Your CLAUDE.md is too long: what to move out
Anthropic says keep each CLAUDE.md under 200 lines. Sort every line into a rule, a procedure, a hard limit, a decision or a fact, and only the rules stay.
On this page
- How long should CLAUDE.md be?
- Why does Claude ignore my CLAUDE.md?
- Sort each line: what to move out
- Keep: rules for every task
- Move: rules for one part of the code
- Move: procedures, into skills
- Move: hard limits, into hooks and deny rules
- Move: personal preferences
- Move: decisions, with their reasons
- Move: facts, with a source
- Delete: what the code already says
- Where decisions and facts go with Memorinth
- Start with one pass
If your CLAUDE.md is too long, Claude follows it less well: Claude Code’s docs say to target under 200 lines per file, because “longer files consume more context and reduce adherence”. Cutting at random doesn’t fix it. Sort every line instead. A rule Claude needs in every session stays. A rule for one folder becomes a path-scoped rule, a procedure becomes a skill, a “never” becomes a hook or a deny rule, and a decision or a fact moves to where it can be searched and kept current. What the code already says is deleted.
This is as of November 2026, from Claude Code’s memory docs and best practices, linked throughout. Claude Code memory: what it keeps, and where maps everything Claude Code remembers, and every guide on it.
| A line that is… | Example | Move it to |
|---|---|---|
| A rule for every task | “Run one test file with pnpm vitest run <file>” |
Stays in CLAUDE.md |
| A rule for one part of the code | “API handlers validate input with zod” | .claude/rules/ with paths |
| A multi-step procedure | “How to cut a release” | A skill |
| A rule with zero exceptions | “Never read .env” |
A deny rule or a hook |
| Your own preference | “Explain diffs briefly” | CLAUDE.local.md or ~/.claude/CLAUDE.md |
| A decision and its reasons | “We dropped Redis because…” | A decision record |
| A fact that can change | “Staging runs Postgres 16” | A fact with a source |
| What the code already shows | The folder layout, the dependency list | Delete it |
How long should CLAUDE.md be?
Under 200 lines per file is the official target. The memory docs say so twice, and Claude Code shows a warning at startup and in /status when one of your instruction files is over the recommended length. It also warns when several files that are each short enough add up past a combined limit, and it skips a file over 4 MiB entirely.
Two details make the number less simple than it looks:
- Imports don’t help. Splitting a file with
@pathimports “helps organization but doesn’t reduce context, since imported files load with the CLAUDE.md importing them”. Each import also counts as a file of its own for the warnings. - Files that load later have a size cap. A
CLAUDE.mdin a subfolder and path-scoped rules load on demand, and over a per-file limit (40,000 characters on a 200K context window) Claude gets only the start of the file, with a note telling it to read the rest.
The line count is a proxy. The real test, in the best practices: every line “takes a little of Claude’s attention on every task, whether it’s relevant or not”. A line belongs only if Claude needs it on every task and couldn’t work it out from the code.
Why does Claude ignore my CLAUDE.md?
Claude ignores lines in CLAUDE.md because the file is guidance, not configuration. Its content “is delivered as a user message after the system prompt”, and there’s “no guarantee of strict compliance, especially for vague or conflicting instructions”. The docs give three causes, and length is only one of them:
- The line is lost. The file is long enough that a single rule doesn’t stand out.
- The line conflicts with another. “If two instructions contradict each other, Claude may pick one arbitrarily.” That includes a nested
CLAUDE.mdor a rule file saying something different. - The line isn’t loaded. A
CLAUDE.mdin a subfolder loads only once Claude reads or edits a file in that folder. Run/context alland look under Memory files to see what loaded at launch.
Adding IMPORTANT doesn’t fix any of these. The best practices are direct about it: “piling on emphasis mostly makes Claude over-apply the rule”. A line that keeps being missed is either in a file that needs to be shorter, or a rule that can’t bend and belongs in a hook.
Sort each line: what to move out
Go through the file one line at a time and ask what kind of thing it is. Each kind has a better home than a file that loads whole into every session.
Keep: rules for every task
What stays is what Claude needs on every task and can’t find by reading the repo. Anthropic’s list is short: the exact test, typecheck and lint commands, places where the code is misleading (“src/legacy/ is still live but don’t copy its patterns”), team choices that aren’t visible in the code, and anything you’ve had to correct twice.
Make each one specific. “Use 2-space indentation” is followed. “Format code properly” isn’t, because it doesn’t say anything.
Move: rules for one part of the code
A rule that only matters in one folder costs context everywhere else. Put it in .claude/rules/ with paths in its frontmatter, and Claude Code loads it only when Claude works with matching files:
---
paths:
- "src/api/**/*.ts"
---
Validate every request body with the schemas in src/api/schemas.A rule file without paths loads at launch like CLAUDE.md itself, so it saves nothing. Use it only to organize.
Move: procedures, into skills
Release steps, a migration checklist, how to add a new provider: these are procedures, and the docs say a multi-step procedure belongs in a skill. Claude sees a skill’s name and description every session but reads the whole file only when the task calls for it. A long release procedure in a skill doesn’t weigh on an unrelated bug fix.
Move: hard limits, into hooks and deny rules
“Never read .env”, “always run the formatter”, “don’t touch the migrations folder”. Claude follows lines like these almost every time. If almost isn’t good enough, they don’t belong in CLAUDE.md. In Anthropic’s words: “If something has to happen every time, make it a hook, a deny rule, or a managed setting.”
- A file Claude must never read is a
denyrule in.claude/settings.json, such as"Read(./.env)". Deny rules hold in every permission mode. - A step that must always run is a
commandhook, such as aPostToolUsehook that formats every edited file, or aStophook that sends Claude back to work until the typecheck passes, up to a cap of blocked stops.
Keep this set small. The same page warns that a hook is for a rule with zero exceptions. “Prefer named exports” has exceptions, so it stays a line of text.
Move: personal preferences
How you like answers written, your sandbox URL, your editor: these are yours, not the team’s. Put them in CLAUDE.local.md, which you add to .gitignore, or in ~/.claude/CLAUDE.md for every project.
Move: decisions, with their reasons
A decision line often grows. It starts as “Use Postgres for the job queue” and gains a paragraph of why, then a note on what was tried before. Keep the outcome in CLAUDE.md if Claude needs it on every task, as a one-line rule. The reasons and the history are worth keeping, but not in every session’s context.
A decision record holds them: the context, the choice and its consequences, in a note that’s superseded rather than edited when the choice changes. A docs/decisions/ folder in your repo works for that with no tools at all. The point is that the agent can find the reason when it’s about to undo the choice, without reading it on every unrelated task.
Move: facts, with a source
“Staging runs Postgres 16”. “The health check is at /health”. “The CI image pins Node 22”. Facts are cheap to write and go stale without anyone noticing, and a stale line in CLAUDE.md is followed just as faithfully as a true one. A fact needs a source, so whoever reads it can check it, and something that says when it was last checked.
Delete: what the code already says
Directory layouts, dependency lists, architecture overviews: Claude reads the repo itself. The memory docs say /doctor proposes trims that cut exactly this kind of content and keep “pitfalls, rationale, and conventions that differ from tool defaults”. Run it on a long file before you sort by hand. /doctor prompt-audit also flags instructions that contradict each other or point at files that no longer exist.
Where decisions and facts go with Memorinth
For a small project, the sort above needs nothing installed: rules in CLAUDE.md, decisions in a folder of Markdown records, and facts in a short doc you keep up to date. That’s the better choice if you work alone in one tool and the list stays short.
Memorinth is for when the decisions and facts outgrow that. It keeps both as Markdown notes in your cortex, with a lifecycle:
- Decisions are recorded with
record_decision. A changed choice gets a new decision that supersedes the old one, which stays as history. - Facts are added with
add_fact, always with a source: a file path, a commit or a URL. After 180 days a fact is due, and the agent checks it against its source. - The briefing puts the current facts and the accepted decisions in front of Claude Code at the start of each session, through a session-start hook. Anything older is found with
search_memorywhen it’s needed.
Your CLAUDE.md then needs a few lines telling the agent to use it, not the knowledge itself:
Search memory before answering questions about past work or decisions.
Record key decisions with record_decision, and stable facts with add_fact
(with a source: a file path, a commit or a URL). Don't record what the
code or git history already says.Memorinth’s guide suggests these lines, and Memorinth’s own repository keeps a CLAUDE.md much like them. It stays short because the knowledge lives somewhere else.
Start with one pass
Open your CLAUDE.md and label each line with a row from the table. Then run /doctor and compare its cuts with yours. For how instructions and knowledge split in practice, read What goes where. For the habits that keep decisions and facts useful, see Writing decisions and Keeping facts true. To connect Claude Code to a cortex, follow Give Claude Code a long-term memory, and for how this fits beside auto memory, see Claude Code memory: built in, or a server?.