codex-supervisor-mcp 0.13.3 → 0.13.5
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.
- package/README.en.md +101 -295
- package/README.md +99 -308
- package/package.json +7 -1
- package/skills/codex-supervisor/SKILL.md +3 -1
- package/src/auto-update.js +0 -1
- package/src/cleanup-plan.js +2 -2
- package/src/codex-runner.js +1 -1
- package/src/landing.js +1 -1
- package/src/mcp-server.js +10 -5
- package/src/prompt.js +4 -1
- package/src/setup.js +2 -2
- package/src/side-chat.js +0 -1
- package/src/task-store.js +1 -1
- package/src/worker-changes.js +21 -1
- package/src/worktree.js +2 -2
package/README.en.md
CHANGED
|
@@ -8,333 +8,159 @@ English | [中文](README.md)
|
|
|
8
8
|
[](https://github.com/zriyox/codex-supervisor-mcp/actions/workflows/ci.yml)
|
|
9
9
|
[](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
|
-
|
|
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
|

|
|
18
18
|
|
|
19
|
-
*30 seconds, recorded live:
|
|
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
|
|
26
|
-
|
|
|
27
|
-
| A
|
|
28
|
-
|
|
|
29
|
-
|
|
|
30
|
-
|
|
|
31
|
-
|
|
|
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
|
-
|
|
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
|
-
|
|
35
|
+
## Five minutes to a running batch
|
|
42
36
|
|
|
43
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
52
|
+
Then say it in plain words in Claude Code:
|
|
59
53
|
|
|
60
|
-
|
|
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
|
-
|
|
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
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
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
|
-
|
|
67
|
+
Workers never commit. Their changes stay on `codex/<taskId>` until the main thread has read the diff.
|
|
76
68
|
|
|
77
|
-
|
|
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`.
|
|
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
|
|
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
|
|
95
|
-
| Main-brain session | A worktree of the code repository | Read the brief, dispatch
|
|
96
|
-
| Codex workers | Their own worktrees | One worker per independently verifiable feature package.
|
|
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
|
|
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:
|
|
102
|
-
|
|
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
|
|
105
|
-
[
|
|
106
|
-
[
|
|
107
|
-
|
|
108
|
-
|
|
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
|
-
[
|
|
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
|
-
|
|
105
|
+
39 of them. Arguments and edge cases are in the [reference](docs/reference.en.md#tools).
|
|
151
106
|
|
|
152
|
-
|
|
|
107
|
+
| Stage | Tool | What it does |
|
|
153
108
|
|---|---|---|
|
|
154
|
-
|
|
|
155
|
-
| `
|
|
156
|
-
|
|
|
157
|
-
|
|
|
158
|
-
|
|
|
159
|
-
|
|
|
160
|
-
|
|
|
161
|
-
|
|
|
162
|
-
|
|
|
163
|
-
| `get_orchestration_overview`
|
|
164
|
-
|
|
|
165
|
-
|
|
|
166
|
-
|
|
|
167
|
-
|
|
|
168
|
-
|
|
|
169
|
-
|
|
|
170
|
-
|
|
|
171
|
-
| `
|
|
172
|
-
| `
|
|
173
|
-
| `
|
|
174
|
-
|
|
|
175
|
-
| `
|
|
176
|
-
|
|
|
177
|
-
|
|
|
178
|
-
|
|
|
179
|
-
| `
|
|
180
|
-
|
|
|
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
|
-
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.
|
|
233
|
-
|
|
234
|
-
Wait defaults to 60 seconds and compact rows; includeEvents selects details unless compact is explicit. Clients supplying a progress token receive notifications every 30 seconds. MCP SDK and real Claude 2.1.299 are verified: a 65-second wait succeeds with a 35-second idle timeout after three progress notifications. Native /loop scheduling is also verified.
|
|
235
|
-
|
|
236
|
-
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.
|
|
237
|
-
|
|
238
|
-
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.
|
|
239
|
-
|
|
240
|
-
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.
|
|
241
|
-
|
|
242
|
-
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.
|
|
243
|
-
|
|
244
|
-
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.
|
|
245
|
-
|
|
246
|
-
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.
|
|
247
|
-
|
|
248
|
-
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.
|
|
249
|
-
|
|
250
|
-
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.
|
|
251
|
-
|
|
252
|
-
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.
|
|
253
|
-
|
|
254
|
-
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.
|
|
255
|
-
|
|
256
|
-
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.
|
|
257
|
-
|
|
258
|
-
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.
|
|
259
|
-
|
|
260
|
-
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 |
|
|
261
136
|
|
|
262
137
|
## How this differs from Claude Code subagents
|
|
263
138
|
|
|
264
|
-
|
|
139
|
+
A subagent can open its own worktree too, so file isolation is not the difference. The model and the process are.
|
|
265
140
|
|
|
266
141
|
| | Claude Code subagent | codex-supervisor worker |
|
|
267
142
|
|---|---|---|
|
|
268
|
-
|
|
|
143
|
+
| Which models | Claude only | Anything the Codex CLI has a provider for |
|
|
269
144
|
| Who does the work | Claude Code itself | A separate `codex exec` process |
|
|
270
|
-
| Two
|
|
271
|
-
|
|
|
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` |
|
|
272
147
|
| Who can drive it | Claude Code only | Any MCP client |
|
|
273
|
-
| Seeing the process | Only the
|
|
274
|
-
|
|
275
|
-
## The state machine
|
|
276
|
-
|
|
277
|
-
| `status` | Meaning |
|
|
278
|
-
|---|---|
|
|
279
|
-
| `queued` | Dispatched, not started |
|
|
280
|
-
| `running` | Running. `phase`: `starting → thinking → command → editing → reporting` |
|
|
281
|
-
| `completed` | Done |
|
|
282
|
-
| `failed` | Non-zero exit, `turn.failed`, spawn failure |
|
|
283
|
-
| `cancelled` | Stopped by `cancel_codex_worker` |
|
|
284
|
-
| `lost` | Worker killed by an outside signal, run process disappeared, or a row whose process never started. `resume_codex_worker` picks it up |
|
|
285
|
-
|
|
286
|
-
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`.
|
|
148
|
+
| Seeing the process | Only the conclusion it returns | Raw JSONL and the web board |
|
|
287
149
|
|
|
288
|
-
##
|
|
150
|
+
## Configuration and state
|
|
289
151
|
|
|
290
|
-
`~/.codex-supervisor
|
|
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
|
-
|
|
|
293
|
-
|---|---|
|
|
294
|
-
| `data/supervisor.sqlite` | `tasks` (one row per work), `task_events`, `sessions`, `side_sessions` / `side_turns` (side chat) |
|
|
295
|
-
| `data/runs/<taskId>.jsonl` | Raw `codex --json` output |
|
|
296
|
-
| `data/update-check.json`, `auto-update.json` | Update check and background update records |
|
|
297
|
-
| `worktrees/<taskId>/` | The worker's Git worktree |
|
|
298
|
-
|
|
299
|
-
`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.
|
|
300
|
-
|
|
301
|
-
## Environment variables
|
|
302
|
-
|
|
303
|
-
| Variable | Default | Effect |
|
|
154
|
+
| Variable | Default | What it does |
|
|
304
155
|
|---|---|---|
|
|
305
|
-
| `SUPERVISOR_HOME` | `~/.codex-supervisor` | State root. The MCP and the board must point at the same one |
|
|
306
|
-
| `
|
|
307
|
-
| `
|
|
308
|
-
| `
|
|
309
|
-
| `SUPERVISOR_WEB_PORT` / `SUPERVISOR_WEB_HOST` | `7877` / `127.0.0.1` | Board address |
|
|
310
|
-
| `CODEX_SUPERVISOR_NO_UPDATE_CHECK` | unset | `1` disables the update check |
|
|
311
|
-
| `CODEX_SUPERVISOR_REGISTRY` | `https://registry.npmjs.org` | Registry for the update check and the auto-update |
|
|
312
|
-
| `CODEX_SUPERVISOR_UPDATE_TIMEOUT_MS` | `4000` | How long to wait for the registry |
|
|
313
|
-
| `CODEX_SUPERVISOR_NO_AUTO_UPDATE` | unset | `1` turns the background auto-update off (notify only) |
|
|
314
|
-
| `CODEX_SUPERVISOR_SKIP_SKILL_SYNC` | unset | `1` turns the skill sync at server start off |
|
|
315
|
-
| `CODEX_SUPERVISOR_SKIP_SETUP` | unset | `1` skips the `postinstall` setup |
|
|
316
|
-
| `CODEX_SUPERVISOR_NPM` | unset | npm for the auto-update; default is the one shipped with the running node |
|
|
317
|
-
| `CODEX_SUPERVISOR_HANDOFF_TOKEN_THRESHOLD` | `300000` | Native-goal token count that marks a worker `handoff_recommended`; `0` disables the warning |
|
|
318
|
-
|
|
319
|
-
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:
|
|
320
|
-
|
|
321
|
-
```json
|
|
322
|
-
{
|
|
323
|
-
"mcpServers": {
|
|
324
|
-
"codex-supervisor": {
|
|
325
|
-
"command": "npx",
|
|
326
|
-
"args": ["-y", "codex-supervisor-mcp"],
|
|
327
|
-
"env": { "CODEX_BIN": "/usr/local/bin/codex" }
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
```
|
|
332
|
-
|
|
333
|
-
## 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 |
|
|
334
160
|
|
|
335
|
-
|
|
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).
|
|
336
162
|
|
|
337
|
-
|
|
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.
|
|
338
164
|
|
|
339
165
|
Uninstall:
|
|
340
166
|
|
|
@@ -345,61 +171,41 @@ codex mcp remove codex-supervisor
|
|
|
345
171
|
rm -rf ~/.claude/skills/codex-supervisor ~/.agents/skills/codex-supervisor ~/.codex/skills/codex-supervisor ~/.codex-supervisor
|
|
346
172
|
```
|
|
347
173
|
|
|
348
|
-
## Windows
|
|
349
|
-
|
|
350
|
-
- 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.
|
|
351
|
-
- Cross-process cancel uses `taskkill /PID <pid> /T /F` for the whole tree, after confirming that pid runs codex.
|
|
352
|
-
- Besides `PATH`, `%APPDATA%\npm`, `%LOCALAPPDATA%\pnpm`, `%LOCALAPPDATA%\Volta\bin` and `%ProgramFiles%\nodejs` are probed.
|
|
353
|
-
|
|
354
174
|
## Troubleshooting
|
|
355
175
|
|
|
356
176
|
| Symptom | Cause | Fix |
|
|
357
177
|
|---|---|---|
|
|
358
|
-
|
|
|
359
|
-
|
|
|
360
|
-
|
|
|
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` |
|
|
361
181
|
| `Cannot find module 'node:sqlite'` | Node older than 22.13.0 | Upgrade Node |
|
|
362
|
-
| Worker `lost` | The worker or
|
|
363
|
-
|
|
|
364
|
-
| `ownedPaths overlap with active worker(s)` | Two workers claimed the same paths | Split differently, or cancel the one holding them |
|
|
365
|
-
| The board is empty | The board and the MCP use different `SUPERVISOR_HOME`
|
|
366
|
-
| `port 7877 ... is already in use` | A board is already running | Open
|
|
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` |
|
|
367
187
|
|
|
368
188
|
## Known limitations
|
|
369
189
|
|
|
370
|
-
-
|
|
371
|
-
- 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.
|
|
372
|
-
- 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.
|
|
373
191
|
- Only the working directory is isolated. Temp directories, databases and ports are shared.
|
|
374
|
-
-
|
|
375
|
-
- Acceptance checks
|
|
376
|
-
-
|
|
377
|
-
- `search_works` is substring matching,
|
|
378
|
-
|
|
379
|
-
## Roadmap
|
|
380
|
-
|
|
381
|
-
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.
|
|
382
|
-
|
|
383
|
-
Run lifetime is independent of MCP; each run process exits after settlement without a global resident daemon.
|
|
384
|
-
|
|
385
|
-
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.
|
|
386
196
|
|
|
387
197
|
## Development
|
|
388
198
|
|
|
389
199
|
```bash
|
|
390
200
|
npm install
|
|
391
|
-
npm test # fake-codex replay,
|
|
392
|
-
npm run test:
|
|
393
|
-
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
|
|
394
203
|
npm run web:dev # board development, /api proxied to 7877
|
|
395
|
-
npm run web:build # bundle to web/dist, runs before npm publish
|
|
396
204
|
```
|
|
397
205
|
|
|
398
|
-
CI runs Ubuntu
|
|
399
|
-
|
|
400
|
-
## Contributing
|
|
206
|
+
CI runs on Ubuntu, macOS and Windows, plus a Node 22.13.0 job that pins the lower bound of `engines`.
|
|
401
207
|
|
|
402
|
-
|
|
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).
|
|
403
209
|
|
|
404
210
|
## License
|
|
405
211
|
|