claude-code - 💡(How to fix) Fix [Bug] Setting CLAUDE_CODE_DISABLE_ATTACHMENTS=1 also disables auto-injection of CLAUDE.md files in subdirectories [5 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#48031Fetched 2026-04-15 06:35:18
View on GitHub
Comments
5
Participants
2
Timeline
17
Reactions
2
Timeline (top)
commented ×5labeled ×5renamed ×4cross-referenced ×2

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.

Error Message

[{"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"}]

Root Cause

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.

Code Example

[{"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"}]

---

CLAUDE.md
.claude/CLAUDE.md
alpha/CLAUDE.md
alpha/beta/CLAUDE.md
alpha/beta/gamma/CLAUDE.md

---

CLAUDE_CODE_DISABLE_ATTACHMENTS=1 claude
RAW_BUFFERClick to expand / collapse

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

  1. Start Claude as
    CLAUDE_CODE_DISABLE_ATTACHMENTS=1 claude
  2. Clone the test repo at https://github.com/vulpicastor/claude-md-load-test.git
  3. Start a fresh CC session in the repo.
  4. Without asking Claude to explore the repo, ask: "What secrets do you know?"
    • This should output contents in project root CLAUDE.md and .claude/CLAUDE.md.
  5. Mention subdir files like alpha/specimen-alpha.md, and without referencing CLAUDE.md, ask Claude about contents in alpha/CLAUDE.md.
  6. Repeat with alpha/beta/gamma/specimen-gamma.md, and again, without referencing CLAUDE.md, ask Claude about the contents in alpha/beta/CLAUDE.md and alpha/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.

extent analysis

TL;DR

The issue can be mitigated by removing the environment variable CLAUDE_CODE_DISABLE_ATTACHMENTS=1 to allow auto-injection of subdirectory CLAUDE.md files.

Guidance

  • Verify that the CLAUDE_CODE_DISABLE_ATTACHMENTS environment variable is the root cause by testing without it and checking if subdirectory CLAUDE.md files are auto-injected.
  • Review the official documentation on CC environment variables to understand the intended behavior of CLAUDE_CODE_DISABLE_ATTACHMENTS.
  • Test the Read tool with and without the CLAUDE_CODE_DISABLE_ATTACHMENTS variable to confirm the difference in behavior.
  • Consider reporting this as a bug to the CC developers, as the current behavior seems to contradict the documentation.

Example

No code snippet is provided as the issue is related to environment variables and tool behavior.

Notes

The issue may be specific to the CLAUDE_CODE_DISABLE_ATTACHMENTS environment variable and its interaction with the Read tool. Further testing and documentation review are necessary to fully understand the cause and implications.

Recommendation

Apply workaround: Remove the CLAUDE_CODE_DISABLE_ATTACHMENTS=1 environment variable to allow auto-injection of subdirectory CLAUDE.md files, as this seems to be the most direct way to restore the expected behavior.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

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.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [Bug] Setting CLAUDE_CODE_DISABLE_ATTACHMENTS=1 also disables auto-injection of CLAUDE.md files in subdirectories [5 comments, 2 participants]