@workit-dev/codex 2.16.2 → 2.17.1

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.16.2",
3
+ "version": "2.17.1",
4
4
  "description": "Adaptive engineering workflow rails for Codex",
5
5
  "author": {
6
6
  "name": "BrainerVirus"
@@ -6,16 +6,25 @@ names (its WORKTREE line), which the lead made with
6
6
  `workit fanout worktree create <slice>` before spawning you; never in the
7
7
  lead's checkout.
8
8
 
9
+ Your first step: a prompt that points at the brief (its WORKTREE, WORKER, TIER
10
+ and TIMEBOX lines and `workit fanout brief <slice> --name <plan>`) means run
11
+ that command and follow its text; a prompt that names a brief file means read
12
+ that file.
13
+
9
14
  Refuse to start without a complete brief. It must state: goal, scope (files
10
15
  or areas you may touch), acceptance (observable outcomes), verify (exact
11
16
  commands), timebox, forbidden (what you must not touch or do), report (what to
12
17
  hand back), standing orders, mode (`new` or `resume`) and the worktree path.
13
- If a field is missing, report which and stop.
18
+ If a field is missing, report which and stop. An unplanned slice
19
+ (`fanout worktree create <slice>` with no plan) has a short brief: the lead's
20
+ prompt states the task, and its acceptance and verify count as the brief's.
14
21
 
15
22
  1. In a Workit worktree (the default), run each git and check command against
16
23
  it, one verb per call:
17
24
  `workit git --cwd <worktree> commit …`, `workit check --cwd <worktree> <name>`
18
25
  (verb first, so the host's allow rules match).
26
+ Read-only git (`status`, `log`, `diff`, `show`) is plain
27
+ `git -C <worktree> …`; `workit git` takes branch, commit, stage and push.
19
28
  Never `cd <worktree> && …` chains, `$VAR` paths or compound commands. Edit
20
29
  files by their path under the worktree. Workit's hooks deny an edit or a
21
30
  mutating git command outside it.
@@ -31602,7 +31602,7 @@ var DESCRIPTORS = {
31602
31602
  };
31603
31603
  var sinceStart = new Map;
31604
31604
  // packages/workit-core/src/hooks/cwd-normalize.ts
31605
- var DIR = String.raw`[A-Za-z0-9_./@%+:,=-]+|'[^'$${"`"}\\\n]*'|"[^"$${"`"}\\!\n]*"`;
31605
+ var DIR = String.raw`(?:[A-Za-z0-9_./@%+:,=-]|(?<=[A-Za-z0-9])~)+|'[^'$${"`"}\n]*'|"(?:[^"$${"`"}\\!\n]|\\(?=[^"$${"`"}\\!\n]))*"`;
31606
31606
  var COMPOUND2 = new RegExp(String.raw`^\s*cd\s+(${DIR})\s*&&\s*(workit(?:\s[\s\S]*)?)$`, "u");
31607
31607
  var GLOBALS_FIRST = new RegExp(String.raw`^(\s*workit)((?:\s+(?:--json|--cwd(?:=|\s+)(?:${DIR})))+)\s+([a-z][a-z-]*)(?=\s|$)`, "u");
31608
31608
  var VERBS = new Set(WORKIT_ALLOWED_VERBS);
@@ -19612,6 +19612,14 @@ var heavyDenial = (original, plan) => ({
19612
19612
  reason: plan.server ? `dev_server: \`${original.trim()}\` starts a dev server (${plan.reason}), which never returns. Start it in the background, owned by this session; run exactly: ${plan.command}` : `heavy_command: \`${original.trim()}\` is heavy (${plan.reason}) and must run under the machine-wide heavy-check lease, so parallel agents cannot exhaust this machine's memory and CPU. Run exactly: ${plan.command}`,
19613
19613
  unblock: plan.command
19614
19614
  });
19615
+ var retryDenial = (gate, what, retry) => ({
19616
+ kind: "deny",
19617
+ reason: `workit ${gate}: ${what}.
19618
+ Retry as: ${retry}
19619
+ Why: Claude Code auto mode refuses a call whose input a hook changed.`,
19620
+ unblock: retry
19621
+ });
19622
+ var autoRouteDenial = (plan) => plan.server ? retryDenial("dev-server", "a dev server never returns, so start it in the background, owned by this session", plan.command) : retryDenial("heavy", "this heavy command runs under the machine-wide heavy-check lease", plan.command);
19615
19623
  var splitDenial = (plan) => ({
19616
19624
  kind: "deny",
19617
19625
  reason: plan.reason,
@@ -23591,7 +23599,7 @@ var standingDelta = (input) => {
23591
23599
  };
23592
23600
  var sinceStart = new Map;
23593
23601
  // packages/workit-core/src/hooks/cwd-normalize.ts
23594
- var DIR = String.raw`[A-Za-z0-9_./@%+:,=-]+|'[^'$${"`"}\\\n]*'|"[^"$${"`"}\\!\n]*"`;
23602
+ var DIR = String.raw`(?:[A-Za-z0-9_./@%+:,=-]|(?<=[A-Za-z0-9])~)+|'[^'$${"`"}\n]*'|"(?:[^"$${"`"}\\!\n]|\\(?=[^"$${"`"}\\!\n]))*"`;
23595
23603
  var COMPOUND2 = new RegExp(String.raw`^\s*cd\s+(${DIR})\s*&&\s*(workit(?:\s[\s\S]*)?)$`, "u");
23596
23604
  var GLOBALS_FIRST = new RegExp(String.raw`^(\s*workit)((?:\s+(?:--json|--cwd(?:=|\s+)(?:${DIR})))+)\s+([a-z][a-z-]*)(?=\s|$)`, "u");
23597
23605
  var VERB_FIRST = /^((?:--json\s+)*)([a-z][a-z-]*)(?=\s|$)/u;
@@ -23676,6 +23684,10 @@ var cdWorkitSplit = (command) => {
23676
23684
  return null;
23677
23685
  };
23678
23686
 
23687
+ // packages/workit-core/src/hooks/spawn-gate.ts
23688
+ import fs23 from "node:fs";
23689
+ import path35 from "node:path";
23690
+
23679
23691
  // packages/workit-core/src/hooks/model-limit.ts
23680
23692
  import { closeSync as closeSync3, openSync as openSync3, readdirSync as readdirSync4, readSync, statSync as statSync5 } from "node:fs";
23681
23693
  import os10 from "node:os";
@@ -23999,20 +24011,37 @@ var agentModelDecision = (cwd, tool, options = {}) => {
23999
24011
 
24000
24012
  // packages/workit-core/src/hooks/spawn-gate.ts
24001
24013
  var MADE_WORKTREE = /^WORKTREE:[ \t]*(?!not made yet)\S(?![^\n]*not made yet)/mu;
24002
- var UNBLOCK = "workit fanout worktree create <slice>";
24003
- var BRIEF = "workit fanout brief <slice>";
24014
+ var namesMade = (word) => {
24015
+ try {
24016
+ const stat = fs23.statSync(word);
24017
+ if (stat.isFile())
24018
+ return stat.size < 1e6 && MADE_WORKTREE.test(fs23.readFileSync(word, "utf8"));
24019
+ const dotGit = path35.join(word, ".git");
24020
+ const link = fs23.statSync(dotGit);
24021
+ const admin = link.isFile() && link.size <= 4096 && /^gitdir: *(.+)/u.exec(fs23.readFileSync(dotGit, "utf8"));
24022
+ return !!admin && fs23.existsSync(path35.resolve(word, admin[1].trim(), FANOUT_TOKEN_FILE));
24023
+ } catch {
24024
+ return false;
24025
+ }
24026
+ };
24027
+ var namesWorktree = (prompt) => MADE_WORKTREE.test(prompt) || (prompt.match(/(?<![\w.~])(?:[a-z]:[\\/]|\/)[^\s'"`<>|;,()]+/giu) ?? []).some((word) => namesMade(word.replace(/[.:]+$/u, "")));
24028
+ var sliceWord = (tool) => (/(?:\bfanout brief|\bworktree create|\bWORKER:) +([a-z0-9][\w.-]*)/iu.exec(String(tool.prompt))?.[1] ?? String(tool.description ?? "")).toLowerCase().replace(/[^a-z0-9._-]+/gu, "-").replace(/^[-._]+|-+$/gu, "").slice(0, 40) || "slice";
24004
24029
  var gate = (descriptor, tool) => {
24005
24030
  const type = typeof tool.subagent_type === "string" ? tool.subagent_type : "";
24006
24031
  const implementer = workitRole(descriptor, type) === "implementer";
24007
- if (implementer && (typeof tool.prompt !== "string" || !MADE_WORKTREE.test(tool.prompt)))
24032
+ if (implementer && (typeof tool.prompt !== "string" || !namesWorktree(tool.prompt))) {
24033
+ const slice = sliceWord(tool);
24034
+ const unblock = `workit fanout worktree create ${slice}`;
24008
24035
  return {
24009
24036
  kind: "deny",
24010
24037
  decision: {
24011
24038
  kind: "deny",
24012
- reason: `workit spawn gate: a ${type} spawn needs a Workit brief with a WORKTREE line, and this prompt has none. Even for one slice: run \`${UNBLOCK}\`, then \`${BRIEF}\`, and spawn again with its text as the prompt and the Agent args its SPAWN line names (a slice no plan registers needs \`workit fanout plan <plan.json>\` first).`,
24013
- unblock: UNBLOCK
24039
+ reason: `workit spawn gate: this ${type} prompt names no worktree Workit made.
24040
+ Retry as: ${unblock} (or --name <plan> for a planned slice), then spawn again with the WORKTREE line it prints as the prompt's first line.`,
24041
+ unblock
24014
24042
  }
24015
24043
  };
24044
+ }
24016
24045
  if (tool.isolation === undefined)
24017
24046
  return { kind: "run", input: tool, change: { dropped: [], reasons: [], notes: [] } };
24018
24047
  const { isolation: _dropped, ...input } = tool;
@@ -24036,8 +24065,8 @@ var spawnDecision = (descriptor, cwd, tool, permissionMode = null) => {
24036
24065
 
24037
24066
  // packages/workit-core/src/hooks/teardown.ts
24038
24067
  import { spawn } from "node:child_process";
24039
- import fs23 from "node:fs";
24040
- import path35 from "node:path";
24068
+ import fs24 from "node:fs";
24069
+ import path36 from "node:path";
24041
24070
  var REAP_INTERVAL_MS = 10 * 60000;
24042
24071
  var LOG_MAX_BYTES = 1 << 20;
24043
24072
  var ENDS = {
@@ -24048,9 +24077,9 @@ var ENDS = {
24048
24077
  };
24049
24078
  var SAFE_SESSION = /^[\w.@+][\w.:@/+-]{0,127}$/u;
24050
24079
  var HOST_SESSION_VARS = ["OPENCODE_SESSION_ID", "PI_SESSION_ID", "CODEX_THREAD_ID"];
24051
- var teardownDir = (env) => path35.join(stateDir3(env), "procs");
24052
- var teardownLog = (env) => path35.join(teardownDir(env), "teardown.log");
24053
- var reapStamp = (env) => path35.join(teardownDir(env), "reap-at-start.stamp");
24080
+ var teardownDir = (env) => path36.join(stateDir3(env), "procs");
24081
+ var teardownLog = (env) => path36.join(teardownDir(env), "teardown.log");
24082
+ var reapStamp = (env) => path36.join(teardownDir(env), "reap-at-start.stamp");
24054
24083
  function spawnDetached(request) {
24055
24084
  try {
24056
24085
  const shell = process.platform === "win32" && !/\.exe$/iu.test(request.command);
@@ -24077,13 +24106,13 @@ var teardownDeps = {
24077
24106
  var openLog = (env, args) => {
24078
24107
  try {
24079
24108
  const file = teardownLog(env);
24080
- fs23.mkdirSync(path35.dirname(file), { recursive: true });
24109
+ fs24.mkdirSync(path36.dirname(file), { recursive: true });
24081
24110
  let size = 0;
24082
24111
  try {
24083
- size = fs23.statSync(file).size;
24112
+ size = fs24.statSync(file).size;
24084
24113
  } catch {}
24085
- const fd = fs23.openSync(file, size > LOG_MAX_BYTES ? "w" : "a", 384);
24086
- fs23.writeSync(fd, `${new Date(teardownDeps.now()).toISOString()} workit ${args.join(" ")}
24114
+ const fd = fs24.openSync(file, size > LOG_MAX_BYTES ? "w" : "a", 384);
24115
+ fs24.writeSync(fd, `${new Date(teardownDeps.now()).toISOString()} workit ${args.join(" ")}
24087
24116
  `);
24088
24117
  return fd;
24089
24118
  } catch {
@@ -24095,7 +24124,7 @@ function runCli(args, env) {
24095
24124
  try {
24096
24125
  const cli = locateWorkitCli2({ env });
24097
24126
  const cwd = teardownDir(env);
24098
- fs23.mkdirSync(cwd, { recursive: true });
24127
+ fs24.mkdirSync(cwd, { recursive: true });
24099
24128
  log = openLog(env, args);
24100
24129
  const started = teardownDeps.spawn({
24101
24130
  command: cli.command,
@@ -24105,7 +24134,7 @@ function runCli(args, env) {
24105
24134
  log
24106
24135
  });
24107
24136
  if (!started && log !== null)
24108
- fs23.writeSync(log, ` not started
24137
+ fs24.writeSync(log, ` not started
24109
24138
  `);
24110
24139
  return started;
24111
24140
  } catch {
@@ -24113,7 +24142,7 @@ function runCli(args, env) {
24113
24142
  } finally {
24114
24143
  if (log !== null)
24115
24144
  try {
24116
- fs23.closeSync(log);
24145
+ fs24.closeSync(log);
24117
24146
  } catch {}
24118
24147
  }
24119
24148
  }
@@ -24132,24 +24161,24 @@ function endSession(end, env = process.env) {
24132
24161
  var claim2 = (file, now) => {
24133
24162
  for (let attempt = 0;attempt < 2; attempt += 1)
24134
24163
  try {
24135
- fs23.writeFileSync(file, String(now), { flag: "wx", mode: 384 });
24164
+ fs24.writeFileSync(file, String(now), { flag: "wx", mode: 384 });
24136
24165
  return true;
24137
24166
  } catch (error) {
24138
24167
  if (error.code !== "EEXIST")
24139
24168
  return false;
24140
24169
  let held = Number.NaN;
24141
24170
  try {
24142
- held = Number(fs23.readFileSync(file, "utf8"));
24171
+ held = Number(fs24.readFileSync(file, "utf8"));
24143
24172
  } catch {}
24144
24173
  if (now - held < REAP_INTERVAL_MS)
24145
24174
  return false;
24146
- fs23.rmSync(file, { force: true });
24175
+ fs24.rmSync(file, { force: true });
24147
24176
  }
24148
24177
  return false;
24149
24178
  };
24150
24179
  var fresh = (stamp, now) => {
24151
24180
  try {
24152
- const last = Number(fs23.readFileSync(stamp, "utf8"));
24181
+ const last = Number(fs24.readFileSync(stamp, "utf8"));
24153
24182
  return now - last < REAP_INTERVAL_MS && last <= now;
24154
24183
  } catch {
24155
24184
  return false;
@@ -24162,7 +24191,7 @@ function reapAtStart(_cwd, env = process.env) {
24162
24191
  try {
24163
24192
  if (fresh(stamp, now))
24164
24193
  return false;
24165
- fs23.mkdirSync(path35.dirname(stamp), { recursive: true });
24194
+ fs24.mkdirSync(path36.dirname(stamp), { recursive: true });
24166
24195
  if (!claim2(lock, now))
24167
24196
  return false;
24168
24197
  } catch {
@@ -24175,12 +24204,12 @@ function reapAtStart(_cwd, env = process.env) {
24175
24204
  started = runCli(["stop", "--orphans", "--reason", "session-start"], env);
24176
24205
  if (started) {
24177
24206
  const temp = `${stamp}.${process.pid}`;
24178
- fs23.writeFileSync(temp, String(now), { mode: 384 });
24179
- fs23.renameSync(temp, stamp);
24207
+ fs24.writeFileSync(temp, String(now), { mode: 384 });
24208
+ fs24.renameSync(temp, stamp);
24180
24209
  }
24181
24210
  } catch {} finally {
24182
24211
  try {
24183
- fs23.rmSync(lock, { force: true });
24212
+ fs24.rmSync(lock, { force: true });
24184
24213
  } catch {}
24185
24214
  }
24186
24215
  return started;
@@ -24783,6 +24812,7 @@ function decide(input, deps) {
24783
24812
  return withContextLine(text ? { kind: "context", text } : NONE6, promptNudge(input, event.prompt));
24784
24813
  }
24785
24814
  case "shell.pre": {
24815
+ const auto = input.host === "claude_code" && input.permissionMode === "auto";
24786
24816
  const npx = npxWorkit(event.command);
24787
24817
  if (npx && workitOnPath()) {
24788
24818
  const canDeny = usable2(descriptor.shellPolicy.deny);
@@ -24794,6 +24824,8 @@ function decide(input, deps) {
24794
24824
  const plain = decide({ ...input, event: { ...event, command: npx } }, deps);
24795
24825
  if (plain.kind !== "none" && plain.kind !== "context")
24796
24826
  return plain;
24827
+ if (auto && canDeny)
24828
+ return retryDenial("npx", "workit is on PATH, so run it directly", npx);
24797
24829
  if (usable2(descriptor.shellPolicy.rewrite))
24798
24830
  return {
24799
24831
  kind: "rewrite",
@@ -24862,8 +24894,10 @@ function decide(input, deps) {
24862
24894
  const rewrites = usable2(descriptor.shellPolicy.rewrite);
24863
24895
  if (plan.kind === "rewrite" && !rewrites && canDeny)
24864
24896
  return heavyDenial(event.command, plan);
24897
+ if (plan.kind === "rewrite" && auto && canDeny)
24898
+ return autoRouteDenial(plan);
24865
24899
  const lease = plan.kind === "rewrite" && rewrites ? plan : null;
24866
- const cwdCommand = !lease && rewrites && input.host === "claude_code" ? cwdRewrite(event.command) ?? verbFirst(event.command) : null;
24900
+ const cwdCommand = !lease && rewrites && input.host === "claude_code" ? cwdRewrite(event.command) ?? (auto ? null : verbFirst(event.command)) : null;
24867
24901
  const aside = plan.kind === "passthrough" ? plan.note : null;
24868
24902
  noteRawCommit(input, event.command, postTool ? callKey(event.toolUseId, event.command) : NEXT_COMMAND);
24869
24903
  const bypass = !lease && input.host === "claude_code" ? workitBypassFlag(event.command, event.dialect) : null;
@@ -24884,8 +24918,11 @@ function decide(input, deps) {
24884
24918
  });
24885
24919
  const nudge = canDeny ? rawGitPre(input, event.command, { nudge: nudges }) : NONE6;
24886
24920
  const nudged = withContextLine(withContextLine(nudge, aside), shipNudge(input, event.command));
24887
- if (!lease)
24888
- return cwdCommand && nudged.kind !== "deny" ? rewritten(nudged.kind === "context" ? nudged.text : null) : nudged;
24921
+ if (!lease) {
24922
+ if (!cwdCommand || nudged.kind === "deny")
24923
+ return nudged;
24924
+ return auto ? retryDenial("cwd", "run one verb per call with --cwd", cwdCommand) : rewritten(nudged.kind === "context" ? nudged.text : null);
24925
+ }
24889
24926
  return rewritten([rewriteNote(lease), nudged.kind === "context" ? nudged.text : null].filter(Boolean).join(`
24890
24927
  `));
24891
24928
  }
@@ -24983,7 +25020,7 @@ var dispatchHook = (adapter, raw, env = process.env) => {
24983
25020
  };
24984
25021
  // packages/workit-core/src/hooks/deadline.ts
24985
25022
  import { appendFileSync, mkdirSync as mkdirSync4 } from "node:fs";
24986
- import path36 from "node:path";
25023
+ import path37 from "node:path";
24987
25024
  var HOOK_SKIP_TEXT = "workit context skipped: host under load";
24988
25025
  var HOOK_DEADLINE_MS = 8000;
24989
25026
  var HOST_DEADLINES = {
@@ -25001,7 +25038,7 @@ var hookDeadlineMs = (env, host = "", native) => {
25001
25038
  const row = HOST_DEADLINES[host];
25002
25039
  return override(env) ?? (row ? native === undefined ? Math.min(...Object.values(row)) : row[native] ?? row[""] : HOOK_DEADLINE_MS);
25003
25040
  };
25004
- var skipsFile = (stateDir) => path36.join(stateDir, HOOK_SKIPS_FILE);
25041
+ var skipsFile = (stateDir) => path37.join(stateDir, HOOK_SKIPS_FILE);
25005
25042
  var recordHookSkip = (skip, stateDir = resolveStateDir()) => {
25006
25043
  try {
25007
25044
  mkdirSync4(stateDir, { recursive: true });
@@ -101,7 +101,7 @@ if (quiet) {
101
101
  `);
102
102
  } else {
103
103
  try {
104
- const { runCodexHook } = await import("./workit-hook-4vkgc2zt.js");
104
+ const { runCodexHook } = await import("./workit-hook-vytacjkg.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.16.2",
3
+ "version": "2.17.1",
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.16.2",
45
- "@workit-dev/mcp": "^2.16.2"
44
+ "@workit-dev/core": "^2.17.1",
45
+ "@workit-dev/mcp": "^2.17.1"
46
46
  },
47
47
  "engines": {
48
48
  "node": ">=24"
@@ -20,16 +20,15 @@ units of ~100+ lines each. Coupled work stays with one owner. Workit never spawn
20
20
  PR (`references/orchestration.md`).
21
21
  2. **Record standing orders** (`workit ledger standing add "<order>"`): every
22
22
  user directive all workers share. Directives decay across resumes.
23
- 3. **Brief each worker verbatim**: `workit fanout worktree create <slice>`
24
- (every host), then `workit fanout brief <slice>` (WORKTREE, SCRATCH, rules).
25
- Never hand-edit it; change the plan or the standing orders and render again.
23
+ 3. **Make the worktrees**: `workit fanout worktree create <slice>…` (every host; `--name <plan.json>`
24
+ registers the file) prints per slice its `WORKTREE:` line and the exact spawn, whose prompt points
25
+ the worker at `workit fanout brief <slice> --name <plan>`. Never hand-edit it; change the plan or
26
+ the standing orders. One unplanned slice needs no plan (`--branch <b>` optional).
26
27
  4. **Spawn in a rolling window**, in the background, each in its own worktree:
27
- keep 4-6 in flight and refill from `spawnable` in `workit fanout status` as
28
- each one finishes. Assign before spawn (OpenCode: `workit worker assign`); each prompt carries
29
- the brief, or a pointer: its `WORKER`, `TIER`, `TIMEBOX` and `WORKTREE` lines plus "run `workit fanout brief <slice>` and follow it"
30
- (budget and model hooks read those lines), so batched OpenCode launches each bind their worker.
31
- Model: the brief's `model:` and `effort:` lines (`workit models show`), else TIER (`references/orchestration.md`).
32
- Claude Code: the `implementer` agent; its spawn hook drops `isolation` and refuses a prompt without a WORKTREE line.
28
+ keep 4-6 in flight and refill from `spawnable` in `workit fanout status`.
29
+ Assign before spawn (OpenCode: `workit worker assign`); each prompt is the printed one
30
+ (budget and model hooks read its WORKTREE, WORKER, TIER and TIMEBOX lines), so batched OpenCode launches each bind their worker.
31
+ Claude Code: copy the printed `SPAWN:` args (a model only when the TIER differs from the agent file); the hook drops `isolation` and refuses a prompt naming no Workit worktree with a `Retry as:`.
33
32
  5. **Judge liveness by side effects only:** `workit fanout status` (head age,
34
33
  PR, CI, verdict, landed; STUCK past the TIMEBOX). Stop a stuck worker and
35
34
  observe that it exited (a timeout is not proof); stop a finished one when its
@@ -103,6 +103,27 @@ is the slice's STUCK threshold in `workit fanout status`. `"fanIn":
103
103
  }
104
104
  ```
105
105
 
106
+ ## Worktrees and the spawn they print
107
+
108
+ `workit fanout worktree create a b c` makes each slice's worktree and prints,
109
+ per slice, `WORKTREE: <path>` and the spawn that carries it. Its prompt starts
110
+ with that WORKTREE line, then `WORKER`, `TIER`, `TIMEBOX` and
111
+ "Run `workit fanout brief <slice> --name <plan>` and follow it exactly.";
112
+ Claude Code's `SPAWN:` line names `model` only when the TIER differs from the
113
+ `implementer` agent file. `--name` takes the plan's name or its file (`--plan`
114
+ is the same flag): a file is registered in that call, and a name no plan has
115
+ registers the one file in `workit dir plans` that starts with it. The plan
116
+ check refuses a slice branch the workspace branch policy refuses and names the
117
+ allowed one.
118
+
119
+ One unplanned slice: `workit fanout worktree create fix-login [--branch
120
+ fix/login] [--base <b>] [--tier <t>]` (no plan holds it) records a one-slice plan named after it
121
+ (the lead's prompt states the task) and prints the same lines; two or more
122
+ slices need a plan file. Claude Code's spawn gate passes a
123
+ `workit:implementer` prompt that names a Workit-made worktree as a WORKTREE
124
+ line, as its path, or as a brief file holding a WORKTREE line; otherwise its
125
+ deny is two lines ending in that ad-hoc command as `Retry as:`.
126
+
106
127
  ## Identity and git rules per host
107
128
 
108
129
  `workit fanout brief` renders the identity line, the model lines and RULES 1