Why two agents in one folder go wrong
Claude Code, Codex and Antigravity's agy all edit files in the folder you start them in. Start two in the same checkout and they share one working tree. A half-finished edit from one can break the other's test run, both can rewrite the same file, and if either switches branches, the other's files change underneath it. Nothing errors out, but you can't tell which results to trust.
Git worktrees, by hand
A worktree is an extra working folder attached to the same repository. It has its own branch and its own checked-out files, and it shares history with your main checkout, so there is nothing to clone.
# one worktree and branch per task
git worktree add ../billing-svc-retry -b retry-backoff
git worktree add ../billing-svc-parser -b parser-split
# one agent in each, each in its own terminal
cd ../billing-svc-retry && claude # terminal 1
cd ../billing-svc-parser && codex # terminal 2
Agents usually leave their edits uncommitted. When a task is done, check what it changed, stage only the task's files, and commit them in its worktree. Then read the diff, merge the branch and remove the worktree:
git -C ../billing-svc-retry status
git -C ../billing-svc-retry add -p # new files: add them by name
git -C ../billing-svc-retry commit -m "Cap retry backoff"
git diff main...retry-backoff
git merge retry-backoff
git worktree remove ../billing-svc-retry
That's all there is to it. The overhead is in everything around it: a terminal per agent, remembering which one asked you a question twenty minutes ago, and cleaning up folders and branches afterwards.
How Offrun runs agents in parallel
- A worktree per chat. Every agent chat in a project gets its own worktree under
.worktreesin your repository, on its own branch. Offrun keeps that folder out of your diffs through the repository's local.git/info/exclude, so it never edits your.gitignore. - Up to four side by side. Chats sit next to each other in one window, each with its own message box.
- Who needs you. The Home screen shows how many agents are running, waiting on you, or have an answer you haven't read, and lists each one's project, state, turn time and how full its context is.
- Read the work in place. Changed files and diffs with line numbers open beside the conversation that produced them.
- Mix agents. Claude Code on one task, Codex on another, Antigravity on a third, each on the login you choose.
- You merge. Branches stay yours to review and merge with the git tools you already use. Nothing merges on its own.
If you want a second opinion before you merge, pick a reviewer for the chat. A second agent reads the uncommitted diff and posts what it found. How review works
How many agents at once?
In practice, the limit is usually your attention and your usage allowance, though your Mac can be a factor too. Each agent stops to ask you things and needs its work read, and each one draws on its account's allowance. Two or three independent tasks is a good place to start. Tasks that touch the same files are better run one after the other: their branches would conflict when you merge them anyway.
If usage is what stops you, more than one login per agent helps. Running multiple Claude Code accounts
Questions
Does a worktree copy my whole repository?
No. Worktrees share the repository's history and objects. Each one only holds its own checked-out files.
Can two agents change the same file?
Yes, each on its own copy in its own worktree. You sort out any overlap when you merge, the same as with two people's branches.
Does Offrun merge for me?
No. Each agent's work stays on its own branch until you merge it.
Which agents can run in parallel?
Claude Code, Codex and Antigravity (agy), signed in with your own accounts. Pi and OpenCode are coming soon.