Three-Tier Agent Memory: Provenance, Corrections, and Retrieval Quality

한국어로 읽기

TECH INSIGHT / EXPLAINED

“Use the decision from last time” requires more than a longer recent-message window. The system needs to find who decided what, when, and in which source, then check whether it is still valid.

Three people explain current conversation cards, past-session notebooks, and a relationship graph.
AI-generated conceptual illustration. Three people explain current conversation cards, past-session notebooks, and a relationship graph.

Local execution of the actual project

These captures show the existing project UI or functions executed locally with non-private sample inputs. Each caption states the scope of the execution.

The original GoClaw web app running locally, displaying the paths and global/personal scopes of two sample memory documents. No real conversations or private notes were read; embedding search was not connected.
The original GoClaw web app running locally, displaying the paths and global/personal scopes of two sample memory documents. No real conversations or private notes were read; embedding search was not connected.

Separate storage shape from loading depth

Working memory can represent the ongoing conversation, episodic memory past events and decisions, and semantic memory verified facts and relationships. Semantic memory need not be a graph or be permanent. Every tier needs correction, deletion, and access controls.

One loading design uses L0 for short relevance hints, L1 for selected details, and L2 for relationship exploration. These names are application choices. Leave even L0 empty when nothing is relevant, and budget tokens and search time separately at each depth.

A one-line memory still needs provenance

“Project A uses Go” alone does not reveal whether that was a proposal or a confirmed decision. Store source_id, source_version, observed_at, subject_id, access_scope, status. When a proposal becomes final, update the fact and retain its relationship to earlier evidence.

Instructions quoted inside a retrieved document remain data, not execution authority. Preserve origin and trust boundaries when injecting memories. A private-chat memory should not automatically become quotable in a public conversation merely because the same user is present.

A 7:3 retrieval mix is not a universal answer

Keyword and vector scores can have different ranges and meanings. Adding them at weights 0.7 and 0.3 without normalization can let one dominate. Use rank fusion or calibrated scores and evaluate names, project codes, and pronoun-heavy questions. A short but meaningful “what about that?” should not be discarded by a simple length filter; use bounded recent context.

For an illustrative set of 20 queries, track 15 successful evidence retrievals separately from four irrelevant injections. Maximum score and injected-item count alone do not measure accuracy.

Characters are not tokens

Slicing a UTF-8 Go string at an arbitrary byte can split an encoding. Rune-based slicing preserves code-point boundaries, but not necessarily a displayed grapheme such as a combining sequence or emoji. Two hundred runes are not reliably fifty tokens. Use the target tokenizer or conservative measured budgets.

Asynchronous memory needs recovery and deletion

Moving summarization and entity extraction off the response path can reduce latency, but the next question may arrive before they finish. Use event IDs and source versions to prevent duplicate handling and stale overwrites, and retry failed jobs. Deletion must cover derived summaries, embeddings, and graph records as well as originals. Similar names alone are not enough evidence to merge two people.

Connecting document records and relationship retrieval

References

Content and examples reviewed: 2026-09-29

댓글