The German tech site Golem published a piece about a problem I work on every day: the memory of coding agents. Their example is small and nasty. A project note says "strip leading zeros from article numbers". Later, a partner starts treating 17 and 0017 as two different articles. The code changes. The note does not. The risk: the next agent trusts the note and breaks the import.
I build a memory tool for AI agents, so this is my problem. I built that trap, once small and once large, and ran it 60 times with Claude. Claude did not fall in once. Here is why, and why I shipped a fix anyway.
The trap
A tiny repository with two commits:
-
30 days ago:
normalisiereArtikelnummer(normalize article number) strips leading zeros. The note describes this version. - Today: "Artikelnummern an Partner-Release 2.4 angepasst" (adjusted article numbers to partner release 2.4). The function now only trims spaces. The partner docs say 17 and 0017 are two different articles.
The commit message is deliberately vague. It says something changed, not what.
The memory holds the old rule as a normal lesson: strip the zeros on both sides, "implemented in src/artikelnummer.js". I stored it a few minutes before the second commit, so for the memory the change is genuinely newer than the note.
The task for the agent: write ordneZu(zeilen, katalog), which assigns partner order lines to catalog entries, and "follow this project's rules for article numbers". A small script decides whether the result is correct, not a model. 0017 has to map to the gasket and 17 to the screw. The shared normalize function must not be "repaired" back to the old rule.
Three groups, ten runs each
- No memory. The agent only has the repository.
- Stale note, as our memory worked before this change. The note comes back as an ordinary hit.
- Stale note with a warning. One line in front of the note: the files of this lesson changed after it was written, with the latest commit.
Every run is Claude Code in headless mode with the Sonnet model, in a fresh copy of the repository. Before the first run I wrote down when I would stop. If the group with the stale note and no warning got it right 9 or 10 times out of 10, there would be nothing to show, and I would say so.
| Group | Correct |
|---|---|
| No memory | 10 of 10 |
| Stale note, no warning | 10 of 10 |
| Stale note, with warning | 10 of 10 |
All thirty runs were correct. The stop rule fired.
Why the trap did not work
The run logs answer it. Before writing a single line, Claude ran this:
git ls-files && for f in $(git ls-files); do echo "=== $f"; cat "$f"; done; git log -p -2 --stat
It printed every file and the last two commits. In a six-file repository, the new rule was always on screen. Its final message said that 17 and 0017 count as two different articles, "the current project rule". The note had said the opposite. Claude went with the code.
So my trap did not test memory. It tested whether Claude reads six files before it writes. It does.
That fits an earlier test of mine: given two notes that contradicted each other, the model sorted them out on its own.
So I made the repository too big to read
The second test changed one thing: size. 180 files, about 230 KB, 37 commits. The decisive commit sits eleven commits below the newest one, so git log -p -2 no longer shows it. A full dump of every file is about 237,000 characters, and the new rule only appears after the first 42,000.
Same note, same rule, same checker, same stop rule, again written down before the first run. I also wrote down that there would be no third version: if this one came back clean, I would not keep tightening the trap until it caught something.
| Group | Correct |
|---|---|
| No memory | 10 of 10 |
| Stale note, no warning | 10 of 10 |
| Stale note, with warning | 10 of 10 |
Thirty out of thirty again. This time Claude did not dump the repository. It searched. In a typical run, these were its first steps after asking the memory:
- Read the empty
ordneZufile. It importsnormalisiereArtikelnummer. - Open that function and search the repo for "artikelnummer".
- Read the partner docs the search found, and the git log of exactly those two files.
The search found the truth every time, in all 30 runs. The repository has three trails to it: the import in the file the agent has to edit, the word "article number" in the task, and the stale note itself, which names its file. The agent opened that file instead of trusting the note. A stale note that says where it came from led Claude to the truth, not away from it.
The group without any memory searched the same way. Its very first command already contained a grep for "artikelnummer".
What I shipped anyway
The warning has shipped in our MCP server (changelog). When a lesson names files, the server asks git whether those files changed after the lesson was written. If they did, the agent sees how many commits, the latest one with its message, and one instruction: check the current code before applying this lesson; if the code now says otherwise, the code wins.
In both tests it arrived ten times out of ten and cost no measurable time: a median of 30 seconds instead of 29 in the small repository, 51 against 51 in the large one. It did not change a single result, because there was nothing left to change.
Here is the uncomfortable part. The warning is loud. In my own memory, 488 of 1,377 lessons with file paths would carry it today, roughly one in three. Many of them point at files that change every day. For those, "this file changed" says little about whether the note is still true. A warning on every third note trains you to skip warnings.
GitHub described a finer version for Copilot's memory: each memory carries citations to code locations, and the agent checks them when it reads the memory. A whole file is a blunt citation. Lines or functions would be sharper. Their Universe talk on when to forget points the same way: context carried over from earlier work can make an agent worse.
What I take from it
I could not reproduce Golem's case with Claude. Not in six files, not in 180. That does not make their point wrong. Golem tested a different agent. And my trap had a weakness that real projects often do not have: the new rule lived under the exact word the agent searched for.
The cases I would worry about look different. The rule moved to another module. It got a new name. Or nobody wrote it down at all, and only the behaviour changed. In those cases the agent's search does not find the truth, and the note is the loudest voice left. A warning like ours points at the file that changed. Whether that is enough there, I have not measured. That would be a new question, not a third round of this one.
What I take from it is smaller than I expected, and more useful. The danger is not that a note is old. The danger is an agent that trusts a note and stops looking. Claude kept looking. A memory should make looking easier: say where a lesson came from, and say when the ground under it moved.
A note without that is a rumor with good formatting.
When did a note in your project last outlive the code it described?
Using Jira or Confluence with Claude Code, Cursor or JetBrains in the EU? I'll set up your team memory in 15 minutes, with your real Git and Jira history. Free for the first 5 teams. Write to hello@cachly.dev or reply here: cachly.dev
I build cachly. It keeps what you explain to your AI: your rules, your decisions and the bugs you already solved. Claude Code, Cursor, Copilot and the others read it in every session, for you alone or for your whole team, and every lesson carries the name of whoever learned it.
Try it, in increasing order of commitment:
-
30 seconds, no account:
npx @cachly-dev/mcp-server@latest demoin any git repo. It reads your log locally and prints what an assistant would already know about the project. After npx fetches the package, the command makes no network calls. -
Claude Code plugin:
/plugin marketplace add cachly-dev/cachly-mcp, then/plugin install cachly-brain@cachly. -
5 minutes, free tier:
npx @cachly-dev/mcp-server@latest autopilotwrites the MCP configuration for whichever assistant you use. - Or from the web: cachly.dev · free tier, servers in Germany.
On Product Hunt since 1 December: cachly on Product Hunt.



Top comments (2)
Nice write-up, and good call publishing the null result instead of tuning the trap until it worked.
The small repo is doing a lot of work here: when the agent can cat every file, the code always wins. In a large repo the agent reads only what looks relevant, so a stale note can win by default. A cheap way to handle that is to store, with each lesson, the file paths and the commit it was written against. At recall time a quick git log on those paths tells you whether the note is older than the code, which is exactly the warning line from your third group, computed instead of hand-written.
Another option for project rules specifically: keep them in a versioned file inside the repo (CLAUDE.md, AGENTS.md or similar), so the change that breaks a rule shows up in the same diff as the rule and the reviewer sees both.
your unmeasured case is the one that worries me too. if the rule moves to another module or gets a new name, a file-change warning points at the old path and the search can miss. i'd store the rule itself as a versioned fact, like 17 and 0017 are distinct, with an as-of date, so a later conflicting behavior is a new version rather than a stale note about a file that no longer holds it.