Skip to main content

Retain / Recall / Reflect

UnifiedMemory uses three product verbs so agents know which job they are doing. They are intentionally separate. Retain changes durable state, recall prepares eligible memory for a turn, and reflect answers a question with retrieved context without silently promoting new memory.

Retain

Retain is the write path. It accepts a compact fact, a post-turn writeback, or a batch of candidate content and turns it into governed memory.

The retain pipeline is:

  1. Capture the submitted content as evidence with source, agent, session, and container metadata.
  2. Strip injected memory blocks so agents do not recursively store their own prompt context.
  3. Classify junk and residue before review creation. Greetings, emoji-only messages, raw assistant dumps, generic web prose, secrets, smoke/eval rows, and lifecycle logs are not actionable memory.
  4. Extract atomic claims, entities, temporal hints, source role, and sensitivity using MiniMax-backed cognition where configured.
  5. Store additive observations first. Reconciliation decides whether a claim is new, supporting, superseding, contradictory, or review-only.
  6. Assign lifecycle state and trust bucket. Caller-supplied confidence and trust_score are compatibility signals, not authority.

Retain should produce facts over transcripts. A good retained item is small, grounded, scoped, and useful on a later turn.

Recall

Recall is the read path. It retrieves memory only after hard eligibility gates run.

The recall contract is:

  1. Resolve effective identity from the key or session, not from a request body override.
  2. Filter by workspace/container, namespace, lifecycle, latest/current state, temporal validity, assistant visibility, agent scope, and trust bucket.
  3. Build candidates from semantic Vectorize search, keyword/entity matches, temporal state, graph relationships, and trusted profile/core facts.
  4. Hydrate candidates from D1 before prompt injection. Vector metadata is a coarse filter, not the final authority.
  5. Return diagnostics such as candidate sources, suppressed items, trust policy, Courtroom links, and why each important memory was included.

Normal agent recall should see its own working/session memory plus approved canonical owner facts. It should not see another agent's private working memory unless a deliberate handoff or shared promotion exists.

Reflect

Reflect is a synthesis path. It recalls eligible memory, assembles a bounded context, and produces a grounded answer.

Reflection may use:

  • trusted current facts;
  • caution facts labeled as weaker evidence;
  • approved observations;
  • active mental models that passed activation gates;
  • Courtroom evidence when the user asks why something is trusted.

Reflection must not:

  • upgrade rejected, stale, forensic, secret-like, test/eval, or superseded rows;
  • treat Google Memory Bank output as automatic truth;
  • convert its own answer into durable memory unless a separate writeback call captures a useful atomic outcome;
  • hide uncertainty when evidence is missing.

Use reflect when the caller wants an answer. Use recall when the caller wants memory context. Use retain or writeback when the caller wants to save a useful fact.

Example lifecycle

Next steps