Parallel AI Coding Agents with Git Worktrees: Ship 5 Features at Once

K
By Kylian Migot · May 22, 2026 · 9 min read

Git worktrees are the missing primitive for multi-agent development. Each agent gets its own branch, its own directory, and its own dev environment — no conflicts, no coordination overhead.

What Are Git Worktrees?

A git worktree is a linked working directory attached to an existing repository. Unlike cloning a repo into multiple directories (which duplicates the full object database), a worktree shares the underlying git history and object store while giving you a fully independent filesystem view on a different branch.

The canonical git command is simple: git worktree add ../my-feature feature/my-feature. This creates a directory called my-feature one level up, checked out to the branch feature/my-feature. You can run your dev server, install dependencies, and make commits in this directory entirely independently of your main working tree.

Each worktree has its own index (staging area) and HEAD pointer. Changes you make in one worktree are invisible to all others until they are committed and pushed. You can have as many worktrees as your machine can handle — they are cheap to create (a few kilobytes of metadata) and fast to remove (git worktree remove followed by git worktree prune).

Git has supported worktrees since version 2.5 (released in 2015), but most developers have never used them because the traditional single-developer, single-branch workflow didn't need them. The rise of AI coding agents that run in the background — potentially for minutes or hours — changes this calculation entirely.

Why Parallel AI Agents Need Git Worktrees

The most common mistake developers make when trying to run multiple AI coding agents is assigning them all to the same branch in the same directory. The failure mode is immediate and painful.

File conflicts

Agent A is modifying src/lib/auth.ts. Agent B opens the same file to make an unrelated change. One agent's writes overwrite the other's mid-execution. Neither agent knows — it just proceeds with corrupted context.

Unstaged change collisions

Claude Code and Codex both stage files before committing. Two agents staging different versions of the same file in the same index produces an unpredictable merge that neither agent designed.

Dev server conflicts

Agents that run tests or start dev servers (port 3000, port 8080) conflict immediately. The second agent's server startup fails, tests time out, and the agent either loops trying to recover or produces incorrect results.

Git worktrees eliminate all three problems. Each agent operates in its own directory on its own branch. The filesystem is fully isolated — Agent A's edits to src/lib/auth.ts exist only in its worktree directory. Agent B sees the version of that file on its own branch, untouched.

Each worktree can bind its dev server to a different port. Agents can run tests independently without interfering with each other's output. And because each worktree is a real filesystem path, agents can be pointed at their working directory with a simple cd — no environment variable juggling.

The only coordination point is the shared git history, which agents access read-only until they push their branch. This is exactly the coordination model you want: agents share nothing except the foundation they branched from.

Setting Up Parallel Claude Code Agents with Git Worktrees

Here is the manual workflow for running multiple Claude Code agents in parallel using git worktrees. This is the foundation AIDEN automates — but it is useful to understand what is happening under the hood.

  1. Create a worktree for each story

    For each parallel task, create a worktree from your main branch: git worktree add ../project-auth feature/auth, git worktree add ../project-payments feature/payments, git worktree add ../project-notifications feature/notifications. Each directory gets a fresh checkout of a new branch.

  2. Open a terminal in each worktree

    cd into each worktree directory in a separate terminal tab or pane. From this point on, every command you run (npm install, npm run dev, git add, git commit) affects only this worktree's branch. The other worktrees are completely unaffected.

  3. Launch claude in each worktree

    In each terminal, run claude (or codex) and give each agent its task. Because you're in a separate directory with a separate branch, the agent operates in complete isolation. It can make commits, run tests, and even start a dev server without any coordination with the other agents.

  4. Track progress manually

    This is where manual management breaks down. With 3 terminals, it's manageable. With 5, you're constantly alt-tabbing to check which agent is blocked, which has committed, and which is still running. You need a mental model of 5 independent processes, each with its own state, each potentially waiting for your attention.

  5. Open PRs manually

    When each agent finishes, you push the branch and open a PR: git push -u origin feature/auth, gh pr create. Then clean up: git worktree remove ../project-auth. Repeat for each story. At 5 parallel stories, this is 15+ commands per cycle.

This workflow is entirely valid and many experienced developers use it. The overhead is the problem: at 3 agents, it's a 15-minute setup; at 5 agents, you spend more time managing the workflow than reviewing what the agents produced. The agents are faster than the scaffolding around them.

How AIDEN Automates the Entire Parallel Agent Workflow

AIDEN was built specifically to eliminate the manual overhead of the worktree + parallel agent workflow. Every step in the manual setup above is automated. Here is what AIDEN does end-to-end when you launch a story:

Automatic worktree creation

When you approve a spec and launch an agent, AIDEN calls git worktree add internally, creates a new branch from your configured base branch, and names both the branch and the directory after the story slug. You never touch the command line.

Agent assignment and launch

AIDEN spawns a Claude Code or Codex process inside the worktree directory, with the story spec as its context. The agent starts immediately, with its working directory isolated to its own branch.

Kanban board streaming

AIDEN streams the agent's stdout to a card on the kanban board in real time. You can see every agent's current action, last commit, and status at a glance — no terminal tab juggling.

Automatic PR on completion

When the agent marks the task done, AIDEN pushes the branch and opens a GitHub pull request with the spec attached as the description. You receive a notification on the board card. Review and merge — worktree cleanup happens automatically after merge.

The net result: you describe a story, approve the spec, and AIDEN handles every worktree and agent lifecycle command from creation to PR. You spend your time writing story cards and reviewing PRs — not managing terminals and git plumbing.

AIDEN also handles edge cases the manual workflow leaves open: if an agent gets blocked and exits unexpectedly, AIDEN marks the card as blocked and preserves the branch. If an agent needs to install dependencies (npm install, pip install), it does so inside its worktree without affecting any other worktree's node_modules or virtual environment.

How Many Parallel Agents Can You Run?

There is no hard limit on git worktrees themselves — git handles hundreds of them without performance degradation. The practical limits come from three other places:

API rate limits

Anthropic and OpenAI both apply per-minute token limits. If you launch 10 agents simultaneously, several will hit rate limit errors in the first minute. AIDEN's scheduler staggers agent launches to stay within your tier's limits, typically achieving 4–6 active agents without interruption on a standard paid API plan.

Machine resources

Each Claude Code or Codex agent spawns a subprocess. On a MacBook Pro M3 with 16GB RAM, 5–6 simultaneous agents is comfortable; 8–10 starts to compete for memory if each worktree runs a dev server. AIDEN shows active memory usage per agent and queues new stories rather than spawning agents that will be starved for resources.

Your review throughput

The real bottleneck is usually you. If 5 agents each finish a story in 20 minutes and each PR takes you 10 minutes to review, you need 50 minutes of focused review per hour to keep up. Most developers find 3–4 simultaneous agents is the sustainable parallel workload — enough to feel like a force multiplier, not so many that PRs pile up unreviewed.

Frequently Asked Questions

What is a git worktree?
A git worktree is a linked working directory attached to an existing repository. It lets you check out a different branch in a separate directory without cloning the repo again. You can have as many worktrees as you need, each on a different branch, all sharing the same underlying git history and object store.
How many agents can run in parallel?
Practically, 3–6 parallel agents is the sweet spot for most developers on modern hardware. The limiting factors are your machine's CPU/RAM (each agent spawns a subprocess), Anthropic and OpenAI API rate limits, and your own ability to review PRs as they arrive. AIDEN handles scheduling so agents queue gracefully rather than hitting rate limits simultaneously.
Do parallel agents interfere with each other?
No — that's exactly what git worktrees prevent. Each agent operates in its own directory on its own branch, with its own working tree state. Agents cannot read or write each other's uncommitted changes. The only coordination point is the shared git history, which agents access read-only until they push their branch.
Does AIDEN manage worktrees automatically?
Yes. AIDEN creates a new git worktree for each story you launch, assigns an agent, streams its output to the kanban board, and cleans up the worktree after the PR is merged or the story is closed. You never run git worktree add or git worktree remove manually.

Stop managing terminals. Start shipping features.

AIDEN handles every worktree, every agent, and every PR automatically. Free to start — bring your own Claude Code or Codex CLI.

Download AIDEN — free