Memory unification slice 2: scope, CRUD and revisions #37

Closed
opened 2026-10-27 13:34:41 +00:00 by sam · 0 comments
Owner

Prerequisite: slice 1.

The internal/domain/memory contract (Scope{Kind,Agent,User} with Validate/Key;
Subject with Scopes/WritableScopes; Store with Create/Get/Query/List/Update/
Forget/Revisions; Record carrying Scope/Kind/Content/Revision/Author/OriginUser/
Source/CreatedAt/UpdatedAt; Metadata dropped), the builtin engine with per-scope
HISTORY.md, the store relocation to internal/infrastructure/memory/builtin, the
scanner move into the engine (applied in Create and Update), and the curator
rewritten onto agent-user scope.

Update supersedes rather than overwrites: the superseded state is appended to
HISTORY.md before the live block is replaced, so a crash leaves a recoverable
extra history entry, never a lost prior state. Update carries no Scope; Expected
may name the revision being replaced. Forget records a deleted revision first.

Curator: sessioncurator.reviewOne stops writing Identity: sessionID and writes
ScopeAgentUser{AgentID: <session's agent>, UserID: }. The
participant is derived from the session's user-role messages: exactly one
distinct non-empty sender writes; zero (dashboard/webhook) or several (group
chat) write nothing and record why. Ambiguity fails closed.

COLLISION: archie-core-trnd.1 (curator definitions: generic engine +
tool-carrying passes) rewrites the same curator surface. Sequence with it or
land one first; doing both blind means doing curator work twice.

Notes

Slice 2 in flight on branch feat/memory-engine-scope-crud (seam commit d2dfdfef: Scope/Subject/CRUD contract + scanner move + builtin store relocation). Wave 1 lanes: engine (internal/infrastructure/memory), curator (internal/infrastructure/sessioncurator agent-user write), docs (migration-decisions §5 + agent-system pointer). Collision with archie-core-trnd.1 resolved by sequencing: slice 2 lands first because it touches only sessioncurator.go, while trnd.1 rewrites the curator engine/registrar and must preserve the agent-user scope write. Decisions frozen at the seam: live marker becomes JSON carrying full provenance (agent-system.md:97-99 fields); a marker-free block is not a record (incumbent documented behaviour, now tested); HISTORY.md gets its own generous named size bound; the content scanner lives in internal/domain/memory and is applied in Create AND Update; a session with zero or several distinct user-role senders writes nothing and returns ActionSkipped naming the count.
SUPERSEDED (2026-09-19): slice 2 landed on main as #886 (7ee5025d, authored by Sam), together with slices 3-5 (#887-#889). The lane-branch note above describes a superseded local attempt on feat/memory-engine-scope-crud (commits d2dfdfef, db8d0f5f, unpushed, branch since deleted from the shared worktree; objects still recoverable until gc). Main's implementation is the later iteration: it also drops the legacy builtin/provider.go from the relocated store package and adds warn-level scanner coverage. Two defects the local attempt's adversarial review found are LIVE on main and filed: archie-core-ga6i (curator vs turn AgentID mismatch; single-identity deployments fail every pass) and archie-core-pf1g (scanner pattern-table tests lost with internal/memory).

Close reason

Closed


Imported from beads archie-core-2ent.2 · GitHub #851 · type task · priority P1 · created 2026-09-17 · closed 2026-09-19

Prerequisite: slice 1. The internal/domain/memory contract (Scope{Kind,Agent,User} with Validate/Key; Subject with Scopes/WritableScopes; Store with Create/Get/Query/List/Update/ Forget/Revisions; Record carrying Scope/Kind/Content/Revision/Author/OriginUser/ Source/CreatedAt/UpdatedAt; Metadata dropped), the builtin engine with per-scope HISTORY.md, the store relocation to internal/infrastructure/memory/builtin, the scanner move into the engine (applied in Create and Update), and the curator rewritten onto agent-user scope. Update supersedes rather than overwrites: the superseded state is appended to HISTORY.md before the live block is replaced, so a crash leaves a recoverable extra history entry, never a lost prior state. Update carries no Scope; Expected may name the revision being replaced. Forget records a deleted revision first. Curator: sessioncurator.reviewOne stops writing Identity: sessionID and writes ScopeAgentUser{AgentID: <session's agent>, UserID: <participant>}. The participant is derived from the session's user-role messages: exactly one distinct non-empty sender writes; zero (dashboard/webhook) or several (group chat) write nothing and record why. Ambiguity fails closed. COLLISION: archie-core-trnd.1 (curator definitions: generic engine + tool-carrying passes) rewrites the same curator surface. Sequence with it or land one first; doing both blind means doing curator work twice. ### Notes Slice 2 in flight on branch feat/memory-engine-scope-crud (seam commit d2dfdfef: Scope/Subject/CRUD contract + scanner move + builtin store relocation). Wave 1 lanes: engine (internal/infrastructure/memory), curator (internal/infrastructure/sessioncurator agent-user write), docs (migration-decisions §5 + agent-system pointer). Collision with archie-core-trnd.1 resolved by sequencing: slice 2 lands first because it touches only sessioncurator.go, while trnd.1 rewrites the curator engine/registrar and must preserve the agent-user scope write. Decisions frozen at the seam: live marker becomes JSON carrying full provenance (agent-system.md:97-99 fields); a marker-free block is not a record (incumbent documented behaviour, now tested); HISTORY.md gets its own generous named size bound; the content scanner lives in internal/domain/memory and is applied in Create AND Update; a session with zero or several distinct user-role senders writes nothing and returns ActionSkipped naming the count. SUPERSEDED (2026-09-19): slice 2 landed on main as #886 (7ee5025d, authored by Sam), together with slices 3-5 (#887-#889). The lane-branch note above describes a superseded local attempt on feat/memory-engine-scope-crud (commits d2dfdfef, db8d0f5f, unpushed, branch since deleted from the shared worktree; objects still recoverable until gc). Main's implementation is the later iteration: it also drops the legacy builtin/provider.go from the relocated store package and adds warn-level scanner coverage. Two defects the local attempt's adversarial review found are LIVE on main and filed: archie-core-ga6i (curator vs turn AgentID mismatch; single-identity deployments fail every pass) and archie-core-pf1g (scanner pattern-table tests lost with internal/memory). ### Close reason Closed --- _Imported from beads `archie-core-2ent.2` · GitHub #851 · type task · priority P1 · created 2026-09-17 · closed 2026-09-19_
sam added the hightask labels 2026-10-27 13:34:41 +00:00
sam self-assigned this 2026-10-27 13:34:41 +00:00
sam closed this issue 2026-10-27 13:34:42 +00:00
sam added a new dependency 2026-10-27 13:41:40 +00:00
sam added a new dependency 2026-10-27 13:41:40 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Reference: sam/archie#37