Proposal: expose bounded memory_search and memory_get over the existing memory_item store #4426
Replies: 1 comment 1 reply
|
I think this proposal starts from the wrong question. The user problem is simple: a user should not need to repeat durable preferences, project facts, and prior decisions across conversations. The current implementation gap is also concrete: Maka already has The shortest falsifiable path is therefore: This proposal replaces that question with a much larger one: what generic platform capabilities must exist before a perfect stateful Memory Plugin can be built? That conflates three separate projects:
The Plugin boundary is a deployment and ownership decision. It is not evidence that Tool contribution, generic Plugin state, RuntimeEvent observation, Context contribution, background work, and a new governance projection must all precede useful memory. Requiring all six turns a missing read path into a platform program. The three-plane model is a reasonable description of authority, but it does not justify three engineering subsystems. For the first useful slice, I would reset the proposal to the following sequence:
Scope isolation, Incognito, bounded results, provenance, and fail-closed behavior are necessary safeguards and should remain. The rest has not yet earned its complexity. If the real objective is to use Memory as the forcing function for a Stateful Plugin Platform, that is a legitimate but different proposal. It should be named and justified as a platform investment, with Memory as its validation consumer. It should not present the full Extension Runtime roadmap as if it were a prerequisite derived from the memory product problem. So I do not think the current prerequisite framing should be accepted. First connect the read side that already exists in storage, measure what it solves, and let concrete failures pay for each additional layer. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Summary
A user should not need to repeat a durable preference, project fact, or prior decision in every conversation.
Maka already extracts atomic items and stores them with keys, Scope, temporal state, lifecycle, and
RuntimeEventprovenance. The missing product link is smaller: the Agent cannot search or read those accepted items.The proposed first slice is therefore two bounded, Host-owned model tools over the existing store:
memory_search— find active Items by exact or prefix key under the current Runtime-authorized Scope;memory_get— read one authorized Item by ID with its current version and provenance metadata.No storage migration, Plugin migration, derived memory layer, vector dependency, or new background process is required.
Current implementation gap
At the reviewed
maincommit, Maka already has:memory_itemrecords withglobalandworkspaceScope, temporal fields, lifecycle state, typed keys, and source event identities;MemoryItemStore.readItem(itemId);MemoryItemStore.searchByKeys({ terms, match, workspaceKey, includeArchived, limit });memory.enabledandmemory.agentReadEnabled, with Agent reads disabled by default;What it does not have is a model-facing tool wired to
readItemorsearchByKeys. The current prompt projection reads the separate local-memory document; it does not expose the accepted SQLite Item store to the Agent.This proposal connects that existing read capability. It does not redesign the memory lifecycle.
Proposed first slice
1. Runtime Host owns authorization
Runtime Host derives the current Workspace identity and applies Runtime Policy before a tool is admitted or executed.
workspaceKey, Profile ID, Session ID, or another caller-selected Scope.memory.enabled = false, ormemory.agentReadEnabled = falsemakes the read tools unavailable or returns a policy-denied result without querying storage.2.
memory_searchSuggested input:
V1 should preserve the current store semantics: match any distinct normalized term and rank by the number of matched terms. The model-facing limit should default to 5 and be capped at 10, below the storage ceiling.
Each result should contain only what is needed to choose or use an Item:
The output must have a hard aggregate size limit and an explicit truncation indicator. It must not expose records from a broader Scope when the result budget is exhausted or a Scope identity is unavailable.
3.
memory_getSuggested input:
The Host resolves the Item, checks that it is active and belongs to Global or the current Workspace Scope, then returns the current Item, keys, version, temporal state, and source identities. A missing, archived, or unauthorized Item should produce the same non-disclosing not-found result.
memory_getdoes not retrieve raw event content. Source-range recall is a separate capability that should be added only if evaluation shows that Item content and provenance identities are insufficient for trustworthy answers.4. No implicit prompt injection
This slice adds explicit tools only. It does not automatically inject SQLite Items into every prompt and does not change the existing local-memory document projection.
That keeps cost and behavior observable: an Item enters model context only through a recorded tool call and bounded tool result.
Acceptance gates
Deterministic CI
memory_searchand indistinguishable from missing Items inmemory_get;Capability evaluation
Use fixture conversations in which a later Session asks about a durable preference, project fact, or prior decision established in an earlier Session.
Compare:
memory_search/memory_get.Report:
The first slice succeeds only if it improves later-session continuity without increasing unsupported claims or Scope leakage.
Explicit non-goals
The following are not prerequisites and are not part of this proposal:
What would justify another layer
Additional mechanisms should be proposed only against a measured failure:
Questions for maintainers
memory_search/memory_getpair the right smallest next slice under Title: feat(memory): add an automatic long-term memory lifecycle #1615?memory.agentReadEnabledgate both tools, matching the existing Agent-read authority?sourceCountuntil a source-range design exists?Relationship to existing work
References
maka/packages/core/src/long-term-memory.ts
Lines 75 to 111 in 3db83c2
maka/packages/core/src/long-term-memory.ts
Lines 295 to 332 in 3db83c2
maka/packages/storage/src/sqlite-long-term-memory-store.ts
Lines 842 to 885 in 3db83c2
maka/packages/core/src/runtime-policy.ts
Lines 128 to 130 in 3db83c2
All reactions