@boyingliu01/xp-gate 0.7.0 → 0.8.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 (197) hide show
  1. package/bin/xp-gate.js +4 -9
  2. package/lib/__tests__/audit-log.test.ts +107 -0
  3. package/lib/__tests__/detect-deps.test.js +212 -42
  4. package/lib/__tests__/doctor.test.js +1 -0
  5. package/lib/__tests__/gate-audit.test.ts +59 -0
  6. package/lib/__tests__/init.test.js +47 -1
  7. package/lib/__tests__/install-skill.test.js +1 -45
  8. package/lib/__tests__/ui-detector.test.ts +186 -26
  9. package/lib/__tests__/ui-review.test.ts +119 -0
  10. package/lib/__tests__/uninstall.test.js +1 -0
  11. package/lib/detect-deps.js +180 -37
  12. package/lib/doctor.js +7 -9
  13. package/lib/gate-audit.ts +26 -42
  14. package/lib/init.js +42 -13
  15. package/lib/install-skill.js +20 -48
  16. package/lib/rollback.js +1 -16
  17. package/lib/shared-paths.js +30 -0
  18. package/lib/shared-utils.js +25 -0
  19. package/lib/ui-detector.ts +20 -14
  20. package/lib/ui-review.ts +58 -53
  21. package/lib/uninstall.js +8 -9
  22. package/package.json +1 -1
  23. package/plugins/claude-code/.claude-plugin/plugin.json +1 -1
  24. package/plugins/claude-code/skills/admin-template-guidelines/SKILL.md +904 -0
  25. package/plugins/claude-code/skills/delphi-review/.delphi-config.json.example +45 -0
  26. package/plugins/claude-code/skills/delphi-review/AGENTS.md +66 -0
  27. package/plugins/claude-code/skills/delphi-review/INSTALL.md +152 -0
  28. package/plugins/claude-code/skills/delphi-review/SKILL.md +454 -0
  29. package/plugins/claude-code/skills/delphi-review/opencode.json.delphi.example +56 -0
  30. package/plugins/claude-code/skills/delphi-review/references/code-walkthrough.md +486 -0
  31. package/plugins/claude-code/skills/improve-codebase-architecture/SKILL.md +156 -0
  32. package/plugins/claude-code/skills/ralph-loop/SKILL.md +501 -0
  33. package/plugins/claude-code/skills/ralph-loop/references/components/memory.md +55 -0
  34. package/plugins/claude-code/skills/ralph-loop/references/components/middleware.md +54 -0
  35. package/plugins/claude-code/skills/ralph-loop/references/components/skill-invocations.md +39 -0
  36. package/plugins/claude-code/skills/ralph-loop/references/components/system-prompt.md +24 -0
  37. package/plugins/claude-code/skills/ralph-loop/references/components/tool-descriptions.md +32 -0
  38. package/plugins/claude-code/skills/ralph-loop/references/phase-2-build-ralph.md +89 -0
  39. package/plugins/claude-code/skills/ralph-loop/templates/progress-log.md +36 -0
  40. package/plugins/claude-code/skills/sprint-flow/AGENTS.md +68 -0
  41. package/plugins/claude-code/skills/sprint-flow/SKILL.md +1248 -0
  42. package/plugins/claude-code/skills/sprint-flow/references/components/memory.md +87 -0
  43. package/plugins/claude-code/skills/sprint-flow/references/components/middleware.md +72 -0
  44. package/plugins/claude-code/skills/sprint-flow/references/components/skill-invocations.md +104 -0
  45. package/plugins/claude-code/skills/sprint-flow/references/components/system-prompt.md +27 -0
  46. package/plugins/claude-code/skills/sprint-flow/references/components/tool-descriptions.md +96 -0
  47. package/plugins/claude-code/skills/sprint-flow/references/force-levels.md +203 -0
  48. package/plugins/claude-code/skills/sprint-flow/references/phase-0-think.md +115 -0
  49. package/plugins/claude-code/skills/sprint-flow/references/phase-1-plan.md +178 -0
  50. package/plugins/claude-code/skills/sprint-flow/references/phase-2-build.md +198 -0
  51. package/plugins/claude-code/skills/sprint-flow/references/phase-3-review.md +213 -0
  52. package/plugins/claude-code/skills/sprint-flow/references/phase-4-uat.md +125 -0
  53. package/plugins/claude-code/skills/sprint-flow/references/phase-5-feedback.md +100 -0
  54. package/plugins/claude-code/skills/sprint-flow/references/phase-6-ship.md +193 -0
  55. package/plugins/claude-code/skills/sprint-flow/references/phase-7-land.md +140 -0
  56. package/plugins/claude-code/skills/sprint-flow/references/phase-8-cleanup.md +192 -0
  57. package/plugins/claude-code/skills/sprint-flow/references/phase-minus-0-5-auto-estimate.md +257 -0
  58. package/plugins/claude-code/skills/sprint-flow/templates/auto-estimate-learning-log.md +136 -0
  59. package/plugins/claude-code/skills/sprint-flow/templates/auto-estimate-output-template.md +132 -0
  60. package/plugins/claude-code/skills/sprint-flow/templates/emergent-issues-template.md +120 -0
  61. package/plugins/claude-code/skills/sprint-flow/templates/pain-document-template.md +115 -0
  62. package/plugins/claude-code/skills/sprint-flow/templates/sprint-progress-template.md +151 -0
  63. package/plugins/claude-code/skills/sprint-flow/templates/sprint-summary-template.md +120 -0
  64. package/plugins/claude-code/skills/test-driven-development/SKILL.md +71 -0
  65. package/plugins/claude-code/skills/test-specification-alignment/AGENTS.md +56 -0
  66. package/plugins/claude-code/skills/test-specification-alignment/SKILL.md +702 -0
  67. package/plugins/claude-code/skills/test-specification-alignment/references/alignment-verification-algorithm.md +493 -0
  68. package/plugins/claude-code/skills/test-specification-alignment/references/phase2-constraint-enforcement.md +431 -0
  69. package/plugins/claude-code/skills/test-specification-alignment/references/specification-format.md +348 -0
  70. package/plugins/claude-code/skills/to-issues/SKILL.md +277 -0
  71. package/plugins/opencode/README.md +38 -0
  72. package/plugins/opencode/index.ts +85 -0
  73. package/plugins/opencode/package.json +18 -0
  74. package/plugins/opencode/skills/admin-template-guidelines/SKILL.md +904 -0
  75. package/plugins/opencode/skills/delphi-review/.delphi-config.json.example +45 -0
  76. package/plugins/opencode/skills/delphi-review/AGENTS.md +66 -0
  77. package/plugins/opencode/skills/delphi-review/INSTALL.md +152 -0
  78. package/plugins/opencode/skills/delphi-review/SKILL.md +454 -0
  79. package/plugins/opencode/skills/delphi-review/opencode.json.delphi.example +56 -0
  80. package/plugins/opencode/skills/delphi-review/references/code-walkthrough.md +486 -0
  81. package/plugins/opencode/skills/improve-codebase-architecture/SKILL.md +156 -0
  82. package/plugins/opencode/skills/ralph-loop/SKILL.md +501 -0
  83. package/plugins/opencode/skills/ralph-loop/references/components/memory.md +55 -0
  84. package/plugins/opencode/skills/ralph-loop/references/components/middleware.md +54 -0
  85. package/plugins/opencode/skills/ralph-loop/references/components/skill-invocations.md +39 -0
  86. package/plugins/opencode/skills/ralph-loop/references/components/system-prompt.md +24 -0
  87. package/plugins/opencode/skills/ralph-loop/references/components/tool-descriptions.md +32 -0
  88. package/plugins/opencode/skills/ralph-loop/references/phase-2-build-ralph.md +89 -0
  89. package/plugins/opencode/skills/ralph-loop/templates/progress-log.md +36 -0
  90. package/plugins/opencode/skills/sprint-flow/AGENTS.md +68 -0
  91. package/plugins/opencode/skills/sprint-flow/SKILL.md +1248 -0
  92. package/plugins/opencode/skills/sprint-flow/references/components/memory.md +87 -0
  93. package/plugins/opencode/skills/sprint-flow/references/components/middleware.md +72 -0
  94. package/plugins/opencode/skills/sprint-flow/references/components/skill-invocations.md +104 -0
  95. package/plugins/opencode/skills/sprint-flow/references/components/system-prompt.md +27 -0
  96. package/plugins/opencode/skills/sprint-flow/references/components/tool-descriptions.md +96 -0
  97. package/plugins/opencode/skills/sprint-flow/references/force-levels.md +203 -0
  98. package/plugins/opencode/skills/sprint-flow/references/phase-0-think.md +115 -0
  99. package/plugins/opencode/skills/sprint-flow/references/phase-1-plan.md +178 -0
  100. package/plugins/opencode/skills/sprint-flow/references/phase-2-build.md +198 -0
  101. package/plugins/opencode/skills/sprint-flow/references/phase-3-review.md +213 -0
  102. package/plugins/opencode/skills/sprint-flow/references/phase-4-uat.md +125 -0
  103. package/plugins/opencode/skills/sprint-flow/references/phase-5-feedback.md +100 -0
  104. package/plugins/opencode/skills/sprint-flow/references/phase-6-ship.md +193 -0
  105. package/plugins/opencode/skills/sprint-flow/references/phase-7-land.md +140 -0
  106. package/plugins/opencode/skills/sprint-flow/references/phase-8-cleanup.md +192 -0
  107. package/plugins/opencode/skills/sprint-flow/references/phase-minus-0-5-auto-estimate.md +257 -0
  108. package/plugins/opencode/skills/sprint-flow/templates/auto-estimate-learning-log.md +136 -0
  109. package/plugins/opencode/skills/sprint-flow/templates/auto-estimate-output-template.md +132 -0
  110. package/plugins/opencode/skills/sprint-flow/templates/emergent-issues-template.md +120 -0
  111. package/plugins/opencode/skills/sprint-flow/templates/pain-document-template.md +115 -0
  112. package/plugins/opencode/skills/sprint-flow/templates/sprint-progress-template.md +151 -0
  113. package/plugins/opencode/skills/sprint-flow/templates/sprint-summary-template.md +120 -0
  114. package/plugins/opencode/skills/test-driven-development/SKILL.md +71 -0
  115. package/plugins/opencode/skills/test-specification-alignment/AGENTS.md +56 -0
  116. package/plugins/opencode/skills/test-specification-alignment/SKILL.md +702 -0
  117. package/plugins/opencode/skills/test-specification-alignment/references/alignment-verification-algorithm.md +493 -0
  118. package/plugins/opencode/skills/test-specification-alignment/references/phase2-constraint-enforcement.md +431 -0
  119. package/plugins/opencode/skills/test-specification-alignment/references/specification-format.md +348 -0
  120. package/plugins/opencode/skills/to-issues/SKILL.md +277 -0
  121. package/plugins/opencode/tsconfig.json +15 -0
  122. package/plugins/qoder/skills/admin-template-guidelines/SKILL.md +904 -0
  123. package/plugins/qoder/skills/delphi-review/.delphi-config.json.example +45 -0
  124. package/plugins/qoder/skills/delphi-review/AGENTS.md +66 -0
  125. package/plugins/qoder/skills/delphi-review/INSTALL.md +152 -0
  126. package/plugins/qoder/skills/delphi-review/SKILL.md +454 -0
  127. package/plugins/qoder/skills/delphi-review/opencode.json.delphi.example +56 -0
  128. package/plugins/qoder/skills/delphi-review/references/code-walkthrough.md +486 -0
  129. package/plugins/qoder/skills/improve-codebase-architecture/SKILL.md +156 -0
  130. package/plugins/qoder/skills/ralph-loop/SKILL.md +501 -0
  131. package/plugins/qoder/skills/ralph-loop/references/components/memory.md +55 -0
  132. package/plugins/qoder/skills/ralph-loop/references/components/middleware.md +54 -0
  133. package/plugins/qoder/skills/ralph-loop/references/components/skill-invocations.md +39 -0
  134. package/plugins/qoder/skills/ralph-loop/references/components/system-prompt.md +24 -0
  135. package/plugins/qoder/skills/ralph-loop/references/components/tool-descriptions.md +32 -0
  136. package/plugins/qoder/skills/ralph-loop/references/phase-2-build-ralph.md +89 -0
  137. package/plugins/qoder/skills/ralph-loop/templates/progress-log.md +36 -0
  138. package/plugins/qoder/skills/sprint-flow/AGENTS.md +68 -0
  139. package/plugins/qoder/skills/sprint-flow/SKILL.md +1248 -0
  140. package/plugins/qoder/skills/sprint-flow/references/components/memory.md +87 -0
  141. package/plugins/qoder/skills/sprint-flow/references/components/middleware.md +72 -0
  142. package/plugins/qoder/skills/sprint-flow/references/components/skill-invocations.md +104 -0
  143. package/plugins/qoder/skills/sprint-flow/references/components/system-prompt.md +27 -0
  144. package/plugins/qoder/skills/sprint-flow/references/components/tool-descriptions.md +96 -0
  145. package/plugins/qoder/skills/sprint-flow/references/force-levels.md +203 -0
  146. package/plugins/qoder/skills/sprint-flow/references/phase-0-think.md +115 -0
  147. package/plugins/qoder/skills/sprint-flow/references/phase-1-plan.md +178 -0
  148. package/plugins/qoder/skills/sprint-flow/references/phase-2-build.md +198 -0
  149. package/plugins/qoder/skills/sprint-flow/references/phase-3-review.md +213 -0
  150. package/plugins/qoder/skills/sprint-flow/references/phase-4-uat.md +125 -0
  151. package/plugins/qoder/skills/sprint-flow/references/phase-5-feedback.md +100 -0
  152. package/plugins/qoder/skills/sprint-flow/references/phase-6-ship.md +193 -0
  153. package/plugins/qoder/skills/sprint-flow/references/phase-7-land.md +140 -0
  154. package/plugins/qoder/skills/sprint-flow/references/phase-8-cleanup.md +192 -0
  155. package/plugins/qoder/skills/sprint-flow/references/phase-minus-0-5-auto-estimate.md +257 -0
  156. package/plugins/qoder/skills/sprint-flow/templates/auto-estimate-learning-log.md +136 -0
  157. package/plugins/qoder/skills/sprint-flow/templates/auto-estimate-output-template.md +132 -0
  158. package/plugins/qoder/skills/sprint-flow/templates/emergent-issues-template.md +120 -0
  159. package/plugins/qoder/skills/sprint-flow/templates/pain-document-template.md +115 -0
  160. package/plugins/qoder/skills/sprint-flow/templates/sprint-progress-template.md +151 -0
  161. package/plugins/qoder/skills/sprint-flow/templates/sprint-summary-template.md +120 -0
  162. package/plugins/qoder/skills/test-driven-development/SKILL.md +71 -0
  163. package/plugins/qoder/skills/test-specification-alignment/AGENTS.md +56 -0
  164. package/plugins/qoder/skills/test-specification-alignment/SKILL.md +702 -0
  165. package/plugins/qoder/skills/test-specification-alignment/references/alignment-verification-algorithm.md +493 -0
  166. package/plugins/qoder/skills/test-specification-alignment/references/phase2-constraint-enforcement.md +431 -0
  167. package/plugins/qoder/skills/test-specification-alignment/references/specification-format.md +348 -0
  168. package/plugins/qoder/skills/to-issues/SKILL.md +277 -0
  169. package/skills/admin-template-guidelines/SKILL.md +904 -0
  170. package/skills/delphi-review/SKILL.md +112 -77
  171. package/skills/improve-codebase-architecture/SKILL.md +156 -0
  172. package/skills/ralph-loop/SKILL.md +165 -34
  173. package/skills/sprint-flow/SKILL.md +448 -107
  174. package/skills/sprint-flow/references/components/skill-invocations.md +1 -1
  175. package/skills/sprint-flow/references/components/tool-descriptions.md +1 -1
  176. package/skills/sprint-flow/references/force-levels.md +203 -0
  177. package/skills/sprint-flow/references/phase-1-plan.md +4 -4
  178. package/skills/sprint-flow/references/phase-minus-0-5-auto-estimate.md +20 -1
  179. package/skills/sprint-flow/templates/auto-estimate-output-template.md +7 -5
  180. package/skills/sprint-flow/templates/sprint-progress-template.md +151 -0
  181. package/skills/test-driven-development/SKILL.md +71 -0
  182. package/skills/test-specification-alignment/SKILL.md +98 -24
  183. package/skills/to-issues/SKILL.md +277 -0
  184. package/plugins/qoder/AGENTS.md +0 -93
  185. package/plugins/qoder/README.md +0 -87
  186. package/plugins/qoder/widgets/quality-report.html +0 -163
  187. package/plugins/qoder/widgets/sprint-dashboard.html +0 -172
  188. package/skills/delphi-review/evals/evals.json +0 -82
  189. package/skills/delphi-review/references/qoder-multi-model.md +0 -191
  190. package/skills/ralph-loop/evals/evals.json +0 -311
  191. package/skills/ralph-loop/evolution-history.json +0 -59
  192. package/skills/ralph-loop/evolution-log.md +0 -16
  193. package/skills/sprint-flow/evals/evals.json +0 -130
  194. package/skills/sprint-flow/evolution-history.json +0 -39
  195. package/skills/sprint-flow/evolution-log.md +0 -23
  196. package/skills/sprint-flow/references/qoder-adaptation.md +0 -173
  197. package/skills/test-specification-alignment/evals/evals.json +0 -75
@@ -1,10 +1,23 @@
1
1
  ---
2
2
  name: delphi-review
3
- description: "Delphi consensus review: multi-round anonymous expert review until unanimous APPROVAL. Supports design/code-walkthrough modes. 2-3 experts from different providers. MANDATORY before implementation, design, or architecture decisions. Trigger: 'review this design', '评审这个需求', 'design review', '多专家评审', 'consensus review', 'code walkthrough', 'push review', or any request for multi-expert review of requirements, design docs, architecture, or PRs."
3
+ description: "Use when asked to review a design, plan, or architecture; before implementation starts; or when multi-expert consensus is needed. Triggers: 'review this design', '评审这个需求', 'design review', '多专家评审', 'consensus review', 'code walkthrough', 'push review', 'architecture review', 'PR review', or any request for multi-expert evaluation of requirements, design docs, or PRs."
4
4
  ---
5
5
 
6
6
  # Delphi Consensus Review
7
7
 
8
+ ## Scope
9
+
10
+ **In Scope:**
11
+ - Multi-round anonymous expert consensus review (design + code-walkthrough modes)
12
+ - 2-3 experts from different providers with statistical consensus (>= 91%)
13
+ - Structured verdict: APPROVED / PASS_WITH_CAVEATS / REQUEST_CHANGES
14
+ - Domestic models only (no Anthropic/OpenAI/Google)
15
+
16
+ **Out of Scope:**
17
+ - Does NOT implement code changes (review only, implementation is separate)
18
+ - Does NOT replace testing or CI/CD verification
19
+ - Does NOT handle deployment or release decisions
20
+
8
21
  ## 核心原则
9
22
 
10
23
  **Delphi 方法只有一个目的:得到所有专家一致认可的可行方案。**
@@ -14,7 +27,7 @@ description: "Delphi consensus review: multi-round anonymous expert review until
14
27
  1. **匿名性** — Round 1 专家互不知道对方意见
15
28
  2. **迭代** — 多轮直到共识,不是固定轮数
16
29
  3. **受控反馈** — 每轮看到其他专家意见
17
- 4. **统计共识** — >=95% 一致才算共识
30
+ 4. **统计共识** — >=91% 一致才算共识
18
31
 
19
32
  ### 质量优先
20
33
 
@@ -82,24 +95,24 @@ description: "Delphi consensus review: multi-round anonymous expert review until
82
95
 
83
96
  | 阈值 | 说明 |
84
97
  |------|------|
85
- | **>=95%** | 推荐默认 |
98
+ | **>=91%** | 推荐默认 |
86
99
  | 100% | 完全一致(更严格) |
87
100
 
88
101
  ---
89
102
 
90
- ## 完整流程
103
+ ## Delphi 评审执行过程
91
104
 
92
105
  ```
93
106
  Phase 0: 准备 → Round 1: 匿名独立评审 → 共识检查
94
107
 
95
- ├─ 一致 + >=95% + APPROVED → ✅ 完成
108
+ ├─ 一致 + >=91% + APPROVED → ✅ 完成
96
109
 
97
- └─ 不一致 或 <95% 或 REQUEST_CHANGES
110
+ └─ 不一致 或 <91% 或 REQUEST_CHANGES
98
111
 
99
112
 
100
113
  Round 2: 交换意见 → 共识检查
101
114
 
102
- ├─ 一致 + >=95% + APPROVED → ✅ 完成
115
+ ├─ 一致 + >=91% + APPROVED → ✅ 完成
103
116
 
104
117
  └─ 仍分歧 或 REQUEST_CHANGES
105
118
 
@@ -202,14 +215,96 @@ Phase 0: 准备 → Round 1: 匿名独立评审 → 共识检查
202
215
 
203
216
  ---
204
217
 
218
+ ## Triggers
219
+
220
+ This skill activates on any request for multi-expert review. Common triggers:
221
+
222
+ **English:**
223
+ - "review this design"
224
+ - "design review"
225
+ - "architecture review"
226
+ - "consensus review"
227
+ - "code walkthrough"
228
+ - "push review"
229
+ - "multi-expert review"
230
+ - "PR review"
231
+
232
+ **Chinese:**
233
+ - "评审这个需求"
234
+ - "多专家评审"
235
+ - "设计评审"
236
+ - "架构评审"
237
+ - "代码走查"
238
+
239
+ **Related commands:**
240
+ - `/delphi-review` - Design review mode
241
+ - `/delphi-review --mode code-walkthrough` - Pre-push code walkthrough
242
+
243
+ ---
244
+
245
+ ## Workflow Steps
246
+
247
+ 1. **Determine mode** - Design review (default) or code-walkthrough (--mode code-walkthrough)
248
+ 2. **Dispatch anonymous experts** - 2-3 experts from ≥2 different domestic model providers
249
+ 3. **Collect Round 1 independent reviews** - Anonymous, no cross-expert bias
250
+ 4. **Synthesize feedback** - Measure consensus, identify disagreements
251
+ 5. **Run Round 2+ until consensus** - Exchange opinions, iterate until ≥91% agreement
252
+ 6. **Block on unresolved Critical/Major** - Zero-tolerance: all Critical/Major must be resolved
253
+ 7. **Emit verdict** - APPROVED (with specification.yaml) or REQUEST_CHANGES (fix + re-review)
254
+
255
+ **Consensus threshold:** ≥91% (project standard for Delphi review approval)
256
+ **Model policy:** Domestic models only (DeepSeek, Qwen, Kimi, GLM, MiniMax). Foreign models (Anthropic/OpenAI/Google) forbidden.
257
+
258
+ ---
259
+
260
+ ## Scope
261
+
262
+ **IN Scope:**
263
+ - Design document review (requirements, architecture, PRDs)
264
+ - Pre-implementation planning review
265
+ - Code walkthrough (git push validation, max 20 files/500 LOC)
266
+ - Multi-expert consensus building
267
+ - Specification extraction (design → specification.yaml)
268
+
269
+ **OUT Scope:**
270
+ - Single-expert review (use `/review` instead)
271
+ - Post-implementation review (use `/requesting-code-review`)
272
+ - Security audit (use `/security-research` or `/cso`)
273
+ - Performance benchmarking (use `/benchmark`)
274
+
275
+ ---
276
+
277
+ ## Examples
278
+
279
+ **Example 1: Design review**
280
+ ```bash
281
+ /delphi-review
282
+ ```
283
+ → 3 experts review design doc → consensus report + specification.yaml
284
+
285
+ **Example 2: Code walkthrough**
286
+ ```bash
287
+ /delphi-review --mode code-walkthrough
288
+ ```
289
+ → Pre-push validation → .code-walkthrough-result.json
290
+
291
+ **Example 3: Chinese trigger**
292
+ ```
293
+ User: 评审这个需求文档
294
+ → Auto-detects delphi-review trigger → dispatches experts
295
+ ```
296
+
297
+ ---
298
+
205
299
  ## Output Format (MANDATORY)
206
- Every review round output MUST follow this exact JSON structure:
300
+
301
+ Every review round output MUST follow this exact JSON structure for design mode:
207
302
 
208
303
  ```json
209
304
  {
210
305
  "expert_id": "A|B|C",
211
306
  "round": 1,
212
- "mode": "design|code-walkthrough",
307
+ "mode": "design",
213
308
  "verdict": "APPROVED|REQUEST_CHANGES|REJECTED",
214
309
  "confidence": 9,
215
310
  "critical_issues": ["..."],
@@ -218,11 +313,14 @@ Every review round output MUST follow this exact JSON structure:
218
313
  "consensus_report": {
219
314
  "agreed_items": ["..."],
220
315
  "disagreed_items": ["..."],
221
- "final_verdict": "APPROVED|REQUEST_CHANGES"
316
+ "final_verdict": "APPROVED|REQUEST_CHANGES",
317
+ "consensus_ratio": 0.95
222
318
  }
223
319
  }
224
320
  ```
225
321
 
322
+ **For code-walkthrough mode**, output follows `.code-walkthrough-result.json` schema (see `references/code-walkthrough.md`).
323
+
226
324
  **Anti-patterns mapping to assertions:**
227
325
  - `Round 1 → 生成报告 → "评审完成"` → Output MUST NOT have `verdict: APPROVED` if `critical_issues` exist.
228
326
  - `只处理 Critical,忽略 Major` → Output MUST include `major_concerns` array, even if empty.
@@ -242,7 +340,7 @@ Every review round output MUST follow this exact JSON structure:
242
340
  - [ ] Round 2+ 完成(交换意见 / 最终立场)
243
341
 
244
342
  **CRITICAL — 共识验证:**
245
- - [ ] 问题共识比例 >=95%
343
+ - [ ] 问题共识比例 >=91%
246
344
  - [ ] 所有 Critical Issues 已解决
247
345
  - [ ] 所有 Major Concerns 已处理
248
346
 
@@ -316,54 +414,6 @@ Every review round output MUST follow this exact JSON structure:
316
414
 
317
415
  ---
318
416
 
319
- ## Qoder 平台适配
320
-
321
- 在 Qoder IDE 中,delphi-review 的多专家评审通过以下方式实现:
322
-
323
- ### 多模型评审(替代 OpenCode 的多 agent 配置)
324
-
325
- 利用 Qoder 的多模型访问能力(类似 coding plan),通过 Agent subagent 派发不同模型完成 Expert A/B/C 评审:
326
-
327
- | 专家 | 角色 | Qoder Subagent 映射 | 说明 |
328
- |------|------|---------------------|------|
329
- | Expert A (架构) | 架构审查 | **plan-agent** subagent | 适合架构级分析 |
330
- | Expert B (技术) | 实现审查 | **CodeReview** subagent | 代码审查天然适合 |
331
- | Expert C (可行性) | 可行性仲裁 | **plan-agent** subagent(不同 prompt) | 与 Expert A 使用不同的评审 prompt |
332
-
333
- **执行流程**:
334
- 1. orchestrator 准备评审材料(设计文档/代码变更)
335
- 2. 分别派发 2-3 个 Agent subagent,每个 subagent 携带对应专家的 system prompt
336
- 3. 收集各专家评审结果 → 合并为共识报告
337
- 4. 如未达成共识 → 迭代(携带其他专家意见重新评审)
338
-
339
- ### 专家配置
340
-
341
- 专家→模型映射通过 `.qoder/delphi-config.json` 配置:
342
-
343
- ```json
344
- {
345
- "experts": {
346
- "A": { "role": "architecture", "model_hint": "deepseek-v4-pro" },
347
- "B": { "role": "implementation", "model_hint": "kimi-k2.6" },
348
- "C": { "role": "feasibility", "model_hint": "qwen3.6-plus" }
349
- },
350
- "consensus_threshold": 0.95,
351
- "max_rounds": 5
352
- }
353
- ```
354
-
355
- > **注意**:`model_hint` 是建议模型,实际使用的模型取决于 Qoder 的模型调度策略。
356
-
357
- ### 降级方案
358
-
359
- 如果多模型 subagent 调用不可用,降级为**单模型多角色模式**:
360
- - 同一模型分别扮演 Expert A/B/C(不同 system prompt)
361
- - 明确标注降级警告:`[DEGRADED] 单模型多角色模式,失去跨 provider 匿名性保护`
362
-
363
- 详细配置和执行指南参见 `references/qoder-multi-model.md`。
364
-
365
- ---
366
-
367
417
  ## Anti-Patterns
368
418
 
369
419
  | ❌ 错误 | ✅ 正确 |
@@ -372,7 +422,7 @@ Every review round output MUST follow this exact JSON structure:
372
422
  | 只处理 Critical,忽略 Major | 零容忍:Critical/Major 全部必须处理,不可跳过或降级 |
373
423
  | 单专家自评 | 至少 2 位不同 provider 的专家 |
374
424
  | 用户说"时间紧急"就跳过 | 评审是投资不是开销,跳过后期返工成本更高 |
375
- | "专家几乎一致"就通过 | "几乎" = 不一致,继续到 >=95% |
425
+ | "专家几乎一致"就通过 | "几乎" = 不一致,继续到 >=91% |
376
426
  | 使用 Anthropic/GPT/Gemini 等国外昂贵模型 | 必须使用国产开源模型(DeepSeek, Qwen, Kimi, GLM, MiniMax) |
377
427
  | 三个专家使用同一厂家模型 | 必须来自至少 2 家不同厂家 |
378
428
 
@@ -387,7 +437,7 @@ Every review round output MUST follow this exact JSON structure:
387
437
  | "这只是小变更" | 所有变更都需要评审 |
388
438
  | "Round 1 就够了" | 不够,必须多轮直到共识 |
389
439
  | "生成报告就完成了" | APPROVED 才算完成 |
390
- | "2/3 同意就是共识" | 还要检查问题共识比例 >=95% |
440
+ | "2/3 同意就是共识" | 还要检查问题共识比例 >=91% |
391
441
 
392
442
  ---
393
443
 
@@ -395,25 +445,10 @@ Every review round output MUST follow this exact JSON structure:
395
445
 
396
446
  **Delphi 评审完成的唯一标准:**
397
447
  1. ✅ 所有专家裁决 APPROVED
398
- 2. ✅ 问题共识 >=95%
448
+ 2. ✅ 问题共识 >=91%
399
449
  3. ✅ 所有 Critical Issues 已修复验证
400
450
  4. ✅ 所有 Major Concerns 已处理
401
451
  5. ✅ 共识报告已生成
402
452
  6. ✅ 用户已确认
403
453
 
404
454
  **缺少任何一项 = 未完成**
405
- ## Output Format (MANDATORY)
406
- Every delphi review round MUST output valid JSON:
407
- ```json
408
- {
409
- "skill_name": "delphi-review",
410
- "mode": "design|code-walkthrough",
411
- "phase": "Round 1|Round 2|Round 3|Consensus",
412
- "expert_id": "A|B|C",
413
- "verdict": "APPROVED|REQUEST_CHANGES|REJECTED",
414
- "confidence": 8,
415
- "issues": [{"id": "string", "severity": "critical|major|minor", "description": "string"}],
416
- "consensus_report": {"status": "pending|consensus|disagreement"}
417
- }
418
- ```
419
- **Eval assertions check for:** `verdict` enum values, `confidence` range, `issues` structure, `consensus_report.status`.
@@ -0,0 +1,156 @@
1
+ ---
2
+ name: improve-codebase-architecture
3
+ description: Find deepening opportunities in a codebase, informed by domain language in CONTEXT.md and decisions in ADRs. Use when user wants to improve architecture, find refactoring opportunities, consolidate tightly-coupled modules, or make a codebase more AI-navigable. Run periodically (weekly or after surges of development).
4
+ ---
5
+
6
+ # Improve Codebase Architecture
7
+
8
+ 周期性架构健康检查:发现 **shallow module → deep module** 的深度化机会。目标是提升可测试性、AI 可导航性、模块边界清晰度。
9
+
10
+ 与 XP-Gate 质量门禁的分工:
11
+ | 机制 | 时机 | 作用 |
12
+ |------|------|------|
13
+ | **6 道门禁** | 每次 commit | 被动拦截明显问题(函数过长、重复代码等) |
14
+ | **improve-codebase-architecture** | 每周/开发潮后 | 主动深度化改进(seam 识别、模块合并、接口提炼) |
15
+
16
+ ---
17
+
18
+ ## 术语(与 XP-Gate Principles 一致)
19
+
20
+ | 术语 | 定义 |
21
+ |------|------|
22
+ | **Module** | 任何有接口和实现的东西(函数、类、包、slice) |
23
+ | **Interface** | 调用者使用前必须知道的一切:类型、不变量、错误模式、顺序、配置 |
24
+ | **Implementation** | 接口背后的代码 |
25
+ | **Depth** | 接口的杠杆率:大量行为隐藏在简单接口后。**Deep = 高杠杆**。**Shallow = 接口几乎与实现一样复杂** |
26
+ | **Seam** | 接口所在位置;可以在不修改实现的情况下改变行为的地方 |
27
+ | **Adapter** | 在 seam 处满足接口的具体实现 |
28
+ | **Locality** | 深度带来的可维护性收益:变更、bug、知识集中在一处 |
29
+
30
+ ---
31
+
32
+ ## 核心判断工具
33
+
34
+ ### Deletion Test
35
+ 想象删除某个模块:
36
+ - 如果复杂性消失 → 它是 pass-through,不值得保留
37
+ - 如果复杂性在 N 个调用方中重新出现 → **它真正提供了价值**
38
+ - **"Yes, concentrates" = 你想发现的信号**
39
+
40
+ ### The Interface Is the Test Surface
41
+ 接口就是测试的边界。如果测试需要深入实现细节,说明接口太浅。
42
+
43
+ ### One Adapter = Hypothetical Seam. Two Adapters = Real Seam.
44
+ 只有一个实现满足接口 → 可能过度抽象。两个以上 → 真正的可替换边界。
45
+
46
+ ---
47
+
48
+ ## 流程
49
+
50
+ ### 1. 探索
51
+
52
+ 先读项目的 `CONTEXT.md`(领域语言)和 `docs/adr/`(架构决策)。
53
+
54
+ 然后有机地走查代码库(不要遵循死板启发式),注意你在哪里感受到摩擦:
55
+
56
+ - 理解一个概念是否需要在多个小文件间跳来跳去?
57
+ - 模块是否 **shallow** — 接口几乎与实现一样复杂?
58
+ - 纯函数是否仅仅为了可测试性而被提取,但真正的 bug 隐藏在调用方式中?(缺乏 **locality**)
59
+ - 紧密耦合的模块是否在其 seams 之处泄漏?
60
+ - 哪些部分难以通过当前接口进行测试?
61
+
62
+ 对任何怀疑 shallow 的模块执行 **Deletion Test**:删除它会让复杂性集中还是分散?"是的,会集中"就是你要的信号。
63
+
64
+ ### 2. 呈现候选项
65
+
66
+ 以编号列表呈现深度化机会。每项包含:
67
+
68
+ - **Files** — 涉及哪些文件/模块
69
+ - **Problem** — 当前架构为何造成摩擦(使用 CONTEXT.md 中的领域术语)
70
+ - **Solution** — 自然语言描述会怎样改变
71
+ - **Benefits** — 用 locality 和 leverage 解释收益,以及测试会怎样改善
72
+
73
+ **使用 CONTEXT.md 领域术语。如果与 ADR 冲突**,仅在摩擦值得重新讨论 ADR 时才标注:
74
+ > *"Contradicts ADR-0007 — 但值得重新打开,因为…"*
75
+
76
+ 不要列出 ADR 禁止的每个理论重构。
77
+
78
+ **此时不要提出接口设计**。先问用户:"你想探索哪个候选项?"
79
+
80
+ ### 3. 用户选择候选项
81
+
82
+ 仅当用户明确选择某个候选项时,才进入步骤 4。
83
+
84
+ ### 4. Grilling 循环(设计树遍历)
85
+
86
+ 用户选中某个候选项后,进入 grilling 对话:
87
+ - 遍历约束、依赖、深度化模块的形状
88
+ - seam 背后放什么、什么不放在 seam 背后
89
+ - 哪些测试能在深度化后存活/新增
90
+
91
+ **对话中的副作用**(决策固化时立即执行):
92
+ - 命名不在 CONTEXT.md 中的新概念 → **新增到 CONTEXT.md**
93
+ - 模糊术语在对话中变清晰 → **更新 CONTEXT.md**
94
+ - 用户拒绝候选项且有有理由 → **提议记录为 ADR**(避免未来重复建议)
95
+ - 需要探索替代接口 → **按接口设计原则引导**
96
+
97
+ ### 5. 输出(可选)
98
+
99
+ 如果用户在 grilling 后决定执行重构:
100
+ - 生成重构计划(含文件列表、步骤顺序、风险点)
101
+ - 调用 test-driven-development skill 执行重构(保持行为不变)
102
+
103
+ ---
104
+
105
+ ## 与 XP-Gate 集成
106
+
107
+ ### 触发时机
108
+ ```
109
+ Phase 5 (FEEDBACK) 后推荐调用:
110
+ → learn + retro + **improve-codebase-architecture**
111
+ → 发现架构摩擦 → 记录到 retro → 下一 Sprint 纳入 backlog
112
+
113
+ 或作为独立周期性任务:
114
+ → /improve-codebase-architecture → 每周/开发潮后
115
+ ```
116
+
117
+ ### 与 ralph-loop 的关系
118
+ 架构改进本身可以作为一个独立的 REQ 通过 ralph-loop 执行:
119
+ - REQ: "深度化 Order 模块(从 N 个散文件合并为 deep module)"
120
+ - 通过 test-driven-development 保证行为不变
121
+
122
+ ### 与质量门禁的关系
123
+ 架构改进后,质量门禁的 violation 数量应减少:
124
+ - God class → 拆分为 deep modules → SOLID-001 (SRP) 告警消失
125
+ - Deep nesting → 封装为简单接口 → CC-002 告警消失
126
+ - Code duplication → 提取公共 deep module → Gate 2 (Dup Code) 改善
127
+
128
+ ---
129
+
130
+ ## Anti-Patterns
131
+
132
+ | ❌ 错误 | ✅ 正确 |
133
+ |---------|---------|
134
+ | 仅在文件层面重构(拆分大文件) | 在概念边界处重构(deep module 封装行为) |
135
+ | 为了测试而提取纯函数 | 为了 locality 和组织行为边界而重构 |
136
+ | 过度设计接口(只有一个 adapter) | 发现真实 seam(≥2 adapters 或需要可测试性)后再抽象 |
137
+ | 忽视现有 ADR 提出重构 | 尊重 ADR,仅在摩擦值得重新讨论时标注冲突 |
138
+ | 一次性重构整个模块 | 逐个候选项执行,使用 TDD 保证行为不变 |
139
+ | 与 ADR 冲突但不记录决策 | 记录为 ADR,避免未来重复建议 |
140
+
141
+ ---
142
+
143
+ ## 使用示例
144
+
145
+ ```
146
+ /improve-codebase-architecture
147
+
148
+ → Explore: 读取 CONTEXT.md, 走查代码库
149
+ → 发现 3 个浅模块候选项
150
+ → 呈现: #1 Order 模块过浅 / #2 Auth 适配器泄漏 / #3 支付领域缺乏 locality
151
+ → 用户选中 #1
152
+ → Grilling: 讨论 Order 的 seam 应该在哪
153
+ → 更新 CONTEXT.md: 新增 "Order Intake" 术语
154
+ → 提议 ADR: "Order 状态机封装" → 用户同意 → 创建 docs/adr/000X.md
155
+ → 输出: 重构计划 → TDD 执行
156
+ ```
@@ -1,13 +1,6 @@
1
1
  ---
2
2
  name: ralph-loop
3
- description: >
4
- Default Phase 2 BUILD mode for Sprint-Flow. Processes ONE REQ at a time from
5
- specification.yaml with clean isolated context per subagent dispatch, persists
6
- memory via git history + classified learnings, runs full regression tests on each
7
- REQ, and only commits on verification pass. Designed to reduce token consumption
8
- from linear context accumulation to per-REQ fixed budgets (40-67% savings).
9
- Token-constraint is the default — every Phase 2 uses this mode automatically.
10
- Use `--mode parallel` to opt into the legacy all-at-once mode if needed.
3
+ description: Use when executing Sprint-Flow Phase 2 BUILD, processing one REQ, building the next requirement, iterating with clean context, or requiring full regression per requirement.
11
4
  maturity: stable
12
5
  ---
13
6
 
@@ -25,6 +18,25 @@ maturity: stable
25
18
  | **浓缩型分类学习** | permanent(架构级)+ contextual(最近 3 条)双层 learnings |
26
19
  | **AGENTS.md 统一更新** | orchestrator 统一写,subagent 不直接修改 — 无竞态 |
27
20
 
21
+ ---
22
+
23
+ ## Triggers
24
+
25
+ **关键词触发**:ralph-loop, process one REQ, build next requirement, Phase 2 BUILD, iterate REQ, isolated REQ build, clean context, full regression
26
+
27
+ **使用场景**:
28
+ - 执行 Sprint-Flow Phase 2 BUILD 阶段
29
+ - 从 specification.yaml 读取需求逐个实现
30
+ - 需要控制每个 REQ 的 token 预算
31
+ - 防止上下文污染(前一个 REQ 的实现细节影响后一个 REQ)
32
+ - 需要全量回归测试保证不引入回归
33
+ - 需要持久化 learnings 供后续 REQ 参考
34
+
35
+ **何时不使用**:
36
+ - 需求数量极少(1-2 个)且相互独立,可以并行
37
+ - 紧急热修复,不需要完整 Sprint Flow
38
+ - 明确使用 `--mode parallel` 切换到并行模式
39
+
28
40
  ## 作为 Phase 2 默认行为
29
41
 
30
42
  Ralph Loop 是 Sprint-Flow **Phase 2 BUILD 的默认模式**:
@@ -297,43 +309,162 @@ Phase 0, 1, 3-6 行为完全不变。
297
309
 
298
310
  ---
299
311
 
300
- ## Qoder 平台适配
312
+ ## Workflow Steps (Mandatory Execution Order)
313
+
314
+ **每个 REQ 必须按以下顺序执行,不得跳过或重排**:
315
+
316
+ 1. **Load next READY REQ**
317
+ - 从 specification.yaml 读取下一个依赖已满足的 REQ
318
+ - 检查 priority 和 status (pending 状态)
319
+ - 构建依赖图,确认无循环依赖
320
+
321
+ 2. **Create isolated context**
322
+ - 清空前一个 REQ 的对话历史
323
+ - 注入:当前 REQ + AC + permanent learnings + contextual learnings (最近 3 条)
324
+ - 注入:AGENTS.md + git log --oneline -5 + 测试基础设施摘要
325
+
326
+ 3. **Dispatch build subagent**
327
+ - 使用 `task(category="unspecified-high", load_skills=["test-driven-development"], timeout=300)`
328
+ - 强制 TDD 流程:RED → GREEN → REFACTOR
329
+ - 强制执行 Mock 边界策略(详见 Mock 边界表)
330
+
331
+ 4. **Run full regression tests**
332
+ - L1: typecheck + lint on changed files
333
+ - L1b: 检查测试先行比率 (新增测试行数 / 总新增行数 ≥ 40%)
334
+ - **L2: 全量测试运行**(不只是 @test 当前 REQ 的测试)
335
+ - L3: 检查整体覆盖率 ≥ 80%
336
+
337
+ 5. **Fix until green or block**
338
+ - 失败 → retry (max 3 次,每次注入失败摘要)
339
+ - 第 3 次仍失败 → BLOCK → 等待用户决策 (skip/manual/stop/rollback)
340
+ - 通过 → git commit + 标记 done
341
+
342
+ 6. **Persist learnings**
343
+ - 分类为 permanent(架构级)或 contextual(临时性)
344
+ - 自动升级条件:被≥2 个 REQ 引用 或 涉及接口/数据结构
345
+ - 调用 `gstack/learn` 总结经验教训
346
+
347
+ 7. **Update sprint state**
348
+ - orchestrator 统一更新 AGENTS.md(append `## ralph-loop: [REQ-XXX title]`)
349
+ - 原子写 checkpoint (progress.log)
350
+ - 继续下一个 READY REQ
351
+
352
+ **禁止行为**:
353
+ - ❌ 跳过测试基础设施检查
354
+ - ❌ 只运行部分测试(必须全量回归)
355
+ - ❌ 验证失败仍 commit
356
+ - ❌ 多个 subagent 同时写 AGENTS.md
357
+ - ❌ 修改前一个 REQ 的代码(除非修复回归)
358
+
359
+ ---
360
+
361
+ ## Scope
362
+
363
+ **In Scope**:
364
+ - Phase 2 BUILD 阶段的 REQ 级迭代构建
365
+ - 从 specification.yaml 读取需求并逐个实现
366
+ - 测试先行(TDD)+ 全量回归测试
367
+ - 持久化 learnings 供后续 REQ 参考
368
+ - 依赖排序和循环依赖检测
369
+ - 崩溃恢复(从 checkpoint 继续)
370
+
371
+ **Out of Scope**:
372
+ - Phase 0-1 (THINK/PLAN) 的需求分析和设计
373
+ - Phase 3-6 (REVIEW/USER ACCEPT/FEEDBACK/SHIP) 的后续阶段
374
+ - 并行模式(需显式使用 `--mode parallel` 切换到 `dispatching-parallel-agents`)
375
+ - 紧急热修复(应使用标准 sprint-flow 或手动处理)
376
+ - 非 specification.yaml 定义的需求(临时需求应先纳入 spec 再执行)
377
+
378
+ ---
379
+
380
+ ## Examples
381
+
382
+ **Example 1: 标准 Sprint Flow 启动**
383
+ ```bash
384
+ /sprint-flow "开发用户登录功能,支持 JWT 和 OAuth2" --type web-nextjs
385
+ # → Phase 0-1 完成设计评审后,Phase 2 自动进入 ralph-loop 模式
386
+ # → 按拓扑顺序处理 REQ-001 (User Model) → REQ-002 (Auth Middleware) → REQ-003 (Login API)
387
+ ```
388
+
389
+ **Example 2: 单个 REQ 构建**
390
+ ```bash
391
+ /ralph-loop
392
+ # → 从 specification.yaml 读取下一个 READY REQ
393
+ # → 创建孤立上下文,dispatch TDD subagent
394
+ # → 全量回归测试通过后 commit
395
+ ```
396
+
397
+ **Example 3: 处理阻塞 REQ**
398
+ ```
399
+ REQ-005 失败 3 次 → BLOCKED
400
+ → 用户决策:
401
+ - skip: 跳过此 REQ,继续 REQ-006
402
+ - manual: 手动修复后重新 dispatch
403
+ - stop: 停止整个 ralph-loop,保留已 done commits
404
+ - rollback: git reset 回上一个稳定版本
405
+ ```
406
+
407
+ **Example 4: 崩溃恢复**
408
+ ```bash
409
+ # 系统崩溃后重新启动
410
+ /ralph-loop --resume
411
+ # → 检测 progress.log → 跳过已 done REQs
412
+ # → 从最后一个 pending REQ 继续,无需重做已完成工作
413
+ ```
414
+
415
+ **Example 5: 测试基础设施缺失**
416
+ ```
417
+ REQ-001 开始 → 检查 test-utils.ts → 不存在
418
+ → dispatch "生成测试基础设施" subagent
419
+ → retry max 2 次 → 仍失败 → BLOCK 或 fallback inline 生成
420
+ → 基础设施就绪后继续业务代码开发
421
+ ```
422
+
423
+ ---
301
424
 
302
- ### Subagent Dispatch(替代 OpenCode 的 `task()` API)
425
+ ## Output Contract (Mandatory Checklist)
303
426
 
304
- Qoder 环境中,ralph-loop 的 subagent 派发使用以下方式:
427
+ **每个 REQ 完成时必须输出以下结构化检查清单**:
305
428
 
306
- | 原调用 | Qoder 替代 | 说明 |
307
- |---------|------------|------|
308
- | `task(category="unspecified-high", load_skills=["test-driven-development"])` | **orchestrator 直接执行** | ralph-loop 逐 REQ 迭代,每个 REQ 在干净上下文中执行,不需要独立 subagent |
309
- | `gstack/learn` | **Qoder Memory 系统** | permanent learnings → `UpdateMemory`;contextual learnings → 会话上下文 |
429
+ ```markdown
430
+ ## REQ-XXX: [Title] - Execution Summary
310
431
 
311
- ### Learnings 持久化(替代 gstack/learn)
432
+ **Status**: PASS / ❌ FAIL (retry n/3) / 🚫 BLOCKED
312
433
 
313
- ralph-loop 的 learnings 分类机制在 Qoder 中通过 Memory 系统实现更优雅的持久化:
434
+ **Context Isolation**:
435
+ - [ ] Previous REQ context cleared
436
+ - [ ] Permanent learnings injected (N items)
437
+ - [ ] Contextual learnings injected (≤3 items)
438
+ - [ ] Test infrastructure confirmed ready
314
439
 
315
- | Learnings 类型 | 原方案 | Qoder 替代 |
316
- |---------------|--------|------------|
317
- | **permanent** | progress.log + AGENTS.md | `UpdateMemory`(project_introduction / expert_experience / development_practice_specification 类型) |
318
- | **contextual** | progress.log(最近 3 条) | 当前会话上下文传递,不持久化 |
319
- | **Sprint retro** | gstack/learn | Phase 5 结束时 `UpdateMemory` 写入 |
440
+ **TDD Compliance**:
441
+ - [ ] Tests written BEFORE implementation
442
+ - [ ] Test/implementation ratio 40%
443
+ - [ ] Mock usage justified (if >30% mock density)
320
444
 
321
- **执行方式**:每个 REQ 完成后,orchestrator 调用 `UpdateMemory` 存储 permanent learnings:
322
- - 架构决策 `expert_experience` 类型
323
- - 接口约定/全局规范 `development_practice_specification` 类型
324
- - 项目结构发现 `project_introduction` 类型
445
+ **Verification Layers**:
446
+ - [ ] L1: typecheck + lint pass
447
+ - [ ] L1b: Test-first ratio check pass
448
+ - [ ] L2: **FULL regression tests** (all tests, not just @test REQ-XXX)
449
+ - [ ] L3: coverage ≥ 80%
325
450
 
326
- ### 三层验证 Gate 增强(替代 PostToolUse Hook)
451
+ **Learnings Persisted**:
452
+ - [ ] Permanent: [N items, list key ones]
453
+ - [ ] Contextual: [N items, sliding window]
454
+ - [ ] `gstack/learn` called
327
455
 
328
- Qoder 中,三层验证 Gate 增加 principles 检查步骤:
456
+ **State Updated**:
457
+ - [ ] AGENTS.md updated (orchestrator)
458
+ - [ ] progress.log atomically written
459
+ - [ ] Git commit created (if PASS)
329
460
 
330
- | 层级 | 原验证 | Qoder 增强 |
331
- |------|--------|------------|
332
- | L1 | typecheck + lint | + **principles check**(`npx -y tsx src/principles/index.ts --files <changed> --format console`) |
333
- | L2 | 全量测试 | 无变化 |
334
- | L3 | coverage ≥ 80% | 无变化 |
461
+ **Next Step**: [REQ-YYY title / COMPLETE / BLOCKED]
462
+ ```
335
463
 
336
- > **注意**:principles check 仅在 src/principles/ 存在时执行(非 xp-gate 项目跳过)。
464
+ **Eval Criteria** (Issue #120, #121):
465
+ - ✅ L2 pass: Structured execution plan visible (checklist format)
466
+ - ✅ L3 pass: All 7 workflow steps followed, full regression tests run
467
+ - ❌ Fail: Missing checklist, partial tests, context pollution
337
468
 
338
469
  ---
339
470