How to Make an Agent's Memory Let Go of Old Values
When a fact changes, an agent's memory has to do three things in a row: resolve the new statement to the same entity and fact as the old one, actually extract the new value instead of reading it as a repeat, and then rank the current value above the old one at retrieval time. Most memory layers handle the first well and the other two badly. In our tests, fixing the second step with explicit extraction guidance and fixing timestamp precision moved "newest value wins" from 1 of 6 tries to 14 of 21, which is better and still the weakest number in our memory eval.
I'm Mahmoud Zalt, an independent AI architect; my company Sista AI is where I do this kind of agent internals work.
The system here is the conversation memory behind Sistava, built on Graphiti, a temporal knowledge graph on Neo4j. The full evaluation, including every memory number below, is published in Sistava's research report How We Evaluate AI Employees. This article is the engineering story behind those numbers.
Why Changed Facts Are the Hard Case
Storing a fact once is easy. The real test is three weeks later, when the client raises the budget, the main contact moves on, or the weekly report moves from Monday to Friday. An agent that keeps quoting last month's budget is worse than one that remembers nothing, because it sounds confident.
In a temporal knowledge graph, a fact is an edge between entities with a valid_at and an invalid_at. When a new fact contradicts an existing one, the pipeline sets invalid_at on the old edge, and search filters on invalid_at IS NULL. That design is right. It only works if all of the following hold:
- Same thing, different words. "The autumn campaign budget" in session one and "their budget went up" in session three must resolve to the same entity and a comparable fact. That is entity resolution plus edge deduplication.
- The update is extracted at all. A new value often arrives in a sentence that mostly restates known context. If the extractor treats it as a repeat, no new edge exists, so there is nothing to contradict the old one.
- Both facts live in one consistency scope. Deduplication and contradiction detection run inside one graph group. If the two statements were written to different groups, they are never compared.
- Retrieval prefers the current edge. The original fact often shares more words with the question than the terse update does, so hybrid search can rank the old edge first if it is still valid.
None of these fail when you test memory inside one conversation. They only fail across sessions, days apart, which is exactly how people use agents.
The Eval: Changed Facts Across Sessions
Our memory eval replays six sessions between staff of a fictional marketing agency and an agent: a kickoff, project updates, a round of changes, team news, one private chat with a different member, and one chat in a different workspace. Then it fires 22 probes in six categories: recall, update (newest value wins), forgetting (a corrected or retracted fact is not used), no invention, isolation, and small talk producing no facts. Three probes cover changed facts: a campaign budget raised in a later session, a client contact changed from their e-commerce lead to their marketing director, and a weekly report moved from Monday mornings to Friday afternoons.
Each probe is scored three ways, and the separation matters:
| Score | What it checks |
|---|---|
| Retrieval | The facts production would actually inject into the reply prompt, pattern-matched: expected value present, outdated or foreign value absent |
| Answer check | A judge model answers from those facts, and the same patterns score the answer |
| LLM judge | The judge grades the answer against a one-line truth |
Extraction uses a model and varies run to run by about one probe, so we compare runs, not single probes, and the published figure is the total across seven runs on the final version.
Three Fixes, One Cause at a Time
| Stage | Change | Newest value won (retrieval) |
|---|---|---|
| 1 | Baseline: one memory scope per chat | 0 of 3, one run |
| 2 | One scope per person and agent | 1 of 6, two runs |
| 3 | Extraction guidance for changed values, second-precision timestamps | 14 of 21, seven runs |
Fix 1: put both statements in one consistency scope
With per-chat scopes, an update in a later chat was written to a different graph group than the original, so the contradiction step never compared them. Retrieval returned two current facts. The fix was to scope memory to one person and one agent across all their private chats, which I wrote up in agent memory should belong to the person, not the chat. It was necessary and nowhere near sufficient: 1 of 6.
Fix 2: stop the extractor reading updates as repeats
To find out why, the eval has a trace mode that writes one JSON line per Graphiti prompt step: entity extraction, entity deduplication, edge extraction, edge deduplication. Reading the traces made the cause obvious. Once earlier chats shared a scope, the extractor received them as previous messages context, saw the budget being discussed again, and dropped the new value as already known. No new edge, nothing to invalidate.
Graphiti accepts custom extraction instructions that are appended to its entity and fact extraction prompts. We added a short guidance block with these rules:
- An update is new information, never a repeat. When the current message gives a new value for something previous messages stated, state the new value as its own fact in the present tense.
- Name the thing that changed, even when it is not a person or a company: a campaign and its budget, a report and its schedule, a deadline, an ad channel, a standing preference. Name it so it reads on its own ("Acme spring campaign"), which gives entity resolution something stable to match.
- State withdrawals as facts. "Acme has not chosen an ad channel yet" is a fact that can retire "Acme wants TikTok".
- Keep separate details separate. When a report arrives and what it looks like are two facts, so moving the day does not invalidate the format.
- Write state, not reported speech. "The campaign budget is 20,000" can be replaced by a later state. "Sam said the budget is 20,000" stays true forever and never conflicts. And no extra "the agent noted it" facts.
The last rule is the one I would put on a poster. Reported speech is the quiet killer of invalidation, because a statement about what someone said never contradicts a later statement about what someone else said. The guidance sits behind its own config switch, so its effect can be measured on and off.
Fix 3: timestamps precise enough to order a quick correction
Conversations are saved as one batched episode, with a timestamp on each exchange. Those stamps were at minute precision while the reference time was at second precision. A value set and changed within the same minute could be read as ending the moment it began, so the update expired itself. Every exchange is now stamped to the second, matching the reference time. It is a small fix with a general lesson: a temporal store is only as good as the clock you give it.
Retire, Do Not Delete
An invalidated fact keeps its validity dates. Normal retrieval only uses current facts, but the agent's on-demand memory search can explicitly ask for superseded facts, which removes only the validity filter, uses a different cache identity, and returns the dates. So "what was the budget before the increase?" has an answer, and "what is the budget?" returns only the current one.
This matters for business agents. "What did we agree in October?" is a legitimate question, and a memory that overwrote values in place could not answer it. It also makes debugging possible: in one of the final runs, 19 facts were stored for the requester and 4 had been invalidated by a later contradiction, and each of those is inspectable with its dates.
What Held, and What Did Not
The fixes did not cost anything elsewhere. Totals across the seven runs on the final version:
| Category | Result |
|---|---|
| Newest value wins when a fact changes | 14 of 21 (67%) |
| Recall of ordinary facts | 60 of 63 (95%) |
| Corrected or retracted fact no longer used | 2 of 2, every run |
| Invents nothing about things never said | 4 of 4, every run |
| Other people and workspaces kept apart | 4 of 4, every run |
| Small talk saves nothing | 9 of 9, every run |
Still, in a third of tries the old value was the one returned. And the failures move around: in one run the budget update held while the contact and the report day failed; in the next, the contact and report day held while the budget failed. That pattern points at extraction variance rather than one broken case. It is also why a regression gate matters here: one is rolling out that compares every release against the last accepted memory scores, so a fix that slips shows up as a drop.
The research report lists changed facts as a named weak spot next to asking before acting on unclear requests and naming sources. Publishing the weak number is deliberate. A memory eval that only reports recall is measuring the easy half of the job.
A Checklist for Your Own Agent Memory
- Test updates across sessions, not inside one. Write probes for a raised number, a changed person and a moved schedule, stated in a later session than the original.
- Score retrieval on its own, with outdated values as a failure condition, not just expected values as a pass.
- Run the eval several times and report totals; single runs of model-based extraction lie in both directions.
- Trace each extraction step before guessing. The cause was invisible in final answers and obvious in the edge extraction traces.
- Write facts as current state, name changeable things as entities, and keep separate details as separate facts.
- Give the store precise time. Match timestamp precision to the reference time.
- Invalidate, do not delete, and let the agent ask for history explicitly.
- Keep live values out of memory. Prices, stock and order status belong in a tool call to the system of record.
If you are building memory for an agent that will work with the same people for months, this is the kind of design and eval work I do in agent development engagements. The full method, models and sample sizes behind these numbers are in How We Evaluate AI Employees, published by Sistava.
Frequently Asked Questions
How does an AI agent update a fact in long-term memory?
In a temporal knowledge graph, the new statement is extracted as its own fact, resolved against existing entities and facts, and if it contradicts an existing fact, the old edge gets an invalid_at timestamp. Retrieval then filters to facts that are still valid.
Why does my agent keep returning the old value?
Usually one of three causes: the update was written to a different memory scope than the original, the extractor treated the update as a repeat and never created a new fact, or retrieval ranked the old fact higher because it was still marked valid. Trace extraction per step to see which.
Should agent memory delete outdated facts?
No. Invalidate them with timestamps. Current facts serve normal answers, and superseded facts remain available when someone asks how something changed.
How do you evaluate changed facts in agent memory?
Replay multi-session conversations where values change in a later session, then probe what retrieval returns. Count a probe as passed only if the new value is present and the old one is absent, and total the result over several runs.
What extraction rule helped most?
Writing facts as current state instead of reported speech, combined with naming the thing that changed. "The budget is X" can be invalidated; "Sam said the budget is X" never conflicts with anything.








