/rig:orchestrate [recipe (defaults to the currently composed harness)] [--run] [--provider rig|claude|mock] [--isolate] [--auto-route] [--max-parallel N] [--quorum all|majority] [--plan]from rig
rig/orchestrate — computational orchestration. A deterministic runner (scripts/orchestrate.py) enforces a recipe's step transitions, gates, retries, stopping, and state in code. `run` executes each step as a rig harness in its own process, with parallel verification across providers.
Ships in rig. Installing the plugin adds it to Claude Code.
Start the rig:engine skill with the Skill tool first and follow its SKILL.md. This command is the way into --orchestrate: the mode where code holds the wheel. The control loop — which step is next, whether a gate passed, retries, stopping conditions, keeping state — is enforced by scripts/orchestrate.py, a deterministic runner, rather than by prose. patterns/computational-orchestration holds the procedure and the contracts.
$ARGUMENTS
For an explicitly requested waterfall or iterative lifecycle, use
scripts/orchestrate.py lifecycle template|init|decide|revise|status and
the lifecycle guide. Prepare a structured proposal,
show its revision, scope and stage digest, and obtain the user's decision about
that proposal before recording it. Do not infer approval from generated prose.
Initialization calls no provider; resume <state> --progress starts only work
permitted by the upstream gate. Preserve the same state through revisions and
rejections. This is separate from ordinary plan and legacy approve.
1. Semi-automatic (the model does each step's work) The runner decides the transitions; the model executes each step by delegation:
orchestrate plan <recipe> # compute the step state machine (the equivalent of --plan; no model needed)
orchestrate init <recipe> [--goal G] # create the run-state and the first action
orchestrate next run-state.json # compute the next transition deterministically (START/ADVANCE/RETRY/AWAIT/BLOCKED/ESCALATE/DONE)
orchestrate check run-state.json # run the step's checks: (lint, tests) — the computational sensors
orchestrate verdict run-state.json --by <reviewer> --pass|--fail # an independent verifier's judgement (grader != generator)
2. Fully automatic (each step runs as a rig harness in its own process)
orchestrate run <recipe> --provider rig --isolate \ # worktree isolation; only green fast-forwards back
[--verifier-provider rig] [--max-parallel N] [--quorum all|majority] [--goal G]
--provider rig: each step runs as a separate process started through the rig:engine skill — rig calling rig by name, a recursive harness. The alternatives are claude, codex, grok (grok-build headless, grok -p; its read-only and sandbox flags are undocumented, so a verifier's read-only constraint is a prompt contract only — #328), ollama and lmstudio (local, OpenAI-compatible), anthropic (the Anthropic Messages API over HTTP; detects Fable 5's refusal classifier and the fallback — #297, see 5 below), cmd (any CLI), and mock. Local models take --model <name> (ollama defaults to llama3.1) and --base-url <url>, and need the server running.--auto-route (#264): choose deterministically among a step's auto_route.candidates — a list of {model, cost_tier, max_size} declared cheapest first — according to the current diff size, measured the same way --diff-git measures it. A step that declares no auto_route is untouched, and its existing model: or --model still wins. The reason for each choice is recorded in the run-state's history (action: AUTO_ROUTE) and in runs.jsonl under steps[].auto_route.--auto-route-learn (#305): takes --auto-route further by learning from .rig/runs.jsonl — which models were used per recipe and step, and how often they passed the gate — on frequency. It runs in shadow mode by default: the prediction is recorded in steps[].learned_route and does not affect the choice. --auto-route-mode active is what applies it. With too few reference runs or a low pass rate it falls back to static --auto-route and always records the counterfactual — why the prediction was rejected. --exploration-pct N [--exploration-date D] tries the runner-up on a fraction of runs, decided deterministically from --exploration-date and a hash of the recipe and step. No randomness.3. Discovering models dynamically (configure what is actually available)
orchestrate models [--save] [--json] # discover the running LLM servers and CLIs
orchestrate run <recipe> --provider ollama --auto-model # pick a model from what is really there
models calls /v1/models on ollama and lmstudio to fetch the available models live, and reports whether the claude, codex, and rig CLIs are present. --save writes ~/.claude/rig/models.json, which --auto-model reads next time.--auto-model (also --auto-model-setting): with no --model, resolve one from the saved settings, then the first entry from a live /v1/models, then the default. A missing server falls back to the default rather than crashing.4. Testing a provider end to end (probe)
orchestrate probe --provider codex # one call in the verifier role, checking for a VERDICT
orchestrate probe --provider codex --role generator
orchestrate probe --provider ollama --model llama3.1
Runs the provider exactly once and shows (1) the command or endpoint actually used, (2) the exit code, (3) the raw output, and (4) whether the contract (VERDICT or STATUS) parses. Exit 0 means rig can use it. On a ✗, match the real command and flags with --provider-cmd "codex exec --... {prompt}" (the cmd provider).
personas fan out into concurrent processes (--max-parallel). Aggregation is deterministic (--quorum all for unanimity, majority for a majority).--generators rig,claude,codex has several models generate the same step in parallel, and the judge picks the first candidate to PASS — in list order, so it is deterministic.needs: [id…], independent steps whose dependencies are met run concurrently in the same wave (intake → design and test together → merge).VERDICT: PASS|FAIL.5. Fable 5's refusal classifier and the fallback (--provider anthropic, #297)
orchestrate run <recipe> --provider anthropic --model claude-fable-5 --step-model <id>=<model>
--provider anthropic calls the Anthropic Messages API directly over HTTP rather than through the claude or rig CLI providers — a CLI runs with --output-format text and so has no structured stop_reason. Setting fallback_model in cfg (claude-opus-4-8, say) requests anthropic-beta: server-side-fallback-2026-06-01, and when Fable 5's refusal classifier fires (cyber, bio, or reasoning_extraction) the server falls back to Opus 4.8 transparently.
FABLE_FALLBACK (from and to model) goes into state["history"] and the gate is not stopped — the step's result is handled as usual, which is what #297 asked for.FABLE_REFUSAL (category and explanation) is recorded and the step is told through rc=1. Never a silent failure.usage.input_tokens, usage.output_tokens, and usage.cache_read_input_tokens (the fallen-back prefix is billed at 10%) are aggregated into runs --cost's anthropic row, and the counts of fallbacks and refusals appear at the end of the summary.If you assign Fable 5 with --step-model to a persona whose job is discussing attack techniques — security-reviewer and its kin — always set fallback_model (see agents/security-reviewer.md).
What was actually verified: a mock HTTP server reproducing the Anthropic Messages API's response shapes confirmed all three paths — direct refusal, server-side fallback, ordinary success. It has never been pointed at the real Anthropic API, to avoid the cost and the production risk, so a real model actually returning stop_reason: refusal, and the real billing of a fallback, remain unverified.
6. A/B experiments between recipes (ab, #291)
orchestrate ab <recipe1> <recipe2> [...] --provider mock --goal "<goal>" [--verifier-provider V] [--max-steps N]
Runs the same task through several recipe variants genuinely in parallel and compares elapsed time, retry count, and final state. Each variant runs independently in an isolated worktree, exactly as under --isolate, so there is no file contention and a ThreadPoolExecutor is safe. The premise is that you are comparing recipes, not models or providers — one provider is given, shared by every variant.
## rig ab — recipes/bugfix.md vs recipes/hotfix.md
recipe final elapsed(s) retries worktree
bugfix DONE 42.3 0 -
hotfix DONE 18.7 1 -
A variant that did not finish, or whose tree is dirty, keeps its worktree (the same rule as --isolate). Clean up with git worktree remove --force <dir>.
A/B on rules (differing manifests, #317): run one recipe under two conditions that differ only in the manifest. This answers a practical finding — a change that adds a rule cannot be evaluated statically; the only way to compare is to run real tasks.
orchestrate ab <recipe> --manifest-a <path> --manifest-b <path> --provider mock --goal "<goal>"
Each variant gets its manifest written as .claude/rig.md inside its own worktree (the main working tree is never touched), and its content hash is recorded in the trust store — passing it explicitly on the CLI is the consent, the same consent model as --allow-project-manifest. Rows in the comparison are labelled A(<stem>) and B(<stem>) so it is clear which manifest each was. The honest scope: a variant's manifest takes effect in the nested provider calls that run with the worktree as their cwd, because that is how a manifest is resolved. The parent orchestrate process's own load_manifest() — the size classification behind --auto-route, for instance — keeps reading the calling repository's manifest. Recipe, provider, and model are shared by every variant: what is being measured is only the difference in the rules.
7. Turning gap prescriptions into a forge draft (runs, #268)
orchestrate runs
Where the same (recipe, step) pair has escalated twice or more, "## Gap prescriptions" prints a concrete /rig:forge draft request — identifying the three reviewers that REJECTed at that step most often from the verdict records (steps[].verdicts) and writing them into the description. orchestrate.py never calls forge itself, since that needs a model; what it produces is a forge prompt you can paste. A person or an AI reviews and settles the draft, and /rig:drill --replay measures whether it improved anything.
8. Delegating to the Managed Agents API (the review-gate fan-out; experimental, opt-in, #295)
cfg["parallel_backend"] = "managed-agents"
cfg["environment_id"] = "<the Managed Agents host environment id>" # required
_execute_step's parallel review-gate verification uses run_verifiers_parallel (subprocesses and a ThreadPoolExecutor) by default. Only when cfg["parallel_backend"] == "managed-agents" does run_managed_agents_fanout delegate to the Anthropic Managed Agents API — the coordinator-and-worker beta, managed-agents-2026-04-01. The default path is completely unchanged. One worker agent is created per persona, and a coordinator that only judges gathers them. It polls threads.list and stops when every worker has reported or managed_agents_max_polls is reached (30 by default, managed_agents_poll_interval 2 seconds). The return shape matches run_verifiers_parallel — a list of {by, persona, provider, ok, note} — so _execute_step's pass and fail logic needs no change.
cfg["environment_id"], the Managed Agents host environment. Unset, it returns an error verdict immediately rather than failing silently.max_polls runs out is recorded explicitly as a timeout verdict, never quietly dropped.usage is aggregated into cfg["_token_usage"]["managed-agents"], the same path runs --cost reads.MANAGED_AGENTS_SESSION action (session id, worker count) is recorded in state["history"]. Integrating the event stream itself with the run-continuity header is not implemented.What was actually verified: the REST endpoint paths (/v1/agents and the rest) are inferred from the official Python SDK's method names (client.beta.agents.create and so on; see managed_agents/CMA_plan_big_execute_small.ipynb in anthropics/claude-cookbooks) rather than read from an official REST reference. A mock HTTP server verified the whole call order — creating workers and the coordinator, creating the session, sending events, polling threads, aggregating, and the error path when environment_id is unset — but it has never been connected to the real API. Context isolation between workers and the coordinator is a property of Anthropic's server and cannot be verified from client code; what was verified here is only that rig's own code never requests or forwards raw worker output and reads only the final result the API returned.
Even without an explicit --orchestrate, a run goes through orchestrate when (§4.3):
checks: or needs: — a recipe that means to be run deterministically, through machine verification or DAG parallelism; ordefault_orchestrate: true — a project-wide default.--no-orchestrate returns that one run to the prose engine. It does not affect single-shot generators such as /rig:persona. The plan output says auto orchestrate: auto ON/off.
harness-taxonomy). Transitions, stopping, and retries are held by code.run-state.json, so the same state machine resumes across compaction and restarts — the computational version of run-continuity.Use run ... --progress (or resume <state.json> --progress) for runner-owned,
flushed stderr events: preparation, generation, checks, reviews, transitions,
waiting time and the terminal summary. Raw provider output is not streamed.
status <state.json> --json is a read-only last saved snapshot, not proof that
a process is alive or evidence remains fresh. Before the first legacy step ends,
there may be no state file yet. Heartbeats mean waiting for a result, not measured
work completion; never invent a percentage.
For an explicitly requested long run in interactive Claude Code only:
run_in_background: true, an explicit --out path and
--progress. Keep the returned task ID and output-file path. A foreground
subagent must not launch a long command and then end its own turn.--progress), this is the
one exception to patterns/monitor's "do not poll the output": read bounded
new portions of that output file with Read at reasonable intervals. Without
--progress, do not read it; wait for the completion notification. Use TaskOutput only as a compatibility fallback when available;
current Claude Code marks it deprecated. Relay observed phase changes and,
during long waits, the reported elapsed waiting time. Before a state exists,
use this output; do not infer failure from an absent first checkpoint.resume verifies and computes one transition; it does not rerun the
whole autonomous loop. Strict resume continues its saved strict workflow.These monitoring instructions do not apply to provider subprocesses, headless runs or CI. They introduce no hook or automatic conversation routing. See Claude Code's background command tools and interactive background Bash guidance.
--provider rig and claude start claude nested — mind the cost and the recursion. Check a design with --provider mock, a separate process that returns a deterministic dummy immediately.ESCALATE (no infinite loops), and self-grading (by=self) means BLOCKED.orchestrate selftest.While a RUN is active, restate this run-status header as a single line at the top of every turn. Do not drop it right after an interruption, a question, or tool output — the visibility is the evidence that the harness is driving:
▸ rig | recipe: <name[tier]|ad-hoc> | step: <id> (<n>/<N>) | gate: <none|pending|passed|REJECT> | backend: <manual|workflow> | mode: <gated|autonomous>
Exception (SKILL.md §6 ①): a turn woken only by a <task-notification> whose status is completed and whose result is only the harness's already-delivered sentence (the report was delivered to you as a message and is not repeated) gets no header and no narration; a result that merely quotes that sentence is not exempt, and a failed, killed or stopped notification never is.
What the command file sets; muted values are Claude Code's defaults
7-day visitors to each command page
npx claudepluginhub itoh-shun/rig --plugin rig30 commands in this plugin
/brainstormrig/brainstorm — thinking a design through 💭rig/brainstorm — think a rough idea through: questions, alternatives, and agreement section by section. It comes before implementation and task-splitting, settling what to build, why, and in what order, so nothing goes into implementation still vague. Converges on a design brief and hands off to /rig:tasks or /rig:dev./catalogrig/catalog — the cross-tier registryrig/catalog — the cross-tier registry. Walks every tier (shipped, global, project) and shows the map of domain x pack x persona x wiki x recipe, so you can see again who is doing what where. Read-only./designrig/design — designing and auditing 🎨rig/design — a design harness with UI/UX and accessibility built in. From a description it produces a specification, component specs, wireframes, and an accessibility plan, then vets them against UI/UX heuristics and WCAG. Given a URL it fetches the running screen with Playwright and audits it. --ppt and --claudedesign add output formats./devrig — the dev-flow orchestratorrig — a LEGO-style dev-flow orchestrator. Composes facet, pattern, step, and recipe bricks at invocation time into a harness built for the task at hand: review, implement, PR, and so on./drillrig/drill — measuring reviewer detection 🎯rig/drill — measure what reviewers actually catch, by mutation drill. Seeds known bugs into a worktree, runs the review fan-out, and scores which reviewer caught what. --replay re-runs an edited persona over archived diffs and diffs the verdicts. Turns persona quality from an opinion into a number./exportrig/export — write a brick out as a skill 📤rig/export — give back what rig grew: write a persona, recipe, or pack out as a standalone Claude Code skill. Strips rig's own vocabulary so the result is self-contained, and carries provenance and licence with it. The counterpart to import: this returns things to the network.Other plugins' commands for the same job