I switched off Claude's memory
Claude Code's auto memory wrote 61 memories in four weeks, and stale ones kept loading. I sorted them into files and switched it off.
Claude Code ships with auto memory on by default in local sessions. As you work, it saves memories: your corrections, your preferences, facts about the project. A one-line index of them loads at the start of every new session, and a whole memory is read back when it's needed.
I left it on (1) because I had no reason to change it and (2) because an assistant that remembers a correction shouldn't need telling twice. I ran it for about four weeks this summer in one workspace that spans all my repositories. By the end, I was noticing that its index was loading details that were no longer true.
So I sorted every memory into the file it belonged in and switched the feature off.
Key takeaways
- It's written to often but rarely read. Between 9 June and 10 July auto memory wrote 61 memories, and 9 of 90 sessions read one back in full.
- Stale lines kept loading. A one-line index of every memory loads at the start of each session, so summaries that were no longer true reached every session after they went stale.
- Every memory had a better home. All 38 still stored belonged in a file: project instructions, written standards, docs, code comments or decision records. Half repeated a rule that was already written down.
- Files change through a diff. I moved each memory into its file and switched auto memory off. Those files change through a diff I review; Claude edits its memories itself, and those changes go unreviewed unless you go digging.
Written often, rarely read
Between 9 June and 10 July auto memory wrote 61 distinct memories [1]. Of 90 sessions in that period, 41 wrote to it. A session reads a memory in full when the whole file appears in its context, which I counted from the session records: 9 sessions did, one in ten [2]. Of the 38 memories still stored at the end, 24 were never read back in full by any session.
Each of those 24 still had its one-line summary in the index, which loads at the start of every session, from the day the memory was written.
Teal and grey are mixed through every ring. The 14 read in full averaged 1.9 links and 196 words; the other 24 averaged 2.2 links and 197 words. Being well linked or long didn't seem to make a memory more likely to be read.
Context rot
Some memories went stale, and their lines were in context at the start of every session after that. That's the context rot I was worried about. Unfortunately, I can't show a session acting on one. Here are some examples of the errors that were coming up:
- A feature was still listed to do after it had been built.
- A library release was pending after it had gone out.
- Two memories linked to others that had already been deleted.
When I was planning to switch auto memory off, a triage cut the store from 37 memories to 33 on 7 July. It was back to 38 by 10 July.
Recall against a file that's always read
Claude treats both its memory and its project instructions as context, not enforced configuration. To block an action whatever the model decides, the documentation points to a hook instead.
Where a rule lives decides how often it applies:
- A memory. Its line is always in the index; the whole memory reaches the model when it's read back.
- A project instruction or written standard. It's loaded every time it applies.
- A hook, a lint rule or a test. It runs every time and can refuse the change.
Project instructions, standards, hooks and tests all live in files that change through a diff at review time. Claude writes and edits its memories itself, so those changes aren't ever inspected unless you go digging. Crucially, they also live on one development machine.
Where the 38 memories went
For each memory still stored I asked which file should hold it, and all 38 had one.
| What happened to the memory | Memories |
|---|---|
| Deleted, because a standard, doc or code comment already held it | 19 |
| Written into the file that owns it, then deleted | 17 |
| Written up as a decision record, then deleted | 1 |
| Moved in an earlier pass | 1 |
By kind of file, 9 belonged in the project instructions, 8 in written standards, 16 in docs, 3 in code comments and 2 in decision records. Half the memories repeated rules that were already written down. My first map, made before checking, put that number at 16; checking found 19. Two of my open-source libraries, nhs-pay and paye-calc, needed no change, because the design the memories described was already in their own docs.
The memories about how I work captured rubric, so I cut them down and rehomed them into the project instructions. I keep the facts about me in a short file I wrote myself. It loads at the start of every session and changes only when I change it.
How much carried over
The 38 memories held 8,357 words. After rehoming, I was left with 1,932 words in committed project docs: 23% [5].
| Home | Memories | Initial size | Final size |
|---|---|---|---|
| Project instructions | 9 | 2,025 | 475 |
| Written standards | 8 | 1,785 | 81 |
| Docs | 16 | 3,451 | 1,376 |
| Code comments | 3 | 675 | 0 |
| Decision records | 2 | 421 | 0 |
| Total | 38 | 8,357 | 1,932 |
Of the 6,425 words that didn't carry over, 77% belonged to the 19 memories whose fact was already written down. The 17 memories that did need a new home added 1,932 words to their homes, against 3,029 in the memories. Facts that survived then had a single home.
How I moved them
- Copy everything first. I saved the whole memory before touching it, so that deleting a memory could never lose anything.
- Map each memory to a home. A preference about code went to the written standard, a fact about one project to that project's docs, a decision to the decision records.
- Check the map with read-only agents. A map that says "the style guide covers this" is a claim, so I sent a cheap read-only agent to each of three repositories with the exact list of claims routed there. Each answered present, partial or missing, with the file and line, so every delete rested on evidence.
- Act on the verdict. Present meant delete the memory. Partial or missing meant write the rule into its home, confirm it landed, then delete the memory.
- Switch it off last. I set
autoMemoryEnabledto false. A hook now refuses any write to the memory folder in case the setting is ever turned back on, and a table in the project instructions says where each kind of fact goes. The hook went in last so it couldn't block the move.
The four memories that lived in my other repositories were checked when I went to move them. The checking pattern came from How I AI's episode on how Mozilla fixed Firefox security bugs, where a verifier subagent checks each bug report before an engineer sees it. I didn't build a reusable agent for it: moving the memories happens once, and a general read-only agent with a precise brief did the job.
Pruning
For comparison, I was curious about how human memory handles this problem. One account of sleep, the synaptic homeostasis hypothesis, says the brain strengthens connections while you're awake and scales them back while you sleep. What matters then stands out from the noise. Forgetting helps too: a 2017 paper in Neuron argues that letting memories fade helps decisions hold up when the world changes.
In contrast, auto memory has no pruning step of its own. A memory changes only when Claude or you happen to edit it, and nothing checks the store against what's still true. So the emphasis is then on you creating a system to manage memories. The one triage I ran cut it to 33 memories. It was back to 38 three days later. Moving every memory into a file was my pruning, done once and by hand. How to prune routinely is still an open question. Until there's an answer, I'd rather keep my rules where a diff shows every change.
The prompt
A prompt reconstructed from my notes of the run, and the brief for each checking agent, come by email. Subscribe to the blog and they arrive just after you confirm.
I build skills and checks like these at Casomo. The About page says more about how I work.
Notes
- Written against seen: 61 memories were written in all. Version control saw 44 of them, and 5 more survive in a snapshot taken at the switch-off. The other 12 were written and deleted without being committed.
- How they were made: scripts counted what the memory did, reading the session records for each memory file's path and for each time a whole memory file was loaded into a session. The words carried over were counted from the commits that moved the memories.
- Where the numbers come from: the memory folder's version history from 23 June to 10 July, and a daily count of memories written, taken from my own session records, for the days before that. No session data is published.
- Reads: when each memory was read isn't recorded, only whether it was ever read in full.
- Words, not lines: a memory's line is an unwrapped paragraph, and the files that took them over wrap at about 80 characters. By lines, the files gained 185 against the memories' 205, which would look like 90% carried over, against 23% by words.