Skip to content
Back to skills

Run Wave

ASecurity

Front door for running a multi-item wave of MCP work items through a generated run plan — resolves a frontier of ready/resumed items, derives per-item seat stages from their resolved schemas, opens a server run for them, and executes the plan via the Workflow tool (Method A) or direct Agent dispatch (Method B) when Workflow is unavailable. Use when a user says: run the wave, launch the wave, run a wave over <feature>, run these ready items as a wave, run-wave, resume run r-…, or when a task n...

  • 215 stars
  • 0 votes
  • 0 copies
  • 4 views
  • Added September 29, 2026
ai-agentsrustgobashnodeawsgitapi

Works with

  • terminal
  • cli
  • api
  • mcp

Security analysis

A100/100

Pro scans all 4 files and shows the line behind each finding

Scanned November 25, 2026

npx -y skills add jpicklyk/task-orchestrator --skill run-wave --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Run Wave?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Run Wave
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/jpicklyk-run-wave/badge)](https://www.skillsdirectory.com/skills/jpicklyk-run-wave)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: run-wave
description: "Front door for running a multi-item wave of MCP work items through a generated run plan — resolves a frontier of ready/resumed items, derives per-item seat stages from their resolved schemas, opens a server run for them, and executes the plan via the Workflow tool (Method A) or direct Agent dispatch (Method B) when Workflow is unavailable. Use when a user says: run the wave, launch the wave, run a wave over <feature>, run these ready items as a wave, run-wave, resume run r-…, or when a task notification arrives from task-orchestrator:implement-wave. NOT for a single Direct-tier fix (use /status-progression or a direct dispatch) and NOT for headless unattended queue draining (use /ralph). Does not itself decide whether to plan or implement — it executes a run plan over items whose specification/task-scope notes already exist."
argument-hint: "[ancestorId | itemIds] [--method A|B] [--mode shared|per-item] [--worktree <path> --branch <name>] [--resume <runId>] [--altitude-safe]"
---

# run-wave — Multi-Item Run Plan Front Door

This skill resolves a frontier of ready (and resumable) MCP work items into a **run plan** —
a deterministic set of per-item seat stages derived from each item's resolved schema — opens a
**server run** over those items, and executes the plan either through the `Workflow` tool
(**Method A**) or through direct `Agent` dispatch (**Method B**, the fallback when `Workflow` is
unavailable or the server doesn't yet serve enough capability data for Method A). Both methods
execute the **same** run plan and the same seat prompts — Method B reuses the Method A core
byte-for-byte (see `references/method-b.md`).

The skill itself does no planning arithmetic. All frontier resolution, edge classification, stage
derivation and the exact server ops are produced by a pure Node helper (`scripts/run-planner.mjs`
/ `run-planner-lib.mjs` / `run-exec-lib.mjs`). This skill's job is: call the helper with the right
inputs, show the human the plan, send the ops the helper renders, launch, and drive post-run
verification and advancement. Side effects (MCP calls, token files, `git worktree add`,
`Workflow`/`Agent` dispatch) stay in this prose, never in the helper. The Workflow runtime has no
MCP access: every `runs_write`, `runs_read` and orchestrator `advance` call is yours.

**Do not attempt to replicate the helper's algorithm in your head.** If a helper call fails or
its output looks wrong, report the raw stderr/stdout rather than improvising a plan by reading
MCP responses directly — the whole point of the helper split is that frontier/edge/stage logic
is fixture-tested, not reasoned about fresh each run.

**Code Mode.** In a Code Mode session (only `REPL` and `Poll` are visible), run each step that `references/code-mode.md` covers through its recipe; the steps, rules, checkpoints and reports here are unchanged.

---

## The server run

A run-wave run is a server run (`current/docs/api-reference.md` → "Category: Runs"). Two ids name it:

- the **plan id** `runId` (`r-…`), from `plan`: the scratchpad directory, the plan document's
  `args.runId`, the provenance `run=` field and the run's `label`;
- the **server run id** (a UUID), from `runs_write` `open`: bound into the plan with `bind-run` as
  `args.serverRunId` and passed as `runId` to every `runs_write`/`runs_read` call.

The run view (`runs_read` `get`, `frontier`, `seats`) is the run's state: there is no plan or state
document on the server. The local scratch files (`<scratchpad>/run-wave/<runId>/plan.json`,
`state.json`, `result.json`) hold what the helper reads.

**Tokens.** `open` answers an `orchestratorToken` once (`coordinatorToken` before 4.1; a keyed replay omits both); `assign` answers each
seat's `seatToken` once. Write each seat token, and nothing else, as one line to the token file
`run-ops assign` names (`<scratchpad>/run-wave/<runId>/tokens/<short>.<seat>.token`); the seat prompt
names that path and the seat reads it. Write the run token the same way, as one line to the
`tokenFile` that `run-ops --phase open` names (`tokens/coordinator.token`), so a restart, `--resume`
or compaction can read it back; pass it as `seatToken` from that file, and delete `tokens/` at close. Never put a token in a prompt, a note, a log line, a commit, the plan or a helper
input, and never echo one back to the user. A lost run token (no file, or the file's token is
refused) of an open or paused run is reissued on the director profile's connection (no `seatToken`) or
with a human credential; the old token is refused from then on. A closed run cannot be reissued (`run_closed`). Write the answer's `orchestratorToken` to `tokens/coordinator.token`:

```to-call
{"tool": "runs_write", "op": "reissue", "args": {"runId": "<run uuid>"}, "profile": "director"}
```

A background orchestrator is denied `reissue`: it reports the lost token to the session that started it.

A seat envelope is stripped before it is persisted: any `seatToken`, `orchestratorToken` or `coordinatorToken` key is removed at any depth in both methods, and Method B's `stage-result` also redacts every value read from the run's token files. Method A strips by key only (the Workflow sandbox cannot read token files), so a token echoed under another key is not caught there. The run token file sits in the same `tokens/` directory, so Method B redacts its value too.

**Which token goes on a call.** Every orchestrator call (`update`, `assign`, `close`, the orchestrator
`advance` calls, `withdraw` of a decision this run raised, and every `notes_write` `upsert` to an
`orchestrator`-seat key of a run member while the run is open: post-run Step 3 and the Step 5 pointer)
carries the run token as the top-level `seatToken`; `end_seat` carries the seat's own token; `open` carries none.

**RESULTS.** A write tool answers `data.results[i]`, one entry per `ops[]` element: read each
element's own `ok` and `data.results[i].error` (`code`, `detail`, `fix`). A call-level
`partial_failure` only means "an element failed, look per element" and carries no detail. The
exception is an atomic batch (`atomic: true`): it answers only the failing element's own error with
`error.index`, and nothing was written.

**Retry classes the orchestrator meets.**

| Answer | What to do |
|---|---|
| `run_paused {pauseReason, pauseDecisionId}` | never retry. Save the answer as `paused.json` and send a `paused` report with `--paused paused.json` (see Reporting). The run pauses on an `attempt-cap` decision, or on a manual pause. A director or a human answers an attempts decision (`allow_one`, `skip_item` or `stop`); it cannot be withdrawn, so answering it or closing the run is the only way out. A manual pause has no decision: a director or a human `resume`s it. A run token can neither answer nor resume |
| `run_at_capacity {active, max}` | transient: back off until a seat ends (`maxActiveSeats`), then re-send the same `assign`; no decision to answer (Method B and every post-run reviewer assign; a Method A launch assign: see Step 5a) |
| `unavailable` (kind shedding) | retry once after `retryAfterMs` |
| `unauthenticated` "The seat token is not accepted." | the token is unknown, ended, superseded or the run closed: a seat stops (`seat-token-rejected`); a lost run token of an open or paused run is reissued (see Tokens); a closed run's token cannot be, `reissue` answers `run_closed` |
| `note_owned_by_other {ownerSeat}`, `seat_forbidden`, `not_claim_holder`, `decision_closed {decisionId, status}`, `forbidden` (`detail.required`), `not_found` (`detail.kind` `seat` or `decision`), `invalid_run_state`, `run_closed` | permanent: never retry unchanged; read `error.fix` |

**Decisions.** A writing seat that needs a ruling raises `runs_write` `raise {class: "deviation",
block: true, dedupeKey, question, options, recommended, itemId}` under its own token and stops with
`reason: "awaiting_decision"` and the `decisionId`. A raise with `block: true` blocks the item; an
answer never resumes it, and a blocked item allows only `resume` and `cancel`. The orchestrator
withdraws (`runs_write` `withdraw {decisionId}`, run token as `seatToken`) only decisions it or its seats
raised that went stale — never a server-raised `attempt-cap` decision. A stall is
never a reason to raise: see Stalled seats below. Answered decisions are resumed here, at Step 2 (before the snapshot) and at post-run Step 6, by the rule in [status-progression/references/decisions.md](../status-progression/references/decisions.md): never while the decision is open.

**Reporting.** An orchestrator reports to the director (or shows the user, when none runs this skill) on
exactly four events: `planned` (end of Step 5a; for a tier-2 orchestrator, its return), `decision` (a
stage stopped `awaiting_decision`, or this skill raised one), `paused` (`run_paused`, or a stalled seat whose re-assign hit the attempt cap) and `closed`
(any close). Send only the block `node "<helper>" report --plan <plan.json> --event <e> [--result F]
[--run F] [--close F] [--paused F] [--needs TEXT]` prints, never a hand-written one and never note text, diffs or a
token. Contract, addressing and the brief: `skills/director/references/coordinator-tiers.md`. After
`decision` or `paused`, wait for the answer; never answer a decision yourself. A run's orchestrator that runs as a subagent (of a director or of the user's session) never addresses the user: its questions and permission needs go up on the report's `needs:` line. Only the user's own session, running this skill as the orchestrator, shows the user the report, Checkpoint 1 and Step 5's gate keys.

---

## Helper resolution

Every helper call in this skill (and in the references) is of the form:

```
node "<helper>" <cmd> --in <scratchpad>/run-wave/<runId>/<file>
```

Resolve `<helper>` once, at the start of Step 0, and reuse the same resolved path for every
later call in this run (record it as `state.helper`):

1. Try `${CLAUDE_PLUGIN_ROOT}/scripts/run-planner.mjs`. `${CLAUDE_PLUGIN_ROOT}` substitutes
   inside plugin skill bodies (the same mechanism the `code-modernization` plugin's commands
   rely on) — confirm the literal string `${CLAUDE_PLUGIN_ROOT}` did **not** survive into the
   command you are about to run, and that `probe` (see F0 below) exits 0.
2. If the literal survived, or `probe` exits non-zero, fall back to the dev-checkout path
   `<git toplevel>/claude-plugins/task-orchestrator/scripts/run-planner.mjs`, when that path
   exists. Set `state.helperFallback: true` and add `helper-fallback` to `meta.degradations` —
   under this fallback, `probe`'s `phase0Hooks` reflects the checkout, not the installed plugin
   cache, so Step 0 F4 will read `entryMode: pre-entered` even when the installed cache actually
   has Phase 0 hooks. Report this degradation rather than silently trusting the pre-entered path.
3. If neither resolves, **stop** and tell the user to refresh the plugin cache (see
   `claude-plugins/CLAUDE.md` → "Plugin Discovery and Cache Refresh") — do not attempt a manual
   plan. While the plugin version is unchanged, every plugin file (workflows, skills,
   references, hooks, agents) reaches the installed cache only through the forced refresh in
   `claude-plugins/CLAUDE.md` "Plugin Discovery and Cache Refresh".

---

## Step 0 — Capability check and fallbacks

Run every check below before touching MCP state. Each row's fallback is a rule for THIS run —
re-probe every invocation (capabilities can change between sessions). F3 and F7 need a `rootId`
before Step 1 runs, so resolve it first by Step 1's rule (session context, then the `Config:` file,
then `.taskorchestrator/config.yaml`).

| # | Check | How | Fallback |
|---|---|---|---|
| F0 | Helper resolvable | `node "<helper>" probe` exits 0 | dev-checkout path (see Helper resolution above); else stop with the cache-refresh pointer |
| F1 | `Workflow` tool callable | `Workflow` already in your tool list, or `ToolSearch("select:Workflow")` resolves it | Method B (pass `--method B` to `plan` in Step 3 so the plan document's `meta.method` is `"B"`) |
| F2 | Server is 4.x with seats; `features` cover `seats`, `dispatchBySeat`, `rules` | `probe.serverCompat` first: non-null is the server-compat warning (a 3.x server, or one without the `seats` feature); `plan` also refuses (exit 3, `server incompatible: ...`) when the snapshot's `probe` carries it. Then the first `items_read(select:"schema")` response's `features` field — `probe` reports plugin/hook capability, never the server's schema `features` | `probe.serverCompat` non-null → **stop, both methods**, and show its line (upgrade the server or the plugin). Missing `features`/`seats` → stop as well (runs and seat tokens need them). Missing `rules` → **stop, both methods** (the server cannot serve the protocol rules, and `promptRules` in the shared prompt core marks the protocol key fatal for Method B too) |
| F3 | Protocol rules served | `config(ops:[{op:"rules", rootId}])` — its keys are the snapshot's `rulesServed` — includes `protocol.entry-seat`, `protocol.in-phase-seat`, `protocol.read-only-agent`; **not** `probe`, which carries no `rulesServed` field at all | **stop, both methods**, with: "protocol rules not served for this root". The reason: `promptRules` (`workflows/implement-wave.js`) marks the protocol key fatal, and Method B renders its seat prompts from that same core, so Method B cannot proceed either. Repair, then re-probe F3. (a) REST URL configured: start a new session; config-sync pushes the plugin's `bundled-rules/` at SessionStart to any initialized root that does not provide them. (b) No REST URL: run the `/task-orchestrator:init` rule seeding, or for each missing key `docs_write(ops:[{op:"upsert", rootId, kind:"rule", slug:"<key>", body:<${CLAUDE_PLUGIN_ROOT}/bundled-rules/<key>.md verbatim>}])`, then confirm the `config` `rules` get's `rulesVersion` is a hash listed for that key in `bundled-rules/manifest.json`; on a mismatch re-upsert once, then report |
| F4 | Phase 0 hooks present | `probe.phase0Hooks` (plugin 3.8.0 or later, the subagent-start `workflow-subagent` skip, and the phase-guard-record `seatToken` filter) | `entryMode: 'pre-entered'` (pass `--entry pre-entered` to `plan` in Step 3, rather than only noting it in prose) — the front door advances each item queue→work itself before launch, under the run token, instead of the entry seat sending `advance` `transition` `start` |
| F5 | Size guideline | `probe.workflowSizeGuideline` compared against the plan's `meta.estAgents` (medium: warn above ~10 agents; large: warn above ~50) | advisory line only — never blocks the run |
| F6 | Allow rules present | `probe.allow` (`{workflow, mcp, bashGit, bashNode}`) | warn: "this run will pause at the first un-allowed seat tool call in manual/accept-edits mode"; list the specific missing allow entries; **never** edit `.claude/settings.json` yourself. The `planned` report adds `needs: approve launch; allow rules missing: <n> (<keys>)` itself from the plan's probe `allow` (keys `workflow`, `mcp`, `bashGit`, `bashNode`; under Method B the `workflow` key is left out, since no Workflow call is made); never pass `--needs` for it, because a passed `--needs` replaces that line; with no director, the warning line still shows to the user |
| F7 | Open run already exists | `runs_read(select:"list", rootId, status:"open")` (and `status:"paused"`), keeping the runs whose `hints.plan` is a plan id (`r-…`) of this skill; or the target's (parent or single item's) pointer line `run-wave: <runId> run=<uuid8>` (in its `run-pointers` note, else its `session-tracking`) | an open or paused run found → `runs_read` `get`, `frontier` and `seats` for it, then go straight to the **Resume matrix** below instead of Steps 1–3 |
| F8 | Seat skills loadable | the `Seat skills:` line of Step 3's `explain` output, checked against the skills this session lists (an orchestrator agent: its own list), names matched exactly | a missing name stops the run at Checkpoint 1, before Step 4, in every mode (autonomous and the post-plan hand-off included): no worktree, no open, no assign. Tell the user the missing names: plugin skills reach a running session only at a skill reload (`/reload-skills`) or in a new session; then re-run `explain` on the same `plan.json` and re-check (no re-plan). An orchestrator agent returns the stop and the names instead of the `planned` report (as the `maxActiveSeats` refusal does). A name absent from disk too is a config gap (a seat's `skills:` or the defaults table), reported as such |

Report every fallback you took (F0/F1/F2/F3/F6) once, as run-level friction (post-run Step 3: the
Step 7 report and the feature parent's `session-tracking`), not on each item — a silent fallback is a
degradation the user should be able to see later.

---

## Invocation arguments

Each `argument-hint` flag maps to a `plan` CLI flag one-for-one, except the two rows that never
reach `plan` at all:

| Argument | `plan` flag | Notes |
|---|---|---|
| `ancestorId \| itemIds` | — | Scopes Step 2's snapshot (`snapshot --ancestor` or `--items`) or its calls; never passed to `plan` itself |
| `--method A\|B` | `--method A\|B` | Forces the method instead of the server-capability default |
| `--mode shared\|per-item` | `--mode shared\|per-item` | |
| `--worktree <path> --branch <name>` | `--worktree <path> --branch <name>` | `shared` mode only; both or neither, else `plan` exits 3. Reuses an already-created feature worktree/branch (e.g. one the project's own workflow created) instead of `assembleArgs` deriving a fresh one |
| `--resume <runId>` | — | Routes straight to the **Resume matrix** below instead of Steps 1–3 |
| `--altitude-safe` | `--altitude-safe` | Sets `args.altitudeSafe: true`: implement-wave returns the altitude-safe result (`rollup` counts, statuses, SHAs, file lists, note keys, reasons cut to 120 characters, the planner `sweep` entries with kind, hits, disposed, unowned file names and the grep cut to 120 characters, both scenario lists, no seat prose). Post-run Step 0 saves and verifies it like a full result |

Step 0 F4's fallback also maps to a `plan` flag, not just a prose note: when `probe.phase0Hooks`
is false, pass `--entry pre-entered` to `plan` in Step 3. Likewise, when F1 selects Method B,
pass `--method B` to `plan` so `meta.method` is `"B"` — the Method B prompt addendum and the blind
test-author default key on it.

**Director tier 2.** (Needs director mode entered through the `/task-orchestrator:director` skill in a normal session: the hardened `claude --agent director` entry has neither `Workflow` nor `start_session`, so it probes tier 3 or 4.) When a director session drives the run, it does not run these steps itself (its
guard denies the `node` helper, and the snapshot reads note bodies). It dispatches one named
background orchestrator agent (`run_in_background: true`, `model` set) for Steps 0-5a with
`--altitude-safe --method A`. The orchestrator records run phase `planned` (not `launched`), writes
`tokens/coordinator.token`, and returns the `planned` report plus `{runId, serverRunId, args}`. The
director makes the one `Workflow` call, then sends the orchestrator `launched` with the call's task id,
run id and script path; only then does the orchestrator record phase `launched` and those keys in
`state.json`. On the task notification the director sends the result JSON verbatim; the orchestrator writes
`result.json` and runs post-run, then reports. `plan` refuses `--method A` (exit 3) when `runBudget.maxActiveSeats` is below the schema-seat count; the orchestrator returns that refusal instead of a `planned` report, and the director raises `maxActiveSeats` or drives tier 2b (Code Mode) or 3. Decisions land between runs. See
`skills/director/references/coordinator-tiers.md`.

**Director tier 2b.** A tier-2b orchestrator is a Code Mode subagent: it runs Steps 0-9 and post-run itself with `--method B` per `references/code-mode.md` and sends each report to `"main"`. A prompt that is only the line `Run /task-orchestrator:run-wave <scope> --method B as a tier-2b orchestrator.` means: read the Tier 2b brief in `skills/director/references/coordinator-tiers.md` first and follow it. Its launch gate applies: a `planned` report whose `needs:` line is not `nothing` waits for the director's `approved` or `stop` (`stop` closes the run `cancelled` and reports `closed`) before the first dispatch round, which records `launched`; with `needs: nothing` it launches at once.

---

## Steps 1–9

| Step | Action |
|---|---|
| 1 Scope | Resolve the target: `ancestorId` (a parent feature/container UUID) or explicit item ids from `$ARGUMENTS`. Resolve `rootId` in this order: (1) session context, the `Active project:` line or the `Personal root:` line the SessionStart hook injects; (2) else `project.rootId` from the file on that context's `Config:` line; (3) else `.taskorchestrator/config.yaml` → `project.rootId`. A personal root is anchor-only: it is the `rootId` for `config` `rules`, `docs_*` and `runs_write` `open`, never the snapshot's `ancestorId` (scope by the target). If no `rootId` resolves, stop and point at `/task-orchestrator:init` (or `--user`). |
| 2 Snapshot | First read `items_read(select:"blocked", ancestorId)`. Resume each `awaiting_decision` entry with `resumable: true`, token-less, and carry the ruling into a `fix-decisions-<n>` note (decisions.md section 5); a `seat_forbidden` reply means the item is in another open run: skip it and report it. List what was resumed at Checkpoint 1. With a REST API URL, run `node "<helper>" snapshot --root <rootId> --ancestor <id> \| --items <ids> --out <scratchpad>/run-wave/snapshot.json`; when its stdout `needs.scopes` lists ids, build those entries by the scopes rule below, save `{<id>: {files, dependsOn?}}` and run it again with `--scopes <file>`; on exit 0 the snapshot is written and Step 2 is done, so go to Step 3. The snapshot calls that follow are the by-hand fallback for when the subcommand cannot run (exit 2 for no REST API URL), not an extra step. By hand, make the snapshot calls (`items_read(select:"next")` ready + `role:"work"` resume candidates, plus every non-terminal item in the target scope that `items_read(select:"blocked")` reports as blocked only by other candidates (add these to `candidates` with `source:"ready"`; `next` does not return them, and without this the planner defers them as `not projected`; under `--entry pre-entered` those in-run edges defer the item cross-run), `items_read(select:"blocked")`, `items_read(select:"overview")`, `items_read(select:"schema")` per candidate (copy each note's integer `maxLength` too: without it the plan has no `noteLimits`), `config(ops:[{op:"rules", rootId}])`, `items_read(select:"context")` per distinct parent, `notes_read(select:"list", itemId, keys:[...])` for work-role candidates, and, for each pair of candidates with one parent that an unsatisfied `blocked` dependency edge joins, `notes_read(select:"get", itemId:<id>, key:<planner queue note key>)` per item, plus the summary of both items (from `items_read(select:"get", itemId:<id>)` or the overview) (projected into `scopes`: `files` is every repo path the note or summary names as a file to edit, including `Shared file, lock-serialized:` lines; `dependsOn` is the ids on `Depends on <id>:` lines), per candidate `notes_read(select:"list", itemId)` with no `keys` filter, following `page.next` until it is absent, to find `carry-in-*` keys (when any exist, `dispositions` = the `carry-in-dispositions` note body via `notes_read(select:"get", itemId, key:"carry-in-dispositions")`, else the `## Carry-in dispositions` section of the planner queue note, else null; projected into `carryIns`), `git rev-parse --show-toplevel` + `git fetch origin` + `git rev-parse origin/main` + `git worktree list --porcelain`). Assemble `run-wave/snapshot-v1` (field reference: `references/snapshot.md`; projected fields only — no note bodies, no guidance text; the exceptions are `scopes` and `carryIns` (the dispositions body is the one place a note body enters), see `references/snapshot.md`) and write it to `<scratchpad>/run-wave/snapshot.json` — **no `runId` exists yet**, so this path carries no `<runId>/` segment |
| 3 Plan | `node "<helper>" plan --in <scratchpad>/run-wave/snapshot.json --scratchpad <scratchpad>` (add `--method B` whenever F1 selected Method B, so `meta.method` is `"B"`; without `--method`, the plan may still pick B when `runBudget.maxActiveSeats` is below the schema-seat count, F1 notwithstanding: Steps 5a and 6 follow the plan's `meta.method`) — **`--scratchpad` is mandatory here**, not optional: the project profile's `verify`/`searchScope` entries may carry a literal `<scratchpad>` placeholder that only this flag substitutes, `plan` refuses (exit 3) rather than silently shipping the un-substituted literal, and seat token files live under the `project.scratchDir` it sets. Once `plan` returns a `runId`, copy the snapshot and the returned plan document to `<scratchpad>/run-wave/<runId>/snapshot.json` and `<scratchpad>/run-wave/<runId>/plan.json` — **every step from here on reads from that `<runId>/` pair**, never from the pre-`runId` snapshot path. Then, for each `meta.lateCarryIns` entry (a carry-in key on an item with no planner stage and no disposition line), write one disposition line (`<key>: in scope (AC n) | deferred to <item-id> | rejected because <reason>`) into that item's `orchestrator-carry-in-dispositions` note (notes_write upsert, the orchestrator's own note, never a planner-seat note) before launch; the implementer prompt names the key and requires it to be read. A carry-in note is a requirement, not a hand-off dump: the source (item and finding id, or the red-proof survivor), what the receiving item must do in at most five lines, how it is verified (one command), and the acceptance criterion it should become; anything that enumerates files or lines goes in a `page` document the note names by slug; target under 1200 characters. Then `node "<helper>" explain --in <scratchpad>/run-wave/<runId>/plan.json`. **Checkpoint 1:** show the `explain` table to the user, including its `Warnings:` line when present, and run F8 on its `Seat skills:` line. Warnings are advisory and never block the run, unlike `meta.excluded`/`meta.degradations`; acting on a `shared-file edge` warning (deleting the edge, re-planning) is the user's call in collaborative mode, and the skill never deletes an edge by itself. In collaborative mode, wait for explicit approval before continuing. In autonomous mode, proceed unless `meta.excluded` or `meta.degradations` is non-empty — either one requires a human look first. When entered from post-plan-workflow's hand-off, plan approval counts as Checkpoint 1: proceed as in autonomous mode, and where a human look is required show the table and end the turn. A project dispatch contract is not part of the run plan: seat prompts are generated and never reference it. It serves the orchestrator (fallback hand-dispatches, the post-run commit map) and the reviewers; anything a seat must know goes in the item's `specification`/`task-scope` note, which seats read. If the run is empty (no items admitted), stop and report every deferral/exclusion with its reason — do not silently no-op (`run-ops open` exits 2 on an empty plan) |
| 4 Worktrees | `git worktree add` for each entry in `meta.worktreesToCreate`. On resume, reuse an existing branch/worktree rather than recreating it |
| 5 Open | `node "<helper>" run-ops --plan <scratchpad>/run-wave/<runId>/plan.json --phase open` renders `{tool: "runs_write", ops: [{op: "open", rootId, items, scopeId?, label: <runId>, title, hints: {plan, method, worktreeMode}, budget?}]}` (`budget` only when the profile sets its opt-in `runBudget.attemptsPerSeat` or `runBudget.maxActiveSeats`); send it as rendered, with no token. From the result keep `data.results[0].runId` (the server run UUID) and the `orchestratorToken` (`coordinatorToken` before 4.1; write it to the `tokenFile` per Tokens). A `duplicate` element means an item is already in another open run: stop and report it (F7 should have caught it). Then `node "<helper>" bind-run --in <scratchpad>/run-wave/<runId>/plan.json --server-run <uuid>` and overwrite `plan.json` with its output (exit 2 on anything but a full UUID). Run the **Parent check** below, then append the pointer line (under the run token when the target is a run member; a non-member parent stays token-less). The pointer goes to the target's `run-pointers` note when the target's resolved schema declares that key (`items_read` `schema` or `context` of the target), else to its `session-tracking` note. `run-pointers` is orchestrator-owned and never a stage note, so it is always written; the skip below applies only to the `session-tracking` fallback: when a stage of that item owns `session-tracking` on a seat-less schema, skip the pointer write, since a pre-launch note would block the implementer's own write, and rely on the `runs_read` `list` + `hints.plan` path of F7. Never write an undeclared `run-pointers` key. Write `run-wave: <runId> run=<first 8 hex of the uuid> parent=<skipped\|started\|blocked:<key,...>\|blocked:<errorCode>\|<role>>` to the parent's (else the single item's) `run-pointers` note (fallback `session-tracking`) with `notes_write` `upsert` (the whole body, the line appended). **Parent check:** the target parent is the item the pointer line goes on, and only when it is not itself a run item and not the run's `rootId` item; on every skip path (single-item run; the parent is the `rootId` item; the parent is itself a run item) write `parent=skipped` so the field is always present. `items_read(select:"context", itemId:<parent>)`: role `queue` and `gateStatus.canAdvance` → `advance(ops:[{op:"transition", itemId:<parent>, trigger:"start"}])` with the run token and write `parent=started`; role `queue` and `canAdvance` false → tell the user the `gateStatus.missing` keys before launch, record them under Friction in `session-tracking`, write `parent=blocked:<key,...>` and continue (a gate block never stops the launch); an element error that is not a note-gate block (for example `dependency_unmet` or `resource_unavailable`) → write `parent=blocked:<errorCode>` and continue; any other role → no-op, write `parent=<role>`. Why: the server's start cascade moves only the immediate parent queue→work and not at all when that parent's queue notes are missing, so a target two levels up, resumed work-role items or a gate-blocked cascade would otherwise leave it in queue |
| 5a Assign | Under `entryMode: pre-entered`, first move every queue-role run item to work: one `advance` call with one `transition` `start` element per such item, under the run token (read each element; an item that did not enter is excluded from the launch and reported). Then: **Method A** — `node "<helper>" run-ops --plan <plan> --phase assign` renders one `assign` element per schema-seat stage of every item (inserted stages such as `declarations-extractor` are not schema seats and run token-less, read-only) plus the aligned `tokenFiles` list; send it in ONE `runs_write` call under the run token and write each successful `data.results[i].seatToken` to `tokenFiles[i]` (create the `tokens/` directory first). Any failed element means do not launch: its seat has no token file. `run_at_capacity` here means seats from an earlier attempt are still active (end them via post-run Step 0b, then re-send that element); `run_paused`: stop and send a `paused` report (see Reporting). Method A pre-assigns at launch, so `stalledSeats` reads every seat as assigned from the start and stays advisory until each seat's first call; `plan` already guarantees `maxActiveSeats` covers every schema seat, or picks Method B. Follow the plan's `meta.method`. **Method B** assigns per dispatch batch (see `references/method-b.md`). **Method A: adopt the pre-filled planner notes** (Method B adopts per batch, see `references/method-b.md`; post-plan-workflow pre-fills them token-less, so the planner seat is otherwise refused `note_owned_by_other`): for every item with a planner stage, `notes_read` `get` each of that stage's note keys token-less (an absent key is skipped), save the answers as a JSON object keyed by item id, render `node "<helper>" run-ops --plan <plan> --phase adopt-notes --notes <observed.json>` and send each op as its own `notes_write` call under its `tokenFiles` entry (none when null), reading each element. A version_conflict on a delete means the note changed since the get: skip that note and report it, never re-create it. Any other failed delete leaves the note as is: report it and do not launch that item's planner seat; a failed upsert after a good delete: re-upsert the held body token-less, report it and do not launch that seat. Then `run-ops --phase update --run-phase launched` and send it under the run token (the hints replace); a tier-2 orchestrator sends `--run-phase planned` instead and waits for the director's `launched` message. **Method B** records `planned` here as well, and the loop records `launched` on its first dispatch round (`references/method-b.md`), so a gated tier-2b run stays `planned` until the director's `approved`. Then send the `planned` report (`report --event planned`; tier 2: it is the return value) |
| 6a Launch A | `Workflow({name: "task-orchestrator:implement-wave", args: <the bound plan's args object, passed as a real object — never a JSON-encoded string>})`. Record the returned `taskId` **and** the Workflow runtime's own run identifiers — `state.wfRunId` and `state.wfScriptPath` — from that call's result in `<scratchpad>/run-wave/<runId>/state.json`; these are distinct from the TO plan id (`r-…`) and the server run id, and are what a later resume needs to reattach to this exact Workflow run. **End the turn here** — the result arrives later as an async task notification; say so explicitly to the user |
| 6b Launch B | Run the Method B loop — see `references/method-b.md` |
| 7 Post-run | Runs only when triggered by the Method A notification, or by Method B's own loop reaching `next → {complete: true}`. See `references/post-run.md`: the end-seats sweep, verify, the notes audit, the batched advance, review hand-off, then `close` (no usage report is sent) |
| 8 Review | Method B generic review (F-9 in the design) unless `plan.json` `meta.review` (from the project's `run-profile.json` `review`: `mode`, `skill`, `step`, `onFail`) has `mode` `handoff`, in which case the run stays open, a reviewer seat is assigned per item, and control passes to the review step it names; `onFail` `stop` makes a review Fail a human checkpoint; the run closes after that review returns (post-run Step 5, then Step 7) |
| 8a Declared post-merge steps | Once the PR that holds the wave's work has merged (per-item mode: each item's PR; shared mode: the feature PR): the steps the project's `run-profile.json` `postRun` declares with `when` `post-merge`, selected by `post-run-steps`, each run per the rule it names, in the background; never a merge gate. See `references/post-run.md` Step 7a |
| 8b Feature closure | A parent with 2+ children and a review phase: once every child is terminal, one feature reviewer over the merged range, every finding disposed in `orchestrator-confirmation`, then the parent completes. See `references/post-run.md` Step 7b |
| 9 Loop | Re-run from Step 2 without waiting for 8a. Items surfaced in the last orchestrator `advance` answer's `unblocked[]` join the next frontier automatically |

Steps 1–5a are the **planning** half of a run; Steps 6–9 are the **execution** half. A run can
span many orchestrator turns — see turn-boundary discipline below.

---

## Stalled seats

`runs_read(select:"frontier", runId)` lists `inFlight[]` with `stalled` per seat (quiet strictly
longer than the run's `stallAfterSeconds`); the run view's `stalledSeats` counts them. A stalled
seat is handled like an interrupted one, never by raising a decision: snapshot its worktree's
uncommitted changes to `refs/wip/<short>` (as in the Resume matrix), re-`assign` the seat under the
run token (this supersedes the old token and counts attempt n+1), write the new token to the
same token file, and re-dispatch the seat; its INTERRUPTED-ATTEMPT CHECK continues from the
snapshot. Past the run's attempt cap the `assign` answers `run_paused` (an `attempt-cap` decision):
stop and surface it.

---

## Turn-boundary protocol

This skill's loop is a protocol across turns, not a single-shot script:

- **Record the phase before every turn ends.** Whatever step you are mid-way through, the run's
  `hints.phase` (`run-ops --phase update --run-phase <phase>`, run token) and the local
  `state.json` must reflect where you actually are, not where you expect to be next. Phases:
  `planned`, `launched`, `notified`, `post-run`, `review`. A turn that ends without recording it is
  a turn that resume (F7) cannot recover.
- **Increment `turns`** in `state.json` once per orchestrator turn in which you act for this run —
  this feeds the `orchestrator-turns` field of the provenance line (`references/post-run.md`).
- **Re-entry always goes through Step 0 F7, never from conversation context.** After
  compaction, a session restart, or simply picking the thread back up later, do not assume the
  run state you remember is still current — re-read the run view and the local state and resume
  from what they say. This is why the skill's own trigger phrases include "task notification from
  task-orchestrator:implement-wave" and "resume run r-…": both should land you back in Step 0,
  not mid-script.
- **A result whose `runId`/`serverRunId` matches no open run is reported, never acted on.**
  If a notification or Method B envelope references a run this session has no record of (already
  closed, or from a different session), surface it to the user as informational and stop —
  do not retroactively advance items based on it.

---

## Resume matrix

One wave runs per project root at a time: F7 resumes an open or paused run rather than opening a second.

When Step 0 F7 finds an open run, read `runs_read` `get` (status, `hints.phase`, `pauseReason`),
`frontier` (`inFlight`, `ready`, `waiting`) and `seats` for it, and dispatch on the phase. A
**paused** run is surfaced first (its pause decision is a director's or a human's to answer); a run
whose run token is lost cannot be updated, assigned or closed with it. Check the token first:
if `tokens/coordinator.token` is present, use it; if it is absent, or a call on an open run answers
`unauthenticated`, reissue the run token (see Tokens) and continue at the run's phase. An
`unauthenticated` answer on a closed run means it is finished: send the `closed` report and finish
post-run token-less.

For a member of this still-open run whose decision is answered (`resumable: true`), resume it under the run token and carry the ruling (decisions.md), then re-dispatch its seat.

| phase | Resume action |
|---|---|
| `planned` | Re-validate with `node "<helper>" validate --in <scratchpad>/run-wave/<runId>/plan.json`, re-run the Step 5 parent check (idempotent) and REWRITE the pointer's `parent=` field, in whichever note holds the line (`run-pointers` or the `session-tracking` fallback), with the current value (for example `parent=work` once the parent is already in work) rather than appending a second pointer line, then continue at Step 5a |
| `launched` (Method A) | Notification not yet seen: check `/workflows` or the task's status first. Before relaunching, protect interrupted work: for each run worktree that has uncommitted changes and no commit for the seat that was in flight (no `[<short>]` commit with a `Seat:` trailer in `<baseSha>..HEAD`), snapshot the changes to `refs/wip/<short>` without touching the index or the tree (temporary `GIT_INDEX_FILE`: `read-tree HEAD`, `add -A`, `write-tree`, `commit-tree -p HEAD`, `update-ref refs/wip/<short>`) and leave the tree as it is; the re-dispatched seat's INTERRUPTED-ATTEMPT CHECK continues from it. Re-`assign` every seat `frontier.inFlight` lists as stalled, or whose token file is missing, and rewrite its token file. If the session was itself restarted and the run is gone but `state.wfRunId`/`state.wfScriptPath` were recorded (Step 6a), stop the stale task (`TaskStop`) and relaunch with `Workflow({scriptPath: state.wfScriptPath, resumeFromRunId: state.wfRunId})` (a director session never makes this call, its guard denies a `scriptPath` or `resumeFromRunId` Workflow call: a tier-2 director sends the resume to the orchestrator, which makes it); if those keys are missing, close the run (`--reason abandoned`) and re-plan from Step 2 instead (seats are rerun-safe: re-dispatching an already-entered seat is not destructive). A `resumeFromRunId` relaunch re-runs every stage whose prompt changed since the first launch, even a finished one: that seat is refused its already-ended token and returns `stopped` (`seat-token-rejected`) while its first work stands, so when merging the two results take an item finished in the earlier result from that result. A Method A writer's `SHARED WITH` line comes from the sibling planners that had settled when its call was made, so its prompt is not stable across a replay and a `resumeFromRunId` relaunch can re-run a finished writer whose line changed. A resume replays a stopped seat's cached result unless its prompt changed, and retrying a stopped seat with an unchanged prompt needs a fresh launch of a re-planned run: see Retrying a stopped seat |
| `launched` (Method B) | Before relaunching, protect interrupted work: for each run worktree that has uncommitted changes and no commit for the seat that was in flight (no `[<short>]` commit with a `Seat:` trailer in `<baseSha>..HEAD`), snapshot the changes to `refs/wip/<short>` without touching the index or the tree (temporary `GIT_INDEX_FILE`: `read-tree HEAD`, `add -A`, `write-tree`, `commit-tree -p HEAD`, `update-ref refs/wip/<short>`) and leave the tree as it is; the re-dispatched seat's INTERRUPTED-ATTEMPT CHECK continues from it. Then resume `next` from the saved local `state.json`; any in-flight stage with no recorded `stage-result` is re-assigned and re-dispatched (rerun-safe) |
| `notified` / `post-run` | Continue `references/post-run.md` at the first step not yet recorded in `state.json` |
| `review` | Continue at Step 8 above. A recorded review-wave launch (`reviewWave.taskId`, `reviewWave.wfRunId`, `reviewWave.wfScriptPath` in `state.json`) is awaited or relaunched like the `launched` row |

**Retrying a stopped seat** (both methods). A `resumeFromRunId` relaunch replays the cached result of every stage whose prompt did not change, a stopped one included (a stopped seat is a completed agent call); Method B's resumed `next` re-dispatches only a stage with no recorded `stage-result`, and a stopped stage has one; a fresh launch with the same args re-runs every stage from the start, a finished planner included (it has no rerun check). Procedure: fix the cause (for an F8 gap: reload, then re-check F8); finish post-run so the run closes; for each stopped item whose planner stage returned done and whose role is still queue, send `advance` `transition` `start` token-less (the run is closed), so the next snapshot reads it as a work-role resume candidate with no planner stage; an element error (`gate_blocked` or any other) leaves it in queue and the re-plan runs its planner; then re-plan from Step 2. Never relaunch the same args fresh to retry.

**Warning on re-plans:** an `unblockAt: work` in-run edge holds for the first launch only. Once the blocker has entered work, a re-plan reads the edge as satisfied and admits the dependents with no wait. Finish the blocker in its own run before re-planning its dependents.

A `closed` run is finished — `runs_read` `list` with `status: "open"` never returns it, and a stale
pointer line in `run-pointers` (or `session-tracking`) pointing at a closed run is stale prose, not a live run.

---

## See also

- `references/snapshot.md` — the `run-wave/snapshot-v1` field reference Step 2 fills.
- `references/method-b.md` — the direct-Agent-dispatch execution loop used when `Workflow` is
  unavailable or Step 0 selects Method B, including scheduling, per-batch seat assignment,
  envelope handling, the declarations scan, and the degradations Method B declares relative to
  Method A.
- `references/code-mode.md` — the script recipes for a Code Mode session: one per mechanical orchestrator step (F7, probe, snapshot and plan; worktrees, open, parent check and assign; adopt-notes; the Method A launch; Method B dispatch and collect; post-run Steps 0 to 3, the Step 4 advance, generic review dispatch, the reports and the Step 7 close), with a Coverage table naming the recipe or `prose` for every step.
- `references/post-run.md` — the post-run protocol shared by both methods: the end-seats
  sweep, result verification, the notes audit, note-filling, the batched `advance` call, review
  hand-off, close, and the human checkpoints that close out a run.
- `/status-progression` — for a single item's own advance/gate state outside a run plan.
- `/ralph` — for headless, unattended queue draining instead of an interactive run plan.
- `/session-retrospective --run <runId>` — the retrospective scoped to this run's members (pass the
  server run id).
- The project's own workflow skill that hands a wave to this one, for Parallel-tier and
  multi-item Delegated-tier waves.

Files in this skill

  • SKILL.md15.9 KB
  • references/method-b.md8.2 KB
  • references/post-run.md8.9 KB
  • references/snapshot.md3.8 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.