Skip to the content
Built by Colton

Updated Tue / 2026-10-06 / 4:55 AM CT

AI model selection · companion guideVendor facts checked 2026-10-04

How to slim your CLAUDE.md

Your instruction file loads at the start of every session, so every line in it is paid for every time. Here is how to cut it to a short list of if-then rules that point to detail only when the detail is needed. The same method works for the AGENTS.md file that Codex reads.

Why it matters

Under 200 linesAnthropic's target per CLAUDE.md file. Longer files use more context and are followed less reliably.
Imports still loadAn @path import is pulled in at launch. It tidies the file, it does not save tokens.
Comments are freeBlock HTML comments (<!-- note -->) are stripped before Claude sees the file.
32 KiB for CodexCodex stops reading AGENTS.md files once they add up to 32 KiB by default, so the end gets cut off.

The pattern: if-then law lines

Every rule becomes one to three lines with three parts:

  1. Trigger: when does this rule apply? Start with "When" or "Before".
  2. Binding: what must happen, in one plain sentence.
  3. Pointer: where the full detail lives, written as a plain path in backticks.
- **DEPLOYS.** Before any deploy: run the tests, deploy with the one
  script, then confirm the live page shows today's version.
  Detail: `docs/rules/deploys.md`

Why backticks and not an import: a path in backticks is just text, so the detail file stays on disk until the trigger fires and Claude opens it. Writing @docs/rules/deploys.md instead would load the whole file into every session, which is the cost you are trying to cut.

Sort every paragraph into one of five piles

PileWhat it looks likeWhere it goes
Always trueProject layout, build command, names that must be spelled a certain way.Stays in CLAUDE.md, as short as possible.
Triggered rule"Whenever you send an email...", "Before a deploy..."One law line in CLAUDE.md plus a pointer.
ProcedureA ten-step recipe, a checklist, a runbook.A reference file or a skill. Skills load only when used.
Story and historyWhy the rule exists, the incident behind it, the changelog.The reference file or a CHANGELOG. Keep at most one short reason in the law line.
StaleOld tools, finished projects, rules that contradict newer ones.Delete. Two rules that disagree make Claude pick one at random.

Rules that only matter for one part of a project can also move to .claude/rules/ with a paths: field, so they load only when Claude works on matching files.

Before and after

Before: 14 lines of prose, loaded every session

## Email
We had a problem in March where a draft went out with the wrong
attachment and a client got a competitor's pricing, which was a
huge mess and took two weeks to clean up. So from now on, always
double check attachments. Also emails should sound friendly but
not too casual, no exclamation points, sign off with just my first
name. Drafts should never be sent without me looking at them first.
Oh and put the date in the subject line for weekly reports.

## Changelog
- Mar 3: added attachment rule after the pricing incident
- Mar 9: added no exclamation points
- Apr 2: weekly report subject lines now carry the date
- Apr 20: clarified the sign-off

After: 3 lines in CLAUDE.md

- **EMAIL.** When drafting any email: never send, always leave it as a
  draft for me; check every attachment against the recipient; voice is
  warm, no exclamation points, sign off with first name only.
  Detail and history: `docs/rules/email.md`

Moved to docs/rules/email.md (loads only when an email is being written)

# Email rules
Why the attachment check exists: in March a draft carried another
client's pricing. Two weeks of cleanup.
Weekly reports: put the date in the subject line.

## Changelog
- Apr 20: clarified the sign-off
- Apr 2: weekly report subject lines carry the date
- Mar 9: no exclamation points
- Mar 3: attachment check added

Memory index hooks

Claude Code's auto memory keeps an index file, MEMORY.md, and only its first 200 lines (or 25 KB) load at the start of a session. Make each line a hook that says when the memory matters, so Claude knows which file to open:

- [Invoice rules](invoice-rules.md) - read before creating any invoice; net 30, one PDF per client
- [Brand colors](brand-colors.md) - read before styling anything customer-facing

A hook that only names the topic ("Invoices") makes Claude open the file to find out whether it matters. A hook that carries the trigger and the headline often answers the question on its own.

A size budget

  • Personal file (the one that loads in every project): aim for under 100 lines.
  • Project file: under 200 lines, Anthropic's own target.
  • Each law line: one to three lines. If it needs more, the extra belongs in the pointer file.
  • Memory index: under 200 lines, because nothing past that loads.
  • Check it: wc -l CLAUDE.md counts lines, and /context in Claude Code shows how much of the session your instructions use.

The monthly trim, 15 minutes

  1. Count the lines. If you are over budget, start with the longest rule.
  2. Anything with a story, a date or a quote in it: move the story to the pointer file.
  3. Anything that has not fired in a month: move it to a reference file or delete it.
  4. Look for two rules that say different things about the same situation, and keep the newer one.
  5. Move finished projects out entirely.
  6. Test it: open a fresh session and ask "what rules apply when I send an email?" If it finds the right line and opens the right pointer, the file works.

A prompt to do the first pass for you

Paste this into a fresh Claude Code session in the folder that holds your CLAUDE.md. Read the result before you keep it.

Read my CLAUDE.md. Rewrite it as short if-then law lines: each rule gets a bold NAME, a trigger ("When..." or "Before..."), one plain sentence of what must happen, and a pointer to a detail file written as a path in backticks (not an @ import). Move every story, incident, quote, example and changelog entry into those detail files under docs/rules/, one file per topic, and keep nothing out. Keep always-true facts (layout, commands, spellings) as short plain lines. List any rules that contradict each other and ask me which one wins. Target: under 100 lines. Show me the before and after line counts, and back up the original file first.

Sources, checked 2026-10-04

SLIM YOUR CLAUDE.MD · builtbycolton.com/models/claude-mdGuide v3.0 · facts checked 2026-10-04