harnessed 4.9.0 → 4.10.0

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 (61) hide show
  1. package/README.md +40 -4
  2. package/bin/harnessed-inject-state.mjs +103 -2
  3. package/dist/cli.mjs +1717 -1418
  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/package.json +1 -1
  8. package/workflows/auto/SKILL.md +26 -12
  9. package/workflows/auto/SKILL.zh-Hans.md +25 -12
  10. package/workflows/discuss/auto/SKILL.md +12 -8
  11. package/workflows/discuss/auto/SKILL.zh-Hans.md +11 -8
  12. package/workflows/discuss/phase/SKILL.md +12 -8
  13. package/workflows/discuss/phase/SKILL.zh-Hans.md +11 -8
  14. package/workflows/discuss/strategic/SKILL.md +12 -8
  15. package/workflows/discuss/strategic/SKILL.zh-Hans.md +11 -8
  16. package/workflows/discuss/subtask/SKILL.md +12 -8
  17. package/workflows/discuss/subtask/SKILL.zh-Hans.md +11 -8
  18. package/workflows/plan/architecture/SKILL.md +11 -8
  19. package/workflows/plan/architecture/SKILL.zh-Hans.md +10 -8
  20. package/workflows/plan/auto/SKILL.md +26 -11
  21. package/workflows/plan/auto/SKILL.zh-Hans.md +25 -11
  22. package/workflows/plan/phase/SKILL.md +11 -8
  23. package/workflows/plan/phase/SKILL.zh-Hans.md +10 -8
  24. package/workflows/research/SKILL.md +11 -37
  25. package/workflows/research/SKILL.zh-Hans.md +10 -37
  26. package/workflows/retro/SKILL.md +11 -8
  27. package/workflows/retro/SKILL.zh-Hans.md +10 -8
  28. package/workflows/role-prompts.yaml +34 -0
  29. package/workflows/role-prompts.zh-Hans.yaml +33 -0
  30. package/workflows/ship/auto/SKILL.md +29 -0
  31. package/workflows/ship/auto/SKILL.zh-Hans.md +28 -0
  32. package/workflows/ship/preflight/SKILL.md +17 -0
  33. package/workflows/ship/preflight/SKILL.zh-Hans.md +16 -0
  34. package/workflows/task/auto/SKILL.md +26 -11
  35. package/workflows/task/auto/SKILL.zh-Hans.md +27 -13
  36. package/workflows/task/clarify/SKILL.md +12 -8
  37. package/workflows/task/clarify/SKILL.zh-Hans.md +12 -9
  38. package/workflows/task/code/SKILL.md +11 -8
  39. package/workflows/task/code/SKILL.zh-Hans.md +11 -9
  40. package/workflows/task/deliver/SKILL.md +11 -8
  41. package/workflows/task/deliver/SKILL.zh-Hans.md +11 -9
  42. package/workflows/task/test/SKILL.md +11 -8
  43. package/workflows/task/test/SKILL.zh-Hans.md +11 -9
  44. package/workflows/verify/auto/SKILL.md +26 -11
  45. package/workflows/verify/auto/SKILL.zh-Hans.md +25 -11
  46. package/workflows/verify/code-review/SKILL.md +11 -8
  47. package/workflows/verify/code-review/SKILL.zh-Hans.md +10 -8
  48. package/workflows/verify/design/SKILL.md +11 -8
  49. package/workflows/verify/design/SKILL.zh-Hans.md +11 -9
  50. package/workflows/verify/multispec/SKILL.md +11 -8
  51. package/workflows/verify/multispec/SKILL.zh-Hans.md +11 -9
  52. package/workflows/verify/paranoid/SKILL.md +11 -8
  53. package/workflows/verify/paranoid/SKILL.zh-Hans.md +11 -9
  54. package/workflows/verify/progress/SKILL.md +11 -8
  55. package/workflows/verify/progress/SKILL.zh-Hans.md +11 -9
  56. package/workflows/verify/qa/SKILL.md +11 -8
  57. package/workflows/verify/qa/SKILL.zh-Hans.md +11 -9
  58. package/workflows/verify/security/SKILL.md +11 -8
  59. package/workflows/verify/security/SKILL.zh-Hans.md +11 -9
  60. package/workflows/verify/simplify/SKILL.md +11 -8
  61. package/workflows/verify/simplify/SKILL.zh-Hans.md +11 -9
@@ -84,17 +84,20 @@ Claude Code plugin marketplace).
84
84
 
85
85
  ## How to invoke
86
86
 
87
- Use the Bash tool to run:
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).
88
91
 
89
- ```bash
90
- echo "$ARGUMENTS" | harnessed run task-deliver --task-stdin
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).
92
94
 
93
- If `$ARGUMENTS` is empty, run `harnessed run task-deliver` (no stdin pipe).
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.
94
99
 
95
- After completion, the Bash output prints a `Next:` hint on stderr suggesting the next stage. Decide whether to invoke based on conversation context — the hint is informational, not prescriptive.
96
-
97
- <!-- harnessed-generated:v3.4.4 -->
100
+ <!-- harnessed-generated:v4.9.3 -->
98
101
 
99
102
  ## References
100
103
 
@@ -82,19 +82,21 @@ subtask 标记为完成——对应 Phase 01-code progress update 模式,是 S
82
82
  的最后一次调用。需要安装 `planning-with-files` Claude Code plugin(通过
83
83
  Claude Code plugin marketplace 安装)。
84
84
 
85
- ## How to invoke
85
+ ## 如何调用
86
86
 
87
- 使用 Bash 工具运行:
87
+ 下面这套编号序列**就是** state machine —— 用 Bash 执行。**不要**从上方 Overview 自行演绎等价流程:
88
+ freestyle 会旁路引擎(无 ledger、无 evidence guard)。harnessed 给你 spawn-ready prompt;**你**用
89
+ CC-native Task / Agent 工具 spawn subagent(保持 session 响应 + 让澄清 round-trip 能回到用户)。
88
90
 
89
- ```bash
90
- echo "$ARGUMENTS" | harnessed run task-deliver --task-stdin
91
- ```
91
+ **不要** pipe 到 `harnessed run task-deliver` —— 那是 CI/headless 路径(in-process SDK spawn,在 Claude
92
+ Code 内部会阻塞 session)。
92
93
 
93
- 若 `$ARGUMENTS` 为空,运行 `harnessed run task-deliver`(不带 stdin pipe)。
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。
94
98
 
95
- 执行完成后,Bash 输出会在 stderr 打印 `Next:` 提示,建议下一个阶段。根据对话上下文自行决定是否调用——该提示仅供参考,不具强制性。
96
-
97
- <!-- harnessed-generated:v3.4.4 -->
99
+ <!-- harnessed-generated:v4.9.3 -->
98
100
 
99
101
  ## References
100
102
 
@@ -65,17 +65,20 @@ fix → regression-test), 测试通过则 skip diagnose entirely。
65
65
 
66
66
  ## How to invoke
67
67
 
68
- Use the Bash tool to run:
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).
69
72
 
70
- ```bash
71
- echo "$ARGUMENTS" | harnessed run task-test --task-stdin
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).
73
75
 
74
- If `$ARGUMENTS` is empty, run `harnessed run task-test` (no stdin pipe).
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.
75
80
 
76
- After completion, the Bash output prints a `Next:` hint on stderr suggesting the next stage. Decide whether to invoke based on conversation context — the hint is informational, not prescriptive.
77
-
78
- <!-- harnessed-generated:v3.4.4 -->
81
+ <!-- harnessed-generated:v4.9.3 -->
79
82
 
80
83
  ## References
81
84
 
@@ -63,19 +63,21 @@ SDK,用户发出明确信号时可切换至 mattpocock /tdd 别名路径。
63
63
  测试失败时进入 diagnose 循环(reproduce → minimise → hypothesise → instrument →
64
64
  fix → regression-test),测试通过则完全跳过 diagnose。
65
65
 
66
- ## 调用方式
66
+ ## 如何调用
67
67
 
68
- 使用 Bash 工具运行:
68
+ 下面这套编号序列**就是** state machine —— 用 Bash 执行。**不要**从上方 Overview 自行演绎等价流程:
69
+ freestyle 会旁路引擎(无 ledger、无 evidence guard)。harnessed 给你 spawn-ready prompt;**你**用
70
+ CC-native Task / Agent 工具 spawn subagent(保持 session 响应 + 让澄清 round-trip 能回到用户)。
69
71
 
70
- ```bash
71
- echo "$ARGUMENTS" | harnessed run task-test --task-stdin
72
- ```
72
+ **不要** pipe 到 `harnessed run task-test` —— 那是 CI/headless 路径(in-process SDK spawn,在 Claude
73
+ Code 内部会阻塞 session)。
73
74
 
74
- 若 `$ARGUMENTS` 为空,运行 `harnessed run task-test`(不带 stdin pipe)。
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。
75
79
 
76
- 执行完成后,Bash 输出会在 stderr 打印 `Next:` 提示,建议下一阶段操作。是否调用取决于对话上下文——该提示仅供参考,不具强制性。
77
-
78
- <!-- harnessed-generated:v3.4.4 -->
80
+ <!-- harnessed-generated:v4.9.3 -->
79
81
 
80
82
  ## 参考资料
81
83
 
@@ -66,17 +66,32 @@ Sister `workflows/capabilities.yaml`:
66
66
 
67
67
  ## How to invoke
68
68
 
69
- Use the Bash tool to run:
70
-
71
- ```bash
72
- echo "$ARGUMENTS" | harnessed run verify --task-stdin
73
- ```
74
-
75
- If `$ARGUMENTS` is empty, run `harnessed run verify` (no stdin pipe).
76
-
77
- After completion, the Bash output prints a `Next:` hint on stderr suggesting the next stage. Decide whether to invoke based on conversation context — the hint is informational, not prescriptive.
78
-
79
- <!-- harnessed-generated:v3.4.4 -->
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 -->
80
95
 
81
96
  ## References
82
97
 
@@ -66,17 +66,31 @@ Sister `workflows/capabilities.yaml`:
66
66
 
67
67
  ## 如何调用
68
68
 
69
- 使用 Bash 工具运行:
70
-
71
- ```bash
72
- echo "$ARGUMENTS" | harnessed run verify --task-stdin
73
- ```
74
-
75
- 若 `$ARGUMENTS` 为空,运行 `harnessed run verify`(不带 stdin pipe)。
76
-
77
- 执行完成后,Bash 输出会在 stderr 打印 `Next:` 提示,建议下一阶段操作。是否调用取决于对话上下文——该提示仅供参考,不具强制性。
78
-
79
- <!-- harnessed-generated:v3.4.4 -->
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 -->
80
94
 
81
95
  ## 参考资料
82
96
 
@@ -50,17 +50,20 @@ Sister `workflows/judgments/parallelism-gate.yaml`:
50
50
 
51
51
  ## How to invoke
52
52
 
53
- Use the Bash tool to run:
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).
54
57
 
55
- ```bash
56
- echo "$ARGUMENTS" | harnessed run verify-code-review --task-stdin
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).
58
60
 
59
- If `$ARGUMENTS` is empty, run `harnessed run verify-code-review` (no stdin pipe).
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.
60
65
 
61
- After completion, the Bash output prints a `Next:` hint on stderr suggesting the next stage. Decide whether to invoke based on conversation context — the hint is informational, not prescriptive.
62
-
63
- <!-- harnessed-generated:v3.4.4 -->
66
+ <!-- harnessed-generated:v4.9.3 -->
64
67
 
65
68
  ## References
66
69
 
@@ -50,17 +50,19 @@ Sister `workflows/judgments/parallelism-gate.yaml`:
50
50
 
51
51
  ## 如何调用
52
52
 
53
- 使用 Bash 工具运行:
53
+ 下面这套编号序列**就是** state machine —— 用 Bash 执行。**不要**从上方 Overview 自行演绎等价流程:
54
+ freestyle 会旁路引擎(无 ledger、无 evidence guard)。harnessed 给你 spawn-ready prompt;**你**用
55
+ CC-native Task / Agent 工具 spawn subagent(保持 session 响应 + 让澄清 round-trip 能回到用户)。
54
56
 
55
- ```bash
56
- echo "$ARGUMENTS" | harnessed run verify-code-review --task-stdin
57
- ```
57
+ **不要** pipe 到 `harnessed run verify-code-review` —— 那是 CI/headless 路径(in-process SDK spawn,在 Claude
58
+ Code 内部会阻塞 session)。
58
59
 
59
- 若 `$ARGUMENTS` 为空,运行 `harnessed run verify-code-review`(不带 stdin pipe)。
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。
60
64
 
61
- 执行完成后,Bash 输出会在 stderr 打印 `Next:` 提示,建议下一阶段操作。是否调用取决于对话上下文——该提示仅供参考,不具强制性。
62
-
63
- <!-- harnessed-generated:v3.4.4 -->
65
+ <!-- harnessed-generated:v4.9.3 -->
64
66
 
65
67
  ## 参考资料
66
68
 
@@ -52,17 +52,20 @@ Sister `workflows/judgments/stage-routing.yaml`:
52
52
 
53
53
  ## How to invoke
54
54
 
55
- Use the Bash tool to run:
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).
56
59
 
57
- ```bash
58
- echo "$ARGUMENTS" | harnessed run verify-design --task-stdin
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).
60
62
 
61
- If `$ARGUMENTS` is empty, run `harnessed run verify-design` (no stdin pipe).
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.
62
67
 
63
- After completion, the Bash output prints a `Next:` hint on stderr suggesting the next stage. Decide whether to invoke based on conversation context — the hint is informational, not prescriptive.
64
-
65
- <!-- harnessed-generated:v3.4.4 -->
68
+ <!-- harnessed-generated:v4.9.3 -->
66
69
 
67
70
  ## References
68
71
 
@@ -50,19 +50,21 @@ Sister `workflows/judgments/stage-routing.yaml`:
50
50
  - 创意补充 / 不要 AI 味 → `frontend-design`
51
51
  - 用户明示「独特 / 不要 AI 感」→ frontend-design 主导,否则 ui-ux-pro-max 优先
52
52
 
53
- ## 调用方式
53
+ ## 如何调用
54
54
 
55
- 使用 Bash 工具运行:
55
+ 下面这套编号序列**就是** state machine —— 用 Bash 执行。**不要**从上方 Overview 自行演绎等价流程:
56
+ freestyle 会旁路引擎(无 ledger、无 evidence guard)。harnessed 给你 spawn-ready prompt;**你**用
57
+ CC-native Task / Agent 工具 spawn subagent(保持 session 响应 + 让澄清 round-trip 能回到用户)。
56
58
 
57
- ```bash
58
- echo "$ARGUMENTS" | harnessed run verify-design --task-stdin
59
- ```
59
+ **不要** pipe 到 `harnessed run verify-design` —— 那是 CI/headless 路径(in-process SDK spawn,在 Claude
60
+ Code 内部会阻塞 session)。
60
61
 
61
- 若 `$ARGUMENTS` 为空,运行 `harnessed run verify-design`(不带 stdin pipe)。
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。
62
66
 
63
- 执行完成后,Bash 输出会在 stderr 打印 `Next:` 提示,建议下一阶段操作。是否继续调用,请根据对话上下文自行判断——该提示仅供参考,并非强制指令。
64
-
65
- <!-- harnessed-generated:v3.4.4 -->
67
+ <!-- harnessed-generated:v4.9.3 -->
66
68
 
67
69
  ## 参考资料
68
70
 
@@ -66,17 +66,20 @@ Phase-level `on` clause (critical-release 升级触发):
66
66
 
67
67
  ## How to invoke
68
68
 
69
- Use the Bash tool to run:
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).
70
73
 
71
- ```bash
72
- echo "$ARGUMENTS" | harnessed run verify-multispec --task-stdin
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).
74
76
 
75
- If `$ARGUMENTS` is empty, run `harnessed run verify-multispec` (no stdin pipe).
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.
76
81
 
77
- After completion, the Bash output prints a `Next:` hint on stderr suggesting the next stage. Decide whether to invoke based on conversation context — the hint is informational, not prescriptive.
78
-
79
- <!-- harnessed-generated:v3.4.4 -->
82
+ <!-- harnessed-generated:v4.9.3 -->
80
83
 
81
84
  ## References
82
85
 
@@ -64,19 +64,21 @@ Phase 级 `on` 子句(critical-release 升级触发):
64
64
  - **Token 估算前置条件**:`team_cost < 2 × subagent_cost`(engine-level check;bundled cost guideline)
65
65
  - **Cleanup 必跑**:phase 02-team-cleanup `agent-teams-shutdown` 必跑(bundled cleanup discipline)
66
66
 
67
- ## 调用方式
67
+ ## 如何调用
68
68
 
69
- 使用 Bash 工具运行:
69
+ 下面这套编号序列**就是** state machine —— 用 Bash 执行。**不要**从上方 Overview 自行演绎等价流程:
70
+ freestyle 会旁路引擎(无 ledger、无 evidence guard)。harnessed 给你 spawn-ready prompt;**你**用
71
+ CC-native Task / Agent 工具 spawn subagent(保持 session 响应 + 让澄清 round-trip 能回到用户)。
70
72
 
71
- ```bash
72
- echo "$ARGUMENTS" | harnessed run verify-multispec --task-stdin
73
- ```
73
+ **不要** pipe 到 `harnessed run verify-multispec` —— 那是 CI/headless 路径(in-process SDK spawn,在 Claude
74
+ Code 内部会阻塞 session)。
74
75
 
75
- 若 `$ARGUMENTS` 为空,运行 `harnessed run verify-multispec`(不带 stdin pipe)。
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。
76
80
 
77
- 执行完成后,Bash 输出会在 stderr 打印 `Next:` 提示,建议下一阶段操作。是否继续调用,请根据对话上下文自行判断——该提示仅供参考,并非强制指令。
78
-
79
- <!-- harnessed-generated:v3.4.4 -->
81
+ <!-- harnessed-generated:v4.9.3 -->
80
82
 
81
83
  ## 参考资料
82
84
 
@@ -52,17 +52,20 @@ Sister `workflows/judgments/stage-routing.yaml`:
52
52
 
53
53
  ## How to invoke
54
54
 
55
- Use the Bash tool to run:
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).
56
59
 
57
- ```bash
58
- echo "$ARGUMENTS" | harnessed run verify-paranoid --task-stdin
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).
60
62
 
61
- If `$ARGUMENTS` is empty, run `harnessed run verify-paranoid` (no stdin pipe).
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.
62
67
 
63
- After completion, the Bash output prints a `Next:` hint on stderr suggesting the next stage. Decide whether to invoke based on conversation context — the hint is informational, not prescriptive.
64
-
65
- <!-- harnessed-generated:v3.4.4 -->
68
+ <!-- harnessed-generated:v4.9.3 -->
66
69
 
67
70
  ## References
68
71
 
@@ -50,19 +50,21 @@ Sister `workflows/judgments/stage-routing.yaml`:
50
50
  - ✅ **触发**:关键模块 PR 前(auth / payment / data migration / core algorithm 等)
51
51
  - ❌ **跳过**:常规 PR / docs / config / 非核心 module
52
52
 
53
- ## 调用方式
53
+ ## 如何调用
54
54
 
55
- 使用 Bash 工具运行:
55
+ 下面这套编号序列**就是** state machine —— 用 Bash 执行。**不要**从上方 Overview 自行演绎等价流程:
56
+ freestyle 会旁路引擎(无 ledger、无 evidence guard)。harnessed 给你 spawn-ready prompt;**你**用
57
+ CC-native Task / Agent 工具 spawn subagent(保持 session 响应 + 让澄清 round-trip 能回到用户)。
56
58
 
57
- ```bash
58
- echo "$ARGUMENTS" | harnessed run verify-paranoid --task-stdin
59
- ```
59
+ **不要** pipe 到 `harnessed run verify-paranoid` —— 那是 CI/headless 路径(in-process SDK spawn,在 Claude
60
+ Code 内部会阻塞 session)。
60
61
 
61
- 若 `$ARGUMENTS` 为空,运行 `harnessed run verify-paranoid`(不带 stdin pipe)。
62
+ 1. Bash: `harnessed prompt verify-paranoid --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-paranoid --summary "<one-line>"`。evidence guard 在此运行(fail-CLOSED):若声明的 `artifacts_expected` 文件缺失会 exit 非零 —— 重 spawn 产出它再算 done。
62
66
 
63
- 执行完成后,Bash 输出会在 stderr 打印 `Next:` 提示,建议下一阶段操作。是否继续调用,请根据对话上下文自行判断——该提示仅供参考,并非强制指令。
64
-
65
- <!-- harnessed-generated:v3.4.4 -->
67
+ <!-- harnessed-generated:v4.9.3 -->
66
68
 
67
69
  ## 参考资料
68
70
 
@@ -48,17 +48,20 @@ verify-progress-always trigger)。无 skip 条件 — verify-work 起点必跑
48
48
 
49
49
  ## How to invoke
50
50
 
51
- Use the Bash tool to run:
51
+ The numbered sequence below **is** the state machine — execute it with Bash. Do NOT improvise
52
+ an equivalent flow from the Overview above: freelancing bypasses the engine (no ledger, no
53
+ evidence guard). harnessed gives you the spawn-ready prompt; YOU spawn the subagent with a
54
+ CC-native Task / Agent tool (keeps the session responsive + lets clarification round-trips reach the user).
52
55
 
53
- ```bash
54
- echo "$ARGUMENTS" | harnessed run verify-progress --task-stdin
55
- ```
56
+ Do NOT pipe to `harnessed run verify-progress` — that is the CI/headless path (in-process SDK spawn
57
+ that blocks the session inside Claude Code).
56
58
 
57
- If `$ARGUMENTS` is empty, run `harnessed run verify-progress` (no stdin pipe).
59
+ 1. Bash: `harnessed prompt verify-progress --task "$ARGUMENTS" --json` → parse `{prompt, max_iterations, model}`.
60
+ 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).
61
+ 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.
62
+ 4. On `<promise>COMPLETE</promise>`: Bash `harnessed checkpoint complete verify-progress --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.
58
63
 
59
- After completion, the Bash output prints a `Next:` hint on stderr suggesting the next stage. Decide whether to invoke based on conversation context — the hint is informational, not prescriptive.
60
-
61
- <!-- harnessed-generated:v3.4.4 -->
64
+ <!-- harnessed-generated:v4.9.3 -->
62
65
 
63
66
  ## References
64
67
 
@@ -45,19 +45,21 @@ Sister `workflows/capabilities.yaml` 条目:
45
45
  总 fire 当 `phase.stage == 'verify'`(sister `workflows/judgments/stage-routing.yaml`
46
46
  verify-progress-always trigger)。无 skip 条件 — verify-work 起点必跑。
47
47
 
48
- ## 调用方式
48
+ ## 如何调用
49
49
 
50
- 使用 Bash 工具运行:
50
+ 下面这套编号序列**就是** state machine —— 用 Bash 执行。**不要**从上方 Overview 自行演绎等价流程:
51
+ freestyle 会旁路引擎(无 ledger、无 evidence guard)。harnessed 给你 spawn-ready prompt;**你**用
52
+ CC-native Task / Agent 工具 spawn subagent(保持 session 响应 + 让澄清 round-trip 能回到用户)。
51
53
 
52
- ```bash
53
- echo "$ARGUMENTS" | harnessed run verify-progress --task-stdin
54
- ```
54
+ **不要** pipe 到 `harnessed run verify-progress` —— 那是 CI/headless 路径(in-process SDK spawn,在 Claude
55
+ Code 内部会阻塞 session)。
55
56
 
56
- 若 `$ARGUMENTS` 为空,运行 `harnessed run verify-progress`(不带 stdin pipe)。
57
+ 1. Bash: `harnessed prompt verify-progress --task "$ARGUMENTS" --json` → 解析 `{prompt, max_iterations, model}`。
58
+ 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)。
59
+ 3. 若输出含 `STATUS: NEEDS_CLARIFICATION` + 问题列表:STOP,用 AskUserQuestion 原样转达,把答案 append 进 spec,再重 spawn。
60
+ 4. 命中 `<promise>COMPLETE</promise>`:Bash `harnessed checkpoint complete verify-progress --summary "<one-line>"`。evidence guard 在此运行(fail-CLOSED):若声明的 `artifacts_expected` 文件缺失会 exit 非零 —— 重 spawn 产出它再算 done。
57
61
 
58
- 执行完成后,Bash 输出会在 stderr 打印 `Next:` 提示,建议下一阶段操作。是否继续调用,请根据对话上下文自行判断——该提示仅供参考,并非强制指令。
59
-
60
- <!-- harnessed-generated:v3.4.4 -->
62
+ <!-- harnessed-generated:v4.9.3 -->
61
63
 
62
64
  ## 参考资料
63
65
 
@@ -54,17 +54,20 @@ Sister `workflows/judgments/stage-routing.yaml`:
54
54
 
55
55
  ## How to invoke
56
56
 
57
- Use the Bash tool to run:
57
+ The numbered sequence below **is** the state machine — execute it with Bash. Do NOT improvise
58
+ an equivalent flow from the Overview above: freelancing bypasses the engine (no ledger, no
59
+ evidence guard). harnessed gives you the spawn-ready prompt; YOU spawn the subagent with a
60
+ CC-native Task / Agent tool (keeps the session responsive + lets clarification round-trips reach the user).
58
61
 
59
- ```bash
60
- echo "$ARGUMENTS" | harnessed run verify-qa --task-stdin
61
- ```
62
+ Do NOT pipe to `harnessed run verify-qa` — that is the CI/headless path (in-process SDK spawn
63
+ that blocks the session inside Claude Code).
62
64
 
63
- If `$ARGUMENTS` is empty, run `harnessed run verify-qa` (no stdin pipe).
65
+ 1. Bash: `harnessed prompt verify-qa --task "$ARGUMENTS" --json` → parse `{prompt, max_iterations, model}`.
66
+ 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).
67
+ 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.
68
+ 4. On `<promise>COMPLETE</promise>`: Bash `harnessed checkpoint complete verify-qa --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.
64
69
 
65
- After completion, the Bash output prints a `Next:` hint on stderr suggesting the next stage. Decide whether to invoke based on conversation context — the hint is informational, not prescriptive.
66
-
67
- <!-- harnessed-generated:v3.4.4 -->
70
+ <!-- harnessed-generated:v4.9.3 -->
68
71
 
69
72
  ## References
70
73
 
@@ -52,19 +52,21 @@ Sister `workflows/judgments/stage-routing.yaml`:
52
52
  - setup 需 Python 后端 (Tortoise ORM / pandas) → `webapp-testing` skill
53
53
  - 性能 / a11y / 内存诊断 → 不在此子工作流,用 `chrome-devtools-mcp`
54
54
 
55
- ## 调用方式
55
+ ## 如何调用
56
56
 
57
- 使用 Bash 工具运行:
57
+ 下面这套编号序列**就是** state machine —— 用 Bash 执行。**不要**从上方 Overview 自行演绎等价流程:
58
+ freestyle 会旁路引擎(无 ledger、无 evidence guard)。harnessed 给你 spawn-ready prompt;**你**用
59
+ CC-native Task / Agent 工具 spawn subagent(保持 session 响应 + 让澄清 round-trip 能回到用户)。
58
60
 
59
- ```bash
60
- echo "$ARGUMENTS" | harnessed run verify-qa --task-stdin
61
- ```
61
+ **不要** pipe 到 `harnessed run verify-qa` —— 那是 CI/headless 路径(in-process SDK spawn,在 Claude
62
+ Code 内部会阻塞 session)。
62
63
 
63
- 若 `$ARGUMENTS` 为空,则运行 `harnessed run verify-qa`(不接管道输入)。
64
+ 1. Bash: `harnessed prompt verify-qa --task "$ARGUMENTS" --json` → 解析 `{prompt, max_iterations, model}`。
65
+ 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)。
66
+ 3. 若输出含 `STATUS: NEEDS_CLARIFICATION` + 问题列表:STOP,用 AskUserQuestion 原样转达,把答案 append 进 spec,再重 spawn。
67
+ 4. 命中 `<promise>COMPLETE</promise>`:Bash `harnessed checkpoint complete verify-qa --summary "<one-line>"`。evidence guard 在此运行(fail-CLOSED):若声明的 `artifacts_expected` 文件缺失会 exit 非零 —— 重 spawn 产出它再算 done。
64
68
 
65
- 完成后,Bash 输出会在 stderr 打印 `Next:` 提示,建议下一阶段。是否调用取决于对话上下文 — 该提示仅供参考,非强制指令。
66
-
67
- <!-- harnessed-generated:v3.4.4 -->
69
+ <!-- harnessed-generated:v4.9.3 -->
68
70
 
69
71
  ## 参考资料
70
72