How to run several AI coding agents at once

Four rules for running Claude Code, Codex and other agents in parallel: separate checkouts, visible status, sessions that survive, and one place per project.

One coding agent is a pair programmer. Three or four running at once are a team, and a team needs some organisation. Run several in a few terminal tabs and the same problems show up every time: two agents edit the same file, one sits waiting for approval in a tab you forgot about, and closing the wrong window takes an hour of context with it.

These four rules fix most of it. They hold whichever agents you use (Claude Code, Codex, Gemini CLI, OpenCode or a mix) and whether or not you use Hive.

1. Give every agent its own checkout

Agents don't coordinate. Two agents in the same directory read and write the same files, run the same tests against each other's half-finished changes, and can leave your working tree in a state neither of them meant. The fix is old and boring: one checkout per agent.

Git worktrees make that cheap. A worktree is a second working directory backed by the same repository, on its own branch:

git worktree add -b agent/login-fix ../shop-login-fix
cd ../shop-login-fix && claude

Each agent then works on its own branch, and you merge what you like. Our guide to worktrees for agents covers the pitfalls. In Hive, Ctrl+Space C opens a terminal in a new worktree on a fresh branch, and the sidebar warns when two agents share a directory.

2. Make status visible at a glance

The real cost of parallel agents is attention. An agent blocked on a permission prompt does nothing until you notice. With five tabs, you notice late.

You want three states visible without opening anything:

  • Working: leave it alone.
  • Needs input: a question or a permission prompt. Go now.
  • Done: finished while you were elsewhere. Review it.

Hive reads each agent's screen with per-agent rules and shows these states in the sidebar for every agent in every project, even agents you started by typing claude in a plain terminal. Agents it has no rules for show as unknown rather than a guess. Your own scripts can report their state with hive report-agent, and the optional desktop notifications call you back when something needs you.

3. Keep sessions alive when the terminal goes away

A long agent run shouldn't depend on a terminal window staying open. Closing a window, an SSH connection dropping or a terminal crash shouldn't end the session.

That is what a multiplexer server is for. tmux does it, and so does Hive: its daemon, hived, owns the agents' terminals. Detach with Ctrl+Space d or just close the window, and the agents keep working. Run hive again to pick up exactly where you were. (A reboot or a sleeping laptop still stops them; for agents that run overnight, use an always-on machine and connect over SSH.)

4. One place per project

When agents work across several repositories, a flat list of tabs stops making sense. Group work by project: each repository gets its own set of tabs, and switching projects switches the whole set.

Hive calls these spaces and creates them for you. Open a terminal, cd into a repository, and within a couple of seconds the terminal moves to that repository's space. Alt+↑/Alt+↓ moves between spaces, Alt+←/Alt+→ between a space's tabs, and the AGENTS list shows every agent of every space with its status, so nothing hides in a project you aren't looking at.

A workflow that puts it together

  1. Run hive in your repository. You get a terminal.
  2. Start the main agent: type claude.
  3. For a second, independent task press Ctrl+Space C and start codex in the new worktree.
  4. Split a pane for the dev server (Ctrl+Space v), or define a layout that opens agent, server and terminal in one go.
  5. Work on something else. When the sidebar shows needs input, answer it; when it shows done, review the diff (Ctrl+Space G opens lazygit beside the agent if you enable review).
  6. Merge the branches you want. Remove worktrees you don't need.

None of this needs a cloud service or an account: it all runs locally, and the agents run unmodified with their own permission prompts intact.