@boyingliu01/xp-gate 0.19.2 → 0.19.3

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 (78) hide show
  1. package/hooks/pre-commit +24 -5
  2. package/lib/mattpocock-license-verdict.json +1 -1
  3. package/mock-policy/AGENTS.md +3 -3
  4. package/mutation/AGENTS.md +3 -3
  5. package/package.json +1 -1
  6. package/plugins/claude-code/.claude-plugin/plugin.json +2 -2
  7. package/plugins/claude-code/skills/delphi-review/AGENTS.md +3 -3
  8. package/plugins/claude-code/skills/sprint-flow/AGENTS.md +3 -3
  9. package/plugins/claude-code/skills/test-specification-alignment/AGENTS.md +3 -3
  10. package/plugins/dsh/package.json +1 -1
  11. package/plugins/dsh/skills/delphi-review/AGENTS.md +3 -3
  12. package/plugins/dsh/skills/sprint-flow/AGENTS.md +3 -3
  13. package/plugins/dsh/skills/test-specification-alignment/AGENTS.md +3 -3
  14. package/plugins/opencode/package.json +1 -1
  15. package/plugins/opencode/skills/delphi-review/AGENTS.md +3 -3
  16. package/plugins/opencode/skills/sprint-flow/AGENTS.md +3 -3
  17. package/plugins/opencode/skills/test-specification-alignment/AGENTS.md +3 -3
  18. package/plugins/qoder/plugin.json +2 -2
  19. package/plugins/qoder/skills/admin-template-guidelines/SKILL.md +6 -797
  20. package/plugins/qoder/skills/admin-template-guidelines/references/rule-1.md +91 -0
  21. package/plugins/qoder/skills/admin-template-guidelines/references/rule-2.md +155 -0
  22. package/plugins/qoder/skills/admin-template-guidelines/references/rule-3.md +70 -0
  23. package/plugins/qoder/skills/admin-template-guidelines/references/rule-4.md +154 -0
  24. package/plugins/qoder/skills/admin-template-guidelines/references/rule-5.md +126 -0
  25. package/plugins/qoder/skills/admin-template-guidelines/references/rule-6.md +180 -0
  26. package/plugins/qoder/skills/batch-grill-me/SKILL.md +15 -0
  27. package/plugins/qoder/skills/clipboard-vision/describe-clipboard.ps1 +115 -0
  28. package/plugins/qoder/skills/clipboard-vision/describe-clipboard.sh +161 -0
  29. package/plugins/qoder/skills/delphi-review/.delphi-config.json.example +61 -28
  30. package/plugins/qoder/skills/delphi-review/AGENTS.md +3 -3
  31. package/plugins/qoder/skills/delphi-review/INSTALL.md +97 -98
  32. package/plugins/qoder/skills/delphi-review/SKILL.md +77 -54
  33. package/plugins/qoder/skills/delphi-review/hooks.md +19 -0
  34. package/plugins/qoder/skills/delphi-review/opencode.json.delphi.example +6 -10
  35. package/plugins/qoder/skills/delphi-review/references/orchestrator-dispatch.md +64 -0
  36. package/plugins/qoder/skills/delphi-review/references/requirements.md +402 -0
  37. package/plugins/qoder/skills/delphi-review/references/round-templates.md +134 -0
  38. package/plugins/qoder/skills/delphi-review/scripts/verify-consensus.sh +43 -0
  39. package/plugins/qoder/skills/delphi-review/tools.md +29 -0
  40. package/plugins/qoder/skills/domain-modeling/ADR-FORMAT.md +64 -0
  41. package/plugins/qoder/skills/domain-modeling/CONTEXT-FORMAT.md +60 -0
  42. package/plugins/qoder/skills/domain-modeling/SKILL.md +74 -0
  43. package/plugins/qoder/skills/grill-with-docs/SKILL.md +7 -0
  44. package/plugins/qoder/skills/grilling/SKILL.md +12 -0
  45. package/plugins/qoder/skills/ralph-loop/SKILL.md +87 -428
  46. package/plugins/qoder/skills/ralph-loop/references/components.md +113 -0
  47. package/plugins/qoder/skills/ralph-loop/references/workflow-details.md +99 -0
  48. package/plugins/qoder/skills/sprint-flow/AGENTS.md +4 -4
  49. package/plugins/qoder/skills/sprint-flow/SKILL.md +255 -454
  50. package/plugins/qoder/skills/sprint-flow/__tests__/sprint-flow.test.cjs +457 -0
  51. package/plugins/qoder/skills/sprint-flow/hooks.md +18 -0
  52. package/plugins/qoder/skills/sprint-flow/references/components/memory.md +1 -1
  53. package/plugins/qoder/skills/sprint-flow/references/components/middleware.md +1 -1
  54. package/plugins/qoder/skills/sprint-flow/references/components/skill-invocations.md +21 -20
  55. package/plugins/qoder/skills/sprint-flow/references/components/tool-descriptions.md +22 -23
  56. package/plugins/qoder/skills/sprint-flow/references/force-levels.md +0 -1
  57. package/plugins/qoder/skills/sprint-flow/references/orchestration-rules.md +34 -27
  58. package/plugins/qoder/skills/sprint-flow/references/phase-1-prep.md +1 -1
  59. package/plugins/qoder/skills/sprint-flow/references/phase-2-design.md +157 -120
  60. package/plugins/qoder/skills/sprint-flow/references/phase-3-build.md +203 -2
  61. package/plugins/qoder/skills/sprint-flow/references/phase-4-verify.md +107 -34
  62. package/plugins/qoder/skills/sprint-flow/references/phase-5-ship.md +194 -12
  63. package/plugins/qoder/skills/sprint-flow/references/phase-6-close.md +139 -7
  64. package/plugins/qoder/skills/sprint-flow/references/phase-overview.md +486 -0
  65. package/plugins/qoder/skills/sprint-flow/scripts/verify-sprint-state.sh +38 -0
  66. package/plugins/qoder/skills/sprint-flow/tools.md +29 -0
  67. package/plugins/qoder/skills/test-specification-alignment/AGENTS.md +3 -3
  68. package/plugins/qoder/skills/test-specification-alignment/SKILL.md +104 -601
  69. package/plugins/qoder/skills/to-issues/SKILL.md +1 -1
  70. package/principles/AGENTS.md +3 -3
  71. package/skills/delphi-review/AGENTS.md +3 -3
  72. package/skills/sprint-flow/AGENTS.md +3 -3
  73. package/skills/test-specification-alignment/AGENTS.md +3 -3
  74. package/plugins/qoder/skills/ralph-loop/references/components/memory.md +0 -55
  75. package/plugins/qoder/skills/ralph-loop/references/components/middleware.md +0 -54
  76. package/plugins/qoder/skills/ralph-loop/references/components/skill-invocations.md +0 -39
  77. package/plugins/qoder/skills/ralph-loop/references/components/system-prompt.md +0 -24
  78. 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. 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.
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,15 +316,16 @@ 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 不能计为一次成功执行
333
329
 
334
330
  #### Qoder 平台(推荐 — Custom Agent 模式)
335
331
 
@@ -349,7 +345,7 @@ Qoder 环境下使用 **Custom Agent** 机制,每个专家是一个独立的 c
349
345
 
350
346
  OpenCode 环境下通过 `opencode.json` 的 agent 配置 + `.delphi-config.json` 调用外部 API:
351
347
  - **MUST 从 `opencode.json` 的 agent 配置中读取模型**
352
- - 通过 `scripts/delphi-external-review.cjs` 调用各 provider 的 OpenAI 兼容 API
348
+ - 通过 `scripts/delphi-external-review.cjs` 调用各 provider 的兼容 API
353
349
  - 需要用户自行配置 API key(环境变量注入)
354
350
 
355
351
  ### 共识阈值
@@ -422,7 +418,7 @@ Phase 0: 准备 → Round 1: 匿名独立评审 → 共识检查
422
418
 
423
419
  ## Output Format (MANDATORY for L3)
424
420
 
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.
421
+ 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
422
 
427
423
  ```json
428
424
  {
@@ -445,7 +441,31 @@ Every Delphi mode MUST use the full JSON schema below. Each of the three Qoder C
445
441
 
446
442
  **For code-walkthrough mode**, output follows `.code-walkthrough-result.json` schema (see `references/code-walkthrough.md`).
447
443
 
448
- **For requirements mode**, output follows the Requirements 模式 schema above and includes exact HEAD plus all three successful Custom Agent results.
444
+ **For requirements mode**, output follows `requirements-reviewed.json` schema (see `references/requirements.md`):
445
+
446
+ ```json
447
+ {
448
+ "mode": "requirements",
449
+ "verdict": "APPROVED|GAPS_FOUND",
450
+ "timestamp": "2026-07-25T10:30:00Z",
451
+ "consensus_ratio": 1.0,
452
+ "requirements_hash": "<SHA-256 hex digest>",
453
+ "head_commit": "<git rev-parse HEAD>",
454
+ "context_file_used": "CONTEXT.md",
455
+ "round": 1,
456
+ "expert_verdicts": [
457
+ { "role": "architecture", "verdict": "APPROVED", "confidence": 9, "result_type": "delphi_expert_result", "requested_model": "provider/model-a" },
458
+ { "role": "technical", "verdict": "APPROVED", "confidence": 8, "result_type": "delphi_expert_result", "requested_model": "provider/model-b" },
459
+ { "role": "feasibility", "verdict": "APPROVED", "confidence": 8, "result_type": "delphi_expert_result", "requested_model": "provider/model-c" }
460
+ ],
461
+ "requirements_statement": "<short summary of what was reviewed>",
462
+ "gaps_found": [],
463
+ "rounds_used": 1,
464
+ "escalation_needed": false
465
+ }
466
+ ```
467
+
468
+ 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
469
 
450
470
  **Anti-patterns mapping:**
451
471
  - `Round 1 → "评审完成"` → MUST NOT have `verdict: APPROVED` if `critical_issues` exist
@@ -457,7 +477,7 @@ Every Delphi mode MUST use the full JSON schema below. Each of the three Qoder C
457
477
  ## Terminal State Checklist
458
478
 
459
479
  - [ ] Phase 0 完成(文档验证 + 专家分配)
460
- - [ ] 已完成所需轮次(最多 5 轮,每轮三个 Custom Agent 均执行)
480
+ - [ ] 已完成所需轮次(最多 5 轮,每轮三位专家均执行)
461
481
  - [ ] 问题共识比例 >=90%
462
482
  - [ ] 所有 Critical Issues 已解决,Major Concerns 已处理
463
483
  - [ ] 最终裁决是 **APPROVED** 或 **APPROVED_WITH_MINOR**
@@ -493,14 +513,16 @@ Every Delphi mode MUST use the full JSON schema below. Each of the three Qoder C
493
513
  |---------|---------|
494
514
  | Round 1 未 APPROVED 就"评审完成" | 迭代直到 APPROVED,修复后重新评审 |
495
515
  | 只处理 Critical,忽略 Major | 零容忍:Critical/Major 全部必须处理 |
496
- | 单专家自评 | 三个 distinct executable models 全部成功执行 |
516
+ | 单专家自评 | 必须运行 architecture、technical、feasibility 三位专家,并聚合三份成功结果 |
497
517
  | 用户说"时间紧急"就跳过 | 评审是投资不是开销 |
498
518
  | "专家几乎一致"就通过 | "几乎" = 不一致,继续到 >=90% |
499
- | 按 provider 或模型国籍限制选择 | 仅强制三个 distinct trimmed model IDs |
500
- | `provider: local` fallback 计入 | fallback 不算成功执行证据 |
519
+ | 使用任何国籍或厂商的模型 | 模型国籍和厂商均不受限制,仍必须满足三个 distinct executable model IDs |
520
+ | 三个专家同一 provider | 允许共享 provider,只要三个 requested_model IDs distinct 且每个调用成功 |
501
521
 
502
522
  **Code-walkthrough 专属 Anti-Patterns** → 详见 `references/code-walkthrough.md`
503
523
 
524
+ **Requirements 专属 Anti-Patterns** → 详见 `references/requirements.md`
525
+
504
526
  ---
505
527
 
506
528
  ## Red Flags
@@ -510,7 +532,7 @@ Every Delphi mode MUST use the full JSON schema below. Each of the three Qoder C
510
532
  | 要求跳过评审 | "skip review", "不用评审", "跳过评审" | → 提醒评审是投资而非开销 |
511
533
  | 时间压力 | "来不及", "时间紧", "emergency" | → 提醒时间紧迫正是需要评审的时刻 |
512
534
  | 提前终止 | Round 1 后用户说 "可以了", "够了" | → BLOCK: 评审未达终止条件 |
513
- | 单专家自评 | 用户仅指定 1 个专家 | → BLOCK:必须执行 architecture、technical、feasibility 三个 Custom Agent |
535
+ | 单专家自评 | 用户仅指定 1 个专家 | → BLOCK:Delphi 必须执行 architecture、technical、feasibility 三位专家 |
514
536
  | 无文档输入 | 仅触发词,无设计/代码内容 | → `[DelphiReview:BLOCKED]` |
515
537
 
516
538
  ---
@@ -532,5 +554,6 @@ Every Delphi mode MUST use the full JSON schema below. Each of the three Qoder C
532
554
  | File | Content |
533
555
  |------|---------|
534
556
  | `@references/code-walkthrough.md` | Code-walkthrough mode specification |
557
+ | `@references/requirements.md` | Requirements mode specification |
535
558
  | `@references/orchestrator-dispatch.md` | Orchestrator auto-dispatch rules (#218 subagent multi-round loop) |
536
559
  | `@references/round-templates.md` | Round templates (anonymous/exchange/final/fix report formats) |
@@ -0,0 +1,19 @@
1
+ # Hooks — Delphi Review
2
+
3
+ Delphi Review integrates with safety and operational hooks to ensure review integrity
4
+ and context preservation.
5
+
6
+ ## Security Hooks
7
+
8
+ | Hook | Purpose | Activation |
9
+ |------|---------|------------|
10
+ | `/careful` | Safety guardrails for destructive commands | Ensure review is read-only — block any destructive operations |
11
+ | `/freeze` | Restrict edits to review scope | Prevent accidental changes during review |
12
+ | `/guard` | Full safety mode (careful + freeze) | Maximum protection — read-only review with no accidental edits |
13
+
14
+ ## Operational Hooks
15
+
16
+ | Hook | Purpose | Activation |
17
+ |------|---------|------------|
18
+ | `/context-save` | Save review context before pause or handoff | Before pausing review or switching tasks |
19
+ | `/context-restore` | Restore review context on resume | When resuming review from pause or handoff |
@@ -3,23 +3,19 @@
3
3
  "Delphi Review Agent Configuration Template",
4
4
  "===========================================",
5
5
  "Copy the relevant 'agent' block below into your opencode.json.",
6
- "Replace YOUR_PROVIDER/YOUR_MODEL with your actual provider and model names.",
7
- "All 3 agents must use distinct trimmed executable model IDs; providers may be shared."
6
+ "Replace the example model IDs with three callable IDs available through your configured provider.",
7
+ "The three model fields must be different after trimming; providers may be shared."
8
8
  ],
9
9
 
10
10
  "$example_providers": {
11
- "OpenAI": "openai/gpt-4o",
12
- "Anthropic": "anthropic/claude-sonnet-4-20250514",
13
- "Ali_Bailian": "bailian-coding-plan/qwen3.6-plus",
14
- "Google_Gemini": "google/gemini-2.5-pro",
15
- "DeepSeek": "deepseek/deepseek-chat"
11
+ "SharedProviderExample": "bailian-tp/qwen-plus"
16
12
  },
17
13
 
18
14
  "agent": {
19
15
  "delphi-reviewer-architecture": {
20
16
  "description": "Delphi expert reviewer for architecture perspective. Focuses on requirements alignment, system design, and high-level coherence.",
21
17
  "mode": "subagent",
22
- "model": "YOUR_PROVIDER/YOUR_MODEL_A",
18
+ "model": "bailian-tp/qwen-plus",
23
19
  "prompt": "You are a Delphi expert reviewer specializing in architecture and requirements alignment. Review the input for: 1) Alignment with stated goals 2) Architectural coherence 3) System-level implications 4) Trade-offs and alternatives. Output structured review with verdict (APPROVED/REQUEST_CHANGES/REJECTED) and confidence level.",
24
20
  "tools": {
25
21
  "read": true,
@@ -31,7 +27,7 @@
31
27
  "delphi-reviewer-technical": {
32
28
  "description": "Delphi expert reviewer for technical depth. Focuses on implementation details, code correctness, and edge cases. Used in delphi-review.",
33
29
  "mode": "subagent",
34
- "model": "YOUR_PROVIDER/YOUR_MODEL_B",
30
+ "model": "bailian-tp/deepseek-v3",
35
31
  "prompt": "You are a Delphi expert reviewer specializing in technical implementation. Review the input for: 1) Implementation correctness 2) Code quality and patterns 3) Edge cases and error handling 4) Performance implications. Output structured review with verdict (APPROVED/REQUEST_CHANGES/REJECTED) and confidence level.",
36
32
  "tools": {
37
33
  "read": true,
@@ -43,7 +39,7 @@
43
39
  "delphi-reviewer-feasibility": {
44
40
  "description": "Delphi expert reviewer for feasibility analysis. Focuses on practical constraints, risks, and execution viability. Used in delphi-review.",
45
41
  "mode": "subagent",
46
- "model": "YOUR_PROVIDER/YOUR_MODEL_C",
42
+ "model": "bailian-tp/glm-4.5",
47
43
  "prompt": "You are a Delphi expert reviewer specializing in feasibility and risk analysis. Review the input for: 1) Practical constraints (time, resources, dependencies) 2) Risk identification and mitigation 3) Execution complexity 4) Alternative approaches. Output structured review with verdict (APPROVED/REQUEST_CHANGES/REJECTED) and confidence level.",
48
44
  "tools": {
49
45
  "read": true,