← Blog · 2026-10-18
CLAUDE.md or .claude/rules Not Working? 12 Causes and Fixes
Shortcut: paste your rule files into our free Claude Code rules checker. It shows which rules load at launch, which load only for matching files and which never load, tests file paths against your
paths:globs, and lints a CLAUDE.md's imports and length. It runs in your browser.
Claude Code reads two kinds of instruction files:
| File | When it loads |
|---|---|
CLAUDE.md or .claude/CLAUDE.md in your working directory or any folder above it, plus CLAUDE.local.md |
At launch |
~/.claude/CLAUDE.md |
At launch, in every project |
CLAUDE.md in a subfolder of your working directory |
When Claude reads, writes or edits a file in that subfolder |
.claude/rules/*.md with no paths frontmatter, and ~/.claude/rules/*.md |
At launch |
.claude/rules/*.md with paths frontmatter |
When Claude reads, writes or edits a matching file |
When an instruction doesn't seem to apply, the file either didn't load, loaded at a different moment than you expected, or loaded and Claude didn't follow it. Work through the checks below in order.
If the problem is notes Claude saved for itself (auto memory, MEMORY.md) rather than files you wrote, see Claude Code auto memory not working? 12 causes and fixes.
First: see what loaded
Run /context in a session and look at the list under Memory files. If a file is missing there, Claude can't see it. Two exceptions: a subfolder's CLAUDE.md and a rule with paths don't appear at launch, because they load later. When one loads, a one-line Loaded notice with its path appears in the terminal.
For a full log, add an InstructionsLoaded hook. It fires for every CLAUDE.md and rule file as it loads and receives the file_path, a load_reason (session_start, nested_traversal, path_glob_match, include or compact) and, for lazy loads, the trigger_file_path that caused it. Our hooks generator writes the settings block for you.
The file never loads: 6 causes
- It's in the wrong place or has the wrong name. A project file must be
./CLAUDE.mdor./.claude/CLAUDE.mdin the folder you start Claude Code in or a folder above it. Rules must be.mdfiles inside.claude/rules/(subfolders such as.claude/rules/frontend/are fine) or~/.claude/rules/. Claude Code doesn't read Cursor's.cursor/rules/*.mdcor Copilot's.github/copilot-instructions.mdas rules. Fix: move the file. Running/initcan fold Cursor and Copilot rules into a generated CLAUDE.md. - You edited it during the session. Your project-root and user CLAUDE.md files are read once at session start and held in memory, so edits don't apply to the running session. Fix: run
/clearor/compact, or restart. Subfolder CLAUDE.md files and path-scoped rules are different: editing one before it loads does take effect, but once it has loaded, a later edit doesn't change what's already in the conversation. - An
AGENTS.mdand aCLAUDE.mdcompete. By default Claude readsAGENTS.mdonly when there's noCLAUDE.md,.claude/CLAUDE.mdorCLAUDE.local.mdin your working directory or above it, so adding aCLAUDE.local.mdfor yourself can stop Claude reading the team'sAGENTS.md. ReadingAGENTS.mddirectly needs v2.1.277 or later. Fix: in/config, set Project instructions toclaude-md-and-agents-md, or put@AGENTS.mdat the top of yourCLAUDE.md. - Something excludes it. Check four places.
claudeMdExcludesin any settings file skips CLAUDE.md and rules files whose absolute path matches its globs. AReaddeny rule that covers the file withholds it, with anInstruction file not loaded (a Read deny rule covers it)notice, and so doespermissions.blockReadsOutsideWorkingDirectoriesfor a file outside your working directories. Project rules are skipped when you start with--setting-sourcesthat leaves outproject. And Project instructions set tomanaged-onlyleaves out your own CLAUDE.md files and rules at launch. Fix: narrow the exclusion or deny rule, then start a new session. - The folder came from
--add-dir. Claude can read and edit files in an added directory, but its CLAUDE.md files aren't loaded by default. Fix: setCLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD=1. That loads the added folder'sCLAUDE.md,.claude/CLAUDE.md,.claude/rules/*.mdandCLAUDE.local.md. - It's a symlink to somewhere outside the project. A
.claude/rules/link whose target is outside your working directory is treated like an external import: it waits for the approval dialog at the start of a session, and after approval only linked rules withoutpathsload. A link to a network path (a UNC share,/netor/Network) isn't followed at all. Fix: keep shared personal rules in~/.claude/rules/, which needs no approval, or copy the file into the project.
A path-scoped rule loads at the wrong time: 4 causes
- The frontmatter doesn't parse, so the rule loads everywhere. If the YAML between the
---markers doesn't parse, Claude Code ignores the frontmatter and loads the rule as if it had nopaths. The usual culprit is an unquoted glob:paths: **/*.tsis invalid YAML because*starts an alias, andpaths: {src,lib}/**/*.tsreads as a mapping. A backslash inside double quotes, as in"photos \[2024/**", is an invalid escape. Fix: quote every pattern, and use single quotes for patterns with a backslash. Runclaude --debugto see the parse error.
---
paths:
- "src/api/**/*.{ts,tsx}"
- 'photos \[2024/**'
---
- The field is called something else.
pathsis the only field Claude Code reads from a rule, and any other field is ignored without an error. A file converted from Cursor withglobs:andalwaysApply:, or from Copilot withapplyTo:, has nopaths, so it loads in every session. Fix: rename the field to lowercasepaths. It accepts a YAML list or a comma-separated string. - The pattern never matches. Patterns are globs:
*stays inside one folder and**crosses folders. So*.mdmatches Markdown files in the project root only (use**/*.mdfor every folder), andsrc/apiwith no wildcard matches only a file with exactly that path (usesrc/api/**). A[that doesn't form a bracket expression, as inphotos [2024/**, makes that pattern match nothing; escape it as\[. Brace groups multiply: a rule's wholepathslist shares a budget of 1,000 expanded patterns, and a pattern past the budget is used unexpanded and matches nothing. Also check what triggers the load: the Read, Write or Edit tool on a matching file, or a single-filecatorhead. A search across files doesn't. Fix: type real file paths into the rules checker to see which pattern, if any, matches. - It was there, then
/compactdropped it. After compaction, Claude re-reads the project-root CLAUDE.md and rules withoutpathsfrom disk. Path-scoped rules and subfolder CLAUDE.md files were part of the conversation, so they're summarized away and come back only when a matching file is opened again. Fix: if a rule must survive compaction, remove itspathsfrontmatter or move it into the project-root CLAUDE.md.
It loaded, but Claude doesn't follow it: 2 causes
- The file is long, vague or contradicts another one. CLAUDE.md content reaches Claude as a user message after the system prompt, so it's guidance, not enforced configuration. Anthropic's target is under 200 lines per CLAUDE.md; longer files cost more context and reduce adherence, and Claude Code warns at startup and in
/statuswhen a file is over the recommended length. A file over 4 MiB is skipped. If two files disagree, including a user rule and a project rule, Claude may follow either one. Fix: make instructions concrete ("Use 2-space indentation", not "format code nicely"), move instructions that only matter for some files into path-scoped rules, and run/doctor prompt-audit(v2.1.283 or later) to find outdated and conflicting instructions. - An
@importdidn't resolve. Imports load at launch with the file that references them, up to four hops deep, and relative paths resolve from that file's folder, not your working directory. A path ends at the first space unless you put a backslash before it (@Design\ Docs/api.md), a path in quotes isn't imported at all, and@pathinside backticks or a code block stays literal. In a project file, an import outside your working directory triggers an approval dialog the first time; if you declined it, those imports stay disabled. Fix: paste the file into the CLAUDE.md section of the rules checker to list each import the way Claude Code reads it.
When it has to happen every time
If an instruction must run at a fixed moment, such as before every commit or after each edit, make it a hook: hooks run as shell commands and apply regardless of what Claude decides. For something that must never happen, use a permissions.deny rule (permissions builder). If your CLAUDE.md sets commit or pull request rules, turn off Claude Code's built-in git guidance with the includeGitInstructions setting and set the attribution text with attribution, so the two don't compete. And for instructions you want at the system-prompt level in scripts, pass --append-system-prompt at launch.
Quick reference
| Symptom | Likely cause | Fix |
|---|---|---|
Missing from /context Memory files |
Wrong folder or name, excluded, or AGENTS.md conflict | Checks 1, 3, 4 |
| Edit has no effect | File read once at session start | /clear, /compact or restart |
| Path-scoped rule loads in every session | Unparsable YAML or globs: instead of paths: |
Quote patterns; rename to paths |
| Path-scoped rule never loads | Pattern doesn't match, invalid [, over the brace budget |
Test paths in the rules checker |
| Rule disappears mid-session | /compact dropped a path-scoped rule |
Remove paths or move it to CLAUDE.md |
| Loaded but ignored | Long, vague or conflicting instructions | Under 200 lines, concrete wording, /doctor prompt-audit |
Facts on this page come from Anthropic's memory and rules, debug your configuration, prompt caching, context window, errors and hooks docs. Not affiliated with Anthropic.