Skip to content

Back to the catalog

Damir I on X: "Two developers, four agents, one repo: a setup for pairs" / X
x.comarticle

Damir I on X: "Two developers, four agents, one repo: a setup for pairs" / X

A guide to avoiding merge conflicts when two developers each run Claude Code and Codex on one repo. It cites Brun, Holmes, Ernst and Notkin: 16% of merges had textual conflicts, and 93% grew from unshared commits. It gives four steps (person/agent/task branch names, push at first commit, a partner-files script, a git merge-tree pre-push hook), then pitches the agentmash live-warning tool.

TL;DR Shows a four-step git setup and pre-push hook to catch conflicts between two developers' coding agents, then pitches agentmash.
Document

What it claims

Damir I's X post describes a four-step git setup for two developers who each run Claude Code and Codex on one repo: four agents, six possible pairings in a single file. Beyond the summary's figures, it cites Brun, Holmes, Ernst and Notkin (IEEE TSE 2013; ESEC/FSE 2011). In the three of their nine projects with runnable test suites, a third of the merges git called clean still broke the build or tests. Textual conflicts lasted 3.2 days on average. The author argues that agents committing for hours on unshared branches lengthen the window in which 93% of conflicts form.

How to use it

Branches follow person/agent/task, and each clone records the partner's name, which both scripts read:

git switch -c maya/claude/orders-api
git config pair.partner tim

After the agent's first commit, push and open a draft PR:

git push -u origin HEAD
gh pr create --draft --fill

An AGENTS.md "Pairing" section tells both agents the naming rule and the push rule. It also tells them to run the partner-files script before a task, and to stop and name the file if the task needs one on the partner's list.

scripts/partner-files.sh lists the files each of the partner's remote branches changes against origin/main, with a count of branches per file:

#!/bin/sh
# scripts/partner-files.sh: files your partner's open branches change compared to main
partner=$(git config --get pair.partner)
[ -z "$partner" ] && { echo "Run: git config pair.partner <name>"; exit 1; }
git fetch -q --prune origin
for b in $(git for-each-ref --format='%(refname:short)' "refs/remotes/origin/$partner"); do
  git diff --name-only origin/main..."$b"
done | sort | uniq -c | sort -rn
chmod +x scripts/partner-files.sh

.git/hooks/pre-push needs git 2.38 or newer. It runs git merge-tree in memory against each partner branch, prints the conflicting files, and always exits 0, so the push is warned about but never blocked:

#!/bin/sh
# .git/hooks/pre-push: warns when your branch conflicts with your partner's open branches
partner=$(git config --get pair.partner)
[ -z "$partner" ] && exit 0
git fetch -q origin
for b in $(git for-each-ref --format='%(refname:short)' "refs/remotes/origin/$partner"); do
  if ! out=$(git merge-tree --write-tree --name-only --no-messages HEAD "$b"); then
    echo "Your branch conflicts with $b in:"
    echo "$out" | tail -n +2
  fi
done
exit 0
chmod +x .git/hooks/pre-push

Limits

The author names three gaps in the manual setup. Uncommitted work is invisible. Checks run only at task start and at push. The agents never see the warnings, so they cannot adjust their edits. The hook catches textual conflicts only; it does not address the clean merges that the cited study found still broke tests.

The second half promotes agentmash, the author's product. It is in closed beta and free for two developers on one private repo. It issues a "PARALLEL EDIT" warning to an agent about to edit a file with a partner's uncommitted changes. Setup is npx agentmash login per developer, a repo connection at agentmash.dev/install, and approving its hooks via /hooks in Codex. It sends file paths, branch names, change shape (line counts and names touched) and the first 500 characters of each prompt off the machine. It also sends code if the room enables diffs or a session is shared live. npx agentmash logout removes it. The post gives no evaluation of agentmash or of the manual scripts.

Organisations named here

  • GitHub
  • agentmash
  • Brun
  • Claude Code
  • Ernst
  • Holmes
  • Notkin

Technologies named here

  • Claude Code
  • Codex
  • AGENTS.md
  • Git
  • GitHub
  • npm
  • agentmash
  • gh
  • git merge-tree
  • npx agentmash
  • pre-push hook
  • scripts/partner-files.sh

Techniques named here

  • Early push with draft pull request
  • In-memory merge dry-run in a pre-push hook
  • Live parallel-edit warning
  • Person/agent/task branch naming
  • Pre-task partner file check