@in-the-loop-labs/pair-review 5.4.2 → 5.4.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 (36) hide show
  1. package/README.md +1 -1
  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-balanced.md +1 -1
  6. package/plugin-code-critic/skills/analyze/references/level1-thorough.md +1 -1
  7. package/plugin-code-critic/skills/analyze/references/level2-balanced.md +2 -2
  8. package/plugin-code-critic/skills/analyze/references/level2-thorough.md +2 -2
  9. package/plugin-code-critic/skills/analyze/references/level3-balanced.md +2 -2
  10. package/plugin-code-critic/skills/analyze/references/level3-thorough.md +2 -2
  11. package/plugin-code-critic/skills/analyze/references/orchestration-balanced.md +3 -3
  12. package/plugin-code-critic/skills/analyze/references/orchestration-fast.md +1 -1
  13. package/plugin-code-critic/skills/analyze/references/orchestration-thorough.md +3 -3
  14. package/plugin-pair-loop/.claude-plugin/plugin.json +1 -1
  15. package/public/js/components/CouncilProgressModal.js +2 -9
  16. package/public/js/pr.js +21 -8
  17. package/public/js/utils/category-emoji.js +1 -1
  18. package/public/js/utils/header-anchor.js +38 -0
  19. package/public/local.html +3 -0
  20. package/public/pr.html +3 -0
  21. package/src/ai/codex-provider.js +65 -17
  22. package/src/ai/executable-provider.js +1 -1
  23. package/src/ai/pi-format.js +42 -1
  24. package/src/ai/pi-style-provider.js +25 -10
  25. package/src/ai/prompts/baseline/consolidation/balanced.js +2 -2
  26. package/src/ai/prompts/baseline/consolidation/thorough.js +2 -2
  27. package/src/ai/prompts/baseline/level1/balanced.js +1 -1
  28. package/src/ai/prompts/baseline/level1/thorough.js +1 -1
  29. package/src/ai/prompts/baseline/level2/balanced.js +2 -2
  30. package/src/ai/prompts/baseline/level2/thorough.js +2 -2
  31. package/src/ai/prompts/baseline/level3/balanced.js +2 -2
  32. package/src/ai/prompts/baseline/level3/thorough.js +2 -2
  33. package/src/ai/prompts/baseline/orchestration/balanced.js +2 -2
  34. package/src/ai/prompts/baseline/orchestration/thorough.js +2 -2
  35. package/src/ai/prompts/shared/output-schema.js +6 -201
  36. package/src/utils/category-emoji.js +1 -1
package/README.md CHANGED
@@ -632,7 +632,7 @@ pair-review integrates with AI providers via their CLI tools:
632
632
 
633
633
  - **Claude**: Uses Claude Code CLI
634
634
  - **Antigravity**: Uses the Antigravity CLI (`agy`), the successor to the Gemini CLI. Install it with `curl -fsSL https://antigravity.google/cli/install.sh | bash` (macOS/Linux; it is not an npm package) — see the [Antigravity docs](https://antigravity.google/docs). Antigravity is an analysis-only provider: it runs as an agentic reviewer in non-interactive print mode and has **no chat/ACP mode**.
635
- - **Codex**: Uses Codex CLI. GPT-5.6 Sol High (`gpt-5.6-sol-high`) remains the recommended default during rollout. GPT-6.1 Sol High (`gpt-6.1-sol-high`) and XHigh (`gpt-6.1-sol-xhigh`) are explicit choices for reviews and chat; Enterprise and Edu administrators must enable GPT-6.1 Sol access. GPT-6.1 Terra XHigh (`gpt-6.1-terra-xhigh`) is an explicit balanced choice; Enterprise access depends on workspace administrator controls.
635
+ - **Codex**: Uses Codex CLI. GPT-5.6 Sol High (`gpt-5.6-sol-high`) remains the recommended default during rollout. GPT-6.2 Sol High (`gpt-6.2-sol-high`) and XHigh (`gpt-6.2-sol-xhigh`), GPT-6.2 Astra High (`gpt-6.2-astra-high`) and XHigh (`gpt-6.2-astra-xhigh`), and GPT-6.1 Sol High (`gpt-6.1-sol-high`) and XHigh (`gpt-6.1-sol-xhigh`) are explicit choices for reviews and chat; Enterprise and Edu administrators must enable GPT-6.1 and GPT-6.2 access, and GPT-6.2 requires Codex CLI 0.170.0 or later. GPT-6.1 Terra XHigh (`gpt-6.1-terra-xhigh`) is an explicit balanced choice; Enterprise access depends on workspace administrator controls.
636
636
  - **GitHub Copilot**: Uses Copilot CLI
637
637
  - **OpenCode**: Uses OpenCode CLI (requires model configuration)
638
638
  - **Cursor**: Uses Cursor Agent CLI (streaming output with sandbox mode)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@in-the-loop-labs/pair-review",
3
- "version": "5.4.2",
3
+ "version": "5.4.3",
4
4
  "description": "Your AI-powered code review partner - Close the feedback loop with AI coding agents",
5
5
  "main": "src/server.js",
6
6
  "bin": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pair-review",
3
- "version": "5.4.2",
3
+ "version": "5.4.3",
4
4
  "description": "pair-review app integration — Open PRs and local changes in the pair-review web UI, run server-side AI analysis, and address review feedback. Requires the pair-review MCP server.",
5
5
  "author": {
6
6
  "name": "in-the-loop-labs",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "code-critic",
3
- "version": "5.4.2",
3
+ "version": "5.4.3",
4
4
  "description": "AI-powered code review analysis — Run three-level AI analysis directly in your coding agent. Works standalone, no server required.",
5
5
  "author": {
6
6
  "name": "in-the-loop-labs",
@@ -95,7 +95,7 @@ Omit severity for praise items.
95
95
  "description": "Detailed explanation",
96
96
  "suggestion": "How to fix/improve (omit for praise items)",
97
97
  "confidence": 0.0-1.0,
98
- "reasoning": ["Step-by-step reasoning explaining why this issue was flagged (optional)"]
98
+ "reasoning": ["Concise code evidence and impact supporting this issue (optional)"]
99
99
  }],
100
100
  "summary": "Brief summary of findings"
101
101
  }
@@ -117,7 +117,7 @@ Output JSON with this structure:
117
117
  "description": "Detailed explanation",
118
118
  "suggestion": "How to fix/improve (omit this field for praise items - no action needed)",
119
119
  "confidence": 0.0-1.0,
120
- "reasoning": ["Step-by-step reasoning explaining why this issue was flagged"]
120
+ "reasoning": ["Concise code evidence and impact supporting this issue"]
121
121
  }],
122
122
  "summary": "Brief summary of findings"
123
123
  }
@@ -97,7 +97,7 @@ Omit severity for praise items.
97
97
  "description": "Explanation mentioning why full file context was needed",
98
98
  "suggestion": "How to fix/improve (omit for praise items)",
99
99
  "confidence": 0.0-1.0,
100
- "reasoning": ["Step-by-step reasoning explaining why this issue was flagged (optional)"]
100
+ "reasoning": ["Concise code evidence and impact supporting this issue (optional)"]
101
101
  }],
102
102
  "fileLevelSuggestions": [{
103
103
  "file": "path/to/file",
@@ -107,7 +107,7 @@ Omit severity for praise items.
107
107
  "description": "File-level observation (architecture, organization, naming, etc.)",
108
108
  "suggestion": "How to address (omit for praise items)",
109
109
  "confidence": 0.0-1.0,
110
- "reasoning": ["Step-by-step reasoning explaining why this issue was flagged (optional)"]
110
+ "reasoning": ["Concise code evidence and impact supporting this issue (optional)"]
111
111
  }],
112
112
  "summary": "Brief summary of file context findings"
113
113
  }
@@ -146,7 +146,7 @@ Output JSON with this structure:
146
146
  "description": "Detailed explanation mentioning why full file context was needed",
147
147
  "suggestion": "How to fix/improve based on file context (omit for praise items)",
148
148
  "confidence": 0.0-1.0,
149
- "reasoning": ["Step-by-step reasoning explaining why this issue was flagged"]
149
+ "reasoning": ["Concise code evidence and impact supporting this issue"]
150
150
  }],
151
151
  "fileLevelSuggestions": [{
152
152
  "file": "path/to/file",
@@ -156,7 +156,7 @@ Output JSON with this structure:
156
156
  "description": "Explanation of the file-level observation (architecture, organization, naming, etc.)",
157
157
  "suggestion": "How to address the file-level concern (omit for praise items)",
158
158
  "confidence": 0.0-1.0,
159
- "reasoning": ["Step-by-step reasoning explaining why this issue was flagged"]
159
+ "reasoning": ["Concise code evidence and impact supporting this issue"]
160
160
  }],
161
161
  "summary": "Brief summary of file context findings"
162
162
  }
@@ -134,7 +134,7 @@ Output JSON with this structure:
134
134
  "description": "Detailed explanation mentioning why codebase context was needed",
135
135
  "suggestion": "How to fix/improve based on codebase context (omit for praise items)",
136
136
  "confidence": 0.0-1.0,
137
- "reasoning": ["Step-by-step reasoning explaining why this issue was flagged (optional)"]
137
+ "reasoning": ["Concise code evidence and impact supporting this issue (optional)"]
138
138
  }],
139
139
  "fileLevelSuggestions": [{
140
140
  "file": "path/to/file",
@@ -144,7 +144,7 @@ Output JSON with this structure:
144
144
  "description": "Explanation of the file-level observation from codebase perspective",
145
145
  "suggestion": "How to address the file-level concern (omit for praise items)",
146
146
  "confidence": 0.0-1.0,
147
- "reasoning": ["Step-by-step reasoning explaining why this issue was flagged (optional)"]
147
+ "reasoning": ["Concise code evidence and impact supporting this issue (optional)"]
148
148
  }],
149
149
  "summary": "Brief summary of how these changes connect to and impact the codebase"
150
150
  }
@@ -146,7 +146,7 @@ Output JSON with this structure:
146
146
  "description": "Detailed explanation mentioning why codebase context was needed",
147
147
  "suggestion": "How to fix/improve based on codebase context (omit for praise items)",
148
148
  "confidence": 0.0-1.0,
149
- "reasoning": ["Step-by-step reasoning explaining why this issue was flagged"]
149
+ "reasoning": ["Concise code evidence and impact supporting this issue"]
150
150
  }],
151
151
  "fileLevelSuggestions": [{
152
152
  "file": "path/to/file",
@@ -156,7 +156,7 @@ Output JSON with this structure:
156
156
  "description": "Explanation of the file-level observation from codebase perspective",
157
157
  "suggestion": "How to address the file-level concern (omit for praise items)",
158
158
  "confidence": 0.0-1.0,
159
- "reasoning": ["Step-by-step reasoning explaining why this issue was flagged"]
159
+ "reasoning": ["Concise code evidence and impact supporting this issue"]
160
160
  }],
161
161
  "summary": "Brief summary of how these changes connect to and impact the codebase"
162
162
  }
@@ -50,7 +50,7 @@ Each level provides suggestions as a JSON array with the following schema per it
50
50
  - suggestion: remediation advice
51
51
  - severity: "critical", "medium", or "minor" (omit for praise items)
52
52
  - confidence: 0.0-1.0 score
53
- - reasoning: (optional) array of strings with step-by-step reasoning
53
+ - reasoning: (optional) array of strings with concise code evidence and impact
54
54
  - is_file_level: true if this is a file-level suggestion (no line numbers)
55
55
 
56
56
  **Level 1 - Diff Analysis ([N] suggestions):**
@@ -122,7 +122,7 @@ Output JSON with this structure:
122
122
  "description": "Clear explanation of the issue and why this guidance matters to the human reviewer",
123
123
  "suggestion": "Specific, actionable guidance for the reviewer. For praise items this can be omitted. For other types always include specific, actionable suggestions.",
124
124
  "confidence": 0.0-1.0,
125
- "reasoning": ["Step-by-step reasoning explaining why this issue was flagged (optional)"]
125
+ "reasoning": ["Concise code evidence and impact supporting this issue (optional)"]
126
126
  }],
127
127
  "fileLevelSuggestions": [{
128
128
  "file": "path/to/file",
@@ -132,7 +132,7 @@ Output JSON with this structure:
132
132
  "description": "Explanation of the file-level observation",
133
133
  "suggestion": "How to address the file-level concern (omit for praise items)",
134
134
  "confidence": 0.0-1.0,
135
- "reasoning": ["Step-by-step reasoning explaining why this issue was flagged (optional)"]
135
+ "reasoning": ["Concise code evidence and impact supporting this issue (optional)"]
136
136
  }],
137
137
  "summary": "Formatted markdown summary following the Summary Structure guidance above."
138
138
  }
@@ -50,7 +50,7 @@ Each level provides suggestions as a JSON array with the following schema per it
50
50
  - suggestion: remediation advice
51
51
  - severity: "critical", "medium", or "minor" (omit for praise items)
52
52
  - confidence: 0.0-1.0 score
53
- - reasoning: (optional) array of strings with step-by-step reasoning
53
+ - reasoning: (optional) array of strings with concise code evidence and impact
54
54
  - is_file_level: true if this is a file-level suggestion (no line numbers)
55
55
 
56
56
  **Level 1 - Diff Analysis ([N] suggestions):**
@@ -55,7 +55,7 @@ Each level provides suggestions as a JSON array with the following schema per it
55
55
  - suggestion: remediation advice
56
56
  - severity: "critical", "medium", or "minor" (omit for praise items)
57
57
  - confidence: 0.0-1.0 score
58
- - reasoning: (optional) array of strings with step-by-step reasoning
58
+ - reasoning: (optional) array of strings with concise code evidence and impact
59
59
  - is_file_level: true if this is a file-level suggestion (no line numbers)
60
60
 
61
61
  **Level 1 - Diff Analysis ([N] suggestions):**
@@ -213,7 +213,7 @@ Output JSON with this structure:
213
213
  "description": "Clear explanation of the issue and why this guidance matters to the human reviewer",
214
214
  "suggestion": "Specific, actionable guidance for the reviewer (omit for praise items)",
215
215
  "confidence": 0.0-1.0,
216
- "reasoning": ["Step-by-step reasoning explaining why this issue was flagged"]
216
+ "reasoning": ["Concise code evidence and impact supporting this issue"]
217
217
  }],
218
218
  "fileLevelSuggestions": [{
219
219
  "file": "path/to/file",
@@ -223,7 +223,7 @@ Output JSON with this structure:
223
223
  "description": "Explanation of the file-level observation",
224
224
  "suggestion": "How to address the file-level concern (omit for praise items)",
225
225
  "confidence": 0.0-1.0,
226
- "reasoning": ["Step-by-step reasoning explaining why this issue was flagged"]
226
+ "reasoning": ["Concise code evidence and impact supporting this issue"]
227
227
  }],
228
228
  "summary": "Formatted markdown summary following the Summary Synthesis Guidance above."
229
229
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pair-loop",
3
- "version": "5.4.2",
3
+ "version": "5.4.3",
4
4
  "description": "Agent-orchestrated review loop — implement, review with pair-review multi-model councils via the headless CLI, triage, fix, and repeat until a final review returns no blockers. MCP-independent.",
5
5
  "author": {
6
6
  "name": "in-the-loop-labs",
@@ -17,7 +17,6 @@ class CouncilProgressModal {
17
17
  this._wsUnsub = null;
18
18
  this._onReconnect = null;
19
19
  this.statusCheckInterval = null;
20
- this.isRunningInBackground = false;
21
20
  this.councilConfig = null;
22
21
 
23
22
  // Track per-voice completion state
@@ -93,22 +92,18 @@ class CouncilProgressModal {
93
92
  }
94
93
 
95
94
  /**
96
- * Hide the modal.
95
+ * Hide the modal. Progress monitoring continues so the analyze button
96
+ * still completes when the analysis finishes.
97
97
  */
98
98
  hide() {
99
99
  this.isVisible = false;
100
100
  this.modal.style.display = 'none';
101
-
102
- if (!this.isRunningInBackground) {
103
- this.stopProgressMonitoring();
104
- }
105
101
  }
106
102
 
107
103
  /**
108
104
  * Run analysis in background.
109
105
  */
110
106
  runInBackground() {
111
- this.isRunningInBackground = true;
112
107
  this.hide();
113
108
  }
114
109
 
@@ -116,7 +111,6 @@ class CouncilProgressModal {
116
111
  * Reopen the modal from background execution.
117
112
  */
118
113
  reopenFromBackground() {
119
- this.isRunningInBackground = false;
120
114
  if (this.currentAnalysisId) {
121
115
  // Don't rebuild — just re-show the existing DOM
122
116
  this.isVisible = true;
@@ -1432,7 +1426,6 @@ class CouncilProgressModal {
1432
1426
  if (cancelBtn) {
1433
1427
  cancelBtn.textContent = 'Cancel';
1434
1428
  }
1435
- this.isRunningInBackground = false;
1436
1429
  }
1437
1430
 
1438
1431
  // ---------------------------------------------------------------------------
package/public/js/pr.js CHANGED
@@ -5155,8 +5155,10 @@ class PRManager {
5155
5155
  wrapper.classList.remove('collapsed');
5156
5156
  this.collapsedFiles.delete(filePath);
5157
5157
  } else {
5158
- wrapper.classList.add('collapsed');
5159
- this.collapsedFiles.add(filePath);
5158
+ window.HeaderAnchor.keepHeaderInPlace(header, () => {
5159
+ wrapper.classList.add('collapsed');
5160
+ this.collapsedFiles.add(filePath);
5161
+ });
5160
5162
  }
5161
5163
 
5162
5164
  // Update header state
@@ -5182,9 +5184,11 @@ class PRManager {
5182
5184
  this.viewedFiles.add(filePath);
5183
5185
  // Auto-collapse when marking as viewed
5184
5186
  if (wrapper && !wrapper.classList.contains('collapsed')) {
5185
- wrapper.classList.add('collapsed');
5186
- this.collapsedFiles.add(filePath);
5187
5187
  const header = wrapper.querySelector('.d2h-file-header');
5188
+ window.HeaderAnchor.keepHeaderInPlace(header, () => {
5189
+ wrapper.classList.add('collapsed');
5190
+ this.collapsedFiles.add(filePath);
5191
+ });
5188
5192
  if (header) {
5189
5193
  window.DiffRenderer.updateFileHeaderState(header, false);
5190
5194
  }
@@ -5257,14 +5261,21 @@ class PRManager {
5257
5261
  if (!wrapper) return;
5258
5262
 
5259
5263
  const key = this._contextStateKey(filePath);
5260
- const collapsed = wrapper.classList.toggle('collapsed');
5264
+ const header = wrapper.querySelector('.d2h-file-header');
5265
+ const collapsed = !wrapper.classList.contains('collapsed');
5261
5266
  if (collapsed) {
5267
+ window.HeaderAnchor.keepHeaderInPlace(header, () => {
5268
+ wrapper.classList.add('collapsed');
5269
+ });
5262
5270
  this.collapsedFiles.add(key);
5263
5271
  } else {
5272
+ // Not anchored: a collapsed header partly under the sticky toolbar
5273
+ // drops to the sticky line on expand, and compensating for that would
5274
+ // push the top of the newly revealed body up under it.
5275
+ wrapper.classList.remove('collapsed');
5264
5276
  this.collapsedFiles.delete(key);
5265
5277
  }
5266
5278
 
5267
- const header = wrapper.querySelector('.d2h-file-header');
5268
5279
  if (header) {
5269
5280
  window.DiffRenderer.updateFileHeaderState(header, !collapsed);
5270
5281
  }
@@ -5286,8 +5297,10 @@ class PRManager {
5286
5297
  this.viewedFiles.add(key);
5287
5298
  // Auto-collapse when marking as viewed
5288
5299
  if (wrapper && !wrapper.classList.contains('collapsed')) {
5289
- wrapper.classList.add('collapsed');
5290
- this.collapsedFiles.add(key);
5300
+ window.HeaderAnchor.keepHeaderInPlace(header, () => {
5301
+ wrapper.classList.add('collapsed');
5302
+ this.collapsedFiles.add(key);
5303
+ });
5291
5304
  if (header) {
5292
5305
  window.DiffRenderer.updateFileHeaderState(header, false);
5293
5306
  }
@@ -3,7 +3,7 @@
3
3
  * Canonical category-to-emoji mapping for AI suggestion types.
4
4
  * Used by SuggestionManager and FileCommentManager to format adopted comments.
5
5
  *
6
- * Canonical types from src/ai/prompts/shared/output-schema.js:
6
+ * Canonical types from the output-schema sections in src/ai/prompts/baseline/:
7
7
  * bug|improvement|praise|suggestion|design|performance|security|code-style
8
8
  */
9
9
 
@@ -0,0 +1,38 @@
1
+ // Copyright 2026 Tim Perkins (tjwp) | SPDX-License-Identifier: Apache-2.0
2
+ /**
3
+ * Keeps a file header at the same viewport position across a synchronous
4
+ * change that resizes its file, such as collapsing it.
5
+ *
6
+ * A header stuck to the top of the diff pane belongs to a file the reader is
7
+ * partway through. Collapsing that file shrinks it to just the header, which
8
+ * would leave the header far above the viewport. Scrolling the pane by however
9
+ * far the header moved puts the collapsed header back where it was stuck, with
10
+ * the next file directly below it. A header that wasn't stuck doesn't move, so
11
+ * nothing scrolls.
12
+ *
13
+ * @param {Element|null} header - The file header to hold in place
14
+ * @param {() => T} change - Synchronous change that resizes the header's file
15
+ * @returns {T} the change's return value
16
+ * @template T
17
+ */
18
+ function keepHeaderInPlace(header, change) {
19
+ if (!header) return change();
20
+
21
+ const topBefore = header.getBoundingClientRect().top;
22
+ const result = change();
23
+ const shift = header.getBoundingClientRect().top - topBefore;
24
+
25
+ if (shift !== 0) {
26
+ header.closest('.diff-view')?.scrollBy(0, shift);
27
+ }
28
+
29
+ return result;
30
+ }
31
+
32
+ if (typeof window !== 'undefined') {
33
+ window.HeaderAnchor = { keepHeaderInPlace };
34
+ }
35
+
36
+ if (typeof module !== 'undefined' && module.exports) {
37
+ module.exports = { keepHeaderInPlace };
38
+ }
package/public/local.html CHANGED
@@ -608,6 +608,9 @@
608
608
  <!-- Stable scroll-into-view for lazily rendered diff bodies -->
609
609
  <script src="/js/utils/scroll-into-view.js"></script>
610
610
 
611
+ <!-- Holds a file header in place when its file collapses -->
612
+ <script src="/js/utils/header-anchor.js"></script>
613
+
611
614
  <!-- WebSocket client -->
612
615
  <script src="/js/ws-client.js"></script>
613
616
 
package/public/pr.html CHANGED
@@ -413,6 +413,9 @@
413
413
  <!-- Stable scroll-into-view for lazily rendered diff bodies -->
414
414
  <script src="/js/utils/scroll-into-view.js"></script>
415
415
 
416
+ <!-- Holds a file header in place when its file collapses -->
417
+ <script src="/js/utils/header-anchor.js"></script>
418
+
416
419
  <!-- WebSocket client -->
417
420
  <script src="/js/ws-client.js"></script>
418
421
 
@@ -27,9 +27,13 @@ const BIN_DIR = path.join(__dirname, '..', '..', 'bin');
27
27
  * GPT-6.1 Terra (2026-10-26, $1/$5 per 1M tokens, Codex CLI >= 0.159.0) runs on
28
28
  * Plus, Pro, Business, Enterprise, and Edu, with Enterprise access subject to
29
29
  * workspace availability and administrator controls.
30
+ * GPT-6.2 Sol and GPT-6.2 Astra (2026-11-17; Sol $2/$10, Astra $8/$40 per 1M
31
+ * tokens; Codex CLI >= 0.170.0, which older CLIs reject as model_not_found) run
32
+ * on Plus, Pro, Enterprise, and Edu, with Enterprise and Edu off by default
33
+ * until an administrator enables them.
30
34
  * Selecting a model locally does not grant access. testAvailability() checks
31
35
  * only `codex --version`, and model rejection does not trigger a fallback,
32
- * so GPT-6 and GPT-6.1 remain explicit choices.
36
+ * so GPT-6, GPT-6.1, and GPT-6.2 remain explicit choices.
33
37
  * Each picker entry specifies a reasoning effort explicitly.
34
38
  *
35
39
  * Entries are ordered thorough → balanced → fast. The first balanced entry
@@ -64,15 +68,59 @@ const BIN_DIR = path.join(__dirname, '..', '..', 'bin');
64
68
  */
65
69
  const CODEX_MODELS = [
66
70
  // ── Thorough tier ───────────────────────────────────────────────────────
71
+ {
72
+ id: 'gpt-6.2-sol-high',
73
+ cli_model: 'gpt-6.2-sol',
74
+ extra_args: ['-c', 'model_reasoning_effort="high"'],
75
+ name: 'GPT-6.2 Sol High',
76
+ tier: 'thorough',
77
+ tagline: 'Latest Workhorse',
78
+ description: 'Latest workhorse model for coding and everyday work, with high reasoning effort for demanding reviews and cross-file analysis. Requires GPT-6.2 Sol access and Codex CLI 0.170.0 or later; Enterprise and Edu administrators must enable it during rollout.',
79
+ badge: 'Newest',
80
+ badgeClass: 'badge-power'
81
+ },
82
+ {
83
+ id: 'gpt-6.2-sol-xhigh',
84
+ cli_model: 'gpt-6.2-sol',
85
+ extra_args: ['-c', 'model_reasoning_effort="xhigh"'],
86
+ name: 'GPT-6.2 Sol XHigh',
87
+ tier: 'thorough',
88
+ tagline: 'Latest Workhorse Depth',
89
+ description: 'Latest workhorse model for coding and everyday work, with extra-high reasoning effort for difficult architectural reviews, subtle regressions, and security-sensitive changes. Requires GPT-6.2 Sol access and Codex CLI 0.170.0 or later; Enterprise and Edu administrators must enable it during rollout.',
90
+ badge: 'Extra High',
91
+ badgeClass: 'badge-power'
92
+ },
93
+ {
94
+ id: 'gpt-6.2-astra-high',
95
+ cli_model: 'gpt-6.2-astra',
96
+ extra_args: ['-c', 'model_reasoning_effort="high"'],
97
+ name: 'GPT-6.2 Astra High',
98
+ tier: 'thorough',
99
+ tagline: 'Most Capable',
100
+ description: 'Frontier intelligence for the most demanding coding and professional work, with high reasoning effort for deep cross-file analysis and demanding architectural reviews. Requires GPT-6.2 Astra access and Codex CLI 0.170.0 or later; Enterprise and Edu administrators must enable it during rollout.',
101
+ badge: 'Most Capable',
102
+ badgeClass: 'badge-power'
103
+ },
104
+ {
105
+ id: 'gpt-6.2-astra-xhigh',
106
+ cli_model: 'gpt-6.2-astra',
107
+ extra_args: ['-c', 'model_reasoning_effort="xhigh"'],
108
+ name: 'GPT-6.2 Astra XHigh',
109
+ tier: 'thorough',
110
+ tagline: 'Maximum Depth',
111
+ description: 'Frontier intelligence for the most demanding coding and professional work, with extra-high reasoning effort for concurrency, security-sensitive changes, and large codebase context. Requires GPT-6.2 Astra access and Codex CLI 0.170.0 or later; Enterprise and Edu administrators must enable it during rollout.',
112
+ badge: 'Extra High',
113
+ badgeClass: 'badge-power'
114
+ },
67
115
  {
68
116
  id: 'gpt-6.1-sol-high',
69
117
  cli_model: 'gpt-6.1-sol',
70
118
  extra_args: ['-c', 'model_reasoning_effort="high"'],
71
119
  name: 'GPT-6.1 Sol High',
72
120
  tier: 'thorough',
73
- tagline: 'Latest Workhorse',
74
- description: 'Latest workhorse model for coding and everyday work, with high reasoning effort for demanding reviews and cross-file analysis. Requires GPT-6.1 Sol access; Enterprise and Edu administrators must enable it during rollout.',
75
- badge: 'Newest',
121
+ tagline: 'Previous Workhorse',
122
+ description: 'Previous generation workhorse model for coding and everyday work, with high reasoning effort for demanding reviews and cross-file analysis. Requires GPT-6.1 Sol access; Enterprise and Edu administrators must enable it during rollout.',
123
+ badge: 'Previous Gen',
76
124
  badgeClass: 'badge-power'
77
125
  },
78
126
  {
@@ -81,8 +129,8 @@ const CODEX_MODELS = [
81
129
  extra_args: ['-c', 'model_reasoning_effort="xhigh"'],
82
130
  name: 'GPT-6.1 Sol XHigh',
83
131
  tier: 'thorough',
84
- tagline: 'Latest Workhorse Depth',
85
- description: 'Latest workhorse model for coding and everyday work, with extra-high reasoning effort for difficult architectural reviews, subtle regressions, and security-sensitive changes. Requires GPT-6.1 Sol access; Enterprise and Edu administrators must enable it during rollout.',
132
+ tagline: 'Previous Workhorse Depth',
133
+ description: 'Previous generation workhorse model for coding and everyday work, with extra-high reasoning effort for difficult architectural reviews, subtle regressions, and security-sensitive changes. Requires GPT-6.1 Sol access; Enterprise and Edu administrators must enable it during rollout.',
86
134
  badge: 'Extra High',
87
135
  badgeClass: 'badge-power'
88
136
  },
@@ -92,9 +140,9 @@ const CODEX_MODELS = [
92
140
  extra_args: ['-c', 'model_reasoning_effort="high"'],
93
141
  name: 'GPT-6 Astra High',
94
142
  tier: 'thorough',
95
- tagline: 'Most Capable',
96
- description: 'Frontier intelligence for the most demanding work, with high reasoning effort for deep cross-file analysis and demanding architectural reviews.',
97
- badge: 'Most Capable',
143
+ tagline: 'Previous Gen',
144
+ description: 'Previous generation frontier model for the most demanding work, with high reasoning effort for deep cross-file analysis and demanding architectural reviews.',
145
+ badge: 'Previous Gen',
98
146
  badgeClass: 'badge-power'
99
147
  },
100
148
  {
@@ -103,8 +151,8 @@ const CODEX_MODELS = [
103
151
  extra_args: ['-c', 'model_reasoning_effort="xhigh"'],
104
152
  name: 'GPT-6 Astra XHigh',
105
153
  tier: 'thorough',
106
- tagline: 'Maximum Depth',
107
- description: 'Frontier intelligence for the most demanding work, with extra-high reasoning effort for concurrency, security-sensitive changes, and large codebase context.',
154
+ tagline: 'Previous Gen Depth',
155
+ description: 'Previous generation frontier model for the most demanding work, with extra-high reasoning effort for concurrency, security-sensitive changes, and large codebase context.',
108
156
  badge: 'Extra High',
109
157
  badgeClass: 'badge-power'
110
158
  },
@@ -114,9 +162,9 @@ const CODEX_MODELS = [
114
162
  extra_args: ['-c', 'model_reasoning_effort="high"'],
115
163
  name: 'GPT-6 Sol High',
116
164
  tier: 'thorough',
117
- tagline: 'Previous Gen',
118
- description: 'Previous generation workhorse model, with high reasoning effort for demanding reviews and cross-file analysis. Requires GPT-6 access; Enterprise administrators must enable it during rollout.',
119
- badge: 'Previous Gen',
165
+ tagline: 'Older Workhorse',
166
+ description: 'Older generation workhorse model, with high reasoning effort for demanding reviews and cross-file analysis. Requires GPT-6 access; Enterprise administrators must enable it during rollout.',
167
+ badge: 'Older Gen',
120
168
  badgeClass: 'badge-power'
121
169
  },
122
170
  {
@@ -125,8 +173,8 @@ const CODEX_MODELS = [
125
173
  extra_args: ['-c', 'model_reasoning_effort="xhigh"'],
126
174
  name: 'GPT-6 Sol XHigh',
127
175
  tier: 'thorough',
128
- tagline: 'Previous Gen Depth',
129
- description: 'Previous generation workhorse model, with extra-high reasoning effort for difficult architectural reviews, subtle regressions, and security-sensitive changes. Requires GPT-6 access; Enterprise administrators must enable it during rollout.',
176
+ tagline: 'Older Workhorse Depth',
177
+ description: 'Older generation workhorse model, with extra-high reasoning effort for difficult architectural reviews, subtle regressions, and security-sensitive changes. Requires GPT-6 access; Enterprise administrators must enable it during rollout.',
130
178
  badge: 'Extra High',
131
179
  badgeClass: 'badge-power'
132
180
  },
@@ -137,7 +185,7 @@ const CODEX_MODELS = [
137
185
  name: 'GPT-5.6 Sol High',
138
186
  tier: 'thorough',
139
187
  tagline: 'Older Workhorse',
140
- description: 'Older generation workhorse model, with high reasoning effort for demanding reviews and cross-file analysis. The default while GPT-6 and GPT-6.1 access rolls out.',
188
+ description: 'Older generation workhorse model, with high reasoning effort for demanding reviews and cross-file analysis. The default while GPT-6, GPT-6.1, and GPT-6.2 access rolls out.',
141
189
  badge: 'Recommended',
142
190
  badgeClass: 'badge-recommended',
143
191
  default: true
@@ -65,7 +65,7 @@ Map the tool's output to this exact JSON schema:
65
65
  }
66
66
 
67
67
  Rules:
68
- - Include a "reasoning" array with step-by-step reasoning about how you mapped the tool output
68
+ - Include a "reasoning" array with concise evidence for how you mapped the tool output
69
69
  - Map each review finding to one suggestion object
70
70
  - Use "NEW" for old_or_new (external tools review the new version)
71
71
  - Preserve severity if the tool provides it
@@ -203,6 +203,44 @@ function extractPiEventText(event, seenTexts) {
203
203
  return text;
204
204
  }
205
205
 
206
+ /**
207
+ * Extract the outcome of the last assistant message in a Pi JSONL event.
208
+ *
209
+ * Pi and OMP report a failed model request (for example, a provider refusal)
210
+ * as an assistant message with an `errorMessage`. The CLI writes this message
211
+ * only to stdout, so stderr alone does not explain the failure.
212
+ *
213
+ * Only the last assistant message in the event counts. A later message that
214
+ * succeeded replaces an earlier error, so a turn that the CLI retried
215
+ * successfully does not report its old error. Non-assistant messages and
216
+ * assistant messages whose `errorMessage` is empty or only whitespace give no
217
+ * signal either way and are ignored.
218
+ *
219
+ * @param {Object} event - Parsed Pi event object
220
+ * @returns {{errorMessage: string|null}|null} The last assistant message's
221
+ * outcome (`errorMessage` is null when it succeeded), or null when the event
222
+ * carries no assistant message
223
+ */
224
+ function extractPiEventError(event) {
225
+ let messages = [];
226
+ if (event?.type === 'agent_end' && Array.isArray(event.messages)) {
227
+ messages = event.messages;
228
+ } else if (event?.type === 'message_end' || event?.type === 'turn_end') {
229
+ messages = [event.message];
230
+ }
231
+
232
+ let outcome = null;
233
+ for (const msg of messages) {
234
+ if (msg?.role !== 'assistant') continue;
235
+ if (msg.errorMessage === undefined || msg.errorMessage === null) {
236
+ outcome = { errorMessage: null };
237
+ } else if (typeof msg.errorMessage === 'string' && msg.errorMessage.trim()) {
238
+ outcome = { errorMessage: msg.errorMessage.trim() };
239
+ }
240
+ }
241
+ return outcome;
242
+ }
243
+
206
244
  /**
207
245
  * Accumulate only raw lines that could plausibly help the direct JSON fallback.
208
246
  * Pi JSONL event envelopes are intentionally excluded because they are noisy
@@ -251,7 +289,7 @@ function accumulatePiRawFallbackLine(line, state, levelPrefix, parseResult, cliN
251
289
  * Parse a single Pi JSONL line into accumulated assistant text.
252
290
  *
253
291
  * @param {string} line - One JSONL line
254
- * @param {{textContent: string, seenTexts: Set<string>, rawOutput: string, rawOutputTruncated: boolean}} state - Parse state
292
+ * @param {{textContent: string, seenTexts: Set<string>, rawOutput: string, rawOutputTruncated: boolean, errorMessage?: string|null}} state - Parse state
255
293
  * @param {string} levelPrefix - Prefix used in logs
256
294
  * @param {string} [cliName='Pi'] - CLI name used in log messages
257
295
  */
@@ -262,6 +300,8 @@ function accumulatePiResponseLine(line, state, levelPrefix, cliName = 'Pi') {
262
300
  try {
263
301
  const event = JSON.parse(line);
264
302
  state.textContent += extractPiEventText(event, state.seenTexts);
303
+ const outcome = extractPiEventError(event);
304
+ if (outcome) state.errorMessage = outcome.errorMessage;
265
305
  parseResult = { status: 'parsed', value: event };
266
306
  } catch {
267
307
  logger.debug(`${levelPrefix} Skipping malformed JSONL line: ${line.substring(0, 100)}`);
@@ -527,6 +567,7 @@ module.exports = {
527
567
  appendHeadTailBuffer,
528
568
  formatHeadTailBuffer,
529
569
  extractPiEventText,
570
+ extractPiEventError,
530
571
  accumulatePiRawFallbackLine,
531
572
  accumulatePiResponseLine,
532
573
  appendPiChunkToLineBuffer,
@@ -132,7 +132,8 @@ class PiStyleProvider extends AIProvider {
132
132
  textContent: '',
133
133
  seenTexts: new Set(),
134
134
  rawOutput: '',
135
- rawOutputTruncated: false
135
+ rawOutputTruncated: false,
136
+ errorMessage: null
136
137
  };
137
138
 
138
139
  const settle = (fn, value) => {
@@ -224,6 +225,15 @@ class PiStyleProvider extends AIProvider {
224
225
  return;
225
226
  }
226
227
 
228
+ // Process any remaining buffered line before the exit check, so that a
229
+ // final unterminated event can still supply the model error message.
230
+ if (lineBufferState.buffer.trim()) {
231
+ lineCount++;
232
+ emitStreamLine(lineBufferState.buffer);
233
+ this.logStreamLine(lineBufferState.buffer, lineCount, levelPrefix);
234
+ accumulatePiResponseLine(lineBufferState.buffer, responseState, levelPrefix, this.cliName);
235
+ }
236
+
227
237
  const stderr = formatHeadTailBuffer(stderrCapture);
228
238
 
229
239
  // Always log stderr if present
@@ -237,18 +247,15 @@ class PiStyleProvider extends AIProvider {
237
247
 
238
248
  if (code !== 0) {
239
249
  logger.error(`${levelPrefix} ${this.cliName} CLI exited with code ${code}`);
240
- settle(reject, new Error(`${levelPrefix} ${this.cliName} CLI exited with code ${code}: ${stderr}`));
250
+ // The model error (for example, a provider refusal) is only on stdout.
251
+ if (responseState.errorMessage) {
252
+ logger.error(`${levelPrefix} ${this.cliName} model error: ${responseState.errorMessage}`);
253
+ }
254
+ const details = [responseState.errorMessage, stderr.trim()].filter(Boolean).join('\n');
255
+ settle(reject, new Error(`${levelPrefix} ${this.cliName} CLI exited with code ${code}: ${details}`));
241
256
  return;
242
257
  }
243
258
 
244
- // Process any remaining buffered line
245
- if (lineBufferState.buffer.trim()) {
246
- lineCount++;
247
- emitStreamLine(lineBufferState.buffer);
248
- this.logStreamLine(lineBufferState.buffer, lineCount, levelPrefix);
249
- accumulatePiResponseLine(lineBufferState.buffer, responseState, levelPrefix, this.cliName);
250
- }
251
-
252
259
  logger.info(`${levelPrefix} ${this.cliName} CLI completed - received ${lineCount} JSONL events`);
253
260
 
254
261
  // Parse the JSONL response
@@ -270,6 +277,14 @@ class PiStyleProvider extends AIProvider {
270
277
  }
271
278
 
272
279
  settle(resolve, parsed.data);
280
+ } else if (responseState.errorMessage) {
281
+ // The CLI exited 0 but the final model request failed. A later
282
+ // successful assistant message clears errorMessage, so it is only set
283
+ // here when the run ended on the error. Any earlier assistant text is
284
+ // pre-tool narration, not a review to extract, so the LLM extraction
285
+ // fallback would only cost a model call and hide the real cause.
286
+ logger.error(`${levelPrefix} ${this.cliName} model error: ${responseState.errorMessage}`);
287
+ settle(reject, new Error(`${levelPrefix} ${this.cliName} model error: ${responseState.errorMessage}`));
273
288
  } else {
274
289
  // Regex extraction failed, try LLM-based extraction as fallback
275
290
  logger.warn(`${levelPrefix} Regex extraction failed: ${parsed.error}`);
@@ -149,7 +149,7 @@ Output JSON with this structure:
149
149
  "description": "Detailed explanation",
150
150
  "suggestion": "How to fix/improve (omit for praise)",
151
151
  "confidence": 0.0-1.0,
152
- "reasoning": ["Step-by-step reasoning explaining why this issue was flagged (optional)"]
152
+ "reasoning": ["Concise code evidence and impact supporting this issue (optional)"]
153
153
  }
154
154
  ],
155
155
  "fileLevelSuggestions": [{
@@ -160,7 +160,7 @@ Output JSON with this structure:
160
160
  "description": "Explanation of the file-level observation",
161
161
  "suggestion": "How to address the file-level concern (omit for praise items)",
162
162
  "confidence": 0.0-1.0,
163
- "reasoning": ["Step-by-step reasoning explaining why this issue was flagged (optional)"]
163
+ "reasoning": ["Concise code evidence and impact supporting this issue (optional)"]
164
164
  }],
165
165
  "summary": "Formatted markdown summary following the Summary Synthesis guidance above."
166
166
  }
@@ -204,7 +204,7 @@ Output JSON with this structure:
204
204
  "description": "Detailed explanation",
205
205
  "suggestion": "How to fix/improve (omit for praise)",
206
206
  "confidence": 0.0-1.0,
207
- "reasoning": ["Step-by-step reasoning explaining why this issue was flagged"]
207
+ "reasoning": ["Concise code evidence and impact supporting this issue"]
208
208
  }
209
209
  ],
210
210
  "fileLevelSuggestions": [{
@@ -215,7 +215,7 @@ Output JSON with this structure:
215
215
  "description": "Explanation of the file-level observation",
216
216
  "suggestion": "How to address the file-level concern (omit for praise items)",
217
217
  "confidence": 0.0-1.0,
218
- "reasoning": ["Step-by-step reasoning explaining why this issue was flagged"]
218
+ "reasoning": ["Concise code evidence and impact supporting this issue"]
219
219
  }],
220
220
  "summary": "Formatted markdown summary following the Summary Synthesis Guidance above."
221
221
  }
@@ -125,7 +125,7 @@ Omit severity for praise items.
125
125
  "description": "Detailed explanation",
126
126
  "suggestion": "How to fix/improve (omit for praise items)",
127
127
  "confidence": 0.0-1.0,
128
- "reasoning": ["Step-by-step reasoning explaining why this issue was flagged (optional)"]
128
+ "reasoning": ["Concise code evidence and impact supporting this issue (optional)"]
129
129
  }],
130
130
  "summary": "Brief summary of findings"
131
131
  }
@@ -149,7 +149,7 @@ Output JSON with this structure:
149
149
  "description": "Detailed explanation",
150
150
  "suggestion": "How to fix/improve (omit this field for praise items - no action needed)",
151
151
  "confidence": 0.0-1.0,
152
- "reasoning": ["Step-by-step reasoning explaining why this issue was flagged"]
152
+ "reasoning": ["Concise code evidence and impact supporting this issue"]
153
153
  }],
154
154
  "summary": "Brief summary of findings"
155
155
  }
@@ -123,7 +123,7 @@ Omit severity for praise items.
123
123
  "description": "Explanation mentioning why full file context was needed",
124
124
  "suggestion": "How to fix/improve (omit for praise items)",
125
125
  "confidence": 0.0-1.0,
126
- "reasoning": ["Step-by-step reasoning explaining why this issue was flagged (optional)"]
126
+ "reasoning": ["Concise code evidence and impact supporting this issue (optional)"]
127
127
  }],
128
128
  "fileLevelSuggestions": [{
129
129
  "file": "path/to/file",
@@ -133,7 +133,7 @@ Omit severity for praise items.
133
133
  "description": "File-level observation (architecture, organization, naming, etc.)",
134
134
  "suggestion": "How to address (omit for praise items)",
135
135
  "confidence": 0.0-1.0,
136
- "reasoning": ["Step-by-step reasoning explaining why this issue was flagged (optional)"]
136
+ "reasoning": ["Concise code evidence and impact supporting this issue (optional)"]
137
137
  }],
138
138
  "summary": "Brief summary of file context findings"
139
139
  }
@@ -180,7 +180,7 @@ Output JSON with this structure:
180
180
  "description": "Detailed explanation mentioning why full file context was needed",
181
181
  "suggestion": "How to fix/improve based on file context (omit for praise items)",
182
182
  "confidence": 0.0-1.0,
183
- "reasoning": ["Step-by-step reasoning explaining why this issue was flagged"]
183
+ "reasoning": ["Concise code evidence and impact supporting this issue"]
184
184
  }],
185
185
  "fileLevelSuggestions": [{
186
186
  "file": "path/to/file",
@@ -190,7 +190,7 @@ Output JSON with this structure:
190
190
  "description": "Explanation of the file-level observation (architecture, organization, naming, etc.)",
191
191
  "suggestion": "How to address the file-level concern (omit for praise items)",
192
192
  "confidence": 0.0-1.0,
193
- "reasoning": ["Step-by-step reasoning explaining why this issue was flagged"]
193
+ "reasoning": ["Concise code evidence and impact supporting this issue"]
194
194
  }],
195
195
  "summary": "Brief summary of file context findings"
196
196
  }
@@ -147,7 +147,7 @@ Output JSON with this structure:
147
147
  "description": "Detailed explanation mentioning why codebase context was needed",
148
148
  "suggestion": "How to fix/improve based on codebase context (omit for praise items)",
149
149
  "confidence": 0.0-1.0,
150
- "reasoning": ["Step-by-step reasoning explaining why this issue was flagged (optional)"]
150
+ "reasoning": ["Concise code evidence and impact supporting this issue (optional)"]
151
151
  }],
152
152
  "fileLevelSuggestions": [{
153
153
  "file": "path/to/file",
@@ -157,7 +157,7 @@ Output JSON with this structure:
157
157
  "description": "Explanation of the file-level observation from codebase perspective",
158
158
  "suggestion": "How to address the file-level concern (omit for praise items)",
159
159
  "confidence": 0.0-1.0,
160
- "reasoning": ["Step-by-step reasoning explaining why this issue was flagged (optional)"]
160
+ "reasoning": ["Concise code evidence and impact supporting this issue (optional)"]
161
161
  }],
162
162
  "summary": "Brief summary of how these changes connect to and impact the codebase"
163
163
  }
@@ -170,7 +170,7 @@ Output JSON with this structure:
170
170
  "description": "Detailed explanation mentioning why codebase context was needed",
171
171
  "suggestion": "How to fix/improve based on codebase context (omit for praise items)",
172
172
  "confidence": 0.0-1.0,
173
- "reasoning": ["Step-by-step reasoning explaining why this issue was flagged"]
173
+ "reasoning": ["Concise code evidence and impact supporting this issue"]
174
174
  }],
175
175
  "fileLevelSuggestions": [{
176
176
  "file": "path/to/file",
@@ -180,7 +180,7 @@ Output JSON with this structure:
180
180
  "description": "Explanation of the file-level observation from codebase perspective",
181
181
  "suggestion": "How to address the file-level concern (omit for praise items)",
182
182
  "confidence": 0.0-1.0,
183
- "reasoning": ["Step-by-step reasoning explaining why this issue was flagged"]
183
+ "reasoning": ["Concise code evidence and impact supporting this issue"]
184
184
  }],
185
185
  "summary": "Brief summary of how these changes connect to and impact the codebase"
186
186
  }
@@ -149,7 +149,7 @@ Output JSON with this structure:
149
149
  "description": "Clear explanation of the issue and why this guidance matters to the human reviewer",
150
150
  "suggestion": "Specific, actionable guidance for the reviewer. For praise items this can be omitted. For other types always include specific, actionable suggestions.",
151
151
  "confidence": 0.0-1.0,
152
- "reasoning": ["Step-by-step reasoning explaining why this issue was flagged (optional)"]
152
+ "reasoning": ["Concise code evidence and impact supporting this issue (optional)"]
153
153
  }],
154
154
  "fileLevelSuggestions": [{
155
155
  "file": "path/to/file",
@@ -159,7 +159,7 @@ Output JSON with this structure:
159
159
  "description": "Explanation of the file-level observation",
160
160
  "suggestion": "How to address the file-level concern (omit for praise items)",
161
161
  "confidence": 0.0-1.0,
162
- "reasoning": ["Step-by-step reasoning explaining why this issue was flagged (optional)"]
162
+ "reasoning": ["Concise code evidence and impact supporting this issue (optional)"]
163
163
  }],
164
164
  "summary": "Formatted markdown summary following the Summary Structure guidance above."
165
165
  }
@@ -255,7 +255,7 @@ Output JSON with this structure:
255
255
  "description": "Clear explanation of the issue and why this guidance matters to the human reviewer",
256
256
  "suggestion": "Specific, actionable guidance for the reviewer (omit for praise items)",
257
257
  "confidence": 0.0-1.0,
258
- "reasoning": ["Step-by-step reasoning explaining why this issue was flagged"]
258
+ "reasoning": ["Concise code evidence and impact supporting this issue"]
259
259
  }],
260
260
  "fileLevelSuggestions": [{
261
261
  "file": "path/to/file",
@@ -265,7 +265,7 @@ Output JSON with this structure:
265
265
  "description": "Explanation of the file-level observation",
266
266
  "suggestion": "How to address the file-level concern (omit for praise items)",
267
267
  "confidence": 0.0-1.0,
268
- "reasoning": ["Step-by-step reasoning explaining why this issue was flagged"]
268
+ "reasoning": ["Concise code evidence and impact supporting this issue"]
269
269
  }],
270
270
  "summary": "Formatted markdown summary following the Summary Synthesis Guidance above."
271
271
  }
@@ -1,12 +1,10 @@
1
1
  // Copyright 2026 Tim Perkins (tjwp) | SPDX-License-Identifier: Apache-2.0
2
2
  /**
3
- * Output schema section - shared across prompt types
3
+ * Output schema documentation shared across prompt types.
4
4
  *
5
- * This section defines the JSON structure for AI responses.
6
- * It is LOCKED and cannot be modified by variants.
7
- *
8
- * CRITICAL: Output schemas are sacred - they must be identical across
9
- * all providers to ensure consistent parsing.
5
+ * Each baseline prompt defines its own locked `output-schema` section inline
6
+ * (see src/ai/prompts/baseline/). This module holds only the input schema docs
7
+ * that the orchestration prompts embed to describe the suggestions they receive.
10
8
  */
11
9
 
12
10
  /**
@@ -24,202 +22,9 @@ const ORCHESTRATION_INPUT_SCHEMA_DOCS = `Each level provides suggestions as a JS
24
22
  - suggestion: remediation advice
25
23
  - severity: "critical", "medium", or "minor" (omit for praise items)
26
24
  - confidence: 0.0-1.0 score
27
- - reasoning: (optional) array of strings with step-by-step reasoning
25
+ - reasoning: (optional) array of strings with concise code evidence and impact
28
26
  - is_file_level: true if this is a file-level suggestion (no line numbers)`;
29
27
 
30
- /**
31
- * Level 1 output schema (diff analysis - changes in isolation)
32
- */
33
- const LEVEL1_OUTPUT_SCHEMA = {
34
- level: 1,
35
- suggestions: [{
36
- file: 'path/to/file',
37
- line_start: 42,
38
- line_end: 42,
39
- old_or_new: 'NEW',
40
- type: 'bug|improvement|praise|suggestion|design|performance|security|code-style',
41
- severity: 'critical|medium|minor (omit for praise)',
42
- title: 'Brief title',
43
- description: 'Detailed explanation',
44
- suggestion: 'How to fix/improve (omit this field for praise items - no action needed)',
45
- confidence: '0.0-1.0',
46
- reasoning: ['Step 1: ...', 'Step 2: ...']
47
- }],
48
- summary: 'Brief summary of findings'
49
- };
50
-
51
- /**
52
- * Level 2 output schema (file context analysis)
53
- */
54
- const LEVEL2_OUTPUT_SCHEMA = {
55
- level: 2,
56
- suggestions: [{
57
- file: 'path/to/file',
58
- line_start: 42,
59
- line_end: 42,
60
- old_or_new: 'NEW',
61
- type: 'bug|improvement|praise|suggestion|design|performance|security|code-style',
62
- severity: 'critical|medium|minor (omit for praise)',
63
- title: 'Brief title',
64
- description: 'Detailed explanation mentioning why full file context was needed',
65
- suggestion: 'How to fix/improve based on file context (omit for praise items)',
66
- confidence: 0.8,
67
- reasoning: ['Step 1: ...', 'Step 2: ...']
68
- }],
69
- fileLevelSuggestions: [{
70
- file: 'path/to/file',
71
- type: 'bug|improvement|praise|suggestion|design|performance|security|code-style',
72
- severity: 'critical|medium|minor (omit for praise)',
73
- title: 'Brief title describing file-level concern',
74
- description: 'Explanation of the file-level observation (architecture, organization, naming, etc.)',
75
- suggestion: 'How to address the file-level concern (omit for praise items)',
76
- confidence: 0.8,
77
- reasoning: ['Step 1: ...', 'Step 2: ...']
78
- }],
79
- summary: 'Brief summary of file context findings'
80
- };
81
-
82
- /**
83
- * Level 3 output schema (codebase context analysis)
84
- */
85
- const LEVEL3_OUTPUT_SCHEMA = {
86
- level: 3,
87
- suggestions: [{
88
- file: 'path/to/file',
89
- line_start: 42,
90
- line_end: 42,
91
- old_or_new: 'NEW',
92
- type: 'bug|improvement|praise|suggestion|design|performance|security|code-style',
93
- severity: 'critical|medium|minor (omit for praise)',
94
- title: 'Brief title',
95
- description: 'Detailed explanation mentioning why codebase context was needed',
96
- suggestion: 'How to fix/improve based on codebase context (omit for praise items)',
97
- confidence: '0.0-1.0',
98
- reasoning: ['Step 1: ...', 'Step 2: ...']
99
- }],
100
- fileLevelSuggestions: [{
101
- file: 'path/to/file',
102
- type: 'bug|improvement|praise|suggestion|design|performance|security|code-style',
103
- severity: 'critical|medium|minor (omit for praise)',
104
- title: 'Brief title describing file-level concern',
105
- description: 'Explanation of the file-level observation from codebase perspective',
106
- suggestion: 'How to address the file-level concern (omit for praise items)',
107
- confidence: '0.0-1.0',
108
- reasoning: ['Step 1: ...', 'Step 2: ...']
109
- }],
110
- summary: 'Brief summary of how these changes connect to and impact the codebase'
111
- };
112
-
113
- /**
114
- * Orchestration output schema (curated multi-level analysis)
115
- */
116
- const ORCHESTRATION_OUTPUT_SCHEMA = {
117
- level: 'orchestrated',
118
- suggestions: [{
119
- file: 'path/to/file',
120
- line_start: 42,
121
- line_end: 42,
122
- old_or_new: 'NEW',
123
- type: 'bug|improvement|praise|suggestion|design|performance|security|code-style',
124
- severity: 'critical|medium|minor (omit for praise)',
125
- title: 'Brief title describing the curated insight',
126
- description: 'Clear explanation of the issue and why this guidance matters to the human reviewer',
127
- suggestion: 'Specific, actionable guidance for the reviewer (omit for praise items)',
128
- confidence: '0.0-1.0',
129
- reasoning: ['Step 1: ...', 'Step 2: ...']
130
- }],
131
- fileLevelSuggestions: [{
132
- file: 'path/to/file',
133
- type: 'bug|improvement|praise|suggestion|design|performance|security|code-style',
134
- severity: 'critical|medium|minor (omit for praise)',
135
- title: 'Brief title describing file-level concern',
136
- description: 'Explanation of the file-level observation',
137
- suggestion: 'How to address the file-level concern (omit for praise items)',
138
- confidence: '0.0-1.0',
139
- reasoning: ['Step 1: ...', 'Step 2: ...']
140
- }],
141
- summary: 'Brief summary of orchestration results and key patterns found'
142
- };
143
-
144
- /**
145
- * Helper to build a locked output schema section
146
- * @param {Object} schema - The output schema object
147
- * @returns {Object} Section definition
148
- */
149
- function buildOutputSchemaSection(schema) {
150
- return {
151
- name: 'output-schema',
152
- locked: true,
153
- content: `## Output Format
154
-
155
- ### CRITICAL OUTPUT REQUIREMENT
156
- Output ONLY valid JSON with no additional text, explanations, or markdown code blocks. Do not wrap the JSON in \`\`\`json blocks. The response must start with { and end with }.
157
-
158
- Output JSON with this structure:
159
- ${JSON.stringify(schema, null, 2)}
160
-
161
- ### GitHub Suggestion Syntax
162
- When suggesting a specific change, **embed** a GitHub suggestion block within the "suggestion" field:
163
-
164
- \`\`\`suggestion
165
- replacement content here
166
- \`\`\`
167
-
168
- The content inside the block is the complete replacement for the commented line(s). Do not include explanation inside the block — any explanation should appear as plain text outside it. For non-specific suggestions, use plain text only.`
169
- };
170
- }
171
-
172
- /**
173
- * Section definition for output schema (Level 1)
174
- */
175
- const level1OutputSchemaSection = buildOutputSchemaSection(LEVEL1_OUTPUT_SCHEMA);
176
-
177
- /**
178
- * Section definition for output schema (Level 2)
179
- * @deprecated Use getOutputSchemaSection(2) instead
180
- */
181
- const outputSchemaSection = buildOutputSchemaSection(LEVEL2_OUTPUT_SCHEMA);
182
-
183
- /**
184
- * Section definition for output schema (Level 3)
185
- */
186
- const level3OutputSchemaSection = buildOutputSchemaSection(LEVEL3_OUTPUT_SCHEMA);
187
-
188
- /**
189
- * Section definition for output schema (Orchestration)
190
- */
191
- const orchestrationOutputSchemaSection = buildOutputSchemaSection(ORCHESTRATION_OUTPUT_SCHEMA);
192
-
193
- /**
194
- * Get the output schema section for a specific level
195
- * @param {number|string} level - Analysis level (1, 2, 3, or 'orchestration')
196
- * @returns {Object} Section definition
197
- */
198
- function getOutputSchemaSection(level) {
199
- if (level === 1) {
200
- return level1OutputSchemaSection;
201
- }
202
- if (level === 2) {
203
- return outputSchemaSection;
204
- }
205
- if (level === 3) {
206
- return level3OutputSchemaSection;
207
- }
208
- if (level === 'orchestration') {
209
- return orchestrationOutputSchemaSection;
210
- }
211
- throw new Error(`Output schema for level ${level} not yet implemented`);
212
- }
213
-
214
28
  module.exports = {
215
- LEVEL1_OUTPUT_SCHEMA,
216
- LEVEL2_OUTPUT_SCHEMA,
217
- LEVEL3_OUTPUT_SCHEMA,
218
- ORCHESTRATION_OUTPUT_SCHEMA,
219
- ORCHESTRATION_INPUT_SCHEMA_DOCS,
220
- outputSchemaSection,
221
- level1OutputSchemaSection,
222
- level3OutputSchemaSection,
223
- orchestrationOutputSchemaSection,
224
- getOutputSchemaSection
29
+ ORCHESTRATION_INPUT_SCHEMA_DOCS
225
30
  };
@@ -3,7 +3,7 @@
3
3
  * Canonical category-to-emoji mapping for AI suggestion types.
4
4
  * Used by server-side code to format adopted comments.
5
5
  *
6
- * Canonical types from src/ai/prompts/shared/output-schema.js:
6
+ * Canonical types from the output-schema sections in src/ai/prompts/baseline/:
7
7
  * bug|improvement|praise|suggestion|design|performance|security|code-style
8
8
  */
9
9