Subagents ignore user CLAUDE.md rules (e.g. no composite shell commands)
Problem
When a user configures rules in ~/.claude/CLAUDE.md (e.g., "never chain commands with &&, ||, or ;"), the main Claude Code session respects them — but subagents launched via the Agent tool do not.
This is an insane annoyance because:
- The user sets a rule to avoid permission prompts (e.g., "no composite commands so each command matches an allowed prefix in settings.json")
- The main session obeys
- But every Agent subagent immediately starts running
cd /some/path && grep ...orcd /some/path && git ..., triggering the exact permission prompts the rule was designed to prevent - The user has to repeatedly reject or approve these, defeating the entire purpose of the rule
- There is no workaround — the user cannot control the internal behavior of spawned agents
Expected Behavior
Subagents should inherit and respect all CLAUDE.md rules from the parent session, including user-level (~/.claude/CLAUDE.md) and project-level rules.
Actual Behavior
Subagents operate as fresh sessions with no knowledge of CLAUDE.md rules. They use default patterns like cd /path && command which violate user-configured rules.
Reproduction
- Add to
~/.claude/CLAUDE.md:
``&&
No composite shell commands. Never chain commands with , ||, or ;. Run each command as a separate Bash tool call.``
- Add corresponding allowed prefixes in
settings.json(e.g.,Bash(git:*),Bash(grep:*)) - Ask Claude to do something that spawns agents (e.g.,
/code-review) - Observe agents running
grep -rn "pattern"— composite commands that trigger permission prompts
Impact
This makes Agent-heavy workflows (code review, deep review, multi-repo tasks) extremely painful for users who rely on CLAUDE.md rules for permission management. Every agent spawn becomes a permission prompt minefield.
Suggested Fix
Pass the full CLAUDE.md context (user-level + project-level) to subagents as part of their system context, the same way the parent session receives it.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗