Skip to content

Claude Code ignores your CLAUDE.md: why, and what fixes it

By the Toolbay team · Checked against the sources below on

Claude Code reads CLAUDE.md at the start of a session, but reading is not obeying. Rules get skipped when the file is long, when a rule cannot be checked, when two files disagree, or deep into a long session after compaction. Many people report it: see GitHub issues 18454 and 6120.

Why it happens

  • The file is too long. Anthropic's docs say to target under 200 lines per CLAUDE.md, because longer files reduce adherence.
  • The rule is vague. "Write clean code" gives the model nothing to check.
  • Two files disagree. Claude Code joins every CLAUDE.md it finds (user, project, parent folders, CLAUDE.local.md). The docs say it may pick either side of a contradiction.
  • The session is long. Rules read at the start compete with everything that came after.
  • It is a procedure, not a rule. Twenty steps in CLAUDE.md are easy to drop halfway.

Fixes, most effective first

  1. Cut the file to the rules that matter, under 200 lines. Move procedures into skills and folder-specific rules into .claude/rules/ with a paths list.
  2. Rewrite each rule so you could check it: name the command, the folder, the exact format.
  3. Find and remove contradictions across ~/.claude/CLAUDE.md, the project file, parent folders and CLAUDE.local.md. /memory shows which files are loaded.
  4. Enforce the rules that matter most with a test, a lint rule or a hook, so breaking them fails loudly.
  5. Start a fresh session for each new task instead of one long one.

Rules it can check, and rules it cannot

CLAUDE.md
# Vague (easy to skip)
- Write clean code.
- Be careful with the database.

# Checkable (easy to follow and to verify)
- Run npm test before saying a task is done.
- Never edit files in src/generated/; change the schema and run npm run gen.
- New API routes go in src/app/api/<name>/route.ts.

Each checkable rule names a command, a folder or a file pattern. You can see at a glance whether the agent followed it, and so can a hook.

When a skill or vault helps, and when it does not

Helps

  • Moving a long procedure out of CLAUDE.md into a skill shortens the always-loaded file, which the docs tie to better adherence.
  • A hook enforces the one rule that must never be broken, whatever the model remembers.

Does not help

  • A skill does not make the model obey CLAUDE.md; a shorter, checkable file does.
  • Adding more instruction files on top of a long one makes conflicts more likely.