-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Description
Preflight Checklist
- I have searched existing issues and this hasn't been reported yet
- This is a single bug report (please file separate reports for different bugs)
- I am using the latest version of Claude Code
What's Wrong?
Rules with paths: frontmatter placed in user-level rules directory (~/.claude/rules/) are never loaded, even when working with files that match the specified glob patterns.
Setup:
- User-level rule file:
~/.claude/rules/csharp-dotnet.mdwithpaths: ["**/*.cs"]frontmatter - Project has
.csfiles
Observation:
- When editing
.csfiles, the user-level rule withpaths:is NOT loaded - The same rule file works correctly when placed in project-level rules (
./.claude/rules/) - The same rule file also works when symlinked from user-level to project-level rules
- Rules without
paths:frontmatter in~/.claude/rules/load correctly (unconditionally)
Verified behavior:
| Location | paths: frontmatter | Result |
|---|---|---|
~/.claude/rules/ |
With paths | ❌ Not loaded |
./.claude/rules/ |
With paths | ✅ Loaded |
./.claude/rules/ |
Symlink to user-level | ✅ Loaded |
What Should Happen?
User-level rules with paths: frontmatter should be loaded when working with files that match the specified glob patterns, just like project-level rules.
According to the documentation:
User-level rules: You can create personal rules that apply to all your projects in
~/.claude/rules/
The paths: frontmatter should work consistently regardless of whether the rule is placed in user-level or project-level rules directory.
Error Messages/Logs
No error messages. The rules are silently not loaded. Running `/memory` shows the user-level rule with `paths:` is not listed in the loaded memory files.Steps to Reproduce
-
Create a user-level rule file with
paths:frontmatter:mkdir -p ~/.claude/rules cat > ~/.claude/rules/csharp-rules.md << 'EOF' --- paths: - "**/*.cs" --- # C# Rules - Follow C# naming conventions EOF
-
Create a project with a
.csfile:mkdir test-project && cd test-project echo 'public class Test { }' > Test.cs
-
Start Claude Code:
claude -
Run
/memory- observe thatcsharp-rules.mdis NOT listed -
Edit the
.csfile: ask Claude to "Read Test.cs" -
Run
/memoryagain - the rule is still NOT loaded -
Workaround test: Copy the same rule to project-level:
mkdir -p .claude/rules cp ~/.claude/rules/csharp-rules.md .claude/rules/ -
Restart Claude Code and edit the
.csfile -
Run
/memory- now the rule IS loaded
This confirms paths: works in project-level rules but not in user-level rules.
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
No response
Claude Code Version
2.1.25
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
VS Code integrated terminal
Additional Information
Workaround:
Using symlinks from project-level rules to user-level rules works:
# In project directory
mkdir -p .claude/rules
# On Windows (requires admin):
mklink ".claude\rules\csharp-rules.md" "C:\Users\username\.claude\rules\csharp-rules.md"
# On macOS/Linux:
ln -s ~/.claude/rules/csharp-rules.md .claude/rules/Related issues:
- [BUG] Path-scoped rules in
.claude/rules/not automatically loaded when working with matching files #16853 - Path-scoped rules in.claude/rules/not automatically loaded (project-level) - Documentation: .claude/rules/ frontmatter format incorrect - globs works, paths with quotes/YAML list does not #17204 - Documentation: frontmatter format issues
This issue is different from the above as it specifically affects user-level rules (~/.claude/rules/), not project-level rules.