[BUG] Path-scoped rules in .claude/rules/ load into context globally regardless of paths: frontmatter
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Rules placed in .claude/rules/ with paths: frontmatter are loaded into the conversation context at session start, even when the working directory doesn't match the specified paths.
What Should Happen?
Expected behavior:
Rules with paths: frontmatter should only load into context when working with files matching those paths.
Actual behavior:
All .md files in .claude/rules/ are loaded into context at session start, regardless of paths: configuration.
Error Messages/Logs
Steps to Reproduce
- Create a path-scoped rule file:
.claude/rules/solutions/standards.md
- Add frontmatter:
---
paths:
- "solutions/**/*"
---
# Solutions Standards
[content...]
- Start a new Claude Code session in the project root
- Observe that the rule content appears in the loaded context
Environment:
- Claude Code CLI
- macOS
Claude Model
None
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.0.76
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Cursor
Additional Information
Impact:
Projects with multiple directory-specific rules experience significant context bloat. In my case, 28 rules load at session start when only ~5 should be global.
Workaround:
None found. Removing alwaysApply: false (which isn't documented anyway) had no
This issue has 14 comments on GitHub. Read the full discussion on GitHub ↗