DEV Community

Cover image for Claude Code Ignoring CLAUDE.md? See What's in Its Context

Claude Code Ignoring CLAUDE.md? See What's in Its Context

Gábor Mészáros on November 05, 2026

When Claude Code ignores a rule, the usual move is to reword it. Start with the verb, use backticks for literals, bold segments that you want to ma...
Collapse
 
nark3d profile image
Adam Lewis •

A nested file never loading deserves attention, because the agent did read the code it governs, just through sed. Any rule that only exists in a folder CLAUDE.md is conditional on the agent arriving there by a path that triggers the load. That pushes must-follow rules up to the launch files or behind a hook that checks the edit itself. Otherwise the rule is decoration until someone opens the file by hand.

Collapse
 
cleverhoods profile image
Gábor Mészáros Reporails •

yep, xray was built for this.
Since the article release a few stuff was added to help people figure out what's going on.
For example around /compact. People seems to think that the previously loaded items are all reloaded, whilst it's not the case.

It's also worth mentioning that an event-bus type progressive disclosure is an absolute must nowadays for good context building: dev.to/reporails/progressive-discl...

Collapse
 
paullovelace profile image
Paul Lovelace •

The loaded-vs-never-loaded split is the check I'd steal first — I've reworded rules that were never in context at all, which is just shouting at a file the agent never read. Two of eleven instruction files loading, and the self-declared primary one for the folder being edited not among them, is the kind of thing that would take me weeks to notice. When a rule loads and still gets ignored, do you find it's usually wording, or the rule fighting something else in context?

Collapse
 
cleverhoods profile image
Gábor Mészáros Reporails •

When I was still using rules instead of an event-bus based system (recommending the Progressive Disclosure series for that) what was frequent is that the rules overlapped, and some of them had contradicting instructions. On earlier models it created a healthy random havoc, on the Opus/Sonnet/Haiku 5.5 family it followed what was loaded last. That created a different type of havoc.

Since switching to an event bus progressive disclosure, these issues are long gone.

Collapse
 
alexshev profile image
Alex Shev •

Context visibility is the right diagnostic primitive here: a configuration file is only useful if you can prove what the agent actually received.

A context report should include source, ordering, truncation, and the effective instruction text. That turns “it ignored the file” into a debuggable state rather than a debate about model behavior.

Collapse
 
cleverhoods profile image
Gábor Mészáros Reporails •

@alexshev thanks, most of that list is already in there: source and load state per file (that's where the 2/11 came from), ordering on the timeline, and tool, hook and subagent returns as the agent actually got them. Truncation is the part I haven't finished yet, the cut shows up in the text but nothing flags it... what would you want there, a per-file flag or the size of what got cut?

Collapse
 
crisstiank profile image
Cristian K •

Checking the loaded-source list before rewriting a rule is a great distinction. For must-follow nested guidance, I’d add a small hook or CI assertion that the expected file exists and is present in context, so failures are visible. Do you see broken file references often, or is nested loading the more common culprit?

Collapse
 
cleverhoods profile image
Gábor Mészáros Reporails •

since the creation of Sagecompass I moved my progressive disclosure into an event-bus based strategy (more on that in this series: dev.to/cleverhoods/series/44293), so these issues are not present on the new projects that I'm working on.

What I'm usually seeing is that users expect certain things to be loaded and it causes quite some frustration when it's not the case. It's also equally annoying when irrelevant stuff is being loaded, that happens all the time with skills in the wild.

Since Reporails provides diagnostics for these artifacts, it made sense to provide an UI too so people would see what's going on.

Collapse
 
coldboothq profile image
Coldboot •

One case for the "conflict" side: a project's CLAUDE.md said to keep diffs scoped to the task. Claude was asked to add a function, noticed a type error on another line in the same file, and left it alone. That was the rule doing its job.

What sent it back was a Stop hook running the TypeScript check. The check failed, the hook exited 2, and Claude fixed the line before finishing.

So the rule loaded and was followed. It just pulled against something else that mattered, and rewording either one wouldn't have helped much. Moving the must-happen check out of prose and into a hook did, because a hook isn't competing with anything.

A rough test that came out of it: if two loaded rules can both be right at the same moment, it's a conflict, and whichever one must win probably belongs in a hook.

Collapse
 
alexshev profile image
Alex Shev •

Context visibility is the right diagnostic primitive here: a configuration file is only useful if you can prove what the agent actually received.