codex-supervisor-mcp 0.13.4 → 0.13.6

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 (103) hide show
  1. package/README.en.md +101 -297
  2. package/README.md +99 -310
  3. package/package.json +24 -63
  4. package/src/{acceptance.js → app/acceptance.js} +54 -68
  5. package/src/app/cancel.js +60 -0
  6. package/src/{cleanup-plan.js → app/cleanup-plan.js} +13 -14
  7. package/src/app/compose.js +7 -0
  8. package/src/{context-compiler.js → app/context-compiler.js} +7 -13
  9. package/src/app/dispatch.js +396 -0
  10. package/src/app/followup.js +98 -0
  11. package/src/app/land-chain.js +124 -0
  12. package/src/app/landing.js +357 -0
  13. package/src/app/ownership.js +57 -0
  14. package/src/app/rebase.js +216 -0
  15. package/src/app/resume.js +164 -0
  16. package/src/app/run-state.js +26 -0
  17. package/src/app/settled.js +28 -0
  18. package/src/{side-chat.js → app/side-chat.js} +79 -266
  19. package/src/app/sse.js +20 -0
  20. package/src/app/start-run.js +77 -0
  21. package/src/app/verify-push.js +119 -0
  22. package/src/app/worktree-setup.js +176 -0
  23. package/src/{acceptance-baseline.js → domain/acceptance-baseline.js} +2 -1
  24. package/src/domain/acceptance-spec.js +30 -0
  25. package/src/domain/command-outcome.js +6 -0
  26. package/src/{overview-delta.js → domain/overview-delta.js} +5 -1
  27. package/src/domain/side-turn-view.js +73 -0
  28. package/src/{worker-preflight.js → domain/worker-preflight.js} +1 -1
  29. package/src/infra/git.js +30 -0
  30. package/src/infra/process.js +59 -0
  31. package/src/{sandbox-roots.js → infra/sandbox-roots.js} +2 -1
  32. package/src/{skill-sync.js → infra/skill-sync.js} +1 -1
  33. package/src/infra/store/db.js +265 -0
  34. package/src/infra/store/events.js +146 -0
  35. package/src/infra/store/facts.js +338 -0
  36. package/src/infra/store/reconcile.js +172 -0
  37. package/src/infra/store/records.js +160 -0
  38. package/src/infra/store/runner-readers.js +16 -0
  39. package/src/infra/store/schema.js +306 -0
  40. package/src/infra/store/sessions.js +138 -0
  41. package/src/infra/store/tasks.js +307 -0
  42. package/src/{auto-update-worker.js → infra/update/auto-update-worker.js} +4 -4
  43. package/src/{auto-update.js → infra/update/auto-update.js} +3 -4
  44. package/src/{update-check.js → infra/update/update-check.js} +4 -4
  45. package/src/{workspace-kind.js → infra/workspace-kind.js} +5 -7
  46. package/src/{worktree.js → infra/worktree.js} +57 -42
  47. package/src/{acceptance-cli.js → interface/bin/acceptance-cli.js} +7 -3
  48. package/src/{cleanup.js → interface/bin/cleanup.js} +3 -2
  49. package/src/{monitor.jsx → interface/bin/monitor.jsx} +4 -1
  50. package/src/{setup.js → interface/bin/setup.js} +9 -8
  51. package/src/{stage.js → interface/bin/stage.js} +1 -1
  52. package/src/{web-server.js → interface/bin/web-server.js} +2 -2
  53. package/src/interface/mcp/meta.js +7 -0
  54. package/src/interface/mcp/result.js +34 -0
  55. package/src/interface/mcp/schemas.js +24 -0
  56. package/src/interface/mcp/server.js +94 -0
  57. package/src/interface/mcp/tools/delivery.js +197 -0
  58. package/src/interface/mcp/tools/dispatch.js +267 -0
  59. package/src/interface/mcp/tools/facts.js +239 -0
  60. package/src/interface/mcp/tools/overview.js +202 -0
  61. package/src/interface/mcp/tools/poll.js +62 -0
  62. package/src/interface/mcp/tools/results.js +270 -0
  63. package/src/interface/mcp/tools/review.js +135 -0
  64. package/src/interface/mcp/tools/wait.js +145 -0
  65. package/src/interface/mcp/update-state.js +34 -0
  66. package/src/interface/mcp/views/overview.js +183 -0
  67. package/src/interface/mcp/views/task.js +223 -0
  68. package/src/interface/web/app.js +226 -0
  69. package/src/interface/web/views.js +224 -0
  70. package/src/mcp-server.js +3 -2223
  71. package/src/run-host/entry.js +23 -0
  72. package/src/run-host/finalize.js +236 -0
  73. package/src/run-host/launch.js +63 -0
  74. package/src/run-host/live-run.js +73 -0
  75. package/src/run-host/outcome-facts.js +61 -0
  76. package/src/run-host/streams.js +76 -0
  77. package/src/run-host/track.js +128 -0
  78. package/src/{runner-adapter.js → runners/codex/adapter.js} +6 -6
  79. package/src/runners/codex/chat-chunks.js +97 -0
  80. package/src/{event-parser.js → runners/codex/event-parser.js} +57 -55
  81. package/src/{goal-store.js → runners/codex/goal-store.js} +2 -2
  82. package/src/{mcp-config.js → runners/codex/mcp-config.js} +1 -1
  83. package/src/codex-runner.js +0 -1586
  84. package/src/landing.js +0 -507
  85. package/src/task-store.js +0 -1800
  86. package/src/web-app.js +0 -425
  87. /package/src/{failure-class.js → domain/failure-class.js} +0 -0
  88. /package/src/{owned-changes.js → domain/owned-changes.js} +0 -0
  89. /package/src/{prompt.js → domain/prompt.js} +0 -0
  90. /package/src/{status.js → domain/status.js} +0 -0
  91. /package/src/{thread-health.js → domain/thread-health.js} +0 -0
  92. /package/src/{truncate.js → domain/truncate.js} +0 -0
  93. /package/src/{worker-changes.js → domain/worker-changes.js} +0 -0
  94. /package/src/{worker-env.js → domain/worker-env.js} +0 -0
  95. /package/src/{worker-report.js → domain/worker-report.js} +0 -0
  96. /package/src/{worker-report.schema.json → domain/worker-report.schema.json} +0 -0
  97. /package/src/{bin-resolver.js → infra/bin-resolver.js} +0 -0
  98. /package/src/{cleanup-hint.js → infra/cleanup-hint.js} +0 -0
  99. /package/src/{external-output.js → infra/external-output.js} +0 -0
  100. /package/src/{handoff.js → infra/handoff.js} +0 -0
  101. /package/src/{paths.js → infra/paths.js} +0 -0
  102. /package/src/{stage-store.js → infra/stage-store.js} +0 -0
  103. /package/src/{tool-guard.js → runners/codex/tool-guard.js} +0 -0
package/README.en.md CHANGED
@@ -8,335 +8,159 @@ English | [中文](README.md)
8
8
  [![CI](https://github.com/zriyox/codex-supervisor-mcp/actions/workflows/ci.yml/badge.svg)](https://github.com/zriyox/codex-supervisor-mcp/actions/workflows/ci.yml)
9
9
  [![node](https://img.shields.io/badge/node-%3E%3D22.13.0-339933.svg)](package.json)
10
10
 
11
- Website [codex-supervisor.zriyo.com](https://codex-supervisor.zriyo.com) · for models [llms.txt](https://codex-supervisor.zriyo.com/llms.txt)
11
+ Website [codex-supervisor.zriyo.com](https://codex-supervisor.zriyo.com) · for models [llms.txt](https://codex-supervisor.zriyo.com/llms.txt) · [reference](docs/reference.en.md)
12
12
 
13
13
  Point several agents at one repository and they overwrite each other, nobody can say who changed what, and the main thread's context fills up with worker output.
14
14
 
15
- **codex-supervisor-mcp** is a Codex MCP server that takes dispatch and bookkeeping out of the model's context and puts them on disk: one main thread (Claude Code, Codex, or any MCP client) runs several Codex CLI workers at once, one Git worktree per worker, state in SQLite, a web board on top.
15
+ codex-supervisor-mcp is an MCP server. A main thread (Claude Code, Codex, or any MCP client) uses it to run several Codex CLI workers at once: one Git worktree per worker, state in SQLite, and a web board to watch them. Dispatch and bookkeeping live on disk, not in the model's context.
16
16
 
17
17
  ![Demo: one Claude Code main thread dispatches three Codex workers into separate worktrees, waits, and merges the result](https://raw.githubusercontent.com/zriyox/codex-supervisor-mcp/main/assets/demo.gif)
18
18
 
19
- *30 seconds, recorded live: `create_codex_worker` ×3, three workers in their own worktrees in parallel, the main thread collects three diffs and makes one commit.*
19
+ *30 seconds, recorded live: three workers in their own worktrees in parallel, then the main thread collects three diffs and makes one commit.*
20
20
 
21
21
  ## What it solves
22
22
 
23
23
  | Problem | What it does |
24
24
  |---|---|
25
- | Workers trample each other's files | One Git worktree per worker, `ownedPaths` checked for overlap before dispatch |
26
- | A worker is not only an editor | Four `workspaceKind` shapes: Git edit `git_worktree`, read-only `read_only_in_place`, networked research `scratch`, and explicitly authorized non-Git writes `in_place_write`. A non-Git source directory is never writable by default. |
27
- | A worker says it is done and it is not | Dispatch with `acceptance` commands; the supervisor runs them in the worktree after the worker exits, and `land` refuses while they fail |
28
- | Worker output floods the main thread | Events go to `data/runs/<taskId>.jsonl`; reads are gated by `limit` / `maxChars` / `kinds` |
29
- | One status read fills the context | `get_orchestration_overview` fits every worker into 7000 bytes |
30
- | Nobody knows who is still running after a restart | `supervisor.sqlite`, one row per work, with `thread_id` |
31
- | A new session cannot pick up an old worker | `resume_codex_worker` runs `codex exec resume <thread_id>`: the same Codex conversation |
32
- | "Failed" and "process gone" look alike | The state machine keeps `failed` and `lost` apart |
33
- | No view of where a batch is | `codex-supervisor-web`, a board that shows every worker by session |
34
- | Work sits uncommitted or unpushed | Collecting a worker means `land_codex_worker` by default; the main thread commits and pushes its own edits; before deploying, check the remote SHA really contains the files |
35
- | Worktrees and branches pile up | `verify_delivery_push` creates a cleanup plan. Only acceptance-passed, remotely verified, clean worktrees can be SAFE; review an item before explicitly applying it, while branches and evidence stay retained |
36
-
37
- Workers run `codex exec` with `model` passed through: the main thread stays on Claude, workers can run DeepSeek or any model Codex has a provider for, and the bills stay separate.
25
+ | Workers step on each other's files | One worktree per worker; `ownedPaths` is checked for conflicts before dispatch |
26
+ | Worker output floods the main thread | Events go to JSONL; the main thread reads a compressed overview (every worker in under 7000 bytes) |
27
+ | A restart or a new session loses the workers | One SQLite row per work, with its `thread_id`; `resume_codex_worker` rejoins the same Codex session |
28
+ | A failed run looks the same as a dead process | The state machine keeps `failed` and `lost` apart, and a failure carries its source and code |
29
+ | A worker says it is done and is not | Dispatch with `acceptance` commands; the supervisor runs them itself after the worker exits and refuses to land on failure |
30
+ | Changes sit on a local branch | `land_codex_worker` merges into the integration branch; `verify_delivery_push` proves the commit is on the remote |
31
+ | Worktrees pile up | Only verified, pushed and clean ones are marked SAFE, and nothing is removed until you say so. Branches and evidence stay |
38
32
 
39
- ## Five minutes to a running batch
33
+ A worker is a `codex exec` process and `model` is passed straight through. Keep the main thread on Claude, put the workers on DeepSeek or another provider, and the bills stay separate.
40
34
 
41
- Prerequisites: Node.js 22.13.0 or newer, `codex` on `PATH`. macOS, Linux and Windows.
35
+ ## Five minutes to a running batch
42
36
 
43
- ### 1. Install
37
+ You need Node.js 22.13.0 or newer and the `codex` CLI on `PATH`. macOS, Linux and Windows all work.
44
38
 
45
39
  ```bash
46
40
  npm install -g codex-supervisor-mcp
47
41
  ```
48
42
 
49
- A global npm install runs `postinstall` when lifecycle scripts are enabled, installing the skill and registering MCP with detected Claude Code/Codex clients. `--ignore-scripts`, disabled lifecycle scripts, and running through npx do not guarantee registration; run `codex-supervisor-setup` and inspect both clients with `mcp get`. Manual registration also works:
43
+ The install script puts the skill into every Claude Code and Codex it finds and registers the MCP server. Restart them afterwards. If nothing got registered (`--ignore-scripts`, for instance), run `codex-supervisor-setup`, or add it by hand:
50
44
 
51
45
  ```bash
52
46
  claude mcp add -s user codex-supervisor -- npx -y codex-supervisor-mcp
53
47
  codex mcp add codex-supervisor -- npx -y codex-supervisor-mcp
54
48
  ```
55
49
 
56
- Restart Claude Code / Codex. Updates take care of themselves from here; see "Updating". For the skill alone: `npx skills add zriyox/codex-supervisor-mcp`.
50
+ GUI clients such as Claude Desktop, Cursor and Windsurf need their MCP config edited by hand; the snippet is in the [reference](docs/reference.en.md#environment-variables). For the skill without the server: `npx skills add zriyox/codex-supervisor-mcp`.
57
51
 
58
- ### 2. Dispatch a batch
52
+ Then say it in plain words in Claude Code:
59
53
 
60
- Say it in plain words in Claude Code; the skill makes it follow the right steps:
54
+ > Fill in the unit tests for these three modules. Use codex-supervisor, three workers in parallel, call the session "unit tests".
61
55
 
62
- > Fill in the unit tests for these three modules, three codex-supervisor workers in parallel, session "unit tests".
63
-
64
- What the main thread does underneath (you can call the tools yourself):
56
+ The skill walks the main thread through this:
65
57
 
66
58
  ```
67
- preflight_codex_worker run required probes with the target workspace/base/sandbox/guard
68
- get_worker_preflight require passed; rerun when the contract changes
69
- create_codex_worker ×3 each with preflight_id, session_id, ownedPaths, goal
70
- wait_codex_workers 60 seconds by default, then a snapshot, call again until done
71
- get_worker_result ×3 each worker's report, with the commands it really ran
72
- get_worker_diff ×3 inspect the real change before deciding to land
59
+ preflight_codex_worker run a probe in the same environment first
60
+ create_codex_worker ×3 each with session_id, ownedPaths, goal
61
+ wait_codex_workers 60 seconds at most per call; call again until done
62
+ get_worker_result ×3 each worker's report, with the commands it ran and their exit codes
63
+ get_worker_diff ×3 what it actually changed
64
+ land_codex_worker ×3 reviewed; commit on its behalf and land
73
65
  ```
74
66
 
75
- Each worker's changes sit on its own `codex/<taskId>` branch. After acceptance and diff review, the main thread lands them with `land_codex_worker` and `commitMessage`; the worker does not commit.
67
+ Workers never commit. Their changes stay on `codex/<taskId>` until the main thread has read the diff.
76
68
 
77
- ### 3. Open the board
69
+ To watch them work, open the board:
78
70
 
79
71
  ```bash
80
- codex-supervisor-web
81
- # without a global install:
82
- npx -p codex-supervisor-mcp codex-supervisor-web
72
+ codex-supervisor-web # or: npx -p codex-supervisor-mcp codex-supervisor-web
83
73
  ```
84
74
 
85
- Open `http://127.0.0.1:7877`. The state directory is `SUPERVISOR_HOME`, else the nearest `.mcp.json`, else `~/.codex-supervisor`; `SUPERVISOR_WEB_PORT` changes the port. The board only shows; it never dispatches or cancels.
75
+ Open `http://127.0.0.1:7877`. It shows each session's workers: status, the command running right now, changes and events. You can also ask a worker a question on the side; the answer comes from a read-only fork of its thread, so the work in progress is not interrupted. The board is read-only. It does not dispatch or cancel.
86
76
 
87
77
  ## How I use it
88
78
 
89
- Anything that speaks MCP can be the main thread; this is just my way. I run two Claude Code sessions, one for documents and one for dispatch: a session that writes the design and watches the workers fills its context in two hours.
79
+ Anything that speaks MCP can be the main thread; this is just my way. I run two Claude Code sessions, one for documents and one for dispatch. A single session that writes the design and also watches the workers fills its context in two hours.
90
80
 
91
81
  | Who | Where | Does what |
92
82
  |---|---|---|
93
83
  | Me | | Decide what to build, make the calls, read the reports |
94
- | Planning session | The requirements and docs repository | Talk through the requirement, write the design, write one brief per block of work with a paragraph for the main brain at the end |
95
- | Main-brain session | A worktree of the code repository | Read the brief, dispatch Codex workers, check every worker's diff, write results back into the brief, report to me. Writes no business code |
96
- | Codex workers | Their own worktrees | One worker per independently verifiable feature package. It edits and runs acceptance. It does not commit, push or merge |
84
+ | Planning session | The requirements and docs repository | Talk through the requirement, write the design, write one brief per block of work |
85
+ | Main-brain session | A worktree of the code repository | Read the brief, dispatch workers, check diffs, report to me. Writes no business code |
86
+ | Codex workers | Their own worktrees | One worker per independently verifiable feature package. No commit, no push |
97
87
 
98
- One block of text passes between the two sessions, pasted into the main-brain session and handed over with `/goal`. Its shape is fixed:
88
+ One block of text passes between the two sessions, pasted into the main-brain session and handed over with `/goal`:
99
89
 
100
90
  ```text
101
- [Role] You are the main brain: read docs and code, dispatch workers, check results, update docs, report to me. You write no business code.
102
- Dispatch and track with the codex-supervisor skill; load it before starting.
91
+ [Role] You are the main brain: dispatch workers, check results, update docs, report to me.
92
+ You write no business code. Load the codex-supervisor skill first.
103
93
  [Background] Why this block exists, what the previous one left behind
104
- [Read first] Which sections of which documents. Which one wins when they disagree
105
- [Repos] Where the worktrees are, which commit each branch is on, which branches are read-only
106
- [Do] Follow the table in section N of the brief. Split by independently verifiable feature packages. Nothing outside the table. Workers do not commit
107
- [Dispatch] search_works first, do not dispatch twice
108
- One session_id for the whole batch
109
- Serial when writes overlap, parallel only with disjoint write sets
110
- ownedPaths covers implementation, tests, routing, DI, configuration and migrations
111
- Prepare dependencies with workspaceSetup; every writer passes preflight with the same contract
112
- Write the task in full: background, where in the docs, complete write set, verify command, output format
113
- Put the verify command in acceptance too; the worker self-checks through CODEX_SUPERVISOR_ACCEPTANCE_CLI
114
- Read the diff when a worker returns. Its word is not enough; what you see is
115
- [Build/test] Everything on the remote machine, nothing locally
94
+ [Read first] Which sections of which documents, and which one wins when they disagree
95
+ [Do] Follow the table in section N of the brief. Nothing outside the table
96
+ [Dispatch] search_works first so nothing is dispatched twice; one session_id for the batch;
97
+ parallel only when write sets are disjoint; the verify command goes in acceptance too;
98
+ a worker's word is not enough, the diff you read is
116
99
  [Red lines] What not to change, push or read
117
- [Stop and ask me when]
118
- [Report] Tables first, these items, then stop and wait for me
119
- ```
120
-
121
- What the main brain calls in one round:
122
-
123
- ```
124
- search_works has this batch been dispatched before
125
- create_codex_worker one worker per feature package, same session_id, ownedPaths disjoint
126
- wait_codex_workers 60 seconds a round, compact: true, call again until done
127
- get_worker_result what it says it did; verification is what it really ran
128
- get_worker_diff what it actually did
129
- ask_codex_worker when the two differ, ask why; read-only, its thread untouched
130
- resume_codex_worker continue the same thread when it must change something; rebaseOnto when main has moved
131
- land_codex_worker reviewed; commit with commitMessage and land on the integration branch
100
+ [Report] Tables first, then stop and wait for me
132
101
  ```
133
102
 
134
- A feature package can still be resumed before landing. Split it when writes conflict, dependencies need sequencing, or the work has separate acceptance, not because every step needs a new model thread.
135
-
136
- ## What the board shows
137
-
138
- | Where | What |
139
- |---|---|
140
- | Left column | One row per session: title, worker count, how many running, last activity. Version and update notice at the bottom |
141
- | Session page | Counts (total / running / done / failed / lost); while workers run, the command each one is on |
142
- | Worker table | One row per worker: status, title, current command or last report line, duration, files changed, commands run |
143
- | Worker drawer | Seven tabs: overview, report, changes, commands, events, task, side chat |
144
- | Side chat | Ask the worker a question, the way Codex's `/btw` works: its thread is forked into a read-only side session, the running work is untouched. Multi-turn, stoppable, and a page that leaves picks up where it was |
145
-
146
- Light and dark follow the system. No external resources.
147
-
148
103
  ## Tools
149
104
 
150
- Thirty-nine.
105
+ 39 of them. Arguments and edge cases are in the [reference](docs/reference.en.md#tools).
151
106
 
152
- | Tool | Arguments | What it does |
107
+ | Stage | Tool | What it does |
153
108
  |---|---|---|
154
- | `check_workers` | none | Report newly settled runs, actionable failures and active-thread handoff reminders once per run; never cancel or replace a live worker for its token count. Recover a new-format first `lost`, `no_work` or `invalid_report` run once; unchanged state is quiet and a host-scheduled loop with a distinct observer ID supports reconnecting |
155
- | `overview_delta` | `cursor` | Main-thread incremental view: counters, changed summaries, short attention reason / next action and next_cursor; no prompt, diff, event or capsule history |
156
- | `check_acceptance` | `cwd`, `acceptance`, `baseRef`, `timeoutMs` | Execute supplied checks before dispatch, without creating a worker or proving completion; warns that failure-count greps do not establish an approved failure list or required execution |
157
- | `preflight_codex_worker` | `cwd`, `workspaceKind`, `inPlaceAuthorization`, `workspaceSetup`, `ownedPaths`, `probeCommands`, `baseRef`, `sandbox`, `allowedCommands`, `context`, `contracts`, `networkAccess`, `writableRoots` | Run a short probe worker under the exact workspace/base/sandbox/guard contract intended for the later worker; wait for `get_worker_preflight` to report passed before dispatch |
158
- | `get_worker_preflight` | `task_id` | Read probe command evidence and the immutable runtime contract hash |
159
- | `create_codex_worker` | `task`, `cwd`, `workspaceKind`, `inPlaceAuthorization`, `workspaceSetup`, **`ownedPaths`**, **`goal`**, `preflight_id`, `forbid`, `allowedCommands`, `context`, `contracts`, `externalOutputs`, `networkAccess`, `writableRoots`, `maxRunMs`, `maxTotalMs`, `acceptance`, `acceptanceTimeoutMs`, `session_id`, `session_title`, `session_note`, `dependsOn`, `baseRef`, `sandbox`, `model`, `reasoningEffort`, `title`, `skipGitRepoCheck` | Git defaults to an isolated worktree. A non-Git write must choose `scratch`, or an authorized `in_place_write` with paths and acceptance. `workspaceSetup` prepares dependencies before the worker starts; when `preflight_id` is present its complete runtime contract must match. |
160
- | `create_codex_followup_worker` | `task_id`, `followup_prompt`, `session_id`, `session_title`, `title`, `cwd`, `sandbox`, `model`, `ownedPaths`, `forbid`, `allowedCommands`, `context`, `contracts`, `externalOutputs`, `networkAccess`, `writableRoots`, `workspaceKind`, `workspaceSetup`, `goal`, `baseRef`, `acceptance` | A fresh session inherits the parent's current branch commit before landing, or the current target HEAD after landing; explicit `baseRef` takes precedence. Parent drafts are not copied; `preflight_id`, `dependsOn` and `skipGitRepoCheck` are unsupported. |
161
- | `resume_codex_worker` | `task_id`, `prompt`, `rebaseOnto`, `acceptance`, `context` | Continue the same Codex conversation; `thread_id` stays. When the native goal is still active or its state database cannot prove completion, the resume omits the output schema for that turn to avoid `ActiveTurnOutputSchemaMismatch`. `rebaseOnto` first moves the worktree onto the project's newer commit (stash, skip integrated patches, replay new commits, unstash); a conflict puts it back and does not start the worker |
162
- | `wait_codex_workers` | `task_ids`, `mode` (any/all), `timeoutMinutes`, `timeoutMs`, `allowLongWait`, `pollMs`, `compact`, `emitProgress`, `includeEvents`, `eventLimit`, `eventMaxChars`, `eventKinds` | Wait for terminal states with a call budget capped at 60 seconds unless the caller explicitly sets `allowLongWait: true` after verifying its client timeout. Returns requested/effective budgets, `timeout_capped` and a termination reason; `compact` gives one row per worker and `emitProgress` optionally sends progress notifications |
163
- | `get_orchestration_overview` | `status`, `limit` | Every worker in one table, capped at 7000 bytes. Carries `version` and `update` |
164
- | `get_worker_result` | `task_id`, `limit`, `maxChars`, `includeFiles` | The worker's own report, clipped past 6000 bytes with `truncated` and the size to ask for. `acceptance` is whether the supervisor's own checks passed, `verification` the commands the worker ran with exit codes, `base_behind` how far main has moved (`behind` is `null` with a note when `contains_base` is false, meaning the directory switched lines) |
165
- | `get_worker_diff` | `task_id`, `file`, `hunk`, `pageSize`, `cursor`, `maxChars`, `paths` | What the worker actually changed. The default response is a complete file/hunk index. Select one file and page hunks with `hunk` or `cursor`; `maxChars` without `file` keeps the legacy bounded full-diff mode |
166
- | `ask_codex_worker` | `task_id`, `question`, `timeoutMs`, `maxChars`, `fresh`, `end` | Ask the worker on the side. Its thread is forked into a read-only session with no network and no MCP tools; the worker itself is untouched. A resumed worker gets a new fork by itself, `fresh` forces one, `end` deletes it |
167
- | `land_codex_worker` | `task_id`, `onto`, `commitMessage`, `includeFollowupParents`, `commitMessages`, `ignoreAcceptance`, `allowOutsideOwned` | Cherry-pick the worker's `codex/<id>` commits onto the current branch of the dispatch directory: clean target only, a conflict rolls back, a failed acceptance is refused. A malformed report summary no longer blocks an explicit landing when acceptance and the reviewed diff are sound. `commitMessage` first commits the current worker's uncommitted edits as one commit. `includeFollowupParents` lands the follow-up chain root first and `commitMessages` supplies a distinct checkpoint message for any task in that chain; `ignoreAcceptance` lands anyway |
168
- | `verify_delivery_push` | `task_id`, `remote`, `branch` | Fetch a remote branch and prove landed_head is reachable; records push_verified and creates a cleanup plan without pushing or deploying |
169
- | `cleanup_plan` | `task_ids`, `project_root` | Create a 15-minute SAFE / REVIEW / BLOCKED plan with reasons and fingerprints; SAFE requires explicit acceptance, delivery proof, clean state and no active process/dependency |
170
- | `apply_cleanup` | `plan_id`, `item_ids` | Revalidate selected SAFE items, fetch the remote and prove landed SHA reachability, then run only git worktree remove/prune |
171
- | `cleanup_history` | `task_id`, `limit` | Read cleanup decisions and applied removals; never deletes anything |
172
- | `get_worker_summary` | `task_id` | One paragraph: goal, status, changes, last command and message |
173
- | `get_codex_worker_status` | `task_id`, `includePrompt`, `promptMaxChars` | One worker in detail |
174
- | `get_codex_worker_events` | `task_id`, `limit`, `maxChars`, `kinds` | The raw event stream |
175
- | `get_context_snapshot_meta` | `task_id` | Worker-only context snapshot metadata: fact IDs, token count and excluded categories, never capsule text |
176
- | `get_fact` | `fact_id` | Read one historical fact version and its `effective_state`; revocation and automatic expiry retain the original version |
177
- | `search_worker_facts` | `task_id`, `query`, `limit`, `cursor` | Search only verified facts scoped to the current work, explicit dependencies and path-matched repository facts; returns coverage and next_cursor, never raw history |
178
- | `get_worker_evidence` | `task_id`, `limit` | Bounded event metadata and retained artifact IDs for one worker; select an artifact or event explicitly for detail |
179
- | `get_artifact` | `artifact_id`, `maxChars` | Read one supervisor-managed evidence artifact without expanding a worker capsule into main context |
180
- | `promote_worker_fact` | `fact_id`, `scope`, `watchedPaths`, `expiresAt` | Explicitly promote a candidate to a new verified fact after main-thread review; repo scope requires watched paths |
181
- | `revoke_worker_fact` | `fact_id`, `reason` | Append a revocation version and audit event without overwriting the original; the fact is excluded from search and future capsules |
182
- | `create_independent_verifier` | `task_id`, `title` | Create a fresh read-only, no-network verifier for a settled worker; it receives the objective and current worktree, never the target report or candidate facts |
183
- | `record_independent_finding` | `verifier_task_id`, `verdict`, `reason` | Persist an independent passes/fails/inconclusive finding with a subject event and retained evidence artifact |
184
- | `resolve_independent_finding` | `verifier_task_id`, `resolution` | Record how a finding was resolved without deleting the finding or evidence |
185
- | `get_independent_review` | `verifier_task_id` | Read the persistent subject/verifier/finding/resolution relation |
186
- | `get_worker_goal` | `task_id` | The goal recorded at dispatch plus the native Codex goal (tokens, time) |
187
- | `list_codex_workers` | `status`, `includeHistory`, `includeDetails` | List workers, active ones by default |
188
- | `get_session_works` | `session_id` | Every worker of one session. The way back after a main-thread restart |
189
- | `describe_session` | `session_id`, `title`, `note`, `objective`, `default_acceptance`, `approval_state`, `expected_revision` | Record a title and note for a session |
190
- | `search_works` | `query`, `limit` | Substring search over title / goal / prompt / last_message, newest first |
191
- | `check_for_update` | `force` | Ask the registry for a newer version |
192
- | `cancel_codex_worker` | `task_id` | Stop a worker. Falls back to the pid across processes, after confirming that pid runs codex |
193
-
194
- Two fields are required by the MCP schema: `ownedPaths` and `goal.objective`. A writer must also pass the workflow preflight gate described above; the schema keeps `preflight_id` optional for old clients, which is a compatibility escape hatch, not the normal path. `ownedPaths` overlap is reserved at dispatch, the runtime guard checks direct file writes, and landing checks the complete diff.
195
-
196
- `acceptance` runs in Bash with `errexit` and `pipefail`: an unhandled failure stops the check, including a failing test in `npm test | tail`. Workers run `node "$CODEX_SUPERVISOR_ACCEPTANCE_CLI"` for the exact supervisor contract instead of retyping checks in an interactive zsh. The self-check opens the supervisor database read-only, so it needs no write access to the state directory. Handle expected failures explicitly with `if` or `||`; a timeout always fails, even when the command exits 0 after termination. Windows requires Git for Windows Bash and reports an error when it is missing. Displayed output is clipped without changing the exit code.
197
-
198
- In a repository with `package.json`, acceptance that uses local JavaScript tooling such as `npm`, `pnpm`, `vitest`, `vue-tsc`, `eslint` or `nuxi` is rejected with `workspace_setup_required` unless `workspaceSetup` was provided. Dependency preparation is now a runtime gate, not a reminder for the model.
199
-
200
- The standard frontend worktree setup is:
201
-
202
- ```json
203
- {
204
- "workspaceSetup": {
205
- "links": [{ "path": "node_modules", "source": "node_modules" }],
206
- "submodules": true,
207
- "commands": ["npx nuxi prepare"]
208
- }
209
- }
210
- ```
211
-
212
- Pass the same setup to `preflight_codex_worker` and the target `create_codex_worker`; otherwise the runtime contracts do not match.
213
-
214
- `workspaceSetup.links.source` resolves against the dispatch `cwd` and may also be absolute; `path` is always a relative destination inside the worktree. The source must already exist.
215
-
216
- `create_codex_followup_worker` starts from the current parent `codex/<parent>` checkpoint while the parent is unlanded, or the current target HEAD after it has landed; an explicit `baseRef` takes precedence. Uncommitted parent edits stay with that task, and a missing checkpoint returns `followup_checkpoint_missing`. Review each task's acceptance and diff before calling `land_codex_worker({includeFollowupParents: true})` to cherry-pick the chain root first; a failure preserves earlier landings, and the operation can be repeated after fixing the failing task.
217
-
218
- When both the worker and run host have exited, the current run's durable `turn.completed` can recover completed status and exit settlement independently of the acceptance verdict. Missing acceptance is marked interrupted and must be rerun before landing; recovery neither removes worktrees nor reruns the worker automatically.
219
-
220
- Plain-text reports from schema-free resumes remain candidate facts even after acceptance passes; synthesized empty arrays are not promoted as verified claims.
221
-
222
- Chain landing skips commits proven present on the target and ancestors with no changes; `ignoreAcceptance` and `allowOutsideOwned` apply only to the named leaf, not to its ancestors.
223
-
224
- When dispatch omits `goal.tokenBudget`, the worker must omit `token_budget` entirely. The runtime guard rejects `0`, `1`, `null` and any invented value. If a budget is supplied explicitly, the worker must use that exact positive integer.
225
-
226
- Acceptance commands receive `CODEX_SUPERVISOR_TASK_ID`, `CODEX_SUPERVISOR_BASE_COMMIT` and `CODEX_SUPERVISOR_RUN`: the current task, run base and run number, refreshed after rebase/resume.
227
-
228
- Structured acceptance entries use `{command, reportPath, baseline}`. The baseline contains `identity.base_commit`, `failures` (test_id/kind/signature), and `required`; the report contains complete, identity, failures, executed, skipped, and the current `CODEX_SUPERVISOR_CHECK_ID`. Missing/skipped required tests, reused evidence, and changed failures reject acceptance while preserving the shell exit code. reportPath must remain inside the working directory; write reports to an ignored temporary directory so they are not landed.
229
-
230
- Landing checks the real diff against ownedPaths before committing drafts; only use allowOutsideOwned for an explicitly approved exception.
231
-
232
- Worker acceptance runs before the dispatcher commits draft edits, so it should validate functionality and tests. Check clean Git status, commit counts and messages after landing. Inspect the failing check and its run before claiming a verdict is stale; a newer report, external test run or manual commit does not replace supervisor acceptance. Route conflicting requirements to the integration owner for revision and fresh acceptance instead of bypassing the gate with a manual cherry-pick.
233
-
234
- Session default_acceptance is prepended to local checks; resume uses the latest policy. describe_session returns policy_revision and expected_revision prevents stale edits. waiting_user blocks dispatch/resume until approved. host_goal_sync returns a current-policy /goal command. Replace an active native goal through /goal, or propose the same condition through ProposeGoal for host approval when available. The condition reads the latest session revision and approved scope; MCP does not silently modify or disable the host Stop hook.
235
-
236
- Wait defaults to 60 seconds and compact rows; longer requests are capped unless `allowLongWait: true` explicitly opts in. `requested_timeout_ms`, `timeout_ms` and `timeout_capped` expose the applied budget. Progress requires both `emitProgress` and a client progress token; it does not extend a host's hard timeout. Reattach an existing background wait instead of creating duplicates, and schedule `check_workers` for long monitoring.
237
-
238
- Each run injects the shipped PreToolUse guard: apply_patch checks every target including renames and symlinks; forbid rejects red lines. Shell allows simple reads and explicitly declared allowedCommands/acceptance. Declared validation scripts run with dispatcher privileges and may have side effects; this is not a filesystem sandbox for arbitrary programs. Resume/follow-up inherit the policy without changing global hooks. Empty write runs use current output and command evidence and surface no_work; read-only tasks are not empty merely for having no diff.
239
-
240
- Workers are not dispatchers. A worker starts with the codex-supervisor MCP server disabled, so it cannot dispatch, resume, cancel or edit another session. Business MCP servers remain available. Side-chat forks disable every MCP server.
241
-
242
- A model with no separate `apply_patch` tool (measured with Codex 0.162 + DeepSeek/cc-switch) sends the patch as a shell call: `apply_patch <<'EOF' ... EOF`. The guard accepts that shape and judges every target path with the same ownedPaths rule, so such a model can still edit; an unquoted heredoc, or one followed by `&&`/`;`, is refused.
243
-
244
- An `allowedCommands` entry ending in `*` is a prefix match (so `go test ./internal/*` covers `go test ./internal/service -run TestX`), valid only for a single command without shell metacharacters. An editor worker may also read with grep/sed (without `-i`)/find (without `-exec`/`-delete`)/jq (without `-i`)/awk, the git read subcommands and pure read pipes such as `cmd | head|tail|wc|sort|uniq`; `tee`, redirects and `env` stay refused. The guard is not a filesystem sandbox: a miss only writes inside the worker's own worktree, and land refuses it.
245
-
246
- The guard relaxes by workspace shape: a `git_worktree` editor with non-empty `ownedPaths` gets only declared commands and simple reads; `read_only_in_place` cannot write or use network; networked research uses `scratch` under `SUPERVISOR_HOME`, never the source directory; `in_place_write` requires explicit authorization, owned paths and acceptance with before/after manifests. A non-Git `workspace-write` request without `workspaceKind` is refused. A worker capsule names its branch and acceptance source without embedding acceptance commands. Repository facts cross checkouts only when canonical `origin`, repository-relative watched paths and base SHA all match; an unrecognized origin leaves them work-scoped. A fact is append-only expired and excluded from a future worker capsule when its base SHA no longer covers the task, a watched path changed, its declared context content hash changed, or its in-place manifest drifted; explicit dependencies provide only delivery summaries.
247
-
248
- After reconciliation, check_workers atomically resumes a dead first lost/no_work/invalid_report run once and returns recovery receipts (an invalid report only re-asks for the bare JSON; it does not redo the work). If the current run has a durable `turn.completed` and only its run host failed to record the exit code, the task is recovered as completed with report and attention evidence preserved instead of being marked lost. Two consecutive no-output/no-command runs with the same fingerprint become `two_stall` and `needs_attention`, never another blind retry; approval, authentication, permission and quota waits are not retried. Final reports use JSON result/verification/not_done. Parsing safely normalizes a single string field into string[] and one missing closing `]`/`}`; fabricated shapes still fail. The report is a summary: invalid_report preserves the completed lifecycle and attention, does not override the same run's acceptance or reviewed diff, and an explicit landing remains possible. Existing history is labelled legacy_text.
249
-
250
- context declares up to 20 absolute file paths with optional sha256, within a combined 6000-character budget with contracts; each file is at most 5 MB. Dispatch pins actual hashes and resume refuses drift unless new context is explicitly supplied. Handoffs are limited to 1800 characters/16 lines with a truncation marker; complete contracts and refs remain separate, and inputs grant no write permission.
251
-
252
- Declare externalOutputs:[{path,sha256?}] and acceptance for shared writes. Targets are absolute file paths, at most 1 MB each. Current-run before/after hashes and bounded content appear in result/diff as shared_file_already_written_not_cherry_pick; land cannot integrate external files. Targets participate in ownership conflict checks and hook policy; the dispatcher is responsible for validation script side effects.
253
-
254
- workspace-write defaults to networkAccess:false; explicitly enable it for ssh/network checks. Resume/follow-up inherit the setting. maxRunMs bounds one run and maxTotalMs bounds wall time since dispatch; exceeding either stops the worker and preserves actionable partial results without automatic retry. A wait budget does not change these quotas.
255
-
256
- Besides the worktree and the temp directory the sandbox writes the OS cache directory (macOS `~/Library/Caches`, Linux `~/.cache`, Windows `%LOCALAPPDATA%`), the toolchain cache directories that exist under the home directory (`.cargo`, `.npm`, `.yarn`, `.pnpm-store`, `.bun`, `.m2`, `.gradle`, `.nuget`, `.ivy2`, `.bundle`, `.composer`, `.pub-cache`, `.mix`, `.hex`, `.stack`, `.cpanm`, `.deno`, `.conda`, `go/pkg`) Credential directories (`.ssh`, `.gnupg`, `.config`, `.aws`, `.docker`, `.kube`, `.netrc`, `.git-credentials`, `~/Library/Keychains`) are never granted automatically: a dispatch that needs ssh, kubectl, a private registry or a signed commit names the directory in `writableRoots` for that run. `SUPERVISOR_NO_AUTO_CACHE_ROOTS=1` turns every automatic cache root off; an explicit `writableRoots` still applies. Toolchains that cache there, Go's build cache among them, need no per-language variable and no patch when a new language shows up. Codex refuses a writable root with a symlink component, and such a root fails every command in the worker, so both the cache directory and every declared `writableRoots` entry are resolved through realpath first and a root that cannot be resolved to a symlink-free path is dropped. A toolchain that caches elsewhere (`~/.m2`, `~/.gradle`, a vendored mirror) passes `writableRoots:[absolute paths]`: existing directories, at most 20, workspace-write only, inherited by resume/follow-up. Read-only reuse needs nothing.
257
-
258
- Dispatch checks required hooks/output-schema support (Codex 0.162+); unsupported capability returns settled start_failed. get_worker_goal.native_goal_read distinguishes missing_goal, missing_database, locked and read_error; a read failure is not evidence that no goal exists. Native budget/usage limits need attention. Cleanup preserves ignored artifacts, shared evidence and unresolved attention.
259
-
260
- Ownership reservation and task insertion are atomic across MCP dispatch/resume processes; ownership remains reserved during acceptance or exit settlement. Failure to create an isolated Git checkout is explicit and never falls back to executing in the project directory.
261
-
262
- Cleanup previews by default: `npm run cleanup -- --dry-run`. Apply only selected existing items: `npm run cleanup -- --apply --plan <plan_id> --item <item_id>`. SAFE requires acceptance passed, remote delivery proof, a clean worktree, no active process/dependent and verified Git registration/ownership; apply re-fetches the remote and proves the landed SHA remains reachable. Dirty, unaccepted, unlanded, force-pushed-away, lost/failed or unproven work is preserved with a reason.
109
+ | Before dispatch | `check_acceptance` | Runs the acceptance commands for real, to check the commands themselves |
110
+ | | `preflight_codex_worker` / `get_worker_preflight` | Starts a short probe in the target worker's environment, then reads its result |
111
+ | Dispatch | `create_codex_worker` | Dispatches one worker. `ownedPaths` and `goal` are required |
112
+ | | `create_codex_followup_worker` | A new session that builds on a parent task's work |
113
+ | | `resume_codex_worker` | Continues the same Codex session, optionally rebased onto the new head first |
114
+ | | `cancel_codex_worker` | Stops a worker |
115
+ | Tracking | `overview_delta` | The default polling call; returns only what changed since the last cursor |
116
+ | | `check_workers` | Reports newly finished and broken workers; a dead first run is recovered once |
117
+ | | `wait_codex_workers` | Waits for a result, 60 seconds at most per call |
118
+ | | `get_orchestration_overview` / `list_codex_workers` | The status table for every worker |
119
+ | | `get_codex_worker_status` / `get_codex_worker_events` | One worker's status detail and raw events |
120
+ | Collecting | `get_worker_result` / `get_worker_summary` | The worker's report, long and one-paragraph |
121
+ | | `get_worker_diff` | The actual changes, paged by file and hunk |
122
+ | | `get_worker_goal` | The dispatched goal and the native Codex goal's usage |
123
+ | | `ask_codex_worker` | Asks the worker a side question. Read-only; its thread is untouched |
124
+ | | `land_codex_worker` | Commits on the worker's behalf and cherry-picks onto the integration branch; refuses if acceptance failed |
125
+ | Delivery | `verify_delivery_push` | Proves the landed commit is on the remote. It verifies; it never pushes for you |
126
+ | | `cleanup_plan` / `apply_cleanup` / `cleanup_history` | Sorts worktrees into SAFE / REVIEW / BLOCKED and removes only the SAFE items you pick |
127
+ | Sessions | `get_session_works` / `search_works` | Finds a batch again, or searches history by substring |
128
+ | | `describe_session` | Records a batch's title, objective, default acceptance and approval state |
129
+ | Facts | `search_worker_facts` / `get_fact` | Looks up verified facts and their versions |
130
+ | | `promote_worker_fact` / `revoke_worker_fact` | The main thread promotes a candidate fact to verified, or revokes one |
131
+ | | `get_context_snapshot_meta` | What context a worker was given when it started |
132
+ | | `get_worker_evidence` / `get_artifact` | The evidence index and a single artifact |
133
+ | Review | `create_independent_verifier` | Starts a read-only, offline verifier to check the work again |
134
+ | | `record_independent_finding` / `resolve_independent_finding` / `get_independent_review` | Records the verdict, records how it was resolved, reads the whole trail |
135
+ | Other | `check_for_update` | Asks the registry for a newer version |
263
136
 
264
137
  ## How this differs from Claude Code subagents
265
138
 
266
- File isolation is not the difference: a subagent can open a worktree too. The difference is the model and the process.
139
+ A subagent can open its own worktree too, so file isolation is not the difference. The model and the process are.
267
140
 
268
141
  | | Claude Code subagent | codex-supervisor worker |
269
142
  |---|---|---|
270
- | Model | Claude only | `model` passed to the Codex CLI; DeepSeek works |
143
+ | Which models | Claude only | Anything the Codex CLI has a provider for |
271
144
  | Who does the work | Claude Code itself | A separate `codex exec` process |
272
- | Two writers on one file | Worktrees keep them apart, no path declaration | `ownedPaths` overlap is refused before dispatch |
273
- | Main-thread process dies | The main window cannot collect results | An independent run process records worker output and acceptance; a new window reads the same session_id |
145
+ | Two workers writing one file | No path declaration | `ownedPaths` overlap is checked before dispatch and rejected |
146
+ | The main thread dies | The work cannot be collected | Workers and acceptance run to the end; a new window collects them by `session_id` |
274
147
  | Who can drive it | Claude Code only | Any MCP client |
275
- | Seeing the process | Only the returned conclusion | Raw JSONL and the web board |
276
-
277
- ## The state machine
278
-
279
- | `status` | Meaning |
280
- |---|---|
281
- | `queued` | Dispatched, not started |
282
- | `running` | Running. `phase`: `starting → thinking → command → editing → reporting` |
283
- | `completed` | Done |
284
- | `failed` | Non-zero exit, `turn.failed`, spawn failure |
285
- | `cancelled` | Stopped by `cancel_codex_worker` |
286
- | `lost` | Worker killed by an outside signal, run process disappeared, or a row whose process never started. `resume_codex_worker` picks it up |
148
+ | Seeing the process | Only the conclusion it returns | Raw JSONL and the web board |
287
149
 
288
- A terminal state lands in two steps: `turn.completed` sets `completed`, the process exit writes `exit_code`; `wait_codex_workers` returns only after the exit code is in. Windows has no signals, so an outside kill reports as `failed` with an exit code. Native Codex goals: `paused` / `blocked` count as `running` and go to `needs_attention`, `usageLimited` / `budgetLimited` as `failed`.
150
+ ## Configuration and state
289
151
 
290
- ## Where state lives
152
+ Everything lives under `~/.codex-supervisor/`: `data/supervisor.sqlite` is the ledger, `data/runs/<taskId>.jsonl` is Codex's raw output, and `worktrees/<taskId>/` holds each worker's checkout.
291
153
 
292
- `~/.codex-supervisor/` by default:
293
-
294
- | File | Content |
295
- |---|---|
296
- | `data/supervisor.sqlite` | `tasks` (one row per work), `task_events`, `sessions`, `side_sessions` / `side_turns` (side chat) |
297
- | `data/runs/<taskId>.jsonl` | Raw `codex --json` output |
298
- | `data/update-check.json`, `auto-update.json` | Update check and background update records |
299
- | `worktrees/<taskId>/` | The worker's Git worktree |
300
-
301
- `changed_files` is the worktree's real diff, so shell edits and the worker's own commits are both visible. Non-ASCII file names come back as written. Databases from older versions migrate on first open.
302
-
303
- ## Environment variables
304
-
305
- | Variable | Default | Effect |
154
+ | Variable | Default | What it does |
306
155
  |---|---|---|
307
- | `SUPERVISOR_HOME` | `~/.codex-supervisor` | State root. The MCP and the board must point at the same one |
308
- | `CODEX_HOME` | `~/.codex` | Read-only: the native `goals_1.sqlite` and the MCP config |
309
- | `CODEX_BIN` | `codex` | Path to the Codex CLI. The Windows `.cmd` shim is bypassed |
310
- | `GIT_BIN` | `git` | Path to git |
311
- | `SUPERVISOR_WEB_PORT` / `SUPERVISOR_WEB_HOST` | `7877` / `127.0.0.1` | Board address |
312
- | `CODEX_SUPERVISOR_NO_UPDATE_CHECK` | unset | `1` disables the update check |
313
- | `CODEX_SUPERVISOR_REGISTRY` | `https://registry.npmjs.org` | Registry for the update check and the auto-update |
314
- | `CODEX_SUPERVISOR_UPDATE_TIMEOUT_MS` | `4000` | How long to wait for the registry |
315
- | `CODEX_SUPERVISOR_NO_AUTO_UPDATE` | unset | `1` turns the background auto-update off (notify only) |
316
- | `CODEX_SUPERVISOR_SKIP_SKILL_SYNC` | unset | `1` turns the skill sync at server start off |
317
- | `CODEX_SUPERVISOR_SKIP_SETUP` | unset | `1` skips the `postinstall` setup |
318
- | `CODEX_SUPERVISOR_NPM` | unset | npm for the auto-update; default is the one shipped with the running node |
319
- | `CODEX_SUPERVISOR_HANDOFF_TOKEN_THRESHOLD` | `300000` | Native-goal token count that marks a worker `handoff_recommended`; `0` disables the warning |
320
-
321
- GUI clients (Claude Desktop, Cursor, Windsurf) are not automatic registration targets of this installer: add this to their MCP config file, and since their `PATH` often lacks `codex`, give `CODEX_BIN` explicitly:
322
-
323
- ```json
324
- {
325
- "mcpServers": {
326
- "codex-supervisor": {
327
- "command": "npx",
328
- "args": ["-y", "codex-supervisor-mcp"],
329
- "env": { "CODEX_BIN": "/usr/local/bin/codex" }
330
- }
331
- }
332
- }
333
- ```
334
-
335
- ## Updating
156
+ | `SUPERVISOR_HOME` | `~/.codex-supervisor` | State root. The MCP server and the board must point at the same one |
157
+ | `CODEX_BIN` | `codex` | Path to the Codex CLI. GUI clients often lack it on `PATH` |
158
+ | `SUPERVISOR_WEB_PORT` | `7877` | Board port |
159
+ | `CODEX_SUPERVISOR_NO_AUTO_UPDATE` | unset | `1` turns off background updates and only notifies |
336
160
 
337
- Nothing to do by hand. At start the server asks the registry in the background; a newer version is installed by a detached `npm i -g` into the same global path, the running session is untouched and the next session starts on it. Only a copy that `npm i -g` installed is touched; a git checkout or an `npx` copy is left alone. The skill does the same: every start copies it into the existing skill directories, backing up an edited file as `SKILL.md.bak-<timestamp>`.
161
+ The remaining variables, the six worker states and the cache directories the sandbox opens by default are in the [reference](docs/reference.en.md).
338
162
 
339
- When the install fails (a global directory that needs sudo) the `update` field says why and `npm install -g codex-supervisor-mcp@latest` by hand still works. Versions up to 0.6.1 only notify; upgrade by hand once and it is automatic from then on. After changing Node versions/install prefixes, setup repairs old package-generated paths and verifies command/args through client read-back. Custom, disabled and project registrations are preserved with a repair warning. To run the setup again: `codex-supervisor-setup` (`--skill-only` / `--mcp-only` / `--dry-run`). Manual registration failures exit nonzero; automatic installs warn without failing npm. A skill write failure does not prevent MCP registration. Set `CLAUDE_BIN` / `CODEX_BIN` for off-PATH CLIs. Skill locations follow `CLAUDE_CONFIG_DIR` / `CODEX_HOME`.
163
+ Updates take care of themselves. At start the server asks the registry in the background and, if there is a newer version, a detached process runs `npm i -g`. The running session is untouched and the next one starts on the new version. This only applies to a global install.
340
164
 
341
165
  Uninstall:
342
166
 
@@ -347,61 +171,41 @@ codex mcp remove codex-supervisor
347
171
  rm -rf ~/.claude/skills/codex-supervisor ~/.agents/skills/codex-supervisor ~/.codex/skills/codex-supervisor ~/.codex-supervisor
348
172
  ```
349
173
 
350
- ## Windows
351
-
352
- - The npm-installed CLI is `codex.cmd`, which Node refuses to spawn directly. The runner steps over it to `node_modules/@openai/codex/bin/codex.js` and runs that with `node`; no `shell: true`, which would leave only the shell killable on cancel.
353
- - Cross-process cancel uses `taskkill /PID <pid> /T /F` for the whole tree, after confirming that pid runs codex.
354
- - Besides `PATH`, `%APPDATA%\npm`, `%LOCALAPPDATA%\pnpm`, `%LOCALAPPDATA%\Volta\bin` and `%ProgramFiles%\nodejs` are probed.
355
-
356
174
  ## Troubleshooting
357
175
 
358
176
  | Symptom | Cause | Fix |
359
177
  |---|---|---|
360
- | Not in `claude mcp list` | The install method skipped `postinstall` | `codex-supervisor-setup`, or `claude mcp add` by hand |
361
- | Dispatch says `codex only resolved to a shell shim` | Windows found only the `.cmd`; the package entry behind it is gone | Reinstall `@openai/codex`, or point `CODEX_BIN` at `codex.js` |
362
- | Worker `failed` at once with `spawn codex ENOENT` | No codex on the process `PATH` | Set `CODEX_BIN` in the config |
178
+ | Missing from `claude mcp list` | The install did not run `postinstall` | `codex-supervisor-setup` |
179
+ | Worker `failed` at once, `spawn codex ENOENT` | No codex on the process `PATH` | Set `CODEX_BIN` |
180
+ | `codex only resolved to a shell shim` | Windows found only the `.cmd`; the package entry is gone | Reinstall `@openai/codex`, or point `CODEX_BIN` at `codex.js` |
363
181
  | `Cannot find module 'node:sqlite'` | Node older than 22.13.0 | Upgrade Node |
364
- | Worker `lost` | The worker or independent run process was interrupted | Inspect events, then `resume_codex_worker` |
365
- | Worker reports `git add` failing with `index.lock: Operation not permitted` | The default sandbox keeps `.git` read-only; this is the intended boundary | Keep the worker to edits and acceptance, then use `land_codex_worker` with `commitMessage` |
366
- | `ownedPaths overlap with active worker(s)` | Two workers claimed the same paths | Split differently, or cancel the one holding them |
367
- | The board is empty | The board and the MCP use different `SUPERVISOR_HOME`s | Start it inside the project with the `.mcp.json`, or pass the same `SUPERVISOR_HOME` |
368
- | `port 7877 ... is already in use` | A board is already running | Open it, or start another with `SUPERVISOR_WEB_PORT=8080` |
182
+ | Worker is `lost` | The worker or its run process was killed | Read the events, then `resume_codex_worker` |
183
+ | `git add` fails with `index.lock: Operation not permitted` | The sandbox makes `.git` read-only. That is the intended boundary | Let `land_codex_worker` commit with `commitMessage` |
184
+ | `ownedPaths overlap with active worker(s)` | Two workers claimed the same paths | Split the work differently, or cancel the one holding them |
185
+ | The board is empty | The board and the MCP server use different `SUPERVISOR_HOME` | Point both at the same directory |
186
+ | `port 7877 ... is already in use` | A board is already running | Open that one, or change `SUPERVISOR_WEB_PORT` |
369
187
 
370
188
  ## Known limitations
371
189
 
372
- - Each run has an independent process that drains worker output, records its exit, and runs acceptance before exiting. These continue after the dispatching MCP is killed; a new window uses `get_session_works` to collect results. If the run process is also killed, inspect lost/interrupted evidence before resuming the preserved worktree and thread_id.
373
- - In the default `workspace-write` sandbox a worker cannot commit (Codex keeps `.git` read-only). Use `land_codex_worker` with `commitMessage`; do not switch to `danger-full-access` just to commit.
374
- - The worktree is cut from a commit; uncommitted work in your checkout is not in it.
190
+ - A worktree is cut from a commit. Uncommitted changes in your checkout are not in it.
375
191
  - Only the working directory is isolated. Temp directories, databases and ports are shared.
376
- - `ownedPaths` overlap is reserved at dispatch. The runtime guard checks direct file edits and landing checks the complete diff. Declared scripts can still produce side effects outside the list, so this is not a complete filesystem sandbox.
377
- - Acceptance checks exactly what `acceptance` says. Anything not written there is not checked; `verification` is only what the worker ran itself, and the rest is the main thread reading the diff.
378
- - One `wait_codex_workers` cannot wait to the end; the client's MCP tool timeout is a hard wall. Call it again.
379
- - `search_works` is substring matching, fine for hundreds of works.
380
-
381
- ## Roadmap
382
-
383
- Done: `CODEX_BIN` / `SUPERVISOR_HOME` / `GIT_BIN`; `status` and `phase` split; `ownedPaths` / `goal` / `dependsOn`; `thread_id` on disk + `resume_codex_worker`; concurrency and multi-process writes; `session_id`, `search_works`, native goals; Windows; the web board; `baseRef`; collecting work with `get_worker_diff` / `ask_codex_worker` / `land_codex_worker`; background auto-update.
384
-
385
- Run lifetime is independent of MCP; each run process exits after settlement without a global resident daemon.
386
-
387
- Not planned: vector search (substring matching is faster at this scale and costs nothing to maintain), `usage_count` ordering (2 of 80 real works were ever referenced again).
192
+ - The guard blocks direct file writes, but it is not a filesystem sandbox. A script you allowed can have side effects outside its declared paths; the diff check before landing is what catches them.
193
+ - Acceptance checks what you wrote in `acceptance` and nothing else. The rest is the main thread reading the diff.
194
+ - The client's MCP tool timeout is a hard wall, so one `wait_codex_workers` call cannot wait to the end. Call it again.
195
+ - `search_works` is substring matching, which is enough for a few hundred works. Vector search is not planned.
388
196
 
389
197
  ## Development
390
198
 
391
199
  ```bash
392
200
  npm install
393
- npm test # fake-codex replay, fast and deterministic
394
- npm run test:edge # test/edge only
395
- npm run test:real # end to end against the real codex CLI
201
+ npm test # fake-codex replay, under a minute
202
+ npm run test:real # real codex CLI end to end; needs a logged-in codex
396
203
  npm run web:dev # board development, /api proxied to 7877
397
- npm run web:build # bundle to web/dist, runs before npm publish
398
204
  ```
399
205
 
400
- CI runs Ubuntu / macOS / Windows, plus a Node 22.13.0 job that pins the `engines` floor.
401
-
402
- ## Contributing
206
+ CI runs on Ubuntu, macOS and Windows, plus a Node 22.13.0 job that pins the lower bound of `engines`.
403
207
 
404
- See [CONTRIBUTING.en.md](CONTRIBUTING.en.md). Security issues go through the [private advisory form](https://github.com/zriyox/codex-supervisor-mcp/security/advisories/new); see [SECURITY.md](SECURITY.md).
208
+ To contribute, read [CONTRIBUTING.en.md](CONTRIBUTING.en.md). Security reports go through the [private channel](https://github.com/zriyox/codex-supervisor-mcp/security/advisories/new); see [SECURITY.md](SECURITY.md).
405
209
 
406
210
  ## License
407
211