Heidelberg AICurriculum
Track 20 · Advanced
20.3

Parallel agent fleets

Five coding agents, one repository, and a review queue you did not plan for

7 lessons 2026-08-13 AI-generated

1Overview

Running multiple coding agents concurrently against one codebase, each in its own isolated workspace, with their output funnelled through a single review gate.

Personal assistants are one agent per person. This chapter is several agents on one codebase at the same time — each in an isolated workspace, all producing diffs, all arriving at the same human. → Worktree and container isolation, merge discipline, and the honest measurement of whether five agents actually beat one. → The bottleneck moves, and it moves somewhere most teams do not have capacity: review.

Several coding agents on one repository at once. Isolation so they cannot collide, merge discipline so the work survives, and an honest measurement at the end — because the bottleneck moves from writing code to reviewing it, and that is a capacity problem no tool solves.

1.2After this chapter you can
Give each agent an isolated workspace so parallel work cannot collide
Choose between git worktrees and container isolation for a given task
Split work into genuinely independent tasks, and recognise when it is not
Merge several agent branches without losing changes or re-running everything
Measure whether the fleet beat a single agent, including your review time
Set a review gate that the fleet cannot outrun
1.3When to reach for it

Many small, independent, well-specified tasks — a backlog of mechanical fixes. Not one hard task you hoped to parallelise.

1.4Key parts

Per-agent isolation (worktree or container), a task list with real independence, a merge strategy, and a review gate with a throughput limit.

1.5Free vs paid

The orchestration tooling is open source; the model tokens scale linearly with the fleet. Five agents cost five times as much whether or not they helped.

1.6Watch out

Tooling in this niche does not merely stall, it shuts down. The best-known fleet tool of 2026 posted a shutdown notice in April with no sustainable business model. Learn the technique; treat every tool here as replaceable.

2Lessons 7

2.1 Create separate worktrees for each agent

A git worktree creates a separate checkout directory linked to its own branch while sharing the same repository metadata.

Run multiple coding agents on the same repository without branch conflicts using git worktree

  1. Run git worktree add -b fleet/task-1 ../task-1 from inside the main repository to create the first worktree
  2. Start the coding agent with its working directory set to ../task-1, either by launching it there or passing that path as cwd
  3. Create additional agents by repeating git worktree add -b fleet/task-2 ../task-2 (and so on) for each parallel task
  4. Verify all active worktrees with git worktree list to see their paths and checked‑out branches
  5. When a task is finished, clean up with git worktree remove ../task-1 (add -f only if you need to discard uncommitted changes)
  • You'll see A git worktree list output showing one line per active checkout with its path, commit and branch name
  • Takeaway git worktree add -b assigns an agent its own folder and branch while sharing a single repository
  • Check How does using git worktree add -b let each coding agent work without branch conflicts?
  • Cost Free — it is a git feature, not a tool you install. The real cost is disk: each worktree is a full working-tree checkout, so five parallel worktrees hold five copies of every tracked file on disk, not one.

2.2 Pick the right isolation method for an agent

A container‑use workspace launches an isolated Docker‑based environment for a coding agent, keeping its execution separate from the host system.

Select either a git worktree or a containerised workspace based on what the task must be kept away from

  1. Run git worktree add to create a new worktree for the branch you want to isolate
  2. Open your system monitor and confirm that the worktree agent shows up as a regular process
  3. Execute dagger/container-use start with the desired base image to launch a containerised workspace for the task
  4. Inspect the container runtime UI (or use docker ps) to see that the container‑use agent runs inside its own isolated environment
  5. Use git diff in the worktree to review any changes before committing, or run your tests inside the container to verify behaviour
  • You'll see The worktree agent appears as a normal process in your system monitor, while the container‑use agent runs inside the container runtime and is invisible there
  • Takeaway Choose worktrees for branch‑level safety and containers for full host isolation depending on how much you trust the task
  • Check What criteria determine whether you should use a git worktree or a container‑use workspace to isolate a coding agent?
  • Cost Worktrees: free, instant. container-use: free and open source, but the container runtime and image builds cost real setup time and disk — budget more than the "five minutes" a worktree takes.

2.3 Identify truly independent parallel tasks

An independent parallel task is a self‑contained description that neither reads nor writes files modified by any other task.

Distinguish a genuinely parallel task list from one that merely appears parallel before creating worktrees

  1. Write each task description in isolation as if the others do not exist
  2. Check that a description does not mention any file modified by another task
  3. Confirm that no description depends on the output or existence of another task’s artefact
  • You'll see You can write five task descriptions that never reference each other, confirming they are independent
  • Takeaway Independence means no task reads what another writes and no task relies on another's output; if you must cross‑reference tasks, they are not truly parallel
  • Check What three checks confirm that a set of task descriptions are truly independent and can run in parallel?
  • Cost Free, and the cheapest step in the whole chapter to skip — which is exactly why it gets skipped, and exactly why the merge lesson right after this one exists.

2.4 Merge each agent branch safely

A git merge --no-ff integrates an agent’s branch into the integration branch while preserving a separate commit history.

Integrate every agent's work into the main line one at a time while catching conflicts early

  1. Run git merge --no-ff fleet/task-1 onto the integration branch and verify the build passes
  2. Execute your test suite to confirm the merged code works correctly
  3. Remove the completed worktree with git worktree remove ../task-1 and delete the branch
  4. Repeat the merge for fleet/task-2, now against the updated integration branch, and run tests again
  5. If a conflict appears, resolve it manually or hand the conflicting hunk to the responsible agent before proceeding
  • You'll see A clean git status and passing tests after each merge before the next branch is processed
  • Takeaway Merging and testing one branch at a time, then removing its worktree, keeps conflicts small and attributable
  • Check After merging an agent’s branch with git merge --no-ff, what outcome indicates it is safe to remove that worktree and delete the branch?
  • Cost Free — it's the same git merge you'd run for one branch, run N times instead of once. The cost you're managing is your own time if you skip the "one at a time" discipline and have to untangle a compound conflict instead.

2.5 Measure if a fleet beats a single agent

A wall‑clock time calculation adds the agents’ execution duration to the reviewer’s time to assess overall speed and cost.

Determine whether running multiple agents saves overall time and tokens compared with one agent

  1. Start a timer when you begin the batch of work
  2. Run the full fleet on the backlog and note the agents' completion times
  3. Record your own review time for each task as you read the diffs
  4. Calculate total wall‑clock time (agents + review) and total token spend for both the fleet run and a single‑agent run
  • You'll see Side‑by‑side numbers showing total wall‑clock time (agent + review) and token spend for the fleet versus a single agent
  • Takeaway Include your review time in the wall‑clock measurement and compare token cost, because parallel writing is cheap to start but reviewing and tokens scale with fleet size
  • Check How do you compare the efficiency of a fleet versus a single agent using both total wall‑clock time and token consumption?
  • Cost The measurement itself is free — a timer and a note. What it measures is not: the token multiplier is real spend, and it accrues whether the fleet turned out to be worth it or not.

2.6 Limit parallel agents to match your review capacity

A diffs‑per‑hour limit caps the number of concurrently running agents to match the reviewer’s capacity.

Restrict the number of active agents so they never exceed the diffs you can honestly review per hour

  1. Decide the maximum diffs‑per‑hour you can review carefully and note that number
  2. Configure your agent launcher script to start no more than that many agents concurrently
  3. Pause launching a new agent until the previous diff has been reviewed, merged or rejected
  • You'll see Diffs appear one at a time from finished worktrees, queued according to your own pace
  • Takeaway Match fleet concurrency to your true reviewing speed rather than disk or CPU limits
  • Check What steps configure your launcher script so that no more than your maximum diffs‑per‑hour are active at any moment?
  • Cost Free to set as a policy. What it costs is patience: a real throughput cap means a five-agent fleet does not finish five times faster from your perspective, even though the writing did.

2.7 Plan a parallel agent fleet around review capacity

A review‑capacity‑aligned workflow structures agent launches to keep the pending diff queue within human review limits.

Design a workflow that scales writing agents without exceeding human review limits

  1. Open the repository on GitHub and view the Commits list
  2. Read the project's announcement page for any sunset notices
  3. Verify that your local workspace still builds after hosted features are removed
  • You'll see Your review queue remains the same length whether one or five agents generate diffs
  • Takeaway Review capacity does not scale with fleet size, so build the technique to survive tool changes
  • Check Which three actions ensure that adding more agents does not increase the length of your review queue?
  • Cost Free to internalize, and the one lesson in this chapter with no tool to install — which is rather the point.

3You’ll know it worked 14 checkable outcomes in this chapter

  • Running the fleet command shows each agent working on only its assigned paths without collision errors
  • The CLI outputs a summary of agents and target files with no errors before any changes are made
  • Check that the expected changes (issue fix, dependency bumps) appear as new PRs or merged commits in the repository
  • After reviewing, the diffs are applied and the main project reflects all new artifacts without conflicts
  • Blue dots appear on finished threads; you can stop or archive any thread without leaving the window
  • The thread disappears from the sidebar and its folder is removed; showing thread history restores it exactly as before
  • Every issue results in an open PR that references the original issue number
  • Each worktree connects to a distinct Neon branch URL and sees isolated tables

14 outcomes in all — one per recipe below.

4FAQ, Tips & How-to 14

one problem, one solution, one action
How-to Copilot Everyone

Agents keep overwriting each other’s files

Create a markdown file (plan.md) that maps each target component or directory to a specific sub‑agent. By being explicit about which files each agent may modify, you prevent overlapping writes and merge conflicts during parallel execution.

TechWhistle ↗ Lesson → AI-generated
How-to Copilot Everyone

Need to check a new fleet launch safely

Use the `--dry-run` (or similar) flag when first launching the fleet. The command parses plan.md, checks that all referenced paths exist, and simulates agent startup without writing any code, catching typos or mis‑assignments early.

TechWhistle ↗ Lesson → AI-generated
How-to Copilot Everyone

Many separate code changes need checking

After the fleet finishes, it creates separate Git branches each containing only that agent’s final diff. By reviewing each branch individually you retain full control over integration and can catch logical errors before merging to main.

TechWhistle ↗ Lesson → AI-generated
How-to Everyone

Want to apply many fixes and upgrades across a repo

The /fleet command lets you issue a single prompt that spawns several Copilot agents, each handling a separate sub‑task (e.g., fixing an issue, upgrading dependencies). By delegating these tasks to parallel agents, you finish routine maintenance without manual intervention.

GitHub ↗ Lesson → AI-generated
How-to Everyone

Need several AI drafts at once

Replit’s parallel agents let you launch several AI‑driven tasks (e.g., mobile app, video, pitch deck) from the same project. Each task runs in its own isolated copy so changes never affect the main code until you approve them, enabling true multitasking without context switching.

Replit ↗ Lesson → AI-generated
How-to Everyone

Multiple agents edit separately

Each parallel agent’s output lives in an isolated workspace until you move it to the “Ready” stage, where you can review a diff against the main branch. This prevents accidental overwrites and enforces disciplined merging of multiple contributors.

Replit ↗ Lesson → AI-generated
How-to Everyone

Multiple people need separate code spaces

A Git worktree creates a fresh checkout of the same repository in a separate folder, allowing multiple agents to edit code without interfering with each other. Zed can create these worktrees directly from the UI, giving each agent its own isolated workspace.

Zed Industries ↗ Lesson → AI-generated
How-to Everyone

Juggling separate AI chat windows

Zed’s Threads sidebar lets you import, start, stop, and monitor any number of agent threads (Zed, Claude, Codex, etc.) in one window, removing the need for separate editor instances.

Zed Industries ↗ Lesson → AI-generated
How-to Everyone

Parallel agent threads filling up disk

When you archive a thread, Zed moves its uncommitted changes into Git storage and deletes temporary files, freeing disk space while preserving the ability to restore later.

Zed Industries ↗ Lesson → AI-generated
How-to Everyone

Multiple AI bots need separate code copies

Worktrees let each AI agent operate on its own copy of the repository, preventing file conflicts. By creating a separate worktree per issue, agents can modify code independently and later merge via pull requests.

Cole Medin ↗ Lesson → AI-generated
How-to Everyone

Turn every GitHub issue into an auditable pull request

Treating a GitHub issue as the input spec and the resulting pull request as validation output creates a clear, auditable workflow for each agent. This aligns planning, implementation, and review steps.

Cole Medin ↗ Lesson → AI-generated
How-to Everyone

Running multiple worktrees causes port conflicts

Assigning each worktree a unique port based on its name prevents runtime collisions when agents start the application for testing. A simple script can compute a deterministic offset from a base port.

Cole Medin ↗ Lesson → AI-generated
How-to Everyone

Need a sandbox DB for each git worktree

Neon's branching feature clones the production database schema and data into a separate branch for each worktree, giving agents safe sandboxed databases. This avoids cross‑worktree data races.

Cole Medin ↗ Lesson → AI-generated
How-to Everyone

Want a bias‑free pull‑request check

Running a review in a new AI session (cleared context) prevents the writer’s bias from influencing the reviewer, similar to an independent code audit. The dedicated /review_pr command automates diff extraction and issue comparison.

Cole Medin ↗ Lesson → AI-generated

The same set on /recipes, filtered by tool and role.

5See also

💬 Discuss this chapter

Ask, share, or report — over on the Heidelberg AI community forum.