Claude Code — agents & parallel work
Advanced Subagents, agent view, agent teams, and “spin up” parallel workers (2026).Parent map: Claude Code 2026.
Official:
Four ways to run more than one agent
| Primitive | What it is | Best for |
|---|---|---|
| Subagent | Isolated Claude instance under the parent session; own context; reports a summary back | Explore, specialist roles, token-efficient side work |
| Agent view | Terminal dashboard for background sessions (claude agents / /background) | Multiple long-running sessions you monitor |
| Agent teams | Coordinating peers that message each other (preview) | Split independent workstreams with orchestration |
| Batch + worktrees | /batch → independent units, each in a worktree | Large multi-area changes without thrashing one branch |
Compare approaches on the official agents page — pick one pattern per job so you don’t stack costs.
SPIN / spawn parallel agents
There is no separate product named “SPIN agents.” In 2026 docs and product copy, spin means:
Spawn one or more agents (subagents or team members) in parallel so independent work runs concurrently.
Common spin patterns:
# Independent research
Lead: "Spin two explore subagents — auth flow and billing flow — summarize only."
# Parallel implementation units
/batch # Claude decomposes; units may run in worktrees
# Team (preview)
# Lead coordinates workers that can message each otherRules of thumb for spinning
- Independence — no shared write conflicts if possible
- Clear deliverable — each worker returns a short summary, not a novel
- Tool scope — lock tools/model per subagent definition
- Human gate — review before merge; use SubagentStop hooks when you need policy
- Cost — N parallel agents ≈ N× context/tools; watch usage
Subagents
What they are
- Reusable configs (often under
.claude/agents/) - Custom system prompt, model, and tool permissions
- Run inside a parent session and return results
- More efficient than full separate sessions for specialized, repeatable jobs
Define once, invoke by name
Typical layout (sub-agents, claude directory):
.claude/
agents/
code-reviewer.md
explorer.mdMarkdown + YAML frontmatter example:
---
name: code-reviewer
description: Reviews code for correctness, security, and maintainability
tools: Read, Grep, Glob
---
You are a senior code reviewer. Review for:
1. Correctness: logic errors, edge cases, null handling
2. Security: injection, auth bypass, data exposure
3. Maintainability: naming, complexity, duplicationAllow spawning nested workers (or restrict):
# any subagent type
tools: Agent, Read, Bash
# allowlist only
tools: Agent(worker, researcher), Read, BashAsk Claude to generate one:
Create a personal code-improver subagent in ~/.claude/agents/ that scans
files and suggests improvements. Read-only. Use Sonnet.Parallel research prompt:
Research the authentication, database, and API modules in parallel using separate subagentsSession commands
| Command | Role |
|---|---|
/tasks | List background work including finished subagents |
| Task / Task tools | Claude may spawn subagents when the task fits |
Exact invocation UX varies by version — prefer official docs + in-product help.
Agent view & background sessions
| Action | Role |
|---|---|
/background | Detach whole session as background agent |
/fork | Copy session into new background session |
claude agents | Dashboard to dispatch/monitor (see agent view) |
/remote-control | Continue local session from another device — see Remote Control |
Use when you want parallel sessions you own, not just internal subagents.
Agent teams (research preview)
Spin up multiple agents that coordinate and work in parallel — better when work splits cleanly.
Official: https://code.claude.com/docs/en/agent-teamsThe main session is the lead. Teammates spawn when you ask for parallel work or when Claude proposes them — approval is required before spawn.
Example:
Spawn three teammates to review PR #142:
- One focused on security implications
- One checking performance impact
- One validating test coverage
Have them each review and report findings.Treat as preview: behavior and limits can change. Prefer for independent surfaces, not tightly coupled refactors.
Explore → Plan → Execute (reliable pipeline)
For multi-file work, a common 2026 pattern:
1. Explore — subagent(s) map the area (read-only tools)
2. Plan — /plan or plan mode; human approves
3. Execute — main session or scoped workers implement
4. Verify — tests, /code-review, optional second-pass agentWire rules into CLAUDE.md so Claude defaults to this for large tasks.
Hooks & gates
- SubagentStop (and related hooks) — gate or grade worker output before it merges into the lead context
- Skills + hooks + subagents stack: plugins
See hooks for events.
Cost & safety
| Do | Don’t |
|---|---|
| Start with 1–2 workers | Fan out tens of agents on day one |
| Deny network/prod tools on workers | Give every worker full bypass |
| Commit/worktree before big spins | Spin on dirty main with secrets in tree |
| Use plan mode for architecture | Auto-merge multi-agent diffs blind |