@boyingliu01/xp-gate 0.15.5 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (165) hide show
  1. package/adapter-common.sh +0 -0
  2. package/adapters/cpp.sh +0 -0
  3. package/adapters/dart.sh +0 -0
  4. package/adapters/flutter.sh +0 -0
  5. package/adapters/go.sh +0 -0
  6. package/adapters/iac.sh +0 -0
  7. package/adapters/java.sh +0 -0
  8. package/adapters/kotlin.sh +0 -0
  9. package/adapters/objectivec.sh +0 -0
  10. package/adapters/plugins/book299-20132-python/scripts/install-gradle.sh +0 -0
  11. package/adapters/plugins/book299-20132-python/scripts/install-maven.sh +0 -0
  12. package/adapters/plugins/book299-4081-c/scripts/install-gradle.sh +0 -0
  13. package/adapters/plugins/book299-4081-c/scripts/install-maven.sh +0 -0
  14. package/adapters/plugins/book299-4083-javascriptes5/scripts/install-gradle.sh +0 -0
  15. package/adapters/plugins/book299-4083-javascriptes5/scripts/install-maven.sh +0 -0
  16. package/adapters/powershell.sh +0 -0
  17. package/adapters/python.sh +0 -0
  18. package/adapters/shell.sh +0 -0
  19. package/adapters/swift.sh +0 -0
  20. package/adapters/typescript.sh +0 -0
  21. package/bin/xp-gate.js +29 -1
  22. package/gate-3.sh +0 -0
  23. package/gate-4.sh +0 -0
  24. package/gate-7.sh +0 -0
  25. package/gate-8.sh +0 -0
  26. package/gate-9.sh +0 -0
  27. package/hooks/adapter-common.sh +0 -0
  28. package/hooks/gate-3.sh +0 -0
  29. package/hooks/gate-4.sh +0 -0
  30. package/hooks/gate-7.sh +0 -0
  31. package/hooks/gate-8.sh +0 -0
  32. package/hooks/gate-9.sh +0 -0
  33. package/hooks/lib/now-ms.sh +33 -0
  34. package/hooks/pre-commit +63 -47
  35. package/hooks/pre-push +0 -0
  36. package/hooks/sprint-gate.sh +291 -0
  37. package/lib/__tests__/check-version.test.js +122 -0
  38. package/lib/__tests__/doctor.test.js +13 -15
  39. package/lib/__tests__/gate-audit.test.ts +38 -0
  40. package/lib/__tests__/phase-transition.test.js +512 -272
  41. package/lib/__tests__/retro.test.js +131 -0
  42. package/lib/__tests__/sprint-audit.test.js +207 -207
  43. package/lib/__tests__/sprint-status-rework.test.js +184 -0
  44. package/lib/check-version.js +9 -0
  45. package/lib/doctor-tui.js +268 -198
  46. package/lib/doctor.js +15 -3
  47. package/lib/gate-audit.ts +18 -7
  48. package/lib/gate-runner.js +77 -30
  49. package/lib/init.js +10 -0
  50. package/lib/language-tools.js +833 -833
  51. package/lib/mattpocock-license-verdict.json +7 -0
  52. package/lib/phase-transition.js +499 -249
  53. package/lib/retro.js +222 -0
  54. package/lib/shared-utils.js +7 -0
  55. package/lib/sprint-audit.js +235 -235
  56. package/lib/sprint-init.js +207 -0
  57. package/lib/sprint-state-migrator.js +1 -0
  58. package/lib/sprint-status.js +111 -0
  59. package/mock-policy/AGENTS.md +3 -3
  60. package/mutation/AGENTS.md +3 -3
  61. package/package.json +3 -2
  62. package/plugins/claude-code/.claude-plugin/plugin.json +1 -1
  63. package/plugins/claude-code/bin/delphi-review-guard.sh +0 -0
  64. package/plugins/claude-code/bin/xp-gate-check +0 -0
  65. package/plugins/claude-code/skills/batch-grill-me/SKILL.md +15 -0
  66. package/plugins/claude-code/skills/delphi-review/AGENTS.md +3 -3
  67. package/plugins/claude-code/skills/delphi-review/SKILL.md +59 -4
  68. package/plugins/claude-code/skills/delphi-review/references/requirements.md +390 -0
  69. package/plugins/claude-code/skills/delphi-review/references/round-templates.md +67 -0
  70. package/plugins/claude-code/skills/domain-modeling/ADR-FORMAT.md +64 -0
  71. package/plugins/claude-code/skills/domain-modeling/CONTEXT-FORMAT.md +60 -0
  72. package/plugins/claude-code/skills/domain-modeling/SKILL.md +74 -0
  73. package/plugins/claude-code/skills/grill-with-docs/SKILL.md +7 -0
  74. package/plugins/claude-code/skills/grilling/SKILL.md +12 -0
  75. package/plugins/claude-code/skills/sprint-flow/AGENTS.md +3 -3
  76. package/plugins/claude-code/skills/sprint-flow/SKILL.md +168 -43
  77. package/plugins/claude-code/skills/sprint-flow/references/components/memory.md +1 -1
  78. package/plugins/claude-code/skills/sprint-flow/references/components/middleware.md +1 -1
  79. package/plugins/claude-code/skills/sprint-flow/references/components/skill-invocations.md +21 -20
  80. package/plugins/claude-code/skills/sprint-flow/references/components/tool-descriptions.md +22 -23
  81. package/plugins/claude-code/skills/sprint-flow/references/orchestration-rules.md +14 -12
  82. package/plugins/claude-code/skills/sprint-flow/references/phase-2-design.md +145 -133
  83. package/plugins/claude-code/skills/sprint-flow/references/phase-3-build.md +69 -2
  84. package/plugins/claude-code/skills/sprint-flow/references/phase-4-verify.md +93 -31
  85. package/plugins/claude-code/skills/sprint-flow/references/phase-5-ship.md +99 -14
  86. package/plugins/claude-code/skills/sprint-flow/references/phase-6-close.md +37 -5
  87. package/plugins/claude-code/skills/sprint-flow/references/phase-overview.md +58 -53
  88. package/plugins/claude-code/skills/test-specification-alignment/AGENTS.md +3 -3
  89. package/plugins/claude-code/skills/test-specification-alignment/SKILL.md +8 -3
  90. package/plugins/claude-code/skills/to-issues/SKILL.md +1 -1
  91. package/plugins/opencode/index.ts +1 -0
  92. package/plugins/opencode/package.json +1 -1
  93. package/plugins/opencode/skills/batch-grill-me/SKILL.md +15 -0
  94. package/plugins/opencode/skills/delphi-review/AGENTS.md +3 -3
  95. package/plugins/opencode/skills/delphi-review/SKILL.md +59 -4
  96. package/plugins/opencode/skills/delphi-review/references/requirements.md +390 -0
  97. package/plugins/opencode/skills/delphi-review/references/round-templates.md +67 -0
  98. package/plugins/opencode/skills/domain-modeling/ADR-FORMAT.md +64 -0
  99. package/plugins/opencode/skills/domain-modeling/CONTEXT-FORMAT.md +60 -0
  100. package/plugins/opencode/skills/domain-modeling/SKILL.md +74 -0
  101. package/plugins/opencode/skills/grill-with-docs/SKILL.md +7 -0
  102. package/plugins/opencode/skills/grilling/SKILL.md +12 -0
  103. package/plugins/opencode/skills/sprint-flow/AGENTS.md +3 -3
  104. package/plugins/opencode/skills/sprint-flow/SKILL.md +168 -43
  105. package/plugins/opencode/skills/sprint-flow/references/components/memory.md +1 -1
  106. package/plugins/opencode/skills/sprint-flow/references/components/middleware.md +1 -1
  107. package/plugins/opencode/skills/sprint-flow/references/components/skill-invocations.md +21 -20
  108. package/plugins/opencode/skills/sprint-flow/references/components/tool-descriptions.md +22 -23
  109. package/plugins/opencode/skills/sprint-flow/references/orchestration-rules.md +14 -12
  110. package/plugins/opencode/skills/sprint-flow/references/phase-2-design.md +145 -133
  111. package/plugins/opencode/skills/sprint-flow/references/phase-3-build.md +69 -2
  112. package/plugins/opencode/skills/sprint-flow/references/phase-4-verify.md +93 -31
  113. package/plugins/opencode/skills/sprint-flow/references/phase-5-ship.md +99 -14
  114. package/plugins/opencode/skills/sprint-flow/references/phase-6-close.md +37 -5
  115. package/plugins/opencode/skills/sprint-flow/references/phase-overview.md +58 -53
  116. package/plugins/opencode/skills/test-specification-alignment/AGENTS.md +3 -3
  117. package/plugins/opencode/skills/test-specification-alignment/SKILL.md +8 -3
  118. package/plugins/opencode/skills/to-issues/SKILL.md +1 -1
  119. package/plugins/qoder/agents/delphi-architecture.md +48 -48
  120. package/plugins/qoder/agents/delphi-feasibility.md +48 -48
  121. package/plugins/qoder/agents/delphi-technical.md +48 -48
  122. package/plugins/qoder/bin/sprint-flow-guard.sh +0 -0
  123. package/plugins/qoder/bin/xp-gate-check +0 -0
  124. package/plugins/qoder/plugin.json +1 -1
  125. package/plugins/qoder/skills/delphi-review/AGENTS.md +3 -3
  126. package/plugins/qoder/skills/sprint-flow/AGENTS.md +3 -3
  127. package/plugins/qoder/skills/test-specification-alignment/AGENTS.md +3 -3
  128. package/principles/AGENTS.md +3 -3
  129. package/scripts/__tests__/check-mattpocock-license.test.js +229 -0
  130. package/scripts/__tests__/sync-package-content.test.js +50 -0
  131. package/scripts/check-mattpocock-license.cjs +302 -0
  132. package/scripts/delphi-external-review.cjs +432 -432
  133. package/scripts/migrate-audit-anomalies.mjs +78 -0
  134. package/scripts/sync-package-content.js +52 -5
  135. package/skills/batch-grill-me/SKILL.md +15 -0
  136. package/skills/delphi-review/AGENTS.md +3 -3
  137. package/skills/delphi-review/SKILL.md +59 -4
  138. package/skills/delphi-review/references/requirements.md +390 -0
  139. package/skills/delphi-review/references/round-templates.md +67 -0
  140. package/skills/domain-modeling/ADR-FORMAT.md +64 -0
  141. package/skills/domain-modeling/CONTEXT-FORMAT.md +60 -0
  142. package/skills/domain-modeling/SKILL.md +74 -0
  143. package/skills/grill-with-docs/SKILL.md +7 -0
  144. package/skills/grilling/SKILL.md +12 -0
  145. package/skills/sprint-flow/AGENTS.md +3 -3
  146. package/skills/sprint-flow/SKILL.md +168 -43
  147. package/skills/sprint-flow/references/components/memory.md +1 -1
  148. package/skills/sprint-flow/references/components/middleware.md +1 -1
  149. package/skills/sprint-flow/references/components/skill-invocations.md +21 -20
  150. package/skills/sprint-flow/references/components/tool-descriptions.md +22 -23
  151. package/skills/sprint-flow/references/orchestration-rules.md +14 -12
  152. package/skills/sprint-flow/references/phase-2-design.md +145 -133
  153. package/skills/sprint-flow/references/phase-3-build.md +69 -2
  154. package/skills/sprint-flow/references/phase-4-verify.md +93 -31
  155. package/skills/sprint-flow/references/phase-5-ship.md +99 -14
  156. package/skills/sprint-flow/references/phase-6-close.md +37 -5
  157. package/skills/sprint-flow/references/phase-overview.md +58 -53
  158. package/skills/test-specification-alignment/AGENTS.md +3 -3
  159. package/skills/test-specification-alignment/SKILL.md +8 -3
  160. package/skills/to-issues/SKILL.md +1 -1
  161. package/adapters/gate-3.sh +0 -68
  162. package/adapters/gate-4.sh +0 -80
  163. package/adapters/gate-7.sh +0 -45
  164. package/adapters/gate-8.sh +0 -56
  165. package/adapters/gate-9.sh +0 -104
@@ -0,0 +1,390 @@
1
+ # Requirements Mode Reference
2
+
3
+ > Extracted from `SKILL.md`. This file contains ALL content specific to the `requirements` mode of Delphi Review.
4
+
5
+ ---
6
+
7
+ ## Overview
8
+
9
+ 需求评审模式,用于 grill-with-docs 完成共享理解后、设计文档生成前,对需求完整性进行轻量级多专家 Delphi 评审。
10
+
11
+ **触发命令**: `/delphi-review --mode requirements`
12
+
13
+ **设计背景**: Issue #368 识别出原始意图中"需求评审一次 + 设计评审一次"的第一次评审被完全丢弃。本模式恢复该评审点,在需求探索(grill-with-docs)与设计文档生成之间插入一道轻量质量门禁。
14
+
15
+ **定位**:
16
+ - **轻量**: 2 专家(architecture + feasibility)、最多 1 轮(循环语义下最多 2 轮)
17
+ - **需求焦点**: 评审对象是需求陈述 + CONTEXT.md,不是设计文档或代码
18
+ - **程序化阻塞**: 输出 `requirements-reviewed.json`,由 `phase-transition 2 completed` 校验
19
+ - **防陈旧绑定**: `requirements_hash`(SHA-256)绑定需求内容,防止旧证据复用
20
+
21
+ ---
22
+
23
+ ## Five Core Properties
24
+
25
+ 1. **匿名性** — Expert A/B 互不知道对方意见(Round 1)
26
+ 2. **迭代共识** — GAPS_FOUND 时回到 grill-with-docs 补充,最多 2 轮循环
27
+ 3. **关键缺口零容忍** — Critical requirement gaps 必须在进入设计前解决
28
+ 4. **防陈旧绑定** — requirements_hash 绑定需求内容 + CONTEXT.md,旧证据不可复用
29
+ 5. **轻量但严格** — 2 专家配置,但共识要求 2/2(100%),不因轻量而降标
30
+
31
+ ---
32
+
33
+ ## 触发条件
34
+
35
+ - **自动触发**: sprint-flow Phase 2 THINK 链中,grill-with-docs 完成后、设计文档生成前(参见 `skills/sprint-flow/references/phase-2-design.md` Step 2)
36
+ - **手动触发**: `/delphi-review --mode requirements`
37
+
38
+ **⚠️ 重要调用方式说明**:
39
+
40
+ - ✅ **正确**: sprint-flow 编排层在 Phase 2 Step 2 自动调用
41
+ - ✅ **正确**: 在 Agent session 中执行 `/delphi-review --mode requirements`
42
+ - ❌ **错误**: 在设计文档已生成后调用(应在设计前)
43
+ - ❌ **错误**: 用 requirements 模式评审设计文档或代码(那是 design / code-walkthrough 模式的职责)
44
+
45
+ **与 sprint-flow 的集成**:
46
+
47
+ ```
48
+ sprint-flow Phase 2 THINK:
49
+ Step 0: CONTEXT.md 预检
50
+ Step 1: grill-with-docs(需求访谈)
51
+ Step 2: delphi-review --mode requirements ← 本模式
52
+ Step 3: 原生设计文档生成
53
+ Step 4: HARD-GATE(用户审批设计文档)
54
+ ```
55
+
56
+ **lightweight sprint 例外**: 当 `change_type == "修改已存在代码"` 时,sprint-flow 跳过 R1 需求评审,需求维度合并入 R2 设计评审。
57
+
58
+ ---
59
+
60
+ ## 流程概览
61
+
62
+ ```
63
+ grill-with-docs (completed)
64
+ │
65
+ ▼
66
+ delphi-review --mode requirements
67
+ │
68
+ ├─→ Context gather: CONTEXT.md + grill session summary + user requirements statement
69
+ │
70
+ ├─→ Expert A (architecture) anonymous review — focus: requirements completeness,
71
+ │ requirement→AC coverage, scenario coverage
72
+ │
73
+ ├─→ Expert B (feasibility) anonymous review — focus: testability of acceptance criteria,
74
+ │ user persona clarity, scope boundaries
75
+ │
76
+ ├─→ Consensus check
77
+ │ │
78
+ │ ├─→ Both APPROVED → write requirements-reviewed.json verdict=APPROVED
79
+ │ │
80
+ │ └─→ Either GAPS_FOUND → record gaps, set verdict=GAPS_FOUND
81
+ │
82
+ └─→ Return to sprint-flow orchestrator
83
+ │
84
+ ├─→ APPROVED → proceed to design doc generation
85
+ └─→ GAPS_FOUND → loop back to grill-with-docs (1 more round, max 2 total)
86
+ ```
87
+
88
+ ---
89
+
90
+ ## 专家角色
91
+
92
+ | 专家 | 视角 | 配置 |
93
+ |------|------|------|
94
+ | Expert A (architecture) | 需求完整性 + 需求→AC 映射 + 场景覆盖 | `.delphi-config.json` → `experts.architecture` |
95
+ | Expert B (feasibility) | AC 可测试性 + 用户画像 + 范围边界 | `.delphi-config.json` → `experts.feasibility` |
96
+
97
+ > ⚠️ **注意**: requirements 模式**不使用** technical 专家。技术实现细节属于设计/实现阶段(design / code-walkthrough 模式),不属于需求评审范畴。
98
+
99
+ > ⚠️ **注意**: 至少配置 **两个不同 provider** 的模型。详见 [INSTALL.md](./INSTALL.md)。
100
+
101
+ **专家选择理由**(设计决策 §16.4 C3):
102
+ - **architecture 专家**: 天然映射范围/覆盖到需求层面——需求完整性、需求→AC 映射、场景覆盖、领域术语一致性
103
+ - **feasibility 专家**: 天然映射可测试性/假设到验收标准——AC 可测试性、用户画像清晰度、范围边界、隐含假设
104
+ - **technical 专家**: 排除——技术实现细节在需求阶段尚未确定,评审无意义
105
+
106
+ ---
107
+
108
+ ## 评审焦点(模式切换指令)
109
+
110
+ ### Expert A (architecture) — 需求模式焦点
111
+
112
+ | 维度 | 检查内容 |
113
+ |------|---------|
114
+ | **需求完整性** | 所有用户场景是否已覆盖,是否有遗漏的用例路径 |
115
+ | **需求→AC 映射** | 每个需求是否有对应的验收标准,映射是否完整 |
116
+ | **场景覆盖** | 正常流、异常流、边界场景是否均已识别 |
117
+ | **领域术语一致性** | 需求陈述中的术语是否与 CONTEXT.md 领域模型一致(交叉引用) |
118
+ | **AC 精确度** | 验收标准是否具体、可度量、无歧义 |
119
+
120
+ ### Expert B (feasibility) — 需求模式焦点
121
+
122
+ | 维度 | 检查内容 |
123
+ |------|---------|
124
+ | **AC 可测试性** | 每个验收标准是否可被自动化或手动测试验证 |
125
+ | **用户画像清晰度** | 目标用户/角色是否明确定义,场景是否贴合真实使用 |
126
+ | **范围边界清晰度** | 需求边界(in-scope vs out-of-scope)是否明确划定 |
127
+ | **需求间依赖** | 需求之间是否存在隐含依赖或冲突 |
128
+ | **隐含假设** | 是否存在未明确声明的假设(技术、业务、环境) |
129
+
130
+ ---
131
+
132
+ ## 共识标准
133
+
134
+ | 条件 | 结果 |
135
+ |------|------|
136
+ | 2/2 APPROVED + 无 Critical gaps | ✅ verdict=APPROVED,进入设计文档生成 |
137
+ | 2/2 APPROVED + 有 Minor gaps | ✅ verdict=APPROVED(记录 gaps 供参考) |
138
+ | 1/2 APPROVED, 1/2 GAPS_FOUND | ❌ verdict=GAPS_FOUND,记录 gaps |
139
+ | 0/2 APPROVED | ❌ verdict=GAPS_FOUND,记录 gaps |
140
+ | 有 Critical requirement gaps | ❌ verdict=GAPS_FOUND |
141
+
142
+ **共识要求**: 2/2 一致 APPROVED(100%)。轻量配置不降低共识标准。
143
+
144
+ ---
145
+
146
+ ## 循环控制(Loop Semantics)
147
+
148
+ ```
149
+ Round 1: delphi-review --mode requirements
150
+ │
151
+ ├─→ APPROVED → 完成,进入设计文档生成
152
+ │
153
+ └─→ GAPS_FOUND
154
+ │
155
+ ├─→ gaps 记录到 requirements-reviewed.json
156
+ ├─→ 返回 sprint-flow → grill-with-docs 补充访谈
157
+ │
158
+ ▼
159
+ Round 2: delphi-review --mode requirements(带 Round 1 gaps 上下文)
160
+ │
161
+ ├─→ APPROVED → 完成,进入设计文档生成
162
+ │
163
+ └─→ GAPS_FOUND
164
+ │
165
+ └─→ escalation_needed: true
166
+ → sprint-flow Phase 2 处理升级 UX(交用户决策)
167
+ ```
168
+
169
+ **硬性限制**:
170
+ - **最多 2 轮**(Round 1 + 可选 Round 2)
171
+ - **禁止无界循环** — Round 2 后仍 GAPS_FOUND 必须升级
172
+ - **Round 2 上下文**: 专家看到 Round 1 的 gaps 列表,评估是否已修复
173
+ - **升级语义**: `escalation_needed: true` 写入 requirements-reviewed.json,sprint-flow 负责 UX
174
+
175
+ ---
176
+
177
+ ## 输出格式
178
+
179
+ ### 证据文件: `.sprint-state/phase-outputs/requirements-reviewed.json`
180
+
181
+ ```json
182
+ {
183
+ "mode": "requirements",
184
+ "verdict": "APPROVED",
185
+ "timestamp": "2026-07-25T10:30:00Z",
186
+ "requirements_hash": "a1b2c3d4e5f6...(SHA-256 hex digest)",
187
+ "head_commit": "abc123def456789...",
188
+ "context_file_used": "CONTEXT.md",
189
+ "round": 1,
190
+ "expert_verdicts": [
191
+ { "role": "architecture", "verdict": "APPROVED", "confidence": 9 },
192
+ { "role": "feasibility", "verdict": "APPROVED", "confidence": 8 }
193
+ ],
194
+ "requirements_statement": "实现用户注册流程,支持邮箱验证和密码重置",
195
+ "gaps_found": [],
196
+ "rounds_used": 1,
197
+ "escalation_needed": false
198
+ }
199
+ ```
200
+
201
+ ### GAPS_FOUND 示例
202
+
203
+ ```json
204
+ {
205
+ "mode": "requirements",
206
+ "verdict": "GAPS_FOUND",
207
+ "timestamp": "2026-07-25T10:30:00Z",
208
+ "requirements_hash": "a1b2c3d4e5f6...",
209
+ "head_commit": "abc123def456789...",
210
+ "context_file_used": "CONTEXT.md",
211
+ "round": 1,
212
+ "expert_verdicts": [
213
+ { "role": "architecture", "verdict": "APPROVED", "confidence": 8 },
214
+ { "role": "feasibility", "verdict": "GAPS_FOUND", "confidence": 7 }
215
+ ],
216
+ "requirements_statement": "实现用户注册流程,支持邮箱验证和密码重置",
217
+ "gaps_found": [
218
+ "密码重置的过期时间未定义",
219
+ "邮箱验证失败的重试策略缺失",
220
+ "AC-003 不可测试:'系统应快速响应' 无量化指标"
221
+ ],
222
+ "rounds_used": 1,
223
+ "escalation_needed": false
224
+ }
225
+ ```
226
+
227
+ ### 字段说明
228
+
229
+ | 字段 | 类型 | 说明 |
230
+ |------|------|------|
231
+ | `mode` | string | 固定值 `"requirements"` |
232
+ | `verdict` | string | `APPROVED` 或 `GAPS_FOUND` |
233
+ | `timestamp` | string | 评审完成时间 (ISO 8601 UTC) |
234
+ | `requirements_hash` | string | SHA-256 hex digest(防陈旧绑定,见下文) |
235
+ | `head_commit` | string | 当前 `git rev-parse HEAD` |
236
+ | `context_file_used` | string | 引用的 CONTEXT.md 路径 |
237
+ | `round` | number | 当前轮次(1 或 2) |
238
+ | `expert_verdicts` | array | 各专家裁决(2 项:architecture + feasibility) |
239
+ | `requirements_statement` | string | 被评审需求的简短摘要 |
240
+ | `gaps_found` | array | GAPS_FOUND 时的缺口列表(APPROVED 时为空数组) |
241
+ | `rounds_used` | number | 实际使用的轮次数 |
242
+ | `escalation_needed` | boolean | Round 2 后仍 GAPS_FOUND 时为 `true` |
243
+
244
+ ### 状态文件: `.sprint-state/delphi-reviewed.json`
245
+
246
+ APPROVED 时同步写入状态文件(与 design / code-walkthrough 模式一致):
247
+
248
+ ```json
249
+ {
250
+ "mode": "requirements",
251
+ "timestamp": "2026-07-25T10:30:00Z",
252
+ "verdict": "APPROVED",
253
+ "consensus_ratio": 1.0
254
+ }
255
+ ```
256
+
257
+ > 此文件供 `verify-consensus.sh` 校验。GAPS_FOUND 时**不写入**此文件(评审未完成)。
258
+
259
+ ---
260
+
261
+ ## Hash 绑定(防陈旧绑定 — §8.4)
262
+
263
+ `requirements_hash` = SHA-256 of:
264
+
265
+ ```
266
+ requirements_statement + CONTEXT.md content + ISO timestamp prefix (YYYY-MM-DD)
267
+ ```
268
+
269
+ **计算规则**:
270
+ 1. 拼接: `requirements_statement` 字符串 + `CONTEXT.md` 文件完整内容(若存在)+ 当日日期前缀 `YYYY-MM-DD`
271
+ 2. 对拼接结果计算 SHA-256 hex digest
272
+ 3. 若 CONTEXT.md 不存在,仅拼接 `requirements_statement` + 日期前缀
273
+
274
+ **目的**: 防止旧证据复用。`phase-transition 2 completed` 校验时:
275
+ - 文件必须存在
276
+ - `verdict` 必须为 `APPROVED`
277
+ - `requirements_hash` 必须为非空字符串
278
+ - 若 hash 与当前需求内容不匹配 → BLOCK(防陈旧绑定)
279
+
280
+ **与 phase-transition.js 的集成**(v0.17.1 已实现):
281
+
282
+ ```javascript
283
+ // EVIDENCE_FILES[2] — 已存在于 phase-transition.js
284
+ {
285
+ path: '.sprint-state/phase-outputs/requirements-reviewed.json',
286
+ requiredFields: ['verdict', 'requirements_hash'],
287
+ blockingCheck: (data) => data.verdict === 'APPROVED',
288
+ blockingMessage: 'Requirements review verdict is not APPROVED',
289
+ }
290
+ ```
291
+
292
+ ---
293
+
294
+ ## 证据文件路径
295
+
296
+ | 文件 | 路径 | 校验时机 | 校验方 |
297
+ |------|------|----------|--------|
298
+ | requirements-reviewed.json | `.sprint-state/phase-outputs/` | `phase-transition 2 completed` | phase-transition.js Layer 2 |
299
+ | delphi-reviewed.json | `.sprint-state/` | verify-consensus.sh | verify-consensus.sh |
300
+
301
+ ---
302
+
303
+ ## Anti-Patterns
304
+
305
+ **只在 `--mode requirements` 时适用:**
306
+
307
+ | ❌ Don't | ✅ Do | Why |
308
+ |----------|------|-----|
309
+ | 使用全部 3 个专家 | 仅使用 architecture + feasibility | 轻量配置(设计决策 §16.4 C3),technical 属设计阶段 |
310
+ | 无界循环评审 | 最多 2 轮,之后升级 | 防止无限循环(设计 §5.3 step 3) |
311
+ | 跳过 CONTEXT.md 交叉引用 | 始终交叉引用领域术语 | 需求应使用 CONTEXT.md 中的规范术语 |
312
+ | 输出泛化批准 | 输出 hash 绑定的需求陈述 | 防陈旧绑定(§8.4,Round 1 设计反馈 #14) |
313
+ | 接受 1/2 APPROVED | 要求 2/2 共识(100%) | 轻量配置仍需严格共识 |
314
+ | Round 2 中复用 Round 1 gaps 作为新发现 | Round 2 专家获得 Round 1 gaps 上下文 | 迭代改进,避免重复劳动 |
315
+ | 评审设计文档或代码 | 仅评审需求陈述 + CONTEXT.md | 设计/代码评审是 design / code-walkthrough 模式的职责 |
316
+ | GAPS_FOUND 时写入 delphi-reviewed.json | 仅 APPROVED 时写入状态文件 | GAPS_FOUND 表示评审未完成 |
317
+ | 在 lightweight sprint 中执行 R1 | `change_type == "修改已存在代码"` 时跳过 R1 | 需求维度合并入 R2 设计评审 |
318
+
319
+ ---
320
+
321
+ ## Security Notes
322
+
323
+ - **只读评审**: requirements 模式不修改任何源文件,仅写入证据文件到 `.sprint-state/`
324
+ - **Hash 完整性**: `requirements_hash` 使用 SHA-256,防止需求内容被篡改后复用旧证据
325
+ - **Commit 绑定**: `head_commit` 记录评审时的 git HEAD,提供时间线追溯
326
+ - **无外部 API 泄露**: 评审内容仅传递给配置的国产模型 provider,不经过第三方服务
327
+ - **证据不可伪造**: phase-transition.js 程序化校验证据文件,LLM 无法绕过
328
+
329
+ ---
330
+
331
+ ## Triggers / Negative Triggers
332
+
333
+ **触发(requirements 模式特有)**:
334
+ - `/delphi-review --mode requirements`
335
+ - "review the requirements"
336
+ - "评审需求"
337
+ - "requirements review"
338
+ - "/requirements-review"
339
+
340
+ **不触发**:
341
+ - "review my requirements document"(教育性讨论,非执行评审)
342
+ - "requirements template"(询问模板格式)
343
+ - "how to write requirements"(教育性)
344
+ - "check my requirements"(模糊,可能是 Casual 检查)
345
+
346
+ ---
347
+
348
+ ## Terminal State Checklist (requirements mode)
349
+
350
+ **Pre-requisites (MANDATORY - BLOCK if missing):**
351
+ - [ ] grill-with-docs 已完成(或 CONTEXT.md 快速路径)
352
+ - [ ] 需求陈述可用(非空)
353
+ - [ ] Expert A (architecture) 模型 API 可用
354
+ - [ ] Expert B (feasibility) 模型 API 可用
355
+
356
+ **CRITICAL - 共识验证 (requirements):**
357
+ - [ ] 2/2 专家 APPROVED
358
+ - [ ] 无 Critical requirement gaps 未解决
359
+ - [ ] requirements_hash 已计算并写入
360
+
361
+ **Final Requirements (requirements):**
362
+ - [ ] `.sprint-state/phase-outputs/requirements-reviewed.json` 已写入
363
+ - [ ] JSON 格式有效,包含所有必需字段
364
+ - [ ] verdict 为 APPROVED 或 GAPS_FOUND
365
+ - [ ] IF APPROVED: `.sprint-state/delphi-reviewed.json` 已写入(mode=requirements)
366
+ - [ ] IF GAPS_FOUND: gaps_found 数组非空,escalation_needed 正确设置
367
+ - [ ] IF Round 2 后仍 GAPS_FOUND: escalation_needed = true
368
+
369
+ **IF 任何 Pre-requisite 缺失:**
370
+ - **CANNOT 完成评审**
371
+ - **MUST BLOCK 并通知用户**
372
+
373
+ **IF GAPS_FOUND (Round 1):**
374
+ - 返回 sprint-flow → grill-with-docs 补充
375
+ - 重新执行 requirements 评审(Round 2)
376
+
377
+ **IF GAPS_FOUND (Round 2):**
378
+ - **escalation_needed = true**
379
+ - **MUST 升级给用户决策**
380
+ - **CANNOT 自动继续**
381
+
382
+ **⭐ APPROVED 后必做 (requirements mode):写入证据文件**
383
+
384
+ IF mode == `requirements` AND 最终裁决是 APPROVED,评审完成后必须:
385
+
386
+ 1. 写入 `.sprint-state/phase-outputs/requirements-reviewed.json`
387
+ 2. 写入 `.sprint-state/delphi-reviewed.json`(状态文件)
388
+ 3. 验证 JSON 格式有效
389
+ 4. 验证 requirements_hash 非空
390
+ 5. 验证 head_commit 匹配当前 HEAD
@@ -65,3 +65,70 @@
65
65
  ### Critical Issues 修复 | ### Major Concerns 处理 | ### Minor Concerns 说明
66
66
  ### 请求重新评审
67
67
  ```
68
+
69
+ ---
70
+
71
+ ## Requirements Mode: Round 1(匿名独立需求评审)
72
+
73
+ ### 执行方式
74
+
75
+ 2 位专家(architecture + feasibility)独立收到:需求陈述 + CONTEXT.md + grill session 摘要 + "独立评审需求完整性,不知道其他专家意见"。
76
+
77
+ ### 输出格式
78
+
79
+ ```markdown
80
+ ## Requirements Review - Expert [A(architecture)/B(feasibility)]
81
+
82
+ ### 需求摘要
83
+ [被评审需求的简短概括]
84
+
85
+ ### 评审焦点
86
+ - 需求完整性: [评估]
87
+ - 需求→AC 映射: [评估]
88
+ - 场景覆盖: [评估]
89
+ - AC 可测试性: [评估]
90
+ - 用户画像清晰度: [评估]
91
+ - 范围边界: [评估]
92
+
93
+ ### 缺口清单 (Gaps)
94
+ #### Critical Gaps (必须解决才能进入设计)
95
+ 1. [缺口描述] - 影响: [...] - 补充建议: [...]
96
+ #### Minor Gaps (建议补充但不阻塞)
97
+ 1. [...]
98
+
99
+ ### 裁决: [APPROVED / GAPS_FOUND]
100
+ ### 置信度: [X/10]
101
+ ### 关键理由
102
+ 1. [...]
103
+ ```
104
+
105
+ ## Requirements Mode: Round 2(带上下文的补充评审,如需要)
106
+
107
+ ### 触发条件
108
+
109
+ Round 1 裁决为 GAPS_FOUND,grill-with-docs 补充访谈后重新评审。
110
+
111
+ ### 执行方式
112
+
113
+ 2 位专家收到:更新后的需求陈述 + CONTEXT.md + **Round 1 gaps 列表** + "评估 Round 1 缺口是否已修复,是否有新缺口"。
114
+
115
+ ### 输出格式
116
+
117
+ ```markdown
118
+ ## Requirements Review Round 2 - Expert [A(architecture)/B(feasibility)]
119
+
120
+ ### Round 1 缺口修复验证
121
+ | Round 1 Gap | 状态 | 说明 |
122
+ |-------------|------|------|
123
+ | [gap 描述] | ✅ 已修复 / ❌ 仍存在 | [验证说明] |
124
+
125
+ ### 新发现缺口(如有)
126
+ 1. [新缺口描述]
127
+
128
+ ### 裁决: [APPROVED / GAPS_FOUND]
129
+ ### 置信度: [X/10]
130
+ ### 立场变化说明
131
+ [与 Round 1 相比的立场变化]
132
+ ```
133
+
134
+ > ⚠️ Round 2 后仍 GAPS_FOUND → `escalation_needed: true`,升级给用户决策。禁止 Round 3。
@@ -0,0 +1,64 @@
1
+ # ADR Format
2
+
3
+ ## Filename convention
4
+
5
+ `docs/adr/{NNNN}-{kebab-case-title}.md`
6
+
7
+ Where `{NNNN}` is a zero-padded incrementing number (e.g., `0001`, `0002`).
8
+
9
+ ## Structure
10
+
11
+ ```md
12
+ # {NNNN}. {Title}
13
+
14
+ ## Status
15
+
16
+ Proposed | Accepted | Deprecated | Superseded by ADR-XXXX
17
+
18
+ ## Context
19
+
20
+ {The issue(s) or situation(s) motivating this decision. What forces are at play? What is the problem?}
21
+
22
+ ## Decision
23
+
24
+ {The decision made. Stated in full sentences, in the present tense. What did we decide to do?}
25
+
26
+ ## Consequences
27
+
28
+ ### Positive
29
+ - {Benefit 1}
30
+ - {Benefit 2}
31
+
32
+ ### Negative
33
+ - {Trade-off 1}
34
+ - {Trade-off 2}
35
+
36
+ ### Neutral
37
+ - {Neutral observation 1}
38
+
39
+ ## Alternatives Considered
40
+
41
+ ### {Alternative 1 title}
42
+ {Brief description and why it was rejected.}
43
+
44
+ ### {Alternative 2 title}
45
+ {Brief description and why it was rejected.}
46
+ ```
47
+
48
+ ## Rules
49
+
50
+ - **Write for future readers, not present participants.** Future readers won't have the conversation context.
51
+ - **Be honest about trade-offs.** Every decision has costs. Name them.
52
+ - **One decision per ADR.** If you're writing "we decided X AND Y", split them.
53
+ - **Keep the decision short.** 1-3 sentences. The context section is where the complexity lives.
54
+ - **Superseded decisions are not deleted.** When a decision is overturned, create a new ADR that supersedes it. Update the old one's status to "Superseded by ADR-XXXX". This preserves history.
55
+ - **Don't document trivial choices.** If the answer is obvious or easily reversible, skip the ADR.
56
+
57
+ ## When NOT to write an ADR
58
+
59
+ - The decision is easily reversible.
60
+ - The decision is a personal preference with no team impact.
61
+ - The decision is well-documented elsewhere (e.g., in the project's CONTRIBUTING.md).
62
+ - The decision follows an obvious path with no real alternatives.
63
+
64
+ When in doubt, skip it. An ADR that shouldn't exist creates more noise than value.
@@ -0,0 +1,60 @@
1
+ # CONTEXT.md Format
2
+
3
+ ## Structure
4
+
5
+ ```md
6
+ # {Context Name}
7
+
8
+ {One or two sentence description of what this context is and why it exists.}
9
+
10
+ ## Language
11
+
12
+ **Order**:
13
+ {A one or two sentence description of the term}
14
+ _Avoid_: Purchase, transaction
15
+
16
+ **Invoice**:
17
+ A request for payment sent to a customer after delivery.
18
+ _Avoid_: Bill, payment request
19
+
20
+ **Customer**:
21
+ A person or organization that places orders.
22
+ _Avoid_: Client, buyer, account
23
+ ```
24
+
25
+ ## Rules
26
+
27
+ - **Be opinionated.** When multiple words exist for the same concept, pick the best one and list the others under `_Avoid_`.
28
+ - **Keep definitions tight.** One or two sentences max. Define what it IS, not what it does.
29
+ - **Only include terms specific to this project's context.** General programming concepts (timeouts, error types, utility patterns) don't belong even if the project uses them extensively. Before adding a term, ask: is this a concept unique to this context, or a general programming concept? Only the former belongs.
30
+ - **Group terms under subheadings** when natural clusters emerge. If all terms belong to a single cohesive area, a flat list is fine.
31
+
32
+ ## Single vs multi-context repos
33
+
34
+ **Single context (most repos):** One `CONTEXT.md` at the repo root.
35
+
36
+ **Multiple contexts:** A `CONTEXT-MAP.md` at the repo root lists the contexts, where they live, and how they relate to each other:
37
+
38
+ ```md
39
+ # Context Map
40
+
41
+ ## Contexts
42
+
43
+ - [Ordering](./src/ordering/CONTEXT.md) — receives and tracks customer orders
44
+ - [Billing](./src/billing/CONTEXT.md) — generates invoices and processes payments
45
+ - [Fulfillment](./src/fulfillment/CONTEXT.md) — manages warehouse picking and shipping
46
+
47
+ ## Relationships
48
+
49
+ - **Ordering → Fulfillment**: Ordering emits `OrderPlaced` events; Fulfillment consumes them to start picking
50
+ - **Fulfillment → Billing**: Fulfillment emits `ShipmentDispatched` events; Billing consumes them to generate invoices
51
+ - **Ordering ↔ Billing**: Shared types for `CustomerId` and `Money`
52
+ ```
53
+
54
+ The skill infers which structure applies:
55
+
56
+ - If `CONTEXT-MAP.md` exists, read it to find contexts
57
+ - If only a root `CONTEXT.md` exists, single context
58
+ - If neither exists, create a root `CONTEXT.md` lazily when the first term is resolved
59
+
60
+ When multiple contexts exist, infer which one the current topic relates to. If unclear, ask.
@@ -0,0 +1,74 @@
1
+ ---
2
+ name: domain-modeling
3
+ description: Build and sharpen a project's domain model. Use when the user wants to pin down domain terminology or a ubiquitous language, record an architectural decision, or when another skill needs to maintain the domain model.
4
+ ---
5
+
6
+ # Domain Modeling
7
+
8
+ Actively build and sharpen the project's domain model as you design. This is the *active* discipline — challenging terms, inventing edge-case scenarios, and writing the glossary and decisions down the moment they crystallise. (Merely *reading* `CONTEXT.md` for vocabulary is not this skill — that's a one-line habit any skill can do. This skill is for when you're changing the model, not just consuming it.)
9
+
10
+ ## File structure
11
+
12
+ Most repos have a single context:
13
+
14
+ ```
15
+ /
16
+ ├── CONTEXT.md
17
+ ├── docs/
18
+ │ └── adr/
19
+ │ ├── 0001-event-sourced-orders.md
20
+ │ └── 0002-postgres-for-write-model.md
21
+ └── src/
22
+ ```
23
+
24
+ If a `CONTEXT-MAP.md` exists at the root, the repo has multiple contexts. The map points to where each one lives:
25
+
26
+ ```
27
+ /
28
+ ├── CONTEXT-MAP.md
29
+ ├── docs/
30
+ │ └── adr/ ← system-wide decisions
31
+ ├── src/
32
+ │ ├── ordering/
33
+ │ │ ├── CONTEXT.md
34
+ │ │ └── docs/adr/ ← context-specific decisions
35
+ │ └── billing/
36
+ │ ├── CONTEXT.md
37
+ │ └── docs/adr/
38
+ ```
39
+
40
+ Create files lazily — only when you have something to write. If no `CONTEXT.md` exists, create one when the first term is resolved. If no `docs/adr/` exists, create it when the first ADR is needed.
41
+
42
+ ## During the session
43
+
44
+ ### Challenge against the glossary
45
+
46
+ When the user uses a term that conflicts with the existing language in `CONTEXT.md`, call it out immediately. "Your glossary defines 'cancellation' as X, but you seem to mean Y — which is it?"
47
+
48
+ ### Sharpen fuzzy language
49
+
50
+ When the user uses vague or overloaded terms, propose a precise canonical term. "You're saying 'account' — do you mean the Customer or the User? Those are different things."
51
+
52
+ ### Discuss concrete scenarios
53
+
54
+ When domain relationships are being discussed, stress-test them with specific scenarios. Invent scenarios that probe edge cases and force the user to be precise about the boundaries between concepts.
55
+
56
+ ### Cross-reference with code
57
+
58
+ When the user states how something works, check whether the code agrees. If you find a contradiction, surface it: "Your code cancels entire Orders, but you just said partial cancellation is possible — which is right?"
59
+
60
+ ### Update CONTEXT.md inline
61
+
62
+ When a term is resolved, update `CONTEXT.md` right there. Don't batch these up — capture them as they happen. Use the format in [CONTEXT-FORMAT.md](./CONTEXT-FORMAT.md).
63
+
64
+ `CONTEXT.md` should be totally devoid of implementation details. Do not treat `CONTEXT.md` as a spec, a scratch pad, or a repository for implementation decisions. It is a glossary and nothing else.
65
+
66
+ ### Offer ADRs sparingly
67
+
68
+ Only offer to create an ADR when all three are true:
69
+
70
+ 1. **Hard to reverse** — the cost of changing your mind later is meaningful
71
+ 2. **Surprising without context** — a future reader will wonder "why did they do it this way?"
72
+ 3. **The result of a real trade-off** — there were genuine alternatives and you picked one for specific reasons
73
+
74
+ If any of the three is missing, skip the ADR. Use the format in [ADR-FORMAT.md](./ADR-FORMAT.md).
@@ -0,0 +1,7 @@
1
+ ---
2
+ name: grill-with-docs
3
+ description: A relentless interview to sharpen a plan or design, which also creates docs (ADR's and glossary) as we go.
4
+ disable-model-invocation: true
5
+ ---
6
+
7
+ Run a `/grilling` session, using the `/domain-modeling` skill.
@@ -0,0 +1,12 @@
1
+ ---
2
+ name: grilling
3
+ description: Grill the user relentlessly about a plan, decision, or idea. Use when the user wants to stress-test their thinking, or uses any 'grill' trigger phrases.
4
+ ---
5
+
6
+ Interview me relentlessly about every aspect of this until we reach a shared understanding. Walk down each branch of the decision tree, resolving dependencies between decisions one-by-one. For each question, provide your recommended answer.
7
+
8
+ Ask the questions one at a time, waiting for feedback on each question before continuing. Asking multiple questions at once is bewildering.
9
+
10
+ If a *fact* can be found by exploring the environment (filesystem, tools, etc.), look it up rather than asking me. The *decisions*, though, are mine — put each one to me and wait for my answer.
11
+
12
+ Do not act on it until I confirm we have reached a shared understanding.