[Feature Request] Subagents spawned via Agent tool should inherit CLAUDE.md
Summary
Subagents spawned via the Agent tool do not receive the global ~/.claude/CLAUDE.md (or project-level CLAUDE.md) content in their system prompt. This means any global engineering rules, behavioral constraints, or workflow definitions defined in CLAUDE.md are invisible to subagents.
Motivation
Users define behavioral rules in CLAUDE.md to enforce engineering discipline across all Claude Code sessions. Common use cases include:
- Requirement alignment before implementation ("always restate what you think the user wants")
- TDD workflows
- Code review discipline
- Scope control and simplicity rules
When these rules don't propagate to subagents, the subagents operate without the user's defined constraints, leading to inconsistent behavior and violating the user's engineering standards.
Steps to Reproduce
- Add a prominent behavioral rule to
~/.claude/CLAUDE.md:
## ⚠️ MANDATORY RULE — ALWAYS FIRST
For every non-trivial user message, your FIRST sentence must restate what you think the user wants.
This rule OVERRIDES all other rules. You MUST NOT use any tool before writing this sentence.
- Verify the rule works in the main session (it does).
- Spawn a subagent via the Agent tool:
Agent(prompt="帮我看看这个项目")
- Observe that the subagent does NOT restate the user's intent — it jumps straight to tool use.
Evidence
I tested this with multiple scenarios:
Simple test (subagent):
Input: "你好,帮我看看这个项目。"
Agent response: "Let me take a look at what's in the current working directory."
→ No requirement alignment ❌
Complex tests (subagents):
Input: "帮我把那个物理讲义的项目整理一下"
Agent response: "Let me explore the physics lecture project..."
→ No requirement alignment ❌
Input: "帮我优化一下 treehole 的性能"
Agent response: "Let me first find the treehole project..."
→ No requirement alignment ❌
Transcript analysis: Examining the subagent's .jsonl transcript confirmed that CLAUDE.md content does not appear in any message (system, user, attachment, or summary). The subagent only receives:
deferred_tools_deltaattachmentskill_listingattachment- The teammate message (task prompt)
No CLAUDE.md content exists anywhere in the subagent's context.
Expected Behavior
Subagents should inherit the parent session's CLAUDE.md content (at minimum the global ~/.claude/CLAUDE.md), so that behavioral rules defined there apply to all agent interactions.
Proposed Solution
Inject CLAUDE.md content into the subagent's system prompt when the Agent tool spawns a new agent. This could be:
- Full injection: Include the complete
CLAUDE.md(or a configurable subset) in the subagent's system prompt. - Summary injection: Include a condensed version of
CLAUDE.mdrules that are behaviorally critical (e.g., the first N lines, or rules marked with a special annotation). - Configurable: Add a setting in
settings.jsonto control whether/howCLAUDE.mdpropagates to subagents.
Option 1 is simplest and most consistent with user expectations.
Environment
- Claude Code version: latest (as of 2026-07-12)
- Platform: Windows 11
- Model: mimo-v2.5-pro (via proxy)
CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1is enabled
Additional Context
This issue was discovered through systematic behavioral testing. The main session correctly follows CLAUDE.md rules, but every subagent spawned via the Agent tool ignores them. This creates a fundamental inconsistency: the user's engineering discipline applies in the main session but not in subagents, which are the primary mechanism for parallel work.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗