[BUG] Windows: ~/.claude/ rules loaded twice (global + project scope)
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?
Trying to diagnose why context is filling up fast, Claude identifies that:
Global rules from ~/.claude/rules/*.md and ~/.claude/CLAUDE.md are loaded twice into the context — once correctly as "user's private global instructions for all projects" and a second time incorrectly as "project instructions, checked into the codebase." The project's .claude/ directory contains no rules/ folder and no symlinks — the duplicated files only exist in ~/.claude/.
This doubles the context consumption of all global rules files, which adds up when you have several rules files
What Should Happen?
Rules should only be loaded once, not twice. Global ~/.claude/rules/*.md files should appear only as global instructions, not also as project instructions.
Error Messages/Logs
No error messages — the duplication is visible in the system context injected into the conversation. Each global rules file appears in two `Contents of` blocks:
1. Contents of C:\Users\<user>\.claude\rules\agents.md (user's private global instructions for all projects)
2. Contents of c:\Users\<user>\.claude\rules\agents.md (project instructions, checked into the codebase)
Same path, different drive letter casing, loaded under two different labels.
Steps to Reproduce
Create global rules files in ~/.claude/rules/ (e.g. ~/.claude/rules/agents.md, ~/.claude/rules/coding-style.md)
Create a global ~/.claude/CLAUDE.md
Open a project that has its own .claude/ directory (containing e.g. settings.local.json) but does not have a rules/ subdirectory inside it
Start a Claude Code session in the VSCode extension
Ask Claude: "How many times are my rules files loaded in your context?"
Claude will confirm each ~/.claude/rules/*.md file and ~/.claude/CLAUDE.md appear twice — once as global, once as project
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.27
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
VS Code integrated terminal
Additional Information
The affected files in my case were all 8 rules files plus the global CLAUDE.md — each loaded twice. The project-specific CLAUDE.md (in the project root) was loaded correctly and only once.
Listing of project .claude/ directory confirming no rules exist there:
$ ls .claude/
agents/ (empty directory)
settings.local.json
Listing of global ~/.claude/rules/:
agents.md
coding-style.md
git-workflow.md
hooks.md
patterns.md
performance.md
security.md
testing.md
The duplication doesn't change behavior (same content both times) but wastes context window budget — in my case ~9 files loaded twice, roughly doubling the token cost of rules ingestion per session.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗