harnessed 2.0.1 → 3.0.1

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 (68) hide show
  1. package/README.md +246 -47
  2. package/dist/cli.mjs +416 -98
  3. package/dist/cli.mjs.map +1 -1
  4. package/dist/index.mjs +1 -1
  5. package/dist/index.mjs.map +1 -1
  6. package/package.json +1 -1
  7. package/workflows/capabilities.yaml +468 -0
  8. package/workflows/defaults.yaml +71 -4
  9. package/workflows/disciplines/karpathy.yaml +47 -0
  10. package/workflows/disciplines/language.yaml +38 -0
  11. package/workflows/disciplines/operational.yaml +61 -0
  12. package/workflows/disciplines/output-style.yaml +62 -0
  13. package/workflows/disciplines/priority.yaml +28 -0
  14. package/workflows/disciplines/protocols.yaml +70 -0
  15. package/workflows/discuss/auto/.gitkeep +0 -0
  16. package/workflows/discuss/auto/SKILL.md +63 -0
  17. package/workflows/discuss/auto/workflow.yaml +40 -0
  18. package/workflows/discuss/phase/SKILL.md +61 -0
  19. package/workflows/discuss/phase/workflow.yaml +35 -0
  20. package/workflows/discuss/strategic/SKILL.md +66 -0
  21. package/workflows/discuss/strategic/workflow.yaml +47 -0
  22. package/workflows/discuss/subtask/SKILL.md +67 -0
  23. package/workflows/discuss/subtask/workflow.yaml +33 -0
  24. package/workflows/judgments/stage-routing.yaml +93 -0
  25. package/workflows/judgments/web-design-routing.yaml +37 -0
  26. package/workflows/judgments/web-search-routing.yaml +52 -0
  27. package/workflows/judgments/web-testing-routing.yaml +50 -0
  28. package/workflows/plan/architecture/SKILL.md +62 -0
  29. package/workflows/plan/architecture/workflow.yaml +33 -0
  30. package/workflows/plan/auto/.gitkeep +0 -0
  31. package/workflows/plan/auto/SKILL.md +63 -0
  32. package/workflows/plan/auto/workflow.yaml +41 -0
  33. package/workflows/plan/phase/SKILL.md +64 -0
  34. package/workflows/plan/phase/workflow.yaml +37 -0
  35. package/workflows/research/SKILL.md +6 -2
  36. package/workflows/research/workflow.yaml +34 -3
  37. package/workflows/retro/SKILL.md +68 -0
  38. package/workflows/retro/workflow.yaml +40 -0
  39. package/workflows/task/auto/.gitkeep +0 -0
  40. package/workflows/task/auto/SKILL.md +68 -0
  41. package/workflows/task/auto/workflow.yaml +57 -0
  42. package/workflows/task/clarify/SKILL.md +83 -0
  43. package/workflows/task/clarify/workflow.yaml +39 -0
  44. package/workflows/task/code/SKILL.md +89 -0
  45. package/workflows/task/code/workflow.yaml +55 -0
  46. package/workflows/task/deliver/SKILL.md +118 -0
  47. package/workflows/task/deliver/workflow.yaml +77 -0
  48. package/workflows/task/test/SKILL.md +93 -0
  49. package/workflows/task/test/workflow.yaml +44 -0
  50. package/workflows/verify/auto/.gitkeep +0 -0
  51. package/workflows/verify/auto/SKILL.md +77 -0
  52. package/workflows/verify/auto/workflow.yaml +74 -0
  53. package/workflows/verify/code-review/SKILL.md +69 -0
  54. package/workflows/verify/code-review/workflow.yaml +32 -0
  55. package/workflows/verify/design/SKILL.md +72 -0
  56. package/workflows/verify/design/workflow.yaml +33 -0
  57. package/workflows/verify/multispec/SKILL.md +86 -0
  58. package/workflows/verify/multispec/workflow.yaml +58 -0
  59. package/workflows/verify/paranoid/SKILL.md +71 -0
  60. package/workflows/verify/paranoid/workflow.yaml +30 -0
  61. package/workflows/verify/progress/SKILL.md +67 -0
  62. package/workflows/verify/progress/workflow.yaml +44 -0
  63. package/workflows/verify/qa/SKILL.md +73 -0
  64. package/workflows/verify/qa/workflow.yaml +31 -0
  65. package/workflows/verify/security/SKILL.md +67 -0
  66. package/workflows/verify/security/workflow.yaml +31 -0
  67. package/workflows/verify/simplify/SKILL.md +67 -0
  68. package/workflows/verify/simplify/workflow.yaml +31 -0
@@ -0,0 +1,55 @@
1
+ # workflows/task/code/workflow.yaml — Phase v3.0-3.4 W0 T3.4.W0.7 (D-09 + D-05 + D-15)
2
+ #
3
+ # Stage ③.b 子任务编码 — karpathy 4 心法 always-on (Think Before Coding / Simplicity First /
4
+ # Surgical Changes / Goal-Driven Execution) + mattpocock conditional route (zoom-out 陌生 /
5
+ # improve-codebase-architecture 周期审查 / diagnose bug root cause unknown)。
6
+ # 02-progress: planning-with-files Claude Code plugin /plan slash cmd 更新 progress.md
7
+ # (per D-15 + Q-AUDIT-5a Option A — plugin 真接, NOT npm SDK NOT fs.writeFile self-impl)。
8
+ #
9
+ # Sister refs:
10
+ # - .planning/phase-v3.0-3.2/RESEARCH-workflows.md § Area 2 task/code sub yaml example
11
+ # - ~/.claude/CLAUDE.md "Execute 阶段" 节 karpathy 4 心法 + mattpocock 招式按需召唤
12
+ # - workflows/capabilities.yaml zoom-out + improve-codebase-architecture + diagnose +
13
+ # planning-with-files (Phase 2.3 W0.1 SHIPPED)
14
+ # - workflows/disciplines/karpathy.yaml (Phase 3.3 W0.4 SHIPPED, L0 substrate always-on)
15
+ # - src/workflow/schema/workflow.ts WorkflowSchemaV3 (Phase 3.3 W0.5 SHIPPED)
16
+ #
17
+ # disciplines_applied: 6 default 全开 per D-09 L0 Discipline Substrate always-on
18
+ # tools_available: 4 entry ∈ capabilities.yaml entry set (T3.3.W0.10 Contract C1 catch)
19
+
20
+ schema_version: harnessed.workflow.v3
21
+ workflow: task-code
22
+ description: |
23
+ Stage ③.b 子任务编码 — karpathy 4 心法 always-on + mattpocock conditional route
24
+ (zoom-out 陌生模块 / improve-codebase-architecture 周期审查 / diagnose bug root cause
25
+ unknown)。02-progress: planning-with-files Claude Code plugin slash cmd `/plan`
26
+ 更新 progress.md 跟踪 subtask 进度 (per D-15 + Q-AUDIT-5a Option A LOCKED)。
27
+
28
+ disciplines_applied: [karpathy, output-style, language, operational, priority, protocols]
29
+ tools_available:
30
+ - zoom-out
31
+ - improve-codebase-architecture
32
+ - diagnose
33
+ - planning-with-files
34
+
35
+ phases:
36
+ - id: 01-code
37
+ name: code (karpathy 心法 always-on + mattpocock conditional route)
38
+ upstream: karpathy
39
+ model: sonnet
40
+ max_iterations: '{{ defaults.ralph_max_iterations.task-code.01-code }}'
41
+ invokes_tools:
42
+ - if: 'phase.unfamiliar_module == true'
43
+ tool: zoom-out
44
+ - if: 'phase.architecture_health_audit == true'
45
+ tool: improve-codebase-architecture
46
+ - if: 'subtask.bug_root_cause_unknown == true'
47
+ tool: diagnose
48
+
49
+ - id: 02-progress
50
+ name: progress (planning-with-files /plan — update progress.md)
51
+ upstream: planning-with-files
52
+ capability: '{{ capabilities.planning-with-files.cmd }}'
53
+ invokes: '/plan'
54
+ model: haiku
55
+ artifacts_expected: [progress.md]
@@ -0,0 +1,118 @@
1
+ ---
2
+ name: task-deliver
3
+ description: |
4
+ task-deliver workflow v3 — Stage ③.d 子任务交付 sub-workflow (ralph-loop COMPLETE
5
+ wrapper + Agent Teams conditional escalation + R20.10 explicit max_iterations_exceeded
6
+ fallback)。2-phase composition: 01-deliver (ralph-loop SDK wrapper with completion_promise
7
+ verbatim "COMPLETE" + parallelism judgments.parallelism-gate.ralph-loop-wrapper.fires +
8
+ fallback emit_warning_and_halt exit_code 1) → 02-progress-mark (Claude Code plugin
9
+ /plan mark subtask complete in progress.md)。
10
+ schema_version: harnessed.workflow.v3 with disciplines_applied [6] + tools_available
11
+ [ralph-loop, agent-teams-create, agent-teams-send-message, agent-teams-shutdown,
12
+ planning-with-files]. Triggered by harnessed CLI `harnessed task-deliver --task <text>`
13
+ or slash command `/task-deliver` after `harnessed setup`.
14
+ trigger_phrases:
15
+ - "deliver this subtask"
16
+ - "task-deliver workflow"
17
+ - "Stage 3 deliver"
18
+ - "ralph-loop COMPLETE"
19
+ - "跑 task-deliver"
20
+ ---
21
+
22
+ # task-deliver workflow (v3)
23
+
24
+ ## Overview
25
+
26
+ 2-phase sub-workflow mapping the user's CLAUDE.md Stage ③.d 子任务交付 discipline
27
+ 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 ralph-loop SDK wrapper + D-11 Agent
29
+ Teams 升级 5 触发 OR-chain + R20.10 explicit max_iterations_exceeded handler).
30
+
31
+ | phase | id | upstream | model | capability / args / parallelism / fallback |
32
+ | ----- | -- | -------- | ----- | ------------------------------------------ |
33
+ | 1 | `01-deliver` | ralph-loop | haiku | `{{ capabilities.ralph-loop.cmd }}` + `args: {completion_promise: COMPLETE, max_iterations: ...}` + `parallelism: judgments.parallelism-gate.ralph-loop-wrapper.fires` + `fallback.max_iterations_exceeded.action: emit_warning_and_halt` |
34
+ | 2 | `02-progress-mark` | planning-with-files | haiku | `{{ capabilities.planning-with-files.cmd }}` / `invokes: /plan` / `artifacts_expected: [progress.md]` |
35
+
36
+ Per-phase config loads from `workflows/task/deliver/workflow.yaml`; engine.runRouting
37
+ spawns each phase as a sub-agent via `@anthropic-ai/claude-agent-sdk` 0.3.142+.
38
+
39
+ ## Phase 01 ralph-loop COMPLETE wrapper (R20.10 + D-10 + ADR 0011)
40
+
41
+ ralph-loop SDK wrapper 保 completion-promise verbatim string `"COMPLETE"` — sub-task
42
+ 被认为完成的判据是子任务输出包含 verbatim "COMPLETE" string (NOT 启发式 / NOT
43
+ LLM-as-judge). Sister capabilities.yaml `ralph-loop` entry impl `bundled-skill` +
44
+ `sdk_ref: src/routing/lib/ralphLoop.ts` (Phase 2.2 v0.2.0 ship)。
45
+
46
+ ### Parallelism — ralph-loop 正交 wrapper
47
+
48
+ `parallelism: judgments.parallelism-gate.ralph-loop-wrapper.fires` ref — per R20.10
49
+ + D-10, ralph-loop 是 **正交 wrapper** 套在 subagent-default / agent-teams-upgrade /
50
+ main-session-fallback 任 1 mode 外层 (NOT 互斥触发器, 而是 `wraps:` orthogonal field
51
+ in parallelism-gate.yaml L42-45). Runtime engine 评估 wrapping mode 后 spawn 相应
52
+ execution unit + 套 ralph-loop completion check。
53
+
54
+ ### Agent Teams conditional escalation (D-11 + agent-teams.md 5 OR-chain)
55
+
56
+ 5 升级触发 (per capabilities.yaml `agent-teams-create.fires_when` + agent-teams.md):
57
+ 1. `teammate_send_message_needed == true` — teammate 间 SendMessage 互通 (NOT fire-and-forget)
58
+ 2. `subagent_context_overflow == true` — subagent 撞 context 上限
59
+ 3. `shared_task_list == true` — 多 teammate 共享 task list 自协调
60
+ 4. `opposing_hypothesis_debate == true` — 对立假设辩论
61
+ 5. `fullstack_three_way == true` — 全栈三路协同
62
+
63
+ 任 1 fire → escalate subagent fan-out → Agent Teams Pattern A/B/C。Cleanup mandatory
64
+ per agent-teams.md 防呆清单 (SendMessage shutdown_request + TeamDelete) — engine-level
65
+ wiring, NOT yaml schema scope。
66
+
67
+ ### R20.10 explicit max_iterations_exceeded handler (NOT silent abort)
68
+
69
+ phase.fallback.max_iterations_exceeded = `{action: emit_warning_and_halt, message,
70
+ exit_code: 1}` — schema-enforced via FallbackMaxIterationsExceeded Type.Literal(
71
+ 'emit_warning_and_halt') (workflow.ts L70-77). Sister Phase 2.4 W1.2 fallbackHandlers.ts
72
+ engine.ts wire — ralph-loop 撞 max_iterations 时 explicit emit warning + halt with
73
+ exit_code 1, NOT silent abort / continue。
74
+
75
+ Brief enforcement W0.9: ✅ ralph-loop completion_promise COMPLETE / ✅ parallelism-gate
76
+ ref / ✅ R20.10 explicit max_iterations_exceeded handler。
77
+
78
+ ## Phase 02 progress-mark planning-with-files (D-15 + Q-AUDIT-5a Option A)
79
+
80
+ 02-progress-mark invokes Claude Code plugin slash cmd `/plan` to mark subtask complete
81
+ in `progress.md` — sister Phase 01-code progress update pattern, last call in Stage
82
+ ③ task chain。Plugin path `~/.claude/plugins/cache/planning-with-files/
83
+ planning-with-files/2.34.0/` verified (2026-05-20)。
84
+
85
+ ## CLI invocation
86
+
87
+ ```bash
88
+ # Dry-run preview — arbitrate-only, never spawns SDK.
89
+ harnessed task-deliver --task "<text>" --dry-run --non-interactive
90
+
91
+ # Apply path — real SDK spawn + 2-phase chain (ralph-loop COMPLETE + progress mark).
92
+ harnessed task-deliver --task "<text>" --apply
93
+ ```
94
+
95
+ ## Forward-looking note
96
+
97
+ The `trigger_phrases:` frontmatter is active after `harnessed setup` copies this
98
+ SKILL.md to `~/.claude/skills/task-deliver/` — Claude Code then loads the slash
99
+ command `/task-deliver` automatically (Gap B fix — sister v1.0.2 mechanism).
100
+
101
+ ## References
102
+
103
+ - D-09 — L0 Discipline Substrate always-on (6 disciplines)
104
+ - D-10 — ralph-loop 真接 SDK wrapper (NOT mock reference; v0.2.0 ship)
105
+ - D-11 — Agent Teams 升级 5 触发 OR-chain per ~/.claude/rules/agent-teams.md
106
+ - R20.10 — ralph-loop max_iterations_exceeded explicit emit_warning_and_halt
107
+ (acceptance c "NOT silent abort"); ralph-loop 正交 wrapper wraps 3 mode
108
+ - D-02 — SKILL.md `name:` bare slash cmd (`task-deliver` NOT `task/deliver`) per ADR 0030
109
+ - ADR 0011 — SDK + ralph-loop integration v0.2.0 baseline
110
+ - ~/.claude/CLAUDE.md "Execute 阶段" 节 ralph-loop 至 verbatim COMPLETE +
111
+ `子任务并行执行机制` Agent Teams 升级路由
112
+ - ~/.claude/rules/agent-teams.md — Pattern A/B/C + 防呆清单 cleanup mandatory
113
+ - `workflows/judgments/parallelism-gate.yaml` triggers.ralph-loop-wrapper +
114
+ agent-teams-upgrade + subagent-default + main-session-fallback
115
+ - `workflows/capabilities.yaml` — ralph-loop + agent-teams-{create,send-message,shutdown}
116
+ + planning-with-files entries
117
+ - `workflows/defaults.yaml` — ralph_max_iterations.task-deliver.* values (T3.4.W2.2 followup)
118
+ - `docs/WORKFLOW.md` — 4-stage workflow mermaid + Stage ③ Execute 章节
@@ -0,0 +1,77 @@
1
+ # workflows/task/deliver/workflow.yaml — Phase v3.0-3.4 W0 T3.4.W0.9
2
+ # (D-09 + D-10 + D-11 + R20.10 + ADR 0011 ralph-loop 真接 SDK wrapper)
3
+ #
4
+ # Stage ③.d 子任务交付 — ralph-loop COMPLETE wrapper 保 completion-promise verbatim
5
+ # "COMPLETE" (R20.10 + D-10 v0.2.0 ralph-loop SDK pattern)。Parallelism: subagent
6
+ # default fan-out OR Agent Teams 升级 (5 触发 OR-chain per ~/.claude/rules/agent-teams.md
7
+ # + D-11)。02-progress-mark: planning-with-files /plan 更新 progress.md 标记完成。
8
+ #
9
+ # Brief enforcement (W0.9 spec MUST include):
10
+ # - ralph-loop completion_promise = COMPLETE (R20.10 verbatim acceptance string)
11
+ # - parallelism-gate ref: judgments.parallelism-gate.ralph-loop-wrapper.fires
12
+ # (R20.10 ralph-loop 正交 wraps subagent-default / agent-teams-upgrade / main-session-fallback)
13
+ # - Agent Teams route conditional via on[] clause when 5 escalation triggers fire
14
+ # - R20.10 explicit max_iterations_exceeded handler:
15
+ # {action: emit_warning_and_halt, message, exit_code: 1} — NOT silent abort
16
+ # (sister Phase 2.4 W1.2 fallbackHandlers.ts engine.ts wire pattern)
17
+ #
18
+ # Sister refs:
19
+ # - .planning/phase-v3.0-3.2/RESEARCH-workflows.md § Area 2 task/deliver sub yaml example
20
+ # - workflows/judgments/parallelism-gate.yaml triggers.ralph-loop-wrapper (Phase 2.3 W0.2 SHIPPED)
21
+ # - workflows/capabilities.yaml ralph-loop + agent-teams-{create,send-message,shutdown} +
22
+ # planning-with-files (Phase 2.3 W0.1 + 3.3 W0.2 SHIPPED)
23
+ # - ~/.claude/rules/agent-teams.md 5 升级触发 OR-chain (teammate_send_message_needed /
24
+ # subagent_context_overflow / shared_task_list / opposing_hypothesis_debate / fullstack_three_way)
25
+ # - src/workflow/schema/workflow.ts WorkflowSchemaV3 FallbackMaxIterationsExceeded
26
+ # Type.Literal('emit_warning_and_halt') (Phase 3.3 W0.5 SHIPPED)
27
+ #
28
+ # disciplines_applied: 6 default 全开 per D-09 L0 Discipline Substrate always-on
29
+ # tools_available: 5 entry ∈ capabilities.yaml entry set (T3.3.W0.10 Contract C1 catch)
30
+
31
+ schema_version: harnessed.workflow.v3
32
+ workflow: task-deliver
33
+ description: |
34
+ Stage ③.d 子任务交付 — ralph-loop COMPLETE wrapper 保 completion-promise verbatim
35
+ "COMPLETE" (R20.10 + D-10 v0.2.0 ralph-loop SDK pattern)。Parallelism subagent
36
+ default fan-out OR Agent Teams 升级 (5 触发 OR-chain per ~/.claude/rules/agent-teams.md
37
+ + D-11)。R20.10 explicit max_iterations_exceeded handler: emit_warning_and_halt
38
+ exit_code 1 (NOT silent abort, sister Phase 2.4 W1.2 fallbackHandlers.ts engine.ts
39
+ wire pattern)。Cleanup mandatory when Agent Teams escalation path fires (shutdown_request
40
+ + TeamDelete per agent-teams.md 防呆清单)。
41
+
42
+ disciplines_applied: [karpathy, output-style, language, operational, priority, protocols]
43
+ tools_available:
44
+ - ralph-loop
45
+ - agent-teams-create
46
+ - agent-teams-send-message
47
+ - agent-teams-shutdown
48
+ - planning-with-files
49
+
50
+ phases:
51
+ - id: 01-deliver
52
+ name: deliver (ralph-loop COMPLETE wrapper + Agent Teams conditional escalation)
53
+ upstream: ralph-loop
54
+ capability: '{{ capabilities.ralph-loop.cmd }}'
55
+ model: haiku
56
+ args:
57
+ completion_promise: COMPLETE
58
+ max_iterations: '{{ defaults.ralph_max_iterations.task-deliver.01-deliver }}'
59
+ parallelism: judgments.parallelism-gate.ralph-loop-wrapper.fires
60
+ on:
61
+ - if: 'subtask.lines >= 20 and subtask.type != "single_command_query"'
62
+ invoke: '{{ capabilities.ralph-loop.cmd }}'
63
+ - if: 'subtask.lines < 20 or subtask.type == "single_command_query"'
64
+ action: skip
65
+ fallback:
66
+ max_iterations_exceeded:
67
+ action: emit_warning_and_halt
68
+ message: 'ralph-loop max-iterations exceeded for task-deliver. Sub-task likely incomplete — explicit halt per R20.10 (NOT silent abort).'
69
+ exit_code: 1
70
+
71
+ - id: 02-progress-mark
72
+ name: progress-mark (planning-with-files /plan — mark subtask complete in progress.md)
73
+ upstream: planning-with-files
74
+ capability: '{{ capabilities.planning-with-files.cmd }}'
75
+ invokes: '/plan'
76
+ model: haiku
77
+ artifacts_expected: [progress.md]
@@ -0,0 +1,93 @@
1
+ ---
2
+ name: task-test
3
+ description: |
4
+ task-test workflow v3 — Stage ③.c 子任务测试 sub-workflow (superpowers TDD
5
+ red-green-refactor 强制 + diagnose conditional invoke)。Single-phase composition:
6
+ 01-test (capability `superpowers:test-driven-development` + gate
7
+ judgments.tdd-gate.tdd-strongly-suggested.fires + invokes_tools[{if: test_fail,
8
+ tool: diagnose}])。Alias /tdd (mattpocock-skills) 可替代 superpowers TDD per D-13。
9
+ schema_version: harnessed.workflow.v3 with disciplines_applied [6] + tools_available
10
+ [tdd, diagnose]. Triggered by harnessed CLI `harnessed task-test --task <text>` or
11
+ slash command `/task-test` after `harnessed setup`.
12
+ trigger_phrases:
13
+ - "test this subtask"
14
+ - "task-test workflow"
15
+ - "Stage 3 test"
16
+ - "TDD red-green-refactor"
17
+ - "跑 task-test"
18
+ ---
19
+
20
+ # task-test workflow (v3)
21
+
22
+ ## Overview
23
+
24
+ Single-phase sub-workflow mapping the user's CLAUDE.md Stage ③.c 子任务测试 + TDD
25
+ 强烈建议开启 discipline onto the harnessed runtime, fully `harnessed.workflow.v3`
26
+ schema (Phase v3.0-3.4 W0 T3.4.W0.8 — D-09 L0 Discipline Substrate + D-04 gate ref
27
+ + D-05 conditional `invokes_tools` + D-13 tdd capability alias).
28
+
29
+ | phase | id | upstream | model | capability / invokes_tools | gate |
30
+ | ----- | -- | -------- | ----- | -------------------------- | ---- |
31
+ | 1 | `01-test` | superpowers | sonnet | `{{ capabilities.tdd.cmd }}` + `invokes_tools: [{if: test_fail == true, tool: diagnose}]` | `judgments.tdd-gate.tdd-strongly-suggested.fires` |
32
+
33
+ Per-phase config loads from `workflows/task/test/workflow.yaml`; engine.runRouting
34
+ spawns each phase as a sub-agent via `@anthropic-ai/claude-agent-sdk` 0.3.142+.
35
+
36
+ ## TDD gate (D-04 + judgments/tdd-gate.yaml 6 fires_when + 3 skips_when)
37
+
38
+ Gate `judgments.tdd-gate.tdd-strongly-suggested.fires` 机器化 CLAUDE.md
39
+ 「Execute 阶段」 TDD 强烈建议开启 节 6 OR-chain:
40
+ - `subtask.is_core_business_logic == true`
41
+ - `subtask.is_algorithm == true`
42
+ - `subtask.is_data_processing == true`
43
+ - `subtask.regression_risk == 'high'`
44
+ - `subtask.reliability_required == true`
45
+
46
+ Skips when (per tdd-gate.yaml skips_when):
47
+ - `subtask.type in ['crud', 'ui_polish', 'docs_only']`
48
+
49
+ Gate 4-level ref pre-resolved by `judgmentResolver` (T2.3.W0.4 SHIPPED) BEFORE
50
+ expr-eval evaluation — runtime engine 跳过 phase 当 gate 不 fire 时。
51
+
52
+ ## D-13 tdd capability alias
53
+
54
+ Capability `tdd` (per capabilities.yaml L346-359) 主 impl `superpowers:test-driven-
55
+ development`, alias `[{impl: mattpocock-skills, cmd: /tdd}]` — 两者可替代 per D-13
56
+ LOCKED 决策。`{{ capabilities.tdd.cmd }}` 默认 resolve 至 superpowers
57
+ SDK, 用户 explicit signal 可切换 mattpocock /tdd alias path。
58
+
59
+ ## Conditional diagnose invoke (D-05 invokes_tools)
60
+
61
+ Phase 01-test 条件性 fire `diagnose` (capabilities.yaml L55-64 mattpocock-skills
62
+ /diagnose) when `test_fail == true` — sister CLAUDE.md "系统化排错" pattern;
63
+ test fail 时进入 diagnose loop (reproduce → minimise → hypothesise → instrument →
64
+ fix → regression-test), 测试通过则 skip diagnose entirely。
65
+
66
+ ## CLI invocation
67
+
68
+ ```bash
69
+ # Dry-run preview — arbitrate-only, never spawns SDK.
70
+ harnessed task-test --task "<text>" --dry-run --non-interactive
71
+
72
+ # Apply path — real SDK spawn + 1-phase (TDD gate evaluation conditional).
73
+ harnessed task-test --task "<text>" --apply
74
+ ```
75
+
76
+ ## Forward-looking note
77
+
78
+ The `trigger_phrases:` frontmatter is active after `harnessed setup` copies this
79
+ SKILL.md to `~/.claude/skills/task-test/` — Claude Code then loads the slash
80
+ command `/task-test` automatically (Gap B fix — sister v1.0.2 mechanism).
81
+
82
+ ## References
83
+
84
+ - D-09 — L0 Discipline Substrate always-on
85
+ - D-04 — `gate` 4-level ref pre-resolved by `judgmentResolver`
86
+ - D-05 — phase-level `invokes_tools` conditional tool fire
87
+ - D-13 — tdd capability 2 impl 候选 alias (superpowers 主 + mattpocock /tdd 备)
88
+ - D-02 — SKILL.md `name:` bare slash cmd (`task-test` NOT `task/test`) per ADR 0030
89
+ - ~/.claude/CLAUDE.md "Execute 阶段" TDD 强烈建议开启 6 触发 + 3 跳过
90
+ - `workflows/judgments/tdd-gate.yaml` triggers.tdd-strongly-suggested
91
+ - `workflows/capabilities.yaml` — tdd (superpowers + mattpocock alias) + diagnose entries
92
+ - `workflows/defaults.yaml` — ralph_max_iterations.task-test.* values (T3.4.W2.2 followup)
93
+ - `docs/WORKFLOW.md` — 4-stage workflow mermaid + Stage ③ Execute 章节
@@ -0,0 +1,44 @@
1
+ # workflows/task/test/workflow.yaml — Phase v3.0-3.4 W0 T3.4.W0.8 (D-09 + D-04 + D-05 + D-13)
2
+ #
3
+ # Stage ③.c 子任务测试 — superpowers:test-driven-development red-green-refactor 强制
4
+ # (核心业务逻辑 / 算法 / 数据处理 / 回归 risk high / reliability required 触发 tdd-gate),
5
+ # 其他可选 mattpocock /tdd alias (per D-13 capabilities.yaml `tdd` entry aliases)。
6
+ # Conditional fire: diagnose 当 test_fail == true 时 invoke (D-05 invokes_tools)。
7
+ #
8
+ # Sister refs:
9
+ # - .planning/phase-v3.0-3.2/RESEARCH-workflows.md § Area 2 task/test sub yaml example
10
+ # - workflows/judgments/tdd-gate.yaml triggers.tdd-strongly-suggested (Phase 2.3 W0.2 SHIPPED)
11
+ # - workflows/capabilities.yaml tdd + diagnose (Phase 2.3 W0.1 SHIPPED + D-13 alias)
12
+ # - ~/.claude/CLAUDE.md "Execute 阶段" 节 TDD 强烈建议开启 6 触发 + 3 跳过
13
+ # - src/workflow/schema/workflow.ts WorkflowSchemaV3 (Phase 3.3 W0.5 SHIPPED)
14
+ #
15
+ # Brief enforcement:
16
+ # - W0.8 必带 tdd-gate ref: phase.gate: judgments.tdd-gate.tdd-strongly-suggested.fires
17
+ # - W0.8 必带 diagnose conditional invoke: invokes_tools[{if: 'test_fail == true', tool: diagnose}]
18
+ #
19
+ # disciplines_applied: 6 default 全开 per D-09 L0 Discipline Substrate always-on
20
+ # tools_available: 2 entry ∈ capabilities.yaml entry set (T3.3.W0.10 Contract C1 catch)
21
+
22
+ schema_version: harnessed.workflow.v3
23
+ workflow: task-test
24
+ description: |
25
+ Stage ③.c 子任务测试 — superpowers TDD red-green-refactor 强制 (核心业务 / 算法 /
26
+ 数据处理 / 回归 risk high / reliability required, 6 fires_when OR-chain per
27
+ ~/.claude/CLAUDE.md), 其他可选 mattpocock /tdd alias。Conditional diagnose
28
+ invoke when test_fail (D-05 invokes_tools phase-level fire). Gate:
29
+ judgments.tdd-gate.tdd-strongly-suggested.fires (4-level ref, pre-resolved per D-04)。
30
+
31
+ disciplines_applied: [karpathy, output-style, language, operational, priority, protocols]
32
+ tools_available: [tdd, diagnose]
33
+
34
+ phases:
35
+ - id: 01-test
36
+ name: test (superpowers TDD red-green-refactor + diagnose conditional invoke)
37
+ upstream: superpowers
38
+ capability: '{{ capabilities.tdd.cmd }}'
39
+ model: sonnet
40
+ gate: judgments.tdd-gate.tdd-strongly-suggested.fires
41
+ invokes_tools:
42
+ - if: 'test_fail == true'
43
+ tool: diagnose
44
+ max_iterations: '{{ defaults.ralph_max_iterations.task-test.01-test }}'
File without changes
@@ -0,0 +1,77 @@
1
+ ---
2
+ name: verify
3
+ description: |
4
+ Stage ④ Verify master orchestrator — 7 sub conditional per ~/.claude/CLAUDE.md "Verify 阶段"
5
+ verbatim: progress 必跑 → code-review 并行 → paranoid 关键模块强制 → qa/security/design 可选
6
+ 并行 conditional → simplify 末尾 → multispec 关键发布 Pattern C 4-specialist Agent Team。
7
+ schema_version: harnessed.workflow.v3 with delegates_to (7 sub: progress serial order 1 +
8
+ 5 parallel conditional + simplify serial order 99) + disciplines_applied (6 default) +
9
+ tools_available (10 entry)。Triggered by harnessed CLI `harnessed verify --phase <num>` or
10
+ slash command `/verify` (bare per ADR 0030 namespace policy D-02 LOCK) after `harnessed setup`.
11
+ trigger_phrases:
12
+ - "verify"
13
+ - "验证阶段"
14
+ - "stage 4 verify"
15
+ - "verify work"
16
+ - "代码审查 + 简化"
17
+ ---
18
+
19
+ # verify master orchestrator (v3)
20
+
21
+ ## Overview
22
+
23
+ 4-stage cadence Stage ④ master orchestrator delegating to 7 sub-workflows
24
+ (per ~/.claude/CLAUDE.md "Verify 阶段" 节 verbatim — 9-phase composition compressed
25
+ into 7 sub delegation via stage-routing.yaml):
26
+
27
+ | order/mode | sub | gate ref | mode | when fires |
28
+ | ---------- | --- | -------- | ---- | ---------- |
29
+ | 1 (serial) | `progress` | (unconditional — verify 起点) | serial | always when stage=='verify' |
30
+ | parallel | `code-review` | (unconditional — multi-agent fan-out) | parallel | always |
31
+ | parallel | `paranoid` | `judgments.stage-routing.verify-paranoid-critical.fires` | parallel | phase.is_critical_module == true |
32
+ | parallel | `qa` | `judgments.stage-routing.verify-qa-ui.fires` | parallel | phase.has_ui_changes == true |
33
+ | parallel | `security` | `judgments.stage-routing.verify-security-secrets.fires` | parallel | phase.has_auth_or_secrets == true |
34
+ | parallel | `design` | `judgments.stage-routing.verify-design-changes.fires` | parallel | phase.has_design_changes == true |
35
+ | parallel | `multispec` | `judgments.stage-routing.verify-multispec-critical-release.fires` | parallel | is_critical_release == true (Pattern C 4-specialist Agent Team) |
36
+ | 99 (serial) | `simplify` | (unconditional — 末尾 tail) | serial | always — code-simplifier 末尾移除重复 / 多余逻辑 |
37
+
38
+ Engine runtime per T3.5.W0.1 `runMasterOrchestrator`:
39
+ - **serial chain**: progress (order 1) 起点 → ... → simplify (order 99) 末尾收尾
40
+ - **parallel fan-out**: 5 conditional sub (code-review + paranoid + qa + security + design + multispec)
41
+ spawn 并发, 按 gate-eval 结果 fire-or-skip
42
+ - K9 invariant enforced: every serial mode delegate carries explicit `order`
43
+
44
+ ## Verify cadence (sister CLAUDE.md "Verify 阶段" verbatim)
45
+
46
+ 1. 子任务完成后立即 `/gsd-verify-work` + `/gsd-progress` (sub progress 起点必跑串行)
47
+ 2. 项目 / 大功能整体完成后:
48
+ - 先 `code-review` 多 Agent 并行 (sub code-review)
49
+ - **关键模块强制** `/review` Paranoid Staff Engineer (sub paranoid, gate is_critical_module)
50
+ - 可选 `/qa` (sub qa, gate has_ui_changes) / `/cso` (sub security, gate has_auth_or_secrets) / `/design-review` (sub design, gate has_design_changes)
51
+ - **关键发布 / 大重构 PR** 升级 4-specialist Agent Team Pattern C (sub multispec, gate critical-release-upgrade)
52
+ - 再 `code-simplifier` 末尾 (sub simplify, serial order 99)
53
+
54
+ ## Capability refs
55
+
56
+ Sister `workflows/capabilities.yaml`:
57
+ - `gsd-verify-work` + `gsd-progress` — Bucket 2 (progress sub upstream)
58
+ - `code-review` + `code-simplifier` — Bucket 1 mattpocock (code-review + simplify subs)
59
+ - `gstack-review` + `gstack-qa` + `gstack-cso` + `gstack-design-review` — Bucket 3 治理关卡 (paranoid/qa/security/design subs)
60
+ - `agent-teams-create` — Bucket 5 agent-platform (multispec Pattern C 4-specialist team)
61
+ - `planning-with-files` — Bucket 4 核心 (progress.md sink throughout)
62
+
63
+ ## Invocation
64
+
65
+ - CLI: `harnessed verify --phase <num>`
66
+ - Slash command: `/verify` (bare per ADR 0030 namespace policy D-02 LOCK after `harnessed setup`)
67
+
68
+ ## References
69
+
70
+ - D-01 master orchestrator delegation pattern
71
+ - D-02 bare slash cmd convention (ADR 0030 namespace policy LOCK)
72
+ - D-12 gstack 治理关卡 ref (paranoid / qa / security / design subs)
73
+ - ~/.claude/CLAUDE.md "Verify 阶段" 节 verbatim
74
+ - ~/.claude/rules/agent-teams.md Pattern C 多维度审查 (multispec sub 4-specialist 互相质询)
75
+ - workflows/judgments/stage-routing.yaml — verify-* 6 triggers (7 sub delegation)
76
+ - workflows/verify/{progress,code-review,paranoid,qa,security,design,simplify,multispec}/workflow.yaml
77
+ — 8 sub-workflow Phase 3.4 SHIPPED
@@ -0,0 +1,74 @@
1
+ # workflows/verify/auto/workflow.yaml — Phase v3.0-3.5 W1 T3.5.W1.4
2
+ #
3
+ # Stage ④ Verify master orchestrator — 7 sub conditional per ~/.claude/CLAUDE.md "Verify 阶段"
4
+ # verbatim + RESEARCH-workflows § Area 2 verify master:
5
+ # progress 必跑 (serial order 1) →
6
+ # code-review 并行 (parallel) +
7
+ # paranoid 关键模块 (parallel + gate is-critical-module) +
8
+ # qa+security+design 可选 conditional (parallel) +
9
+ # simplify 末尾 (serial order 99) +
10
+ # multispec 关键发布 Pattern C (parallel + gate critical-release-upgrade)
11
+ #
12
+ # Sister refs:
13
+ # - ~/.claude/CLAUDE.md "Verify 阶段 (GSD + gstack)" 节 verbatim
14
+ # - workflows/judgments/stage-routing.yaml — verify-* triggers (7 sub delegation)
15
+ # - workflows/judgments/parallelism-gate.yaml — agent-teams-upgrade trigger (multispec gate)
16
+ # - workflows/verify/{progress,code-review,paranoid,qa,security,design,simplify,multispec}/workflow.yaml
17
+ # — 8 sub-workflow Phase 3.4 SHIPPED
18
+ # - workflows/capabilities.yaml — gsd-verify-work + gsd-progress + code-review + gstack-review +
19
+ # gstack-qa + gstack-cso + gstack-design-review + code-simplifier + agent-teams-create +
20
+ # planning-with-files
21
+ # - .planning/phase-v3.0-3.2/RESEARCH-workflows.md § Area 2 Master Orchestrator yaml Examples
22
+ # - src/workflow/schema/workflow.ts WorkflowSchemaV3 + DelegationClause (Phase 3.3 W0.5 SHIPPED)
23
+ #
24
+ # Master invariant (per WorkflowSchemaV3 runtime + check-workflow-schema.mjs K9):
25
+ # - phases 缺省 (master only has delegates_to[])
26
+ # - 7 delegates_to: serial 2 (progress order 1 + simplify order 99) + parallel 5
27
+ # - serial mode 必带 explicit order (K9 invariant T3.3.W0.10)
28
+ # - parallel mode 无 order field 需求
29
+
30
+ schema_version: harnessed.workflow.v3
31
+ workflow: verify
32
+ description: |
33
+ Stage ④ Verify master orchestrator — 7 sub conditional per ~/.claude/CLAUDE.md "Verify 阶段"
34
+ verbatim: progress 必跑串行 → code-review 并行 → paranoid 关键模块强制 → qa/security/design
35
+ 可选 conditional 并行 → simplify 末尾串行 → multispec 关键发布 Pattern C 4-specialist Agent Team。
36
+ serial mode 必带 explicit order (K9 invariant); progress order 1 起点, simplify order 99 末尾。
37
+
38
+ disciplines_applied: [karpathy, output-style, language, operational, priority, protocols]
39
+ tools_available:
40
+ - gsd-verify-work
41
+ - gsd-progress
42
+ - code-review
43
+ - gstack-review
44
+ - gstack-qa
45
+ - gstack-cso
46
+ - gstack-design-review
47
+ - code-simplifier
48
+ - agent-teams-create
49
+ - planning-with-files
50
+
51
+ delegates_to:
52
+ - sub: progress
53
+ mode: serial
54
+ order: 1
55
+ - sub: code-review
56
+ mode: parallel
57
+ - sub: paranoid
58
+ gate: judgments.stage-routing.verify-paranoid-critical.fires
59
+ mode: parallel
60
+ - sub: qa
61
+ gate: judgments.stage-routing.verify-qa-ui.fires
62
+ mode: parallel
63
+ - sub: security
64
+ gate: judgments.stage-routing.verify-security-secrets.fires
65
+ mode: parallel
66
+ - sub: design
67
+ gate: judgments.stage-routing.verify-design-changes.fires
68
+ mode: parallel
69
+ - sub: multispec
70
+ gate: judgments.stage-routing.verify-multispec-critical-release.fires
71
+ mode: parallel
72
+ - sub: simplify
73
+ mode: serial
74
+ order: 99
@@ -0,0 +1,69 @@
1
+ ---
2
+ name: verify-code-review
3
+ description: |
4
+ Stage ④.b verify sub-workflow — code-review 多 agent 并行 fan-out 高置信度 finding
5
+ (subagent default per ~/.claude/CLAUDE.md 子任务并行机制 — Task / Agent 工具 spawn
6
+ 多 subagent fan-out, context 隔离, token 敏感)。
7
+ schema_version: harnessed.workflow.v3 with disciplines_applied (6 default) + tools_available
8
+ (code-review) + 1 phase (parallelism ref judgments.parallelism-gate.subagent-default.fires)。
9
+ Triggered by harnessed CLI `harnessed verify-code-review --phase <num>` or slash command
10
+ `/verify-code-review` after `harnessed setup`.
11
+ trigger_phrases:
12
+ - "verify code review"
13
+ - "代码审查"
14
+ - "multi-agent code review"
15
+ - "并行 review"
16
+ - "跑 verify-code-review"
17
+ ---
18
+
19
+ # verify-code-review workflow (v3)
20
+
21
+ ## Overview
22
+
23
+ 1-phase sub-workflow mapping CLAUDE.md "Verify 阶段 — code-review 多 agent 并行" 章节
24
+ onto harnessed runtime (Phase v3.0-3.4 W0.11 — D-04 Stage ④ Verify 7 sub + 子任务并行
25
+ 机制 subagent default routing 机器化 + Pattern A sub-workflow ship)。
26
+
27
+ | phase | id | upstream | model | capability | parallelism |
28
+ | ----- | -- | -------- | ----- | ---------- | ----------- |
29
+ | 1 | `01-code-review` | mattpocock-skills | sonnet | `{{ capabilities.code-review.cmd }}` | `judgments.parallelism-gate.subagent-default.fires` |
30
+
31
+ Per-phase config loads from `workflows/verify/code-review/workflow.yaml`; engine spawns
32
+ multiple subagent in parallel fan-out (sister `~/.claude/CLAUDE.md` 子任务并行机制 默认 —
33
+ Task / Agent 工具 spawn 多任务并发, context 隔离, summary 折叠回主 context)。
34
+
35
+ ## Capability refs
36
+
37
+ Sister `workflows/capabilities.yaml` entries:
38
+ - `code-review` — Bucket 1 mattpocock 高频招式 (impl: mattpocock-skills, cmd: /code-review)
39
+
40
+ ## Parallelism gate ref
41
+
42
+ Sister `workflows/judgments/parallelism-gate.yaml`:
43
+ - `subagent-default.fires` — `subtask.parallel_count <= 3 and subtask.communication_needed == false`
44
+ (默认 fan-out, focused 任务 research / verify / review 单文件 / 跑测试 / 抓 doc / 探索模块)
45
+
46
+ ## Routing rules
47
+
48
+ 总 fire 当 `phase.stage == 'verify'` 后必跑串行 (verify-progress) 之后并行 fan-out。无 skip
49
+ 条件 — code-review 多 agent 是 verify-work 第 3 phase 默认 fan-out (sister CLAUDE.md verbatim)。
50
+
51
+ ## CLI invocation
52
+
53
+ ```bash
54
+ # Dry-run preview — arbitrate-only, never spawns SDK.
55
+ harnessed verify-code-review --phase <num> --dry-run --non-interactive
56
+
57
+ # Apply path — real SDK spawn + parallel fan-out subagent.
58
+ harnessed verify-code-review --phase <num> --apply
59
+ ```
60
+
61
+ ## References
62
+
63
+ - D-04 Stage ④ Verify 7 sub 分解
64
+ - ~/.claude/CLAUDE.md "Verify 阶段 — code-review 多 agent 并行" verbatim
65
+ - ~/.claude/CLAUDE.md "子任务并行执行机制 — subagent vs Agent Teams 路由" subagent default
66
+ - workflows/capabilities.yaml — code-review
67
+ - workflows/judgments/parallelism-gate.yaml — subagent-default.fires
68
+ - workflows/defaults.yaml — ralph_max_iterations.verify-code-review.* values (W2.2 backfill)
69
+ - workflows/verify-work/workflow.yaml v2 SHIPPED phase 03-code-review-parallel sister verbatim
@@ -0,0 +1,32 @@
1
+ # workflows/verify/code-review/workflow.yaml — Phase v3.0-3.4 W0 T3.4.W0.11
2
+ #
3
+ # Stage ④.b verify sub-workflow — code-review 多 agent 并行 fan-out 高置信度 finding
4
+ # (subagent default per CLAUDE.md 子任务并行机制 — Task / Agent 工具 spawn 多任务 fan-out,
5
+ # context 隔离, token 敏感)。
6
+ #
7
+ # Sister refs:
8
+ # - ~/.claude/CLAUDE.md "Verify 阶段" — "code-review 多 agent 并行" 章节
9
+ # - ~/.claude/CLAUDE.md "子任务并行执行机制 — subagent vs Agent Teams 路由" subagent default
10
+ # - workflows/judgments/parallelism-gate.yaml — subagent-default.fires 默认 fan-out
11
+ # - workflows/capabilities.yaml — code-review (Bucket 1 mattpocock 高频招式)
12
+ # - workflows/verify-work/workflow.yaml v2 SHIPPED phase 03-code-review-parallel sister pattern
13
+ # - .planning/phase-v3.0-3.2/RESEARCH-workflows.md § Area 2 verify/code-review example verbatim
14
+
15
+ schema_version: harnessed.workflow.v3
16
+ workflow: verify-code-review
17
+ description: |
18
+ Stage ④.b code-review 多 agent 并行 fan-out 高置信度 finding (subagent default per
19
+ CLAUDE.md 子任务并行机制)。parallelism ref judgments.parallelism-gate.subagent-default.fires
20
+ 机器化 — Task / Agent 工具 spawn 多 subagent 并行 fan-out, context 隔离, token 敏感场景默认。
21
+
22
+ disciplines_applied: [karpathy, output-style, language, operational, priority, protocols]
23
+ tools_available: [code-review]
24
+
25
+ phases:
26
+ - id: 01-code-review
27
+ name: code-review (multi-agent 并行 fan-out 高置信度 finding)
28
+ upstream: mattpocock-skills
29
+ capability: '{{ capabilities.code-review.cmd }}'
30
+ model: sonnet
31
+ parallelism: judgments.parallelism-gate.subagent-default.fires
32
+ max_iterations: '{{ defaults.ralph_max_iterations.verify-code-review.01-code-review }}'