harnessed 4.32.21 → 4.36.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 (105) hide show
  1. package/README.md +6 -6
  2. package/bin/harnessed-inject-state.mjs +16 -0
  3. package/dist/cli.mjs +1419 -276
  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/dist/schemas/index.mjs.map +1 -1
  8. package/manifests/optional/chrome-devtools-mcp.yaml +60 -0
  9. package/manifests/optional/doc-discipline-gate.yaml +54 -0
  10. package/manifests/optional/ecc.yaml +28 -14
  11. package/manifests/tools/exa-mcp.yaml +51 -0
  12. package/manifests/tools/tavily-mcp.yaml +4 -4
  13. package/messages/en.json +11 -0
  14. package/messages/zh-Hans.json +11 -0
  15. package/package.json +1 -1
  16. package/routing/decision_rules.yaml +1 -1
  17. package/workflows/README.md +1 -1
  18. package/workflows/auto/SKILL.md +13 -9
  19. package/workflows/auto/SKILL.zh-Hans.md +13 -9
  20. package/workflows/capabilities.yaml +105 -45
  21. package/workflows/defaults.yaml +8 -2
  22. package/workflows/disciplines/karpathy.yaml +29 -0
  23. package/workflows/disciplines/karpathy.zh-Hans.yaml +27 -0
  24. package/workflows/disciplines/language.yaml +15 -10
  25. package/workflows/disciplines/operational.yaml +1 -1
  26. package/workflows/disciplines/operational.zh-Hans.yaml +1 -1
  27. package/workflows/disciplines/output-style.yaml +10 -2
  28. package/workflows/disciplines/output-style.zh-Hans.yaml +10 -2
  29. package/workflows/disciplines/priority.yaml +15 -2
  30. package/workflows/disciplines/priority.zh-Hans.yaml +15 -2
  31. package/workflows/discuss/auto/SKILL.md +4 -4
  32. package/workflows/discuss/auto/SKILL.zh-Hans.md +4 -4
  33. package/workflows/discuss/auto/workflow.yaml +16 -3
  34. package/workflows/discuss/phase/SKILL.md +1 -1
  35. package/workflows/discuss/phase/SKILL.zh-Hans.md +1 -1
  36. package/workflows/discuss/strategic/SKILL.md +1 -1
  37. package/workflows/discuss/strategic/SKILL.zh-Hans.md +1 -1
  38. package/workflows/discuss/subtask/SKILL.md +1 -1
  39. package/workflows/discuss/subtask/SKILL.zh-Hans.md +1 -1
  40. package/workflows/judgments/parallelism-gate.yaml +11 -6
  41. package/workflows/judgments/phase-gate.yaml +5 -1
  42. package/workflows/judgments/stage-routing.yaml +21 -26
  43. package/workflows/judgments/strategic-gate.yaml +30 -0
  44. package/workflows/judgments/user-overrides.yaml +7 -3
  45. package/workflows/judgments/web-search-routing.yaml +3 -3
  46. package/workflows/judgments/web-testing-routing.yaml +24 -7
  47. package/workflows/plan/architecture/SKILL.md +7 -3
  48. package/workflows/plan/architecture/SKILL.zh-Hans.md +7 -3
  49. package/workflows/plan/auto/SKILL.md +11 -7
  50. package/workflows/plan/auto/SKILL.zh-Hans.md +11 -7
  51. package/workflows/plan/phase/SKILL.md +7 -3
  52. package/workflows/plan/phase/SKILL.zh-Hans.md +7 -3
  53. package/workflows/research/SKILL.md +24 -9
  54. package/workflows/research/SKILL.zh-Hans.md +23 -9
  55. package/workflows/research/workflow.yaml +43 -3
  56. package/workflows/retro/SKILL.md +7 -3
  57. package/workflows/retro/SKILL.zh-Hans.md +7 -3
  58. package/workflows/role-prompts.yaml +28 -21
  59. package/workflows/role-prompts.zh-Hans.yaml +22 -17
  60. package/workflows/ship/auto/SKILL.md +11 -7
  61. package/workflows/ship/auto/SKILL.zh-Hans.md +11 -7
  62. package/workflows/ship/preflight/SKILL.md +7 -3
  63. package/workflows/ship/preflight/SKILL.zh-Hans.md +7 -3
  64. package/workflows/task/auto/SKILL.md +26 -16
  65. package/workflows/task/auto/SKILL.zh-Hans.md +26 -16
  66. package/workflows/task/auto/workflow.yaml +11 -4
  67. package/workflows/task/clarify/SKILL.md +1 -1
  68. package/workflows/task/clarify/SKILL.zh-Hans.md +1 -1
  69. package/workflows/task/code/SKILL.md +7 -3
  70. package/workflows/task/code/SKILL.zh-Hans.md +7 -3
  71. package/workflows/task/deliver/SKILL.md +53 -35
  72. package/workflows/task/deliver/SKILL.zh-Hans.md +54 -36
  73. package/workflows/task/deliver/workflow.yaml +32 -24
  74. package/workflows/task/test/SKILL.md +7 -3
  75. package/workflows/task/test/SKILL.zh-Hans.md +7 -3
  76. package/workflows/task/test/workflow.yaml +13 -0
  77. package/workflows/verify/auto/SKILL.md +12 -8
  78. package/workflows/verify/auto/SKILL.zh-Hans.md +12 -8
  79. package/workflows/verify/auto/workflow.yaml +3 -1
  80. package/workflows/verify/code-review/SKILL.md +7 -3
  81. package/workflows/verify/code-review/SKILL.zh-Hans.md +7 -3
  82. package/workflows/verify/design/SKILL.md +24 -10
  83. package/workflows/verify/design/SKILL.zh-Hans.md +24 -10
  84. package/workflows/verify/design/workflow.yaml +36 -7
  85. package/workflows/verify/eval-review/SKILL.md +7 -3
  86. package/workflows/verify/eval-review/SKILL.zh-Hans.md +7 -3
  87. package/workflows/verify/multispec/SKILL.md +17 -10
  88. package/workflows/verify/multispec/SKILL.zh-Hans.md +16 -10
  89. package/workflows/verify/multispec/workflow.yaml +7 -5
  90. package/workflows/verify/paranoid/SKILL.md +7 -3
  91. package/workflows/verify/paranoid/SKILL.zh-Hans.md +7 -3
  92. package/workflows/verify/progress/SKILL.md +7 -3
  93. package/workflows/verify/progress/SKILL.zh-Hans.md +7 -3
  94. package/workflows/verify/qa/SKILL.md +33 -14
  95. package/workflows/verify/qa/SKILL.zh-Hans.md +33 -14
  96. package/workflows/verify/qa/workflow.yaml +55 -2
  97. package/workflows/verify/security/SKILL.md +7 -3
  98. package/workflows/verify/security/SKILL.zh-Hans.md +7 -3
  99. package/workflows/verify/simplify/SKILL.md +7 -3
  100. package/workflows/verify/simplify/SKILL.zh-Hans.md +7 -3
  101. package/workflows/verify/validate-phase/SKILL.md +7 -3
  102. package/workflows/verify/validate-phase/SKILL.zh-Hans.md +7 -3
  103. package/manifests/skill-packs/karpathy-skills.yaml +0 -65
  104. package/manifests/tools/chrome-devtools-mcp.yaml +0 -64
  105. package/manifests/tools/ralph-loop.yaml +0 -46
@@ -19,17 +19,21 @@ trigger_phrases:
19
19
 
20
20
  ## 概览
21
21
 
22
- 1-phase 子工作流,将 CLAUDE.md「Verify 阶段 — 可选 /design-review」映射到 harnessed
22
+ 3-phase 子工作流,将 CLAUDE.md「Verify 阶段 — 可选 /design-review」映射到 harnessed
23
23
  运行时(Phase v3.0-3.4 W0.13c — D-04 Stage ④ Verify 7 sub + D-12 gstack 治理关卡 +
24
- Pattern A sub-workflow ship)。
24
+ Pattern A sub-workflow ship;T2.3 两段式 remediation lane 接线)。
25
25
 
26
26
  | phase | id | upstream | model | capability | gate |
27
27
  | ----- | -- | -------- | ----- | ---------- | ---- |
28
- | 1 | `01-design-review` | gstack | sonnet | `{{ capabilities.gstack-design-review.cmd }}` | `judgments.stage-routing.verify-design-changes.fires` |
28
+ | 1 | `01-design-review` | gstack | sonnet | `{{ capabilities.gstack-design-review.cmd }}` | `judgments.web-design-routing.design-review-post.fires` |
29
+ | 2 | `02-ui-ux-structure` | ui-ux-pro-max | sonnet | `{{ capabilities.ui-ux-pro-max.cmd }}` | `judgments.web-design-routing.ui-ux-pro-max-structure.fires` |
30
+ | 3 | `03-design-taste-polish` | design-taste-frontend | sonnet | `{{ capabilities.design-taste-frontend.cmd }}` | `judgments.web-design-routing.design-taste-polish.fires` |
29
31
 
30
32
  Per-phase 配置从 `workflows/verify/design/workflow.yaml` 加载;引擎 4-level gate
31
33
  resolver 通过 expr-eval 计算 `phase.has_design_changes == true` — 为 true 则调用 gstack
32
- `/design-review`(设计系统一致性 + AI 审美问题识别),为 false 则跳过。
34
+ `/design-review`(设计系统一致性 + AI 审美问题识别),为 false 则跳过。Phase 02 / 03 是
35
+ review 出问题清单后的两段式 remediation lane(结构问题 → Stage 1;视觉打磨 / AI 味 → Stage 2),
36
+ 各由 `phase.has_ui_changes == true` 独立 gate。
33
37
 
34
38
  ## Capability refs
35
39
 
@@ -41,8 +45,14 @@ Sister `workflows/capabilities.yaml` 条目:
41
45
 
42
46
  ## Gate ref
43
47
 
44
- Sister `workflows/judgments/stage-routing.yaml`:
45
- - `verify-design-changes.fires` — `phase.stage == 'verify' and phase.has_design_changes == true`
48
+ Sister `workflows/judgments/web-design-routing.yaml`:
49
+ - `design-review-post.fires` — `phase.stage == 'verify' and phase.has_design_changes == true`
50
+ - `ui-ux-pro-max-structure.fires` — `phase.has_ui_changes == true`
51
+ - `design-taste-polish.fires` — `phase.has_ui_changes == true`
52
+
53
+ `workflows/verify/auto/workflow.yaml` 的 `delegates_to` 也 gate 在
54
+ `design-review-post.fires` 上 —— 之前那条逐字等价的 `stage-routing.verify-design-changes`
55
+ 副本已删,一个判据一个家。
46
56
 
47
57
  ## 路由规则(bundled web-design routing — `workflows/judgments/web-design-routing.yaml`)
48
58
 
@@ -64,11 +74,15 @@ CC-native Task / Agent 工具 spawn subagent(保持 session 响应 + 让澄清 r
64
74
  Code 内部会阻塞 session)。
65
75
 
66
76
  1. Bash: `harnessed prompt verify-design --task "$ARGUMENTS" --json` → 解析 `{prompt, max_iterations, model}`。
67
- 2. 用 CC-native subagent(Task / Agent 工具)以该 `prompt` + `model` spawn,用 ralph-loop plugin 包裹:`/ralph-loop "<prompt>" --max-iterations <max_iterations> --completion-promise "COMPLETE"`。若 plugin 未装,改用原生 goal gate(Claude Code 2.1.139+ / Codex):`/goal "this subtask is delivered: the subagent's final output contains verbatim <promise>COMPLETE</promise>; or stop after <max_iterations> turns"`,随后 spawn subagent,由 goal 评估器驱动重 spawn 直到目标清除。若 `/goal` 也不可用,自循环:spawn → 检查输出 `<promise>COMPLETE</promise>` → 把上轮输出 append 后重 spawn(至多 max_iterations)。goal 只在叶子 subtask 层设置 — `/goal` 每 session 单槽,嵌套 goal 会覆盖外层。
77
+ 2. 用 CC-native subagent(Task / Agent 工具)以该 `prompt` + `model` spawn,然后用 harnessed 自己的完成闸门驱动交付:
78
+ - subagent 返回后,把它的最终输出写入文件,跑 `harnessed checkpoint complete verify-design --result-file <path>` —— 该命令对声明的产物、TDD boundary、逐字 `<promise>COMPLETE</promise>` 三者 fail-closed。
79
+ - 若被拦下,跑 `harnessed checkpoint fail verify-design --failing-tests <n>` 记录本次尝试;命中停机条件时它会打印 BUDGET-EXHAUSTED / NO-PROGRESS / BREAK-LOOP。
80
+ - **仅当**这三者都未触发时才允许重 spawn。任一触发即停:重新收敛子任务范围、修掉阻塞点,或上报用户。绝不越过停机指令继续重 spawn。
68
81
  3. 若输出含 `STATUS: NEEDS_CLARIFICATION` + 问题列表:STOP,用 AskUserQuestion 原样转达,把答案 append 进 spec,再重 spawn。
69
- 4. 命中 `<promise>COMPLETE</promise>`:Bash `harnessed checkpoint complete verify-design --summary "<one-line>"`。evidence guard 在此运行(fail-CLOSED):若声明的 `artifacts_expected` 文件缺失会 exit 非零 —— 重 spawn 产出它再算 done。
82
+ 4. 命中 `<promise>COMPLETE</promise>`:把 subagent 最终输出写入文件,再 Bash `harnessed checkpoint complete verify-design --result-file <path> --summary "<one-line>"`。fail-CLOSED —— 除非声明的 `artifacts_expected` 文件全部存在、TDD boundary 通过(证据非空 / 红绿两侧齐全 / 测试文件未被删除)、且结果含逐字 `<promise>COMPLETE</promise>`(或结构化 COMPLETE 状态),否则拦下。`--result <text>` 是内联变体;`--result-file` 优先且在 Windows 上引号安全。`--force` 记录可审计的覆盖(`evidence_status=overridden`),不是静默放行。
83
+ 5. 若 complete 闸门拦下:Bash `harnessed checkpoint fail verify-design --failing-tests <n>` 记录本次尝试。命中停机条件时会打印 `BUDGET-EXHAUSTED` / `NO-PROGRESS` / `BREAK-LOOP`。**仅当**三者都未触发时才允许重 spawn;任一触发即 STOP —— 重新收敛子任务范围、修掉阻塞点,或上报用户。
70
84
 
71
- <!-- harnessed-generated:v4.9.3 -->
85
+ <!-- harnessed-generated:v4.12.0 -->
72
86
 
73
87
  ## 参考资料
74
88
 
@@ -76,5 +90,5 @@ Code 内部会阻塞 session)。
76
90
  - D-12 gstack 治理关卡可选
77
91
  - workflows/judgments/web-design-routing.yaml — 两段式 ui-ux-pro-max 结构 → design-taste-frontend 打磨
78
92
  - workflows/capabilities.yaml — gstack-design-review / ui-ux-pro-max / design-taste-frontend
79
- - workflows/judgments/stage-routing.yaml — verify-design-changes trigger
93
+ - workflows/verify/auto/workflow.yaml — `design` delegate gate = 同一个 design-review-post trigger
80
94
  - workflows/verify-work/workflow.yaml v2 SHIPPED phase 07-design-review-conditional sister verbatim
@@ -4,8 +4,10 @@
4
4
  # (has_design_changes 触发, 可选 conditional; bundled verify-stage optional /design-review step).
5
5
  #
6
6
  # Sister refs:
7
- # - workflows/judgments/web-design-routing.yaml — 两段式 ui-ux-pro-max 结构 → design-taste-frontend 打磨
8
- # - workflows/judgments/stage-routing.yaml verify-design-changes trigger (has_design_changes)
7
+ # - workflows/judgments/web-design-routing.yaml — 3 trigger 全接线 (T2.3):
8
+ # design-review-post (01) + ui-ux-pro-max-structure (02) + design-taste-polish (03)
9
+ # design-review-post 同时是 workflows/verify/auto/workflow.yaml `design`
10
+ # delegate 的 gate (stage-routing.verify-design-changes 那份逐字副本已删)
9
11
  # - workflows/capabilities.yaml — gstack-design-review / ui-ux-pro-max / design-taste-frontend
10
12
  # - workflows/verify-work/workflow.yaml v2 SHIPPED phase 07-design-review-conditional sister pattern
11
13
  # - .planning/phase-v3.0-3.2/RESEARCH-workflows.md § Area 2 verify/design example verbatim
@@ -14,10 +16,11 @@ schema_version: harnessed.workflow.v3
14
16
  workflow: verify-design
15
17
  description: |
16
18
  Stage ④.f gstack /design-review 设计系统一致性 + AI 审美问题识别 (has_design_changes 触发,
17
- 可选 conditional)。Gate: judgments.stage-routing.verify-design-changes.fires
18
- (phase.has_design_changes == true) — UI module fire only; 后端 / docs PR skip。
19
- tools_available 含 ui-ux-pro-max (Stage 1 结构骨架) + design-taste-frontend (Stage 2 视觉打磨叠加)
20
- per bundled 两段式 web-design routing (workflows/judgments/web-design-routing.yaml).
19
+ 可选 conditional)。Gate: judgments.web-design-routing.design-review-post.fires
20
+ (phase.stage == 'verify' and phase.has_design_changes == true) — UI module fire only;
21
+ 后端 / docs PR skip。tools_available 含 ui-ux-pro-max (Stage 1 结构骨架) +
22
+ design-taste-frontend (Stage 2 视觉打磨叠加) per bundled 两段式 web-design routing
23
+ (workflows/judgments/web-design-routing.yaml); T2.3 起两段式各成一条 remediation lane phase。
21
24
 
22
25
  disciplines_applied: [karpathy, output-style, language, operational, priority, protocols]
23
26
  tools_available: [gstack-design-review, ui-ux-pro-max, design-taste-frontend]
@@ -28,8 +31,34 @@ phases:
28
31
  upstream: gstack
29
32
  capability: '{{ capabilities.gstack-design-review.cmd }}'
30
33
  model: sonnet
31
- gate: judgments.stage-routing.verify-design-changes.fires
34
+ # T2.3 — gate 由 judgments.stage-routing.verify-design-changes.fires 换成
35
+ # 同址的 judgments.web-design-routing.design-review-post.fires。两个 trigger 的
36
+ # fires_when 逐字等价 ("phase.stage == 'verify' and phase.has_design_changes == true"),
37
+ # 所以行为零变化; 换 ref 让 web-design-routing 的第 3 个 trigger 不再是运行时孤儿。
38
+ # 后续: stage-routing 的那份副本已删, verify/auto 的 delegate gate 也指到这里 —
39
+ # 一个判据一个家 (guard: tests/workflow/judgment-expression-dedup.test.ts)。
40
+ gate: judgments.web-design-routing.design-review-post.fires
32
41
  max_iterations: 3
33
42
  # D2-followup (ADR-0033): declare report artifact so the evidence guard is real
34
43
  # (verified, not none_declared) — proves the design-review consistency pass actually ran.
35
44
  artifacts_expected: [design-review-report.md]
45
+
46
+ # T2.3 — 两段式 remediation lane。01-design-review 出问题清单后:
47
+ # 命中结构 / 交互逻辑问题 → Stage 1 ui-ux-pro-max; 命中视觉打磨 / AI 味问题 → Stage 2
48
+ # design-taste-frontend (顺序上 polish 在结构之后, per web-design-routing.yaml)。
49
+ # 两条 lane 之前是运行时孤儿 (零 gate ref → 文件永不加载求值)。
50
+ - id: 02-ui-ux-structure
51
+ name: ui-ux-pro-max (Stage 1 — 受众 / 交互逻辑 / 设计主轴, 数据驱动结构骨架)
52
+ upstream: ui-ux-pro-max
53
+ capability: '{{ capabilities.ui-ux-pro-max.cmd }}'
54
+ model: sonnet
55
+ gate: judgments.web-design-routing.ui-ux-pro-max-structure.fires
56
+ max_iterations: 3
57
+
58
+ - id: 03-design-taste-polish
59
+ name: design-taste-frontend (Stage 2 — 细节 + 视觉打磨 → 高级感, anti-slop)
60
+ upstream: design-taste-frontend
61
+ capability: '{{ capabilities.design-taste-frontend.cmd }}'
62
+ model: sonnet
63
+ gate: judgments.web-design-routing.design-taste-polish.fires
64
+ max_iterations: 3
@@ -57,11 +57,15 @@ Do NOT pipe to `harnessed run verify-eval-review` — that is the CI/headless pa
57
57
  that blocks the session inside Claude Code).
58
58
 
59
59
  1. Bash: `harnessed prompt verify-eval-review --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, use the native goal gate instead (Claude Code 2.1.139+ / Codex): `/goal "this subtask is delivered: the subagent's final output contains verbatim <promise>COMPLETE</promise>; or stop after <max_iterations> turns"` then spawn the subagent and let the goal evaluator drive re-spawns until it clears. If `/goal` is unavailable too, self-loop: spawn → check output for `<promise>COMPLETE</promise>` → re-spawn with prior output appended (up to max_iterations). Set the goal only at the leaf subtask level — `/goal` is single-slot per session and a nested goal overwrites the outer one.
60
+ 2. Spawn a CC-native subagent (Task / Agent tool) with that `prompt` and `model`, then drive delivery with harnessed's own completion gate:
61
+ - on return, write the subagent's final output to a file and run `harnessed checkpoint complete verify-eval-review --result-file <path>` — it is fail-closed on the declared artifacts, the TDD boundary, and the verbatim `<promise>COMPLETE</promise>`.
62
+ - if it blocks, run `harnessed checkpoint fail verify-eval-review --failing-tests <n>` to record the attempt; it prints BUDGET-EXHAUSTED / NO-PROGRESS / BREAK-LOOP when a stop condition is reached.
63
+ - respawn ONLY while none of those three has fired. Any one of them means stop: re-scope the subtask, fix the blocker, or escalate to the user. Never respawn past a stop directive.
61
64
  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-eval-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
+ 4. On `<promise>COMPLETE</promise>`: write the subagent’s final output to a file, then Bash `harnessed checkpoint complete verify-eval-review --result-file <path> --summary "<one-line>"`. Fail-CLOSED — it blocks unless every declared `artifacts_expected` file exists, the TDD boundary passes (non-empty evidence / both the red and green sides present / the test file was not deleted), and the result carries a verbatim `<promise>COMPLETE</promise>` (or a structured COMPLETE status). `--result <text>` is the inline variant; `--result-file` wins and is quoting-safe on Windows. `--force` records an audited override (`evidence_status=overridden`) — it does not silently pass.
66
+ 5. If the complete gate blocked: Bash `harnessed checkpoint fail verify-eval-review --failing-tests <n>` to record the attempt. It prints `BUDGET-EXHAUSTED` / `NO-PROGRESS` / `BREAK-LOOP` once a stop condition is reached. Respawn ONLY while none of those three has fired; any one of them means STOP — re-scope the subtask, fix the blocker, or escalate to the user.
63
67
 
64
- <!-- harnessed-generated:v4.9.3 -->
68
+ <!-- harnessed-generated:v4.12.0 -->
65
69
 
66
70
  ## References
67
71
 
@@ -56,11 +56,15 @@ CC-native Task / Agent 工具 spawn subagent(保持 session 响应 + 让澄清 r
56
56
  Code 内部会阻塞 session)。
57
57
 
58
58
  1. Bash: `harnessed prompt verify-eval-review --task "$ARGUMENTS" --json` → 解析 `{prompt, max_iterations, model}`。
59
- 2. 用 CC-native subagent(Task / Agent 工具)以该 `prompt` + `model` spawn,用 ralph-loop plugin 包裹:`/ralph-loop "<prompt>" --max-iterations <max_iterations> --completion-promise "COMPLETE"`。若 plugin 未装,改用原生 goal gate(Claude Code 2.1.139+ / Codex):`/goal "this subtask is delivered: the subagent's final output contains verbatim <promise>COMPLETE</promise>; or stop after <max_iterations> turns"`,随后 spawn subagent,由 goal 评估器驱动重 spawn 直到目标清除。若 `/goal` 也不可用,自循环:spawn → 检查输出 `<promise>COMPLETE</promise>` → 把上轮输出 append 后重 spawn(至多 max_iterations)。goal 只在叶子 subtask 层设置 — `/goal` 每 session 单槽,嵌套 goal 会覆盖外层。
59
+ 2. 用 CC-native subagent(Task / Agent 工具)以该 `prompt` + `model` spawn,然后用 harnessed 自己的完成闸门驱动交付:
60
+ - subagent 返回后,把它的最终输出写入文件,跑 `harnessed checkpoint complete verify-eval-review --result-file <path>` —— 该命令对声明的产物、TDD boundary、逐字 `<promise>COMPLETE</promise>` 三者 fail-closed。
61
+ - 若被拦下,跑 `harnessed checkpoint fail verify-eval-review --failing-tests <n>` 记录本次尝试;命中停机条件时它会打印 BUDGET-EXHAUSTED / NO-PROGRESS / BREAK-LOOP。
62
+ - **仅当**这三者都未触发时才允许重 spawn。任一触发即停:重新收敛子任务范围、修掉阻塞点,或上报用户。绝不越过停机指令继续重 spawn。
60
63
  3. 若输出含 `STATUS: NEEDS_CLARIFICATION` + 问题列表:STOP,用 AskUserQuestion 原样转达,把答案 append 进 spec,再重 spawn。
61
- 4. 命中 `<promise>COMPLETE</promise>`:Bash `harnessed checkpoint complete verify-eval-review --summary "<one-line>"`。evidence guard 在此运行(fail-CLOSED):若声明的 `artifacts_expected` 文件缺失会 exit 非零 —— 重 spawn 产出它再算 done。
64
+ 4. 命中 `<promise>COMPLETE</promise>`:把 subagent 最终输出写入文件,再 Bash `harnessed checkpoint complete verify-eval-review --result-file <path> --summary "<one-line>"`。fail-CLOSED —— 除非声明的 `artifacts_expected` 文件全部存在、TDD boundary 通过(证据非空 / 红绿两侧齐全 / 测试文件未被删除)、且结果含逐字 `<promise>COMPLETE</promise>`(或结构化 COMPLETE 状态),否则拦下。`--result <text>` 是内联变体;`--result-file` 优先且在 Windows 上引号安全。`--force` 记录可审计的覆盖(`evidence_status=overridden`),不是静默放行。
65
+ 5. 若 complete 闸门拦下:Bash `harnessed checkpoint fail verify-eval-review --failing-tests <n>` 记录本次尝试。命中停机条件时会打印 `BUDGET-EXHAUSTED` / `NO-PROGRESS` / `BREAK-LOOP`。**仅当**三者都未触发时才允许重 spawn;任一触发即 STOP —— 重新收敛子任务范围、修掉阻塞点,或上报用户。
62
66
 
63
- <!-- harnessed-generated:v4.9.3 -->
67
+ <!-- harnessed-generated:v4.12.0 -->
64
68
 
65
69
  ## 参考资料
66
70
 
@@ -4,7 +4,7 @@ description: |
4
4
  Stage ④.h verify sub-workflow — 4-specialist Agent Team Pattern C 多维度审查 (关键发布 /
5
5
  大重构 PR 升级, code-review + gstack-review + gstack-cso + gstack-qa 4 teammate 互相
6
6
  SendMessage 质询, NOT fire-and-forget subagent fan-out; bundled Agent Teams Pattern C
7
- routing). Cleanup mandatory: shutdown_request + TeamDelete (bundled cleanup discipline).
7
+ routing). Cleanup mandatory: 按名请求每个 teammate shut down (bundled cleanup discipline).
8
8
  schema_version: harnessed.workflow.v3 with disciplines_applied (6 default) + tools_available
9
9
  (agent-teams 3 + 4 specialist capability) + 2 phase (01-team-create on critical-release
10
10
  invoke / 02-team-cleanup mandatory shutdown)。
@@ -31,17 +31,20 @@ D-11 Agent Teams + Pattern A sub-workflow ship)。
31
31
  | 1 | `01-team-create` | claude-platform | opus | `{{ capabilities.agent-teams-create.cmd }}` | `parallelism: agent-teams-upgrade.fires`; `on: is_major_release OR is_large_refactor → invoke` |
32
32
  | 2 | `02-team-cleanup` | claude-platform | haiku | `{{ capabilities.agent-teams-shutdown.cmd }}` | mandatory 防呆清单 |
33
33
 
34
- Per-phase config loads from `workflows/verify/multispec/workflow.yaml`; phase 01 creates 4
35
- teammate (code-review + gstack-review + gstack-cso + gstack-qa) via TeamCreate, teammates 互相
36
- SendMessage 质询 findings 是否真问题 (NOT fire-and-forget); phase 02 mandatory shutdown_request
37
- + TeamDelete (bundled Agent Teams cleanup discipline)。
34
+ Per-phase config loads from `workflows/verify/multispec/workflow.yaml`; phase 01 spawns 4
35
+ background teammate (code-review + gstack-review + gstack-cso + gstack-qa) with
36
+ `Agent(name, run_in_background=true)` — the team forms implicitly on the FIRST spawn (CC
37
+ 2.1.178+ has no create step / no create tool), teammates 互相 SendMessage 质询 findings 是否
38
+ 真问题 (NOT fire-and-forget); phase 02 mandatory 按名请求每个 teammate shut down (bundled
39
+ Agent Teams cleanup discipline — 团目录在 session 退出时自动清理,无独立 teardown 工具,
40
+ 剩下的纪律是别把 teammate 落在运行态)。
38
41
 
39
42
  ## Capability refs
40
43
 
41
44
  Sister `workflows/capabilities.yaml` entries:
42
- - `agent-teams-create` — Bucket 5 Agent Teams (impl: claude-platform, cmd: TeamCreate)
45
+ - `agent-teams-create` — Bucket 5 Agent Teams (impl: claude-platform, cmd: `Agent(name, run_in_background=true)`)
43
46
  - `agent-teams-send-message` — Bucket 5 Agent Teams (impl: claude-platform, cmd: SendMessage)
44
- - `agent-teams-shutdown` — Bucket 5 Agent Teams (impl: claude-platform, cmd: TeamDelete)
47
+ - `agent-teams-shutdown` — Bucket 5 Agent Teams (impl: claude-platform, cmd: `ask the <teammate-name> teammate to shut down`)
45
48
  - `code-review` — Bucket 1 mattpocock (teammate 1)
46
49
  - `gstack-review` — Bucket 3 治理关卡 (teammate 2 Paranoid Staff Engineer)
47
50
  - `gstack-cso` — Bucket 3 治理关卡 (teammate 3 安全审查)
@@ -79,11 +82,15 @@ Do NOT pipe to `harnessed run verify-multispec` — that is the CI/headless path
79
82
  that blocks the session inside Claude Code).
80
83
 
81
84
  1. Bash: `harnessed prompt verify-multispec --task "$ARGUMENTS" --json` → parse `{prompt, max_iterations, model}`.
82
- 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, use the native goal gate instead (Claude Code 2.1.139+ / Codex): `/goal "this subtask is delivered: the subagent's final output contains verbatim <promise>COMPLETE</promise>; or stop after <max_iterations> turns"` then spawn the subagent and let the goal evaluator drive re-spawns until it clears. If `/goal` is unavailable too, self-loop: spawn → check output for `<promise>COMPLETE</promise>` → re-spawn with prior output appended (up to max_iterations). Set the goal only at the leaf subtask level — `/goal` is single-slot per session and a nested goal overwrites the outer one.
85
+ 2. Spawn a CC-native subagent (Task / Agent tool) with that `prompt` and `model`, then drive delivery with harnessed's own completion gate:
86
+ - on return, write the subagent's final output to a file and run `harnessed checkpoint complete verify-multispec --result-file <path>` — it is fail-closed on the declared artifacts, the TDD boundary, and the verbatim `<promise>COMPLETE</promise>`.
87
+ - if it blocks, run `harnessed checkpoint fail verify-multispec --failing-tests <n>` to record the attempt; it prints BUDGET-EXHAUSTED / NO-PROGRESS / BREAK-LOOP when a stop condition is reached.
88
+ - respawn ONLY while none of those three has fired. Any one of them means stop: re-scope the subtask, fix the blocker, or escalate to the user. Never respawn past a stop directive.
83
89
  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.
84
- 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.
90
+ 4. On `<promise>COMPLETE</promise>`: write the subagent’s final output to a file, then Bash `harnessed checkpoint complete verify-multispec --result-file <path> --summary "<one-line>"`. Fail-CLOSED — it blocks unless every declared `artifacts_expected` file exists, the TDD boundary passes (non-empty evidence / both the red and green sides present / the test file was not deleted), and the result carries a verbatim `<promise>COMPLETE</promise>` (or a structured COMPLETE status). `--result <text>` is the inline variant; `--result-file` wins and is quoting-safe on Windows. `--force` records an audited override (`evidence_status=overridden`) — it does not silently pass.
91
+ 5. If the complete gate blocked: Bash `harnessed checkpoint fail verify-multispec --failing-tests <n>` to record the attempt. It prints `BUDGET-EXHAUSTED` / `NO-PROGRESS` / `BREAK-LOOP` once a stop condition is reached. Respawn ONLY while none of those three has fired; any one of them means STOP — re-scope the subtask, fix the blocker, or escalate to the user.
85
92
 
86
- <!-- harnessed-generated:v4.9.3 -->
93
+ <!-- harnessed-generated:v4.12.0 -->
87
94
 
88
95
  ## References
89
96
 
@@ -4,7 +4,7 @@ description: |
4
4
  Stage ④.h verify 子工作流 — 4-specialist Agent Team Pattern C 多维度审查(关键发布 /
5
5
  大重构 PR 升级,code-review + gstack-review + gstack-cso + gstack-qa 4 teammate 互相
6
6
  SendMessage 质询,NOT fire-and-forget subagent fan-out;bundled Agent Teams Pattern C
7
- routing)。Cleanup 必跑:shutdown_request + TeamDelete(bundled cleanup discipline)。
7
+ routing)。Cleanup 必跑:按名请求每个 teammate shut down(bundled cleanup discipline)。
8
8
  schema_version: harnessed.workflow.v3 with disciplines_applied (6 default) + tools_available
9
9
  (agent-teams 3 + 4 specialist capability) + 2 phase (01-team-create on critical-release
10
10
  invoke / 02-team-cleanup mandatory shutdown)。
@@ -31,17 +31,19 @@ D-11 Agent Teams + Pattern A sub-workflow ship)。
31
31
  | 1 | `01-team-create` | claude-platform | opus | `{{ capabilities.agent-teams-create.cmd }}` | `parallelism: agent-teams-upgrade.fires`; `on: is_major_release OR is_large_refactor → invoke` |
32
32
  | 2 | `02-team-cleanup` | claude-platform | haiku | `{{ capabilities.agent-teams-shutdown.cmd }}` | mandatory 防呆清单 |
33
33
 
34
- Per-phase 配置从 `workflows/verify/multispec/workflow.yaml` 加载;phase 01 通过 TeamCreate 创建 4
35
- 个 teammate(code-review + gstack-review + gstack-cso + gstack-qa),teammate 互相
36
- SendMessage 质询 findings 是否真问题(NOT fire-and-forget);phase 02 必跑 shutdown_request
37
- + TeamDelete(bundled Agent Teams cleanup discipline)。
34
+ Per-phase 配置从 `workflows/verify/multispec/workflow.yaml` 加载;phase 01 用
35
+ `Agent(name, run_in_background=true)` spawn 4 个后台 teammate(code-review + gstack-review +
36
+ gstack-cso + gstack-qa),团在**第一个** spawn 时隐式形成(CC 2.1.178+ 无建团步骤、无建团
37
+ 工具);teammate 互相 SendMessage 质询 findings 是否真问题(NOT fire-and-forget);phase 02
38
+ 必跑「按名请求每个 teammate shut down」(bundled Agent Teams cleanup discipline——团目录在
39
+ session 退出时自动清理,无独立 teardown 工具,剩下的纪律是别把 teammate 落在运行态)。
38
40
 
39
41
  ## Capability refs
40
42
 
41
43
  Sister `workflows/capabilities.yaml` 条目:
42
- - `agent-teams-create` — Bucket 5 Agent Teams (impl: claude-platform, cmd: TeamCreate)
44
+ - `agent-teams-create` — Bucket 5 Agent Teams (impl: claude-platform, cmd: `Agent(name, run_in_background=true)`)
43
45
  - `agent-teams-send-message` — Bucket 5 Agent Teams (impl: claude-platform, cmd: SendMessage)
44
- - `agent-teams-shutdown` — Bucket 5 Agent Teams (impl: claude-platform, cmd: TeamDelete)
46
+ - `agent-teams-shutdown` — Bucket 5 Agent Teams (impl: claude-platform, cmd: `ask the <teammate-name> teammate to shut down`)
45
47
  - `code-review` — Bucket 1 mattpocock (teammate 1)
46
48
  - `gstack-review` — Bucket 3 治理关卡 (teammate 2 Paranoid Staff Engineer)
47
49
  - `gstack-cso` — Bucket 3 治理关卡 (teammate 3 安全审查)
@@ -78,11 +80,15 @@ CC-native Task / Agent 工具 spawn subagent(保持 session 响应 + 让澄清 r
78
80
  Code 内部会阻塞 session)。
79
81
 
80
82
  1. Bash: `harnessed prompt verify-multispec --task "$ARGUMENTS" --json` → 解析 `{prompt, max_iterations, model}`。
81
- 2. 用 CC-native subagent(Task / Agent 工具)以该 `prompt` + `model` spawn,用 ralph-loop plugin 包裹:`/ralph-loop "<prompt>" --max-iterations <max_iterations> --completion-promise "COMPLETE"`。若 plugin 未装,改用原生 goal gate(Claude Code 2.1.139+ / Codex):`/goal "this subtask is delivered: the subagent's final output contains verbatim <promise>COMPLETE</promise>; or stop after <max_iterations> turns"`,随后 spawn subagent,由 goal 评估器驱动重 spawn 直到目标清除。若 `/goal` 也不可用,自循环:spawn → 检查输出 `<promise>COMPLETE</promise>` → 把上轮输出 append 后重 spawn(至多 max_iterations)。goal 只在叶子 subtask 层设置 — `/goal` 每 session 单槽,嵌套 goal 会覆盖外层。
83
+ 2. 用 CC-native subagent(Task / Agent 工具)以该 `prompt` + `model` spawn,然后用 harnessed 自己的完成闸门驱动交付:
84
+ - subagent 返回后,把它的最终输出写入文件,跑 `harnessed checkpoint complete verify-multispec --result-file <path>` —— 该命令对声明的产物、TDD boundary、逐字 `<promise>COMPLETE</promise>` 三者 fail-closed。
85
+ - 若被拦下,跑 `harnessed checkpoint fail verify-multispec --failing-tests <n>` 记录本次尝试;命中停机条件时它会打印 BUDGET-EXHAUSTED / NO-PROGRESS / BREAK-LOOP。
86
+ - **仅当**这三者都未触发时才允许重 spawn。任一触发即停:重新收敛子任务范围、修掉阻塞点,或上报用户。绝不越过停机指令继续重 spawn。
82
87
  3. 若输出含 `STATUS: NEEDS_CLARIFICATION` + 问题列表:STOP,用 AskUserQuestion 原样转达,把答案 append 进 spec,再重 spawn。
83
- 4. 命中 `<promise>COMPLETE</promise>`:Bash `harnessed checkpoint complete verify-multispec --summary "<one-line>"`。evidence guard 在此运行(fail-CLOSED):若声明的 `artifacts_expected` 文件缺失会 exit 非零 —— 重 spawn 产出它再算 done。
88
+ 4. 命中 `<promise>COMPLETE</promise>`:把 subagent 最终输出写入文件,再 Bash `harnessed checkpoint complete verify-multispec --result-file <path> --summary "<one-line>"`。fail-CLOSED —— 除非声明的 `artifacts_expected` 文件全部存在、TDD boundary 通过(证据非空 / 红绿两侧齐全 / 测试文件未被删除)、且结果含逐字 `<promise>COMPLETE</promise>`(或结构化 COMPLETE 状态),否则拦下。`--result <text>` 是内联变体;`--result-file` 优先且在 Windows 上引号安全。`--force` 记录可审计的覆盖(`evidence_status=overridden`),不是静默放行。
89
+ 5. 若 complete 闸门拦下:Bash `harnessed checkpoint fail verify-multispec --failing-tests <n>` 记录本次尝试。命中停机条件时会打印 `BUDGET-EXHAUSTED` / `NO-PROGRESS` / `BREAK-LOOP`。**仅当**三者都未触发时才允许重 spawn;任一触发即 STOP —— 重新收敛子任务范围、修掉阻塞点,或上报用户。
84
90
 
85
- <!-- harnessed-generated:v4.9.3 -->
91
+ <!-- harnessed-generated:v4.12.0 -->
86
92
 
87
93
  ## 参考资料
88
94
 
@@ -11,8 +11,10 @@
11
11
  # - workflows/verify-work/workflow.yaml v2 SHIPPED phase 09-agent-team-multispecialist sister pattern
12
12
  # - .planning/phase-v3.0-3.2/RESEARCH-workflows.md § Area 2 verify/multispec example verbatim
13
13
  #
14
- # Cleanup mandatory (bundled Agent Teams discipline): SendMessage shutdown_request +
15
- # TeamDelete — engine-level wiring (phase 02-team-cleanup capability agent-teams-shutdown).
14
+ # Cleanup mandatory (bundled Agent Teams discipline): 按名请求每个 teammate shut down —
15
+ # engine-level wiring (phase 02-team-cleanup capability agent-teams-shutdown). CC 2.1.178+
16
+ # 已删除建团/删团工具:团在第一个 teammate spawn 时隐式形成,团目录在 session 退出时自动清理,
17
+ # 所以 02 phase 的实质是「确认 4 个 teammate 都停了」而非调用一个 teardown 工具。
16
18
  # Token estimate prereq: team_cost < 2 × subagent_cost (bundled cost guideline; engine-level check).
17
19
 
18
20
  schema_version: harnessed.workflow.v3
@@ -20,8 +22,8 @@ workflow: verify-multispec
20
22
  description: |
21
23
  Stage ④.h 4-specialist Agent Team Pattern C 多维度审查 (关键发布 / 大重构 PR 升级,
22
24
  code-review + gstack-review + gstack-cso + gstack-qa 4 teammate 互相 SendMessage 质询,
23
- NOT fire-and-forget subagent fan-out)。Cleanup mandatory: shutdown_request + TeamDelete
24
- (bundled Agent Teams cleanup discipline)。
25
+ NOT fire-and-forget subagent fan-out)。Cleanup mandatory: 按名请求每个 teammate shut down
26
+ (bundled Agent Teams cleanup discipline; 团目录在 session 退出时自动清理,无 teardown 工具)。
25
27
 
26
28
  disciplines_applied: [karpathy, output-style, language, operational, priority, protocols]
27
29
  tools_available:
@@ -54,7 +56,7 @@ phases:
54
56
  artifacts_expected: [multispec-review-report.md]
55
57
 
56
58
  - id: 02-team-cleanup
57
- name: Agent Team cleanup (shutdown_request + TeamDelete 防呆清单)
59
+ name: Agent Team cleanup (按名请求 teammate shut down 防呆清单)
58
60
  upstream: claude-platform
59
61
  capability: '{{ capabilities.agent-teams-shutdown.cmd }}'
60
62
  model: haiku
@@ -65,11 +65,15 @@ Do NOT pipe to `harnessed run verify-paranoid` — that is the CI/headless path
65
65
  that blocks the session inside Claude Code).
66
66
 
67
67
  1. Bash: `harnessed prompt verify-paranoid --task "$ARGUMENTS" --json` → parse `{prompt, max_iterations, model}`.
68
- 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, use the native goal gate instead (Claude Code 2.1.139+ / Codex): `/goal "this subtask is delivered: the subagent's final output contains verbatim <promise>COMPLETE</promise>; or stop after <max_iterations> turns"` then spawn the subagent and let the goal evaluator drive re-spawns until it clears. If `/goal` is unavailable too, self-loop: spawn → check output for `<promise>COMPLETE</promise>` → re-spawn with prior output appended (up to max_iterations). Set the goal only at the leaf subtask level — `/goal` is single-slot per session and a nested goal overwrites the outer one.
68
+ 2. Spawn a CC-native subagent (Task / Agent tool) with that `prompt` and `model`, then drive delivery with harnessed's own completion gate:
69
+ - on return, write the subagent's final output to a file and run `harnessed checkpoint complete verify-paranoid --result-file <path>` — it is fail-closed on the declared artifacts, the TDD boundary, and the verbatim `<promise>COMPLETE</promise>`.
70
+ - if it blocks, run `harnessed checkpoint fail verify-paranoid --failing-tests <n>` to record the attempt; it prints BUDGET-EXHAUSTED / NO-PROGRESS / BREAK-LOOP when a stop condition is reached.
71
+ - respawn ONLY while none of those three has fired. Any one of them means stop: re-scope the subtask, fix the blocker, or escalate to the user. Never respawn past a stop directive.
69
72
  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.
70
- 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.
73
+ 4. On `<promise>COMPLETE</promise>`: write the subagent’s final output to a file, then Bash `harnessed checkpoint complete verify-paranoid --result-file <path> --summary "<one-line>"`. Fail-CLOSED — it blocks unless every declared `artifacts_expected` file exists, the TDD boundary passes (non-empty evidence / both the red and green sides present / the test file was not deleted), and the result carries a verbatim `<promise>COMPLETE</promise>` (or a structured COMPLETE status). `--result <text>` is the inline variant; `--result-file` wins and is quoting-safe on Windows. `--force` records an audited override (`evidence_status=overridden`) — it does not silently pass.
74
+ 5. If the complete gate blocked: Bash `harnessed checkpoint fail verify-paranoid --failing-tests <n>` to record the attempt. It prints `BUDGET-EXHAUSTED` / `NO-PROGRESS` / `BREAK-LOOP` once a stop condition is reached. Respawn ONLY while none of those three has fired; any one of them means STOP — re-scope the subtask, fix the blocker, or escalate to the user.
71
75
 
72
- <!-- harnessed-generated:v4.9.3 -->
76
+ <!-- harnessed-generated:v4.12.0 -->
73
77
 
74
78
  ## References
75
79
 
@@ -64,11 +64,15 @@ CC-native Task / Agent 工具 spawn subagent(保持 session 响应 + 让澄清 r
64
64
  Code 内部会阻塞 session)。
65
65
 
66
66
  1. Bash: `harnessed prompt verify-paranoid --task "$ARGUMENTS" --json` → 解析 `{prompt, max_iterations, model}`。
67
- 2. 用 CC-native subagent(Task / Agent 工具)以该 `prompt` + `model` spawn,用 ralph-loop plugin 包裹:`/ralph-loop "<prompt>" --max-iterations <max_iterations> --completion-promise "COMPLETE"`。若 plugin 未装,改用原生 goal gate(Claude Code 2.1.139+ / Codex):`/goal "this subtask is delivered: the subagent's final output contains verbatim <promise>COMPLETE</promise>; or stop after <max_iterations> turns"`,随后 spawn subagent,由 goal 评估器驱动重 spawn 直到目标清除。若 `/goal` 也不可用,自循环:spawn → 检查输出 `<promise>COMPLETE</promise>` → 把上轮输出 append 后重 spawn(至多 max_iterations)。goal 只在叶子 subtask 层设置 — `/goal` 每 session 单槽,嵌套 goal 会覆盖外层。
67
+ 2. 用 CC-native subagent(Task / Agent 工具)以该 `prompt` + `model` spawn,然后用 harnessed 自己的完成闸门驱动交付:
68
+ - subagent 返回后,把它的最终输出写入文件,跑 `harnessed checkpoint complete verify-paranoid --result-file <path>` —— 该命令对声明的产物、TDD boundary、逐字 `<promise>COMPLETE</promise>` 三者 fail-closed。
69
+ - 若被拦下,跑 `harnessed checkpoint fail verify-paranoid --failing-tests <n>` 记录本次尝试;命中停机条件时它会打印 BUDGET-EXHAUSTED / NO-PROGRESS / BREAK-LOOP。
70
+ - **仅当**这三者都未触发时才允许重 spawn。任一触发即停:重新收敛子任务范围、修掉阻塞点,或上报用户。绝不越过停机指令继续重 spawn。
68
71
  3. 若输出含 `STATUS: NEEDS_CLARIFICATION` + 问题列表:STOP,用 AskUserQuestion 原样转达,把答案 append 进 spec,再重 spawn。
69
- 4. 命中 `<promise>COMPLETE</promise>`:Bash `harnessed checkpoint complete verify-paranoid --summary "<one-line>"`。evidence guard 在此运行(fail-CLOSED):若声明的 `artifacts_expected` 文件缺失会 exit 非零 —— 重 spawn 产出它再算 done。
72
+ 4. 命中 `<promise>COMPLETE</promise>`:把 subagent 最终输出写入文件,再 Bash `harnessed checkpoint complete verify-paranoid --result-file <path> --summary "<one-line>"`。fail-CLOSED —— 除非声明的 `artifacts_expected` 文件全部存在、TDD boundary 通过(证据非空 / 红绿两侧齐全 / 测试文件未被删除)、且结果含逐字 `<promise>COMPLETE</promise>`(或结构化 COMPLETE 状态),否则拦下。`--result <text>` 是内联变体;`--result-file` 优先且在 Windows 上引号安全。`--force` 记录可审计的覆盖(`evidence_status=overridden`),不是静默放行。
73
+ 5. 若 complete 闸门拦下:Bash `harnessed checkpoint fail verify-paranoid --failing-tests <n>` 记录本次尝试。命中停机条件时会打印 `BUDGET-EXHAUSTED` / `NO-PROGRESS` / `BREAK-LOOP`。**仅当**三者都未触发时才允许重 spawn;任一触发即 STOP —— 重新收敛子任务范围、修掉阻塞点,或上报用户。
70
74
 
71
- <!-- harnessed-generated:v4.9.3 -->
75
+ <!-- harnessed-generated:v4.12.0 -->
72
76
 
73
77
  ## 参考资料
74
78
 
@@ -61,11 +61,15 @@ Do NOT pipe to `harnessed run verify-progress` — that is the CI/headless path
61
61
  that blocks the session inside Claude Code).
62
62
 
63
63
  1. Bash: `harnessed prompt verify-progress --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, use the native goal gate instead (Claude Code 2.1.139+ / Codex): `/goal "this subtask is delivered: the subagent's final output contains verbatim <promise>COMPLETE</promise>; or stop after <max_iterations> turns"` then spawn the subagent and let the goal evaluator drive re-spawns until it clears. If `/goal` is unavailable too, self-loop: spawn → check output for `<promise>COMPLETE</promise>` → re-spawn with prior output appended (up to max_iterations). Set the goal only at the leaf subtask level — `/goal` is single-slot per session and a nested goal overwrites the outer one.
64
+ 2. Spawn a CC-native subagent (Task / Agent tool) with that `prompt` and `model`, then drive delivery with harnessed's own completion gate:
65
+ - on return, write the subagent's final output to a file and run `harnessed checkpoint complete verify-progress --result-file <path>` — it is fail-closed on the declared artifacts, the TDD boundary, and the verbatim `<promise>COMPLETE</promise>`.
66
+ - if it blocks, run `harnessed checkpoint fail verify-progress --failing-tests <n>` to record the attempt; it prints BUDGET-EXHAUSTED / NO-PROGRESS / BREAK-LOOP when a stop condition is reached.
67
+ - respawn ONLY while none of those three has fired. Any one of them means stop: re-scope the subtask, fix the blocker, or escalate to the user. Never respawn past a stop directive.
65
68
  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-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.
69
+ 4. On `<promise>COMPLETE</promise>`: write the subagent’s final output to a file, then Bash `harnessed checkpoint complete verify-progress --result-file <path> --summary "<one-line>"`. Fail-CLOSED — it blocks unless every declared `artifacts_expected` file exists, the TDD boundary passes (non-empty evidence / both the red and green sides present / the test file was not deleted), and the result carries a verbatim `<promise>COMPLETE</promise>` (or a structured COMPLETE status). `--result <text>` is the inline variant; `--result-file` wins and is quoting-safe on Windows. `--force` records an audited override (`evidence_status=overridden`) — it does not silently pass.
70
+ 5. If the complete gate blocked: Bash `harnessed checkpoint fail verify-progress --failing-tests <n>` to record the attempt. It prints `BUDGET-EXHAUSTED` / `NO-PROGRESS` / `BREAK-LOOP` once a stop condition is reached. Respawn ONLY while none of those three has fired; any one of them means STOP — re-scope the subtask, fix the blocker, or escalate to the user.
67
71
 
68
- <!-- harnessed-generated:v4.9.3 -->
72
+ <!-- harnessed-generated:v4.12.0 -->
69
73
 
70
74
  ## References
71
75
 
@@ -59,11 +59,15 @@ CC-native Task / Agent 工具 spawn subagent(保持 session 响应 + 让澄清 r
59
59
  Code 内部会阻塞 session)。
60
60
 
61
61
  1. Bash: `harnessed prompt verify-progress --task "$ARGUMENTS" --json` → 解析 `{prompt, max_iterations, model}`。
62
- 2. 用 CC-native subagent(Task / Agent 工具)以该 `prompt` + `model` spawn,用 ralph-loop plugin 包裹:`/ralph-loop "<prompt>" --max-iterations <max_iterations> --completion-promise "COMPLETE"`。若 plugin 未装,改用原生 goal gate(Claude Code 2.1.139+ / Codex):`/goal "this subtask is delivered: the subagent's final output contains verbatim <promise>COMPLETE</promise>; or stop after <max_iterations> turns"`,随后 spawn subagent,由 goal 评估器驱动重 spawn 直到目标清除。若 `/goal` 也不可用,自循环:spawn → 检查输出 `<promise>COMPLETE</promise>` → 把上轮输出 append 后重 spawn(至多 max_iterations)。goal 只在叶子 subtask 层设置 — `/goal` 每 session 单槽,嵌套 goal 会覆盖外层。
62
+ 2. 用 CC-native subagent(Task / Agent 工具)以该 `prompt` + `model` spawn,然后用 harnessed 自己的完成闸门驱动交付:
63
+ - subagent 返回后,把它的最终输出写入文件,跑 `harnessed checkpoint complete verify-progress --result-file <path>` —— 该命令对声明的产物、TDD boundary、逐字 `<promise>COMPLETE</promise>` 三者 fail-closed。
64
+ - 若被拦下,跑 `harnessed checkpoint fail verify-progress --failing-tests <n>` 记录本次尝试;命中停机条件时它会打印 BUDGET-EXHAUSTED / NO-PROGRESS / BREAK-LOOP。
65
+ - **仅当**这三者都未触发时才允许重 spawn。任一触发即停:重新收敛子任务范围、修掉阻塞点,或上报用户。绝不越过停机指令继续重 spawn。
63
66
  3. 若输出含 `STATUS: NEEDS_CLARIFICATION` + 问题列表:STOP,用 AskUserQuestion 原样转达,把答案 append 进 spec,再重 spawn。
64
- 4. 命中 `<promise>COMPLETE</promise>`:Bash `harnessed checkpoint complete verify-progress --summary "<one-line>"`。evidence guard 在此运行(fail-CLOSED):若声明的 `artifacts_expected` 文件缺失会 exit 非零 —— 重 spawn 产出它再算 done。
67
+ 4. 命中 `<promise>COMPLETE</promise>`:把 subagent 最终输出写入文件,再 Bash `harnessed checkpoint complete verify-progress --result-file <path> --summary "<one-line>"`。fail-CLOSED —— 除非声明的 `artifacts_expected` 文件全部存在、TDD boundary 通过(证据非空 / 红绿两侧齐全 / 测试文件未被删除)、且结果含逐字 `<promise>COMPLETE</promise>`(或结构化 COMPLETE 状态),否则拦下。`--result <text>` 是内联变体;`--result-file` 优先且在 Windows 上引号安全。`--force` 记录可审计的覆盖(`evidence_status=overridden`),不是静默放行。
68
+ 5. 若 complete 闸门拦下:Bash `harnessed checkpoint fail verify-progress --failing-tests <n>` 记录本次尝试。命中停机条件时会打印 `BUDGET-EXHAUSTED` / `NO-PROGRESS` / `BREAK-LOOP`。**仅当**三者都未触发时才允许重 spawn;任一触发即 STOP —— 重新收敛子任务范围、修掉阻塞点,或上报用户。
65
69
 
66
- <!-- harnessed-generated:v4.9.3 -->
70
+ <!-- harnessed-generated:v4.12.0 -->
67
71
 
68
72
  ## 参考资料
69
73
 
@@ -4,8 +4,8 @@ description: |
4
4
  Stage ④.d verify sub-workflow — gstack /qa 端到端 QA 验收 (has_ui_changes 触发, 可选 conditional;
5
5
  bundled verify-stage optional /qa step).
6
6
  schema_version: harnessed.workflow.v3 with disciplines_applied (6 default) + tools_available
7
- (gstack-qa + playwright-cli + playwright-test + webapp-testing) + 1 phase (gate ref
8
- has_ui_changes conditional)。
7
+ (gstack-qa + browse + playwright-cli + playwright-test + webapp-testing + chrome-devtools-mcp)
8
+ + 5 phase (01-qa gate ref has_ui_changes conditional + 4 条 web-testing-routing lane)。
9
9
  Triggered by slash command
10
10
  `/verify-qa` after `harnessed setup`.
11
11
  trigger_phrases:
@@ -20,37 +20,52 @@ trigger_phrases:
20
20
 
21
21
  ## Overview
22
22
 
23
- 1-phase sub-workflow mapping CLAUDE.md "Verify 阶段 — 可选 /qa" onto harnessed runtime
23
+ 5-phase sub-workflow mapping CLAUDE.md "Verify 阶段 — 可选 /qa" onto harnessed runtime
24
24
  (Phase v3.0-3.4 W0.13a — D-04 Stage ④ Verify 7 sub + D-12 gstack 治理关卡 + Pattern A
25
- sub-workflow ship)。
25
+ sub-workflow ship; T2.3 三层职责矩阵 + 非功能性诊断 4 条 lane 接线)。
26
26
 
27
27
  | phase | id | upstream | model | capability | gate |
28
28
  | ----- | -- | -------- | ----- | ---------- | ---- |
29
29
  | 1 | `01-qa` | gstack | sonnet | `{{ capabilities.gstack-qa.cmd }}` | `judgments.stage-routing.verify-qa-ui.fires` |
30
+ | 2 | `02-e2e-ci` | playwright-test | sonnet | (upstream-driven) | `judgments.web-testing-routing.playwright-test-default.fires` |
31
+ | 3 | `03-browser-probe` | gstack | sonnet | `{{ capabilities.browse.cmd }}` | `judgments.web-testing-routing.browse-probe.fires` |
32
+ | 4 | `04-python-backend-e2e` | gstack | sonnet | `{{ capabilities.webapp-testing.cmd }}` | `judgments.web-testing-routing.webapp-testing-python-backend.fires` |
33
+ | 5 | `05-perf-a11y-diagnostic` | chrome-devtools-mcp | sonnet | (upstream-driven) | `judgments.web-testing-routing.chrome-devtools-mcp-diagnostic.fires` |
30
34
 
31
35
  Per-phase config loads from `workflows/verify/qa/workflow.yaml`; engine 4-level gate resolver
32
36
  evaluates `phase.has_ui_changes == true` via expr-eval — true 则 invoke gstack `/qa` (端到端
33
- QA 验收 + UI dogfood), false 则 skip。
37
+ QA 验收 + UI dogfood), false 则 skip。Phase 02-05 是三层职责矩阵 + 非功能性诊断的 4 条 lane,
38
+ 由 `subtask.test_type` 单值互斥选择 — 无 test_type 信号时全 skip (只跑 01-qa)。
34
39
 
35
40
  ## Capability refs
36
41
 
37
42
  Sister `workflows/capabilities.yaml` entries:
38
43
  - `gstack-qa` — Bucket 3 治理关卡 (impl: gstack, cmd: /qa, fires_when: has_ui_changes)
39
- - `playwright-cli` — Bucket 2 special-purpose (impl: npm-cli, browser_probe)
44
+ - `browse` — Bucket 2 special-purpose (impl: gstack user-skill, cmd: /browse — 手层主导)
45
+ - `playwright-cli` — Bucket 2 special-purpose (impl: npm-cli, browser_probe — 未装 gstack 时的降级)
40
46
  - `playwright-test` — Bucket 2 special-purpose (impl: npm-cli, e2e_test typescript)
41
47
  - `webapp-testing` — Bucket 2 special-purpose (impl: gstack, e2e_test python)
48
+ - `chrome-devtools-mcp` — Bucket 4 tool-mcp (impl: mcp, cmd: chrome-devtools — 非功能性诊断必用;
49
+ provider 二选一: ecc bonus tier 或 optional 自装 manifest,两者都缺则该 lane 不可用)
42
50
 
43
51
  ## Gate ref
44
52
 
45
53
  Sister `workflows/judgments/stage-routing.yaml`:
46
54
  - `verify-qa-ui.fires` — `phase.stage == 'verify' and phase.has_ui_changes == true`
47
55
 
56
+ Sister `workflows/judgments/web-testing-routing.yaml` (T2.3 — 4 条 lane 各接一个 gate):
57
+ - `playwright-test-default.fires` → phase 02
58
+ - `browse-probe.fires` → phase 03
59
+ - `webapp-testing-python-backend.fires` → phase 04
60
+ - `chrome-devtools-mcp-diagnostic.fires` → phase 05
61
+
48
62
  ## Routing rules (bundled web-testing routing — `workflows/judgments/web-testing-routing.yaml`)
49
63
 
50
- - 写测试 提交 repo / CI 跑 → `@playwright/test` (默认 frontend/e2e/*.spec.ts)
51
- - 探查 / 调试 / 一次性确认 → `playwright-cli` (token 最省)
52
- - setup 需 Python 后端 (Tortoise ORM / pandas) → `webapp-testing` skill
53
- - 性能 / a11y / 内存诊断 → 不在此 sub-workflow,用 `chrome-devtools-mcp`
64
+ - 写测试 提交 repo / CI 跑 → `@playwright/test` (默认 frontend/e2e/*.spec.ts) — phase 02
65
+ - 探查 / 调试 / 一次性确认 → `/browse` 主导 (token 高效, 可复用 cookies 与会话状态);
66
+ 未装 gstack 时降级 `playwright-cli` — phase 03
67
+ - setup 需 Python 后端 (Tortoise ORM / pandas) → `webapp-testing` skill — phase 04
68
+ - 性能 / a11y / 内存诊断 → **必用** `chrome-devtools-mcp` (NOT playwright/test/cli/webapp-testing) — phase 05
54
69
 
55
70
  ## How to invoke
56
71
 
@@ -67,17 +82,21 @@ Do NOT pipe to `harnessed run verify-qa` — that is the CI/headless path (in-pr
67
82
  that blocks the session inside Claude Code).
68
83
 
69
84
  1. Bash: `harnessed prompt verify-qa --task "$ARGUMENTS" --json` → parse `{prompt, max_iterations, model}`.
70
- 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, use the native goal gate instead (Claude Code 2.1.139+ / Codex): `/goal "this subtask is delivered: the subagent's final output contains verbatim <promise>COMPLETE</promise>; or stop after <max_iterations> turns"` then spawn the subagent and let the goal evaluator drive re-spawns until it clears. If `/goal` is unavailable too, self-loop: spawn → check output for `<promise>COMPLETE</promise>` → re-spawn with prior output appended (up to max_iterations). Set the goal only at the leaf subtask level — `/goal` is single-slot per session and a nested goal overwrites the outer one.
85
+ 2. Spawn a CC-native subagent (Task / Agent tool) with that `prompt` and `model`, then drive delivery with harnessed's own completion gate:
86
+ - on return, write the subagent's final output to a file and run `harnessed checkpoint complete verify-qa --result-file <path>` — it is fail-closed on the declared artifacts, the TDD boundary, and the verbatim `<promise>COMPLETE</promise>`.
87
+ - if it blocks, run `harnessed checkpoint fail verify-qa --failing-tests <n>` to record the attempt; it prints BUDGET-EXHAUSTED / NO-PROGRESS / BREAK-LOOP when a stop condition is reached.
88
+ - respawn ONLY while none of those three has fired. Any one of them means stop: re-scope the subtask, fix the blocker, or escalate to the user. Never respawn past a stop directive.
71
89
  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.
72
- 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.
90
+ 4. On `<promise>COMPLETE</promise>`: write the subagent’s final output to a file, then Bash `harnessed checkpoint complete verify-qa --result-file <path> --summary "<one-line>"`. Fail-CLOSED — it blocks unless every declared `artifacts_expected` file exists, the TDD boundary passes (non-empty evidence / both the red and green sides present / the test file was not deleted), and the result carries a verbatim `<promise>COMPLETE</promise>` (or a structured COMPLETE status). `--result <text>` is the inline variant; `--result-file` wins and is quoting-safe on Windows. `--force` records an audited override (`evidence_status=overridden`) — it does not silently pass.
91
+ 5. If the complete gate blocked: Bash `harnessed checkpoint fail verify-qa --failing-tests <n>` to record the attempt. It prints `BUDGET-EXHAUSTED` / `NO-PROGRESS` / `BREAK-LOOP` once a stop condition is reached. Respawn ONLY while none of those three has fired; any one of them means STOP — re-scope the subtask, fix the blocker, or escalate to the user.
73
92
 
74
- <!-- harnessed-generated:v4.9.3 -->
93
+ <!-- harnessed-generated:v4.12.0 -->
75
94
 
76
95
  ## References
77
96
 
78
97
  - D-04 Stage ④ Verify 7 sub 分解
79
98
  - D-12 gstack 治理关卡可选
80
99
  - workflows/judgments/web-testing-routing.yaml — 三层职责矩阵 (脑 / 手 / 筋骨)
81
- - workflows/capabilities.yaml — gstack-qa / playwright-cli / playwright-test / webapp-testing
100
+ - workflows/capabilities.yaml — gstack-qa / browse / playwright-cli / playwright-test / webapp-testing / chrome-devtools-mcp
82
101
  - workflows/judgments/stage-routing.yaml — verify-qa-ui trigger
83
102
  - workflows/verify-work/workflow.yaml v2 SHIPPED phase 05-qa-conditional sister verbatim