git-ai Replaces the Merge Queue With a Server-Side Compare-and-Swap
Built as a fork of GitLab's Gitaly, this open-source system lets dozens of coding agents land on one branch without the retry storm.
- Git's landing model assumes a human pushes every few minutes, so fifty agents on one branch turn push into a retry lottery.
- git-ai's real novelty is that landing becomes a server-side compare-and-swap, and concurrent lands batch into a single reference update.
- Underneath the new coordination layer sits a fork of GitLab's Gitaly, which supplies a decade of battle-tested Git RPC plumbing.
- The authors defend against a Unicode bidi override in an actor name, a threat model most version control tools never consider.
Fifty Agents, One Branch
Git was designed around a human. You fetch, you rebase, you push, and when someone else got there first you try again. The whole ritual assumes a change lands every few minutes and that the person pushing is willing to be polite about losing a race.
Fifty coding agents are not polite. Point them at one branch and every one of them fetches the same tip, rebases onto it, and pushes. One wins. Forty-nine get rejected and start over. The project README puts numbers on that: 250 changes from 50 agents, where the classic Git workflow landed roughly 100 of them at about 27 attempts per landed change.
The same benchmark reports that git-ai landed 200 of those changes at 1.0 attempts each, with throughput between 1,862 and 2,544 lands per minute. Those numbers come from the project's own harness, not an independent one. Treat them as a claim with a methodology rather than a fact with a citation. The mechanism behind the claim, though, is right there in the code.
The project is the work of one developer, Federico Elia, who publishes as feder-cr. It appeared shortly after Anthropic published an engineering post describing Scion, an internal version control system built for hundreds of agents reading, writing, and landing code at once. git-ai is an independent implementation of the publicly described ideas. It is not Scion, and it is not affiliated with Anthropic.
Landing Is a Compare-and-Swap
In git-ai, landing a change is a compare-and-swap. The server takes a change, rebases it onto the current tip of the branch, and lands it only if the reference still points where the rebase assumed it did. If the reference moved, the land retries against the new tip. The client never wins a race, because the client is not in the race. The server owns the serialization point and the client just submits work.
Batching is the second half of the trick. Lands that arrive inside the same window get folded into a single reference update. The CLI even reports it, printing notes like (batch 3/17, 1 attempt) so a human watching the output can see how many changesets rode along with one ref move.
The important word is batch. Five changesets that arrive together produce one reference update, not five. That is what collapses attempts per landed change from 27 to 1.0. It is not that the server retries faster or that the network got quicker. It is that the server stopped asking clients to resolve a contention problem the server was better positioned to solve.
The README describes the write path as "changeset plus compare-and-swap per reference," and the code agrees. UserLand rebases a change onto the current tip and lands it with a CAS against the ref. The command surface exposes it through graft commit and graft land, and the batch metadata the CLI prints is read straight off the server's response.
Underneath, It Is Gitaly
Here is the fact that reframes everything above. The Makefile header reads "Makefile for Gitaly." The AGENTS.md file opens with "Entrypoint for agents working on Gitaly." The VERSION file reads 19.5.0-rc3, which follows GitLab's versioning scheme rather than anything git-ai invented. The bundled Git comes from gitlab.com/gitlab-org/git.git.
git-ai is a fork of GitLab's Gitaly, the Git RPC server GitLab has run in production for years. Everything below the new coordination layer is someone else's mature plumbing. The genuinely new code lives in the graft layer: cmd/graft, internal/graft/..., cmd/graft-cache, and cmd/graft-verify.
That is not a knock. It is the most interesting engineering fact about the project. Gitaly already knows how to serve Git over gRPC, manage repositories, and handle the unglamorous parts of running Git at scale. Building a coordination layer on top of it means the hard, boring, load-bearing work is inherited rather than reimplemented. It also means git-ai inherits Gitaly's assumptions, including RPC shapes designed for GitLab's own callers rather than for agent swarms.
One consequence is visible in the repository metadata: the license field says "Other" while the README says MIT. The repo excludes upstream Gitaly's non-MIT ee/ directory and ships upstream notices. That is a fact to check at the repository rather than a verdict, but it is the kind of detail that matters to anyone evaluating reuse.
gitai is an independent implementation of the publicly described design. It is not affiliated with or endorsed by Anthropic.
The Changeset Log, the Cache, and the Green Ref
Around the compare-and-swap sit three pieces of supporting machinery, and each one is a small argument about where work belongs.
The first is the ordered changeset log. Every accepted reference update is recorded in order, in SQLite or PostgreSQL. This is the durable record of what landed and in what sequence, which is what lets a client ask the server what happened instead of walking history locally.
The second is graft-cache, an optional tier that serves immutable object reads from memory or disk and proxies everything else upstream. Git objects are content-addressed, which means a cached object can never go stale. Immutability makes cache correctness nearly free, and it is why the project can promise strict tiers that verify every object they serve.
The third is graft-verify, a daemon that runs a configured test command against the tip after lands and advances a "green" ref on success. Its most interesting decision is that it treats exit codes as an API. Zero means success, one means the tool itself errored, and two is reserved for the case where the tests ran and failed.
const (
exitOK = 0
exitError = 1
exitFailed = 2
)
That distinction lets CI branch on "the code is broken" versus "the verifier is broken," which are very different problems with very different fixes. The daemon also reports a first-class skipped state when nothing is pending, rather than treating an empty queue as an error or an empty response. Small choices, but they are the ones that make a tool usable inside an automated pipeline instead of just next to one.
The Bidi Override in an Actor Name
The detail that proves the authors thought hard about their own threat model is a function called displayText. It takes any server-supplied string and escapes control characters, Unicode format characters, line and paragraph separators, and invalid UTF-8 bytes, rendering them as visible Go-style escapes like \x1b, \u202e, or \xff.
The doc comment names the attack. Actor names and resolved file paths come from other clients and from file names, and a file name may contain any byte except NUL and slash. An escape sequence embedded in an actor name could move the cursor and overwrite earlier lines, forging which actor landed which commit inside a batch.
That is a real attack surface for a tool whose output is read by humans supervising agent swarms. When fifty autonomous processes are landing commits and a person is scanning a terminal to see who did what, the terminal transcript is the audit log. A forged line in that transcript is a forged audit record. Most version control tools never consider this, because most version control tools assume the person reading the output is the person who produced it.
What It Is and What It Is Not
git-ai is a coordination layer on top of Git. It is not a GitLab replacement, not a hosting product, not Scion, and not a new storage engine. The project's own limitations document says it has no web UI, no issue tracking, no merge-request workflow, and no CI, and it warns that its local access policy is not by itself a security boundary.
Placed historically, the server-side changeset idea has a long lineage. Meta's Sapling and its Mononoke server, and Google's internal Piper, all put source control state and history on the server long before anyone was talking about coding agents. git-ai's contribution is not the server-centric model. It is the specific adaptation of that model to a workload where the clients are cheap, numerous, and impatient.
| Dimension | Classic Git workflow | git-ai |
|---|---|---|
| Landing | Client fetches, rebases, pushes, retries | Server-side compare-and-swap |
| Concurrent lands on one branch | Serialized by retry, most attempts fail | Batched into one reference update |
| Attempts per landed change | About 27 (project-reported) | 1.0 (project-reported) |
| History queries | Client walks history locally | Served server-side and memoized |
| Object access | Full clone or fetch | Sparse object and path fetch |
| Storage | Local repositories | SQLite or Postgres plus object storage (file, S3, GCS, Azure) |
| Verification | CI after push | graft-verify daemon advances a green ref, exit code 2 for test failure |
The honest summary is that this is a clever coordination layer riding a decade of someone else's plumbing, and that combination is exactly why it is worth a look. The benchmark numbers are the project's own and deserve independent reproduction. The mechanism is legible in the code today. And the attention to adversarial input in an agent-supervision tool is the kind of thing that suggests the author was thinking about what happens at scale, not just what happens in a demo.





