Skip to content

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 ​

PrimitiveWhat it isBest for
SubagentIsolated Claude instance under the parent session; own context; reports a summary backExplore, specialist roles, token-efficient side work
Agent viewTerminal dashboard for background sessions (claude agents / /background)Multiple long-running sessions you monitor
Agent teamsCoordinating peers that message each other (preview)Split independent workstreams with orchestration
Batch + worktrees/batch → independent units, each in a worktreeLarge 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:

text
# 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 other

Rules of thumb for spinning ​

  1. Independence — no shared write conflicts if possible
  2. Clear deliverable — each worker returns a short summary, not a novel
  3. Tool scope — lock tools/model per subagent definition
  4. Human gate — review before merge; use SubagentStop hooks when you need policy
  5. 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):

text
.claude/
  agents/
    code-reviewer.md
    explorer.md

Markdown + YAML frontmatter example:

markdown
---
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, duplication

Allow spawning nested workers (or restrict):

yaml
# any subagent type
tools: Agent, Read, Bash

# allowlist only
tools: Agent(worker, researcher), Read, Bash

Ask Claude to generate one:

text
Create a personal code-improver subagent in ~/.claude/agents/ that scans
files and suggests improvements. Read-only. Use Sonnet.

Parallel research prompt:

text
Research the authentication, database, and API modules in parallel using separate subagents

Session commands ​

CommandRole
/tasksList background work including finished subagents
Task / Task toolsClaude may spawn subagents when the task fits

Exact invocation UX varies by version — prefer official docs + in-product help.

Agent view & background sessions ​

ActionRole
/backgroundDetach whole session as background agent
/forkCopy session into new background session
claude agentsDashboard to dispatch/monitor (see agent view)
/remote-controlContinue 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.

text
Official: https://code.claude.com/docs/en/agent-teams

The main session is the lead. Teammates spawn when you ask for parallel work or when Claude proposes them — approval is required before spawn.

Example:

text
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:

text
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 agent

Wire 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 ​

DoDon’t
Start with 1–2 workersFan out tens of agents on day one
Deny network/prod tools on workersGive every worker full bypass
Commit/worktree before big spinsSpin on dirty main with secrets in tree
Use plan mode for architectureAuto-merge multi-agent diffs blind