harnessed 4.32.22 → 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 (99) hide show
  1. package/README.md +6 -6
  2. package/bin/harnessed-inject-state.mjs +16 -0
  3. package/dist/cli.mjs +1201 -235
  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/doc-discipline-gate.yaml +54 -0
  9. package/messages/en.json +8 -0
  10. package/messages/zh-Hans.json +8 -0
  11. package/package.json +1 -1
  12. package/routing/decision_rules.yaml +1 -1
  13. package/workflows/README.md +1 -1
  14. package/workflows/auto/SKILL.md +13 -9
  15. package/workflows/auto/SKILL.zh-Hans.md +13 -9
  16. package/workflows/capabilities.yaml +94 -39
  17. package/workflows/defaults.yaml +8 -2
  18. package/workflows/disciplines/karpathy.yaml +29 -0
  19. package/workflows/disciplines/karpathy.zh-Hans.yaml +27 -0
  20. package/workflows/disciplines/language.yaml +15 -10
  21. package/workflows/disciplines/operational.yaml +1 -1
  22. package/workflows/disciplines/operational.zh-Hans.yaml +1 -1
  23. package/workflows/disciplines/output-style.yaml +10 -2
  24. package/workflows/disciplines/output-style.zh-Hans.yaml +10 -2
  25. package/workflows/disciplines/priority.yaml +15 -2
  26. package/workflows/disciplines/priority.zh-Hans.yaml +15 -2
  27. package/workflows/discuss/auto/SKILL.md +4 -4
  28. package/workflows/discuss/auto/SKILL.zh-Hans.md +4 -4
  29. package/workflows/discuss/auto/workflow.yaml +16 -3
  30. package/workflows/discuss/phase/SKILL.md +1 -1
  31. package/workflows/discuss/phase/SKILL.zh-Hans.md +1 -1
  32. package/workflows/discuss/strategic/SKILL.md +1 -1
  33. package/workflows/discuss/strategic/SKILL.zh-Hans.md +1 -1
  34. package/workflows/discuss/subtask/SKILL.md +1 -1
  35. package/workflows/discuss/subtask/SKILL.zh-Hans.md +1 -1
  36. package/workflows/judgments/parallelism-gate.yaml +11 -6
  37. package/workflows/judgments/phase-gate.yaml +5 -1
  38. package/workflows/judgments/stage-routing.yaml +21 -26
  39. package/workflows/judgments/strategic-gate.yaml +30 -0
  40. package/workflows/judgments/user-overrides.yaml +7 -3
  41. package/workflows/judgments/web-testing-routing.yaml +19 -7
  42. package/workflows/plan/architecture/SKILL.md +7 -3
  43. package/workflows/plan/architecture/SKILL.zh-Hans.md +7 -3
  44. package/workflows/plan/auto/SKILL.md +11 -7
  45. package/workflows/plan/auto/SKILL.zh-Hans.md +11 -7
  46. package/workflows/plan/phase/SKILL.md +7 -3
  47. package/workflows/plan/phase/SKILL.zh-Hans.md +7 -3
  48. package/workflows/research/SKILL.md +24 -9
  49. package/workflows/research/SKILL.zh-Hans.md +23 -9
  50. package/workflows/research/workflow.yaml +43 -3
  51. package/workflows/retro/SKILL.md +7 -3
  52. package/workflows/retro/SKILL.zh-Hans.md +7 -3
  53. package/workflows/role-prompts.yaml +28 -21
  54. package/workflows/role-prompts.zh-Hans.yaml +22 -17
  55. package/workflows/ship/auto/SKILL.md +11 -7
  56. package/workflows/ship/auto/SKILL.zh-Hans.md +11 -7
  57. package/workflows/ship/preflight/SKILL.md +7 -3
  58. package/workflows/ship/preflight/SKILL.zh-Hans.md +7 -3
  59. package/workflows/task/auto/SKILL.md +26 -16
  60. package/workflows/task/auto/SKILL.zh-Hans.md +26 -16
  61. package/workflows/task/auto/workflow.yaml +11 -4
  62. package/workflows/task/clarify/SKILL.md +1 -1
  63. package/workflows/task/clarify/SKILL.zh-Hans.md +1 -1
  64. package/workflows/task/code/SKILL.md +7 -3
  65. package/workflows/task/code/SKILL.zh-Hans.md +7 -3
  66. package/workflows/task/deliver/SKILL.md +53 -35
  67. package/workflows/task/deliver/SKILL.zh-Hans.md +54 -36
  68. package/workflows/task/deliver/workflow.yaml +32 -24
  69. package/workflows/task/test/SKILL.md +7 -3
  70. package/workflows/task/test/SKILL.zh-Hans.md +7 -3
  71. package/workflows/task/test/workflow.yaml +13 -0
  72. package/workflows/verify/auto/SKILL.md +12 -8
  73. package/workflows/verify/auto/SKILL.zh-Hans.md +12 -8
  74. package/workflows/verify/auto/workflow.yaml +3 -1
  75. package/workflows/verify/code-review/SKILL.md +7 -3
  76. package/workflows/verify/code-review/SKILL.zh-Hans.md +7 -3
  77. package/workflows/verify/design/SKILL.md +24 -10
  78. package/workflows/verify/design/SKILL.zh-Hans.md +24 -10
  79. package/workflows/verify/design/workflow.yaml +36 -7
  80. package/workflows/verify/eval-review/SKILL.md +7 -3
  81. package/workflows/verify/eval-review/SKILL.zh-Hans.md +7 -3
  82. package/workflows/verify/multispec/SKILL.md +17 -10
  83. package/workflows/verify/multispec/SKILL.zh-Hans.md +16 -10
  84. package/workflows/verify/multispec/workflow.yaml +7 -5
  85. package/workflows/verify/paranoid/SKILL.md +7 -3
  86. package/workflows/verify/paranoid/SKILL.zh-Hans.md +7 -3
  87. package/workflows/verify/progress/SKILL.md +7 -3
  88. package/workflows/verify/progress/SKILL.zh-Hans.md +7 -3
  89. package/workflows/verify/qa/SKILL.md +33 -14
  90. package/workflows/verify/qa/SKILL.zh-Hans.md +33 -14
  91. package/workflows/verify/qa/workflow.yaml +55 -2
  92. package/workflows/verify/security/SKILL.md +7 -3
  93. package/workflows/verify/security/SKILL.zh-Hans.md +7 -3
  94. package/workflows/verify/simplify/SKILL.md +7 -3
  95. package/workflows/verify/simplify/SKILL.zh-Hans.md +7 -3
  96. package/workflows/verify/validate-phase/SKILL.md +7 -3
  97. package/workflows/verify/validate-phase/SKILL.zh-Hans.md +7 -3
  98. package/manifests/skill-packs/karpathy-skills.yaml +0 -65
  99. package/manifests/tools/ralph-loop.yaml +0 -46
@@ -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
@@ -4,8 +4,8 @@ description: |
4
4
  Stage ④.d 验证子工作流 — gstack /qa 端到端 QA 验收 (has_ui_changes 触发, 可选 conditional;
5
5
  捆绑 verify 阶段可选 /qa 步骤).
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
  ## 概览
22
22
 
23
- 1-phase 子工作流,将 CLAUDE.md "Verify 阶段 — 可选 /qa" 映射到 harnessed 运行时
23
+ 5-phase 子工作流,将 CLAUDE.md "Verify 阶段 — 可选 /qa" 映射到 harnessed 运行时
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 驱动) | `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 驱动) | `judgments.web-testing-routing.chrome-devtools-mcp-diagnostic.fires` |
30
34
 
31
35
  Per-phase 配置从 `workflows/verify/qa/workflow.yaml` 加载;引擎 4-level gate resolver
32
36
  通过 expr-eval 计算 `phase.has_ui_changes == true` — true 则调用 gstack `/qa` (端到端
33
- QA 验收 + UI dogfood),false 则跳过。
37
+ QA 验收 + UI dogfood),false 则跳过。Phase 02-05 是三层职责矩阵 + 非功能性诊断的 4 条 lane,
38
+ 由 `subtask.test_type` 单值互斥选择——无 test_type 信号时全部跳过(只跑 01-qa)。
34
39
 
35
40
  ## Capability refs
36
41
 
37
42
  Sister `workflows/capabilities.yaml` 条目:
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
  ## 路由规则(捆绑 web-testing 路由 — `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 / 内存诊断 → 不在此子工作流,用 `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
  ## 如何调用
56
71
 
@@ -66,17 +81,21 @@ CC-native Task / Agent 工具 spawn subagent(保持 session 响应 + 让澄清 r
66
81
  Code 内部会阻塞 session)。
67
82
 
68
83
  1. Bash: `harnessed prompt verify-qa --task "$ARGUMENTS" --json` → 解析 `{prompt, max_iterations, model}`。
69
- 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 会覆盖外层。
84
+ 2. 用 CC-native subagent(Task / Agent 工具)以该 `prompt` + `model` spawn,然后用 harnessed 自己的完成闸门驱动交付:
85
+ - subagent 返回后,把它的最终输出写入文件,跑 `harnessed checkpoint complete verify-qa --result-file <path>` —— 该命令对声明的产物、TDD boundary、逐字 `<promise>COMPLETE</promise>` 三者 fail-closed。
86
+ - 若被拦下,跑 `harnessed checkpoint fail verify-qa --failing-tests <n>` 记录本次尝试;命中停机条件时它会打印 BUDGET-EXHAUSTED / NO-PROGRESS / BREAK-LOOP。
87
+ - **仅当**这三者都未触发时才允许重 spawn。任一触发即停:重新收敛子任务范围、修掉阻塞点,或上报用户。绝不越过停机指令继续重 spawn。
70
88
  3. 若输出含 `STATUS: NEEDS_CLARIFICATION` + 问题列表:STOP,用 AskUserQuestion 原样转达,把答案 append 进 spec,再重 spawn。
71
- 4. 命中 `<promise>COMPLETE</promise>`:Bash `harnessed checkpoint complete verify-qa --summary "<one-line>"`。evidence guard 在此运行(fail-CLOSED):若声明的 `artifacts_expected` 文件缺失会 exit 非零 —— 重 spawn 产出它再算 done。
89
+ 4. 命中 `<promise>COMPLETE</promise>`:把 subagent 最终输出写入文件,再 Bash `harnessed checkpoint complete verify-qa --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`),不是静默放行。
90
+ 5. 若 complete 闸门拦下:Bash `harnessed checkpoint fail verify-qa --failing-tests <n>` 记录本次尝试。命中停机条件时会打印 `BUDGET-EXHAUSTED` / `NO-PROGRESS` / `BREAK-LOOP`。**仅当**三者都未触发时才允许重 spawn;任一触发即 STOP —— 重新收敛子任务范围、修掉阻塞点,或上报用户。
72
91
 
73
- <!-- harnessed-generated:v4.9.3 -->
92
+ <!-- harnessed-generated:v4.12.0 -->
74
93
 
75
94
  ## 参考资料
76
95
 
77
96
  - D-04 Stage ④ Verify 7 sub 分解
78
97
  - D-12 gstack 治理关卡可选
79
98
  - workflows/judgments/web-testing-routing.yaml — 三层职责矩阵 (脑 / 手 / 筋骨)
80
- - workflows/capabilities.yaml — gstack-qa / playwright-cli / playwright-test / webapp-testing
99
+ - workflows/capabilities.yaml — gstack-qa / browse / playwright-cli / playwright-test / webapp-testing / chrome-devtools-mcp
81
100
  - workflows/judgments/stage-routing.yaml — verify-qa-ui trigger
82
101
  - workflows/verify-work/workflow.yaml v2 SHIPPED phase 05-qa-conditional sister verbatim
@@ -15,10 +15,24 @@ description: |
15
15
  Stage ④.d gstack /qa 端到端 QA 验收 (has_ui_changes 触发, 可选 conditional)。
16
16
  Gate: judgments.stage-routing.verify-qa-ui.fires (phase.has_ui_changes == true) —
17
17
  frontend / E2E module fire only; 后端 / docs PR skip。tools_available 包含
18
- playwright-cli / playwright-test / webapp-testing 配套 E2E test 工具链。
18
+ browse / playwright-cli / playwright-test / webapp-testing / chrome-devtools-mcp
19
+ 配套 E2E test + 非功能性诊断工具链 (T2.3: 三层职责矩阵 4 条 lane 各接一个
20
+ web-testing-routing gate)。
19
21
 
20
22
  disciplines_applied: [karpathy, output-style, language, operational, priority, protocols]
21
- tools_available: [gstack-qa, playwright-cli, playwright-test, webapp-testing]
23
+ # T2.3 — browse 补入 (手层主导, /browse 优先于 playwright-cli);
24
+ # chrome-devtools-mcp 补入 —— 「非功能性诊断 (性能 / a11y / 内存) 必用
25
+ # chrome-devtools-mcp」之前对模型完全不可见 (不在任何 tools_available)。
26
+ # chrome-devtools-mcp provider 二选一: ecc (bonus tier, ECC 唯一默认 MCP connector)
27
+ # 或 optional 自装 manifest chrome-devtools-mcp (不装 ecc 的兜底); 双装 doctor warn;
28
+ # 两者都缺时该 lane 不可用 (注记体例同 web-testing-routing.yaml)。
29
+ tools_available:
30
+ - gstack-qa
31
+ - browse
32
+ - playwright-cli
33
+ - playwright-test
34
+ - webapp-testing
35
+ - chrome-devtools-mcp
22
36
 
23
37
  phases:
24
38
  - id: 01-qa
@@ -31,3 +45,42 @@ phases:
31
45
  # D2-followup (ADR-0033): declare report artifact so the evidence guard is real
32
46
  # (verified, not none_declared) — proves the end-to-end QA pass actually ran.
33
47
  artifacts_expected: [qa-report.md]
48
+
49
+ # T2.3 — 三层职责矩阵 + 非功能性诊断的 4 条 lane。之前 web-testing-routing.yaml
50
+ # 的 4 个 trigger 是运行时孤儿 (零 gate ref → 文件永不加载求值)。lane 由
51
+ # subtask.test_type 单值选择 (互斥); 默认 gateContext test_type 无信号 → 全 skip,
52
+ # 与改动前行为等价 (只跑 01-qa)。
53
+
54
+ # 脑 — 提交进 repo / CI 跑的正式 E2E test framework
55
+ - id: 02-e2e-ci
56
+ name: '@playwright/test (脑层 — frontend/e2e/*.spec.ts, 断言 / fixtures / reporter)'
57
+ upstream: playwright-test
58
+ model: sonnet
59
+ gate: judgments.web-testing-routing.playwright-test-default.fires
60
+ max_iterations: 3
61
+
62
+ # 手 — AI 实时探查 / 调试 / 一次性确认; /browse 主导, 未装 gstack 降级 playwright-cli
63
+ - id: 03-browser-probe
64
+ name: browse (手层 — /browse 主导; 未装 gstack 降级 playwright-cli)
65
+ upstream: gstack
66
+ capability: '{{ capabilities.browse.cmd }}'
67
+ model: sonnet
68
+ gate: judgments.web-testing-routing.browse-probe.fires
69
+ max_iterations: 3
70
+
71
+ # 筋骨 — Python 后端联动特例 (Tortoise ORM / pandas / Django Jinja 模板)
72
+ - id: 04-python-backend-e2e
73
+ name: webapp-testing (筋骨层 — tests/e2e/*.py + with_server.py 双进程)
74
+ upstream: gstack
75
+ capability: '{{ capabilities.webapp-testing.cmd }}'
76
+ model: sonnet
77
+ gate: judgments.web-testing-routing.webapp-testing-python-backend.fires
78
+ max_iterations: 3
79
+
80
+ # 非功能性诊断 — 必用 chrome-devtools-mcp (NOT playwright/test/cli/webapp-testing)
81
+ - id: 05-perf-a11y-diagnostic
82
+ name: chrome-devtools-mcp (LCP / Core Web Vitals / ARIA / 堆快照 — 非功能性 only)
83
+ upstream: chrome-devtools-mcp
84
+ model: sonnet
85
+ gate: judgments.web-testing-routing.chrome-devtools-mcp-diagnostic.fires
86
+ max_iterations: 3
@@ -62,11 +62,15 @@ Do NOT pipe to `harnessed run verify-security` — that is the CI/headless path
62
62
  that blocks the session inside Claude Code).
63
63
 
64
64
  1. Bash: `harnessed prompt verify-security --task "$ARGUMENTS" --json` → parse `{prompt, max_iterations, model}`.
65
- 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.
65
+ 2. Spawn a CC-native subagent (Task / Agent tool) with that `prompt` and `model`, then drive delivery with harnessed's own completion gate:
66
+ - on return, write the subagent's final output to a file and run `harnessed checkpoint complete verify-security --result-file <path>` — it is fail-closed on the declared artifacts, the TDD boundary, and the verbatim `<promise>COMPLETE</promise>`.
67
+ - if it blocks, run `harnessed checkpoint fail verify-security --failing-tests <n>` to record the attempt; it prints BUDGET-EXHAUSTED / NO-PROGRESS / BREAK-LOOP when a stop condition is reached.
68
+ - 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.
66
69
  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.
67
- 4. On `<promise>COMPLETE</promise>`: Bash `harnessed checkpoint complete verify-security --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.
70
+ 4. On `<promise>COMPLETE</promise>`: write the subagent’s final output to a file, then Bash `harnessed checkpoint complete verify-security --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.
71
+ 5. If the complete gate blocked: Bash `harnessed checkpoint fail verify-security --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.
68
72
 
69
- <!-- harnessed-generated:v4.9.3 -->
73
+ <!-- harnessed-generated:v4.12.0 -->
70
74
 
71
75
  ## References
72
76