Orchestrate herdr
Fan a spec's open sub-issues out to one herdr-managed worker tab each and drive each to a test-backed end state. You are the orchestrator: never implement, never close your own tab.
Inputs
SPEC_REF is resolved first, from skill args (SPEC_REF=..., or a bare spec reference; legacy SPEC_URL=/PRD_URL= keys accepted) and otherwise by asking. The rest are settled at Intake. Never guess an input.
- SPEC_REF — the spec (PRD) or parent issue whose open sub-issues become workers, in its tracker's native form: a Linear issue ID (
PRWL-100, ABC-123) or a GitHub issue URL or number.
- AGENT — which coding agent runs the workers, named from the six supported runtimes. It yields two values that are not interchangeable:
CLI_NAME, its launch token, used for PATH checks and tab labels; and AGENT_KIND, its herdr --kind. Both come from the roster in references/intake.md — never from a command's first token, which is wrong for Cursor.
- CODING_CLI —
CLI_NAME plus the permission-mode flags the user picks. The prompt is never a launch argument (see Rules).
- ISOLATION —
worktree, branch, or shared; it decides whether workers can run in parallel.
- TRACKER / TRACKER_TAG — the workspace's tracker of record and its tag — GitHub
G, Linear L. Derived, not asked: resolve per Resolve in references/tracker-map.md, which holds the per-tracker commands cited by bold section name below.
Rules
Zero attribution. Omit co-author, AI, and tool attribution from prompts, commits, tracker comments, and reports.
Never implement. The orchestrator reads, creates tabs, submits prompts, monitors, and reports — nothing else.
One tracker of record per run. The workspace AGENTS.md names it, not SPEC_REF's shape. Never run gh issue against a Linear workspace, or the reverse.
Herdr-managed tabs only, created in the existing herdr workspace/session. No pane splits, no internal sub-agents, no nested coding sessions, and never launch CODING_CLI from inside another CODING_CLI.
Isolation is the user's choice, and herdr's job. Never cd into task, issue, or any other folder. Create a worktree only when the user picked worktree, and only through herdr worktree create — never hand-rolled git worktree add. In branch and shared mode every worker tab starts in the orchestrator's folder.
Saved IDs only. Every submit, read, monitor, and follow-up call uses a tab ID and agent name saved at creation — never the active tab, latest tab, visual order, or a guess.
Prompts are pasted and submitted into a ready CLI — never passed as launch arguments/flags, never left staged or unsent, and never pasted into a dead tab's shell, where the prompt text would execute as commands.
Completion requires test evidence: the worker's test command plus its quoted passing output, read from the tab. An unquoted "tests pass" stays incomplete.
Suggest, never auto-chain. After the final report, suggest /code-review on the workers' diffs or /release-notes for what shipped — suggest only, then stop.
Workflow
Emit Stage / Found / Next / Needs user at each phase transition — one line per field. Transitions: tabs created, prompts submitted, any worker status change, final report.
1. Pre-flight
Fail fast before creating anything, naming what is missing:
HERDR_ENV=1 is set — you are inside herdr. Not set → stop.
- Load the herdr companion per Companion in
references/herdr-commands.md unless already in context — it ships inside the binary, so this is a load, not a gate. That file holds the herdr commands cited by bold section name below.
- Tracker: resolve
TRACKER and TRACKER_TAG per Resolve, then run that tracker's access check. SPEC_REF's shape conflicts with the workspace's tracker → stop and ask.
2. Discover sub-issues
Read SPEC_REF and list its open sub-issues per Discover. State the count found and cross-check it against the spec before creating any tab — under-fanning silently drops slices. Fan-out covers every open sub-issue; the ready-for-agent label does not filter the set. Each issue's native identifier is <n> below.
3. Intake
Ask one batched question set, after Discover and never before — two of the four need the issue list. Name the affected issues and repos in the questions. Away-fallbacks and the full matrices: references/intake.md.
- Which coding agent. Offer all six supported runtimes by product name — Codex CLI (
codex), Claude CLI (claude), Antigravity CLI (agy), Cursor CLI (cursor), Opencode CLI (opencode), GitHub Copilot CLI (copilot); the parenthesised value is AGENT_KIND. Never label an option with a bare binary: Cursor launches as agent, which names no product the user would recognise and is not a valid --kind. Offer every runtime whose launch token is on PATH and say which are missing.
- Which permission mode. Offer the verified interactive preset per Intake, or the bare launch token with its permission behavior explained. Never pick elevation yourself. The answer becomes
CODING_CLI.
- How work is isolated.
worktree, branch, or shared; recommend worktree whenever two open sub-issues share a repo.
- Leftover tabs and agents from a previous run of this spec — monitor them, or create alongside.
4. Create worker tabs
Save the caller's workspace, tab, and folder per Context. For each open sub-issue, create one worker tab labelled [CLI_NAME] - <TRACKER_TAG> #<n> — codex - G #42, codex - L #PRWL-101. ISOLATION picks the command: worktree → Creating worktrees; branch or shared → Create tab. Save each worker's returned workspace, checkout path, tab ID, root pane ID, and slugified agent name per Names. Later calls use that worker's saved context, including a linked worktree workspace.
5. Launch workers
Parallelize the slow parts across tabs:
- Start every worker per Start agent,
AGENT_KIND as --kind and CODING_CLI's flags after --. Each call blocks until its agent is ready, so issue them concurrently — serially, every worker waits out the one before it. branch isolation on a shared checkout is the exception: dispatch those workers one at a time. Never poll or sleep for readiness. agent_not_ready means it booted straight into an approval UI — surface that under Needs user, never relaunch it; any other error is a dead-CLI case under Monitor.
- Submit that issue's worker prompt per Submit.
A worker is not launched until its tab ID and agent name are saved, its prompt is accepted, and its first response is visible.
Fill each worker's prompt from the template in references/worker-prompt.md — one issue per worker, never the full spec, never an identical bulk prompt. It tells each worker to run as many local sub-agent lanes as its CLI supports, and never a cloud agent.
Workers with neither test-first skill installed still owe test evidence; say so in the prompts-submitted phase update.
6. Monitor
Wait on lifecycle state per Watch — it reacts the moment a worker settles, and needs no sweep. Read a settled tab per Read.
- States:
blocked → an approval or question UI; surface under Needs user, never relaunch or answer it. idle / done → read the tab for the report. working → leave it.
- Stalls:
unknown never proves completion. After a start, submit, or wait error, inspect state and output before retrying; a timeout can follow successful submission. Agent gone → redo Launch workers once after confirming its process exited. A live long test stays running; silence alone never makes it blocked. Report a blocker only with an observed failure or missing human decision.
- Labels: a worker blocked on a human decision gets its issue flipped to
ready-for-human with a comment naming the decision, per Block. Issue order and dependency notes only sequence dispatch. Never edit issue titles (no BLOCKER:, AFK:, or HITL: markers).
- Completion: apply the test-evidence rule per issue — read the tab per Read and quote the passing output.
- Status board: on every state-change wake, emit a one-line count —
N running · M completed · K blocked/needs-user — naming any tab whose state changed.
7. Report
Report the tracker, agent and isolation mode, workspace/session ID, working folder, tab map, assigned issues, and blocked/errored issues, plus per worker its end state, the shortest decisive test tail — the pass/fail line and counts; never dump full logs — and its reported Decisions / Open items lines.
Completion criteria
1---2name: orchestrate-herdr3description: Orchestrate herdr worker tabs for a spec (PRD). Takes a spec reference — a Linear issue ID (PRWL-100, ABC-123) or a GitHub issue URL/number — finds its open sub-issues in the workspace's tracker of record (Linear or GitHub), launches one herdr-managed worker tab per issue running a chosen coding CLI, then monitors the tabs until every issue is completed with test evidence, blocked, or errored. Use when running inside herdr (HERDR_ENV=1) and the user wants to fan a spec out to per-issue workers.4---56# Orchestrate herdr78Fan a spec's open sub-issues out to one herdr-managed worker tab each and drive each to a test-backed end state. You are the **orchestrator**: never implement, never close your own tab.910## Inputs1112`SPEC_REF` is resolved first, from skill args (`SPEC_REF=...`, or a bare spec reference; legacy `SPEC_URL=`/`PRD_URL=` keys accepted) and otherwise by asking. The rest are settled at Intake. Never guess an input.1314- **SPEC_REF** — the spec (PRD) or parent issue whose open sub-issues become workers, in its tracker's native form: a Linear issue ID (`PRWL-100`, `ABC-123`) or a GitHub issue URL or number.15- **AGENT** — which coding agent runs the workers, named from the six supported runtimes. It yields two values that are not interchangeable: `CLI_NAME`, its launch token, used for PATH checks and tab labels; and `AGENT_KIND`, its herdr `--kind`. Both come from the roster in [`references/intake.md`](references/intake.md) — never from a command's first token, which is wrong for Cursor.16- **CODING_CLI** — `CLI_NAME` plus the permission-mode flags the user picks. The prompt is never a launch argument (see Rules).17- **ISOLATION** — `worktree`, `branch`, or `shared`; it decides whether workers can run in parallel.18- **TRACKER** / **TRACKER_TAG** — the workspace's tracker of record and its tag — GitHub `G`, Linear `L`. Derived, not asked: resolve per **Resolve** in [`references/tracker-map.md`](references/tracker-map.md), which holds the per-tracker commands cited by bold section name below.1920## Rules2122- **Zero attribution.** Omit co-author, AI, and tool attribution from prompts, commits, tracker comments, and reports.2324- **Never implement.** The orchestrator reads, creates tabs, submits prompts, monitors, and reports — nothing else.25- **One tracker of record per run.** The workspace `AGENTS.md` names it, not `SPEC_REF`'s shape. Never run `gh issue` against a Linear workspace, or the reverse.26- **Herdr-managed tabs only,** created in the existing herdr workspace/session. No pane splits, no internal sub-agents, no nested coding sessions, and never launch `CODING_CLI` from inside another `CODING_CLI`.27- **Isolation is the user's choice, and herdr's job.** Never `cd` into task, issue, or any other folder. Create a worktree only when the user picked `worktree`, and only through `herdr worktree create` — never hand-rolled `git worktree add`. In `branch` and `shared` mode every worker tab starts in the orchestrator's folder.28- **Saved IDs only.** Every submit, read, monitor, and follow-up call uses a tab ID and agent name saved at creation — never the active tab, latest tab, visual order, or a guess.29- **Prompts are pasted and submitted into a ready CLI** — never passed as launch arguments/flags, never left staged or unsent, and **never pasted into a dead tab's shell**, where the prompt text would execute as commands.30- **Completion requires test evidence:** the worker's test command plus its quoted passing output, read from the tab. An unquoted "tests pass" stays incomplete.31- **Suggest, never auto-chain.** After the final report, suggest `/code-review` on the workers' diffs or `/release-notes` for what shipped — suggest only, then stop.3233## Workflow3435Emit `Stage / Found / Next / Needs user` at each phase transition — one line per field. Transitions: tabs created, prompts submitted, any worker status change, final report.3637### 1. Pre-flight3839Fail fast before creating anything, naming what is missing:40411. `HERDR_ENV=1` is set — you are inside herdr. Not set → stop.422. Load the herdr companion per **Companion** in [`references/herdr-commands.md`](references/herdr-commands.md) unless already in context — it ships inside the binary, so this is a load, not a gate. That file holds the herdr commands cited by bold section name below.433. **Tracker:** resolve `TRACKER` and `TRACKER_TAG` per **Resolve**, then run that tracker's access check. `SPEC_REF`'s shape conflicts with the workspace's tracker → stop and ask.4445### 2. Discover sub-issues4647Read `SPEC_REF` and list its open sub-issues per **Discover**. State the count found and cross-check it against the spec before creating any tab — under-fanning silently drops slices. Fan-out covers every open sub-issue; the `ready-for-agent` label does not filter the set. Each issue's native identifier is `<n>` below.4849### 3. Intake5051Ask **one batched question set**, after Discover and never before — two of the four need the issue list. Name the affected issues and repos in the questions. Away-fallbacks and the full matrices: [`references/intake.md`](references/intake.md).52531. **Which coding agent.** Offer all six supported runtimes **by product name** — Codex CLI (`codex`), Claude CLI (`claude`), Antigravity CLI (`agy`), Cursor CLI (`cursor`), Opencode CLI (`opencode`), GitHub Copilot CLI (`copilot`); the parenthesised value is `AGENT_KIND`. Never label an option with a bare binary: Cursor launches as `agent`, which names no product the user would recognise and is not a valid `--kind`. Offer every runtime whose launch token is on PATH and say which are missing.542. **Which permission mode.** Offer the verified interactive preset per Intake, or the bare launch token with its permission behavior explained. Never pick elevation yourself. The answer becomes `CODING_CLI`.553. **How work is isolated.** `worktree`, `branch`, or `shared`; recommend `worktree` whenever two open sub-issues share a repo.564. **Leftover tabs and agents** from a previous run of this spec — monitor them, or create alongside.5758### 4. Create worker tabs5960Save the caller's workspace, tab, and folder per **Context**. For each open sub-issue, create one worker tab labelled `[CLI_NAME] - <TRACKER_TAG> #<n>` — `codex - G #42`, `codex - L #PRWL-101`. `ISOLATION` picks the command: `worktree` → **Creating worktrees**; `branch` or `shared` → **Create tab**. Save each worker's returned workspace, checkout path, tab ID, root pane ID, and slugified agent name per **Names**. Later calls use that worker's saved context, including a linked worktree workspace.6162### 5. Launch workers6364Parallelize the slow parts across tabs:6566- Start every worker per **Start agent**, `AGENT_KIND` as `--kind` and `CODING_CLI`'s flags after `--`. Each call blocks until its agent is ready, so issue them concurrently — serially, every worker waits out the one before it. `branch` isolation on a shared checkout is the exception: dispatch those workers one at a time. Never poll or sleep for readiness. `agent_not_ready` means it booted straight into an approval UI — surface that under Needs user, never relaunch it; any other error is a dead-CLI case under Monitor.67- Submit that issue's worker prompt per **Submit**.6869A worker is not launched until its tab ID and agent name are saved, its prompt is accepted, and its first response is visible.7071Fill each worker's prompt from the template in [`references/worker-prompt.md`](references/worker-prompt.md) — one issue per worker, never the full spec, never an identical bulk prompt. It tells each worker to run as many local sub-agent lanes as its CLI supports, and never a cloud agent.7273Workers with neither test-first skill installed still owe test evidence; say so in the prompts-submitted phase update.7475### 6. Monitor7677Wait on lifecycle state per **Watch** — it reacts the moment a worker settles, and needs no sweep. Read a settled tab per **Read**.7879- **States:** `blocked` → an approval or question UI; surface under Needs user, never relaunch or answer it. `idle` / `done` → read the tab for the report. `working` → leave it.80- **Stalls:** `unknown` never proves completion. After a start, submit, or wait error, inspect state and output before retrying; a timeout can follow successful submission. Agent gone → redo Launch workers once after confirming its process exited. A live long test stays running; silence alone never makes it blocked. Report a blocker only with an observed failure or missing human decision.81- **Labels:** a worker blocked on a human decision gets its issue flipped to `ready-for-human` with a comment naming the decision, per **Block**. Issue order and dependency notes only sequence dispatch. Never edit issue titles (no `BLOCKER:`, `AFK:`, or `HITL:` markers).82- **Completion:** apply the test-evidence rule per issue — read the tab per **Read** and quote the passing output.83- **Status board:** on every state-change wake, emit a one-line count — `N running · M completed · K blocked/needs-user` — naming any tab whose state changed.8485### 7. Report8687Report the tracker, agent and isolation mode, workspace/session ID, working folder, tab map, assigned issues, and blocked/errored issues, plus per worker its end state, the shortest decisive test tail — the pass/fail line and counts; never dump full logs — and its reported `Decisions` / `Open items` lines.8889## Completion criteria9091- [ ] The final tab map accounts for every discovered open sub-issue, including failed launches and exited workers; saved IDs and end states match read-back92- [ ] Each tab, read back, shows its submitted prompt and a worker response — nothing staged or unsent93- [ ] In `worktree` or `branch` mode, each worker's commits land on that issue's branch and no other94- [ ] Every sub-issue's end state is reported: completed with quoted test command and passing output, blocked, or errored95- [ ] Each blocked issue shows `ready-for-human` and a decision-naming comment in the **Verify** read-back, title unchanged96- [ ] The transcript ends with the final report and the `/code-review` / `/release-notes` suggestion — nothing after it