
If Claude Code ignores CLAUDE.md, the most likely reason is that it never read the file in the first place. A wrong file name, a file in the wrong folder or an AGENTS.md hidden behind another CLAUDE.md all look like “ignoring” from the outside.
The quick fix: run /context all in your session and look under Memory files. If your CLAUDE.md is not listed, Claude can’t see it, so rename it to exactly CLAUDE.md and put it in the folder where you start Claude Code (or in .claude/). If it is listed, the problem is the wording: make each rule short and specific, remove conflicting lines, keep the file under 200 lines, and move anything that must always happen into a hook.
We reproduced the two most common causes in a real session below, a misnamed file and a skipped AGENTS.md, and showed each fix working.
Browse all our Claude Code tutorials for more fixes and how-tos.
Tested with Claude Code v2.1.332 on macOS on November 29, 2026. We used two throwaway demo projects, tip-shop and agents-demo, each with one tiny Python file and a fresh Git repository, and started Claude Code with project and local settings only so our personal setup stayed out of the test.
We tested on macOS; the Windows and Linux steps follow Anthropic’s official instructions, and the file names and commands work the same way there.
Quick Summary
| Cause | How to spot it | Fix | Tested by us? |
|---|---|---|---|
| Wrong file name | Not listed in /context all | Rename to exactly CLAUDE.md | Yes |
| Wrong folder | Not listed in /context all | Use ./CLAUDE.md or ./.claude/CLAUDE.md | From the docs |
| AGENTS.md skipped | AGENTS.md missing from /memory | Add @AGENTS.md to CLAUDE.md | Yes |
| File too long | Startup size warning, wc -m | Trim or split into .claude/rules/ | From the docs |
| Vague or conflicting rules | Claude follows some rules, not others | Specific wording, /doctor prompt-audit | From the docs |
| Rule must never be skipped | Works most of the time only | Hook or deny rule | From the docs |
Why Claude Code Ignores CLAUDE.md
A CLAUDE.md file is plain text that Claude Code reads at the start of a session. If you are new to it, our guide to CLAUDE.md project memory covers the basics.
Anthropic’s memory documentation is clear about one thing: CLAUDE.md is context, not enforced configuration. Its content arrives as a user message after the system prompt, and Claude tries to follow it, but there is no guarantee, especially for vague or conflicting instructions.
So “Claude ignores my CLAUDE.md” really splits into two problems:
- The file never loaded. Claude has no idea your rules exist. This is the most common case and the easiest to fix.
- The file loaded, but the rules are vague, buried, too long or in conflict with another file. Claude saw them and picked something else.
Check that the file loaded before you rewrite a single rule. Many “ignored” files were simply never read.

Step 1: Check Whether Claude Code Loaded Your CLAUDE.md
Here is the exact setup we tested. Our tip-shop project had a file of rules saved as CLAUDE.md.txt, which is easy to do by accident when a text editor adds its own extension. The rules said prices use a $ sign with two decimals, and every reply ends with the line “Rules checked.”
We asked Claude a simple question: “In one sentence, what does with_tax in prices.py do?” The answer was correct, but it did not end with “Rules checked.” and it gave no example price.

The /memory command makes the reason clear. It lists the places Claude Code looks for instructions, and the project entry points at ./CLAUDE.md, not CLAUDE.md.txt. The docs note that /memory shows the user and project entries even when those files don’t exist yet, so seeing a path there does not prove the file loaded.

The reliable check is /context all. Anthropic’s docs say to look at the list under Memory files: if your file is missing there, Claude can’t see it.
Fix 1: Use the exact file name and location
We left Claude Code, renamed the file, checked its size and started a new session:
mv CLAUDE.md.txt CLAUDE.md
wc -m CLAUDE.md
claude
This time /context all listed the file under Memory files, using 66 tokens.

We asked the same question again. Claude answered, added a $21.59 example with two decimals and ended with “Rules checked.” Both rules were followed on the first try.

Valid names and places for a project file, according to the docs:
./CLAUDE.mdor./.claude/CLAUDE.mdin the folder where you start Claude Code, or any folder above it./CLAUDE.local.mdfor personal, uncommitted notes (add it to.gitignore)~/.claude/CLAUDE.mdfor personal rules across all your projects
Our post on every CLAUDE.md location walks through each one in more detail.
How CLAUDE.md Files Load (and When They Don’t)
Knowing the load rules explains most “it worked yesterday” puzzles. Claude Code loads CLAUDE.md and CLAUDE.local.md from your working folder and every folder above it, and joins them together. Nothing overrides anything; files closer to where you started Claude are read last.

A few load rules trip people up:
- Subfolder files load later. A
CLAUDE.mdinsrc/does not load at launch and won’t show under Memory files. It loads once Claude reads, writes or edits a file in that folder. - Extra folders need a switch. Folders added with
--add-dirdon’t load theirCLAUDE.mdunless you setCLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD=1. - HTML comments are stripped. Block-level
<!-- notes -->inCLAUDE.mdnever reach Claude, so a rule written inside one is invisible. - Imports need care. A path in quotes is not imported, a path with spaces needs a backslash before each space, and a path inside backticks stays plain text.
- Excluded files stay out. A
claudeMdExcludespattern in your settings can skip a file on purpose, so check it if one file never shows up.
Step 2: Fix an AGENTS.md That Claude Code Ignores
Many repos keep shared agent rules in AGENTS.md. Since v2.1.277, Claude Code can read it directly, but by default only when there is no CLAUDE.md or CLAUDE.local.md in your working folder or above it. Add a small CLAUDE.md and your AGENTS.md silently drops out.
Our agents-demo project had exactly that: an AGENTS.md with our price rules, plus a one-line CLAUDE.md that said “Keep answers short.” The /memory list had no sign of AGENTS.md.

Fix 2: Import AGENTS.md from CLAUDE.md
The docs recommend putting an import line at the top of CLAUDE.md. Claude reads the imported file first, then the rest:
@AGENTS.md
# Notes for Claude
- Keep answers short.After a restart, /memory showed AGENTS.md under Project instructions, marked as imported.

Our test question now came back with a $21.59 example and the closing line from AGENTS.md.

Other options from the docs, if the import doesn’t suit you:
- Open
/configand set Project instructions toclaude-md-and-agents-mdto load both files. - Check
claude --version: readingAGENTS.mddirectly needs v2.1.277 or later, and some sessions need v2.1.281 or later. - Remember that a personal
CLAUDE.local.mdalso counts, so it hidesAGENTS.mdtoo.
For the full comparison, see our post on AGENTS.md vs CLAUDE.md.
Step 3: Fix Rules That Load but Still Get Ignored
If /context all lists your file and Claude still drifts, the problem is in the file itself. These fixes come from Anthropic’s troubleshooting guide.
Fix 3: Keep the file short
Anthropic suggests under 200 lines per CLAUDE.md, because longer files use more context and reduce adherence. Claude Code skips a file over 4 MiB entirely, and you see a startup warning when a file is over the recommended length.
Subfolder CLAUDE.md files and on-demand rules have a separate character limit: 40,000 characters with a 200K context window. Over that, Claude only gets the start of the file. Run wc -m path/to/CLAUDE.md to check, and split large files into .claude/rules/ files, which each count on their own.
Fix 4: Make rules specific
“Use 2-space indentation” works, while “Format code nicely” does not. The same goes for “Run npm test before committing” versus “Test your changes.”
Group rules under headings with bullets rather than long paragraphs. Our CLAUDE.md template shows this layout.
Fix 5: Remove conflicts
If two files disagree, the docs say Claude may pick either one. Check your personal ~/.claude/CLAUDE.md, parent folders, subfolders and .claude/rules/. Running /doctor prompt-audit (v2.1.283 or later) asks Claude to find outdated or conflicting instructions and propose edits without changing anything until you agree.
Watch for rules that compete with Claude Code’s own guidance too. For commit and pull request rules, the docs point to the includeGitInstructions and attribution settings.
Fix 6: Use a hook for must-happen rules
Anything that must run every time, like a formatter after each edit or a check before each commit, belongs in a hook. Hooks run as shell commands at fixed points, whatever Claude decides. Our hooks guide covers setup, and Anthropic’s hooks documentation has the full reference.
Fix 7: Rules lost after /compact
The project root CLAUDE.md survives compaction, because Claude re-reads it from disk. Instructions you only typed in chat do not, and nested files reload only when Claude touches their folder again.
Put anything you want to keep into CLAUDE.md. Our context window guide explains compaction in more depth.
Try It Yourself
Make a test folder with a rule that is easy to spot, then check that Claude reads it:
mkdir rule-test && cd rule-test
printf '# Rules\n\n- End every reply with the exact line: Rules checked.\n' > CLAUDE.md
claudeInside the session, run /context all, confirm CLAUDE.md is under Memory files, then send this prompt:
In one sentence, what is this folder for?If the reply ends with “Rules checked.”, the file loaded. Now rename it to CLAUDE.md.txt, start a new session and watch the line disappear.
Common Mistakes
- Saving the file as
CLAUDE.md.txt,claude.markdownor similar. - Putting the file in
docs/and expecting it to load at launch. - Asking Claude to “read AGENTS.md” in words instead of using
@AGENTS.md. The docs say Claude only sees it if it decides to open the file. - Writing rules inside HTML comments, which are stripped.
- Stacking hundreds of lines of rules into one file.
- Trusting
CLAUDE.mdfor safety rules. Use deny rules or hooks for those.
Pro Tips
- Add one test rule, like a fixed closing line, while you debug, then remove it once you know the file loads.
- Use the
InstructionsLoadedhook to log which instruction files load and why. The docs suggest it for path-scoped and subfolder rules. - Run
claude --debugif a rules file haspathsfrontmatter that seems ignored; bad YAML is reported there. - If Claude keeps adding files you didn’t ask for, pair your rules with deny rules as shown in our fix for unwanted extra files.
- For other startup problems, our list of common errors and the
/doctorcheck are good next stops.
Cheat Sheet

Frequently Asked Questions
How do I know if Claude Code read my CLAUDE.md?
Run /context all and look under Memory files. If your file is listed there, it loaded at launch. Subfolder files appear later, with a Loaded line in the terminal.
Does Claude Code read AGENTS.md?
Yes, from v2.1.277, but by default only when no CLAUDE.md or CLAUDE.local.md exists in your working folder or above it. Add @AGENTS.md to your CLAUDE.md to load both.
Is CLAUDE.md case sensitive?
Use the exact name CLAUDE.md, as the docs do. Some file systems treat case differently, so the exact spelling is the safe choice for everyone who clones the repo.
Why does Claude follow CLAUDE.md sometimes but not always?
It is guidance, not enforced config. Vague, long or conflicting rules get followed less often. Make rules specific, keep the file short, and use hooks or deny rules for anything that must always happen.
Do I need to restart Claude Code after editing CLAUDE.md?
Starting a new session is the simplest way to be sure the change is picked up, which is what we did in our tests. Then confirm with /context all.
Conclusion
When Claude Code ignores CLAUDE.md, start by checking whether it read the file at all: /context all showed us that a file saved as CLAUDE.md.txt never loaded, and a simple rename fixed it on the next session, while an @AGENTS.md import brought back an AGENTS.md that a small CLAUDE.md had hidden. If the file does load, keep it short and specific, clear out conflicts with /doctor prompt-audit, and move must-happen rules into hooks, because CLAUDE.md steers Claude but never forces it. For more on Claude itself, see our Claude AI overview.


