BLACK LABELAcademy
← Our Failures

One Agent Only: Why Parallel Writer Fan-Outs Spray Duplicate Work and Leave Mid-Edit Breakage

intermediate6 min read · updated 2026-06-20

Market & numbers — every figure sourced

two_thread_lock_cost_ms118,000 msMartin Thompson, The Single Writer Principle — benchmark: two threads contending on a lock for a 500M-op increment loop
one_thread_lock_cost_ms10,000 msMartin Thompson, The Single Writer Principle — same benchmark, single thread
pairwise_collision_paths3,741 interaction-pairsest: N(N-1)/2 distinct writer pairs for an N=87 agent fan-out, the count of independent collision surfaces a single-writer design removes

One Agent Only: Why Parallel Writer Fan-Outs Spray Duplicate Work and Leave Mid-Edit Breakage

The fastest way to feel productive and ship nothing is to launch a swarm of agents at the same codebase. It looks like leverage. It is actually contention. This entry is the post-mortem on why fan-outs of parallel writers fail, and the one rule that fixes it: for any artifact you can mutate, exactly one writer touches it at a time.

What we tried

The pitch is seductive. You have a big job — finish five apps, sweep a hundred files, knock out a backlog — so you spin up many agents in parallel and let them all work. In our own runs this took two recurring shapes:

Both assume that agents writing in parallel compose cleanly. They do not. The moment two writers can touch the same artifact, you have not bought parallelism — you have bought a race.

What broke

The root cause

Write contention, not "bad prompts," is the bottleneck. As the single-writer principle puts it, the biggest limit on scalability is having multiple writers contend for any item of data or resource any item of data or resource. An LLM agent makes this worse than ordinary threads: a single agent "transaction" spans minutes, its read set is broad and opaque (it touches far more than it declares), and the live filesystem it writes to admits neither fork nor buffer — every write lands the instant it executes. There is no transaction to roll back.

The fix

Run single-writer in the main loop. One agent owns the work; mutation is serialized. Concretely:

Apply it

Before you spin up a second writer, ask one question: can these two agents ever touch the same file, branch, store, or record? If yes, you do not have parallelism — you have a race, and the coordination tax will exceed the work. Split by ownership or serialize through a queue. When in doubt, one agent, one loop, one writer. It is slower in theory and dramatically faster in practice, because you spend cycles on the task instead of on cleaning up the collision.

Sources

© 2026 Black Label · Education, not financial or legal advice. Every number is sourced or labeled an estimate. Subscribe for $30/month · BlackLabel Tech network

Questions, answered

Why do parallel AI agents editing the same code cause problems?

The moment two writers can touch the same artifact, you have bought a race, not parallelism. In these runs, parallel agents produced duplicate bundles, wiped each other's uncommitted work and left files half-edited. Worse, stale data quietly overwrote fresh changes with no exception, so the build went green while the truth on disk regressed.

What is the single writer principle?

It says the biggest limit on scalability is having multiple writers contend for any item of data or resource, so each item should be owned by exactly one execution context for all mutations. In Thompson's benchmark, two threads contending on a lock took 118,000 ms for a job one thread finished in 10,000 ms.

Can you safely run multiple AI agents in parallel?

Parallelize reads, never writes. Research, search and analysis fan out safely because they have no side effects. If you must split write work, give each agent a disjoint slice of the filesystem so no two writers touch the same artifact, or serialize through a queue or a lock per artifact, then merge at a single integration point.

How many collision points does an 87-agent fan-out create?

With N parallel writers there are N(N-1)/2 distinct ways for two of them to collide. For an 87-agent fan-out that is 3741 independent collision surfaces. The lesson notes that a single observed collision reliably predicts systematic collisions at scale.