Path-scoped .claude/rules only load via the Read tool, while auto mode instructs the model to prefer Bash
What's Wrong?
Path-scoped rules (.claude/rules/*.md with paths: frontmatter) only enter context when a matching file is opened with the Read tool. Reading or changing the same file through Bash (cat, head, sed -i, a heredoc) does not load the rule.
On its own that would be an understandable limitation. It turns into a real problem because auto mode injects a system-prompt instruction that steers the model to exactly that path. Verbatim, as it appears in the system prompt when auto mode is active:
While auto mode is active: Do your work through the Bash tool wherever it can accomplish the job: read files with cat, head, or sed -n, search with grep and find, and make file changes with sed, heredocs, or short scripts, rather than using the dedicated Read, Edit, or Write tools. Fall back to a dedicated tool only when Bash genuinely cannot do the job.
So in auto mode the model is told to prefer the one form of file access that never triggers path-scoped rules. A project's coding conventions, security guardrails and per-directory instructions silently stop applying. Nothing in the transcript shows that a rule was skipped, so the user cannot see it happening.
For completeness: Write to a new file at a matching path does not load the rule either. That half overlaps with #82482, which reports the file-creation gap. This issue is about Bash access and about the interaction with auto mode's tool preference, which I could not find reported.
What Should Happen?
Path-scoped rules should load when Claude accesses a matching path, not only when it happens to use Read. Any of these would fix it:
- Match file paths that appear in Bash commands against rule
paths:and inject the matching rules before the command runs. - Do not steer the model away from the file tools in auto mode while those tools are the only rule trigger.
At the very least the two mechanisms should not contradict each other the way they do now.
Steps to Reproduce
In a project with one path-scoped rule:
# .claude/rules/probe.md
---
paths:
- "config/demo/**"
---
PROBE: this rule loaded.
and an existing file config/demo/thing.yml. In a session that has not loaded the rule yet:
- Run
head -3 config/demo/thing.ymlthrough the Bash tool. The rule is not injected. - Open the same file with the
Readtool. The rule is injected, as aContents of .../.claude/rules/probe.mdsystem reminder. - Create
config/demo/other.ymlwith theWritetool. The rule is not injected.
I observed this with two independent, unrelated path-scoped rules in one session, with the same result each time.
Claude Code Version
2.1.267
Claude Model
Opus 5 (claude-opus-5)
Platform
Claude Code desktop app, macOS, zsh.
Is this a regression?
Not sure. I have not tested an earlier version.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗