[Bug] Setting CLAUDE_CODE_DISABLE_ATTACHMENTS=1 also disables auto-injection of CLAUDE.md files in subdirectories
Bug Description (auto-generated by /feedback)
The auto-injection of CLAUDE.md appears to be completely broken when the environment variable CLAUDE_CODE_DISABLE_ATTACHMENTS=1 is set. As the transcript of this session shows, CC has to manually load subdirectory CLAUDE.md and it was completely unaware of the "secrets" I prepared in the CLAUDE.md when I just ask it to read other repo files.
Environment Info
- Platform: darwin
- Terminal: tmux
- Version: 2.1.107
- Feedback ID: 2a7706a3-95f2-4075-bc90-ecb9a039381d
Errors
[{"error":"Error: NON-FATAL: Lock acquisition failed for /Users/slz/.local/share/claude/versions/2.1.107 (expected in multi-process scenarios)\n at bd_ (/$bunfs/root/src/entrypoints/cli.js:2334:2153)\n at nt6 (/$bunfs/root/src/entrypoints/cli.js:2334:1233)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-04-14T17:18:47.729Z"}]
---
Full Bug Report: Subdirectory CLAUDE.md files are not auto-injected when reading files in those directories
Summary
In the last few releases of CC, when Claude reads a file (via the Read tool) inside a subdirectory, Claude Code does not automatically load CLAUDE.md files along the directory path to that file. This means Claude misses scoped instructions and context that should be active for files in those directories.
What happened
I have a dummy project (full source on GitHub) with CLAUDE.md files at multiple levels, each containing silly "secret" information and instructions:
CLAUDE.md
.claude/CLAUDE.md
alpha/CLAUDE.md
alpha/beta/CLAUDE.md
alpha/beta/gamma/CLAUDE.md
When I asked Claude about alpha/specimen-alpha.md, it read the file but did not load alpha/CLAUDE.md. As a result:
- Claude ignored instructions in
alpha/CLAUDE.md(e.g., addressing me as "Captain") - Claude was unaware of secrets/context defined there
- Claude gave an incorrect answer when I followed up with a question whose correct answer was contained in
alpha/CLAUDE.md— and only corrected itself after I pointed out the file existed
When I then asked about alpha/beta/gamma/specimen-gamma.md, Claude again did not automatically load alpha/beta/CLAUDE.md or alpha/beta/gamma/CLAUDE.md — it only read them after I manually intervened.
Steps to reproduce
- Start Claude as
``bash``
CLAUDE_CODE_DISABLE_ATTACHMENTS=1 claude
- Clone the test repo at https://github.com/vulpicastor/claude-md-load-test.git
- Start a fresh CC session in the repo.
- Without asking Claude to explore the repo, ask: "What secrets do you know?"
- This should output contents in project root
CLAUDE.mdand.claude/CLAUDE.md.
- Mention subdir files like
alpha/specimen-alpha.md, and without referencing CLAUDE.md, ask Claude about contents inalpha/CLAUDE.md. - Repeat with
alpha/beta/gamma/specimen-gamma.md, and again, without referencing CLAUDE.md, ask Claude about the contents inalpha/beta/CLAUDE.mdandalpha/beta/gamma/CLAUDE.md.
Expected behavior
According to official docs on CC environment variables for CLAUDE_CODE_DISABLE_ATTACHMENTS:
Set to 1 to disable attachment processing. File mentions with @ syntax are sent as plain text instead of being expanded into file content
This does not seem to imply that disabling all file attachments, including subdirectory CLAUDE.md injections for the Read tool (not via file @-mention), should have been disabled.
Current behavior
Only the project root CLAUDE.md and .claude/CLAUDE.md are auto-injected. Subdirectory CLAUDE.md files are silently ignored unless I explicitly call them out.
Implications
This unexpected regression may explain why some users are reporting Claude getting "dumber" and not respecting instructions, because the harness failed to inject crucial context.
This issue has 7 comments on GitHub. Read the full discussion on GitHub ↗