@simonren/quorum 0.11.1 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,7 +5,7 @@ argument-hint: <question or steering> [flex|high reasoning]
5
5
 
6
6
  # Multi Consult
7
7
 
8
- Ask the panel — Codex, Gemini, and Claude with a fresh context — the same question in parallel and synthesize their answers into one recommendation. Use this for **consultation**: choosing an approach, weighing alternatives, getting a second opinion on a design. Not for reviewing work you (Claude Code, "CC") already did — that is `/multi-review`.
8
+ Ask the panel — Codex, Gemini, and Claude with a fresh context — the same question in parallel and synthesize their answers into one recommendation. Use this for **consultation**: choosing an approach, weighing alternatives, getting a second opinion on a design. Not for reviewing work you already did — that is the multi-review command.
9
9
 
10
10
  Each model answers in a fixed structure (Recommendation with a confidence line / Reasoning / Tradeoffs / Risks / Open questions). You read all of them and present one consolidated answer with a "Models said:" footer so dissent stays visible.
11
11
 
@@ -5,9 +5,9 @@ argument-hint: [steering, e.g. "focus the challenge on rollback safety"] [flex|x
5
5
 
6
6
  # Multi Review
7
7
 
8
- Convene the panel on work you (Claude Code, "CC") produced in this conversation: code you changed, a plan you wrote, findings, an analysis, or a proposal. Every available model reviews it twice, in parallel — a **standard pass** (bugs, gaps, does it clear the bar) and an **adversarial pass** (assumptions, design decisions, failure paths). The reviewers have the filesystem but not this conversation. They return raw findings; **you verify each one against the code and deliver one verdict.** You are the judge, not a relay.
8
+ Convene the panel on work you produced in this conversation: code you changed, a plan you wrote, findings, an analysis, or a proposal. Every available model reviews it twice, in parallel — a **standard pass** (bugs, gaps, does it clear the bar) and an **adversarial pass** (assumptions, design decisions, failure paths). The reviewers have the filesystem but not this conversation. They return raw findings; **you verify each one against the code and deliver one verdict.** You are the judge, not a relay.
9
9
 
10
- If there is no CC-produced work in this conversation to review, say so and suggest `/multi-consult` instead of inventing a brief.
10
+ If there is no work of yours in this conversation to review, say so and suggest `/multi-consult` instead of inventing a brief.
11
11
 
12
12
  ## Arguments
13
13
 
@@ -54,6 +54,7 @@ export class CodexAdapter extends CliAdapter {
54
54
  '-m', cfg.model,
55
55
  '-c', `model_reasoning_effort=${reasoningEffort}`,
56
56
  '-c', 'model_reasoning_summary_format=experimental',
57
+ '-c', 'mcp_servers={}', // no inherited MCP servers — incl. quorum itself under a Codex host
57
58
  '--sandbox', 'read-only',
58
59
  '--skip-git-repo-check',
59
60
  '-C', workingDir,
@@ -0,0 +1,9 @@
1
+ /**
2
+ * SHA-256 of every command file quorum has ever shipped — GENERATED, do not edit.
3
+ * Regenerate with `node scripts/gen-command-hashes.mjs`.
4
+ *
5
+ * Used to recognize an install from a release that predates the provenance
6
+ * marker, so quorum can upgrade its own files without ever touching one the
7
+ * operator wrote. A missing hash costs an upgrade, never data.
8
+ */
9
+ export declare const SHIPPED_COMMAND_HASHES: ReadonlySet<string>;
@@ -0,0 +1,40 @@
1
+ /**
2
+ * SHA-256 of every command file quorum has ever shipped — GENERATED, do not edit.
3
+ * Regenerate with `node scripts/gen-command-hashes.mjs`.
4
+ *
5
+ * Used to recognize an install from a release that predates the provenance
6
+ * marker, so quorum can upgrade its own files without ever touching one the
7
+ * operator wrote. A missing hash costs an upgrade, never data.
8
+ */
9
+ export const SHIPPED_COMMAND_HASHES = new Set([
10
+ '0799b9576f018a8b0c8ee8032c2c65621e3ac40b0f91469167f8effc9e3c68bc',
11
+ '0973d253db3dd34771b2a6251ab0952a38e2f239312f81a78b516a2aa77f188e',
12
+ '0aa3c041fbc439c959900096044e9c7fc29367abd433ea5528c3220e203fe4f7',
13
+ '0e640efa9a7fb5a3c3a5d2d4423f983a6d724a1c4f6b1c724eff6661a197b588',
14
+ '23d7a8280cac407051bf627531f651b3356a649afe823d98e372704dadd83707',
15
+ '2a9bdc5e10740baa0d03dd98f83505d78002050d1c833fb37eb362922b7c1847',
16
+ '3a1f0d1580e01f434bc67dfb305c8195dc864267edc4fd0b7d7e5852e59d7235',
17
+ '3c02aa89c99f09fd3372a0ce4e822a289d18bd19a5af1fb52de9def208dcbf19',
18
+ '3e83a69212c2caaa521f848c7adfe6f0534568ca51a70a404723107d86a02f34',
19
+ '4e492be65caaa12cf821d722e3c0d0e23a0ae69995c555e50b5fe9cabece535e',
20
+ '6073cc2cacd1ed3193bfdd4c3bc682bdddddfff1926f270ac54297220919a250',
21
+ '71826597257ae5e5aae97eb949fcaf296b6233671527bc1d909a9819f700bdf5',
22
+ '7340667a2b12f26c4a9e7ad06cab9b657f79c7846e3f39055913e9f95d12d8a6',
23
+ '80e5572b0de7b7f3dbcfc6058b54bee8b66c8af0aa177fa0c8010fb14bb1a710',
24
+ '9448a29e4523551155297c8da68ea36e14047cb470a740e74fdbac7a5dea36e4',
25
+ '94512584761514488cbec665a7d95656d729ceea9ea2a38959c51e991fdb8470',
26
+ '9aa277b158cd2a34ffc13865d4eaf129f5f6ce25ef8b1de73f67096104b5f794',
27
+ '9d2ed5597e531c8411242ba720944fb1be287ab8a4f098879255320a82d082ee',
28
+ 'aa2d1ee0d16e74530c17c44d1558708452894abbeef84204167bbc458cd31549',
29
+ 'b4a54f73411aac6ea0a46fac14d655a48d55839330b8de9b14e6766d405370a0',
30
+ 'c017641338fa4bc44f57caff21c648a58f8ecbe67d8b93d53968d96ba841e37b',
31
+ 'c14e0f4e0b1d261e3df3486f377b949f8847f5303bace0ab74409a452c86a865',
32
+ 'c6828c722a60427942e4173a19115e03f4993a7d1d477e407791ed5422b968f3',
33
+ 'd4d4e3977f5b6054a421bd2c34d8ca66956d92de6126964cef31dc5880898dd3',
34
+ 'dcbe42ab9ddc24dd2fbc715c9af0ec5a230f584de8be381624a548bbba17c369',
35
+ 'e211a1e9180a4170c656812008ead03f7659e631cd75ce9176360e036c71052a',
36
+ 'e547dcc16c6af42d5db492e5dff5f8e3c46a4aff1bb2ab69575548d7ca2c0c33',
37
+ 'f0946130b81916ba13bb30520934e11626dabc7c41c470314c5c70e95c6bc320',
38
+ 'fc7fc509ee1f274eff7e4f04bbe280463eaebf23431bd12b46eae238b993b787',
39
+ 'fe308b8b7b52ec83cc87e9842431e62d3956d0a0085d21489195cf5f4fe7e0db',
40
+ ]);
@@ -7,22 +7,68 @@ export interface InstallResult {
7
7
  success: boolean;
8
8
  installed: string[];
9
9
  removed: string[];
10
+ /** Directories actually written to — one per host CLI present on this machine. */
11
+ targets: string[];
12
+ /** Files left alone because something quorum did not write already sits there. */
13
+ skipped: string[];
10
14
  error?: string;
11
15
  }
16
+ export type HostId = 'claude' | 'codex';
12
17
  /**
13
- * Get source and target paths for command files
18
+ * Map an MCP `initialize` clientInfo.name onto a host.
19
+ *
20
+ * Measured against the real CLIs: Claude Code sends `claude-code`, Codex sends
21
+ * `codex-mcp-client`. An unknown client gets nothing written to disk — quorum's
22
+ * tools work regardless, only the slash-command shorthand is host-specific.
23
+ */
24
+ export declare function hostFromClientName(name: string | undefined): HostId | null;
25
+ /**
26
+ * Get source and target paths for command files.
27
+ *
28
+ * A target is included only when that host's home directory already exists —
29
+ * quorum never creates `~/.codex` for a user who has no Codex installed. This
30
+ * runs before `server.connect()`, so the MCP client identity is not available
31
+ * yet; directory presence is the signal.
14
32
  */
15
- export declare function getCommandPaths(): {
33
+ export declare function getCommandPaths(host?: HostId): {
16
34
  source: string;
17
- target: string;
35
+ targets: string[];
18
36
  };
19
37
  /**
20
- * Install slash commands to ~/.claude/commands/
38
+ * Rewrite a Claude Code command file as a Codex skill.
39
+ *
40
+ * A skill's frontmatter is `name` + `description`; `argument-hint` is not a
41
+ * skill field, and `$ARGUMENTS` is not substituted the way a slash command
42
+ * substitutes it, so the body refers to the request in prose instead.
43
+ */
44
+ export declare function toSkill(name: string, body: string): string;
45
+ /**
46
+ * Install the orchestration instructions for a host CLI.
47
+ *
48
+ * With `host`, only that host's directory is written — the server uses this so
49
+ * a session never writes into a CLI that is merely installed as a *reviewer*.
50
+ * Without it (the `quorum update` subcommand, an explicit user action), every
51
+ * host present on the machine is written.
21
52
  *
22
- * @param overrides Test-only path overrides; production callers pass nothing.
53
+ * @param overrides Test-only path overrides; production callers pass `host`.
54
+ * A `target` override collapses the install to that single directory.
23
55
  * @returns Result object with success status and installed commands
24
56
  */
25
57
  export declare function installCommands(overrides?: Partial<{
26
58
  source: string;
27
59
  target: string;
60
+ host: HostId;
28
61
  }>): InstallResult;
62
+ /**
63
+ * Stamped into every file quorum writes, so a later install can recognize its
64
+ * own work without guessing. Must never change: older installs are identified
65
+ * by this exact string.
66
+ */
67
+ export declare const PROVENANCE_MARKER = "<!-- installed by quorum; edits are overwritten on upgrade -->";
68
+ /**
69
+ * True when these bytes are a marked file, or one quorum shipped verbatim.
70
+ *
71
+ * `known` is injectable so the identity rule can be tested without depending
72
+ * on the generated manifest's current contents.
73
+ */
74
+ export declare function isOurContent(body: Buffer, known?: ReadonlySet<string>): boolean;
package/dist/commands.js CHANGED
@@ -3,10 +3,12 @@
3
3
  *
4
4
  * Used by index.ts (auto-install on MCP server startup and `update` subcommand)
5
5
  */
6
- import { existsSync, mkdirSync, copyFileSync, readdirSync, renameSync, statSync } from 'fs';
6
+ import { existsSync, mkdirSync, readdirSync, readFileSync, renameSync, rmSync, statSync, writeFileSync } from 'fs';
7
7
  import { join, dirname } from 'path';
8
8
  import { homedir } from 'os';
9
9
  import { fileURLToPath } from 'url';
10
+ import { createHash } from 'crypto';
11
+ import { SHIPPED_COMMAND_HASHES } from './command-hashes.js';
10
12
  const __filename = fileURLToPath(import.meta.url);
11
13
  const __dirname = dirname(__filename);
12
14
  /** Old command filenames that should be pruned on upgrade */
@@ -26,33 +28,123 @@ const DEPRECATED_COMMANDS = [
26
28
  'claude-review.md',
27
29
  ];
28
30
  /**
29
- * Get source and target paths for command files
31
+ * Where each host CLI looks for the orchestration instructions.
32
+ *
33
+ * Claude Code reads flat command files from `~/.claude/commands/` and invokes
34
+ * them as `/multi-review`. Codex 0.155 has no custom-prompt directory — the
35
+ * only `prompts` it implements is the MCP protocol's — so the same content
36
+ * ships as a skill at `~/.codex/skills/<name>/SKILL.md`, which it loads into
37
+ * every session.
38
+ */
39
+ function hostTargets() {
40
+ const home = homedir();
41
+ // `codex-liveness.ts` already honours $CODEX_HOME; stay consistent with it.
42
+ const codexHome = process.env.CODEX_HOME?.trim() || join(home, '.codex');
43
+ return [
44
+ { id: 'claude', home: join(home, '.claude'), dir: join(home, '.claude', 'commands'), layout: 'command' },
45
+ { id: 'codex', home: codexHome, dir: join(codexHome, 'skills'), layout: 'skill' },
46
+ ];
47
+ }
48
+ /**
49
+ * Map an MCP `initialize` clientInfo.name onto a host.
50
+ *
51
+ * Measured against the real CLIs: Claude Code sends `claude-code`, Codex sends
52
+ * `codex-mcp-client`. An unknown client gets nothing written to disk — quorum's
53
+ * tools work regardless, only the slash-command shorthand is host-specific.
54
+ */
55
+ export function hostFromClientName(name) {
56
+ const n = (name ?? '').toLowerCase();
57
+ if (n.includes('claude'))
58
+ return 'claude';
59
+ if (n.includes('codex'))
60
+ return 'codex';
61
+ return null;
62
+ }
63
+ /**
64
+ * Get source and target paths for command files.
65
+ *
66
+ * A target is included only when that host's home directory already exists —
67
+ * quorum never creates `~/.codex` for a user who has no Codex installed. This
68
+ * runs before `server.connect()`, so the MCP client identity is not available
69
+ * yet; directory presence is the signal.
30
70
  */
31
- export function getCommandPaths() {
71
+ export function getCommandPaths(host) {
32
72
  return {
33
73
  source: join(__dirname, '..', 'commands'),
34
- target: join(homedir(), '.claude', 'commands'),
74
+ targets: hostTargets()
75
+ .filter((h) => (host ? h.id === host : existsSync(h.home)))
76
+ .map((h) => h.dir),
35
77
  };
36
78
  }
79
+ /** The layout a target directory uses, by its path. Defaults to flat commands. */
80
+ function layoutFor(target) {
81
+ return hostTargets().find((h) => h.dir === target)?.layout ?? 'command';
82
+ }
83
+ /**
84
+ * Rewrite a Claude Code command file as a Codex skill.
85
+ *
86
+ * A skill's frontmatter is `name` + `description`; `argument-hint` is not a
87
+ * skill field, and `$ARGUMENTS` is not substituted the way a slash command
88
+ * substitutes it, so the body refers to the request in prose instead.
89
+ */
90
+ export function toSkill(name, body) {
91
+ const fm = body.match(/^---\n([\s\S]*?)\n---\n?/);
92
+ const description = fm?.[1].match(/^description:\s*(.+)$/m)?.[1].trim() ?? name;
93
+ const rest = (fm ? body.slice(fm[0].length) : body).replace(/\$ARGUMENTS/g, 'the request you were given');
94
+ return `---\nname: ${name}\ndescription: ${description}\n---\n${rest.startsWith('\n') ? '' : '\n'}${rest}`;
95
+ }
37
96
  /**
38
- * Install slash commands to ~/.claude/commands/
97
+ * Install the orchestration instructions for a host CLI.
39
98
  *
40
- * @param overrides Test-only path overrides; production callers pass nothing.
99
+ * With `host`, only that host's directory is written — the server uses this so
100
+ * a session never writes into a CLI that is merely installed as a *reviewer*.
101
+ * Without it (the `quorum update` subcommand, an explicit user action), every
102
+ * host present on the machine is written.
103
+ *
104
+ * @param overrides Test-only path overrides; production callers pass `host`.
105
+ * A `target` override collapses the install to that single directory.
41
106
  * @returns Result object with success status and installed commands
42
107
  */
43
108
  export function installCommands(overrides) {
44
- const defaults = getCommandPaths();
109
+ const defaults = getCommandPaths(overrides?.host);
45
110
  const source = overrides?.source ?? defaults.source;
46
- const target = overrides?.target ?? defaults.target;
47
- // Check source exists
111
+ const targets = overrides?.target ? [overrides.target] : defaults.targets;
48
112
  if (!existsSync(source)) {
49
- return { success: false, installed: [], removed: [], error: 'Commands directory not found' };
113
+ return { success: false, installed: [], removed: [], targets: [], skipped: [], error: 'Commands directory not found' };
114
+ }
115
+ const files = readdirSync(source).filter((f) => f.endsWith('.md'));
116
+ if (files.length === 0) {
117
+ return { success: false, installed: [], removed: [], targets: [], skipped: [], error: 'No command files found' };
118
+ }
119
+ const installed = new Set();
120
+ const removed = new Set();
121
+ const skipped = new Set();
122
+ const written = [];
123
+ const failures = [];
124
+ // One unwritable host must not deny the others: keep going and report.
125
+ for (const target of targets) {
126
+ const outcome = installTo(source, target, files, installed, removed, skipped);
127
+ if (outcome.ok)
128
+ written.push(target);
129
+ else
130
+ failures.push(`${target}: ${outcome.error}`);
50
131
  }
132
+ return {
133
+ success: written.length > 0 || targets.length === 0,
134
+ installed: [...installed],
135
+ removed: [...removed],
136
+ targets: written,
137
+ skipped: [...skipped],
138
+ ...(failures.length > 0 ? { error: failures.join('; ') } : {}),
139
+ };
140
+ }
141
+ /** Install the command set into one host directory. Mutates the shared name sets. */
142
+ function installTo(source, target, files, installed, removed, skipped) {
51
143
  // Create target directory, handle errors (not a dir, permission denied)
52
144
  try {
53
145
  if (existsSync(target)) {
54
146
  if (!statSync(target).isDirectory()) {
55
- return { success: false, installed: [], removed: [], error: `${target} exists but is not a directory` };
147
+ return { ok: false, error: `${target} exists but is not a directory` };
56
148
  }
57
149
  }
58
150
  else {
@@ -61,19 +153,31 @@ export function installCommands(overrides) {
61
153
  }
62
154
  catch (err) {
63
155
  const msg = err instanceof Error ? err.message : String(err);
64
- return { success: false, installed: [], removed: [], error: `Cannot create target directory: ${msg}` };
156
+ return { ok: false, error: `Cannot create target directory: ${msg}` };
65
157
  }
66
- const files = readdirSync(source).filter(f => f.endsWith('.md'));
67
- if (files.length === 0) {
68
- return { success: false, installed: [], removed: [], error: 'No command files found' };
69
- }
70
- // Prune deprecated commands from target by renaming to .deprecated.bak
71
- // (lossless — preserves any user edits the operator may have made). If the
72
- // backup already exists from a previous upgrade, leave it alone.
73
- const removed = [];
74
- for (const oldFile of DEPRECATED_COMMANDS) {
75
- const oldPath = join(target, oldFile);
76
- if (existsSync(oldPath)) {
158
+ const layout = layoutFor(target);
159
+ // Prune deprecated commands by renaming to .deprecated.bak (lossless —
160
+ // preserves any user edits the operator made). If the backup already exists
161
+ // from a previous upgrade, leave it alone.
162
+ //
163
+ // Only in the flat command layout: these names were never installed anywhere
164
+ // else, so a `codex.md` in another host's directory is somebody else's file.
165
+ if (layout === 'command') {
166
+ for (const oldFile of DEPRECATED_COMMANDS) {
167
+ const oldPath = join(target, oldFile);
168
+ if (!existsSync(oldPath))
169
+ continue;
170
+ // A name we retired is not proof the file is ours — `codex.md` is a
171
+ // plausible thing for an operator to write. Only rename our own.
172
+ try {
173
+ if (!isOurContent(readFileSync(oldPath))) {
174
+ skipped.add(oldPath);
175
+ continue;
176
+ }
177
+ }
178
+ catch {
179
+ continue;
180
+ }
77
181
  const backupPath = `${oldPath}.deprecated.bak`;
78
182
  try {
79
183
  if (!existsSync(backupPath)) {
@@ -82,24 +186,105 @@ export function installCommands(overrides) {
82
186
  // If the backup already exists, the original was already moved on a
83
187
  // prior install. The file we see now must be a recreation; leave it
84
188
  // alone — the user clearly wants it.
85
- removed.push(oldFile.replace('.md', ''));
189
+ removed.add(oldFile.replace('.md', ''));
86
190
  }
87
191
  catch {
88
192
  // Best-effort removal — don't fail the install
89
193
  }
90
194
  }
91
195
  }
92
- // Copy current files
93
- const installed = [];
94
196
  try {
95
197
  for (const file of files) {
96
- copyFileSync(join(source, file), join(target, file));
97
- installed.push(file.replace('.md', ''));
198
+ const name = file.replace('.md', '');
199
+ const dest = layout === 'skill' ? join(target, name, 'SKILL.md') : join(target, file);
200
+ if (!isOursOrAbsent(dest)) {
201
+ skipped.add(dest); // never clobber a file we did not write
202
+ continue;
203
+ }
204
+ const body = readFileSync(join(source, file), 'utf-8');
205
+ if (layout === 'skill')
206
+ mkdirSync(join(target, name), { recursive: true });
207
+ writeAtomic(dest, stamp(layout === 'skill' ? toSkill(name, body) : body));
208
+ installed.add(name);
98
209
  }
99
210
  }
100
211
  catch (err) {
101
212
  const msg = err instanceof Error ? err.message : String(err);
102
- return { success: false, installed, removed, error: `Copy failed: ${msg}` };
213
+ return { ok: false, error: `Copy failed: ${msg}` };
214
+ }
215
+ return { ok: true };
216
+ }
217
+ /**
218
+ * Stamped into every file quorum writes, so a later install can recognize its
219
+ * own work without guessing. Must never change: older installs are identified
220
+ * by this exact string.
221
+ */
222
+ export const PROVENANCE_MARKER = '<!-- installed by quorum; edits are overwritten on upgrade -->';
223
+ /** Add the provenance marker directly below the frontmatter, or at the top. */
224
+ function stamp(body) {
225
+ if (body.includes(PROVENANCE_MARKER))
226
+ return body;
227
+ const fm = body.match(/^---\n[\s\S]*?\n---\n/);
228
+ return fm
229
+ ? `${fm[0]}${PROVENANCE_MARKER}\n${body.slice(fm[0].length)}`
230
+ : `${PROVENANCE_MARKER}\n${body}`;
231
+ }
232
+ /**
233
+ * True when `dest` is absent or is a file quorum may overwrite.
234
+ *
235
+ * These directories belong to the host CLIs, not to quorum, so a name collision
236
+ * with the operator's own `multi-review.md` must not destroy it. Exactly two
237
+ * things count as ours:
238
+ *
239
+ * 1. the provenance marker — written by this version onward;
240
+ * 2. byte-identical to a file some quorum release shipped, which is how an
241
+ * install from before the marker is recognized.
242
+ *
243
+ * Both are exact. An earlier attempt guessed from the reserved `[flex]`/
244
+ * `[xhigh]` vocabulary, but only v0.11.x ever carried it: every release from
245
+ * v0.7.0 to v6.2.0 would have been stranded un-upgradeable. Anything that
246
+ * matches neither signal is somebody else's file, left alone and reported.
247
+ */
248
+ function isOursOrAbsent(dest) {
249
+ if (!existsSync(dest))
250
+ return true;
251
+ try {
252
+ return isOurContent(readFileSync(dest));
253
+ }
254
+ catch {
255
+ return false;
256
+ }
257
+ }
258
+ /**
259
+ * True when these bytes are a marked file, or one quorum shipped verbatim.
260
+ *
261
+ * `known` is injectable so the identity rule can be tested without depending
262
+ * on the generated manifest's current contents.
263
+ */
264
+ export function isOurContent(body, known = SHIPPED_COMMAND_HASHES) {
265
+ if (body.includes(PROVENANCE_MARKER))
266
+ return true;
267
+ return known.has(createHash('sha256').update(body).digest('hex'));
268
+ }
269
+ /**
270
+ * Write `body` to `dest` atomically.
271
+ *
272
+ * A crashed or short write must never leave a truncated file behind: that file
273
+ * would lack the provenance marker, so every later install would treat it as
274
+ * the user's own and refuse to repair it. Rename within the same directory is
275
+ * atomic, so `dest` is either the old content or the new one.
276
+ */
277
+ function writeAtomic(dest, body) {
278
+ const tmp = `${dest}.quorum-${process.pid}.tmp`;
279
+ try {
280
+ writeFileSync(tmp, body);
281
+ renameSync(tmp, dest);
282
+ }
283
+ catch (err) {
284
+ try {
285
+ rmSync(tmp, { force: true });
286
+ }
287
+ catch { /* best effort */ }
288
+ throw err;
103
289
  }
104
- return { success: true, installed, removed };
105
290
  }
package/dist/config.d.ts CHANGED
@@ -273,6 +273,16 @@ export declare const ConfigSchema: z.ZodDefault<z.ZodObject<{
273
273
  maxBufferSize?: number | undefined;
274
274
  }>>;
275
275
  }, "strip", z.ZodTypeAny, {
276
+ claude: {
277
+ enabled: boolean;
278
+ model: string;
279
+ inactivityTimeoutMs: number;
280
+ maxTimeoutMs: number;
281
+ maxBufferSize: number;
282
+ fallbackModel: string | null;
283
+ effort: "high" | "xhigh" | "low" | "medium" | "max" | null;
284
+ consultEffort: "high" | "xhigh" | "low" | "medium" | "max" | null;
285
+ };
276
286
  codex: {
277
287
  enabled: boolean;
278
288
  model: string;
@@ -287,16 +297,6 @@ export declare const ConfigSchema: z.ZodDefault<z.ZodObject<{
287
297
  maxTimeoutMs: number;
288
298
  maxBufferSize: number;
289
299
  };
290
- claude: {
291
- enabled: boolean;
292
- model: string;
293
- inactivityTimeoutMs: number;
294
- maxTimeoutMs: number;
295
- maxBufferSize: number;
296
- fallbackModel: string | null;
297
- effort: "high" | "xhigh" | "low" | "medium" | "max" | null;
298
- consultEffort: "high" | "xhigh" | "low" | "medium" | "max" | null;
299
- };
300
300
  gemini: {
301
301
  enabled: boolean;
302
302
  inactivityTimeoutMs: number;
@@ -305,6 +305,16 @@ export declare const ConfigSchema: z.ZodDefault<z.ZodObject<{
305
305
  model?: string | undefined;
306
306
  };
307
307
  }, {
308
+ claude?: {
309
+ enabled?: boolean | undefined;
310
+ model?: string | undefined;
311
+ inactivityTimeoutMs?: number | undefined;
312
+ maxTimeoutMs?: number | undefined;
313
+ maxBufferSize?: number | undefined;
314
+ fallbackModel?: string | null | undefined;
315
+ effort?: "high" | "xhigh" | "low" | "medium" | "max" | null | undefined;
316
+ consultEffort?: "high" | "xhigh" | "low" | "medium" | "max" | null | undefined;
317
+ } | undefined;
308
318
  codex?: {
309
319
  enabled?: boolean | undefined;
310
320
  model?: string | undefined;
@@ -319,16 +329,6 @@ export declare const ConfigSchema: z.ZodDefault<z.ZodObject<{
319
329
  maxTimeoutMs?: number | undefined;
320
330
  maxBufferSize?: number | undefined;
321
331
  } | undefined;
322
- claude?: {
323
- enabled?: boolean | undefined;
324
- model?: string | undefined;
325
- inactivityTimeoutMs?: number | undefined;
326
- maxTimeoutMs?: number | undefined;
327
- maxBufferSize?: number | undefined;
328
- fallbackModel?: string | null | undefined;
329
- effort?: "high" | "xhigh" | "low" | "medium" | "max" | null | undefined;
330
- consultEffort?: "high" | "xhigh" | "low" | "medium" | "max" | null | undefined;
331
- } | undefined;
332
332
  gemini?: {
333
333
  enabled?: boolean | undefined;
334
334
  model?: string | undefined;
@@ -20,10 +20,11 @@ export function buildConsultPrompt(request) {
20
20
  const sections = [];
21
21
  sections.push([
22
22
  'You are one of several senior engineers consulted independently on the',
23
- 'same question. Your answer goes to Claude Code (CC), an AI agent that',
24
- 'will compare the panel\'s answers and synthesize one recommendation for',
25
- 'the user. CC has the conversation context; you do not — everything you',
26
- 'know is in this brief. Nobody benefits from hedging: a clear position',
23
+ 'same question. Your answer goes to the requesting agent, an AI coding',
24
+ 'agent that will compare the panel\'s answers and synthesize one',
25
+ 'recommendation for the user. It has the conversation context; you do',
26
+ 'not — everything you know is in this brief. Nobody benefits from',
27
+ 'hedging: a clear position',
27
28
  'with its reasons is the most useful thing you can produce.',
28
29
  ].join('\n'));
29
30
  sections.push([
package/dist/doctor.d.ts CHANGED
@@ -16,5 +16,6 @@ export declare function collectAdapterStatus(options?: {
16
16
  }): Promise<AdapterStatus[]>;
17
17
  /** Start-up log on stderr (stdout is the MCP transport). */
18
18
  export declare function logCliStatus(): Promise<void>;
19
+ export declare function checkCodexHostConfig(configPath?: string): string[];
19
20
  /** `quorum doctor`: full report on stdout. Returns the process exit code. */
20
21
  export declare function runDoctor(version: string): Promise<number>;
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,90 @@ 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
+ }
71
+ /**
72
+ * Codex kills an MCP tool call at `tool_timeout_sec` (default 60) and gives up
73
+ * on start-up at `startup_timeout_sec` (default 10). A panel run takes minutes
74
+ * and `npx -y` on a cold cache takes more than ten seconds, so a Codex host
75
+ * that has not raised both will fail every call with an opaque client timeout.
76
+ * Claude Code has no comparable cap, so this check only fires for Codex.
77
+ */
78
+ /** Codex's home, honouring $CODEX_HOME like `codex-liveness.ts` does. */
79
+ function codexHome() {
80
+ return process.env.CODEX_HOME?.trim() || join(homedir(), '.codex');
81
+ }
82
+ export function checkCodexHostConfig(configPath = join(codexHome(), 'config.toml')) {
83
+ if (!existsSync(configPath))
84
+ return [];
85
+ let toml;
86
+ try {
87
+ toml = readFileSync(configPath, 'utf-8');
88
+ }
89
+ catch {
90
+ return [];
91
+ }
92
+ const scoped = quorumServerToml(toml);
93
+ if (scoped === null)
94
+ return [];
95
+ const warnings = [];
96
+ const toolTimeout = readSeconds(scoped, 'tool_timeout_sec');
97
+ if (toolTimeout === null) {
98
+ warnings.push(`${configPath}: the quorum MCP server has no tool_timeout_sec — Codex will abort every call after 60s. Set tool_timeout_sec = 3600.`);
99
+ }
100
+ else if (toolTimeout < 600) {
101
+ warnings.push(`${configPath}: the quorum MCP server has tool_timeout_sec = ${toolTimeout}, below a panel run. Set tool_timeout_sec = 3600.`);
102
+ }
103
+ const startupTimeout = readSeconds(scoped, 'startup_timeout_sec');
104
+ if (startupTimeout === null || startupTimeout < 30) {
105
+ 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.`);
106
+ }
107
+ return warnings;
108
+ }
109
+ /**
110
+ * Everything TOML says about `mcp_servers.quorum`, in whichever of the three
111
+ * spellings the file uses, or null when quorum is not registered with Codex.
112
+ *
113
+ * [mcp_servers.quorum] <- what `codex mcp add` writes
114
+ * mcp_servers.quorum = { ... } <- inline table
115
+ * mcp_servers.quorum.key = value <- dotted keys
116
+ *
117
+ * Scoping matters more than completeness here: reading another server's
118
+ * timeouts as quorum's would suppress a warning the user needs.
119
+ */
120
+ function quorumServerToml(toml) {
121
+ const parts = [];
122
+ // Table header through to the next header, indented or not. Must not stop at
123
+ // the `[` inside `args = [...]`.
124
+ const section = toml.match(/^[ \t]*\[mcp_servers\.quorum\][^\n]*\n(?:(?![ \t]*\[)[^\n]*\n?)*/m);
125
+ if (section)
126
+ parts.push(section[0]);
127
+ const inline = toml.match(/^[ \t]*mcp_servers\.quorum[ \t]*=[ \t]*\{([^}]*)\}/m);
128
+ if (inline)
129
+ parts.push(inline[1].replace(/,/g, '\n'));
130
+ for (const m of toml.matchAll(/^[ \t]*mcp_servers\.quorum\.([A-Za-z_][\w-]*)[ \t]*=[ \t]*([^\n]*)$/gm)) {
131
+ parts.push(`${m[1]} = ${m[2]}`);
132
+ }
133
+ return parts.length > 0 ? parts.join('\n') : null;
134
+ }
135
+ /** A bare integer value for `key`; TOML allows `1_000`. */
136
+ function readSeconds(scoped, key) {
137
+ const m = scoped.match(new RegExp(`^[ \\t]*${key}[ \\t]*=[ \\t]*([0-9_]+)`, 'm'));
138
+ if (!m)
139
+ return null;
140
+ const n = Number(m[1].replace(/_/g, ''));
141
+ return Number.isFinite(n) ? n : null;
66
142
  }
67
143
  /** `quorum doctor`: full report on stdout. Returns the process exit code. */
68
144
  export async function runDoctor(version) {
69
145
  const configPath = getConfigPath();
70
- const { target } = getCommandPaths();
146
+ const { targets } = getCommandPaths();
71
147
  const statuses = await collectAdapterStatus({ fresh: true });
72
148
  console.log(`quorum v${version}`);
73
149
  console.log(`node ${process.version}`);
74
150
  console.log(`config: ${configPath}${existsSync(configPath) ? '' : ' (not created yet — starts on first server launch)'}`);
75
- console.log(`slash commands: ${target}`);
151
+ console.log(`slash commands: ${targets.join(', ') || 'no host CLI found (expected ~/.claude or ~/.codex)'}`);
76
152
  console.log('');
77
153
  console.log('Reviewer CLIs:');
78
154
  for (const s of statuses) {
@@ -80,6 +156,13 @@ export async function runDoctor(version) {
80
156
  if (s.settings)
81
157
  console.log(` ${s.settings}`);
82
158
  }
159
+ const hostWarnings = checkCodexHostConfig();
160
+ if (hostWarnings.length > 0) {
161
+ console.log('');
162
+ console.log('Codex host:');
163
+ for (const w of hostWarnings)
164
+ console.log(` ⚠️ ${w}`);
165
+ }
83
166
  const usable = statuses.filter((s) => s.enabled && s.available);
84
167
  console.log('');
85
168
  if (usable.length === 0) {
@@ -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 exited = false;
180
- proc.once('exit', () => {
181
- exited = true;
182
- activeChildren.delete(proc);
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
- /** SIGTERM now, SIGKILL if the process is still around after the grace period. */
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
- if (!exited)
189
- killTree(proc, 'SIGKILL');
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
- proc.on('close', (code) => {
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 CC believes it did — verify against the code before agreeing with any of it.
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 CC 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 CC 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 CC 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 CC missed.',
181
- analysis: 'An analysis CC wrote up. Check its reasoning and evidence against the code and flag conclusions the code does not support.',
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 CC
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 CC, which will verify every claim against the code and synthesize a verdict across several reviewers.`;
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(`- CC assumed: ${u.ccAssumption}`);
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 `## CC'S UNCERTAINTIES — verify these first
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(` CC's guess: ${q.ccGuess}`);
245
+ lines.push(` The agent's guess: ${q.ccGuess}`);
246
246
  return lines.join('\n');
247
247
  });
248
- return `## QUESTIONS FROM CC
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 CC)
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 CC'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.
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 Claude Code's work or answers its questions; Claude Code synthesizes.
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 Claude Code's work or answers its questions; Claude Code synthesizes.
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 Claude Code launches)
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 Claude Code session that asked for it.
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,
@@ -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('CC-composed, self-contained question, ending with a CRITERIA block (priority-ordered, each tagged [stated] or [assumed]).'),
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 CC to synthesize. " +
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 CC-produced work to review; to review such work use 'multi_review'. The discriminator is the shape of the " +
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 {
@@ -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("CC's 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 CC knows here. Keep it short: no diffs or file contents (agy takes the whole prompt on argv, ~120 KB max)."),
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 CC changed, 'plan' before implementing, 'findings' from an investigation, 'analysis', or 'proposal'."),
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 CC created or modified (relative to workingDir). Reviewers read these first.'),
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 Claude Code (CC) already produced — code changes, a plan, findings, an analysis, or a proposal. " +
43
- "Requires 'ccOutput', CC's 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 CC to verify against the code " +
45
- "and synthesize. For an open question with no prior CC work to review, use 'multi_consult' instead — the discriminator " +
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.11.1",
3
+ "version": "0.12.0",
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",