# An orchestrator over builders

Source: https://flow-next.dev/autonomy/orchestrating-builders/

One session that judges and several builder sessions that each run flow --auto on one spec in their own worktree - the document that holds the run's memory, the pane manager that lets one agent read and prompt the others, what the orchestrator checks, how it answers a review round cap, the rules that keep parallel builders from colliding, and the prompts to copy.

[`flow --auto`](https://flow-next.dev/autonomy/pilot/) carries one spec to its pull request, and [goal mode](https://flow-next.dev/autonomy/goal-mode/) works one outcome down into child specs, one child at a time. This page is for the next size up: an outcome of ten or twenty specs that you want built several at a time, with judgment applied while it runs and not only at the end.

The pattern has two kinds of session. **Builders** each take one spec and run `/flow-next:flow --auto` on it in their own worktree. One **orchestrator** writes the specs, hands them out, reads what the builders are doing, answers what they cannot answer themselves, and merges or holds. You talk to the orchestrator. It talks to the builders through a terminal workspace manager that lets one agent read and prompt another’s pane: [Herdr](https://herdr.dev/) is what the examples use, and tmux or any tool with the same three verbs works.

Nothing here is a flow-next feature you switch on. Flow-next supplies the parts that make it hold: a spec is a contract a builder can be handed, every stage ends in a verdict line the orchestrator can read, review gates fire the same way with nobody there, and all state lives in git. The rest is a document and a few prompts, and this page gives you both.

## When it fits

| You have                                                                                  | Use                                                                                                                                                                              |
| ----------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| One spec                                                                                  | [`flow --auto fn-12`](https://flow-next.dev/autonomy/pilot/), no orchestrator                                                                                                    |
| An outcome whose specs only show up as you measure, built one at a time                   | [Goal mode](https://flow-next.dev/autonomy/goal-mode/)                                                                                                                           |
| A blessed backlog to drain overnight, each item independent                               | [The assembly line](https://flow-next.dev/autonomy/going-autonomous/#running-the-full-pipeline) and [unattended operation](https://flow-next.dev/autonomy/unattended-operation/) |
| An outcome of many specs with an order, shared files and decisions that come up mid-build | An orchestrator over builders                                                                                                                                                    |

It costs one more session that does no building, and it pays for itself when the specs interact: when a second builder needs what the first one just changed, when a reviewer keeps finding the same kind of fault, when a builder’s proof passes for the wrong reason. A loop sees a verdict line. An orchestrator reads the work.

## The parts

**One document holds the run.** A PRD or a goal spec in the repo, on the default branch, that says what the outcome is, which child specs exist, what each needs before it can start, and which run in parallel. Add two sections most PRDs lack: a **runbook** (how to hand out a spec, what to check, how to restart a builder, what never to touch) and a **build log** (one dated row per event: started, stopped and why, merged with its commit, decided and why). The orchestrator’s context will be summarised or lost during a long run. Write the document so that a fresh session given only its path can carry on, and have the orchestrator test that by reading the log before every check.

**Specs are written one wave ahead.** Write the specs for the work that can start now, mark them [no-plan](https://flow-next.dev/guides/writing-specs/) and ready, and write the next wave while this one builds. Specs written all at once are wrong by the third merge, because each child changes what the next one stands on.

**One builder, one pane, one worktree, one spec.** A builder is an ordinary agent session started in its own git worktree. It gets a brief that names one spec and runs `/flow-next:flow --auto <spec> --until=merge`, or without `--until=merge` when the orchestrator merges. It keeps its own review loop, its own QA and its own pull request. It does not know the other builders exist, and the spec’s Boundaries section is how it learns what they own.

**The orchestrator holds judgment, not code.** It edits specs and the document, never the product. It needs to list the builder panes, read a pane’s screen, and send a pane a prompt. With Herdr:

```bash
herdr agent list                         # who exists and whether each is working, idle or done
herdr agent read builder1                # the pane's current screen
herdr agent prompt builder1 "…"          # submit a prompt
herdr agent send-keys builder1 alt+m     # deliver a queued prompt now (key depends on the agent)
```

With tmux the same verbs are `tmux list-panes`, `tmux capture-pane -p -t <pane>` and `tmux send-keys -t <pane> "…" Enter`. Whatever you use, test one thing before you rely on it: a prompt sent to an agent that is mid-turn is usually queued until the turn ends, and for a `flow --auto` run the turn ends when the spec does. Find the key that delivers a queued message now, and have the orchestrator read the pane afterwards to confirm it arrived.

**A cadence.** The orchestrator checks on an interval, from the host’s `/loop` or a scheduled prompt. Ten minutes suited builders whose specs take one to three hours. The check prompt is [below](https://flow-next.dev/autonomy/orchestrating-builders/#the-check-on-a-cadence).

## What the orchestrator checks

Status is the easy half: a pane is working, idle or done, a pull request is open, CI is green. A check that stops there is a loop with extra cost. The useful half is direction, and these are the things worth naming in the check prompt because each one happened:

* **Scope beyond the spec.** A branch several times the size the spec implies. Read the diff stat against the acceptance criteria before the pull request merges, not after.
* **Two builders in the same file.** Name the shared files in each spec’s Boundaries. When a collision is unavoidable, decide which builder owns the shared part and tell the other to take it at catch-up.
* **Findings that do not shrink.** From the second review round, count the findings that are open or new. See [the next section](https://flow-next.dev/autonomy/orchestrating-builders/#the-review-round-cap).
* **A proof that sidesteps its criterion.** A live proof rerun with shorter jobs so a timeout no longer fires, or a run that ended in an error and was reported as shown. Read the proof, and send the builder back to fix the fault.
* **A builder waiting on something that will not come.** A pending check that never starts, a survey prompt in the pane, a CI failure it has not noticed. Read the CI log for it and tell it which test failed.
* **Things nobody may touch.** A production daemon’s port, a shared database, the default branch’s migration order. Put them in every spec and in the check.
* **A fact that makes the document wrong.** When a builder finds that a spec assumed something false, the orchestrator fixes the document on the default branch at once, so the next builder does not trip on it.

For UI work, the orchestrator opens the screenshots. A size check that passes and a review that says SHIP have both been true of a screen that was wrong.

## The review round cap

Under `--auto` a builder fixes and re-reviews until SHIP, bounded by [flowctl’s round cap](https://flow-next.dev/reference/troubleshooting/). At the cap it stops `NEEDS_HUMAN`. With an orchestrator, that stop goes to the orchestrator, and it was the most frequent thing ours had to answer. The rule that held:

1. **Read the findings, then count them per round.** 13, then 7, then 6 converges slowly. 12, then 3 open, then 4, then 9 new does not.
2. **Shrinking: allow more rounds, with a bound.** One `flowctl spec reset-review-rounds <spec>` and at most two more draws, with a stop if the second is not SHIP.
3. **Not shrinking: stop the loop and look for the one mechanism behind the findings.** Nine findings about the same design are one finding. Change the design in the spec, then reset.
4. **A reset is not free.** It starts a review with no memory of the earlier rounds, and a fresh review of a large diff finds about ten new things every time. Reset after a redesign or when the remaining findings are fixed, not to get a second opinion.
5. **Decline what the spec does not ask for.** A reviewer will keep asking for hardening. A finding is fixed when it shows the change is wrong for its request; otherwise the builder declines it and records the reason. Say this in the answer, or the branch grows to satisfy the reviewer.

## Rules that keep builders apart

| What went wrong                                                                                                                   | The rule                                                                                                                                        |
| --------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| A docs push to the default branch while a pull request waited for CI forced it to catch up and rerun everything                   | Hold pushes while any pull request is in its merge window; batch them after the merge                                                           |
| A spec file edited on the default branch while its builder was running conflicted with the builder’s own flow state               | Correct a running builder by prompt. Spec text changes go into the builder’s branch                                                             |
| Two specs were each given a fixed migration number, a third took one of them, and a builder loosened the migration runner to cope | Shared numbering is “the next free number after the default branch, renamed at catch-up”, never assigned ahead                                  |
| Two builders each wrote the same helper                                                                                           | The orchestrator names which one is shared and tells the other to drop its copy                                                                 |
| A workspace manager restart reopened panes on the wrong conversations                                                             | The log says which builder is on which spec, and the runbook says how to match a pane to its spec and restart it                                |
| A stale helper file was appended to the log twice                                                                                 | The orchestrator reads a tool’s result before it runs the next step. A failed write followed by a script that reads the file is the usual cause |
| A builder ran the whole test suite locally for an hour                                                                            | The spec says which checks to run locally and that CI runs the rest                                                                             |
| A UI test mocked a shared module for the whole process and broke unrelated tests in CI only                                       | Lessons like this go into the next spec’s Boundaries, where the next builder reads them                                                         |

Two more are decisions to make before you start. **Who merges.** Builders can merge their own pull requests under a rule the repo already states (CI green, the latest verdict SHIP, no open thread), with named exceptions, such as anything that touches authentication, that stop at the pull request for the orchestrator or for you. **Which model sits where.** Use good builders: a frontier coding model, the class of Claude Opus 5.5 or Gemini Neon. A builder runs a whole spec alone, through its own review and proof, and a weak one turns every stop into the orchestrator’s work. Give the orchestrator a model at least as strong, because it judges what the builders produce. [Orchestration & routing](https://flow-next.dev/guides/model-routing/) covers the tiers.

## The prompts

Four prompts carry the pattern. Each is short because the document holds the detail.

### Start the orchestrator

```text
You are the orchestrator for <outcome>. The single source is docs/prd/<name>.md: read all
of it, then its build log from the last row backwards.


You do not write product code. You write specs one wave ahead, hand each ready spec to a
free builder, read what the builders do, answer what the document or a spec already
answers, and record every start, stop, decision and merge in the build log. Builders are
the panes builder1, builder2 and builder3, each in its own worktree; reach them with
`herdr agent list`, `herdr agent read <name>` and `herdr agent prompt <name>`.


Judge direction, not only status. Stop a builder that leaves its spec's scope. Decide a
review round cap yourself by the rule in the runbook. Bring to me only what is mine: a
product decision the document leaves open, anything that touches <the gated areas>, and
anything that costs money I have not agreed to.


Never <the things nobody may touch>. Keep the document good enough that a fresh session
given only its path could take over from you.
```

### The check, on a cadence

```text
/loop 10m Orchestrator check for <outcome>. Read the last rows of the build log first;
they say which builder is on which spec. Then look at each builder and every open pull
request.


Judge direction, not only status: scope beyond the spec, two builders in the same file,
more than one task file for a no-plan spec, a full local test run, anything touching
<the things nobody may touch>, and from review round two a findings count that does not
shrink.


If all is on track, reply in two lines at most. Otherwise act as the runbook says: one
corrective prompt that quotes the spec, confirm a claimed merge on the forge before
believing it, log it, start what the merge freed, and write the next wave's specs.
```

The two-line limit matters. Most checks find nothing, and a check that writes a page each time buries the one that found something.

### Hand a builder its spec

```text
You are a builder for <outcome>. Your spec is <spec-id>; read it in full, and the
sections of docs/prd/<name>.md it names.


Run /flow-next:flow --auto <spec-id> --until=merge. The spec has no task breakdown and
needs none. Stay inside its Boundaries: other builders are working in the files it says
are not yours. Run the checks the spec lists and no others; CI runs the full suite.


Prove live what the spec says to prove, on a throwaway environment, and look at the
result yourself before you call it done. If the spec assumes something that is not true,
or you cannot meet a criterion as written, stop and say exactly what you found and what
the options are. Do not change the proof so the problem does not show.
```

The last two sentences earn their place. A builder that stops with a measured gap and two options saves an afternoon. One that quietly builds around the gap costs one.

### Answer a round cap

```text
Orchestrator answer on the round cap for <spec-id>: rounds went <n>, <n>, <n> and all are
fixed, so it converges. Run `flowctl spec reset-review-rounds <spec-id>` once, then at
most two more review draws.


Fix a finding only when it shows the change is wrong for what the spec asks. Decline,
with the reason recorded, any finding that asks for machinery the spec does not. If a
draw raises a new finding about the design itself, or the second draw is not SHIP, stop
and report the findings instead of fixing on. Then finish as planned.
```

A correction mid-run has the same shape: what you saw, the sentence of the spec it breaks, the one thing to do, and what happens next.

## What a spec needs for this

A spec written for a builder nobody is watching closely carries more than one written for yourself. Beyond [the usual sections](https://flow-next.dev/guides/writing-specs/):

* **Decision Context** with the decisions already made and who made them, quoted. A builder that knows why does not relitigate.
* **Boundaries** that name the files this spec owns, the files another running spec owns, and what may never be touched.
* **A live-proof criterion.** “On a throwaway environment, do this and show that.” Unit tests passed on every fault our live proofs found.
* **How to run and prove it**: the route, which checks to run locally, the merge rule, and what to do with a fact that makes the spec wrong.

## Field case: 16 pull requests in a day

A product rebuild in a private repo ran this way on 26 and 27 November 2026: one orchestrator, three builder panes, a PRD of 23 child specs in 8 waves.

| Run outcome, first 23 hours                             | Result                                                                 |
| ------------------------------------------------------- | ---------------------------------------------------------------------- |
| Pull requests merged                                    | 16, each reviewed by another model family                              |
| Builders                                                | 3 panes, one worktree each                                             |
| Stops at the review round cap                           | 6 of the 16; each answered by the orchestrator, none by a person       |
| Children redesigned mid-build                           | 1, twice, after its findings stopped shrinking                         |
| Faults found by a live proof that unit tests had passed | 5                                                                      |
| Decisions taken to the owner                            | A design pick, where published specs land, and what to add to the plan |
| Orchestrator sessions                                   | 1, summarised and resumed from the document several times              |

Most of the orchestrator’s work was judgment at a stop: a round cap to answer, a branch grown to satisfy a reviewer, a proof that passed around a fault. Those calls are what turned sixteen builder runs into merged work, and they are the case for having an orchestrator.

## Related

* [Flow —auto](https://flow-next.dev/autonomy/pilot/) - what each builder runs, and its verdict grammar.
* [Goal mode](https://flow-next.dev/autonomy/goal-mode/) - one session working an outcome down, one child at a time.
* [Unattended operation](https://flow-next.dev/autonomy/unattended-operation/) - worktree isolation and overlap rules, which apply to every builder here.
* [Writing specs](https://flow-next.dev/guides/writing-specs/) - the contract a builder is handed.
* [Orchestration & routing](https://flow-next.dev/guides/model-routing/) - which model does which job.
