Not a rule the model ignored from the start -- one that visibly held, and then quietly did not. There is a documented mechanism for this, and it is the direct cost of the advice everyone gives about keeping instruction files small.
Claude Code gives you more than one place to put an instruction, and they do not behave the same way when a long conversation compacts.
Re-injected from disk, intact: the project-root CLAUDE.md, unscoped rules, auto memory, and the plan written in plan mode.
Reloaded only when their trigger fires again: rules carrying paths: frontmatter, and nested CLAUDE.md files in subdirectories.
Source: code.claude.com/docs/en/context-window and /docs/en/memory. Checked 2026-09-20.
A path-scoped rule does not live in the system prompt. It enters the conversation as a message, at the moment Claude reads a file the glob matches. That makes it ordinary conversation history -- and compaction replaces conversation history with a summary.
So the rule applied while you were working in that directory, survived as long as the conversation did, and disappeared into a summary the moment the window filled. It will come back the next time a matching file is read, and not before.
Anthropic states the remedy in one sentence: "If a rule must persist across compaction, drop the paths: frontmatter or move it to the project-root CLAUDE.md."
Path-scoping is the recommended way to keep your root file small, and keeping the root file small is real advice -- the documented target is under 200 lines, because longer files consume more context and reduce adherence.
And path-scoping is also the thing that makes a rule lapse in long sessions. Both are true at once. The instinct to tidy a grown root file by scoping its rules is the instinct that removes them from the hard half of the session.
Ask what the rule is for.
Two other things worth knowing while you are in there. Imports do not help -- a file pulled in with @path loads at launch like everything else, so splitting for tidiness does not reduce context. And auto memory has its own ceiling: the first 200 lines or 25KB of the index, whichever comes first, and everything past that is dropped at load rather than partially read.
If the instruction never held, it is a writing problem -- the rule is a prohibition with no alternative, or it has a scope gap. If it held and then stopped, look at where it lives before you rewrite a word of it.
This page is one section of claude-md-rules, one of the Agent Skills in this set. The skills are plain SKILL.md markdown -- no install, no runtime, no dependency. Drop a folder into ~/.claude/skills/ and invoke it by name.
Four of them are free and need no signup: github.com/resilientmindset01-commits/claude-code-skills-free
Written by ResilientMindset. Not affiliated with, endorsed by, or sponsored by Anthropic. Every claim about Claude Code on this page was checked against Anthropic's own documentation on the date shown.