@boyingliu01/xp-gate 0.19.2 → 0.20.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 (223) hide show
  1. package/adapters/gate-4.sh +83 -18
  2. package/adapters/gate-8.sh +49 -5
  3. package/adapters/iac.sh +1 -1
  4. package/adapters/typescript.sh +15 -60
  5. package/bin/xp-gate.js +15 -16
  6. package/gate-10.sh +35 -2
  7. package/gate-4.sh +110 -21
  8. package/gate-8.sh +49 -5
  9. package/hooks/gate-10.sh +35 -2
  10. package/hooks/gate-4.sh +110 -21
  11. package/hooks/gate-8.sh +49 -5
  12. package/hooks/lib/jscpd-run.sh +63 -0
  13. package/hooks/lib/sprint-gate-report.sh +58 -0
  14. package/hooks/lib/test-failure.sh +152 -0
  15. package/hooks/lib/typecheck.sh +141 -0
  16. package/hooks/lib/validate-code-walkthrough.cjs +43 -5
  17. package/hooks/post-merge +100 -0
  18. package/hooks/pre-commit +401 -155
  19. package/hooks/pre-push +75 -19
  20. package/lib/__tests__/bootstrap.test.js +23 -41
  21. package/lib/__tests__/check-version.test.js +8 -1
  22. package/lib/__tests__/detect-deps.test.js +16 -0
  23. package/lib/__tests__/doctor-drift-round2.test.js +212 -0
  24. package/lib/__tests__/doctor-executed-surface.test.js +209 -0
  25. package/lib/__tests__/doctor-hook-drift.test.js +329 -0
  26. package/lib/__tests__/doctor-machine-mutation.test.js +116 -0
  27. package/lib/__tests__/doctor-module-drift.test.js +206 -0
  28. package/lib/__tests__/doctor-module-resolution-parity.test.js +314 -0
  29. package/lib/__tests__/doctor-path-equivalence.test.js +59 -0
  30. package/lib/__tests__/doctor-repair-boundary.test.js +52 -0
  31. package/lib/__tests__/doctor-tui-skill-freshness.test.js +105 -0
  32. package/lib/__tests__/doctor.test.js +155 -0
  33. package/lib/__tests__/gate-runner.test.js +19 -3
  34. package/lib/__tests__/helpers/lib-sandbox.cjs +55 -0
  35. package/lib/__tests__/init.test.js +44 -17
  36. package/lib/__tests__/install-skill-full-dir.test.js +151 -0
  37. package/lib/__tests__/install-skill.test.js +51 -132
  38. package/lib/__tests__/language-tools-detect.test.js +158 -0
  39. package/lib/__tests__/phase-transition.test.js +15 -1
  40. package/lib/__tests__/qoder-delphi-agents.test.js +285 -0
  41. package/lib/__tests__/shared-paths.test.js +20 -0
  42. package/lib/__tests__/shared-utils.test.js +69 -0
  43. package/lib/__tests__/skill-flags.test.js +48 -0
  44. package/lib/__tests__/ui-detector.test.ts +6 -2
  45. package/lib/__tests__/uninstall.test.js +20 -0
  46. package/lib/__tests__/update-hooks.test.js +12 -0
  47. package/lib/__tests__/update-skill.test.js +7 -4
  48. package/lib/detect-deps.js +3 -20
  49. package/lib/doctor-tui.js +22 -5
  50. package/lib/doctor.js +1178 -31
  51. package/lib/init.js +184 -33
  52. package/lib/install-cmd.js +7 -4
  53. package/lib/install-skill.js +38 -95
  54. package/lib/language-tools.js +83 -4
  55. package/lib/mattpocock-license-verdict.json +1 -1
  56. package/lib/shared-paths.js +5 -2
  57. package/lib/shared-utils.js +47 -3
  58. package/lib/uninstall.js +12 -0
  59. package/lib/update-hooks.js +4 -4
  60. package/lib/update-skill.js +6 -7
  61. package/mock-policy/AGENTS.md +4 -4
  62. package/mutation/AGENTS.md +4 -4
  63. package/mutation/__tests__/gate-m.test.ts +66 -14
  64. package/mutation/__tests__/mutmut-runner.test.ts +91 -42
  65. package/mutation/__tests__/test-filter-parity.test.ts +37 -0
  66. package/mutation/gate-m.ts +21 -8
  67. package/package.json +1 -1
  68. package/plugins/claude-code/.claude-plugin/plugin.json +2 -2
  69. package/plugins/claude-code/skills/clipboard-vision/__tests__/clipboard-vision-distribution.test.cjs +0 -1
  70. package/plugins/claude-code/skills/delphi-review/AGENTS.md +4 -4
  71. package/plugins/claude-code/skills/delphi-review/SKILL.md +98 -14
  72. package/plugins/claude-code/skills/delphi-review/references/code-walkthrough.md +36 -3
  73. package/plugins/claude-code/skills/delphi-review/references/requirements.md +6 -6
  74. package/plugins/claude-code/skills/sprint-flow/AGENTS.md +4 -4
  75. package/plugins/claude-code/skills/sprint-flow/references/phase-2-design.md +3 -3
  76. package/plugins/claude-code/skills/test-specification-alignment/AGENTS.md +4 -4
  77. package/plugins/dsh/README.md +169 -4
  78. package/plugins/dsh/dsh-overlay.patch.yml +67 -0
  79. package/plugins/dsh/package.json +1 -1
  80. package/plugins/dsh/scripts/prepack.cjs +24 -19
  81. package/plugins/dsh/setup-dsh.ps1 +160 -0
  82. package/plugins/dsh/skills/clipboard-vision/__tests__/clipboard-vision-distribution.test.cjs +0 -1
  83. package/plugins/dsh/skills/delphi-review/AGENTS.md +4 -4
  84. package/plugins/dsh/skills/delphi-review/SKILL.md +98 -14
  85. package/plugins/dsh/skills/delphi-review/references/code-walkthrough.md +36 -3
  86. package/plugins/dsh/skills/delphi-review/references/requirements.md +6 -6
  87. package/plugins/dsh/skills/sprint-flow/AGENTS.md +4 -4
  88. package/plugins/dsh/skills/sprint-flow/references/phase-2-design.md +3 -3
  89. package/plugins/dsh/skills/test-specification-alignment/AGENTS.md +4 -4
  90. package/plugins/dsh/src/command.test.ts +66 -2
  91. package/plugins/dsh/src/command.ts +36 -14
  92. package/plugins/dsh/src/contract.test.ts +31 -1
  93. package/plugins/dsh/src/delphi-config.test.ts +190 -0
  94. package/plugins/dsh/src/delphi-config.ts +223 -0
  95. package/plugins/dsh/src/delphi-run.test.ts +181 -0
  96. package/plugins/dsh/src/delphi-run.ts +129 -0
  97. package/plugins/dsh/src/delphi.test.ts +222 -0
  98. package/plugins/dsh/src/delphi.ts +247 -0
  99. package/plugins/dsh/src/dialect.test.ts +59 -0
  100. package/plugins/dsh/src/dialect.ts +40 -0
  101. package/plugins/dsh/src/index.ts +70 -4
  102. package/plugins/dsh/src/skills.test.ts +26 -19
  103. package/plugins/opencode/package.json +1 -1
  104. package/plugins/opencode/skills/clipboard-vision/__tests__/clipboard-vision-distribution.test.cjs +0 -1
  105. package/plugins/opencode/skills/delphi-review/AGENTS.md +4 -4
  106. package/plugins/opencode/skills/delphi-review/SKILL.md +98 -14
  107. package/plugins/opencode/skills/delphi-review/references/code-walkthrough.md +36 -3
  108. package/plugins/opencode/skills/delphi-review/references/requirements.md +6 -6
  109. package/plugins/opencode/skills/sprint-flow/AGENTS.md +4 -4
  110. package/plugins/opencode/skills/sprint-flow/references/phase-2-design.md +3 -3
  111. package/plugins/opencode/skills/test-specification-alignment/AGENTS.md +4 -4
  112. package/plugins/qoder/agents/delphi-architecture.md +1 -1
  113. package/plugins/qoder/agents/delphi-feasibility.md +1 -1
  114. package/plugins/qoder/agents/delphi-technical.md +1 -1
  115. package/plugins/qoder/plugin.json +2 -2
  116. package/plugins/qoder/skills/admin-template-guidelines/SKILL.md +6 -797
  117. package/plugins/qoder/skills/admin-template-guidelines/references/rule-1.md +91 -0
  118. package/plugins/qoder/skills/admin-template-guidelines/references/rule-2.md +155 -0
  119. package/plugins/qoder/skills/admin-template-guidelines/references/rule-3.md +70 -0
  120. package/plugins/qoder/skills/admin-template-guidelines/references/rule-4.md +154 -0
  121. package/plugins/qoder/skills/admin-template-guidelines/references/rule-5.md +126 -0
  122. package/plugins/qoder/skills/admin-template-guidelines/references/rule-6.md +180 -0
  123. package/plugins/qoder/skills/batch-grill-me/SKILL.md +15 -0
  124. package/plugins/qoder/skills/clipboard-vision/__tests__/clipboard-vision-distribution.test.cjs +0 -1
  125. package/plugins/qoder/skills/clipboard-vision/describe-clipboard.ps1 +115 -0
  126. package/plugins/qoder/skills/clipboard-vision/describe-clipboard.sh +161 -0
  127. package/plugins/qoder/skills/delphi-review/.delphi-config.json.example +61 -28
  128. package/plugins/qoder/skills/delphi-review/AGENTS.md +4 -4
  129. package/plugins/qoder/skills/delphi-review/INSTALL.md +97 -98
  130. package/plugins/qoder/skills/delphi-review/SKILL.md +170 -63
  131. package/plugins/qoder/skills/delphi-review/hooks.md +19 -0
  132. package/plugins/qoder/skills/delphi-review/opencode.json.delphi.example +6 -10
  133. package/plugins/qoder/skills/delphi-review/references/code-walkthrough.md +36 -3
  134. package/plugins/qoder/skills/delphi-review/references/orchestrator-dispatch.md +64 -0
  135. package/plugins/qoder/skills/delphi-review/references/requirements.md +402 -0
  136. package/plugins/qoder/skills/delphi-review/references/round-templates.md +134 -0
  137. package/plugins/qoder/skills/delphi-review/scripts/verify-consensus.sh +43 -0
  138. package/plugins/qoder/skills/delphi-review/tools.md +29 -0
  139. package/plugins/qoder/skills/domain-modeling/ADR-FORMAT.md +64 -0
  140. package/plugins/qoder/skills/domain-modeling/CONTEXT-FORMAT.md +60 -0
  141. package/plugins/qoder/skills/domain-modeling/SKILL.md +74 -0
  142. package/plugins/qoder/skills/grill-with-docs/SKILL.md +7 -0
  143. package/plugins/qoder/skills/grilling/SKILL.md +12 -0
  144. package/plugins/qoder/skills/ralph-loop/SKILL.md +87 -428
  145. package/plugins/qoder/skills/ralph-loop/references/components.md +113 -0
  146. package/plugins/qoder/skills/ralph-loop/references/workflow-details.md +99 -0
  147. package/plugins/qoder/skills/sprint-flow/AGENTS.md +5 -5
  148. package/plugins/qoder/skills/sprint-flow/SKILL.md +255 -454
  149. package/plugins/qoder/skills/sprint-flow/__tests__/sprint-flow.test.cjs +457 -0
  150. package/plugins/qoder/skills/sprint-flow/hooks.md +18 -0
  151. package/plugins/qoder/skills/sprint-flow/references/components/memory.md +1 -1
  152. package/plugins/qoder/skills/sprint-flow/references/components/middleware.md +1 -1
  153. package/plugins/qoder/skills/sprint-flow/references/components/skill-invocations.md +21 -20
  154. package/plugins/qoder/skills/sprint-flow/references/components/tool-descriptions.md +22 -23
  155. package/plugins/qoder/skills/sprint-flow/references/force-levels.md +0 -1
  156. package/plugins/qoder/skills/sprint-flow/references/orchestration-rules.md +34 -27
  157. package/plugins/qoder/skills/sprint-flow/references/phase-1-prep.md +1 -1
  158. package/plugins/qoder/skills/sprint-flow/references/phase-2-design.md +160 -123
  159. package/plugins/qoder/skills/sprint-flow/references/phase-3-build.md +203 -2
  160. package/plugins/qoder/skills/sprint-flow/references/phase-4-verify.md +107 -34
  161. package/plugins/qoder/skills/sprint-flow/references/phase-5-ship.md +194 -12
  162. package/plugins/qoder/skills/sprint-flow/references/phase-6-close.md +139 -7
  163. package/plugins/qoder/skills/sprint-flow/references/phase-overview.md +486 -0
  164. package/plugins/qoder/skills/sprint-flow/scripts/verify-sprint-state.sh +38 -0
  165. package/plugins/qoder/skills/sprint-flow/tools.md +29 -0
  166. package/plugins/qoder/skills/test-specification-alignment/AGENTS.md +4 -4
  167. package/plugins/qoder/skills/test-specification-alignment/SKILL.md +104 -601
  168. package/plugins/qoder/skills/to-issues/SKILL.md +1 -1
  169. package/principles/AGENTS.md +9 -8
  170. package/principles/__tests__/adapter-metrics.test.ts +292 -0
  171. package/principles/__tests__/analyzer.test.ts +29 -6
  172. package/principles/__tests__/baseline-prune-timeout.test.ts +71 -0
  173. package/principles/__tests__/baseline-prune.test.ts +338 -0
  174. package/principles/__tests__/boy-scout-init-baseline.test.ts +167 -0
  175. package/principles/__tests__/boy-scout-integration.test.ts +97 -6
  176. package/principles/__tests__/boy-scout.test.ts +253 -7
  177. package/principles/__tests__/config-enforcement.test.ts +469 -0
  178. package/principles/__tests__/config-git-timeout.test.ts +66 -0
  179. package/principles/__tests__/direct-execution.test.ts +187 -0
  180. package/principles/__tests__/index.test.ts +16 -3
  181. package/principles/__tests__/warnings-baseline-budgets.test.ts +74 -0
  182. package/principles/adapters/typescript.ts +613 -13
  183. package/principles/analyzer.ts +22 -0
  184. package/principles/baseline-prune.ts +217 -0
  185. package/principles/boy-scout.ts +481 -51
  186. package/principles/config.ts +362 -54
  187. package/principles/direct-execution.ts +60 -0
  188. package/principles/index.ts +40 -17
  189. package/principles/rules/__tests__/clean-code/many-exports.test.ts +16 -10
  190. package/principles/rules/clean-code/code-duplication.ts +8 -8
  191. package/principles/rules/clean-code/deep-nesting.ts +8 -8
  192. package/principles/rules/clean-code/god-class.ts +8 -8
  193. package/principles/rules/clean-code/large-file.ts +15 -11
  194. package/principles/rules/clean-code/long-function.ts +8 -8
  195. package/principles/rules/clean-code/magic-numbers.ts +10 -7
  196. package/principles/rules/clean-code/many-exports.ts +7 -7
  197. package/principles/rules/clean-code/missing-error-handling.ts +5 -5
  198. package/principles/rules/clean-code/too-many-params.ts +8 -8
  199. package/principles/rules/clean-code/unused-imports.ts +5 -5
  200. package/principles/rules/solid/dip.ts +18 -8
  201. package/principles/rules/solid/isp.ts +9 -8
  202. package/principles/rules/solid/lsp.ts +6 -6
  203. package/principles/rules/solid/ocp.ts +6 -5
  204. package/principles/rules/solid/srp.ts +7 -8
  205. package/principles/types.ts +15 -0
  206. package/scripts/__tests__/sync-package-content.test.js +28 -0
  207. package/scripts/delphi-external-review.cjs +193 -10
  208. package/scripts/sync-package-content.js +7 -4
  209. package/skills/clipboard-vision/__tests__/clipboard-vision-distribution.test.cjs +0 -1
  210. package/skills/delphi-review/AGENTS.md +4 -4
  211. package/skills/delphi-review/SKILL.md +98 -14
  212. package/skills/delphi-review/references/code-walkthrough.md +36 -3
  213. package/skills/delphi-review/references/requirements.md +6 -6
  214. package/skills/sprint-flow/AGENTS.md +4 -4
  215. package/skills/sprint-flow/references/phase-2-design.md +3 -3
  216. package/skills/test-specification-alignment/AGENTS.md +4 -4
  217. package/lib/__tests__/download-skill.test.js +0 -281
  218. package/lib/download-skill.js +0 -96
  219. package/plugins/qoder/skills/ralph-loop/references/components/memory.md +0 -55
  220. package/plugins/qoder/skills/ralph-loop/references/components/middleware.md +0 -54
  221. package/plugins/qoder/skills/ralph-loop/references/components/skill-invocations.md +0 -39
  222. package/plugins/qoder/skills/ralph-loop/references/components/system-prompt.md +0 -24
  223. package/plugins/qoder/skills/ralph-loop/references/components/tool-descriptions.md +0 -32
@@ -1,151 +1,150 @@
1
- # Installing and Configuring Delphi Review (Qoder)
1
+ # Installing and Configuring Delphi Review
2
2
 
3
- This guide walks you through setting up the Delphi consensus review skill in your Qoder environment.
3
+ This guide walks you through setting up the Delphi consensus review skill in your OpenCode environment.
4
4
 
5
5
  ## Prerequisites
6
6
 
7
- - **Node.js >= 18** (script uses built-in `fetch`)
8
- - Exactly **3 callable expert model configurations** with distinct trimmed executable model IDs
9
- - `@boyingliu01/xp-gate` npm package installed (for the `delphi-external-review.cjs` script)
7
+ - OpenCode installed and configured
8
+ - Exactly **3 callable expert model configurations** are required.
9
+ - The three configurations must use distinct trimmed executable model IDs. They may share one provider and token plan.
10
10
 
11
- > Provider, vendor, gateway, and model nationality are unrestricted. One provider and token plan may serve all three roles.
11
+ > Provider, vendor, gateway, and model nationality are unrestricted. The enforced diversity boundary is three distinct requested model IDs, not provider diversity.
12
12
 
13
- ## Quick Setup (4 steps)
13
+ ## Quick Setup (3 steps)
14
14
 
15
15
  ### Step 1: Copy the configuration template
16
16
 
17
17
  ```bash
18
- # From your project root:
19
- cp skills/delphi-review/.delphi-config.json.example skills/delphi-review/.delphi-config.json
18
+ # From your project root (where opencode.json lives):
19
+ cp skills/delphi-review/.delphi-config.json.example .delphi-config.json
20
20
  ```
21
21
 
22
- Or if installed globally:
22
+ This file maps abstract expert roles to agent names. You typically don't need to edit this unless you want custom agent names.
23
23
 
24
- ```bash
25
- cp ~/.qoder/skills/delphi-review/.delphi-config.json.example ~/.qoder/skills/delphi-review/.delphi-config.json
24
+ ### Step 2: Add agent definitions to opencode.json
25
+
26
+ Copy the `agent` block from `skills/delphi-review/opencode.json.delphi.example` into your `opencode.json`.
27
+
28
+ Then replace the provider/model placeholders:
29
+
30
+ ```json
31
+ // Before (template):
32
+ "model": "YOUR_PROVIDER/YOUR_MODEL_A"
33
+
34
+ // After (your config):
35
+ "model": "bailian-tp/qwen-plus"
36
+ // The other two role model fields must be different trimmed IDs.
26
37
  ```
27
38
 
28
- ### Step 2: Edit the configuration
39
+ ### Step 3: Ensure provider configuration exists
40
+
41
+ Your `opencode.json` must have the provider definitions. If you're using OpenCode's built-in providers (OpenAI, Anthropic, etc.), you just need API keys set in your environment.
29
42
 
30
- Open `.delphi-config.json` and fill in your API keys and model preferences:
43
+ For custom providers (like Ali Bailian), add a provider entry:
31
44
 
32
45
  ```json
33
- {
34
- "active_profile": "default",
35
- "profiles": {
36
- "default": {
37
- "providers": {
38
- "deepseek": {
39
- "base_url": "https://api.deepseek.com/v1",
40
- "api_key": "sk-your-key-here"
46
+ "provider": {
47
+ "my-custom-provider": {
48
+ "npm": "@ai-sdk/anthropic",
49
+ "name": "My Custom Provider",
50
+ "options": {
51
+ "baseURL": "https://your-api-endpoint.com/v1",
52
+ "apiKey": "your-api-key"
53
+ },
54
+ "models": {
55
+ "my-model-name": {
56
+ "name": "My Model Name",
57
+ "modalities": {
58
+ "input": ["text"],
59
+ "output": ["text"]
41
60
  },
42
- "zhipu": {
43
- "base_url": "https://open.bigmodel.cn/api/paas/v4",
44
- "api_key": "your-key-here"
61
+ "limit": {
62
+ "context": 128000,
63
+ "output": 8192
45
64
  }
46
- },
47
- "experts": {
48
- "architecture": { "provider": "deepseek", "model": "deepseek-chat" },
49
- "technical": { "provider": "zhipu", "model": "glm-5.2" },
50
- "feasibility": { "provider": "deepseek", "model": "deepseek-reasoner" }
51
65
  }
52
66
  }
53
67
  }
54
68
  }
55
69
  ```
56
70
 
57
- ### Step 3: Verify Node.js version
58
-
59
- ```bash
60
- node --version # Must be >= 18.0.0
61
- ```
62
-
63
- ### Step 4: Verify configuration
71
+ ## Model Recommendations
64
72
 
65
- Test that the script can read your config and the API is reachable:
73
+ The skill requires exactly three experts for every mode. Choose three models that are callable through your configured provider.
66
74
 
67
- ```bash
68
- node <script-path> --expert architecture --input "Test review: verify connectivity" --round 1 --config skills/delphi-review/.delphi-config.json
69
- ```
75
+ | Expert Role | Recommended | Alternatives |
76
+ |-------------|-------------|-------------|
77
+ | **Architecture (Expert A)** | Claude Sonnet 4 | GPT-4o, Qwen-Plus, Gemini 2.5 Pro |
78
+ | **Technical (Expert B)** | Claude Haiku | Qwen-Coder, DeepSeek-Coder, GPT-4o-mini |
79
+ | **Feasibility (Expert C)** | Claude Opus | GPT-4, Gemini 2.5 Pro, Qwen-Max |
70
80
 
71
- Where `<script-path>` is located (in priority order):
72
- 1. `node_modules/@boyingliu01/xp-gate/scripts/delphi-external-review.cjs`
73
- 2. `$(npm root -g)/@boyingliu01/xp-gate/scripts/delphi-external-review.cjs`
81
+ **Minimum viable setup**:
82
+ - Expert A: architecture model
83
+ - Expert B: technical model
84
+ - Expert C: feasibility model
85
+ - All three requested model IDs must be distinct. A `provider: local` fallback does not count.
74
86
 
75
- ## Configuration Reference
87
+ ## Configuration File Reference
76
88
 
77
89
  ### `.delphi-config.json`
78
90
 
79
- | Field | Required | Description |
80
- |-------|----------|-------------|
81
- | `active_profile` | ✅ | Name of the active configuration profile |
82
- | `profiles` | ✅ | Named configuration profiles (for easy switching) |
83
- | `profiles.<name>.providers` | ✅ | Provider definitions: base_url + api_key |
84
- | `profiles.<name>.experts` | ✅ | Expert-to-provider/model mapping |
85
- | `profiles.<name>.experts.<role>.provider` | ✅ | Callable provider name; `"local"` fallback cannot count |
86
- | `consensus.threshold_percent` | ❌ | Consensus threshold (default: 90) |
87
- | `consensus.max_review_rounds` | ❌ | Max review rounds (default: 5) |
88
-
89
- ### Switching profiles
90
-
91
- Edit `active_profile` in the config, or use the `--profile <name>` CLI argument to override temporarily.
92
-
93
- ### Single-provider setup
94
-
95
- One provider may expose all three distinct executable models:
96
-
97
- ```json
98
- {
99
- "active_profile": "starter",
100
- "profiles": {
101
- "starter": {
102
- "providers": {
103
- "deepseek": { "base_url": "https://api.deepseek.com/v1", "api_key": "sk-xxx" }
104
- },
105
- "experts": {
106
- "architecture": { "provider": "deepseek", "model": "deepseek-chat" },
107
- "technical": { "provider": "deepseek", "model": "deepseek-reasoner" },
108
- "feasibility": { "provider": "deepseek", "model": "deepseek-coder" }
109
- }
110
- }
111
- }
112
- }
113
- ```
114
-
115
- > All three model IDs must remain distinct after trimming, and all three calls must succeed.
91
+ | Field | Description | Default |
92
+ |-------|-------------|---------|
93
+ | `num_experts` | Number of experts to use | 3, fixed |
94
+ | `experts.architecture` | Architecture reviewer configuration | Required |
95
+ | `experts.technical` | Technical reviewer configuration | Required |
96
+ | `experts.feasibility` | Feasibility reviewer configuration | Required for 3-expert mode |
97
+ | `consensus.threshold_percent` | Agreement threshold | 90 |
98
+ | `consensus.max_review_rounds` | Maximum review rounds | 5 |
99
+ | `consensus.cross_provider_required` | Deprecated and ignored; emits `cross_provider_required_ignored` | false or omitted |
100
+
101
+ ### `opencode.json` agent block
102
+
103
+ | Field | Description |
104
+ |-------|-------------|
105
+ | `model` | Provider/model identifier (e.g., `openai/gpt-4o`) |
106
+ | `mode` | Must be `"subagent"` |
107
+ | `prompt` | Expert role instructions |
108
+ | `tools` | Tool permissions (read: true, write: false recommended) |
116
109
 
117
110
  ## Usage
118
111
 
119
112
  Once configured, invoke the skill via:
120
113
 
121
- ```
114
+ ```bash
122
115
  /delphi-review
123
116
  ```
124
117
 
125
- The skill will:
126
- 1. Read `.delphi-config.json` to find expert configurations
127
- 2. Call external model APIs via `delphi-external-review.cjs` script
128
- 3. Reject `provider: "local"` fallback as non-executed evidence
129
- 4. Aggregate verdicts and compute consensus
118
+ Or reference it in your workflows. The skill will automatically use the agents defined in your `opencode.json`.
130
119
 
131
120
  ## Troubleshooting
132
121
 
133
- ### "Config file not found"
122
+ ### "Agent delphi-reviewer-xxx not found"
123
+
124
+ The agent definitions in `opencode.json` don't match the names in `.delphi-config.json`. Verify:
125
+ 1. Agent names in `.delphi-config.json` match keys in `opencode.json` `agent` block
126
+ 2. opencode.js is valid JSON (use `jq . opencode.json` to verify)
127
+
128
+ ### "Model YOUR_PROVIDER/YOUR_MODEL not available"
134
129
 
135
- Copy `.delphi-config.json.example` to `.delphi-config.json` and fill in your API keys.
130
+ You forgot to replace the placeholder. Search for `YOUR_PROVIDER` in your opencode.json and replace with actual values.
136
131
 
137
- ### "Script not found"
132
+ ### Both experts gave identical feedback
138
133
 
139
- Install the npm package: `npm install -g @boyingliu01/xp-gate`
134
+ Shared providers are allowed. Configure three distinct executable model IDs and verify all three calls succeed.
140
135
 
141
- ### "Authentication failed (401)"
136
+ ### Review takes too long / costs too much
142
137
 
143
- Check your API key in `.delphi-config.json`. Ensure the key matches the provider.
138
+ Do not reduce the expert count. Use three callable models and keep the threshold and round bounds unchanged.
144
139
 
145
- ### "Expert model IDs are not distinct"
140
+ ## Advanced: JSON Schema Validation
146
141
 
147
- Configure three distinct callable model IDs. They may use the same provider.
142
+ For IDE autocompletion and validation, reference the schema in your `.delphi-config.json`:
148
143
 
149
- ### "Node.js >= 18 required"
144
+ ```json
145
+ {
146
+ "$schema": "https://example.com/delphi-config.schema.json"
147
+ }
148
+ ```
150
149
 
151
- Upgrade Node.js. The script uses the built-in `fetch` API.
150
+ The schema file is available at `.delphi-config.schema.json` in this directory.
@@ -4,8 +4,8 @@ version: 1.1.0
4
4
  description: >
5
5
  Performs multi-round anonymous expert consensus review using the Delphi method. Supports
6
6
  design review (default), code-walkthrough (--mode code-walkthrough), and requirements
7
- (--mode requirements) modes. Uses exactly 3
8
- successfully executed experts with distinct model IDs and a >=90% statistical consensus threshold.
7
+ (lightweight, --mode requirements) modes. Uses exactly three experts with distinct executable
8
+ model IDs and a >=90% statistical consensus threshold.
9
9
  Outputs structured verdict (APPROVED/PASS_WITH_CAVEATS/REQUEST_CHANGES/BLOCKED).
10
10
 
11
11
  WHAT: Anonymous multi-expert review with iterative consensus building for designs, plans,
@@ -21,12 +21,13 @@ description: >
21
21
  "多专家评审", "consensus review", "code walkthrough", "push review", "architecture review",
22
22
  "delphi review", "run delphi", "start delphi", "评审这个架构", "review this architecture",
23
23
  "评审PR", "review this PR with delphi", "delphi评审", "delphi 评审", "run delphi review",
24
- "执行delphi", "启动delphi评审".
24
+ "执行delphi", "启动delphi评审", "review the requirements", "评审需求", "requirements review",
25
+ "/requirements-review".
25
26
  NEGATIVE TRIGGERS: "how does delphi work", "what is delphi review", "code review checklist",
26
27
  "review my code quickly", "can you review this", "peer review", "I need a review",
27
28
  "explain the review process", "review guidelines", "how to review a design",
28
29
  "code review template", "review format", "PR review", "帮我review一下",
29
- "just review this", "quick review", "review steps".
30
+ "just review this", "quick review", "review steps", "review my requirements document".
30
31
  maturity: beta
31
32
  auto_continue: true
32
33
  triggers:
@@ -52,6 +53,10 @@ triggers:
52
53
  - "run delphi review"
53
54
  - "执行delphi"
54
55
  - "启动delphi评审"
56
+ - "review the requirements"
57
+ - "评审需求"
58
+ - "requirements review"
59
+ - "/requirements-review"
55
60
  triggers_negative_examples:
56
61
  - "how does delphi work" # educational question about the process
57
62
  - "what is delphi review" # asking for explanation, not execution
@@ -73,6 +78,7 @@ triggers_negative_examples:
73
78
  - "review format" # asking about format, not executing
74
79
  - "show me how to review" # educational request about reviewing
75
80
  - "review checklist example" # asking for examples, not running review
81
+ - "review my requirements document" # educational discussion about requirements, not executing review
76
82
  triggers_negative_test_cases:
77
83
  - input: "how does delphi work"
78
84
  expect: "NOT triggered"
@@ -130,6 +136,16 @@ triggers_negative_test_cases:
130
136
  expect: "NOT triggered"
131
137
  - input: "run delphi"
132
138
  expect: "triggered"
139
+ - input: "review the requirements"
140
+ expect: "triggered"
141
+ - input: "评审需求"
142
+ expect: "triggered"
143
+ - input: "requirements review"
144
+ expect: "triggered"
145
+ - input: "/requirements-review"
146
+ expect: "triggered"
147
+ - input: "review my requirements document"
148
+ expect: "NOT triggered"
133
149
  workflow_steps:
134
150
  - "Step 0: Input Validation → Output: [DelphiReview] or [DelphiReview:BLOCKED]"
135
151
  - "Round 1: Anonymous Independent Review → Output: [DelphiReview Round 1] expert JSON verdicts"
@@ -170,10 +186,10 @@ tools_denied:
170
186
  ## Scope
171
187
 
172
188
  **In Scope:**
173
- - Multi-round anonymous expert consensus review (design + requirements + code-walkthrough modes)
174
- - Exactly 3 experts with distinct trimmed executable model IDs and statistical consensus (>= 90%)
189
+ - Multi-round anonymous expert consensus review (design + code-walkthrough modes)
190
+ - Exactly three experts with distinct normalized executable model IDs and statistical consensus (>= 90%)
175
191
  - Structured verdict: APPROVED / PASS_WITH_CAVEATS / REQUEST_CHANGES
176
- - Provider, vendor, gateway, country, and model nationality are unrestricted; any expert execution failure blocks approval
192
+ - Model nationality, vendor, provider, and gateway are unrestricted.
177
193
 
178
194
  **Out of Scope:**
179
195
  - Does NOT implement code changes (review only, implementation is separate)
@@ -204,6 +220,10 @@ tools_denied:
204
220
  - run delphi review
205
221
  - 执行delphi
206
222
  - 启动delphi评审
223
+ - review the requirements
224
+ - 评审需求
225
+ - requirements review
226
+ - /requirements-review
207
227
 
208
228
  **NOT triggered by:**
209
229
  - "how does delphi work" (educational)
@@ -223,16 +243,17 @@ tools_denied:
223
243
  - "code review template" (asking for template)
224
244
  - "review format" (asking about format)
225
245
  - "show me how to review" (educational)
246
+ - "review my requirements document" (educational discussion, not execution)
226
247
 
227
248
  ## Workflow
228
249
 
229
250
  1. **Step 0: Input Validation** — Check input contains reviewable content (design doc/code/spec/diff). Empty input → `[DelphiReview:BLOCKED]`.
230
- 2. **Round 1: Anonymous Independent Review** — Launch the architecture, technical, and feasibility Custom Agents independently. Record three successful `delphi_expert_result` records and each `requested_model`.
231
- 3. **Execution Verification** — Require all three records and three distinct trimmed requested model IDs. Model provider, vendor, gateway, and nationality are unrestricted.
232
- 4. **Consensus Check** — Aggregate all three results; consensus >=90% AND all APPROVED → complete.
233
- 5. **Rounds 2-5** — Exchange evidence and re-evaluate with all three Custom Agents until approved or five rounds are exhausted.
234
- 6. **Failure Handling** — Missing/failed agents, duplicate model IDs, or no consensus after Round 5 → BLOCK; never reduce the expert count.
235
- 7. **Generate Output** — Consensus report + specification.yaml (design) or `.code-walkthrough-result.json` (walkthrough) + `delphi-reviewed.json`.
251
+ 2. **Round 1: Anonymous Independent Review** — Invoke architecture, technical, and feasibility independently without exposing their opinions to one another. Every successful result must use `result_type=delphi_expert_result`.
252
+ 3. **Execution Verification** — Verify that all three results succeeded and that their `requested_model` values are three distinct trimmed IDs, confirmed against the platform's execution record rather than expert self-report alone (OpenCode: the provider call log; Qoder: the `model` field of `model.request.started` events under `~/.qoder/logs/sessions/<project>/<sessionId>/segments/*.jsonl` — the `--model` argv in `~/.qoder/logs/runs/*/manifest.json` is the session model and proves nothing about subagents). A local fallback (`provider: local`) is not an executed expert and cannot satisfy this check; a local hosted endpoint configured as an ordinary callable provider can. Each expert record must also carry an explicit `channel` of either `external` or `local`; the value is a whitelist and a missing or unknown value fails the gate (it is never defaulted, since defaulting would let a forged record pass by simply omitting the field). Where the platform pins subagents to the session model (current Qoder Custom Agent dispatch, see the Qoder section below), the check cannot pass on built-in models at all and the external provider path is required.
253
+ 4. **Consensus Check** — Aggregate all three successful expert results. Consensus >=90% AND all APPROVED → complete. One expert result is never global approval.
254
+ 5. **Rounds 2-5: Exchange and Final Positions** — If needed, expose prior aggregate evidence, re-evaluate, and stop at the first approved consensus or after five rounds.
255
+ 6. **Failure Handling** — Any expert failure, missing result, duplicate model ID, or unverifiable execution blocks the review. Do not substitute a local fallback or silently reduce the expert count.
256
+ 7. **Generate Output** — Write the consensus report and mode-specific evidence only after aggregation. For code walkthrough, bind the exact-HEAD result after aggregation.
236
257
 
237
258
  ## Activation (MANDATORY for L1 Trigger Detection)
238
259
 
@@ -281,37 +302,11 @@ Each round MUST output a structured round marker:
281
302
  |------|------|------|------|
282
303
  | `design`(默认) | `/delphi-review` | 需求/设计/架构/PR 评审 | 共识报告 + specification.yaml |
283
304
  | `code-walkthrough` | `--mode code-walkthrough` | git push 前代码走查 | `.code-walkthrough-result.json` |
284
- | `requirements` | `--mode requirements` | Phase 2 R1 需求完整性评审 | `.sprint-state/phase-outputs/requirements-reviewed.json` |
305
+ | `requirements` | `--mode requirements` | Phase 2 THINK 阶段需求评审 | `.sprint-state/phase-outputs/requirements-reviewed.json` |
285
306
 
286
307
  **Code Walkthrough 模式**的完整规范 → 详见 `references/code-walkthrough.md`
287
308
 
288
- ### Requirements 模式(Qoder Custom Agents)
289
-
290
- 在 Phase 2 需求探索完成、设计审批前,并行运行 Qoder 的 architecture、technical、feasibility 三个 Custom Agent。Round 1 保持匿名;任一 Agent 未成功返回、任一裁决不是 `APPROVED`、三个 trimmed `requested_model` 不互异,或聚合 `consensus_ratio < 0.90` 时,R1 必须 BLOCK,不能减少专家数或使用仲裁结果代替。
291
-
292
- APPROVED 后读取 `git rev-parse HEAD` 的精确结果并写入 `.sprint-state/phase-outputs/requirements-reviewed.json`。无法解析 HEAD 时不得写 APPROVED 证据:
293
-
294
- ```json
295
- {
296
- "mode": "requirements",
297
- "verdict": "APPROVED",
298
- "timestamp": "2026-08-20T10:30:00Z",
299
- "requirements_statement": "<被评审的原始需求陈述>",
300
- "context_file_used": "CONTEXT.md | null",
301
- "requirements_hash": "<SHA-256 of requirements_statement + context exact UTF-8 content if used + timestamp YYYY-MM-DD>",
302
- "head_commit": "<exact git rev-parse HEAD>",
303
- "consensus_ratio": 0.90,
304
- "expert_verdicts": [
305
- { "role": "architecture", "verdict": "APPROVED", "result_type": "delphi_expert_result", "requested_model": "provider/model-a" },
306
- { "role": "technical", "verdict": "APPROVED", "result_type": "delphi_expert_result", "requested_model": "provider/model-b" },
307
- { "role": "feasibility", "verdict": "APPROVED", "result_type": "delphi_expert_result", "requested_model": "provider/model-c" }
308
- ]
309
- }
310
- ```
311
-
312
- Schema-v2 对 context 路径执行项目根目录 containment 与 realpath 检查,并在 Phase 2 transition 时重新计算 hash;生成 hash 为小写 hex,比较时大小写不敏感。
313
-
314
- `confidence` 可以由 Custom Agent 提供,但不是 R1 evidence contract 的必需字段。Phase 2 全部步骤完成、进入 Phase 3 前必须执行 `npx xp-gate phase-transition 2 completed`;schema-v2 Sprint 只有通过程序化校验才能继续。
309
+ **Requirements 模式**的完整规范 → 详见 `references/requirements.md`
315
310
 
316
311
  ---
317
312
 
@@ -321,37 +316,122 @@ Schema-v2 对 context 路径执行项目根目录 containment 与 realpath 检
321
316
 
322
317
  | 配置 | 专家 | 适用场景 |
323
318
  |------|------|---------|
324
- | 3 专家(强制) | A(架构) + B(实现) + C(可行性) | 所有评审模式 |
319
+ | 3 专家(固定) | A(架构) + B(实现) + C(可行性) | 所有评审模式 |
325
320
 
326
321
  ### 模型选择策略(强制 — 平台适配)
327
322
 
328
323
  **关键原则**:
329
- - ✅ 三个专家必须成功执行且使用 **三个 distinct trimmed model IDs**
330
- - ❌ 禁止 hardcode 模型名称
331
- - ✅ Provider、vendor、gateway 和模型国籍不受限制
332
- - ❌ `provider: local` fallback 不能计为成功执行
324
+ - ✅ 必须配置 architecture、technical、feasibility 三个专家角色
325
+ - ✅ 三个角色必须使用三个不同的 trimmed、可执行模型 ID
326
+ - ✅ 模型国籍、厂商、provider 和 gateway 不受限制
327
+ - ✅ 三个角色可以共享一个 provider 和 token 计划
328
+ - ❌ `provider: local` 的特殊 fallback 不能计为一次成功执行
329
+
330
+ #### Qoder 平台(Custom Agent 模式 — 只能做到同模型三角色)
331
+
332
+ Qoder 的内置模型**没有本地推理端点**:推理请求由 Qoder 客户端经服务端代理发出,凭证是一次性 job token。所以不能照搬 OpenCode 的 `base_url + api_key` 直连方式;Qoder 侧内置模型的唯一入口是 **Custom Agent** —— 每个专家一个独立 agent 文件,frontmatter 用 `model` 字段声明模型。
333
+
334
+ **契约结论(先说结论)**:这条路径**不满足**"三个不同可执行模型 ID"契约。2026-09-23 做过一次排除混杂因素的复测:先把 `~/.qoder/agents/delphi-*.md` 三份文件绑成三个不同的 0.1× 内置模型(`qfmodel` / `dfmodel` / `gfmodel`;架构角与会话模型同名,所以真正有判别力的是技术角与可行性角),**再**新开会话——新 CLI 进程,`session.config.loaded` 记录 `model: "qfmodel"`,注册表加载的必然是已修好的绑定——然后只派发三个 subagent,各回一句话、不调工具。结果:三个独立的 `is_subagent: true` turn,`turn.started` / `model.request.started` / `model.response.completed` 三处的 `model` 全为会话模型 `qfmodel`,`dfmodel` / `gfmodel` 出现 0 次;同时三份回复分别命中架构 / 技术 / 可行性视角,说明角色提示词确实生效、agent 也确实被加载。即 `subagent_type` 派发路径采纳 Custom Agent 的提示词,但**丢弃**它的 `model` 绑定。
335
+
336
+ 因此 Qoder 原生模式只能作为**同模型、三角色(persona)的自查**,其共识比例不能当作多模型交叉验证的证据,也不应用作 Gate MW 的三模型凭据。需要契约合规的 Delphi 时,按上面的外部 provider 方式配置 `.delphi-config.json`(Qoder 与 OpenCode 同用,条件是模型确有可调端点)。
333
337
 
334
- #### Qoder 平台(推荐 — Custom Agent 模式)
338
+ | 角色 | Agent 文件 | 绑定的 modelId | 实际执行模型 |
339
+ |------|-----------|---------------|-------------|
340
+ | Architecture (A) | `.qoder/agents/delphi-architecture.md` | `qfmodel` | 会话模型 |
341
+ | Technical (B) | `.qoder/agents/delphi-technical.md` | `gfmodel` | 会话模型 |
342
+ | Feasibility (C) | `.qoder/agents/delphi-feasibility.md` | `dfmodel` | 会话模型 |
335
343
 
336
- Qoder 环境下使用 **Custom Agent** 机制,每个专家是一个独立的 custom agent,配置不同的 Qoder 内置模型:
344
+ **安装位置**(`xp-gate init` 自动部署,已存在的文件不覆盖):
345
+ - 项目级:`<project>/.qoder/agents/`(`xp-gate init`)
346
+ - 用户级:`~/.qoder/agents/`(`xp-gate init --global`)
337
347
 
338
- | 专家 | Agent 文件 | 模型 | Credits 费率 |
339
- |------|-----------|------|-------------|
340
- | Architecture (A) | `.qoder/agents/delphi-architecture.md` | Qwen3.7-Max | 0.5× |
341
- | Technical (B) | `.qoder/agents/delphi-technical.md` | GLM-5.2 | 0.6× |
342
- | Feasibility (C) | `.qoder/agents/delphi-feasibility.md` | DeepSeek-V4-Pro | 0.5× |
348
+ **model 字段格式**:仍须写成 `"[DisplayName](modelId)"`。裸名字或已下线 ID 不会报错,会被平台静默忽略。`xp-gate init` 会审计已部署的 `delphi-*.md`,格式非法或 modelId 与本版本模板不一致时点名文件并给出"删除 → 重跑 `init` → 重启会话"提示;因为部署语义是"已存在不覆盖",从 #417 之前的版本升级必须手工删旧文件再重跑 `init`。注意:修好绑定也只是让角色声明规范,并不改变上表的执行模型结论。
343
349
 
344
- **执行方式**:通过 Agent tool 并行启动 3 个 subagent(type=GeneralPurpose),每个 agent 使用自己配置的模型独立评审,主 orchestrator 收集结果后计算共识。
350
+ **执行方式**:用 Agent tool 并行派发 3 个 subagent,`subagent_type` 分别取 `delphi-architecture`、`delphi-technical`、`delphi-feasibility`。**新建或修改 agent 文件后必须重开会话**——注册表只在会话启动时加载,否则报 `Unknown agent type`。
345
351
 
346
- **优势**:无需外部 API key,直接使用 Qoder Credits,模型由平台统一管理。
352
+ **客观验证(不要采信专家自述)**:`~/.qoder/logs/runs/*/manifest.json` 的 argv `--model` 记录的是**会话/进程启动模型**,对 subagent 没有判别力(历史上所有运行都是同一个 ID)。真正的证据在按会话分段的日志里:
353
+
354
+ ```bash
355
+ grep '"type":"model.request.started"' ~/.qoder/logs/sessions/<project>/<sessionId>/segments/*.jsonl \
356
+ | grep -oE '"model":"[^"]*"' | sort | uniq -c
357
+ ```
358
+
359
+ 同一文件里的 `turn.started`(`is_subagent:true`)与 `model.response.completed` 可交叉核对:前者证明三个角色各自起了独立 turn,后者带 `provider` 字段。两个坑:(1) 被验证的那个 modelId 必须**不等于会话模型**,否则该角色测不出判别力(会话模型通常是 `qfmodel`);(2) 改完 agent 文件必须**换新会话**再测,注册表只在会话启动时加载,用旧会话的数据下结论会被旧绑定污染。专家自述的 `requested_model` 只是在复述自己 frontmatter 里的声明,不构成证据。
360
+
361
+ **成本**:走这条路径不消耗外部 API key,只计 Qoder Credits。
347
362
 
348
363
  #### OpenCode 平台(External API 模式)
349
364
 
350
365
  OpenCode 环境下通过 `opencode.json` 的 agent 配置 + `.delphi-config.json` 调用外部 API:
351
366
  - **MUST 从 `opencode.json` 的 agent 配置中读取模型**
352
- - 通过 `scripts/delphi-external-review.cjs` 调用各 provider 的 OpenAI 兼容 API
367
+ - 通过 `scripts/delphi-external-review.cjs` 调用各 provider 的兼容 API(注意:该脚本目前在仓库根 `scripts/` 下,尚未随 skill 目录分发)
353
368
  - 需要用户自行配置 API key(环境变量注入)
354
369
 
370
+ #### DeepSeek Harness 平台(`delphi-review` 工具 — 推荐)
371
+
372
+ DSH 里**不要**用 `subagent` 工具派发三个专家。原因和 Qoder 同源:DSH 的 subagent
373
+ 继承宿主配置的**单一**模型(`SubagentModelSelectionConfig.enabled` 默认 `false`),
374
+ 三个"专家"会是同一模型的三个实例 —— 按本 skill 的规则必须 BLOCK。
375
+
376
+ DSH 的正确入口是插件提供的 **`delphi-review` 工具**(`@boyingliu01/dsh-plugin-xp-gate`):
377
+
378
+ ```
379
+ delphi-review(
380
+ subject: <待评审材料:diff / 设计 / 规格>,
381
+ addressed: <可选:上一轮之后改了什么,用于后续轮次>,
382
+ maxRounds: <可选:覆盖默认 5 轮>
383
+ )
384
+ ```
385
+
386
+ 该工具**直连外部 OpenAI 兼容网关**,每个席位绑定一个不同模型,因此不依赖宿主配置即可
387
+ 满足不变量。它复用**同一份** `.delphi-config.json`,无需额外配置。
388
+
389
+ **代码强制的不变量**(不是文档约定,违反即报错):
390
+
391
+ | 不变量 | 违反时 |
392
+ |---|---|
393
+ | 恰好 3 位专家 | `DelphiConfigError` |
394
+ | 3 个 `requested_model` 去空白后两两不同 | `DelphiConfigError` |
395
+ | 模型不得为未展开的 `${...}` 占位符 | `DelphiConfigError`(在**任何网络调用之前**) |
396
+ | 缺密钥 / 缺 provider / 专家跨网关 | `DelphiSetupError`,报变量名而非回显配置 |
397
+ | 报告缺 `### VERDICT` 段 | 记为 `INVALID_NO_VERDICT`,**不计入共识** |
398
+ | 退出码 0 但内容为空 | 记为 ERROR(推理模型可能把预算全烧在隐藏 token 上) |
399
+
400
+ **轮次语义与本 skill 一致**:Round 1 匿名且并发;Round 2+ 回传**汇总票型**与"已修改项",
401
+ 个体报告始终匿名。达到阈值即停,否则到 `max_review_rounds` 为止并如实返回 `NO CONSENSUS`。
402
+
403
+ **推理模型注意**:`g-glm-5.3-flash` 这类模型会先产出隐藏推理 token。
404
+ 实测 `max_tokens=4000` 时 `finish_reason=length` 且 **content 为空**;
405
+ 席位需独立预算(该席位配置为 32000)。工具把"空内容"记为 ERROR 而非空评审。
406
+
407
+ > 备选:若希望 DSH **原生** `subagent` 也能选模型,需同时满足
408
+ > (1) `dsh-tool-subagent` 的 `modelSelectionSettings: true`(仅能力开关),
409
+ > (2) 宿主设置 `SubagentModelSelectionConfig.enabled = true` 且 `allowedModels` ≥3 个不同模型。
410
+ > 该路线依赖宿主配置,CI / 一次性会话不可靠,故不作为默认路径。
411
+ #### WorkBuddy 平台(Expert 团队模式)
412
+
413
+ WorkBuddy 侧以 Team 型专家团(示例:`delphi-review-team`,安装在 `~/.workbuddy/plugins/marketplaces/my-experts/plugins/`,创建方式见 [docs/platform-workbuddy.md](../../docs/platform-workbuddy.md))承载评审,触发本技能后按此路由执行:
414
+
415
+ | 角色 | Agent ID | 绑定模型 | 倍率 |
416
+ |------|----------|---------|------|
417
+ | 主理人(衡定一,会话自身) | delphi-review-team-team-lead | 会话模型,固定用 `local-deepseek-v4-flash` | 零 credits |
418
+ | Architecture (A) | delphi-arch-reviewer | `deepseek-v4.1-flash` | x0.11 |
419
+ | Technical (B) | delphi-tech-reviewer | `glm-5.3-flash` | x0.06 |
420
+ | Feasibility (C) | delphi-feasibility-reviewer | `hy3` | x0.00(免费) |
421
+
422
+ **执行方式**:
423
+ - 主理人开场自检:会话模型不是 `local-deepseek-v4-flash` 时,先提醒用户切换再开始。
424
+ - 已启用专家团 → 按其团队机制 spawn 3 位成员;未启用 → 用 `Agent` 工具同一消息**并行** spawn 3 个 `general-purpose` 子代理,prompt = 对应专家 MD 全文人设(读专家团 `agents/` 目录)+ 匿名评审模板 + 待评审材料,`model` 参数按上表传。
425
+ - Round 1 三个子代理互不见对方输出(匿名铁律不变)。
426
+
427
+ **执行验证(适配本平台,2026-09-29 校准)**:
428
+ - 参数层路由 ✅ 已实测:`Agent` 工具 `model` 参数传 `deepseek-v4.1-flash` / `glm-5.3-flash` / `hy3` 三个 ID 均被接受,3 个 general-purpose 子代理并行执行成功。
429
+ - 执行层证据 ⚠️ 平台暂缺:WorkBuddy 审计日志(`~/.workbuddy/audit-log/`)只记 command-safety 事件,无 per-request 模型路由记录,无法像 Qoder/OpenCode 那样从日志取证 distinct models。
430
+ - **WorkBuddy 过渡验证标准**:参数级校准(model ID 被平台接受且子代理成功执行)+ 专家 `requested_model` 自述如实记录;报告中必须注明「执行层验证待平台日志支持」。若 `model` 参数被拒绝(报错/回落会话模型),按本技能 Failure Handling 处理,不得静默降级冒充三模型共识。
431
+ - 契约合规兜底:需要严格证据时,走外部 provider 路径(`.delphi-config.json` + 兼容 API,如 whalecloud 网关 3 个模型 ID)。
432
+
433
+ **成本**:3 专家合计 x0.17/轮;主理人选 local 会话模型则零 credits。
434
+
355
435
  ### 共识阈值
356
436
 
357
437
  | 阈值 | 说明 |
@@ -422,7 +502,7 @@ Phase 0: 准备 → Round 1: 匿名独立评审 → 共识检查
422
502
 
423
503
  ## Output Format (MANDATORY for L3)
424
504
 
425
- Every Delphi mode MUST use the full JSON schema below. Each of the three Qoder Custom Agents outputs independently and the orchestrator aggregates only after execution verification. There is no single-reviewer Delphi approval path.
505
+ Every Delphi mode MUST use the full JSON schema below. Architecture, technical, and feasibility each output independently; the orchestrator verifies all three executions before aggregating `consensus_report`. There is no single-reviewer Delphi approval path.
426
506
 
427
507
  ```json
428
508
  {
@@ -445,7 +525,31 @@ Every Delphi mode MUST use the full JSON schema below. Each of the three Qoder C
445
525
 
446
526
  **For code-walkthrough mode**, output follows `.code-walkthrough-result.json` schema (see `references/code-walkthrough.md`).
447
527
 
448
- **For requirements mode**, output follows the Requirements 模式 schema above and includes exact HEAD plus all three successful Custom Agent results.
528
+ **For requirements mode**, output follows `requirements-reviewed.json` schema (see `references/requirements.md`):
529
+
530
+ ```json
531
+ {
532
+ "mode": "requirements",
533
+ "verdict": "APPROVED|GAPS_FOUND",
534
+ "timestamp": "2026-07-25T10:30:00Z",
535
+ "consensus_ratio": 1.0,
536
+ "requirements_hash": "<SHA-256 hex digest>",
537
+ "head_commit": "<git rev-parse HEAD>",
538
+ "context_file_used": "CONTEXT.md",
539
+ "round": 1,
540
+ "expert_verdicts": [
541
+ { "role": "architecture", "verdict": "APPROVED", "confidence": 9, "result_type": "delphi_expert_result", "requested_model": "provider/model-a", "resolved_model": "provider/model-a", "channel": "external" },
542
+ { "role": "technical", "verdict": "APPROVED", "confidence": 8, "result_type": "delphi_expert_result", "requested_model": "provider/model-b", "resolved_model": "provider/model-b", "channel": "external" },
543
+ { "role": "feasibility", "verdict": "APPROVED", "confidence": 8, "result_type": "delphi_expert_result", "requested_model": "provider/model-c", "resolved_model": "provider/model-c", "channel": "external" }
544
+ ],
545
+ "requirements_statement": "<short summary of what was reviewed>",
546
+ "gaps_found": [],
547
+ "rounds_used": 1,
548
+ "escalation_needed": false
549
+ }
550
+ ```
551
+
552
+ Schema-v2 Phase 2 requires `requirements_statement`, `timestamp`, `consensus_ratio`, `expert_verdicts`, `head_commit`, and `requirements_hash`. The hash is SHA-256 of the exact concatenation `requirements_statement + project-relative context file UTF-8 content if used + timestamp YYYY-MM-DD`; context paths must remain inside the project after realpath resolution.
449
553
 
450
554
  **Anti-patterns mapping:**
451
555
  - `Round 1 → "评审完成"` → MUST NOT have `verdict: APPROVED` if `critical_issues` exist
@@ -457,7 +561,7 @@ Every Delphi mode MUST use the full JSON schema below. Each of the three Qoder C
457
561
  ## Terminal State Checklist
458
562
 
459
563
  - [ ] Phase 0 完成(文档验证 + 专家分配)
460
- - [ ] 已完成所需轮次(最多 5 轮,每轮三个 Custom Agent 均执行)
564
+ - [ ] 已完成所需轮次(最多 5 轮,每轮三位专家均执行)
461
565
  - [ ] 问题共识比例 >=90%
462
566
  - [ ] 所有 Critical Issues 已解决,Major Concerns 已处理
463
567
  - [ ] 最终裁决是 **APPROVED** 或 **APPROVED_WITH_MINOR**
@@ -493,14 +597,16 @@ Every Delphi mode MUST use the full JSON schema below. Each of the three Qoder C
493
597
  |---------|---------|
494
598
  | Round 1 未 APPROVED 就"评审完成" | 迭代直到 APPROVED,修复后重新评审 |
495
599
  | 只处理 Critical,忽略 Major | 零容忍:Critical/Major 全部必须处理 |
496
- | 单专家自评 | 三个 distinct executable models 全部成功执行 |
600
+ | 单专家自评 | 必须运行 architecture、technical、feasibility 三位专家,并聚合三份成功结果 |
497
601
  | 用户说"时间紧急"就跳过 | 评审是投资不是开销 |
498
602
  | "专家几乎一致"就通过 | "几乎" = 不一致,继续到 >=90% |
499
- | 按 provider 或模型国籍限制选择 | 仅强制三个 distinct trimmed model IDs |
500
- | `provider: local` fallback 计入 | fallback 不算成功执行证据 |
603
+ | 使用任何国籍或厂商的模型 | 模型国籍和厂商均不受限制,仍必须满足三个 distinct executable model IDs |
604
+ | 三个专家同一 provider | 允许共享 provider,只要三个 requested_model IDs distinct 且每个调用成功 |
501
605
 
502
606
  **Code-walkthrough 专属 Anti-Patterns** → 详见 `references/code-walkthrough.md`
503
607
 
608
+ **Requirements 专属 Anti-Patterns** → 详见 `references/requirements.md`
609
+
504
610
  ---
505
611
 
506
612
  ## Red Flags
@@ -510,7 +616,7 @@ Every Delphi mode MUST use the full JSON schema below. Each of the three Qoder C
510
616
  | 要求跳过评审 | "skip review", "不用评审", "跳过评审" | → 提醒评审是投资而非开销 |
511
617
  | 时间压力 | "来不及", "时间紧", "emergency" | → 提醒时间紧迫正是需要评审的时刻 |
512
618
  | 提前终止 | Round 1 后用户说 "可以了", "够了" | → BLOCK: 评审未达终止条件 |
513
- | 单专家自评 | 用户仅指定 1 个专家 | → BLOCK:必须执行 architecture、technical、feasibility 三个 Custom Agent |
619
+ | 单专家自评 | 用户仅指定 1 个专家 | → BLOCK:Delphi 必须执行 architecture、technical、feasibility 三位专家 |
514
620
  | 无文档输入 | 仅触发词,无设计/代码内容 | → `[DelphiReview:BLOCKED]` |
515
621
 
516
622
  ---
@@ -532,5 +638,6 @@ Every Delphi mode MUST use the full JSON schema below. Each of the three Qoder C
532
638
  | File | Content |
533
639
  |------|---------|
534
640
  | `@references/code-walkthrough.md` | Code-walkthrough mode specification |
641
+ | `@references/requirements.md` | Requirements mode specification |
535
642
  | `@references/orchestrator-dispatch.md` | Orchestrator auto-dispatch rules (#218 subagent multi-round loop) |
536
643
  | `@references/round-templates.md` | Round templates (anonymous/exchange/final/fix report formats) |