@in-the-loop-labs/pair-review 5.2.2 → 5.3.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 (48) hide show
  1. package/README.md +26 -16
  2. package/package.json +1 -1
  3. package/plugin/.claude-plugin/plugin.json +1 -1
  4. package/plugin-code-critic/.claude-plugin/plugin.json +1 -1
  5. package/plugin-code-critic/skills/analyze/references/level1-thorough.md +52 -121
  6. package/plugin-code-critic/skills/analyze/references/level2-thorough.md +49 -113
  7. package/plugin-code-critic/skills/analyze/references/level3-thorough.md +46 -195
  8. package/plugin-code-critic/skills/analyze/references/orchestration-thorough.md +56 -112
  9. package/plugin-pair-loop/.claude-plugin/plugin.json +1 -1
  10. package/public/css/analysis-config.css +29 -0
  11. package/public/css/pr.css +208 -0
  12. package/public/js/components/AIPanel.js +14 -9
  13. package/public/js/components/ChatPanel.js +790 -54
  14. package/public/js/components/ConfirmDialog.js +70 -2
  15. package/public/js/modules/pierre-bridge.js +58 -97
  16. package/public/js/modules/suggestion-manager.js +9 -121
  17. package/public/js/pr.js +15 -28
  18. package/public/js/utils/scroll-into-view.js +18 -4
  19. package/src/ai/analyzer.js +31 -6
  20. package/src/ai/antigravity-provider.js +62 -42
  21. package/src/ai/claude-provider.js +18 -20
  22. package/src/ai/codex-provider.js +76 -81
  23. package/src/ai/executable-provider.js +3 -1
  24. package/src/ai/index.js +2 -0
  25. package/src/ai/muse-provider.js +84 -52
  26. package/src/ai/omp-provider.js +27 -12
  27. package/src/ai/pi-provider.js +12 -6
  28. package/src/ai/prompts/baseline/consolidation/thorough.js +56 -43
  29. package/src/ai/prompts/baseline/level1/thorough.js +76 -138
  30. package/src/ai/prompts/baseline/level2/thorough.js +76 -129
  31. package/src/ai/prompts/baseline/level3/thorough.js +67 -212
  32. package/src/ai/prompts/baseline/orchestration/thorough.js +79 -130
  33. package/src/ai/prompts/render-for-skill.js +5 -0
  34. package/src/ai/prompts/shared/adversarial-verification.js +68 -0
  35. package/src/ai/provider.js +61 -2
  36. package/src/ai/stream-parser.js +22 -1
  37. package/src/chat/acp-bridge.js +11 -0
  38. package/src/chat/chat-models.js +348 -0
  39. package/src/chat/chat-providers.js +17 -0
  40. package/src/chat/claude-code-bridge.js +9 -0
  41. package/src/chat/codex-bridge.js +6 -1
  42. package/src/chat/omp-bridge.js +5 -0
  43. package/src/chat/pi-bridge.js +20 -5
  44. package/src/chat/session-manager.js +158 -63
  45. package/src/config.js +1 -1
  46. package/src/hooks/payloads.js +5 -1
  47. package/src/main.js +1 -1
  48. package/src/routes/chat.js +83 -11
@@ -10,7 +10,7 @@ const path = require('path');
10
10
  const os = require('os');
11
11
  const fs = require('fs');
12
12
  const { spawn } = require('child_process');
13
- const { AIProvider, registerProvider, quoteShellArgs } = require('./provider');
13
+ const { AIProvider, registerProvider, quoteShellArgs, resolveCliModelConfig } = require('./provider');
14
14
  const logger = require('../utils/logger');
15
15
  const { extractJSON } = require('../utils/json-extractor');
16
16
  const { CancellationError, isAnalysisCancelled } = require('../routes/shared');
@@ -153,25 +153,41 @@ function attemptIdOf(record) {
153
153
  * The provider's default model.
154
154
  *
155
155
  * DELIBERATE: this is the NON-contributor model, even though the muse CLI's own
156
- * default is `muse-spark-1.2-contributor`. Pair-review sends potentially
156
+ * default is `muse-spark-1.3-contributor`. Pair-review sends potentially
157
157
  * proprietary source code to the model, and the contributor tier is discounted
158
158
  * precisely because Meta may use that content for product improvement. Opting
159
159
  * into data sharing must be an explicit user choice, never a silent default.
160
160
  */
161
- const DEFAULT_MUSE_MODEL = 'muse-spark-1.2-high';
161
+ const DEFAULT_MUSE_MODEL = 'muse-spark-1.3-high';
162
162
 
163
163
  /**
164
164
  * Muse model definitions with tier mappings.
165
165
  *
166
- * Muse exposes exactly two real CLI model IDs; everything below is a
167
- * reasoning-effort variant over those two, using the same `cli_model` +
166
+ * Muse exposes two real CLI model IDs per generation; everything below is a
167
+ * reasoning-effort variant over the current pair, using the same `cli_model` +
168
168
  * `extra_args` pattern as the Codex provider:
169
- * - muse-spark-1.2 — $1.25/$4.25 per MTok, ~1M context, 256k max output
170
- * - muse-spark-1.2-contributor — $0.10/$0.20 per MTok, discounted because
171
- * submitted content may be used by Meta for product improvement
169
+ * - muse-spark-1.3 — $1.25/$4.25 per MTok ($0.15 cached), ~1M context
170
+ * - muse-spark-1.3-contributor — $0.10/$0.20 per MTok ($0.002 cached), discounted
171
+ * because submitted content may be used by Meta for product improvement
172
172
  *
173
- * `--reasoning-effort` accepts none|minimal|low|medium|high|xhigh|ultra
174
- * (muse's own default is `high`).
173
+ * Muse Spark 1.3 (released 2026-09-02) is priced identically to 1.2 and is
174
+ * strictly better (Meta reports ~20% fewer tool calls and ~25% fewer tokens;
175
+ * DeepSWE v1.1 75.4 vs 55.0, Terminal-Bench 2.1 88.8 vs 82.9). The 1.2 ids still
176
+ * work on the CLI and are not deprecated, but there is no reason to offer both
177
+ * generations at the same price, so every `muse-spark-1.2-*` id is kept as an
178
+ * alias of its 1.3 twin at the same reasoning effort. Saved councils and configs
179
+ * upgrade in place instead of falling through to muse's own default.
180
+ *
181
+ * Do NOT treat the locally cached catalog (~/.local/share/muse/model-catalog/)
182
+ * as authoritative: it lags the CLI and still listed only 1.2 after 1.3 worked.
183
+ *
184
+ * `--reasoning-effort` accepts minimal|low|medium|high|xhigh|max|ultra with
185
+ * `--provider meta` (`none` is rejected outright; muse's own default is `high`).
186
+ * `ultra` is behind a closed feature gate: muse prints "reasoning effort ultra
187
+ * is not available (gate ultra_reasoning_effort is closed); using xhigh" and
188
+ * silently runs at xhigh, whereas `max` actually runs. The top built-in is
189
+ * therefore `max`, and the former `-ultra` ids alias onto it rather than
190
+ * shipping a duplicate of the xhigh entries.
175
191
  *
176
192
  * Ordering matters: each reasoning effort is listed as a non-contributor entry
177
193
  * followed by its contributor twin, so that getFastTierModel() — which picks the
@@ -180,32 +196,37 @@ const DEFAULT_MUSE_MODEL = 'muse-spark-1.2-high';
180
196
  */
181
197
  const MUSE_MODELS = [
182
198
  {
183
- id: 'muse-spark-1.2-ultra',
184
- cli_model: 'muse-spark-1.2',
185
- extra_args: ['--reasoning-effort', 'ultra'],
186
- name: 'Muse Spark 1.2 Ultra',
199
+ id: 'muse-spark-1.3-max',
200
+ // `-ultra` ids resolve here because ultra is gate-closed and degrades to
201
+ // xhigh; 1.2 ids resolve here because 1.3 is a same-price upgrade.
202
+ aliases: ['muse-spark-1.3-ultra', 'muse-spark-1.2-max', 'muse-spark-1.2-ultra'],
203
+ cli_model: 'muse-spark-1.3',
204
+ extra_args: ['--reasoning-effort', 'max'],
205
+ name: 'Muse Spark 1.3 Max',
187
206
  tier: 'thorough',
188
207
  tagline: 'Maximum Depth',
189
- description: 'Muse Spark at the highest reasoning effort for the hardest reviews: architecture, concurrency, and security-sensitive changes.',
208
+ description: 'Muse Spark at the highest available reasoning effort for the hardest reviews: architecture, concurrency, and security-sensitive changes.',
190
209
  badge: 'Max Reasoning',
191
210
  badgeClass: 'badge-power'
192
211
  },
193
212
  {
194
- id: 'muse-spark-1.2-contributor-ultra',
195
- cli_model: 'muse-spark-1.2-contributor',
196
- extra_args: ['--reasoning-effort', 'ultra'],
197
- name: 'Muse Spark 1.2 Contributor Ultra',
213
+ id: 'muse-spark-1.3-contributor-max',
214
+ aliases: ['muse-spark-1.3-contributor-ultra', 'muse-spark-1.2-contributor-max', 'muse-spark-1.2-contributor-ultra'],
215
+ cli_model: 'muse-spark-1.3-contributor',
216
+ extra_args: ['--reasoning-effort', 'max'],
217
+ name: 'Muse Spark 1.3 Contributor Max',
198
218
  tier: 'thorough',
199
219
  tagline: 'Discounted Depth',
200
- description: 'Same model and highest reasoning effort at roughly a tenth of the cost. Content you send on this tier may be used by Meta for product improvement—do not select it for proprietary code.',
220
+ description: 'Same model and highest available reasoning effort at roughly a tenth of the cost. Content you send on this tier may be used by Meta for product improvement—do not select it for proprietary code.',
201
221
  badge: 'Shares Data',
202
222
  badgeClass: 'badge-power'
203
223
  },
204
224
  {
205
- id: 'muse-spark-1.2-xhigh',
206
- cli_model: 'muse-spark-1.2',
225
+ id: 'muse-spark-1.3-xhigh',
226
+ aliases: ['muse-spark-1.2-xhigh'],
227
+ cli_model: 'muse-spark-1.3',
207
228
  extra_args: ['--reasoning-effort', 'xhigh'],
208
- name: 'Muse Spark 1.2 XHigh',
229
+ name: 'Muse Spark 1.3 XHigh',
209
230
  tier: 'thorough',
210
231
  tagline: 'Frontier Depth',
211
232
  description: 'Muse Spark with extra-high reasoning effort for difficult architectural reviews and subtle behavioral regressions.',
@@ -213,10 +234,11 @@ const MUSE_MODELS = [
213
234
  badgeClass: 'badge-power'
214
235
  },
215
236
  {
216
- id: 'muse-spark-1.2-contributor-xhigh',
217
- cli_model: 'muse-spark-1.2-contributor',
237
+ id: 'muse-spark-1.3-contributor-xhigh',
238
+ aliases: ['muse-spark-1.2-contributor-xhigh'],
239
+ cli_model: 'muse-spark-1.3-contributor',
218
240
  extra_args: ['--reasoning-effort', 'xhigh'],
219
- name: 'Muse Spark 1.2 Contributor XHigh',
241
+ name: 'Muse Spark 1.3 Contributor XHigh',
220
242
  tier: 'thorough',
221
243
  tagline: 'Discounted Frontier',
222
244
  description: 'Same model and extra-high reasoning effort at roughly a tenth of the cost. Content you send on this tier may be used by Meta for product improvement—do not select it for proprietary code.',
@@ -224,12 +246,13 @@ const MUSE_MODELS = [
224
246
  badgeClass: 'badge-power'
225
247
  },
226
248
  {
227
- id: 'muse-spark-1.2-high',
228
- // Aliases keep results/councils saved under a bare model ID resolving here.
229
- aliases: ['muse-spark-1.2', 'muse-spark'],
230
- cli_model: 'muse-spark-1.2',
249
+ id: 'muse-spark-1.3-high',
250
+ // Bare model ids (and the previous generation's) keep results/councils
251
+ // saved under them resolving here.
252
+ aliases: ['muse-spark-1.3', 'muse-spark', 'muse-spark-1.2', 'muse-spark-1.2-high'],
253
+ cli_model: 'muse-spark-1.3',
231
254
  extra_args: ['--reasoning-effort', 'high'],
232
- name: 'Muse Spark 1.2 High',
255
+ name: 'Muse Spark 1.3 High',
233
256
  tier: 'balanced',
234
257
  tagline: 'Best Balance',
235
258
  description: 'Meta\'s coding model with high reasoning effort and roughly 1M tokens of context—strong everyday PR review across large diffs.',
@@ -238,11 +261,11 @@ const MUSE_MODELS = [
238
261
  default: true
239
262
  },
240
263
  {
241
- id: 'muse-spark-1.2-contributor-high',
242
- aliases: ['muse-spark-1.2-contributor'],
243
- cli_model: 'muse-spark-1.2-contributor',
264
+ id: 'muse-spark-1.3-contributor-high',
265
+ aliases: ['muse-spark-1.3-contributor', 'muse-spark-1.2-contributor', 'muse-spark-1.2-contributor-high'],
266
+ cli_model: 'muse-spark-1.3-contributor',
244
267
  extra_args: ['--reasoning-effort', 'high'],
245
- name: 'Muse Spark 1.2 Contributor High',
268
+ name: 'Muse Spark 1.3 Contributor High',
246
269
  tier: 'balanced',
247
270
  tagline: 'Discounted Tier',
248
271
  description: 'Same model and high reasoning effort at roughly a tenth of the cost. Content you send on this tier may be used by Meta for product improvement—do not select it for proprietary code.',
@@ -250,10 +273,11 @@ const MUSE_MODELS = [
250
273
  badgeClass: 'badge-balanced'
251
274
  },
252
275
  {
253
- id: 'muse-spark-1.2-low',
254
- cli_model: 'muse-spark-1.2',
276
+ id: 'muse-spark-1.3-low',
277
+ aliases: ['muse-spark-1.2-low'],
278
+ cli_model: 'muse-spark-1.3',
255
279
  extra_args: ['--reasoning-effort', 'low'],
256
- name: 'Muse Spark 1.2 Low',
280
+ name: 'Muse Spark 1.3 Low',
257
281
  tier: 'fast',
258
282
  tagline: 'Quick Pass',
259
283
  description: 'Muse Spark with low reasoning effort for fast surface scans of small, straightforward changes.',
@@ -261,10 +285,11 @@ const MUSE_MODELS = [
261
285
  badgeClass: 'badge-speed'
262
286
  },
263
287
  {
264
- id: 'muse-spark-1.2-contributor-low',
265
- cli_model: 'muse-spark-1.2-contributor',
288
+ id: 'muse-spark-1.3-contributor-low',
289
+ aliases: ['muse-spark-1.2-contributor-low'],
290
+ cli_model: 'muse-spark-1.3-contributor',
266
291
  extra_args: ['--reasoning-effort', 'low'],
267
- name: 'Muse Spark 1.2 Contributor Low',
292
+ name: 'Muse Spark 1.3 Contributor Low',
268
293
  tier: 'fast',
269
294
  tagline: 'Lowest Cost',
270
295
  description: 'The cheapest option: low reasoning effort on the discounted tier. Content you send on this tier may be used by Meta for product improvement—do not select it for proprietary code.',
@@ -334,8 +359,8 @@ class MuseProvider extends AIProvider {
334
359
 
335
360
  // Resolve cli_model + extra_args + env from built-in model, provider config,
336
361
  // and per-model config. This is what lets reasoning variants like
337
- // muse-spark-1.2-ultra pass `--model muse-spark-1.2` plus
338
- // `--reasoning-effort ultra`.
362
+ // muse-spark-1.3-max pass `--model muse-spark-1.3` plus
363
+ // `--reasoning-effort max`.
339
364
  const { cliModel, extraArgs, env } = this._resolveModelConfig(model);
340
365
 
341
366
  // A cli_model of explicitly `null` omits --model entirely, letting muse pick
@@ -368,11 +393,16 @@ class MuseProvider extends AIProvider {
368
393
  const configOverrides = this.configOverrides || {};
369
394
 
370
395
  const builtIn = MUSE_MODELS.find(m => m.id === modelId || (m.aliases && m.aliases.includes(modelId)));
371
- const configModel = configOverrides.models?.find(m => m.id === modelId);
396
+ // A config override may target the built-in by any of its ids/aliases (e.g.
397
+ // keyed under a retired 1.2 id while the provider was constructed with the
398
+ // 1.3 id), or declare its own aliases; match on the union so no lookup diverges.
399
+ const modelKeys = new Set([modelId, builtIn?.id, ...(builtIn?.aliases || [])].filter(Boolean));
400
+ const configModel = configOverrides.models?.find(
401
+ m => modelKeys.has(m.id) || (m.aliases || []).some(a => modelKeys.has(a))
402
+ );
372
403
 
373
- const cliModel = configModel?.cli_model !== undefined
374
- ? configModel.cli_model
375
- : (builtIn?.cli_model !== undefined ? builtIn.cli_model : modelId);
404
+ // Shared cli_model ladder (config model > built-in > id); see provider.js.
405
+ const cliModel = resolveCliModelConfig(builtIn, configModel, modelId);
376
406
 
377
407
  // Three-way merge for extra_args: built-in model → provider config → per-model config
378
408
  const builtInArgs = builtIn?.extra_args || [];
@@ -1078,8 +1108,8 @@ class MuseProvider extends AIProvider {
1078
1108
 
1079
1109
  if (this.isUnknownModelError(diagnostic)) {
1080
1110
  return new Error(
1081
- `${levelPrefix} Muse CLI rejected the model "${this.model}" as unknown. ` +
1082
- `Check the model ID (and any cli_model override) against Muse's catalog. ` +
1111
+ `${levelPrefix} Muse CLI rejected the model "${this.model}" as unknown or inaccessible. ` +
1112
+ `Check the model ID (and any cli_model override) against what \`muse exec --model\` accepts — the locally cached catalog can lag the CLI. ` +
1083
1113
  `Original error: ${diagnostic}`
1084
1114
  );
1085
1115
  }
@@ -1102,14 +1132,16 @@ class MuseProvider extends AIProvider {
1102
1132
  }
1103
1133
 
1104
1134
  /**
1105
- * Detect an unknown/hidden model rejection. Muse fails fast with
1106
- * "model `X` is not in the catalog".
1135
+ * Detect an unknown/hidden/inaccessible model rejection. Muse fails fast
1136
+ * with either "model `X` is not in the catalog" (older CLIs; also "is hidden
1137
+ * in the catalog") or "model `X` does not exist or you lack access" (current
1138
+ * CLI, exit 1).
1107
1139
  *
1108
1140
  * @param {string} text - Captured stderr and/or terminal reason
1109
1141
  * @returns {boolean}
1110
1142
  */
1111
1143
  isUnknownModelError(text) {
1112
- return /is (?:not in|hidden in) the catalog/i.test(text || '');
1144
+ return /(?:is (?:not in|hidden in) the catalog|does not exist or you lack access)/i.test(text || '');
1113
1145
  }
1114
1146
 
1115
1147
  /**
@@ -21,7 +21,8 @@
21
21
  * (advisor.enabled in ~/.omp/agent/config.yml). Reviews disable it by
22
22
  * default via a bundled --config overlay; set `"advisor": true` in
23
23
  * config.json providers.omp to opt in (passes --advisor instead).
24
- * - Tools: OMP's read-only tool set is read,bash,grep,glob (no find/ls).
24
+ * - Tools: OMP's read-only tool set is read,bash,grep,glob (no find/ls),
25
+ * plus OMP's built-in `task` subagent tool.
25
26
  * - No bundled task extension or --no-prompt-templates flag (Pi-specific).
26
27
  *
27
28
  * OMP provides a 'default' analysis mode and supports additional models via
@@ -29,7 +30,7 @@
29
30
  */
30
31
 
31
32
  const path = require('path');
32
- const { registerProvider } = require('./provider');
33
+ const { registerProvider, resolveCliModelConfig } = require('./provider');
33
34
  const { PiStyleProvider } = require('./pi-style-provider');
34
35
 
35
36
  // Config overlay that disables the advisor runtime for review runs.
@@ -109,8 +110,20 @@ class OmpProvider extends PiStyleProvider {
109
110
  // MCP tools configured in the user's OMP setup are likewise excluded because
110
111
  // they are not on the allowlist.
111
112
  //
112
- // Enabled tools: read, bash, grep, glob
113
- // Excluded tools: edit, write (file modification), task, MCP tools
113
+ // Enabled tools: read, bash, grep, glob, task
114
+ // Excluded tools: edit, write (file modification), MCP tools
115
+ //
116
+ // `task` is OMP's built-in subagent tool. It is enabled so Level 2/3
117
+ // analysis can parallelize read-only exploration (the thorough-tier prompts
118
+ // explicitly invite this). Verified against OMP 18.1.21 source
119
+ // (src/task/executor.ts): a subagent's tool set comes from its agent
120
+ // definition, NOT from the parent's --tools list. The bundled scout,
121
+ // reviewer, and security-reviewer agents declare read-only tool lists, but
122
+ // the generic `task`/`sonic` agents declare none and therefore receive
123
+ // OMP's full default tool set, including write. This does not widen the
124
+ // effective blast radius — the parent already has unrestricted `bash`
125
+ // (see LIMITATION below) — but it does mean the write/edit exclusion is
126
+ // defense-in-depth for the parent turn only, not a hard boundary.
114
127
  //
115
128
  // LIMITATION: The `bash` tool grants arbitrary shell command execution.
116
129
  // Unlike Claude (Bash(git diff*) prefixes) or Copilot (shell(git diff) prefixes),
@@ -121,24 +134,27 @@ class OmpProvider extends PiStyleProvider {
121
134
  // 1. Prompt engineering: Analysis prompts explicitly instruct the AI to only
122
135
  // use read-only operations and never modify files
123
136
  // 2. Worktree isolation: Analysis runs in a git worktree, limiting blast radius
124
- // 3. Tool exclusion: edit and write tools are not loaded at all
137
+ // 3. Tool exclusion: edit and write tools are not loaded for the parent
138
+ // session (subagents spawned via `task` follow their agent definitions)
125
139
  //
126
140
  // If OMP CLI adds prefix-based bash restrictions in the future, they should
127
141
  // be adopted here to match the granularity of other providers.
128
142
  // ============================================================================
129
143
 
130
- // omp -p --mode json --model <model> --tools read,bash,grep,glob <prompt-via-@file>
144
+ // omp -p --mode json --model <model> --tools read,bash,grep,glob,task <prompt-via-@file>
131
145
  // -p: Non-interactive mode (process prompt and exit)
132
146
  // --mode json: Output JSONL events
133
147
  // --model: Specify the model (omitted when cli_model is null to use OMP's default)
134
- // --tools: Enable read-only tools for Level 2/3 analysis (excludes edit,write for safety)
148
+ // --tools: Enable read-only tools plus `task` (subagents) for Level 2/3 analysis
149
+ // (excludes edit,write for safety)
135
150
  // --no-session: Each omp invocation is an ephemeral analysis — there's no need to
136
151
  // persist session state between runs. Set PAIR_REVIEW_OMP_SESSION=1
137
152
  // to enable session saving for debugging (sessions saved under ~/.omp/).
138
153
  // Advisor: disabled by default via the bundled --config overlay (see
139
154
  // REVIEW_CONFIG_OVERLAY_PATH); configOverrides.advisor === true opts in via --advisor.
140
155
  // Build args: base args + built-in extra_args + provider extra_args + model extra_args
141
- // In yolo mode, omit --tools entirely to allow all tools (including edit, write)
156
+ // In yolo mode, omit --tools entirely to allow all tools (including edit, write).
157
+ // `task` is in both modes; only the file-modification tools differ.
142
158
  // load_skills (default true): when false, adds --no-skills to suppress skill
143
159
  // auto-discovery.
144
160
  const loadSkills = configOverrides.load_skills !== false;
@@ -152,7 +168,7 @@ class OmpProvider extends PiStyleProvider {
152
168
  baseArgs = ['-p', '--mode', 'json', ...cliModelArgs, ...sessionArgs,
153
169
  ...advisorArgs, ...skillArgs];
154
170
  } else {
155
- baseArgs = ['-p', '--mode', 'json', ...cliModelArgs, '--tools', 'read,bash,grep,glob',
171
+ baseArgs = ['-p', '--mode', 'json', ...cliModelArgs, '--tools', 'read,bash,grep,glob,task',
156
172
  ...sessionArgs, ...advisorArgs, ...skillArgs];
157
173
  }
158
174
  const builtInArgs = builtIn?.extra_args || [];
@@ -207,9 +223,8 @@ class OmpProvider extends PiStyleProvider {
207
223
  _resolveCliModelArgs(modelId) {
208
224
  const builtIn = OMP_MODELS.find(m => m.id === modelId);
209
225
  const configModel = this.configOverrides?.models?.find(m => m.id === modelId);
210
- const resolvedCliModel = configModel?.cli_model !== undefined
211
- ? configModel.cli_model
212
- : (builtIn?.cli_model !== undefined ? builtIn.cli_model : modelId);
226
+ // Shared cli_model ladder (config model > built-in > id); see provider.js.
227
+ const resolvedCliModel = resolveCliModelConfig(builtIn, configModel, modelId);
213
228
  if (resolvedCliModel === null) return [];
214
229
  return ['--model', resolvedCliModel];
215
230
  }
@@ -21,7 +21,7 @@
21
21
  */
22
22
 
23
23
  const path = require('path');
24
- const { registerProvider } = require('./provider');
24
+ const { registerProvider, resolveCliModelConfig } = require('./provider');
25
25
  const { PiStyleProvider } = require('./pi-style-provider');
26
26
 
27
27
  // Path to the bundled Pi task extension, which provides a generic subagent tool
@@ -72,7 +72,11 @@ const PI_MODELS = [
72
72
  description: 'Pi autonomously selects the best model for each review task',
73
73
  badge: 'Smart Routing',
74
74
  badgeClass: 'badge-power',
75
- extra_args: ['--thinking', 'high', '--skill', REVIEW_SKILL_PATH]
75
+ extra_args: ['--thinking', 'high', '--skill', REVIEW_SKILL_PATH],
76
+ // Analysis-only: the --skill arg loads review-model guidance, which has no meaning
77
+ // in a conversation (and PiBridge appends extraArgs after --no-skills, so the skill
78
+ // would load even with skill auto-discovery off).
79
+ supports_chat: false
76
80
  },
77
81
  {
78
82
  id: 'review-roulette',
@@ -84,7 +88,10 @@ const PI_MODELS = [
84
88
  badge: 'Surprise',
85
89
  badgeClass: 'badge-power',
86
90
  extra_args: ['--thinking', 'high', '--skill', ROULETTE_SKILL_PATH],
87
- env: { PI_TASK_MAX_DEPTH: '2' }
91
+ env: { PI_TASK_MAX_DEPTH: '2' },
92
+ // Analysis-only — see the note on multi-model. Its PI_TASK_MAX_DEPTH bump is for
93
+ // fan-out during review, not for chat.
94
+ supports_chat: false
88
95
  }
89
96
  ];
90
97
 
@@ -238,9 +245,8 @@ class PiProvider extends PiStyleProvider {
238
245
  _resolveCliModelArgs(modelId) {
239
246
  const builtIn = PI_MODELS.find(m => m.id === modelId);
240
247
  const configModel = this.configOverrides?.models?.find(m => m.id === modelId);
241
- const resolvedCliModel = configModel?.cli_model !== undefined
242
- ? configModel.cli_model
243
- : (builtIn?.cli_model !== undefined ? builtIn.cli_model : modelId);
248
+ // Shared cli_model ladder (config model > built-in > id); see provider.js.
249
+ const resolvedCliModel = resolveCliModelConfig(builtIn, configModel, modelId);
244
250
  if (resolvedCliModel === null) return [];
245
251
  // Support provider/model format (e.g., 'google/gemini-2.5-flash')
246
252
  if (typeof resolvedCliModel === 'string' && resolvedCliModel.includes('/')) {
@@ -2,17 +2,28 @@
2
2
  /**
3
3
  * Consolidation Thorough Prompt - Comprehensive Cross-Reviewer Suggestion Merging
4
4
  *
5
- * This is the thorough tier variant of Consolidation analysis. It is optimized for
6
- * careful, detailed merging with extended reasoning and comprehensive guidance
7
- * for resolving conflicts and synthesizing multi-reviewer findings.
5
+ * This is the thorough tier variant of Consolidation analysis. It is targeted
6
+ * at frontier reasoning models and is optimized for evidence-weighted merging:
7
+ * confidence keeps a single pipeline-wide meaning, reviewer agreement and
8
+ * contradiction are treated as evidence rather than inputs to score
9
+ * arithmetic, and unique single-reviewer insights are protected.
8
10
  *
9
- * Tier-specific optimizations applied:
10
- * - ADDED: Reasoning encouragement section for thoughtful synthesis
11
- * - COMPREHENSIVE: Consolidation rules with detailed conflict resolution
12
- * - COMPREHENSIVE: Consensus handling with confidence calibration
13
- * - ADDED: Summary synthesis guidance
14
- * - EXPANDED: Guidelines with review philosophy
15
- * - INCLUDED: All optional sections
11
+ * Tier-specific design decisions:
12
+ * - KEPT: Deduplication/conflict-resolution rules, reviewer context weighting,
13
+ * unique-insight protection, summary synthesis guidance
14
+ * - ADDED: Adversarial verification pass, FLOW-CONDITIONAL via the
15
+ * {{adversarialVerification}} placeholder (shared text in
16
+ * ../../shared/adversarial-verification.js). Cross-voice consolidation —
17
+ * the reviewer-centric council's final merge stage — fills it; intra-level
18
+ * consolidation (the level-centric council's Pass 1) passes '' so findings
19
+ * reach the final cross-level orchestration pass unverified, with
20
+ * cross-voice overlap intact as evidence. Adversarial verification runs
21
+ * exactly once per analysis flow, at the last merge point — every extra
22
+ * pass is an independent chance to wrongly kill a true positive.
23
+ * - REPLACED: Confidence score arithmetic with ordinal evidence-based rules
24
+ * - REMOVED: Reasoning-encouragement boilerplate
25
+ * - UNIFIED: Confidence semantics (probability the finding is real) shared
26
+ * with the analysis levels
16
27
  *
17
28
  * Section categories:
18
29
  * - locked: Cannot be modified by variants (data integrity)
@@ -28,6 +39,9 @@
28
39
  * - {{lineNumberGuidance}} - Line number guidance section
29
40
  * - {{customInstructions}} - Custom instructions section (optional)
30
41
  * - {{dedupInstructions}} - Dedup instructions section (optional)
42
+ * - {{adversarialVerification}} - Adversarial verification section (optional;
43
+ * filled with ADVERSARIAL_VERIFICATION_SECTION by cross-voice consolidation,
44
+ * '' by intra-level consolidation)
31
45
  * - {{reviewerSuggestions}} - Formatted reviewer suggestions input
32
46
  * - {{suggestionCount}} - Total number of input suggestions
33
47
  * - {{reviewerCount}} - Number of reviewers being consolidated
@@ -55,17 +69,6 @@ Multiple independent AI reviewers have analyzed the same code changes. Your task
55
69
  Each reviewer may have used a different AI model, perspective, or focus area. Your consolidation should produce output that is stronger than any individual review.
56
70
  </section>
57
71
 
58
- <section name="reasoning-encouragement" required="true" tier="thorough">
59
- ## Reasoning Approach
60
- Take your time to analyze the reviewer findings thoroughly. For each cluster of related suggestions:
61
- 1. Identify which reviewers flagged the same or overlapping issues
62
- 2. Evaluate the strength of evidence from each reviewer
63
- 3. Determine the best framing that captures the full insight
64
- 4. Calibrate confidence based on reviewer agreement and evidence quality
65
- 5. Consider whether merging would lose important nuance
66
- 6. Formulate clear, actionable guidance that respects reviewer autonomy
67
- </section>
68
-
69
72
  <section name="custom-instructions" optional="true" tier="balanced,thorough">
70
73
  {{customInstructions}}
71
74
  </section>
@@ -93,6 +96,10 @@ Each reviewer below may have been configured with custom instructions. These fal
93
96
  {{reviewerSuggestions}}
94
97
  </section>
95
98
 
99
+ <section name="adversarial-verification" optional="true" tier="thorough">
100
+ {{adversarialVerification}}
101
+ </section>
102
+
96
103
  <section name="consolidation-rules" required="true" tier="thorough">
97
104
  ## Consolidation Guidelines
98
105
 
@@ -110,13 +117,13 @@ Apply careful analysis when identifying duplicates:
110
117
  - Situations where separate action items are clearer than combined ones
111
118
 
112
119
  **Merging Best Practices:**
113
- - Preserve the most actionable and specific details from each reviewer
120
+ - Preserve the most actionable and specific details from each reviewer, including concrete failure and attack scenarios and cited evidence — do not summarize an exploit description back into a code observation
114
121
  - Use the clearest framing, regardless of which reviewer provided it
115
122
  - Do NOT mention which reviewer found the issue — focus on the insight itself
116
123
 
117
124
  ### 2. Conflict Resolution
118
125
  When reviewers disagree about an issue:
119
- - **Evaluate evidence quality**: Concrete code analysis > pattern matching > heuristics
126
+ - **Evaluate evidence quality**: Concrete code analysis with cited evidence > pattern matching > heuristics
120
127
  - **Consider specificity**: More specific analysis usually wins
121
128
  - **Weight actionability**: Prefer the suggestion that gives clearer next steps
122
129
  - **When truly uncertain**: Include the suggestion with reduced confidence and note the tension in the description
@@ -141,28 +148,29 @@ Assess severity based on the evidence and reasoning across all reviewers. When r
141
148
 
142
149
  <section name="consensus-handling" required="true" tier="thorough">
143
150
  ### 6. Consensus Handling and Confidence Calibration
151
+ Confidence keeps its pipeline-wide meaning: the probability the finding is real and correctly described.
144
152
 
145
153
  **Cross-Reviewer Agreement:**
146
- - **Strong consensus** (3+ reviewers): Boost confidence by 0.2 (cap at 1.0)
147
- - **Moderate consensus** (2 reviewers): Boost confidence by 0.1
148
- - **Single reviewer**: Preserve original confidence — don't penalize valuable unique findings
149
- - **Contradiction**: Use the lower confidence minus 0.1
150
-
151
- **Confidence Calibration:**
152
- - High (0.8+): Clear issues with strong evidence or multi-reviewer consensus
153
- - Medium (0.5-0.79): Likely valuable suggestions with reasonable evidence
154
- - Lower (0.3-0.49): Marginal suggestions — include only if unique and actionable
155
- - Very low (<0.3): Consider omitting unless multi-reviewer consensus
156
-
157
- Note: Confidence is about certainty of value, not severity.
154
+ - **Independent convergence is strong evidence.** A finding flagged by multiple reviewers warrants higher confidence than any single reviewer assigned it — the more reviewers, the stronger the evidence
155
+ - **Contradiction is evidence of uncertainty.** Resolve on the evidence (see Conflict Resolution); if genuinely unresolvable, keep the finding at reduced confidence and note the tension
156
+ - **Lone findings keep their original confidence** — don't penalize valuable unique insights
157
+ - Set confidence from the strength of the combined evidence — never by mechanical score arithmetic
158
+
159
+ **Confidence Bands:**
160
+ - High (0.8+): Strong evidence — verified analysis or multi-reviewer consensus
161
+ - Medium (0.5-0.79): Reasonable evidence from a single reviewer
162
+ - Lower (0.3-0.49): Weakly evidenced — include only if unique and actionable
163
+ - Very low (<0.3): Omit unless multiple reviewers agree
164
+
165
+ Note: Confidence is about certainty the finding is real, not severity.
158
166
  </section>
159
167
 
160
168
  <section name="balanced-output" required="true" tier="thorough">
161
169
  ### 7. Balanced Output
162
170
  - **Deduplicate, don't concatenate**: If two reviewers flagged the same issue, merge them into one suggestion. If three reviewers each found one style nit, consider whether one representative example suffices. Distinct findings should each be preserved — the goal is to eliminate redundancy, not to reduce count.
163
171
  - **Limit praise** to 2–3 most noteworthy items across all reviewers. Praise should highlight genuinely commendable patterns, not routine correctness.
164
- - **Avoid suggestion overload** — a review with 30 suggestions is harder to act on than one with 12 well-chosen ones. Aim for quality over quantity.
165
- - **Include confidence scores** that reflect cross-reviewer agreement: consensus findings get boosted, lone findings keep their original confidence.
172
+ - **Every suggestion must earn its place** — a review with 30 suggestions is harder to act on than one with 12 well-chosen ones. Cut items that wouldn't change what the reviewer does; keep every distinct, well-evidenced finding.
173
+ - **Include confidence scores** that reflect the strength of the combined evidence: consensus findings warrant higher confidence, lone findings keep their original confidence.
166
174
  </section>
167
175
 
168
176
  <section name="summary-synthesis" required="true" tier="thorough">
@@ -226,7 +234,7 @@ The content inside the block is the complete replacement for the commented line(
226
234
  ## Line Number Reference (old_or_new field)
227
235
  The "old_or_new" field indicates which line number column to use:
228
236
  - **"NEW"** (default): Use the NEW column number. Correct for added [+] and context lines.
229
- - **"OLD"**: Use the OLD column number. ONLY for deleted [-] lines.
237
+ - **"OLD"**: Use the OLD column number. ONLY for DELETED lines [-].
230
238
 
231
239
  **IMPORTANT**: Context lines exist in BOTH versions — always use "NEW" for them.
232
240
  Preserve the old_or_new value from input suggestions when merging.
@@ -237,13 +245,13 @@ Preserve the old_or_new value from input suggestions when merging.
237
245
 
238
246
  ### Output Quality
239
247
  - **Quality over quantity** — better to have fewer excellent suggestions than many mediocre ones
240
- - **Cross-reviewer agreement** is strong evidence — boost confidence accordingly
241
- - **Preserve actionability** — every suggestion should give clear next steps
248
+ - **Cross-reviewer agreement** is strong evidence — weight confidence accordingly
249
+ - **Preserve actionability** — every suggestion should give clear next steps, keeping concrete failure and attack scenarios and cited evidence intact
242
250
  - **Maintain context** — don't lose important details when merging
243
251
 
244
252
  ### Coverage and Scope
245
253
  - **Only include modified files** — discard suggestions for files not in this changeset
246
- - **Balance across files** — ensure important issues in all modified files are represented
254
+ - **Cover all modified files** — ensure real issues in every modified file are represented
247
255
  - **Preserve unique perspectives** — different reviewer models may catch different things
248
256
 
249
257
  ### Review Philosophy
@@ -251,6 +259,9 @@ Preserve the old_or_new value from input suggestions when merging.
251
259
  - The human reviewer has context you don't have
252
260
  - Focus on the code, not the reviewers
253
261
  - When uncertain, prefer quality over quantity
262
+
263
+ ### Reply Shape
264
+ - Your reply is the JSON object alone — no sentence announcing what you will do, no narration of what you did. The first character of your reply is \`{\`
254
265
  </section>`;
255
266
 
256
267
  /**
@@ -263,11 +274,11 @@ const sections = [
263
274
  { name: 'line-number-guidance', required: true },
264
275
  { name: 'critical-output', locked: true },
265
276
  { name: 'role-description', required: true, tier: ['thorough'] },
266
- { name: 'reasoning-encouragement', required: true, tier: ['thorough'] },
267
277
  { name: 'custom-instructions', optional: true, tier: ['balanced', 'thorough'] },
268
278
  { name: 'dedup-instructions', optional: true },
269
279
  { name: 'reviewer-context-guidance', required: true, tier: ['thorough'] },
270
280
  { name: 'input-suggestions', locked: true },
281
+ { name: 'adversarial-verification', optional: true, tier: ['thorough'] },
271
282
  { name: 'consolidation-rules', required: true, tier: ['thorough'] },
272
283
  { name: 'consensus-handling', required: true, tier: ['thorough'] },
273
284
  { name: 'balanced-output', required: true, tier: ['thorough'] },
@@ -279,6 +290,8 @@ const sections = [
279
290
 
280
291
  /**
281
292
  * Default section order for Consolidation Thorough
293
+ * Note: reasoning-encouragement removed; confidence arithmetic replaced by
294
+ * evidence-based rules inside consensus-handling
282
295
  */
283
296
  const defaultOrder = [
284
297
  'role',
@@ -286,11 +299,11 @@ const defaultOrder = [
286
299
  'line-number-guidance',
287
300
  'critical-output',
288
301
  'role-description',
289
- 'reasoning-encouragement',
290
302
  'custom-instructions',
291
303
  'dedup-instructions',
292
304
  'reviewer-context-guidance',
293
305
  'input-suggestions',
306
+ 'adversarial-verification',
294
307
  'consolidation-rules',
295
308
  'consensus-handling',
296
309
  'balanced-output',