Claude Code: "MEMORY.md over its 200-line read limit", how to fix it
Back to the blog
Articleinteligência artificialtecnologiaautomação

Claude Code: "MEMORY.md over its 200-line read limit", how to fix it

MafraOctober 12, 20265 min read

Claude Code forgot something you taught it yesterday, and the transcript shows: Error: this write left the memory index at MEMORY.md at 214 lines, over its 200-line read limit. It means the auto memory index went over its read limit, and everything after line 200 (or after 25KB) no longer makes it into the session.

This guide shows the exact limit, how to measure your file with one command, and how to rewrite the index without losing anything. Everything was checked against the official Claude Code docs on 2026-10-12.

What does "over its 200-line read limit" mean?

It means Claude wrote to MEMORY.md and left the file over one of its two read limits: 200 lines or 25KB. The write succeeded, but only the start of the file is loaded when a session opens. The message, as it appears in the docs (the omitted part says the entries at the end are already invisible):

Error: this write left the memory index at MEMORY.md at 214 lines, over its 200-line read limit. The write succeeded, but everything past the limit is silently dropped each time the index is loaded [...] Rewrite it to under 140 lines now: keep one line per entry, move detail into topic files, and merge or drop stale entries.

Claude Code delivers this error to Claude after the write, not as a banner in your terminal. That is why you often only notice it in the transcript, or when the agent ignores a preference it had already learned.

What is the exact MEMORY.md limit?

Claude Code loads the first 200 lines or the first 25KB of MEMORY.md, whichever comes first. The rest stays on disk but does not enter the start of the conversation.

ItemBehaviorSince
MEMORY.md (auto memory index)Loads up to 200 lines or 25KB, whichever comes firstCurrent documented limit
Warning when over the limitError returned to Claude right after the writev2.1.210 (before that, the cut was silent)
YAML frontmatter and block-level HTML commentsStripped before measuring, they do not countv2.1.211
Topic files (user_role.md etc.)Not loaded at startup, Claude reads them when neededAlways
CLAUDE.mdLoads in full up to 4 MiB; larger files are skippedCurrent documented limit

The 200-line limit applies only to MEMORY.md. Auto memory lives in ~/.claude/projects/<project>/memory/, with the index and one file per memory.

Why do the newest memories disappear first?

Because the cut happens at the end of the file, and the end is where new entries usually go. The index is read top to bottom and stopped at the limit. Result: what the agent just learned is the first thing to become invisible.

Flowchart: the MEMORY.md index went over the 200-line limit, measure lines and bytes with wc -l -c, rewrite the index through /memory; if the rule always applies, move it to CLAUDE.md
From the error to a lean index, in three steps and one branch.

How do I check if my MEMORY.md is already over the limit?

Count lines and bytes of every index at once. On macOS or Linux:

find ~/.claude/projects -name MEMORY.md -exec wc -l -c {} +

The first column is the line count and the second is the size in bytes. Any file over 200 lines or close to 25000 bytes is already losing its end. If you changed the location with autoMemoryDirectory in settings.json, swap the path in the command.

To see which instruction files loaded in the current session, run /context and check the list under Memory files.

How do I fix the MEMORY.md limit?

Rewrite the index to sit well below the limit, with one line per entry, and move the detail into topic files. Nothing is lost: the topic files stay in place and Claude opens them when it needs them.

  1. Ask Claude itself, in the session:
    Rewrite MEMORY.md to under 140 lines: one line per entry, detail in topic files, merge duplicate entries and drop stale ones.
  2. Prefer editing by hand? Run /memory and pick the option to open the auto memory folder. It is all plain markdown.
  3. Run the find ... wc -l -c command again and confirm the file is under 200 lines and under 25KB.

The number 140 comes from the error message itself: it is the target Claude Code suggests to leave headroom before the next cut.

Rules that must apply in every session

If an entry is a fixed project instruction ("use pnpm, not npm", "run the tests before committing"), it belongs in CLAUDE.md, which loads in full. Instructions that only matter for part of the code can go in .claude/rules/, scoped by file type, and only load when Claude works on those files. The docs recommend keeping each CLAUDE.md under 200 lines for adherence, but that is a recommendation, not a cut.

What if the cut happened on an older version?

Before v2.1.210, an over-limit index was silently truncated on load, with no warning at write time. Update Claude Code and measure the file: if it went over the limit back then, the entries at the end have been missing from your sessions ever since.

In issue #99403, opened on 2026-10-04, users also report a load-time warning in the form MEMORY.md is 267 lines (limit: 200). Only part of it was loaded, seen on Claude Code 2.1.286. That text comes from user reports, not the official docs, and the request in the issue (show which entries were dropped) is still open.

If you use Verboo Code, permanent project instructions live in the file opened by /memory; the walkthrough is in how to give the agent permanent instructions with /memory and AGENTS.md.

If what limits your coding agent is the plan and not the memory size, Verboo Code has unlimited tokens.

Enjoyed this article?
Share knowledge with your network.
// Read also

Related articles