Isolation

Git Worktrees

The cheapest correct answer to “what happens when two agents edit the same repository at once?”

One checkout per worker

A worktree is a second working directory backed by the same object database. Each worker claims one, works in it, and lands from it — so two agents can hold two different branches of one repository simultaneously without either seeing the other's uncommitted files.

Sharing a single checkout between concurrent agents produces a specific, ugly failure: one agent stages another's half-written files, and the resulting commit contains work nobody reviewed.

Refused, not discouraged

Constructing the orchestrator with concurrency above one and no worktree manager raises immediately: “concurrent workers interleave edits in one checkout.”

The alternative — documenting the hazard and trusting operators to remember — is the pattern that produces an incident six months later. Making the wrong configuration unconstructible costs one guard clause.

Reaping

Worktrees outlive the workers that made them when a process dies abruptly. cooddee reap removes any worktree with no live claim behind it, so an interrupted run does not leave the disk filling with orphans.

The check is the claim, not the timestamp: a worktree whose card is still leased is never removed, however old it looks.