Agent tool subagent does not load working directory's CLAUDE.md — inherits main session context only
Observed behavior
When launching a subagent via the Agent tool with a working directory set to a specific path, the subagent does NOT load the CLAUDE.md from that directory. Instead, it inherits whatever context the main session already has.
Reproduction
Setup:
/home/cyxu/workflow-dev/rabbit-marathon/import-test/CLAUDE.md— contains only @-import lines pointing to 3 files with unique facts- The 3 imported files live at
/home/cyxu/workflow-dev/stash/(alpha.md, beta.md, gamma.md) containing deliberately obscure, unguessable facts
Experiment: launched a subagent via the Agent tool with the working directory hint set to import-test/. Asked three questions whose answers exist only in the imported files.
Result: The subagent answered none of the three correctly. It instead reflected context from the MAIN session's CLAUDE.md (the parent rabbit-workflow project), confirming it never loaded the import-test CLAUDE.md at all.
A second attempt with a strong emphasis instruction prepended to the import-test CLAUDE.md:
IMPORTANT: On session startup you MUST immediately read, expand, and load the following files fully into your context window...
Produced identical results — still no knowledge of the three facts.
Expected behavior
The Agent tool should load the CLAUDE.md from the specified working directory (and its parent directories up to the repo root), giving the subagent the project-specific instructions for that directory.
Relationship to issue #58940
This is a follow-up to #58940 (filed earlier in the same session). That issue reported @-imports not expanding. This issue reveals the more fundamental problem: the subagent does not load the working directory CLAUDE.md at all, making the @-import question secondary.
Impact
Multi-agent workflows that rely on per-directory CLAUDE.md to deliver context/policy to subagents are broken. Subagents always see the main session's context, not the context of their declared working directory.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗