Lab note 003 // build log
Memory Without the Transcript Swamp
A plain-English tour of a safer agent-memory pattern: admit less, keep it local, and let retrieval select approved context instead of writing a little novel about you.
Lab note 003 // build log
A plain-English tour of a safer agent-memory pattern: admit less, keep it local, and let retrieval select approved context instead of writing a little novel about you.
Illustrated plumbing diagram
The point is not to remember every byte of a conversation. The point is to admit a tiny amount of useful, durable context through explicit gates, then disclose it in a form that cannot freeload as an instruction.
Wide map: scroll sideways on smaller screens to follow the full signal path.
Retention is fail-closed. If authority, lifecycle state, or validation is ambiguous, nothing is stored.
The retrieval engine can point at an approved memory. It does not get to rewrite, paraphrase, or invent it.
At most one short card enters the current turn, explicitly marked as reference material instead of command text.
The dumb version of memory
The naive agent-memory move is to shovel every conversation, tool call, pasted document, and stray thought into a database, then jam whatever looks similar back into the next prompt. This is great if your goal is to build a haunted attic full of stale instructions, accidental secrets, and extremely confident nonsense.
A useful memory system has a smaller job: preserve the few facts that actually help future work while making it hard for untrusted text to become durable or steer the agent later.
The write side: customs, not a vacuum cleaner
Every possible memory starts as a candidate, not a fact. A source gate checks whether the conversation surface is allowed. A candidate filter rejects things that look like secrets, pasted instructions, raw transcripts, identifiers, or conversational debris. Only a short, stable, declarative claim may reach the local memory engine.
If the guard is unavailable, the lifecycle has expired, the source is ambiguous, or the candidate is malformed, the system writes nothing. The normal chat reply still works. That is the important inversion: a memory failure should make the agent forgetful, not broken.
The read side: selector, not author
Retrieval is treated as a selection problem, not a writing assignment. The local engine can return an opaque match that says, effectively, 'this approved memory may be relevant.' A separate trusted-card store resolves that match to the exact text that was approved at write time.
That means the retrieval engine does not get to paraphrase the memory, merge it with unrelated material, or sneak a fresh instruction into the model context. It can point. It cannot narrate.
The final mile
The current turn receives at most one small advisory card in a fixed reference-only wrapper. The wrapper matters. It tells the model that this is background context, not a new command from a mysterious voice in the wires.
The result is deliberately unglamorous: less 'agent with infinite recollection' and more 'competent colleague who remembers the one preference that actually matters.' That is a feature. The job is continuity without turning every old sentence into an authority figure.
Public mask, private brainstem
The diagram above shows the pattern, not a production treasure map. It leaves out private surfaces, identifiers, host details, credentials, provider settings, operational paths, and the very specific knobs that make a local deployment local.
Good public architecture writing should teach the shape of the machine without handing strangers a flashlight and directions to the basement.