@workit-dev/codex 2.12.0 → 2.14.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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "workit",
3
- "version": "2.12.0",
3
+ "version": "2.14.0",
4
4
  "description": "Adaptive engineering workflow rails for Codex",
5
5
  "author": {
6
6
  "name": "BrainerVirus"
@@ -0,0 +1,26 @@
1
+ # Generated by Workit from packages/workit-claude-code/agents/babysitter.md; edits are overwritten on the next plugin start.
2
+ name = "workit-babysitter"
3
+ description = "Drives one pushed PR to its endpoint - polls its status, fixes red CI in the PR's own worktree, answers review threads - and reports when it is ready, merged or blocked. Use to babysit a PR in the background after it is opened."
4
+ developer_instructions = '''You are the workit babysitter for one PR. Follow the workit-ship skill
5
+ (`$workit-ship`): its babysit loop is your job.
6
+
7
+ 1. Work only in the checkout or worktree your prompt names, on the PR's own
8
+ branch; never in another branch. Run Workit against it, one verb per call:
9
+ `workit pr status --cwd <worktree> --json`, `workit check --cwd <worktree> <name>`,
10
+ `workit git --cwd <worktree> commit …`.
11
+ 2. Act on `babysit` in `workit pr status --json`: wait, fix a red check at its
12
+ root (reproduce it with `workit check` first), answer each unresolved thread,
13
+ or stop at the endpoint your prompt names (`ready` by default).
14
+ 3. Merge only when your prompt or the grant says `merged`; never force-push,
15
+ rebase or retarget unless your prompt says so.
16
+ 4. A fix you cannot make in one round, a product choice, or a check that stays
17
+ red after one fix: stop and report it.
18
+
19
+ Before your final report, wait for or stop every background command you started
20
+ (the host shows you running while one lives); never report with one still running.
21
+
22
+ Report: the PR, its head SHA and endpoint, each check and thread you acted on,
23
+ and anything left for the lead.
24
+
25
+ Codex does not isolate subagents: work only in the checkout or worktree your prompt names, never in another one.
26
+ '''
@@ -0,0 +1,27 @@
1
+ # Generated by Workit from packages/workit-claude-code/agents/decider.md; edits are overwritten on the next plugin start.
2
+ name = "workit-decider"
3
+ description = "Fresh read-only decider for a stuck call - a failed fix round and recheck, or a worker and a reviewer who disagree - that returns the options, a pick by reversibility and the exact change list. Use instead of a third review round; never for a product choice."
4
+ sandbox_mode = "read-only"
5
+ developer_instructions = '''You are the workit decider. You wrote none of the work and change none of it:
6
+ you read, decide and report. Follow the workit-fanout skill
7
+ (`$workit-fanout`, "Stuck calls: the decider").
8
+
9
+ 1. Read the dispute itself: the brief or acceptance, the diff
10
+ (`git -C <worktree> diff <base>...HEAD`), the failed findings and the
11
+ author's answer, and `workit ledger list --type decision`.
12
+ 2. List the real options (two or three), each with what it costs if wrong.
13
+ 3. Pick one by reversibility: the option cheapest to undo wins a tie.
14
+ 4. Give the exact change list for the pick: file, what changes, and the check
15
+ that proves it, so the fixer applies it once.
16
+
17
+ A product choice, or authority nobody here has, is not yours: say so and name
18
+ the question for the user. The lead records your pick with
19
+ `workit ledger decision`; you record nothing.
20
+
21
+ Before your final report, wait for or stop every background command you started
22
+ (the host shows you running while one lives); never report with one still running.
23
+
24
+ Never commit, push, merge or edit. Write only in your session's scratchpad.
25
+
26
+ Codex runs you in a read-only sandbox: read and run read-only commands only, and record nothing.
27
+ '''
@@ -6621,13 +6621,13 @@ var require_dist = __commonJS(function(exports, module) {
6621
6621
  });
6622
6622
 
6623
6623
  // packages/workit-codex/scripts/launch-mcp.ts
6624
- import { existsSync as existsSync17, realpathSync as realpathSync12, statSync as statSync6 } from "node:fs";
6624
+ import { existsSync as existsSync18, realpathSync as realpathSync12, statSync as statSync6 } from "node:fs";
6625
6625
  import path38 from "node:path";
6626
6626
  import { fileURLToPath as fileURLToPath3 } from "node:url";
6627
6627
 
6628
6628
  // packages/workit-core/src/core.ts
6629
6629
  import { spawnSync as spawnSync20 } from "node:child_process";
6630
- import { existsSync as existsSync12, realpathSync as realpathSync9 } from "node:fs";
6630
+ import { existsSync as existsSync13, realpathSync as realpathSync9 } from "node:fs";
6631
6631
  import path31 from "node:path";
6632
6632
 
6633
6633
  // packages/workit-core/src/core/task-contract.ts
@@ -15515,7 +15515,7 @@ var workspaceConfigSchema = object({
15515
15515
  fanout: object({
15516
15516
  tierModels: unknown().optional().describe("The model per slice TIER (mundane, standard, hard), as one name or per host.")
15517
15517
  }).passthrough().optional().describe("Fanout settings."),
15518
- models: object({ roles: modelRoles }).passthrough().optional().describe("Model and effort per role and host (roles), the lead's own advisory model (lead) and whether a model the lead names on a spawn wins (allowLeadOverride, default false); the same key at the top of workspaces.json is the global default."),
15518
+ models: object({ roles: modelRoles }).passthrough().optional().describe("Model and effort per role and host (roles), the lead's own advisory model (lead), how a role model applies (enforce: advise, the default, or strict) and, under strict, whether a model the lead names on a spawn wins (allowLeadOverride, default false); the same key at the top of workspaces.json is the global default."),
15519
15519
  resources: unknown().optional().describe("Heavy-check limits on this machine: slots, scope, heavy, light, memoryMax, cpuQuota, wait."),
15520
15520
  remotes: array(nonBlank.refine((pattern) => remotePattern(pattern) !== null, "is not a remote URL (https://host/owner/repo, git@host:owner/repo, a path, or owner/*)")).optional().describe("Remote URLs this entry owns: a checkout pushing to or opening PRs on one never exceeds this entry's grants, wherever the folder is (`owner/*` claims a whole owner). Only the user changes it, in their own terminal."),
15521
15521
  autonomy: object(Object.fromEntries(["push", "pr", "merge", "release", "rerun"].map((kind) => [
@@ -15553,7 +15553,7 @@ var workspaceConfigSchema = object({
15553
15553
  });
15554
15554
  var workspacesFileSchema = object({
15555
15555
  workspaces: array(workspaceConfigSchema).optional().describe("Workspace entries, each mapping a path glob to its forge, policies and grants."),
15556
- models: object({ roles: modelRoles }).passthrough().optional().describe("The global default model and effort per role and host (roles), the lead's own advisory model (lead) and whether a model the lead names on a spawn wins (allowLeadOverride, default false).")
15556
+ models: object({ roles: modelRoles }).passthrough().optional().describe("The global default model and effort per role and host (roles), the lead's own advisory model (lead), how a role model applies (enforce: advise, the default, or strict) and, under strict, whether a model the lead names on a spawn wins (allowLeadOverride, default false).")
15557
15557
  }).passthrough().superRefine((file, context) => {
15558
15558
  const names = new Set;
15559
15559
  for (const [index, workspace] of (file.workspaces ?? []).entries()) {
@@ -23668,16 +23668,19 @@ var HOST_KEYS = new Set([
23668
23668
  "pi",
23669
23669
  "default"
23670
23670
  ]);
23671
- var BUILT_IN_CLAUDE_CODE = {
23671
+ var CLAUDE_AGENT_FILES = {
23672
23672
  decider: { model: "fable", effort: "high" },
23673
- "implementer.hard": { model: "opus" },
23674
- "implementer.standard": { model: "sonnet" },
23675
- "implementer.mundane": { model: "haiku" },
23673
+ implementer: { model: "sonnet" },
23676
23674
  verifier: { model: "sonnet" },
23677
23675
  reviewer: { model: "opus" },
23678
- explore: { model: "haiku" },
23679
23676
  babysit: { model: "haiku" }
23680
23677
  };
23678
+ var BUILT_IN_CLAUDE_CODE = {
23679
+ ...CLAUDE_AGENT_FILES,
23680
+ "implementer.hard": { model: "opus" },
23681
+ "implementer.standard": { model: "sonnet" },
23682
+ "implementer.mundane": { model: "haiku" }
23683
+ };
23681
23684
  var isObject6 = (value) => !!value && typeof value === "object" && !Array.isArray(value);
23682
23685
  var name = (value) => typeof value === "string" && value.trim() ? value.trim() : null;
23683
23686
  var leaf = (value) => {
@@ -23761,18 +23764,20 @@ var firstAvailable = (candidates, host, now = new Date) => {
23761
23764
  }
23762
23765
  return { ...primary, skipped, allExhausted: true };
23763
23766
  };
23767
+ var FILE_ROLES = new Set(["decider", "verifier", "reviewer", "babysit"]);
23764
23768
  var CLAUDE_ALIASES = new Set(["sonnet", "opus", "haiku", "fable"]);
23765
23769
  var CLAUDE_EFFORTS = new Set(["low", "medium", "high", "xhigh", "max"]);
23766
23770
  var CLAUDE_SPAWNS = [
23767
- ...["hard", "standard", "mundane"].map((tier) => ({
23768
- label: tier === "hard" ? "workit:implementer hard" : tier,
23771
+ ...MODEL_TIERS.map((tier) => ({
23772
+ label: `workit:implementer ${tier}`,
23769
23773
  selector: { role: "implementer", tier }
23770
23774
  })),
23771
- { label: "workit:verifier", selector: { role: "verifier" } },
23772
- { label: "workit:reviewer", selector: { role: "reviewer" } },
23775
+ ...["verifier", "reviewer", "decider"].map((role) => ({
23776
+ label: `workit:${role}`,
23777
+ selector: { role }
23778
+ })),
23779
+ { label: "workit:babysitter", selector: { role: "babysit" } },
23773
23780
  { label: "Explore", selector: { role: "explore" } },
23774
- { label: "ROLE: decider", selector: { role: "decider" } },
23775
- { label: "ROLE: babysit", selector: { role: "babysit" } },
23776
23781
  { label: "general-purpose", selector: { role: "default" } }
23777
23782
  ];
23778
23783
  var uniformImplementerModel = (cwd, host, dir) => {
@@ -24035,6 +24040,7 @@ var exportDigest = (bundle) => sha256({
24035
24040
  task: bundle.task
24036
24041
  });
24037
24042
  // packages/workit-core/src/autonomy.ts
24043
+ import { closeSync as closeSync2, copyFileSync as copyFileSync2, existsSync as existsSync11, openSync as openSync2 } from "node:fs";
24038
24044
  import path26 from "node:path";
24039
24045
 
24040
24046
  // packages/workit-core/src/core/eval-world.ts
@@ -24131,12 +24137,36 @@ function checkSeal(dir) {
24131
24137
  }
24132
24138
 
24133
24139
  // packages/workit-core/src/autonomy.ts
24134
- var accountDir = () => {
24140
+ var accountHomeDir = () => {
24135
24141
  const home = grantsHome.resolve();
24136
24142
  return home === null ? null : configDir({ HOME: home });
24137
24143
  };
24138
- var grantsDir = () => accountDir() ?? resolveConfigDir();
24144
+ var deniedFile = (dir) => {
24145
+ for (const name of ["workspaces.json", SEAL_FILE]) {
24146
+ const file = path26.join(dir, name);
24147
+ try {
24148
+ closeSync2(openSync2(file, "r"));
24149
+ } catch (error) {
24150
+ const code = error.code;
24151
+ if (code === "EACCES" || code === "EPERM")
24152
+ return file;
24153
+ }
24154
+ }
24155
+ return null;
24156
+ };
24157
+ var accountDir = () => {
24158
+ const dir = accountHomeDir();
24159
+ return dir === null || deniedFile(dir) !== null ? null : dir;
24160
+ };
24161
+ var grantsDir = () => accountHomeDir() ?? resolveConfigDir();
24139
24162
  var NO_ACCOUNT = "no OS account record answered (core/account-home.ts), so no grants are read: the D4 defaults apply";
24163
+ var accountUnread = () => {
24164
+ const dir = accountHomeDir();
24165
+ if (dir === null)
24166
+ return NO_ACCOUNT;
24167
+ const file = deniedFile(dir);
24168
+ return file === null ? null : `the account's ${path26.basename(file)} cannot be read (permission denied), so it reads as no workspace entries: no grants, no models, the D4 defaults apply`;
24169
+ };
24140
24170
  var entriesIn = (dir) => dir === null ? [] : loadWorkspacesFrom(dir);
24141
24171
  var fileSource = (dir = accountDir()) => ({
24142
24172
  resolve: (cwd, name) => dir === null ? null : resolveWorkspaceFrom(cwd, dir, name),
@@ -24179,7 +24209,7 @@ var benchWorld = (cwd) => {
24179
24209
  var grantsOverride = () => {
24180
24210
  const shown = shownGrantsDir();
24181
24211
  if (shown === null)
24182
- return NO_ACCOUNT;
24212
+ return accountUnread() ?? NO_ACCOUNT;
24183
24213
  const configured = path26.resolve(resolveConfigDir());
24184
24214
  return configured === path26.resolve(shown) ? null : `the config directory is redirected to ${configured} (WORKIT_CONFIG, WORKIT_CONFIG_DIR or XDG_CONFIG_HOME), but that override does not apply to grants: grants are read only from ${path26.join(grantsDir(), "workspaces.json")}, and under a redirect they never exceed the D4 defaults`;
24185
24215
  };
@@ -24348,9 +24378,10 @@ function capAt(source, named, where, by, why, main = false) {
24348
24378
  }
24349
24379
  function resolveAutonomy(cwd, target) {
24350
24380
  const world = benchWorld(cwd);
24381
+ const unread = world ? null : accountUnread();
24382
+ if (unread !== null)
24383
+ return { ...autonomyOf(null), note: unread };
24351
24384
  const override = world ? null : grantsOverride();
24352
- if (override === NO_ACCOUNT)
24353
- return { ...autonomyOf(null), note: override };
24354
24385
  let resolved;
24355
24386
  const once = typeof target === "function" ? () => resolved ??= target() : target;
24356
24387
  const account = accountAuthority(cwd, world, once);
@@ -26558,7 +26589,7 @@ class WorkitCore {
26558
26589
  }
26559
26590
  // packages/workit-core/src/core/repo-context.ts
26560
26591
  import { spawnSync as spawnSync16 } from "node:child_process";
26561
- import { existsSync as existsSync11, readFileSync as readFileSync11, readdirSync as readdirSync4 } from "node:fs";
26592
+ import { existsSync as existsSync12, readFileSync as readFileSync11, readdirSync as readdirSync4 } from "node:fs";
26562
26593
  import path27 from "node:path";
26563
26594
  var isSafeContextRange = (value) => value.length <= 4096 && (() => {
26564
26595
  try {
@@ -26740,7 +26771,7 @@ var diffStatForRange = (cwd, range) => {
26740
26771
  };
26741
26772
  var packageScripts = (cwd, keys) => {
26742
26773
  const pkgPath = path27.join(cwd, "package.json");
26743
- if (!existsSync11(pkgPath))
26774
+ if (!existsSync12(pkgPath))
26744
26775
  return [];
26745
26776
  try {
26746
26777
  const pkg = JSON.parse(readFileSync11(pkgPath, "utf8"));
@@ -26775,7 +26806,7 @@ var documentationFiles = (cwd) => {
26775
26806
  return matches.toSorted().slice(0, 200);
26776
26807
  };
26777
26808
  var readTrimmed2 = (file, maxLines) => {
26778
- if (!existsSync11(file))
26809
+ if (!existsSync12(file))
26779
26810
  return "";
26780
26811
  const lines = readFileSync11(file, "utf8").split(`
26781
26812
  `);
@@ -26851,7 +26882,7 @@ ${status.stderr}` : "");
26851
26882
  stdout += `
26852
26883
  `;
26853
26884
  stdout += printSection("Recent Validation Signals");
26854
- if (existsSync11(path27.join(cwd, "package.json"))) {
26885
+ if (existsSync12(path27.join(cwd, "package.json"))) {
26855
26886
  stdout += `package.json detected. Common scripts:
26856
26887
  `;
26857
26888
  const found = packageScripts(cwd, ["lint", "format:check", "test", "build"]);
@@ -26860,7 +26891,7 @@ ${status.stderr}` : "");
26860
26891
  `) + `
26861
26892
  `;
26862
26893
  }
26863
- if (existsSync11(path27.join(cwd, "Cargo.toml")) || existsSync11(path27.join(cwd, "src-tauri/Cargo.toml"))) {
26894
+ if (existsSync12(path27.join(cwd, "Cargo.toml")) || existsSync12(path27.join(cwd, "src-tauri/Cargo.toml"))) {
26864
26895
  stdout += `Rust project detected.
26865
26896
  `;
26866
26897
  }
@@ -26912,7 +26943,7 @@ function changelogContext(root, range) {
26912
26943
  `;
26913
26944
  stdout += printSection("Existing CHANGELOG.md");
26914
26945
  const changelogPath = path27.join(cwd, "CHANGELOG.md");
26915
- if (existsSync11(changelogPath)) {
26946
+ if (existsSync12(changelogPath)) {
26916
26947
  stdout += readTrimmed2(changelogPath, 260) + `
26917
26948
  `;
26918
26949
  } else {
@@ -26954,7 +26985,7 @@ function docsRefreshContext(root, range) {
26954
26985
  `;
26955
26986
  stdout += printSection("README Preview");
26956
26987
  const readme = path27.join(cwd, "README.md");
26957
- if (existsSync11(readme)) {
26988
+ if (existsSync12(readme)) {
26958
26989
  stdout += readTrimmed2(readme, 220) + `
26959
26990
  `;
26960
26991
  } else {
@@ -26963,7 +26994,7 @@ function docsRefreshContext(root, range) {
26963
26994
  }
26964
26995
  stdout += printSection("Package Scripts");
26965
26996
  const pkgPath = path27.join(cwd, "package.json");
26966
- if (existsSync11(pkgPath)) {
26997
+ if (existsSync12(pkgPath)) {
26967
26998
  try {
26968
26999
  const pkg = JSON.parse(readFileSync11(pkgPath, "utf8"));
26969
27000
  stdout += JSON.stringify({ name: pkg.name, version: pkg.version, scripts: pkg.scripts }, null, 2) + `
@@ -27019,7 +27050,7 @@ function releaseNotesContext(root, rangeOrTag) {
27019
27050
  `;
27020
27051
  stdout += printSection("Existing Release Files");
27021
27052
  for (const rel of ["CHANGELOG.md", "RELEASE_NOTES.md", ".github/releases.md"]) {
27022
- if (existsSync11(path27.join(cwd, rel)))
27053
+ if (existsSync12(path27.join(cwd, rel)))
27023
27054
  stdout += rel + `
27024
27055
  `;
27025
27056
  }
@@ -27627,7 +27658,7 @@ function resolveInside(root, candidate) {
27627
27658
  throw new Error("path must stay inside repository root");
27628
27659
  }
27629
27660
  let ancestor = target;
27630
- while (!existsSync12(ancestor))
27661
+ while (!existsSync13(ancestor))
27631
27662
  ancestor = path31.dirname(ancestor);
27632
27663
  const canonicalAncestor = realpathSync9(ancestor);
27633
27664
  if (canonicalAncestor !== base && !canonicalAncestor.startsWith(base + path31.sep)) {
@@ -27651,7 +27682,7 @@ function run2(root, executable, args, env = {}) {
27651
27682
  }
27652
27683
 
27653
27684
  // packages/workit-core/src/core/cli-locate.ts
27654
- import { closeSync as closeSync2, existsSync as existsSync13, openSync as openSync2, readSync } from "node:fs";
27685
+ import { closeSync as closeSync3, existsSync as existsSync14, openSync as openSync3, readSync } from "node:fs";
27655
27686
  import path32 from "node:path";
27656
27687
  var LAUNCHER_MARKER = "workit-owned-launcher";
27657
27688
  var CLI_PACKAGE_PATH = ["node_modules", "@workit-dev", "cli"];
@@ -27666,7 +27697,7 @@ var ownedCurrentEntry = (env, platform = process.platform) => path32.join(instal
27666
27697
  var head = (file) => {
27667
27698
  let fd;
27668
27699
  try {
27669
- fd = openSync2(file, "r");
27700
+ fd = openSync3(file, "r");
27670
27701
  const buffer = Buffer.alloc(256);
27671
27702
  const read = readSync(fd, buffer, 0, buffer.length, 0);
27672
27703
  return buffer.subarray(0, read).toString("utf8");
@@ -27674,13 +27705,13 @@ var head = (file) => {
27674
27705
  return "";
27675
27706
  } finally {
27676
27707
  if (fd !== undefined)
27677
- closeSync2(fd);
27708
+ closeSync3(fd);
27678
27709
  }
27679
27710
  };
27680
27711
  var locateWorkitCli = (options = {}) => {
27681
27712
  const env = options.env ?? process.env;
27682
27713
  const platform = options.platform ?? process.platform;
27683
- const exists = options.exists ?? existsSync13;
27714
+ const exists = options.exists ?? existsSync14;
27684
27715
  const read = options.read ?? head;
27685
27716
  const node = options.node ?? process.execPath;
27686
27717
  const launcher = ownedLauncherPath(env, platform);
@@ -27742,7 +27773,7 @@ var SUPPORT_MATRIX = {
27742
27773
  };
27743
27774
 
27744
27775
  // packages/workit-mcp/src/server.ts
27745
- import { existsSync as existsSync14, readFileSync as readFileSync12, realpathSync as realpathSync10 } from "node:fs";
27776
+ import { existsSync as existsSync15, readFileSync as readFileSync12, realpathSync as realpathSync10 } from "node:fs";
27746
27777
  import path33 from "node:path";
27747
27778
  // node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js
27748
27779
  function isZ4Schema(s) {
@@ -30301,7 +30332,7 @@ function createMcpServer(host, contextProvider) {
30301
30332
  path33.join(here, "server.ts"),
30302
30333
  path33.join(here, "..", "..", "workit-core", "src", "core", "task-contract.ts"),
30303
30334
  path33.join(here, "..", "..", "workit-core", "src", "core", "task-engine.ts")
30304
- ].filter((file) => existsSync14(file)));
30335
+ ].filter((file) => existsSync15(file)));
30305
30336
  let staleWarned = false;
30306
30337
  const failures = new Map;
30307
30338
  const server = new Server({ name: "workit", version: VERSION }, { capabilities: { tools: {}, resources: {} } });
@@ -30818,13 +30849,13 @@ var PROMPT_INTENTS = [
30818
30849
  ].map(([name, pattern]) => [`workit-${name}`, pattern]);
30819
30850
  var READERS = new Set("cat sed head tail less more bat nl get-content gc type".split(" "));
30820
30851
  // packages/workit-core/src/hooks/hosts/fields.ts
30821
- import { existsSync as existsSync15, realpathSync as realpathSync11, statSync as statSync5 } from "node:fs";
30852
+ import { existsSync as existsSync16, realpathSync as realpathSync11, statSync as statSync5 } from "node:fs";
30822
30853
  import path35 from "node:path";
30823
30854
  var isRecord4 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
30824
30855
  var nonEmpty2 = (value) => typeof value === "string" && value.trim() !== "";
30825
30856
  var optionalText = (value) => typeof value === "string" ? value : null;
30826
30857
  var existingDirectory = (value) => {
30827
- if (!nonEmpty2(value) || !path35.isAbsolute(value) || !existsSync15(value))
30858
+ if (!nonEmpty2(value) || !path35.isAbsolute(value) || !existsSync16(value))
30828
30859
  return null;
30829
30860
  try {
30830
30861
  return statSync5(value).isDirectory() ? realpathSync11(value) : null;
@@ -31725,7 +31756,7 @@ if (false)
31725
31756
 
31726
31757
  // packages/workit-codex/scripts/agents.ts
31727
31758
  import {
31728
- existsSync as existsSync16,
31759
+ existsSync as existsSync17,
31729
31760
  lstatSync as lstatSync6,
31730
31761
  mkdirSync as mkdirSync5,
31731
31762
  readdirSync as readdirSync5,
@@ -31736,7 +31767,13 @@ import {
31736
31767
  } from "node:fs";
31737
31768
  import os6 from "node:os";
31738
31769
  import path37 from "node:path";
31739
- var CODEX_AGENT_ROLES = ["verifier", "reviewer", "implementer"];
31770
+ var CODEX_AGENT_ROLES = [
31771
+ "verifier",
31772
+ "reviewer",
31773
+ "implementer",
31774
+ "decider",
31775
+ "babysitter"
31776
+ ];
31740
31777
  var CODEX_AGENT_MARKER = "# Generated by Workit";
31741
31778
  var codexAgentName = (role) => `workit-${role}`;
31742
31779
  var codexAgentFile = (role) => `${codexAgentName(role)}.toml`;
@@ -31784,7 +31821,7 @@ var lstatOrNull = (file) => {
31784
31821
  };
31785
31822
  var installCodexAgents = (pluginRoot, codexHome, models = {}) => {
31786
31823
  const source = path37.join(pluginRoot, "agents");
31787
- if (!existsSync16(source))
31824
+ if (!existsSync17(source))
31788
31825
  return [];
31789
31826
  const version = pluginVersion(pluginRoot);
31790
31827
  const target = path37.join(codexHome, "agents");
@@ -31850,7 +31887,7 @@ var resolveCodexWorkspaceRoot = (pluginRoot, env) => {
31850
31887
  const explicit = env.WORKIT_WORKSPACE_ROOT;
31851
31888
  const inherited = env.PWD;
31852
31889
  const candidate = explicit ?? (inherited && path38.resolve(inherited) !== path38.resolve(pluginRoot) ? inherited : undefined);
31853
- if (!candidate || !path38.isAbsolute(candidate) || !existsSync17(candidate))
31890
+ if (!candidate || !path38.isAbsolute(candidate) || !existsSync18(candidate))
31854
31891
  return null;
31855
31892
  try {
31856
31893
  if (!statSync6(candidate).isDirectory())
@@ -31892,10 +31929,15 @@ var codexContextProvider = (host = detectCodexSurface(process.env), root) => ({
31892
31929
  var pluginRoot = () => path38.resolve(path38.dirname(fileURLToPath3(import.meta.url)), "..");
31893
31930
  var codexRoleModels = (cwd) => {
31894
31931
  const out = {};
31895
- for (const role of ["verifier", "reviewer"]) {
31932
+ for (const [file, role] of [
31933
+ ["verifier", "verifier"],
31934
+ ["reviewer", "reviewer"],
31935
+ ["decider", "decider"],
31936
+ ["babysitter", "babysit"]
31937
+ ]) {
31896
31938
  const found = resolveRoleModel(cwd, { role }, "codex");
31897
31939
  if (found)
31898
- out[role] = { model: found.model, effort: found.effort };
31940
+ out[file] = { model: found.model, effort: found.effort };
31899
31941
  }
31900
31942
  const implementer = uniformImplementerModel(cwd, "codex");
31901
31943
  if (implementer)
@@ -7356,7 +7356,7 @@ var workspaceConfigSchema = object({
7356
7356
  fanout: object({
7357
7357
  tierModels: unknown().optional().describe("The model per slice TIER (mundane, standard, hard), as one name or per host.")
7358
7358
  }).passthrough().optional().describe("Fanout settings."),
7359
- models: object({ roles: modelRoles }).passthrough().optional().describe("Model and effort per role and host (roles), the lead's own advisory model (lead) and whether a model the lead names on a spawn wins (allowLeadOverride, default false); the same key at the top of workspaces.json is the global default."),
7359
+ models: object({ roles: modelRoles }).passthrough().optional().describe("Model and effort per role and host (roles), the lead's own advisory model (lead), how a role model applies (enforce: advise, the default, or strict) and, under strict, whether a model the lead names on a spawn wins (allowLeadOverride, default false); the same key at the top of workspaces.json is the global default."),
7360
7360
  resources: unknown().optional().describe("Heavy-check limits on this machine: slots, scope, heavy, light, memoryMax, cpuQuota, wait."),
7361
7361
  remotes: array(nonBlank.refine((pattern) => remotePattern(pattern) !== null, "is not a remote URL (https://host/owner/repo, git@host:owner/repo, a path, or owner/*)")).optional().describe("Remote URLs this entry owns: a checkout pushing to or opening PRs on one never exceeds this entry's grants, wherever the folder is (`owner/*` claims a whole owner). Only the user changes it, in their own terminal."),
7362
7362
  autonomy: object(Object.fromEntries(["push", "pr", "merge", "release", "rerun"].map((kind) => [
@@ -7394,7 +7394,7 @@ var workspaceConfigSchema = object({
7394
7394
  });
7395
7395
  var workspacesFileSchema = object({
7396
7396
  workspaces: array(workspaceConfigSchema).optional().describe("Workspace entries, each mapping a path glob to its forge, policies and grants."),
7397
- models: object({ roles: modelRoles }).passthrough().optional().describe("The global default model and effort per role and host (roles), the lead's own advisory model (lead) and whether a model the lead names on a spawn wins (allowLeadOverride, default false).")
7397
+ models: object({ roles: modelRoles }).passthrough().optional().describe("The global default model and effort per role and host (roles), the lead's own advisory model (lead), how a role model applies (enforce: advise, the default, or strict) and, under strict, whether a model the lead names on a spawn wins (allowLeadOverride, default false).")
7398
7398
  }).passthrough().superRefine((file, context) => {
7399
7399
  const names = new Set;
7400
7400
  for (const [index, workspace] of (file.workspaces ?? []).entries()) {
@@ -8907,16 +8907,19 @@ var HOST_KEYS = new Set([
8907
8907
  "pi",
8908
8908
  "default"
8909
8909
  ]);
8910
- var BUILT_IN_CLAUDE_CODE = {
8910
+ var CLAUDE_AGENT_FILES = {
8911
8911
  decider: { model: "fable", effort: "high" },
8912
- "implementer.hard": { model: "opus" },
8913
- "implementer.standard": { model: "sonnet" },
8914
- "implementer.mundane": { model: "haiku" },
8912
+ implementer: { model: "sonnet" },
8915
8913
  verifier: { model: "sonnet" },
8916
8914
  reviewer: { model: "opus" },
8917
- explore: { model: "haiku" },
8918
8915
  babysit: { model: "haiku" }
8919
8916
  };
8917
+ var BUILT_IN_CLAUDE_CODE = {
8918
+ ...CLAUDE_AGENT_FILES,
8919
+ "implementer.hard": { model: "opus" },
8920
+ "implementer.standard": { model: "sonnet" },
8921
+ "implementer.mundane": { model: "haiku" }
8922
+ };
8920
8923
  var isObject2 = (value) => !!value && typeof value === "object" && !Array.isArray(value);
8921
8924
  var name = (value) => typeof value === "string" && value.trim() ? value.trim() : null;
8922
8925
  var leaf = (value) => {
@@ -8948,6 +8951,10 @@ var forHostList = (value, host) => {
8948
8951
  return [];
8949
8952
  };
8950
8953
  var rolesOf = (models) => isObject2(models) && isObject2(models.roles) ? models.roles : null;
8954
+ var resolveRoleModel = (cwd, selector, host, dir) => {
8955
+ const chosen = firstAvailable(resolveRoleModels(cwd, selector, host, dir), host);
8956
+ return chosen ? { model: chosen.model, effort: chosen.effort, source: chosen.source } : null;
8957
+ };
8951
8958
  var resolveRoleModels = (cwd, selector, host, dir) => {
8952
8959
  const { role, tier } = selector;
8953
8960
  for (const source of modelSources(cwd, dir)) {
@@ -9002,12 +9009,15 @@ var fallbackText = (chosen) => {
9002
9009
  const passed = chosen.skipped.map((one) => `${one.model} (${one.provider} exhausted until ${shortTime(one.until)})`).join(", ");
9003
9010
  return chosen.allExhausted ? `every model configured for it is exhausted: ${passed}; it runs on ${chosen.model} anyway. Add a model of another provider to the list in workspaces.json, then run \`workit models show\`.` : `fell back past ${passed}.`;
9004
9011
  };
9005
- var leadOverrideAllowed = (cwd, dir) => {
9012
+ var modelsKey = (cwd, key, dir) => {
9006
9013
  for (const source of modelSources(cwd, dir))
9007
- if (isObject2(source.models) && Object.hasOwn(source.models, "allowLeadOverride"))
9008
- return source.models.allowLeadOverride === true;
9009
- return false;
9014
+ if (isObject2(source.models) && Object.hasOwn(source.models, key))
9015
+ return source.models[key];
9016
+ return;
9010
9017
  };
9018
+ var leadOverrideAllowed = (cwd, dir) => modelsKey(cwd, "allowLeadOverride", dir) === true;
9019
+ var enforceMode = (cwd, dir) => modelsKey(cwd, "enforce", dir) === "strict" ? "strict" : "advise";
9020
+ var FILE_ROLES = new Set(["decider", "verifier", "reviewer", "babysit"]);
9011
9021
  var CLAUDE_ALIASES = new Set(["sonnet", "opus", "haiku", "fable"]);
9012
9022
  var CLAUDE_EFFORTS = new Set(["low", "medium", "high", "xhigh", "max"]);
9013
9023
  var FULL_CLAUDE_ID = /^(?:[\w.-]+[./])?claude-(?:\d[\d.-]*-)?(sonnet|opus|haiku|fable)(?:[-.@[]|$)/u;
@@ -9033,7 +9043,7 @@ var chooseSpawnModel = (cwd, selector, host, given, accept, dir) => {
9033
9043
  const givenModel = name(given.model);
9034
9044
  const label = roleLabel(selector);
9035
9045
  const configured = resolved.source !== "built-in";
9036
- if (givenModel && (!configured || leadOverrideAllowed(cwd, dir)))
9046
+ if (givenModel && (!configured || enforceMode(cwd, dir) === "advise" || leadOverrideAllowed(cwd, dir)))
9037
9047
  return none;
9038
9048
  const model = accept(resolved.model);
9039
9049
  const effort = resolved.effort && !name(given.effort) ? resolved.effort : null;
@@ -9059,40 +9069,34 @@ var chooseSpawnModel = (cwd, selector, host, given, accept, dir) => {
9059
9069
  model,
9060
9070
  effort,
9061
9071
  basis,
9062
- note: givenModel ? `Workit replaced model ${givenModel} with ${model} on this spawn: role ${label} is set in ${resolved.source}.${why} Next time ${next} on the spawn. To let a spawn's own model win, set "allowLeadOverride": true under models in workspaces.json.` : `Workit set ${model}${effort ? ` (effort ${effort})` : ""} on this spawn: role ${label}, ${resolved.source}.${why}${configured ? "" : " Name a model to choose another."}`
9063
- };
9064
- };
9065
- var claudeSpawnArgs = (cwd, selector, dir) => {
9066
- const choice = chooseSpawnModel(cwd, selector, "claude_code", {}, claudeAgentModel, dir);
9067
- if (!choice.model)
9068
- return null;
9069
- const effort = choice.effort?.toLowerCase() ?? null;
9070
- return {
9071
- model: choice.model,
9072
- effort: effort && CLAUDE_EFFORTS.has(effort) ? effort : null
9072
+ note: givenModel ? `Workit replaced model ${givenModel} with ${model} on this spawn: role ${label} is set in ${resolved.source}.${why} Next time ${next} on the spawn, or set models.enforce "advise" so a named model wins.` : `Workit set ${model}${effort ? ` (effort ${effort})` : ""} on this spawn: role ${label}, ${resolved.source}.${why}${configured ? "" : " Name a model to choose another."}`
9073
9073
  };
9074
9074
  };
9075
9075
  var CLAUDE_SPAWNS = [
9076
- ...["hard", "standard", "mundane"].map((tier) => ({
9077
- label: tier === "hard" ? "workit:implementer hard" : tier,
9076
+ ...MODEL_TIERS.map((tier) => ({
9077
+ label: `workit:implementer ${tier}`,
9078
9078
  selector: { role: "implementer", tier }
9079
9079
  })),
9080
- { label: "workit:verifier", selector: { role: "verifier" } },
9081
- { label: "workit:reviewer", selector: { role: "reviewer" } },
9080
+ ...["verifier", "reviewer", "decider"].map((role) => ({
9081
+ label: `workit:${role}`,
9082
+ selector: { role }
9083
+ })),
9084
+ { label: "workit:babysitter", selector: { role: "babysit" } },
9082
9085
  { label: "Explore", selector: { role: "explore" } },
9083
- { label: "ROLE: decider", selector: { role: "decider" } },
9084
- { label: "ROLE: babysit", selector: { role: "babysit" } },
9085
9086
  { label: "general-purpose", selector: { role: "default" } }
9086
9087
  ];
9087
9088
  var claudeSpawnTable = (cwd, dir) => {
9088
9089
  const rows = CLAUDE_SPAWNS.flatMap(({ label, selector }) => {
9089
- const args = claudeSpawnArgs(cwd, selector, dir);
9090
- return args ? [`${label} ${args.model}${args.effort ? `/${args.effort}` : ""}`] : [];
9090
+ const want = resolveRoleModel(cwd, selector, "claude_code", dir);
9091
+ const model = want && want.source !== "built-in" ? claudeAgentModel(want.model) : null;
9092
+ const effort = want?.effort?.toLowerCase();
9093
+ const file = label.startsWith("workit:") ? CLAUDE_AGENT_FILES[selector.role] : undefined;
9094
+ return model && (model !== file?.model || effort !== file.effort) ? [`${label} ${model}${effort ? `/${effort}` : ""}`] : [];
9091
9095
  });
9092
- return rows.length ? `Agent spawn model/effort (pass them, workers with run_in_background: true): ${rows.join(", ")}. Implementer prompt: \`workit fanout brief <slice>\` after \`workit fanout worktree create <slice>\`, even for one slice.` : null;
9096
+ return `Spawn Workit roles by name (workit:implementer, workit:verifier, workit:reviewer, workit:decider, workit:babysitter; search: Explore), workers with run_in_background: true, and pass no model or effort unless the user named one${rows.length ? `; configured here (pass them): ${rows.join(", ")}` : ""}. Implementer prompt: \`workit fanout brief <slice>\` after \`workit fanout worktree create <slice>\`, even for one slice.`;
9093
9097
  };
9094
9098
  var ROLE_SELECTORS = MODEL_ROLES.flatMap((role) => role === "implementer" ? MODEL_TIERS.map((tier) => ({ role, tier })) : [{ role }]);
9095
- var AGENT_ROLE = /^(?:workit[:-])?(decider|implementer|verifier|reviewer|explore|babysit)$/iu;
9099
+ var AGENT_ROLE = /^(?:workit[:-])?(decider|implementer|verifier|reviewer|explore|babysit)(?:(?<=babysit)ter)?$/iu;
9096
9100
  var ROLE_LINE = /^[ \t]*ROLE:[ \t]*(decider|implementer|verifier|reviewer|explore|babysit)\b/imu;
9097
9101
  var TIER_LINE = /^[ \t]*TIER:[ \t]*(mundane|standard|hard)\b/imu;
9098
9102
  var isBrief = (text) => TIER_LINE.test(text) && /^WORKTREE:/mu.test(text);
@@ -15514,7 +15518,7 @@ var seedTurnContext = (input, descriptor, text = turnContextText(input, descript
15514
15518
  };
15515
15519
  // packages/workit-core/src/core/route-intent.ts
15516
15520
  import { spawnSync as spawnSync14 } from "node:child_process";
15517
- import { existsSync as existsSync10 } from "node:fs";
15521
+ import { existsSync as existsSync11 } from "node:fs";
15518
15522
  import path25 from "node:path";
15519
15523
 
15520
15524
  // packages/workit-core/src/hooks/raw-git.ts
@@ -15525,6 +15529,7 @@ import os5 from "node:os";
15525
15529
  import path24 from "node:path";
15526
15530
 
15527
15531
  // packages/workit-core/src/autonomy.ts
15532
+ import { closeSync as closeSync2, copyFileSync, existsSync as existsSync10, openSync as openSync2 } from "node:fs";
15528
15533
  import path22 from "node:path";
15529
15534
 
15530
15535
  // packages/workit-core/src/core/eval-world.ts
@@ -15621,12 +15626,36 @@ function checkSeal(dir) {
15621
15626
  }
15622
15627
 
15623
15628
  // packages/workit-core/src/autonomy.ts
15624
- var accountDir = () => {
15629
+ var accountHomeDir = () => {
15625
15630
  const home = grantsHome.resolve();
15626
15631
  return home === null ? null : configDir2({ HOME: home });
15627
15632
  };
15628
- var grantsDir = () => accountDir() ?? resolveConfigDir();
15633
+ var deniedFile = (dir) => {
15634
+ for (const name of ["workspaces.json", SEAL_FILE]) {
15635
+ const file = path22.join(dir, name);
15636
+ try {
15637
+ closeSync2(openSync2(file, "r"));
15638
+ } catch (error) {
15639
+ const code = error.code;
15640
+ if (code === "EACCES" || code === "EPERM")
15641
+ return file;
15642
+ }
15643
+ }
15644
+ return null;
15645
+ };
15646
+ var accountDir = () => {
15647
+ const dir = accountHomeDir();
15648
+ return dir === null || deniedFile(dir) !== null ? null : dir;
15649
+ };
15650
+ var grantsDir = () => accountHomeDir() ?? resolveConfigDir();
15629
15651
  var NO_ACCOUNT = "no OS account record answered (core/account-home.ts), so no grants are read: the D4 defaults apply";
15652
+ var accountUnread = () => {
15653
+ const dir = accountHomeDir();
15654
+ if (dir === null)
15655
+ return NO_ACCOUNT;
15656
+ const file = deniedFile(dir);
15657
+ return file === null ? null : `the account's ${path22.basename(file)} cannot be read (permission denied), so it reads as no workspace entries: no grants, no models, the D4 defaults apply`;
15658
+ };
15630
15659
  var entriesIn = (dir) => dir === null ? [] : loadWorkspacesFrom(dir);
15631
15660
  var fileSource = (dir = accountDir()) => ({
15632
15661
  resolve: (cwd, name) => dir === null ? null : resolveWorkspaceFrom(cwd, dir, name),
@@ -15686,7 +15715,7 @@ var benchWorld = (cwd) => {
15686
15715
  var grantsOverride = () => {
15687
15716
  const shown = shownGrantsDir();
15688
15717
  if (shown === null)
15689
- return NO_ACCOUNT;
15718
+ return accountUnread() ?? NO_ACCOUNT;
15690
15719
  const configured = path22.resolve(resolveConfigDir());
15691
15720
  return configured === path22.resolve(shown) ? null : `the config directory is redirected to ${configured} (WORKIT_CONFIG, WORKIT_CONFIG_DIR or XDG_CONFIG_HOME), but that override does not apply to grants: grants are read only from ${path22.join(grantsDir(), "workspaces.json")}, and under a redirect they never exceed the D4 defaults`;
15692
15721
  };
@@ -15855,9 +15884,10 @@ function capAt(source, named, where, by, why, main = false) {
15855
15884
  }
15856
15885
  function resolveAutonomy(cwd, target) {
15857
15886
  const world = benchWorld(cwd);
15887
+ const unread = world ? null : accountUnread();
15888
+ if (unread !== null)
15889
+ return { ...autonomyOf(null), note: unread };
15858
15890
  const override = world ? null : grantsOverride();
15859
- if (override === NO_ACCOUNT)
15860
- return { ...autonomyOf(null), note: override };
15861
15891
  let resolved;
15862
15892
  const once = typeof target === "function" ? () => resolved ??= target() : target;
15863
15893
  const account = accountAuthority(cwd, world, once);
@@ -15956,9 +15986,9 @@ function capAtRemotes(source, autonomy, cwd, target) {
15956
15986
  return capped;
15957
15987
  }
15958
15988
  var grantsMatter = (kind) => {
15959
- const override = grantsOverride();
15960
- if (override === NO_ACCOUNT)
15989
+ if (accountUnread() !== null)
15961
15990
  return false;
15991
+ const override = grantsOverride();
15962
15992
  const entries = entriesIn(accountDir());
15963
15993
  const matters = entries.some((entry) => {
15964
15994
  const autonomy = autonomyOf(entry);
@@ -18571,7 +18601,7 @@ var judgedDir = (root, dir) => {
18571
18601
  if (dir === null)
18572
18602
  return root;
18573
18603
  const resolved = path25.resolve(root, dir);
18574
- return existsSync10(resolved) && inWorkitWorkspace(resolved) ? resolved : null;
18604
+ return existsSync11(resolved) && inWorkitWorkspace(resolved) ? resolved : null;
18575
18605
  };
18576
18606
  var shellBranchPolicyViolation = (root, command, dialect = "posix") => {
18577
18607
  let judged = false;
@@ -19580,7 +19610,7 @@ var splitDenial = (plan) => ({
19580
19610
  });
19581
19611
  // packages/workit-core/src/hooks/write-gate.ts
19582
19612
  import {
19583
- existsSync as existsSync11,
19613
+ existsSync as existsSync12,
19584
19614
  readdirSync as readdirSync3,
19585
19615
  readFileSync as readFileSync10,
19586
19616
  readlinkSync as readlinkSync3,
@@ -20292,7 +20322,7 @@ var linkSources = (args, at) => {
20292
20322
  const sources = names.filter((name, index) => into >= 0 ? name !== dest : index < names.length - 1 || names.length === 1);
20293
20323
  const target = dest === undefined ? null : at(dest);
20294
20324
  const symbolic = args.some((arg) => /^-[a-zA-Z]*s|^--symbolic$/.test(arg));
20295
- const base = target === null ? null : into >= 0 || sources.length > 1 || existsSync11(target) || /[\\/]$/.test(dest ?? "") ? target : path29.dirname(target);
20325
+ const base = target === null ? null : into >= 0 || sources.length > 1 || existsSync12(target) || /[\\/]$/.test(dest ?? "") ? target : path29.dirname(target);
20296
20326
  return sources.flatMap((source) => {
20297
20327
  if (symbolic && base !== null && !path29.isAbsolute(homeExpanded(source)))
20298
20328
  return [path29.resolve(base, source)];
@@ -21763,13 +21793,13 @@ ${line}` };
21763
21793
  return decision;
21764
21794
  };
21765
21795
  // packages/workit-core/src/hooks/hosts/fields.ts
21766
- import { existsSync as existsSync12, realpathSync as realpathSync9, statSync as statSync4 } from "node:fs";
21796
+ import { existsSync as existsSync13, realpathSync as realpathSync9, statSync as statSync4 } from "node:fs";
21767
21797
  import path31 from "node:path";
21768
21798
  var isRecord6 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
21769
21799
  var nonEmpty2 = (value) => typeof value === "string" && value.trim() !== "";
21770
21800
  var optionalText = (value) => typeof value === "string" ? value : null;
21771
21801
  var existingDirectory = (value) => {
21772
- if (!nonEmpty2(value) || !path31.isAbsolute(value) || !existsSync12(value))
21802
+ if (!nonEmpty2(value) || !path31.isAbsolute(value) || !existsSync13(value))
21773
21803
  return null;
21774
21804
  try {
21775
21805
  return statSync4(value).isDirectory() ? realpathSync9(value) : null;
@@ -23633,7 +23663,7 @@ var cdWorkitSplit = (command) => {
23633
23663
  };
23634
23664
 
23635
23665
  // packages/workit-core/src/hooks/model-limit.ts
23636
- import { closeSync as closeSync2, openSync as openSync2, readdirSync as readdirSync4, readSync, statSync as statSync5 } from "node:fs";
23666
+ import { closeSync as closeSync3, openSync as openSync3, readdirSync as readdirSync4, readSync, statSync as statSync5 } from "node:fs";
23637
23667
  import os10 from "node:os";
23638
23668
  import path34 from "node:path";
23639
23669
  var MONTHS = ["jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"];
@@ -23774,21 +23804,21 @@ var TAIL_BYTES2 = 16384;
23774
23804
  var tail = (file, size) => {
23775
23805
  const length = Math.min(size, TAIL_BYTES2);
23776
23806
  const buffer = Buffer.alloc(length);
23777
- const fd = openSync2(file, "r");
23807
+ const fd = openSync3(file, "r");
23778
23808
  try {
23779
23809
  readSync(fd, buffer, 0, length, size - length);
23780
23810
  } finally {
23781
- closeSync2(fd);
23811
+ closeSync3(fd);
23782
23812
  }
23783
23813
  return buffer.toString("utf8");
23784
23814
  };
23785
23815
  var start = (file) => {
23786
23816
  const buffer = Buffer.alloc(TAIL_BYTES2);
23787
- const fd = openSync2(file, "r");
23817
+ const fd = openSync3(file, "r");
23788
23818
  try {
23789
23819
  return buffer.subarray(0, readSync(fd, buffer, 0, TAIL_BYTES2, 0)).toString("utf8");
23790
23820
  } finally {
23791
- closeSync2(fd);
23821
+ closeSync3(fd);
23792
23822
  }
23793
23823
  };
23794
23824
  var parse4 = (line) => {
@@ -23877,11 +23907,12 @@ var respawn = (input, reasons, dropped, limits) => {
23877
23907
  return {
23878
23908
  kind: "deny",
23879
23909
  reason: [
23880
- `workit spawn args: spawn again with exactly ${args} (description and prompt as written${without}).`,
23881
- ...reasons,
23882
- "Workit denies instead of rewriting the spawn: Claude Code's auto mode refuses a hook-rewritten spawn.",
23910
+ `workit spawn args: ${reasons.join(" ")}`,
23911
+ `Retry as: Agent ${args} (description and prompt as written${without}).`,
23912
+ "Why: auto mode refuses a hook-rewritten spawn.",
23883
23913
  limits
23884
- ].filter(Boolean).join(" "),
23914
+ ].filter(Boolean).join(`
23915
+ `),
23885
23916
  unblock: args
23886
23917
  };
23887
23918
  };
@@ -23916,18 +23947,19 @@ var agentModelDecision = (cwd, tool, options = {}) => {
23916
23947
  if (!selector)
23917
23948
  return asWritten(null);
23918
23949
  const choice = chooseSpawnModel(cwd, selector, "claude_code", tool, claudeAgentModel);
23950
+ const file = String(tool.subagent_type).startsWith("workit:") ? CLAUDE_AGENT_FILES[selector.role] : undefined;
23919
23951
  const effort = choice.effort?.toLowerCase() ?? null;
23920
23952
  const input = { ...tool };
23921
- if (choice.model)
23953
+ if (choice.model && (given(tool.model) || choice.model !== file?.model))
23922
23954
  input.model = choice.model;
23923
- if (effort && CLAUDE_EFFORTS.has(effort) && !given(tool.effort))
23955
+ if (effort && CLAUDE_EFFORTS.has(effort) && !given(tool.effort) && effort !== file?.effort)
23924
23956
  input.effort = effort;
23925
23957
  const needs = [
23926
23958
  input.model === tool.model ? null : `model ${String(input.model)}`,
23927
23959
  input.effort === tool.effort ? null : `effort ${String(input.effort)}`
23928
23960
  ].filter(Boolean);
23929
23961
  if (!needs.length)
23930
- return asWritten(choice.note);
23962
+ return asWritten(choice.model ? null : choice.note);
23931
23963
  if (!auto) {
23932
23964
  const note = choice.note ?? `Workit set effort ${String(input.effort)} on this spawn: its role's configured effort.`;
23933
23965
  return {
@@ -23937,12 +23969,18 @@ var agentModelDecision = (cwd, tool, options = {}) => {
23937
23969
  `)
23938
23970
  };
23939
23971
  }
23972
+ if (enforceMode(cwd) === "advise") {
23973
+ if (changed)
23974
+ return respawn(tool, change.reasons, change.dropped, limits);
23975
+ const ran = file ? `${file.model}${file.effort ? `/${file.effort}` : ""}` : "its default model";
23976
+ const pass = spawnArgsText({ model: input.model, effort: input.effort });
23977
+ return asWritten(`Workit: this ${String(tool.subagent_type || "general-purpose")} spawn runs on ${ran}; ${choice.basis} sets ${needs.join(" and ")}. To use it, pass ${pass} on the spawn.`);
23978
+ }
23940
23979
  const replaced = given(tool.model) && input.model !== tool.model;
23941
23980
  return respawn(input, [
23942
23981
  ...change.reasons,
23943
- `It needs ${needs.join(" and ")}: ${choice.basis ?? "its role"}.`,
23944
- replaced ? `That replaces model ${String(tool.model)}: a configured role model wins unless "allowLeadOverride": true is set under models in workspaces.json.` : ""
23945
- ].filter(Boolean), change.dropped, limits);
23982
+ `It needs ${needs.join(" and ")} (${choice.basis}, models.enforce strict)${replaced ? `, not ${String(tool.model)}` : ""}.`
23983
+ ], change.dropped, limits);
23946
23984
  };
23947
23985
 
23948
23986
  // packages/workit-core/src/hooks/spawn-gate.ts
@@ -101,7 +101,7 @@ if (quiet) {
101
101
  `);
102
102
  } else {
103
103
  try {
104
- const { runCodexHook } = await import("./workit-hook-cs31z956.js");
104
+ const { runCodexHook } = await import("./workit-hook-mcerh8x3.js");
105
105
  await runCodexHook([payload]);
106
106
  } catch (error) {
107
107
  const { answerRuntimeFailure } = await import("./workit-hook-9k8dtngs.js");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workit-dev/codex",
3
- "version": "2.12.0",
3
+ "version": "2.14.0",
4
4
  "private": false,
5
5
  "description": "Workit Codex CLI/desktop plugin — shared MCP transport, hooks, method skills, and verifier/reviewer/implementer agents",
6
6
  "keywords": [
@@ -41,8 +41,8 @@
41
41
  "build": "bun scripts/build.ts"
42
42
  },
43
43
  "devDependencies": {
44
- "@workit-dev/core": "^2.12.0",
45
- "@workit-dev/mcp": "^2.12.0"
44
+ "@workit-dev/core": "^2.14.0",
45
+ "@workit-dev/mcp": "^2.14.0"
46
46
  },
47
47
  "engines": {
48
48
  "node": ">=24"
@@ -39,7 +39,7 @@ units of ~100+ lines each. Coupled work stays with one owner. Workit never spawn
39
39
  6. **Retry once, then escalate.** A stuck or failed slice gets one retry with
40
40
  a fresh brief (`workit fanout brief <slice> --mode resume`, same branch);
41
41
  if that fails too, re-slice it, take it over, or report the gap. Never
42
- chain resumes. A fix round and recheck that both fail: a decider, not a
42
+ chain resumes. A fix round and recheck that both fail: the decider agent, not a
43
43
  third round; product choices go to the user (`references/orchestration.md`).
44
44
  7. **Verify by the workspace `verification` setting** (`workit grant show`).
45
45
  A report is a pointer, never evidence. `proportional` (default): each slice's lane (`workit pr status`) decides; none needs no verdict, self the author's `--self`, focused and full a verifier (Claude Code: the `model` and `effort` of `workit models show --role verifier`) after the last push; one verdict at a stack's top covers its unchanged lower PRs, and a stale one with `reverify: focused` re-checks only the new diff, reusing green CI. `self`: a verifier that wrote none
@@ -5,35 +5,37 @@ and fans in. Workit records and checks; the host's own subagents run the work.
5
5
 
6
6
  ## TIER to model
7
7
 
8
- TIER is a field of each slice and of its brief. Role models come from the
9
- workspace (`models.roles`; `fanout.tierModels` still feeds the implementer
10
- tiers) and, on Claude Code, built-in defaults: the brief has a `model:` line
11
- (with `effort:` when set) under TIER and a `verifier:` line; `workit fanout
12
- status` names the model next to each spawnable slice; `workit models show
13
- [--role r] [--host h] --json` lists every role (decider, implementer tiers,
14
- verifier, reviewer, explore, babysit). Pass exactly that `model` (and `effort`
15
- where the host's spawn call takes one) on the spawn call: a subagent that
16
- passes none inherits your model. Scouting and PR babysitting use the `explore`
17
- and `babysit` roles. A role with no model (other hosts without config) runs
18
- on the host's model, and TIER only sizes the timebox and decides whether to
19
- race. Claude Code's built-in defaults, when nothing is configured:
20
-
21
- | Role or TIER | `model` on the Agent call |
8
+ TIER is a field of each slice and of its brief. Each Workit role is a host
9
+ agent that carries its own model: spawn it by name and pass no `model` or
10
+ `effort` unless the user named one (a named model always wins).
11
+
12
+ | Host | Spawn by name |
13
+ | --- | --- |
14
+ | Claude Code | `workit:implementer`, `workit:verifier`, `workit:reviewer`, `workit:decider`, `workit:babysitter`; search: `Explore` |
15
+ | OpenCode | `workit-implementer`, `workit-verifier`, `workit-reviewer`, `workit-decider`, `workit-babysitter` |
16
+ | Codex | the same `workit-*` names |
17
+ | Cursor | `workit-verifier`, `workit-reviewer`, `workit-decider`, `workit-babysitter` |
18
+
19
+ Claude Code, with nothing configured (pass a brief's `SPAWN:` line as printed):
20
+
21
+ | Role or TIER | Model |
22
22
  | --- | --- |
23
- | decider | `fable`, effort `high` |
24
- | hard | `opus` |
25
- | standard | `sonnet` |
26
- | mundane | `haiku` |
27
- | verifier | `sonnet` |
28
- | reviewer | `opus` |
29
- | explore, babysit | `haiku` |
30
-
31
- Claude Code and OpenCode also get the role's model set on the spawn by
32
- Workit; a configured one beats a `model` you pass unless
33
- `models.allowLeadOverride` is true. A general spawn takes
34
- `models.roles.default`, or the role its prompt's `ROLE: <role>` line names.
35
- `models.lead` (your own model) is advisory. `workit models show` marks each
36
- role `enforced` or `advisory` per host: on advisory, pass the model.
23
+ | decider | `fable`, effort `high` (agent file) |
24
+ | hard | `opus` (the brief's SPAWN line) |
25
+ | standard, verifier | `sonnet` (agent file) |
26
+ | mundane | `haiku` (the brief's SPAWN line) |
27
+ | reviewer | `opus` (agent file) |
28
+ | babysitter | `haiku` (agent file) |
29
+
30
+ A role
31
+ configured in `models.roles` to another model is listed in your session
32
+ contract (Claude Code) or set on the host's agent (OpenCode, Codex); `workit
33
+ models show [--role r] [--host h]` prints per host whether it comes from the
34
+ `agent file`, a `spawn fill` or is `advisory` (pass it yourself), and the
35
+ `models.enforce` mode. Under `strict` a configured role model beats a named
36
+ one and Claude Code's auto mode denies a spawn that lacks it. A role with no
37
+ model runs on the host's model, and TIER only sizes the timebox and decides
38
+ whether to race. `models.lead` (your own model) is advisory.
37
39
 
38
40
  ## Rolling window
39
41
 
@@ -66,10 +68,9 @@ reversibility (the option cheapest to undo wins a tie), and the exact change
66
68
  list. The fixer applies that list once, then one focused recheck follows.
67
69
 
68
70
  - Hard call (shared contract, security, migration): two deciders on different
69
- models (Claude Code, OpenCode, Cursor: the `decider` role model and a
70
- different `model` on the spawn, kept on a configured decider role only with
71
- `models.allowLeadOverride`; Codex and Pi: one decider). If they disagree, you take the
72
- more reversible option.
71
+ models (Claude Code, OpenCode, Cursor: one bare decider spawn and one that
72
+ names another `model`; Codex and Pi: one decider). If they disagree, you
73
+ take the more reversible option.
73
74
  - Record it: `workit ledger decision "<pick>" --by decider --why "<why it is
74
75
  the more reversible>" --view "<decider A: view>" --view "<decider B: view>"`.
75
76
  The row is listed as a decider call; it is never the user's answer to a
@@ -45,7 +45,7 @@ those files since the judged head and reuse green CI there (no fresh install, no
45
45
  under your own session (the one the lead or the hook gave you).
46
46
  8. **Bound the loop.** A failed verdict gets one fix round and one recheck of
47
47
  the changed hunks. Still failing, or stuck: no third round; the lead spawns
48
- a decider (read the `workit-fanout` skill's SKILL.md and follow it). A product choice goes to the user.
48
+ the decider agent by name, no model (read the `workit-fanout` skill's SKILL.md and follow it). A product choice: the user.
49
49
  9. **Harness note** (optional): friction caused by the repo or harness, not
50
50
  the change (a flaky fixture, a missing check, a misleading doc or skill
51
51
  line), goes on its own `Harness note:` line in the report and any PR
@@ -29,7 +29,7 @@ once the verdict is accepted. `merged`: step 7. `null` (closed, not merged):
29
29
  stop and report. Stop early only for a new consequential choice, a host
30
30
  denial, a review comment that needs a product decision, a required update
31
31
  that repeats because the base keeps moving, or after 3 failed fix attempts on
32
- the same check. Fix round and recheck both failed: a decider (read the `workit-fanout` skill's SKILL.md and follow it).
32
+ the same check. Fix round and recheck both failed: the decider agent (read the `workit-fanout` skill's SKILL.md and follow it).
33
33
 
34
34
  1. **Open.** Last before the PR, if `workit grant show` has `changelog: update|create`: write the Unreleased entry with `workit changelog apply`, commit it; with `docs: when-user-facing` fix only docs the diff made false (`references/changelog.md`).
35
35
  Full local check (`workit check ci` when `.workit/checks.json` has a `ci` group), push once: `workit git push`, then `workit pr template` and fill the template it prints: every heading, each `<!-- -->` replaced (Workit's: `references/pr-body.md`).