Why agent memory returns stale facts, and how write-time supersession fixes it

The Serena TeamEngineering6 min read

By The Serena Team

A memory demo stores a fact and retrieves it. A production memory system has to survive the fact changing.

Real workspaces do not stay static. People change jobs, launch dates move, policies get replaced, and the same person or project appears under shortened names across notes, threads, and connected tools. When an agent asks a current-state question like "Who owns the Q4 release?" or "What is the current launch date?", an append-only vector or keyword store has a structural problem: every historical version of that fact matches the entity in the query.

When outdated versions stay active in the index, reranking at read time can push the newest revision to the top slot while still leaking older, contradicted revisions into the rest of the context window. Once contradicted statements sit side by side in the prompt, the agent has to guess which one still holds.

Why read-time reranking is not enough

Adding recency weights or time-based reranking to an append-only store treats a storage problem as a ranking problem.

Consider what happens when a project changes owners twice in one quarter. An append-only memory index now holds three separate statements that all share the same project name and the same ownership wording. A query for the current owner retrieves all three. Even if a recency boost puts the third statement in position one, the two superseded statements still land in positions two and three of the retrieved context window.

Two failures follow from that layout:

  • Context contamination: The agent reads the current owner and two former owners in the same prompt, inviting hedging or wrong citations whenever wording varies slightly.
  • Relevance distortion: Pushing recency hard enough to suppress older facts can overwhelm exact lexical matches on unrelated queries, surfacing recent noise ahead of a durable constraint that was written months earlier.

Keeping active retrieval clean requires separating current truth from historical audit records at write time, and governing when a new statement is allowed to replace active truth.

Write-time supersession with full audit history

Instead of appending every update into the same active retrieval pool, Serena AI separates the active slot from the audit log at write time and gates replacement on authorization.

Automatic capture does not silently overwrite active team truth. When background capture extracts a statement that differs from an active memory, Serena leaves the active revision untouched and records a reviewable conflicting proposal, even when the entity resolves unambiguously.

In-place supersession takes effect through an authorized correction or trusted cited write when no open contradiction blocks activation. At that point, the engine marks the prior revision as superseded and activates the new revision in place. Active retrieval queries only the active revision. Superseded revisions are never deleted; they remain preserved in audit storage so people can inspect what changed, when it changed, and why, or roll back a mistake.

This gives teams two properties that append-only indexes struggle to combine:

  • Clean top-k context: Active retrieval returns the current decision, owner, or deadline instead of filling the context window with every earlier draft of the same fact.
  • Traceable history: Audit history stays complete without polluting everyday agent lookups or letting unreviewed captures mutate live truth.

On the read path, exact identity matching and entity bindings narrow retrieval directly onto known workspace entities alongside lexical search, rather than relying only on broad similarity search across the whole workspace.

Calibrated hybrid ranking

Lexical search and freshness solve different jobs, and they break when their scales collide.

In Postgres full-text search, ts_rank_cd produces raw scores that can sit in a narrow numeric band compared to a naive recency bonus. If freshness is added on an uncalibrated scale, a recent but weakly relevant note can outrank an exact match on a standing policy or architectural decision.

Serena combines bounded, weighted retrieval signals: exact identity match, entity match, calibrated lexical ts_rank_cd, bounded freshness, retrieval utility, and epistemic confidence. Because freshness carries a bounded lower weight than exact, entity, and lexical relevance, recency helps surface timely context without drowning out an exact match on a durable constraint.

Separating extraction, deterministic resolution, and activation

Write-time supersession is only safe if each stage of the write path does one narrow job and fails closed on ambiguity.

Serena splits the write path into three distinct stages:

  • Model-backed candidate extraction: Automatic capture uses a lite language model at temperature zero to extract candidate statements and verbatim evidence excerpts from incoming source text, filtering likely secrets and requiring verbatim grounding in the source.
  • Deterministic scoped alias resolution: Once a candidate identity key is extracted, Serena resolves shortened surface forms deterministically against the workspace entity inventory with zero LLM calls, using general English token rules: leading token matching (first name against a unique full name), head token matching (distinct surname or primary noun), initial plus head matching (such as R. Chen), and prefix or suffix phrase matching for shortened project and document names.
  • Active-state protection and authorized supersession: Unreviewed automatic captures that conflict with an active memory become reviewable proposals instead of mutating live truth; authorized corrections and trusted cited writes supersede the prior revision in place while keeping full audit history.
Three-stage architecture diagram showing model-backed candidate extraction with verbatim evidence, deterministic token alias resolution against the scoped entity inventory with zero LLM calls, and write-time supersession where authorized corrections activate the new revision while preserving prior revisions in the audit log. Fail-closed branches leave active truth untouched when an alias is ambiguous or when an automatically captured update differs from an active memory, routing both to reviewable proposals.
Three-stage memory write path: model-backed candidate extraction, deterministic scoped alias resolution with zero LLM calls, and active-state protection where automatic capture proposes conflicts while authorized corrections supersede in place.

Deterministic matching encounters a predictable edge case: genuine ambiguity. If a workspace has two teammates named Robert, a message reading "Robert moved the handoff to Friday" cannot be safely assigned to either person by string rules alone.

Serena applies a strict fail-closed ambiguity policy. Whenever a shortened mention matches two or more candidate entities, the resolver refuses to merge or overwrite any live revision. It leaves existing active records intact and routes the ambiguous update to review so a person can confirm or correct the link.

Even when a mention resolves unambiguously to one entity, an automatically captured statement that differs from active memory still routes to a reviewable conflicting proposal rather than overwriting active truth silently. In knowledge work, surfacing a clear conflict for human judgment is strictly safer than letting background automation overwrite the wrong record.

Human ownership and authorized corrections

No automated memory pipeline resolves every conflict on its own. Real organizations change direction in side conversations, reverse earlier calls, and refine terminology as projects mature.

That is why write-time supersession is paired with explicit human control:

  • Reviewable proposals: Both ambiguous aliases and conflicting automatic captures wait for explicit resolution rather than mutating shared state silently.
  • Authorized replacements: Activating a replacement requires an authorized correction or trusted cited write so a single unverified mention cannot quietly rewrite an accepted team decision.
  • Cheap, durable steering: Once a person resolves a conflict or records an authorized correction in the shared work record, the active state updates once and every person and agent downstream reads the same current truth.

Key takeaways

  • Read-time reranking on an append-only store can improve the top result while still leaking superseded facts into the rest of the context window.
  • Separating extraction, deterministic resolution, and authorized activation keeps background capture from silently overwriting active truth.
  • Write-time supersession preserves full audit history while exposing only the active revision to retrieval once an authorized correction or trusted cited write takes effect.
  • Combining exact match, entity match, calibrated lexical ts_rank_cd, and a bounded lower-weight freshness term keeps recent noise from outranking exact matches.
  • Deterministic token canonicalization resolves unambiguous aliases with zero LLM calls, while fail-closed ambiguity and conflict checks route unclear updates to human review.

Frequently asked questions

Why not delete superseded facts instead of archiving them?

Deleting old revisions destroys accountability. Teams still need to know what the earlier decision was, when it changed, and why. Keeping superseded rows in audit storage while excluding them from active retrieval gives agents clean current context without losing history.

Does the memory write path use an LLM?

Automatic capture uses a lite language model at temperature zero to extract candidate statements and verbatim evidence excerpts from source text. Once an identity key is extracted, scoped alias resolution runs deterministically against the workspace entity inventory with zero LLM calls, and genuine ambiguity fails closed to human review rather than asking a model to guess.

Can an automatically captured update overwrite an active team memory?

No. Even after an alias resolves unambiguously to one entity, if an automatically captured statement differs from an active memory, Serena leaves the active revision untouched and records a reviewable conflicting proposal. In-place supersession takes effect through an authorized correction or trusted cited write.

What happens when two people in a workspace share the same first name?

Because the short form matches more than one candidate entity, the canonicalizer refuses to guess. Existing active memories stay untouched, and the incoming update is held for review until someone confirms which entity it applies to.

When will benchmark numbers be published?

We are keeping benchmark metrics separate while we finish validating our live production memory engine end to end. Once that validation is complete, we will publish a dedicated evaluation post with reproducible methodology and full results.

Put this into practice

Serena keeps tasks, notes, projects, and your calendar in one workspace, so the plan you make in the morning is still readable when the day changes.
Start free