@simonren/quorum 0.11.1 → 0.12.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 +2 -2
- package/commands/multi-consult.md +1 -1
- package/commands/multi-review.md +2 -2
- package/dist/adapters/claude.js +3 -1
- package/dist/adapters/codex.js +4 -1
- package/dist/adapters/gemini.d.ts +31 -3
- package/dist/adapters/gemini.js +97 -26
- package/dist/command-hashes.d.ts +9 -0
- package/dist/command-hashes.js +40 -0
- package/dist/commands.d.ts +51 -5
- package/dist/commands.js +215 -30
- package/dist/config.d.ts +32 -28
- package/dist/config.js +7 -5
- package/dist/consult-prompt.js +5 -4
- package/dist/decoders/agy.d.ts +26 -0
- package/dist/decoders/agy.js +44 -0
- package/dist/decoders/index.d.ts +2 -0
- package/dist/decoders/index.js +1 -0
- package/dist/doctor.d.ts +9 -0
- package/dist/doctor.js +116 -3
- package/dist/executor.d.ts +10 -0
- package/dist/executor.js +50 -9
- package/dist/handoff.js +13 -13
- package/dist/index.d.ts +2 -1
- package/dist/index.js +16 -10
- package/dist/server.js +18 -0
- package/dist/tools/consult.js +3 -3
- package/dist/tools/review.js +7 -7
- package/package.json +1 -1
package/dist/doctor.js
CHANGED
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Also backs the start-up status log on stderr.
|
|
5
5
|
*/
|
|
6
|
-
import { existsSync } from 'fs';
|
|
6
|
+
import { existsSync, readFileSync } from 'fs';
|
|
7
|
+
import { homedir } from 'os';
|
|
8
|
+
import { join } from 'path';
|
|
7
9
|
import { getAllAdapters } from './adapters/index.js';
|
|
8
10
|
import { CliAdapter } from './adapters/cli-adapter.js';
|
|
9
11
|
import { getConfig, getConfigPath } from './config.js';
|
|
@@ -63,16 +65,113 @@ export async function logCliStatus() {
|
|
|
63
65
|
if (!statuses.some((s) => s.enabled && s.available)) {
|
|
64
66
|
console.error('[quorum] Warning: no reviewer CLI available. Install codex, agy, or claude — or run `quorum doctor`.');
|
|
65
67
|
}
|
|
68
|
+
for (const w of checkCodexHostConfig())
|
|
69
|
+
console.error(`[quorum] Warning: ${w}`);
|
|
70
|
+
for (const w of agyWarnings())
|
|
71
|
+
console.error(`[quorum] Warning: ${w}`);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* agy's `toolPermission: always-proceed` approves the model's own requests to
|
|
75
|
+
* run a command outside the terminal sandbox, so `--sandbox` stops nothing.
|
|
76
|
+
* Under `proceed-in-sandbox` sandboxed commands still run unasked and print
|
|
77
|
+
* mode denies the bypass. agy has no per-run flag for this, so it is the
|
|
78
|
+
* user's setting to change.
|
|
79
|
+
*/
|
|
80
|
+
export function checkAgyToolPermission(settingsPath = join(homedir(), '.gemini', 'antigravity-cli', 'settings.json')) {
|
|
81
|
+
try {
|
|
82
|
+
const { toolPermission } = JSON.parse(readFileSync(settingsPath, 'utf-8'));
|
|
83
|
+
if (toolPermission !== 'always-proceed')
|
|
84
|
+
return [];
|
|
85
|
+
}
|
|
86
|
+
catch {
|
|
87
|
+
return [];
|
|
88
|
+
}
|
|
89
|
+
return [`${settingsPath}: toolPermission is "always-proceed", so agy lets the Gemini reviewer run commands outside --sandbox without asking. Set it to "proceed-in-sandbox".`];
|
|
90
|
+
}
|
|
91
|
+
function agyWarnings() {
|
|
92
|
+
return getConfig().gemini.enabled ? checkAgyToolPermission() : [];
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Codex kills an MCP tool call at `tool_timeout_sec` (default 60) and gives up
|
|
96
|
+
* on start-up at `startup_timeout_sec` (default 10). A panel run takes minutes
|
|
97
|
+
* and `npx -y` on a cold cache takes more than ten seconds, so a Codex host
|
|
98
|
+
* that has not raised both will fail every call with an opaque client timeout.
|
|
99
|
+
* Claude Code has no comparable cap, so this check only fires for Codex.
|
|
100
|
+
*/
|
|
101
|
+
/** Codex's home, honouring $CODEX_HOME like `codex-liveness.ts` does. */
|
|
102
|
+
function codexHome() {
|
|
103
|
+
return process.env.CODEX_HOME?.trim() || join(homedir(), '.codex');
|
|
104
|
+
}
|
|
105
|
+
export function checkCodexHostConfig(configPath = join(codexHome(), 'config.toml')) {
|
|
106
|
+
if (!existsSync(configPath))
|
|
107
|
+
return [];
|
|
108
|
+
let toml;
|
|
109
|
+
try {
|
|
110
|
+
toml = readFileSync(configPath, 'utf-8');
|
|
111
|
+
}
|
|
112
|
+
catch {
|
|
113
|
+
return [];
|
|
114
|
+
}
|
|
115
|
+
const scoped = quorumServerToml(toml);
|
|
116
|
+
if (scoped === null)
|
|
117
|
+
return [];
|
|
118
|
+
const warnings = [];
|
|
119
|
+
const toolTimeout = readSeconds(scoped, 'tool_timeout_sec');
|
|
120
|
+
if (toolTimeout === null) {
|
|
121
|
+
warnings.push(`${configPath}: the quorum MCP server has no tool_timeout_sec — Codex will abort every call after 60s. Set tool_timeout_sec = 3600.`);
|
|
122
|
+
}
|
|
123
|
+
else if (toolTimeout < 600) {
|
|
124
|
+
warnings.push(`${configPath}: the quorum MCP server has tool_timeout_sec = ${toolTimeout}, below a panel run. Set tool_timeout_sec = 3600.`);
|
|
125
|
+
}
|
|
126
|
+
const startupTimeout = readSeconds(scoped, 'startup_timeout_sec');
|
|
127
|
+
if (startupTimeout === null || startupTimeout < 30) {
|
|
128
|
+
warnings.push(`${configPath}: the quorum MCP server has startup_timeout_sec under 30s — a cold \`npx -y\` fetch will time out. Set startup_timeout_sec = 60.`);
|
|
129
|
+
}
|
|
130
|
+
return warnings;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Everything TOML says about `mcp_servers.quorum`, in whichever of the three
|
|
134
|
+
* spellings the file uses, or null when quorum is not registered with Codex.
|
|
135
|
+
*
|
|
136
|
+
* [mcp_servers.quorum] <- what `codex mcp add` writes
|
|
137
|
+
* mcp_servers.quorum = { ... } <- inline table
|
|
138
|
+
* mcp_servers.quorum.key = value <- dotted keys
|
|
139
|
+
*
|
|
140
|
+
* Scoping matters more than completeness here: reading another server's
|
|
141
|
+
* timeouts as quorum's would suppress a warning the user needs.
|
|
142
|
+
*/
|
|
143
|
+
function quorumServerToml(toml) {
|
|
144
|
+
const parts = [];
|
|
145
|
+
// Table header through to the next header, indented or not. Must not stop at
|
|
146
|
+
// the `[` inside `args = [...]`.
|
|
147
|
+
const section = toml.match(/^[ \t]*\[mcp_servers\.quorum\][^\n]*\n(?:(?![ \t]*\[)[^\n]*\n?)*/m);
|
|
148
|
+
if (section)
|
|
149
|
+
parts.push(section[0]);
|
|
150
|
+
const inline = toml.match(/^[ \t]*mcp_servers\.quorum[ \t]*=[ \t]*\{([^}]*)\}/m);
|
|
151
|
+
if (inline)
|
|
152
|
+
parts.push(inline[1].replace(/,/g, '\n'));
|
|
153
|
+
for (const m of toml.matchAll(/^[ \t]*mcp_servers\.quorum\.([A-Za-z_][\w-]*)[ \t]*=[ \t]*([^\n]*)$/gm)) {
|
|
154
|
+
parts.push(`${m[1]} = ${m[2]}`);
|
|
155
|
+
}
|
|
156
|
+
return parts.length > 0 ? parts.join('\n') : null;
|
|
157
|
+
}
|
|
158
|
+
/** A bare integer value for `key`; TOML allows `1_000`. */
|
|
159
|
+
function readSeconds(scoped, key) {
|
|
160
|
+
const m = scoped.match(new RegExp(`^[ \\t]*${key}[ \\t]*=[ \\t]*([0-9_]+)`, 'm'));
|
|
161
|
+
if (!m)
|
|
162
|
+
return null;
|
|
163
|
+
const n = Number(m[1].replace(/_/g, ''));
|
|
164
|
+
return Number.isFinite(n) ? n : null;
|
|
66
165
|
}
|
|
67
166
|
/** `quorum doctor`: full report on stdout. Returns the process exit code. */
|
|
68
167
|
export async function runDoctor(version) {
|
|
69
168
|
const configPath = getConfigPath();
|
|
70
|
-
const {
|
|
169
|
+
const { targets } = getCommandPaths();
|
|
71
170
|
const statuses = await collectAdapterStatus({ fresh: true });
|
|
72
171
|
console.log(`quorum v${version}`);
|
|
73
172
|
console.log(`node ${process.version}`);
|
|
74
173
|
console.log(`config: ${configPath}${existsSync(configPath) ? '' : ' (not created yet — starts on first server launch)'}`);
|
|
75
|
-
console.log(`slash commands: ${
|
|
174
|
+
console.log(`slash commands: ${targets.join(', ') || 'no host CLI found (expected ~/.claude or ~/.codex)'}`);
|
|
76
175
|
console.log('');
|
|
77
176
|
console.log('Reviewer CLIs:');
|
|
78
177
|
for (const s of statuses) {
|
|
@@ -80,6 +179,20 @@ export async function runDoctor(version) {
|
|
|
80
179
|
if (s.settings)
|
|
81
180
|
console.log(` ${s.settings}`);
|
|
82
181
|
}
|
|
182
|
+
const hostWarnings = checkCodexHostConfig();
|
|
183
|
+
if (hostWarnings.length > 0) {
|
|
184
|
+
console.log('');
|
|
185
|
+
console.log('Codex host:');
|
|
186
|
+
for (const w of hostWarnings)
|
|
187
|
+
console.log(` ⚠️ ${w}`);
|
|
188
|
+
}
|
|
189
|
+
const geminiWarnings = agyWarnings();
|
|
190
|
+
if (geminiWarnings.length > 0) {
|
|
191
|
+
console.log('');
|
|
192
|
+
console.log('Gemini (agy):');
|
|
193
|
+
for (const w of geminiWarnings)
|
|
194
|
+
console.log(` ⚠️ ${w}`);
|
|
195
|
+
}
|
|
83
196
|
const usable = statuses.filter((s) => s.enabled && s.available);
|
|
84
197
|
console.log('');
|
|
85
198
|
if (usable.length === 0) {
|
package/dist/executor.d.ts
CHANGED
|
@@ -81,6 +81,11 @@ export interface CliExecutorOptions {
|
|
|
81
81
|
* Default: 5_000.
|
|
82
82
|
*/
|
|
83
83
|
killGraceMs?: number;
|
|
84
|
+
/**
|
|
85
|
+
* How long to wait after the child exits for `close` (all stdio flushed).
|
|
86
|
+
* Past this, a lingering grandchild is holding the pipe: reap it and settle.
|
|
87
|
+
*/
|
|
88
|
+
closeGraceMs?: number;
|
|
84
89
|
}
|
|
85
90
|
export interface CliResult {
|
|
86
91
|
/** Lines split on '\n', excluding the trailing empty string from a final newline. */
|
|
@@ -94,6 +99,11 @@ export interface CliResult {
|
|
|
94
99
|
/** True when rawStdout was capped at maxBufferSize. */
|
|
95
100
|
truncated: boolean;
|
|
96
101
|
}
|
|
102
|
+
/**
|
|
103
|
+
* Grace period between a child's `exit` and its `close`. Normal stdio flush is
|
|
104
|
+
* immediate; anything longer means something else still holds the pipe.
|
|
105
|
+
*/
|
|
106
|
+
export declare const DEFAULT_CLOSE_GRACE_MS = 2000;
|
|
97
107
|
export declare class CliExecutor {
|
|
98
108
|
private readonly opts;
|
|
99
109
|
/** Mutable inactivity timeout — see setInactivityTimeout(). */
|
package/dist/executor.js
CHANGED
|
@@ -104,6 +104,11 @@ export async function gracefulExit(code, graceMs = 2_000) {
|
|
|
104
104
|
}
|
|
105
105
|
process.exit(code);
|
|
106
106
|
}
|
|
107
|
+
/**
|
|
108
|
+
* Grace period between a child's `exit` and its `close`. Normal stdio flush is
|
|
109
|
+
* immediate; anything longer means something else still holds the pipe.
|
|
110
|
+
*/
|
|
111
|
+
export const DEFAULT_CLOSE_GRACE_MS = 2_000;
|
|
107
112
|
export class CliExecutor {
|
|
108
113
|
opts;
|
|
109
114
|
/** Mutable inactivity timeout — see setInactivityTimeout(). */
|
|
@@ -124,6 +129,7 @@ export class CliExecutor {
|
|
|
124
129
|
maxTimeoutMs: options.maxTimeoutMs ?? 3_600_000,
|
|
125
130
|
maxBufferSize: options.maxBufferSize ?? 1_048_576,
|
|
126
131
|
killGraceMs: options.killGraceMs ?? 5_000,
|
|
132
|
+
closeGraceMs: options.closeGraceMs ?? DEFAULT_CLOSE_GRACE_MS,
|
|
127
133
|
};
|
|
128
134
|
this.currentInactivityMs = this.opts.inactivityTimeoutMs;
|
|
129
135
|
}
|
|
@@ -176,17 +182,50 @@ export class CliExecutor {
|
|
|
176
182
|
detached: POSIX,
|
|
177
183
|
});
|
|
178
184
|
activeChildren.add(proc);
|
|
179
|
-
let
|
|
180
|
-
proc.once('exit', () => {
|
|
181
|
-
|
|
182
|
-
|
|
185
|
+
let closed = false;
|
|
186
|
+
proc.once('exit', (code) => {
|
|
187
|
+
// `close` fires only once every inherited stdio pipe is closed. A CLI
|
|
188
|
+
// that leaves a background process holding stdout keeps the pipe open
|
|
189
|
+
// after it is itself gone, so `close` may never arrive and the run
|
|
190
|
+
// would block until the inactivity cap — 15 minutes for gemini — while
|
|
191
|
+
// nothing is running. Give the normal flush a moment, then reap the
|
|
192
|
+
// group that still holds the pipe.
|
|
193
|
+
//
|
|
194
|
+
// The reap runs whether or not the promise has settled: settlement
|
|
195
|
+
// governs what the caller is told, never whether descendants are
|
|
196
|
+
// cleaned up. A timeout settles before the child exits, and skipping
|
|
197
|
+
// the reap there is what left reviewer processes alive for days.
|
|
198
|
+
const grace = setTimeout(() => {
|
|
199
|
+
if (closed)
|
|
200
|
+
return;
|
|
201
|
+
console.error(`[executor] child exited (${code ?? 'signal'}) but stdio stayed open; reaping the process group`);
|
|
202
|
+
reap();
|
|
203
|
+
if (!settled)
|
|
204
|
+
finalize(code);
|
|
205
|
+
}, this.opts.closeGraceMs);
|
|
206
|
+
grace.unref?.();
|
|
183
207
|
});
|
|
184
|
-
/**
|
|
208
|
+
/**
|
|
209
|
+
* SIGKILL the whole group and release our read ends.
|
|
210
|
+
*
|
|
211
|
+
* Safe to call more than once and after the direct child is gone: the
|
|
212
|
+
* signal goes to the process group, and killing an already-dead group
|
|
213
|
+
* is a no-op.
|
|
214
|
+
*/
|
|
215
|
+
const reap = () => {
|
|
216
|
+
killTree(proc, 'SIGKILL');
|
|
217
|
+
proc.stdout.destroy();
|
|
218
|
+
proc.stderr.destroy();
|
|
219
|
+
activeChildren.delete(proc);
|
|
220
|
+
};
|
|
221
|
+
/** SIGTERM now, SIGKILL the group unconditionally after the grace period. */
|
|
185
222
|
const terminate = () => {
|
|
186
223
|
killTree(proc, 'SIGTERM');
|
|
187
224
|
const escalation = setTimeout(() => {
|
|
188
|
-
|
|
189
|
-
|
|
225
|
+
// Unconditional by design: the direct child exiting on SIGTERM says
|
|
226
|
+
// nothing about the grandchildren it spawned, and gating on it let
|
|
227
|
+
// those survive every timeout.
|
|
228
|
+
reap();
|
|
190
229
|
}, this.opts.killGraceMs);
|
|
191
230
|
escalation.unref?.();
|
|
192
231
|
};
|
|
@@ -315,7 +354,8 @@ export class CliExecutor {
|
|
|
315
354
|
// ------------------------------------------------------------------
|
|
316
355
|
// close — normal resolution path (all stdio flushed)
|
|
317
356
|
// ------------------------------------------------------------------
|
|
318
|
-
|
|
357
|
+
function finalize(code) {
|
|
358
|
+
closed = true;
|
|
319
359
|
clearTimers();
|
|
320
360
|
activeChildren.delete(proc);
|
|
321
361
|
// Flush decoder remainders and any partial final line.
|
|
@@ -335,7 +375,8 @@ export class CliExecutor {
|
|
|
335
375
|
exitCode: code ?? -1,
|
|
336
376
|
truncated,
|
|
337
377
|
}));
|
|
338
|
-
}
|
|
378
|
+
}
|
|
379
|
+
proc.on('close', (code) => finalize(code));
|
|
339
380
|
// ------------------------------------------------------------------
|
|
340
381
|
// error — spawn failures (e.g. ENOENT)
|
|
341
382
|
// ------------------------------------------------------------------
|
package/dist/handoff.js
CHANGED
|
@@ -21,7 +21,7 @@ export const COMPREHENSIVE_REVIEWER = {
|
|
|
21
21
|
applicableFocusAreas: [],
|
|
22
22
|
systemPrompt: `Senior staff engineer doing the review a careful human would do before merging.
|
|
23
23
|
Priority: correctness > security and data integrity > behaviour under failure (retries, partial writes, concurrency) > performance > maintainability.
|
|
24
|
-
Skeptical by default: the brief describes what
|
|
24
|
+
Skeptical by default: the brief describes what the requesting agent believes it did — verify against the code before agreeing with any of it.
|
|
25
25
|
Report only real issues with evidence. Do not rubber-stamp; do not pad.`,
|
|
26
26
|
};
|
|
27
27
|
/** Change-focused reviewer — used when the requested focus areas map to no specialist. */
|
|
@@ -175,10 +175,10 @@ For each: what specifically should be documented and where.`,
|
|
|
175
175
|
// PROMPT SECTIONS SHARED BY BOTH PASSES
|
|
176
176
|
// =============================================================================
|
|
177
177
|
const TASK_BY_OUTPUT_TYPE = {
|
|
178
|
-
implementation: 'Code changes
|
|
179
|
-
plan: 'A plan
|
|
180
|
-
findings: 'Findings
|
|
181
|
-
analysis: 'An analysis
|
|
178
|
+
implementation: 'Code changes the requesting agent made in the working directory. Locate the change (git diff if the directory is a repository, otherwise PRIORITY FILES), read it in full, then judge it against the acceptance bar.',
|
|
179
|
+
plan: 'A plan the requesting agent wrote before implementing. Nothing has changed on disk yet. Judge whether the plan is complete, correct against the code as it exists today, and safe to execute; point at existing code that contradicts it.',
|
|
180
|
+
findings: 'Findings the requesting agent produced from analysis (an audit, a bug investigation, a root-cause claim). Verify each finding against the code: confirm it, refute it, or add what it missed.',
|
|
181
|
+
analysis: 'An analysis the requesting agent wrote up. Check its reasoning and evidence against the code and flag conclusions the code does not support.',
|
|
182
182
|
proposal: 'A design proposal. Judge feasibility against the existing code, the alternatives it dismisses, and the risks it does not mention.',
|
|
183
183
|
};
|
|
184
184
|
const DEFAULT_BAR = 'None stated — judge against: correct, safe to merge, no regressions.';
|
|
@@ -195,7 +195,7 @@ function renderTask(handoff) {
|
|
|
195
195
|
|
|
196
196
|
${kind}${base}
|
|
197
197
|
|
|
198
|
-
## THE BRIEF FROM
|
|
198
|
+
## THE BRIEF FROM THE REQUESTING AGENT
|
|
199
199
|
|
|
200
200
|
Working directory: \`${handoff.workingDir}\`
|
|
201
201
|
|
|
@@ -210,7 +210,7 @@ function renderGroundRules() {
|
|
|
210
210
|
- If the directory is a git repository, \`git status\`, \`git diff\`, \`git diff --cached\` and \`git log -3 --stat\` are the fastest way to find the change; when the brief names a base ref, \`git diff <base>...HEAD\` is the change. If it is not a repository, or the tree is clean and no base ref is given, work from PRIORITY FILES and the brief.
|
|
211
211
|
- Verify before you report. Open the file, quote the line. A finding without a location and evidence is not a finding.
|
|
212
212
|
- Stay in scope: the change and the code it touches. Report a pre-existing problem elsewhere only if the change activates it or the bar depends on it, and label it "pre-existing".
|
|
213
|
-
- Do not restate the brief, do not praise, no preamble. Your reader is
|
|
213
|
+
- Do not restate the brief, do not praise, no preamble. Your reader is the requesting agent, which will verify every claim against the code and synthesize a verdict across several reviewers.`;
|
|
214
214
|
}
|
|
215
215
|
function renderUncertainties(handoff) {
|
|
216
216
|
if (!handoff.uncertainties || handoff.uncertainties.length === 0)
|
|
@@ -223,12 +223,12 @@ function renderUncertainties(handoff) {
|
|
|
223
223
|
? [`### ${i + 1}. ${u.question}${tag}`]
|
|
224
224
|
: [`### ${i + 1}. ${u.topic}${tag}`, `- Question: ${u.question}`];
|
|
225
225
|
if (u.ccAssumption)
|
|
226
|
-
lines.push(`-
|
|
226
|
+
lines.push(`- The agent assumed: ${u.ccAssumption}`);
|
|
227
227
|
if (u.relevantFiles && u.relevantFiles.length > 0)
|
|
228
228
|
lines.push(`- Files: ${u.relevantFiles.join(', ')}`);
|
|
229
229
|
return lines.join('\n');
|
|
230
230
|
});
|
|
231
|
-
return `##
|
|
231
|
+
return `## THE AGENT'S UNCERTAINTIES — verify these first
|
|
232
232
|
|
|
233
233
|
Load-bearing items decide the verdict; incidental items are worth a look but do not block.
|
|
234
234
|
|
|
@@ -242,10 +242,10 @@ function renderQuestions(handoff) {
|
|
|
242
242
|
if (q.context)
|
|
243
243
|
lines.push(` Context: ${q.context}`);
|
|
244
244
|
if (q.ccGuess)
|
|
245
|
-
lines.push(`
|
|
245
|
+
lines.push(` The agent's guess: ${q.ccGuess}`);
|
|
246
246
|
return lines.join('\n');
|
|
247
247
|
});
|
|
248
|
-
return `## QUESTIONS FROM
|
|
248
|
+
return `## QUESTIONS FROM THE AGENT
|
|
249
249
|
|
|
250
250
|
${items.join('\n')}`;
|
|
251
251
|
}
|
|
@@ -272,7 +272,7 @@ ${ask}`;
|
|
|
272
272
|
function renderKnownGaps(handoff) {
|
|
273
273
|
if (!handoff.knownGaps || handoff.knownGaps.length === 0)
|
|
274
274
|
return null;
|
|
275
|
-
return `## KNOWN GAPS (acknowledged by
|
|
275
|
+
return `## KNOWN GAPS (acknowledged by the agent)
|
|
276
276
|
|
|
277
277
|
${handoff.knownGaps.map((g) => `- ${g}`).join('\n')}
|
|
278
278
|
|
|
@@ -321,7 +321,7 @@ Ordered by severity, most severe first. Write \`None.\` if there are no material
|
|
|
321
321
|
Severity: S1 = blocks the bar (data loss, security, wrong results, crash on a common path). S2 = real bug or gap; ship only after fixing. S3 = worth fixing, not blocking.
|
|
322
322
|
|
|
323
323
|
## Answers
|
|
324
|
-
Numbered to match
|
|
324
|
+
Numbered to match the agent's uncertainties, then its questions. Each: \`verified\` / \`refuted\` / \`could not verify\`, plus the evidence in one or two sentences. Write \`None asked.\` if the brief had neither.
|
|
325
325
|
|
|
326
326
|
## Decisions
|
|
327
327
|
One line per decision in the brief: \`agree\`, or \`disagree — <better alternative and why>\`. Write \`None listed.\` if the brief listed none.`;
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
* Quorum MCP server — entry point.
|
|
4
4
|
*
|
|
5
5
|
* A quorum of AI CLIs (Codex, Gemini via agy, Claude Code with fresh context)
|
|
6
|
-
* reviews
|
|
6
|
+
* reviews the requesting agent's work or answers its questions; that agent
|
|
7
|
+
* verifies and synthesizes. Hosted by Claude Code or Codex.
|
|
7
8
|
*
|
|
8
9
|
* Usage:
|
|
9
10
|
* npx -y @simonren/quorum run the MCP server on stdio
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
* Quorum MCP server — entry point.
|
|
4
4
|
*
|
|
5
5
|
* A quorum of AI CLIs (Codex, Gemini via agy, Claude Code with fresh context)
|
|
6
|
-
* reviews
|
|
6
|
+
* reviews the requesting agent's work or answers its questions; that agent
|
|
7
|
+
* verifies and synthesizes. Hosted by Claude Code or Codex.
|
|
7
8
|
*
|
|
8
9
|
* Usage:
|
|
9
10
|
* npx -y @simonren/quorum run the MCP server on stdio
|
|
@@ -23,7 +24,7 @@ const VERSION = JSON.parse(readFileSync(__pkgPath, 'utf-8')).version;
|
|
|
23
24
|
const USAGE = `quorum v${VERSION}
|
|
24
25
|
|
|
25
26
|
Usage:
|
|
26
|
-
quorum Run the MCP server on stdio (what
|
|
27
|
+
quorum Run the MCP server on stdio (what the host CLI launches)
|
|
27
28
|
quorum update Install or update the /multi-review and /multi-consult slash commands
|
|
28
29
|
quorum doctor Show detected reviewer CLIs, versions, and config
|
|
29
30
|
quorum --version Print the version
|
|
@@ -39,6 +40,18 @@ function runUpdate() {
|
|
|
39
40
|
console.log(`✓ Retired ${result.removed.length} deprecated commands (kept as .deprecated.bak): ${result.removed.map((c) => `/${c}`).join(', ')}`);
|
|
40
41
|
}
|
|
41
42
|
console.log(`✓ Installed ${result.installed.length} slash commands: ${result.installed.map((c) => `/${c}`).join(', ')}`);
|
|
43
|
+
for (const target of result.targets) {
|
|
44
|
+
console.log(` → ${target}`);
|
|
45
|
+
}
|
|
46
|
+
if (result.targets.length === 0) {
|
|
47
|
+
console.log(' (no host CLI found — expected ~/.claude or $CODEX_HOME to exist)');
|
|
48
|
+
}
|
|
49
|
+
for (const path of result.skipped) {
|
|
50
|
+
console.log(` ⚠️ left alone (not installed by quorum): ${path}`);
|
|
51
|
+
}
|
|
52
|
+
if (result.error) {
|
|
53
|
+
console.log(` ⚠️ ${result.error}`);
|
|
54
|
+
}
|
|
42
55
|
process.exit(0);
|
|
43
56
|
}
|
|
44
57
|
async function startServer() {
|
|
@@ -55,16 +68,9 @@ async function startServer() {
|
|
|
55
68
|
const msg = error instanceof Error ? error.message : String(error);
|
|
56
69
|
console.error(`[quorum] Warning: could not initialize config: ${msg}`);
|
|
57
70
|
}
|
|
58
|
-
const install = installCommands();
|
|
59
|
-
if (install.success) {
|
|
60
|
-
console.error(`[quorum] Installed ${install.installed.length} slash commands`);
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
console.error(`[quorum] Warning: could not install commands: ${install.error}`);
|
|
64
|
-
}
|
|
65
71
|
await logCliStatus();
|
|
66
72
|
// Reap reviewer processes if we are signalled or the client hangs up —
|
|
67
|
-
// a Codex/Claude run must not outlive the
|
|
73
|
+
// a Codex/Claude run must not outlive the host session that asked for it.
|
|
68
74
|
installChildCleanupHooks();
|
|
69
75
|
process.stdin.once('end', () => { void gracefulExit(0); });
|
|
70
76
|
process.stdin.once('close', () => { void gracefulExit(0); });
|
package/dist/server.js
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* handler's input type all come from one definition and cannot drift.
|
|
7
7
|
*/
|
|
8
8
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
9
|
+
import { hostFromClientName, installCommands } from './commands.js';
|
|
9
10
|
import { handleMultiReview, MULTI_REVIEW_DESCRIPTION, ReviewInputShape } from './tools/review.js';
|
|
10
11
|
import { handleMultiConsult, MULTI_CONSULT_DESCRIPTION, ConsultInputShape } from './tools/consult.js';
|
|
11
12
|
/**
|
|
@@ -20,6 +21,23 @@ const TOOL_ANNOTATIONS = {
|
|
|
20
21
|
};
|
|
21
22
|
export function createServer(version) {
|
|
22
23
|
const server = new McpServer({ name: 'quorum', version }, { capabilities: { tools: {} } });
|
|
24
|
+
// Install the slash commands for whoever actually connected. This runs on
|
|
25
|
+
// `initialize` rather than at start-up because that is the first moment the
|
|
26
|
+
// client identifies itself — and because Codex is far more often present as
|
|
27
|
+
// a *reviewer* than as the host, directory presence would write into
|
|
28
|
+
// ~/.codex for users who never drive quorum from Codex at all.
|
|
29
|
+
server.server.oninitialized = () => {
|
|
30
|
+
const host = hostFromClientName(server.server.getClientVersion()?.name);
|
|
31
|
+
if (!host)
|
|
32
|
+
return;
|
|
33
|
+
const result = installCommands({ host });
|
|
34
|
+
console.error(result.success
|
|
35
|
+
? `[quorum] host=${host}: installed ${result.installed.length} commands → ${result.targets.join(', ')}`
|
|
36
|
+
: `[quorum] host=${host}: could not install commands: ${result.error}`);
|
|
37
|
+
for (const path of result.skipped) {
|
|
38
|
+
console.error(`[quorum] Warning: left alone (not installed by quorum): ${path}`);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
23
41
|
server.registerTool('multi_review', {
|
|
24
42
|
title: 'Multi-model review (standard + adversarial)',
|
|
25
43
|
description: MULTI_REVIEW_DESCRIPTION,
|
package/dist/tools/consult.js
CHANGED
|
@@ -27,7 +27,7 @@ export const ConsultInputShape = {
|
|
|
27
27
|
workingDir: z.string().min(1)
|
|
28
28
|
.describe('Absolute path of the project root. Always required, even for general questions. Never a home directory or system path.'),
|
|
29
29
|
question: z.string().min(1).max(100_000)
|
|
30
|
-
.describe('
|
|
30
|
+
.describe('A self-contained question you compose, ending with a CRITERIA block (priority-ordered, each tagged [stated] or [assumed]).'),
|
|
31
31
|
relevantFiles: z.array(z.string().min(1)).max(100).optional()
|
|
32
32
|
.describe('For code-grounded questions: the minimal file subset (typically 3–10) the panel must read. Omit for general questions so the panel answers from expertise without reading the filesystem.'),
|
|
33
33
|
customPrompt: z.string().max(20_000).optional()
|
|
@@ -40,9 +40,9 @@ export const ConsultInputShape = {
|
|
|
40
40
|
};
|
|
41
41
|
export const ConsultInputSchema = z.object(ConsultInputShape);
|
|
42
42
|
export const MULTI_CONSULT_DESCRIPTION = "Ask the panel (Codex, Gemini, Claude with fresh context) the same question in parallel and get each model's " +
|
|
43
|
-
"structured answer (Recommendation / Reasoning / Tradeoffs / Risks / Open questions) back for
|
|
43
|
+
"structured answer (Recommendation / Reasoning / Tradeoffs / Risks / Open questions) back for you to synthesize. " +
|
|
44
44
|
"Input shape: 'question' only — no 'ccOutput'. Use for guidance, recommendations, or choosing an approach when there is " +
|
|
45
|
-
"no prior
|
|
45
|
+
"no prior work of yours to review; to review such work use 'multi_review'. The discriminator is the shape of the " +
|
|
46
46
|
"input, not the user's phrasing. Calls take minutes.";
|
|
47
47
|
function toConsultRequest(input) {
|
|
48
48
|
return {
|
package/dist/tools/review.js
CHANGED
|
@@ -21,13 +21,13 @@ export const ReviewInputShape = {
|
|
|
21
21
|
workingDir: z.string().min(1)
|
|
22
22
|
.describe('Absolute path of the project root the reviewers may read. Never a home directory or system path.'),
|
|
23
23
|
ccOutput: z.string().min(1).max(100_000)
|
|
24
|
-
.describe("
|
|
24
|
+
.describe("Your brief: SUMMARY (with a Bar: line), UNCERTAINTIES tagged [load-bearing]/[incidental], QUESTIONS, DECISIONS (with Rationale:), KNOWN GAPS, PRIORITY FILES. Reviewers have the filesystem but not the conversation — put what only you know here. Keep it short: no diffs or file contents (agy takes the whole prompt on argv, ~120 KB max)."),
|
|
25
25
|
outputType: z.enum(OUTPUT_TYPES)
|
|
26
|
-
.describe("What the brief describes: 'implementation' for code
|
|
26
|
+
.describe("What the brief describes: 'implementation' for code you changed, 'plan' before implementing, 'findings' from an investigation, 'analysis', or 'proposal'."),
|
|
27
27
|
baseRef: z.string().max(200).regex(/^[A-Za-z0-9._\/@^~-]+$/, 'baseRef must be a git ref or SHA').optional()
|
|
28
28
|
.describe("Git ref the change is relative to, e.g. 'main' or a merge-base SHA. Give it when the working tree is clean (a checked-out branch or PR) so reviewers can run `git diff <baseRef>...HEAD` instead of finding an empty diff."),
|
|
29
29
|
analyzedFiles: z.array(z.string().min(1)).max(200).optional()
|
|
30
|
-
.describe('Files
|
|
30
|
+
.describe('Files you created or modified (relative to workingDir). Reviewers read these first.'),
|
|
31
31
|
focusAreas: z.array(z.enum(FOCUS_AREAS)).max(FOCUS_AREAS.length).optional()
|
|
32
32
|
.describe('Areas to weight. Only when the user asked for a focus; omit for a comprehensive review.'),
|
|
33
33
|
customPrompt: z.string().max(20_000).optional()
|
|
@@ -39,10 +39,10 @@ export const ReviewInputShape = {
|
|
|
39
39
|
.describe("Codex service tier. Omit for the config default ('fast' = priority, ~2x cost); 'flex' = cheaper and slower; 'default' = API default tier."),
|
|
40
40
|
};
|
|
41
41
|
export const ReviewInputSchema = z.object(ReviewInputShape);
|
|
42
|
-
export const MULTI_REVIEW_DESCRIPTION = "Review work
|
|
43
|
-
"Requires 'ccOutput',
|
|
44
|
-
"runs a standard pass and an adversarial pass in parallel; the raw responses come back for
|
|
45
|
-
"and synthesize. For an open question with no prior
|
|
42
|
+
export const MULTI_REVIEW_DESCRIPTION = "Review work you already produced — code changes, a plan, findings, an analysis, or a proposal. " +
|
|
43
|
+
"Requires 'ccOutput', your brief about that work. Every available model (Codex, Gemini, Claude with fresh context) " +
|
|
44
|
+
"runs a standard pass and an adversarial pass in parallel; the raw responses come back for you to verify against the code " +
|
|
45
|
+
"and synthesize. For an open question with no prior work to review, use 'multi_consult' instead — the discriminator " +
|
|
46
46
|
"is the shape of the input, not the user's phrasing. Calls take minutes.";
|
|
47
47
|
function toReviewRequest(input) {
|
|
48
48
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simonren/quorum",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.1",
|
|
4
4
|
"description": "MCP server for Claude Code — a quorum of AI models (Codex, Gemini, Claude Fable with fresh context) for standard + adversarial review and consultation, synthesized by Claude Code",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|