Chapter 19: Memory That Compounds#
The difference between month one and month three#
A setup with no memory makes the same small mistakes forever. You correct the same formatting, restate the same preference, re-explain the same boundary, week after week. A setup with good memory makes a mistake once, maybe twice — and then never again. By month three it has quietly absorbed a hundred small lessons and feels eerily like working with someone who knows you.
That feeling is not magic. It is corrections that were captured instead of repeated. This chapter is about making the capturing deliberate.
The four places memory lives#
“Memory” is really four different places, each with a different job:
-
Your
CLAUDE.md. Loaded every single session, by your choice. Best for the small set of facts needed almost every time — your role, your active projects, your hard rules. Chapter 20 covers designing it. -
Claude’s automatic memory. Claude Code quietly keeps its own notes about your project — things it decides are worth remembering, like preferences you have stated and lessons from corrections. When you see “Saved 2 memories” flash by, this is what happened. The notes live in plain markdown files on your machine (under
~/.claude/projects/, in amemory/folder with aMEMORY.mdindex), the index loads at the start of each session, and you can read, edit, or delete any of it. You do not manage this layer — but knowing it exists explains why Claude remembers things you never put inCLAUDE.md. -
Your folders. Your notes, decisions, and daily logs are memory too — the durable record of what happened, retrievable whenever it becomes relevant. This is the memory you control completely.
-
A searchable archive (optional). For heavy users: a tool that indexes everything so you can ask “when did I last work on the pricing model?” months later. More on the tools below.
The art is putting each fact in the right place. Needed almost every session: CLAUDE.md. Needed sometimes: let automatic memory catch it, or tell Claude to remember it. The record of what happened: your folders.
The two-correction rule#
One rule governs this whole layer: the first correction is free; the second one means write it down. If you catch yourself correcting Claude on the same thing a second time, stop and make it permanent — say “remember this” or add a line to CLAUDE.md. A third correction is not bad luck; it is a lesson you declined to record. Two strikes, then it goes in memory.
Keep memory durable, keep status in logs#
A quick test before anything gets remembered permanently: will this still be true in three months? “I always want charts as images, not code” — yes, that is memory. “The deck is due Friday” — no, that is status, and it belongs in a dated log where the date gives it context. Memory that fills up with expired status turns into noise that contradicts itself within a week.
The companion habit: when you notice a remembered fact is wrong or expired, delete it. A stale memory is worse than a missing one, because it gets trusted.
When a session fills up: the four moves#
Long sessions eventually strain the context window — you can watch the indicator climb in your status line. When it does, you have four moves, in rough order of how much they preserve:
- Compact.
/compactsummarizes the conversation in place and keeps going. Give it a steer so it keeps what matters:
Inside Claude Code:
/compact Keep: the three deck directions we chose and the feedback on each. The exploration before that can go.
-
Rewind and summarize. My favourite move in the entire tool, and weirdly underused. Sometimes the recent part of a session is gold and the early part is bloat. Press
Esctwice, pick the message where the good part starts, and choose “Summarize up to here” — everything before that point gets compressed into a summary, and everything after stays word-for-word. There is also a “Summarize from here” for the opposite case. You keep the working context you care about and shed the rest. (Chapter 13 covers the rewind menu’s restore options; this is the same menu doing memory surgery.) -
Hand off. Ask Claude to write a short handoff note — what is done, what is decided, what is next, which files matter — then start a fresh session with that note as the first message. This is what most “compact didn’t help” situations actually need.
-
Restart clean. Sometimes the right move is a fresh session pointed at the right files. Starting over costs less than dragging a bloated session across a hard problem.
The memory tools I actually use#
Everything above is built in and enough for most people. Two outside tools have earned a place in my own setup, and a few more are worth knowing about:
- Supermemory (supermemory.ai) is my searchable archive — an AI-native memory layer where things I save can be found later by meaning, not just by keyword. This is what I use for the “when did I last touch this?” problem.
- claude-mem is a Claude Code plugin that watches your sessions and builds cross-session memory automatically — within a project, it means a new session already knows what the last ten did. Install it once and it just accumulates.
Worth a look if you want alternatives: Basic Memory (your notes stay plain markdown files with search on top — the gentlest option, with an official plugin), Mem0 (the most widely used memory layer, hosted, free tier, official plugin), and QMD — a fully local search engine for your own notes and transcripts, built by Shopify’s founder. QMD is excellent and private, but fair warning: it needs a terminal install and an indexing step, so save it for when you are comfortable. You need none of these on day one. The built-ins carry you a long way.
Pro tips#
- Treat the second correction as an alarm, not an annoyance. It is the cheapest signal you will ever get that a lesson is missing.
- Prune monthly. Once a month, read your
CLAUDE.mdand your saved memories, and delete what is no longer true. Memory you have recently weeded is memory you can trust. - Write decisions down where you will look. What you decided and why is the memory you will miss most in six months. A
Decisions/folder turns “why did we do it this way?” from an argument into a lookup.