Why is Claude Code ignoring my CLAUDE.md?

Either the file never loaded, or it loaded and Claude didn't follow it. Run /context all and look under Memory files. If your CLAUDE.md is missing, it's a location or settings problem. If it's listed, the instruction is too vague, conflicts with another file, or needs a hook, because CLAUDE.md is context, not enforced configuration.

Step 1: Check whether the file loaded

  1. Start Claude Code in the folder you normally work from.
  2. Run /context all and read the Memory files list.
  3. Run /memory to open any listed file in your editor.

If the file you expect isn't there, work through this table:

SituationWhat happensFix
You launched from a sibling folderClaude Code only walks up from where you startedStart in the project, or move the file above both folders
The file is in a subfolderIt loads the first time Claude reads, writes or edits a file there, so it's never in the launch listAsk Claude to read a file in that folder, then look for the Loaded line
Instruction file not loaded noticeA Read deny rule covers it, it sits outside your working directories while reads are blocked there, or it's a link that loopsChange the rule or the link, or leave it if the restriction is intended
The file is in an --add-dir folderNot loaded by defaultSet CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD=1
A claudeMdExcludes pattern matchesThe file is skippedCheck that key at every settings level, since the arrays merge
Project instructions is managed-onlyProject, local and user files are left out at launchChange it in /config
The file is over 4 MiBClaude Code skips itTrim it
A symlink points at a network pathThe link isn't followedKeep a local copy
You started with --safe-modeYour customizations are off, CLAUDE.md includedStart a normal session

Lines inside block-level HTML comments (<!-- like this -->) are stripped before the content reaches Claude, so a rule inside one is invisible to it. Imports can fail quietly too: if you declined the approval dialog for files outside your project, those imports stay disabled. See how to import files into CLAUDE.md.

For the full list of locations, read where Claude Code looks for CLAUDE.md.

Step 2: If it loaded, find out why Claude isn't following it

CLAUDE.md arrives as a user message after the system prompt. Claude reads it and tries to follow it, with no guarantee of strict compliance. These are the causes the Claude Code docs name:

  • The instruction is vague. "Use 2-space indentation" works better than "format code nicely". "Run npm test before committing" works better than "test your changes".
  • Two files disagree. All discovered files are concatenated, none overrides another, and Claude may pick one arbitrarily. Compare your user file, project file, nested CLAUDE.md files and .claude/rules/.
  • The file is long. Adherence drops past about 200 lines. See how long CLAUDE.md should be.
  • It competes with built-in guidance. If your CLAUDE.md sets commit or pull request rules, turn off the built-in ones with includeGitInstructions and set the attribution text with attribution.
  • The file is cut off. A subfolder CLAUDE.md or an on-demand rules file over the per-file limit reaches Claude only in part: 40,000 characters in a 200K context window. Check with wc -m path/to/CLAUDE.md.
  • The session was compacted. The project-root file is re-read after /compact. Nested files and path-scoped rules wait until Claude next touches a matching file. Anything you said only in chat is gone.

Step 3: Move must-happen rules out of CLAUDE.md

If an instruction must hold every time, CLAUDE.md is the wrong place for it.

You wantUse
A step that runs after every edit or before every commitA hook
A command or file Claude can never touchpermissions.deny in settings.json, or a PreToolUse hook
A multi-step procedureA skill
A rule for one part of the codebase.claude/rules/ with paths frontmatter
Instructions at the system prompt level, for scriptsThe --append-system-prompt flag

Tools for finding the problem

  • /doctor prompt-audit (v2.1.283 or later) looks through your instruction files for outdated or contradictory lines and references to files that don't exist. Nothing changes until you ask it to apply the edits.
  • An InstructionsLoaded hook logs which CLAUDE.md and rules files load, when, and why. This helps with path-scoped rules and subfolder files.
  • claude --safe-mode starts with your customizations off, which tells you whether the problem comes from your configuration at all.

Conflicts between files are the hardest of these to spot one file at a time. Rulebook, the Mac app we are building, puts every level in one window so you can read them side by side and drag a rule to the file it belongs in.

Questions

How do I know if Claude Code loaded my CLAUDE.md?
Run /context all in a session and look under Memory files. A file listed there loaded. A CLAUDE.md in a subfolder won't appear, because it loads on demand; when it loads, a Loaded line with its path appears in the terminal.
Is CLAUDE.md part of the system prompt?
No. CLAUDE.md content is delivered as a user message after the system prompt. Claude reads it and tries to follow it, with no guarantee of strict compliance. For instructions at the system prompt level, launch with --append-system-prompt.
How do I force Claude Code to follow a rule every time?
Write the rule as a hook or a permission rule. Hooks run as shell commands at fixed lifecycle events whatever Claude decides, and a deny rule in settings.json blocks the action. CLAUDE.md shapes behavior but doesn't enforce it.
Why did Claude forget my instructions after /compact?
The project-root CLAUDE.md is re-read from disk after /compact. Nested CLAUDE.md files and path-scoped rules return only when Claude next touches a matching file. Instructions given only in chat are lost, so put those in CLAUDE.md.
Why does Claude ignore the end of a subfolder CLAUDE.md?
On-demand files over a per-file limit are cut off. Claude gets only the start plus a note to read the rest. The limit is 40,000 characters in a 200K context window. Run wc -m on the file, then trim it or split it into rules files.

Rulebook for Mac

Rulebook is a native Mac app we are building for these files. It shows every CLAUDE.md and settings.json level side by side, lets you drag a rule from one file to another, and edits permissions without hand-written JSON. See the features.

Rulebook is in development and not available yet.

Email us about the launch

Related guides