[BUG] Subdirectory CLAUDE.md files not loaded on-demand when reading files via Read tool (VS Code extension, v2.1.39)
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?
When using Claude Code via the VS Code extension (v2.1.39), subdirectory CLAUDE.md files are not loaded into context when Claude reads files in those directories using the Read tool.
According to the documentation, subdirectory CLAUDE.md files should be loaded on-demand when accessing files in that directory. In practice, only the root-level CLAUDE.md is loaded at session start, and no subdirectory CLAUDE.md files are ever injected — even after multiple Read tool calls into those directories.
What Should Happen?
When Claude reads a file like src/generation/orchestrator.ts, the src/generation/CLAUDE.md file (if it exists) should be loaded into the conversation context. If that CLAUDE.md contains @ imports (e.g., @AGENTS.md), those should also be resolved relative to that subdirectory.
Steps to Reproduce
- Create a project with hierarchical
CLAUDE.mdfiles:
/project/
CLAUDE.md ← contains "@AGENTS.md"
AGENTS.md ← root-level docs
src/
generation/
CLAUDE.md ← contains "@AGENTS.md"
AGENTS.md ← subdirectory-level docs
orchestrator.ts
- Open the project in VS Code with Claude Code extension
- Start a conversation
- Observe: root
/project/CLAUDE.mdand/project/AGENTS.mdare loaded ✅ - Ask Claude to read
src/generation/orchestrator.ts(Claude uses theReadtool) - Ask Claude: "Which CLAUDE.md files are in your context?"
Expected: Both root CLAUDE.md and src/generation/CLAUDE.md (with resolved @AGENTS.md import)
Actual: Only root CLAUDE.md — the subdirectory one is never loaded
Concrete session evidence
In my session, Claude read files across 6 subdirectories (src/cli/, src/generation/, src/generation/writers/, src/orchestration/, src/update/, src/change-detection/) — all of which have CLAUDE.md files. None were loaded into context. The system prompt only ever contained:
Contents of /home/.../CLAUDE.md (project instructions, checked into the codebase):
Contents of /home/.../AGENTS.md (project instructions, checked into the codebase):
No subdirectory CLAUDE.md files appeared at any point during the conversation.
Additional context
This is a regression or continuation of the issue reported in:
- #2571 — auto-closed due to inactivity, never actually fixed; confirmed still broken in VS Code extension
- #18371 —
@links in subdirectory CLAUDE.md not resolved from parent directory (related but distinct) - #18601 — CLAUDE.md not loaded until first file read in plan execution (related timing issue)
The combination of this bug + #18371 means that even if subdirectory loading were fixed, the @ imports inside those files might still not resolve. Both need to work for hierarchical project documentation to function as designed.
Error Messages/Logs
No error messages — the files are silently not loaded.
Environment Info
- Claude Code version: 2.1.39
- Platform: Linux (WSL2)
- IDE: VS Code extension
- OS: Linux 6.6.87.2-microsoft-standard-WSL2
- Model: Claude Opus 4.6
This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗