How a subagent is defined
A custom subagent is a Markdown file: YAML frontmatter sets its configuration, and the body supplies its instructions. Save a project definition in .claude/agents/, or use ~/.claude/agents/ across your projects.
name identifies the agent and description tells Claude when to delegate; both are required. tools is optional. Omit it to inherit the tools available to subagents, or list a smaller set, as this local example does.
---
name: repo-guide
description: Maps project files before implementation planning
tools: Read, Glob, Grep
---
Map the relevant files and explain how they connect.
Report paths and findings. Do not modify files.The two documented entries below are components of Feature Dev. Installing that package supplies its agents; they are not two separate install packages.
How delegation works
Claude chooses automatic delegation using your task, the agent’s description and the conversation context. A matching description helps selection; creating a definition does not mean it runs on every request. Quick edits or work needing frequent back-and-forth can stay in the main conversation.
Ask directly: Use the repo-guide subagent to map the files involved in this change.
Natural language still leaves the choice to Claude. For an explicit one-task invocation, type @ and select the agent from the picker. Enabled plugin agents appear under their scoped names.
If an agent is unavailable, check its definition and install scope and whether it is disabled. Delegation does not bypass tool or permission restrictions. When the same name is defined in multiple places, the documented scope precedence is session, project, user, then plugin. A subagent uses its own context and returns a summary to the caller; its model requests count toward the same account usage limits.
Subagent vs agent teams vs an external service
Choose by how work is coordinated and where the capability runs. A subagent’s saved definition or optional persistent memory does not make it a continuously running service.
| Mechanism | How it works | Useful when |
|---|---|---|
| Subagent | Handles a delegated task in its own context within the calling session and returns results. | You need focused exploration or review without filling the main conversation with all the intermediate output. |
| Agent team | A lead coordinates separate Claude Code sessions whose teammates can message each other. Agent teams are experimental and disabled by default. | Independent investigations or work areas benefit from coordination between teammates. |
| External service / MCP server | MCP exposes tools and data from a local process or a remote server. It is not, by itself, a team of Claude sessions. | You need a capability or data source such as a repository API or documentation lookup, with its own connection and access requirements. |
Agent teams are not permanently running workers. The documented team is scoped to a session, and resuming does not restore in-process teammates. A local MCP process or hosted service has a lifecycle determined by its implementation and hosting.
Official team comparison ↗ · Team lifecycle limits ↗ · MCP connections ↗ · Browse documented MCP integrations