/schedule, /loop, Remote Control). Plus the trade-offs: cost and merge effort.
The chapter's claim: the most underrated capability of Claude Code is not how fast it writes code — it is how many instances you can run at once. Master parallelism and your workflow shifts from "one person, one AI" to "one person commanding an AI team."
While writing this book, the author ran 6 Claude Code processes at the same time, each on a different chapter. Six processes in parallel for about 2 hours produced all 10 chapter drafts — work that would take at least a full day sequentially.
Claude Code's work pattern is: you give a task → Claude works a few minutes → you review → you give the next task. There is a lot of waiting in between.
Boris Cherny's day-to-day: 5 local Claude Code instances (each in its own git checkout) plus 5–10
claude.ai/code cloud sessions — one writing a feature, one fixing bugs, one writing tests,
one refactoring, one doing review. His first productivity tip to his team: do more work in parallel.
| Mechanism | What it is | Use when |
|---|---|---|
| Parallel sessions + Worktrees | Several independent Claude sessions, each in an isolated filesystem/branch | Tasks that have nothing to do with each other |
| Subagents | A specialist called in for one step of your current task, with its own context | You need an "expert" (e.g. security review) without opening a new window |
| Agent Teams | Multiple sessions that message each other and divide the work themselves | One task that benefits from writer/reviewer or test-driven collaboration |
| Fan-out / batch | The same operation repeated across many files, run in parallel | Large refactors, migrations, bulk fixes |
| Async execution | /schedule (cloud cron), /loop (long local runs), Remote Control | You do not want to sit at the terminal |
The prerequisite: each session needs its own isolated code environment, or they overwrite each other's files and create conflicts. Git Worktrees solve exactly this — multiple working directories from the same repository, each on a different branch, with completely isolated filesystems.
# Start a Claude session running in an isolated worktree
claude --worktree
# Start inside a Tmux session (can run in the background)
claude --worktree --tmux
What this does: each claude --worktree automatically creates a new worktree,
checks out a new branch, and works in that isolated environment. When done, you merge the branch back into main.
# Add to ~/.zshrc
alias za="tmux select-window -t claude:0"
alias zb="tmux select-window -t claude:1"
alias zc="tmux select-window -t claude:2"
Explaining it: za jumps to the first session, zb the second, and so
on. In the Desktop App there is a worktree checkbox in the UI — tick it, no Tmux configuration needed.
Parallel sessions suit unrelated tasks. Sometimes you instead want an "expert" to handle a specific step
within your current task — like a security reviewer looking at the auth code you just wrote.
That is a subagent. Drop a .md file in .claude/agents/:
.claude/agents/
├── security-reviewer.md # Security review specialist
├── code-simplifier.md # Code simplification specialist
├── verify-app.md # Application verification specialist
└── code-architect.md # Architecture design specialist
Each agent file can define a custom name, tool permissions, permission mode, and even which model to use. A security review agent, for example, can be read-only (no code changes) and set to use a stronger-reasoning model.
You can add "use subagents" to your prompt and let Claude decide when to delegate. This makes Claude invest more compute into complex tasks.
security-reviewer (auto-invoked
whenever authentication, permissions, or data storage are involved) + verify-app (auto-starts
the app and checks functionality after changes). Together they cover "is it written correctly?" and "does it
actually run?"Worktrees = you manually manage parallel sessions. Subagents = the main session calls a specialist. Agent Teams go further: multiple sessions communicate with each other and divide the work themselves. Shipped February 2026, it is currently Claude Code's most powerful collaboration mode. The core idea: instead of you coordinating agents, the agents coordinate themselves. (The book's earlier test — 3 AI teammates building a retro arcade game in 45 minutes — used this.)
Why it works: same reason as human teams. The writer gets locked into their own thinking; the reviewer catches problems from a different angle. Two agents checking each other visibly raises quality.
One agent writes the tests first, defining "what correct behaviour looks like" from the requirements. The implementation agent then satisfies those tests. Agent Teams automatically share task state and messages — no manual copying between agents — and there is a team lead role that coordinates assignment and progress.
You do not configure this — Agent Teams automatically decides whether to run the full four-phase process based on task complexity.
Everything above is a few agents on one task. Fan-out solves a different problem: the same operation across many files.
# Execute a single task in non-interactive mode
claude -p "Migrate this file from JavaScript to TypeScript"
The -p flag passes a prompt directly, so Claude Code is easy to call from scripts. Combine
with a shell loop:
# Batch migrate a set of files
for file in $(cat files-to-migrate.txt); do
claude -p "Migrate $file from JS to TS" \
--allowedTools "Edit,Bash(git commit *)" &
done
for file in $(cat files-to-migrate.txt) — loop over every filename listed in the text file.claude -p "Migrate $file from JS to TS" — run one non-interactive Claude task per file.--allowedTools "Edit,Bash(git commit *)" — pre-authorise only editing and git commits, so it runs unattended.& — run each instance in the background in parallel. 50 files → 50 Claude instances at once; a day's work can finish in minutes./batch command (no scripting needed)Best suited for large-scale refactors, code migrations, and bulk fixes. One person with Claude can match what an engineering team spends a week doing on a migration.
| Feature | What it does | Good for |
|---|---|---|
| Remote Control | Generate a connection link; open it on your phone to create and manage local Claude sessions | Starting a task on your commute or before heading out. Boris starts sessions on his iPhone in the morning, continues on desktop. |
| Claude Code on Web | Run Claude Code at claude.ai/code with nothing installed locally | Cloud dev environments, browser-only work |
/schedule | A Claude task that triggers on a schedule and runs in the cloud, even when your computer is off | Dependency updates, security scans, daily reports |
/loop | Claude runs unattended locally for up to 3 days | Monitoring CI status, continuous integration tests |
# Set up a cloud-based scheduled task
/schedule "Check for outdated dependencies and create PRs"
From Anthropic's white paper "How Anthropic Teams Use Claude Code":
| Team | How they use Claude Code |
|---|---|
| Data infrastructure | Debugging Kubernetes clusters — Claude reads pod logs, analyses the error stack, identifies the root cause, and suggests fixes. Hours of a senior engineer's time → minutes to the right direction. |
| Security | Tracing complex control flows — tracking a request's full path from entry point to database, auto-generating call flow diagrams. |
| Marketing | Batch-generating dozens of ad copy and asset combinations; marketing only handles selection and fine-tuning. |
| Legal | A lawyer — not an engineer, could not write code — built and shipped a phone tree system (routing incoming calls to the right counsel) from scratch. |
The legal example is highlighted as a sign that Claude Code's audience has already expanded well beyond engineers.
PARALLEL SESSIONS one task each, isolated worktrees/branches
[feature] [bugs] [tests] [refactor] [review] <- you coordinate
SUBAGENT one specialist step, own context
main session ──► [security-reviewer] ──► result back
AGENT TEAM they coordinate themselves
[team lead] ⇄ [writer] ⇄ [reviewer] (shared task state)
FAN-OUT same op x many files, in parallel
/batch ──► [f1][f2][f3]...[f50] ──► summary of pass/fail
| Parallel sessions | Subagents | Agent Teams | |
|---|---|---|---|
| Relationship between tasks | Independent | One step inside your task | Collaborating on one task |
| Who coordinates | You | Main session | The agents themselves (team lead) |
| Context | Separate per session | Separate per subagent (frees main context) | Shared task state + messages |
| Isolation | Git worktrees / branches | Within the session | Managed by the team |
/schedule | /loop | |
|---|---|---|
| Runs | In the cloud | Locally |
| Trigger | On a schedule (cron-like) | Unattended, continuous, up to 3 days |
| Works when your computer is off? | Yes | No |
| Good for | Routine maintenance | Long-running monitoring |
claude --worktree do?& do in the batch-migration shell loop?/batch command?/schedule and /loop..claude/agents/security-reviewer.md with read-only tools, and invoke it on some auth code./batch to plan (not necessarily execute) a repetitive change across your codebase and read the file list it produces./schedule task to check for outdated dependencies weekly.Multi-Agent Collaboration
│
├── Why: Claude work = task -> wait -> review -> next
│ many sessions => wait time ~ 0
│ Cost: ~6x tokens + a consistency/merge pass
│
├── Parallel sessions
│ ├── claude --worktree (isolated dir + branch)
│ ├── --tmux + shell aliases (za/zb/zc)
│ └── one branch per session, merge via PR
│
├── Subagents (.claude/agents/*.md)
│ ├── specialist step inside current task
│ └── KEY: independent context (frees main session)
│ └── combo: security-reviewer + verify-app
│
├── Agent Teams (Feb 2026, self-coordinating)
│ ├── Writer / Reviewer loop
│ ├── Test-Driven (AI TDD)
│ ├── team lead role, shared state
│ └── Coordinator: Research -> Synthesis -> Impl -> Verify
│
├── Fan-out / batch
│ ├── claude -p "..." (non-interactive)
│ ├── for ... claude -p ... & (parallel)
│ └── /batch: plan -> confirm -> aggregate
│
└── Async
├── Remote Control (phone), Claude Code on Web
├── /schedule (cloud cron, PC off OK)
└── /loop (local, up to 3 days)
Mindset: AI = night shift team
claude --worktree automates it..claude/agents/*.md) handle a specialist step; their key value is independent context.claude -p in a backgrounded loop, or the /batch command (plan → confirm → aggregate)./schedule (cloud), /loop (local, up to 3 days) — treat AI as a night-shift team.This teaching edition is based on the supplied April 2026, 2nd edition of Claude Code: The Complete Guide (§08, "Multi-Agent Collaboration"). Flags, command names, feature availability (e.g. Agent Teams, February 2026) and cost figures reflect that edition and may change over time.