Give each sub-agent only the tools and MCP servers its role needs
A sub-agent with every tool its parent has is a second copy of the parent’s blast radius, running with less oversight. In Claude Code, for example, a sub-agent with no tools list inherits the built-in and MCP tools of the main conversation (minus a few interactive ones). The fix is the same in any framework: decide per role what the agent may touch, and configure it.
Allowlist per role
Section titled “Allowlist per role”-
MUST give every sub-agent definition an explicit tool allowlist. Do not rely on inheritance.
-
SHOULD start from a role matrix and widen only with a reason:
Role Tools MCP Not Explorer / researcher Read, search, read-only shell or web fetch Code index, docs search Edit, write, deploy, send Implementer Read, edit, write, run tests and build Code index; issue tracker read Deploy, push to protected branches, send messages Reviewer Read, search, run tests Code index Edit (it reports; the implementer fixes) Operator (rare) Narrow, named commands or wrapper scripts Only the server for the system it operates Anything else; always with approval -
MUST keep tools with side effects outside the workspace (deploy, send, pay, delete, write to production systems) to the roles that need them, behind approval (BP-0032).
MCP per sub-agent
Section titled “MCP per sub-agent”- MUST attach MCP servers to the sub-agents that need them, not to everything: allow one server’s tools by name, and withhold all MCP tools from roles that need none.
- SHOULD define a server only on the sub-agent that uses it when the main conversation does not need it. In Claude Code an inline server is connected when that sub-agent starts and disconnected when it finishes, keeping it out of the main conversation’s context.
- SHOULD give a sub-agent’s MCP server narrower credentials than the parent’s where the server supports it (a read-only token for an explorer’s issue-tracker server, for example) (BP-0023).
- SHOULD prefer a narrow wrapper script to a broad MCP server when the sub-agent needs only a few operations (BP-0055).
Enforce, don’t hope
Section titled “Enforce, don’t hope”- MUST NOT rely on a sub-agent’s own permission mode for safety. In Claude Code, when the main conversation runs in bypass, accept-edits or auto mode, the sub-agent runs in that mode and its own setting is ignored. Use tool allowlists, deny rules and hooks, which apply regardless (BP-0021).
- SHOULD scope guardrail hooks to the sub-agent that needs them (for example, block writes outside its worktree).
- SHOULD limit spawning: remove the agent-spawning tool from workers that should not delegate, and keep nesting shallow. Claude Code allows three levels below the main conversation by default and can be set lower.
- SHOULD cap turns per sub-agent, and give writing sub-agents their own worktree (BP-0035).
- SHOULD control skills explicitly: preloading a skill is not the same as limiting access; remove the skill tool from roles that must not use skills.
Keep it honest
Section titled “Keep it honest”- MUST keep sub-agent definitions in version control and review tool-list changes like permission changes.
- SHOULD test the limits: ask each sub-agent to do something outside its role (edit a file, call an unlisted server) and confirm it cannot.
When to apply
Section titled “When to apply”Defining sub-agents or agent roles in any framework; adding an MCP server; reviewing an orchestrator-worker setup (BP-0042).
Examples
Section titled “Examples”Claude Code sub-agent definitions (.claude/agents/*.md):
---# author: Stephen Eatonname: explorerdescription: Read-only codebase and issue search. Returns paths and short findings.tools: Read, Grep, Glob, mcp__codeindex__*disallowedTools: Agent, Skillmodel: haikueffort: lowmaxTurns: 20------# author: Stephen Eatonname: implementerdescription: Implements one planned unit test-first in its own worktree.tools: Read, Grep, Glob, Edit, Write, BashdisallowedTools: Agent, mcp__*isolation: worktreemodel: sonneteffort: medium------# author: Stephen Eatonname: ui-checkerdescription: Drives the app in a browser and captures screenshots against the approved mockup.tools: Read, mcp__playwright__*mcpServers: - playwright: # inline: only this sub-agent connects to it type: stdio command: npx args: ["-y", "@playwright/mcp@latest"]---Claude Code applies disallowedTools first, then resolves tools against what is left; a tool in both is removed.
Anti-patterns
Section titled “Anti-patterns”- Sub-agents with no tool list, inheriting every MCP server the parent has.
- A reviewer that can edit the code it reviews.
- Every MCP server configured globally “in case a sub-agent needs it”.
- Counting on a sub-agent’s
permissionModewhile the parent runs in bypass mode. - Workers spawning workers spawning workers.
Checklist
Section titled “Checklist”- Explicit tool allowlist on every sub-agent; role matrix written down
- Side-effect tools only where needed, with approval
- MCP servers attached per sub-agent; narrower credentials where possible
- Enforcement via tool lists, deny rules and hooks, not the sub-agent’s permission mode
- Spawning depth and turns limited; writers isolated
- Definitions versioned and reviewed; limits tested