[BUG] Nested <subdir>/.claude/skills and subdirectory CLAUDE.md never load in auto mode: trigger fires only on Read/Edit/Write, not Bash or Grep (nested-directory variant of #90004)

Status Open
Reported on v2.1.267
Maintainer reply None cached
Activity 3 comments · opened Sep 10, 2026

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?

Related to #90004 but not a duplicate. That issue covers skills with paths: frontmatter and traces the conditionalSkills matcher. This one covers two other consumers of the same Read/Edit/Write-only trigger that the code excerpt there does not touch: nested-directory skill discovery (<subdir>/.claude/skills/, the monorepo layout from the docs, no paths: frontmatter) and lazy loading of subdirectory CLAUDE.md / AGENTS.md. Filing separately so there is a tracker if the fix for #90004 only patches the paths: matcher. Close as duplicate if it turns out to cover both.

The docs say nested skills load "the first time Claude reads or edits a file in that subdirectory". In practice the trigger fires only for the Read, Edit and Write tools. Reading the same file through Bash (cat, sed -n, grep) or through the dedicated Grep tool does not load the nested skill, and does not load the subdirectory CLAUDE.md / AGENTS.md chain either.

On its own that would be a documentation gap. It becomes a functional bug in auto mode, because the auto-mode system prompt tells Claude to read files with Bash instead of the file tools:

While auto mode is active: Do your work through the Bash tool wherever it can accomplish the job: read files with cat, head, or sed -n, search with grep and find, and make file changes with sed, heredocs, or short scripts, rather than using the dedicated Read, Edit, or Write tools. Fall back to a dedicated tool only when Bash genuinely cannot do the job.

So in auto mode, one part of the product steers Claude away from the only tool calls that the other part relies on. A complete read-only investigation inside a subtree can finish without that subtree's skills, CLAUDE.md or AGENTS.md ever entering context. Any "read the skill directly" fallback placed in the nested AGENTS.md is gated by the same trigger, so it never gets a chance to run.

Verified in one session on two unrelated subtrees of a large monorepo, each with its own nested .claude/skills/<skill>:

  • Two shell reads (cat, sed -n, grep) of source files under the first subtree loaded nothing. A five-line Read tool call on one of those same files loaded the skill and the whole nested CLAUDE.md -> AGENTS.md chain at once.
  • On the second subtree, the dedicated Grep tool with an explicit path under it loaded nothing. A Read on the same file loaded the skill immediately. Grep receives the path as a structured argument, so this is not only a shell-parsing problem.

What Should Happen?

One of the following, in order of preference:

  1. The trigger fires for any tool call that observes a path inside the subtree: Read, Edit, Write, Grep, Glob, and Bash commands whose arguments resolve to existing paths under a directory that owns a .claude/ folder.
  2. Auto mode's Bash-first instruction exempts the first touch of a subtree that has a .claude/ directory, or auto mode does not instruct Bash-first reads.
  3. At minimum, the docs state that only Read, Edit and Write tool calls trigger nested loading, so monorepo owners can plan around it.

Error Messages/Logs

No error is printed. The symptom is the absence of the two notices that normally follow a Read in a subtree with its own `.claude/` directory:


New skills discovered in sub/.claude/skills, now available via the Skill tool:
- demo


and the injected `sub/CLAUDE.md` content. Both are missing after any number of Bash or Grep tool reads, and both appear immediately after a single Read tool call on the same file. `/demo` stays "Unknown skill" until that Read happens.

Steps to Reproduce

mkdir -p repro/sub/.claude/skills/demo
cd repro
git init -q
printf -- '---\nname: demo\ndescription: Demo nested skill. Use when working on files under sub/.\n---\nhello from nested skill\n' > sub/.claude/skills/demo/SKILL.md
printf 'Nested CLAUDE.md was loaded\n' > sub/CLAUDE.md
echo x > sub/file.txt
claude            # start at the repro root, auto mode

Then, in the session:

  1. Prompt: Use Bash to run: cat sub/file.txt

No "New skills discovered" notice. No sub/CLAUDE.md content. /demo is unknown.

  1. Prompt: Use the Grep tool to search for x under sub/

Same result. Nothing loads.

  1. Prompt: Use the Read tool on sub/file.txt

"New skills discovered in sub/.claude/skills: demo" appears immediately, and the content of sub/CLAUDE.md is injected.

Steps 1 and 2 can be repeated any number of times before step 3 with no change.

Claude Model

Opus

Is this a regression?

No, this never worked

Last Working Version

_No response_

Claude Code Version

2.1.267

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

Windows Terminal

Additional Information

Permission mode: auto.

The Bash-vs-Read tool preference has been reported before as a model-side problem (#21696, #39979). Auto mode now makes that preference the instructed behavior, which is what turns the narrow trigger into a functional gap.

Related issues:

  • #90004 same trigger and same auto-mode aggravator, for paths: conditional skills. This report is the nested-directory and subdirectory CLAUDE.md variant. Also note #90004 is labeled platform:linux; this reproduces on Windows.
  • #88041 the auto-mode bashFirst instruction itself.
  • #40640 nested .claude/skills not discovered as documented. Closed as duplicate, canonical not named. Reporters do not say which tools read the files, so Bash reads are a plausible unrecorded cause.
  • #39787 nested skill not discovered "even after actively reading and editing files". Auto-closed as a duplicate of #39138, which is about three-level nesting inside one .claude/skills/ tree, a different problem. Likely mis-triaged.
  • #23478, #38487, #63142 path-scoped rules and subdirectory CLAUDE.md load on Read but not on Write. Same trigger, different bypass.
  • #2571, #3529, #24987 subdirectory CLAUDE.md not loaded on access.
  • #41798 (closed docs issue) quotes the permissions doc line that Read/Edit deny rules apply to the built-in file tools, not to Bash subprocesses. Same class of gap: a mechanism keyed on the file tools that Bash walks around.

View original on GitHub ↗

3 Comments

Ribsy447 · 13 days ago

Data point from Linux (WSL2 Ubuntu, ext4), Claude Code 2.1.240–2.1.285, auto mode. 42 sessions launched from a parent folder with 7 project subfolders, each with its own CLAUDE.md. Counting nested_memory attachments in the session transcripts:

  • Folder reached only through Bash/Grep/Glob: subfolder CLAUDE.md loaded in 0 of 44 session × folder cases
  • Read/Edit/Write on a file in the folder: loaded in 13 of 19

The same sessions made 3,266 Bash calls vs 637 Read calls, so the subfolder CLAUDE.md was missing from most sessions that worked in those folders.

VincentH-Net · 5 days ago

Confirming on macOS (Darwin 25.6), Claude desktop app (Code tab), Claude Code 2.1.295, auto mode. One data point beyond the Linux and Windows ones:

  • A session started at the monorepo root spent about an hour and dozens of Bash reads (cat, sed -n, awk, grep) plus one Bash-driven edit (a Python script) of files under enms/backend/, which has nine skills in enms/backend/.claude/skills/. None loaded. The edit target was a SKILL.md inside that nested skills folder itself, and even that did not trigger discovery.
  • A Bash cd into the subdirectory, which the harness reported as a primary working directory change, did load the nested enms/backend/CLAUDE.md, but still not the nested skills. So on 2.1.295 the cwd-change path loads CLAUDE.md while skill discovery remains Read/Edit/Write-only.
  • One three-line Read tool call on enms/backend/Readme.md then produced the "New skills discovered in enms/backend/.claude/skills" notice with all nine skills.
yishait-tailor · 1 day ago

Measured on Claude Code 2.1.296, macOS. Each action ran in a fresh claude -p session. An InstructionsLoaded hook was the ground truth, and every transcript was checked for exactly one tool call.

What loads path rules and nested CLAUDE.md now:

  • Loads: Read, Write (including a new file), and a plain single-file cat/head/tail/nl/bat/sed -n, or grep/rg with a match. These also count inside a ; or && list.
  • Loads nothing: pipes, ||, redirects (2>/dev/null), extra flags (cat -A), cd dir && cat file, grep -r, a grep with no match, and every Bash write (sed -i, >, >>, heredoc, python -c, cp).

A fix that keeps Bash: a root CLAUDE.md brief that explains the gap and asks for one plain read per folder before working there. Tested on Opus in auto mode with bashFirst:true confirmed in every session: 5 edit tasks × 3 runs per arm.

| | No brief | Strict "Edit/Write only" brief | Read-first brief (below) |
|---|---|---|---|
| Rule loaded | 5/15 | 15/15 | 15/15 |
| Bash writes | 12/15 | 2/15 | 2/15 (after a Read) |
| Avg tool calls | 2.4 | 2.5 | 2.3 |

Context loading (known Claude Code gap). Path rules and nested CLAUDE.md load only on a Read/Write/Edit, or a plain single-file Bash read (cat, head, tail, sed -n, grep/rg with a match), with no pipes and no cd &&. Bash writes, pipes and multi-file commands load nothing. Before working in a folder, do one plain read of a file there; after that, use whatever is most efficient, Bash included. Repeat for each new folder, and again after /compact.

Small sample, and it's a workaround, not a fix, but it's been holding up for us.