October 23, 2026

How to Run Multiple Claude Code Agents in Parallel

Give each Claude Code agent its own git worktree, hand each one a task that touches different files, and review the branches one at a time. This guide walks through the setup step by step with plain Claude Code, then shows how Chief plans, runs and reviews parallel agents for you.

The short answer

To run multiple Claude Code agents at the same time:

  1. Split the work into tasks that touch different files.
  2. Start each agent in its own worktree with claude --worktree <name>, one terminal per agent, so edits never collide.
  3. Copy local config such as .env into each worktree with a .worktreeinclude file, and install dependencies there.
  4. Monitor them from one screen with background agents: claude --bg "<task>" starts one, and claude agents lists them all.
  5. Review and merge each branch on its own, then let Claude Code clean up the worktree.

Everything below works with Claude Code alone. The same pattern works for OpenAI Codex, or a mix of both.

Before you start

  • Claude Code installed and signed in. Run claude --version to check. The flags below are in current releases; run claude update if one is missing.
  • A git repository with at least one commit. Worktrees branch from an existing commit.
  • Usage headroom. Every agent spends from the same plan. Three agents use roughly three times the tokens of one, so check your limits first. AI coding agent costs breaks down what each plan includes.

Step 1: Pick tasks that can run side by side

Parallel agents go fastest when their work doesn't overlap. Before you start any agent, ask one question about each task: does it need another task's output, or edit the same files?

Good to run in parallelBetter run in order
A new API endpoint and an unrelated settings pageA database migration and the code that reads the new column
Tests for module A and a refactor of module BTwo refactors of the same file
Docs updates and a bug fixA shared type change and every feature that uses it

When two tasks depend on each other, run the shared piece first (the interface, type or migration), then start the tasks that build on it. Three well-separated tasks beat six that keep meeting in the same files.

Step 2: Start each agent in its own worktree

A git worktree is a second checkout of your repository on its own branch, sharing the same history. Each agent edits its own copy of the files, so nothing it writes can land in another agent's work.

Claude Code creates worktrees for you. Open one terminal per agent in your repository root:

# Terminal 1
claude --worktree add-invoices-api

# Terminal 2
claude --worktree settings-page

# Terminal 3
claude -w fix-flaky-login-test

Each command creates .claude/worktrees/<name>/ on a new branch called worktree-<name>, then starts a Claude Code session inside it. Give each session its task as the first message.

Add the worktree folder to .gitignore once, so the checkouts don't show up as untracked files in your main checkout:

echo ".claude/worktrees/" >> .gitignore

Step 3: Give every worktree what it needs to run

A worktree is a fresh checkout of tracked files only. Your .env, local certificates and node_modules stay behind in the main checkout.

Create a .worktreeinclude file at the repository root. It uses .gitignore syntax, and Claude Code copies every matching gitignored file into each new worktree:

.env
.env.local
config/local-settings.json

Then ask each agent to install dependencies before it starts, or run your setup command yourself in the worktree directory. Watch for two shared resources:

  • Ports. Two dev servers can't both listen on port 3000. Tell each agent which port to use.
  • Databases. Agents running migrations against the same local database can interfere. Give each one its own database name, or run migrations in only one task.

Step 4: Watch every agent from one screen

Three terminal tabs work for three agents. Past that, use background agents. Each one is a full Claude Code session that keeps running without a terminal attached, and Claude Code moves it into its own worktree before it edits anything.

claude --bg "add pagination to the invoices API and cover it with tests"
claude --bg "fix the flaky login test in tests/auth"
claude agents

claude agents opens one view of every session, grouped by Needs input, Working and Completed. Press Space to peek at a session and answer its question without attaching, or Enter to open the full conversation. From scripts, claude attach <id>, claude logs <id> and claude stop <id> do the same jobs.

Step 5: Use subagents for parallel work inside one task

Subagents are different from parallel sessions. A subagent runs inside one Claude Code conversation, does a focused job in its own context window and reports back. They suit research and fan-out inside a single task: "use subagents to check every service for the old auth header."

When subagents edit files in parallel, give each one its own worktree. Ask Claude to "use worktrees for your agents", or add isolation: worktree to a custom subagent's frontmatter in .claude/agents/:

---
name: refactorer
description: Applies mechanical refactors across many files
isolation: worktree
---

Apply the requested refactor across every affected file, then run the tests and report the results.

Use parallel sessions for independent tasks you want to review as separate branches. Use subagents to split up one task.

Step 6: Review and merge one branch at a time

Every agent finishes on its own branch, so review is a normal branch review:

git worktree list
git log --oneline main..worktree-add-invoices-api
git diff main...worktree-add-invoices-api

Merge or open a pull request for each branch in turn, and run the tests after each merge. Merging one at a time means any conflict is small and easy to place. Before you merge, check three things in each branch: it does what the task asked, its tests pass, and it doesn't include changes outside its scope.

For larger batches, How to Review AI-Generated Code at Scale covers review queues and agent-as-reviewer workflows.

Step 7: Clean up

When you exit a worktree session, Claude Code checks for unsaved work. A clean worktree from an unnamed session is removed with its branch. A worktree with changes prompts you to keep or remove it. For worktrees you created yourself, or ones left behind by non-interactive runs:

git worktree remove .claude/worktrees/add-invoices-api
git worktree prune

How many agents should you run?

Start with two or three. The limit is rarely your laptop: Claude Code does its heavy work in the cloud, and each worktree costs about one copy of your source files on disk. The real limits are:

  • Your review time. If finished branches start piling up, adding agents only grows the pile.
  • Task independence. You need that many tasks that don't edit the same files.
  • Your usage limits. Every agent draws from the same plan.

The right number keeps every agent busy and your review queue short.

How Chief runs multiple agents for you

Everything above works. Once you run several agents every day, most of your time goes to the steps around the code: choosing tasks that won't collide, writing each prompt, checking which agent is waiting, and reviewing what came back. Chief takes over that loop.

  • You set the goal, Chief plans the work. Describe the outcome in a sentence. Chief breaks it into milestones, each with a definition of done and the milestones it depends on.
  • Parallel by plan. Chief runs every milestone whose dependencies are done at the same time. It plans shared pieces such as types, interfaces and migrations first, and it chains or merges milestones that would mostly edit the same files, so parallel agents stay out of each other's way.
  • Runs on your computer, with your subscriptions. The Chief relay starts Claude Code, Codex and other agents in your project folder, using the accounts you already pay for. Each agent commits only its own files, tagged with its task, so every change traces back to its milestone.
  • Every result is reviewed. Chief checks each finished milestone against its definition of done. Decisions only you can make go into one queue.
  • Auto mode with a budget. Set a task limit and a weekly cap on your provider's usage, and Chief keeps working towards your goals until it reaches either one.
  • Check in from anywhere. Approve milestones and answer the queue from your phone, from the Chief MCP server in Claude, Claude Code or Codex, or from a DM with Chief for Discord.

You set the direction and make the calls. Chief keeps the agents working. See Chief and Claude Code for how the two fit together, and the multi-agent orchestration guide for the bigger picture.

FAQ

Can I run multiple Claude Code sessions in the same folder?

Yes, but agents in the same folder edit the same files, so one agent's changes can land in the middle of another's work. Give each session its own worktree with claude --worktree <name>, or plan the tasks so they never touch the same files, which is how Chief runs parallel agents in one project folder.

What is the difference between subagents and parallel agents?

A subagent runs inside one Claude Code conversation and reports its findings back to that conversation. A parallel agent is a separate Claude Code session with its own task and, usually, its own branch. Use subagents to split up one task and parallel sessions for independent tasks.

Do parallel Claude Code agents share my usage limit?

Yes. Every session signed in to the same account draws from the same plan, so three agents use your limit about three times as fast as one. AI coding agent costs compares plans and limits.

Can I run Claude Code and Codex in parallel on the same repository?

Yes. Start each tool in its own worktree with git worktree add, then run claude in one and codex in the other. Chief runs both from one plan and sends each milestone to the agent you choose. See the multi-provider orchestration guide.

Is there a Claude Code orchestrator?

Claude Code includes subagents, background agents and the claude agents view for running several sessions yourself. An orchestrator such as Chief adds the planning, dispatch, review and queue around those sessions, so the agents keep working towards your goals without you starting each one.

More articles

AI Agent Orchestration Guide

What AI agent orchestration is, how multi-agent orchestration works for Claude Code and Codex, and a comparison of orchestration approaches. Free guide.

What Is Agentic Engineering?

Agentic engineering means directing AI coding agents that write and test code while you set goals and review results. How it differs from agentic coding.

AI Code Review at Scale

What AI code review is, the main types of AI code review tools, and five workflows for reviewing AI-generated code from several coding agents at once.

Claude Code and Codex Pricing

Claude Code pricing from $20/mo (Pro) to $200/mo (Max 20x), Codex pricing from ChatGPT Free to Pro, usage limits and a comparison table, checked Oct 2026.

From Single Agent to Multi-Agent

Already using one AI coding agent? Here's how to scale to multiple instances running in parallel — the concurrency patterns, worktree isolation, and task decomposition strategies that make it work.

Vibe Coding at Scale

Vibe coding with one agent is fun. Vibe coding with five is chaos — unless you have orchestration. Here's how to scale the vibe without losing the quality.

Why AI Agents Need an Orchestration Layer

Running AI coding agents in terminal tabs works for two. Five signs you've outgrown it, tabs vs an orchestration layer, and what to look for in one.

Multi-Provider AI Orchestration

Claude Code, Codex, Cursor, Aider — each excels at different work. Here's how to combine providers into one coordinated workflow and why cross-provider review catches bugs single-provider setups miss.

Use Chief From Your AI Assistant

Chief's remote MCP server connects Claude, Claude Code and Codex to your projects. Ask what's waiting on you, catch up on what shipped and propose milestones.

Claude Code vs Codex: When to Use Each

Codex vs Claude Code: when each fits, a comparison table and FAQ. Claude Code vs Codex isn't either-or; Chief runs both on your projects.

Claude Code vs Cursor: When to Use Each

Cursor vs Claude Code: when each fits, a comparison table and FAQ. Claude Code vs Cursor isn't either-or; keep Cursor and let Chief run Claude Code.

Git Worktrees for AI Coding Agents

How to use git worktrees with Claude Code and Codex: one per agent, parallel runs, .env files, merging and cleanup. Every command, step by step.

How to Run Claude Code From Your Phone

Run Claude Code from your phone: Remote Control, cloud sessions in the Claude mobile app, or SSH and tmux, step by step. Plus approving agents in Discord.

The Best AI Coding Agents in 2026

The best AI coding agents of 2026: Claude Code, Codex, Cursor, Copilot and more agentic AI coding tools compared, and how to run several with Chief.

Subagents vs Parallel Agents

What is a subagent? How Claude Code subagents and Codex subagents work, how they differ from parallel agents, and when to use each one.

How to Install and Set Up Codex CLI

Install Codex CLI on macOS, Linux or Windows, sign in, run your first session and update it. Every command, then run Codex alongside Claude Code in Chief.

Ready to manage your agents?

Chief plans the work, runs your Claude Code and Codex agents in parallel and collects the decisions only you can make.