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
@@ -1,5 +1,6 @@
1
1
  # harnessed v2.0 workflow defaults
2
2
  # Phase v2.0-2.3 W1.2 ship — ralph_max_iterations table per R20.10 + D-10 fallback abort path
3
+ # Phase v3.0-3.4 W2.2 extend — 18 v3 sub-workflow + retro standalone × phase entries
3
4
  # Sister Phase 2.2 STRIDE T-2.2-05 DoS mitigation: hard_upper_limit = 100 caps any user override
4
5
  # Phase 2.4 workflow.yaml v2 interpolation: {{ defaults.ralph_max_iterations.<workflow>.<phase> }}
5
6
 
@@ -8,6 +9,7 @@ schema_version: harnessed.defaults.v1
8
9
  # Per-workflow per-phase ralph-loop iteration ceiling
9
10
  # Values balance: completion guarantee vs DoS prevention; sister ADR 0011 v0.2.0 ralph-loop SDK pattern
10
11
  ralph_max_iterations:
12
+ # v2 legacy (Phase 2.3 W1.2 SHIPPED, deprecated v3.0 per D-04 release-notes-only migration)
11
13
  execute-task:
12
14
  01-clarify: 5
13
15
  02-code: 20
@@ -21,16 +23,81 @@ ralph_max_iterations:
21
23
  04-gsd-plan: 3
22
24
  05-persist: 5
23
25
 
24
- research:
25
- 01-fan-out: 3
26
- 02-synth: 3
27
-
28
26
  verify-work:
29
27
  01-gsd-verify-work: 3
30
28
  02-code-review: 5
31
29
  03-gstack-review: 3
32
30
  04-code-simplifier: 5
33
31
 
32
+ # v3 standalone (research v3 schema bump + retro NEW per Phase 3.4 W1.1+W1.2)
33
+ research:
34
+ 01-fan-out: 3
35
+ 02-synth: 3
36
+
37
+ retro:
38
+ 01-retro: 3
39
+ 02-persist: 3
40
+
41
+ # v3 sub-workflow — discuss stage (3 sub per Phase 3.4 W0.1-W0.3)
42
+ discuss-strategic:
43
+ 01-office-hours: 5
44
+ 02-plan-ceo-review: 3
45
+
46
+ discuss-phase:
47
+ 01-gsd-discuss-phase: 5
48
+
49
+ discuss-subtask:
50
+ 01-brainstorm: 5
51
+
52
+ # v3 sub-workflow — plan stage (2 sub per Phase 3.4 W0.4-W0.5)
53
+ plan-architecture:
54
+ 01-plan-eng-review: 3
55
+
56
+ plan-phase:
57
+ 01-gsd-plan-phase: 5
58
+ 02-persist: 5
59
+
60
+ # v3 sub-workflow — task stage (4 sub per Phase 3.4 W0.6-W0.9)
61
+ task-clarify:
62
+ 01-clarify: 5
63
+
64
+ task-code:
65
+ 01-code: 20
66
+
67
+ task-test:
68
+ 01-test: 15
69
+
70
+ task-deliver:
71
+ 01-deliver: 20
72
+
73
+ # v3 sub-workflow — verify stage (8 sub per Phase 3.4 W0.10-W0.13a-e)
74
+ verify-progress:
75
+ 01-gsd-verify-work: 3
76
+ 02-gsd-progress: 3
77
+ 03-persist: 3
78
+
79
+ verify-code-review:
80
+ 01-code-review: 5
81
+
82
+ verify-paranoid:
83
+ 01-gstack-review: 3
84
+
85
+ verify-qa:
86
+ 01-qa: 3
87
+
88
+ verify-security:
89
+ 01-cso: 3
90
+
91
+ verify-design:
92
+ 01-design-review: 3
93
+
94
+ verify-simplify:
95
+ 01-code-simplifier: 5
96
+
97
+ verify-multispec:
98
+ 01-team-create: 1
99
+ 02-team-cleanup: 1
100
+
34
101
  # Hard upper limit — workflow engine rejects any user override > this value
35
102
  # Sister Phase 2.2 STRIDE T-2.2-05 DoS mitigation
36
103
  hard_upper_limit: 100
@@ -0,0 +1,47 @@
1
+ # workflows/disciplines/karpathy.yaml
2
+ # karpathy 心法 + 编码硬限 — 机器化 ~/.claude/CLAUDE.md 「andrej-karpathy-skills」 节
3
+ # Phase v3.0-3.3 W0.4 ship per D-09 (L0 Discipline Substrate)
4
+ # Snapshot of CLAUDE.md as of v3.0 ship date (K7 mitigation, verbatim)
5
+
6
+ schema_version: harnessed.discipline.v1
7
+ discipline: karpathy
8
+ enforcement_layer: code-writing
9
+ auto_enforce: true
10
+
11
+ rules:
12
+ - id: think-before-coding
13
+ description: 先思考后写代码,不直接 dump 代码;每个子任务前 brainstorm 设计意图
14
+ enforcement: warn
15
+ trigger: subtask.type == 'code-write'
16
+ check_method: heuristic
17
+ # check_method='heuristic' — runtime engine 检查 subagent 输出 first 200 char 是否含设计意图 marker
18
+ # (e.g., 'Plan:' / 'Approach:' / '设计:' / '思路:'),若全是 code block → warn
19
+
20
+ - id: simplicity-first
21
+ description: 追求最小有效代码,避免不必要复杂度;YAGNI / 不为假设场景写代码
22
+ enforcement: warn
23
+ trigger: always-on
24
+ check_method: llm-judge
25
+ # check_method='llm-judge' — verify phase 调用 code-simplifier review
26
+
27
+ - id: surgical-changes
28
+ description: 小步原子修改,每个 commit 单一职责;不大段重写
29
+ enforcement: warn
30
+ trigger: phase.type == 'execute'
31
+ check_method: external-cmd
32
+ auto_fix_cmd: 'git diff --stat HEAD~1 | awk ''{lines+=$3} END {if (lines>300) exit 1}'''
33
+ # 单 commit > 300 line diff → warn (rough heuristic, override allowed via task spec)
34
+
35
+ - id: goal-driven-execution
36
+ description: 目标驱动,不发散 / 不无关重构;只解决当前任务 + 不夹带 cleanup
37
+ enforcement: warn
38
+ trigger: phase.type == 'execute'
39
+ check_method: heuristic
40
+
41
+ - id: file-length-200-hard-limit
42
+ description: 单文件 ≤200L 硬限 (per project CLAUDE.md karpathy 心法 reminder);超过 → split helper
43
+ enforcement: halt
44
+ trigger: phase.type == 'execute' AND file.lines > 200
45
+ check_method: external-cmd
46
+ auto_fix_cmd: 'wc -l <file> | awk ''{if ($1>200) exit 1}'''
47
+ # 实装 split helper pattern (sister fallbackHandlers.ts / sdkReconcile.ts ≤80L)
@@ -0,0 +1,38 @@
1
+ # workflows/disciplines/language.yaml
2
+ # 语言与输出规范 — 机器化 ~/.claude/CLAUDE.md 「语言与输出规范」 节
3
+ # Phase v3.0-3.3 W0.4 ship per D-09
4
+ # Snapshot of CLAUDE.md as of v3.0 ship date (K7 mitigation, verbatim)
5
+
6
+ schema_version: harnessed.discipline.v1
7
+ discipline: language
8
+ enforcement_layer: output
9
+ auto_enforce: true
10
+
11
+ rules:
12
+ - id: default-language-zh-hans
13
+ description: 默认输出语言简体中文 (zh-Hans);所有解释/分析/计划/总结/提问/状态更新一律中文
14
+ enforcement: warn
15
+ trigger: user.lang_request == null
16
+ check_method: heuristic
17
+ # heuristic — response 中文 char 占比 > 60% (排除 code block);占比 < 30% → warn
18
+
19
+ - id: preserve-english-categories
20
+ description: 8 类强制保留英文原文,不翻译不音译
21
+ enforcement: warn
22
+ trigger: always-on
23
+ check_method: heuristic
24
+ # 8 类 (verbatim CLAUDE.md):
25
+ # 1. 代码/命令/shell/配置/正则/SQL
26
+ # 2. 文件/目录/路径名 (src/components/Button.tsx 等)
27
+ # 3. 工具/框架/库/产品/公司名 (Claude Code / GSD / React 等)
28
+ # 4. API/函数/类/变量/字段/环境变量/配置键
29
+ # 5. 错误信息/stack trace/log 输出
30
+ # 6. URL / commit hash / issue / PR 编号 / 版本号 / git ref
31
+ # 7. 业内固定缩写与通用术语 (TDD / CRUD / API / MCP / token 等)
32
+ # 8. 引用原文 verbatim
33
+
34
+ - id: lang-request-override
35
+ description: 用户明确"用英文回答"/"reply in English"/"翻译成 X" → 整段切换目标语言
36
+ enforcement: info
37
+ trigger: user.lang_request != null
38
+ check_method: regex
@@ -0,0 +1,61 @@
1
+ # workflows/disciplines/operational.yaml
2
+ # 操作纪律 — 机器化 project CLAUDE.md (biome preempt + commit safety) +
3
+ # ~/.claude/CLAUDE.md (A7 ADR / no-skip-hooks / authorization-not-transitive)
4
+ # Phase v3.0-3.3 W0.4 ship per D-09
5
+ # Snapshot of CLAUDE.md as of v3.0 ship date (K7 mitigation, verbatim)
6
+
7
+ schema_version: harnessed.discipline.v1
8
+ discipline: operational
9
+ enforcement_layer: commit
10
+ auto_enforce: true
11
+
12
+ rules:
13
+ - id: biome-preempt
14
+ description: |
15
+ TS/JS commit 前必跑 `pnpm exec biome check --write` (3 CI-red recurrences Phase 2.1.1/2.2/2.3 project memory)
16
+ enforcement: auto-fix
17
+ trigger: |
18
+ phase.type == 'commit' AND
19
+ changed_files matches '\\.(ts|tsx|js|mjs)$'
20
+ check_method: external-cmd
21
+ auto_fix_cmd: 'corepack pnpm exec biome check --write'
22
+ # NEW src/discipline/enforcement/before-commit.ts hook; exit 0 才允许 commit
23
+
24
+ - id: a7-adr-conservation
25
+ description: |
26
+ 新 ADR 不动旧 ADR main body,baseline tag iterate,CI A7 step 守恒
27
+ (sister Phase 1.3-2.6 ADR errata 路径)
28
+ enforcement: warn
29
+ trigger: phase.type == 'commit' AND changed_files contains 'docs/adr/'
30
+ check_method: external-cmd
31
+ auto_fix_cmd: 'scripts/check-adr-conservation.sh'
32
+
33
+ - id: no-push-without-approval
34
+ description: |
35
+ NEVER push to remote without user explicit approval (project CLAUDE.md commit safety)
36
+ enforcement: halt
37
+ trigger: cmd.type == 'git-push'
38
+ check_method: external-cmd
39
+ # ralph-loop / subagent 自动调 git push → halt;user explicit `git push` 在主 session 允许
40
+
41
+ - id: no-skip-hooks
42
+ description: |
43
+ 不允许 --no-verify / --no-gpg-sign 等 skip hook flag,除非用户明确要求
44
+ enforcement: halt
45
+ trigger: cmd.type == 'git-commit' AND args contains '--no-verify'
46
+ check_method: regex
47
+
48
+ - id: destructive-ops-explicit
49
+ description: |
50
+ Destructive ops (git reset --hard / push --force / rm -rf / drop table) 必须用户 explicit 确认
51
+ enforcement: halt
52
+ trigger: cmd.is_destructive == true
53
+ check_method: heuristic
54
+ # heuristic — 命令含 'rm -rf' / 'reset --hard' / '--force' / 'DROP TABLE' / 'delete from'
55
+
56
+ - id: authorization-not-transitive
57
+ description: |
58
+ 用户 approve 一次 push ≠ 全程 approve;每个 destructive / shared-state 操作单独确认
59
+ enforcement: warn
60
+ trigger: cmd.requires_approval == true AND session.has_prior_approval == true
61
+ check_method: heuristic
@@ -0,0 +1,62 @@
1
+ # workflows/disciplines/output-style.yaml
2
+ # 对话回答风格 — 机器化 ~/.claude/CLAUDE.md 「对话回答风格」 节
3
+ # Phase v3.0-3.3 W0.4 ship per D-09
4
+ # Snapshot of CLAUDE.md as of v3.0 ship date (K7 mitigation, verbatim)
5
+
6
+ schema_version: harnessed.discipline.v1
7
+ discipline: output-style
8
+ enforcement_layer: output
9
+ auto_enforce: true
10
+
11
+ rules:
12
+ - id: bluf-conclusion-first
13
+ description: 结论先行 (BLUF),每段先一句给答案/判断/推荐,再展开理由
14
+ enforcement: warn
15
+ trigger: always-on
16
+ check_method: heuristic
17
+ # heuristic — 第一句长度 ≤ 100 char + 含答案动词 ('是' / '不是' / '推荐' / '应该' / 'use X')
18
+ # 失败 → warn 'BLUF missing: first sentence is not a conclusion'
19
+
20
+ - id: no-sycophantic-open-close
21
+ description: 删除"好问题/太棒了/完美/希望对你有帮助/还需要别的吗"等开场闭合套话
22
+ enforcement: auto-fix
23
+ trigger: always-on
24
+ check_method: regex
25
+ auto_fix_cmd: 'strip-sycophantic'
26
+ # NEW src/discipline/enforcement/strip-sycophantic.ts — regex strip 13 known phrase
27
+
28
+ - id: no-emoji-unless-requested
29
+ description: 禁用 emoji,除非用户明确要求 (项目 markdown 文件如 README/PR/CHANGELOG 不约束)
30
+ enforcement: warn
31
+ trigger: response.target == 'chat' AND user.requested_emoji == false
32
+ check_method: regex
33
+ # regex /\p{Emoji_Presentation}/u; 命中 + trigger fires → warn
34
+
35
+ - id: no-em-dash
36
+ description: 禁用 em-dash (—— / —);替代:补充用括号/冒号,并列用顿号,转折单独成句
37
+ enforcement: auto-fix
38
+ trigger: response.target == 'chat'
39
+ check_method: regex
40
+ auto_fix_cmd: 'replace-em-dash'
41
+ # auto-replace '——' → ', ' (单段内逗号);'—' → ':' OR ','
42
+
43
+ - id: precise-quantifier
44
+ description: 量词精确,能给具体数字/文件名/行号/commit hash 就不用"一些/几个/多个"
45
+ enforcement: info
46
+ trigger: always-on
47
+ check_method: llm-judge
48
+
49
+ - id: no-end-recap
50
+ description: 不做结尾总结,除非用户明确要求"汇总/recap"
51
+ enforcement: warn
52
+ trigger: response.target == 'chat'
53
+ check_method: heuristic
54
+ # heuristic — 末尾 200 char 含 '## 总结' / '## Summary' / 'In summary' / '综上所述'
55
+ # → warn 'redundant end recap'
56
+
57
+ - id: no-empty-continuation-question
58
+ description: 禁空洞续作询问 (要不要我帮你 X?/还需要别的吗?);保留工作流必要下一步指引
59
+ enforcement: warn
60
+ trigger: response.target == 'chat'
61
+ check_method: regex
62
+ # regex /要不要|还需要别的|希望对你有帮助/ + trigger fires → warn
@@ -0,0 +1,28 @@
1
+ # workflows/disciplines/priority.yaml
2
+ # 优先级仲裁 — 机器化 ~/.claude/CLAUDE.md 「响应规范与优先级」 节
3
+ # Phase v3.0-3.3 W0.4 ship per D-09
4
+ # Snapshot of CLAUDE.md as of v3.0 ship date (K7 mitigation, verbatim)
5
+
6
+ schema_version: harnessed.discipline.v1
7
+ discipline: priority
8
+ enforcement_layer: workflow
9
+ auto_enforce: true
10
+
11
+ priority_hierarchy:
12
+ - gstack # 决策层 最高优先
13
+ - gsd # 整体 orchestration
14
+ - superpowers # 子任务执行质量
15
+ - planning-with-files # 计划持久化
16
+ - karpathy # 编码行为
17
+ - mattpocock # 招式 by-demand
18
+ - parallel # subagent / Agent Teams / ralph-loop 执行机制
19
+
20
+ rules:
21
+ - id: multi-capability-arbitration
22
+ description: |
23
+ 多 capability fires_when 同时 true → 按 priority_hierarchy order 选最高
24
+ e.g., gstack /office-hours + GSD /gsd-discuss-phase 同 fire → gstack 先跑
25
+ enforcement: warn
26
+ trigger: capabilities.fired_count > 1
27
+ check_method: heuristic
28
+ # NEW src/discipline/enforcement/before-spawn.ts hook — sort fired capabilities by tier rank
@@ -0,0 +1,70 @@
1
+ # workflows/disciplines/protocols.yaml
2
+ # 跨 CC instance 协议 — 机器化 ~/.claude/rules/cc-handoff.md (Ideation→Onboarding +
3
+ # Plan→Execute) + 写入边界表
4
+ # Phase v3.0-3.3 W0.4 ship per D-09
5
+ # Snapshot of CLAUDE.md as of v3.0 ship date (K7 mitigation, verbatim)
6
+
7
+ schema_version: harnessed.discipline.v1
8
+ discipline: protocols
9
+ enforcement_layer: workflow
10
+ auto_enforce: false # 默认 NOT auto-enforce — 协议是 cross-session, harnessed 主要 validate
11
+
12
+ rules: []
13
+
14
+ protocols:
15
+ cc-handoff-ideation-to-onboarding:
16
+ description: |
17
+ 场景 A — Ideation-CC 写自包含产品设计文档;Onboarding-CC 新项目目录读取并启动 GSD
18
+ required_fields:
19
+ - 业务目的
20
+ - 范围/边界
21
+ - 关键决策+决策理由
22
+ - 技术栈+理由
23
+ - 已识别风险
24
+ - 推荐 milestone 划分
25
+ - "Open questions (OPEN: <问题>, decision required by user)"
26
+ forbidden_phrases:
27
+ - "TODO"
28
+ - "待补充"
29
+ - "暂定"
30
+
31
+ plan-execute-cc-ready-metadata:
32
+ description: |
33
+ 场景 B — Plan-CC 离场 PLAN.md 必须 ready-to-execute (metadata 标记)
34
+ required_fields:
35
+ - "status: ready-to-execute"
36
+ - "每个 task: 精确文件路径"
37
+ - "每个 task: acceptance criteria"
38
+ - "每个 task: 依赖前置 task 编号"
39
+ - "## Open Questions 节为空"
40
+ forbidden_phrases:
41
+ - "TODO"
42
+ - "待补充"
43
+ - "暂定"
44
+
45
+ file-ownership-strict:
46
+ description: |
47
+ 跨 CC 写入边界 — 下游 CC 不修改上游 artifact;歧义写到 PROGRESS.md ## Blocked
48
+ file_ownership:
49
+ ideation-cc:
50
+ - 产品设计文档
51
+ onboarding-cc:
52
+ - ".planning/* (初始化)"
53
+ - 项目代码
54
+ plan-cc:
55
+ - SPEC.md
56
+ - DISCUSS.md
57
+ - PLAN.md
58
+ - RESEARCH.md
59
+ execute-cc:
60
+ - PROGRESS.md
61
+ - VERIFICATION.md
62
+ - 代码
63
+ - commit
64
+ rules:
65
+ - id: no-modify-upstream-artifact
66
+ description: |
67
+ 下游 CC 发现上游 artifact 模糊 → 写 PROGRESS.md ## Blocked,不修改上游
68
+ enforcement: halt
69
+ trigger: cc.role == 'execute' AND file.target matches 'PLAN.md|SPEC.md|DISCUSS.md|RESEARCH.md'
70
+ check_method: file-content-match
File without changes
@@ -0,0 +1,63 @@
1
+ ---
2
+ name: discuss
3
+ description: |
4
+ Stage ① Discuss master orchestrator — 3 sub-workflow parallel gate-eval (chain-isolation 铁律)。
5
+ 战略层 / Phase 层 / 子任务层独立判断 gate, 可能 3 个全跑 / 1-2 个 / 全跳 + 透明声明。
6
+ schema_version: harnessed.workflow.v3 with delegates_to (3 sub: strategic + phase + subtask, mode parallel)
7
+ + disciplines_applied (6 default) + tools_available (planning-with-files)。
8
+ Triggered by harnessed CLI `harnessed discuss --topic <text>` or slash command `/discuss`
9
+ (bare per ADR 0030 namespace policy D-02 LOCK) after `harnessed setup`.
10
+ trigger_phrases:
11
+ - "discuss"
12
+ - "讨论澄清"
13
+ - "新功能澄清"
14
+ - "stage 1 discuss"
15
+ - "三层澄清"
16
+ ---
17
+
18
+ # discuss master orchestrator (v3)
19
+
20
+ ## Overview
21
+
22
+ 4-stage cadence Stage ① master orchestrator delegating to 3 independent sub-workflows
23
+ (per ~/.claude/CLAUDE.md "澄清/审查触发判据" 节 三层独立判断):
24
+
25
+ | sub | gate ref | mode | when fires |
26
+ | --- | -------- | ---- | ---------- |
27
+ | `strategic` | `judgments.stage-routing.discuss-strategic-delegate.fires` | parallel | new_project / new_milestone / new_feature / is_major_release |
28
+ | `phase` | `judgments.stage-routing.discuss-phase-delegate.fires` | parallel | open_decisions ≥ 2 / cross_phase_data_flow / scope_days > 1 |
29
+ | `subtask` | `judgments.stage-routing.discuss-subtask-delegate.fires` | parallel | approaches ≥ 2 / core_algorithm / has_api_contract / error_cost=high |
30
+
31
+ Engine runtime spawns 3 sub-workflow phases via `runMasterOrchestrator` per
32
+ T3.5.W0.1 (sister sub-workflow `runWorkflow` SDK pattern, parallel fan-out via
33
+ subagent default — Path A `query()` parallel OR Path B sub-shell fallback per
34
+ T3.5.W2.1 dogfood cycle decision LOCK)。
35
+
36
+ ## Chain-isolation 铁律 (sister CLAUDE.md "Fallback 三条铁律")
37
+
38
+ - 拿不准 → 倾向跳过, 但在响应里**透明声明**: "这次跳过了 X, 因为 Y。如果你认为需要请明说"
39
+ - 用户明示 → 覆盖判据 (用户说 "先 brainstorm" / "跑 office-hours" / "讨论一下" 时无条件激活)
40
+ - **链式互不前置**: 跳过战略层 ≠ 必须跳过 phase 层; 每层独立判断 (防止 "上层没跑下层不敢跑" 的死板)
41
+
42
+ ## Capability refs
43
+
44
+ Sister `workflows/capabilities.yaml`:
45
+ - `planning-with-files` — Bucket 4 核心 capability (impl: claude-code-plugin, cmd: /plan, discuss sink findings.md)
46
+ - sub `strategic` upstream → `gstack-office-hours` + `gstack-plan-ceo-review`
47
+ - sub `phase` upstream → `gsd-discuss-phase`
48
+ - sub `subtask` upstream → `superpowers-brainstorming` + `grill-with-docs` + `grill-me`
49
+
50
+ ## Invocation
51
+
52
+ - CLI: `harnessed discuss --topic "<text>"`
53
+ - Slash command: `/discuss <text>` (bare per ADR 0030 namespace policy D-02 LOCK after `harnessed setup`)
54
+
55
+ ## References
56
+
57
+ - D-01 master orchestrator delegation pattern
58
+ - D-02 bare slash cmd convention (ADR 0030 namespace policy LOCK)
59
+ - D-04 Stage ① Discuss 三层独立判
60
+ - ~/.claude/CLAUDE.md "澄清/审查触发判据" 节 verbatim
61
+ - workflows/judgments/stage-routing.yaml — discuss-{strategic,phase,subtask}-delegate triggers
62
+ - workflows/discuss/{strategic,phase,subtask}/workflow.yaml — 3 sub-workflow Phase 3.4 SHIPPED
63
+ - workflows/judgments/fallback.yaml — 链式互不前置 chain-isolation 铁律
@@ -0,0 +1,40 @@
1
+ # workflows/discuss/auto/workflow.yaml — Phase v3.0-3.5 W1 T3.5.W1.1
2
+ #
3
+ # Stage ① Discuss master orchestrator — 3 sub-workflow parallel gate-eval (chain-isolation 铁律
4
+ # per ~/.claude/CLAUDE.md "澄清/审查触发判据" 节 + fallback.yaml "链式互不前置")。
5
+ # 3 sub 独立判 gate, 可能全跑 / 1-2 个 / 全跳 + 透明声明。
6
+ #
7
+ # Sister refs:
8
+ # - ~/.claude/CLAUDE.md "澄清/审查触发判据" 节 (战略 / Phase / 子任务三层独立判)
9
+ # - workflows/judgments/stage-routing.yaml — discuss-{strategic,phase,subtask}-delegate triggers
10
+ # - workflows/discuss/{strategic,phase,subtask}/workflow.yaml — 3 sub-workflow Phase 3.4 SHIPPED
11
+ # - workflows/capabilities.yaml — planning-with-files (discuss sink findings.md)
12
+ # - .planning/phase-v3.0-3.2/RESEARCH-workflows.md § Area 2 Master Orchestrator yaml Examples
13
+ # - src/workflow/schema/workflow.ts WorkflowSchemaV3 + DelegationClause (Phase 3.3 W0.5 SHIPPED)
14
+ #
15
+ # Master invariant (per WorkflowSchemaV3 runtime check + check-workflow-schema.mjs K9):
16
+ # - phases 缺省 (master only has delegates_to[])
17
+ # - 3 delegates_to mode parallel — 3 sub 独立 gate-eval, parallel fan-out
18
+ # - 无 serial mode → 无 order field 需求
19
+
20
+ schema_version: harnessed.workflow.v3
21
+ workflow: discuss
22
+ description: |
23
+ Stage ① Discuss master orchestrator — 3 sub-workflow parallel gate-eval (chain-isolation 铁律):
24
+ 战略层 (gstack /office-hours + /plan-ceo-review) + Phase 层 (GSD /gsd-discuss-phase) + 子任务层
25
+ (superpowers brainstorming) 独立判 gate, 可能全跑 / 1-2 个 / 全跳 + 透明声明 ("这次跳过了 X 因为 Y")。
26
+ Sister CLAUDE.md "澄清/审查触发判据" 节 + fallback.yaml "链式互不前置" 铁律。
27
+
28
+ disciplines_applied: [karpathy, output-style, language, operational, priority, protocols]
29
+ tools_available: [planning-with-files]
30
+
31
+ delegates_to:
32
+ - sub: strategic
33
+ gate: judgments.stage-routing.discuss-strategic-delegate.fires
34
+ mode: parallel
35
+ - sub: phase
36
+ gate: judgments.stage-routing.discuss-phase-delegate.fires
37
+ mode: parallel
38
+ - sub: subtask
39
+ gate: judgments.stage-routing.discuss-subtask-delegate.fires
40
+ mode: parallel
@@ -0,0 +1,61 @@
1
+ ---
2
+ name: discuss-phase
3
+ description: |
4
+ Stage ①.b Phase 层 discuss sub-workflow — GSD /gsd-discuss-phase 灰色澄清 (≥2 open
5
+ implementation decisions / 跨 phase API contract 不清 / phase scope > 1 day / 灰色地带)。
6
+ schema_version: harnessed.workflow.v3 with disciplines_applied (6 default) + tools_available
7
+ (gsd-discuss-phase + planning-with-files) + 2 phases (01-gsd-discuss + 02-persist findings.md
8
+ + knowledge.md)。Triggered by harnessed CLI `harnessed discuss-phase --phase <num>` or slash
9
+ command `/discuss-phase` after `harnessed setup`.
10
+ trigger_phrases:
11
+ - "discuss phase"
12
+ - "phase 层澄清"
13
+ - "gsd discuss phase"
14
+ - "灰色地带澄清"
15
+ - "跑 discuss-phase"
16
+ ---
17
+
18
+ # discuss-phase workflow (v3)
19
+
20
+ ## Overview
21
+
22
+ 2-phase sub-workflow mapping CLAUDE.md "Stage ①.b Phase 层 — GSD /gsd-discuss-phase 灰色澄清"
23
+ onto harnessed runtime (Phase v3.0-3.4 W0.2 — D-04 Stage ① Discuss 三层 + Pattern A
24
+ sub-workflow ship)。
25
+
26
+ | phase | id | upstream | model | capability / invokes | gate / artifacts |
27
+ | ----- | -- | -------- | ----- | -------------------- | ---------------- |
28
+ | 1 | `01-gsd-discuss` | gsd | sonnet | `{{ capabilities.gsd-discuss-phase.cmd }}` | `gate: judgments.phase-gate.gsd-discuss-phase.fires` |
29
+ | 2 | `02-persist` | planning-with-files | haiku | `{{ capabilities.planning-with-files.cmd }}` + `invokes: /plan` | `artifacts_expected: [findings.md, knowledge.md]` |
30
+
31
+ ## Capability refs
32
+
33
+ Sister `workflows/capabilities.yaml` entries:
34
+ - `gsd-discuss-phase` — Bucket 2 (impl: gsd, cmd: /gsd-discuss-phase)
35
+ - `planning-with-files` — Bucket 4 (impl: claude-code-plugin, cmd: /plan)
36
+
37
+ ## Gate refs
38
+
39
+ Sister `workflows/judgments/phase-gate.yaml`:
40
+ - `gsd-discuss-phase.fires` — `phase.open_decisions >= 2 or phase.has_cross_phase_data_flow == true or phase.scope_days > 1`
41
+
42
+ ## Invocation
43
+
44
+ - CLI: `harnessed discuss-phase --phase <num>`
45
+ - Slash command: `/discuss-phase <num>` (after `harnessed setup`)
46
+
47
+ ## Routing rules
48
+
49
+ 跳过条件 (sister CLAUDE.md "Phase 层 ❌ 跳过"):
50
+ - 单一明确子任务
51
+ - 跟前 phase 同 module 同 pattern
52
+ - < 1 天工作量
53
+ - bug 修复且已有最小复现
54
+
55
+ ## References
56
+
57
+ - D-04 Stage ① Discuss 三层 (战略 / phase / 子任务)
58
+ - ~/.claude/CLAUDE.md "Phase 层: GSD /gsd-discuss-phase"
59
+ - workflows/capabilities.yaml — gsd-discuss-phase / planning-with-files
60
+ - workflows/judgments/phase-gate.yaml — gsd-discuss-phase trigger
61
+ - workflows/defaults.yaml — ralph_max_iterations.discuss-phase.* values (W2.2 backfill)
@@ -0,0 +1,35 @@
1
+ # workflows/discuss/phase/workflow.yaml — Phase v3.0-3.4 W0 T3.4.W0.2
2
+ #
3
+ # Stage ①.b Phase 层 sub-workflow — GSD /gsd-discuss-phase 灰色澄清
4
+ # (sister ~/.claude/CLAUDE.md "澄清/审查触发判据 — Phase 层")。
5
+ #
6
+ # Sister refs:
7
+ # - workflows/judgments/phase-gate.yaml — gsd-discuss-phase trigger
8
+ # - workflows/capabilities.yaml — gsd-discuss-phase / planning-with-files
9
+ # - .planning/phase-v3.0-3.2/RESEARCH-workflows.md § Area 2 sub-stage example verbatim
10
+
11
+ schema_version: harnessed.workflow.v3
12
+ workflow: discuss-phase
13
+ description: |
14
+ Stage ①.b Phase 层 — GSD /gsd-discuss-phase 灰色澄清 (≥2 open decisions / phase scope > 1 day /
15
+ 跨 phase API contract 不清)。Gate: judgments.phase-gate.gsd-discuss-phase.fires。
16
+
17
+ disciplines_applied: [karpathy, output-style, language, operational, priority, protocols]
18
+ tools_available: [gsd-discuss-phase, planning-with-files]
19
+
20
+ phases:
21
+ - id: 01-gsd-discuss
22
+ name: gsd-discuss-phase (Phase 层灰色澄清 + open decisions resolve)
23
+ upstream: gsd
24
+ capability: '{{ capabilities.gsd-discuss-phase.cmd }}'
25
+ model: sonnet
26
+ gate: judgments.phase-gate.gsd-discuss-phase.fires
27
+ max_iterations: '{{ defaults.ralph_max_iterations.discuss-phase.01-gsd-discuss }}'
28
+
29
+ - id: 02-persist
30
+ name: planning-with-files findings.md + knowledge.md (phase decision 持久化)
31
+ upstream: planning-with-files
32
+ capability: '{{ capabilities.planning-with-files.cmd }}'
33
+ invokes: '/plan'
34
+ model: haiku
35
+ artifacts_expected: [findings.md, knowledge.md]