Command Palette

Search for a command to run...

crossxrGitHub
Blog

Your agent's memory is lying to it

research
0views

Everyone is teaching agents to write memory. Almost nobody checks whether that memory is still true. Research notes on verified, calibrated agent memory, why coding agents are the place to start, and what we are building.

Your agent's memory is lying to it

Open a coding agent in your repo with memory switched on, and watch what it does first. It sends sub-agents to re-read the codebase, the same codebase it explored yesterday and the day before. The agent is not being dumb, it is being careful. It has memories, but no way to know whether they still hold. A note saying "auth lives in lib/auth" was true last week, and since then someone may have moved the folder, so the only safe move is to look again, which is slow and expensive.

That small, daily annoyance points at the biggest problem in agent memory. Agents do not forget. They remember things that are not true anymore, and they cannot tell which ones. We have spent the past week researching this, and the "we" here is me and my research co-worker @soubhagyaranjanpanda on Instagram, who will also be writing the next updates on this work for this blog. These research notes, the second draft, cover what we learned, where our thinking changed, and what we are building.

Where agent memory is today

Most memory products, including Mem0, Supermemory and Zep, follow a similar pattern. They extract facts from conversations and store them, and when the agent needs something, they search for related text and paste it into the prompt. That works better every year. The top systems now score 92 to 95 percent on LoCoMo and LongMemEval, the two standard benchmarks, which are close to saturated.

Mem0's own State of AI Agent Memory 2026 report, though, lists problems that search does not touch. Facts that were once relevant become confidently wrong as they go stale, systems overwrite facts instead of tracking how they evolve, and accuracy drops by about a quarter between one million and ten million tokens of history. All three come from one gap. A retrieved memory comes with a relevance score, which says how well it matches the question, and nothing about whether it is still true.

relevance is not truth

  • Retrieval memory
  • Similarity search
  • Illustrative

The agent needs the user's city, so the memory layer searches stored facts for text that looks like the question.

Illustrative memories. Retrieval scores how close a stored fact is to the question, so a stale fact can rank first.

The idea everyone now shares

Our first idea was to put a small, specialised model inside the memory layer. It would decide what context the big model, whether Opus, Fable or GPT, actually needs, instead of returning search results. Part of the inspiration was Jev, a System One model from TypeSafe AI covered in an earlier post on this blog, which fills a predefined schema and attaches an honest probability to each answer, making it fast, cheap, typed and calibrated.

Then we read the field and found that this direction is already crowded. Memory-R1 and AgeMem train models with reinforcement learning to add, update and delete memories. UMA trains a single policy to maintain a structured memory bank, rewarded by how well later questions are answered, and T-Mem predicts at write time how a memory will be searched for later. Letta pioneered sleep-time compute, where memory is reorganised offline, and in June 2026 it went further with Memory Models: Towards Agents That Learn. That post argues for specialised models that create and curate memory, trained with what Letta calls memory-native RL, with memories generated offline through "agent dreaming" and carried across model generations.

Letta has also shipped the file-based half of this for coding agents. Its Context Repositories, released in February 2026, store an agent's memory as a folder of files versioned with git. Memory swarms of subagents each write memory in their own git worktree, their changes are merged back with git, and background jobs reflect on recent conversations and defragment memory into a tidy set of files. It can even bootstrap memory from your existing Claude Code and Codex histories.

Letta's work is strong, and much of it matches where we started, which is exactly why it changed our plan. Building the model that writes memory is now a well-funded race, and we are not going to win it by entering late. The memory models post also names the problem holding everyone back, memory rot, and its open questions include how to make memories that generalise instead of degrading over time. What neither post discusses is verification, meaning how anyone knows whether a memory is still true. That is the half we are building.

The missing half is memory you can verify

The part of Jev that matters for memory is not its size but its calibration. So instead of giving agents text, we give them beliefs with a confidence attached, tied to their sources:

"current_city": {
  "value": "Bangalore",
  "p": 0.41,
  "status": "stale",
  "as_of": "2025-08-02",
  "evidence": ["ep_12", "ep_37"]
}

With a probability of 0.41, the agent knows to ask "Are you still in Bangalore?" instead of planning around a fact that may be a year out of date. A search-based system would return the same sentence with high relevance and no warning.

Mem0 has published a guide to memory confidence that describes confidence rising when a fact is reinforced, falling when it is contradicted, and retiring the fact when it is superseded. It is a good sign that the industry is heading this way. But Mem0 has no built-in confidence field, the example scores are set by hand, nothing checks them against reality, and a fact that is never mentioned again keeps its score forever. Our design adds the two things that make confidence trustworthy. The first is decay over time, because a job title goes stale at a different rate than a birthday or a current project, and those rates are learned. The second is calibration against reality, where every score is checked against what turns out to be true later, so that a belief marked 0.8 is right about 80 percent of the time.

a belief with odds

  • Belief ledger
  • Reinforce · decay · supersede
  • Illustrative

The user mentions their city in a chat. It becomes a belief with a value, a probability that it is still true, and a link to the episode it came from.

One belief over fourteen months. Confidence rises with evidence, decays with silence, and an answer from the user replaces it while keeping the old value on record.

Where it hurts most today is coding agents

General personal facts are hard to verify, but code is not. Every claim an agent makes about a codebase can be checked against the code itself, and that makes coding agents the right place to start. Tools like Cursor already keep the raw code index fresh with a Merkle tree of file hashes, so only changed files get re-indexed, and Letta's Context Repositories keep a full git history of the agent's notes. But what an exploration agent rebuilds each session is understanding, things like "auth goes through this middleware, then requireRole()", "tests run with this command" or "routes are only registered in this one file". Nobody caches that understanding with proof that it still holds. Letta's git tells you when a note was edited, but it cannot tell you that the note stopped being true, for example when someone renamed the function it describes two days later, because the notes are versioned against themselves rather than against the code.

We treat understanding the way a build system treats compiled code. Every belief records what it was derived from, meaning the exact files, functions and searches the agent used, captured automatically from its tool calls, along with a hash of each function's code and the commit it was verified at. At session start, a git diff plus re-hashing takes well under a second, and each belief lands in one of four states. A belief is fresh when every input is unchanged, so it is reused because it is still true by construction. It needs a re-check when an input function changed, in which case a small model reads the old belief and the diff and confirms or revises it. It is stale when an input was deleted or restructured, so the agent re-explores just that area. And where no belief covers the question, that is a gap, which the agent explores normally before saving the result with its inputs.

proof of freshness

  • Coding agents
  • Session start
  • Illustrative

Each belief from the last session records exactly what it was derived from: the files and functions the agent read, their hashes, and any searches it ran.

An illustrative repository. Understanding is cached like build output: re-checked only when the inputs it was derived from change.

Claims about absence get their own check, because a belief like "routes are only registered here" depends on a search, so we re-run the search and compare. Beliefs also follow code branches. A belief verified on a feature branch stays on that branch, and when the pull request merges it is re-verified against main before the rest of the team sees it. All of this work can happen before you open the session, from git hooks or idle time, so the agent gets a verified summary the moment the session starts. In Claude Code, a SessionStart hook plus an MCP server is enough, and no changes to the agent are needed.

If every input an agent read is unchanged, re-exploring would read the same code and reach the same conclusion, so accuracy can match a full re-map at a fraction of the cost. We will not just assert that. We will audit it by re-deriving a random sample of fresh beliefs from scratch and publishing the error rate.

The same check works on the files agents already use as memory. Letta notes that the harness itself is a form of memory, which in practice means CLAUDE.md, AGENTS.md, skill files and Letta's context-repository files, and they rot constantly as the test command gets renamed or the folder a file describes gets moved. Flagging those stale lines is our first, free product.

The architecture, briefly

The full system is designed like a brain, because the brain solved the efficiency problem long ago. It runs on about 20 watts because a fast, cheap system handles most of the work while a slow system consolidates in the background, an idea neuroscience calls Complementary Learning Systems theory (McClelland and colleagues, 1995).

At the top is the interface, an SDK, a REST API and an MCP server, and memory can also be rendered as plain AGENTS.md or CLAUDE.md files for agents that only read files. The fast path runs on every turn, where a small calibrated model fills typed requests from a precompiled working set with a target of under 100 milliseconds. It sizes the context for whichever model reads it, because IBM's ALTK-Evolve work shows that smaller models do better with less, carefully chosen memory. Underneath sits the belief ledger, where every belief records when it was true and when we learned it, along with its confidence, evidence count, decay rate, trust level and sources. Nothing is overwritten, and old beliefs are superseded so that history stays queryable.

An offline cycle extracts facts, reconciles conflicts, applies decay, turns specific cases into general rules, re-verifies beliefs and precomputes what the fast path will need. A learning loop turns user corrections, ask-user answers, audits and re-checks into exact labels for training the small verifier models. And governance runs across all of it, since every write is validated and tagged by source, so content from emails or web pages cannot override what a user said without confirmation, because memory writes are an attack surface. The latency and token figures in our design are targets, not measurements.

six parts

  • Brain layer
  • Design, not measured

Agents reach the layer through an SDK, REST or an MCP server. Memory can also be rendered as plain AGENTS.md or CLAUDE.md files for agents that only read files.

The full system, designed like a brain. Latency and token figures are targets, not measurements.

How we compare

These tables reflect what we found in each system's own papers, posts and docs. A dash means our reading did not cover it, not that the feature is missing, and the results come from different benchmarks and setups, so they cannot be compared directly.

SystemHow it worksChange over timeConfidence per factChecked against realityReported results
Mem0An LLM extracts facts on write. Retrieval fuses semantic, keyword (BM25) and entity matching.Updates or replaces factsOnly as user-defined metadata, set by hand (guide)No92.5% LoCoMo, 94.4% LongMemEval (self-reported)
SupermemoryRetrieval-based memory API———85.2% LongMemEval (third-party comparison)
Zep / GraphitiTemporal knowledge graph built from conversations and business dataYes, every relationship has a validity windowNoNoUp to 18.5% higher accuracy and 90% lower latency on LongMemEval vs. baseline (paper)
LettaThe agent manages its own memory, with sleep-time compute offline. Now pursuing memory models trained with memory-native RL.Background reorganisation. Names memory rot as an open problem.NoNot addressed in the postSleep-time compute: about 5× less test-time compute (paper). Memory models: no results yet.
LangChain Agent BuilderMemory as files (AGENTS.md, skills, tools.json) in a Postgres-backed virtual filesystem, edited during runs with user approvalThe agent edits files; background reflection is plannedNoSchema validation onlyNone published
Memory-R1, AgeMem, UMAModels trained with RL to add, update and delete memoriesA learned update policyNoRewarded by answer quality, not by whether each fact is trueUMA: highest average among compared methods at a 16k budget (paper)
ALTK-Evolve (IBM)Distils completed runs into guidelines and sizes how many each model getsLLM-based conflict resolutionNoMeasured by task successDeepSeek-V3.2 on AppWorld: 89.3 / 80.4 vs ACE's 80.4 / 73.2, at 263K vs 634K tokens per task (IBM, single run)
Ours (planned)Verifies memory written by any system. Each belief is tied to its sources, re-checked only when those change, and served through typed requests.Validity windows, reinforce, revise and supersede events, and learned decay over timeYes, on every fieldYes, through source checks, scoring against later outcomes, and random auditsNone yet; our figures are design targets

For coding agents specifically, the picture looks like this.

ApproachWhat it keeps freshWhat it misses
Cursor codebase indexingThe raw code index. A Merkle tree of file hashes means only changed files are re-indexed.The agent's understanding of the code is not cached, so it is rebuilt each time.
Claude Code memoryCLAUDE.md and AGENTS.md instructions you write, plus auto-memory notes Claude writes, all loaded at session startNothing ties a note to the code it came from, so notes have to be re-checked, often by re-exploring.
Letta Context RepositoriesThe agent's notes, as git-versioned files written by parallel subagents, with background reflection and defragmentationNotes are versioned against themselves, not the code, so a note can go stale without anything changing in memory. Staleness and verification are not discussed.
Mem0's coding-agent guideRecommends timestamps, preferring recent memories, and checking memories against the current repoChecking is left to the agent, which in practice means re-exploration.
Ours (planned)The agent's understanding. Each belief is tied to the exact functions and searches it came from, and re-checked only when those change.Inputs the agent never read, such as runtime config or external services. We track lockfiles and config as inputs for every belief, and audit samples.

The pattern across both tables is that others keep raw data fresh or decide what to write. Nobody we found ties derived understanding to the exact inputs it depends on, or gives each belief a probability that is measured against reality.

The real moat

The honest test for a moat is whether Letta, Mem0 or a frontier lab could copy it in a quarter. A model that writes memory, or offline consolidation, fails that test, because Letta, Memory-R1, AgeMem and UMA already cover it. Git-versioned memory files and parallel memory-writing agents fail it too, since Letta's Context Repositories already ship them, and vector and graph databases or a file-level code index are commodity. Labels mined from public git history are reproducible by anyone, Letta included, which makes them good for a benchmark but not for a moat, and the benchmark itself is valuable for distribution and for setting the standard, but anyone could build one.

Four things pass the test. The first is team-shared verified memory, which works as a network effect inside every customer. Sharing alone is not the moat, since git can do that, as Letta shows, but shared memory without verification spreads rot, because one agent's stale belief misleads every teammate's agent. Verification is what makes sharing safe. When one developer's agent explores the payment service, every teammate's agent gets that verified understanding for free, each session refreshes beliefs for everyone, value grows with every seat, and leaving resets the whole team's agents to zero.

The second is becoming the system of record for what agents believed. The ledger keeps history, so it can answer what the agent believed, when, and why it acted. As agents take real actions inside companies, that audit trail becomes something legal and compliance teams require, and regulations such as the EU AI Act already impose record-keeping duties on high-risk AI systems. Once a company's audit trail lives with us, it stays. The third is labels from private deployments. We learn which beliefs real agents form on private code, how fast each kind goes stale, and which re-checks were wrong, and those labels only build up for whoever runs in production. They train our verifier models, and while the architecture can be copied, the calibration cannot. The fourth is neutrality across harnesses. Letta sells its own harness, and Claude Code, Cursor and Codex compete with each other, so none of them can be the verification layer for all the others, while we can, including for Letta.

The strategy fits in one sentence: give away the checker and the benchmark to win developers, then sell the shared memory each team builds on and the audit trail, both of which get more valuable the longer a team uses them. This also changes how we relate to the teams building memory models. Their training needs a reward signal, and "did the agent finish its task?" is a sparse and noisy one, whereas our labels are dense and exact, because they answer whether a memory was still true when checked against the source. Teams training memory models are potential partners, not just competitors.

What we are shipping next

The first phase is an open memory-rot benchmark, built by replaying real repositories across their git history, together with a free checker that flags stale lines in CLAUDE.md, AGENTS.md and Letta context-repository files, and we will judge it by whether developers adopt the checker and the benchmark gets cited. The second phase is verified code memory shared per team, shipped as a Claude Code plugin and as an MCP server for Cursor, Codex and Letta, and the number that decides whether it works is fewer exploration calls per session and less time to the first useful action at equal audited accuracy.

The third phase is calibrated verifier models trained on private labels, which have to show lower calibration error than rule-only checks. The fourth goes beyond code, to business and personal facts, to routing simple turns away from the frontier model, and to audit exports, measured by fewer stale facts reaching the model and fewer frontier calls at equal task success. We will publish the benchmark and our audited error rates, including if the numbers disappoint us.

We are early, and several numbers in this post are design targets rather than results. If you are building agents, memory models or coding tools and want memory you can verify, we would like to talk. You can also follow the research as it develops through @soubhagyaranjanpanda on Instagram, ahead of the next update here.

Sources: from Letta, Memory Models: Towards Agents That Learn, Context Repositories and Sleep-time Compute. On Jev, write-ups from TrueFoundry and DigitalOcean and the Pydantic docs. From Mem0, the State of AI Agent Memory 2026, the 2026 AI Memory Benchmark Guide, Confidence scores in agent memory and AI coding agents that remember your codebase. Supermemory's large-repo coding agent memory bottleneck, LangChain's How we built Agent Builder's memory system, and IBM Research's ALTK-Evolve vs ACE with ALTK-Evolve on GitHub. The papers Learning to Remember (UMA), Agentic Memory (AgeMem), Memory-R1, T-Mem and Zep. Cursor's Securely indexing large codebases, the Claude Code memory and hooks docs, DEV's 5 agent memory systems compared, and McClelland, McNaughton and O'Reilly (1995), "Why there are complementary learning systems in the hippocampus and neocortex", Psychological Review 102(3).

Enjoyed this article?

Leave a like to let me know this was valuable to you.

Get new posts by email

One email when a new article goes up. Unsubscribe anytime.

Discussion

(0)

No comments yet. Be the first to share your thoughts.

Command Palette

Search for a command to run...