Last reviewed
Correct answer: B. A compaction dropped it, and the root file was re-injected while it was not
Explanation
The principle — when one instruction survives and another does not, ask how each one got into context in the first place.
Why the key is correct — Anthropic documents both halves. Project-root CLAUDE.md survives compaction: after a compaction Claude re-reads it from disk and re-injects it. Rules carrying paths frontmatter do not get that treatment; they are loaded into message history when their trigger file is read, so compaction summarises them away with everything else, and they reload only the next time a matching file is opened. That is precisely the pattern described. An hour in, the session compacted; the root file came back from disk and the path-scoped rule did not, because nothing had re-read a file matching its patterns since. The rule is still on disk and still correct, and it is simply no longer in the conversation.
Why the others are wrong — gradual decay would have degraded both files together, and the asymmetry is the whole clue. Dismissing it as coincidence ignores an hour of consistent adherence ending cleanly rather than intermittently. And an override between instruction files is not a mechanism that exists, since discovered files are concatenated rather than replacing each other; nothing about elapsed time would trigger such a resolution even if it did.
Remember this — if a path-scoped rule has to survive compaction, drop its paths frontmatter or move it into the project-root file. Otherwise its lifetime is bounded by the next summarisation.
Sources — Anthropic's memory page and the context window page.
Sources
“Project-root CLAUDE.md survives compaction: after /compact, Claude re-reads it from disk and re-injects it into the session.”
“If a rule must persist across compaction, drop the paths: frontmatter or move it to the project-root CLAUDE.md.”
Practise 10 questions on this topic
Take Claude Code Basics — Timed Test 2 (10 questions) — scored instantly, explanation for every question, no login.