harnessed 4.9.1 → 4.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/README.md +43 -6
  2. package/bin/harnessed-inject-state.mjs +103 -2
  3. package/dist/cli.mjs +1758 -1419
  4. package/dist/cli.mjs.map +1 -1
  5. package/dist/index.mjs +1 -1
  6. package/dist/index.mjs.map +1 -1
  7. package/manifests/skill-packs/frontend-design.yaml +1 -1
  8. package/manifests/skill-packs/gstack.yaml +1 -1
  9. package/manifests/skill-packs/ui-ux-pro-max.yaml +1 -1
  10. package/package.json +1 -1
  11. package/workflows/auto/SKILL.md +26 -12
  12. package/workflows/auto/SKILL.zh-Hans.md +25 -10
  13. package/workflows/discuss/auto/SKILL.md +15 -12
  14. package/workflows/discuss/auto/SKILL.zh-Hans.md +12 -8
  15. package/workflows/discuss/phase/SKILL.md +15 -12
  16. package/workflows/discuss/phase/SKILL.zh-Hans.md +12 -8
  17. package/workflows/discuss/strategic/SKILL.md +15 -12
  18. package/workflows/discuss/strategic/SKILL.zh-Hans.md +12 -8
  19. package/workflows/discuss/subtask/SKILL.md +15 -12
  20. package/workflows/discuss/subtask/SKILL.zh-Hans.md +12 -8
  21. package/workflows/plan/architecture/SKILL.md +14 -12
  22. package/workflows/plan/architecture/SKILL.zh-Hans.md +11 -8
  23. package/workflows/plan/auto/SKILL.md +26 -12
  24. package/workflows/plan/auto/SKILL.zh-Hans.md +25 -10
  25. package/workflows/plan/phase/SKILL.md +14 -12
  26. package/workflows/plan/phase/SKILL.zh-Hans.md +11 -8
  27. package/workflows/research/SKILL.md +14 -12
  28. package/workflows/research/SKILL.zh-Hans.md +11 -8
  29. package/workflows/retro/SKILL.md +14 -12
  30. package/workflows/retro/SKILL.zh-Hans.md +11 -8
  31. package/workflows/role-prompts.yaml +34 -0
  32. package/workflows/role-prompts.zh-Hans.yaml +33 -0
  33. package/workflows/ship/auto/SKILL.md +29 -0
  34. package/workflows/ship/auto/SKILL.zh-Hans.md +28 -0
  35. package/workflows/ship/preflight/SKILL.md +17 -0
  36. package/workflows/ship/preflight/SKILL.zh-Hans.md +16 -0
  37. package/workflows/task/auto/SKILL.md +26 -12
  38. package/workflows/task/auto/SKILL.zh-Hans.md +25 -10
  39. package/workflows/task/clarify/SKILL.md +15 -12
  40. package/workflows/task/clarify/SKILL.zh-Hans.md +12 -8
  41. package/workflows/task/code/SKILL.md +14 -12
  42. package/workflows/task/code/SKILL.zh-Hans.md +11 -8
  43. package/workflows/task/deliver/SKILL.md +14 -12
  44. package/workflows/task/deliver/SKILL.zh-Hans.md +11 -8
  45. package/workflows/task/test/SKILL.md +14 -12
  46. package/workflows/task/test/SKILL.zh-Hans.md +11 -8
  47. package/workflows/verify/auto/SKILL.md +26 -12
  48. package/workflows/verify/auto/SKILL.zh-Hans.md +25 -10
  49. package/workflows/verify/code-review/SKILL.md +14 -12
  50. package/workflows/verify/code-review/SKILL.zh-Hans.md +11 -8
  51. package/workflows/verify/design/SKILL.md +14 -12
  52. package/workflows/verify/design/SKILL.zh-Hans.md +11 -8
  53. package/workflows/verify/multispec/SKILL.md +14 -12
  54. package/workflows/verify/multispec/SKILL.zh-Hans.md +11 -8
  55. package/workflows/verify/paranoid/SKILL.md +14 -12
  56. package/workflows/verify/paranoid/SKILL.zh-Hans.md +11 -8
  57. package/workflows/verify/progress/SKILL.md +14 -12
  58. package/workflows/verify/progress/SKILL.zh-Hans.md +11 -8
  59. package/workflows/verify/qa/SKILL.md +14 -12
  60. package/workflows/verify/qa/SKILL.zh-Hans.md +11 -8
  61. package/workflows/verify/security/SKILL.md +14 -12
  62. package/workflows/verify/security/SKILL.zh-Hans.md +11 -8
  63. package/workflows/verify/simplify/SKILL.md +14 -12
  64. package/workflows/verify/simplify/SKILL.zh-Hans.md +11 -8
@@ -55,16 +55,20 @@ Phase 01-brainstorm 在 `phase.spec_ambiguous == true` 时条件性 fire `grill-
55
55
 
56
56
  ## 如何调用
57
57
 
58
- CC-native 编排。**不要** pipe 到 `harnessed run task-clarify` —— 那是 CI/headless 路径(in-process
59
- SDK spawn,会阻塞 session、绕过 Agent Teams,在 Claude Code 内部调用时还会挂死)。
58
+ 澄清需要真实用户对话,所以本阶段直接在**本 session** 跑 —— **不要** spawn,也**不要**自行演绎:
59
+ 按以下步骤走,把 locked spec 持久化给执行阶段。
60
60
 
61
- 改用 `/task-clarify` slash command(由 `harnessed setup` 生成于 `~/.claude/commands/task-clarify.md`)。
62
- 它以 CC-native 方式驱动:`harnessed gates` 决定哪些 sub fire,`harnessed prompt <sub>` 给出每个
63
- spawn-ready prompt,然后用 CC-native subagent(Task / Agent 工具)逐个 spawn 已 fire 的 sub,
64
- 每个结果用 `harnessed checkpoint` 记录。完整 state-machine 步骤见 `~/.claude/commands/task-clarify.md`;
65
- 若该文件不存在,自行按 gates → prompt → spawn → checkpoint 同序执行。
61
+ 1. 对 "$ARGUMENTS" 评估澄清判据:
62
+ - **战略层** —— 新功能 / 新 milestone / 商业 scope 不清 → gstack `/office-hours` + `/plan-ceo-review`
63
+ - **Phase 层** —— ≥2 个 open implementation decision / 跨 phase API contract 不清 → GSD `/gsd-discuss-phase`
64
+ - **子任务层** —— ≥2 个不同方案 / 核心算法 / API contract 设计 / 高错误成本 → superpowers brainstorming
65
+ 2. 对每个 fire 的层与用户对话(option 型决策用 AskUserQuestion),锁定每个 open decision。
66
+ 3. 不 fire 的层透明 skip —— 说明哪些被 skip 及原因。
67
+ 4. 把 locked 决策持久化到 `.planning/`(planning-with-files 的 `findings.md` / `task_plan.md`)。
66
68
 
67
- <!-- harnessed-generated:v4.9.1 -->
69
+ 产出:一份 locked spec,执行阶段(`/plan` → `/task` → `/verify`)无需再问用户即可消费。
70
+
71
+ <!-- harnessed-generated:v4.9.3 -->
68
72
 
69
73
  ## References
70
74
 
@@ -62,18 +62,20 @@ marketplace).
62
62
 
63
63
  ## How to invoke
64
64
 
65
- Orchestrated CC-natively. Do NOT pipe to `harnessed run task-code` — that is the CI/headless
66
- path (an in-process SDK spawn that blocks the session, bypasses Agent Teams, and hangs when
67
- invoked from inside a Claude Code session).
68
-
69
- Run the `/task-code` slash command instead (generated by `harnessed setup` at
70
- `~/.claude/commands/task-code.md`). It drives the stage natively: `harnessed gates` → which
71
- subs fire, `harnessed prompt <sub>` → each spawn-ready prompt, then a CC-native subagent
72
- (Task / Agent tool) per fired sub, recording each outcome with `harnessed checkpoint`. The
73
- full state-machine steps live in `~/.claude/commands/task-code.md`; if that file is absent,
74
- follow that same gates → prompt → spawn → checkpoint sequence yourself.
75
-
76
- <!-- harnessed-generated:v4.9.1 -->
65
+ The numbered sequence below **is** the state machine — execute it with Bash. Do NOT improvise
66
+ an equivalent flow from the Overview above: freelancing bypasses the engine (no ledger, no
67
+ evidence guard). harnessed gives you the spawn-ready prompt; YOU spawn the subagent with a
68
+ CC-native Task / Agent tool (keeps the session responsive + lets clarification round-trips reach the user).
69
+
70
+ Do NOT pipe to `harnessed run task-code` — that is the CI/headless path (in-process SDK spawn
71
+ that blocks the session inside Claude Code).
72
+
73
+ 1. Bash: `harnessed prompt task-code --task "$ARGUMENTS" --json` → parse `{prompt, max_iterations, model}`.
74
+ 2. Spawn a CC-native subagent (Task / Agent tool) with that `prompt` + `model`, wrapped in the ralph-loop plugin: `/ralph-loop "<prompt>" --max-iterations <max_iterations> --completion-promise "COMPLETE"`. If the plugin is absent, self-loop: spawn → check output for `<promise>COMPLETE</promise>` → re-spawn with prior output appended (up to max_iterations).
75
+ 3. If the output contains `STATUS: NEEDS_CLARIFICATION` + a question list: STOP, relay them verbatim via AskUserQuestion, append the answers to the spec, then re-spawn the same sub.
76
+ 4. On `<promise>COMPLETE</promise>`: Bash `harnessed checkpoint complete task-code --summary "<one-line>"`. The evidence guard runs here (fail-CLOSED): if a declared `artifacts_expected` file is missing it exits non-zero — re-spawn to produce it before treating the sub as done.
77
+
78
+ <!-- harnessed-generated:v4.9.3 -->
77
79
 
78
80
  ## References
79
81
 
@@ -61,16 +61,19 @@ Phase 01-code 根据 phase fact context 条件性 fire 3 个 mattpocock 招式
61
61
 
62
62
  ## 如何调用
63
63
 
64
- CC-native 编排。**不要** pipe 到 `harnessed run task-code` —— 那是 CI/headless 路径(in-process
65
- SDK spawn,会阻塞 session、绕过 Agent Teams,在 Claude Code 内部调用时还会挂死)。
64
+ 下面这套编号序列**就是** state machine —— 用 Bash 执行。**不要**从上方 Overview 自行演绎等价流程:
65
+ freestyle 会旁路引擎(无 ledger、无 evidence guard)。harnessed 给你 spawn-ready prompt;**你**用
66
+ CC-native Task / Agent 工具 spawn subagent(保持 session 响应 + 让澄清 round-trip 能回到用户)。
66
67
 
67
- 改用 `/task-code` slash command(由 `harnessed setup` 生成于 `~/.claude/commands/task-code.md`)。
68
- 它以 CC-native 方式驱动:`harnessed gates` 决定哪些 sub fire,`harnessed prompt <sub>` 给出每个
69
- spawn-ready prompt,然后用 CC-native subagent(Task / Agent 工具)逐个 spawn 已 fire 的 sub,
70
- 每个结果用 `harnessed checkpoint` 记录。完整 state-machine 步骤见 `~/.claude/commands/task-code.md`;
71
- 若该文件不存在,自行按 gates → prompt → spawn → checkpoint 同序执行。
68
+ **不要** pipe 到 `harnessed run task-code` —— 那是 CI/headless 路径(in-process SDK spawn,在 Claude
69
+ Code 内部会阻塞 session)。
72
70
 
73
- <!-- harnessed-generated:v4.9.1 -->
71
+ 1. Bash: `harnessed prompt task-code --task "$ARGUMENTS" --json` → 解析 `{prompt, max_iterations, model}`。
72
+ 2. 用 CC-native subagent(Task / Agent 工具)以该 `prompt` + `model` spawn,用 ralph-loop plugin 包裹:`/ralph-loop "<prompt>" --max-iterations <max_iterations> --completion-promise "COMPLETE"`。若 plugin 未装,自循环:spawn → 检查 `<promise>COMPLETE</promise>` → 把上轮输出 append 后重 spawn(至多 max_iterations)。
73
+ 3. 若输出含 `STATUS: NEEDS_CLARIFICATION` + 问题列表:STOP,用 AskUserQuestion 原样转达,把答案 append 进 spec,再重 spawn。
74
+ 4. 命中 `<promise>COMPLETE</promise>`:Bash `harnessed checkpoint complete task-code --summary "<one-line>"`。evidence guard 在此运行(fail-CLOSED):若声明的 `artifacts_expected` 文件缺失会 exit 非零 —— 重 spawn 产出它再算 done。
75
+
76
+ <!-- harnessed-generated:v4.9.3 -->
74
77
 
75
78
  ## References
76
79
 
@@ -84,18 +84,20 @@ Claude Code plugin marketplace).
84
84
 
85
85
  ## How to invoke
86
86
 
87
- Orchestrated CC-natively. Do NOT pipe to `harnessed run task-deliver` — that is the CI/headless
88
- path (an in-process SDK spawn that blocks the session, bypasses Agent Teams, and hangs when
89
- invoked from inside a Claude Code session).
90
-
91
- Run the `/task-deliver` slash command instead (generated by `harnessed setup` at
92
- `~/.claude/commands/task-deliver.md`). It drives the stage natively: `harnessed gates` → which
93
- subs fire, `harnessed prompt <sub>` → each spawn-ready prompt, then a CC-native subagent
94
- (Task / Agent tool) per fired sub, recording each outcome with `harnessed checkpoint`. The
95
- full state-machine steps live in `~/.claude/commands/task-deliver.md`; if that file is absent,
96
- follow that same gates → prompt → spawn → checkpoint sequence yourself.
97
-
98
- <!-- harnessed-generated:v4.9.1 -->
87
+ The numbered sequence below **is** the state machine — execute it with Bash. Do NOT improvise
88
+ an equivalent flow from the Overview above: freelancing bypasses the engine (no ledger, no
89
+ evidence guard). harnessed gives you the spawn-ready prompt; YOU spawn the subagent with a
90
+ CC-native Task / Agent tool (keeps the session responsive + lets clarification round-trips reach the user).
91
+
92
+ Do NOT pipe to `harnessed run task-deliver` — that is the CI/headless path (in-process SDK spawn
93
+ that blocks the session inside Claude Code).
94
+
95
+ 1. Bash: `harnessed prompt task-deliver --task "$ARGUMENTS" --json` → parse `{prompt, max_iterations, model}`.
96
+ 2. Spawn a CC-native subagent (Task / Agent tool) with that `prompt` + `model`, wrapped in the ralph-loop plugin: `/ralph-loop "<prompt>" --max-iterations <max_iterations> --completion-promise "COMPLETE"`. If the plugin is absent, self-loop: spawn → check output for `<promise>COMPLETE</promise>` → re-spawn with prior output appended (up to max_iterations).
97
+ 3. If the output contains `STATUS: NEEDS_CLARIFICATION` + a question list: STOP, relay them verbatim via AskUserQuestion, append the answers to the spec, then re-spawn the same sub.
98
+ 4. On `<promise>COMPLETE</promise>`: Bash `harnessed checkpoint complete task-deliver --summary "<one-line>"`. The evidence guard runs here (fail-CLOSED): if a declared `artifacts_expected` file is missing it exits non-zero — re-spawn to produce it before treating the sub as done.
99
+
100
+ <!-- harnessed-generated:v4.9.3 -->
99
101
 
100
102
  ## References
101
103
 
@@ -84,16 +84,19 @@ Claude Code plugin marketplace 安装)。
84
84
 
85
85
  ## 如何调用
86
86
 
87
- CC-native 编排。**不要** pipe 到 `harnessed run task-deliver` —— 那是 CI/headless 路径(in-process
88
- SDK spawn,会阻塞 session、绕过 Agent Teams,在 Claude Code 内部调用时还会挂死)。
87
+ 下面这套编号序列**就是** state machine —— 用 Bash 执行。**不要**从上方 Overview 自行演绎等价流程:
88
+ freestyle 会旁路引擎(无 ledger、无 evidence guard)。harnessed 给你 spawn-ready prompt;**你**用
89
+ CC-native Task / Agent 工具 spawn subagent(保持 session 响应 + 让澄清 round-trip 能回到用户)。
89
90
 
90
- 改用 `/task-deliver` slash command(由 `harnessed setup` 生成于 `~/.claude/commands/task-deliver.md`)。
91
- 它以 CC-native 方式驱动:`harnessed gates` 决定哪些 sub fire,`harnessed prompt <sub>` 给出每个
92
- spawn-ready prompt,然后用 CC-native subagent(Task / Agent 工具)逐个 spawn 已 fire 的 sub,
93
- 每个结果用 `harnessed checkpoint` 记录。完整 state-machine 步骤见 `~/.claude/commands/task-deliver.md`;
94
- 若该文件不存在,自行按 gates → prompt → spawn → checkpoint 同序执行。
91
+ **不要** pipe 到 `harnessed run task-deliver` —— 那是 CI/headless 路径(in-process SDK spawn,在 Claude
92
+ Code 内部会阻塞 session)。
95
93
 
96
- <!-- harnessed-generated:v4.9.1 -->
94
+ 1. Bash: `harnessed prompt task-deliver --task "$ARGUMENTS" --json` → 解析 `{prompt, max_iterations, model}`。
95
+ 2. 用 CC-native subagent(Task / Agent 工具)以该 `prompt` + `model` spawn,用 ralph-loop plugin 包裹:`/ralph-loop "<prompt>" --max-iterations <max_iterations> --completion-promise "COMPLETE"`。若 plugin 未装,自循环:spawn → 检查 `<promise>COMPLETE</promise>` → 把上轮输出 append 后重 spawn(至多 max_iterations)。
96
+ 3. 若输出含 `STATUS: NEEDS_CLARIFICATION` + 问题列表:STOP,用 AskUserQuestion 原样转达,把答案 append 进 spec,再重 spawn。
97
+ 4. 命中 `<promise>COMPLETE</promise>`:Bash `harnessed checkpoint complete task-deliver --summary "<one-line>"`。evidence guard 在此运行(fail-CLOSED):若声明的 `artifacts_expected` 文件缺失会 exit 非零 —— 重 spawn 产出它再算 done。
98
+
99
+ <!-- harnessed-generated:v4.9.3 -->
97
100
 
98
101
  ## References
99
102
 
@@ -65,18 +65,20 @@ fix → regression-test), 测试通过则 skip diagnose entirely。
65
65
 
66
66
  ## How to invoke
67
67
 
68
- Orchestrated CC-natively. Do NOT pipe to `harnessed run task-test` — that is the CI/headless
69
- path (an in-process SDK spawn that blocks the session, bypasses Agent Teams, and hangs when
70
- invoked from inside a Claude Code session).
71
-
72
- Run the `/task-test` slash command instead (generated by `harnessed setup` at
73
- `~/.claude/commands/task-test.md`). It drives the stage natively: `harnessed gates` → which
74
- subs fire, `harnessed prompt <sub>` → each spawn-ready prompt, then a CC-native subagent
75
- (Task / Agent tool) per fired sub, recording each outcome with `harnessed checkpoint`. The
76
- full state-machine steps live in `~/.claude/commands/task-test.md`; if that file is absent,
77
- follow that same gates → prompt → spawn → checkpoint sequence yourself.
78
-
79
- <!-- harnessed-generated:v4.9.1 -->
68
+ The numbered sequence below **is** the state machine — execute it with Bash. Do NOT improvise
69
+ an equivalent flow from the Overview above: freelancing bypasses the engine (no ledger, no
70
+ evidence guard). harnessed gives you the spawn-ready prompt; YOU spawn the subagent with a
71
+ CC-native Task / Agent tool (keeps the session responsive + lets clarification round-trips reach the user).
72
+
73
+ Do NOT pipe to `harnessed run task-test` — that is the CI/headless path (in-process SDK spawn
74
+ that blocks the session inside Claude Code).
75
+
76
+ 1. Bash: `harnessed prompt task-test --task "$ARGUMENTS" --json` → parse `{prompt, max_iterations, model}`.
77
+ 2. Spawn a CC-native subagent (Task / Agent tool) with that `prompt` + `model`, wrapped in the ralph-loop plugin: `/ralph-loop "<prompt>" --max-iterations <max_iterations> --completion-promise "COMPLETE"`. If the plugin is absent, self-loop: spawn → check output for `<promise>COMPLETE</promise>` → re-spawn with prior output appended (up to max_iterations).
78
+ 3. If the output contains `STATUS: NEEDS_CLARIFICATION` + a question list: STOP, relay them verbatim via AskUserQuestion, append the answers to the spec, then re-spawn the same sub.
79
+ 4. On `<promise>COMPLETE</promise>`: Bash `harnessed checkpoint complete task-test --summary "<one-line>"`. The evidence guard runs here (fail-CLOSED): if a declared `artifacts_expected` file is missing it exits non-zero — re-spawn to produce it before treating the sub as done.
80
+
81
+ <!-- harnessed-generated:v4.9.3 -->
80
82
 
81
83
  ## References
82
84
 
@@ -65,16 +65,19 @@ fix → regression-test),测试通过则完全跳过 diagnose。
65
65
 
66
66
  ## 如何调用
67
67
 
68
- CC-native 编排。**不要** pipe 到 `harnessed run task-test` —— 那是 CI/headless 路径(in-process
69
- SDK spawn,会阻塞 session、绕过 Agent Teams,在 Claude Code 内部调用时还会挂死)。
68
+ 下面这套编号序列**就是** state machine —— 用 Bash 执行。**不要**从上方 Overview 自行演绎等价流程:
69
+ freestyle 会旁路引擎(无 ledger、无 evidence guard)。harnessed 给你 spawn-ready prompt;**你**用
70
+ CC-native Task / Agent 工具 spawn subagent(保持 session 响应 + 让澄清 round-trip 能回到用户)。
70
71
 
71
- 改用 `/task-test` slash command(由 `harnessed setup` 生成于 `~/.claude/commands/task-test.md`)。
72
- 它以 CC-native 方式驱动:`harnessed gates` 决定哪些 sub fire,`harnessed prompt <sub>` 给出每个
73
- spawn-ready prompt,然后用 CC-native subagent(Task / Agent 工具)逐个 spawn 已 fire 的 sub,
74
- 每个结果用 `harnessed checkpoint` 记录。完整 state-machine 步骤见 `~/.claude/commands/task-test.md`;
75
- 若该文件不存在,自行按 gates → prompt → spawn → checkpoint 同序执行。
72
+ **不要** pipe 到 `harnessed run task-test` —— 那是 CI/headless 路径(in-process SDK spawn,在 Claude
73
+ Code 内部会阻塞 session)。
76
74
 
77
- <!-- harnessed-generated:v4.9.1 -->
75
+ 1. Bash: `harnessed prompt task-test --task "$ARGUMENTS" --json` → 解析 `{prompt, max_iterations, model}`。
76
+ 2. 用 CC-native subagent(Task / Agent 工具)以该 `prompt` + `model` spawn,用 ralph-loop plugin 包裹:`/ralph-loop "<prompt>" --max-iterations <max_iterations> --completion-promise "COMPLETE"`。若 plugin 未装,自循环:spawn → 检查 `<promise>COMPLETE</promise>` → 把上轮输出 append 后重 spawn(至多 max_iterations)。
77
+ 3. 若输出含 `STATUS: NEEDS_CLARIFICATION` + 问题列表:STOP,用 AskUserQuestion 原样转达,把答案 append 进 spec,再重 spawn。
78
+ 4. 命中 `<promise>COMPLETE</promise>`:Bash `harnessed checkpoint complete task-test --summary "<one-line>"`。evidence guard 在此运行(fail-CLOSED):若声明的 `artifacts_expected` 文件缺失会 exit 非零 —— 重 spawn 产出它再算 done。
79
+
80
+ <!-- harnessed-generated:v4.9.3 -->
78
81
 
79
82
  ## 参考资料
80
83
 
@@ -66,18 +66,32 @@ Sister `workflows/capabilities.yaml`:
66
66
 
67
67
  ## How to invoke
68
68
 
69
- Orchestrated CC-natively. Do NOT pipe to `harnessed run verify` — that is the CI/headless
70
- path (an in-process SDK spawn that blocks the session, bypasses Agent Teams, and hangs when
71
- invoked from inside a Claude Code session).
72
-
73
- Run the `/verify` slash command instead (generated by `harnessed setup` at
74
- `~/.claude/commands/verify.md`). It drives the stage natively: `harnessed gates` → which
75
- subs fire, `harnessed prompt <sub>` → each spawn-ready prompt, then a CC-native subagent
76
- (Task / Agent tool) per fired sub, recording each outcome with `harnessed checkpoint`. The
77
- full state-machine steps live in `~/.claude/commands/verify.md`; if that file is absent,
78
- follow that same gates → prompt → spawn → checkpoint sequence yourself.
79
-
80
- <!-- harnessed-generated:v4.9.1 -->
69
+ The numbered sequence below **is** the state machine — execute it step by step with Bash.
70
+ Do NOT improvise an equivalent flow from the Overview above: freelancing bypasses the engine
71
+ (no per-sub ledger, no evidence guard, no recovery). harnessed is the orchestration brain
72
+ (`harnessed gates` says which subs fire, `harnessed prompt` gives each spawn-ready prompt,
73
+ `harnessed checkpoint` records the ledger); YOU spawn with CC-native Task / Agent tools.
74
+
75
+ Do NOT pipe to `harnessed run verify` — that is the CI/headless path (in-process SDK spawn
76
+ that blocks the session, bypasses Agent Teams, and hangs inside Claude Code).
77
+
78
+ 1. If the clarification criteria fire for "$ARGUMENTS" (≥2 approaches / core algorithm / API contract / high error cost), clarify interactively in THIS session first (AskUserQuestion) and lock decisions; otherwise transparent-skip. Produce a locked spec.
79
+ 2. Bash: `harnessed gates verify --task "<locked spec>" --skip-sub clarify` → parse the JSON `{fire, skip, parallelism}`. This is the plan SoT (no spawn). Keep the verbatim JSON.
80
+ 3. Bash: `harnessed checkpoint start verify --plan '<the verbatim gates JSON from step 2>'` → seeds the per-sub ledger so `harnessed status --recover` can re-orient you after compaction.
81
+ 4. If `parallelism.escalate_to_teams === true`: read `~/.claude/rules/agent-teams.md`, then drive the fired subs as an Agent Team (`TeamCreate` → `Agent(name, team_name, …)` per sub with its `harnessed prompt <sub>` prompt → coordinate via `SendMessage` → `SendMessage shutdown_request` + `TeamDelete`). Still checkpoint each sub (`complete` / `fail`) as below.
82
+ 5. Otherwise, for each fired sub in `order` (serial subs sequentially, parallel subs concurrently):
83
+ - **If the entry has `is_master: true`** (a stage master — e.g. `/auto` firing `plan`/`task`/`verify`): do NOT prompt+spawn it. RECURSE: run that master’s own `harnessed gates <sub> --task "<spec>" --skip-sub clarify` → `harnessed checkpoint start <sub> --plan '<json>'` → repeat this loop for ITS fired subs.
84
+ - **Else (leaf sub):**
85
+ a. Bash: `harnessed prompt <sub> --task "<spec>" --json` → parse `{prompt, max_iterations, model}`.
86
+ b. Spawn a CC-native subagent (Task / Agent tool) with that `prompt` + `model`, wrapped in the ralph-loop plugin: `/ralph-loop "<prompt>" --max-iterations <max_iterations> --completion-promise "COMPLETE"`. If the plugin is absent, self-loop: spawn → check output for `<promise>COMPLETE</promise>` → re-spawn with prior output appended (up to max_iterations).
87
+ c. If the output contains `STATUS: NEEDS_CLARIFICATION` + questions: STOP, relay them verbatim via AskUserQuestion, append the answers to the spec, then re-spawn the same sub.
88
+ d. On `<promise>COMPLETE</promise>`: Bash `harnessed checkpoint complete <sub> --summary "<one-line>"`. The evidence guard runs here (fail-CLOSED): if a declared `artifacts_expected` file is missing it exits non-zero — re-spawn to produce it, or pass `--force` only to deliberately override.
89
+ e. If the sub cannot reach COMPLETE (max_iterations exhausted / unrecoverable error): Bash `harnessed checkpoint fail <sub> --summary "<why>"`, then STOP and report to the user.
90
+ 6. After all fired subs are `done` (or recorded `failed`), Bash `harnessed status --recover` to confirm the ledger and report a per-sub fired/skipped/done/failed summary to the user.
91
+
92
+ **If you lose context (compaction / resume):** run `harnessed status --recover` first — it reads the ledger and prints "you are here, this is next" so you resume at the first `pending` sub instead of restarting. If the ledger is empty, re-run steps 2-3.
93
+
94
+ <!-- harnessed-generated:v4.9.3 -->
81
95
 
82
96
  ## References
83
97
 
@@ -66,16 +66,31 @@ Sister `workflows/capabilities.yaml`:
66
66
 
67
67
  ## 如何调用
68
68
 
69
- CC-native 编排。**不要** pipe 到 `harnessed run verify` —— 那是 CI/headless 路径(in-process
70
- SDK spawn,会阻塞 session、绕过 Agent Teams,在 Claude Code 内部调用时还会挂死)。
71
-
72
- 改用 `/verify` slash command(由 `harnessed setup` 生成于 `~/.claude/commands/verify.md`)。
73
- 它以 CC-native 方式驱动:`harnessed gates` 决定哪些 sub fire,`harnessed prompt <sub>` 给出每个
74
- spawn-ready prompt,然后用 CC-native subagent(Task / Agent 工具)逐个 spawn 已 fire 的 sub,
75
- 每个结果用 `harnessed checkpoint` 记录。完整 state-machine 步骤见 `~/.claude/commands/verify.md`;
76
- 若该文件不存在,自行按 gates → prompt → spawn → checkpoint 同序执行。
77
-
78
- <!-- harnessed-generated:v4.9.1 -->
69
+ 下面这套编号序列**就是** state machine —— 逐步用 Bash 执行。**不要**从上方 Overview 自行演绎一套
70
+ 等价流程:freestyle 会旁路引擎(无 per-sub ledger、无 evidence guard、无 recovery)。harnessed 是
71
+ 编排大脑(`harnessed gates` 决定哪些 sub fire,`harnessed prompt` 给出每个 spawn-ready prompt,
72
+ `harnessed checkpoint` 记录 ledger);**你**(主 session)用 CC-native Task / Agent 工具做 spawn。
73
+
74
+ **不要** pipe 到 `harnessed run verify` —— 那是 CI/headless 路径(in-process SDK spawn,会阻塞
75
+ session、绕过 Agent Teams,在 Claude Code 内部调用时会挂死)。
76
+
77
+ 1. 若 "$ARGUMENTS" 触发澄清判据(≥2 方案 / 核心算法 / API contract / 高错误成本),先在**本 session** 交互澄清(AskUserQuestion)并锁决策;否则透明 skip。产出 locked spec。
78
+ 2. Bash: `harnessed gates verify --task "<locked spec>" --skip-sub clarify` → 解析 JSON `{fire, skip, parallelism}`。这是 plan SoT(不 spawn)。保留 verbatim JSON。
79
+ 3. Bash: `harnessed checkpoint start verify --plan '<step 2 的 verbatim gates JSON>'` → seed per-sub ledger,让 `harnessed status --recover` 能在 compaction 后给你重新定位。
80
+ 4. 若 `parallelism.escalate_to_teams === true`:读 `~/.claude/rules/agent-teams.md`,然后把 fired subs 作为 Agent Team 驱动(`TeamCreate` → 每个 sub `Agent(name, team_name, …)` + 其 `harnessed prompt <sub>` prompt → 用 `SendMessage` 协调 → `SendMessage shutdown_request` + `TeamDelete`)。每个 sub 仍按下方 checkpoint(`complete` / `fail`)。
81
+ 5. 否则,对 `order` 里每个 fired sub(serial 串行、parallel 并发):
82
+ - **若该项 `is_master: true`**(本身是 stage master —— 如 `/auto` fire `plan`/`task`/`verify`):**不要**直接 prompt+spawn。RECURSE:跑该 master 自己的 `harnessed gates <sub> --task "<spec>" --skip-sub clarify` → `harnessed checkpoint start <sub> --plan '<json>'` → 对它的 fired subs 重复本循环。
83
+ - **否则(leaf sub):**
84
+ a. Bash: `harnessed prompt <sub> --task "<spec>" --json` → 解析 `{prompt, max_iterations, model}`。
85
+ b. 用 CC-native subagent(Task / Agent 工具)以该 `prompt` + `model` spawn,用 ralph-loop plugin 包裹:`/ralph-loop "<prompt>" --max-iterations <max_iterations> --completion-promise "COMPLETE"`。若 plugin 未装,自循环:spawn → 检查输出 `<promise>COMPLETE</promise>` → 把上轮输出 append 后重 spawn(至多 max_iterations)。
86
+ c. 若输出含 `STATUS: NEEDS_CLARIFICATION` + 问题列表:STOP,用 AskUserQuestion 原样转达,把答案 append 进 spec,再重 spawn 同一 sub。
87
+ d. 命中 `<promise>COMPLETE</promise>`:Bash `harnessed checkpoint complete <sub> --summary "<one-line>"`。evidence guard 在此运行(fail-CLOSED):若声明的 `artifacts_expected` 文件缺失会 exit 非零 —— 重 spawn 产出它,或仅在刻意覆盖时传 `--force`。
88
+ e. 若 sub 无法达到 COMPLETE(max_iterations 耗尽 / 不可恢复错误):Bash `harnessed checkpoint fail <sub> --summary "<why>"`,然后 STOP 并向用户报告。
89
+ 6. 所有 fired subs `done`(或记录 `failed`)后,Bash `harnessed status --recover` 确认 ledger,并向用户报告 per-sub fired/skipped/done/failed 摘要。
90
+
91
+ **若丢失上下文(compaction / resume):** 先跑 `harnessed status --recover` —— 它读 ledger 并打印「你在这里,下一步是什么」,让你从第一个 `pending` sub 续跑而非重启。若 ledger 为空,重跑 step 2-3。
92
+
93
+ <!-- harnessed-generated:v4.9.3 -->
79
94
 
80
95
  ## 参考资料
81
96
 
@@ -50,18 +50,20 @@ Sister `workflows/judgments/parallelism-gate.yaml`:
50
50
 
51
51
  ## How to invoke
52
52
 
53
- Orchestrated CC-natively. Do NOT pipe to `harnessed run verify-code-review` — that is the CI/headless
54
- path (an in-process SDK spawn that blocks the session, bypasses Agent Teams, and hangs when
55
- invoked from inside a Claude Code session).
56
-
57
- Run the `/verify-code-review` slash command instead (generated by `harnessed setup` at
58
- `~/.claude/commands/verify-code-review.md`). It drives the stage natively: `harnessed gates` → which
59
- subs fire, `harnessed prompt <sub>` → each spawn-ready prompt, then a CC-native subagent
60
- (Task / Agent tool) per fired sub, recording each outcome with `harnessed checkpoint`. The
61
- full state-machine steps live in `~/.claude/commands/verify-code-review.md`; if that file is absent,
62
- follow that same gates → prompt → spawn → checkpoint sequence yourself.
63
-
64
- <!-- harnessed-generated:v4.9.1 -->
53
+ The numbered sequence below **is** the state machine — execute it with Bash. Do NOT improvise
54
+ an equivalent flow from the Overview above: freelancing bypasses the engine (no ledger, no
55
+ evidence guard). harnessed gives you the spawn-ready prompt; YOU spawn the subagent with a
56
+ CC-native Task / Agent tool (keeps the session responsive + lets clarification round-trips reach the user).
57
+
58
+ Do NOT pipe to `harnessed run verify-code-review` — that is the CI/headless path (in-process SDK spawn
59
+ that blocks the session inside Claude Code).
60
+
61
+ 1. Bash: `harnessed prompt verify-code-review --task "$ARGUMENTS" --json` → parse `{prompt, max_iterations, model}`.
62
+ 2. Spawn a CC-native subagent (Task / Agent tool) with that `prompt` + `model`, wrapped in the ralph-loop plugin: `/ralph-loop "<prompt>" --max-iterations <max_iterations> --completion-promise "COMPLETE"`. If the plugin is absent, self-loop: spawn → check output for `<promise>COMPLETE</promise>` → re-spawn with prior output appended (up to max_iterations).
63
+ 3. If the output contains `STATUS: NEEDS_CLARIFICATION` + a question list: STOP, relay them verbatim via AskUserQuestion, append the answers to the spec, then re-spawn the same sub.
64
+ 4. On `<promise>COMPLETE</promise>`: Bash `harnessed checkpoint complete verify-code-review --summary "<one-line>"`. The evidence guard runs here (fail-CLOSED): if a declared `artifacts_expected` file is missing it exits non-zero — re-spawn to produce it before treating the sub as done.
65
+
66
+ <!-- harnessed-generated:v4.9.3 -->
65
67
 
66
68
  ## References
67
69
 
@@ -50,16 +50,19 @@ Sister `workflows/judgments/parallelism-gate.yaml`:
50
50
 
51
51
  ## 如何调用
52
52
 
53
- CC-native 编排。**不要** pipe 到 `harnessed run verify-code-review` —— 那是 CI/headless 路径(in-process
54
- SDK spawn,会阻塞 session、绕过 Agent Teams,在 Claude Code 内部调用时还会挂死)。
53
+ 下面这套编号序列**就是** state machine —— 用 Bash 执行。**不要**从上方 Overview 自行演绎等价流程:
54
+ freestyle 会旁路引擎(无 ledger、无 evidence guard)。harnessed 给你 spawn-ready prompt;**你**用
55
+ CC-native Task / Agent 工具 spawn subagent(保持 session 响应 + 让澄清 round-trip 能回到用户)。
55
56
 
56
- 改用 `/verify-code-review` slash command(由 `harnessed setup` 生成于 `~/.claude/commands/verify-code-review.md`)。
57
- 它以 CC-native 方式驱动:`harnessed gates` 决定哪些 sub fire,`harnessed prompt <sub>` 给出每个
58
- spawn-ready prompt,然后用 CC-native subagent(Task / Agent 工具)逐个 spawn 已 fire 的 sub,
59
- 每个结果用 `harnessed checkpoint` 记录。完整 state-machine 步骤见 `~/.claude/commands/verify-code-review.md`;
60
- 若该文件不存在,自行按 gates → prompt → spawn → checkpoint 同序执行。
57
+ **不要** pipe 到 `harnessed run verify-code-review` —— 那是 CI/headless 路径(in-process SDK spawn,在 Claude
58
+ Code 内部会阻塞 session)。
61
59
 
62
- <!-- harnessed-generated:v4.9.1 -->
60
+ 1. Bash: `harnessed prompt verify-code-review --task "$ARGUMENTS" --json` → 解析 `{prompt, max_iterations, model}`。
61
+ 2. 用 CC-native subagent(Task / Agent 工具)以该 `prompt` + `model` spawn,用 ralph-loop plugin 包裹:`/ralph-loop "<prompt>" --max-iterations <max_iterations> --completion-promise "COMPLETE"`。若 plugin 未装,自循环:spawn → 检查 `<promise>COMPLETE</promise>` → 把上轮输出 append 后重 spawn(至多 max_iterations)。
62
+ 3. 若输出含 `STATUS: NEEDS_CLARIFICATION` + 问题列表:STOP,用 AskUserQuestion 原样转达,把答案 append 进 spec,再重 spawn。
63
+ 4. 命中 `<promise>COMPLETE</promise>`:Bash `harnessed checkpoint complete verify-code-review --summary "<one-line>"`。evidence guard 在此运行(fail-CLOSED):若声明的 `artifacts_expected` 文件缺失会 exit 非零 —— 重 spawn 产出它再算 done。
64
+
65
+ <!-- harnessed-generated:v4.9.3 -->
63
66
 
64
67
  ## 参考资料
65
68
 
@@ -52,18 +52,20 @@ Sister `workflows/judgments/stage-routing.yaml`:
52
52
 
53
53
  ## How to invoke
54
54
 
55
- Orchestrated CC-natively. Do NOT pipe to `harnessed run verify-design` — that is the CI/headless
56
- path (an in-process SDK spawn that blocks the session, bypasses Agent Teams, and hangs when
57
- invoked from inside a Claude Code session).
58
-
59
- Run the `/verify-design` slash command instead (generated by `harnessed setup` at
60
- `~/.claude/commands/verify-design.md`). It drives the stage natively: `harnessed gates` → which
61
- subs fire, `harnessed prompt <sub>` → each spawn-ready prompt, then a CC-native subagent
62
- (Task / Agent tool) per fired sub, recording each outcome with `harnessed checkpoint`. The
63
- full state-machine steps live in `~/.claude/commands/verify-design.md`; if that file is absent,
64
- follow that same gates → prompt → spawn → checkpoint sequence yourself.
65
-
66
- <!-- harnessed-generated:v4.9.1 -->
55
+ The numbered sequence below **is** the state machine — execute it with Bash. Do NOT improvise
56
+ an equivalent flow from the Overview above: freelancing bypasses the engine (no ledger, no
57
+ evidence guard). harnessed gives you the spawn-ready prompt; YOU spawn the subagent with a
58
+ CC-native Task / Agent tool (keeps the session responsive + lets clarification round-trips reach the user).
59
+
60
+ Do NOT pipe to `harnessed run verify-design` — that is the CI/headless path (in-process SDK spawn
61
+ that blocks the session inside Claude Code).
62
+
63
+ 1. Bash: `harnessed prompt verify-design --task "$ARGUMENTS" --json` → parse `{prompt, max_iterations, model}`.
64
+ 2. Spawn a CC-native subagent (Task / Agent tool) with that `prompt` + `model`, wrapped in the ralph-loop plugin: `/ralph-loop "<prompt>" --max-iterations <max_iterations> --completion-promise "COMPLETE"`. If the plugin is absent, self-loop: spawn → check output for `<promise>COMPLETE</promise>` → re-spawn with prior output appended (up to max_iterations).
65
+ 3. If the output contains `STATUS: NEEDS_CLARIFICATION` + a question list: STOP, relay them verbatim via AskUserQuestion, append the answers to the spec, then re-spawn the same sub.
66
+ 4. On `<promise>COMPLETE</promise>`: Bash `harnessed checkpoint complete verify-design --summary "<one-line>"`. The evidence guard runs here (fail-CLOSED): if a declared `artifacts_expected` file is missing it exits non-zero — re-spawn to produce it before treating the sub as done.
67
+
68
+ <!-- harnessed-generated:v4.9.3 -->
67
69
 
68
70
  ## References
69
71
 
@@ -52,16 +52,19 @@ Sister `workflows/judgments/stage-routing.yaml`:
52
52
 
53
53
  ## 如何调用
54
54
 
55
- CC-native 编排。**不要** pipe 到 `harnessed run verify-design` —— 那是 CI/headless 路径(in-process
56
- SDK spawn,会阻塞 session、绕过 Agent Teams,在 Claude Code 内部调用时还会挂死)。
55
+ 下面这套编号序列**就是** state machine —— 用 Bash 执行。**不要**从上方 Overview 自行演绎等价流程:
56
+ freestyle 会旁路引擎(无 ledger、无 evidence guard)。harnessed 给你 spawn-ready prompt;**你**用
57
+ CC-native Task / Agent 工具 spawn subagent(保持 session 响应 + 让澄清 round-trip 能回到用户)。
57
58
 
58
- 改用 `/verify-design` slash command(由 `harnessed setup` 生成于 `~/.claude/commands/verify-design.md`)。
59
- 它以 CC-native 方式驱动:`harnessed gates` 决定哪些 sub fire,`harnessed prompt <sub>` 给出每个
60
- spawn-ready prompt,然后用 CC-native subagent(Task / Agent 工具)逐个 spawn 已 fire 的 sub,
61
- 每个结果用 `harnessed checkpoint` 记录。完整 state-machine 步骤见 `~/.claude/commands/verify-design.md`;
62
- 若该文件不存在,自行按 gates → prompt → spawn → checkpoint 同序执行。
59
+ **不要** pipe 到 `harnessed run verify-design` —— 那是 CI/headless 路径(in-process SDK spawn,在 Claude
60
+ Code 内部会阻塞 session)。
63
61
 
64
- <!-- harnessed-generated:v4.9.1 -->
62
+ 1. Bash: `harnessed prompt verify-design --task "$ARGUMENTS" --json` → 解析 `{prompt, max_iterations, model}`。
63
+ 2. 用 CC-native subagent(Task / Agent 工具)以该 `prompt` + `model` spawn,用 ralph-loop plugin 包裹:`/ralph-loop "<prompt>" --max-iterations <max_iterations> --completion-promise "COMPLETE"`。若 plugin 未装,自循环:spawn → 检查 `<promise>COMPLETE</promise>` → 把上轮输出 append 后重 spawn(至多 max_iterations)。
64
+ 3. 若输出含 `STATUS: NEEDS_CLARIFICATION` + 问题列表:STOP,用 AskUserQuestion 原样转达,把答案 append 进 spec,再重 spawn。
65
+ 4. 命中 `<promise>COMPLETE</promise>`:Bash `harnessed checkpoint complete verify-design --summary "<one-line>"`。evidence guard 在此运行(fail-CLOSED):若声明的 `artifacts_expected` 文件缺失会 exit 非零 —— 重 spawn 产出它再算 done。
66
+
67
+ <!-- harnessed-generated:v4.9.3 -->
65
68
 
66
69
  ## 参考资料
67
70
 
@@ -66,18 +66,20 @@ Phase-level `on` clause (critical-release 升级触发):
66
66
 
67
67
  ## How to invoke
68
68
 
69
- Orchestrated CC-natively. Do NOT pipe to `harnessed run verify-multispec` — that is the CI/headless
70
- path (an in-process SDK spawn that blocks the session, bypasses Agent Teams, and hangs when
71
- invoked from inside a Claude Code session).
72
-
73
- Run the `/verify-multispec` slash command instead (generated by `harnessed setup` at
74
- `~/.claude/commands/verify-multispec.md`). It drives the stage natively: `harnessed gates` → which
75
- subs fire, `harnessed prompt <sub>` → each spawn-ready prompt, then a CC-native subagent
76
- (Task / Agent tool) per fired sub, recording each outcome with `harnessed checkpoint`. The
77
- full state-machine steps live in `~/.claude/commands/verify-multispec.md`; if that file is absent,
78
- follow that same gates → prompt → spawn → checkpoint sequence yourself.
79
-
80
- <!-- harnessed-generated:v4.9.1 -->
69
+ The numbered sequence below **is** the state machine — execute it with Bash. Do NOT improvise
70
+ an equivalent flow from the Overview above: freelancing bypasses the engine (no ledger, no
71
+ evidence guard). harnessed gives you the spawn-ready prompt; YOU spawn the subagent with a
72
+ CC-native Task / Agent tool (keeps the session responsive + lets clarification round-trips reach the user).
73
+
74
+ Do NOT pipe to `harnessed run verify-multispec` — that is the CI/headless path (in-process SDK spawn
75
+ that blocks the session inside Claude Code).
76
+
77
+ 1. Bash: `harnessed prompt verify-multispec --task "$ARGUMENTS" --json` → parse `{prompt, max_iterations, model}`.
78
+ 2. Spawn a CC-native subagent (Task / Agent tool) with that `prompt` + `model`, wrapped in the ralph-loop plugin: `/ralph-loop "<prompt>" --max-iterations <max_iterations> --completion-promise "COMPLETE"`. If the plugin is absent, self-loop: spawn → check output for `<promise>COMPLETE</promise>` → re-spawn with prior output appended (up to max_iterations).
79
+ 3. If the output contains `STATUS: NEEDS_CLARIFICATION` + a question list: STOP, relay them verbatim via AskUserQuestion, append the answers to the spec, then re-spawn the same sub.
80
+ 4. On `<promise>COMPLETE</promise>`: Bash `harnessed checkpoint complete verify-multispec --summary "<one-line>"`. The evidence guard runs here (fail-CLOSED): if a declared `artifacts_expected` file is missing it exits non-zero — re-spawn to produce it before treating the sub as done.
81
+
82
+ <!-- harnessed-generated:v4.9.3 -->
81
83
 
82
84
  ## References
83
85
 
@@ -66,16 +66,19 @@ Phase 级 `on` 子句(critical-release 升级触发):
66
66
 
67
67
  ## 如何调用
68
68
 
69
- CC-native 编排。**不要** pipe 到 `harnessed run verify-multispec` —— 那是 CI/headless 路径(in-process
70
- SDK spawn,会阻塞 session、绕过 Agent Teams,在 Claude Code 内部调用时还会挂死)。
69
+ 下面这套编号序列**就是** state machine —— 用 Bash 执行。**不要**从上方 Overview 自行演绎等价流程:
70
+ freestyle 会旁路引擎(无 ledger、无 evidence guard)。harnessed 给你 spawn-ready prompt;**你**用
71
+ CC-native Task / Agent 工具 spawn subagent(保持 session 响应 + 让澄清 round-trip 能回到用户)。
71
72
 
72
- 改用 `/verify-multispec` slash command(由 `harnessed setup` 生成于 `~/.claude/commands/verify-multispec.md`)。
73
- 它以 CC-native 方式驱动:`harnessed gates` 决定哪些 sub fire,`harnessed prompt <sub>` 给出每个
74
- spawn-ready prompt,然后用 CC-native subagent(Task / Agent 工具)逐个 spawn 已 fire 的 sub,
75
- 每个结果用 `harnessed checkpoint` 记录。完整 state-machine 步骤见 `~/.claude/commands/verify-multispec.md`;
76
- 若该文件不存在,自行按 gates → prompt → spawn → checkpoint 同序执行。
73
+ **不要** pipe 到 `harnessed run verify-multispec` —— 那是 CI/headless 路径(in-process SDK spawn,在 Claude
74
+ Code 内部会阻塞 session)。
77
75
 
78
- <!-- harnessed-generated:v4.9.1 -->
76
+ 1. Bash: `harnessed prompt verify-multispec --task "$ARGUMENTS" --json` → 解析 `{prompt, max_iterations, model}`。
77
+ 2. 用 CC-native subagent(Task / Agent 工具)以该 `prompt` + `model` spawn,用 ralph-loop plugin 包裹:`/ralph-loop "<prompt>" --max-iterations <max_iterations> --completion-promise "COMPLETE"`。若 plugin 未装,自循环:spawn → 检查 `<promise>COMPLETE</promise>` → 把上轮输出 append 后重 spawn(至多 max_iterations)。
78
+ 3. 若输出含 `STATUS: NEEDS_CLARIFICATION` + 问题列表:STOP,用 AskUserQuestion 原样转达,把答案 append 进 spec,再重 spawn。
79
+ 4. 命中 `<promise>COMPLETE</promise>`:Bash `harnessed checkpoint complete verify-multispec --summary "<one-line>"`。evidence guard 在此运行(fail-CLOSED):若声明的 `artifacts_expected` 文件缺失会 exit 非零 —— 重 spawn 产出它再算 done。
80
+
81
+ <!-- harnessed-generated:v4.9.3 -->
79
82
 
80
83
  ## 参考资料
81
84
 
@@ -52,18 +52,20 @@ Sister `workflows/judgments/stage-routing.yaml`:
52
52
 
53
53
  ## How to invoke
54
54
 
55
- Orchestrated CC-natively. Do NOT pipe to `harnessed run verify-paranoid` — that is the CI/headless
56
- path (an in-process SDK spawn that blocks the session, bypasses Agent Teams, and hangs when
57
- invoked from inside a Claude Code session).
58
-
59
- Run the `/verify-paranoid` slash command instead (generated by `harnessed setup` at
60
- `~/.claude/commands/verify-paranoid.md`). It drives the stage natively: `harnessed gates` → which
61
- subs fire, `harnessed prompt <sub>` → each spawn-ready prompt, then a CC-native subagent
62
- (Task / Agent tool) per fired sub, recording each outcome with `harnessed checkpoint`. The
63
- full state-machine steps live in `~/.claude/commands/verify-paranoid.md`; if that file is absent,
64
- follow that same gates → prompt → spawn → checkpoint sequence yourself.
65
-
66
- <!-- harnessed-generated:v4.9.1 -->
55
+ The numbered sequence below **is** the state machine — execute it with Bash. Do NOT improvise
56
+ an equivalent flow from the Overview above: freelancing bypasses the engine (no ledger, no
57
+ evidence guard). harnessed gives you the spawn-ready prompt; YOU spawn the subagent with a
58
+ CC-native Task / Agent tool (keeps the session responsive + lets clarification round-trips reach the user).
59
+
60
+ Do NOT pipe to `harnessed run verify-paranoid` — that is the CI/headless path (in-process SDK spawn
61
+ that blocks the session inside Claude Code).
62
+
63
+ 1. Bash: `harnessed prompt verify-paranoid --task "$ARGUMENTS" --json` → parse `{prompt, max_iterations, model}`.
64
+ 2. Spawn a CC-native subagent (Task / Agent tool) with that `prompt` + `model`, wrapped in the ralph-loop plugin: `/ralph-loop "<prompt>" --max-iterations <max_iterations> --completion-promise "COMPLETE"`. If the plugin is absent, self-loop: spawn → check output for `<promise>COMPLETE</promise>` → re-spawn with prior output appended (up to max_iterations).
65
+ 3. If the output contains `STATUS: NEEDS_CLARIFICATION` + a question list: STOP, relay them verbatim via AskUserQuestion, append the answers to the spec, then re-spawn the same sub.
66
+ 4. On `<promise>COMPLETE</promise>`: Bash `harnessed checkpoint complete verify-paranoid --summary "<one-line>"`. The evidence guard runs here (fail-CLOSED): if a declared `artifacts_expected` file is missing it exits non-zero — re-spawn to produce it before treating the sub as done.
67
+
68
+ <!-- harnessed-generated:v4.9.3 -->
67
69
 
68
70
  ## References
69
71