How to run several coding agents at once

Last updated By the Zoltbot team

Short answer

Give each agent its own git worktree and branch so their edits land in separate folders. Then plan for what a worktree leaves shared: dev server ports, the local database, chat history and your review queue. On one laptop that works for a few agents at a time, and past that the bookkeeping is the hard part.

Start with one worktree per agent

Two agents in the same folder will edit the same files, and the second one to save wins. A git worktree fixes that. It is a second checkout of the same repository on its own branch, and every worktree shares one .git folder, so commits made in one are visible from the others.

git worktree add ../shop-auth -b agent/auth
git worktree add ../shop-billing -b agent/billing

cd ../shop-auth && claude      # Claude Code in the first worktree
cd ../shop-billing && codex    # Codex in the second

Git refuses to check out a branch that another worktree already has checked out, unless you force it. Keep that guard: one branch per agent, named after the task.

The agents now do this for you too. claude --worktree feature-auth starts a Claude Code session in a fresh worktree. In the ChatGPT desktop app you can pick Worktree under the composer to start a Codex chat in its own checkout. Cursor's Agents Window runs agents in worktrees, and its /best-of-n command runs one task across several models, each in a separate worktree.

Where worktrees stop helping

A worktree separates files. Everything else on your laptop is still shared, and that is where our parallel runs used to go wrong.

What a git worktree separates, and what stays shared.Three worktrees, each with its own files and its own branch, all connect to one shared .git folder. All three also share the same localhost port 3000, the same local Postgres database and the same person doing the review. Files and branches are separate per worktree; ports, the database, chat history and review are shared.SEPARATE IN EACH WORKTREEshop-authagent/authown files and indexshop-billingagent/billingown files and indexshop-searchagent/searchown files and indexSTILL SHARED BY ALL THREE.git historyshared on purposePort 3000every dev serverDev databaseevery migrationYouevery reviewOrange: where parallel agents get in each other's way.
What a git worktree separates, and what stays shared.
Text version of this diagram

Three worktrees, each with its own files and its own branch, all connect to one shared .git folder. All three also share the same localhost port 3000, the same local Postgres database and the same person doing the review. Files and branches are separate per worktree; ports, the database, chat history and review are shared.

Shared ports

Every worktree runs the same npm run dev, and they all want port 3000. The second server fails to start, or picks a random port that your OAuth callback and browser tabs don't know about. Read the port from an environment variable and set a different one in each worktree's .env.local. Claude Code and Codex both copy gitignored files such as .env into new worktrees when you list them in a .worktreeinclude file at the repository root, so keep a template there and change the number per worktree.

One database

The Postgres or SQLite database your app talks to does not move with the worktree. Two agents running migrations against one dev database will break each other's tests, and the failures look like flaky code. Give each worktree its own database name, such as shop_dev_auth and shop_dev_billing, or a SQLite file inside the worktree, and run migrations as part of setup. Cursor's worktree docs show exactly this: a .cursor/worktrees.json that copies .env and runs npm run db:migrate in every new worktree.

Two agents in one folder anyway

Our worst mix-ups came from losing track of which terminal was in which folder. An agent gets started in the main checkout while another is already working there, both edit the same file, and one of them reverts the other's change while tidying up. A worktree only protects you if every agent is actually in its own one, and nothing on screen checks that for you.

Chat history spread across tools and folders

Each tool saves conversations in its own place. Claude Code stores sessions locally and ties each one to the folder it ran in, so a session from ../shop-auth is listed under that path. Codex and Cursor keep their own histories in their own apps and CLIs. Delete a worktree, or forget which of six folders held the useful conversation, and finding the reasoning behind a change means searching three tools.

Reviewing many results

Five agents finish within the same hour. Each one left a branch, some terminal output and maybe a summary. Now you have to work out which finished, which stopped an hour ago to ask a question, and which diff is safe to merge first. This is where parallel agents stop paying off for us: the agents are fast, and the person reviewing becomes the queue.

A setup that works on one laptop

  1. One branch and one worktree per task, named after the task. git worktree list becomes your index.
  2. A .worktreeinclude file (Claude Code, Codex) or a .cursor/worktrees.json setup file (Cursor) that copies .env into each new worktree.
  3. A port and a database name per worktree, set in that worktree's .env.local.
  4. Only as many agents as you can review the same day. For us that is three or four.
  5. Merge one branch at a time. Rebase the others onto it and run the tests again before the next merge.
  6. Remove finished worktrees with git worktree remove so the list stays short.

Built-in parallel features in each tool

If you only use one agent, its own parallel mode may be all you need.

Built-in ways to run agents in parallel, checked 6 November 2026
ToolRunning several at onceKeeping edits apart
Claude CodeAgent view (claude agents, research preview) lists background sessions on one screen. Subagents, and agent teams (experimental, off by default).claude --worktree <name>. Sessions started from agent view move into their own worktree before they edit files.
CodexWorktree chats in the ChatGPT desktop app, cloud tasks, and scheduled tasks on background worktrees.Git worktrees, in detached HEAD by default. Handoff moves a chat and its code between Local and Worktree.
CursorThe Agents Window runs parallel agents. Cloud agents run in their own VMs.Worktrees with setup scripts. /best-of-n runs one task across several models in separate worktrees.

Each of these works well inside its own tool. Each is also built around its own agent: Claude Code's docs say that in every one of its parallel modes, the workers are Claude sessions. If you use two or three tools, you get two or three dashboards.

Where Zoltbot fits

We built Zoltbot because we ran Claude Code and Codex side by side every day, and the bookkeeping above kept eating our afternoons. It is a macOS app that sits above your agents and keeps track of the work.

Zoltbot keeps the project tree, the queue and the review screen. Each agent keeps its own session.A project holds sub-projects, and each sub-project holds chats and tasks. Zoltbot sends each task to Claude Code, Codex, Cursor or Antigravity through that tool's own CLI. Tasks that share a code folder wait in a visible queue. Each tool's own session store keeps the conversation, and Zoltbot keeps an index plus the review screen.Project: ShopSub-project: CheckoutFix coupon bug · runningAdd tests · queued, folder busySub-project: DocsUpdate setup guide · needs reviewZoltbotroutes each request · one task per folder · queue · review · always-on daemonClaude Codeown CLI and loginown session storeCodexown CLI and loginown session storeCursorown CLI and loginown session storeAntigravityown CLI and loginown session store
Zoltbot keeps the project tree, the queue and the review screen. Each agent keeps its own session.
Text version of this diagram

A project holds sub-projects, and each sub-project holds chats and tasks. Zoltbot sends each task to Claude Code, Codex, Cursor or Antigravity through that tool's own CLI. Tasks that share a code folder wait in a visible queue. Each tool's own session store keeps the conversation, and Zoltbot keeps an index plus the review screen.

  • Zoltbot can give each task its own git worktree, so tasks in one repository run at the same time on separate checkouts. Tasks that share a code folder run one at a time, and the rest wait with a visible reason, so two agents never edit the same checkout.
  • Conversations stay in each tool's own session store. Zoltbot indexes them by project and task, so you open the task and its conversation is there, including after a restart.
  • A finished task shows its result for review. Accept it, or request changes and the same task runs another revision in its own conversation.
  • Claude Code, Codex, Cursor and Antigravity run through their own CLIs on the plans you already pay for. Zoltbot never charges for tokens.
  • An always-on background process runs the agents, so closing or restarting the app doesn't stop them.

Zoltbot doesn't separate ports or databases. Agents still share your machine's ports and your dev database, so keep the per-worktree .env.local habit from the setup above.

Questions

How many coding agents can I run at once?

As many as your plan's usage limits and your laptop allow. Review is usually the real limit, and three or four parallel tasks is what one of us can review well in a day. Running several sessions at once also uses up limits faster: Claude Code's docs note that parallel sessions multiply token usage.

Do I need git worktrees to run agents in parallel?

Only when the agents work in the same repository. Agents in different repositories, or in folders that share no files, can run side by side without them.

Can Claude Code and Codex work on the same repository at the same time?

Yes, if each has its own worktree and branch. Without worktrees they edit the same files. See our short answer for the steps.

Does Zoltbot create worktrees for me?

Yes. Give a task its own worktree and Zoltbot runs it on a separate checkout beside your other tasks. Tasks without one share the code folder and run one at a time.

Sources

Checked on . Claims about other tools come from their own docs and pricing pages: