@feigi/fleet-ctl 0.0.0 → 3.16.2

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 (152) hide show
  1. package/agents/{fleet-implementer.agent.md → fleet-implementer-slow-high.agent.md} +23 -2
  2. package/agents/fleet-implementer-slow-medium.agent.md +231 -0
  3. package/agents/fleet-implementer-smol-high.agent.md +231 -0
  4. package/agents/{fleet-implementer-alt.agent.md → fleet-implementer-task-high.agent.md} +23 -2
  5. package/agents/fleet-implementer-task-max.agent.md +231 -0
  6. package/agents/fleet-review-comments.agent.md +4 -2
  7. package/agents/fleet-review-correctness.agent.md +2 -1
  8. package/agents/fleet-review-runner.agent.md +14 -10
  9. package/agents/fleet-review-silent-failure.agent.md +4 -3
  10. package/agents/fleet-review-simplify.agent.md +2 -1
  11. package/agents/fleet-review-snapshot.agent.md +2 -1
  12. package/agents/fleet-review-test-run.agent.md +29 -0
  13. package/agents/fleet-review-tests.agent.md +10 -5
  14. package/agents/fleet-review-types.agent.md +4 -2
  15. package/agents/fleet-review-verifier.agent.md +4 -3
  16. package/commands/review-and-fix.md +7 -6
  17. package/commands/run-merge-bot.md +14 -4
  18. package/package.json +4 -2
  19. package/scripts/agent-test.test.mjs +36 -32
  20. package/scripts/ambient-git-vars-mjs-prose.test.mjs +23 -13
  21. package/scripts/apply-ruleset.test.mjs +4 -3
  22. package/scripts/arg-header-probes-prose.test.mjs +1 -0
  23. package/scripts/arg.test.mjs +18 -18
  24. package/scripts/board-cli.test.mjs +18 -21
  25. package/scripts/board-identity.test.mjs +9 -9
  26. package/scripts/board-liveness-banner.test.mjs +6 -6
  27. package/scripts/board-prev-shape.test.mjs +12 -13
  28. package/scripts/board-tryparse-null.test.mjs +7 -7
  29. package/scripts/board.mjs +4 -7
  30. package/scripts/board.test.mjs +57 -61
  31. package/scripts/candidates.test.mjs +228 -17
  32. package/scripts/ci-completes-premise-prose.test.mjs +1 -1
  33. package/scripts/ci-state-prose.test.mjs +2 -2
  34. package/scripts/ci-state.mjs +389 -187
  35. package/scripts/ci-state.test.mjs +458 -165
  36. package/scripts/claim-lifecycle.test.mjs +2 -1
  37. package/scripts/claim-ticket.test.mjs +35 -34
  38. package/scripts/closing-keyword-prose.test.mjs +1 -1
  39. package/scripts/cockpit-tick-nonblocking.test.mjs +8 -8
  40. package/scripts/compute-board.mjs +13 -3
  41. package/scripts/compute-board.test.mjs +64 -1
  42. package/scripts/compute-spend.mjs +46 -8
  43. package/scripts/compute-spend.test.mjs +64 -10
  44. package/scripts/cross-repo-citation-prose.test.mjs +18 -19
  45. package/scripts/delete-merged-branch.sh +218 -0
  46. package/scripts/delete-merged-branch.test.mjs +576 -0
  47. package/scripts/derive-testcmd.sh +18 -7
  48. package/scripts/derive-testcmd.test.mjs +9 -8
  49. package/scripts/diff-stats.mjs +2 -2
  50. package/scripts/diff-stats.test.mjs +7 -11
  51. package/scripts/dispatch-block-golden-prose.test.mjs +111 -6
  52. package/scripts/dispatch-block-pins-prose.test.mjs +5 -5
  53. package/scripts/dispositions-check.mjs +507 -0
  54. package/scripts/dispositions-check.test.mjs +843 -0
  55. package/scripts/dispositions-gate-prose.test.mjs +114 -0
  56. package/scripts/drop-merged-label.test.mjs +3 -4
  57. package/scripts/exec-stub.mjs +93 -0
  58. package/scripts/exec-stub.test.mjs +69 -0
  59. package/scripts/filing-bar-seat-prose.test.mjs +1 -1
  60. package/scripts/finisher-test-verdict-prose.test.mjs +102 -0
  61. package/scripts/fix-applier-correction-rules-prose.test.mjs +11 -10
  62. package/scripts/fleet-bootstrap +5 -20
  63. package/scripts/fleet-bootstrap.test.mjs +75 -0
  64. package/scripts/fleet-heartbeat.mjs +2 -2
  65. package/scripts/fleet-provenance +15 -24
  66. package/scripts/fleet-provenance.test.mjs +86 -12
  67. package/scripts/fleet-run.test.mjs +5 -5
  68. package/scripts/fleet-state.mjs +33 -11
  69. package/scripts/fleet-state.test.mjs +90 -3
  70. package/scripts/fleet-tick.mjs +346 -70
  71. package/scripts/fleet-tick.test.mjs +566 -16
  72. package/scripts/force-with-lease-reason-prose.test.mjs +1 -1
  73. package/scripts/frontmatter-check.mjs +3 -2
  74. package/scripts/frontmatter-check.test.mjs +6 -6
  75. package/scripts/immutable-body-claim-prose.test.mjs +53 -262
  76. package/scripts/implementer-model-tier.test.mjs +98 -506
  77. package/scripts/inflight.test.mjs +18 -127
  78. package/scripts/is-cli.mjs +26 -0
  79. package/scripts/is-cli.test.mjs +99 -0
  80. package/scripts/json.test.mjs +3 -3
  81. package/scripts/ledger-dispatch.test.mjs +368 -7
  82. package/scripts/ledger-grammar.mjs +85 -1
  83. package/scripts/ledger-grammar.test.mjs +86 -1
  84. package/scripts/ledger-read-require-file.test.mjs +7 -7
  85. package/scripts/ledger-rotate.test.mjs +142 -0
  86. package/scripts/ledger.mjs +181 -17
  87. package/scripts/ledger.test.mjs +12 -130
  88. package/scripts/main-checkout.mjs +312 -0
  89. package/scripts/main-checkout.test.mjs +332 -0
  90. package/scripts/member-outcomes-header.test.mjs +3 -3
  91. package/scripts/member-outcomes.mjs +4 -5
  92. package/scripts/member-outcomes.test.mjs +92 -18
  93. package/scripts/member-prompt-prose.test.mjs +17 -13
  94. package/scripts/member-record.mjs +8 -3
  95. package/scripts/member-record.test.mjs +5 -5
  96. package/scripts/member-write-guard.mjs +5 -5
  97. package/scripts/member-write-guard.test.mjs +6 -3
  98. package/scripts/no-undo-audit.sh +24 -21
  99. package/scripts/no-undo-audit.test.mjs +9 -13
  100. package/scripts/pointer-target-prose.test.mjs +1 -1
  101. package/scripts/pr-overlap.test.mjs +6 -9
  102. package/scripts/prompt-renderer.mjs +10 -9
  103. package/scripts/prose-pin.mjs +10 -11
  104. package/scripts/prove-merge.test.mjs +3 -3
  105. package/scripts/quiet-payload-prose.test.mjs +1 -1
  106. package/scripts/reap.test.mjs +3 -4
  107. package/scripts/release-label-split-prose.test.mjs +17 -2
  108. package/scripts/release-ticket.test.mjs +35 -44
  109. package/scripts/review-core-cwd-isolation.test.mjs +7 -6
  110. package/scripts/review-core-reads.test.mjs +1 -1
  111. package/scripts/review-core-scratch-refusal.test.mjs +64 -0
  112. package/scripts/review-core-shared-test-run.test.mjs +238 -0
  113. package/scripts/review-core-snapshot-path.test.mjs +59 -12
  114. package/scripts/review-core-specialist-scratch.test.mjs +12 -10
  115. package/scripts/review-core-testcmd.test.mjs +76 -45
  116. package/scripts/review-core-unrun.test.mjs +154 -168
  117. package/scripts/review-core.mjs +250 -56
  118. package/scripts/review-eval.mjs +11 -4
  119. package/scripts/review-host-fixture.mjs +12 -3
  120. package/scripts/review-in-run-retry.test.mjs +27 -3
  121. package/scripts/review-runner-spawns.test.mjs +5 -3
  122. package/scripts/review-runner.test.mjs +14 -3
  123. package/scripts/review-tier-audit.test.mjs +1 -1
  124. package/scripts/run-merge-bot-prose.test.mjs +29 -6
  125. package/scripts/scratch-partition-invariant-prose.test.mjs +1 -1
  126. package/scripts/section-between-guard-prose.test.mjs +4 -3
  127. package/scripts/select-dimensions.test.mjs +1 -1
  128. package/scripts/shell-traps-prose.test.mjs +6 -9
  129. package/scripts/shortlist.mjs +4 -1
  130. package/scripts/shortlist.test.mjs +30 -16
  131. package/scripts/snapshot-repo.test.mjs +177 -4
  132. package/scripts/stash-prohibition-prose.test.mjs +1 -1
  133. package/scripts/temp-dir.mjs +47 -0
  134. package/scripts/tier-check.mjs +95 -28
  135. package/scripts/tier-check.test.mjs +131 -29
  136. package/scripts/tier-outcomes-header.test.mjs +11 -54
  137. package/scripts/tier-outcomes.mjs +34 -12
  138. package/scripts/tier-outcomes.test.mjs +157 -4
  139. package/scripts/tier-roles.mjs +118 -29
  140. package/scripts/tier-roles.test.mjs +226 -61
  141. package/scripts/tracker-block-copy-prose.test.mjs +3 -3
  142. package/scripts/verify-sha.test.mjs +4 -5
  143. package/scripts/watcher-degraded-block.test.mjs +5 -8
  144. package/scripts/within-run-pair-prose.test.mjs +43 -75
  145. package/scripts/worktree-audit.test.mjs +2 -1
  146. package/skills/next-ticket/SKILL.md +2 -2
  147. package/skills/run-team/SKILL.md +433 -303
  148. package/skills/run-team/references/ci-and-staleness.md +7 -6
  149. package/skills/run-team/references/correction-tickets.md +3 -3
  150. package/skills/run-team/references/isolation.md +1 -1
  151. package/skills/sizing-a-ticket/SKILL.md +8 -8
  152. package/scripts/tier-guard-gate-prose.test.mjs +0 -216
@@ -1,21 +1,21 @@
1
1
  import { test } from "node:test";
2
2
  import assert from "node:assert/strict";
3
3
  import { spawnSync } from "node:child_process";
4
- import { mkdtempSync, mkdirSync, writeFileSync } from "node:fs";
5
- import { tmpdir } from "node:os";
6
- import { join } from "node:path";
4
+ import { chmodSync, mkdirSync, readdirSync, writeFileSync } from "node:fs";
5
+ import { tempDir } from "./temp-dir.mjs";
6
+ import { delimiter, join } from "node:path";
7
7
  import { fileURLToPath } from "node:url";
8
8
 
9
9
  import {
10
10
  parseModelRoute, parseFrontmatter, stripLevel, resolveRole, expectedOmpModel,
11
- modelsEqual, checkRoutes,
11
+ modelsEqual, checkRoutes, catalogEntry,
12
12
  } from "./tier-roles.mjs";
13
13
 
14
14
  const SCRIPT = fileURLToPath(new URL("./tier-roles.mjs", import.meta.url));
15
15
  const REPO_AGENTS = fileURLToPath(new URL("../agents", import.meta.url));
16
16
 
17
17
  function dir() {
18
- return mkdtempSync(join(tmpdir(), "tier-roles-"));
18
+ return tempDir("tier-roles-");
19
19
  }
20
20
 
21
21
  function agentsDir(files) {
@@ -37,8 +37,8 @@ function jsonFile(d, name, value) {
37
37
  return p;
38
38
  }
39
39
 
40
- function runCli(argv, cwd) {
41
- return spawnSync(process.execPath, [SCRIPT, ...argv], { cwd, encoding: "utf8" });
40
+ function runCli(argv, cwd, env) {
41
+ return spawnSync(process.execPath, [SCRIPT, ...argv], { cwd, encoding: "utf8", env });
42
42
  }
43
43
 
44
44
  // ---------------------------------------------------------------------------
@@ -175,52 +175,68 @@ test("modelsEqual: a bare suffix match without the '/' boundary is NOT equal", (
175
175
 
176
176
  const MODEL_ROLES = { slow: "anthropic/claude-opus-5:auto", task: "anthropic/claude-sonnet-5:auto", smol: "anthropic/claude-haiku-4-5:auto" };
177
177
 
178
+ // The shape of `omp models --json`, trimmed to the three targets above. The
179
+ // efforts are the ones measured on omp's own catalog (spec 2026-09-28 § 2):
180
+ // the adaptive pair runs low…max, haiku's budget mode minimal…xhigh — no max.
181
+ const ADAPTIVE = ["low", "medium", "high", "xhigh", "max"];
182
+ const CATALOG = {
183
+ models: [
184
+ { provider: "amazon-bedrock", id: "anthropic.claude-haiku-4-5", selector: "amazon-bedrock/anthropic.claude-haiku-4-5", thinking: null },
185
+ { provider: "anthropic", id: "claude-opus-5", selector: "anthropic/claude-opus-5", thinking: ADAPTIVE },
186
+ { provider: "anthropic", id: "claude-sonnet-5", selector: "anthropic/claude-sonnet-5", thinking: ADAPTIVE },
187
+ { provider: "anthropic", id: "claude-haiku-4-5", selector: "anthropic/claude-haiku-4-5", thinking: ["minimal", "low", "medium", "high", "xhigh"] },
188
+ ],
189
+ };
190
+
191
+ const routes = (files, modelRoles = MODEL_ROLES, overrides = {}) =>
192
+ checkRoutes({ agentsDir: agentsDir(files), modelRoles, overrides, catalog: CATALOG });
193
+
178
194
  test("checkRoutes: every definition routed and every role resolvable -> no violations or notices", () => {
179
- const agents = agentsDir({ "fleet-a": "@slow:xhigh", "fleet-b": "@smol:low" });
180
- const result = checkRoutes({ agentsDir: agents, modelRoles: MODEL_ROLES, overrides: {} });
181
- assert.deepEqual(result, { violations: [], notices: [] });
195
+ assert.deepEqual(routes({ "fleet-a": "@slow:xhigh", "fleet-b": "@smol:low" }), { violations: [], notices: [] });
196
+ });
197
+
198
+ test("checkRoutes: an agents directory holding no *.agent.md definition is a violation naming the directory, never a vacuous pass", () => {
199
+ const empty = agentsDir({});
200
+ const { violations } = checkRoutes({ agentsDir: empty, modelRoles: MODEL_ROLES, overrides: {}, catalog: CATALOG });
201
+ assert.deepEqual(violations, [`no *.agent.md definition found in ${empty}`]);
202
+
203
+ // A directory that holds only files the check does not read is the same case.
204
+ writeFileSync(join(empty, "README.md"), "not a definition\n");
205
+ assert.deepEqual(checkRoutes({ agentsDir: empty, modelRoles: MODEL_ROLES, overrides: {}, catalog: CATALOG }).violations, [`no *.agent.md definition found in ${empty}`]);
206
+ });
207
+
208
+ test("checkRoutes: an empty agents directory still reports the other violations alongside", () => {
209
+ const { violations } = checkRoutes({ agentsDir: agentsDir({}), modelRoles: MODEL_ROLES, overrides: { "fleet-a": "@slow:xhigh" }, catalog: CATALOG });
210
+ assert.equal(violations.length, 2);
211
+ assert.match(violations.join("\n"), /task\.agentModelOverrides\.fleet-a shadows/);
182
212
  });
183
213
 
184
214
  test("checkRoutes (a): a definition whose model: is not a route is a violation naming the file", () => {
185
- const agents = agentsDir({ "fleet-a": "opus" });
186
- const { violations } = checkRoutes({ agentsDir: agents, modelRoles: MODEL_ROLES, overrides: {} });
215
+ const { violations } = routes({ "fleet-a": "opus" });
187
216
  assert.equal(violations.length, 1);
188
217
  assert.match(violations[0], /^fleet-a\.agent\.md: model "opus" is not @<role>:<level>$/);
189
218
  });
190
219
 
191
220
  test("checkRoutes (b): a used role with no modelRoles entry is a violation naming the role and the definition", () => {
192
- const agents = agentsDir({ "fleet-a": "@slow:xhigh" });
193
- const { violations } = checkRoutes({ agentsDir: agents, modelRoles: {}, overrides: {} });
221
+ const { violations } = routes({ "fleet-a": "@slow:xhigh" }, {});
194
222
  assert.equal(violations.length, 1);
195
223
  assert.match(violations[0], /modelRoles\.slow is unset/);
196
224
  assert.match(violations[0], /fleet-a\.agent\.md/);
197
225
  });
198
226
 
199
227
  test("checkRoutes (b): an unset role no definition uses is not a violation", () => {
200
- const agents = agentsDir({ "fleet-a": "@slow:xhigh" });
201
- const { violations } = checkRoutes({ agentsDir: agents, modelRoles: { slow: MODEL_ROLES.slow }, overrides: {} });
202
- assert.deepEqual(violations, []);
228
+ assert.deepEqual(routes({ "fleet-a": "@slow:xhigh" }, { slow: MODEL_ROLES.slow }).violations, []);
203
229
  });
204
230
 
205
231
  test("checkRoutes (c): a fleet- key in task.agentModelOverrides shadows the definition and violates, remedy resets when nothing else remains", () => {
206
- const agents = agentsDir({ "fleet-a": "@slow:xhigh" });
207
- const { violations } = checkRoutes({
208
- agentsDir: agents,
209
- modelRoles: MODEL_ROLES,
210
- overrides: { "fleet-a": "@slow:xhigh" },
211
- });
232
+ const { violations } = routes({ "fleet-a": "@slow:xhigh" }, MODEL_ROLES, { "fleet-a": "@slow:xhigh" });
212
233
  assert.equal(violations.length, 1);
213
234
  assert.match(violations[0], /task\.agentModelOverrides\.fleet-a shadows the definition's own model \(precedence #1\) — remove it/);
214
235
  assert.match(violations[0], /omp config reset task\.agentModelOverrides/);
215
236
  });
216
237
 
217
238
  test("checkRoutes (c): the remedy keeps the operator's own non-fleet- entries when one exists", () => {
218
- const agents = agentsDir({ "fleet-a": "@slow:xhigh" });
219
- const { violations } = checkRoutes({
220
- agentsDir: agents,
221
- modelRoles: MODEL_ROLES,
222
- overrides: { "fleet-a": "@slow:xhigh", "my-other-agent": "opus" },
223
- });
239
+ const { violations } = routes({ "fleet-a": "@slow:xhigh" }, MODEL_ROLES, { "fleet-a": "@slow:xhigh", "my-other-agent": "opus" });
224
240
  assert.equal(violations.length, 1);
225
241
  assert.match(violations[0], /omp config set task\.agentModelOverrides/);
226
242
  assert.match(violations[0], /my-other-agent/);
@@ -228,35 +244,87 @@ test("checkRoutes (c): the remedy keeps the operator's own non-fleet- entries wh
228
244
  });
229
245
 
230
246
  test("checkRoutes (c): a non-fleet- override key is the operator's own and never violates", () => {
231
- const agents = agentsDir({ "fleet-a": "@slow:xhigh" });
232
- const { violations } = checkRoutes({
233
- agentsDir: agents,
234
- modelRoles: MODEL_ROLES,
235
- overrides: { "my-other-agent": "opus" },
236
- });
237
- assert.deepEqual(violations, []);
247
+ assert.deepEqual(routes({ "fleet-a": "@slow:xhigh" }, MODEL_ROLES, { "my-other-agent": "opus" }).violations, []);
238
248
  });
239
249
 
240
- test("checkRoutes (d): slow and task resolving to the same model is a notice, not a violation", () => {
241
- const agents = agentsDir({ "fleet-a": "@slow:xhigh" });
242
- const { violations, notices } = checkRoutes({
243
- agentsDir: agents,
244
- modelRoles: { slow: "anthropic/claude-opus-5:auto", task: "anthropic/claude-opus-5:auto", smol: MODEL_ROLES.smol },
245
- overrides: {},
246
- });
250
+ test("checkRoutes (d): a level the role's target does not run at is a violation naming the file and the efforts", () => {
251
+ // The one the spec names: haiku has no `max`, so `smol-max` would clamp.
252
+ const { violations } = routes({ "fleet-implementer-smol-max": "@smol:max", "fleet-implementer-smol-high": "@smol:high" });
253
+ assert.equal(violations.length, 1);
254
+ assert.match(violations[0], /^fleet-implementer-smol-max\.agent\.md: level max is not one modelRoles\.smol's target anthropic\/claude-haiku-4-5 runs at \(thinking: minimal, low, medium, high, xhigh\)/);
255
+ // And the other edge of the adaptive range: no `minimal` on opus.
256
+ assert.match(routes({ "fleet-a": "@slow:minimal" }).violations[0] ?? "", /fleet-a\.agent\.md: level minimal/);
257
+ });
258
+
259
+ test("checkRoutes (d): every level a target lists is accepted, through a role value written without its provider", () => {
260
+ // The must-ACCEPT half: `task-max` is a real wire effort on the adaptive
261
+ // models, and `smol-minimal` one on haiku's budget mode.
262
+ assert.deepEqual(routes({ "fleet-a": "@task:max", "fleet-b": "@smol:minimal", "fleet-c": "@slow:low" }).violations, []);
263
+ assert.deepEqual(routes({ "fleet-a": "@task:max" }, { task: "claude-sonnet-5:high" }).violations, []);
264
+ });
265
+
266
+ test("checkRoutes (d): a target the catalog does not list, or lists with no thinking at all, cannot pass", () => {
267
+ const unlisted = routes({ "fleet-a": "@slow:high" }, { slow: "acme/unknown-1" }).violations;
268
+ assert.equal(unlisted.length, 1);
269
+ assert.match(unlisted[0], /modelRoles\.slow resolves to acme\/unknown-1, which omp's model catalog does not list — cannot check the level of fleet-a\.agent\.md/);
270
+ const thinkless = routes({ "fleet-a": "@smol:low" }, { smol: "amazon-bedrock/anthropic.claude-haiku-4-5" }).violations;
271
+ assert.equal(thinkless.length, 1);
272
+ assert.match(thinkless[0], /level low is not one .*\(thinking: none\)/);
273
+ });
274
+
275
+ test("checkRoutes (d): a catalog omp did not print is named as a shape error, never blamed on the operator's roles", () => {
276
+ const withCatalog = (catalog, modelRoles = MODEL_ROLES) =>
277
+ checkRoutes({ agentsDir: agentsDir({ "fleet-a": "@slow:high" }), modelRoles, overrides: {}, catalog }).violations;
278
+ for (const [catalog, kind] of [[{}, "absent"], [{ models: "nope" }, "string"], [{ models: null }, "null"]]) {
279
+ const v = withCatalog(catalog);
280
+ assert.equal(v.length, 1, JSON.stringify(v));
281
+ assert.equal(v[0], `omp's model catalog has no models list (models: ${kind}) — cannot check the level of any definition`);
282
+ }
283
+ // An unset role is still its own violation beside a malformed catalog.
284
+ assert.deepEqual(withCatalog({}, {}).map((v) => v.split(" ")[0]), ["omp's", "modelRoles.slow"]);
285
+ const opus = (thinking) => ({ models: [{ selector: "anthropic/claude-opus-5", thinking }] });
286
+ for (const [thinking, kind] of [["low,medium,high,max", "string"], [undefined, "absent"], [{ high: true }, "object"]]) {
287
+ const v = withCatalog(opus(thinking));
288
+ assert.equal(v.length, 1, JSON.stringify(v));
289
+ assert.equal(v[0], `omp's model catalog lists anthropic/claude-opus-5 with thinking that is neither a list nor null (${kind}) — cannot check the level of fleet-a.agent.md`);
290
+ }
291
+ // The must-ACCEPT half: `thinking: null` is a real catalog value (a model
292
+ // with no efforts), so it stays the level violation, and an empty list is a list.
293
+ assert.match(withCatalog(opus(null))[0], /^fleet-a\.agent\.md: level high is not one .*\(thinking: none\)/);
294
+ assert.match(withCatalog(opus([]))[0], /^fleet-a\.agent\.md: level high is not one .*\(thinking: none\)/);
295
+ assert.deepEqual(withCatalog(opus(["high"])), []);
296
+ });
297
+
298
+ test("catalogEntry: an exact selector wins over a provider-less match", () => {
299
+ assert.equal(catalogEntry("anthropic/claude-haiku-4-5", CATALOG).provider, "anthropic");
300
+ assert.equal(catalogEntry("claude-opus-5", CATALOG).selector, "anthropic/claude-opus-5");
301
+ assert.equal(catalogEntry("claude-opus", CATALOG), null);
302
+ assert.equal(catalogEntry("anthropic/claude-opus-5", {}), null);
303
+ });
304
+
305
+ test("checkRoutes (e): slow and task resolving to the same model is a notice, not a violation", () => {
306
+ const { violations, notices } = routes(
307
+ { "fleet-a": "@slow:xhigh" },
308
+ { slow: "anthropic/claude-opus-5:auto", task: "anthropic/claude-opus-5:auto", smol: MODEL_ROLES.smol },
309
+ );
247
310
  assert.deepEqual(violations, []);
248
311
  assert.equal(notices.length, 1);
249
312
  assert.match(notices[0], /modelRoles\.slow and modelRoles\.task both resolve to/);
250
313
  });
251
314
 
252
- test("checkRoutes (d): slow and task resolving to different models is not a notice", () => {
253
- const agents = agentsDir({ "fleet-a": "@slow:xhigh" });
254
- const { notices } = checkRoutes({ agentsDir: agents, modelRoles: MODEL_ROLES, overrides: {} });
255
- assert.deepEqual(notices, []);
315
+ test("checkRoutes (e): slow and task resolving to different models is not a notice", () => {
316
+ assert.deepEqual(routes({ "fleet-a": "@slow:xhigh" }).notices, []);
256
317
  });
257
318
 
258
- test("checkRoutes: every real plugin/agents definition routes cleanly against a model-roles fixture that covers all three roles", () => {
259
- const { violations } = checkRoutes({ agentsDir: REPO_AGENTS, modelRoles: MODEL_ROLES, overrides: {} });
319
+ // The five-cell grid at ratification (spec 2026-09-28 § 2), and every real
320
+ // definition clean against targets that run each one's level.
321
+ test("checkRoutes: every real plugin/agents definition routes cleanly, and the implementer definitions are exactly the five cells", () => {
322
+ const cells = readdirSync(REPO_AGENTS)
323
+ .map((f) => /^fleet-implementer(?:-(.+))?\.agent\.md$/.exec(f))
324
+ .filter(Boolean)
325
+ .map((m) => m[1]);
326
+ assert.deepEqual(cells.sort(), ["slow-high", "slow-medium", "smol-high", "task-high", "task-max"]);
327
+ const { violations } = checkRoutes({ agentsDir: REPO_AGENTS, modelRoles: MODEL_ROLES, overrides: {}, catalog: CATALOG });
260
328
  assert.deepEqual(violations, []);
261
329
  });
262
330
 
@@ -264,21 +332,36 @@ test("checkRoutes: every real plugin/agents definition routes cleanly against a
264
332
  // CLI
265
333
  // ---------------------------------------------------------------------------
266
334
 
335
+ // Every flag the check reads the live install through, pointed at a fixture:
336
+ // a test that left one off would shell out to the box's own `omp`.
337
+ function installFlags(d, { overrides = {}, modelRoles = MODEL_ROLES, catalog = CATALOG } = {}) {
338
+ return [
339
+ "--overrides", jsonFile(d, "overrides.json", overrides),
340
+ "--model-roles", jsonFile(d, "model-roles.json", modelRoles),
341
+ "--catalog", jsonFile(d, "catalog.json", catalog),
342
+ ];
343
+ }
344
+
267
345
  test("CLI: --check with a clean install exits 0", () => {
268
346
  const d = dir();
269
347
  const agents = agentsDir({ "fleet-a": "@slow:xhigh" });
270
- const overridesPath = jsonFile(d, "overrides.json", {});
271
- const modelRolesPath = jsonFile(d, "model-roles.json", MODEL_ROLES);
272
- const r = runCli(["--check", "--agents", agents, "--overrides", overridesPath, "--model-roles", modelRolesPath], d);
348
+ const r = runCli(["--check", "--agents", agents, ...installFlags(d)], d);
273
349
  assert.equal(r.status, 0, r.stderr);
274
350
  });
275
351
 
352
+ test("CLI: --check on an agents directory with no definitions exits 1 naming the directory", () => {
353
+ const d = dir();
354
+ const agents = agentsDir({});
355
+ const r = runCli(["--check", "--agents", agents, ...installFlags(d)], d);
356
+ assert.equal(r.status, 1);
357
+ assert.match(r.stderr, /no \*\.agent\.md definition found in /);
358
+ assert.doesNotMatch(r.stdout, /every definition routes/);
359
+ });
360
+
276
361
  test("CLI: --check with a non-route model: exits 1 naming the file", () => {
277
362
  const d = dir();
278
363
  const agents = agentsDir({ "fleet-a": "opus" });
279
- const overridesPath = jsonFile(d, "overrides.json", {});
280
- const modelRolesPath = jsonFile(d, "model-roles.json", MODEL_ROLES);
281
- const r = runCli(["--check", "--agents", agents, "--overrides", overridesPath, "--model-roles", modelRolesPath], d);
364
+ const r = runCli(["--check", "--agents", agents, ...installFlags(d)], d);
282
365
  assert.equal(r.status, 1);
283
366
  assert.match(r.stderr, /fleet-a\.agent\.md: model "opus" is not @<role>:<level>/);
284
367
  });
@@ -286,13 +369,36 @@ test("CLI: --check with a non-route model: exits 1 naming the file", () => {
286
369
  test("CLI: --check with a shadowing fleet- override exits 1 naming the remedy", () => {
287
370
  const d = dir();
288
371
  const agents = agentsDir({ "fleet-a": "@slow:xhigh" });
289
- const overridesPath = jsonFile(d, "overrides.json", { "fleet-a": "@slow:xhigh" });
290
- const modelRolesPath = jsonFile(d, "model-roles.json", MODEL_ROLES);
291
- const r = runCli(["--check", "--agents", agents, "--overrides", overridesPath, "--model-roles", modelRolesPath], d);
372
+ const r = runCli(["--check", "--agents", agents, ...installFlags(d, { overrides: { "fleet-a": "@slow:xhigh" } })], d);
292
373
  assert.equal(r.status, 1);
293
374
  assert.match(r.stderr, /omp config reset task\.agentModelOverrides/);
294
375
  });
295
376
 
377
+ test("CLI: --check with a smol-max cell exits 1 — haiku has no max, and the check refuses rather than clamps", () => {
378
+ const d = dir();
379
+ const agents = agentsDir({ "fleet-implementer-smol-high": "\"@smol:high\"", "fleet-implementer-smol-max": "\"@smol:max\"" });
380
+ const r = runCli(["--check", "--agents", agents, ...installFlags(d)], d);
381
+ assert.equal(r.status, 1);
382
+ assert.match(r.stderr, /fleet-implementer-smol-max\.agent\.md: level max is not one modelRoles\.smol's target/);
383
+ assert.doesNotMatch(r.stderr, /smol-high/);
384
+ });
385
+
386
+ test("CLI: a --catalog that is not a JSON object refuses by flag", () => {
387
+ const d = dir();
388
+ const agents = agentsDir({ "fleet-a": "@slow:xhigh" });
389
+ const r = runCli(["--check", "--agents", agents, ...installFlags(d, { catalog: [] })], d);
390
+ assert.equal(r.status, 2);
391
+ assert.match(r.stderr, /--catalog .*catalog\.json must be a JSON object, got an array/);
392
+ });
393
+
394
+ test("CLI: a --catalog file holding null refuses as null, not as object", () => {
395
+ const d = dir();
396
+ const agents = agentsDir({ "fleet-a": "@slow:xhigh" });
397
+ const r = runCli(["--check", "--agents", agents, ...installFlags(d, { catalog: null })], d);
398
+ assert.equal(r.status, 2);
399
+ assert.match(r.stderr, /--catalog .*catalog\.json must be a JSON object, got null$/m);
400
+ });
401
+
296
402
  test("CLI: --check without --check flag is required", () => {
297
403
  const d = dir();
298
404
  const r = runCli([], d);
@@ -309,8 +415,67 @@ test("CLI: an unknown flag refuses by name", () => {
309
415
 
310
416
  test("CLI: --agents defaults to the plugin's own agents directory", () => {
311
417
  const d = dir();
312
- const overridesPath = jsonFile(d, "overrides.json", {});
313
- const modelRolesPath = jsonFile(d, "model-roles.json", MODEL_ROLES);
314
- const r = runCli(["--check", "--overrides", overridesPath, "--model-roles", modelRolesPath], d);
418
+ const r = runCli(["--check", ...installFlags(d)], d);
315
419
  assert.equal(r.status, 0, r.stderr);
316
420
  });
421
+
422
+ // A fake `omp` first on PATH whose every invocation prints `stdout` — the live
423
+ // reads (`omp config get … --json`, `omp models --json`) have no flag-free
424
+ // fixture path, so the binary itself is the fixture.
425
+ function runCliWithFakeOmp(stdout, argv, cwd) {
426
+ const bin = dir();
427
+ const fake = join(bin, "omp");
428
+ writeFileSync(fake, `#!/bin/sh\ncat <<'FAKE_OMP_EOF'\n${stdout}\nFAKE_OMP_EOF\n`);
429
+ chmodSync(fake, 0o755);
430
+ return runCli(argv, cwd, { ...process.env, PATH: `${bin}${delimiter}${process.env.PATH}` });
431
+ }
432
+
433
+ // What an `omp` read may print that is JSON yet not an object, with the shape
434
+ // the refusal names.
435
+ const NON_OBJECTS = [["null", "null"], ["an array", "[]"], ["a string", "\"x\""], ["a number", "42"], ["a boolean", "true"]];
436
+
437
+ for (const [shape, printed] of NON_OBJECTS) {
438
+ test(`CLI: live \`omp config get\` printing ${shape} refuses naming the command`, () => {
439
+ const d = dir();
440
+ const agents = agentsDir({ "fleet-a": "@slow:xhigh" });
441
+ const r = runCliWithFakeOmp(printed, ["--check", "--agents", agents, "--model-roles", jsonFile(d, "mr.json", MODEL_ROLES), "--catalog", jsonFile(d, "c.json", CATALOG)], d);
442
+ assert.equal(r.status, 2, r.stderr);
443
+ assert.match(r.stderr, new RegExp(`omp config get task\\.agentModelOverrides --json exited 0 but printed ${shape}, not a JSON object`));
444
+ });
445
+ }
446
+
447
+ for (const [shape, printed] of NON_OBJECTS) {
448
+ test(`CLI: live \`omp models\` printing ${shape} refuses naming the command`, () => {
449
+ const d = dir();
450
+ const agents = agentsDir({ "fleet-a": "@slow:xhigh" });
451
+ const r = runCliWithFakeOmp(printed, ["--check", "--agents", agents, "--overrides", jsonFile(d, "o.json", {}), "--model-roles", jsonFile(d, "mr.json", MODEL_ROLES)], d);
452
+ assert.equal(r.status, 2, r.stderr);
453
+ assert.match(r.stderr, new RegExp(`omp models --json exited 0 but printed ${shape}, not a JSON object`));
454
+ });
455
+ }
456
+
457
+ test("CLI: live `omp config get` envelope holding a null value refuses as null, not as object", () => {
458
+ const d = dir();
459
+ const agents = agentsDir({ "fleet-a": "@slow:xhigh" });
460
+ const r = runCliWithFakeOmp("{\"value\":null}", ["--check", "--agents", agents, "--model-roles", jsonFile(d, "mr.json", MODEL_ROLES), "--catalog", jsonFile(d, "c.json", CATALOG)], d);
461
+ assert.equal(r.status, 2, r.stderr);
462
+ assert.match(r.stderr, /omp config get task\.agentModelOverrides --json must be a JSON object, got null$/m);
463
+ });
464
+
465
+ test("CLI: live `omp` reads printing well-formed objects are accepted", () => {
466
+ const d = dir();
467
+ const agents = agentsDir({ "fleet-a": "@slow:xhigh" });
468
+ // One fake serves all three reads: `{ value, models }` satisfies the config
469
+ // envelope and the catalog at once; each config read then takes `value` as its record.
470
+ const printed = JSON.stringify({ value: {}, models: CATALOG.models });
471
+ const r = runCliWithFakeOmp(printed, ["--check", "--agents", agents], d);
472
+ assert.notEqual(r.status, 2, r.stderr);
473
+ assert.doesNotMatch(r.stderr, /not a JSON object/);
474
+ });
475
+
476
+ test("CLI: live `omp` reads printing an empty object are not refused by the readOmpJson guard", () => {
477
+ const d = dir();
478
+ const agents = agentsDir({ "fleet-a": "@slow:xhigh" });
479
+ const r = runCliWithFakeOmp("{}", ["--check", "--agents", agents], d);
480
+ assert.doesNotMatch(r.stderr, /exited 0 but printed/);
481
+ });
@@ -1,5 +1,5 @@
1
1
  // #374. `docs/agents/issue-tracker.md` reproduces the implementer issue-read
2
- // block — since #1804 carried by the body of `agents/fleet-implementer.agent.md`
2
+ // block — since #1804 carried by the body of `agents/fleet-implementer-<cell>.agent.md`
3
3
  // (spec 2026-09-24 § 2 Decision 2), which each harness injects as the member's
4
4
  // system prompt; before that, by a `>` quote block in `run-team/SKILL.md`'s
5
5
  // phase 2 — and the copy has fallen behind that block
@@ -64,7 +64,7 @@ const REPO = join(import.meta.dirname, "..");
64
64
  const read = (...p) => readFileSync(join(REPO, ...p), "utf8");
65
65
  // The body alone — everything after the frontmatter's closing `---`. Named
66
66
  // SKILL for the history above: this was run-team/SKILL.md's phase 2 until #1804.
67
- const SKILL = read("agents", "fleet-implementer.agent.md").split("---").slice(2).join("---");
67
+ const SKILL = read("agents", "fleet-implementer-slow-high.agent.md").split("---").slice(2).join("---");
68
68
  const REPO_ROOT = join(import.meta.dirname, "..", "..");
69
69
  const TRACKER = readFileSync(join(REPO_ROOT, "docs", "agents", "issue-tracker.md"), "utf8");
70
70
 
@@ -150,7 +150,7 @@ function block(text, what, end) {
150
150
  return slice.join("\n");
151
151
  }
152
152
 
153
- const source = (text = SKILL) => block(text, "agents/fleet-implementer.agent.md", SKILL_END);
153
+ const source = (text = SKILL) => block(text, "agents/fleet-implementer-slow-high.agent.md", SKILL_END);
154
154
  const copy = (text = TRACKER) => block(text, "docs/agents/issue-tracker.md", TRACKER_END);
155
155
 
156
156
  // Each side's own raw bytes, for the fixtures below to mutate. Both throw,
@@ -22,6 +22,7 @@ import { copyFileSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSy
22
22
  import { tmpdir } from "node:os";
23
23
  import { join } from "node:path";
24
24
  import { fileURLToPath } from "node:url";
25
+ import { writeExecStub } from "./exec-stub.mjs";
25
26
 
26
27
  const SCRIPT = fileURLToPath(new URL("./verify-sha.sh", import.meta.url));
27
28
 
@@ -130,10 +131,9 @@ test("a merge-base that fails rather than answers is exit 2, never reachable:fal
130
131
  // the exec: a git under a path with a space word-splits otherwise, and the
131
132
  // fetch then dies first — which still satisfies the exit-2 and null-json
132
133
  // assertions below, so only the stderr match would catch it.
133
- writeFileSync(
134
+ writeExecStub(
134
135
  join(bin, "git"),
135
136
  `#!/bin/sh\n[ "$1" = merge-base ] && { echo "error: could not parse commit deadbeef" >&2; exit 128; }\nexec "${REAL_GIT}" "$@"\n`,
136
- { mode: 0o755 },
137
137
  );
138
138
 
139
139
  const { code, json, stderr } = verify(w, "main", head, {
@@ -428,10 +428,9 @@ test("a sha the cat-file guard rejects is fatal — the script stops rather than
428
428
  t.after(() => rmSync(bin, { recursive: true, force: true }));
429
429
  // Resolved out here, where PATH is still the real one, and quoted at the exec,
430
430
  // for the reasons the merge-base shim above records at length.
431
- writeFileSync(
431
+ writeExecStub(
432
432
  join(bin, "git"),
433
433
  `#!/bin/sh\n[ "$1" = cat-file ] && { echo "error: unable to read object" >&2; exit 1; }\nexec "${REAL_GIT}" "$@"\n`,
434
- { mode: 0o755 },
435
434
  );
436
435
 
437
436
  const { code, json, stderr } = verify(w, "main", head, {
@@ -609,7 +608,7 @@ test("an ordinary branch name is untouched — the escaping accepts what it shou
609
608
  function sedShim(t, body) {
610
609
  const bin = mkdtempSync(join(tmpdir(), "verify-sha-sed-shim-"));
611
610
  t.after(() => rmSync(bin, { recursive: true, force: true }));
612
- writeFileSync(join(bin, "sed"), `#!/bin/sh\n${body}\n`, { mode: 0o755 });
611
+ writeExecStub(join(bin, "sed"), `#!/bin/sh\n${body}\n`);
613
612
  return `${bin}:${ENV.PATH ?? process.env.PATH}`;
614
613
  }
615
614
 
@@ -18,9 +18,10 @@
18
18
  import { test } from "node:test";
19
19
  import assert from "node:assert/strict";
20
20
  import { execFileSync } from "node:child_process";
21
- import { mkdtempSync, mkdirSync, writeFileSync, readFileSync, chmodSync } from "node:fs";
22
- import { tmpdir } from "node:os";
21
+ import { mkdirSync, writeFileSync, readFileSync } from "node:fs";
22
+ import { tempDir } from "./temp-dir.mjs";
23
23
  import { join } from "node:path";
24
+ import { writeExecStub } from "./exec-stub.mjs";
24
25
 
25
26
  // The stubs shell out to jq, and so does the block under test. Without it every
26
27
  // gate would fail identically and the suite would go green on a block that
@@ -41,15 +42,11 @@ const blocks = [...SKILL.matchAll(/```sh\n([\s\S]*?)```/g)]
41
42
  assert.equal(blocks.length, 1, `expected exactly one sh block emitting WATCHER DEGRADED, found ${blocks.length} — update this test`);
42
43
  const BLOCK = blocks[0];
43
44
 
44
- const DIR = mkdtempSync(join(tmpdir(), "watcher-block-"));
45
+ const DIR = tempDir("watcher-block-");
45
46
  const BIN = join(DIR, "bin");
46
47
  mkdirSync(BIN);
47
48
 
48
- const stub = (name, body) => {
49
- const p = join(BIN, name);
50
- writeFileSync(p, body);
51
- chmodSync(p, 0o755);
52
- };
49
+ const stub = (name, body) => writeExecStub(join(BIN, name), body);
53
50
 
54
51
  // Every *SEQ variable names a file of one value per line, consumed one per
55
52
  // invocation, so a scenario can change what a probe returns between ticks. The