harnessed 5.0.12 → 5.0.14

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 (84) hide show
  1. package/CHANGELOG.md +27 -1
  2. package/README-zh.md +1 -28
  3. package/README.md +1 -28
  4. package/bin/harnessed-check-docs.mjs +15 -0
  5. package/bin/harnessed-update-reminder-worker.mjs +2819 -151
  6. package/bin/harnessed-update-reminder.mjs +665 -69
  7. package/dist/cli.mjs +1528 -590
  8. package/dist/cli.mjs.map +1 -1
  9. package/dist/index.mjs +1 -1
  10. package/dist/index.mjs.map +1 -1
  11. package/messages/en.json +15 -1
  12. package/messages/zh-Hans.json +15 -1
  13. package/package.json +1 -2
  14. package/workflows/auto/SKILL.md +10 -18
  15. package/workflows/auto/SKILL.zh-Hans.md +8 -18
  16. package/workflows/discuss/auto/SKILL.md +4 -7
  17. package/workflows/discuss/auto/SKILL.zh-Hans.md +2 -7
  18. package/workflows/discuss/phase/SKILL.md +4 -7
  19. package/workflows/discuss/phase/SKILL.zh-Hans.md +2 -7
  20. package/workflows/discuss/strategic/SKILL.md +4 -8
  21. package/workflows/discuss/strategic/SKILL.zh-Hans.md +2 -8
  22. package/workflows/discuss/subtask/SKILL.md +4 -7
  23. package/workflows/discuss/subtask/SKILL.zh-Hans.md +2 -7
  24. package/workflows/harnessed-update/SKILL.md +9 -8
  25. package/workflows/harnessed-update/SKILL.zh-Hans.md +7 -8
  26. package/workflows/host-primitives.yaml +8 -8
  27. package/workflows/host-primitives.zh-Hans.yaml +8 -8
  28. package/workflows/plan/ai-integration/SKILL.md +7 -7
  29. package/workflows/plan/ai-integration/SKILL.zh-Hans.md +7 -7
  30. package/workflows/plan/architecture/SKILL.md +7 -13
  31. package/workflows/plan/architecture/SKILL.zh-Hans.md +7 -13
  32. package/workflows/plan/auto/SKILL.md +8 -14
  33. package/workflows/plan/auto/SKILL.zh-Hans.md +8 -14
  34. package/workflows/plan/phase/SKILL.md +7 -13
  35. package/workflows/plan/phase/SKILL.zh-Hans.md +7 -13
  36. package/workflows/plan/secure/SKILL.md +7 -7
  37. package/workflows/plan/secure/SKILL.zh-Hans.md +7 -7
  38. package/workflows/plan/spec/SKILL.md +7 -7
  39. package/workflows/plan/spec/SKILL.zh-Hans.md +7 -7
  40. package/workflows/plan/ui/SKILL.md +7 -7
  41. package/workflows/plan/ui/SKILL.zh-Hans.md +7 -7
  42. package/workflows/research/SKILL.md +7 -7
  43. package/workflows/research/SKILL.zh-Hans.md +7 -7
  44. package/workflows/retro/SKILL.md +8 -15
  45. package/workflows/retro/SKILL.zh-Hans.md +7 -15
  46. package/workflows/ship/auto/SKILL.md +8 -14
  47. package/workflows/ship/auto/SKILL.zh-Hans.md +8 -14
  48. package/workflows/ship/preflight/SKILL.md +7 -9
  49. package/workflows/ship/preflight/SKILL.zh-Hans.md +7 -9
  50. package/workflows/task/auto/SKILL.md +8 -15
  51. package/workflows/task/auto/SKILL.zh-Hans.md +8 -15
  52. package/workflows/task/clarify/SKILL.md +2 -10
  53. package/workflows/task/clarify/SKILL.zh-Hans.md +2 -10
  54. package/workflows/task/code/SKILL.md +7 -15
  55. package/workflows/task/code/SKILL.zh-Hans.md +7 -15
  56. package/workflows/task/deliver/SKILL.md +7 -17
  57. package/workflows/task/deliver/SKILL.zh-Hans.md +7 -17
  58. package/workflows/task/test/SKILL.md +7 -14
  59. package/workflows/task/test/SKILL.zh-Hans.md +7 -14
  60. package/workflows/verify/auto/SKILL.md +9 -14
  61. package/workflows/verify/auto/SKILL.zh-Hans.md +9 -14
  62. package/workflows/verify/code-review/SKILL.md +8 -13
  63. package/workflows/verify/code-review/SKILL.zh-Hans.md +8 -13
  64. package/workflows/verify/design/SKILL.md +8 -12
  65. package/workflows/verify/design/SKILL.zh-Hans.md +7 -12
  66. package/workflows/verify/eval-review/SKILL.md +8 -12
  67. package/workflows/verify/eval-review/SKILL.zh-Hans.md +7 -12
  68. package/workflows/verify/multispec/SKILL.md +8 -15
  69. package/workflows/verify/multispec/SKILL.zh-Hans.md +7 -15
  70. package/workflows/verify/paranoid/SKILL.md +7 -14
  71. package/workflows/verify/paranoid/SKILL.zh-Hans.md +7 -14
  72. package/workflows/verify/progress/SKILL.md +8 -13
  73. package/workflows/verify/progress/SKILL.zh-Hans.md +8 -13
  74. package/workflows/verify/qa/SKILL.md +7 -13
  75. package/workflows/verify/qa/SKILL.zh-Hans.md +7 -13
  76. package/workflows/verify/second-opinion/SKILL.md +8 -12
  77. package/workflows/verify/second-opinion/SKILL.zh-Hans.md +7 -12
  78. package/workflows/verify/security/SKILL.md +8 -12
  79. package/workflows/verify/security/SKILL.zh-Hans.md +7 -12
  80. package/workflows/verify/simplify/SKILL.md +8 -12
  81. package/workflows/verify/simplify/SKILL.zh-Hans.md +7 -12
  82. package/workflows/verify/validate-phase/SKILL.md +8 -12
  83. package/workflows/verify/validate-phase/SKILL.zh-Hans.md +7 -12
  84. package/README-en.md +0 -659
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: plan-ui
3
- description: Run the conditional GSD ui-phase design contract before plan-phase.
3
+ description: "Optional: produce the GSD UI design contract before plan-phase when the change touches the UI."
4
4
  trigger_phrases: ["plan ui", "gsd ui phase"]
5
5
  ---
6
6
 
@@ -27,13 +27,13 @@ evidence guard). harnessed gives you the spawn-ready prompt; YOU spawn the subag
27
27
 
28
28
  Do NOT pipe to `harnessed run plan-ui` — that is the CI/headless path ({{ host.harnessed_run_warning_note.execution_tail }}
29
29
 
30
- 1. Bash: `harnessed prompt plan-ui --task "$ARGUMENTS" --json` → parse `{prompt, max_iterations, model}`.
31
- 2. Spawn a {{ host.native }} subagent ({{ host.spawn_subagent }}) with that `prompt` and `model`, then drive delivery with harnessed's own completion gate:
32
- - on return, write the subagent's final output to a file and run `harnessed checkpoint complete plan-ui --result-file <path>` — it is fail-closed on the declared artifacts, the TDD boundary, and the verbatim `<promise>COMPLETE</promise>`.
30
+ 1. Bash: `harnessed prompt plan-ui --task "$ARGUMENTS" --json` → parse `{prompt, max_iterations, model, result_file}`.
31
+ 2. Spawn a {{ host.native }} subagent ({{ host.spawn_subagent }}) with that `prompt` and `model`. The sub writes its own final result into `result_file` — the path that prompt names — so the FILE is the completion signal: do NOT wait for the sub's chat message, because a background or re-parented agent's message may never arrive. Then drive delivery with harnessed's own completion gate:
32
+ - the gate is `harnessed checkpoint complete plan-ui --result-file <result_file> --wait 60` — one call waits at most 60 seconds, so run the SAME command again when the sub needs longer; it is fail-closed on the declared artifacts, the TDD boundary, and the verbatim `<promise>COMPLETE</promise>`.
33
33
  - if it blocks, run `harnessed checkpoint fail plan-ui --failing-tests <n>` to record the attempt; it prints BUDGET-EXHAUSTED / NO-PROGRESS / BREAK-LOOP when a stop condition is reached.
34
34
  - 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.
35
- 3. If the output contains `STATUS: NEEDS_CLARIFICATION` + a question list: STOP, relay them verbatim via {{ host.ask_user }}, append the answers to the spec, then re-spawn the same sub.
36
- 4. On `<promise>COMPLETE</promise>`: write the subagent’s final output to a file, then Bash `harnessed checkpoint complete plan-ui --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.
35
+ 3. If the sub’s output contains `STATUS: NEEDS_CLARIFICATION` + a question list (read it from `result_file` — the chat message may never arrive): STOP, relay them verbatim via {{ host.ask_user }}, append the answers to the spec, then re-spawn the same sub.
36
+ 4. When `result_file` carries the completion marker: Bash `harnessed checkpoint complete plan-ui --result-file <result_file> --wait 60 --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 file carries a verbatim `<promise>COMPLETE</promise>` (or a structured COMPLETE status). `--wait 60` bounds ONE call to 60 seconds — run the SAME command again when the sub needs longer, never an unbounded wait. `--result <text>` is the inline variant; `--result-file` wins and is quoting-safe on Windows. A `result-wait-timeout` exit means the sub has not signalled YET — repeat the same command; `--force` records an audited override (`evidence_status=overridden`) — it does not silently pass.
37
37
  5. If the complete gate blocked: Bash `harnessed checkpoint fail plan-ui --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.
38
38
 
39
- <!-- harnessed-generated:v4.12.0 -->
39
+ <!-- harnessed-generated:v4.13.0 -->
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: plan-ui
3
- description: 在 plan-phase 前按条件运行 GSD ui-phase 设计契约。
3
+ description: 可选:改动涉及 UI 时,在 plan-phase 前产出 GSD UI 设计契约。
4
4
  trigger_phrases: ["plan ui", "gsd ui phase"]
5
5
  ---
6
6
 
@@ -26,13 +26,13 @@ freestyle 会旁路引擎(无 ledger、无 evidence guard)。harnessed 给你 sp
26
26
 
27
27
  **不要** pipe 到 `harnessed run plan-ui` —— 那是 CI/headless 路径({{ host.harnessed_run_warning_note.execution_tail }}
28
28
 
29
- 1. Bash: `harnessed prompt plan-ui --task "$ARGUMENTS" --json` → 解析 `{prompt, max_iterations, model}`。
30
- 2. 用 {{ host.native }} subagent({{ host.spawn_subagent.zh_tool }})以该 `prompt` + `model` spawn,然后用 harnessed 自己的完成闸门驱动交付:
31
- - subagent 返回后,把它的最终输出写入文件,跑 `harnessed checkpoint complete plan-ui --result-file <path>` —— 该命令对声明的产物、TDD boundary、逐字 `<promise>COMPLETE</promise>` 三者 fail-closed。
29
+ 1. Bash: `harnessed prompt plan-ui --task "$ARGUMENTS" --json` → 解析 `{prompt, max_iterations, model, result_file}`。
30
+ 2. 用 {{ host.native }} subagent({{ host.spawn_subagent.zh_tool }})以该 `prompt` + `model` spawn。sub 自己把最终结果写入 `result_file`(prompt 里给出的那个路径)—— **完成信号是文件**,不是聊天消息:后台 / 被 re-parent 的 agent 消息可能永不到达,不要等它。然后用 harnessed 自己的完成闸门驱动交付:
31
+ - 闸门是 `harnessed checkpoint complete plan-ui --result-file <result_file> --wait 60` —— 单次调用最多等 60 秒,sub 需要更久就重复**同一条**命令;它对声明的产物、TDD boundary、逐字 `<promise>COMPLETE</promise>` 三者 fail-closed。
32
32
  - 若被拦下,跑 `harnessed checkpoint fail plan-ui --failing-tests <n>` 记录本次尝试;命中停机条件时它会打印 BUDGET-EXHAUSTED / NO-PROGRESS / BREAK-LOOP。
33
33
  - **仅当**这三者都未触发时才允许重 spawn。任一触发即停:重新收敛子任务范围、修掉阻塞点,或上报用户。绝不越过停机指令继续重 spawn。
34
- 3. 若输出含 `STATUS: NEEDS_CLARIFICATION` + 问题列表:STOP,用 {{ host.ask_user }} 原样转达,把答案 append 进 spec,再重 spawn。
35
- 4. 命中 `<promise>COMPLETE</promise>`:把 subagent 最终输出写入文件,再 Bash `harnessed checkpoint complete plan-ui --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`),不是静默放行。
34
+ 3. 若 sub 的输出含 `STATUS: NEEDS_CLARIFICATION` + 问题列表(从 `result_file` 读 —— 聊天消息可能永不到达):STOP,用 {{ host.ask_user }} 原样转达,把答案 append 进 spec,再重 spawn。
35
+ 4. 当 `result_file` 携带完成标记时:Bash `harnessed checkpoint complete plan-ui --result-file <result_file> --wait 60 --summary "<one-line>"`。fail-CLOSED —— 除非声明的 `artifacts_expected` 文件全部存在、TDD boundary 通过(证据非空 / 红绿两侧齐全 / 测试文件未被删除)、且结果文件含逐字 `<promise>COMPLETE</promise>`(或结构化 COMPLETE 状态),否则拦下。`--wait 60` 只约束**单次**调用为 60 秒 —— sub 需要更久就重复**同一条**命令,绝不无限等待。`--result <text>` 是内联变体;`--result-file` 优先且在 Windows 上引号安全。`result-wait-timeout` 退出码表示 sub 尚未发出完成信号 —— 重复同一条命令;`--force` 记录可审计的覆盖(`evidence_status=overridden`),不是静默放行。
36
36
  5. 若 complete 闸门拦下:Bash `harnessed checkpoint fail plan-ui --failing-tests <n>` 记录本次尝试。命中停机条件时会打印 `BUDGET-EXHAUSTED` / `NO-PROGRESS` / `BREAK-LOOP`。**仅当**三者都未触发时才允许重 spawn;任一触发即 STOP —— 重新收敛子任务范围、修掉阻塞点,或上报用户。
37
37
 
38
- <!-- harnessed-generated:v4.12.0 -->
38
+ <!-- harnessed-generated:v4.13.0 -->
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: research
3
- description: 多源调研 workflow — Tavily/Exa/ctx7 多源 fan-out + GSD discuss synth aggregate; harnessed v2.0 NEW per R20.7 (Stage ① Discuss 独立 call); schema bumped to harnessed.workflow.v3 in Phase v3.0-3.4 W1.1 (T3.4.W1.1) with disciplines_applied [6] + tools_available [tavily-mcp, exa-mcp, ctx7, gsd-discuss-phase], phases reuse v2 verbatim. Triggered by slash command `/research` after `harnessed setup`.
3
+ description: Research a question across multiple sources in parallel, then aggregate and deduplicate the findings into one synthesis. Use it when the answer needs current external information rather than what the repo already knows.
4
4
  preamble-tier: 2
5
5
  schema_version: harnessed.workflow.v3
6
6
  ---
@@ -60,14 +60,14 @@ evidence guard). harnessed gives you the spawn-ready prompt; YOU spawn the subag
60
60
 
61
61
  Do NOT pipe to `harnessed run research` — that is the CI/headless path ({{ host.harnessed_run_warning_note.execution_tail }}
62
62
 
63
- 1. Bash: `harnessed prompt research --task "$ARGUMENTS" --json` → parse `{prompt, max_iterations, model}`.
64
- 2. Spawn a {{ host.native }} subagent ({{ host.spawn_subagent }}) 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 research --result-file <path>` — it is fail-closed on the declared artifacts, the TDD boundary, and the verbatim `<promise>COMPLETE</promise>`.
63
+ 1. Bash: `harnessed prompt research --task "$ARGUMENTS" --json` → parse `{prompt, max_iterations, model, result_file}`.
64
+ 2. Spawn a {{ host.native }} subagent ({{ host.spawn_subagent }}) with that `prompt` and `model`. The sub writes its own final result into `result_file` — the path that prompt names — so the FILE is the completion signal: do NOT wait for the sub's chat message, because a background or re-parented agent's message may never arrive. Then drive delivery with harnessed's own completion gate:
65
+ - the gate is `harnessed checkpoint complete research --result-file <result_file> --wait 60` — one call waits at most 60 seconds, so run the SAME command again when the sub needs longer; it is fail-closed on the declared artifacts, the TDD boundary, and the verbatim `<promise>COMPLETE</promise>`.
66
66
  - if it blocks, run `harnessed checkpoint fail research --failing-tests <n>` to record the attempt; it prints BUDGET-EXHAUSTED / NO-PROGRESS / BREAK-LOOP when a stop condition is reached.
67
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.
68
68
  - {{ host.delivery_contract_note }}
69
- 3. If the output contains `STATUS: NEEDS_CLARIFICATION` + a question list: STOP, relay them verbatim via {{ host.ask_user }}, append the answers to the spec, then re-spawn the same sub.
70
- 4. On `<promise>COMPLETE</promise>`: write the subagent’s final output to a file, then Bash `harnessed checkpoint complete research --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.
69
+ 3. If the sub’s output contains `STATUS: NEEDS_CLARIFICATION` + a question list (read it from `result_file` — the chat message may never arrive): STOP, relay them verbatim via {{ host.ask_user }}, append the answers to the spec, then re-spawn the same sub.
70
+ 4. When `result_file` carries the completion marker: Bash `harnessed checkpoint complete research --result-file <result_file> --wait 60 --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 file carries a verbatim `<promise>COMPLETE</promise>` (or a structured COMPLETE status). `--wait 60` bounds ONE call to 60 seconds — run the SAME command again when the sub needs longer, never an unbounded wait. `--result <text>` is the inline variant; `--result-file` wins and is quoting-safe on Windows. A `result-wait-timeout` exit means the sub has not signalled YET — repeat the same command; `--force` records an audited override (`evidence_status=overridden`) — it does not silently pass.
71
71
  5. If the complete gate blocked: Bash `harnessed checkpoint fail research --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.
72
72
 
73
- <!-- harnessed-generated:v4.12.0 -->
73
+ <!-- harnessed-generated:v4.13.0 -->
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: research
3
- description: 多源调研工作流 — Tavily/Exa/ctx7 多源 fan-out + GSD discuss synth aggregate; harnessed v2.0 新增 per R20.7 (Stage ① Discuss 独立调用); schema bumped to harnessed.workflow.v3 in Phase v3.0-3.4 W1.1 (T3.4.W1.1) with disciplines_applied [6] + tools_available [tavily-mcp, exa-mcp, ctx7, gsd-discuss-phase], phases reuse v2 verbatim. Triggered by slash command `/research` after `harnessed setup`.
3
+ description: 多源并行调研,再把结果聚合去重成一份综合结论。用于答案依赖外部最新信息、而非仓库现有内容时。
4
4
  preamble-tier: 2
5
5
  schema_version: harnessed.workflow.v3
6
6
  ---
@@ -58,14 +58,14 @@ freestyle 会旁路引擎(无 ledger、无 evidence guard)。harnessed 给你 sp
58
58
 
59
59
  **不要** pipe 到 `harnessed run research` —— 那是 CI/headless 路径({{ host.harnessed_run_warning_note.execution_tail }}
60
60
 
61
- 1. Bash: `harnessed prompt research --task "$ARGUMENTS" --json` → 解析 `{prompt, max_iterations, model}`。
62
- 2. 用 {{ host.native }} subagent({{ host.spawn_subagent.zh_tool }})以该 `prompt` + `model` spawn,然后用 harnessed 自己的完成闸门驱动交付:
63
- - subagent 返回后,把它的最终输出写入文件,跑 `harnessed checkpoint complete research --result-file <path>` —— 该命令对声明的产物、TDD boundary、逐字 `<promise>COMPLETE</promise>` 三者 fail-closed。
61
+ 1. Bash: `harnessed prompt research --task "$ARGUMENTS" --json` → 解析 `{prompt, max_iterations, model, result_file}`。
62
+ 2. 用 {{ host.native }} subagent({{ host.spawn_subagent.zh_tool }})以该 `prompt` + `model` spawn。sub 自己把最终结果写入 `result_file`(prompt 里给出的那个路径)—— **完成信号是文件**,不是聊天消息:后台 / 被 re-parent 的 agent 消息可能永不到达,不要等它。然后用 harnessed 自己的完成闸门驱动交付:
63
+ - 闸门是 `harnessed checkpoint complete research --result-file <result_file> --wait 60` —— 单次调用最多等 60 秒,sub 需要更久就重复**同一条**命令;它对声明的产物、TDD boundary、逐字 `<promise>COMPLETE</promise>` 三者 fail-closed。
64
64
  - 若被拦下,跑 `harnessed checkpoint fail research --failing-tests <n>` 记录本次尝试;命中停机条件时它会打印 BUDGET-EXHAUSTED / NO-PROGRESS / BREAK-LOOP。
65
65
  - **仅当**这三者都未触发时才允许重 spawn。任一触发即停:重新收敛子任务范围、修掉阻塞点,或上报用户。绝不越过停机指令继续重 spawn。
66
66
  - {{ host.delivery_contract_note }}
67
- 3. 若输出含 `STATUS: NEEDS_CLARIFICATION` + 问题列表:STOP,用 {{ host.ask_user }} 原样转达,把答案 append 进 spec,再重 spawn。
68
- 4. 命中 `<promise>COMPLETE</promise>`:把 subagent 最终输出写入文件,再 Bash `harnessed checkpoint complete research --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`),不是静默放行。
67
+ 3. 若 sub 的输出含 `STATUS: NEEDS_CLARIFICATION` + 问题列表(从 `result_file` 读 —— 聊天消息可能永不到达):STOP,用 {{ host.ask_user }} 原样转达,把答案 append 进 spec,再重 spawn。
68
+ 4. 当 `result_file` 携带完成标记时:Bash `harnessed checkpoint complete research --result-file <result_file> --wait 60 --summary "<one-line>"`。fail-CLOSED —— 除非声明的 `artifacts_expected` 文件全部存在、TDD boundary 通过(证据非空 / 红绿两侧齐全 / 测试文件未被删除)、且结果文件含逐字 `<promise>COMPLETE</promise>`(或结构化 COMPLETE 状态),否则拦下。`--wait 60` 只约束**单次**调用为 60 秒 —— sub 需要更久就重复**同一条**命令,绝不无限等待。`--result <text>` 是内联变体;`--result-file` 优先且在 Windows 上引号安全。`result-wait-timeout` 退出码表示 sub 尚未发出完成信号 —— 重复同一条命令;`--force` 记录可审计的覆盖(`evidence_status=overridden`),不是静默放行。
69
69
  5. 若 complete 闸门拦下:Bash `harnessed checkpoint fail research --failing-tests <n>` 记录本次尝试。命中停机条件时会打印 `BUDGET-EXHAUSTED` / `NO-PROGRESS` / `BREAK-LOOP`。**仅当**三者都未触发时才允许重 spawn;任一触发即 STOP —— 重新收敛子任务范围、修掉阻塞点,或上报用户。
70
70
 
71
- <!-- harnessed-generated:v4.12.0 -->
71
+ <!-- harnessed-generated:v4.13.0 -->
@@ -1,15 +1,8 @@
1
1
  ---
2
2
  name: retro
3
3
  description: |
4
- Standalone post-④ Verify retrospective workflow — gstack /retro 经验教训 / 决策 / lessons
5
- 系统总结 (项目 / 里程碑结束可选, bundled milestone-close retrospective cadence)
6
- + planning-with-files RETROSPECTIVE.md 持久化 (sister Phase
7
- v2.0-2.5 RETROSPECTIVE pattern)。Capability ref retro-gstack alias suffix per Pattern A
8
- E.2 LOCK (NOT bare retro 避免 standalone workflow / capability namespace 冲突)。
9
- schema_version: harnessed.workflow.v3 with disciplines_applied (6 default) + tools_available
10
- (retro-gstack + planning-with-files) + 2 phase (01-retro gstack invoke + 02-persist
11
- RETROSPECTIVE.md sink)。Triggered by harnessed CLI `harnessed retro --milestone <name>` or
12
- slash command `/retro` after `harnessed setup`.
4
+ Optional: retrospect over the work just finished and summarize the lessons and decisions
5
+ with gstack /retro, when a project or milestone ends.
13
6
  trigger_phrases:
14
7
  - "项目总结"
15
8
  - "里程碑结束"
@@ -60,16 +53,16 @@ evidence guard). harnessed gives you the spawn-ready prompt; YOU spawn the subag
60
53
 
61
54
  Do NOT pipe to `harnessed run retro` — that is the CI/headless path ({{ host.harnessed_run_warning_note.execution_tail }}
62
55
 
63
- 1. Bash: `harnessed prompt retro --task "$ARGUMENTS" --json` → parse `{prompt, max_iterations, model}`.
64
- 2. Spawn a {{ host.native }} subagent ({{ host.spawn_subagent }}) 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 retro --result-file <path>` — it is fail-closed on the declared artifacts, the TDD boundary, and the verbatim `<promise>COMPLETE</promise>`.
56
+ 1. Bash: `harnessed prompt retro --task "$ARGUMENTS" --json` → parse `{prompt, max_iterations, model, result_file}`.
57
+ 2. Spawn a {{ host.native }} subagent ({{ host.spawn_subagent }}) with that `prompt` and `model`. The sub writes its own final result into `result_file` — the path that prompt names — so the FILE is the completion signal: do NOT wait for the sub's chat message, because a background or re-parented agent's message may never arrive. Then drive delivery with harnessed's own completion gate:
58
+ - the gate is `harnessed checkpoint complete retro --result-file <result_file> --wait 60` — one call waits at most 60 seconds, so run the SAME command again when the sub needs longer; it is fail-closed on the declared artifacts, the TDD boundary, and the verbatim `<promise>COMPLETE</promise>`.
66
59
  - if it blocks, run `harnessed checkpoint fail retro --failing-tests <n>` to record the attempt; it prints BUDGET-EXHAUSTED / NO-PROGRESS / BREAK-LOOP when a stop condition is reached.
67
60
  - 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.
68
- 3. If the output contains `STATUS: NEEDS_CLARIFICATION` + a question list: STOP, relay them verbatim via {{ host.ask_user }}, append the answers to the spec, then re-spawn the same sub.
69
- 4. On `<promise>COMPLETE</promise>`: write the subagent’s final output to a file, then Bash `harnessed checkpoint complete retro --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.
61
+ 3. If the sub’s output contains `STATUS: NEEDS_CLARIFICATION` + a question list (read it from `result_file` — the chat message may never arrive): STOP, relay them verbatim via {{ host.ask_user }}, append the answers to the spec, then re-spawn the same sub.
62
+ 4. When `result_file` carries the completion marker: Bash `harnessed checkpoint complete retro --result-file <result_file> --wait 60 --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 file carries a verbatim `<promise>COMPLETE</promise>` (or a structured COMPLETE status). `--wait 60` bounds ONE call to 60 seconds — run the SAME command again when the sub needs longer, never an unbounded wait. `--result <text>` is the inline variant; `--result-file` wins and is quoting-safe on Windows. A `result-wait-timeout` exit means the sub has not signalled YET — repeat the same command; `--force` records an audited override (`evidence_status=overridden`) — it does not silently pass.
70
63
  5. If the complete gate blocked: Bash `harnessed checkpoint fail retro --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
64
 
72
- <!-- harnessed-generated:v4.12.0 -->
65
+ <!-- harnessed-generated:v4.13.0 -->
73
66
 
74
67
  ## References
75
68
 
@@ -1,15 +1,7 @@
1
1
  ---
2
2
  name: retro
3
3
  description: |
4
- 独立的 post-④ Verify 回顾工作流 — gstack /retro 经验教训 / 决策 / lessons
5
- 系统总结 (项目 / 里程碑结束可选, bundled milestone-close retrospective cadence)
6
- + planning-with-files RETROSPECTIVE.md 持久化 (sister Phase
7
- v2.0-2.5 RETROSPECTIVE pattern)。Capability ref retro-gstack alias suffix per Pattern A
8
- E.2 LOCK (NOT bare retro 避免 standalone workflow / capability namespace 冲突)。
9
- schema_version: harnessed.workflow.v3 with disciplines_applied (6 default) + tools_available
10
- (retro-gstack + planning-with-files) + 2 phase (01-retro gstack invoke + 02-persist
11
- RETROSPECTIVE.md sink)。Triggered by harnessed CLI `harnessed retro --milestone <name>` or
12
- slash command `/retro` after `harnessed setup`.
4
+ 可选:回顾刚完成的工作,用 gstack /retro 总结经验教训与决策,在项目或里程碑结束时。
13
5
  trigger_phrases:
14
6
  - "项目总结"
15
7
  - "里程碑结束"
@@ -59,16 +51,16 @@ freestyle 会旁路引擎(无 ledger、无 evidence guard)。harnessed 给你 sp
59
51
 
60
52
  **不要** pipe 到 `harnessed run retro` —— 那是 CI/headless 路径({{ host.harnessed_run_warning_note.execution_tail }}
61
53
 
62
- 1. Bash: `harnessed prompt retro --task "$ARGUMENTS" --json` → 解析 `{prompt, max_iterations, model}`。
63
- 2. 用 {{ host.native }} subagent({{ host.spawn_subagent.zh_tool }})以该 `prompt` + `model` spawn,然后用 harnessed 自己的完成闸门驱动交付:
64
- - subagent 返回后,把它的最终输出写入文件,跑 `harnessed checkpoint complete retro --result-file <path>` —— 该命令对声明的产物、TDD boundary、逐字 `<promise>COMPLETE</promise>` 三者 fail-closed。
54
+ 1. Bash: `harnessed prompt retro --task "$ARGUMENTS" --json` → 解析 `{prompt, max_iterations, model, result_file}`。
55
+ 2. 用 {{ host.native }} subagent({{ host.spawn_subagent.zh_tool }})以该 `prompt` + `model` spawn。sub 自己把最终结果写入 `result_file`(prompt 里给出的那个路径)—— **完成信号是文件**,不是聊天消息:后台 / 被 re-parent 的 agent 消息可能永不到达,不要等它。然后用 harnessed 自己的完成闸门驱动交付:
56
+ - 闸门是 `harnessed checkpoint complete retro --result-file <result_file> --wait 60` —— 单次调用最多等 60 秒,sub 需要更久就重复**同一条**命令;它对声明的产物、TDD boundary、逐字 `<promise>COMPLETE</promise>` 三者 fail-closed。
65
57
  - 若被拦下,跑 `harnessed checkpoint fail retro --failing-tests <n>` 记录本次尝试;命中停机条件时它会打印 BUDGET-EXHAUSTED / NO-PROGRESS / BREAK-LOOP。
66
58
  - **仅当**这三者都未触发时才允许重 spawn。任一触发即停:重新收敛子任务范围、修掉阻塞点,或上报用户。绝不越过停机指令继续重 spawn。
67
- 3. 若输出含 `STATUS: NEEDS_CLARIFICATION` + 问题列表:STOP,用 {{ host.ask_user }} 原样转达,把答案 append 进 spec,再重 spawn。
68
- 4. 命中 `<promise>COMPLETE</promise>`:把 subagent 最终输出写入文件,再 Bash `harnessed checkpoint complete retro --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`),不是静默放行。
59
+ 3. 若 sub 的输出含 `STATUS: NEEDS_CLARIFICATION` + 问题列表(从 `result_file` 读 —— 聊天消息可能永不到达):STOP,用 {{ host.ask_user }} 原样转达,把答案 append 进 spec,再重 spawn。
60
+ 4. 当 `result_file` 携带完成标记时:Bash `harnessed checkpoint complete retro --result-file <result_file> --wait 60 --summary "<one-line>"`。fail-CLOSED —— 除非声明的 `artifacts_expected` 文件全部存在、TDD boundary 通过(证据非空 / 红绿两侧齐全 / 测试文件未被删除)、且结果文件含逐字 `<promise>COMPLETE</promise>`(或结构化 COMPLETE 状态),否则拦下。`--wait 60` 只约束**单次**调用为 60 秒 —— sub 需要更久就重复**同一条**命令,绝不无限等待。`--result <text>` 是内联变体;`--result-file` 优先且在 Windows 上引号安全。`result-wait-timeout` 退出码表示 sub 尚未发出完成信号 —— 重复同一条命令;`--force` 记录可审计的覆盖(`evidence_status=overridden`),不是静默放行。
69
61
  5. 若 complete 闸门拦下:Bash `harnessed checkpoint fail retro --failing-tests <n>` 记录本次尝试。命中停机条件时会打印 `BUDGET-EXHAUSTED` / `NO-PROGRESS` / `BREAK-LOOP`。**仅当**三者都未触发时才允许重 spawn;任一触发即 STOP —— 重新收敛子任务范围、修掉阻塞点,或上报用户。
70
62
 
71
- <!-- harnessed-generated:v4.12.0 -->
63
+ <!-- harnessed-generated:v4.13.0 -->
72
64
 
73
65
  ## 参考文档
74
66
 
@@ -1,13 +1,7 @@
1
1
  ---
2
2
  name: ship
3
3
  description: |
4
- Stage ⑤ Ship master orchestrator — the release stage after Verify. ship-preflight
5
- 必跑串行 (release-readiness gate) → 委派 PR/deploy 给 gstack /ship → publish 留
6
- publish.yml CI (tag push 触发)。schema_version: harnessed.workflow.v3 with delegates_to
7
- (1 sub: preflight serial order 1) + disciplines_applied (6 default) + tools_available
8
- (release-preflight + ship + planning-with-files)。Triggered by `/ship` (bare per ADR 0030)
9
- or headless CLI `harnessed run ship` after `harnessed run verify`. Deploy boundary =
10
- TAG-READY (no push/publish/tag).
4
+ Run the release stage after verification: check release readiness, then hand the PR and deploy to gstack /ship; the tag push triggers the publish CI. Use it when the work is verified and ready to ship.
11
5
  trigger_phrases:
12
6
  - "ship"
13
7
  - "发布阶段"
@@ -63,22 +57,22 @@ Do NOT pipe to `harnessed run ship` — that is the CI/headless path ({{ host.ha
63
57
 
64
58
  1. If the clarification criteria fire for "$ARGUMENTS" (≥2 approaches / core algorithm / API contract / high error cost), clarify interactively in THIS session first ({{ host.ask_user }}) and lock decisions; otherwise transparent-skip. Produce a locked spec.
65
59
  1b. Bash: `harnessed facts ship --out .harnessed-facts.json` → it lists ONLY the facts this stage’s gates actually read: deterministic ones already filled (change size / files touched / stage, from git), judgement calls left `null` with a one-line hint of what to judge. Edit the file and replace each `null` in `facts` with your honest answer from the locked spec — leave one null only if you genuinely cannot judge it (it then falls back to the built-in default). Do NOT skip this step and do NOT invent facts the command did not ask for.
66
- 2. Bash: `harnessed gates ship --task "<locked spec>" --context-file .harnessed-facts.json --skip-sub discuss` → parse the JSON `{fire, skip, parallelism}`. This is the plan SoT (no spawn). Keep the verbatim JSON.
60
+ 2. Bash: `harnessed gates ship --task "<locked spec>" --context-file .harnessed-facts.json --skip-sub discuss` → parse the JSON `{fire: [{sub, order, mode, is_master}], skip: [{sub, reason}], parallelism: {escalate_to_teams, teams_active, transport, result_contract, bounded_wait}}`. `escalate_to_teams: false` means the run cannot form a team — drive the fired subs as a plain subagent fan-out (parallel where `order` allows) instead. `teams_active` says whether a team is actually running, `transport` names the transport this plan uses, `result_contract` is `result-file` and `bounded_wait` is `true`: every sub signals completion through its result file, never through a chat message. This is the plan SoT (no spawn). Keep the verbatim JSON.
67
61
  3. Bash: `harnessed checkpoint start ship --plan '<the verbatim gates JSON from step 2>'` → seeds the per-sub ledger so `harnessed status --recover` can re-orient you after compaction.
68
62
  {{ host.teams_step_note.skill }}
69
63
  5. Otherwise, for each fired sub in `order` (serial subs sequentially, parallel subs concurrently):
70
64
  - **If the entry has `is_master: true`** (a stage master — e.g. `/auto` firing `plan`/`task`/`verify`): do NOT prompt+spawn it. RECURSE: run that master’s own `harnessed facts <sub> --out .harnessed-facts.json` (fill the nulls) → `harnessed gates <sub> --task "<spec>" --context-file .harnessed-facts.json --skip-sub discuss` → `harnessed checkpoint start <sub> --plan '<json>'` → repeat this loop for ITS fired subs.
71
65
  - **Else (leaf sub):**
72
- a. Bash: `harnessed prompt <sub> --task "<spec>" --json` → parse `{prompt, max_iterations, model}`.
73
- b. Spawn a {{ host.native }} subagent ({{ host.spawn_subagent }}) with that `prompt` and `model`, then drive delivery with harnessed's own completion gate:
74
- - on return, write the subagent's final output to a file and run `harnessed checkpoint complete <sub> --result-file <path>` — it is fail-closed on the declared artifacts, the TDD boundary, and the verbatim `<promise>COMPLETE</promise>`.
66
+ a. Bash: `harnessed prompt <sub> --task "<spec>" --json` → parse `{prompt, max_iterations, model, result_file}`.
67
+ b. Spawn a {{ host.native }} subagent ({{ host.spawn_subagent }}) with that `prompt` and `model`. The sub writes its own final result into `result_file` — the path that prompt names — so the FILE is the completion signal: do NOT wait for the sub's chat message, because a background or re-parented agent's message may never arrive. Then drive delivery with harnessed's own completion gate:
68
+ - the gate is `harnessed checkpoint complete <sub> --result-file <result_file> --wait 60` — one call waits at most 60 seconds, so run the SAME command again when the sub needs longer; it is fail-closed on the declared artifacts, the TDD boundary, and the verbatim `<promise>COMPLETE</promise>`.
75
69
  - if it blocks, run `harnessed checkpoint fail <sub> --failing-tests <n>` to record the attempt; it prints BUDGET-EXHAUSTED / NO-PROGRESS / BREAK-LOOP when a stop condition is reached.
76
70
  - 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.
77
- c. If the output contains `STATUS: NEEDS_CLARIFICATION` + questions: STOP, relay them verbatim via {{ host.ask_user }}, append the answers to the spec, then re-spawn the same sub.
78
- d. On `<promise>COMPLETE</promise>`: write the subagent’s final output to a file, then Bash `harnessed checkpoint complete <sub> --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. On a non-zero exit the sub is NOT done — re-spawn to close the gap, or pass `--force` only to deliberately override (records `evidence_status=overridden`, an audited override rather than a silent pass).
71
+ c. If the sub’s output contains `STATUS: NEEDS_CLARIFICATION` + questions (read it from `result_file` — the chat message may never arrive): STOP, relay them verbatim via {{ host.ask_user }}, append the answers to the spec, then re-spawn the same sub.
72
+ d. When `result_file` carries the completion marker: Bash `harnessed checkpoint complete <sub> --result-file <result_file> --wait 60 --summary "<one-line>"`. The evidence guard runs here (fail-CLOSED) and 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 file carries a verbatim `<promise>COMPLETE</promise>` (or a structured COMPLETE status). `--wait 60` bounds ONE call to 60 seconds — run the SAME command again when the sub needs longer, never an unbounded wait. `--result <text>` is the inline variant; `--result-file` wins and is quoting-safe on Windows. A `result-wait-timeout` exit means the sub has not signalled YET — repeat the same command; on any other non-zero exit the sub is NOT done — re-spawn to close the gap, or pass `--force` only to deliberately override (records `evidence_status=overridden`, an audited override rather than a silent pass).
79
73
  e. If the complete gate blocked: Bash `harnessed checkpoint fail <sub> --failing-tests <n>` to record the attempt (omit the flag when the sub has no tests — the evidence-artifact digest is the fallback progress metric). It prints `BUDGET-EXHAUSTED` (attempts spent vs `workflows/defaults.yaml ralph_max_iterations`), `NO-PROGRESS` (no improvement for N consecutive attempts) or `BREAK-LOOP` (this sub failed >= the threshold) once a stop condition is reached. Respawn ONLY while none of those three has fired; any one of them means STOP — re-scope, fix the blocker, or escalate to the user, and report it.
80
74
  6. After all fired subs are `done` (or recorded `failed`), Bash `harnessed status --recover` to confirm the ledger and report a per-sub fired/skipped/done/failed summary to the user.
81
75
 
82
76
  **If you lose context (compaction / resume):** run `harnessed status --recover` first — it reads the ledger and prints "you are here, this is next" so you resume at the first `pending` sub instead of restarting. If the ledger is empty, re-run steps 2-3.
83
77
 
84
- <!-- harnessed-generated:v4.12.0 -->
78
+ <!-- harnessed-generated:v4.13.0 -->
@@ -1,13 +1,7 @@
1
1
  ---
2
2
  name: ship
3
3
  description: |
4
- Stage ⑤ Ship 主控编排器 — Verify 之后的发布阶段。ship-preflight
5
- 必跑串行(release-readiness 关卡)→ 委派 PR/deploy 给 gstack /ship → publish 留
6
- publish.yml CI(tag push 触发)。schema_version: harnessed.workflow.v3 with delegates_to
7
- (1 sub: preflight serial order 1) + disciplines_applied (6 default) + tools_available
8
- (release-preflight + ship + planning-with-files)。Triggered by `/ship` (bare per ADR 0030)
9
- or headless CLI `harnessed run ship` after `harnessed run verify`. Deploy boundary =
10
- TAG-READY (no push/publish/tag).
4
+ 跑 Verify 后的发布阶段:先过发布就绪关卡,再把 PR 与部署交给 gstack /ship。准备上线时用它。
11
5
  trigger_phrases:
12
6
  - "ship"
13
7
  - "发布阶段"
@@ -61,22 +55,22 @@ preflight 通过后,主控将 PR + deploy 委派给 gstack `/ship`(组合复
61
55
 
62
56
  1. 若 "$ARGUMENTS" 触发澄清判据(≥2 方案 / 核心算法 / API contract / 高错误成本),先在**本 session** 交互澄清({{ host.ask_user }})并锁决策;否则透明 skip。产出 locked spec。
63
57
  1b. Bash: `harnessed facts ship --out .harnessed-facts.json` → 它只列出**本阶段 gate 真正读取**的 fact:能确定性推导的已填好(改动行数 / 触及文件数 / stage,来自 git),判断题留 `null` 并附一行说明。编辑该文件,把 `facts` 里每个 `null` 按 locked spec 换成你的真实判断 —— 只有确实无法判断时才留 null(此时回退内置默认值)。**不要**跳过本步,也**不要**自行编造命令没问的 fact。
64
- 2. Bash: `harnessed gates ship --task "<locked spec>" --context-file .harnessed-facts.json --skip-sub discuss` → 解析 JSON `{fire, skip, parallelism}`。这是 plan SoT(不 spawn)。保留 verbatim JSON。
58
+ 2. Bash: `harnessed gates ship --task "<locked spec>" --context-file .harnessed-facts.json --skip-sub discuss` → 解析 JSON `{fire: [{sub, order, mode, is_master}], skip: [{sub, reason}], parallelism: {escalate_to_teams, teams_active, transport, result_contract, bounded_wait}}`。`escalate_to_teams: false` 表示本次运行成不了团 —— 按 subagent fan-out 驱动 fired subs(`order` 允许处并发),不要成团。`teams_active` 说明此刻是否真的有团在跑,`transport` 给出本 plan 使用的传输,`result_contract` 是 `result-file`、`bounded_wait` 是 `true`:每个 sub 的完成信号是结果文件,不是聊天消息。这是 plan SoT(不 spawn)。保留 verbatim JSON。
65
59
  3. Bash: `harnessed checkpoint start ship --plan '<step 2 的 verbatim gates JSON>'` → seed per-sub ledger,让 `harnessed status --recover` 能在 compaction 后给你重新定位。
66
60
  {{ host.teams_step_note.skill }}
67
61
  5. 否则,对 `order` 里每个 fired sub(serial 串行、parallel 并发):
68
62
  - **若该项 `is_master: true`**(本身是 stage master —— 如 `/auto` fire `plan`/`task`/`verify`):**不要**直接 prompt+spawn。RECURSE:跑该 master 自己的 `harnessed facts <sub> --out .harnessed-facts.json`(填完 null)→ `harnessed gates <sub> --task "<spec>" --context-file .harnessed-facts.json --skip-sub discuss` → `harnessed checkpoint start <sub> --plan '<json>'` → 对它的 fired subs 重复本循环。
69
63
  - **否则(leaf sub):**
70
- a. Bash: `harnessed prompt <sub> --task "<spec>" --json` → 解析 `{prompt, max_iterations, model}`。
71
- b. 用 {{ host.native }} subagent({{ host.spawn_subagent.zh_tool }})以该 `prompt` + `model` spawn,然后用 harnessed 自己的完成闸门驱动交付:
72
- - subagent 返回后,把它的最终输出写入文件,跑 `harnessed checkpoint complete <sub> --result-file <path>` —— 该命令对声明的产物、TDD boundary、逐字 `<promise>COMPLETE</promise>` 三者 fail-closed。
64
+ a. Bash: `harnessed prompt <sub> --task "<spec>" --json` → 解析 `{prompt, max_iterations, model, result_file}`。
65
+ b. 用 {{ host.native }} subagent({{ host.spawn_subagent.zh_tool }})以该 `prompt` + `model` spawn。sub 自己把最终结果写入 `result_file`(prompt 里给出的那个路径)—— **完成信号是文件**,不是聊天消息:后台 / 被 re-parent 的 agent 消息可能永不到达,不要等它。然后用 harnessed 自己的完成闸门驱动交付:
66
+ - 闸门是 `harnessed checkpoint complete <sub> --result-file <result_file> --wait 60` —— 单次调用最多等 60 秒,sub 需要更久就重复**同一条**命令;它对声明的产物、TDD boundary、逐字 `<promise>COMPLETE</promise>` 三者 fail-closed。
73
67
  - 若被拦下,跑 `harnessed checkpoint fail <sub> --failing-tests <n>` 记录本次尝试;命中停机条件时它会打印 BUDGET-EXHAUSTED / NO-PROGRESS / BREAK-LOOP。
74
68
  - **仅当**这三者都未触发时才允许重 spawn。任一触发即停:重新收敛子任务范围、修掉阻塞点,或上报用户。绝不越过停机指令继续重 spawn。
75
- c. 若输出含 `STATUS: NEEDS_CLARIFICATION` + 问题列表:STOP,用 {{ host.ask_user }} 原样转达,把答案 append 进 spec,再重 spawn 同一 sub。
76
- d. 命中 `<promise>COMPLETE</promise>`:把 subagent 最终输出写入文件,再 Bash `harnessed checkpoint complete <sub> --result-file <path> --summary "<one-line>"`。fail-CLOSED —— 除非声明的 `artifacts_expected` 文件全部存在、TDD boundary 通过(证据非空 / 红绿两侧齐全 / 测试文件未被删除)、且结果含逐字 `<promise>COMPLETE</promise>`(或结构化 COMPLETE 状态),否则拦下。`--result <text>` 是内联变体;`--result-file` 优先且在 Windows 上引号安全。exit 非零即表示该 sub **未** done —— 重 spawn 补齐,或仅在刻意覆盖时传 `--force`(记录 `evidence_status=overridden`,是可审计的覆盖而非静默放行)。
69
+ c. 若 sub 的输出含 `STATUS: NEEDS_CLARIFICATION` + 问题列表(从 `result_file` 读 —— 聊天消息可能永不到达):STOP,用 {{ host.ask_user }} 原样转达,把答案 append 进 spec,再重 spawn 同一 sub。
70
+ d. 当 `result_file` 携带完成标记时:Bash `harnessed checkpoint complete <sub> --result-file <result_file> --wait 60 --summary "<one-line>"`。fail-CLOSED —— 除非声明的 `artifacts_expected` 文件全部存在、TDD boundary 通过(证据非空 / 红绿两侧齐全 / 测试文件未被删除)、且结果文件含逐字 `<promise>COMPLETE</promise>`(或结构化 COMPLETE 状态),否则拦下。`--wait 60` 只约束**单次**调用为 60 秒 —— sub 需要更久就重复**同一条**命令,绝不无限等待。`--result <text>` 是内联变体;`--result-file` 优先且在 Windows 上引号安全。`result-wait-timeout` 退出码表示 sub 尚未发出完成信号 —— 重复同一条命令;其它非零退出码即表示该 sub **未** done —— 重 spawn 补齐,或仅在刻意覆盖时传 `--force`(记录 `evidence_status=overridden`,是可审计的覆盖而非静默放行)。
77
71
  e. 若 complete 闸门拦下:Bash `harnessed checkpoint fail <sub> --failing-tests <n>` 记录本次尝试(该 sub 无测试时省略该 flag —— 回退用证据产物摘要作进展度量)。命中停机条件时它会打印 `BUDGET-EXHAUSTED`(已用尝试次数 vs `workflows/defaults.yaml ralph_max_iterations`)、`NO-PROGRESS`(连续 N 次无进展)或 `BREAK-LOOP`(该 sub 失败次数达阈值)。**仅当**三者都未触发时才允许重 spawn;任一触发即 STOP —— 重新收敛范围、修掉阻塞点或上报用户,并说明情况。
78
72
  6. 所有 fired subs `done`(或记录 `failed`)后,Bash `harnessed status --recover` 确认 ledger,并向用户报告 per-sub fired/skipped/done/failed 摘要。
79
73
 
80
74
  **若丢失上下文(compaction / resume):** 先跑 `harnessed status --recover` —— 它读 ledger 并打印「你在这里,下一步是什么」,让你从第一个 `pending` sub 续跑而非重启。若 ledger 为空,重跑 step 2-3。
81
75
 
82
- <!-- harnessed-generated:v4.12.0 -->
76
+ <!-- harnessed-generated:v4.13.0 -->
@@ -1,9 +1,7 @@
1
1
  ---
2
2
  name: ship-preflight
3
3
  description: |
4
- Stage ⑤.a Ship sub — release-preflight gate. Runs `harnessed release-preflight`
5
- (read-only: CHANGELOG [Unreleased] non-empty + version + git-clean + tag-absent).
6
- A failing gate blocks shipping. Nothing is pushed/published/tagged here.
4
+ Check that the repo is ready to tag a release: the changelog has unreleased entries, the version resolves, the tree is clean, and the tag does not exist yet. Run it before shipping; a failed check blocks the release.
7
5
  trigger_phrases:
8
6
  - "release preflight"
9
7
  - "release ready"
@@ -64,13 +62,13 @@ evidence guard). harnessed gives you the spawn-ready prompt; YOU spawn the subag
64
62
 
65
63
  Do NOT pipe to `harnessed run ship-preflight` — that is the CI/headless path ({{ host.harnessed_run_warning_note.execution_tail }}
66
64
 
67
- 1. Bash: `harnessed prompt ship-preflight --task "$ARGUMENTS" --json` → parse `{prompt, max_iterations, model}`.
68
- 2. Spawn a {{ host.native }} subagent ({{ host.spawn_subagent }}) 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 ship-preflight --result-file <path>` — it is fail-closed on the declared artifacts, the TDD boundary, and the verbatim `<promise>COMPLETE</promise>`.
65
+ 1. Bash: `harnessed prompt ship-preflight --task "$ARGUMENTS" --json` → parse `{prompt, max_iterations, model, result_file}`.
66
+ 2. Spawn a {{ host.native }} subagent ({{ host.spawn_subagent }}) with that `prompt` and `model`. The sub writes its own final result into `result_file` — the path that prompt names — so the FILE is the completion signal: do NOT wait for the sub's chat message, because a background or re-parented agent's message may never arrive. Then drive delivery with harnessed's own completion gate:
67
+ - the gate is `harnessed checkpoint complete ship-preflight --result-file <result_file> --wait 60` — one call waits at most 60 seconds, so run the SAME command again when the sub needs longer; it is fail-closed on the declared artifacts, the TDD boundary, and the verbatim `<promise>COMPLETE</promise>`.
70
68
  - if it blocks, run `harnessed checkpoint fail ship-preflight --failing-tests <n>` to record the attempt; it prints BUDGET-EXHAUSTED / NO-PROGRESS / BREAK-LOOP when a stop condition is reached.
71
69
  - 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.
72
- 3. If the output contains `STATUS: NEEDS_CLARIFICATION` + a question list: STOP, relay them verbatim via {{ host.ask_user }}, append the answers to the spec, then re-spawn the same sub.
73
- 4. On `<promise>COMPLETE</promise>`: write the subagent’s final output to a file, then Bash `harnessed checkpoint complete ship-preflight --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
+ 3. If the sub’s output contains `STATUS: NEEDS_CLARIFICATION` + a question list (read it from `result_file` — the chat message may never arrive): STOP, relay them verbatim via {{ host.ask_user }}, append the answers to the spec, then re-spawn the same sub.
71
+ 4. When `result_file` carries the completion marker: Bash `harnessed checkpoint complete ship-preflight --result-file <result_file> --wait 60 --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 file carries a verbatim `<promise>COMPLETE</promise>` (or a structured COMPLETE status). `--wait 60` bounds ONE call to 60 seconds — run the SAME command again when the sub needs longer, never an unbounded wait. `--result <text>` is the inline variant; `--result-file` wins and is quoting-safe on Windows. A `result-wait-timeout` exit means the sub has not signalled YET — repeat the same command; `--force` records an audited override (`evidence_status=overridden`) — it does not silently pass.
74
72
  5. If the complete gate blocked: Bash `harnessed checkpoint fail ship-preflight --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.
75
73
 
76
- <!-- harnessed-generated:v4.12.0 -->
74
+ <!-- harnessed-generated:v4.13.0 -->
@@ -1,9 +1,7 @@
1
1
  ---
2
2
  name: ship-preflight
3
3
  description: |
4
- Stage ⑤.a Ship 子工作流 — 发布前置门控。运行 `harnessed release-preflight`
5
- (只读检查:CHANGELOG [Unreleased] 非空 + 版本号 + git 工作区干净 + tag 不存在)。
6
- 任一检查失败则阻断发布流程。此处不会推送/发布/打 tag。
4
+ 发布前置门控:CHANGELOG 有未发布条目、版本号可解析、工作区干净、tag 不存在。发布前跑它,失败就阻断发布。
7
5
  trigger_phrases:
8
6
  - "release preflight"
9
7
  - "release ready"
@@ -59,13 +57,13 @@ freestyle 会旁路引擎(无 ledger、无 evidence guard)。harnessed 给你 sp
59
57
 
60
58
  **不要** pipe 到 `harnessed run ship-preflight` —— 那是 CI/headless 路径({{ host.harnessed_run_warning_note.execution_tail }}
61
59
 
62
- 1. Bash: `harnessed prompt ship-preflight --task "$ARGUMENTS" --json` → 解析 `{prompt, max_iterations, model}`。
63
- 2. 用 {{ host.native }} subagent({{ host.spawn_subagent.zh_tool }})以该 `prompt` + `model` spawn,然后用 harnessed 自己的完成闸门驱动交付:
64
- - subagent 返回后,把它的最终输出写入文件,跑 `harnessed checkpoint complete ship-preflight --result-file <path>` —— 该命令对声明的产物、TDD boundary、逐字 `<promise>COMPLETE</promise>` 三者 fail-closed。
60
+ 1. Bash: `harnessed prompt ship-preflight --task "$ARGUMENTS" --json` → 解析 `{prompt, max_iterations, model, result_file}`。
61
+ 2. 用 {{ host.native }} subagent({{ host.spawn_subagent.zh_tool }})以该 `prompt` + `model` spawn。sub 自己把最终结果写入 `result_file`(prompt 里给出的那个路径)—— **完成信号是文件**,不是聊天消息:后台 / 被 re-parent 的 agent 消息可能永不到达,不要等它。然后用 harnessed 自己的完成闸门驱动交付:
62
+ - 闸门是 `harnessed checkpoint complete ship-preflight --result-file <result_file> --wait 60` —— 单次调用最多等 60 秒,sub 需要更久就重复**同一条**命令;它对声明的产物、TDD boundary、逐字 `<promise>COMPLETE</promise>` 三者 fail-closed。
65
63
  - 若被拦下,跑 `harnessed checkpoint fail ship-preflight --failing-tests <n>` 记录本次尝试;命中停机条件时它会打印 BUDGET-EXHAUSTED / NO-PROGRESS / BREAK-LOOP。
66
64
  - **仅当**这三者都未触发时才允许重 spawn。任一触发即停:重新收敛子任务范围、修掉阻塞点,或上报用户。绝不越过停机指令继续重 spawn。
67
- 3. 若输出含 `STATUS: NEEDS_CLARIFICATION` + 问题列表:STOP,用 {{ host.ask_user }} 原样转达,把答案 append 进 spec,再重 spawn。
68
- 4. 命中 `<promise>COMPLETE</promise>`:把 subagent 最终输出写入文件,再 Bash `harnessed checkpoint complete ship-preflight --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
+ 3. 若 sub 的输出含 `STATUS: NEEDS_CLARIFICATION` + 问题列表(从 `result_file` 读 —— 聊天消息可能永不到达):STOP,用 {{ host.ask_user }} 原样转达,把答案 append 进 spec,再重 spawn。
66
+ 4. 当 `result_file` 携带完成标记时:Bash `harnessed checkpoint complete ship-preflight --result-file <result_file> --wait 60 --summary "<one-line>"`。fail-CLOSED —— 除非声明的 `artifacts_expected` 文件全部存在、TDD boundary 通过(证据非空 / 红绿两侧齐全 / 测试文件未被删除)、且结果文件含逐字 `<promise>COMPLETE</promise>`(或结构化 COMPLETE 状态),否则拦下。`--wait 60` 只约束**单次**调用为 60 秒 —— sub 需要更久就重复**同一条**命令,绝不无限等待。`--result <text>` 是内联变体;`--result-file` 优先且在 Windows 上引号安全。`result-wait-timeout` 退出码表示 sub 尚未发出完成信号 —— 重复同一条命令;`--force` 记录可审计的覆盖(`evidence_status=overridden`),不是静默放行。
69
67
  5. 若 complete 闸门拦下:Bash `harnessed checkpoint fail ship-preflight --failing-tests <n>` 记录本次尝试。命中停机条件时会打印 `BUDGET-EXHAUSTED` / `NO-PROGRESS` / `BREAK-LOOP`。**仅当**三者都未触发时才允许重 spawn;任一触发即 STOP —— 重新收敛子任务范围、修掉阻塞点,或上报用户。
70
68
 
71
- <!-- harnessed-generated:v4.12.0 -->
69
+ <!-- harnessed-generated:v4.13.0 -->
@@ -1,14 +1,7 @@
1
1
  ---
2
2
  name: task
3
3
  description: |
4
- Stage ③ Task master orchestrator — 串行 invoke 4 sub per subtask (clarify → code → test → deliver)。
5
- completion gate (harnessed 自有 checkpoint CLI) 在 deliver phase 内 (D-10 orthogonal wrapper)。tdd-gate conditional
6
- fire on test sub。schema_version: harnessed.workflow.v3 with delegates_to (4 sub: clarify order 1
7
- conditional + code order 2 + test order 3 conditional + deliver order 4) + disciplines_applied
8
- (6 default) + tools_available (8 entry: superpowers-brainstorming + tdd + grill-with-docs +
9
- improve-codebase-architecture + diagnose + completion-gate + planning-with-files)。
10
- Triggered by slash command `/task`
11
- (bare per ADR 0030 namespace policy D-02 LOCK) after `harnessed setup`.
4
+ Run one subtask end to end: clarify the approach, write the code, test it, then deliver it behind a completion gate. Use it at the start of every subtask you implement.
12
5
  trigger_phrases:
13
6
  - "task"
14
7
  - "子任务执行"
@@ -78,25 +71,25 @@ Do NOT pipe to `harnessed run task` — that is the CI/headless path ({{ host.ha
78
71
 
79
72
  1. If the clarification criteria fire for "$ARGUMENTS" (≥2 approaches / core algorithm / API contract / high error cost), clarify interactively in THIS session first ({{ host.ask_user }}) and lock decisions; otherwise transparent-skip. Produce a locked spec.
80
73
  1b. Bash: `harnessed facts task --out .harnessed-facts.json` → it lists ONLY the facts this stage’s gates actually read: deterministic ones already filled (change size / files touched / stage, from git), judgement calls left `null` with a one-line hint of what to judge. Edit the file and replace each `null` in `facts` with your honest answer from the locked spec — leave one null only if you genuinely cannot judge it (it then falls back to the built-in default). Do NOT skip this step and do NOT invent facts the command did not ask for.
81
- 2. Bash: `harnessed gates task --task "<locked spec>" --context-file .harnessed-facts.json --skip-sub discuss` → parse the JSON `{fire, skip, parallelism}`. This is the plan SoT (no spawn). Keep the verbatim JSON.
74
+ 2. Bash: `harnessed gates task --task "<locked spec>" --context-file .harnessed-facts.json --skip-sub discuss` → parse the JSON `{fire: [{sub, order, mode, is_master}], skip: [{sub, reason}], parallelism: {escalate_to_teams, teams_active, transport, result_contract, bounded_wait}}`. `escalate_to_teams: false` means the run cannot form a team — drive the fired subs as a plain subagent fan-out (parallel where `order` allows) instead. `teams_active` says whether a team is actually running, `transport` names the transport this plan uses, `result_contract` is `result-file` and `bounded_wait` is `true`: every sub signals completion through its result file, never through a chat message. This is the plan SoT (no spawn). Keep the verbatim JSON.
82
75
  3. Bash: `harnessed checkpoint start task --plan '<the verbatim gates JSON from step 2>'` → seeds the per-sub ledger so `harnessed status --recover` can re-orient you after compaction.
83
76
  {{ host.teams_step_note.skill }}
84
77
  5. Otherwise, for each fired sub in `order` (serial subs sequentially, parallel subs concurrently):
85
78
  - **If the entry has `is_master: true`** (a stage master — e.g. `/auto` firing `plan`/`task`/`verify`): do NOT prompt+spawn it. RECURSE: run that master’s own `harnessed facts <sub> --out .harnessed-facts.json` (fill the nulls) → `harnessed gates <sub> --task "<spec>" --context-file .harnessed-facts.json --skip-sub discuss` → `harnessed checkpoint start <sub> --plan '<json>'` → repeat this loop for ITS fired subs.
86
79
  - **Else (leaf sub):**
87
- a. Bash: `harnessed prompt <sub> --task "<spec>" --json` → parse `{prompt, max_iterations, model}`.
88
- b. Spawn a {{ host.native }} subagent ({{ host.spawn_subagent }}) with that `prompt` and `model`, then drive delivery with harnessed's own completion gate:
89
- - on return, write the subagent's final output to a file and run `harnessed checkpoint complete <sub> --result-file <path>` — it is fail-closed on the declared artifacts, the TDD boundary, and the verbatim `<promise>COMPLETE</promise>`.
80
+ a. Bash: `harnessed prompt <sub> --task "<spec>" --json` → parse `{prompt, max_iterations, model, result_file}`.
81
+ b. Spawn a {{ host.native }} subagent ({{ host.spawn_subagent }}) with that `prompt` and `model`. The sub writes its own final result into `result_file` — the path that prompt names — so the FILE is the completion signal: do NOT wait for the sub's chat message, because a background or re-parented agent's message may never arrive. Then drive delivery with harnessed's own completion gate:
82
+ - the gate is `harnessed checkpoint complete <sub> --result-file <result_file> --wait 60` — one call waits at most 60 seconds, so run the SAME command again when the sub needs longer; it is fail-closed on the declared artifacts, the TDD boundary, and the verbatim `<promise>COMPLETE</promise>`.
90
83
  - if it blocks, run `harnessed checkpoint fail <sub> --failing-tests <n>` to record the attempt; it prints BUDGET-EXHAUSTED / NO-PROGRESS / BREAK-LOOP when a stop condition is reached.
91
84
  - 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.
92
- c. If the output contains `STATUS: NEEDS_CLARIFICATION` + questions: STOP, relay them verbatim via {{ host.ask_user }}, append the answers to the spec, then re-spawn the same sub.
93
- d. On `<promise>COMPLETE</promise>`: write the subagent’s final output to a file, then Bash `harnessed checkpoint complete <sub> --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. On a non-zero exit the sub is NOT done — re-spawn to close the gap, or pass `--force` only to deliberately override (records `evidence_status=overridden`, an audited override rather than a silent pass).
85
+ c. If the sub’s output contains `STATUS: NEEDS_CLARIFICATION` + questions (read it from `result_file` — the chat message may never arrive): STOP, relay them verbatim via {{ host.ask_user }}, append the answers to the spec, then re-spawn the same sub.
86
+ d. When `result_file` carries the completion marker: Bash `harnessed checkpoint complete <sub> --result-file <result_file> --wait 60 --summary "<one-line>"`. The evidence guard runs here (fail-CLOSED) and 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 file carries a verbatim `<promise>COMPLETE</promise>` (or a structured COMPLETE status). `--wait 60` bounds ONE call to 60 seconds — run the SAME command again when the sub needs longer, never an unbounded wait. `--result <text>` is the inline variant; `--result-file` wins and is quoting-safe on Windows. A `result-wait-timeout` exit means the sub has not signalled YET — repeat the same command; on any other non-zero exit the sub is NOT done — re-spawn to close the gap, or pass `--force` only to deliberately override (records `evidence_status=overridden`, an audited override rather than a silent pass).
94
87
  e. If the complete gate blocked: Bash `harnessed checkpoint fail <sub> --failing-tests <n>` to record the attempt (omit the flag when the sub has no tests — the evidence-artifact digest is the fallback progress metric). It prints `BUDGET-EXHAUSTED` (attempts spent vs `workflows/defaults.yaml ralph_max_iterations`), `NO-PROGRESS` (no improvement for N consecutive attempts) or `BREAK-LOOP` (this sub failed >= the threshold) once a stop condition is reached. Respawn ONLY while none of those three has fired; any one of them means STOP — re-scope, fix the blocker, or escalate to the user, and report it.
95
88
  6. After all fired subs are `done` (or recorded `failed`), Bash `harnessed status --recover` to confirm the ledger and report a per-sub fired/skipped/done/failed summary to the user.
96
89
 
97
90
  **If you lose context (compaction / resume):** run `harnessed status --recover` first — it reads the ledger and prints "you are here, this is next" so you resume at the first `pending` sub instead of restarting. If the ledger is empty, re-run steps 2-3.
98
91
 
99
- <!-- harnessed-generated:v4.12.0 -->
92
+ <!-- harnessed-generated:v4.13.0 -->
100
93
 
101
94
  ## References
102
95
 
@@ -1,14 +1,7 @@
1
1
  ---
2
2
  name: task
3
3
  description: |
4
- Stage ③ Task 主控编排器 — 串行 invoke 4 sub per subtask (clarify → code → test → deliver)。
5
- completion gate (harnessed 自有 checkpoint CLI) 在 deliver phase 内 (D-10 orthogonal wrapper)。tdd-gate conditional
6
- fire on test sub。schema_version: harnessed.workflow.v3 with delegates_to (4 sub: clarify order 1
7
- conditional + code order 2 + test order 3 conditional + deliver order 4) + disciplines_applied
8
- (6 default) + tools_available (8 entry: superpowers-brainstorming + tdd + grill-with-docs +
9
- improve-codebase-architecture + diagnose + completion-gate + planning-with-files)。
10
- Triggered by slash command `/task`
11
- (bare per ADR 0030 namespace policy D-02 LOCK) after `harnessed setup`.
4
+ 跑完一个子任务:先澄清方案,再编码、测试,最后通过完成闸门交付。每个子任务开始时用它。
12
5
  trigger_phrases:
13
6
  - "task"
14
7
  - "子任务执行"
@@ -77,25 +70,25 @@ Sister `workflows/capabilities.yaml`:
77
70
 
78
71
  1. 若 "$ARGUMENTS" 触发澄清判据(≥2 方案 / 核心算法 / API contract / 高错误成本),先在**本 session** 交互澄清({{ host.ask_user }})并锁决策;否则透明 skip。产出 locked spec。
79
72
  1b. Bash: `harnessed facts task --out .harnessed-facts.json` → 它只列出**本阶段 gate 真正读取**的 fact:能确定性推导的已填好(改动行数 / 触及文件数 / stage,来自 git),判断题留 `null` 并附一行说明。编辑该文件,把 `facts` 里每个 `null` 按 locked spec 换成你的真实判断 —— 只有确实无法判断时才留 null(此时回退内置默认值)。**不要**跳过本步,也**不要**自行编造命令没问的 fact。
80
- 2. Bash: `harnessed gates task --task "<locked spec>" --context-file .harnessed-facts.json --skip-sub discuss` → 解析 JSON `{fire, skip, parallelism}`。这是 plan SoT(不 spawn)。保留 verbatim JSON。
73
+ 2. Bash: `harnessed gates task --task "<locked spec>" --context-file .harnessed-facts.json --skip-sub discuss` → 解析 JSON `{fire: [{sub, order, mode, is_master}], skip: [{sub, reason}], parallelism: {escalate_to_teams, teams_active, transport, result_contract, bounded_wait}}`。`escalate_to_teams: false` 表示本次运行成不了团 —— 按 subagent fan-out 驱动 fired subs(`order` 允许处并发),不要成团。`teams_active` 说明此刻是否真的有团在跑,`transport` 给出本 plan 使用的传输,`result_contract` 是 `result-file`、`bounded_wait` 是 `true`:每个 sub 的完成信号是结果文件,不是聊天消息。这是 plan SoT(不 spawn)。保留 verbatim JSON。
81
74
  3. Bash: `harnessed checkpoint start task --plan '<step 2 的 verbatim gates JSON>'` → seed per-sub ledger,让 `harnessed status --recover` 能在 compaction 后给你重新定位。
82
75
  {{ host.teams_step_note.skill }}
83
76
  5. 否则,对 `order` 里每个 fired sub(serial 串行、parallel 并发):
84
77
  - **若该项 `is_master: true`**(本身是 stage master —— 如 `/auto` fire `plan`/`task`/`verify`):**不要**直接 prompt+spawn。RECURSE:跑该 master 自己的 `harnessed facts <sub> --out .harnessed-facts.json`(填完 null)→ `harnessed gates <sub> --task "<spec>" --context-file .harnessed-facts.json --skip-sub discuss` → `harnessed checkpoint start <sub> --plan '<json>'` → 对它的 fired subs 重复本循环。
85
78
  - **否则(leaf sub):**
86
- a. Bash: `harnessed prompt <sub> --task "<spec>" --json` → 解析 `{prompt, max_iterations, model}`。
87
- b. 用 {{ host.native }} subagent({{ host.spawn_subagent.zh_tool }})以该 `prompt` + `model` spawn,然后用 harnessed 自己的完成闸门驱动交付:
88
- - subagent 返回后,把它的最终输出写入文件,跑 `harnessed checkpoint complete <sub> --result-file <path>` —— 该命令对声明的产物、TDD boundary、逐字 `<promise>COMPLETE</promise>` 三者 fail-closed。
79
+ a. Bash: `harnessed prompt <sub> --task "<spec>" --json` → 解析 `{prompt, max_iterations, model, result_file}`。
80
+ b. 用 {{ host.native }} subagent({{ host.spawn_subagent.zh_tool }})以该 `prompt` + `model` spawn。sub 自己把最终结果写入 `result_file`(prompt 里给出的那个路径)—— **完成信号是文件**,不是聊天消息:后台 / 被 re-parent 的 agent 消息可能永不到达,不要等它。然后用 harnessed 自己的完成闸门驱动交付:
81
+ - 闸门是 `harnessed checkpoint complete <sub> --result-file <result_file> --wait 60` —— 单次调用最多等 60 秒,sub 需要更久就重复**同一条**命令;它对声明的产物、TDD boundary、逐字 `<promise>COMPLETE</promise>` 三者 fail-closed。
89
82
  - 若被拦下,跑 `harnessed checkpoint fail <sub> --failing-tests <n>` 记录本次尝试;命中停机条件时它会打印 BUDGET-EXHAUSTED / NO-PROGRESS / BREAK-LOOP。
90
83
  - **仅当**这三者都未触发时才允许重 spawn。任一触发即停:重新收敛子任务范围、修掉阻塞点,或上报用户。绝不越过停机指令继续重 spawn。
91
- c. 若输出含 `STATUS: NEEDS_CLARIFICATION` + 问题列表:STOP,用 {{ host.ask_user }} 原样转达,把答案 append 进 spec,再重 spawn 同一 sub。
92
- d. 命中 `<promise>COMPLETE</promise>`:把 subagent 最终输出写入文件,再 Bash `harnessed checkpoint complete <sub> --result-file <path> --summary "<one-line>"`。fail-CLOSED —— 除非声明的 `artifacts_expected` 文件全部存在、TDD boundary 通过(证据非空 / 红绿两侧齐全 / 测试文件未被删除)、且结果含逐字 `<promise>COMPLETE</promise>`(或结构化 COMPLETE 状态),否则拦下。`--result <text>` 是内联变体;`--result-file` 优先且在 Windows 上引号安全。exit 非零即表示该 sub **未** done —— 重 spawn 补齐,或仅在刻意覆盖时传 `--force`(记录 `evidence_status=overridden`,是可审计的覆盖而非静默放行)。
84
+ c. 若 sub 的输出含 `STATUS: NEEDS_CLARIFICATION` + 问题列表(从 `result_file` 读 —— 聊天消息可能永不到达):STOP,用 {{ host.ask_user }} 原样转达,把答案 append 进 spec,再重 spawn 同一 sub。
85
+ d. 当 `result_file` 携带完成标记时:Bash `harnessed checkpoint complete <sub> --result-file <result_file> --wait 60 --summary "<one-line>"`。fail-CLOSED —— 除非声明的 `artifacts_expected` 文件全部存在、TDD boundary 通过(证据非空 / 红绿两侧齐全 / 测试文件未被删除)、且结果文件含逐字 `<promise>COMPLETE</promise>`(或结构化 COMPLETE 状态),否则拦下。`--wait 60` 只约束**单次**调用为 60 秒 —— sub 需要更久就重复**同一条**命令,绝不无限等待。`--result <text>` 是内联变体;`--result-file` 优先且在 Windows 上引号安全。`result-wait-timeout` 退出码表示 sub 尚未发出完成信号 —— 重复同一条命令;其它非零退出码即表示该 sub **未** done —— 重 spawn 补齐,或仅在刻意覆盖时传 `--force`(记录 `evidence_status=overridden`,是可审计的覆盖而非静默放行)。
93
86
  e. 若 complete 闸门拦下:Bash `harnessed checkpoint fail <sub> --failing-tests <n>` 记录本次尝试(该 sub 无测试时省略该 flag —— 回退用证据产物摘要作进展度量)。命中停机条件时它会打印 `BUDGET-EXHAUSTED`(已用尝试次数 vs `workflows/defaults.yaml ralph_max_iterations`)、`NO-PROGRESS`(连续 N 次无进展)或 `BREAK-LOOP`(该 sub 失败次数达阈值)。**仅当**三者都未触发时才允许重 spawn;任一触发即 STOP —— 重新收敛范围、修掉阻塞点或上报用户,并说明情况。
94
87
  6. 所有 fired subs `done`(或记录 `failed`)后,Bash `harnessed status --recover` 确认 ledger,并向用户报告 per-sub fired/skipped/done/failed 摘要。
95
88
 
96
89
  **若丢失上下文(compaction / resume):** 先跑 `harnessed status --recover` —— 它读 ledger 并打印「你在这里,下一步是什么」,让你从第一个 `pending` sub 续跑而非重启。若 ledger 为空,重跑 step 2-3。
97
90
 
98
- <!-- harnessed-generated:v4.12.0 -->
91
+ <!-- harnessed-generated:v4.13.0 -->
99
92
 
100
93
  ## References
101
94
 
@@ -1,15 +1,7 @@
1
1
  ---
2
2
  name: task-clarify
3
3
  description: |
4
- task-clarify workflow v3 — Stage ③.a 子任务澄清 sub-workflow (superpowers
5
- brainstorm + mattpocock /grill-with-docs conditional invoke)。Per-subtask
6
- repeat invoke 入口 — execute-task 每个 subtask 起步先走 task-clarify 评估 gate
7
- (judgments.subtask-gate.brainstorming.fires) 是否激活 brainstorming + 条件性
8
- fire grill-with-docs (phase.spec_ambiguous == true)。
9
- schema_version: harnessed.workflow.v3 with disciplines_applied [6] + tools_available
10
- [superpowers-brainstorming, grill-with-docs]. Triggered by headless CLI
11
- `harnessed run task-clarify` or slash command `/task-clarify` after
12
- `harnessed setup`.
4
+ Decide whether a subtask needs a brainstorm and a locked spec before any code is written. Run it at the start of every subtask, and transparently skip the brainstorm when the subtask is routine.
13
5
  trigger_phrases:
14
6
  - "clarify this subtask"
15
7
  - "task-clarify workflow"
@@ -72,7 +64,7 @@ execution stages.
72
64
 
73
65
  Output: a locked spec the execution stages (`/plan` → `/task` → `/verify`) consume without further user input.
74
66
 
75
- <!-- harnessed-generated:v4.12.0 -->
67
+ <!-- harnessed-generated:v4.13.0 -->
76
68
 
77
69
  ## References
78
70