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
- Start Claude Code in the folder you normally work from.
- Run
/context alland read the Memory files list. - Run
/memoryto open any listed file in your editor.
If the file you expect isn't there, work through this table:
| Situation | What happens | Fix |
|---|---|---|
| You launched from a sibling folder | Claude Code only walks up from where you started | Start in the project, or move the file above both folders |
| The file is in a subfolder | It loads the first time Claude reads, writes or edits a file there, so it's never in the launch list | Ask Claude to read a file in that folder, then look for the Loaded line |
Instruction file not loaded notice | A Read deny rule covers it, it sits outside your working directories while reads are blocked there, or it's a link that loops | Change the rule or the link, or leave it if the restriction is intended |
The file is in an --add-dir folder | Not loaded by default | Set CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD=1 |
A claudeMdExcludes pattern matches | The file is skipped | Check that key at every settings level, since the arrays merge |
Project instructions is managed-only | Project, local and user files are left out at launch | Change it in /config |
| The file is over 4 MiB | Claude Code skips it | Trim it |
| A symlink points at a network path | The link isn't followed | Keep a local copy |
You started with --safe-mode | Your customizations are off, CLAUDE.md included | Start 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 testbefore 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
includeGitInstructionsand set the attribution text withattribution. - 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 want | Use |
|---|---|
| A step that runs after every edit or before every commit | A hook |
| A command or file Claude can never touch | permissions.deny in settings.json, or a PreToolUse hook |
| A multi-step procedure | A skill |
| A rule for one part of the codebase | .claude/rules/ with paths frontmatter |
| Instructions at the system prompt level, for scripts | The --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
InstructionsLoadedhook logs which CLAUDE.md and rules files load, when, and why. This helps with path-scoped rules and subfolder files. claude --safe-modestarts 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 launchRelated guides
- Where does Claude Code look for CLAUDE.md files?
- Which Claude Code settings.json wins? File locations and precedence
- How to stop Claude Code asking permission for every command
- How long should CLAUDE.md be? Trimming a CLAUDE.md that Claude ignores
- Does Claude Code read AGENTS.md? CLAUDE.md vs AGENTS.md and .cursorrules
- Where are Claude Code skills stored, and how are they found?
- Where do Claude Code hooks go? File locations and scope
- How to share CLAUDE.md across projects or a team
- How to import other files into CLAUDE.md