Lab / Essay
Agent workflow, measured
One branch, many agents
Do per-agent git branches waste tokens? We measured two weeks of our own AI coding sessions. Branchy work paid about three times the branch tax and hit more conflicts, but the tax was a few percent, not a disaster.
Two projects, same two weeks, same tools
One shared branch against a branch per agent.
Git branches were invented for people. A person goes away for a week, works on a copy, and comes back to merge. Branches make that safe, and they are the right tool for it.
When we started running several AI coding sessions in parallel on the same codebase, the obvious move was to give each one its own branch and its own working copy (a git worktree). Every guide suggests it. We had a hunch it was the wrong tool for agents: a crew of sessions that finish a task in minutes does not need a week-long copy, and every copy has to be synced, merged and cleaned up again. So we measured it instead of arguing about it.
What we measured
A small script read two weeks of our own session logs (every API request carries its token counts, every tool call carries the command it ran) and kept only numbers. It tagged every request that did branch work: creating or removing worktrees, switching or listing branches, merging, rebasing, cherry-picking, stashing, resolving conflicts. Then it compared that with what reached the main line in git: commits, merges, task cards shipped.
Over those 14 days the sessions used about 12.3 billion tokens across 27 projects on one workstation. Most of that is cached context being re-read, which is cheap per token but adds up.
Two projects, same two weeks
We picked a fair pair. Project A ran its parallel agents in one shared branch and one checkout: a boss session split the work into cards and gave each agent its own files to edit. Project B, another product of similar size built with the same tooling, gave agents branches and worktrees and merged their work back.
- Branch work as a share of all tokens: 1.3% in A, 4.0% in B. About three times as much.
- Branch commands: 143 in A, 663 in B. Worktrees created: 29 and 83. Merge conflicts hit: 2 and 10.
- Tokens per commit that reached the main line: 2.84 million in A, 2.78 million in B. Effectively the same.
- Cost per task card shipped: B was 16% dearer. Cost per commit: B was 14% cheaper (it makes smaller commits).
- Time from writing a change to it landing on the main line: 0.4 hours on average in A, 0.6 hours in B.
Across all 16 projects that had enough history, the ones with five or more merges paid 5.2% of their tokens on branch work; the near-linear ones paid 3.1%.
What the numbers say, honestly
The hunch was half right. Branch-per-agent work costs about three times as much in branch bookkeeping and hits several times as many merge conflicts. Across everything, branch work came to 550 million tokens in two weeks, so "millions of tokens" is true.
But it is a tax of a few percent, not the thing that eats a budget. Cost per shipped commit was no worse in the branchy project, and merged work landed within the hour, so we cannot say branches stalled shipping. Keeping one shared branch in sync is not free either: pulling and pushing cost about as much as all the branch work put together. In the same two weeks, oversized context windows and expensive models on routine work cost far more than branches did.
We still made "one shared branch" the default, because it is cheaper, it conflicts less, and there is less state for an agent to get wrong. We just stopped claiming it is a miracle.
How a boss hands out file claims
- Cut the work by files, not topics. Each card names its area, the paths it owns, the goal, when it is done, and what to read first.
- Write the claims before anyone starts. One line per agent, such as
w1 crates/billing/**. Claims never overlap. - Agents edit only what they claimed and commit only those paths. Nobody runs commands that sweep up other agents' work, such as stash, reset or "add everything".
- Shared files go through the boss, one card at a time. A failing test may be a neighbour's half-written file, so agents check the claims before "fixing" it.
- Done means landed. No branch to merge, no worktree to clean up, nothing to reconcile.
This is how JIVA runs its crews.
Caveats
One workstation, one pair, two weeks. Project A was not perfectly linear: it used throwaway worktrees for experiments and one short-lived branch. Our tagging is a lower bound (re-running builds and tests inside fresh worktrees is not counted), and counting whole conversations that touched a branch would be a loose upper bound. Card counts depend on how each project writes its commit messages. Token costs are compared at list prices; we run on a flat plan.
More from the lab
Other ideas on the bench.
Essay · Desktop and mobile apps
The argument for Tauri 2
Read
Concept · Agent protocol
JIVA: one terminal, many souls
Read
Concept · Local-first AI
Iblis: the studio that runs on your own machine
Read
Concept · Developer tooling
Bael: a thermal guardian for unattended builds
Read
Concept · Agent tooling
Leviathan: borrow before you build
Read
Concept · Application shell
Lilith: a dark launchpad that wears any brand
Read
Concept · Multi-model reasoning
Delphieiux: ask once, a council answers
Read
Concept · Music visuals
Vizeiux: a visualizer that reads the song first
Read
Concept · Audio analysis
Audeiux: a second opinion on a finished mix
Read
Concept · Music video
Videiux: a video maker that hears the song
Read
Concept · Events
Bootheiux: one shell for interactive booths
Read
Concept · Presentation
Software you can hold: honest 3D boxes
Read