using-workflows
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chineseusing-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 ). No recipe, no
run dir. When in doubt, bypass — recipes exist for loops, not ceremony.
using-tmux-agent-toolsRed 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.
如果是单一限定任务、单一上下文、无阶段划分、无收敛条件 → 直接执行(内联执行,或通过调用单个worker)。无需使用模板,无需运行目录。存疑时选择绕过 — 模板专为循环型工作设计,而非形式化流程。
using-tmux-agent-tools曾导致问题的警示信号(若明知存在仍继续执行,需说明理由):
- 「我记得那个模板的内容」—— 模板会迭代更新;运行前务必阅读头部注释(参数约定)。绝不要猜测参数。
- 「先做完再补运行记录」—— 如果符合下方运行目录的要求,应先创建运行目录。
- 「这个小改动不需要校验」—— 对任何模板的行为层级修改,都必须先经过一轮共识校验。
子Agent豁免规则:被委派的worker无需进入此路由 — 调度器已完成路由;worker只需遵循其任务简报。
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)
来自全局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 ; Codex commands it through
Workflow(references/codex-adapter.md) — the runner is mechanical, so use the cheapest capable model with reasoning effortclaude-workflow-runner.low - Write-back duty: every recipe artifact/result lands in the CALLER's
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.
.workflow/<YYYYMMDDHHMM>-<slug>/
全局规则会在任务启动时将循环型工作路由至此。到达后:
- 通过下方的SELECT步骤,将触发词(audit / consensus verification / findings triage / root-cause deep-dive / plan→build)匹配到对应模板。
- 运行时拆分:Claude通过原生调用模板;Codex通过
Workflow(references/codex-adapter.md)调用模板 — 运行器是机械性的,因此使用成本最低且具备能力的模型,推理等级设为claude-workflow-runner。low - 回写职责:所有模板生成的产物/结果都必须存入调用方的运行目录(即连续性规则要求你创建的目录)—— 绝不能存入独立位置。一个任务对应一个运行目录,模板需遵循此约定共享该目录。
.workflow/<YYYYMMDDHHMM>-<slug>/
SELECT
选择模板
Discover live — never recite the recipe list from memory:
bash
ls ~/.claude/workflows/*.workflow.js .claude/workflows/*.workflow.js 2>/dev/nullThe 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-triageEntry points off the loop:
- weird bug → · docs/design drifted → the matching audit
root-cause-deep-dive-audit - ONE artifact needs a second-model verdict → — ONE round, irreversible/behavior-tier changes only; NOT a default station
consensus-gate - 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 (, ,
) are normally reached THROUGH
; call one directly only when you want just that stage.
Args auto-fill: = user's words → repo CLAUDE.md → the COUNTERPART
engine (the second brain is always the OTHER engine relative to the current
commander: Claude commands → a codex profile; Codex commands → a claude
profile; never your own engine, never a hard-coded name) → ask once;
= one line (repo abs path + stack + scope). Prefer name invocation
over scriptPath.
feature-plan-consensusplan-pipelinespec-implement-dual-review-verifyfeature-lifecycle-autoclicontext实时查找模板 — 绝不要凭记忆列举模板列表:
bash
ls ~/.claude/workflows/*.workflow.js .claude/workflows/*.workflow.js 2>/dev/null核心循环(唯一的循环 — 不存在调度外环;请勿自行创建):
audit (docs-vs-code | design-vs-code | root-cause-deep-dive)
→ findings-triage 连接器①: askUser → 人工逐字确认 ·
│ 简报 → 生命周期 · directFix → 分区运行
→ feature-lifecycle-auto 轻量壳层: feature-plan-consensus | plan-pipeline
│ → 校验 ✋ (autoBuild=false: 人工审核计划)
│ → spec-implement-dual-review-verify
→ 重新运行初始audit,使用相同参数
│ 连接器②: 内置在你自身中,而非代码里
→ confirmed == 0 → 收敛完成,生成报告 · 否则 → 返回findings-triage循环外的入口点:
- 疑难bug → · 文档/设计偏离 → 匹配对应的audit模板
root-cause-deep-dive-audit - 单个产物需要第二个模型的结论 → — 仅一轮,仅适用于不可逆/行为层级变更;非默认环节
consensus-gate - 多视角生成式设计共识 →
design-consensus - “项目下一步该做什么” →
project-direction-review - 模板集群盘点 / 机器漂移检测 →
workflow-manifest
阶段模板(, , )通常通过访问;仅当你只需要该阶段时才直接调用。参数自动填充规则: = 用户输入 → 仓库CLAUDE.md → 对应引擎(相对于当前指挥者,第二大脑始终是另一个引擎:Claude指挥 → Codex配置文件;Codex指挥 → Claude配置文件;绝不能是自身引擎,绝不能硬编码名称)→ 仅询问一次; = 一行内容(仓库绝对路径 + 栈信息 + 范围)。优先使用名称调用,而非scriptPath。
feature-plan-consensusplan-pipelinespec-implement-dual-review-verifyfeature-lifecycle-autoclicontextCross-runtime execution
跨运行时执行
Both runtimes RUN recipes through this router; only the execution vehicle
differs. Claude Code executes natively with .
Codex executes via (one bounded Claude
runner capsule — mechanics in ), under these
constraints (Codex-authored, gate-v2 2026-07-19):
.workflow.jsWorkflow()ADAPTED: claude-workflow-runnerreferences/codex-adapter.md- 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 , preserve its return under
Workflow(...), write schema-v1recipe_result, then stop.result.json - 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.
- Resolve by the substantive author under review: Codex for Claude-authored work; a non-Codex profile when Codex authored the target; fail closed if unclear.
args.cli - Human gates MUST return plus
status: paused, preservenext_action, stop the runner, and resume only via a new explicitly approved invocation.recipe_result - Evidence MUST say ; adapter or child failure is never recipe PASS.
recipe <name> executed natively on Claude runtime via runner (commanded by Codex)
Runtime matrix (Claude Code = for all 12; Codex column):
NATIVE| Recipe | Codex |
|---|---|
3 audits, | |
| |
| |
两种运行时均通过此路由运行模板;仅执行载体不同。Claude Code通过原生执行。Codex通过执行(一个限定性的Claude运行器胶囊 — 机制详见),需遵循以下约束(Codex编写,gate-v2 2026-07-19):
Workflow().workflow.jsADAPTED: claude-workflow-runnerreferences/codex-adapter.md- Codex必须在调度单个Claude运行器前,冻结模板名称、参数、验收标准、作者运行时和评审者配置文件。
- 运行器必须精确调用一次原生,将返回结果保存到
Workflow(...)下,写入schema-v1格式的recipe_result,然后停止。result.json - 任何后续异常必须将嵌套层级限制为2,声明子配置文件/轮次上限,使用唯一会话并要求等待结果,禁止子进程生成。
- 根据被评审内容的实际作者解析:Claude编写的内容 → 使用Codex;Codex编写的目标内容 → 使用非Codex配置文件;若不明确则终止执行。
args.cli - 人工校验必须返回及
status: paused,保留next_action,停止运行器,仅通过新的明确批准调用恢复执行。recipe_result - 证据必须标注;适配器或子进程失败绝不能视为模板执行通过。
recipe <name> executed natively on Claude runtime via runner (commanded by Codex)
运行时矩阵(Claude Code = 所有12种模板均为;Codex列):
NATIVE| 模板 | Codex |
|---|---|
3种audit、 | |
| |
| |
DEFER
延迟规则
- Chain recipes from the TOP level only — nesting cap is 1, and the lifecycle shell spends it.
workflow() - Run dir (,
.workflow/<slug>/conventions) ONLY when work spans days, has 2+ phases, or must survive interruption/handoff. Within-chat work: a single results file, or nothing.codex-dynamic-workflows - Recipe edits: behavior-tier → consensus-gate one round FIRST; wording →
direct. Canonical = the agent-scripts repo bundle
() → redeploy to
skills/using-workflows/workflows/; a live edit made machine-side must be folded back into the bundle in the same change.~/.claude/workflows/
- 仅能从顶层链式调用模板 — 嵌套上限为1,且生命周期壳层已占用该额度。
workflow() - 仅当工作跨多天、包含2个以上阶段,或需在中断/交接后保留时,才使用运行目录(,遵循
.workflow/<slug>/约定)。聊天内工作:只需单个结果文件,或无需文件。codex-dynamic-workflows - 模板编辑:行为层级修改 → 必须先经过一轮共识校验;措辞修改 → 直接编辑。标准版本为agent-scripts仓库包()→ 重新部署到
skills/using-workflows/workflows/;在机器端进行的实时编辑必须同步合并到包中。~/.claude/workflows/
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: (canonical:
agent-scripts bundle ; deployed
copy at ).
workflows/README.mdskills/using-workflows/workflows/README.md~/.claude/workflows/README.md无匹配模板 → 该工作很可能不是循环型工作;选择绕过。若确实是新的循环型工作 → 向用户提议新模板;绝不要在内部临时拼凑半完整模板。模板参考文档:(标准版本:agent-scripts包中的;部署副本位于)。
workflows/README.mdskills/using-workflows/workflows/README.md~/.claude/workflows/README.md