@mmerterden/multi-agent-pipeline 23.1.0 → 23.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/docs/facts.json +2 -2
  3. package/docs/features.md +1 -1
  4. package/manifest.json +31 -30
  5. package/package.json +1 -1
  6. package/pipeline/commands/multi-agent/fable-status/SKILL.md +1 -1
  7. package/pipeline/commands/multi-agent/routines-import/SKILL.md +2 -0
  8. package/pipeline/commands/multi-agent/routines-share/SKILL.md +5 -4
  9. package/pipeline/commands/multi-agent/routines-update/SKILL.md +2 -0
  10. package/pipeline/lib/model-rung.sh +1 -1
  11. package/pipeline/lib/routine-secret-scan.mjs +89 -4
  12. package/pipeline/multi-agent-refs/cross-cli-contract.md +1 -1
  13. package/pipeline/multi-agent-refs/features/model-fallback.md +3 -3
  14. package/pipeline/multi-agent-refs/features/routine-sharing.md +64 -11
  15. package/pipeline/multi-agent-refs/features/usage-reporting.md +1 -0
  16. package/pipeline/multi-agent-refs/orchestrator/copilot-pipeline.md +1 -1
  17. package/pipeline/multi-agent-refs/phases/phase-3-review.md +3 -3
  18. package/pipeline/multi-agent-refs/review/panel.md +1 -1
  19. package/pipeline/scripts/cost-table.json +6 -5
  20. package/pipeline/scripts/routine-registry.mjs +26 -1
  21. package/pipeline/scripts/routine-share.mjs +58 -17
  22. package/pipeline/scripts/usage-health.mjs +376 -0
  23. package/pipeline/scripts/usage-report.mjs +12 -3
  24. package/pipeline/skills/.skill-manifest.json +5 -5
  25. package/pipeline/skills/shared/core/multi-agent-fable-status/SKILL.md +1 -1
  26. package/pipeline/skills/shared/core/multi-agent-routines-import/SKILL.md +2 -0
  27. package/pipeline/skills/shared/core/multi-agent-routines-share/SKILL.md +4 -3
  28. package/pipeline/skills/shared/core/multi-agent-routines-update/SKILL.md +2 -0
@@ -79,7 +79,7 @@ Each persona file carries its own `modelRationale`. Observability: emit a `phase
79
79
 
80
80
  **Phase 2: Dev (Sonnet).** Per todo in dependency order: mark `in_progress`, TDD (failing test, verify RED, minimal code, verify GREEN, refactor), build via a task agent, on failure fix and rebuild (max 3, `retryCount` in `agent-state.json`), mark `done`, log `Phase 2: {todo-id} - Test ok, Build ok`.
81
81
 
82
- **Phase 3: Review (parallel + triage).** Step 0 diff risk scoring is advisory: `node $HOME/.claude/scripts/diff-risk-score.mjs --base "$BASE_BRANCH" --top 5`, injected as `${PRIORITY_FILES}`; off when `prefs.global.diffRiskAdvisory = false`. Reviewers by host: Claude Code runs `claude-fable-5-1` (security + architecture), `claude-opus-5-5` (edge cases), `claude-sonnet-5-5` (quality); Copilot CLI runs `gpt-5.4`, `claude-opus-4.7`, `claude-sonnet-4.6` (no Fable). Triage is one top-tier pass (`claude-fable-5-1` on Claude Code, `claude-opus-4.7` on Copilot CLI). Blocking findings go back to Phase 2 (max 3 iterations), important ones are fixed and re-reviewed, suggestions applied when reasonable.
82
+ **Phase 3: Review (parallel + triage).** Step 0 diff risk scoring is advisory: `node $HOME/.claude/scripts/diff-risk-score.mjs --base "$BASE_BRANCH" --top 5`, injected as `${PRIORITY_FILES}`; off when `prefs.global.diffRiskAdvisory = false`. Reviewers by host: Claude Code runs `claude-fable-5-2` (security + architecture), `claude-opus-5-5` (edge cases), `claude-sonnet-5-5` (quality); Copilot CLI runs `gpt-5.4`, `claude-opus-4.7`, `claude-sonnet-4.6` (no Fable). Triage is one top-tier pass (`claude-fable-5-2` on Claude Code, `claude-opus-4.7` on Copilot CLI). Blocking findings go back to Phase 2 (max 3 iterations), important ones are fixed and re-reviewed, suggestions applied when reasonable.
83
83
 
84
84
  **Phase 4: Commit & PR.** Per-project steps and the GitHub issue body update: `orchestrator/phase-4-5-projects.md`.
85
85
 
@@ -238,10 +238,10 @@ Launch Agent instances **in parallel** using the shared `code-reviewer` subagent
238
238
 
239
239
  | Reviewer | subagent_type | Claude Code | Copilot CLI | Codex CLI | Focus | Skills Referenced |
240
240
  | ---------- | --------------- | --- | --- | --- | --- | --- |
241
- | Reviewer 1 | `code-reviewer` | `claude-fable-5-1` | `claude-opus-4.7` | `gpt-5.6` @ `xhigh` | Deep security + architecture | `api-security-best-practices`, `architecture` |
241
+ | Reviewer 1 | `code-reviewer` | `claude-fable-5-2` | `claude-opus-4.7` | `gpt-5.6` @ `xhigh` | Deep security + architecture | `api-security-best-practices`, `architecture` |
242
242
  | Reviewer 2 | `code-reviewer` | `claude-opus-5-5` | `gpt-5.4` | `gpt-5.4` @ `high` | Edge cases, different perspective | cross-model diversity |
243
243
  | Reviewer 3 | `code-reviewer` | `claude-sonnet-5-5` | `claude-sonnet-4.6` | `gpt-5.6` @ `medium` | Quality + correctness + naming | `ai-backend-toolkit:clean-code`, stack-specific skill |
244
- | Triage | triage persona | `claude-fable-5-1` | `claude-opus-4.7` | `gpt-5.6` @ `max` | Filter false positives + out-of-scope | - |
244
+ | Triage | triage persona | `claude-fable-5-2` | `claude-opus-4.7` | `gpt-5.6` @ `max` | Filter false positives + out-of-scope | - |
245
245
 
246
246
  Reviewer count per host: **Claude Code 3, Copilot CLI 3, Codex CLI 3** - **2** on Claude Code with the fable rung off, per `$HOME/.claude/multi-agent-refs/features/model-fallback.md`.
247
247
 
@@ -266,7 +266,7 @@ borderline finding. Where the diversity budget goes instead:
266
266
 
267
267
  Each reviewer inherits the `code-reviewer` agent's focus areas (Security, Architecture, Quality, Performance) and output contract. The orchestrator overrides only the model and the stack-specific skill per-reviewer - no prompt duplication.
268
268
 
269
- **Model override wiring:** `code-reviewer.md` declares `preferredModel: fable`, so Reviewer 1 uses the persona default (Fable 5.1). Reviewer 2 (`claude-opus-5-5` on Claude Code, `gpt-5.4` elsewhere) and Reviewer 3 (sonnet rung, per host above) set `PHASE_MODEL_OVERRIDE=<model>` before dispatch - the orchestrator exports `CLAUDE_CODE_SUBAGENT_MODEL` on Claude Code, or passes `--model` on Copilot CLI. Full precedence rule: `skills/shared/core/multi-agent/SKILL.md#agent-dispatch--per-persona-model-routing`. Fable dispatches are subject to the fallback contract (`$HOME/.claude/multi-agent-refs/features/model-fallback.md`): dispatch-error retry walks `fable -> opus -> sonnet` and budget-ceiling downgrade.
269
+ **Model override wiring:** `code-reviewer.md` declares `preferredModel: fable`, so Reviewer 1 uses the persona default (Fable 5.2). Reviewer 2 (`claude-opus-5-5` on Claude Code, `gpt-5.4` elsewhere) and Reviewer 3 (sonnet rung, per host above) set `PHASE_MODEL_OVERRIDE=<model>` before dispatch - the orchestrator exports `CLAUDE_CODE_SUBAGENT_MODEL` on Claude Code, or passes `--model` on Copilot CLI. Full precedence rule: `skills/shared/core/multi-agent/SKILL.md#agent-dispatch--per-persona-model-routing`. Fable dispatches are subject to the fallback contract (`$HOME/.claude/multi-agent-refs/features/model-fallback.md`): dispatch-error retry walks `fable -> opus -> sonnet` and budget-ceiling downgrade.
270
270
 
271
271
  **Stack-specific skills loaded per reviewer** (from Phase 1 `detectedStack`). All three columns are used on every host; Reviewer 2 reads them as Opus on Claude Code and as GPT-5.4 elsewhere.
272
272
 
@@ -7,7 +7,7 @@
7
7
  Every host runs three reviewers; only the second slot differs, because GPT-5.4 exists on Copilot and Codex but not on Claude Code, where Opus fills it.
8
8
 
9
9
  **Claude Code (3 in parallel while the fable rung is on, 2 while it is off):**
10
- - Agent 1: `claude-fable-5-1` → security + architecture (only when `REVIEW_RUNG` is `fable`)
10
+ - Agent 1: `claude-fable-5-2` → security + architecture (only when `REVIEW_RUNG` is `fable`)
11
11
  - Agent 2: `claude-opus-5-5` → edge cases, alternate perspective
12
12
  - Agent 3: `claude-sonnet-5-5` → general quality
13
13
 
@@ -5,6 +5,7 @@
5
5
  "_legacyReadme": "`legacy` prices previous-generation wire IDs a transcript may still name, keyed by the exact ID (a dated snapshot of one prices as it). Dispatch never reads it; cost-analyze consults it after the current `modelId` values and the `models` map. Official Anthropic prices per million tokens.",
6
6
  "legacy": {
7
7
  "claude-fable-5": { "inPerMtok": 10.0, "outPerMtok": 50.0, "cacheReadPerMtok": 1.0 },
8
+ "claude-fable-5-1": { "inPerMtok": 10.0, "outPerMtok": 50.0, "cacheReadPerMtok": 0.25 },
8
9
  "claude-opus-5": { "inPerMtok": 5.0, "outPerMtok": 25.0, "cacheReadPerMtok": 0.5 },
9
10
  "claude-sonnet-5": { "inPerMtok": 2.0, "outPerMtok": 10.0, "cacheReadPerMtok": 0.2 },
10
11
  "claude-haiku-4-5": { "inPerMtok": 1.0, "outPerMtok": 5.0, "cacheReadPerMtok": 0.1 }
@@ -17,12 +18,12 @@
17
18
  },
18
19
  "prices": {
19
20
  "fable": {
20
- "inPerMtok": 10.0,
21
- "outPerMtok": 50.0,
22
- "cacheReadPerMtok": 0.25,
23
- "modelId": "claude-fable-5-1",
21
+ "inPerMtok": 8.0,
22
+ "outPerMtok": 40.0,
23
+ "cacheReadPerMtok": 0.2,
24
+ "modelId": "claude-fable-5-2",
24
25
  "provider": "anthropic",
25
- "note": "Top tier - architects, Reviewer 1 and triage on Claude Code. Claude Fable 5.1, verified against Anthropic pricing 2026-10-14."
26
+ "note": "Top tier - architects, Reviewer 1 and triage on Claude Code. Claude Fable 5.2, verified against Anthropic pricing 2026-11-03."
26
27
  },
27
28
  "opus": {
28
29
  "inPerMtok": 4.0,
@@ -74,7 +74,12 @@ import { prefsFileIn } from "../lib/prefs-value.mjs";
74
74
  import { parseArgs as parseArgv } from "../lib/args.mjs";
75
75
  import { exitOnHelp } from "../lib/cli-help.mjs";
76
76
  import { createHash } from "node:crypto";
77
- import { denyHostsFrom, scanSecrets } from "../lib/routine-secret-scan.mjs";
77
+ import {
78
+ SCANNED_FIELDS,
79
+ denyHostsFrom,
80
+ maskDeniedHosts,
81
+ scanSecrets,
82
+ } from "../lib/routine-secret-scan.mjs";
78
83
  import { isUnattended } from "../lib/unattended.mjs";
79
84
  import { lockTimeoutFrom, updateJsonFileSync } from "../lib/json-file-lock.mjs";
80
85
 
@@ -442,6 +447,26 @@ export function scanPayload(home, payload, env = process.env) {
442
447
  return scanSecrets(payload, { denyHosts: denyHostsFrom(readPrefs(home).global, env) });
443
448
  }
444
449
 
450
+ /**
451
+ * A copy of the payload with every hostname the internal-host rule would flag
452
+ * (with this machine's deny list) replaced by MASKED_HOST in each scanned
453
+ * field, and sha256 recomputed over the masked body. The saved routine is not
454
+ * touched. masked is the number of hostnames replaced.
455
+ */
456
+ export function maskPayloadHosts(home, payload, env = process.env) {
457
+ const denyHosts = denyHostsFrom(readPrefs(home).global, env);
458
+ const out = { ...payload };
459
+ let masked = 0;
460
+ for (const field of SCANNED_FIELDS) {
461
+ if (typeof out[field] !== "string") continue;
462
+ const { text, count } = maskDeniedHosts(out[field], denyHosts);
463
+ out[field] = text;
464
+ masked += count;
465
+ }
466
+ out.sha256 = bodySha256(out.body);
467
+ return { payload: out, masked };
468
+ }
469
+
445
470
  /**
446
471
  * Add a shared payload as a local routine. The sha256 is checked before
447
472
  * anything is written; the local name is `as` when given, else the payload's.
@@ -24,8 +24,8 @@
24
24
  // node routine-share.mjs browse [--q <text>]
25
25
  // node routine-share.mjs fetch --id <id>
26
26
  // node routine-share.mjs share --name <n> --visibility private|members|selected
27
- // [--logins a,b] [--base-version <n>] [--dry-run]
28
- // node routine-share.mjs share --all --visibility private [--dry-run]
27
+ // [--logins a,b] [--base-version <n>] [--mask-hosts] [--dry-run]
28
+ // node routine-share.mjs share --all --visibility private [--mask-hosts] [--dry-run]
29
29
  // node routine-share.mjs import --id <id> --digest <digest> [--sha <sha256>] [--as <local name>]
30
30
  // node routine-share.mjs updates
31
31
  // node routine-share.mjs diff --name <local name>
@@ -49,6 +49,15 @@
49
49
  // ok is false, error rate-limited or partial, when it stopped or a publish
50
50
  // failed.
51
51
  //
52
+ // --mask-hosts (share, one or --all) sends a copy in which every hostname the
53
+ // internal-host rule would flag is replaced by MASKED_HOST
54
+ // (internal-host.invalid), before the scan runs; sha256 is computed over the
55
+ // masked body, so the shared sha differs from the saved routine's, which is
56
+ // not touched. Each result carries masked: N (never the host text). Every
57
+ // other finding still refuses the routine. fetch, import, diff and update
58
+ // report placeholders: N and placeholderLines [{field, line, count}] for the
59
+ // importer to fill in with their own host; nothing fills them in.
60
+ //
52
61
  // Output: one JSON document on stdout. {ok:false, error, ...} on refusal.
53
62
  // share, import, update and delete refuse under MULTI_AGENT_UNATTENDED=1, and
54
63
  // the guard blocks the same subcommands by name (unattended-policy.json).
@@ -72,12 +81,14 @@ import {
72
81
  isValidLocalName,
73
82
  listRoutines,
74
83
  localNameTaken,
84
+ maskPayloadHosts,
75
85
  payloadDigest,
76
86
  payloadIssues,
77
87
  skillEdited,
78
88
  payloadProblems,
79
89
  scanPayload,
80
90
  } from "./routine-registry.mjs";
91
+ import { maskedHostsIn } from "../lib/routine-secret-scan.mjs";
81
92
 
82
93
  exitOnHelp(import.meta.url);
83
94
 
@@ -278,20 +289,40 @@ function parseLogins(text) {
278
289
  return list;
279
290
  }
280
291
 
292
+ /**
293
+ * The payload share sends for one saved routine. With maskHosts, every
294
+ * hostname the internal-host rule would flag is replaced in the copy (the
295
+ * saved routine is untouched) and `masked` carries how many; the host text
296
+ * itself is never reported.
297
+ */
298
+ function sharePayload(home, name, env, maskHosts) {
299
+ const exported = exportRoutine(home, name);
300
+ if (!maskHosts) return { payload: exported, mask: {} };
301
+ const { payload, masked } = maskPayloadHosts(home, exported, env);
302
+ return { payload, mask: { masked } };
303
+ }
304
+
305
+ /** Where the masking placeholder sits in an incoming routine, for the importer to fill in. */
306
+ function placeholdersOf(routine) {
307
+ const { count, lines } = maskedHostsIn(routine);
308
+ return { placeholders: count, placeholderLines: lines };
309
+ }
310
+
281
311
  /** The shareable payload of one routine, or the reason it may not be sent. */
282
- function bulkCandidate(home, name, env) {
312
+ function bulkCandidate(home, name, env, maskHosts) {
283
313
  let payload;
314
+ let mask;
284
315
  try {
285
- payload = exportRoutine(home, name);
316
+ ({ payload, mask } = sharePayload(home, name, env, maskHosts));
286
317
  } catch (err) {
287
318
  if (err instanceof RoutineError) return { skip: { reason: "invalid", detail: err.message } };
288
319
  throw err;
289
320
  }
290
321
  const problems = payloadProblems(payload);
291
- if (problems.length) return { skip: { reason: problems[0], problems } };
322
+ if (problems.length) return { skip: { reason: problems[0], problems, ...mask } };
292
323
  const findings = scanPayload(home, payload, env);
293
- if (findings.length) return { skip: { reason: "secret-detected", findings } };
294
- return { payload };
324
+ if (findings.length) return { skip: { reason: "secret-detected", findings, ...mask } };
325
+ return { payload, mask };
295
326
  }
296
327
 
297
328
  async function shareAll(home, args, env) {
@@ -302,6 +333,7 @@ async function shareAll(home, args, env) {
302
333
  }
303
334
  const ctx = context(home, env);
304
335
  const dryRun = Boolean(args["dry-run"]);
336
+ const maskHosts = args["mask-hosts"] === true;
305
337
  // The skip list is what keeps a bulk run from narrowing a routine already
306
338
  // shared wider, so a response that is not a list stops the run.
307
339
  const listing = await call(ctx, "GET", "");
@@ -324,7 +356,7 @@ async function shareAll(home, args, env) {
324
356
  results.push({ name, status: "skipped", reason: "already-published" });
325
357
  continue;
326
358
  }
327
- const { payload, skip } = bulkCandidate(home, name, env);
359
+ const { payload, mask, skip } = bulkCandidate(home, name, env, maskHosts);
328
360
  if (skip) {
329
361
  results.push({ name, status: "skipped", ...skip });
330
362
  continue;
@@ -336,12 +368,19 @@ async function shareAll(home, args, env) {
336
368
  description: payload.description,
337
369
  sha256: payload.sha256,
338
370
  bytes: Buffer.byteLength(payload.body, "utf8"),
371
+ ...mask,
339
372
  });
340
373
  continue;
341
374
  }
342
375
  try {
343
376
  const { routine } = await call(ctx, "POST", "", { ...payload, visibility: "private" });
344
- results.push({ name, status: "published", id: routine?.id, version: routine?.version });
377
+ results.push({
378
+ name,
379
+ status: "published",
380
+ id: routine?.id,
381
+ version: routine?.version,
382
+ ...mask,
383
+ });
345
384
  } catch (err) {
346
385
  if (!(err instanceof Refusal)) throw err;
347
386
  if (err.extra.status === 429) {
@@ -356,7 +395,7 @@ async function shareAll(home, args, env) {
356
395
  const counts = {};
357
396
  for (const r of results) counts[r.status] = (counts[r.status] ?? 0) + 1;
358
397
  const failed = counts.failed > 0;
359
- const report = { all: true, visibility: "private", counts, results };
398
+ const report = { all: true, visibility: "private", maskHosts, counts, results };
360
399
  if (dryRun) return { ok: true, dryRun: true, url: ctx.base, ...report };
361
400
  if (stopped) return { ok: false, error: "rate-limited", stopped, ...report };
362
401
  if (failed) return { ok: false, error: "partial", ...report };
@@ -383,6 +422,7 @@ const commands = {
383
422
  digest: payloadDigest(payload),
384
423
  localNameTaken: taken,
385
424
  issues,
425
+ ...placeholdersOf(routine),
386
426
  };
387
427
  },
388
428
 
@@ -392,11 +432,11 @@ const commands = {
392
432
  if (!VISIBILITIES.has(visibility)) throw new Refusal("invalid-visibility");
393
433
  const logins = parseLogins(args.logins);
394
434
  if (visibility === "selected" && logins.length === 0) throw new Refusal("invalid-logins");
395
- const payload = exportRoutine(home, args.name);
435
+ const { payload, mask } = sharePayload(home, args.name, env, args["mask-hosts"] === true);
396
436
  const problems = payloadProblems(payload);
397
- if (problems.length) throw new Refusal(problems[0], { problems });
437
+ if (problems.length) throw new Refusal(problems[0], { problems, ...mask });
398
438
  const findings = scanPayload(home, payload, env);
399
- if (findings.length) throw new Refusal("secret-detected", { findings });
439
+ if (findings.length) throw new Refusal("secret-detected", { findings, ...mask });
400
440
  const request = { ...payload, visibility };
401
441
  if (visibility === "selected") request.logins = logins;
402
442
  if (args["base-version"] !== undefined) {
@@ -405,9 +445,9 @@ const commands = {
405
445
  request.baseVersion = v;
406
446
  }
407
447
  const ctx = context(home, env);
408
- if (args["dry-run"]) return { ok: true, dryRun: true, url: ctx.base, request };
448
+ if (args["dry-run"]) return { ok: true, dryRun: true, url: ctx.base, request, ...mask };
409
449
  const { routine } = await call(ctx, "POST", "", request);
410
- return { ok: true, routine };
450
+ return { ok: true, routine, ...mask };
411
451
  },
412
452
 
413
453
  async import(home, args, env) {
@@ -420,7 +460,7 @@ const commands = {
420
460
  id: routine.id,
421
461
  as: typeof args.as === "string" ? args.as : undefined,
422
462
  });
423
- return { ok: true, imported: entry };
463
+ return { ok: true, imported: entry, ...placeholdersOf(routine) };
424
464
  },
425
465
 
426
466
  async updates(home, _args, env) {
@@ -467,6 +507,7 @@ const commands = {
467
507
  descriptionChanged: local.description !== routine.description,
468
508
  localEdits: skillEdited(home, entry),
469
509
  diff: lineDiff(local.body, routine.body),
510
+ ...placeholdersOf(routine),
470
511
  };
471
512
  },
472
513
 
@@ -486,7 +527,7 @@ const commands = {
486
527
  replace: true,
487
528
  backup: edited !== false,
488
529
  });
489
- return { ok: true, updated };
530
+ return { ok: true, updated, ...placeholdersOf(routine) };
490
531
  },
491
532
 
492
533
  async delete(home, args, env) {