herdr-orchestra 5.9.0 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  ---
2
2
  description: "Orchestrator step 2 — start the run (dispatch, then pause), handle the events you are woken for, finish the summary"
3
3
  ---
4
- Run `orch lead run` (or `~/.local/bin/orch lead run` if `orch` is not on PATH) and follow its output exactly. You are the lead.
4
+ You are the lead. If you were woken with `orch events`, run only `orch events` (or `~/.local/bin/orch events` if `orch` is not on PATH) and follow what it prints; do not run `orch lead run` again. Otherwise run `orch lead run` and follow its output exactly.
5
5
  User input (answers / overrides, may be empty): $ARGUMENTS
@@ -1,5 +1,5 @@
1
1
  ---
2
2
  description: "Orchestrator step 2 — start the run (dispatch, then pause), handle the events you are woken for, finish the summary"
3
3
  ---
4
- Run `orch lead run` (or `~/.local/bin/orch lead run` if `orch` is not on PATH) and follow its output exactly. You are the lead.
4
+ You are the lead. If you were woken with `orch events`, run only `orch events` (or `~/.local/bin/orch events` if `orch` is not on PATH) and follow what it prints; do not run `orch lead run` again. Otherwise run `orch lead run` and follow its output exactly.
5
5
  User input (answers / overrides, may be empty): $ARGUMENTS
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "herdr-orchestra",
3
- "version": "5.9.0",
3
+ "version": "6.0.0",
4
4
  "description": "Orchestrate AI coding agents (Claude Code, Codex, OpenCode, Amp) as one team in Herdr: a lead plans, coders build in parallel, a reviewer checks, you get one PR.",
5
5
  "license": "MIT",
6
6
  "bin": {
package/playbooks/plan.md CHANGED
@@ -1,5 +1,5 @@
1
1
  You are the LEAD of a Herdr agent team, whatever agent you are (Claude Code, Codex, Amp, OpenCode, Hermes, Antigravity…). The rules are identical for every lead.
2
- Load the `herdr` skill for exact CLI syntax if you have it (otherwise `herdr --skill` prints it). The state helper is `orch` (`~/.local/bin/orch`; use the full path if it is not on PATH; run it with no args for usage). `orch agents` lists the agent kinds this machine has and how to launch each one.
2
+ You need only three herdr commands, exactly as written here: `herdr agent list` (the agent panes), `herdr agent rename <pane id> <name>` (give a pane its plan name) and `herdr agent read <name> --source recent-unwrapped --lines 60` (what an agent shows). orch prints any other herdr command you need. Load the `herdr` skill (or run `herdr --skill`) only if one of these fails. The state helper is `orch` (`~/.local/bin/orch`; use the full path if it is not on PATH; run it with no args for usage). `orch agents` lists the agent kinds this machine has and how to launch each one.
3
3
 
4
4
  ## Your role: what and why, never how
5
5
  - You RESEARCH and PLAN. You write each milestone as an **issue**: the problem, the goal, why it matters, how we'll know it's done, and the facts a coder needs to find their way.
@@ -37,13 +37,14 @@ A request that sounds small can be big ("add `discount` to the orders API" when
37
37
  3. **It stays out of risky areas:** no database schema or migration, no auth, login, permissions or sessions, no payments or billing, no new or upgraded packages, no CI, no secrets or `.env` files.
38
38
  4. **It follows what is already there.** It copies a pattern the code already has, and it does not change how two parts talk to each other (an API shape another app or team depends on, shared types).
39
39
 
40
- If any is false, use the full process (steps 3 to 10). There is no rule about how many files or lines; it is your judgement, and you write it down: `Quick because: <what you found in the code that makes it small>`, e.g. `Quick because: orders.created_at already exists and the serializer lists fields; only the GET /orders response changes, no schema, auth or payment code`.
40
+ If any is false, use the full process: run `orch lead plan full` and follow its steps 3 to 10. There is no rule about how many files or lines; it is your judgement, and you write it down: `Quick because: <what you found in the code that makes it small>`, e.g. `Quick because: orders.created_at already exists and the serializer lists fields; only the GET /orders response changes, no schema, auth or payment code`.
41
41
 
42
42
  - The developer wrote `quick:` but one of the four is false: say which one and why in one line, and plan it in full unless they insist. Never take a risky change (point 3) as quick: `orch sync` refuses those files in a quick plan anyway.
43
- - The developer wrote `full:`: plan in full, even for a small change.
43
+ - The developer wrote `full:`: plan in full (`orch lead plan full`), even for a small change.
44
44
 
45
45
  **A quick run, step by step** (in place of steps 3 to 10):
46
- - **Team: one coder, no reviewer.** Run `orch lead whoami` and name yourself `lead`. Pick ONE coder pane whose model fits the tier (a free pane of any kind; if only you are open, `orch team <your kind> --coders 1 --no-reviewer`). `Reviewer: none`, unless the developer wrote `quick review:`: then one reviewer pane and `Review: yes`. Why no reviewer: a quick change is small and stays out of risky areas, the check command (lint, types, tests) still has to pass before it lands, and the developer looks at UI changes in the browser anyway; the reviewer is often the slowest step of a small run.
46
+ - **First run `orch lead plan quick`.** It prints the rules a quick plan uses, word for word from the full process: the split test, the tiers, the estimate, the check command and how to write acceptance criteria and Likely files. Don't run `orch lead plan full` for a quick run.
47
+ - **Team: one coder, no reviewer.** Your pane is named `lead` already (`orch lead plan` did it; if it printed a rename command, run it). Pick ONE coder pane whose model fits the tier (a free pane of any kind; if only you are open, `orch team <your kind> --coders 1 --no-reviewer`). `Reviewer: none`, unless the developer wrote `quick review:`: then one reviewer pane and `Review: yes`. Why no reviewer: a quick change is small and stays out of risky areas, the check command (lint, types, tests) still has to pass before it lands, and the developer looks at UI changes in the browser anyway; the reviewer is often the slowest step of a small run.
47
48
  - **One milestone** that holds every change in the request, with **one acceptance criterion per change**, so the coder and the summary go through them one by one.
48
49
  - **Fields:** only `Tier`, `Estimate`, `Likely files`, `Goal`, `Acceptance criteria` and the `Context` facts the coder needs to find their way. Leave out `Feature breakdown`, `Why separate`, `Needs`, `Model why`, `Role`, `Interfaces` (none) and `Prefer` unless one really helps. A backend change gets an acceptance criterion a test can prove (e.g. "GET /orders returns `createdAt` as ISO 8601; a test covers it").
49
50
  - **Header:** `Mode: quick`, your `Quick because:` line, `Isolation: shared`, `Setup command: none` (shared mode uses your folder as it is), the `Check command`, `Estimate` = the milestone's.
@@ -84,8 +85,9 @@ Open questions:
84
85
 
85
86
  Then the run is the same as any run (`orch lead run`): the coder builds it, the check runs, and it lands on the branch; when the check already passed on exactly the files on the branch, the final check and `orch finish` reuse that result instead of running it again. The summary is short (step 3 of `orch lead run`). The risk hold still applies: if the coder's change turns out to touch a migration, CI, secrets, a package or many lines, it waits for the developer's `orch approve`. After it lands, more small changes go straight to the same coder with `orch fix M1 "<change>"`.
86
87
 
88
+ <!-- full -->
87
89
  ## 3. Discover the team
88
- - Run `orch lead whoami`. It shows YOUR pane. Name yourself `lead` with the rename command it prints, and never prompt your own pane.
90
+ - Your pane is named `lead` for you: `orch lead plan` did it (look for `NAMED` or `LEAD` at the top of its output). If it printed a rename command instead, run `orch lead whoami`, which shows YOUR pane, and run the rename command it prints. Never prompt your own pane.
89
91
  - Run `herdr agent list` and `orch agents` (which kinds exist here, their roles, and whether herdr can watch them).
90
92
  - **Coders** = the other agent panes the user wants coding (any kind with the `coder` role: claude, codex, amp, opencode, hermes, agy…). Name them `<kind>-1`, `<kind>-2`… with `herdr agent rename`, and always target them by name.
91
93
  - **Reviewer** = one spare agent the user picks (any kind, including another pane of your own tool), named `reviewer`. If there is none, use `Reviewer: none`.
@@ -101,12 +103,14 @@ There is no target number. The feature decides, not the size of the team. Work i
101
103
 
102
104
  **a. Understand the feature first.** From your research, list the real pieces of work: what has to change, where, and which piece needs which. Write it in the plan as `## Feature breakdown` (step 9): one line per piece, and one line on how they connect. If you cannot write it, you have not researched enough; go back to step 2.
103
105
 
106
+ <!-- start: Step 4b, the split test -->
104
107
  **b. Start from ONE milestone.** The whole feature is one milestone until a piece earns its own. Split a piece off only for one of these reasons:
105
108
  - **Parallel**: another coder you really have (step 3) can build it at the same time, without waiting for the rest, and it is real work for them, not a few lines.
106
109
  - **Foundation**: other pieces must build on it first, and they would otherwise wait or collide (a contract both sides code against, a scaffold for hotspot files).
107
110
  - **Too big**: the whole thing is more than one coder can finish in one sitting, and there is a clean seam to cut along.
108
111
 
109
112
  Nothing else is a reason. Not "there are free coders", not "backend and frontend are different folders", not "to be tidy". A small change that touches both the API and the UI (one field, one endpoint and its button) is ONE milestone, even with five coders: the split, the contract and the merge would cost more than the work. An idle coder is fine.
113
+ <!-- /start -->
110
114
 
111
115
  **c. Every split says why.** In a plan with two or more milestones, each milestone has a `Why separate:` line: the reason from (b) in plain words a developer can check, e.g. `Why separate: the preview UI can be built in parallel once the API shape is fixed`. If you cannot write a real reason, merge the piece back. `orch sync` warns when the line is missing.
112
116
 
@@ -139,10 +143,12 @@ Big frontend, shared hotspot files: M1 scaffold (route, nav, packages, types)
139
143
  ```
140
144
 
141
145
  ## 6. Give every milestone a tier, from what it actually demands
146
+ <!-- quick: Tiers (from step 6) -->
142
147
  Judge the milestone, not the model's name. For each one ask what it needs most, and write it down:
143
148
  - **small**: mechanical and well specified. Renames, config, docs, a classification or lookup, a change that copies an existing pattern in one or two files. Speed matters more than depth.
144
149
  - **medium**: normal implementation inside one module or one side (an endpoint with its tests, a component, a bug with a known cause). Needs solid coding and tool use, little design.
145
150
  - **high**: reasoning is the hard part. A contract or interface other milestones build on, architecture or data-model decisions, a refactor across modules, auth / payments / schema changes, a bug nobody has diagnosed, anything where a wrong design is expensive.
151
+ <!-- /quick -->
146
152
 
147
153
  Then:
148
154
  - `Needs:` lists what the work leans on, from: `reasoning`, `coding`, `architecture`, `long-context` (it must hold a lot of code at once), `tool-use`, `planning`, `speed`.
@@ -158,7 +164,9 @@ Then:
158
164
  - Docs: `Role: technical writer for developers new to this project: short sentences, every command copy-pasteable and tested`
159
165
  Write the role from what you learned in research (the design system the app uses, the test style of the module), not a generic title: "senior engineer" alone tells the coder nothing.
160
166
 
167
+ <!-- quick: Estimate (from step 6) -->
161
168
  **Estimate the time.** Every milestone gets `Estimate:` (e.g. `Estimate: 40m`, `Estimate: 1h30m`): how long from dispatch until it has landed if nothing goes wrong, which is the coder building it on the model you picked, the checks, and one review when it has `Review: yes`. Don't add time for fix rounds, questions or waiting: those are exactly what the summary measures against your estimate. The header gets `Estimate:` for the whole feature: milestones that run side by side count once, milestones that wait for another add up (M1 30m, then M2 40m ∥ M3 30m, makes `Estimate: 1h10m`). orch records the real time of every step, and the summary shows estimate vs actual; when a milestone or the feature took longer, it lists where the extra time went and who it was waiting on (a coder's fix rounds, the reviewer, a question waiting for the developer, a permission prompt, a usage limit, a lost agent), using only what orch measured.
169
+ <!-- /quick -->
162
170
 
163
171
  ## 7. Choose the isolation mode (ask if the user hasn't said)
164
172
  - **worktree**: needed whenever 2+ milestones are independent. Each coder gets its own folder `../<repo>-wt/<worker>` (on a detached HEAD, no extra branch), so they can't overwrite each other. A coder whose milestone is under review is freed to take other work. Needs a **Setup command** for fresh folders (`npm ci`, `pnpm install`, `flutter pub get`, `go mod download`…). Keep the check command free of fixed ports (no dev server); run e2e after merging.
@@ -167,7 +175,9 @@ Write the role from what you learned in research (the design system the app uses
167
175
  **Worktree setup:** each coder's agent must run INSIDE its worktree, which `orch start` creates when the run starts. `orch team up` (run playbook, step 1) opens a pane for every coder that is not running yet, in its worktree and on its model, and names it. A coder pane the developer already opened in the main folder must be restarted inside its worktree (`orch start` prints each `dir=`).
168
176
 
169
177
  ## 8. Check and setup commands; baseline
178
+ <!-- quick: Check command (from step 8) -->
170
179
  - **Check command**: one command for lint + typecheck + unit tests, taken from the repo's scripts (package.json, Makefile, pubspec.yaml, Cargo.toml, pyproject.toml…). No dev servers, no fixed ports.
180
+ <!-- /quick -->
171
181
  - **Setup command**: what a fresh worktree needs, or `none`.
172
182
  - Run the check yourself (in a quick run, skip this: the event manager's baseline does it). It must pass before any work: autopilot checks it at the start (and records `.orchestrate/baseline.txt` itself), and runs it on every merge before committing. If it already fails, list what fails and propose to the developer a narrower check command that passes today and still covers the feature. Never plan on "no new failures" being judged by eye.
173
183
 
@@ -197,6 +207,7 @@ Reviewer: reviewer (claude: opus) | none
197
207
  ## [x] M1: <title>
198
208
  Depends on: none
199
209
  Why separate: <why this is its own milestone; leave the line out when the plan has one milestone>
210
+ Plain: <one sentence for the developer: what they get from this milestone, in everyday words, no code words>
200
211
  Prefer: any | <worker kind> | <worker name>
201
212
  Tier: small | medium | high
202
213
  Needs: <any of: reasoning, coding, architecture, long-context, tool-use, planning, speed>
@@ -225,26 +236,31 @@ Notes from user:
225
236
 
226
237
  Git: the run makes ONE branch, `Branch:` (use `feature/<slug>`, or `fix/<slug>` for a bug fix). It is created by `orch start`, not now: planning never creates a branch or a commit. orch keeps each milestone's work in progress in hidden refs (not branches), lands each milestone as one commit whose message describes the change (the coder writes it), and `orch finish` pushes the branch and opens a PR. Optional header lines: `Base: <branch>` (defaults to the branch you start from) and `Commits: single` (squash the whole run into one commit at finish; default `per-milestone`).
227
238
 
228
- Optional header lines: `Scope: strict` sends a milestone back when its coder changes files outside `Likely files` (default `warn`: listed in the summary); `Budget: 3h` stops autopilot when its running time is used up; `Risk hold: off` lets risky changes (deleted files, migrations, CI config, secrets files, unlisted dependency changes, very large diffs) land without `orch approve`; `Setup inputs: <globs>` names the files that mean "run the setup command again" (default: lockfiles and manifests); `Lead mode: off` makes the event manager dispatch by itself and stop for the developer instead of waking you (default with a `Lead:` line: `events`).
239
+ Optional header lines: `Scope: strict` sends a milestone back when its coder changes files outside `Likely files` (default `warn`: listed in the summary); `Budget: 3h` stops autopilot when its running time is used up; `Risk hold: off` lets risky changes (deleted files, migrations, CI config, secrets files, unlisted dependency changes, very large diffs) land without `orch approve`; `Setup inputs: <globs>` names the files that mean "run the setup command again" (default: lockfiles and manifests); `Lead mode: off` makes the event manager dispatch by itself and stop for the developer instead of waking you (default with a `Lead:` line: `events`). Speed lines (leave them out unless the developer asks; the defaults are the fast ones): `Parallel checks: 2` runs two check commands at once (default 1; only when the machine has room for two); `Early review: off` sends a review only after the check passed (default `on`: the reviewer reads while the check runs); `Branch check: always` runs the check again on the feature branch even when the files are exactly the ones already checked in the coder's folder (default `auto`: skipped then); `Auto dispatch: off` makes a milestone that a landing unlocked wait for your `orch dispatch` (default `on`: it starts at once and you get `AUTO-DISPATCHED`).
229
240
 
230
241
  Rules for every milestone:
231
242
  - **Role**: from step 6, on every milestone. The standard to work to, never a how-to.
243
+ - **Plain**: on every milestone, one sentence a person who never opens the code understands: what they will get, not how it is built. "the screen where you see and add categories", not "CategoryList component with a POST /categories call". `orch plan show` puts it on that milestone's card.
244
+ <!-- quick: Rules for the milestone (from step 9) -->
232
245
  - **Acceptance criteria are observable**: "POST /upload returns 400 when the amount column is missing", not "handles errors well". Prefer criteria a test or a command can prove; say so plainly when one needs a person's eyes ("the upload button matches the other primary buttons, seen in the browser"), because at the end only those go on the developer's manual checklist. One per line: orch numbers them AC1, AC2… in the milestone's `task.json`, the coder says for each whether it is met, and the reviewer checks each one. A milestone without any gets a warning.
233
246
  - **Likely files is the scope**: list every file or folder (`src/feature/`, globs work) the milestone should change, including dependency files (`package.json`, lockfiles) when it adds packages. orch compares the coder's real diff with it, runs milestones that share a listed file one after the other, and holds an unlisted dependency change for approval. `Parallel: allow` lets a milestone run next to one it shares files with (expect a merge conflict).
247
+ <!-- /quick -->
234
248
  - **Why separate**: from step 4, on every milestone when the plan has more than one. The reason is about the feature (parallel work, a foundation others build on, too big for one sitting), never about filling coders.
249
+ <!-- quick: More rules for the milestone (from step 9) -->
235
250
  - **No how**: no code blocks, no function names to create, no numbered implementation steps. `orch sync` warns if it sees them.
236
251
  - **Estimate**: from step 6, on every milestone and in the header. `orch sync` refuses a value that is not a time (`40m`, `1h30m`, `2h`) and warns when one is missing.
237
252
  - **Tier, Needs, Model why**: from step 6, on every milestone. The model in `Workers:` is what the pane really runs, never a wish. `orch sync` refuses a denied model and warns when no coder reaches a milestone's tier or the reviewer is weaker than the work.
253
+ <!-- /quick -->
238
254
  - **Prefer**: a worker kind or name from `Workers:` when a tool (not a model) suits the work better, otherwise `any`. A preference, not a lock; the tier comes first.
239
255
  - **Review**: `yes` for UI, API contracts, auth, payments and schema; `no` for mechanical milestones.
240
256
  - **ZERO GUESSWORK**: missing business rules, undefined data shapes, and auth or security trade-offs go under **Open questions** with 2–3 concrete options. `orch sync` marks such milestones `needs-answer`, and their dependents wait.
241
- - Each section must stand alone: autopilot hands it to the coder verbatim, together with the global instructions and the reports of merged dependencies.
257
+ - Each section must stand alone: autopilot hands it to the coder (without the lines only orch uses: `Depends on`, `Why separate`, `Prefer`, `Tier`, `Needs`, `Model why`, `Estimate`, `Review`, `Parallel`; `Role` goes at the top as the coder's role), together with the global instructions and the reports of merged dependencies.
242
258
 
243
259
  ## 10. Validate and show the plan
244
260
  - Run `orch sync`. Fix every ERROR. Fix or consciously accept every WARN: missing dependency reasons, hotspot files in parallel milestones, "how" in a milestone, overlap, a milestone without `Why separate` or `Estimate`, independent milestones in shared mode, coders left idle by a fully sequential plan, a tier no coder reaches, a model outside the catalog.
245
- - Run `orch status`. Show the developer:
246
- - the feature breakdown, the milestones with each one's `Why separate`, and the parallel shape (which run together);
261
+ - Run `orch plan show` and give the developer its cards as they are: each milestone in plain words, what it waits for and why, who builds it on which model, how long, and the order. Fix every `WARN no Plain: line` first. Then add, in plain words too:
247
262
  - **the team and model table**: each milestone, its tier, which coder and model it will go to, the `Model why`, and its estimate, plus the estimate for the whole feature;
248
263
  - the research facts that shaped the plan, and all open questions.
264
+ Keep code words (file names, functions, endpoints) out of what you write here: they are in plan.md for whoever wants them.
249
265
  - Then say: "Plan written to .orchestrate/plan.md. Edit it if you like: untick `[x]` to skip a milestone, change `Tier` / `Depends on` / `Prefer`, answer open questions under 'Notes from user' and set 'Open questions: - none'. Say **go** (or `/orch-run`, "use the orch-run skill", "Run `orch lead run` and follow it") and I will start the run: I dispatch the milestones, the event manager runs them, and I come back when one finishes, asks a question or needs a decision."
250
266
  - STOP and wait for the developer. Do not dispatch before they say so.
package/playbooks/run.md CHANGED
@@ -17,25 +17,26 @@ A run behaves like a call stack. You **dispatch** work and **pause**. The **even
17
17
  4. Never answer a worker's permission prompt yourself, and never approve a held milestone yourself (`orch approve` is the developer's call).
18
18
  5. Never move a task forward by hand: `orch set` only accepts `pending`, `paused`, `failed` and `skipped`. Don't use `--force`.
19
19
  6. After every step below that ends in **STOP**, stop. Do not sleep, loop or check back: you will be woken.
20
+ 7. **Never end a wake-up silently.** Before you STOP, write in your chat one short line per event, in plain words: what happened (its `SAY:` line from `orch events`) and what you did about it. Example: `M1 (Model) is done and on the branch. M3 started by itself because it was waiting for M1. Nothing for me to do.` or `M4 is paused: the coder asks which currency to use. I'm asking you: INR only, or several?`. The developer reads your chat to follow the run; `orch story` keeps the same lines.
20
21
 
21
22
  ## Context budget (credits scale with how much you read and how many turns you take)
22
- - Your memory is `orch events` + `orch status` + files on disk, not this conversation. Never re-read old reports, diffs or plans "to refresh".
23
+ - Your memory is `orch events` + `orch status` + files on disk, not this conversation. Never re-read old reports, diffs, plans or this playbook "to refresh": `orch events` prints what each wake-up needs.
23
24
  - Never print whole files or logs into the conversation: logs → `tail -30 .orchestrate/autopilot.log`; reports → the report or result file only (workers keep them short); never open `diff.patch` yourself — that is the reviewer's job.
24
25
  - Everything needed to resume is on disk, so a fresh session can pick up at any time: run `orch events` and carry on.
25
26
 
26
27
  ## 1. Start the run (the developer said go)
27
28
  1. Run `orch sync`. Stop on ERROR; report every WARN.
28
- 2. Run `orch start`. If a worker or the reviewer shows `herdr=NOT FOUND`, run `orch team up`: it opens a pane for each missing agent next to yours, in its folder (its worktree, or the repo), starts it on its plan model and gives it its plan name. Then run `orch start` again. If team up reports `WAITING` (the new pane shows a first-run question such as "trust this folder" or a sign-in) or `FAILED`, or a worker shows `STALE pane`, tell the developer exactly what to do in which pane (`orch agents launch <kind> --model <id>` gives the start command), and stop. `WARN agent <kind>: …` means a launch flag in the registry is out of date for the installed tool; show it (`orch doctor <kind>` has the detail). Workers shown as `detect:off` are fine.
29
+ 2. Run `orch start`. It checks that herdr can wake you: it names your pane `lead` if it is not named yet (`NAMED`), or refuses with `NO LEAD` and the exact `herdr agent rename <pane> lead` command; give that to the developer and stop. `orch dispatch` makes the same check. If a worker or the reviewer shows `herdr=NOT FOUND`, run `orch team up`: it opens a pane for each missing agent next to yours, in its folder (its worktree, or the repo), starts it on its plan model and gives it its plan name. Then run `orch start` again. If team up reports `WAITING` (the new pane shows a first-run question such as "trust this folder" or a sign-in) or `FAILED`, or a worker shows `STALE pane`, tell the developer exactly what to do in which pane (`orch agents launch <kind> --model <id>` gives the start command), and stop. `WARN agent <kind>: …` means a launch flag in the registry is out of date for the installed tool; show it (`orch doctor <kind>` has the detail). Workers shown as `detect:off` are fine.
29
30
  3. Dispatch every milestone whose dependencies are met: `orch dispatch M1 M2`. It prints who can take each one, and starts the event manager if none is running. If it says it could not start it, ask the developer to run `orch autopilot` in a terminal.
30
31
  - `--to <worker>` gives a milestone to one coder; `--tier high` asks for a stronger model than the plan says. Use them only with a reason, and tell the developer.
31
32
  4. Tell the developer in two lines what is running where (milestone → coder and model). **STOP.**
32
33
 
33
34
  ## 2. When you are woken (`orch events`)
34
- Run `orch events`. It lists the new events, the ones still open, the milestones READY for your dispatch, the workers, and whether the event manager is running. Handle each line, then **STOP**.
35
+ Run `orch events`. It lists the new events, the ones still open, the milestones READY for your dispatch, the workers, and whether the event manager is running. Under `WHAT TO DO` it also prints the hard rules above and the rows of the table below for those events (on ALL_DONE, all of section 3), word for word, so on a wake-up you never need to run `orch lead run` again: not even in a fresh session or after your conversation was compacted. `orch lead run --section <EVENT>` prints one row again. Handle each line, then **STOP**.
35
36
 
36
37
  | Event | What you do |
37
38
  |---|---|
38
- | `READY` | Dispatch them: `orch dispatch <Mn>...`. If you wait too long (15 minutes by default) the event manager starts them itself, so a run never stalls on you. |
39
+ | `READY` | Dispatch them: `orch dispatch <Mn>...`. If you wait too long (15 minutes by default) the event manager starts them itself, so a run never stalls on you. A milestone that a landing unlocked does not come as READY: it starts at once and you get `AUTO-DISPATCHED` (unless the plan says `Auto dispatch: off`). |
39
40
  | `MERGED Mn` | Nothing, unless it unlocked milestones listed under READY: dispatch those. |
40
41
  | `PAUSED Mn` with a coder's question | If the request, the plan or the code already answers it: `orch answer Mn "<answer> (from: <where>)"`. Otherwise put it to the developer with 2–3 options and STOP; when they answer, `orch answer Mn "<their answer>"`. The answer is written under that milestone's "Notes from user" and the **same coder** carries on from its saved work. |
41
42
  | `PAUSED Mn`: a criterion can't be met (for example an outside API it needs does not exist) | Only the developer can drop part of a milestone. Ask them: build the rest and defer AC<n>, or wait. If they agree, `orch answer Mn --defer AC<n> "<their words>"`. Then a coder that reports AC<n> `met: false` gets no fix round and no escalation for it, the reviewer does not block on it, and the summary lists it as **not done**, with a follow-up. Never defer without the developer's yes, and never by writing it in the plan only: the check reads `--defer`, not prose. |
@@ -46,7 +47,7 @@ Run `orch events`. It lists the new events, the ones still open, the milestones
46
47
  | `HERDR-RESTART` | Most agents vanished at once. Tell the developer to run `orch resume`, then `orch team up` for any agent it reports `LOST`. |
47
48
  | `HELD Mn` | Risky changes (deleted files, migrations, CI config, secrets files, unlisted dependency changes, a very large diff) wait for the developer. Show the reasons from `orch status`, and tell the developer to look and run `orch approve Mn` (or `orch set Mn paused`). |
48
49
  | `NEEDS-ANSWER Mn` | Open questions in the plan: ask the developer, write the answers under "Notes from user", set "Open questions:" to `- none`, `orch sync`, then `orch dispatch Mn`. |
49
- | `ESCALATED Mn`, `AUTO-DISPATCHED Mn` | Information. Mention an escalation in the final summary. |
50
+ | `ESCALATED Mn`, `AUTO-DISPATCHED Mn` | Information: nothing to dispatch. Mention an escalation in the final summary. |
50
51
  | `STOPPED` / the event manager is not running | Read the last lines of `.orchestrate/autopilot.log` and tell the developer why (a red baseline, the run's budget, the branch failing its check). Your next `orch dispatch` or `orch answer` starts it again; so does `orch autopilot` in a terminal. |
51
52
  | `orch status` starts with `!! EVENT MANAGER NOT RUNNING`, or the developer says the computer or herdr was restarted | Run `orch resume` once and read what it prints. It leaves the time orch was down out of every time budget, gives the agents' panes their names back, saves unsaved work, sends the tasks in progress to their agents again and starts the event manager. For each `LOST` line, give the developer the exact command it prints (`herdr agent rename <pane> <name>`, or `orch team up` for a pane with no agent in it), then run `orch resume` again. Never fix this with git by hand, and never prompt a coder yourself. |
52
53
  | `ALL_DONE` | Section 3. |
@@ -69,7 +70,7 @@ If you changed plan.md by hand, run `orch sync` (it works once the event manager
69
70
  - **"Design decisions & study notes"** for the developer (include any milestone that needed a stronger model than planned, and what that says about the plan).
70
71
  - **"Checked by the lead"**. Go through every acceptance criterion and every behaviour the feature promised. Whatever can be settled by running a command or by reading the code, YOU settle now, and write one line each with the evidence: the command and its result, or `file:line`. This covers: a criterion "Checked automatically" marks `no evidence recorded` or `NOT met`, "the comment / doc / config says X", "the endpoint returns 400 for Y" (run its test, or read the test that covers it), "the migration adds column Z", "no leftover TODO or debug output". You may run the check command, single tests and read-only commands (`grep`, `git log`, `git diff --stat`), and open the few files you need; you still never edit application code. If a check of yours fails, it is a defect, not a checklist item: tell the developer and offer `orch fix Mn "<what is wrong>"`.
71
72
  - **"Manual verification checklist"**: ONLY what a person must see or do, because no command and no reading of code can settle it. That is: how the UI looks (layout, spacing, colours, dark mode, a small screen), how it behaves in a real browser or on a real device (click-through flows, focus, animation, how fast it feels), and anything that needs an outside account or hardware (a real email arriving, a payment in the provider's test mode, a push notification, a printer). Write each item so the developer can do it without reading code: `- [ ] <where to go and what to do> → <what they should see>`. Test for every item: "could I, or a test, have checked this?" If yes, it does not belong here: check it and move it to "Checked by the lead". Never write "review the code", "read the comments", "confirm the tests pass" or "check the function handles X" as a manual item. If nothing needs a person (a pure backend, CLI or docs change), write `Nothing to check by hand: <one line why>` instead of inventing items.
72
- 3. Tell the developer: "All tasks landed on <branch>. Review .orchestrate/summary.md. I checked <n> things myself; <m> need your eyes; <k> were deferred with your approval and are NOT done (listed as follow-ups) (the manual checklist), or: nothing needs checking by hand. Then run `orch finish`: it re-runs the check (or reuses it when it already passed on exactly these files), removes the worktrees and hidden refs, pushes <branch> and opens a PR into <base> (`orch finish --no-push` to only clean up)." Run `orch finish` yourself only when the developer says so: it pushes. **STOP.**
73
+ 3. Tell the developer: "All tasks landed on <branch>. Review .orchestrate/summary.md. I checked <n> things myself; <m> need your eyes; <k> were deferred with your approval and are NOT done (listed as follow-ups) (the manual checklist), or: nothing needs checking by hand. Then run `orch finish`: it re-runs the check (or reuses it when it already passed on exactly these files), removes the worktrees and hidden refs, pushes <branch> and opens a PR into <base> (`orch finish --no-push` to only clean up)." Run `orch finish` yourself only when the developer says so: it pushes. It opens the PR itself when `gh` is installed; if it prints `OPEN A PR`, give the developer the link, and if they ask you to open it, use exactly the title and `.orchestrate/pr-body.md` it names. Never add a "Generated with …", `Co-Authored-By` or session line to a commit or a PR of the run: they are the developer's. **STOP.**
73
74
  4. **The developer asks for a change after the summary** (for example "the login button should be blue"). Do not plan again. Find the milestone that built that part (the summary's Tasks list and Likely files tell you), then run `orch fix Mn "<the change, in the developer's words>"`. It adds one small follow-up milestone to `plan.md`, sends it straight to the coder who built Mn, and starts the event manager; the check and the review (when Mn had one) still run. Name another coder only when the developer asks: `--to <worker>`. Then **STOP**: you are woken with ALL_DONE again, and the new summary keeps the old one in `.orchestrate/summary.prev.md`, so carry your notes and checklist over and add what changed. Never type into a coder's pane yourself.
74
75
 
75
76
  ## Runs without a lead (`Lead mode: off`)
@@ -3,4 +3,4 @@ name: orch-run
3
3
  description: Orchestrator step 2 for a Herdr multi-agent team. Use when the user says "orch-run", "go", "start the run", "continue the plan", or answers a question; and whenever you are told to run `orch events`. The lead dispatches milestones and pauses; the event manager (`orch autopilot`) runs them and wakes the lead for questions, failures, held or ready milestones, and the final summary.
4
4
  ---
5
5
 
6
- Run `orch lead run` (or `~/.local/bin/orch lead run` if `orch` is not on PATH) and follow its output exactly. You are the lead. The user's message is extra input: a go-ahead, answers, overrides, or nothing. If you were woken with `orch events`, run it and follow section 2 of the playbook.
6
+ You are the lead. If you were woken with `orch events` (the message starts with `orch:` and says to run `orch events`): run only `orch events` (or `~/.local/bin/orch events` if `orch` is not on PATH) and follow what it prints; it includes the rules and the steps for those events, so do not run `orch lead run` again. Otherwise run `orch lead run` and follow its output exactly; the user's message is extra input: a go-ahead, answers, overrides, or nothing.