--- name: orca-governed-delegation description: Use when a Brigade coordinator delegates work to local Orca workers through brigade orca. Follow the governed open, claim, worker-start, accepted, observe, ack and finalize lifecycle, and use cancel, hold-resolve and status for recovery and capacity. Checked against Orca 1.4.269. allowed-tools: Read, Grep, Bash(brigade orca:*), Bash(brigade roster ready:*) compatibility: A Linux workspace with Brigade Orca support and a compatible Orca CLI. The command is orca-ide because /usr/bin/orca is the screen reader. --- # orca-governed-delegation The coordinator owns every Orca CLI call. Brigade owns the durable enrollment, launch claim, receipt correlation, observation, acknowledgement and closeout. This skill was checked against Orca 1.4.269. On Linux, invoke Orca as `orca-ide`: `/usr/bin/orca` belongs to the screen reader. Use a `brigade.run_batch.v1` batch for ``. Brigade `open` gives you `` and ``, and `` and `` refer to the existing Orca Run and Task. Save full native receipts at the JSON paths. Use the ID from a Brigade terminal result for ``. ## Call order Before the initial claim, run `brigade roster ready --route orca --worker --target --json` on the coordinator with the PATH you will use to launch. Proceed only on `ready`. After upgrading Orca, set the seat's `orca_version` to the exact installed version, rerun readiness, and use a fresh enrollment for new work. Keep the original enrollment and retry keys for retained work. After step 1, the coordinator may run steps 2 through 4 concurrently across tasks. Keep the steps in order within each task and save each task's argv and replies separately. Join the launch chains before starting steps 5 and 6. Report every attempted start to `accepted` and acknowledge definite start refusals before closeout. A refused claim ends before worker-start. A reported ambiguous start keeps its slot and follows the recovery rules while correlated siblings proceed to closeout. Steps 5 and 6 can also run concurrently across tasks, in order within each task. `claim` has up to five seconds to acquire the capacity and run locks. It releases capacity before each wait to retry a busy run lock. `accepted`, `observe`, `ack`, `cancel`, and `hold-resolve` wait up to five seconds for the workspace run lock. On `run-busy`, let other chains continue and retry just the Brigade command with the same arguments. Replay `accepted` with the saved receipt and exit code. On `capacity-lock`, retry the same claim after contention clears. On `capacity-denied`, retry only once capacity is available. Use `status` and the recovery rules for other claim refusals. 1. Enroll the batch: `brigade orca open --target `. It prints a Brigade run and task identity and launches nothing. If it refuses with `orca-unsupported`, route that work through `brigade run batch`. Other refusals are not permission to try another path. 2. Claim exactly one task: `brigade orca claim --orca-run --orca-task --target `. The output contains the exact `orca-ide orchestration worker-start` argv. 3. Run that printed argv as the coordinator. Preserve it exactly, including `--retry-request`, the existing Run and Task, and its other arguments. 4. Record the full worker-start JSON and its exit code: `brigade orca accepted --native-json --exit-code --target `. Report every receipt to Brigade, including refusals. An unreported start is a worker Brigade cannot see. Definite refusals (`start-refused`, `circuit-broken`, or `start-failed`) return a `result_id`. Acknowledge it with `brigade orca ack --result-id --target `. Until then the task holds capacity as `awaiting-ack`. 5. A successful `accepted` prints `observe_argv`, `inbox_argv` and `transcript_argv`. Use the exact `observe_argv` to capture full `worker-show --json --full` evidence. Poll if the worker is still active. Submit interim snapshots to `observe` if you need to record their state. When the dispatch is completed or failed, run the printed `inbox_argv`. After Orca releases the worker, capture a fresh full show and run the printed `transcript_argv`. Reuse the first show if it already proves release. Save the full replies and submit them together with `brigade orca observe --native-json --worker-done-json --transcript-json --target `. The transcript argv is for `orca-ide orchestration worker-read --environment local --dispatch --source transcript --json`. If `result.transcript.limited` is true, repeat that argv with `--cursor` and `result.transcript.nextCursor` as one argument. Continue through `limited: false` and pass a JSON array of the full replies in read order, including any empty final page. Brigade accepts up to eight replies. A source change requires a fresh read from page one. An exact transcript clipped as `transcript_payload` can settle when it ends with non-empty assistant text. The resulting observation receipt reports `transcript_clipped: true`. The printed `inbox_argv` includes the required `--run` and `--limit` arguments. Read mail with `inbox --full`, never `check`, because `check` marks mail read. `worker-show` alone is not acceptance. The 1.4.269 "brief may not have been submitted" notice is neither acceptance nor acknowledgement. Without the matching worker_done report and complete transcript, observation remains `result-transfer-missing` and no terminal result is available to ack. 6. Acknowledge the returned result with `brigade orca ack --result-id --target `. When the preceding observation proved release, ack frees the slot. If Brigade recorded a terminal result before release, wait for Orca to release the worker. For a cancelled worker, after a confirmed stop, use the fresh full show alone to verify release. A cancelled worker may not produce a worker_done report or transcript. Submit the fresh show with `brigade orca observe --native-json --target `. The retained terminal result lets Brigade check release with the show alone. `release-unverified` blocks finalization until Brigade records that release. `finalize` fails immediately if the workspace run lock is held. After every task's closeout chain finishes, run `brigade orca finalize --target ` once. Then run `brigade orca status --json --target ` once to confirm that the run closed with zero live capacity. ## Recovery and capacity - After a lost reply, reuse the same `--retry-request` id and exact printed worker-start argv. Never start a new Orca Run or Task to get around the circuit breaker. Do not invent a new request id or launch a replacement. - `outcome_unknown` means the start outcome is uncertain. Use `brigade orca hold-resolve --native-json --exit-code --show-json --target ` only with recovered start evidence. `hold-resolve` can also clear an `accept-conflict` hold when the recovered evidence matches the retained worker. `brigade orca hold-resolve --abandon --target ` writes a permanent `abandoned-unknown` hold. It frees no slot, `finalize` refuses it, and an operator must follow up. Do not use `hold-resolve` to settle a worker stop. - For a full `failed` worker-start receipt with residual resources, keep the original receipt and its exit code. Capture a fresh `worker-show --json --full` for the same dispatch after release. Supply the receipt with `--native-json` and the snapshot with `--show-json` to `accepted` or `hold-resolve`. A snapshot that proves release and exited liveness settles `start-failed`. Acknowledge the returned result ID to free the slot before `finalize`. If either proof is missing, `start-unknown` still holds the slot. Report a retained worktree to the operator when the refusal response or task row in `brigade orca status --json` shows `worktree_retained: true`. Status keeps the flag after acknowledgement. - Request cancellation with `brigade orca cancel --target `. Run the printed `orca-ide orchestration worker-stop` argv. If it reports `stop_unknown`, rerun that same printed argv with the same `--retry-request`, then report again through `cancel`. A stop request is not proof of cancellation. The full report form is `brigade orca cancel --native-json --exit-code --show-json --target `. `--native-json` and `--exit-code` must be supplied together. - Inspect state and workspace capacity with `brigade orca status --json --target `. Status is read-only. - Only Brigade `ack` acknowledges a terminal result. Orca worker state, mail, delivery notices and a start receipt do not substitute for it. ## Commands The supported Brigade verbs are `open`, `claim`, `accepted`, `observe`, `ack`, `finalize`, `cancel`, `hold-resolve` and `status`. Follow each printed native argv exactly and retain its receipts for the matching Brigade verb.