Skip to content

[BUG] CLAUDE.md files in subdirectories are not being automatically loaded #2571

Description

@RicSala

Environment

  • Platform (select one):
    • Anthropic API
    • AWS Bedrock
    • Google Vertex AI
    • Other: Claude Code CLI
  • Claude CLI version: latest version
  • Operating System: macOS
  • Terminal:

Bug Description

CLAUDE.md files in subdirectories are not being automatically loaded when accessing files in those directories, contrary to what the documentation states. The memory system only loads CLAUDE.md files from parent directories (recursively up), but not from the current working directory when reading files.

Steps to Reproduce

  1. Create a project structure:
  • /project/
    • CLAUDE.md
    • src/
      • credits/
        • CLAUDE.md
        • error.ts
  1. Add content to /project/CLAUDE.md (root level)
  2. Add test content to /project/src/credits/CLAUDE.md (subdirectory level)
  3. Ask Claude to review the file /src/credits/error.ts
  4. Check Claude's context/memory

Expected Behavior

According to the official documentation, when working in /project/src/credits/ or reading files in that directory, Claude should load:

  • /project/CLAUDE.md (recursively up) ✅
  • /project/src/credits/CLAUDE.md (current directory) ✅

The docs specifically state: "When reading files in subdirs: /project/src/feature/subdir/CLAUDE.md ✅ (loaded on access)"

Actual Behavior

  • Claude only loads the root /project/CLAUDE.md
  • Claude does NOT automatically load /project/src/credits/CLAUDE.md
  • The subdirectory CLAUDE.md file must be manually attached to the conversation

Additional Context

This behavior contradicts the documented memory loading pattern. The documentation suggests that CLAUDE.md files should be loaded from the directory containing the file being accessed, but in practice, only parent directory CLAUDE.md files are being loaded.

This significantly impacts the ability to use directory-specific context and instructions, which is a key feature of the memory system for organizing large projects.

[EDIT]: Creating this again because it's not solved.

Claude Code team: Please, don't just close bug reports on rapid-fire style... that doesn't solve the issues, just bury them and leave the user (the client) with a pretty bad feeling for the product and company 🙏🏻

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghas reproHas detailed reproduction stepsmemoryoncallplatform:macosIssue specifically occurs on macOS

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions