Claude Code ignores my CLAUDE.md
Two different problems hide behind that sentence. Either the file never reached Claude, which you can prove in one command, or it did and Claude didn't follow it, which no file edit fully fixes. Here is how to tell them apart and what works for each.
Quick check. In the session, run /context all and look under Memory files. If your CLAUDE.md isn't listed, it didn't load, and one of the four causes below is why. If it is listed, skip to loaded but ignored.
Two problems, one symptom
When I started looking at the GitHub issues for this, I expected most of them to be about the model. A lot are. But a good share turned out to be files that never loaded at all: a CLAUDE.md in a sibling package, an @import with a full stop glued to it, an AGENTS.md sitting next to a CLAUDE.md. Those are worth ruling out first because they're mechanical and the fix takes a minute.
Anthropic's memory docs are blunt about the other half: "CLAUDE.md content is delivered as a user message after the system prompt, not as part of the system prompt itself. Claude reads it and tries to follow it, but there's no guarantee of strict compliance, especially for vague or conflicting instructions." So once you've confirmed the file loads, the work shifts from the file to the rule.
1. You started in the wrong folder
Claude Code loads CLAUDE.md "from your current working directory and every directory above it" at launch. Files in subfolders load later, "once Claude reads, writes, or edits another file in that subdirectory". Files in sibling folders never load.
So if you run claude in packages/web, the root CLAUDE.md and packages/web/CLAUDE.md load; packages/api/CLAUDE.md does not, however relevant it is. And if you run it at the repository root, packages/web/CLAUDE.md shows up only after Claude touches a file in there, and it never appears under Memory files because it wasn't there at launch. The docs say a Loaded line with the path is printed in the terminal at that moment.
The docs add a detail that trips people up when testing: create the subfolder file from your shell, not by asking Claude to write it, then ask Claude to read a file in that folder. There's more on this in CLAUDE.md in a monorepo.
2. An import that doesn't expand
An @path import pulls another file into context with the CLAUDE.md that names it. The path runs to the next space, and that is the whole problem. Claude Code takes the word after @ as written, so these three lines load nothing, even when the file exists:
Follow @AGENTS.md.looks for a file calledAGENTS.md.with the full stop.See @docs/style.md: it matterslooks forstyle.md:.(see @docs/style.md)isn't read as an import at all, because the@comes straight after a bracket rather than a space or the start of a line.
I checked this against the parser in Claude Code 2.1.312 and with canary files while building the 0.4.0 linter, so the three cases above are tested, not inferred. The docs cover two more: a path in quotes "isn't imported at all", and anything inside backticks or a code block is skipped on purpose, so `@README` is just text.
The fix is the same every time: put the import on its own line, or a space on both sides of it. There are five more ways an import can load nothing (a space in the path, a chain over four hops, a tag block, an ancestor file, an external path); CLAUDE.md @import not working has the test results for each.
There is a quieter case, and I got it wrong myself before writing this. Start Claude Code in packages/api and the root CLAUDE.md loads, because ancestors always do, but its @AGENTS.md now points at a file outside the folder you started in. The docs call that an external import: "The first time Claude Code encounters external imports in a project, it shows an approval dialog listing the files. If you decline, the imports stay disabled and the dialog doesn't appear again." Say yes once and they load from then on, for you. claude -p never asks, so in a script or CI run they never load unless someone already said yes on that machine. The answer is stored per user, not in the repository, so a teammate's clone starts from the question again. The 0.4.0 load view mislabelled this as "not expanded" (every canary run was headless, so I never saw the prompt); 0.4.1 lists those imports under their own heading, waiting for approval. If a rule has to be there from every start folder and in CI, write it in the root file rather than importing it.
3. CLAUDE.md is hiding your AGENTS.md
If your rules live in AGENTS.md so that Codex and Cursor read them too, remember that Claude Code reads AGENTS.md only "when you have no CLAUDE.md or CLAUDE.local.md in your working directory or above it". One CLAUDE.md anywhere on that path, even an empty one, and even a personal CLAUDE.local.md, switches AGENTS.md off.
The fix from the docs: either delete the CLAUDE.md, or put @AGENTS.md in it on its own line so the shared file comes in through the import, or set Project instructions to claude-md-and-agents-md in /config. The full table of which file wins is in AGENTS.md vs CLAUDE.md.
4. The file was cut short
Three limits, all from the docs, read on 15 November 2026:
- A CLAUDE.md that loads at launch is delivered in full as long as it is 4 MiB or smaller. Over that, "Claude Code skips a file over 4 MiB and loads none of it".
- A subfolder CLAUDE.md, a rules file in a subfolder, or any path-scoped rule has a per-file limit: 40,000 characters on a 200K context window. Over it, "Claude receives only the start of it", followed by a note telling Claude to read the rest with the Read tool. Until it chooses to, the later rules aren't in context.
wc -mgives the character count. - Auto memory's
MEMORY.mdloads "first 200 lines or 25KB" every session. Anything you wrote below line 200 isn't there.
Separate from the hard limits, there's the soft one: "Files over 200 lines consume more context and may reduce adherence", and you get a warning at startup and in /status when a file passes it. How many tokens does my CLAUDE.md cost? has real files measured.
Check all four at once
Inside a session, /context all is the ground truth. From a terminal, without starting Claude, the AsItIs CLI prints what would load for any start folder, which imports resolve, what loads later, and what never loads with the reason. This is the real output on a small test repository I set up with every mistake on this page in it:
$ npx -y asitis@0.4.8 loads --tool claude-code
Claude Code: about 108 tokens at launch from 4 files; 3 more files can load later; 1 not loaded
At launch
1. CLAUDE.md, about 43 tokens, project instructions
2. docs/conventions.md, about 18 tokens, imported by CLAUDE.md
3. @AGENTS.md.: not loaded as written (see lint_steering), not counted
4. @docs/style.md).: not loaded as written (see lint_steering), not counted
5. .claude/rules/always.md, about 5 tokens, rule without paths, so it loads every session
6. Skill listing (2 entries), about 42 tokens
Later, when the agent works in a folder or on matching files
7. .claude/rules/frontend.md, when Claude reads or edits a file matching apps/web/** (no file matches now)
8. packages/api/CLAUDE.md, when Claude reads or edits a file in packages/api
9. packages/web/CLAUDE.md, when Claude reads or edits a file in packages/web
Not loaded
- AGENTS.md: CLAUDE.md switches off the AGENTS.md fallback, and no CLAUDE.md imports it
How sure: 7 confirmed with a canary run. Lines 3 and 4 are the two broken imports; the "Not loaded" line is the shadowed AGENTS.md; the frontend rule on line 7 points at a folder that doesn't exist. The linter says the same things as findings with a fix each:
$ npx -y asitis@0.4.8 lint
CLAUDE.md:5:1 warning broken-import "@AGENTS.md." is not loaded: Claude Code reads the path as "AGENTS.md.", with the "." on the end, and no file has that name. Put a space before the "." or drop it
CLAUDE.md:6:1 warning broken-import "@docs/style.md)." is not loaded: Claude Code only reads an @import that starts a line or follows a space, and this one comes right after "(". Take it out of the parentheses or put a space on both sides
.claude/rules/frontend.md:2:1 warning path-rule-matches-nothing No file in this project matches paths "apps/web/**". Claude Code loads this rule only when it reads a matching file, so it never loads. Fix the pattern or delete the file Both run with npx -y asitis@0.4.8 loads and asitis lint. They read the files and nothing else: no network, no writes. Inside Claude Code the same checks are /asitis:md-loads and /asitis:md-lint once the plugin is installed. Your ~/.claude/CLAUDE.md and anything above the project folder aren't shown, and the claudeMdExcludes setting isn't read, so the defaults are assumed.
Loaded, but ignored
If the file is under Memory files and the rule is still broken, you're in the half that no loader fixes. What the docs recommend, in their order, with my notes:
- Make it specific. The docs' example: "Use 2-space indentation" works better than "format code nicely." A rule you could check with a script is a rule the model can check too.
- Remove contradictions. "If two files give different guidance for the same behavior, Claude may pick one arbitrarily." The usual pair is a root CLAUDE.md that says one thing and a package file or a rules file that says the opposite. The linter reports those as
nested-contradictionandcontradiction. - Check what Claude Code adds on its own. If your rule is about commits or pull requests, it competes with built-in guidance. The docs point at the
includeGitInstructionsandattributionsettings to turn that off. - Shorten the file. Over 200 lines "may reduce adherence". Move area-specific rules into
.claude/rules/files with apathsfield and procedures into skills. CLAUDE.md best practices covers what to keep. - Don't shout. Capitals and "ALWAYS" at the top of a long file don't change the delivery mechanism. Fewer, clearer rules do more than louder ones.
And then the honest part. The docs say Claude "treats them as context, not enforced configuration. To block an action regardless of what Claude decides, use a PreToolUse hook instead." That's the line to act on.
Rules that must hold: deny rules and hooks
Two mechanisms run whether or not the model remembers your rule.
Permission deny rules go in .claude/settings.json (committed, for the team) or ~/.claude/settings.json. The settings docs give the shape; the example there stops Claude reading .env files with "deny": ["Read(./.env)", "Read(./.env.*)"]. The same block takes Edit(...) and Bash(...) patterns.
Hooks are shell commands Claude Code runs at fixed points. The hooks guide puts it plainly: they give "deterministic control: certain actions always happen rather than relying on the LLM to choose to run them." A PreToolUse hook that exits with code 2 blocks the tool call and sends its stderr to Claude as the reason. This one refuses force pushes:
{
"hooks": {
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [{ "type": "command", "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/no-force-push.sh" }]
}
]
}
} #!/bin/bash
INPUT=$(cat)
COMMAND=$(echo "$INPUT" | jq -r '.tool_input.command')
if echo "$COMMAND" | grep -q "push --force"; then
echo "Blocked: force pushes are not allowed here" >&2
exit 2
fi
exit 0 The script shape is the one from the hooks guide (it reads the tool input as JSON on stdin, so it needs jq). Swap the grep for whatever your rule is. "Run the tests before every commit" becomes a hook on Bash that matches git commit and runs them; "never edit generated files" becomes an Edit|Write hook that checks the path. The rule can stay in CLAUDE.md so Claude knows why; the hook is what makes it true.
Check your file
The steering file checker flags broken @imports, a CLAUDE.md over 200 lines, contradictions and hidden text in one file. For the whole project, the plugin's /asitis:md-loads shows what Claude Code loads from any start folder. Both are read-only.
Open the steering file checker
To check every steering file in a project from inside Claude Code, including links, @imports and what loads every session, install the free AsItIs plugin. It is read-only and makes no network calls.
claude plugin marketplace add Katta041/asitis-agent-tools
claude plugin install asitis@asitis About the pluginSource on GitHub
MIT licensed. A star on GitHub helps other people find it.
Questions
How do I check whether Claude Code loaded my CLAUDE.md?
Run /context all in the session and look under Memory files. Every CLAUDE.md and CLAUDE.local.md that loaded at launch is listed there, with its imports. A subfolder CLAUDE.md is not in that list because it loads later; when it does, a Loaded line with its path appears in the terminal. Outside a session, asitis loads prints the same list for any folder, plus the files that will never load and why.
Does Claude Code re-read CLAUDE.md when I edit it mid-session?
Anthropic's docs say the project-root CLAUDE.md is re-read from disk after /compact. For an edit you make mid-session, the safe assumption is that a new session, or the next compaction, picks it up. Nested CLAUDE.md files and path-scoped rules load again on demand.
Why does Claude Code ignore my AGENTS.md?
Because there is a CLAUDE.md, .claude/CLAUDE.md or CLAUDE.local.md in your working folder or above it. By default Claude Code reads AGENTS.md only when none of those exist. Add the line @AGENTS.md to the CLAUDE.md, or set Project instructions to claude-md-and-agents-md in /config.
The file loaded and Claude still breaks the rule. What now?
That is normal for some kinds of rule, and the docs say so: CLAUDE.md is context, not enforced configuration. Make the rule specific and checkable, remove any rule that contradicts it, keep the file under 200 lines, and for anything that must hold every time (no force pushes, no edits to .env, tests before every commit) use a permissions.deny rule or a PreToolUse hook. Those run whether or not Claude remembers the rule.
See what an agent changed in your CLAUDE.md. Keep or revert each change.
The linter is free and needs no signup. I'm also building a desktop editor for the markdown your agents write and read. It shows what an agent changed since you last looked, lets you keep or revert each change, and never touches a line you didn't edit. No release date yet. One email to confirm, one when the paid beta opens, one when 1.0 ships. $29 once for a founding licence, with 24 months of updates.
Or add the linter to CI, no email needed.
Your address is stored with Cloudflare, which hosts this site. No IP address is kept. See the privacy policy.
Related: CLAUDE.md in a monorepo, AGENTS.md vs CLAUDE.md, CLAUDE.md best practices, Claude Code skill not triggering.
Sources, read on 15 November 2026: Claude Code docs, How Claude remembers your project (the import rules, the AGENTS.md table, the size limits and the "Troubleshoot memory issues" section), Automate actions with hooks and Settings files and precedence. Quotes are exact. The import punctuation cases were checked against Claude Code 2.1.312, and the external-import prompt against 2.1.312 and 2.1.325. Command output is from @asitis/mcp 0.4.2 (0.4.3 prints the same) on a fixture repository, trimmed for width.