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,64 @@
1
+ ---
2
+ name: plan-phase
3
+ description: |
4
+ Stage ②.b 计划层 plan sub-workflow — GSD /gsd-plan-phase Wave A research + Wave B planner +
5
+ Wave C plan-checker + planning-with-files Claude Code plugin /plan 持久化 task_plan.md +
6
+ progress.md (sister ~/.claude/CLAUDE.md "Plan 阶段 GSD + planning-with-files")。Stage ② 铁律:
7
+ dual capability (GSD orchestration + planning-with-files plugin)。schema_version:
8
+ harnessed.workflow.v3 with disciplines_applied (6 default) + tools_available [gsd-plan-phase,
9
+ planning-with-files] + 2 phases (01-gsd-plan + 02-persist)。Triggered by harnessed CLI
10
+ `harnessed plan-phase --phase <num>` or slash command `/plan-phase` after `harnessed setup`.
11
+ trigger_phrases:
12
+ - "plan phase"
13
+ - "计划层 phase"
14
+ - "gsd plan phase"
15
+ - "持久化计划"
16
+ - "跑 plan-phase"
17
+ ---
18
+
19
+ # plan-phase workflow (v3)
20
+
21
+ ## Overview
22
+
23
+ 2-phase sub-workflow mapping CLAUDE.md "Plan 阶段 — GSD + planning-with-files" onto harnessed
24
+ runtime (Phase v3.0-3.4 W0.5 — D-04 Stage ② Plan 二层 + D-15 planning-with-files
25
+ claude-code-plugin /plan + Pattern A sub-workflow ship)。
26
+
27
+ | phase | id | upstream | model | capability / invokes | artifacts |
28
+ | ----- | -- | -------- | ----- | -------------------- | --------- |
29
+ | 1 | `01-gsd-plan` | gsd | sonnet | `{{ capabilities.gsd-plan-phase.cmd }}` | (Wave A research + Wave B planner + Wave C plan-checker) |
30
+ | 2 | `02-persist` | planning-with-files | haiku | `{{ capabilities.planning-with-files.cmd }}` + `invokes: /plan` | `artifacts_expected: [task_plan.md, progress.md]` |
31
+
32
+ ## Capability refs
33
+
34
+ Sister `workflows/capabilities.yaml` entries:
35
+ - `gsd-plan-phase` — Bucket 2 (impl: gsd, cmd: /gsd-plan-phase)
36
+ - `planning-with-files` — Bucket 4 (impl: claude-code-plugin, cmd: /plan;
37
+ plugin_path: ~/.claude/plugins/cache/planning-with-files/...; outputs:
38
+ task_plan.md + progress.md + findings.md)
39
+
40
+ ## Stage ② 铁律 — dual capability
41
+
42
+ GSD `/gsd-plan-phase` orchestrate (Wave A research → Wave B planner → Wave C
43
+ plan-checker) → planning-with-files `/plan` 持久化 (plugin 真生成 task_plan.md +
44
+ progress.md, NOT fs.writeFile self-impl per D-15 Q-AUDIT-5a claude-code-plugin
45
+ reframe)。
46
+
47
+ ## Invocation
48
+
49
+ - CLI: `harnessed plan-phase --phase <num>`
50
+ - Slash command: `/plan-phase <num>` (after `harnessed setup`)
51
+
52
+ ## Output artifacts
53
+
54
+ - `task_plan.md` — 主任务清单 + 文件路径 + 依赖 + 验收标准
55
+ - `progress.md` — phase 进度跟踪 + cross-session 恢复
56
+ - (`findings.md` 由 discuss-* sub-workflow 产出, 此处不重复)
57
+
58
+ ## References
59
+
60
+ - D-04 Stage ② Plan 二层 (架构 / 计划)
61
+ - D-15 Q-AUDIT-5a planning-with-files claude-code-plugin reframe (NOT npm-sdk)
62
+ - ~/.claude/CLAUDE.md "Plan 阶段 GSD + planning-with-files"
63
+ - workflows/capabilities.yaml — gsd-plan-phase / planning-with-files (Bucket 4)
64
+ - workflows/defaults.yaml — ralph_max_iterations.plan-phase.* values (W2.2 backfill)
@@ -0,0 +1,37 @@
1
+ # workflows/plan/phase/workflow.yaml — Phase v3.0-3.4 W0 T3.4.W0.5
2
+ #
3
+ # Stage ②.b 计划层 sub-workflow — GSD /gsd-plan-phase Wave A research + Wave B planner +
4
+ # Wave C plan-checker + planning-with-files /plan 持久化 task_plan.md (sister
5
+ # ~/.claude/CLAUDE.md "Plan 阶段 GSD + planning-with-files")。Stage ② 铁律: dual capability
6
+ # (gsd-plan-phase + planning-with-files /plan invokes)。
7
+ #
8
+ # Sister refs:
9
+ # - workflows/capabilities.yaml — gsd-plan-phase / planning-with-files
10
+ # - .planning/phase-v3.0-3.2/RESEARCH-workflows.md § Area 2 sub-stage example verbatim
11
+
12
+ schema_version: harnessed.workflow.v3
13
+ workflow: plan-phase
14
+ description: |
15
+ Stage ②.b 计划层 — GSD /gsd-plan-phase Wave A research + Wave B planner + Wave C plan-checker
16
+ + planning-with-files /plan 持久化 task_plan.md + progress.md (sister CLAUDE.md "Plan 阶段
17
+ GSD + planning-with-files")。Stage ② 铁律: dual capability (GSD orchestration + planning-with-files
18
+ Claude Code plugin /plan invocation)。
19
+
20
+ disciplines_applied: [karpathy, output-style, language, operational, priority, protocols]
21
+ tools_available: [gsd-plan-phase, planning-with-files]
22
+
23
+ phases:
24
+ - id: 01-gsd-plan
25
+ name: gsd-plan-phase (Wave A research + Wave B planner + Wave C plan-checker)
26
+ upstream: gsd
27
+ capability: '{{ capabilities.gsd-plan-phase.cmd }}'
28
+ model: sonnet
29
+ max_iterations: '{{ defaults.ralph_max_iterations.plan-phase.01-gsd-plan }}'
30
+
31
+ - id: 02-persist
32
+ name: planning-with-files /plan (task_plan.md + progress.md 持久化)
33
+ upstream: planning-with-files
34
+ capability: '{{ capabilities.planning-with-files.cmd }}'
35
+ invokes: '/plan'
36
+ model: haiku
37
+ artifacts_expected: [task_plan.md, progress.md]
@@ -1,12 +1,16 @@
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). Triggered by harnessed CLI `harnessed research --topic <text>` or slash command `/research` after `harnessed setup`.
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 harnessed CLI `harnessed research --topic <text>` or slash command `/research` after `harnessed setup`.
4
4
  preamble-tier: 2
5
+ schema_version: harnessed.workflow.v3
5
6
  ---
6
7
 
7
8
  # research workflow
8
9
 
9
- Multi-source research workflow shipped with harnessed v2.0 (Stage ① Discuss).
10
+ Multi-source research workflow shipped with harnessed v2.0 (Stage ① Discuss);
11
+ `workflow.yaml` schema bumped to `harnessed.workflow.v3` in Phase v3.0-3.4 W1.1
12
+ (T3.4.W1.1 — D-09 L0 Discipline Substrate + D-05 tools_available cross-validate);
13
+ phases content (01-fan-out + 02-synth) verbatim reused from v2 SHIPPED unchanged.
10
14
 
11
15
  ## Phases (2)
12
16
 
@@ -1,9 +1,40 @@
1
- schema_version: harnessed.workflow.v2
1
+ # workflows/research/workflow.yaml — Phase v3.0-3.4 W1 T3.4.W1.1
2
+ # (v2 19L → v3 ~25L schema bump per RESEARCH-workflows Area 2 Standalone section)
3
+ #
4
+ # Standalone Stage ① alternate — 多源调研 Tavily MCP (默认关键词) + Exa MCP (描述式 / 学术)
5
+ # + ctx7 CLI (库 API 文档) fan-out + GSD discuss synth aggregate; sister
6
+ # ~/.claude/rules/web-search.md + context7.md routing 机器化 per R20.7 + D-08。
7
+ #
8
+ # v2 → v3 字段 delta (W1.1 schema bump scope):
9
+ # BUMP `schema_version: harnessed.workflow.v3` (17th surface — sister Phase 3.3 W0.11)
10
+ # ADD `disciplines_applied: [6 basename]` (D-09 L0 Discipline Substrate)
11
+ # ADD `tools_available: [tavily-mcp, exa-mcp, ctx7, gsd-discuss-phase]`
12
+ # (D-05 + Contract C1 cross-validate)
13
+ # KEEP phases verbatim (01-fan-out + 02-synth) — phases 内容 reuse v2 SHIPPED
14
+ # (per PLAN L455 "phases 内容 reuse v2")
15
+ #
16
+ # Sister refs:
17
+ # - .planning/phase-v3.0-3.2/PLAN.md L450-457 (T3.4.W1.1 spec verbatim)
18
+ # - .planning/phase-v3.0-3.2/RESEARCH-workflows.md § Area 2 Standalone research v3 example
19
+ # - workflows/capabilities.yaml tavily-mcp + exa-mcp + ctx7 + gsd-discuss-phase
20
+ # (Phase 2.3 W0.1 SHIPPED)
21
+ # - workflows/disciplines/{karpathy,output-style,language,operational,priority,protocols}.yaml
22
+ # (Phase 3.3 W0.4 SHIPPED, L0 substrate)
23
+ # - src/workflow/schema/workflow.ts WorkflowSchemaV3 (Phase 3.3 W0.5 SHIPPED 122L)
24
+
25
+ schema_version: harnessed.workflow.v3
2
26
  workflow: research
3
- description: 多源调研 workflow — Tavily MCP (默认关键词) + Exa MCP (描述式/学术) + ctx7 CLI (库 API 文档) fan-out + GSD discuss synth aggregate; sister ~/.claude/rules/web-search.md + context7.md routing 机器化 per R20.7 + D-08
27
+ description: |
28
+ Standalone Stage ① alternate — 多源调研 Tavily MCP (默认关键词) + Exa MCP (描述式 /
29
+ 学术) + ctx7 CLI (库 API 文档) fan-out + GSD discuss synth aggregate; sister
30
+ ~/.claude/rules/web-search.md + context7.md routing 机器化 per R20.7 + D-08。
31
+
32
+ disciplines_applied: [karpathy, output-style, language, operational, priority, protocols]
33
+ tools_available: [tavily-mcp, exa-mcp, ctx7, gsd-discuss-phase]
4
34
 
5
35
  phases:
6
- # 01-fan-out: 多源 fan-out — Tavily / Exa / ctx7 各源并行查询 (subagent fan-out per CLAUDE.md 子任务并行执行机制); generic shape — workflow engine 按 capability route 触发 3 source sequentially
36
+ # 01-fan-out: 多源 fan-out — Tavily / Exa / ctx7 各源并行查询 (subagent fan-out per CLAUDE.md
37
+ # 子任务并行执行机制); generic shape — workflow engine 按 capability route 触发 3 source sequentially
7
38
  - id: 01-fan-out
8
39
  upstream: web-search
9
40
  model: sonnet
@@ -0,0 +1,68 @@
1
+ ---
2
+ name: retro
3
+ description: |
4
+ Standalone post-④ Verify retrospective workflow — gstack /retro 经验教训 / 决策 / lessons
5
+ 系统总结 (项目 / 里程碑结束可选, sister ~/.claude/CLAUDE.md "项目 / 里程碑结束: 可选跑
6
+ /retro 总结" verbatim) + 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`.
13
+ trigger_phrases:
14
+ - "项目总结"
15
+ - "里程碑结束"
16
+ - "经验教训"
17
+ - "retro"
18
+ ---
19
+
20
+ # retro workflow (v3 NEW standalone)
21
+
22
+ ## Overview
23
+
24
+ 2-phase standalone workflow mapping CLAUDE.md "项目 / 里程碑结束: 可选跑 /retro 总结" onto
25
+ harnessed runtime (Phase v3.0-3.4 W1.2 — D-04 NEW v3 standalone workflow + Pattern A E.2
26
+ retro-gstack alias suffix LOCK)。
27
+
28
+ | phase | id | upstream | model | capability / invokes | artifacts |
29
+ | ----- | -- | -------- | ----- | -------------------- | --------- |
30
+ | 1 | `01-retro` | gstack | opus | `{{ capabilities.retro-gstack.cmd }}` | gstack /retro 经验教训系统总结 |
31
+ | 2 | `02-persist` | planning-with-files | haiku | `{{ capabilities.planning-with-files.cmd }}` + `invokes: /plan` | `artifacts_expected: [RETROSPECTIVE.md]` |
32
+
33
+ Per-phase config loads from `workflows/retro/workflow.yaml`; engine spawns phase 01 gstack
34
+ `/retro` (alias resolve to retro-gstack carrier per capabilities.yaml entry), phase 02
35
+ planning-with-files `/plan` invoke 持久化 RETROSPECTIVE.md sink。
36
+
37
+ ## Capability refs (Pattern A E.2 LOCK)
38
+
39
+ Sister `workflows/capabilities.yaml` entries:
40
+ - `retro-gstack` — Bucket 7 gstack optional **alias suffix** per Pattern A E.2 LOCK
41
+ (impl: gstack, cmd: /retro, aliases to harnessed-bundled /retro, fires_when: is_milestone_close)
42
+ — 解决 namespace 冲突 (NOT bare `retro` capability 因 standalone workflow 已占 retro 名)
43
+ - `planning-with-files` — Bucket 4 核心 capability (impl: claude-code-plugin, cmd: /plan)
44
+
45
+ ## Routing rules (sister CLAUDE.md "项目 / 里程碑结束")
46
+
47
+ - ✅ **触发**: 项目结束 / 里程碑结束 / 用户明示 "复盘 / retro / lessons learned"
48
+ - ❌ **跳过**: 日常 PR / 单 phase 完成 (常规 verify-progress 已够用)
49
+
50
+ ## CLI invocation
51
+
52
+ ```bash
53
+ # Dry-run preview — arbitrate-only, never spawns SDK.
54
+ harnessed retro --milestone <name> --dry-run --non-interactive
55
+
56
+ # Apply path — real SDK spawn + 2-phase serial (gstack /retro → planning-with-files RETROSPECTIVE.md sink).
57
+ harnessed retro --milestone <name> --apply
58
+ ```
59
+
60
+ ## References
61
+
62
+ - D-04 NEW v3 standalone workflow (research v3 bump + retro NEW)
63
+ - Pattern A E.2 LOCK — 2 alias suffix `-gstack` 解决 namespace 冲突 (retro-gstack + investigate-gstack)
64
+ - Pattern A reconcile D.2 — gstack 30 optional naming bare 例外
65
+ - ~/.claude/CLAUDE.md "项目 / 里程碑结束: 可选跑 /retro 总结" verbatim
66
+ - workflows/capabilities.yaml — retro-gstack (alias suffix) + planning-with-files
67
+ - workflows/defaults.yaml — ralph_max_iterations.retro.* values (W2.2 backfill)
68
+ - sister Phase v2.0-2.5 RETROSPECTIVE.md sink pattern
@@ -0,0 +1,40 @@
1
+ # workflows/retro/workflow.yaml — Phase v3.0-3.4 W1 T3.4.W1.2 NEW
2
+ #
3
+ # Standalone post-④ Verify — gstack /retro 经验教训总结 (项目 / 里程碑结束可选,
4
+ # sister ~/.claude/CLAUDE.md "项目 / 里程碑结束: 可选跑 /retro 总结" verbatim)。
5
+ # Sink RETROSPECTIVE.md (sister Phase v2.0-2.5 RETROSPECTIVE pattern)。
6
+ #
7
+ # Sister refs:
8
+ # - ~/.claude/CLAUDE.md "项目 / 里程碑结束: 可选跑 /retro 总结" verbatim
9
+ # - workflows/capabilities.yaml — retro-gstack (Bucket 7 gstack optional alias suffix per
10
+ # Pattern A E.2 LOCK, 解决 namespace 冲突 — retro carrier 自带 gstack 字符串 NOT prefix policy)
11
+ # - workflows/capabilities.yaml — planning-with-files (Bucket 4 核心 capability /plan)
12
+ # - .planning/phase-v3.0-3.2/RESEARCH-workflows.md § Area 2 Standalone retro example verbatim
13
+ # - Pattern A reconcile D.2 (gstack 30 optional naming 2 alias suffix retro-gstack / investigate-gstack)
14
+
15
+ schema_version: harnessed.workflow.v3
16
+ workflow: retro
17
+ description: |
18
+ Standalone post-④ — gstack /retro 经验教训总结 (项目 / 里程碑结束可选, sister CLAUDE.md
19
+ "项目 / 里程碑结束: 可选跑 /retro 总结")。Sink RETROSPECTIVE.md (sister Phase v2.0-2.5
20
+ RETROSPECTIVE pattern)。Capability ref retro-gstack alias suffix per Pattern A E.2 LOCK
21
+ (NOT bare retro 避免 standalone workflow / capability namespace 冲突)。
22
+
23
+ disciplines_applied: [karpathy, output-style, language, operational, priority, protocols]
24
+ tools_available: [retro-gstack, planning-with-files]
25
+
26
+ phases:
27
+ - id: 01-retro
28
+ name: gstack-retro (经验教训 / 决策 / lessons 系统总结)
29
+ upstream: gstack
30
+ capability: '{{ capabilities.retro-gstack.cmd }}'
31
+ model: opus
32
+ max_iterations: '{{ defaults.ralph_max_iterations.retro.01-retro }}'
33
+
34
+ - id: 02-persist
35
+ name: planning-with-files RETROSPECTIVE.md (经验教训持久化)
36
+ upstream: planning-with-files
37
+ capability: '{{ capabilities.planning-with-files.cmd }}'
38
+ invokes: '/plan'
39
+ model: haiku
40
+ artifacts_expected: [RETROSPECTIVE.md]
File without changes
@@ -0,0 +1,68 @@
1
+ ---
2
+ name: task
3
+ description: |
4
+ Stage ③ Task master orchestrator — 串行 invoke 4 sub per subtask (clarify → code → test → deliver)。
5
+ ralph-loop COMPLETE wrapper 在 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
+ zoom-out + improve-codebase-architecture + diagnose + ralph-loop + planning-with-files)。
10
+ Triggered by harnessed CLI `harnessed task --subtask <text>` or slash command `/task`
11
+ (bare per ADR 0030 namespace policy D-02 LOCK) after `harnessed setup`.
12
+ trigger_phrases:
13
+ - "task"
14
+ - "子任务执行"
15
+ - "stage 3 execute"
16
+ - "ralph loop"
17
+ - "执行子任务"
18
+ ---
19
+
20
+ # task master orchestrator (v3)
21
+
22
+ ## Overview
23
+
24
+ 4-stage cadence Stage ③ master orchestrator delegating to 4 sequential sub-workflows
25
+ per subtask (per ~/.claude/CLAUDE.md "Execute 阶段" 节 + karpathy 心法 always-on):
26
+
27
+ | order | sub | gate ref | mode | when fires |
28
+ | ----- | --- | -------- | ---- | ---------- |
29
+ | 1 | `clarify` | `judgments.subtask-gate.brainstorming.fires` | serial | approaches ≥ 2 / core_algorithm / has_api_contract / error_cost=high |
30
+ | 2 | `code` | (unconditional — karpathy 心法 always-on + mattpocock conditional route) | serial | always |
31
+ | 3 | `test` | `judgments.tdd-gate.tdd-strongly-suggested.fires` | serial | 核心业务 / 算法 / 数据处理 / 回归 risk / reliability (6 fires_when OR-chain) |
32
+ | 4 | `deliver` | (unconditional — ralph-loop COMPLETE wrapper) | serial | always |
33
+
34
+ Engine runtime spawns 4 sub-workflow phases sequentially via `runMasterOrchestrator`
35
+ per T3.5.W0.1 — clarify → code → test → deliver。K9 invariant enforced: every serial
36
+ mode delegate carries explicit `order`。Each subtask 入口走一次此 master orchestrator。
37
+
38
+ ## ralph-loop orthogonal wrapper (D-10)
39
+
40
+ ralph-loop 是正交 wrapper, 套在 deliver sub 的 01-deliver phase 外层保 completion-promise
41
+ verbatim "COMPLETE" (R20.10)。任何执行单元 (subagent / team / 主 session) 都可外层套 ralph-loop
42
+ 保 completion-promise (sister ~/.claude/CLAUDE.md 子任务并行执行机制 "正交 wrapper")。
43
+
44
+ ## Capability refs
45
+
46
+ Sister `workflows/capabilities.yaml`:
47
+ - `superpowers-brainstorming` — Bucket 4 核心 capability (sub clarify upstream)
48
+ - `tdd` — Bucket 4 核心 capability TDD red-green-refactor (sub test upstream)
49
+ - `grill-with-docs` — Bucket 1 mattpocock conditional invoke (clarify)
50
+ - `zoom-out` — Bucket 1 mattpocock conditional invoke (code, unfamiliar_module)
51
+ - `improve-codebase-architecture` — Bucket 1 mattpocock conditional invoke (code, architecture_health_audit)
52
+ - `diagnose` — Bucket 1 mattpocock conditional invoke (code/test, bug_root_cause_unknown / test_fail)
53
+ - `ralph-loop` — Bucket 4 核心 capability orthogonal wrapper (deliver)
54
+ - `planning-with-files` — Bucket 4 核心 capability (code + deliver progress.md update)
55
+
56
+ ## Invocation
57
+
58
+ - CLI: `harnessed task --subtask "<text>"`
59
+ - Slash command: `/task <text>` (bare per ADR 0030 namespace policy D-02 LOCK after `harnessed setup`)
60
+
61
+ ## References
62
+
63
+ - D-01 master orchestrator delegation pattern
64
+ - D-02 bare slash cmd convention (ADR 0030 namespace policy LOCK)
65
+ - D-10 ralph-loop orthogonal wrapper
66
+ - ~/.claude/CLAUDE.md "Execute 阶段" 节 verbatim (karpathy 心法 + mattpocock 招式 + ralph-loop COMPLETE)
67
+ - workflows/judgments/{subtask-gate,tdd-gate}.yaml — brainstorming + tdd-strongly-suggested triggers
68
+ - workflows/task/{clarify,code,test,deliver}/workflow.yaml — 4 sub-workflow Phase 3.4 SHIPPED
@@ -0,0 +1,57 @@
1
+ # workflows/task/auto/workflow.yaml — Phase v3.0-3.5 W1 T3.5.W1.3
2
+ #
3
+ # Stage ③ Task master orchestrator — 串行 invoke 4 sub per subtask (clarify → code → test → deliver)
4
+ # per ~/.claude/CLAUDE.md "Execute 阶段" 节 + RESEARCH-workflows § Area 2。
5
+ # ralph-loop COMPLETE wrapper 在 deliver phase 内 (D-10 orthogonal wrapper not master concern)。
6
+ # tdd-gate conditional fire on test sub (sister task/test/workflow.yaml gate
7
+ # judgments.tdd-gate.tdd-strongly-suggested.fires)。
8
+ #
9
+ # Sister refs:
10
+ # - ~/.claude/CLAUDE.md "Execute 阶段 (GSD orchestration + superpowers 子任务执行)" 节
11
+ # - workflows/judgments/subtask-gate.yaml — brainstorming trigger (clarify)
12
+ # - workflows/judgments/tdd-gate.yaml — tdd-strongly-suggested trigger (test conditional)
13
+ # - workflows/task/{clarify,code,test,deliver}/workflow.yaml — 4 sub-workflow Phase 3.4 SHIPPED
14
+ # - workflows/capabilities.yaml — superpowers-brainstorming + tdd + grill-with-docs + zoom-out +
15
+ # improve-codebase-architecture + diagnose + ralph-loop + planning-with-files
16
+ # - .planning/phase-v3.0-3.2/RESEARCH-workflows.md § Area 2 Master Orchestrator yaml Examples
17
+ # - src/workflow/schema/workflow.ts WorkflowSchemaV3 + DelegationClause (Phase 3.3 W0.5 SHIPPED)
18
+ #
19
+ # Master invariant (per WorkflowSchemaV3 runtime + check-workflow-schema.mjs K9):
20
+ # - phases 缺省 (master only has delegates_to[])
21
+ # - 4 delegates_to mode serial — 必带 explicit order (K9 invariant T3.3.W0.10)
22
+ # - clarify conditional (subtask-gate brainstorming) + code/deliver unconditional + test conditional (tdd-gate)
23
+
24
+ schema_version: harnessed.workflow.v3
25
+ workflow: task
26
+ description: |
27
+ Stage ③ Task master orchestrator — 串行 invoke 4 sub per subtask (clarify → code → test → deliver);
28
+ ralph-loop COMPLETE wrapper 在 deliver phase 内 (D-10 orthogonal wrapper not master concern)。
29
+ tdd-gate conditional fire on test sub (核心业务 / 算法 / 数据处理 / 回归 risk high / reliability
30
+ required, 6 fires_when OR-chain per ~/.claude/CLAUDE.md)。execute-task 每个 subtask 入口走一次。
31
+
32
+ disciplines_applied: [karpathy, output-style, language, operational, priority, protocols]
33
+ tools_available:
34
+ - superpowers-brainstorming
35
+ - tdd
36
+ - grill-with-docs
37
+ - zoom-out
38
+ - improve-codebase-architecture
39
+ - diagnose
40
+ - ralph-loop
41
+ - planning-with-files
42
+
43
+ delegates_to:
44
+ - sub: clarify
45
+ gate: judgments.subtask-gate.brainstorming.fires
46
+ mode: serial
47
+ order: 1
48
+ - sub: code
49
+ mode: serial
50
+ order: 2
51
+ - sub: test
52
+ gate: judgments.tdd-gate.tdd-strongly-suggested.fires
53
+ mode: serial
54
+ order: 3
55
+ - sub: deliver
56
+ mode: serial
57
+ order: 4
@@ -0,0 +1,83 @@
1
+ ---
2
+ name: task-clarify
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 harnessed CLI
11
+ `harnessed task-clarify --task <text>` or slash command `/task-clarify` after
12
+ `harnessed setup`.
13
+ trigger_phrases:
14
+ - "clarify this subtask"
15
+ - "task-clarify workflow"
16
+ - "Stage 3 clarify"
17
+ - "跑 task-clarify"
18
+ ---
19
+
20
+ # task-clarify workflow (v3)
21
+
22
+ ## Overview
23
+
24
+ Single-phase sub-workflow mapping the user's CLAUDE.md Stage ③.a 子任务澄清 discipline
25
+ onto the harnessed runtime, fully `harnessed.workflow.v3` schema (Phase v3.0-3.4 W0
26
+ T3.4.W0.6 — D-09 L0 Discipline Substrate + D-05 conditional `invokes_tools` + D-04
27
+ gate ref).
28
+
29
+ | phase | id | upstream | model | capability / invokes_tools | gate |
30
+ | ----- | -- | -------- | ----- | -------------------------- | ---- |
31
+ | 1 | `01-brainstorm` | superpowers | sonnet | `{{ capabilities.superpowers-brainstorming.cmd }}` + `invokes_tools: [{if: phase.spec_ambiguous, tool: grill-with-docs}]` | `judgments.subtask-gate.brainstorming.fires` |
32
+
33
+ Per-phase config loads from `workflows/task/clarify/workflow.yaml`; engine.runRouting
34
+ spawns each phase as a sub-agent via `@anthropic-ai/claude-agent-sdk` 0.3.142+.
35
+
36
+ ## Per-subtask repeat invoke pattern
37
+
38
+ task-clarify is **NOT** a one-shot 阶段 — execute-task master orchestrator delegates
39
+ to task-clarify **每个 subtask 入口走一次** evaluate gate (subtask-gate.brainstorming
40
+ .fires) 是否激活。Skip path (subtask.type in ['crud','standard_lib_call'] OR
41
+ subtask.lines < 20) bypasses brainstorming entirely per CLAUDE.md "拿不准 → 倾向跳过"。
42
+
43
+ ## Discipline Substrate (L0 always-on)
44
+
45
+ 6 disciplines (karpathy + output-style + language + operational + priority + protocols)
46
+ apply cross-cutting per D-09 L0 Discipline Substrate — workflow runtime pre-phase hook
47
+ loads discipline yaml + applies rules. Sentinel category `behavioral` SKIP cmd invoke;
48
+ runtime engine routes via `discipline_ref` ref to `workflows/disciplines/<basename>.yaml`.
49
+
50
+ ## Conditional grill-with-docs fire (D-05 invokes_tools)
51
+
52
+ Phase 01-brainstorm 条件性 fire `grill-with-docs` when `phase.spec_ambiguous == true` —
53
+ sister CLAUDE.md "Discuss / Research 阶段" mattpocock 招式按需召唤 pattern; NOT 强制
54
+ unconditional fire (D-05 invokes_tools 与 OnClause 并存, 但作用面不同 — invokes_tools
55
+ phase-level conditional tool fire NOT 决定 phase 是否走)。
56
+
57
+ ## CLI invocation
58
+
59
+ ```bash
60
+ # Dry-run preview — arbitrate-only, never spawns SDK.
61
+ harnessed task-clarify --task "<text>" --dry-run --non-interactive
62
+
63
+ # Apply path — real SDK spawn + 1-phase (conditional brainstorming via gate evaluation).
64
+ harnessed task-clarify --task "<text>" --apply
65
+ ```
66
+
67
+ ## Forward-looking note
68
+
69
+ The `trigger_phrases:` frontmatter is active after `harnessed setup` copies this
70
+ SKILL.md to `~/.claude/skills/task-clarify/` — Claude Code then loads the slash
71
+ command `/task-clarify` automatically (Gap B fix — sister v1.0.2 mechanism).
72
+
73
+ ## References
74
+
75
+ - D-09 — L0 Discipline Substrate always-on (6 disciplines)
76
+ - D-05 — phase-level `invokes_tools` conditional tool fire
77
+ - D-04 — `gate` 4-level ref pre-resolved by `judgmentResolver`
78
+ - D-02 — SKILL.md `name:` bare slash cmd (`task-clarify` NOT `task/clarify`) per ADR 0030
79
+ - ~/.claude/CLAUDE.md "Execute 阶段" 节 brainstorming 子任务层判据
80
+ - `workflows/judgments/subtask-gate.yaml` triggers.brainstorming
81
+ - `workflows/capabilities.yaml` — superpowers-brainstorming + grill-with-docs entries
82
+ - `workflows/defaults.yaml` — ralph_max_iterations.task-clarify.* values (T3.4.W2.2 followup)
83
+ - `docs/WORKFLOW.md` — 4-stage workflow mermaid + Stage ③ Execute 章节
@@ -0,0 +1,39 @@
1
+ # workflows/task/clarify/workflow.yaml — Phase v3.0-3.4 W0 T3.4.W0.6 (D-09 + D-05 + D-04)
2
+ #
3
+ # Stage ③.a 子任务澄清 — superpowers brainstorm + mattpocock /grill-with-docs conditional invoke
4
+ # (子任务 ≥2 approach OR core_algorithm OR has_api_contract OR error_cost=high)。
5
+ # Sister gate: judgments.subtask-gate.brainstorming.fires (与 discuss/subtask 同 gate;
6
+ # 但 Stage ③.a 是 per-subtask repeat invoke — execute-task 每个 subtask 入口走一次)。
7
+ #
8
+ # Sister refs:
9
+ # - .planning/phase-v3.0-3.2/RESEARCH-workflows.md § Area 2 task/clarify sub yaml example
10
+ # - workflows/judgments/subtask-gate.yaml triggers.brainstorming (Phase 2.3 W0.2 SHIPPED)
11
+ # - workflows/capabilities.yaml superpowers-brainstorming + grill-with-docs (Phase 2.3 W0.1 SHIPPED)
12
+ # - workflows/defaults.yaml ralph_max_iterations.task-clarify.* (T3.4.W2.2 followup wire)
13
+ # - src/workflow/schema/workflow.ts WorkflowSchemaV3 (Phase 3.3 W0.5 SHIPPED 122L)
14
+ #
15
+ # disciplines_applied: 6 default 全开 per D-09 L0 Discipline Substrate always-on
16
+ # tools_available: 2 entry ∈ capabilities.yaml entry set (T3.3.W0.10 Contract C1 catch)
17
+
18
+ schema_version: harnessed.workflow.v3
19
+ workflow: task-clarify
20
+ description: |
21
+ Stage ③.a 子任务澄清 — superpowers brainstorm + mattpocock /grill-with-docs (子任务
22
+ ≥2 approach 或核心算法 / API contract / 错误成本高 时激活)。Gate: judgments.subtask-gate
23
+ .brainstorming.fires (与 discuss-subtask 同 gate, 但 Stage ③.a 是 per-subtask repeat
24
+ invoke — execute-task 每个 subtask 入口走一次)。
25
+
26
+ disciplines_applied: [karpathy, output-style, language, operational, priority, protocols]
27
+ tools_available: [superpowers-brainstorming, grill-with-docs]
28
+
29
+ phases:
30
+ - id: 01-brainstorm
31
+ name: brainstorm (子任务级澄清 multi-approach 探索)
32
+ upstream: superpowers
33
+ capability: '{{ capabilities.superpowers-brainstorming.cmd }}'
34
+ model: sonnet
35
+ gate: judgments.subtask-gate.brainstorming.fires
36
+ invokes_tools:
37
+ - if: 'phase.spec_ambiguous == true'
38
+ tool: grill-with-docs
39
+ max_iterations: '{{ defaults.ralph_max_iterations.task-clarify.01-brainstorm }}'
@@ -0,0 +1,89 @@
1
+ ---
2
+ name: task-code
3
+ description: |
4
+ task-code workflow v3 — Stage ③.b 子任务编码 sub-workflow (karpathy 4 心法
5
+ always-on + mattpocock conditional route + planning-with-files progress.md update)。
6
+ 2-phase composition: 01-code (karpathy 心法 + zoom-out 陌生模块 / improve-arch
7
+ 周期审查 / diagnose bug conditional invokes_tools) → 02-progress (Claude Code plugin
8
+ /plan 更新 progress.md 跨 session 进度同步)。
9
+ schema_version: harnessed.workflow.v3 with disciplines_applied [6] + tools_available
10
+ [zoom-out, improve-codebase-architecture, diagnose, planning-with-files]. Triggered
11
+ by harnessed CLI `harnessed task-code --task <text>` or slash command `/task-code`
12
+ after `harnessed setup`.
13
+ trigger_phrases:
14
+ - "code this subtask"
15
+ - "task-code workflow"
16
+ - "Stage 3 code"
17
+ - "跑 task-code"
18
+ ---
19
+
20
+ # task-code workflow (v3)
21
+
22
+ ## Overview
23
+
24
+ 2-phase sub-workflow mapping the user's CLAUDE.md Stage ③.b 子任务编码 discipline
25
+ onto the harnessed runtime, fully `harnessed.workflow.v3` schema (Phase v3.0-3.4 W0
26
+ T3.4.W0.7 — D-09 L0 Discipline Substrate + D-05 conditional `invokes_tools` + D-15
27
+ planning-with-files plugin).
28
+
29
+ | phase | id | upstream | model | capability / invokes_tools |
30
+ | ----- | -- | -------- | ----- | -------------------------- |
31
+ | 1 | `01-code` | karpathy | sonnet | `invokes_tools: [{if: phase.unfamiliar_module, tool: zoom-out}, {if: phase.architecture_health_audit, tool: improve-codebase-architecture}, {if: subtask.bug_root_cause_unknown, tool: diagnose}]` |
32
+ | 2 | `02-progress` | planning-with-files | haiku | `{{ capabilities.planning-with-files.cmd }}` / `invokes: /plan` / `artifacts_expected: [progress.md]` |
33
+
34
+ Per-phase config loads from `workflows/task/code/workflow.yaml`; engine.runRouting
35
+ spawns each phase as a sub-agent via `@anthropic-ai/claude-agent-sdk` 0.3.142+.
36
+
37
+ ## Karpathy 4 心法 (L0 Discipline Substrate always-on)
38
+
39
+ Phase 01-code 的 upstream 是 `karpathy` — runtime engine 加载 `workflows/disciplines/
40
+ karpathy.yaml` discipline rules 应用 cross-cutting (Think Before Coding / Simplicity
41
+ First / Surgical Changes / Goal-Driven Execution + ≤200L hard limit + no-feature-creep
42
+ + trust-internal-code + no-comments-default). 不 invoke slash cmd, 通过 hook 强制
43
+ behavioral rule per D-09 L0 Discipline Substrate.
44
+
45
+ ## mattpocock conditional route (D-05 invokes_tools)
46
+
47
+ Phase 01-code 按 phase fact context 条件性 fire 3 mattpocock 招式:
48
+ - `zoom-out` — 陌生模块导航 (when `phase.unfamiliar_module == true`)
49
+ - `improve-codebase-architecture` — 周期架构健康审查 (when `phase.architecture_health_audit == true`)
50
+ - `diagnose` — bug 系统化排错 (when `subtask.bug_root_cause_unknown == true`)
51
+
52
+ 3 触发条件 OR-chain, 任 1 fire 即 invoke 对应招式 — 不互斥 (sister CLAUDE.md
53
+ "mattpocock 招式按需召唤" pattern, NOT exclusive). 无触发 = pure karpathy 心法 only.
54
+
55
+ ## Phase 02-progress planning-with-files plugin 真接 (Q-AUDIT-5a LOCKED Option A)
56
+
57
+ 02-progress invokes the **Claude Code plugin** slash command `/plan` to update
58
+ `progress.md` in `.planning/<phase-id>/` — 跟踪 subtask 完成 / blocked / next step
59
+ per CLAUDE.md "跨 session 恢复" 模式 + R20.6 Manus-style 持久化。Plugin path
60
+ verified at `~/.claude/plugins/cache/planning-with-files/planning-with-files/2.34.0/`
61
+ (2026-05-20).
62
+
63
+ ## CLI invocation
64
+
65
+ ```bash
66
+ # Dry-run preview — arbitrate-only, never spawns SDK.
67
+ harnessed task-code --task "<text>" --dry-run --non-interactive
68
+
69
+ # Apply path — real SDK spawn + 2-phase chain.
70
+ harnessed task-code --task "<text>" --apply
71
+ ```
72
+
73
+ ## Forward-looking note
74
+
75
+ The `trigger_phrases:` frontmatter is active after `harnessed setup` copies this
76
+ SKILL.md to `~/.claude/skills/task-code/` — Claude Code then loads the slash
77
+ command `/task-code` automatically (Gap B fix — sister v1.0.2 mechanism).
78
+
79
+ ## References
80
+
81
+ - D-09 — L0 Discipline Substrate always-on (karpathy 心法 4 条 cross-cutting)
82
+ - D-05 — phase-level `invokes_tools` conditional tool fire
83
+ - D-15 + Q-AUDIT-5a — planning-with-files = Claude Code plugin slash cmd `/plan`
84
+ - D-02 — SKILL.md `name:` bare slash cmd (`task-code` NOT `task/code`) per ADR 0030
85
+ - ~/.claude/CLAUDE.md "Execute 阶段" 节 karpathy 心法 + mattpocock 招式按需召唤
86
+ - `workflows/disciplines/karpathy.yaml` — 4 心法 + ≤200L hard limit 等 rules (L0 substrate)
87
+ - `workflows/capabilities.yaml` — zoom-out / improve-codebase-architecture / diagnose / planning-with-files entries
88
+ - `workflows/defaults.yaml` — ralph_max_iterations.task-code.* values (T3.4.W2.2 followup)
89
+ - `docs/WORKFLOW.md` — 4-stage workflow mermaid + Stage ③ Execute 章节