[Feature request] Agent() spawn should optionally inherit project CLAUDE.md and .claude/rules/

Resolved 💬 2 comments Opened Apr 17, 2026 by oviron Closed Apr 17, 2026

Problem

When the main agent spawns a subagent via Agent() (Explore, Plan, general-purpose, or a custom subagent_type), the subagent starts with a clean system prompt. Project-level CLAUDE.md, files in .claude/rules/, and auto-memory are NOT inherited.

For projects that rely heavily on project conventions this means every spawn prompt has to re-include the essentials manually. Critical rules get skipped, behavior drifts. The current workaround is maintaining a "subagent-brief.md" template the main agent copies into every spawn — brittle and easy to forget.

Use case

My workspace has .claude/rules/ with multiple files the main agent auto-loads at session start: behavior.md (tool selection rules), skills.md (skill registry), context-loading.md (trigger-based context files), memory-map.md (where to write what), etc.

When I parallelize work via 9 research sub-agents, each one needs the same literalism, no-legacy, verify-before-done rules — but they arrive with none of it unless I paste the relevant parts into every prompt. In a session with ~15 sub-agent spawns, this adds up to thousands of tokens of repeated boilerplate, plus the risk of forgetting a critical rule once.

Proposal

Add an optional flag on the Agent() tool call (default: false for back-compat):

Agent(
    subagent_type="general-purpose",
    prompt="...",
    inherit_project_context=True
)

When true, the subagent's system prompt is augmented with:

  • The spawning project's CLAUDE.md
  • All *.md files in the spawning project's .claude/rules/
  • Optionally user-level ~/.claude/CLAUDE.md if it's already in the main agent's context

Alternative API: a per-agent-type setting in .claude/agents/*.md frontmatter (inheritProjectRules: true).

Alternatives considered

  • Current workaround: template brief in .claude/rules/subagent-brief.md that the main agent copies into each spawn. Works but brittle — one forgotten copy and the subagent defaults to generic behavior. Also wasteful: the same text re-sent in every spawn.
  • Embedding all rules inline in each prompt: same fragility, worse token economy.
  • Custom sub-agent type with baked-in rules: fragments the rules between multiple places; breaks when rules change.

Severity

Not a blocker, but in workspaces where behavior rules are the primary configuration (which seems increasingly common with Opus 4.7's literal-instruction bias), this inheritance would eliminate a whole class of drift bugs and let users keep a single source of truth.

Happy to clarify use cases or prototype if that helps.

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗