Vibe Coding using Claude Code/Vibe Coding Patterns
Lesson 7 / 7 · 18 min · 0 / 5 exercises
Course contents
Concept · 5 hands-on exercises

Parallel Work: Worktrees, Background Agents and Agent Teams

Run several Claude sessions at once without collisions: give each a worktree, dispatch background agents from agent view, and know when an agent team or a dynamic workflow is worth its cost.

It's tempting to think that four agents finish four times faster. Before reading about the tools, explore where the time actually goes when several agents work and one person reviews.

Explore: Parallel agents, one reviewerExercise 1 of 5
agent workingyou reviewing
160 minone at a time
70 minin parallel
2.3×speed-up
57%of the time is you reviewing

However many agents you add, the speed-up can't pass 4.0×, because your reviews happen one at a time.

Start with 4 agents, 30-minute tasks and 10-minute reviews. Then push the number of agents up.

Move the controls and watch what changes.

Quick checkExercise 2 of 5

With 30-minute tasks and 10-minute reviews, what's the most speed-up you can ever get by adding agents?

Worktrees: one checkout per session

Two sessions editing the same files will trip over each other. A git worktree is a second working directory with its own branch, sharing one repository. claude --worktree feature-auth (or -w) creates .claude/worktrees/feature-auth/ on a new branch called worktree-feature-auth and starts Claude there; run it again with another name in another terminal for a second isolated session. Add .claude/worktrees/ to your .gitignore.

A worktree is a fresh checkout, so gitignored files such as .env aren't there and dependencies aren't installed. List the small files you need in a .worktreeinclude at the repository root (same syntax as .gitignore) and Claude Code copies them into each new worktree. Don't list node_modules: it copies rather than links. When you exit an unnamed worktree session with no changes, Claude Code removes it; otherwise it asks. A claude -p --worktree run exits without asking, so you clean those up with git worktree remove.

Fill the blanksExercise 3 of 5

Start an isolated session for the auth work, and make sure each new worktree gets your local environment file.

claude feature-auth # .worktreeinclude

Five ways to run agents in parallel

ApproachWhat you getStatus as of November 2026
SubagentsWorkers inside one session that return summariesBuilt in; Claude uses them on its own
Agent view (claude agents)One screen to dispatch and watch background sessions on your machineResearch preview
Agent teamsA lead session that assigns work to teammates who share a task list and message each otherExperimental, off by default
ProjectsOne ongoing conversation at claude.ai/code or in the desktop app; Claude starts and tracks parallel cloud threadsPublic beta on Pro, Max and Ultra
Dynamic workflowsA script Claude writes that orchestrates dozens or hundreds of subagents and cross-checks their resultsAll paid plans; on Pro, turn it on in /config

Background agents. Run claude agents to open agent view: type a task and press Enter to dispatch a background session, and each new prompt starts another one. Rows show which sessions are working, which need your input and which are done; you can peek, reply or attach to the full conversation. Each dispatched session moves into its own worktree before it edits files. From inside a session, /background (or /bg) sends the current conversation to the background, and /fork sends a copy while you keep working. From your shell, claude --bg "<task>" dispatches directly.

Agent teams are for work where the workers need to talk: research where teammates challenge each other's findings, or a feature split across frontend, backend and tests. You turn them on with CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1. They use significantly more tokens than one session, and the docs recommend a single session or subagents for sequential work, same-file edits or tasks with many dependencies. For one large mechanical change, /batch packages subagents and worktrees for you: it plans 5 to 30 independent units and has each open a pull request.

Match them upExercise 4 of 5

Match each job to the approach that fits.

Pick one on the left, then its partner on the right.

The job
Approach
0 of 5 matched
Quick checkExercise 5 of 5

Why not dispatch twelve background sessions for every task?

Check your understanding
Q1. What problem do worktrees solve for parallel sessions?
Q2. What's true of agent teams as of November 2026?
Q3. A fresh worktree session fails to start your app because .env is missing. What's the fix?
· Work through the 5 remaining exercises above (stuck? each one can show you the answer).
· Score 100% on the quiz.
Vocabulary in this lesson

Plain-English definitions from the AI Coding Dictionary.