harnessed 4.32.22 → 4.37.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.
- package/README.md +6 -6
- package/bin/harnessed-inject-state.mjs +16 -0
- package/dist/cli.mjs +1471 -302
- package/dist/cli.mjs.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/schemas/index.mjs.map +1 -1
- package/manifests/optional/doc-discipline-gate.yaml +54 -0
- package/messages/en.json +8 -0
- package/messages/zh-Hans.json +8 -0
- package/package.json +1 -1
- package/routing/decision_rules.yaml +1 -1
- package/workflows/README.md +1 -1
- package/workflows/auto/SKILL.md +13 -9
- package/workflows/auto/SKILL.zh-Hans.md +13 -9
- package/workflows/capabilities.yaml +100 -40
- package/workflows/defaults.yaml +8 -2
- package/workflows/disciplines/karpathy.yaml +29 -0
- package/workflows/disciplines/karpathy.zh-Hans.yaml +27 -0
- package/workflows/disciplines/language.yaml +15 -10
- package/workflows/disciplines/operational.yaml +1 -1
- package/workflows/disciplines/operational.zh-Hans.yaml +1 -1
- package/workflows/disciplines/output-style.yaml +10 -2
- package/workflows/disciplines/output-style.zh-Hans.yaml +10 -2
- package/workflows/disciplines/priority.yaml +15 -2
- package/workflows/disciplines/priority.zh-Hans.yaml +15 -2
- package/workflows/discuss/auto/SKILL.md +4 -4
- package/workflows/discuss/auto/SKILL.zh-Hans.md +4 -4
- package/workflows/discuss/auto/workflow.yaml +16 -3
- package/workflows/discuss/phase/SKILL.md +1 -1
- package/workflows/discuss/phase/SKILL.zh-Hans.md +1 -1
- package/workflows/discuss/strategic/SKILL.md +1 -1
- package/workflows/discuss/strategic/SKILL.zh-Hans.md +1 -1
- package/workflows/discuss/subtask/SKILL.md +1 -1
- package/workflows/discuss/subtask/SKILL.zh-Hans.md +1 -1
- package/workflows/judgments/parallelism-gate.yaml +11 -6
- package/workflows/judgments/phase-gate.yaml +5 -1
- package/workflows/judgments/stage-routing.yaml +21 -26
- package/workflows/judgments/strategic-gate.yaml +30 -0
- package/workflows/judgments/user-overrides.yaml +7 -3
- package/workflows/judgments/web-testing-routing.yaml +33 -12
- package/workflows/plan/architecture/SKILL.md +7 -3
- package/workflows/plan/architecture/SKILL.zh-Hans.md +7 -3
- package/workflows/plan/auto/SKILL.md +11 -7
- package/workflows/plan/auto/SKILL.zh-Hans.md +11 -7
- package/workflows/plan/phase/SKILL.md +7 -3
- package/workflows/plan/phase/SKILL.zh-Hans.md +7 -3
- package/workflows/research/SKILL.md +24 -9
- package/workflows/research/SKILL.zh-Hans.md +23 -9
- package/workflows/research/workflow.yaml +43 -3
- package/workflows/retro/SKILL.md +7 -3
- package/workflows/retro/SKILL.zh-Hans.md +7 -3
- package/workflows/role-prompts.yaml +28 -21
- package/workflows/role-prompts.zh-Hans.yaml +22 -17
- package/workflows/ship/auto/SKILL.md +11 -7
- package/workflows/ship/auto/SKILL.zh-Hans.md +11 -7
- package/workflows/ship/preflight/SKILL.md +7 -3
- package/workflows/ship/preflight/SKILL.zh-Hans.md +7 -3
- package/workflows/task/auto/SKILL.md +26 -16
- package/workflows/task/auto/SKILL.zh-Hans.md +26 -16
- package/workflows/task/auto/workflow.yaml +11 -4
- package/workflows/task/clarify/SKILL.md +1 -1
- package/workflows/task/clarify/SKILL.zh-Hans.md +1 -1
- package/workflows/task/code/SKILL.md +7 -3
- package/workflows/task/code/SKILL.zh-Hans.md +7 -3
- package/workflows/task/deliver/SKILL.md +53 -35
- package/workflows/task/deliver/SKILL.zh-Hans.md +54 -36
- package/workflows/task/deliver/workflow.yaml +32 -24
- package/workflows/task/test/SKILL.md +37 -3
- package/workflows/task/test/SKILL.zh-Hans.md +33 -3
- package/workflows/task/test/workflow.yaml +13 -0
- package/workflows/verify/auto/SKILL.md +12 -8
- package/workflows/verify/auto/SKILL.zh-Hans.md +12 -8
- package/workflows/verify/auto/workflow.yaml +3 -1
- package/workflows/verify/code-review/SKILL.md +7 -3
- package/workflows/verify/code-review/SKILL.zh-Hans.md +7 -3
- package/workflows/verify/design/SKILL.md +24 -10
- package/workflows/verify/design/SKILL.zh-Hans.md +24 -10
- package/workflows/verify/design/workflow.yaml +36 -7
- package/workflows/verify/eval-review/SKILL.md +7 -3
- package/workflows/verify/eval-review/SKILL.zh-Hans.md +7 -3
- package/workflows/verify/multispec/SKILL.md +17 -10
- package/workflows/verify/multispec/SKILL.zh-Hans.md +16 -10
- package/workflows/verify/multispec/workflow.yaml +7 -5
- package/workflows/verify/paranoid/SKILL.md +7 -3
- package/workflows/verify/paranoid/SKILL.zh-Hans.md +7 -3
- package/workflows/verify/progress/SKILL.md +7 -3
- package/workflows/verify/progress/SKILL.zh-Hans.md +7 -3
- package/workflows/verify/qa/SKILL.md +44 -14
- package/workflows/verify/qa/SKILL.zh-Hans.md +44 -14
- package/workflows/verify/qa/workflow.yaml +61 -2
- package/workflows/verify/security/SKILL.md +7 -3
- package/workflows/verify/security/SKILL.zh-Hans.md +7 -3
- package/workflows/verify/simplify/SKILL.md +7 -3
- package/workflows/verify/simplify/SKILL.zh-Hans.md +7 -3
- package/workflows/verify/validate-phase/SKILL.md +7 -3
- package/workflows/verify/validate-phase/SKILL.zh-Hans.md +7 -3
- package/manifests/skill-packs/karpathy-skills.yaml +0 -65
- package/manifests/tools/ralph-loop.yaml +0 -46
|
@@ -2,18 +2,18 @@
|
|
|
2
2
|
name: task
|
|
3
3
|
description: |
|
|
4
4
|
Stage ③ Task 主控编排器 — 串行 invoke 4 sub per subtask (clarify → code → test → deliver)。
|
|
5
|
-
|
|
5
|
+
completion gate (harnessed 自有 checkpoint CLI) 在 deliver phase 内 (D-10 orthogonal wrapper)。tdd-gate conditional
|
|
6
6
|
fire on test sub。schema_version: harnessed.workflow.v3 with delegates_to (4 sub: clarify order 1
|
|
7
7
|
conditional + code order 2 + test order 3 conditional + deliver order 4) + disciplines_applied
|
|
8
8
|
(6 default) + tools_available (8 entry: superpowers-brainstorming + tdd + grill-with-docs +
|
|
9
|
-
improve-codebase-architecture + diagnose +
|
|
9
|
+
improve-codebase-architecture + diagnose + completion-gate + planning-with-files)。
|
|
10
10
|
Triggered by slash command `/task`
|
|
11
11
|
(bare per ADR 0030 namespace policy D-02 LOCK) after `harnessed setup`.
|
|
12
12
|
trigger_phrases:
|
|
13
13
|
- "task"
|
|
14
14
|
- "子任务执行"
|
|
15
15
|
- "stage 3 execute"
|
|
16
|
-
- "
|
|
16
|
+
- "completion gate"
|
|
17
17
|
- "执行子任务"
|
|
18
18
|
---
|
|
19
19
|
|
|
@@ -29,18 +29,24 @@ trigger_phrases:
|
|
|
29
29
|
| 1 | `clarify` | `judgments.subtask-gate.brainstorming.fires` | serial | approaches ≥ 2 / core_algorithm / has_api_contract / error_cost=high |
|
|
30
30
|
| 2 | `code` | (无条件 — karpathy 心法 always-on + mattpocock conditional route) | serial | 始终触发 |
|
|
31
31
|
| 3 | `test` | `judgments.tdd-gate.tdd-strongly-suggested.fires` | serial | 核心业务 / 算法 / 数据处理 / 回归 risk / reliability (6 fires_when OR-chain) |
|
|
32
|
-
| 4 | `deliver` | (无条件 —
|
|
32
|
+
| 4 | `deliver` | (无条件 — completion gate COMPLETE wrapper) | serial | 始终触发 |
|
|
33
33
|
|
|
34
34
|
Engine runtime 通过 `runMasterOrchestrator` 按顺序 spawn 4 个子工作流阶段
|
|
35
35
|
(依照 T3.5.W0.1:clarify → code → test → deliver)。K9 invariant 强制执行:每个 serial
|
|
36
36
|
mode delegate 必须携带显式 `order`。每个 subtask 入口走一次此主控编排器。
|
|
37
37
|
|
|
38
|
-
##
|
|
38
|
+
## 完成闸门正交 wrapper (D-10)
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
verbatim "COMPLETE" (R20.10)。任何执行单元 (subagent / team / 主 session)
|
|
40
|
+
完成闸门是正交 wrapper, 套在 deliver sub 的 01-deliver phase 外层保 completion-promise
|
|
41
|
+
verbatim "COMPLETE" (R20.10)。任何执行单元 (subagent / team / 主 session) 都可外层套它
|
|
42
42
|
保 completion-promise (bundled subagent vs Agent Teams routing — orthogonal wrapper rule).
|
|
43
43
|
|
|
44
|
+
它是 harnessed 自有的 CLI,不是上游 plugin (ADR 0039,4.36.0 摘除 `/ralph-loop` 依赖):
|
|
45
|
+
`harnessed checkpoint complete <sub> --result-file <path>` 对产物 / TDD boundary / verbatim
|
|
46
|
+
`<promise>COMPLETE</promise>` 三重 fail-closed;被拦下时 `harnessed checkpoint fail <sub>
|
|
47
|
+
--failing-tests <n>` 记录尝试并在命中停机条件时打印 BUDGET-EXHAUSTED / NO-PROGRESS /
|
|
48
|
+
BREAK-LOOP。**仅当**三者都未触发才允许重 spawn;任一触发即停。
|
|
49
|
+
|
|
44
50
|
## Capability refs
|
|
45
51
|
|
|
46
52
|
Sister `workflows/capabilities.yaml`:
|
|
@@ -49,7 +55,7 @@ Sister `workflows/capabilities.yaml`:
|
|
|
49
55
|
- `grill-with-docs` — Bucket 1 mattpocock conditional invoke (clarify)
|
|
50
56
|
- `improve-codebase-architecture` — Bucket 1 mattpocock conditional invoke (code, architecture_health_audit)
|
|
51
57
|
- `diagnose` — Bucket 1 mattpocock conditional invoke (code/test, bug_root_cause_unknown / test_fail)
|
|
52
|
-
- `
|
|
58
|
+
- `completion-gate` — Bucket 4 核心 capability orthogonal wrapper (deliver;harnessed 自有 `harnessed checkpoint complete` / `fail`,无上游 plugin)
|
|
53
59
|
- `planning-with-files` — Bucket 4 核心 capability (code + deliver progress.md update)
|
|
54
60
|
|
|
55
61
|
## Invocation
|
|
@@ -71,27 +77,31 @@ Sister `workflows/capabilities.yaml`:
|
|
|
71
77
|
session、绕过 Agent Teams,在 Claude Code 内部调用时会挂死)。
|
|
72
78
|
|
|
73
79
|
1. 若 "$ARGUMENTS" 触发澄清判据(≥2 方案 / 核心算法 / API contract / 高错误成本),先在**本 session** 交互澄清(AskUserQuestion)并锁决策;否则透明 skip。产出 locked spec。
|
|
74
|
-
|
|
80
|
+
1b. Bash: `harnessed facts task --out .harnessed-facts.json` → 它只列出**本阶段 gate 真正读取**的 fact:能确定性推导的已填好(改动行数 / 触及文件数 / stage,来自 git),判断题留 `null` 并附一行说明。编辑该文件,把 `facts` 里每个 `null` 按 locked spec 换成你的真实判断 —— 只有确实无法判断时才留 null(此时回退内置默认值)。**不要**跳过本步,也**不要**自行编造命令没问的 fact。
|
|
81
|
+
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。
|
|
75
82
|
3. Bash: `harnessed checkpoint start task --plan '<step 2 的 verbatim gates JSON>'` → seed per-sub ledger,让 `harnessed status --recover` 能在 compaction 后给你重新定位。
|
|
76
|
-
4. 若 `parallelism.escalate_to_teams === true`:读 `~/.claude/rules/agent-teams.md`,然后把 fired subs 作为 Agent Team
|
|
83
|
+
4. 若 `parallelism.escalate_to_teams === true`:读 `~/.claude/rules/agent-teams.md`,然后把 fired subs 作为 Agent Team 驱动。**没有建团步骤、也没有建团工具** —— 对每个 fired sub 用 `Agent(name: <sub>, run_in_background: true, prompt: <该 sub 的 `harnessed prompt <sub>` prompt>)` spawn 一个后台 teammate,团在**第一个** spawn 时隐式形成,本 session 即 lead(`team_name` 入参被接受但忽略 —— 团名由 session 派生)。用 `SendMessage` 协调;某个 sub 完成后,**按名**请求该 teammate 关闭(例如「ask the verify-qa teammate to shut down」)。每个 sub 仍按下方 checkpoint(`complete` / `fail`)。
|
|
77
84
|
5. 否则,对 `order` 里每个 fired sub(serial 串行、parallel 并发):
|
|
78
|
-
- **若该项 `is_master: true`**(本身是 stage master —— 如 `/auto` fire `plan`/`task`/`verify`):**不要**直接 prompt+spawn。RECURSE:跑该 master 自己的 `harnessed gates <sub> --task "<spec>" --skip-sub discuss` → `harnessed checkpoint start <sub> --plan '<json>'` → 对它的 fired subs 重复本循环。
|
|
85
|
+
- **若该项 `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 重复本循环。
|
|
79
86
|
- **否则(leaf sub):**
|
|
80
87
|
a. Bash: `harnessed prompt <sub> --task "<spec>" --json` → 解析 `{prompt, max_iterations, model}`。
|
|
81
|
-
b. 用 CC-native subagent(Task / Agent 工具)以该 `prompt` + `model` spawn
|
|
88
|
+
b. 用 CC-native subagent(Task / Agent 工具)以该 `prompt` + `model` spawn,然后用 harnessed 自己的完成闸门驱动交付:
|
|
89
|
+
- subagent 返回后,把它的最终输出写入文件,跑 `harnessed checkpoint complete <sub> --result-file <path>` —— 该命令对声明的产物、TDD boundary、逐字 `<promise>COMPLETE</promise>` 三者 fail-closed。
|
|
90
|
+
- 若被拦下,跑 `harnessed checkpoint fail <sub> --failing-tests <n>` 记录本次尝试;命中停机条件时它会打印 BUDGET-EXHAUSTED / NO-PROGRESS / BREAK-LOOP。
|
|
91
|
+
- **仅当**这三者都未触发时才允许重 spawn。任一触发即停:重新收敛子任务范围、修掉阻塞点,或上报用户。绝不越过停机指令继续重 spawn。
|
|
82
92
|
c. 若输出含 `STATUS: NEEDS_CLARIFICATION` + 问题列表:STOP,用 AskUserQuestion 原样转达,把答案 append 进 spec,再重 spawn 同一 sub。
|
|
83
|
-
d. 命中 `<promise>COMPLETE</promise
|
|
84
|
-
e. 若
|
|
93
|
+
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`,是可审计的覆盖而非静默放行)。
|
|
94
|
+
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 —— 重新收敛范围、修掉阻塞点或上报用户,并说明情况。
|
|
85
95
|
6. 所有 fired subs `done`(或记录 `failed`)后,Bash `harnessed status --recover` 确认 ledger,并向用户报告 per-sub fired/skipped/done/failed 摘要。
|
|
86
96
|
|
|
87
97
|
**若丢失上下文(compaction / resume):** 先跑 `harnessed status --recover` —— 它读 ledger 并打印「你在这里,下一步是什么」,让你从第一个 `pending` sub 续跑而非重启。若 ledger 为空,重跑 step 2-3。
|
|
88
98
|
|
|
89
|
-
<!-- harnessed-generated:v4.
|
|
99
|
+
<!-- harnessed-generated:v4.12.0 -->
|
|
90
100
|
|
|
91
101
|
## References
|
|
92
102
|
|
|
93
103
|
- D-01 master orchestrator delegation pattern
|
|
94
104
|
- D-02 bare slash cmd convention (ADR 0030 namespace policy LOCK)
|
|
95
|
-
- D-10
|
|
105
|
+
- D-10 completion gate orthogonal wrapper (ADR 0039 — 内置化后摘除上游 `/ralph-loop`)
|
|
96
106
|
- workflows/judgments/{subtask-gate,tdd-gate}.yaml — brainstorming + tdd-strongly-suggested triggers
|
|
97
107
|
- workflows/task/{clarify,code,test,deliver}/workflow.yaml — 4 sub-workflow Phase 3.4 SHIPPED
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
#
|
|
3
3
|
# Stage ③ Task master orchestrator — 串行 invoke 4 sub per subtask (clarify → code → test → deliver)
|
|
4
4
|
# per bundled Execute-stage cadence + RESEARCH-workflows § Area 2。
|
|
5
|
-
#
|
|
5
|
+
# completion-gate COMPLETE wrapper 在 deliver phase 内 (D-10 orthogonal wrapper not master concern)。
|
|
6
6
|
# tdd-gate conditional fire on test sub (sister task/test/workflow.yaml gate
|
|
7
7
|
# judgments.tdd-gate.tdd-strongly-suggested.fires)。
|
|
8
8
|
#
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
# - workflows/judgments/tdd-gate.yaml — tdd-strongly-suggested trigger (test conditional)
|
|
12
12
|
# - workflows/task/{clarify,code,test,deliver}/workflow.yaml — 4 sub-workflow Phase 3.4 SHIPPED
|
|
13
13
|
# - workflows/capabilities.yaml — superpowers-brainstorming + tdd + grill-with-docs +
|
|
14
|
-
# improve-codebase-architecture + diagnose +
|
|
14
|
+
# improve-codebase-architecture + diagnose + completion-gate + planning-with-files
|
|
15
15
|
# - .planning/phase-v3.0-3.2/RESEARCH-workflows.md § Area 2 Master Orchestrator yaml Examples
|
|
16
16
|
# - src/workflow/schema/workflow.ts WorkflowSchemaV3 + DelegationClause (Phase 3.3 W0.5 SHIPPED)
|
|
17
17
|
#
|
|
@@ -24,7 +24,7 @@ schema_version: harnessed.workflow.v3
|
|
|
24
24
|
workflow: task
|
|
25
25
|
description: |
|
|
26
26
|
Stage ③ Task master orchestrator — 串行 invoke 4 sub per subtask (clarify → code → test → deliver);
|
|
27
|
-
|
|
27
|
+
completion-gate COMPLETE wrapper 在 deliver phase 内 (D-10 orthogonal wrapper not master concern)。
|
|
28
28
|
tdd-gate conditional fire on test sub (核心业务 / 算法 / 数据处理 / 回归 risk high / reliability
|
|
29
29
|
required, 6 fires_when OR-chain; bundled tdd-gate judgment)。execute-task 每个 subtask 入口走一次。
|
|
30
30
|
|
|
@@ -35,12 +35,17 @@ tools_available:
|
|
|
35
35
|
- grill-with-docs
|
|
36
36
|
- improve-codebase-architecture
|
|
37
37
|
- diagnose
|
|
38
|
-
-
|
|
38
|
+
- completion-gate
|
|
39
39
|
- planning-with-files
|
|
40
40
|
|
|
41
41
|
delegates_to:
|
|
42
42
|
- sub: clarify
|
|
43
43
|
gate: judgments.subtask-gate.brainstorming.fires
|
|
44
|
+
# T2.1 D-5 — the ❌ half of subtask-gate finally evaluates: CRUD / a plain
|
|
45
|
+
# standard-lib call / a <20-line change vetoes brainstorming even when an
|
|
46
|
+
# OR-arm of fires_when matched. Veto is fail-OPEN (a broken skips_when never
|
|
47
|
+
# deletes the gate) — src/workflow/skipGate.ts.
|
|
48
|
+
skip_gate: judgments.subtask-gate.brainstorming.skips
|
|
44
49
|
mode: serial
|
|
45
50
|
order: 1
|
|
46
51
|
- sub: code
|
|
@@ -48,6 +53,8 @@ delegates_to:
|
|
|
48
53
|
order: 2
|
|
49
54
|
- sub: test
|
|
50
55
|
gate: judgments.tdd-gate.tdd-strongly-suggested.fires
|
|
56
|
+
# T2.1 D-5 — tdd-gate's declared skips (crud / ui_polish / docs_only).
|
|
57
|
+
skip_gate: judgments.tdd-gate.tdd-strongly-suggested.skips
|
|
51
58
|
mode: serial
|
|
52
59
|
order: 3
|
|
53
60
|
- sub: deliver
|
|
@@ -81,11 +81,15 @@ Do NOT pipe to `harnessed run task-code` — that is the CI/headless path (in-pr
|
|
|
81
81
|
that blocks the session inside Claude Code).
|
|
82
82
|
|
|
83
83
|
1. Bash: `harnessed prompt task-code --task "$ARGUMENTS" --json` → parse `{prompt, max_iterations, model}`.
|
|
84
|
-
2. Spawn a CC-native subagent (Task / Agent tool) with that `prompt`
|
|
84
|
+
2. Spawn a CC-native subagent (Task / Agent tool) with that `prompt` and `model`, then drive delivery with harnessed's own completion gate:
|
|
85
|
+
- on return, write the subagent's final output to a file and run `harnessed checkpoint complete task-code --result-file <path>` — it is fail-closed on the declared artifacts, the TDD boundary, and the verbatim `<promise>COMPLETE</promise>`.
|
|
86
|
+
- if it blocks, run `harnessed checkpoint fail task-code --failing-tests <n>` to record the attempt; it prints BUDGET-EXHAUSTED / NO-PROGRESS / BREAK-LOOP when a stop condition is reached.
|
|
87
|
+
- 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.
|
|
85
88
|
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.
|
|
86
|
-
4. On `<promise>COMPLETE</promise>`: Bash `harnessed checkpoint complete task-code --summary "<one-line>"`.
|
|
89
|
+
4. On `<promise>COMPLETE</promise>`: write the subagent’s final output to a file, then Bash `harnessed checkpoint complete task-code --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.
|
|
90
|
+
5. If the complete gate blocked: Bash `harnessed checkpoint fail task-code --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.
|
|
87
91
|
|
|
88
|
-
<!-- harnessed-generated:v4.
|
|
92
|
+
<!-- harnessed-generated:v4.12.0 -->
|
|
89
93
|
|
|
90
94
|
## References
|
|
91
95
|
|
|
@@ -79,11 +79,15 @@ CC-native Task / Agent 工具 spawn subagent(保持 session 响应 + 让澄清 r
|
|
|
79
79
|
Code 内部会阻塞 session)。
|
|
80
80
|
|
|
81
81
|
1. Bash: `harnessed prompt task-code --task "$ARGUMENTS" --json` → 解析 `{prompt, max_iterations, model}`。
|
|
82
|
-
2. 用 CC-native subagent(Task / Agent 工具)以该 `prompt` + `model` spawn
|
|
82
|
+
2. 用 CC-native subagent(Task / Agent 工具)以该 `prompt` + `model` spawn,然后用 harnessed 自己的完成闸门驱动交付:
|
|
83
|
+
- subagent 返回后,把它的最终输出写入文件,跑 `harnessed checkpoint complete task-code --result-file <path>` —— 该命令对声明的产物、TDD boundary、逐字 `<promise>COMPLETE</promise>` 三者 fail-closed。
|
|
84
|
+
- 若被拦下,跑 `harnessed checkpoint fail task-code --failing-tests <n>` 记录本次尝试;命中停机条件时它会打印 BUDGET-EXHAUSTED / NO-PROGRESS / BREAK-LOOP。
|
|
85
|
+
- **仅当**这三者都未触发时才允许重 spawn。任一触发即停:重新收敛子任务范围、修掉阻塞点,或上报用户。绝不越过停机指令继续重 spawn。
|
|
83
86
|
3. 若输出含 `STATUS: NEEDS_CLARIFICATION` + 问题列表:STOP,用 AskUserQuestion 原样转达,把答案 append 进 spec,再重 spawn。
|
|
84
|
-
4. 命中 `<promise>COMPLETE</promise
|
|
87
|
+
4. 命中 `<promise>COMPLETE</promise>`:把 subagent 最终输出写入文件,再 Bash `harnessed checkpoint complete task-code --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`),不是静默放行。
|
|
88
|
+
5. 若 complete 闸门拦下:Bash `harnessed checkpoint fail task-code --failing-tests <n>` 记录本次尝试。命中停机条件时会打印 `BUDGET-EXHAUSTED` / `NO-PROGRESS` / `BREAK-LOOP`。**仅当**三者都未触发时才允许重 spawn;任一触发即 STOP —— 重新收敛子任务范围、修掉阻塞点,或上报用户。
|
|
85
89
|
|
|
86
|
-
<!-- harnessed-generated:v4.
|
|
90
|
+
<!-- harnessed-generated:v4.12.0 -->
|
|
87
91
|
|
|
88
92
|
## References
|
|
89
93
|
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: task-deliver
|
|
3
3
|
description: |
|
|
4
|
-
task-deliver workflow v3 — Stage ③.d 子任务交付 sub-workflow (
|
|
5
|
-
|
|
6
|
-
fallback)。2-phase composition: 01-deliver (
|
|
7
|
-
verbatim "COMPLETE" + parallelism judgments.parallelism-gate.
|
|
4
|
+
task-deliver workflow v3 — Stage ③.d 子任务交付 sub-workflow (harnessed 自有 completion-gate
|
|
5
|
+
+ Agent Teams conditional escalation + R20.10 explicit max_iterations_exceeded
|
|
6
|
+
fallback)。2-phase composition: 01-deliver (completion-gate with completion_promise
|
|
7
|
+
verbatim "COMPLETE" + parallelism judgments.parallelism-gate.completion-gate-wrapper.fires +
|
|
8
8
|
fallback emit_warning_and_halt exit_code 1) → 02-progress-mark (Claude Code plugin
|
|
9
9
|
/plan mark subtask complete in progress.md)。
|
|
10
10
|
schema_version: harnessed.workflow.v3 with disciplines_applied [6] + tools_available
|
|
11
|
-
[
|
|
11
|
+
[completion-gate, verification-before-completion, agent-teams-create,
|
|
12
|
+
agent-teams-send-message, agent-teams-shutdown,
|
|
12
13
|
planning-with-files]. Triggered by harnessed CLI `harnessed task-deliver --task <text>`
|
|
13
14
|
or slash command `/task-deliver` after `harnessed setup`.
|
|
14
15
|
trigger_phrases:
|
|
15
16
|
- "deliver this subtask"
|
|
16
17
|
- "task-deliver workflow"
|
|
17
18
|
- "Stage 3 deliver"
|
|
18
|
-
- "
|
|
19
|
+
- "completion gate COMPLETE"
|
|
19
20
|
- "跑 task-deliver"
|
|
20
21
|
---
|
|
21
22
|
|
|
@@ -25,36 +26,46 @@ trigger_phrases:
|
|
|
25
26
|
|
|
26
27
|
2-phase sub-workflow mapping the user's CLAUDE.md Stage ③.d 子任务交付 discipline
|
|
27
28
|
onto the harnessed runtime, fully `harnessed.workflow.v3` schema (Phase v3.0-3.4 W0
|
|
28
|
-
T3.4.W0.9 — D-09 L0 Discipline Substrate + D-10
|
|
29
|
+
T3.4.W0.9 — D-09 L0 Discipline Substrate + D-10 completion gate + D-11 Agent
|
|
29
30
|
Teams 升级 5 触发 OR-chain + R20.10 explicit max_iterations_exceeded handler).
|
|
30
31
|
|
|
31
32
|
| phase | id | upstream | model | capability / args / parallelism / fallback |
|
|
32
33
|
| ----- | -- | -------- | ----- | ------------------------------------------ |
|
|
33
|
-
| 1 | `01-deliver` |
|
|
34
|
+
| 1 | `01-deliver` | (none — harnessed 自有 CLI) | haiku | `{{ capabilities.completion-gate.cmd }}` + `args: {completion_promise: COMPLETE, max_iterations: ...}` + `parallelism: judgments.parallelism-gate.completion-gate-wrapper.fires` + `fallback.max_iterations_exceeded.action: emit_warning_and_halt` |
|
|
34
35
|
| 2 | `02-progress-mark` | planning-with-files | haiku | `{{ capabilities.planning-with-files.cmd }}` / `invokes: /plan` / `artifacts_expected: [progress.md]` |
|
|
35
36
|
|
|
36
37
|
Per-phase config loads from `workflows/task/deliver/workflow.yaml`; engine.runRouting
|
|
37
38
|
spawns each phase as a sub-agent via `@anthropic-ai/claude-agent-sdk` 0.3.142+.
|
|
38
39
|
|
|
39
|
-
## Phase 01
|
|
40
|
+
## Phase 01 completion gate (R20.10 + D-10 + ADR 0039)
|
|
40
41
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
LLM-as-judge). Sister capabilities.yaml `ralph-loop` entry impl `bundled-skill` +
|
|
44
|
-
`sdk_ref: src/workflow/lib/ralphLoop.ts` (Phase 2.2 v0.2.0 ship)。
|
|
42
|
+
完成判据是子任务输出包含 verbatim `"COMPLETE"` string (NOT 启发式 / NOT LLM-as-judge)。
|
|
43
|
+
4.36.0 起这条保证**完全内置**,跑在 harnessed 自己的 live path 上,不依赖任何上游 plugin:
|
|
45
44
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
- `harnessed checkpoint complete <sub> --result-file <path>` — fail-CLOSED,同时校验
|
|
46
|
+
声明的 `artifacts_expected` 产物存在、TDD boundary 通过(证据非空 / 红绿两侧齐全 /
|
|
47
|
+
测试文件未被删除)、结果含 verbatim `<promise>COMPLETE</promise>`(或结构化 COMPLETE
|
|
48
|
+
状态)。`--result <text>` 是内联变体;`--result-file` 优先且在 Windows 上引号安全。
|
|
49
|
+
`--force` 记录可审计的覆盖(`evidence_status=overridden`),不是静默放行。
|
|
50
|
+
- `harnessed checkpoint fail <sub> --failing-tests <n>` — 记录本次尝试,并在命中停机
|
|
51
|
+
条件时打印 `BUDGET-EXHAUSTED`(已用尝试次数 vs `workflows/defaults.yaml
|
|
52
|
+
ralph_max_iterations`)/ `NO-PROGRESS`(连续 N 次无进展;失败测试数,省略该 flag 时退回
|
|
53
|
+
证据产物摘要)/ `BREAK-LOOP`(该 sub 失败次数达阈值)。
|
|
54
|
+
- **仅当**这三条停机理由都未触发时才允许重 spawn。任一触发即停:重新收敛子任务范围、
|
|
55
|
+
修掉阻塞点,或上报用户。绝不越过停机指令继续重 spawn。
|
|
50
56
|
|
|
51
|
-
|
|
57
|
+
这三条停机理由 == 上游 `/ralph-loop --max-iterations` + `--completion-promise` 曾经提供的
|
|
58
|
+
东西,只是长在自有路径上、没有「装没装」的问题(ADR 0039 supersedes ADR 0036 的
|
|
59
|
+
plugin → `/goal` → self-loop 三级链)。Sister capabilities.yaml `completion-gate` entry
|
|
60
|
+
impl `harnessed-bundled` + `sdk_ref: src/workflow/lib/ralphLoop.ts`。
|
|
52
61
|
|
|
53
|
-
|
|
54
|
-
|
|
62
|
+
### Parallelism — completion gate 正交 wrapper
|
|
63
|
+
|
|
64
|
+
`parallelism: judgments.parallelism-gate.completion-gate-wrapper.fires` ref — per R20.10
|
|
65
|
+
+ D-10, completion gate 是 **正交 wrapper** 套在 subagent-default / agent-teams-upgrade /
|
|
55
66
|
main-session-fallback 任 1 mode 外层 (NOT 互斥触发器, 而是 `wraps:` orthogonal field
|
|
56
|
-
in parallelism-gate.yaml
|
|
57
|
-
execution unit + 套
|
|
67
|
+
in parallelism-gate.yaml). Runtime engine 评估 wrapping mode 后 spawn 相应
|
|
68
|
+
execution unit + 套 completion check。
|
|
58
69
|
|
|
59
70
|
### Agent Teams conditional escalation (D-11 + agent-teams.md 5 OR-chain)
|
|
60
71
|
|
|
@@ -66,7 +77,8 @@ execution unit + 套 ralph-loop completion check。
|
|
|
66
77
|
5. `fullstack_three_way == true` — 全栈三路协同
|
|
67
78
|
|
|
68
79
|
任 1 fire → escalate subagent fan-out → Agent Teams Pattern A/B/C。Cleanup mandatory
|
|
69
|
-
per agent-teams.md 防呆清单 (
|
|
80
|
+
per agent-teams.md 防呆清单 (lead 按名请求每个 teammate shut down; CC 2.1.178+ 无 teardown
|
|
81
|
+
工具,团目录 session 退出时自动清理 —— 剩下的纪律是别把 teammate 落在运行态) — engine-level
|
|
70
82
|
wiring, NOT yaml schema scope。
|
|
71
83
|
|
|
72
84
|
### R20.10 explicit max_iterations_exceeded handler (NOT silent abort)
|
|
@@ -74,10 +86,11 @@ wiring, NOT yaml schema scope。
|
|
|
74
86
|
phase.fallback.max_iterations_exceeded = `{action: emit_warning_and_halt, message,
|
|
75
87
|
exit_code: 1}` — schema-enforced via FallbackMaxIterationsExceeded Type.Literal(
|
|
76
88
|
'emit_warning_and_halt') (workflow.ts L70-77). Sister Phase 2.4 W1.2 fallbackHandlers.ts
|
|
77
|
-
engine.ts wire —
|
|
78
|
-
exit_code 1, NOT silent abort / continue
|
|
89
|
+
engine.ts wire — 撞 max_iterations 时 explicit emit warning + halt with
|
|
90
|
+
exit_code 1, NOT silent abort / continue。交互面的对应物是 `checkpoint fail` 打印的
|
|
91
|
+
`BUDGET-EXHAUSTED`。
|
|
79
92
|
|
|
80
|
-
Brief enforcement W0.9: ✅
|
|
93
|
+
Brief enforcement W0.9: ✅ completion-gate completion_promise COMPLETE / ✅ parallelism-gate
|
|
81
94
|
ref / ✅ R20.10 explicit max_iterations_exceeded handler。
|
|
82
95
|
|
|
83
96
|
## Phase 02 progress-mark planning-with-files (D-15 + Q-AUDIT-5a Option A)
|
|
@@ -102,24 +115,29 @@ Do NOT pipe to `harnessed run task-deliver` — that is the CI/headless path (in
|
|
|
102
115
|
that blocks the session inside Claude Code).
|
|
103
116
|
|
|
104
117
|
1. Bash: `harnessed prompt task-deliver --task "$ARGUMENTS" --json` → parse `{prompt, max_iterations, model}`.
|
|
105
|
-
2. Spawn a CC-native subagent (Task / Agent tool) with that `prompt`
|
|
118
|
+
2. Spawn a CC-native subagent (Task / Agent tool) with that `prompt` and `model`, then drive delivery with harnessed's own completion gate:
|
|
119
|
+
- on return, write the subagent's final output to a file and run `harnessed checkpoint complete task-deliver --result-file <path>` — it is fail-closed on the declared artifacts, the TDD boundary, and the verbatim `<promise>COMPLETE</promise>`.
|
|
120
|
+
- if it blocks, run `harnessed checkpoint fail task-deliver --failing-tests <n>` to record the attempt; it prints BUDGET-EXHAUSTED / NO-PROGRESS / BREAK-LOOP when a stop condition is reached.
|
|
121
|
+
- 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.
|
|
106
122
|
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.
|
|
107
|
-
4. On `<promise>COMPLETE</promise>`: Bash `harnessed checkpoint complete task-deliver --summary "<one-line>"`.
|
|
123
|
+
4. On `<promise>COMPLETE</promise>`: write the subagent’s final output to a file, then Bash `harnessed checkpoint complete task-deliver --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.
|
|
124
|
+
5. If the complete gate blocked: Bash `harnessed checkpoint fail task-deliver --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.
|
|
108
125
|
|
|
109
|
-
<!-- harnessed-generated:v4.
|
|
126
|
+
<!-- harnessed-generated:v4.12.0 -->
|
|
110
127
|
|
|
111
128
|
## References
|
|
112
129
|
|
|
113
130
|
- D-09 — L0 Discipline Substrate always-on (6 disciplines)
|
|
114
|
-
- D-10 —
|
|
131
|
+
- D-10 — 完成保证真接 SDK wrapper (NOT mock reference; v0.2.0 ship)
|
|
115
132
|
- D-11 — Agent Teams 升级 5 触发 OR-chain per bundled parallelism-gate rules
|
|
116
|
-
- R20.10 —
|
|
117
|
-
(acceptance c "NOT silent abort");
|
|
133
|
+
- R20.10 — max_iterations_exceeded explicit emit_warning_and_halt
|
|
134
|
+
(acceptance c "NOT silent abort"); completion gate 正交 wrapper wraps 3 mode
|
|
118
135
|
- D-02 — SKILL.md `name:` bare slash cmd (`task-deliver` NOT `task/deliver`) per ADR 0030
|
|
119
|
-
- ADR 0011 — SDK +
|
|
120
|
-
-
|
|
136
|
+
- ADR 0011 — SDK + 完成保证 integration v0.2.0 baseline
|
|
137
|
+
- ADR 0039 — 完成保证内置化 + 摘除上游 `/ralph-loop` 依赖 (supersedes ADR 0036)
|
|
138
|
+
- `workflows/judgments/parallelism-gate.yaml` triggers.completion-gate-wrapper +
|
|
121
139
|
agent-teams-upgrade + subagent-default + main-session-fallback
|
|
122
|
-
- `workflows/capabilities.yaml` —
|
|
140
|
+
- `workflows/capabilities.yaml` — completion-gate + agent-teams-{create,send-message,shutdown}
|
|
123
141
|
+ planning-with-files entries
|
|
124
142
|
- `workflows/defaults.yaml` — ralph_max_iterations.task-deliver.* values (T3.4.W2.2 followup)
|
|
125
143
|
- `docs/WORKFLOW.md` — 4-stage workflow mermaid + Stage ③ Execute 章节
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: task-deliver
|
|
3
3
|
description: |
|
|
4
|
-
task-deliver workflow v3 — Stage ③.d 子任务交付 sub-workflow (
|
|
5
|
-
|
|
6
|
-
fallback)。2-phase composition: 01-deliver (
|
|
7
|
-
verbatim "COMPLETE" + parallelism judgments.parallelism-gate.
|
|
4
|
+
task-deliver workflow v3 — Stage ③.d 子任务交付 sub-workflow (harnessed 自有 completion-gate
|
|
5
|
+
+ Agent Teams conditional escalation + R20.10 explicit max_iterations_exceeded
|
|
6
|
+
fallback)。2-phase composition: 01-deliver (completion-gate with completion_promise
|
|
7
|
+
verbatim "COMPLETE" + parallelism judgments.parallelism-gate.completion-gate-wrapper.fires +
|
|
8
8
|
fallback emit_warning_and_halt exit_code 1) → 02-progress-mark (Claude Code plugin
|
|
9
9
|
/plan mark subtask complete in progress.md)。
|
|
10
10
|
schema_version: harnessed.workflow.v3 with disciplines_applied [6] + tools_available
|
|
11
|
-
[
|
|
11
|
+
[completion-gate, verification-before-completion, agent-teams-create,
|
|
12
|
+
agent-teams-send-message, agent-teams-shutdown,
|
|
12
13
|
planning-with-files]. Triggered by harnessed CLI `harnessed task-deliver --task <text>`
|
|
13
14
|
or slash command `/task-deliver` after `harnessed setup`.
|
|
14
15
|
trigger_phrases:
|
|
15
16
|
- "deliver this subtask"
|
|
16
17
|
- "task-deliver workflow"
|
|
17
18
|
- "Stage 3 deliver"
|
|
18
|
-
- "
|
|
19
|
+
- "completion gate COMPLETE"
|
|
19
20
|
- "跑 task-deliver"
|
|
20
21
|
---
|
|
21
22
|
|
|
@@ -25,36 +26,46 @@ trigger_phrases:
|
|
|
25
26
|
|
|
26
27
|
2-phase 子工作流,将 CLAUDE.md Stage ③.d 子任务交付纪律映射到 harnessed runtime,
|
|
27
28
|
完整采用 `harnessed.workflow.v3` schema(Phase v3.0-3.4 W0 T3.4.W0.9 — D-09 L0
|
|
28
|
-
Discipline Substrate + D-10
|
|
29
|
+
Discipline Substrate + D-10 完成保证 + D-11 Agent Teams 升级 5 触发
|
|
29
30
|
OR-chain + R20.10 explicit max_iterations_exceeded handler)。
|
|
30
31
|
|
|
31
32
|
| phase | id | upstream | model | capability / args / parallelism / fallback |
|
|
32
33
|
| ----- | -- | -------- | ----- | ------------------------------------------ |
|
|
33
|
-
| 1 | `01-deliver` |
|
|
34
|
+
| 1 | `01-deliver` | (无 — harnessed 自有 CLI) | haiku | `{{ capabilities.completion-gate.cmd }}` + `args: {completion_promise: COMPLETE, max_iterations: ...}` + `parallelism: judgments.parallelism-gate.completion-gate-wrapper.fires` + `fallback.max_iterations_exceeded.action: emit_warning_and_halt` |
|
|
34
35
|
| 2 | `02-progress-mark` | planning-with-files | haiku | `{{ capabilities.planning-with-files.cmd }}` / `invokes: /plan` / `artifacts_expected: [progress.md]` |
|
|
35
36
|
|
|
36
37
|
每阶段配置从 `workflows/task/deliver/workflow.yaml` 加载;engine.runRouting 通过
|
|
37
38
|
`@anthropic-ai/claude-agent-sdk` 0.3.142+ 将每个阶段 spawn 为 sub-agent。
|
|
38
39
|
|
|
39
|
-
## Phase 01
|
|
40
|
+
## Phase 01 完成闸门 (R20.10 + D-10 + ADR 0039)
|
|
40
41
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
LLM-as-judge)。Sister capabilities.yaml `ralph-loop` entry impl `bundled-skill` +
|
|
44
|
-
`sdk_ref: src/workflow/lib/ralphLoop.ts`(Phase 2.2 v0.2.0 ship)。
|
|
42
|
+
完成判据是子任务输出包含 verbatim `"COMPLETE"` string(NOT 启发式 / NOT LLM-as-judge)。
|
|
43
|
+
4.36.0 起这条保证**完全内置**,跑在 harnessed 自己的 live path 上,不依赖任何上游 plugin:
|
|
45
44
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
- `harnessed checkpoint complete <sub> --result-file <path>` —— fail-CLOSED,同时校验
|
|
46
|
+
声明的 `artifacts_expected` 产物存在、TDD boundary 通过(证据非空 / 红绿两侧齐全 /
|
|
47
|
+
测试文件未被删除)、结果含 verbatim `<promise>COMPLETE</promise>`(或结构化 COMPLETE
|
|
48
|
+
状态)。`--result <text>` 是内联变体;`--result-file` 优先且在 Windows 上引号安全。
|
|
49
|
+
`--force` 记录可审计的覆盖(`evidence_status=overridden`),不是静默放行。
|
|
50
|
+
- `harnessed checkpoint fail <sub> --failing-tests <n>` —— 记录本次尝试,并在命中停机
|
|
51
|
+
条件时打印 `BUDGET-EXHAUSTED`(已用尝试次数 vs `workflows/defaults.yaml
|
|
52
|
+
ralph_max_iterations`)/ `NO-PROGRESS`(连续 N 次无进展;失败测试数,省略该 flag 时退回
|
|
53
|
+
证据产物摘要)/ `BREAK-LOOP`(该 sub 失败次数达阈值)。
|
|
54
|
+
- **仅当**这三条停机理由都未触发时才允许重 spawn。任一触发即停:重新收敛子任务范围、
|
|
55
|
+
修掉阻塞点,或上报用户。绝不越过停机指令继续重 spawn。
|
|
50
56
|
|
|
51
|
-
|
|
57
|
+
这三条停机理由 == 上游 `/ralph-loop --max-iterations` + `--completion-promise` 曾经提供的
|
|
58
|
+
东西,只是长在自有路径上、没有「装没装」的问题(ADR 0039 supersedes ADR 0036 的
|
|
59
|
+
plugin → `/goal` → self-loop 三级链)。Sister capabilities.yaml `completion-gate` entry
|
|
60
|
+
impl `harnessed-bundled` + `sdk_ref: src/workflow/lib/ralphLoop.ts`。
|
|
52
61
|
|
|
53
|
-
|
|
54
|
-
|
|
62
|
+
### Parallelism — 完成闸门正交 wrapper
|
|
63
|
+
|
|
64
|
+
`parallelism: judgments.parallelism-gate.completion-gate-wrapper.fires` ref——遵循 R20.10
|
|
65
|
+
+ D-10,完成闸门是**正交 wrapper**,套在 subagent-default / agent-teams-upgrade /
|
|
55
66
|
main-session-fallback 任意 1 种模式外层(NOT 互斥触发器,而是 parallelism-gate.yaml
|
|
56
|
-
|
|
57
|
-
执行单元并套
|
|
67
|
+
中的 `wraps:` 正交字段)。Runtime engine 评估 wrapping mode 后 spawn 相应
|
|
68
|
+
执行单元并套 completion check。
|
|
58
69
|
|
|
59
70
|
### Agent Teams 条件性升级 (D-11 + agent-teams.md 5 OR-chain)
|
|
60
71
|
|
|
@@ -66,18 +77,20 @@ L42-45 中的 `wraps:` 正交字段)。Runtime engine 评估 wrapping mode 后
|
|
|
66
77
|
5. `fullstack_three_way == true` — 全栈三路协同
|
|
67
78
|
|
|
68
79
|
任 1 触发 → 升级 subagent fan-out → Agent Teams Pattern A/B/C。清理是强制的,
|
|
69
|
-
遵循 agent-teams.md 防呆清单(
|
|
70
|
-
|
|
80
|
+
遵循 agent-teams.md 防呆清单(lead 按名请求每个 teammate shut down;CC 2.1.178+ 已无
|
|
81
|
+
teardown 工具,团目录在 session 退出时自动清理——剩下的纪律是别把 teammate 落在运行态)
|
|
82
|
+
——属于 engine 级别的连接,NOT yaml schema 的职责范围。
|
|
71
83
|
|
|
72
84
|
### R20.10 explicit max_iterations_exceeded handler(非静默中止)
|
|
73
85
|
|
|
74
86
|
phase.fallback.max_iterations_exceeded = `{action: emit_warning_and_halt, message,
|
|
75
87
|
exit_code: 1}`——通过 FallbackMaxIterationsExceeded Type.Literal(
|
|
76
88
|
'emit_warning_and_halt')(workflow.ts L70-77)做 schema 级强制约束。Sister Phase 2.4
|
|
77
|
-
W1.2 fallbackHandlers.ts engine.ts wire
|
|
78
|
-
warning + halt with exit_code 1,NOT
|
|
89
|
+
W1.2 fallbackHandlers.ts engine.ts wire——撞 max_iterations 时显式 emit
|
|
90
|
+
warning + halt with exit_code 1,NOT 静默中止/继续执行。交互面的对应物是
|
|
91
|
+
`checkpoint fail` 打印的 `BUDGET-EXHAUSTED`。
|
|
79
92
|
|
|
80
|
-
Brief enforcement W0.9: ✅
|
|
93
|
+
Brief enforcement W0.9: ✅ completion-gate completion_promise COMPLETE / ✅ parallelism-gate
|
|
81
94
|
ref / ✅ R20.10 explicit max_iterations_exceeded handler。
|
|
82
95
|
|
|
83
96
|
## Phase 02 progress-mark planning-with-files (D-15 + Q-AUDIT-5a Option A)
|
|
@@ -101,24 +114,29 @@ CC-native Task / Agent 工具 spawn subagent(保持 session 响应 + 让澄清 r
|
|
|
101
114
|
Code 内部会阻塞 session)。
|
|
102
115
|
|
|
103
116
|
1. Bash: `harnessed prompt task-deliver --task "$ARGUMENTS" --json` → 解析 `{prompt, max_iterations, model}`。
|
|
104
|
-
2. 用 CC-native subagent(Task / Agent 工具)以该 `prompt` + `model` spawn
|
|
117
|
+
2. 用 CC-native subagent(Task / Agent 工具)以该 `prompt` + `model` spawn,然后用 harnessed 自己的完成闸门驱动交付:
|
|
118
|
+
- subagent 返回后,把它的最终输出写入文件,跑 `harnessed checkpoint complete task-deliver --result-file <path>` —— 该命令对声明的产物、TDD boundary、逐字 `<promise>COMPLETE</promise>` 三者 fail-closed。
|
|
119
|
+
- 若被拦下,跑 `harnessed checkpoint fail task-deliver --failing-tests <n>` 记录本次尝试;命中停机条件时它会打印 BUDGET-EXHAUSTED / NO-PROGRESS / BREAK-LOOP。
|
|
120
|
+
- **仅当**这三者都未触发时才允许重 spawn。任一触发即停:重新收敛子任务范围、修掉阻塞点,或上报用户。绝不越过停机指令继续重 spawn。
|
|
105
121
|
3. 若输出含 `STATUS: NEEDS_CLARIFICATION` + 问题列表:STOP,用 AskUserQuestion 原样转达,把答案 append 进 spec,再重 spawn。
|
|
106
|
-
4. 命中 `<promise>COMPLETE</promise
|
|
122
|
+
4. 命中 `<promise>COMPLETE</promise>`:把 subagent 最终输出写入文件,再 Bash `harnessed checkpoint complete task-deliver --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`),不是静默放行。
|
|
123
|
+
5. 若 complete 闸门拦下:Bash `harnessed checkpoint fail task-deliver --failing-tests <n>` 记录本次尝试。命中停机条件时会打印 `BUDGET-EXHAUSTED` / `NO-PROGRESS` / `BREAK-LOOP`。**仅当**三者都未触发时才允许重 spawn;任一触发即 STOP —— 重新收敛子任务范围、修掉阻塞点,或上报用户。
|
|
107
124
|
|
|
108
|
-
<!-- harnessed-generated:v4.
|
|
125
|
+
<!-- harnessed-generated:v4.12.0 -->
|
|
109
126
|
|
|
110
127
|
## References
|
|
111
128
|
|
|
112
129
|
- D-09 — L0 Discipline Substrate always-on (6 disciplines)
|
|
113
|
-
- D-10 —
|
|
130
|
+
- D-10 — 完成保证真接 SDK wrapper (NOT mock reference; v0.2.0 ship)
|
|
114
131
|
- D-11 — Agent Teams 升级 5 触发 OR-chain per bundled parallelism-gate rules
|
|
115
|
-
- R20.10 —
|
|
116
|
-
(acceptance c "NOT silent abort");
|
|
132
|
+
- R20.10 — max_iterations_exceeded explicit emit_warning_and_halt
|
|
133
|
+
(acceptance c "NOT silent abort"); 完成闸门正交 wrapper wraps 3 mode
|
|
117
134
|
- D-02 — SKILL.md `name:` bare slash cmd (`task-deliver` NOT `task/deliver`) per ADR 0030
|
|
118
|
-
- ADR 0011 — SDK +
|
|
119
|
-
-
|
|
135
|
+
- ADR 0011 — SDK + 完成保证 integration v0.2.0 baseline
|
|
136
|
+
- ADR 0039 — 完成保证内置化 + 摘除上游 `/ralph-loop` 依赖(supersedes ADR 0036)
|
|
137
|
+
- `workflows/judgments/parallelism-gate.yaml` triggers.completion-gate-wrapper +
|
|
120
138
|
agent-teams-upgrade + subagent-default + main-session-fallback
|
|
121
|
-
- `workflows/capabilities.yaml` —
|
|
139
|
+
- `workflows/capabilities.yaml` — completion-gate + agent-teams-{create,send-message,shutdown}
|
|
122
140
|
+ planning-with-files entries
|
|
123
141
|
- `workflows/defaults.yaml` — ralph_max_iterations.task-deliver.* values (T3.4.W2.2 followup)
|
|
124
142
|
- `docs/WORKFLOW.md` — 4-stage workflow mermaid + Stage ③ Execute 章节
|