Skip to content

[BUG] Subdirectory CLAUDE.md files not loaded on-demand when reading files via Read tool (VS Code extension, v2.1.39) #24987

Description

@GeoloeG-IsT

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?

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

  1. Create a project with hierarchical CLAUDE.md files:
/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
  1. Open the project in VS Code with Claude Code extension
  2. Start a conversation
  3. Observe: root /project/CLAUDE.md and /project/AGENTS.md are loaded ✅
  4. Ask Claude to read src/generation/orchestrator.ts (Claude uses the Read tool)
  5. 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:

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:idebugSomething isn't workinghas reproHas detailed reproduction stepsmemoryplatform:linuxIssue specifically occurs on LinuxstaleIssue is inactive

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions