CLAUDE.md too long? How to trim it
If Claude Code feels forgetful mid-session, check the size of CLAUDE.md first.
Anthropic’s memory docs target under 200 lines per file because longer always-on
memory consumes context and reduces adherence — imports organise content but still load with the parent.
Signs it is already too long
- The file mixes project identity, release runbooks, style essays, and one-off incident notes.
- The same “always / never” lines also exist in
AGENTS.mdor Cursor rules. /context(in Claude Code) shows memory dominating the window before the task starts.- You would not ask a new teammate to memorise the whole file before their first PR.
Trim without inventing numbers
- Measure. Paste
CLAUDE.mdinto the token counter or drop it with sibling files into the scanner. - Keep a short always-on core. Project map, hard constraints, build/test commands, pointers to docs.
- Move workflows to skills. Release checklists and long how-tos should load on demand, not every turn.
- Prefer one source of truth. Point
CLAUDE.mdat@AGENTS.mdfor shared rules instead of forking copies (remember imports still cost tokens). - Enforce must-holds outside prose. Hooks, linters, and CI beat a buried “never” paragraph.
Cutting lines is not the same as cutting tokens. Tables, code fences, and repeated paragraphs dominate weight — sort by section weight in Clogmeter and trim the top offenders first.