harnessed 1.0.4 → 2.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.
@@ -0,0 +1,35 @@
1
+ # workflows/judgments/fallback.yaml
2
+ # Fallback 三条铁律 — 机器化 ~/.claude/CLAUDE.md 「Fallback 三条铁律」 verbatim
3
+ # Sister: 不同于 triggers (fires_when/skips_when 模式), 本 file 使用 'rules' 顶级 key
4
+ # Phase v2.0-2.3 Wave 0 T2.3.W0.2 ship per R20.16 + D-16
5
+
6
+ schema_version: harnessed.judgment.v1
7
+
8
+ rules:
9
+ uncertain-skip-transparently:
10
+ description: |
11
+ 铁律 1 — 拿不准 → 跳过 + 透明声明。
12
+ Workflow runtime 在 gate eval throw GateEvalError 或 evidence 不足时,
13
+ emit ⚠️ message 给用户, 不静默跳过。
14
+ fallback_action: skip_with_transparency
15
+ message_template: "⚠️ 跳过 {gate_name}, 因为 {reason}。如认为需要请明示。"
16
+
17
+ user-explicit-override:
18
+ description: |
19
+ 铁律 2 — 用户明示 → 覆盖判据。
20
+ Workflow runtime 词法匹配 user input, 命中以下任一 signal 强制 invoke,
21
+ 即使 fires_when==false / skips_when==true。
22
+ override_signal:
23
+ - "先 brainstorm"
24
+ - "跑 office-hours"
25
+ - "讨论一下"
26
+ - "office-hours"
27
+ - "brainstorm"
28
+ - "深度调研"
29
+
30
+ chain-isolation:
31
+ description: |
32
+ 铁律 3 — 链式互不前置, 跳过战略层 ≠ 必须跳过 phase 层;
33
+ 每层独立判断 (防"上层没跑下层不敢跑"的死板)。
34
+ Strategic / phase / subtask 三层 gate eval 互相独立, 无父子继承。
35
+ chain_isolation: true
@@ -0,0 +1,47 @@
1
+ # workflows/judgments/parallelism-gate.yaml
2
+ # Parallelism 判据 — 机器化 ~/.claude/CLAUDE.md 「子任务并行执行机制 (subagent vs Agent Teams 路由)」节
3
+ # Sister: ~/.claude/rules/agent-teams.md (5 升级触发完整生命周期)
4
+ # Phase v2.0-2.3 Wave 0 T2.3.W0.2 ship per D-11 (parallelism-gate) + R20.10 (ralph-loop 正交 wrapper)
5
+
6
+ schema_version: harnessed.judgment.v1
7
+
8
+ triggers:
9
+ subagent-default:
10
+ description: |
11
+ Default — subagent fan-out per CLAUDE.md 子任务并行机制
12
+ (Task / Agent 工具 spawn, focused 任务 research / verify / review,
13
+ 多任务并行 fan-out, context 隔离, token 敏感)。
14
+ fires_when: "subtask.parallel_count <= 3 and subtask.communication_needed == false"
15
+ invokes:
16
+ - capability: superpowers-subagent-driven-development
17
+
18
+ main-session-fallback:
19
+ description: |
20
+ Downgrade — main session direct execution 主 session 直接做
21
+ (小任务 < 20 行 / 单命令查询, 不开 subagent 节省 token)。
22
+ fires_when: "subtask.lines < 20 or subtask.type == 'single_command_query'"
23
+
24
+ agent-teams-upgrade:
25
+ description: |
26
+ Upgrade — Claude Code Agent Teams 升级 per ~/.claude/rules/agent-teams.md
27
+ 5 任一触发即可 (teammate SendMessage 互通 / subagent context overflow /
28
+ 共享 task list 自协调 / 对立假设辩论 / 全栈三路协同)。
29
+ 开 team 前 token 成本估算 team_cost < 2 × subagent_cost 才划算。
30
+ fires_when: "teammate_send_message_needed == true or subagent_context_overflow == true or shared_task_list == true or opposing_hypothesis_debate == true or fullstack_three_way == true"
31
+ invokes:
32
+ - capability: agent-teams-create
33
+ requires:
34
+ capabilities:
35
+ - agent-teams-create
36
+
37
+ ralph-loop-wrapper:
38
+ description: |
39
+ Orthogonal — ralph-loop 正交 wrapper, 套在 subagent / team / main session
40
+ 外层保 completion-promise verbatim "COMPLETE"。任何执行单元均可套用,
41
+ 并非互斥触发器 (per R20.10 + D-10)。
42
+ wraps:
43
+ - subagent-default
44
+ - agent-teams-upgrade
45
+ - main-session-fallback
46
+ invokes:
47
+ - capability: ralph-loop
@@ -0,0 +1,17 @@
1
+ # workflows/judgments/phase-gate.yaml
2
+ # Phase 层 (Phase tier) 判据 — 机器化 ~/.claude/CLAUDE.md 「澄清/审查触发判据」节
3
+ # Sister: GSD /gsd-discuss-phase orchestration gate (also /gsd-new-project, /gsd-next)
4
+ # Phase v2.0-2.3 Wave 0 T2.3.W0.2 ship per D-04 + D-16 multi-file 分类
5
+
6
+ schema_version: harnessed.judgment.v1
7
+
8
+ triggers:
9
+ gsd-discuss-phase:
10
+ description: |
11
+ GSD /gsd-discuss-phase — 新 phase 且 ≥2 个 open implementation decisions,
12
+ 或跨 phase 数据流 / API contract / 依赖不清, 或 phase scope > 1 天 / > 5 文件,
13
+ 或存在灰色地带 (多种合理实现都讲得通) 时激活。
14
+ fires_when: "phase.open_decisions >= 2 or phase.has_cross_phase_data_flow == true or phase.scope_days > 1"
15
+ skips_when: "phase.single_task == true or phase.scope_days < 1"
16
+ invokes:
17
+ - capability: gsd-discuss-phase
@@ -0,0 +1,25 @@
1
+ # workflows/judgments/strategic-gate.yaml
2
+ # 战略层 (Strategy tier) 判据 — 机器化 ~/.claude/CLAUDE.md 「澄清/审查触发判据」节
3
+ # Sister: gstack /office-hours + /plan-ceo-review governance gate
4
+ # Phase v2.0-2.3 Wave 0 T2.3.W0.2 ship per D-04 + D-16 multi-file 分类
5
+
6
+ schema_version: harnessed.judgment.v1
7
+
8
+ triggers:
9
+ office-hours:
10
+ description: |
11
+ gstack /office-hours — 新项目 / 新 milestone / 新产品方向时激活,
12
+ 用户原话出现"启动 / 想做个 X / 新功能"触发商业 scope 澄清。
13
+ fires_when: "phase.type in ['new_project', 'new_milestone', 'new_feature']"
14
+ skips_when: "phase.type in ['bug_fix', 'tech_debt', 'continuing_phase'] or phase.scope_locked_in_history == true"
15
+ invokes:
16
+ - capability: gstack-office-hours
17
+
18
+ plan-ceo-review:
19
+ description: |
20
+ gstack /plan-ceo-review — 新项目启动 / 主要发布前强制治理关卡,
21
+ CEO 视角商业 positioning 与 scope 评审。
22
+ fires_when: "phase.type == 'new_project' or phase.is_major_release == true"
23
+ skips_when: "phase.scope_locked_in_history == true or phase.type in ['bug_fix', 'tech_debt']"
24
+ invokes:
25
+ - capability: gstack-plan-ceo-review
@@ -0,0 +1,17 @@
1
+ # workflows/judgments/subtask-gate.yaml
2
+ # 子任务层 (Subtask tier) 判据 — 机器化 ~/.claude/CLAUDE.md 「澄清/审查触发判据」节
3
+ # Sister: superpowers:brainstorming skill (与 superpowers TDD red-green-refactor 并行评估)
4
+ # Phase v2.0-2.3 Wave 0 T2.3.W0.2 ship per D-04 + D-16 multi-file 分类
5
+
6
+ schema_version: harnessed.judgment.v1
7
+
8
+ triggers:
9
+ brainstorming:
10
+ description: |
11
+ superpowers:brainstorming — 子任务有 ≥2 个明显不同实现方案,
12
+ 或涉及核心算法 / 数据结构 / API contract 设计,
13
+ 或无现成 pattern 可抄, 或错误成本高 (数据迁移 / 并发 / 性能关键路径) 时激活。
14
+ fires_when: "subtask.approaches >= 2 or subtask.core_algorithm == true or subtask.has_api_contract == true or subtask.error_cost == 'high'"
15
+ skips_when: "subtask.type in ['crud', 'standard_lib_call'] or subtask.lines < 20"
16
+ invokes:
17
+ - capability: superpowers-brainstorming
@@ -0,0 +1,17 @@
1
+ # workflows/judgments/tdd-gate.yaml
2
+ # TDD 判据 — 机器化 ~/.claude/CLAUDE.md 「Execute 阶段 TDD 强烈建议开启」节
3
+ # Sister: superpowers:test-driven-development skill (alias mattpocock /tdd per D-13)
4
+ # Phase v2.0-2.3 Wave 0 T2.3.W0.2 ship per D-13 (6 fires + 3 skips)
5
+
6
+ schema_version: harnessed.judgment.v1
7
+
8
+ triggers:
9
+ tdd-strongly-suggested:
10
+ description: |
11
+ superpowers:test-driven-development (red-green-refactor) — 子任务为
12
+ 核心业务逻辑 / 算法 / 数据处理, 或回归 bug 风险高, 或需要高可靠性时
13
+ 强烈建议开启 TDD。Alias /tdd (mattpocock-skills) 可替代。
14
+ fires_when: "subtask.is_core_business_logic == true or subtask.is_algorithm == true or subtask.is_data_processing == true or subtask.regression_risk == 'high' or subtask.reliability_required == true"
15
+ skips_when: "subtask.type in ['crud', 'ui_polish', 'docs_only']"
16
+ invokes:
17
+ - capability: tdd
@@ -1,8 +1,11 @@
1
1
  ---
2
2
  name: plan-feature
3
3
  description: |
4
- plan-feature workflow — 5-phase three-layer-stack composition (gstack governance →
5
- superpowers brainstorm → GSD discuss → GSD plan → planning-with-files persist).
4
+ plan-feature workflow v2 — 5-phase 三层栈 composition (gstack governance gate
5
+ superpowers brainstorm → GSD /gsd-discuss-phase → GSD /gsd-plan-phase
6
+ planning-with-files Claude Code plugin slash cmd `/plan` 持久化 task_plan.md +
7
+ progress.md + findings.md). schema_version: harnessed.workflow.v2 with
8
+ capability template interpolation + 4-level gate refs + conditional `on` clauses.
6
9
  Triggered by harnessed CLI `harnessed plan-feature --task <text>` or slash command
7
10
  `/plan-feature` after `harnessed setup`.
8
11
  trigger_phrases:
@@ -12,26 +15,61 @@ trigger_phrases:
12
15
  - "跑 plan-feature"
13
16
  ---
14
17
 
15
- # plan-feature workflow
18
+ # plan-feature workflow (v2)
16
19
 
17
20
  ## Overview
18
21
 
19
22
  5-phase chain mapping the user's CLAUDE.md Discuss + Plan discipline onto the harnessed
20
- runtime (ADR 0011 SDK + ralph-loop integration):
23
+ runtime, upgraded to `harnessed.workflow.v2` schema (Phase v2.0-2.4 W1 T2.4.W1.3 —
24
+ D-15 + Q-AUDIT-5a Option A: planning-with-files = Claude Code plugin slash cmd
25
+ `/plan` 真接, **NOT** npm SDK call, **NOT** fs.writeFile self-impl).
21
26
 
22
- | phase | id | upstream | model | rationale |
23
- | ----- | -- | -------- | ----- | --------- |
24
- | 1 | `01-gstack-decision` | `gstack` `/office-hours` governance gate | opus | 多角色决策关卡 (CEO/EM/Designer/Paranoid/QA/CSO) |
25
- | 2 | `02-brainstorm` | `superpowers brainstorming` + ui-ux-pro-max | sonnet | 任务复杂度澄清 + UI 设计方案 |
26
- | 3 | `03-gsd-discuss` | `gsd` `/gsd-discuss-phase` | sonnet | 灰色地带澄清 4-question batch |
27
- | 4 | `04-gsd-plan` | `gsd` `/gsd-plan-phase` | sonnet | Wave A research + Wave B planner + Wave C checker |
28
- | 5 | `05-persist` | `planning-with-files` | haiku | task_plan.md + progress.md + findings.md 持久化 |
27
+ | phase | id | upstream | model | capability / invokes | gate / on |
28
+ | ----- | -- | -------- | ----- | -------------------- | --------- |
29
+ | 1 | `01-gstack-decision` | gstack | opus | `{{ capabilities.gstack-office-hours.cmd }}` / `{{ gstack_prefix }}office-hours` | `gate: judgments.strategic-gate.office-hours.fires` |
30
+ | 2 | `02-brainstorm` | superpowers | sonnet | `{{ capabilities.superpowers-brainstorming.cmd }}` | `on: judgments.subtask-gate.brainstorming.fires invoke` |
31
+ | 3 | `03-gsd-discuss` | gsd | sonnet | `{{ capabilities.gsd-discuss-phase.cmd }}` | `on: judgments.phase-gate.gsd-discuss-phase.fires invoke` |
32
+ | 4 | `04-gsd-plan` | gsd | sonnet | `invokes: gsd-plan-phase` (literal v2.x patch followup capabilities entry) | |
33
+ | 5 | `05-persist` | planning-with-files | haiku | `{{ capabilities.planning-with-files.cmd }}` / `invokes: /plan` | `on: phase.scope_days > 1 or phase.is_critical_module invoke` |
29
34
 
30
35
  Per-phase config loads from `workflows/plan-feature/workflow.yaml`; engine.runRouting
31
36
  spawns each phase as a sub-agent via `@anthropic-ai/claude-agent-sdk` 0.3.142+.
32
37
 
33
- Phase 1 (gstack governance) uses `on_veto: halt_workflow` — any CEO/EM veto halts the
34
- entire workflow before proceeding to brainstorm or planning.
38
+ ### v1 v2 字段 delta
39
+
40
+ - ADD `schema_version: harnessed.workflow.v2` (T2.4.W0.1 16th surface — first .v2)
41
+ - ADD `description` root field (workflow purpose summary)
42
+ - ADD `phase.capability: '{{ capabilities.<name>.cmd }}'` template interpolation (D-10)
43
+ - ADD `phase.gate: judgments.<file>.<trigger>.fires` 4-level ref (D-04, pre-resolved by `judgmentResolver`)
44
+ - ADD `phase.on: [{if, invoke|action}]` conditional clause (D-09)
45
+ - ADD `phase.artifacts_expected: [...]` 3-file persistence list (D-15)
46
+ - CHANGE `max_iterations` 改用 `{{ defaults.ralph_max_iterations.plan-feature.<phase> }}` jinja ref (T2.3.W1.2 ship)
47
+ - KEEP `invokes: '/plan'` literal at 05-persist (Q-AUDIT-5a anti-pattern guard)
48
+
49
+ ### Phase 1 governance gate
50
+
51
+ Phase 1 (gstack governance) uses workflow-level `on_veto: halt_workflow` — any
52
+ CEO/EM/Designer/Paranoid/QA/CSO veto halts the entire workflow before proceeding
53
+ to brainstorm or planning (D-04 PUSH 任 1 phase 转换前 read = vetoed → 全 halt).
54
+
55
+ ### Phase 5 planning-with-files plugin 真接 (Q-AUDIT-5a LOCKED Option A)
56
+
57
+ 05-persist invokes the **Claude Code plugin** slash command `/plan` via plugin
58
+ cache at `~/.claude/plugins/cache/planning-with-files/planning-with-files/2.34.0/`
59
+ (verified 2026-05-20). The plugin generates 3 markdown files in
60
+ `.planning/<phase-id>/`:
61
+
62
+ - `task_plan.md` — 主计划 (task 列表 + 文件路径 + 依赖顺序 + 验收标准)
63
+ - `progress.md` — 跨 session 进度跟踪
64
+ - `findings.md` — 调研发现 / 知识沉淀
65
+
66
+ Q-AUDIT-5a rejected alternatives (anti-pattern guard verified by
67
+ `tests/workflow/plan-feature-v2.test.ts`):
68
+
69
+ - (b) plugin script direct spawn — Windows PowerShell 跨平台不友好
70
+ - (c) `fs.writeFile` self-implementation — duplicates plugin functionality, breaks
71
+ multi-IDE compatibility (sister .continue / .factory / .gemini / .codebuddy /
72
+ .cursor structure 已就绪)
35
73
 
36
74
  ## CLI invocation
37
75
 
@@ -52,5 +90,9 @@ command `/plan-feature` automatically (Gap B fix — v1.0.2).
52
90
  ## References
53
91
 
54
92
  - ADR 0011 — SDK + ralph-loop integration
55
- - `workflows/plan-feature/workflow.yaml` — 5-phase config
93
+ - `workflows/plan-feature/workflow.yaml` — 5-phase config (v2 schema)
94
+ - `workflows/capabilities.yaml` — capability manifest (35 entry baseline)
95
+ - `workflows/judgments/{strategic-gate,phase-gate,subtask-gate}.yaml` — gate refs
96
+ - `workflows/defaults.yaml` — ralph_max_iterations.plan-feature.* values
56
97
  - `docs/WORKFLOW.md` — 4-stage workflow mermaid + gap analysis
98
+ - `.planning/phase-v2.0-2.2/RESEARCH.md` § 5.3 — D-15 实装路径 reframe
@@ -1,40 +1,81 @@
1
- # workflows/plan-feature/workflow.yaml — Phase 3.2 W2 T2.4 (D-03 WIRED LOCKED)
2
- # 5-phase reference implementation; Phase 3.3+ dogfood 时换真 gsd-discuss/plan/execute spawn.
3
- # R7.1 acceptance: 30 plan-feature 场景跑通 + CEO veto halt_workflow
4
- # R7.4 acceptance: 用户三种前缀场景任一都跑通 (JINJA `{{ gstack_prefix }}` 插值)
1
+ # workflows/plan-feature/workflow.yaml — Phase v2.0-2.4 W1 T2.4.W1.3 (D-15 + Q-AUDIT-5a LOCKED)
2
+ # 5-phase 三层栈 composition: gstack governance superpowers brainstorm → GSD discuss/plan → planning-with-files plugin /plan persist
3
+ # v1 v2 delta (sister L1-40):
4
+ # ADD `schema_version: harnessed.workflow.v2` (T2.4.W0.1 16th surface)
5
+ # ADD `description` root field (workflow purpose)
6
+ # ADD `capability: '{{ capabilities.<name>.cmd }}'` 各 phase (D-10 template interpolation)
7
+ # ADD `gate: judgments.<file>.<trigger>.fires` 01-gstack-decision (D-04 gate reference)
8
+ # ADD `on: [{if, invoke}]` 02-brainstorm + 03-gsd-discuss (D-09 conditional clause)
9
+ # ADD `artifacts_expected: [...]` 05-persist (D-15 planning-with-files 3 file 持久化)
10
+ # ADD `max_iterations: '{{ defaults.ralph_max_iterations.plan-feature.<phase> }}'` (T2.3.W1.2 ship)
11
+ # KEEP `invokes: '/plan'` literal at 05-persist (Q-AUDIT-5a Claude Code plugin slash cmd, NOT npm SDK NOT fs.writeFile)
12
+ # Q-AUDIT-5a anti-pattern guard (verified by tests/workflow/plan-feature-v2.test.ts):
13
+ # - NO npm SDK call (no `import` / `require` planning-with-files — yaml syntax natively absent)
14
+ # - NO fs.writeFile self-impl (no `fs.writeFile` / `writeFile` reference — anti-pattern reviewer guard)
15
+ # - YES `invokes: '/plan'` literal at 05-persist (plugin slash cmd 真接 path a)
16
+ # - YES `capability: '{{ capabilities.planning-with-files.cmd }}'` template ref (resolve to /plan via capabilities.yaml L317)
17
+ # 04-gsd-plan phase: `gsd-plan-phase` 在 capabilities.yaml 中暂未单独 entry — 沿袭 v1 L32 literal pattern (D-08 v2.x patch followup
18
+ # 添加 gsd-plan-phase capability entry; v2.0 baseline 不阻塞 ship per T2.4.W1.3 Implementation Tasks #4-#5 scope)
19
+
20
+ schema_version: harnessed.workflow.v2
5
21
  workflow: plan-feature
6
- on_veto: halt_workflow # workflow-level (NOT per-phase per RESEARCH § 5.2 DRY) — D-04 PUSH 任 1 phase 转换前 read = vetoed → 全 halt
22
+ description: |
23
+ plan-feature 5-phase 三层栈 workflow — gstack governance gate (CEO/EM/Designer/Paranoid/QA/CSO)
24
+ → superpowers brainstorm 子任务级澄清 → GSD /gsd-discuss-phase 灰色澄清 → GSD /gsd-plan-phase
25
+ Wave A/B/C planning → planning-with-files Claude Code plugin slash cmd `/plan` 持久化 3 file
26
+ (task_plan.md + progress.md + findings.md) 在 .planning/<phase-id>/.
27
+ Phase 1 gstack governance veto halts the entire workflow (D-04 PUSH) — engine-level
28
+ on_veto wiring lives in runtime, NOT yaml v2 root schema (WorkflowSchemaV2 strict
29
+ additionalProperties:false per T2.4.W0.1 + STRIDE T-2.2-02).
30
+
7
31
  phases:
8
32
  - id: 01-gstack-decision
9
33
  name: gstack-decision (governance gate — CEO/EM/Designer/Paranoid/QA/CSO)
10
34
  upstream: gstack
11
- model: opus # 高层决策 = opus
12
- invokes: '{{ gstack_prefix }}office-hours' # D-02 JINJA 插值 (gstack-office-hours OR office-hours)
13
- skills: ['plan-feature-decision']
14
- max_iterations: 1
35
+ capability: '{{ capabilities.gstack-office-hours.cmd }}'
36
+ invokes: '{{ gstack_prefix }}office-hours'
37
+ model: opus
38
+ gate: judgments.strategic-gate.office-hours.fires
39
+ max_iterations: '{{ defaults.ralph_max_iterations.plan-feature.01-gstack-decision }}'
40
+
15
41
  - id: 02-brainstorm
16
- name: brainstorm (execution + ui-ux-pro-max UI 任务)
42
+ name: brainstorm (子任务级澄清 multi-approach)
17
43
  upstream: superpowers
18
- model: sonnet # 设计澄清 = sonnet
19
- skills: ['plan-feature-brainstorm']
20
- max_iterations: 5
44
+ capability: '{{ capabilities.superpowers-brainstorming.cmd }}'
45
+ model: sonnet
46
+ on:
47
+ - if: judgments.subtask-gate.brainstorming.fires
48
+ invoke: '{{ capabilities.superpowers-brainstorming.cmd }}'
49
+ max_iterations: '{{ defaults.ralph_max_iterations.plan-feature.02-brainstorm }}'
50
+
21
51
  - id: 03-gsd-discuss
22
- name: gsd-discuss (orchestration — phase discussion)
52
+ name: gsd-discuss (orchestration — phase 灰色澄清 4-question batch)
23
53
  upstream: gsd
54
+ capability: '{{ capabilities.gsd-discuss-phase.cmd }}'
24
55
  model: sonnet
25
- invokes: 'gsd-discuss-phase' # GSD 命令固定无 prefix
26
- skills: ['plan-feature-discuss']
27
- max_iterations: 3
56
+ on:
57
+ - if: judgments.phase-gate.gsd-discuss-phase.fires
58
+ invoke: '{{ capabilities.gsd-discuss-phase.cmd }}'
59
+ max_iterations: '{{ defaults.ralph_max_iterations.plan-feature.03-gsd-discuss }}'
60
+
28
61
  - id: 04-gsd-plan
29
- name: gsd-plan (orchestration — phase planning)
62
+ name: gsd-plan (orchestration — Wave A research + Wave B planner + Wave C checker)
30
63
  upstream: gsd
31
- model: sonnet
32
64
  invokes: 'gsd-plan-phase'
33
- skills: ['plan-feature-plan']
34
- max_iterations: 3
65
+ model: sonnet
66
+ max_iterations: '{{ defaults.ralph_max_iterations.plan-feature.04-gsd-plan }}'
67
+
35
68
  - id: 05-persist
36
- name: persist (planning-with-files MD persistence)
69
+ name: persist (planning-with-files plugin /plan — Manus-style markdown persistence)
37
70
  upstream: planning-with-files
38
- model: haiku # 文档写入 = haiku 省 token (sister Phase 2.2 CD-2 04-deliver=haiku)
39
- skills: ['plan-feature-persist']
40
- max_iterations: 5
71
+ capability: '{{ capabilities.planning-with-files.cmd }}'
72
+ invokes: '/plan'
73
+ model: haiku
74
+ on:
75
+ - if: phase.scope_days > 1 or phase.is_critical_module == true
76
+ action: invoke
77
+ artifacts_expected:
78
+ - task_plan.md
79
+ - progress.md
80
+ - findings.md
81
+ max_iterations: '{{ defaults.ralph_max_iterations.plan-feature.05-persist }}'
@@ -0,0 +1,35 @@
1
+ ---
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`.
4
+ preamble-tier: 2
5
+ ---
6
+
7
+ # research workflow
8
+
9
+ Multi-source research workflow shipped with harnessed v2.0 (Stage ① Discuss).
10
+
11
+ ## Phases (2)
12
+
13
+ | # | Phase | Upstream | Capability | Model | Description |
14
+ |---|-------|----------|-----------|-------|-------------|
15
+ | 01 | `01-fan-out` | web-search | (route-by-subtask) | sonnet | 3 source fan-out (Tavily MCP / Exa MCP / ctx7 CLI per ~/.claude/rules/web-search.md + context7.md routing) |
16
+ | 02 | `02-synth` | gsd | `gsd-discuss-phase` | opus | GSD discuss-phase aggregate + dedup + reconcile |
17
+
18
+ ## Capability refs
19
+
20
+ Sister `workflows/capabilities.yaml` entries:
21
+ - `tavily-mcp` (impl: mcp-server, default 关键词)
22
+ - `exa-mcp` (impl: mcp-server, 描述式 / 学术)
23
+ - `ctx7` (impl: cli-tool, 库 API 文档)
24
+ - `gsd-discuss-phase` (synth aggregate)
25
+
26
+ ## Invocation
27
+ - CLI: `harnessed research --topic "<topic>"`
28
+ - Slash command: `/research <topic>` (after `harnessed setup`)
29
+
30
+ ## Routing rules (sister ~/.claude/rules/web-search.md)
31
+ - 描述式查询 ("找一篇对比 X 和 Y 的博客") → Exa MCP
32
+ - 学术 / 论文 → Exa MCP
33
+ - 库 / API 文档 → ctx7 CLI (per ~/.claude/rules/context7.md)
34
+ - 关键词 / 时效内容 → Tavily MCP (默认)
35
+ - 抓整站 / 站点结构 → Tavily crawl/map
@@ -0,0 +1,18 @@
1
+ schema_version: harnessed.workflow.v2
2
+ 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
4
+
5
+ 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
7
+ - id: 01-fan-out
8
+ upstream: web-search
9
+ model: sonnet
10
+ max_iterations: '{{ defaults.ralph_max_iterations.research.01-fan-out }}'
11
+ parallelism: judgments.parallelism-gate.subagent-default.fires
12
+
13
+ # 02-synth: GSD discuss synth aggregate — 多源结果 dedup + reconcile + GSD discuss-phase format
14
+ - id: 02-synth
15
+ upstream: gsd
16
+ capability: '{{ capabilities.gsd-discuss-phase.cmd }}'
17
+ model: opus
18
+ max_iterations: '{{ defaults.ralph_max_iterations.research.02-synth }}'
@@ -0,0 +1,92 @@
1
+ ---
2
+ name: verify-work
3
+ description: |
4
+ verify-work workflow v2 — Stage ④ Verify 9-phase composition per CLAUDE.md verbatim
5
+ (gsd-verify-work + gsd-progress 必跑串行 → code-review 多 agent 并行 fan-out → gstack /review
6
+ 关键模块强制 → 可选 /qa /cso /design-review conditional → code-simplifier 末尾串行 →
7
+ 关键发布/大重构 PR 升级 4-specialist Agent Team Pattern C 多维度审查 互相质询)。
8
+ schema_version: harnessed.workflow.v2 with capability template interpolation + parallelism
9
+ gate refs + conditional `on` clauses. Triggered by harnessed CLI `harnessed verify-work
10
+ --phase <num>` or slash command `/verify-work` after `harnessed setup`.
11
+ trigger_phrases:
12
+ - "verify work"
13
+ - "verify-work workflow"
14
+ - "Stage 4 verify"
15
+ - "跑 verify-work"
16
+ ---
17
+
18
+ # verify-work workflow (v2)
19
+
20
+ ## Overview
21
+
22
+ 9-phase chain mapping the user's CLAUDE.md Stage ④ Verify discipline onto the harnessed
23
+ runtime, fully `harnessed.workflow.v2` schema (Phase v2.0-2.4 W2 T2.4.W2.2 — D-12
24
+ Q-AUDIT-2 amend + R20.12 + R20.11 + R20.14).
25
+
26
+ | phase | id | upstream | model | capability / invokes | gate / on / parallelism |
27
+ | ----- | -- | -------- | ----- | -------------------- | ----------------------- |
28
+ | 1 | `01-gsd-verify-work` | gsd | sonnet | `{{ capabilities.gsd-verify-work.cmd }}` | serial — `max_iterations: 3` |
29
+ | 2 | `02-gsd-progress` | gsd | haiku | `{{ capabilities.gsd-progress.cmd }}` | serial — `max_iterations: 2` |
30
+ | 3 | `03-code-review-parallel` | mattpocock-skills | sonnet | `{{ capabilities.code-review.cmd }}` | `parallelism: judgments.parallelism-gate.subagent-default.fires` |
31
+ | 4 | `04-gstack-review-conditional` | gstack | opus | `{{ capabilities.gstack-review.cmd }}` | `on: phase.is_critical_module → invoke / else skip` |
32
+ | 5 | `05-qa-conditional` | gstack | sonnet | `{{ capabilities.gstack-qa.cmd }}` | `on: phase.has_ui_changes → invoke / else skip` |
33
+ | 6 | `06-cso-conditional` | gstack | opus | `{{ capabilities.gstack-cso.cmd }}` | `on: phase.has_auth_or_secrets → invoke / else skip` |
34
+ | 7 | `07-design-review-conditional` | gstack | sonnet | `{{ capabilities.gstack-design-review.cmd }}` | `on: phase.has_design_changes → invoke / else skip` |
35
+ | 8 | `08-code-simplifier` | mattpocock-skills | sonnet | `{{ capabilities.code-simplifier.cmd }}` | serial 末尾 — `max_iterations: 5` |
36
+ | 9 | `09-agent-team-multispecialist` | claude-platform | opus | `{{ capabilities.agent-teams-create.cmd }}` | `parallelism: judgments.parallelism-gate.agent-teams-upgrade.fires`; `on: is_major_release OR is_large_refactor → invoke` |
37
+
38
+ Per-phase config loads from `workflows/verify-work/workflow.yaml`; engine.runRouting
39
+ spawns each phase as a sub-agent via `@anthropic-ai/claude-agent-sdk` 0.3.142+.
40
+
41
+ ## Phase 9 Pattern C 4-specialist Agent Team (D-11 + R20.11)
42
+
43
+ The Agent Team upgrade phase (`09-agent-team-multispecialist`) follows
44
+ `~/.claude/rules/agent-teams.md` Pattern C 多维度审查 verbatim — 4 teammate
45
+ (code-review + gstack-review + gstack-cso + gstack-qa) 互相 SendMessage 质询
46
+ findings 是否真问题 (NOT fire-and-forget subagent fan-out)。Token estimate
47
+ `team_cost < 2 × subagent_cost` is a prereq per agent-teams.md L34 (engine-level
48
+ check, NOT yaml schema scope). Cleanup mandatory: `SendMessage shutdown_request`
49
+ + `TeamDelete` after round-trip complete (防呆清单 per agent-teams.md L46-L48).
50
+
51
+ Trigger condition: `phase.is_major_release == true OR phase.is_large_refactor
52
+ == true`. 常规 PR / 单点任务**不触发** Pattern C — code-review fan-out (phase 3)
53
+ + gstack-review conditional (phase 4) 已够用且更省 token (per CLAUDE.md "Verify
54
+ 阶段" 末段 "关键发布 / 大重构 PR" 限定语)。
55
+
56
+ ## R20.16 chain_isolation 实装 (3 铁律 fallback)
57
+
58
+ 每个 conditional phase (4-7, 9) 都实装 `on: [{if: ..., action: invoke}, {if:
59
+ ..., action: skip}]` — skip 04-gstack-review **不**级联跳过 06-cso-conditional,
60
+ 等等。验证脚本 `node scripts/check-workflow-schema.mjs` 严格 schema 校验 +
61
+ runtime engine 独立判 condition。
62
+
63
+ ## CLI invocation
64
+
65
+ ```bash
66
+ # Dry-run preview — arbitrate-only, never spawns SDK.
67
+ harnessed verify-work --phase <num> --dry-run --non-interactive
68
+
69
+ # Apply path — real SDK spawn + 9-phase chain (conditional phases evaluate by phase fact context).
70
+ harnessed verify-work --phase <num> --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/verify-work/` — Claude Code then loads the slash
77
+ command `/verify-work` automatically (Gap B fix — v1.0.2 sister mechanism).
78
+
79
+ ## References
80
+
81
+ - D-12 (Q-AUDIT-2 amend) — verify-work 7+ phase 完整 4-stage 重定
82
+ - R20.12 — verify-work full scope acceptance
83
+ - R20.11 — 4-specialist Agent Team upgrade
84
+ - R20.14 — special-purpose /qa /cso /design-review conditional
85
+ - R20.7 — D-08 verify-work NEW 2 之一
86
+ - R20.16 — fallback 3 铁律 chain_isolation
87
+ - ~/.claude/CLAUDE.md "Verify 阶段" 7-step verbatim
88
+ - ~/.claude/rules/agent-teams.md Pattern C 多维度审查
89
+ - `workflows/capabilities.yaml` — gsd-verify-work / gsd-progress / code-review / gstack-{review,qa,cso,design-review} / code-simplifier / agent-teams-create entries
90
+ - `workflows/judgments/parallelism-gate.yaml` — subagent-default + agent-teams-upgrade.fires
91
+ - `workflows/defaults.yaml` — ralph_max_iterations.verify-work.* values
92
+ - `docs/WORKFLOW.md` — 4-stage workflow mermaid + Stage ④ Verify 章节