Playbooks · Coding tasks
Keep Claude Code memory under 200 lines
Written November 10, 2026
Claude Code loads only the first 200 lines or 25 KB of MEMORY.md into a session. Treat that top part as an index — one line per note, pointing at detail files — and the file keeps working no matter how much you have learned.
The problem
A memory file grows the way a notebook does: a note per session, a rule per mistake, a correction per misunderstanding. Past a point, the model stops reading it well — not because the notes are wrong, but because there are too many of them and the useful ones are buried. Anthropic's own research ran into the same shape of problem in games and long tasks: a model that wrote down everything spent its time combing through its memories instead of doing the work.
The limit
Anthropic's post on the components of agent memory puts the number plainly. Claude Code's auto memory keeps its injected layer small, and it loads only the first 200 lines or 25 KB of MEMORY.md. That header serves as an index, showing Claude what it knows and where to find it. Anything below the cut is still on disk, but it is not loaded into the session's context.
The same post describes how the top layer is kept small in Anthropic's experiments. Dreaming — the process of reflecting on session logs between interactions — moves details down the hierarchy and leaves links behind. That keeps the part loaded into every session short. A wrong note is a real risk here: dreaming exists partly because a note that is wrong from the start, or that drifts as the environment changes, can be read and trusted by Claude in a later session. In one test Anthropic describes, a wrong note about a landmark sent Claude the wrong way through a cave three times before dreaming caught the error against the session transcript and rewrote it.
The index pattern
Keep MEMORY.md short by making it a table of contents, not the notes themselves:
- One line per note. Each line names a fact, a rule, or a trap, and points at the file where the detail lives. The line is the whole entry; the file holds the explanation.
- Details in separate files. Put the long version — the failing case, the workaround, the exact command — in its own file under a memory folder, and link to it from the index line.
- Prune what is wrong or stale. A note that describes how things used to work is worse than no note: the model will read it and trust it. When a rule stops being true, delete the line and the file, or rewrite both.
- Count the lines. If the file is over 200 lines, the bottom of it is not being read. Move the overflow into detail files until the index fits.
Anthropic's own guidance in the same post is to tell Claude what memory is for but not how to use it, and to leave the judgment of what is worth remembering to the model. The file is yours to curate; the model decides what to pull from it.
What not to do
- Do not paste whole transcripts or logs into MEMORY.md. They eat the 200 lines and push the index off the page.
- Do not keep two versions of the same rule. When a rule changes, replace it in place; a stale copy below the cut is invisible, but a stale copy above it is read as fact.
- Do not treat the file as a diary. A note earns its line by predicting that a future session will need it. A record of what happened, with no lesson attached, is clutter.
Limits
- The 200-line / 25 KB figure is how Claude Code loads its auto memory, as Anthropic describes it. It is a loading limit, not a file-size limit: a longer file still works, but only its first 200 lines or 25 KB are read into a session.
- Dreaming, as described in Anthropic's post, is the mechanism Anthropic uses to correct and prune memory in its own experiments. It is not a button in Claude Code; the practical part for a user is the index pattern and the pruning.
- A short memory file does not fix a wrong note. The index only works if the lines in it are true.
Related playbooks
- Claude agents now dream: memory that consolidates
- Run three independent lines of research at the same time in Claude Code, then combine the short summaries
- Codex memory v2: import memories from other agents
- Keep coding when Claude sign-in is down
Sources
Back to: Coding playbooks hub · Also: Claude agents now dream: memory that consolidates · Claude Code hardens its sandbox ahead of Nov 10