Recipes / Guides / Parallel coding agents / How-to

Step by step · built from 5 real setups

How to run Claude Code agents in parallel with git worktrees

Last updated · by Thomas, editor · How we verify

One worktree per agent, one task per worktree, and you only look at the session that needs you. These steps come from the Claude Code team's own habits and four other published setups.

What you need

Set it up, step by step

  1. Split the work into tasks that touch different files. Parallel tasks editing the same file still conflict. (recipe)
  2. Create one worktree per task: git worktree add ../wt-[BRANCH] -b [BRANCH]. The Claude Code team runs 3 to 5 sessions; start with 3. (recipe)
  3. Write a done-when list for each task: checks a program can run, like tests or CI going green. (recipe)
  4. Start each session in plan mode, and have a second session review the plan before it builds. (recipe)
  5. Give each agent the bounded prompt below: stay in its worktree, write NEEDS INPUT when blocked, DONE plus a summary and test command when finished. (recipe)
  6. Add a Notification hook so a desktop alert names the folder that's waiting. (recipe)
  7. Review one branch at a time: run the checks yourself, merge, then git worktree remove. Commit first; plain git doesn't warn about uncommitted work. (recipe)

Starter prompt: one bounded task per worktree (our version, from the kanban recipe)

For each parallel task: 1. git worktree add ../wt-[BRANCH] -b [BRANCH] 2. Start the agent there with: "Work only inside this worktree on [TASK]. When you need a permission or a decision, stop and write NEEDS INPUT on its own line. When finished, write DONE plus a 3-line summary and the test command." 3. Track every worktree on a 3-column list: Idle / Working / Needs Input.

Notification hook prompt (from the notify recipe)

Set up a Claude Code Notification hook in my user settings that shows a desktop notification "Claude needs input: [project folder]" whenever you're waiting on me or a permission. Use [osascript on macOS / notify-send on Linux]. Show me the settings JSON before writing it.

Approval and safety rules

Real examples

Each one links to the recipe and its original source.

Compare more setups: Parallel coding agents: all 9 recipes →

Common questions

Why use git worktrees for parallel agents?

Each worktree is its own checkout on its own branch, so agents don't edit the same working files. Every setup here gives each agent its own worktree.

How many Claude Code agents can I run at once?

The Claude Code team runs 3 to 5 sessions. The limit people hit is review: too many sessions overloads your review capacity.

Does this work with Codex?

Yes. Agent Navigator supports Claude Code and Codex CLI, and the done-when rules work from either one.

Get the next money recipe. Free.

New recipes every week, plus the top 10 agent setups pack. One email, no spam.

Unsubscribe anytime. Privacy

More guides: Make money with AI agents · AI voice agent business · AI agent agency ideas · Claude Code use cases · Grok Bot use cases · Claude Code vs Codex · AI agents for small business · AI email agents · AI code review agents · Parallel coding agents · AI agents that save you money · Autonomous agents that made money