Agent Upstart

Cool things people are building with agents — and practical help getting the most out of them.

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:

  1. 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.
  2. 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.
  3. 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.
  4. 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

Limits

Related playbooks

Sources

Back to: Coding playbooks hub · Also: Claude agents now dream: memory that consolidates · Claude Code hardens its sandbox ahead of Nov 10