spawndocs

Coordination

How spawn keeps parallel agents aware of each other so they don't collide or go stale.

Every other parallel-agent tool hands you infrastructure — parallel worktrees and sessions — but no awareness between the agents running inside it. The moment two tasks overlap, the agents collide or go stale, because none of them can see what the others are doing. spawn closes that gap with a CoordinationService that every session subscribes to. This is spawn's core differentiator.

The problem

Spinning up isolated worktrees is easy. The hard part is that the isolation is blind: each agent edits in its own world with no signal about sibling work. Two agents touch the same file and produce conflicting changes; an agent finishes a turn against a codebase that has since moved underneath it. Infrastructure alone doesn't prevent collisions or staleness — only awareness does.

What the coordinator does

Live file registry

Tracks who owns or is editing which files right now. Sessions call something like claimFiles(threadId, files[]) on dispatch or first edit.

Change feed

On commit, the change is summarized and pushed as one-line notes into sibling agents' context — e.g. "FYI: auth middleware now requires a session token."

Conflict prevention at dispatch

The router and coordinator know the dependency graph, so colliding tasks can be sequenced or blocked instead of racing.

State refresh / merge prep

Before an agent gets its next turn, a diff summary of what changed since its last turn is injected so it works against current state.

How it fits in

The coordinator is a sidecar that all sessions subscribe to. It's consulted in the decider and at provider start, and its coordination notes are prepended to a session's prompt as developer instructions. Git and commit events feed the coordinator, which is what powers the change feed and state refresh. Together with routing, it lets spawn act on the dependency graph rather than discovering conflicts after the fact.

Status

v1 is an in-memory registry. The following are planned:

  • Persistence across runs.
  • A full dependency graph.
  • Memory carry-over on compact.

Coordination pairs with routing: the router chooses the model, and the coordinator makes sure parallel agents stay aware of each other.

On this page