--- name: orchestrate-herdr disable-model-invocation: true description: "Dispatch spec (PRD) sub-issues to worker tabs; monitor to done. Tab, CLI, or runtime context selects herdr; without any of these: /ask-kit. Tab status or actions with no dispatch: herdr companion." metadata: version: "0.7.2" --- # Orchestrate herdr Fan work out to one herdr-managed worker tab per unit (tracker sub-issue or harness prompt) and drive each to a test-backed end state when the task involves code. You are the **orchestrator**: never implement, never close your own tab. ## Inputs **Run mode** — `spec` when `SPEC_REF` is present; otherwise `harness` per [`references/harness.md`](references/harness.md). Never guess an input. - **SPEC_REF** (spec mode) — parent issue whose open sub-issues become workers: Linear `PRWL-100` / `ABC-123`, or a GitHub issue URL or number. From skill args (`SPEC_REF=...`, bare reference; legacy `SPEC_URL=`/`PRD_URL=` accepted) or intake. - **WORKERS** (harness mode) — list of `{label, prompt}`; defined per harness reference. - **AGENT** — worker runtime. Its `CLI_NAME` launch token serves PATH checks/tab labels; `AGENT_KIND` serves herdr `--kind`. Both come from [`references/intake.md`](references/intake.md), never the command's first token: Cursor's values differ. - **CODING_CLI** — `CLI_NAME` plus the permission-mode flags from the user's established preference or intake choice. 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** — workspace tracker of record (`G` / `L`). Derived per **Resolve** in [`references/tracker-map.md`](references/tracker-map.md), which holds the per-tracker commands cited by bold section name below. **Factory stage.** Under a user-started `/factory run` on herdr, follow [`references/factory-stage.md`](references/factory-stage.md) instead of Intake. ## 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. - **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.** Keep the orchestrator's working directory. Create worktrees only in selected `worktree` mode through `herdr worktree create`, never hand-rolled Git. Verify project-owned placement per Intake before launch; unsupported placement blocks that worker. `branch` and `shared` tabs start in the orchestrator's folder, which must be the assigned repository's checkout. - **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. - **Read completion evidence from the tab.** A task whose diff touches source or tests requires the test command and quoted passing output, however the worker describes it; a non-code task requires the evidence its prompt named, or the observable result when none was named. Spec tasks also require an `AC map:` covering every criterion. Missing proof stays incomplete; a summary alone is a claim. - **Suggest, never auto-chain.** After the final report, suggest `/agentic-qa` for each PR whose `AC map` owes rows to it, `/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: 1. `HERDR_ENV=1` is set — you are inside herdr. Not set → stop. 2. 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. 3. **Mode:** `SPEC_REF` present → **spec**; no `SPEC_REF` → **harness**. When the run uses tracker APIs (spec mode, or harness workers with issues), resolve `TRACKER` / `TRACKER_TAG` per **Resolve** and run that tracker's access check. 4. **Harness-only:** empty **WORKERS** after define step → stop. ### 2. Build the worker set **Spec** — list open sub-issues per **Discover**. State the count and cross-check against the spec before tabs — under-fanning drops slices. Every open sub-issue; `ready-for-agent` does not filter. Identifier `` per issue. Zero open → stop before Intake. A sub-issue blocked by another open sub-issue is not parallel work; list pairs per **Discover** and ask in Intake question 3. **Harness** — define **WORKERS** per [`references/harness.md`](references/harness.md). State the count before tabs. ### 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`](references/intake.md). 1. **Which coding agent.** Offer all six runtimes **by product name** per Intake roster; parenthesised token is `AGENT_KIND`. Never label an option with a bare binary. Offer every runtime whose launch token is on PATH and say which are missing. 2. **Which permission mode.** Reuse the user's established permission mode; otherwise offer the verified interactive preset or bare launch token per Intake. The selected mode becomes `CODING_CLI`. 3. **How work is isolated.** `worktree`, `branch`, or `shared`; recommend `worktree` whenever two open sub-issues share a repo. 4. **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**. One tab per worker: spec → `[CLI_NAME] - #`; harness → `[CLI_NAME] -