Running coding agents in parallel git worktrees: the setup, and the merge check git skips A playbook for running two to four coding agents in parallel git worktrees adds a merge check git does not perform: running the test suite on the merged result of every pair of agent branches before anything lands. The playbook, run with git 2.50.1 on 24 October 2026, cites a 2011 study of the Git, Perl5 and Voldemort histories in which 133 of 399 merge conflicts — a third — were merges git reported as clean that then broke the build or tests, and CooperBench (January 2026) tagged 29.7% of failed two-agent runs as "divergent architecture." The setup requires git 2.38 or later for `git merge-tree --write-tree` and an agent that opens its own worktree, such as Claude Code 2.1.49 or later, Codex CLI 0.156.0 or later, or Cursor's Agents Window or CLI. Running coding agents in parallel git worktrees: the setup, and the merge check git skips This playbook runs two to four coding agents side by side, one git worktree each, and adds the check git never runs: the test suite on the merged result of every pair of agent branches, before anything lands. Worktrees keep agents from overwriting each other's files, but they cannot see two plans that contradict each other, and in a 2011 study https://homes.cs.washington.edu/~mernst/pubs/vc-conflicts-fse2011.pdf of the Git, Perl5 and Voldemort histories, a third of all merge conflicts 133 of 399 were merges git had reported as clean that then broke the build or the tests. Every command below was run with git 2.50.1 on 24 October 2026. What you need - Git https://stackness.dev/tools/git 2.38 or later, which added git merge-tree --write-tree . - An agent that opens its own worktree: Claude Code https://stackness.dev/tools/claude-code 2.1.49 or later, Codex CLI https://stackness.dev/tools/codex-cli 0.156.0 or later, or Cursor https://stackness.dev/tools/cursor with its Agents Window or CLI. Plain git worktree add works with any agent. - A test suite that runs with one command. - Two to four tasks that change different things. Step 3 covers how to tell. What is an intent conflict between parallel coding agents? An intent conflict is two agents' plans contradicting each other while their diffs touch different lines, so git merges both without a word. One agent renames a function while another writes a new caller of the old name; one replaces a class while another extends it. Foremerge https://stackness.dev/tools/foremerge puts the term in its tagline, "Catch intent conflicts before code conflicts"; researchers call the same thing a semantic or higher-order conflict. Git cannot catch it because it merges text, not meaning. The git-merge documentation https://git-scm.com/docs/git-merge says changes that do not overlap "are incorporated in the final result verbatim", and the default ort strategy is a three-way merge of hunks. For agents, CooperBench https://arxiv.org/abs/2601.13295 January 2026 tagged 29.7% of failed two-agent runs as "divergent architecture": incompatible design decisions that lose work "even under a clean merge". 1. Create one worktree per agent A git worktree is a second checkout of the same repository on its own branch, sharing one history. Create one per agent from the main checkout: git worktree add ../shop-rename -b agent/rename git worktree add ../shop-invoices -b agent/invoices git worktree list Expected output, with my paths shortened: ~/src/shop b2cd2f4 main ~/src/shop-invoices b2cd2f4 agent/invoices ~/src/shop-rename b2cd2f4 agent/rename Start one agent in each directory. The agents can also create the worktree themselves: | Agent | Command | Where the worktree goes | Since | |---|---|---|---| | Claude Code | claude --worktree feature-auth | .claude/worktrees/feature-auth/ , branch worktree-feature-auth | v2.1.49, 19 February 2026 | | Codex CLI | codex exec --worktree "..." or /worktree | managed by Codex | default since 0.156.0, 22 September 2026 | | Cursor CLI | agent --worktree auth-fix "..." | ~/.cursor/worktrees/