Claude Code Ignores CLAUDE.md? Why It Happens and How to Fix It

Claude Code Ignores CLAUDE.md? Why It Happens and How to Fix It

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

CauseHow to spot itFixTested by us?
Wrong file nameNot listed in /context allRename to exactly CLAUDE.mdYes
Wrong folderNot listed in /context allUse ./CLAUDE.md or ./.claude/CLAUDE.mdFrom the docs
AGENTS.md skippedAGENTS.md missing from /memoryAdd @AGENTS.md to CLAUDE.mdYes
File too longStartup size warning, wc -mTrim or split into .claude/rules/From the docs
Vague or conflicting rulesClaude follows some rules, not othersSpecific wording, /doctor prompt-auditFrom the docs
Rule must never be skippedWorks most of the time onlyHook or deny ruleFrom 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.

Decision ladder showing five checks when Claude Code ignores CLAUDE.md: loaded, AGENTS.md, size, wording and hooks
Work down this ladder: first make sure the file loads, then make the rules clear.

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.

Claude Code answering a question without following the rules in a file saved as CLAUDE.md.txt
The rules file was named CLAUDE.md.txt, so Claude never read it and skipped the “Rules checked.” line.

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.

Claude Code /memory menu showing project instructions expected at ./CLAUDE.md
The /memory menu shows where Claude Code expects project instructions: ./CLAUDE.md.

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
Terminal showing CLAUDE.md after renaming and wc -m reporting 174 characters
After the rename: the file is now CLAUDE.md, and wc -m reports 174 characters.

This time /context all listed the file under Memory files, using 66 tokens.

Claude Code /context all output listing CLAUDE.md under Memory files with 66 tokens
/context all now lists CLAUDE.md under Memory files, which means Claude can read it.

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.

Claude Code reply showing $21.59 and ending with Rules checked after CLAUDE.md was renamed
Same prompt after the fix: a $ price with two decimals and the “Rules checked.” line.

Valid names and places for a project file, according to the docs:

  • ./CLAUDE.md or ./.claude/CLAUDE.md in the folder where you start Claude Code, or any folder above it
  • ./CLAUDE.local.md for personal, uncommitted notes (add it to .gitignore)
  • ~/.claude/CLAUDE.md for 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.

Layer diagram of managed, user, parent folder, project and subfolder CLAUDE.md files and when they load
All found files are joined in order; subfolder files wait until Claude touches a file there.

A few load rules trip people up:

  • Subfolder files load later. A CLAUDE.md in src/ 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-dir don’t load their CLAUDE.md unless you set CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD=1.
  • HTML comments are stripped. Block-level <!-- notes --> in CLAUDE.md never 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 claudeMdExcludes pattern 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.

Claude Code /memory list without AGENTS.md because a CLAUDE.md exists in the same folder
With a CLAUDE.md in the folder, AGENTS.md is not read and does not appear in /memory.

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.

Claude Code /memory list showing AGENTS.md imported under project instructions
The @AGENTS.md line pulls the file in, and /memory lists it as imported.

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

Claude Code reply ending with AGENTS.md followed after the import was added
After the import, Claude followed the AGENTS.md rules and ended with “AGENTS.md followed.”

Other options from the docs, if the import doesn’t suit you:

  • Open /config and set Project instructions to claude-md-and-agents-md to load both files.
  • Check claude --version: reading AGENTS.md directly needs v2.1.277 or later, and some sessions need v2.1.281 or later.
  • Remember that a personal CLAUDE.local.md also counts, so it hides AGENTS.md too.

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
claude

Inside 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.markdown or 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.md for 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 InstructionsLoaded hook to log which instruction files load and why. The docs suggest it for path-scoped and subfolder rules.
  • Run claude --debug if a rules file has paths frontmatter 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 /doctor check are good next stops.

Cheat Sheet

Cheat sheet of commands and fixes when Claude Code ignores CLAUDE.md
Every check and fix from this guide on one card.

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.

Newsletter

New AI tools in your inbox

The best new tools and the AI news that matters, in one short email. Unsubscribe any time.

Free · No spam · Unsubscribe any time

✓ Looks like you’re subscribed

Loading Google’s sign-up form…

Looks like you’re already subscribed

Thanks for reading! New AI tools and the AI news that matters will land in your inbox.

Not subscribed yet? Refresh the page to load the sign-up form.

The sign-up form couldn’t load. If you use an ad or content blocker, allow news.google.com and reload the page.

Free instant check before you pay. Takes a few seconds.

Scroll to Top