Appearance
Orchestration
Nine orchestration workflows that decide how to run at runtime instead of following one fixed pipeline. Each picks its strategy, its effort, or its work breakdown from the task in front of it, so a one line lookup does not pay for a research fan out and a hard task is not capped at a single pass. They run in session through Claude Code's Workflow tool, each standalone – pick one, ignore the rest – and every one watches the token budget, scaling its fan out to what is left and skipping the heavy stages when it runs low.
In Practice
Every workflow runs the same way, in session through the Workflow tool, with the task passed as args:
Workflow({ scriptPath: "harness/orchestration/smart.workflow.js", args: "your task here" })They fan out agents, so they need the ultracode opt in. What differs is how each one spends that fan out.
Reach for smart when you do not know how hard the task is. One cheap triage agent sizes the job in a single pass – trivial, effort, decompose, contested – then takes the lightest route that clears a strict gate, so it never over spends on something small:
The return is { path, result }, where path names the route it actually took – direct, attempt, deepen:orchestrate, deepen:debate, deepen:panel, or attempt-capped when the budget runs thin.
Spend cheap first with escalate. A low effort pass answers directly, a strict gate judges it, and the thorough three angle panel (completeness, correctness, the edge cases the cheap pass missed) only runs when the cheap answer falls short:
Workflow({ scriptPath: "harness/orchestration/escalate.workflow.js", args: "your task here" })Most tasks clear cheap and come back { tier: 'cheap' }; only the ones that fail the gate pay for { tier: 'thorough' }.
Buy top model quality at crew prices with foreman. fable plans the task into subtasks with per subtask done criteria, the cheaper crew does the work – sonnet on easy subtasks, opus on hard ones – fable checks every output against its criteria, and a stray gets one correction round before fable merges. Pass args.worker to force one crew model for everything:
Workflow({ scriptPath: "harness/orchestration/foreman.workflow.js", args: { task: "your task here", worker: "opus" } })It is the only workflow here that pins models instead of inheriting the session model, and it reads its tier map from routing.nuon at stage 0.
Break a wall with unstick. The worker attempts the task under a no bluffing rule and reports the exact blocker rather than guessing past it. The lesson store is checked first, then three web search angles fan out on the blocker (verbatim error, official docs, known issues), a ranker turns the findings into fixes, and the retry gets them as notes. Hitting the same wall twice ends the loop, because more searching will not save it.
An example outcome. A one line lookup handed to smart comes back as { path: 'direct', result } after two agent calls; the same call on a big, splittable task returns { path: 'deepen:orchestrate', result } with the work fanned across workers scaled to the budget. And when unstick is rescued by a web found fix, it banks the blocker, cause, and fix back to the lesson store before returning, so the next session skips the search.
One caveat on nesting. smart calls orchestrate and debate, and router calls debate, and workflows nest only one level deep, so run smart and router at the top level, never from inside another workflow.
Capstones
smart.workflow.js
The composed one – cheap triage picks the path, early exits stop it spending when a lighter stage is good enough, and budget gates keep it from going heavy on a tight budget. It distils route, escalate, and orchestrate into one frugal flow through four phases: Triage, Attempt, Gate, Deepen. It calls orchestrate and debate as optional sub workflows and falls back to its own panel when either is missing. A failed gate also banks the shortfall to the lesson store.
router.workflow.js
The dispatcher – it classifies the task into one of five routes then runs only the strategy shaped for that kind of work: research fans searchers out across angles and synthesizes, review judges across dimensions and merges, bug-hunt finds candidate bugs then adversarially verifies each and keeps only the confirmed, contested runs a debate, and explain takes one careful deep pass. An unrecognised route defaults to explain.
Strategies
escalate.workflow.js
Cheap first – a low effort pass, a strict gate, and the thorough panel only when the cheap answer does not clear the bar. Effort in proportion to difficulty, and a thin budget keeps the cheap answer rather than escalating.
speculate.workflow.js
Latency hiding – it runs the cheap and thorough passes at the same time, then a judge ships the cheap answer when the two agree and takes the thorough one when they disagree. It spends tokens to save wall time, hiding the heavy pass behind the cheap one; below the floor it runs the cheap pass alone.
orchestrate.workflow.js
Runtime decomposition – a planner breaks the task into independent subtasks, one worker runs each in parallel, and a synthesizer merges. The breakdown is decided by the model, not hardcoded, and every worker brief carries the discipline block: hold to the subtask, pull lessons first, and end with a four part report.
foreman.workflow.js
Model tiered – fable plans with done criteria and merges, the cheaper crew does the bulk work, and fable polices every output against the criteria it wrote, giving a stray one correction round. args.worker forces one crew model for all subtasks, and the tier map comes from routing.nuon with { easy: 'sonnet', hard: 'opus' } as the builtin fallback.
debate.workflow.js
Consensus through disagreement – several agents answer independently from distinct stances so no one anchors, each revises after reading the others, and a judge keeps what survived. Three debaters is the useful minimum, scaled up on a fat budget.
reflexion.workflow.js
Self assessing loop – draft, a strict critic scores it 1 to 10 and lists concrete fixes, refine on those fixes, and loop only while the score keeps climbing. It stops at the bar (8 by default), when a round stops improving, or at the round cap, and always ships the best draft it saw. This is the generic version of skill-smith's loop.
unstick.workflow.js
Self rescuing loop – the worker surfaces the exact blocker instead of grinding, the lesson store is checked before the web, then searchers fan out on the blocker and a ranker turns findings into fixes for the retry. A win from the store bumps that lesson's hit count, a win from the web is banked as a new gotcha, and the same wall twice ends the loop.
References
patterns.md
The catalogue – the full set of orchestration patterns, the ones with a script and the ones worth reaching for without one, plus a picking guide (unknown task type goes to route, latency over cost goes to speculate, top model quality on a small budget goes to foreman, and so on).
routing.nuon
The tier map – the NUON record mapping easy and hard to model names that foreman reads at stage 0, installed as .claude/workflows/routing.nuon. Retune the difficulty to model tiering here without touching the workflow; a missing or unparseable file degrades to the builtin fallback.
Budget Convention
Every workflow here is budget-aware, a hard convention in this kit. Each reads the token budget and does two things with it: it gates its heaviest stage behind a floor, so it will not start an expensive fan out on the dregs of a budget, and it scales its worker, debater, or verify count to what is left. The shared move is one line:
js
const fleet = budget.total ? Math.floor(budget.total / 100000) : 4The floors, and the stage each one guards:
| Workflow | Floor | Guards |
|---|---|---|
smart | 40k | starting the Deepen stage |
escalate | 40k | the thorough panel |
speculate | 40k | racing the thorough pass at all |
debate | 40k | the revise round |
reflexion | 30k | another refine round |
foreman | 30k | a correction round on a stray |
unstick | 30k | another search and retry round |
orchestrate and router carry no named floor but still scale their fan out to budget.remaining() – the worker count for orchestrate, how many bug claims to verify for router. With no budget directive set, budget.total is unset and every workflow runs its full path; the gates only bite once a budget is in play.
Connects to
- Threads through memory –
smart's gate andforeman's check bank shortfalls to.claude/memory/lessons.nuasprocesslessons,orchestrateandforemanworkers pull lessons before starting, andunstickchecks the store before searching then banks a web found fix as agotcha. - reflexion is the generic form of the self critique loop skill-smith runs to refine a skill against its rubric.
- Installed by the installer into
.claude/workflows/, wheresmart's androuter's sub workflow names (orchestrate,debate) resolve andforemanfindsrouting.nuon. - The ideation counterpart diverge ships alongside these in orchestration/, but inverts the job: they decide how to run a task, it generates what to try.