@in-the-loop-labs/pair-review 5.2.3 → 5.3.1
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.
- package/README.md +11 -3
- package/package.json +1 -1
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin-code-critic/.claude-plugin/plugin.json +1 -1
- package/plugin-code-critic/skills/analyze/references/level1-thorough.md +52 -121
- package/plugin-code-critic/skills/analyze/references/level2-thorough.md +49 -113
- package/plugin-code-critic/skills/analyze/references/level3-thorough.md +46 -195
- package/plugin-code-critic/skills/analyze/references/orchestration-thorough.md +56 -112
- package/plugin-pair-loop/.claude-plugin/plugin.json +1 -1
- package/public/css/analysis-config.css +29 -0
- package/public/css/pr.css +208 -0
- package/public/js/components/AIPanel.js +14 -9
- package/public/js/components/ChatPanel.js +790 -54
- package/public/js/components/ConfirmDialog.js +70 -2
- package/public/js/modules/pierre-bridge.js +58 -97
- package/public/js/modules/suggestion-manager.js +9 -121
- package/public/js/pr.js +15 -28
- package/public/js/utils/scroll-into-view.js +18 -4
- package/src/ai/analyzer.js +30 -5
- package/src/ai/antigravity-provider.js +7 -6
- package/src/ai/claude-provider.js +4 -8
- package/src/ai/codex-provider.js +3 -4
- package/src/ai/index.js +2 -0
- package/src/ai/muse-provider.js +3 -4
- package/src/ai/omp-provider.js +27 -12
- package/src/ai/pi-provider.js +12 -6
- package/src/ai/prompts/baseline/consolidation/thorough.js +56 -43
- package/src/ai/prompts/baseline/level1/thorough.js +76 -138
- package/src/ai/prompts/baseline/level2/thorough.js +76 -129
- package/src/ai/prompts/baseline/level3/thorough.js +67 -212
- package/src/ai/prompts/baseline/orchestration/thorough.js +79 -130
- package/src/ai/prompts/render-for-skill.js +5 -0
- package/src/ai/prompts/shared/adversarial-verification.js +68 -0
- package/src/ai/provider.js +60 -1
- package/src/ai/stream-parser.js +22 -1
- package/src/chat/acp-bridge.js +11 -0
- package/src/chat/chat-models.js +348 -0
- package/src/chat/chat-providers.js +17 -0
- package/src/chat/claude-code-bridge.js +9 -0
- package/src/chat/codex-bridge.js +6 -1
- package/src/chat/omp-bridge.js +5 -0
- package/src/chat/pi-bridge.js +20 -5
- package/src/chat/session-manager.js +158 -63
- package/src/config.js +92 -5
- package/src/git/worktree.js +29 -10
- package/src/github/client.js +30 -10
- package/src/hooks/payloads.js +5 -1
- package/src/routes/chat.js +83 -11
- package/src/setup/pr-setup.js +54 -1
package/src/ai/analyzer.js
CHANGED
|
@@ -14,6 +14,7 @@ const { normalizePath, pathExistsInList, resolveRenamedFile } = require('../util
|
|
|
14
14
|
const { buildFileLineCountMap, validateSuggestionLineNumbers } = require('../utils/line-validation');
|
|
15
15
|
const { getPromptBuilder } = require('./prompts');
|
|
16
16
|
const { formatValidFiles } = require('./prompts/shared/valid-files');
|
|
17
|
+
const { ADVERSARIAL_VERIFICATION_SECTION } = require('./prompts/shared/adversarial-verification');
|
|
17
18
|
const { GIT_DIFF_FLAGS } = require('../git/diff-flags');
|
|
18
19
|
const {
|
|
19
20
|
buildAnalysisLineNumberGuidance,
|
|
@@ -655,7 +656,7 @@ class Analyzer {
|
|
|
655
656
|
// Build dedup context from prMetadata and options
|
|
656
657
|
const dedupContext = buildDedupContext(prMetadata, { reviewId: prId, serverPort, runId });
|
|
657
658
|
|
|
658
|
-
const orchestrationResult = await this.orchestrateWithAI(allSuggestions, prMetadata, mergedInstructions, worktreePath, { analysisId, tier, progressCallback, timeout: executionTimeout, logPrefix, reviewerNum, excludePrevious, dedupContext, githubClient });
|
|
659
|
+
const orchestrationResult = await this.orchestrateWithAI(allSuggestions, prMetadata, mergedInstructions, worktreePath, { analysisId, tier, progressCallback, timeout: executionTimeout, logPrefix, reviewerNum, excludePrevious, dedupContext, githubClient, skipAdversarialVerification: options.skipAdversarialVerification });
|
|
659
660
|
|
|
660
661
|
// orchestrateWithAI degrades to the raw union of level suggestions when
|
|
661
662
|
// consolidation fails internally — report that honestly instead of 'success'
|
|
@@ -2856,7 +2857,7 @@ File-level suggestions should NOT have a line number. They apply to the entire f
|
|
|
2856
2857
|
* array is the raw union of all levels rather than a curated set.
|
|
2857
2858
|
*/
|
|
2858
2859
|
async orchestrateWithAI(allSuggestions, prMetadata, customInstructions = null, worktreePath = null, options = {}) {
|
|
2859
|
-
const { analysisId, tier = 'balanced', progressCallback, providerOverride, modelOverride, timeout = 600000, logPrefix: lp = '', reviewerNum, excludePrevious, dedupContext, githubClient } = options;
|
|
2860
|
+
const { analysisId, tier = 'balanced', progressCallback, providerOverride, modelOverride, timeout = 600000, logPrefix: lp = '', reviewerNum, excludePrevious, dedupContext, githubClient, skipAdversarialVerification } = options;
|
|
2860
2861
|
// Build adapter-level log prefix: when reviewerNum is set (council mode),
|
|
2861
2862
|
// use compact format like [R1 Orch] so concurrent reviewers are disambiguated
|
|
2862
2863
|
const adapterLogPrefix = reviewerNum ? `[R${reviewerNum} Orch]` : '';
|
|
@@ -2896,7 +2897,7 @@ File-level suggestions should NOT have a line number. They apply to the entire f
|
|
|
2896
2897
|
}
|
|
2897
2898
|
|
|
2898
2899
|
// Build the consolidation prompt
|
|
2899
|
-
const prompt = this.buildOrchestrationPrompt(allSuggestions, prMetadata, customInstructions, worktreePath, tier, lp, { excludePrevious, dedupContext: resolvedDedupContext });
|
|
2900
|
+
const prompt = this.buildOrchestrationPrompt(allSuggestions, prMetadata, customInstructions, worktreePath, tier, lp, { excludePrevious, dedupContext: resolvedDedupContext, skipAdversarialVerification });
|
|
2900
2901
|
|
|
2901
2902
|
// Execute AI for cross-level consolidation
|
|
2902
2903
|
logger.info(`${lp}[Consolidation] Running AI consolidation to curate and merge suggestions...`);
|
|
@@ -3022,9 +3023,12 @@ File-level suggestions should NOT have a line number. They apply to the entire f
|
|
|
3022
3023
|
* @param {string} worktreePath - Path to the git worktree
|
|
3023
3024
|
* @param {string} tier - Capability tier: 'fast', 'balanced', or 'thorough' (default: 'balanced')
|
|
3024
3025
|
* @param {string} logPrefix - Optional log prefix for reviewer identification in council mode
|
|
3025
|
-
* @param {Object} [dedupOptions] - Dedup options
|
|
3026
|
+
* @param {Object} [dedupOptions] - Dedup and prompt options
|
|
3026
3027
|
* @param {Object} [dedupOptions.excludePrevious] - { github: bool, feedback: bool }
|
|
3027
3028
|
* @param {Object} [dedupOptions.dedupContext] - { owner, repo, pullNumber, reviewId, serverPort }
|
|
3029
|
+
* @param {boolean} [dedupOptions.skipAdversarialVerification] - Omit the adversarial
|
|
3030
|
+
* verification section. Set for per-voice orchestration inside a multi-voice
|
|
3031
|
+
* reviewer-centric council, where verification belongs to cross-voice consolidation
|
|
3028
3032
|
* @returns {string} Orchestration prompt
|
|
3029
3033
|
*/
|
|
3030
3034
|
buildOrchestrationPrompt(allSuggestions, prMetadata, customInstructions = null, worktreePath = null, tier = 'balanced', logPrefix = '', dedupOptions = {}) {
|
|
@@ -3042,6 +3046,14 @@ File-level suggestions should NOT have a line number. They apply to the entire f
|
|
|
3042
3046
|
customInstructions: customInstructions ? this.buildCustomInstructionsSection(customInstructions) : '',
|
|
3043
3047
|
lineNumberGuidance: this.buildOrchestrationLineNumberGuidance(worktreePath),
|
|
3044
3048
|
dedupInstructions: buildDedupInstructions(dedupOptions.excludePrevious, dedupOptions.dedupContext || {}),
|
|
3049
|
+
// Adversarial verification runs exactly once per analysis flow, at the
|
|
3050
|
+
// final merge stage. Orchestration IS that stage for standalone
|
|
3051
|
+
// single-reviewer runs and the level-centric council's Pass 2 — but when
|
|
3052
|
+
// analyzeAllLevels runs as one voice inside a multi-voice
|
|
3053
|
+
// reviewer-centric council, cross-voice consolidation is the final stage
|
|
3054
|
+
// and per-voice verification would pre-kill findings before cross-voice
|
|
3055
|
+
// overlap is visible (same once-per-flow rule as dedup).
|
|
3056
|
+
adversarialVerification: dedupOptions.skipAdversarialVerification ? '' : ADVERSARIAL_VERIFICATION_SECTION,
|
|
3045
3057
|
level1Count: allSuggestions.level1?.length || 0,
|
|
3046
3058
|
level2Count: allSuggestions.level2?.length || 0,
|
|
3047
3059
|
level3Count: allSuggestions.level3?.length || 0,
|
|
@@ -3354,7 +3366,10 @@ File-level suggestions should NOT have a line number. They apply to the entire f
|
|
|
3354
3366
|
}
|
|
3355
3367
|
|
|
3356
3368
|
// Note: excludePrevious/serverPort omitted intentionally — dedup runs once
|
|
3357
|
-
// during cross-voice consolidation, not per-voice.
|
|
3369
|
+
// during cross-voice consolidation, not per-voice. Adversarial
|
|
3370
|
+
// verification follows the same rule: skipped here so this voice's
|
|
3371
|
+
// internal cross-level merge does not pre-kill findings before
|
|
3372
|
+
// cross-voice consolidation can see overlap between voices.
|
|
3358
3373
|
const result = await voiceAnalyzer.analyzeAllLevels(
|
|
3359
3374
|
reviewId,
|
|
3360
3375
|
worktreePath,
|
|
@@ -3366,6 +3381,7 @@ File-level suggestions should NOT have a line number. They apply to the entire f
|
|
|
3366
3381
|
analysisId,
|
|
3367
3382
|
runId: childRunId,
|
|
3368
3383
|
skipRunCreation: true,
|
|
3384
|
+
skipAdversarialVerification: true,
|
|
3369
3385
|
enabledLevels,
|
|
3370
3386
|
tier: voiceTier,
|
|
3371
3387
|
timeout: voiceTimeout,
|
|
@@ -4096,6 +4112,12 @@ File-level suggestions should NOT have a line number. They apply to the entire f
|
|
|
4096
4112
|
reviewIntro: `You are consolidating Level ${level} code review suggestions from multiple independent AI reviewers for ${reviewDescription}.`,
|
|
4097
4113
|
customInstructions: customInstructions ? this.buildCustomInstructionsSection(customInstructions) : '',
|
|
4098
4114
|
dedupInstructions: '',
|
|
4115
|
+
// Intra-level consolidation is Pass 1 of the level-centric council —
|
|
4116
|
+
// NOT the flow's final merge stage. Adversarial verification runs
|
|
4117
|
+
// exactly once per flow, at the last merge point (here, the Pass 2
|
|
4118
|
+
// cross-level orchestration, where it is embedded statically), so
|
|
4119
|
+
// findings reach it with cross-voice overlap intact as evidence.
|
|
4120
|
+
adversarialVerification: '',
|
|
4099
4121
|
lineNumberGuidance: this.buildOrchestrationLineNumberGuidance(worktreePath),
|
|
4100
4122
|
reviewerSuggestions,
|
|
4101
4123
|
suggestionCount,
|
|
@@ -4296,6 +4318,9 @@ File-level suggestions should NOT have a line number. They apply to the entire f
|
|
|
4296
4318
|
customInstructions: customInstructions ? this.buildCustomInstructionsSection(customInstructions) : '',
|
|
4297
4319
|
lineNumberGuidance: this.buildOrchestrationLineNumberGuidance(worktreePath),
|
|
4298
4320
|
dedupInstructions: buildDedupInstructions(excludePrevious, resolvedDedupContext || {}),
|
|
4321
|
+
// Cross-voice consolidation is the reviewer-centric council's final
|
|
4322
|
+
// merge stage — the one place in this flow the adversarial pass runs
|
|
4323
|
+
adversarialVerification: ADVERSARIAL_VERIFICATION_SECTION,
|
|
4299
4324
|
reviewerSuggestions: voiceDescriptions,
|
|
4300
4325
|
suggestionCount: voiceReviews.reduce((sum, v) => sum + v.suggestionCount, 0),
|
|
4301
4326
|
reviewerCount: voiceReviews.length
|
|
@@ -62,9 +62,9 @@ const BIN_DIR = path.join(__dirname, '..', '..', 'bin');
|
|
|
62
62
|
const ANALYSIS_DIRECTIVE =
|
|
63
63
|
'Perform the code-review task described in the input provided on standard input. You are ' +
|
|
64
64
|
'running non-interactively in the repository at the current working directory; you MAY use ' +
|
|
65
|
-
'your
|
|
66
|
-
'the
|
|
67
|
-
'
|
|
65
|
+
'your tools (reading files, searching, and running git/shell commands) to gather the context ' +
|
|
66
|
+
'the instructions call for. Follow the access and leave-no-trace rules stated in the task ' +
|
|
67
|
+
'instructions. When finished, output ONLY the exact result the instructions request (for ' +
|
|
68
68
|
'example, a single JSON object when JSON is requested), with no extra commentary and no ' +
|
|
69
69
|
'surrounding markdown code fences.';
|
|
70
70
|
|
|
@@ -73,9 +73,10 @@ const EXTRACTION_DIRECTIVE =
|
|
|
73
73
|
'Read the input provided on standard input and return ONLY the raw JSON object it describes — ' +
|
|
74
74
|
'no explanation, no markdown, no code fences. Do not use any tools.';
|
|
75
75
|
|
|
76
|
-
// agy self-terminates print mode at --print-timeout; extraction
|
|
77
|
-
// in the base class, so ask agy to give up
|
|
78
|
-
|
|
76
|
+
// agy self-terminates print mode at --print-timeout; extraction is capped at
|
|
77
|
+
// LLM_EXTRACTION_TIMEOUT_MS (300s) in the base class, so ask agy to give up
|
|
78
|
+
// just before that.
|
|
79
|
+
const EXTRACTION_PRINT_TIMEOUT_SECS = 295;
|
|
79
80
|
|
|
80
81
|
// The JS-side execute() timeout is a backstop: it fires this many ms AFTER agy's
|
|
81
82
|
// own --print-timeout budget, so agy self-terminates first (with its own error
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
const path = require('path');
|
|
9
9
|
const { spawn } = require('child_process');
|
|
10
|
-
const { AIProvider, registerProvider, quoteShellArgs } = require('./provider');
|
|
10
|
+
const { AIProvider, registerProvider, quoteShellArgs, resolveCliModelConfig } = require('./provider');
|
|
11
11
|
const logger = require('../utils/logger');
|
|
12
12
|
const { extractJSON } = require('../utils/json-extractor');
|
|
13
13
|
const { CancellationError, isAnalysisCancelled } = require('../routes/shared');
|
|
@@ -350,17 +350,13 @@ class ClaudeProvider extends AIProvider {
|
|
|
350
350
|
_resolveModelConfig(modelId) {
|
|
351
351
|
const configOverrides = this.configOverrides || {};
|
|
352
352
|
|
|
353
|
-
// Resolve cli_model
|
|
353
|
+
// Resolve cli_model via the shared ladder (config model > built-in model > id).
|
|
354
354
|
// cli_model decouples the app-level model ID from the CLI --model argument.
|
|
355
|
-
//
|
|
356
|
-
// - string: use this exact value for --model
|
|
357
|
-
// - null: explicitly suppress --model (for tools that want the model set via env instead)
|
|
355
|
+
// See resolveCliModelConfig in provider.js for the undefined/null/'' contract.
|
|
358
356
|
const builtIn = CLAUDE_MODELS.find(m => m.id === modelId || (m.aliases && m.aliases.includes(modelId)));
|
|
359
357
|
const modelKeys = new Set([modelId, builtIn?.id, ...(builtIn?.aliases || [])].filter(Boolean));
|
|
360
358
|
const configModel = configOverrides.models?.find(m => modelKeys.has(m.id));
|
|
361
|
-
const resolvedCliModel = configModel
|
|
362
|
-
? configModel.cli_model
|
|
363
|
-
: (builtIn?.cli_model !== undefined ? builtIn.cli_model : modelId);
|
|
359
|
+
const resolvedCliModel = resolveCliModelConfig(builtIn, configModel, modelId);
|
|
364
360
|
|
|
365
361
|
// Conditionally include --model in base args (null = suppress, empty string passes through to surface CLI error)
|
|
366
362
|
const cliModelArgs = resolvedCliModel !== null ? ['--model', resolvedCliModel] : [];
|
package/src/ai/codex-provider.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
const path = require('path');
|
|
10
10
|
const { spawn } = require('child_process');
|
|
11
|
-
const { AIProvider, registerProvider, quoteShellArgs } = require('./provider');
|
|
11
|
+
const { AIProvider, registerProvider, quoteShellArgs, resolveCliModelConfig } = require('./provider');
|
|
12
12
|
const logger = require('../utils/logger');
|
|
13
13
|
const { extractJSON } = require('../utils/json-extractor');
|
|
14
14
|
const { CancellationError, isAnalysisCancelled } = require('../routes/shared');
|
|
@@ -259,9 +259,8 @@ class CodexProvider extends AIProvider {
|
|
|
259
259
|
m => modelKeys.has(m.id) || (m.aliases || []).some(a => modelKeys.has(a))
|
|
260
260
|
);
|
|
261
261
|
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
: (builtIn?.cli_model !== undefined ? builtIn.cli_model : modelId);
|
|
262
|
+
// Shared cli_model ladder (config model > built-in > id); see provider.js.
|
|
263
|
+
const cliModel = resolveCliModelConfig(builtIn, configModel, modelId);
|
|
265
264
|
|
|
266
265
|
// Three-way merge for extra_args: built-in model → provider config → per-model config
|
|
267
266
|
const builtInArgs = builtIn?.extra_args || [];
|
package/src/ai/index.js
CHANGED
|
@@ -24,6 +24,7 @@ const {
|
|
|
24
24
|
getProviderConfigOverrides,
|
|
25
25
|
inferModelDefaults,
|
|
26
26
|
resolveDefaultModel,
|
|
27
|
+
resolveCliModelConfig,
|
|
27
28
|
modelMatches,
|
|
28
29
|
mergeModels,
|
|
29
30
|
applyModelOverrides,
|
|
@@ -87,6 +88,7 @@ module.exports = {
|
|
|
87
88
|
getProviderConfigOverrides,
|
|
88
89
|
inferModelDefaults,
|
|
89
90
|
resolveDefaultModel,
|
|
91
|
+
resolveCliModelConfig,
|
|
90
92
|
modelMatches,
|
|
91
93
|
mergeModels,
|
|
92
94
|
applyModelOverrides,
|
package/src/ai/muse-provider.js
CHANGED
|
@@ -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');
|
|
@@ -401,9 +401,8 @@ class MuseProvider extends AIProvider {
|
|
|
401
401
|
m => modelKeys.has(m.id) || (m.aliases || []).some(a => modelKeys.has(a))
|
|
402
402
|
);
|
|
403
403
|
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
: (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);
|
|
407
406
|
|
|
408
407
|
// Three-way merge for extra_args: built-in model → provider config → per-model config
|
|
409
408
|
const builtInArgs = builtIn?.extra_args || [];
|
package/src/ai/omp-provider.js
CHANGED
|
@@ -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),
|
|
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
|
|
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
|
|
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
|
-
|
|
211
|
-
|
|
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
|
}
|
package/src/ai/pi-provider.js
CHANGED
|
@@ -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
|
-
|
|
242
|
-
|
|
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
|
|
6
|
-
*
|
|
7
|
-
*
|
|
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
|
|
10
|
-
* -
|
|
11
|
-
*
|
|
12
|
-
* -
|
|
13
|
-
*
|
|
14
|
-
* -
|
|
15
|
-
* -
|
|
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
|
-
- **
|
|
147
|
-
- **
|
|
148
|
-
- **
|
|
149
|
-
-
|
|
150
|
-
|
|
151
|
-
**Confidence
|
|
152
|
-
- High (0.8+):
|
|
153
|
-
- Medium (0.5-0.79):
|
|
154
|
-
- Lower (0.3-0.49):
|
|
155
|
-
- Very low (<0.3):
|
|
156
|
-
|
|
157
|
-
Note: Confidence is about certainty
|
|
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
|
-
- **
|
|
165
|
-
- **Include confidence scores** that reflect
|
|
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
|
|
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 —
|
|
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
|
-
- **
|
|
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',
|