using-workflows
You pick which recipe the situation needs, fill its args, run it, and keep
the closed loop moving. You are not a recipe.
BYPASS — check FIRST
One bounded task, single context, no stages, no convergence condition → do it
directly (inline, or one worker via using-tmux-agent-tools). No recipe, no
run dir. When in doubt, bypass — recipes exist for loops, not ceremony.
Red flags that have actually burned us (naming one and proceeding anyway
requires a stated reason):
- 「我記得那支 recipe 內容」— recipes evolve; read the header comment (the
args contract) before running. Never guess args.
- 「先做完再補 run record」— if it meets the run-dir bar below, open it first.
- 「這個小改不用 gate」— behavior-tier edits to any recipe DO need one
consensus-gate round first.
Subagent exemption: delegated workers never enter this router — the
dispatcher already routed; workers follow their brief.
TRIGGER
Loop-shaped work: stages plus a convergence condition. Audit chains,
consensus review, plan→build lifecycles, findings triage.
From the Continuity trigger (global CLAUDE.md/AGENTS.md)
The global rule routes loop-shaped work here at task start. On arrival:
- Match the trigger word (audit / consensus verification / findings triage /
root-cause deep-dive / plan→build) to a recipe via SELECT below.
- Runtime split: Claude invokes the recipe natively via
Workflow; Codex
commands it through references/codex-adapter.md (claude-workflow-runner)
— the runner is mechanical, so run it at opus effort low (the floor;
see MODEL FLOOR below).
- Write-back duty: every recipe artifact/result lands in the CALLER's
.workflow/<YYYYMMDDHHMM>-<slug>/ run directory (the one the Continuity
rule had you create) — never a detached location. One task = one run dir,
shared by convention and recipe alike.
SELECT
Discover live — never recite the recipe list from memory:
ls ~/.claude/workflows/*.workflow.js .claude/workflows/*.workflow.js 2>/dev/null
The inner loop (the ONLY loop — there is no scheduling outer ring; do not
invent one):
audit (docs-vs-code | design-vs-code | root-cause-deep-dive)
→ findings-triage connector ①: askUser → human VERBATIM ·
│ briefs → lifecycle · directFix → partitioned run
→ feature-lifecycle-auto thin shell: feature-plan-consensus | plan-pipeline
│ → gate ✋ (autoBuild=false: human reads the plan)
│ → spec-implement-dual-review-verify
→ re-run the ORIGINATING audit, SAME args
│ connector ②: lives in YOU, not in code
→ confirmed == 0 → converged, report · else → back to findings-triage
Entry points off the loop:
- weird bug →
root-cause-deep-dive-audit · docs/design drifted → the matching audit
- ONE artifact needs a second-model verdict →
consensus-gate — ONE round,
irreversible/behavior-tier changes only; NOT a default station
- N-angle generative design consensus →
design-consensus
- "what should this project do next" →
project-direction-review
- recipe fleet inventory / machine drift →
workflow-manifest
Stage recipes (feature-plan-consensus, plan-pipeline,
spec-implement-dual-review-verify) are normally reached THROUGH
feature-lifecycle-auto; call one directly only when you want just that stage.
Args auto-fill: cli is OPTIONAL (user ruling 2026-09-02: never depend on
codex). Any installed agent-tmux profile is a valid review gate — codex,
claude-fable-opus / claude-fable-gate*, cursor (grok), agy* — pick
one that differs from the substantive author; discover the list live with
ls ~/.config/agent-tmux/profiles. OMIT it and every stage runs a FRESH
Claude opus reviewer in an independent context. Never hard-code a name,
never block a run on an external CLI that is not installed. context = one line (repo abs path + stack +
scope). Prefer name invocation over scriptPath.
MODEL FLOOR (user ruling 2026-09-02)
Every recipe agent runs at least opus effort low; the default worker is
opus effort medium, reviewers high. Planning, synthesis,
revision, critique, review, and verdicts NEVER run on sonnet — a sonnet-
written plan is not a plan. sonnet is permitted in exactly two roles, and
only by explicit arg: implementation (spec-implement… model,
pr-review-triage-resolve fixModel) and read-only data gathering
(feature-plan-consensus discoverModel). Reviewers stay opus regardless.
ADVISOR GATE (user ruling 2026-09-02)
Recipes cannot call tools; the gate lives in YOU, the commander. When the
advisor tool is available it is MANDATORY at these points, and the
verdict is recorded in the run dir before the next action:
- BEFORE the first
Workflow launch — brief, recipe, args (model floor,
cli omitted or justified, round caps, hard time-box).
- AT every human gate the recipe returns (
needsUser, autoBuild=false,
plan clean → build) — the plan itself, its size, and whether to build.
- BEFORE any resume / relaunch after an abort (usage limit, exhausted
ladder) — same run or narrower.
No advisor verdict → do not launch, resume, or build. The 2026-09-02
quick-share run (32 plan agents, 182M input tokens, 64 KB plan, zero code
for 3.5 h) went uncaught because no gate sat between "plan rev N" and
"critic round N+1".
Cross-runtime execution
Both runtimes RUN recipes through this router; only the execution vehicle
differs. Claude Code executes .workflow.js natively with Workflow().
Codex executes via ADAPTED: claude-workflow-runner (one bounded Claude
runner capsule — mechanics in references/codex-adapter.md), under these
constraints (Codex-authored, gate-v2 2026-07-19):
- Codex MUST freeze recipe name, args, acceptance, author runtime, and reviewer profile before dispatching exactly one Claude runner.
- The runner MUST invoke exactly one native
Workflow(...), preserve its return under recipe_result, write schema-v1 result.json, then stop.
- Any later exception MUST cap nesting at 2, declare child profiles/round ceilings, use unique sessions plus wait-required results, and forbid children from spawning.
args.cli is optional: when set, resolve it by the substantive author under review (a non-Codex profile when Codex authored the target); when unclear, OMIT it — the recipe's fresh Claude opus reviewer is the default second brain.
- Human gates MUST return
status: paused plus next_action, preserve recipe_result, stop the runner, and resume only via a new explicitly approved invocation.
- Evidence MUST say
recipe <name> executed natively on Claude runtime via runner (commanded by Codex); adapter or child failure is never recipe PASS.
Runtime matrix (Claude Code = NATIVE for all 13; Codex column):
| Recipe |
Codex |
3 audits, findings-triage, design-consensus, project-direction-review, workflow-manifest (7, no tmux inside) |
ADAPTED: claude-workflow-runner |
pr-review-triage-resolve (no tmux; T3 rung = fresh Claude opus unless externalAgentType is set) |
UNTESTED — only run natively on Claude so far; stop and report |
consensus-gate (simple verdict outcome only) |
ADAPTED: direct-claude-review — references/codex-adapter.md |
consensus-gate (as recipe), lifecycle + its 3 stages when cli IS set (5, they launch agent-tmux inside) |
UNAVAILABLE-NATIVE until nested-runner (depth-2) tests pass — stop and report; do not improvise |
DEFER
- Chain recipes from the TOP level only —
workflow() nesting cap is 1, and
the lifecycle shell spends it.
- Run dir (
.workflow/<slug>/, codex-dynamic-workflows conventions) ONLY
when work spans days, has 2+ phases, or must survive interruption/handoff.
Within-chat work: a single results file, or nothing.
- Recipe edits: behavior-tier → consensus-gate one round FIRST; wording →
direct. Canonical = the agent-scripts repo bundle
(
skills/using-workflows/workflows/) → redeploy to ~/.claude/workflows/;
a live edit made machine-side must be folded back into the bundle in the
same change.
NOT-FOUND
No recipe fits → the work probably is not loop-shaped; bypass. A genuinely
new loop shape → propose a new recipe to the user; never improvise a
half-recipe inline. Per-recipe reference: workflows/README.md (canonical:
agent-scripts bundle skills/using-workflows/workflows/README.md; deployed
copy at ~/.claude/workflows/README.md).
1---2name: using-workflows3description: Which workflow recipe runs this. Invoke BEFORE any of: audit (docs vs code, design vs code, root cause, project direction), review findings to triage or resolve, PR review comments, feature brief to plan, plan needs a second-model verdict, spec to implement, 「跑一輪審查」, 「幫我 plan」, 「把 findings 處理掉」. After any audit finishes, invoke again to route its findings to triage. Even a 1% chance means invoke it.4---56# using-workflows78You pick **which** recipe the situation needs, fill its args, run it, and keep9the closed loop moving. You are not a recipe.1011## BYPASS — check FIRST1213One bounded task, single context, no stages, no convergence condition → do it14directly (inline, or one worker via `using-tmux-agent-tools`). No recipe, no15run dir. When in doubt, bypass — recipes exist for loops, not ceremony.1617Red flags that have actually burned us (naming one and proceeding anyway18requires a stated reason):19- 「我記得那支 recipe 內容」— recipes evolve; read the header comment (the20 args contract) before running. Never guess args.21- 「先做完再補 run record」— if it meets the run-dir bar below, open it first.22- 「這個小改不用 gate」— behavior-tier edits to any recipe DO need one23 consensus-gate round first.2425Subagent exemption: delegated workers never enter this router — the26dispatcher already routed; workers follow their brief.2728## TRIGGER2930Loop-shaped work: stages plus a convergence condition. Audit chains,31consensus review, plan→build lifecycles, findings triage.3233### From the Continuity trigger (global CLAUDE.md/AGENTS.md)3435The global rule routes loop-shaped work here at task start. On arrival:361. Match the trigger word (audit / consensus verification / findings triage /37 root-cause deep-dive / plan→build) to a recipe via SELECT below.382. Runtime split: Claude invokes the recipe natively via `Workflow`; Codex39 commands it through `references/codex-adapter.md` (`claude-workflow-runner`)40 — the runner is mechanical, so run it at `opus` effort `low` (the floor;41 see MODEL FLOOR below).423. Write-back duty: every recipe artifact/result lands in the CALLER's43 `.workflow/<YYYYMMDDHHMM>-<slug>/` run directory (the one the Continuity44 rule had you create) — never a detached location. One task = one run dir,45 shared by convention and recipe alike.4647## SELECT4849Discover live — never recite the recipe list from memory:5051```bash52ls ~/.claude/workflows/*.workflow.js .claude/workflows/*.workflow.js 2>/dev/null53```5455The inner loop (the ONLY loop — there is no scheduling outer ring; do not56invent one):5758```59audit (docs-vs-code | design-vs-code | root-cause-deep-dive)60 → findings-triage connector ①: askUser → human VERBATIM ·61 │ briefs → lifecycle · directFix → partitioned run62 → feature-lifecycle-auto thin shell: feature-plan-consensus | plan-pipeline63 │ → gate ✋ (autoBuild=false: human reads the plan)64 │ → spec-implement-dual-review-verify65 → re-run the ORIGINATING audit, SAME args66 │ connector ②: lives in YOU, not in code67 → confirmed == 0 → converged, report · else → back to findings-triage68```6970Entry points off the loop:71- weird bug → `root-cause-deep-dive-audit` · docs/design drifted → the matching audit72- ONE artifact needs a second-model verdict → `consensus-gate` — ONE round,73 irreversible/behavior-tier changes only; NOT a default station74- N-angle generative design consensus → `design-consensus`75- "what should this project do next" → `project-direction-review`76- recipe fleet inventory / machine drift → `workflow-manifest`7778Stage recipes (`feature-plan-consensus`, `plan-pipeline`,79`spec-implement-dual-review-verify`) are normally reached THROUGH80`feature-lifecycle-auto`; call one directly only when you want just that stage.81Args auto-fill: `cli` is OPTIONAL (user ruling 2026-09-02: never depend on82codex). Any installed agent-tmux profile is a valid review gate — `codex`,83`claude-fable-opus` / `claude-fable-gate*`, `cursor` (grok), `agy*` — pick84one that differs from the substantive author; discover the list live with85`ls ~/.config/agent-tmux/profiles`. OMIT it and every stage runs a FRESH86Claude `opus` reviewer in an independent context. Never hard-code a name,87never block a run on an external CLI that is not installed. `context` = one line (repo abs path + stack +88scope). Prefer name invocation over scriptPath.8990## MODEL FLOOR (user ruling 2026-09-02)9192Every recipe agent runs at least `opus` effort `low`; the default worker is93`opus` effort `medium`, reviewers `high`. Planning, synthesis,94revision, critique, review, and verdicts NEVER run on `sonnet` — a sonnet-95written plan is not a plan. `sonnet` is permitted in exactly two roles, and96only by explicit arg: implementation (`spec-implement…` `model`,97`pr-review-triage-resolve` `fixModel`) and read-only data gathering98(`feature-plan-consensus` `discoverModel`). Reviewers stay `opus` regardless.99100## ADVISOR GATE (user ruling 2026-09-02)101102Recipes cannot call tools; the gate lives in YOU, the commander. When the103`advisor` tool is available it is MANDATORY at these points, and the104verdict is recorded in the run dir before the next action:1051. BEFORE the first `Workflow` launch — brief, recipe, args (model floor,106 `cli` omitted or justified, round caps, hard time-box).1072. AT every human gate the recipe returns (`needsUser`, `autoBuild=false`,108 plan clean → build) — the plan itself, its size, and whether to build.1093. BEFORE any resume / relaunch after an abort (usage limit, exhausted110 ladder) — same run or narrower.111No advisor verdict → do not launch, resume, or build. The 2026-09-02112quick-share run (32 plan agents, 182M input tokens, 64 KB plan, zero code113for 3.5 h) went uncaught because no gate sat between "plan rev N" and114"critic round N+1".115116## Cross-runtime execution117118Both runtimes RUN recipes through this router; only the execution vehicle119differs. Claude Code executes `.workflow.js` natively with `Workflow()`.120Codex executes via `ADAPTED: claude-workflow-runner` (one bounded Claude121runner capsule — mechanics in `references/codex-adapter.md`), under these122constraints (Codex-authored, gate-v2 2026-07-19):123124- Codex MUST freeze recipe name, args, acceptance, author runtime, and reviewer profile before dispatching exactly one Claude runner.125- The runner MUST invoke exactly one native `Workflow(...)`, preserve its return under `recipe_result`, write schema-v1 `result.json`, then stop.126- Any later exception MUST cap nesting at 2, declare child profiles/round ceilings, use unique sessions plus wait-required results, and forbid children from spawning.127- `args.cli` is optional: when set, resolve it by the substantive author under review (a non-Codex profile when Codex authored the target); when unclear, OMIT it — the recipe's fresh Claude `opus` reviewer is the default second brain.128- Human gates MUST return `status: paused` plus `next_action`, preserve `recipe_result`, stop the runner, and resume only via a new explicitly approved invocation.129- Evidence MUST say `recipe <name> executed natively on Claude runtime via runner (commanded by Codex)`; adapter or child failure is never recipe PASS.130131Runtime matrix (Claude Code = `NATIVE` for all 13; Codex column):132133| Recipe | Codex |134|---|---|135| 3 audits, `findings-triage`, `design-consensus`, `project-direction-review`, `workflow-manifest` (7, no tmux inside) | `ADAPTED: claude-workflow-runner` |136| `pr-review-triage-resolve` (no tmux; T3 rung = fresh Claude opus unless `externalAgentType` is set) | `UNTESTED` — only run natively on Claude so far; stop and report |137| `consensus-gate` (simple verdict outcome only) | `ADAPTED: direct-claude-review` — `references/codex-adapter.md` |138| `consensus-gate` (as recipe), lifecycle + its 3 stages when `cli` IS set (5, they launch agent-tmux inside) | `UNAVAILABLE-NATIVE` until nested-runner (depth-2) tests pass — stop and report; do not improvise |139140## DEFER141142- Chain recipes from the TOP level only — `workflow()` nesting cap is 1, and143 the lifecycle shell spends it.144- Run dir (`.workflow/<slug>/`, `codex-dynamic-workflows` conventions) ONLY145 when work spans days, has 2+ phases, or must survive interruption/handoff.146 Within-chat work: a single results file, or nothing.147- Recipe edits: behavior-tier → consensus-gate one round FIRST; wording →148 direct. Canonical = the agent-scripts repo bundle149 (`skills/using-workflows/workflows/`) → redeploy to `~/.claude/workflows/`;150 a live edit made machine-side must be folded back into the bundle in the151 same change.152153## NOT-FOUND154155No recipe fits → the work probably is not loop-shaped; bypass. A genuinely156new loop shape → propose a new recipe to the user; never improvise a157half-recipe inline. Per-recipe reference: `workflows/README.md` (canonical:158agent-scripts bundle `skills/using-workflows/workflows/README.md`; deployed159copy at `~/.claude/workflows/README.md`).