@mmerterden/multi-agent-pipeline 23.6.0 → 24.0.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 (167) hide show
  1. package/CHANGELOG.md +56 -1
  2. package/README.md +61 -27
  3. package/README.tr.md +46 -12
  4. package/SECURITY.md +3 -3
  5. package/docs/architecture.md +47 -8
  6. package/docs/ecosystem.md +20 -18
  7. package/docs/engineering.md +1 -1
  8. package/docs/facts.json +8 -6
  9. package/docs/features.md +59 -15
  10. package/install/_codex-agents.mjs +13 -8
  11. package/install/_common.mjs +24 -0
  12. package/install/_dev-only-files.mjs +4 -0
  13. package/install/_mcp-register.mjs +6 -2
  14. package/install/_rewrite-tree.mjs +197 -0
  15. package/install/codex.mjs +96 -180
  16. package/install/copilot.mjs +24 -54
  17. package/install/index.mjs +29 -11
  18. package/install/templates/codex-instructions.md +21 -5
  19. package/install/templates/copilot-instructions.md +21 -14
  20. package/manifest.json +2082 -0
  21. package/package.json +6 -2
  22. package/pipeline/commands/multi-agent/SKILL.md +7 -5
  23. package/pipeline/commands/multi-agent/analysis/SKILL.md +4 -0
  24. package/pipeline/commands/multi-agent/autopilot-on/SKILL.md +31 -3
  25. package/pipeline/commands/multi-agent/autopilot-status/SKILL.md +5 -1
  26. package/pipeline/commands/multi-agent/channels/SKILL.md +16 -8
  27. package/pipeline/commands/multi-agent/log/SKILL.md +2 -0
  28. package/pipeline/commands/multi-agent/resume/SKILL.md +2 -0
  29. package/pipeline/commands/multi-agent/review-rounds/SKILL.md +94 -0
  30. package/pipeline/commands/multi-agent/stack/SKILL.md +1 -1
  31. package/pipeline/commands/multi-agent/sync/SKILL.md +3 -3
  32. package/pipeline/contract/manifest.json +1 -1
  33. package/pipeline/contract/types/index.d.ts +1 -0
  34. package/pipeline/lib/_jira-auth.sh +50 -78
  35. package/pipeline/lib/_service-account.sh +191 -0
  36. package/pipeline/lib/credential-inventory.sh +49 -37
  37. package/pipeline/lib/credential-store.sh +48 -3
  38. package/pipeline/lib/fetch-confluence.sh +76 -92
  39. package/pipeline/lib/fetch-crashlytics.sh +30 -59
  40. package/pipeline/lib/fetch-figma-annotations.sh +9 -9
  41. package/pipeline/lib/fetch-fortify.sh +77 -81
  42. package/pipeline/lib/fetch-graylog.sh +38 -77
  43. package/pipeline/lib/figma-mcp-refresh.sh +23 -4
  44. package/pipeline/lib/figma-screenshot.sh +7 -8
  45. package/pipeline/lib/figma-token.sh +39 -46
  46. package/pipeline/lib/host.mjs +138 -0
  47. package/pipeline/lib/host.sh +48 -0
  48. package/pipeline/lib/issue-fetcher.sh +25 -41
  49. package/pipeline/lib/jira-publish.sh +23 -21
  50. package/pipeline/lib/local-model.mjs +93 -0
  51. package/pipeline/lib/md2confluence-v3.py +37 -30
  52. package/pipeline/lib/model-dispatch.sh +41 -4
  53. package/pipeline/lib/model-resolve.mjs +58 -0
  54. package/pipeline/lib/post-pr-review.sh +38 -53
  55. package/pipeline/lib/reviewer-families.mjs +70 -0
  56. package/pipeline/lib/service-account.mjs +2131 -0
  57. package/pipeline/lib/service-account.sh +35 -0
  58. package/pipeline/lib/usage-names.generated.mjs +3 -0
  59. package/pipeline/lib/usage-token.mjs +64 -24
  60. package/pipeline/lib/usage-vocab.mjs +1 -1
  61. package/pipeline/lib/user-facing.mjs +11 -3
  62. package/pipeline/lib/vercel-deploy.sh +17 -26
  63. package/pipeline/multi-agent-refs/_entry-picker.md +62 -0
  64. package/pipeline/multi-agent-refs/_input-parser.md +1 -1
  65. package/pipeline/multi-agent-refs/analysis/intake.md +2 -0
  66. package/pipeline/multi-agent-refs/analysis/reusable-refs.md +1 -0
  67. package/pipeline/multi-agent-refs/analysis/unattended.md +135 -0
  68. package/pipeline/multi-agent-refs/autopilot-on/details.md +16 -0
  69. package/pipeline/multi-agent-refs/channels/generator.md +10 -2
  70. package/pipeline/multi-agent-refs/channels/menu.md +3 -1
  71. package/pipeline/multi-agent-refs/channels/preview.md +3 -1
  72. package/pipeline/multi-agent-refs/channels/reference.md +16 -2
  73. package/pipeline/multi-agent-refs/channels/report-file.md +188 -0
  74. package/pipeline/multi-agent-refs/component-dispatch.md +2 -2
  75. package/pipeline/multi-agent-refs/cross-cli-contract.md +38 -30
  76. package/pipeline/multi-agent-refs/features/autopilot-circuit-breaker.md +4 -4
  77. package/pipeline/multi-agent-refs/features/doctor.md +37 -11
  78. package/pipeline/multi-agent-refs/features/free-models.md +3 -3
  79. package/pipeline/multi-agent-refs/features/local-model.md +87 -0
  80. package/pipeline/multi-agent-refs/features/model-fallback.md +25 -10
  81. package/pipeline/multi-agent-refs/features/product-context.md +6 -5
  82. package/pipeline/multi-agent-refs/features/review-delta.md +1 -1
  83. package/pipeline/multi-agent-refs/features/review-rounds.md +40 -0
  84. package/pipeline/multi-agent-refs/features/rework-escalation.md +5 -4
  85. package/pipeline/multi-agent-refs/features/service-accounts.md +233 -0
  86. package/pipeline/multi-agent-refs/features/unattended-security.md +10 -1
  87. package/pipeline/multi-agent-refs/help/en.md +31 -2
  88. package/pipeline/multi-agent-refs/help/tr.md +31 -2
  89. package/pipeline/multi-agent-refs/orchestrator/copilot-pipeline.md +3 -2
  90. package/pipeline/multi-agent-refs/orchestrator/dispatcher.md +2 -1
  91. package/pipeline/multi-agent-refs/phases/modes.md +20 -1
  92. package/pipeline/multi-agent-refs/phases/operations.md +1 -1
  93. package/pipeline/multi-agent-refs/phases/phase-0-init.md +1 -1
  94. package/pipeline/multi-agent-refs/phases/phase-2-dev.md +4 -4
  95. package/pipeline/multi-agent-refs/phases/phase-3-review.md +7 -3
  96. package/pipeline/multi-agent-refs/phases/phase-5-report.md +12 -10
  97. package/pipeline/multi-agent-refs/phases.md +4 -3
  98. package/pipeline/multi-agent-refs/resume/details.md +2 -0
  99. package/pipeline/multi-agent-refs/review/panel.md +30 -18
  100. package/pipeline/multi-agent-refs/setup/discovery.md +17 -5
  101. package/pipeline/multi-agent-refs/setup/token-save-flow.md +21 -2
  102. package/pipeline/multi-agent-refs/sync/overview.md +11 -5
  103. package/pipeline/multi-agent-refs/tracker-contract.md +28 -10
  104. package/pipeline/office/index.html +4 -4
  105. package/pipeline/schemas/agent-state.schema.json +19 -1
  106. package/pipeline/schemas/autopilot-config.schema.json +29 -4
  107. package/pipeline/schemas/hosts.json +512 -0
  108. package/pipeline/schemas/hosts.schema.json +310 -0
  109. package/pipeline/schemas/launch.json +22 -2
  110. package/pipeline/schemas/launch.schema.json +2 -1
  111. package/pipeline/schemas/phases.json +21 -3
  112. package/pipeline/schemas/phases.schema.json +8 -0
  113. package/pipeline/schemas/prefs.schema.json +346 -7
  114. package/pipeline/schemas/token-budget.json +2 -2
  115. package/pipeline/scripts/.doctor-mut.47076.mjs +2253 -0
  116. package/pipeline/scripts/_autopilot-config.mjs +67 -4
  117. package/pipeline/scripts/_autopilot-item.mjs +67 -0
  118. package/pipeline/scripts/_autopilot-outcomes.mjs +6 -0
  119. package/pipeline/scripts/_cost.mjs +75 -3
  120. package/pipeline/scripts/analysis-sources.mjs +22 -5
  121. package/pipeline/scripts/analysis-unattended.mjs +360 -0
  122. package/pipeline/scripts/anonymize-findings.mjs +3 -7
  123. package/pipeline/scripts/autopilot-arming.mjs +19 -10
  124. package/pipeline/scripts/autopilot-intake.mjs +124 -27
  125. package/pipeline/scripts/autopilot-menubar.swift +7 -0
  126. package/pipeline/scripts/autopilot-runner.mjs +77 -48
  127. package/pipeline/scripts/autopilot-status.sh +32 -9
  128. package/pipeline/scripts/bulk-read.sh +37 -5
  129. package/pipeline/scripts/confluence-readback.mjs +15 -7
  130. package/pipeline/scripts/cost-table.json +65 -25
  131. package/pipeline/scripts/doctor.mjs +119 -32
  132. package/pipeline/scripts/entry-mode.mjs +101 -0
  133. package/pipeline/scripts/estimate.mjs +30 -16
  134. package/pipeline/scripts/feedback-send.mjs +11 -8
  135. package/pipeline/scripts/gen-facts.mjs +16 -13
  136. package/pipeline/scripts/jira-attach.sh +23 -28
  137. package/pipeline/scripts/jira-search.sh +5 -21
  138. package/pipeline/scripts/launch-request.mjs +15 -9
  139. package/pipeline/scripts/migrate-prefs.mjs +56 -0
  140. package/pipeline/scripts/phase-tracker.sh +146 -38
  141. package/pipeline/scripts/priority-review.mjs +14 -7
  142. package/pipeline/scripts/product-context.mjs +26 -7
  143. package/pipeline/scripts/prune-logs.sh +4 -2
  144. package/pipeline/scripts/report-file.mjs +285 -0
  145. package/pipeline/scripts/review-rounds.mjs +592 -0
  146. package/pipeline/scripts/rework-escalation.mjs +26 -7
  147. package/pipeline/scripts/service-read.mjs +19 -17
  148. package/pipeline/scripts/skill-siblings.mjs +17 -1
  149. package/pipeline/scripts/status-overview.mjs +20 -10
  150. package/pipeline/scripts/uninstall.mjs +145 -57
  151. package/pipeline/scripts/usage-register.mjs +34 -11
  152. package/pipeline/scripts/usage-report.mjs +31 -26
  153. package/pipeline/scripts/validate-state.mjs +19 -11
  154. package/pipeline/scripts/validate-triage.mjs +11 -1
  155. package/pipeline/scripts/work-items.mjs +25 -28
  156. package/pipeline/scripts/write-store-config.mjs +37 -11
  157. package/pipeline/skills/.skill-manifest.json +11 -7
  158. package/pipeline/skills/.skills-index.json +13 -2
  159. package/pipeline/skills/shared/README.md +4 -3
  160. package/pipeline/skills/shared/core/multi-agent/SKILL.md +14 -6
  161. package/pipeline/skills/shared/core/multi-agent-analysis/SKILL.md +2 -0
  162. package/pipeline/skills/shared/core/multi-agent-channels/SKILL.md +11 -8
  163. package/pipeline/skills/shared/core/multi-agent-resume/SKILL.md +1 -1
  164. package/pipeline/skills/shared/core/multi-agent-review-rounds/SKILL.md +92 -0
  165. package/pipeline/skills/shared/core/multi-agent-sync/SKILL.md +3 -3
  166. package/pipeline/skills/skills-index.md +2 -1
  167. package/pipeline/lib/credential-resolve.mjs +0 -75
@@ -4,30 +4,62 @@
4
4
  "verifiedAt": "2026-10-14",
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
- "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 },
9
- "claude-opus-5": { "inPerMtok": 5.0, "outPerMtok": 25.0, "cacheReadPerMtok": 0.5 },
10
- "claude-sonnet-5": { "inPerMtok": 2.0, "outPerMtok": 10.0, "cacheReadPerMtok": 0.2 },
11
- "claude-haiku-4-5": { "inPerMtok": 1.0, "outPerMtok": 5.0, "cacheReadPerMtok": 0.1 }
7
+ "claude-fable-5": {
8
+ "inPerMtok": 10,
9
+ "outPerMtok": 50,
10
+ "cacheReadPerMtok": 1
11
+ },
12
+ "claude-fable-5-1": {
13
+ "inPerMtok": 10,
14
+ "outPerMtok": 50,
15
+ "cacheReadPerMtok": 0.25
16
+ },
17
+ "claude-opus-5": {
18
+ "inPerMtok": 5,
19
+ "outPerMtok": 25,
20
+ "cacheReadPerMtok": 0.5
21
+ },
22
+ "claude-sonnet-5": {
23
+ "inPerMtok": 2,
24
+ "outPerMtok": 10,
25
+ "cacheReadPerMtok": 0.2
26
+ },
27
+ "claude-haiku-4-5": {
28
+ "inPerMtok": 1,
29
+ "outPerMtok": 5,
30
+ "cacheReadPerMtok": 0.1
31
+ }
12
32
  },
13
33
  "_modelsReadme": "`models` prices wire IDs a rung dispatches whose model is not the rung's `modelId`: Copilot CLI's `copilotModelId` values name an older model than the rung's, billed at that model's own rate. Keyed by the exact ID; cost-analyze consults it before the rung rates, so a Copilot CLI session is priced at its own model. Official Anthropic prices per million tokens, verified 2026-10-14.",
14
34
  "models": {
15
- "claude-opus-4.7": { "inPerMtok": 5.0, "outPerMtok": 25.0, "cacheReadPerMtok": 0.5 },
16
- "claude-sonnet-4.6": { "inPerMtok": 3.0, "outPerMtok": 15.0, "cacheReadPerMtok": 0.3 },
17
- "claude-haiku-4.5": { "inPerMtok": 1.0, "outPerMtok": 5.0, "cacheReadPerMtok": 0.1 }
35
+ "claude-opus-4.7": {
36
+ "inPerMtok": 5,
37
+ "outPerMtok": 25,
38
+ "cacheReadPerMtok": 0.5
39
+ },
40
+ "claude-sonnet-4.6": {
41
+ "inPerMtok": 3,
42
+ "outPerMtok": 15,
43
+ "cacheReadPerMtok": 0.3
44
+ },
45
+ "claude-haiku-4.5": {
46
+ "inPerMtok": 1,
47
+ "outPerMtok": 5,
48
+ "cacheReadPerMtok": 0.1
49
+ }
18
50
  },
19
51
  "prices": {
20
52
  "fable": {
21
- "inPerMtok": 8.0,
22
- "outPerMtok": 40.0,
53
+ "inPerMtok": 8,
54
+ "outPerMtok": 40,
23
55
  "cacheReadPerMtok": 0.2,
24
56
  "modelId": "claude-fable-5-2",
25
57
  "provider": "anthropic",
26
58
  "note": "Top tier - architects, Reviewer 1 and triage on Claude Code. Claude Fable 5.2, verified against Anthropic pricing 2026-11-03."
27
59
  },
28
60
  "opus": {
29
- "inPerMtok": 4.0,
30
- "outPerMtok": 20.0,
61
+ "inPerMtok": 4,
62
+ "outPerMtok": 20,
31
63
  "cacheReadPerMtok": 0.2,
32
64
  "modelId": "claude-opus-5-5",
33
65
  "copilotModelId": "claude-opus-4.7",
@@ -35,8 +67,8 @@
35
67
  "note": "Second tier - Reviewer 2 on Claude Code, Reviewer 1 and triage on Copilot CLI, and the opus rung of the fable -> opus -> sonnet fallback ladder. Claude Opus 5.5, verified against Anthropic pricing 2026-10-14."
36
68
  },
37
69
  "sonnet": {
38
- "inPerMtok": 2.0,
39
- "outPerMtok": 10.0,
70
+ "inPerMtok": 2,
71
+ "outPerMtok": 10,
40
72
  "cacheReadPerMtok": 0.1,
41
73
  "modelId": "claude-sonnet-5-5",
42
74
  "copilotModelId": "claude-sonnet-4.6",
@@ -53,36 +85,44 @@
53
85
  "note": "Speed tier - task-clarifier and other latency-sensitive dispatches, plus the terminal rung of the fallback ladder. Claude Haiku 5.5 is priced in two tiers by prompt length (in 0.10, cache-read 0.01, out 0.50 up to 100k input tokens; in 0.50, cache-read 0.05, out 2.50 above); this table holds one rate per rung, so it carries the over-100k tier: over-reporting is the safe direction for a cost ledger. Verified against Anthropic pricing 2026-10-14."
54
86
  },
55
87
  "gpt-5.4": {
56
- "inPerMtok": 10.0,
57
- "outPerMtok": 30.0,
58
- "cacheReadPerMtok": 1.0,
88
+ "inPerMtok": 10,
89
+ "outPerMtok": 30,
90
+ "cacheReadPerMtok": 1,
59
91
  "modelId": "gpt-5.4",
60
92
  "provider": "openai",
61
93
  "note": "Copilot CLI Reviewer 2 and Codex CLI Reviewer 2 - approximate; verify against OpenAI pricing page before relying on totals."
62
94
  },
63
95
  "gpt-5.6": {
64
- "inPerMtok": 10.0,
65
- "outPerMtok": 30.0,
66
- "cacheReadPerMtok": 1.0,
96
+ "inPerMtok": 10,
97
+ "outPerMtok": 30,
98
+ "cacheReadPerMtok": 1,
67
99
  "modelId": "gpt-5.6",
68
100
  "provider": "openai",
69
101
  "note": "Codex CLI top tier - Reviewer 1 at xhigh effort, Reviewer 3 at medium, triage at max, and the fable/opus rungs of the Codex persona tier map. Reasoning effort changes output volume, not the per-token rate, so one entry covers every effort level. Approximate; verify against OpenAI pricing before relying on totals."
70
102
  },
71
103
  "gpt-5.6-terra": {
72
- "inPerMtok": 1.0,
73
- "outPerMtok": 5.0,
104
+ "inPerMtok": 1,
105
+ "outPerMtok": 5,
74
106
  "cacheReadPerMtok": 0.1,
75
107
  "modelId": "gpt-5.6-terra",
76
108
  "provider": "openai",
77
109
  "note": "Codex CLI floor tier - speed-optimised, maps the haiku rung of the Codex persona tier map (task-clarifier). Approximate; verify against OpenAI pricing before relying on totals."
78
110
  },
79
111
  "free": {
80
- "inPerMtok": 0.0,
81
- "outPerMtok": 0.0,
82
- "cacheReadPerMtok": 0.0,
112
+ "inPerMtok": 0,
113
+ "outPerMtok": 0,
114
+ "cacheReadPerMtok": 0,
83
115
  "modelId": "free-chain",
84
116
  "provider": "free-chain",
85
117
  "note": "Layer 2: the multi-agent-mcp's verified free-model chain (llm_delegate / multi-agent-mcp-llm) over free tiers - Groq, Mistral, Gemini, OpenRouter free models, Z.AI GLM Flash, local Ollama. Priced at zero because the provider bills nothing on a free tier; what it saves is reported by route-status from the toolkit's usage log at the rate of the rung it replaced."
118
+ },
119
+ "local": {
120
+ "inPerMtok": 0,
121
+ "outPerMtok": 0,
122
+ "cacheReadPerMtok": 0,
123
+ "modelId": "local",
124
+ "provider": "local",
125
+ "note": "A model served from this machine. Priced at zero because no invoice follows a token, which is the point of the rung; the ledger still counts the tokens, so a run on it is comparable with one that cost money."
86
126
  }
87
127
  }
88
128
  }
@@ -70,10 +70,13 @@ import { prefsHosts, profileGaps } from "../lib/unattended-profile-check.mjs";
70
70
  import { xcodeSkillsStatus } from "../lib/xcode-plugin.mjs";
71
71
  import { hookReport, registrationGaps } from "../lib/hook-registration.mjs";
72
72
  import { PREFS_ENV, globalPref, prefsFileIn } from "../lib/prefs-value.mjs";
73
+ import { itemNames } from "../lib/service-account.mjs";
73
74
  import { check as lowDiskCheck } from "../lib/low-disk.mjs";
74
75
  import { exitOnHelp } from "../lib/cli-help.mjs";
75
76
  import { LEGACY_SERVER_ID, MCP_SERVER_ID, projectLegacyEntries } from "../lib/mcp-rename.mjs";
76
77
  import { didYouMean } from "../lib/args.mjs";
78
+ import { HOST_IDS, STATE_ROOT, currentHostId, host } from "../lib/host.mjs";
79
+ import { localModelProblem } from "../lib/local-model.mjs";
77
80
  import { reportingState } from "./usage-register.mjs";
78
81
  import { accessDoctorLine, readAccessState } from "./usage-access.mjs";
79
82
  import { familyLine, loadFromManifest, schemaLoadByFamily } from "../lib/mcp-schema-load.mjs";
@@ -82,7 +85,16 @@ exitOnHelp(import.meta.url);
82
85
 
83
86
  const HERE = dirname(fileURLToPath(import.meta.url));
84
87
  const HOME = homedir();
85
- const CLAUDE = join(HOME, ".claude");
88
+ // Shared state: logs, preferences, knowledge and the Claude Code settings file
89
+ // live here whichever hosts are installed.
90
+ const CLAUDE = join(HOME, STATE_ROOT);
91
+ // The install this doctor is part of. Running from a checkout there is no
92
+ // install to read, so the checks that need one answer about the first host.
93
+ // Reading `.claude` on a Copilot-only machine reported "no install" on a
94
+ // machine with a complete one.
95
+ const HOST_ID = currentHostId(HERE) ?? HOST_IDS[0];
96
+ const HOST = host(HOST_ID);
97
+ const HOST_TREE = currentHostId(HERE) ? dirname(HERE) : join(HOME, HOST.install.root);
86
98
  const PREFS = prefsFileIn(HOME);
87
99
 
88
100
  const argv = process.argv.slice(2);
@@ -146,6 +158,7 @@ const CHECK_IDS = [
146
158
  "usage-register",
147
159
  "access",
148
160
  "free-models",
161
+ "local-model",
149
162
  "xcode-skills",
150
163
  "routine-commands",
151
164
  "mcp-legacy-names",
@@ -225,7 +238,7 @@ function readJson(path) {
225
238
  // resolves against whatever that file names - which on a machine configured for
226
239
  // GitHub Packages is a 404 and a process that never starts. A health check whose
227
240
  // one step silently fails is worse than no step. Rule: smoke-npm-scope-pinning.sh.
228
- const SUBTREES = ["commands", "multi-agent-refs", "scripts", "lib", "schemas"];
241
+ const SUBTREES = HOST.install.subtrees;
229
242
 
230
243
  // Runs before everything else so a non-darwin host gets one honest line instead
231
244
  // of a cascade of failures whose common cause is never stated. This blocks
@@ -247,16 +260,16 @@ function checkHostPlatform() {
247
260
  }
248
261
 
249
262
  function checkInstallPresent() {
250
- if (!existsSync(CLAUDE)) {
263
+ if (!existsSync(HOST_TREE)) {
251
264
  report(
252
265
  "install-present",
253
266
  "BLOCK",
254
- `no install at ${CLAUDE}`,
267
+ `no install at ${HOST_TREE}`,
255
268
  "run npx --@mmerterden:registry=https://registry.npmjs.org @mmerterden/multi-agent-pipeline install",
256
269
  );
257
270
  return false;
258
271
  }
259
- const missing = SUBTREES.filter((d) => !existsSync(join(CLAUDE, d)));
272
+ const missing = SUBTREES.filter((d) => !existsSync(join(HOST_TREE, d)));
260
273
  if (missing.length) {
261
274
  report(
262
275
  "install-present",
@@ -271,7 +284,7 @@ function checkInstallPresent() {
271
284
  }
272
285
 
273
286
  function checkInstallVersion() {
274
- const stamp = join(CLAUDE, ".pipeline-version");
287
+ const stamp = join(HOST_TREE, ".pipeline-version");
275
288
  if (!existsSync(stamp)) {
276
289
  skip("install-version", "no .pipeline-version stamp in the installed tree");
277
290
  return;
@@ -333,7 +346,7 @@ function checkUpdatePolicy() {
333
346
  }
334
347
 
335
348
  function checkScriptSurface() {
336
- const cmdDir = join(CLAUDE, "commands", "multi-agent");
349
+ const cmdDir = join(HOST_TREE, HOST.install.commandSpecs);
337
350
  if (!existsSync(cmdDir)) {
338
351
  skip("script-surface", "no installed command tree to read");
339
352
  return;
@@ -347,13 +360,19 @@ function checkScriptSurface() {
347
360
  // `scripts/nested/bar.mjs` was truncated to the directory, so as long as the
348
361
  // directory existed a missing file one level inside it passed - the check
349
362
  // reported OK for exactly the case it exists to catch.
363
+ // The install rewrites `$HOME/.claude/...` into the host's own root as the
364
+ // files land, so the text to match is this host's spelling, not the one the
365
+ // repo is written in.
350
366
  for (const m of text.matchAll(
351
- /\$HOME\/\.claude\/(scripts|lib)\/([A-Za-z0-9._-]+(?:\/[A-Za-z0-9._-]+)*)/g,
367
+ new RegExp(
368
+ `\\$HOME/\\${HOST.install.root}/(scripts|lib)/([A-Za-z0-9._-]+(?:/[A-Za-z0-9._-]+)*)`,
369
+ "g",
370
+ ),
352
371
  )) {
353
372
  wanted.add(join(m[1], m[2]));
354
373
  }
355
374
  }
356
- const missing = [...wanted].filter((rel) => !existsSync(join(CLAUDE, rel))).sort();
375
+ const missing = [...wanted].filter((rel) => !existsSync(join(HOST_TREE, rel))).sort();
357
376
  if (missing.length) {
358
377
  report(
359
378
  "script-surface",
@@ -368,7 +387,7 @@ function checkScriptSurface() {
368
387
  }
369
388
 
370
389
  function checkSkillSiblings() {
371
- const sib = join(CLAUDE, "scripts", "skill-siblings.mjs");
390
+ const sib = join(HOST_TREE, "scripts", "skill-siblings.mjs");
372
391
  if (!existsSync(sib)) {
373
392
  skip("skill-siblings", "skill-siblings.mjs is not installed");
374
393
  return;
@@ -409,7 +428,7 @@ function checkSkillSiblings() {
409
428
  // as unsynced told the user to run a sync that would change nothing - a health
410
429
  // check whose one step is a no-op teaches people to ignore it.
411
430
  const localOnly = new Set();
412
- const cmdRoot = join(CLAUDE, "commands", "multi-agent");
431
+ const cmdRoot = join(HOST_TREE, HOST.install.commandSpecs);
413
432
  if (existsSync(cmdRoot)) {
414
433
  for (const d of readdirSync(cmdRoot)) {
415
434
  const f = join(cmdRoot, d, "SKILL.md");
@@ -499,6 +518,13 @@ function checkIdentity() {
499
518
  }
500
519
 
501
520
  function checkHookCoverage() {
521
+ // These hooks are entries in Claude Code's own settings file, which only that
522
+ // host reads, so the template and the file it merges into are both under the
523
+ // state root rather than under this host's tree.
524
+ if (HOST_ID !== "claude") {
525
+ skip("hook-coverage", `${HOST.label} does not read Claude Code's hooks file`);
526
+ return;
527
+ }
502
528
  const tpl = join(CLAUDE, "templates", "claude-hooks.json");
503
529
  if (!existsSync(tpl)) {
504
530
  skip("hook-coverage", "no hooks template installed to compare against");
@@ -563,6 +589,13 @@ function checkHookCoverage() {
563
589
  // ~/.claude/scripts, no disableAllHooks; and which preferences do nothing
564
590
  // because their hook is missing (lib/hook-registration.mjs).
565
591
  function checkHookReachability() {
592
+ // These hooks are entries in Claude Code's own settings file, which only that
593
+ // host reads, so the template and the file it merges into are both under the
594
+ // state root rather than under this host's tree.
595
+ if (HOST_ID !== "claude") {
596
+ skip("hook-reachability", `${HOST.label} does not read Claude Code's hooks file`);
597
+ return;
598
+ }
566
599
  const tpl = join(CLAUDE, "templates", "claude-hooks.json");
567
600
  if (!existsSync(tpl)) {
568
601
  skip("hook-reachability", "no hooks template installed to compare against");
@@ -715,7 +748,7 @@ function checkGuardRules() {
715
748
  }
716
749
 
717
750
  function credentialInventory() {
718
- const inv = join(CLAUDE, "lib", "credential-inventory.sh");
751
+ const inv = join(HOST_TREE, "lib", "credential-inventory.sh");
719
752
  if (!existsSync(inv)) return null;
720
753
  try {
721
754
  const args = PROBE ? [inv, "--json", "--probe"] : [inv, "--json"];
@@ -804,27 +837,29 @@ function checkCredentials(inv) {
804
837
 
805
838
  // The toolkit's store_* tools find the App Store Connect and Google Play keys
806
839
  // through a reference file naming Keychain services, written by
807
- // write-store-config.mjs from keychainMapping. A mapping the file does not
808
- // reflect means the keys sit in the Keychain and every store call still says
809
- // "not onboarded". Nothing mapped is nothing claimed, so that case is OK.
810
- const STORE_OF_KEY = {
811
- appstore_connect_key_id: "appStoreConnect",
812
- appstore_connect_issuer_id: "appStoreConnect",
813
- appstore_connect_private_key: "appStoreConnect",
840
+ // write-store-config.mjs from the items this machine's accounts name. A file
841
+ // that does not reflect them means the keys sit in the Keychain and every
842
+ // store call still says "not onboarded". No account is nothing claimed, so
843
+ // that case is OK.
844
+ const STORE_OF_SERVICE = {
845
+ appstore_connect: "appStoreConnect",
814
846
  google_play: "googlePlay",
815
847
  };
848
+ const STORE_SLOTS = {
849
+ appstore_connect: ["key_id", "issuer_id", "private_key"],
850
+ google_play: ["service_account_json"],
851
+ };
816
852
  const STORE_LABELS = { appStoreConnect: "App Store Connect", googlePlay: "Google Play" };
817
853
 
818
- // The host tree this doctor was installed into (~/.claude, ~/.copilot or
819
- // ~/.codex); run from a checkout, the Claude tree.
820
- const HOST_TREE = [".claude", ".copilot", ".codex"].includes(basename(dirname(HERE)))
821
- ? dirname(HERE)
822
- : CLAUDE;
854
+ /** The stores whose keys this machine's accounts name at all. */
855
+ function storesNamed(prefs) {
856
+ const named = itemNames(prefs).filter((x) => STORE_SLOTS[x.service]?.includes(x.slot));
857
+ return [...new Set(named.map((x) => STORE_OF_SERVICE[x.service]))];
858
+ }
823
859
 
824
860
  function checkStoreReference() {
825
861
  const prefsFile = PREFS;
826
- const km = readJson(prefsFile)?.global?.keychainMapping || {};
827
- const mapped = Object.keys(STORE_OF_KEY).filter((k) => typeof km[k] === "string" && km[k].trim());
862
+ const mapped = storesNamed(readJson(prefsFile));
828
863
  if (!mapped.length) {
829
864
  ok("store-reference");
830
865
  return;
@@ -871,7 +906,7 @@ function checkStoreReference() {
871
906
  return;
872
907
  }
873
908
  const partial = Object.entries(res.stores || {}).filter(
874
- ([store, v]) => !v.included && mapped.some((k) => STORE_OF_KEY[k] === store),
909
+ ([store, v]) => !v.included && mapped.includes(store),
875
910
  );
876
911
  if (partial.length) {
877
912
  report(
@@ -982,7 +1017,7 @@ function checkMcpRegistration() {
982
1017
  "mcp-registration",
983
1018
  "INFO",
984
1019
  "multi-agent is not registered as an MCP server, so its tools are unavailable",
985
- "install it with claude mcp add multi-agent",
1020
+ `install it with ${[HOST.cli.candidates[0], "mcp", "add", ...HOST.cli.scopeArgs, "multi-agent"].join(" ")}`,
986
1021
  );
987
1022
  return;
988
1023
  }
@@ -1443,7 +1478,7 @@ const REMOVED_COMMANDS = [
1443
1478
  ];
1444
1479
 
1445
1480
  function checkRoutineCommands() {
1446
- const root = join(CLAUDE, "commands", "multi-agent");
1481
+ const root = join(HOST_TREE, HOST.install.commandSpecs);
1447
1482
  const routines = [];
1448
1483
  try {
1449
1484
  for (const name of readdirSync(root)) {
@@ -1515,7 +1550,7 @@ function checkFreeModels() {
1515
1550
  }
1516
1551
  const lib = [
1517
1552
  join(HERE, "..", "lib", "toolkit-llm.sh"),
1518
- join(CLAUDE, "lib", "toolkit-llm.sh"),
1553
+ join(HOST_TREE, "lib", "toolkit-llm.sh"),
1519
1554
  ].find((p) => existsSync(p));
1520
1555
  if (!lib) {
1521
1556
  report(
@@ -1604,8 +1639,59 @@ function checkFreeModels() {
1604
1639
  // from a copy the installer keeps at the installed Xcode build. A newer Xcode
1605
1640
  // leaves that copy older than what the Mac offers, which degrades the answer
1606
1641
  // rather than breaking a run, so it tops out at WARN.
1642
+ // The local-model host runs a model served from this machine, so two things
1643
+ // have to be true that no other host needs: a model and address are recorded,
1644
+ // and the server answers. Both are checked where they are used rather than at
1645
+ // the first dispatch, because a run that reaches a phase and then cannot ask a
1646
+ // model has already spent the setup.
1647
+ function checkLocalModel() {
1648
+ if (HOST_ID !== "local") {
1649
+ skip("local-model", `${HOST.label} does not run a model served from this machine`);
1650
+ return;
1651
+ }
1652
+ const cfg = readJson(PREFS)?.global?.localModel ?? null;
1653
+ const problem = localModelProblem(cfg);
1654
+ if (problem) {
1655
+ report("local-model", "BLOCK", problem, `set global.localModel in ${PREFS}`);
1656
+ return;
1657
+ }
1658
+ if (!PROBE) {
1659
+ ok("local-model");
1660
+ return;
1661
+ }
1662
+ // --probe only: a reachability check costs a request, and a doctor run that
1663
+ // wakes a model loader every time would be its own problem.
1664
+ const url = new URL("models", cfg.baseUrl.endsWith("/") ? cfg.baseUrl : `${cfg.baseUrl}/`);
1665
+ try {
1666
+ execFileSync("curl", ["-sS", "-m", "5", "-o", "/dev/null", "-w", "%{http_code}", url.href], {
1667
+ encoding: "utf8",
1668
+ stdio: ["ignore", "pipe", "pipe"],
1669
+ });
1670
+ } catch {
1671
+ report(
1672
+ "local-model",
1673
+ "BLOCK",
1674
+ `nothing answered at ${url.origin}, so no phase can reach a model`,
1675
+ "start the local model server, then re-run this check",
1676
+ );
1677
+ return;
1678
+ }
1679
+ ok("local-model");
1680
+ }
1681
+
1607
1682
  function checkXcodeSkills() {
1608
1683
  const s = xcodeSkillsStatus(HOME);
1684
+ // Apple's set reaches Claude Code as a linked plugin and every other host as
1685
+ // copied skill directories, which this status cannot see. Reporting the
1686
+ // Claude linkage on another host told the user to fix something that is not
1687
+ // how their host receives them.
1688
+ if (HOST_ID !== "claude") {
1689
+ skip(
1690
+ "xcode-skills",
1691
+ `${HOST.label} receives Apple's Xcode skills as copies, not as a linked plugin`,
1692
+ );
1693
+ return;
1694
+ }
1609
1695
  if (!s.available) {
1610
1696
  skip(
1611
1697
  "xcode-skills",
@@ -1617,8 +1703,8 @@ function checkXcodeSkills() {
1617
1703
  report(
1618
1704
  "xcode-skills",
1619
1705
  "INFO",
1620
- `Apple's Xcode skills (${s.skills}, Xcode ${s.build}) are not linked into Claude Code`,
1621
- "run /multi-agent:update, or node install.js --claude from the pipeline checkout",
1706
+ `Apple's Xcode skills (${s.skills}, Xcode ${s.build}) are not linked into ${HOST.label}`,
1707
+ `run ${hostCommand("update", HERE)}, or node install.js ${HOST.install.flag} from the pipeline checkout`,
1622
1708
  );
1623
1709
  return;
1624
1710
  }
@@ -2088,6 +2174,7 @@ function main() {
2088
2174
  [["usage-register"], checkUsageRegister],
2089
2175
  [["access"], checkAccessState],
2090
2176
  [["free-models"], checkFreeModels],
2177
+ [["local-model"], checkLocalModel],
2091
2178
  [["xcode-skills"], checkXcodeSkills],
2092
2179
  [["routine-commands"], checkRoutineCommands],
2093
2180
  [["mcp-legacy-names"], checkMcpLegacyNames],
@@ -0,0 +1,101 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * entry-mode.mjs - what a command should do when it was invoked with nothing.
4
+ *
5
+ * `/multi-agent` and `/multi-agent:analysis` are both argument-shaped: a key,
6
+ * a URL, `repo#N`, free text, a sub-command. Typing one of those is fast once
7
+ * you know the forms, and a wall to read for everyone else, so a bare
8
+ * invocation now asks instead of printing the guide.
9
+ *
10
+ * Deciding that is three lines of judgement that must come out the same on
11
+ * every host, so it is decided here rather than in each command's prose. The
12
+ * answer is one word on stdout:
13
+ *
14
+ * typed arguments were given; route them as before
15
+ * picker nothing was given; ask
16
+ * usage a modifier with no task: `autopilot` on its own says
17
+ * how to run, not what to run
18
+ * refuse-unattended nothing was given and nobody is there to answer
19
+ *
20
+ * The last one is why this exists as a gate rather than a convenience: an
21
+ * unattended run that reaches a question stops until it times out, and it
22
+ * stops having produced nothing. A run with no task is a configuration
23
+ * mistake, and saying so in one line beats waiting thirty minutes to say it.
24
+ *
25
+ * Usage:
26
+ * entry-mode.mjs --args "<raw arguments>" [--command multi-agent|analysis]
27
+ *
28
+ * Exit: 0 always, except 2 for a usage error. The word is the answer.
29
+ */
30
+
31
+ import { exitOnHelp } from "../lib/cli-help.mjs";
32
+
33
+ exitOnHelp(import.meta.url);
34
+
35
+ /**
36
+ * Arguments that say how to run rather than what to run.
37
+ *
38
+ * `autopilot` alone, `--loop 3` alone: each one modifies a task that is not
39
+ * there. Answering with the picker would be worse than it sounds, because the
40
+ * modifier would be silently dropped and the run would go interactive.
41
+ */
42
+ const MODIFIERS = [
43
+ /^autopilot$/i,
44
+ /^--loop(=.*)?$/i,
45
+ /^--review-rounds(=.*)?$/i,
46
+ /^--no-cache$/i,
47
+ /^--preview-\S*$/i,
48
+ /^--lang(=.*)?$/i,
49
+ ];
50
+
51
+ /** Whether every word given is a modifier or a modifier's value. */
52
+ function onlyModifiers(words) {
53
+ if (!words.length) return false;
54
+ let expectValue = false;
55
+ for (const word of words) {
56
+ if (expectValue && !word.startsWith("--")) {
57
+ expectValue = false;
58
+ continue;
59
+ }
60
+ const hit = MODIFIERS.find((re) => re.test(word));
61
+ if (!hit) return false;
62
+ expectValue = word.startsWith("--") && !word.includes("=");
63
+ }
64
+ return true;
65
+ }
66
+
67
+ /**
68
+ * The mode for one invocation.
69
+ *
70
+ * @param {string} args - the raw argument string the host passed through
71
+ * @param {object} env - the environment, for the unattended flag
72
+ * @returns {"typed"|"picker"|"usage"|"refuse-unattended"}
73
+ */
74
+ export function entryMode(args, env = {}) {
75
+ const words = String(args ?? "")
76
+ .trim()
77
+ .split(/\s+/)
78
+ .filter(Boolean);
79
+ const unattended = String(env.MULTI_AGENT_UNATTENDED ?? "") === "1";
80
+ if (!words.length) return unattended ? "refuse-unattended" : "picker";
81
+ if (onlyModifiers(words)) return unattended ? "refuse-unattended" : "usage";
82
+ return "typed";
83
+ }
84
+
85
+ function main(argv) {
86
+ let args = null;
87
+ for (let i = 0; i < argv.length; i++) {
88
+ if (argv[i] === "--args") args = argv[i + 1] ?? "";
89
+ if (argv[i] === "--command") i++;
90
+ }
91
+ if (args === null) {
92
+ process.stderr.write('entry-mode: --args "<raw arguments>" is required\n');
93
+ return 2;
94
+ }
95
+ process.stdout.write(entryMode(args, process.env) + "\n");
96
+ return 0;
97
+ }
98
+
99
+ if (process.argv[1] && process.argv[1].endsWith("entry-mode.mjs")) {
100
+ process.exitCode = main(process.argv.slice(2));
101
+ }
@@ -17,17 +17,15 @@
17
17
  * estimate.mjs --jql "<query with statusCategory = Done>" [--roles "iOS,Android,Test"] [--json]
18
18
  *
19
19
  * Host: JIRA_BASE_URL, else https://<JIRA_HOST or prefs .global.hosts.jira>.
20
- * Token: credential store under prefs .global.keychainMapping.jira, else
21
- * JIRA_TOKEN; it travels only in the Authorization header. Read only.
20
+ * Host and token come from one Jira account, resolved together: the token is
21
+ * only produced for the host that account names, and it travels only in the
22
+ * Authorization header. Read only.
22
23
  *
23
24
  * Exit: 0 report printed, 2 usage or auth, 5 a Jira call failed.
24
25
  */
25
26
 
26
- import { homedir } from "node:os";
27
-
28
- import { resolveToken } from "../lib/credential-resolve.mjs";
29
27
  import { runMain } from "../lib/fatal.mjs";
30
- import { loadGlobalPrefs, prefsFileIn } from "../lib/prefs-value.mjs";
28
+ import { resolveSecretAsync, selectAccount } from "../lib/service-account.mjs";
31
29
  import { exitOnHelp } from "../lib/cli-help.mjs";
32
30
 
33
31
  exitOnHelp(import.meta.url);
@@ -87,12 +85,21 @@ function matchesRole(summary, role) {
87
85
  return new RegExp(`(?<![\\p{L}\\p{N}])${esc}(?![\\p{L}\\p{N}])`, "iu").test(s);
88
86
  }
89
87
 
90
- function jiraBase() {
91
- if (process.env.JIRA_BASE_URL) return process.env.JIRA_BASE_URL.replace(/\/+$/, "");
92
- let host = process.env.JIRA_HOST || "";
93
- if (!host) host = loadGlobalPrefs(prefsFileIn(homedir()))?.hosts?.jira || "";
94
- host = host.replace(/^https?:\/\//, "").replace(/\/+$/, "");
95
- return host ? `https://${host}` : "";
88
+ /**
89
+ * The Jira base URL this run is for, checked against an account that exists.
90
+ *
91
+ * A base URL in the environment is honoured, but it is still a destination: it
92
+ * is passed to the resolver, so a host no account covers is a refusal rather
93
+ * than a request that goes out with whatever token was lying around.
94
+ */
95
+ function jiraBase(env = process.env) {
96
+ const asked = env.JIRA_BASE_URL ? env.JIRA_BASE_URL.replace(/\/+$/, "") : "";
97
+ const chosen = selectAccount({ service: "jira", url: asked || undefined }, { env });
98
+ if (!chosen.ok) return chosen;
99
+ return {
100
+ ok: true,
101
+ base: asked || chosen.account.baseUrl || `https://${chosen.account.hosts[0]}`,
102
+ };
96
103
  }
97
104
 
98
105
  async function jira(base, token, path) {
@@ -132,13 +139,20 @@ async function main() {
132
139
  process.exitCode = 2;
133
140
  return;
134
141
  }
135
- const base = jiraBase();
136
- const token = resolveToken("jira", "JIRA_TOKEN");
137
- if (!base || !token) {
138
- process.stderr.write("ERR: a Jira host and token are required\n");
142
+ const target = jiraBase();
143
+ if (!target.ok) {
144
+ process.stderr.write(`ERR: ${target.message} ${target.remedy}\n`);
145
+ process.exitCode = 2;
146
+ return;
147
+ }
148
+ const base = target.base;
149
+ const answer = await resolveSecretAsync({ service: "jira", url: base });
150
+ if (!answer.ok) {
151
+ process.stderr.write(`ERR: ${answer.message} ${answer.remedy}\n`);
139
152
  process.exitCode = 2;
140
153
  return;
141
154
  }
155
+ const token = answer.secret;
142
156
  const roles = (arg(argv, "--roles") || "")
143
157
  .split(",")
144
158
  .map((r) => r.trim())