1. brindle
  2. Guides
  3. Parallel agents

Run several Claude Code agents in parallel with git worktrees

Git worktrees let several Claude Code sessions work in one repository without sharing a checkout. Each edits and tests its own branch, and your main directory stays free.

Type
Guide
Updated
Related
Codex reviews Claude Code
Rewind an agent
Milestone checks

Why a worktree per agent

Two agents in one checkout overwrite each other's edits, change files mid-test and leave a mess that's hard to review. A worktree gives each agent its own directory and branch in the same repository, so you can compare and merge when ready.

It pays off when a request has independent pieces, like a backend endpoint and a frontend view. If both need the same files or each other's unfinished work, splitting costs more than it saves. Set the boundaries first.

Create a worktree with git

Start from a clean, committed base. Create a directory and branch for each task:

git status
git worktree add -b feature/api ../app-api main
git worktree add -b feature/ui ../app-ui main

Replace main with your base branch and pick your own paths. Open a Claude Code session in each directory. Give each one a focused task: the files to change, the behavior to build, the test or build command to run. Ask it to commit on its own branch, then inspect each branch's diff from its worktree.

Coordinate agents with brindle

By hand, you still start sessions, track progress, review branches and clean up. brindle does that. A supervisor splits a goal into tasks, gives each worker its own branch and worktree, tracks dependencies and reviews each worker's exact commit before merging.

Start brindle in your repo and describe the goal and what done means, with checks for multi-part work. Under autopilot, milestones and their checks track progress. brindle can hold a task until its declared dependencies merge, and the sidebar shows active workers and those waiting on you. If brindle isn't installed yet, curl -fsSL pawdelta.com/brindle/install | sh installs brindle and uv, and tmux too on a Mac with Homebrew. On Linux it tells you the one package to install.

cd ~/code/myapp
brindle init
brindle

brindle init detects your setup and check commands and the git-ignored env files to copy into each worktree, and writes .brindle/config.json. Review it, and commit it if your team should share it. Then give the supervisor the goal and its pieces. For example, an API change and a UI change, with the API finished before the UI integration starts.

Under autopilot, or with review on, a branch merges only after a reviewer approves that exact commit and your checks pass. Each worker's contribution gets its own review point instead of landing uninspected in a shared checkout.

Make parallel work easier to review

Parallel work needs clear interfaces. Agree on an API shape, file ownership or behavior before workers start. If two tasks touch the same component, run them in sequence or let one worker own the integration. Worktrees prevent file collisions. They don't prevent design conflicts.

Give each task its own check, such as an API test for one branch and a focused UI check for the other. You still want a repo-wide check before the goal is done. brindle runs your checks before a merge and re-runs milestone checks as work progresses. Make them commands that exercise the behavior you asked for.

Keep the base current. A branch cut earlier may need changes from a task that has since merged. brindle can sync a workspace from its base, and dependent tasks wait for their prerequisites. With plain worktrees, merge the relevant branch yourself and resolve conflicts where you integrate.

Finish and clean up

Review a branch, confirm its checks, merge it. With manual worktrees, remove a finished checkout with git. Keep any branch with unmerged work. The worktree is just a directory; the branch holds the commits.

With brindle, review and merge through the supervisor, then remove finished workspaces. brindle continue resumes a paused session. If the task is too small to split, one Claude Code session is simpler. See Recommended use for choosing work and setting checks, and Providers and models for other agents.