@mmerterden/multi-agent-pipeline 23.4.0 → 23.6.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 (56) hide show
  1. package/CHANGELOG.md +47 -6
  2. package/README.md +4 -4
  3. package/README.tr.md +4 -4
  4. package/SECURITY.md +16 -0
  5. package/docs/architecture.md +1 -1
  6. package/docs/ecosystem.md +9 -9
  7. package/docs/facts.json +10 -10
  8. package/docs/features.md +1 -1
  9. package/install/_platform-filter.mjs +2 -55
  10. package/install/codex.mjs +1 -3
  11. package/install/copilot.mjs +4 -8
  12. package/package.json +2 -2
  13. package/pipeline/commands/multi-agent/design-check/SKILL.md +1 -0
  14. package/pipeline/contract/CHANGELOG.md +14 -0
  15. package/pipeline/contract/README.md +1 -0
  16. package/pipeline/contract/fixtures/error-invalid-request.json +1 -1
  17. package/pipeline/contract/fixtures/error-unauthorized.json +1 -1
  18. package/pipeline/contract/manifest.json +14 -1
  19. package/pipeline/contract/types/index.d.ts +28 -2
  20. package/pipeline/lib/stack-detect.sh +1 -1
  21. package/pipeline/lib/usage-names.generated.mjs +9 -1
  22. package/pipeline/multi-agent-refs/design-check/init-inventory.md +11 -1
  23. package/pipeline/multi-agent-refs/features/remote-control.md +2 -1
  24. package/pipeline/multi-agent-refs/features/usage-reporting.md +5 -5
  25. package/pipeline/multi-agent-refs/help/en.md +1 -1
  26. package/pipeline/multi-agent-refs/help/tr.md +1 -1
  27. package/pipeline/multi-agent-refs/orchestrator/dispatcher.md +1 -1
  28. package/pipeline/multi-agent-refs/outside-the-pipeline.md +2 -1
  29. package/pipeline/multi-agent-refs/toolkit-tools.md +1 -0
  30. package/pipeline/office/index.html +104 -5
  31. package/pipeline/office/toolkit.json +1 -1
  32. package/pipeline/rules/outside-the-pipeline.md +1 -1
  33. package/pipeline/schemas/mcp-health.schema.json +96 -0
  34. package/pipeline/schemas/toolkit-path-params.json +40 -7
  35. package/pipeline/scripts/_contract-core.mjs +1 -1
  36. package/pipeline/scripts/_contract-routes-office.mjs +12 -0
  37. package/pipeline/scripts/_stack-routing.mjs +1 -0
  38. package/pipeline/scripts/build-stack-plugins.mjs +1 -47
  39. package/pipeline/scripts/contract-server.mjs +2 -0
  40. package/pipeline/scripts/design-check-config.mjs +205 -0
  41. package/pipeline/scripts/gen-facts.mjs +1 -2
  42. package/pipeline/scripts/health-report.mjs +35 -8
  43. package/pipeline/scripts/mcp-health.mjs +309 -0
  44. package/pipeline/scripts/remote/handler.mjs +19 -6
  45. package/pipeline/scripts/remote/store.mjs +8 -5
  46. package/pipeline/scripts/skill-usage.mjs +16 -5
  47. package/pipeline/scripts/usage-health.mjs +10 -1
  48. package/pipeline/skills/.skill-manifest.json +6 -2
  49. package/pipeline/skills/.skills-index.json +12 -1
  50. package/pipeline/skills/shared/README.md +4 -3
  51. package/pipeline/skills/shared/external/ink-animation/SKILL.md +230 -0
  52. package/pipeline/skills/shared/external/ink-animation/evals/evals.json +41 -0
  53. package/pipeline/skills/skills-index.md +2 -1
  54. package/manifest.json +0 -2055
  55. package/pipeline/scripts/_renamed-skills.mjs +0 -164
  56. package/pipeline/skills/renamed.json +0 -30
@@ -119,8 +119,12 @@ const result = (status, message, data) => ({
119
119
  message,
120
120
  data,
121
121
  });
122
- const joined = (parts) => msg("join.comma", { parts });
123
- const joinedSemi = (parts) => msg("join.semicolon", { parts });
122
+ /**
123
+ * A message made of several parts. `lead` is the id of the part that decides
124
+ * the section's colour: the one id the site receives for the whole sentence.
125
+ */
126
+ const joined = (parts, lead) => ({ ...msg("join.comma", { parts }), lead });
127
+ const joinedSemi = (parts, lead) => ({ ...msg("join.semicolon", { parts }), lead });
124
128
 
125
129
  // ---------------------------------------------------------------------------
126
130
  // services
@@ -176,7 +180,20 @@ export function servicesSection(inv) {
176
180
  : missing.length || unreachable.length || malformed.length
177
181
  ? "yellow"
178
182
  : "green";
179
- return result(status, joined(parts), { probed: Boolean(inv.probed), items });
183
+ const lead = refused.length
184
+ ? "services.refused"
185
+ : missing.length
186
+ ? "services.missing"
187
+ : unreachable.length
188
+ ? "services.unreachable"
189
+ : malformed.length
190
+ ? "services.malformed"
191
+ : inv.probed
192
+ ? "services.works"
193
+ : unset.length
194
+ ? "services.unset"
195
+ : "services.held";
196
+ return result(status, joined(parts, lead), { probed: Boolean(inv.probed), items });
180
197
  }
181
198
 
182
199
  // ---------------------------------------------------------------------------
@@ -388,9 +405,11 @@ export function hostVersions(home) {
388
405
  export function installSection({ versions, doctor }) {
389
406
  const statuses = [];
390
407
  const parts = [];
408
+ const decisive = [];
391
409
  if (!versions.claude) {
392
410
  statuses.push("red");
393
411
  parts.push(msg("install.none"));
412
+ decisive.push(["red", "install.none"]);
394
413
  } else {
395
414
  const others = ["copilot", "codex"].filter((h) => versions[h]);
396
415
  const behind = others.filter((h) => versions[h] !== versions.claude);
@@ -403,6 +422,7 @@ export function installSection({ versions, doctor }) {
403
422
  if (behind.length) {
404
423
  statuses.push("yellow");
405
424
  parts.push(msg("install.behind", { hosts: behind }));
425
+ decisive.push(["yellow", "install.behind"]);
406
426
  }
407
427
  }
408
428
  const blocking = (doctor?.blocking ?? []).filter((id) => CHECK_ID.test(id));
@@ -410,7 +430,10 @@ export function installSection({ versions, doctor }) {
410
430
  const [status, message] = doctorVerdict(doctor, blocking, warnings);
411
431
  if (status) statuses.push(status);
412
432
  parts.push(message);
413
- return result(worst(statuses), joinedSemi(parts), {
433
+ decisive.push([status ?? "green", message.id]);
434
+ const overall = worst(statuses);
435
+ const lead = decisive.find(([s]) => s === overall)[1];
436
+ return result(overall, joinedSemi(parts, lead), {
414
437
  versions,
415
438
  doctor: doctor?.ran ? { exit: doctor.exit, blocking, warnings } : null,
416
439
  });
@@ -506,7 +529,8 @@ export function sessionsSection({ sessions, usage }) {
506
529
  parts.push(msg("sessions.unpriced", { n: usage.unpricedModels.length }));
507
530
  }
508
531
  if (usage.truncatedFiles) parts.push(msg("sessions.partial", { n: usage.truncatedFiles }));
509
- return result(rows === null ? "yellow" : "green", joined(parts), { open, working, today });
532
+ const lead = rows === null ? "sessions.unreadable" : "sessions.open";
533
+ return result(rows === null ? "yellow" : "green", joined(parts, lead), { open, working, today });
510
534
  }
511
535
 
512
536
  // ---------------------------------------------------------------------------
@@ -546,7 +570,8 @@ export function autopilotSection(st, now = Date.now()) {
546
570
  ];
547
571
  if (awaiting) parts.push(msg("autopilot.waiting", { n: awaiting }));
548
572
  if (silent) parts.push(msg("autopilot.silent"));
549
- return result(silent || awaiting ? "yellow" : "green", joined(parts), data);
573
+ const lead = silent ? "autopilot.silent" : awaiting ? "autopilot.waiting" : "autopilot.on";
574
+ return result(silent || awaiting ? "yellow" : "green", joined(parts, lead), data);
550
575
  }
551
576
 
552
577
  export function officeSection(cur) {
@@ -580,11 +605,13 @@ export function diskSection(sys) {
580
605
  logsMb === null ? msg("disk.logsUnknown") : msg("disk.logs", { size: gb(logsMb) }),
581
606
  ];
582
607
  const statuses = [share < 0.1 ? "red" : share < 0.2 ? "yellow" : "green"];
583
- if (logsMb !== null && logsMb > 2 * MB) {
608
+ const prune = logsMb !== null && logsMb > 2 * MB;
609
+ if (prune) {
584
610
  statuses.push("yellow");
585
611
  parts.push(msg("disk.prune"));
586
612
  }
587
- return result(worst(statuses), joined(parts), data);
613
+ const lead = statuses[0] === "green" && prune ? "disk.prune" : "disk.free";
614
+ return result(worst(statuses), joined(parts, lead), data);
588
615
  }
589
616
 
590
617
  /** The newest green-gate stamp pre-push-check.sh left on this machine. */
@@ -0,0 +1,309 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * @file mcp-health.mjs - how the MCP servers a session uses are doing, per
4
+ * server and tool: calls, failures and when the last failure happened.
5
+ *
6
+ * Nothing here measures anything of its own. Two local files the hooks already
7
+ * write are read and never changed:
8
+ *
9
+ * mcp-failures.jsonl one row per failed call (note-mcp-failure.mjs): server,
10
+ * tool, time and a closed error class. Read with its
11
+ * previous generation.
12
+ * mcp-calls.json successful calls per host session, folded from
13
+ * mcp-calls.log the hook's own log; the lines no report has folded yet
14
+ * are counted as recent
15
+ *
16
+ * Only the last WINDOW_DAYS count. A counter session is counted whole when its
17
+ * last fold falls inside the window, including calls made before the window
18
+ * began; a failure row is counted by its own time. A call that failed is a call, so `calls` is
19
+ * the successful calls plus every failed one; `failures` leaves out the errors
20
+ * that say nothing about the server (invalid input, a refusal by the user or
21
+ * the permission layer, an interrupt), the same split `doctor` uses.
22
+ * `lastFailure` is the time of the last of those failures, to the minute.
23
+ * Successful calls are counted only while usage counting is on (the call
24
+ * counter's switches, note-mcp-failure.mjs callCountEnabled), failures always.
25
+ * With counting off the counter files are not read at all. `callsCounted` says which: false when counting is off or neither counter file
26
+ * exists, and then `calls` holds only the failed calls and is not a call count.
27
+ *
28
+ * Names follow the usage record's rule: a server is named only when it is on
29
+ * the shipped public list (lib/public-mcp-servers.mjs), any other server is the
30
+ * constant `private` with its tools folded into one `private` row, and a tool is
31
+ * named only when it is on the shipped tool list of this product's own server
32
+ * (the generated TOOLKIT_TOOLS), any other is `other`. Names, counts and
33
+ * minutes only: never arguments, results or error text.
34
+ *
35
+ * Files are read through rotated-log.mjs (a generation that is not a regular
36
+ * file is never read; a link or special file where a log or counter belongs is
37
+ * named in `skipped`, like one over the size cap) and the bounded regular-file reader (no link followed,
38
+ * at most READ_MAX bytes each). A file over the cap is left out and named in
39
+ * `skipped`; the rest still answers. Sizes of the answer are bounded too:
40
+ * MAX_SERVERS servers with MAX_TOOLS_PER_SERVER tools each, the rest folded
41
+ * into `other`.
42
+ *
43
+ * Local only: it describes which servers this machine has registered.
44
+ *
45
+ * Usage:
46
+ * mcp-health.mjs [--json]
47
+ *
48
+ * Exit: 0 printed, 2 usage.
49
+ *
50
+ * @module pipeline/scripts/mcp-health
51
+ */
52
+
53
+ import { lstatSync } from "node:fs";
54
+ import { join } from "node:path";
55
+
56
+ import { exitOnHelp } from "../lib/cli-help.mjs";
57
+ import { invokedDirectly } from "../lib/invoked-directly.mjs";
58
+ import { MCP_SERVER_ID } from "../lib/mcp-rename.mjs";
59
+ import { isPublicMcpServer } from "../lib/public-mcp-servers.mjs";
60
+ import { readRegularFile } from "../lib/regular-file.mjs";
61
+ import { rotatedPaths } from "../lib/rotated-log.mjs";
62
+ import { TOOLKIT_TOOLS } from "../lib/usage-names.generated.mjs";
63
+ import {
64
+ CALLER_SIDE,
65
+ CALLS_FILE,
66
+ CALLS_LOG,
67
+ ERROR_CLASSES,
68
+ LOG_FILE,
69
+ callKeyOf,
70
+ callCountEnabled,
71
+ } from "./note-mcp-failure.mjs";
72
+ import { logDir } from "./note-skill-use.mjs";
73
+
74
+ exitOnHelp(import.meta.url);
75
+
76
+ export const CONTRACT_VERSION = "1.0.0";
77
+ export const WINDOW_DAYS = 7;
78
+ const MAX_SERVERS = 5;
79
+ export const MAX_TOOLS_PER_SERVER = 20;
80
+ const MAX_COUNT = 1_000_000;
81
+ const READ_MAX = 4 * 1024 * 1024;
82
+ const DAY_MS = 86_400_000;
83
+ const TOOL_PART = /^[A-Za-z0-9_]{1,64}$/;
84
+ const SESSION_ID = /^[A-Za-z0-9_-]{8,64}$/;
85
+ const TOOLKIT_TOOL_SET = new Set(TOOLKIT_TOOLS);
86
+
87
+ /**
88
+ * The server and tool as the document names them, or null for a value that is
89
+ * not a string. A server off the public list is private whatever its name looks
90
+ * like, and a tool is named only from the shipped list, so no pattern decides
91
+ * whether a failure is counted.
92
+ */
93
+ function label(server, tool) {
94
+ if (typeof server !== "string" || typeof tool !== "string") return null;
95
+ if (!isPublicMcpServer(server)) return { server: "private", tool: "private" };
96
+ const named = server === MCP_SERVER_ID && TOOL_PART.test(tool) && TOOLKIT_TOOL_SET.has(tool);
97
+ return { server, tool: named ? tool : "other" };
98
+ }
99
+
100
+ const minute = (ms) => `${new Date(ms).toISOString().slice(0, 16)}:00Z`;
101
+
102
+ /** The file's text, or null with `skip` set when it exists and cannot be read within the bounds. */
103
+ function readBounded(path, dir, skip) {
104
+ try {
105
+ return readRegularFile(path, { maxBytes: READ_MAX, within: [dir], noFollow: true });
106
+ } catch (e) {
107
+ if (/ENOENT/.test(e?.message ?? "")) return null;
108
+ skip();
109
+ return null;
110
+ }
111
+ }
112
+
113
+ function failureRows(dir, skip) {
114
+ const out = [];
115
+ const file = join(dir, LOG_FILE);
116
+ const regular = new Set(rotatedPaths(file));
117
+ for (const path of [`${file}.1`, file]) {
118
+ if (regular.has(path)) continue;
119
+ try {
120
+ lstatSync(path);
121
+ skip();
122
+ } catch {
123
+ /* not there */
124
+ }
125
+ }
126
+ for (const path of regular) {
127
+ const text = readBounded(path, dir, skip);
128
+ for (const line of (text ?? "").split("\n")) {
129
+ if (!line.startsWith("{")) continue;
130
+ try {
131
+ const r = JSON.parse(line);
132
+ const named = label(r?.server, r?.tool);
133
+ const at = Date.parse(r?.ts);
134
+ if (named && Number.isFinite(at)) {
135
+ const cls = ERROR_CLASSES.includes(r.errorClass) ? r.errorClass : "other";
136
+ out.push({ ...named, at, serverSide: !CALLER_SIDE.has(cls) });
137
+ }
138
+ } catch {
139
+ /* a torn line */
140
+ }
141
+ }
142
+ }
143
+ return out;
144
+ }
145
+
146
+ function callCounts(dir, since, now, skip) {
147
+ const out = [];
148
+ let seen = false;
149
+ const add = (key, n) => {
150
+ const at = key.indexOf(":");
151
+ const named = at > 0 ? label(key.slice(0, at), key.slice(at + 1)) : null;
152
+ if (named && Number.isInteger(n) && n > 0) out.push({ ...named, n: Math.min(n, MAX_COUNT) });
153
+ };
154
+ const counter = readBounded(join(dir, CALLS_FILE), dir, () => skip("calls"));
155
+ if (counter !== null) {
156
+ seen = true;
157
+ try {
158
+ const sessions = JSON.parse(counter)?.sessions;
159
+ for (const s of Object.values(sessions && typeof sessions === "object" ? sessions : {})) {
160
+ const t = Date.parse(s?.t);
161
+ if (!(t >= since && t <= now) || !s?.calls || typeof s.calls !== "object") continue;
162
+ for (const [key, n] of Object.entries(s.calls)) add(key, n);
163
+ }
164
+ } catch {
165
+ /* a damaged counter counts nothing */
166
+ }
167
+ }
168
+ const pending = readBounded(join(dir, CALLS_LOG), dir, () => skip("calls"));
169
+ if (pending !== null) seen = true;
170
+ const tally = new Map();
171
+ for (const line of (pending ?? "").split("\n")) {
172
+ const [sid, name, extra] = line.split(" ");
173
+ if (extra !== undefined || !SESSION_ID.test(sid ?? "")) continue;
174
+ const key = callKeyOf(name);
175
+ if (key) tally.set(key, (tally.get(key) ?? 0) + 1);
176
+ }
177
+ for (const [key, n] of tally) add(key, n);
178
+ return { out, seen };
179
+ }
180
+
181
+ function fold(into, tool, patch) {
182
+ const t = into.get(tool) ?? { tool, calls: 0, failures: 0, last: 0 };
183
+ t.calls = Math.min(t.calls + (patch.calls ?? 0), MAX_COUNT);
184
+ t.failures = Math.min(t.failures + (patch.failures ?? 0), MAX_COUNT);
185
+ t.last = Math.max(t.last, patch.last ?? 0);
186
+ into.set(tool, t);
187
+ }
188
+
189
+ const shown = (t) => ({
190
+ tool: t.tool,
191
+ calls: t.calls,
192
+ failures: t.failures,
193
+ lastFailure: t.last ? minute(t.last) : null,
194
+ });
195
+
196
+ function limitTools(map) {
197
+ const ranked = [...map.values()].sort(
198
+ (a, b) => b.failures - a.failures || b.calls - a.calls || (a.tool < b.tool ? -1 : 1),
199
+ );
200
+ if (ranked.length <= MAX_TOOLS_PER_SERVER) return ranked;
201
+ const keep = ranked.filter((t) => t.tool !== "other").slice(0, MAX_TOOLS_PER_SERVER - 1);
202
+ const rest = new Map();
203
+ for (const t of ranked) {
204
+ if (!keep.includes(t)) fold(rest, "other", t);
205
+ }
206
+ return [...keep, ...rest.values()];
207
+ }
208
+
209
+ /**
210
+ * @param {{env?: NodeJS.ProcessEnv, now?: number}} [opts]
211
+ */
212
+ export function mcpHealth({ env = process.env, now = Date.now() } = {}) {
213
+ const dir = logDir(env);
214
+ const since = now - WINDOW_DAYS * DAY_MS;
215
+ const skipped = new Set();
216
+ const failures = failureRows(dir, () => skipped.add("failures")).filter(
217
+ (r) => r.at >= since && r.at <= now,
218
+ );
219
+ const countingOn = callCountEnabled(env);
220
+ const { out: counted, seen } = countingOn
221
+ ? callCounts(dir, since, now, (what) => skipped.add(what))
222
+ : { out: [], seen: false };
223
+ const callsCounted = countingOn && seen;
224
+
225
+ const servers = new Map();
226
+ const slot = (server) => {
227
+ if (!servers.has(server)) servers.set(server, new Map());
228
+ return servers.get(server);
229
+ };
230
+ for (const c of counted) fold(slot(c.server), c.tool, { calls: c.n });
231
+ for (const f of failures) {
232
+ fold(slot(f.server), f.tool, {
233
+ calls: 1,
234
+ failures: f.serverSide ? 1 : 0,
235
+ last: f.serverSide ? f.at : 0,
236
+ });
237
+ }
238
+
239
+ const rows = [...servers].map(([server, tools]) => {
240
+ const list = limitTools(tools);
241
+ return {
242
+ server,
243
+ calls: list.reduce((n, t) => n + t.calls, 0),
244
+ failures: list.reduce((n, t) => n + t.failures, 0),
245
+ lastFailure: list.reduce((m, t) => Math.max(m, t.last), 0),
246
+ tools: list.map(shown),
247
+ };
248
+ });
249
+ rows.sort(
250
+ (a, b) => b.failures - a.failures || b.calls - a.calls || (a.server < b.server ? -1 : 1),
251
+ );
252
+ const top = rows.slice(0, MAX_SERVERS).map((s) => ({
253
+ ...s,
254
+ lastFailure: s.lastFailure ? minute(s.lastFailure) : null,
255
+ }));
256
+ return {
257
+ contractVersion: CONTRACT_VERSION,
258
+ generatedAt: new Date(now).toISOString(),
259
+ ok: true,
260
+ windowDays: WINDOW_DAYS,
261
+ callsCounted,
262
+ servers: top,
263
+ totals: {
264
+ calls: top.reduce((n, s) => n + s.calls, 0),
265
+ failures: top.reduce((n, s) => n + s.failures, 0),
266
+ },
267
+ skipped: [...skipped].sort(),
268
+ };
269
+ }
270
+
271
+ /**
272
+ * A reader that reuses one answer for ttlMs, so a panel polling every few
273
+ * seconds reads the logs about once a minute.
274
+ * @param {{ttlMs?: number, now?: () => number, compute?: () => object}} [opts]
275
+ */
276
+ export function createMcpHealthCache({
277
+ ttlMs = 60_000,
278
+ now = Date.now,
279
+ compute = () => mcpHealth(),
280
+ } = {}) {
281
+ let at = -Infinity;
282
+ let doc = null;
283
+ return () => {
284
+ const t = now();
285
+ if (doc === null || t - at >= ttlMs || t < at) {
286
+ doc = compute();
287
+ at = t;
288
+ }
289
+ return doc;
290
+ };
291
+ }
292
+
293
+ if (invokedDirectly(import.meta.url)) {
294
+ const args = process.argv.slice(2);
295
+ if (args.some((a) => a !== "--json")) {
296
+ console.error("usage: mcp-health.mjs [--json]");
297
+ process.exit(2);
298
+ }
299
+ const doc = mcpHealth();
300
+ process.stdout.write(
301
+ args.includes("--json")
302
+ ? JSON.stringify(doc) + "\n"
303
+ : doc.servers.length
304
+ ? doc.servers
305
+ .map((s) => `${s.server}: ${s.calls} calls, ${s.failures} failures`)
306
+ .join("\n") + "\n"
307
+ : `no MCP calls recorded in the last ${doc.windowDays} days\n`,
308
+ );
309
+ }
@@ -248,6 +248,7 @@ export async function handleRequest(item, ctx) {
248
248
  audit(env, {
249
249
  device: req.deviceId,
250
250
  verb: req.verb,
251
+ run: issuedHandle(ctx.executor, req.deviceId, answer.run),
251
252
  outcome: answer.payload.ok ? "ok" : "refused",
252
253
  reason: answer.payload.ok ? (gap ? "gap" : "") : answer.payload.error,
253
254
  });
@@ -268,6 +269,16 @@ export async function handleRequest(item, ctx) {
268
269
  }
269
270
  }
270
271
 
272
+ /**
273
+ * The run value of a verb for the audit line: only a handle this device was
274
+ * given by the executor's table, never a raw run id or anything else the
275
+ * phone sent.
276
+ */
277
+ function issuedHandle(executor, deviceId, handle) {
278
+ if (typeof handle !== "string" || !executor?.handles) return "";
279
+ return executor.handles.resolve(deviceId, handle) === null ? "" : handle;
280
+ }
281
+
271
282
  const dropCode = (reason) =>
272
283
  String(reason)
273
284
  .toLowerCase()
@@ -294,24 +305,26 @@ async function decide(req, device, payload, ctx, now) {
294
305
  return { payload: refusal("iat") };
295
306
  }
296
307
 
308
+ let run = "";
297
309
  if (spec.target === "run") {
298
310
  const tag = runTag(b64uDecode(device.keys.tag), checked.args.run);
299
311
  if (!equalBytes(Buffer.from(tag), Buffer.from(req.runTag)))
300
312
  return { payload: refusal("run_tag") };
313
+ run = checked.args.run;
301
314
  } else if (req.runTag !== "") {
302
315
  return { payload: refusal("run_tag") };
303
316
  }
304
317
 
305
- if (spec.mutating && ctx.unattended()) return { payload: refusal("unattended") };
318
+ if (spec.mutating && ctx.unattended()) return { payload: refusal("unattended"), run };
306
319
 
307
- const run = ctx.executor[payload.verb];
308
- if (typeof run !== "function") return { payload: refusal("phase") };
320
+ const execute = ctx.executor[payload.verb];
321
+ if (typeof execute !== "function") return { payload: refusal("phase"), run };
309
322
  try {
310
- const result = await run(checked.args, { deviceId: req.deviceId });
311
- return { payload: { v: WIRE_VERSION, ok: true, result } };
323
+ const result = await execute(checked.args, { deviceId: req.deviceId });
324
+ return { payload: { v: WIRE_VERSION, ok: true, result }, run };
312
325
  } catch (err) {
313
326
  const code =
314
327
  typeof err?.code === "string" && /^[a-z_]{1,32}$/.test(err.code) ? err.code : "internal";
315
- return { payload: refusal(code) };
328
+ return { payload: refusal(code), run };
316
329
  }
317
330
  }
@@ -7,7 +7,7 @@
7
7
  * devices.json 0600 the pinned devices and their session keys,
8
8
  * counters and reply sequence; every change is a
9
9
  * locked read-modify-write, replaced atomically
10
- * audit.jsonl 0600 one line per request: time, device, verb, outcome;
10
+ * audit.jsonl 0600 one line per request: time, device, verb, run handle, outcome;
11
11
  * never content, rotated at a size cap
12
12
  * listener.json 0600 the background listener's pid record (lifecycle.mjs)
13
13
  *
@@ -24,6 +24,7 @@ import { updateJsonFileSync } from "../../lib/json-file-lock.mjs";
24
24
  import { appendFileSafe } from "../../lib/safe-write.mjs";
25
25
  import { readRegularJson } from "../../lib/regular-file.mjs";
26
26
  import { autopilotRoot } from "../../lib/pr-request-location.mjs";
27
+ import { HANDLE_PATTERN } from "./handles.mjs";
27
28
 
28
29
  export const MAX_DEVICES = 5;
29
30
  export const AUDIT_CAP_BYTES = 256 * 1024;
@@ -158,17 +159,19 @@ const AUDIT_OUTCOMES = new Set([
158
159
 
159
160
  /**
160
161
  * One audit line. Only the first 8 characters of the device id, the verb
161
- * name when it is a contract verb, a fixed outcome and a short reason code
162
- * are written: no argument, run id, answer, key or token ever reaches this
163
- * function's output.
162
+ * name when it is a contract verb, a fixed outcome, a short reason code and,
163
+ * for a verb about one run, that run's opaque handle (the value the phone
164
+ * holds, never the run id) are written: no argument, answer, key or token
165
+ * ever reaches this function's output.
164
166
  */
165
- export function audit(env, { device = "", verb = "", outcome, reason = "" }) {
167
+ export function audit(env, { device = "", verb = "", outcome, reason = "", run = "" }) {
166
168
  const line = {
167
169
  t: new Date().toISOString(),
168
170
  device: String(device).slice(0, 8),
169
171
  verb: /^[a-z][a-z0-9_]{0,31}$/.test(verb) ? verb : verb ? "unknown" : "",
170
172
  outcome: AUDIT_OUTCOMES.has(outcome) ? outcome : "dropped",
171
173
  reason: /^[a-z0-9:_-]{0,40}$/.test(reason) ? reason : "",
174
+ run: HANDLE_PATTERN.test(run) ? run : "",
172
175
  };
173
176
  try {
174
177
  ensureDir(env);
@@ -32,10 +32,9 @@
32
32
  *
33
33
  * Two kinds of entry are never prune candidates:
34
34
  *
35
- * rename aliases a SKILL.md carrying `renamed-to:` (_renamed-skills.mjs)
36
- * is left out of the catalog: it goes away by itself at the
37
- * release renamed.json names. A call under the old name
38
- * counts as a use of the skill it points at.
35
+ * rename aliases a SKILL.md carrying `renamed-to:`, left on a machine by an
36
+ * earlier release, is left out of the catalog. A call under
37
+ * the old name counts as a use of the skill it points at.
39
38
  * commands everything under ~/.claude/commands is listed as not
40
39
  * observable. A slash command the user types expands in
41
40
  * the prompt without a Skill tool call, so the hook never
@@ -65,7 +64,6 @@ import { exitOnHelp } from "../lib/cli-help.mjs";
65
64
  import { invokedDirectly } from "../lib/invoked-directly.mjs";
66
65
  import { marketplacePluginNames, pluginSkillRootCandidates } from "../lib/plugin-skill-roots.mjs";
67
66
  import { readRegularFile } from "../lib/regular-file.mjs";
68
- import { aliasTarget } from "./_renamed-skills.mjs";
69
67
  import { LOG_FILE, MAX_LOG_BYTES, SKILL_NAME, logDir } from "./note-skill-use.mjs";
70
68
 
71
69
  exitOnHelp(import.meta.url);
@@ -76,9 +74,22 @@ const DAY_MS = 86_400_000;
76
74
  const READ_CAP = MAX_LOG_BYTES * 4;
77
75
  const OUTCOMES = new Set(["ok", "error"]);
78
76
 
77
+ const ALIAS_TARGET = /^ {2}renamed-to: ([a-z0-9-]+)$/m;
78
+
79
79
  const home = (env) => env.HOME || homedir();
80
80
  const hidden = (name) => name.startsWith("_") || name.startsWith(".");
81
81
 
82
+ function aliasTarget(skillMdPath) {
83
+ try {
84
+ return (
85
+ ALIAS_TARGET.exec(readRegularFile(skillMdPath, { maxBytes: 65_536, noFollow: true }))?.[1] ??
86
+ null
87
+ );
88
+ } catch {
89
+ return null;
90
+ }
91
+ }
92
+
82
93
  function entries(dir) {
83
94
  try {
84
95
  return readdirSync(dir, { withFileTypes: true });
@@ -122,6 +122,15 @@ export function normalizeSummary(raw, _opts = {}) {
122
122
  return { generatedAt, overall, items };
123
123
  }
124
124
 
125
+ /**
126
+ * The reason id of a section message: the lead id of a message built from
127
+ * several parts when it is in the catalogue, else the message's own id.
128
+ */
129
+ function reasonOfMessage(message) {
130
+ const lead = reasonId(message?.lead);
131
+ return lead === "other" ? message?.id : lead;
132
+ }
133
+
125
134
  /**
126
135
  * health-report's document mapped to the contract: one item per section, the
127
136
  * reason being the id of the section's message (`other` when it carries none).
@@ -131,7 +140,7 @@ export function summaryFromReport(doc, _opts = {}) {
131
140
  const items = doc.sections.map((s) => ({
132
141
  id: s?.id,
133
142
  status: s?.status,
134
- reason: s?.message?.id,
143
+ reason: reasonOfMessage(s?.message),
135
144
  }));
136
145
  return normalizeSummary({ generatedAt: doc.generatedAt, overall: doc.status, items });
137
146
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schemaVersion": "1.0.0",
3
- "generatedAt": "2026-11-11T05:01:31Z",
4
- "skillCount": 256,
3
+ "generatedAt": "2026-11-13T09:42:49Z",
4
+ "skillCount": 257,
5
5
  "entries": [
6
6
  {
7
7
  "path": "shared/core/apple-archive-compliance/SKILL.md",
@@ -643,6 +643,10 @@
643
643
  "path": "shared/external/humanizer/SKILL.md",
644
644
  "sha256": "a2be491e7a27e61af1df11141b8e86659387242d7be5626c42eae0544265830e"
645
645
  },
646
+ {
647
+ "path": "shared/external/ink-animation/SKILL.md",
648
+ "sha256": "9b8ac225397c3e915a77be3ae510285437094d0c5fa0dc75045ef18010c6178a"
649
+ },
646
650
  {
647
651
  "path": "shared/external/ios-accessibility/SKILL.md",
648
652
  "sha256": "ea7471eafdd0845edfe9973a6ece9320498ee5f29dd8ee3353bbbc11fc05c889"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schemaVersion": "1.0.0",
3
- "skillCount": 256,
3
+ "skillCount": 257,
4
4
  "entries": [
5
5
  {
6
6
  "name": "accessibility-compliance-accessibility-audit",
@@ -871,6 +871,17 @@
871
871
  "triggerPaths": [],
872
872
  "relativePath": "shared/external/humanizer/SKILL.md"
873
873
  },
874
+ {
875
+ "name": "ink-animation",
876
+ "description": "Builds a hand-inked procedural line animation from a scene description: walking or running figures, trees, houses, lamps, clouds, birds, a sun or moon and a day cycle, as one self-contained animated SVG or HTML file or an MP4. Use when a small looping line-art scene is wanted. Not for tracing a phot",
877
+ "platform": null,
878
+ "group": "external",
879
+ "plugin": "ai-common-toolkit",
880
+ "invokeAs": "ai-common-toolkit:ink-animation",
881
+ "triggerKeywords": [],
882
+ "triggerPaths": [],
883
+ "relativePath": "shared/external/ink-animation/SKILL.md"
884
+ },
874
885
  {
875
886
  "name": "ios-accessibility",
876
887
  "description": "VoiceOver, Voice Control, Switch Control and Full Keyboard Access in SwiftUI, UIKit and AppKit: labels, traits, grouping, focus restore, Dynamic Type, Large Content Viewer, rotors, custom actions, accessibility checks and Nutrition Labels. Use when implementing, reviewing or auditing accessibility (",
@@ -2,12 +2,12 @@
2
2
 
3
3
  Single source of truth for skills delivered to both Claude Code (`~/.claude/skills/`) and Copilot CLI (`~/.copilot/skills/`) by the installer.
4
4
 
5
- **Total:** 256 skills (83 core + 173 external). Auto-generated by `scripts/gen-skills-index.mjs` - do not edit by hand.
5
+ **Total:** 257 skills (83 core + 174 external). Auto-generated by `scripts/gen-skills-index.mjs` - do not edit by hand.
6
6
 
7
7
  ## Directory layout
8
8
 
9
9
  - **`core/`** - 83 `multi-agent*` orchestration skills that are pipeline-critical. Edits here are core-code changes.
10
- - **`external/`** - 173 iOS / Android / generic skills that ship into the stack plugins.
10
+ - **`external/`** - 174 iOS / Android / generic skills that ship into the stack plugins.
11
11
  - Install destinations (ADR-0009): Claude Code gets NO local copy of `external/` - it loads those skills from the `multi-agent-plugins` marketplace, namespaced (`ai-<stack>-toolkit:<name>`); only the two compliance catalogs from `core/` land in `~/.claude/skills/`. Copilot CLI and Codex CLI receive a flat copy filtered to the enabled stacks. `external/` remains the single authoring source that `build-stack-plugins.mjs` publishes from.
12
12
 
13
13
  Source layout is logical grouping only - skill discovery at runtime is unchanged.
@@ -19,7 +19,7 @@ Source layout is logical grouping only - skill discovery at runtime is unchang
19
19
  - [Android / Kotlin](#android-kotlin) - 16
20
20
  - [Web](#web) - 10
21
21
  - [Backend / API](#backend-api) - 11
22
- - [Cross-cutting](#cross-cutting) - 41
22
+ - [Cross-cutting](#cross-cutting) - 42
23
23
 
24
24
  ## Pipeline Orchestration
25
25
 
@@ -290,6 +290,7 @@ Source layout is logical grouping only - skill discovery at runtime is unchang
290
290
  | [`github-actions-templates`](./external/github-actions-templates/) | `external` | Authoring GitHub Actions workflows: triggers, matrices, caching, concurrency, least-privilege permissions, SHA pinning, OIDC, reusable workf |
291
291
  | [`handle-request`](./external/handle-request/) | `external` | Adds the test handles a scenario needs and answers each request with ADDED, ALREADY or COULD NOT ADD plus file:line or reason. Identity valu |
292
292
  | [`humanizer`](./external/humanizer/) | `external` | Removes AI writing patterns so text reads as human-written: inflated language, filler phrases, AI vocabulary, mechanical structure, sycophan |
293
+ | [`ink-animation`](./external/ink-animation/) | `external` | Builds a hand-inked procedural line animation from a scene description: walking or running figures, trees, houses, lamps, clouds, birds, a s |
293
294
  | [`localization-reuse-map`](./external/localization-reuse-map/) | `external` | Localization reuse map for one redesigned screen on iOS, Android and web: new keys set against each platform's legacy key, legacy values and |
294
295
  | [`package-build-audit`](./external/package-build-audit/) | `external` | Finds SwiftPM causes of slow builds: graph shape, plugins, module variants, cycles, umbrella modules, macro cascades and pins, as recommend- |
295
296
  | [`pdfkit`](./external/pdfkit/) | `external` | PDFKit on iOS: PDFView display and SwiftUI wrapping, creating and editing PDFDocument and PDFPage, highlight, note, signature and form annot |