codex-supervisor-mcp 0.7.1 → 0.7.3

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 CHANGED
@@ -8,31 +8,33 @@ 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
- **codex-supervisor-mcp** is a Codex MCP server: let one main thread (Claude Code, Codex, or any MCP client) run several Codex CLI workers at once. One Git worktree per worker, every state change on disk, and a web board to watch the batch.
11
+ Website [codex-supervisor.zriyo.com](https://codex-supervisor.zriyo.com) · for models [llms.txt](https://codex-supervisor.zriyo.com/llms.txt)
12
12
 
13
- ![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)
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
+
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.
14
16
 
15
- *30 seconds, recorded live: the main thread calls `create_codex_worker` three times, the workers run in parallel in their own worktrees, the main thread collects three diffs and makes one commit.*
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)
16
18
 
17
- ## What it is
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.*
18
20
 
19
- Point several agents at one repository and they overwrite each other, and nobody can say afterwards who changed what. This MCP takes dispatching and bookkeeping out of the model's context and puts them on disk:
21
+ ## What it solves
20
22
 
21
- | Problem | What happens here |
23
+ | Problem | What it does |
22
24
  |---|---|
23
- | Workers step on each other's files | One Git worktree per worker; `ownedPaths` is checked for overlap before anything starts |
24
- | A worker's output floods the main thread | Events go to `data/runs/<taskId>.jsonl`; reads have `limit` / `maxChars` / `kinds` gates |
25
+ | Workers trample each other's files | One Git worktree per worker, `ownedPaths` checked for overlap before dispatch |
26
+ | Worker output floods the main thread | Events go to `data/runs/<taskId>.jsonl`; reads are gated by `limit` / `maxChars` / `kinds` |
25
27
  | One status read fills the context | `get_orchestration_overview` fits every worker into 7000 bytes |
26
- | Nobody knows who is still running after a restart | `supervisor.sqlite` has one row per work, with the `thread_id` |
27
- | A new session cannot pick up an old worker | `resume_codex_worker` runs `codex exec resume <thread_id>`, the same Codex conversation |
28
- | "It failed" and "the process vanished" look alike | The state machine keeps `failed` and `lost` apart |
29
- | You cannot see where a batch is | `codex-supervisor-web` opens a board, one session at a time, one line per worker |
28
+ | Nobody knows who is still running after a restart | `supervisor.sqlite`, one row per work, with `thread_id` |
29
+ | A new session cannot pick up an old worker | `resume_codex_worker` runs `codex exec resume <thread_id>`: the same Codex conversation |
30
+ | "Failed" and "process gone" look alike | The state machine keeps `failed` and `lost` apart |
31
+ | No view of where a batch is | `codex-supervisor-web`, a board that shows every worker by session |
30
32
 
31
- Workers are `codex exec` processes and `model` is passed straight through. The main thread stays on Claude for judgement; the workers can run DeepSeek or whatever Codex has a provider for, on a separate bill.
33
+ 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.
32
34
 
33
35
  ## Five minutes to a running batch
34
36
 
35
- Requirements: Node.js 22.13.0 or newer, and the `codex` CLI on `PATH`. macOS, Linux and Windows.
37
+ Prerequisites: Node.js 22.13.0 or newer, `codex` on `PATH`. macOS, Linux and Windows.
36
38
 
37
39
  ### 1. Install
38
40
 
@@ -40,37 +42,30 @@ Requirements: Node.js 22.13.0 or newer, and the `codex` CLI on `PATH`. macOS, Li
40
42
  npm install -g codex-supervisor-mcp
41
43
  ```
42
44
 
43
- A global install's `postinstall` does two things: it copies the bundled skill into `~/.claude/skills/`, `~/.agents/skills/` and `~/.codex/skills/`, and it registers the MCP with `claude mcp add -s user` and `codex mcp add`. Check:
44
-
45
- ```bash
46
- claude mcp list | grep codex-supervisor
47
- codex mcp list | grep codex-supervisor
48
- ```
49
-
50
- If it is missing (`npx`, `--ignore-scripts` and pnpm installs skip `postinstall`), add it by hand:
45
+ `postinstall` installs the skill and registers the MCP. If `claude mcp list` does not show it (`npx`, pnpm and `--ignore-scripts` skip `postinstall`), add it by hand:
51
46
 
52
47
  ```bash
53
48
  claude mcp add -s user codex-supervisor -- npx -y codex-supervisor-mcp
54
49
  codex mcp add codex-supervisor -- npx -y codex-supervisor-mcp
55
50
  ```
56
51
 
57
- Restart Claude Code / Codex so the MCP process is the new one.
52
+ Restart Claude Code / Codex. Updates take care of themselves from here; see "Updating". For the skill alone: `npx skills add zriyox/codex-supervisor-mcp`.
58
53
 
59
54
  ### 2. Dispatch a batch
60
55
 
61
- In Claude Code, say it in plain words; the skill makes it follow the right sequence:
56
+ Say it in plain words in Claude Code; the skill makes it follow the right steps:
62
57
 
63
- > Fill in the unit tests for these three modules. Use codex-supervisor, three workers in parallel, session title "unit tests".
58
+ > Fill in the unit tests for these three modules, three codex-supervisor workers in parallel, session "unit tests".
64
59
 
65
60
  What the main thread does underneath (you can call the tools yourself):
66
61
 
67
62
  ```
68
63
  create_codex_worker ×3 each with session_id, session_title, ownedPaths, goal
69
- wait_codex_workers two-minute budget by default; returns a snapshot, call again if still running
70
- get_worker_result ×3 the full report and change list per worker
64
+ wait_codex_workers two minutes by default, then a snapshot, call again until done
65
+ get_worker_result ×3 each worker's full report and changed files
71
66
  ```
72
67
 
73
- Each worker's changes sit on its own `codex/<taskId>` branch. Whether and how to merge is the main thread's call.
68
+ Each worker's changes sit on its own `codex/<taskId>` branch; whether and how to merge is the main thread's call.
74
69
 
75
70
  ### 3. Open the board
76
71
 
@@ -80,17 +75,11 @@ codex-supervisor-web
80
75
  npx -p codex-supervisor-mcp codex-supervisor-web
81
76
  ```
82
77
 
83
- Open `http://127.0.0.1:7877`. The left column lists sessions with the title given at dispatch and how many workers are still running; a session opens into its worker ledger; a worker opens a drawer with its full report, change list, commands, event stream, task text and token usage. It refreshes every 2.5 seconds while something runs, every 8 seconds otherwise.
84
-
85
- Which store it opens: `SUPERVISOR_HOME` from the environment if set; otherwise the nearest `.mcp.json` above the current directory, if its `codex-supervisor` entry sets `SUPERVISOR_HOME`; otherwise the default `~/.codex-supervisor`. The startup line says which one and where it came from, so running it inside the project directory is enough.
86
-
87
- `SUPERVISOR_WEB_PORT` changes the port. A taken port (usually a board that is already running) is reported in one line and the process exits. The board does not dispatch or cancel; the ask tab starts a read-only Codex side session, described below.
78
+ 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.
88
79
 
89
80
  ## How I use it
90
81
 
91
- The boundary first: this MCP does not care who the main thread is. Claude Code, Codex itself, Cursor, anything that speaks MCP can dispatch. Workers run `codex exec`, so any model you have configured as a Codex provider works, DeepSeek on one worker and GPT on the next. You can describe the batch in plain words and let the skill make the calls, or call the tools yourself. What follows is my way, not the only way.
92
-
93
- I run two Claude Code sessions. One writes documents, the other dispatches. A session that writes the design and watches the workers fills its context in two hours, and mixes the judgement that goes into code with the judgement that goes into dispatch.
82
+ 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.
94
83
 
95
84
  | Who | Where | Does what |
96
85
  |---|---|---|
@@ -99,7 +88,7 @@ I run two Claude Code sessions. One writes documents, the other dispatches. A se
99
88
  | 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 |
100
89
  | Codex workers | Their own worktrees | One worker per step, one commit per step, build and verify on a remote machine. No push, no merge |
101
90
 
102
- Only one block of text passes between the two sessions. The planning session writes it, I paste it into the main-brain session and hand it over with `/goal`. Its shape is always the same:
91
+ One block of text passes between the two sessions, pasted into the main-brain session and handed over with `/goal`. Its shape is fixed:
103
92
 
104
93
  ```text
105
94
  [Role] You are the main brain: read docs and code, dispatch workers, check results, update docs, report to me. You write no business code.
@@ -132,21 +121,19 @@ resume_codex_worker when it must change something, one follow-up, amended in
132
121
  land_codex_worker checked, then landed on the integration branch
133
122
  ```
134
123
 
135
- The last block was 25 steps. The main-brain session ran it end to end with nothing in its context but the brief and each worker's report. The tokens the workers burn are not on the main brain's bill.
136
-
137
- "One worker per step, one commit per step, checked before the next" came from trying it the other way. A worker returns, the main brain reads the diff and finds step 5 wrong: it sends one `resume_codex_worker` saying what is wrong and asking for `git commit --amend` into the same commit. Same Codex thread, full context, checked again before landing. A worker that did three steps cannot be fixed this way: when step 5 is wrong, the commits for steps 6 and 7 are already on top.
124
+ The last block was 25 steps; the main-brain session ran it end to end with nothing in its context but the brief and each worker's report. One worker per step came from trying it the other way: when a step is wrong, one `resume_codex_worker` asks for `--amend` into the same commit and the main brain checks again before landing; a worker that did three steps cannot be fixed that way, since steps 6 and 7 already sit on top of a wrong step 5.
138
125
 
139
126
  ## What the board shows
140
127
 
141
128
  | Where | What |
142
129
  |---|---|
143
- | Left column | One line per session: title (the `session_title` from dispatch, or a line built from the workers' goals when none was given), worker count, how many are running, last activity. The current version and any update notice sit at the bottom |
144
- | Session page | Title, note, first dispatch and last activity; a count line (total / running / completed / failed / lost); while workers run, the command each one is executing; when idle, the last report |
145
- | Worker ledger | One row per worker: status, title, the running command or the last line reported, time taken, files changed (the worktree's real diff, committed work included), commands run, last update. Hovering the title shows the full goal, the owned paths and the branch |
146
- | Worker drawer | Status, title, goal, the running command and one line of numbers (duration / files / commands / tokens / exit code) at the top; seven tabs below: overview (start and end, model, sandbox, thread, branch, base commit, worktree, owned paths), report (rendered markdown), changes, commands, events (virtualized), task text, ask. The divider between the main column and the drawer drags; double-click resets it |
147
- | Ask | A side question about this worker, the way Codex's own `/btw` works: its Codex thread is forked into a read-only side session that answers. The fork can read the worktree and any file on disk, changes nothing, and never touches the worker's own thread, running or not. The first question forks, later ones `resume` the same side session, so it is multi-turn; reasoning, the commands it ran (with exit code and output) and the answer appear step by step as Codex finishes them. Every turn's question and output is stored in the `side_turns` table: switching tabs, closing the drawer or reloading never cuts a turn off, the page re-attaches and replays; another tab can attach too, or stop it; a turn nobody watches still runs to the end and keeps its answer; a turn that was running when the board restarted is marked interrupted. "End" runs `codex delete` on the side session and clears the history. Workers dispatched before 0.5 recorded no thread id and cannot be asked |
130
+ | Left column | One row per session: title, worker count, how many running, last activity. Version and update notice at the bottom |
131
+ | Session page | Counts (total / running / done / failed / lost); while workers run, the command each one is on |
132
+ | Worker table | One row per worker: status, title, current command or last report line, duration, files changed, commands run |
133
+ | Worker drawer | Seven tabs: overview, report, changes, commands, events, task, side chat |
134
+ | 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 |
148
135
 
149
- Lists load lazily: 20 sessions per page in the rail, 40 workers per page in the ledger, the next page fetched as you scroll to the end; while something runs the loaded pages refresh every 2.5 seconds. Light and dark follow the system. System fonts only, nothing fetched from the network.
136
+ Light and dark follow the system. No external resources.
150
137
 
151
138
  ## Tools
152
139
 
@@ -154,78 +141,53 @@ Nineteen.
154
141
 
155
142
  | Tool | Arguments | What it does |
156
143
  |---|---|---|
157
- | `create_codex_worker` | `task`, `cwd`, **`ownedPaths`**, **`goal`**, `session_id`, `session_title`, `session_note`, `dependsOn`, `baseRef`, `sandbox`, `model`, `reasoningEffort`, `title`, `skipGitRepoCheck` | Start a worker. `session_title` / `session_note` say what the batch is for; `baseRef` picks the commit the worktree is cut from (default: the repository's `HEAD`), pass another worker's `codex/<id>` branch to build on work not yet on the main line |
144
+ | `create_codex_worker` | `task`, `cwd`, **`ownedPaths`**, **`goal`**, `session_id`, `session_title`, `session_note`, `dependsOn`, `baseRef`, `sandbox`, `model`, `reasoningEffort`, `title`, `skipGitRepoCheck` | Start a worker. `baseRef` picks the commit the worktree is cut from (default `HEAD`); pass another worker's `codex/<id>` to build on it |
158
145
  | `create_codex_followup_worker` | `task_id`, `followup_prompt`, `session_id`, plus the above | A new session seeded with the old worker's prompt, status and recent events |
159
146
  | `resume_codex_worker` | `task_id`, `prompt` | Continue the same Codex conversation; `thread_id` stays |
160
- | `wait_codex_workers` | `task_ids`, `mode` (any/all), `timeoutMinutes`, `timeoutMs`, `compact`, `includeEvents`, `eventLimit`, `eventMaxChars`, `eventKinds` | Wait for terminal states. Two minutes by default, then a snapshot; `still_running: true` means call again with the same ids. Events off by default; `compact` returns one line per worker |
147
+ | `wait_codex_workers` | `task_ids`, `mode` (any/all), `timeoutMinutes`, `timeoutMs`, `compact`, `includeEvents`, `eventLimit`, `eventMaxChars`, `eventKinds` | Wait for terminal states. Two minutes by default, then a snapshot while the workers keep running; `compact` returns one line per worker |
161
148
  | `get_orchestration_overview` | `status`, `limit` | Every worker in one table, capped at 7000 bytes. Carries `version` and `update` |
162
- | `get_worker_result` | `task_id`, `limit`, `maxChars` | The worker's own full report plus `status` / `exit_code` / `changed_files`. The door for conclusions |
163
- | `get_worker_diff` | `task_id`, `maxChars`, `paths` | What the worker actually changed: patches from the worktree's starting commit to its working tree, committed or not, untracked files included. `maxChars` bounds the whole answer; files past it are listed without a patch |
149
+ | `get_worker_result` | `task_id`, `limit`, `maxChars` | The worker's own full report plus `status` / `exit_code` / `changed_files` |
150
+ | `get_worker_diff` | `task_id`, `maxChars`, `paths` | What the worker actually changed: patches from the worktree's start to its working tree, committed or not. `maxChars` bounds the answer; files past it are listed without a patch |
164
151
  | `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 |
165
- | `land_codex_worker` | `task_id`, `onto`, `commitMessage` | Cherry-pick the worker's commits from `codex/<id>` onto the current branch of the directory it was dispatched from. The target must be clean, `onto` is a check and never a switch, and a conflict rolls back and lists the files. `commitMessage` first commits the worker's uncommitted edits as one commit |
152
+ | `land_codex_worker` | `task_id`, `onto`, `commitMessage` | Cherry-pick the worker's `codex/<id>` commits onto the current branch of the directory it was dispatched from. Clean target only, a conflict rolls back. `commitMessage` first commits the worker's uncommitted edits as one commit |
166
153
  | `get_worker_summary` | `task_id` | One paragraph: goal, status, changes, last command and message |
167
- | `get_codex_worker_status` | `task_id`, `includePrompt`, `promptMaxChars` | One worker in detail; the prompt is clipped to 300 characters unless asked for |
154
+ | `get_codex_worker_status` | `task_id`, `includePrompt`, `promptMaxChars` | One worker in detail |
168
155
  | `get_codex_worker_events` | `task_id`, `limit`, `maxChars`, `kinds` | The raw event stream |
169
156
  | `get_worker_goal` | `task_id` | The goal recorded at dispatch plus the native Codex goal (tokens, time) |
170
157
  | `list_codex_workers` | `status`, `includeHistory`, `includeDetails` | List workers, active ones by default |
171
- | `get_session_works` | `session_id` | Every worker of one session, with its title and note. The way back after a main-thread restart |
172
- | `describe_session` | `session_id`, `title`, `note` | Record a title and note; fields left out keep their value |
158
+ | `get_session_works` | `session_id` | Every worker of one session. The way back after a main-thread restart |
159
+ | `describe_session` | `session_id`, `title`, `note` | Record a title and note for a session |
173
160
  | `search_works` | `query`, `limit` | Substring search over title / goal / prompt / last_message, newest first |
174
- | `check_for_update` | `force` | Ask the registry for a newer version and whether the installed files match the published tarball |
175
- | `cancel_codex_worker` | `task_id` | Stop a worker. Falls back to the pid when the handle is in another process, after confirming that pid runs codex |
176
-
177
- ### The three things to always pass
161
+ | `check_for_update` | `force` | Ask the registry for a newer version |
162
+ | `cancel_codex_worker` | `task_id` | Stop a worker. Falls back to the pid across processes, after confirming that pid runs codex |
178
163
 
179
- - `ownedPaths`: the paths this worker may write. Checked against every running worker before dispatch; an overlap refuses the call with the conflicting `task_id` and no worktree is created. It is a dispatch-time check, not a runtime sandbox.
180
- - `goal.objective`: one line on what the worker is for. The worker creates a native Codex goal from it and marks it complete when done.
181
- - `session_id`: not required by the schema, but without it nothing groups the batch and neither the board nor `get_session_works` can find it again. Same value for the whole batch, and `session_title` on the first dispatch.
182
-
183
- ### Reading results without filling the context
184
-
185
- | Want | Use | Cost |
186
- |---|---|---|
187
- | Status of every worker | `get_orchestration_overview` | 7000 bytes, hard cap |
188
- | One worker's conclusion | `get_worker_result` | The full report, tens of thousands of characters for a big job |
189
- | Alive or finished | `get_worker_summary` | A paragraph |
190
- | What it did | `get_codex_worker_events` | Filter with `kinds`, bound with `limit`, clip with `maxChars` |
191
- | What it actually changed | `get_worker_diff` | Capped by `maxChars`; the file list is always complete |
192
- | Why it did that | `ask_codex_worker` | One answer; the fork carries the worker's whole context |
193
-
194
- The dispatch receipt is small and does not echo the task text. `wait_codex_workers` clips `last_message` to 400 characters and `current_action` to 300; the full text is behind `get_worker_result` and `get_codex_worker_events`. That clipping is what takes a five-worker wait from tens of KB to a few KB, which matters when a client backgrounds a timed-out call and replays the result as a notification.
164
+ Two are required: `ownedPaths` (checked against every running worker before dispatch, overlap refuses the call, dispatch-time only) and `goal.objective` (the worker turns it into a native Codex goal). Without `session_id` nothing groups the batch; use one value for the whole batch.
195
165
 
196
166
  ## How this differs from Claude Code subagents
197
167
 
198
- File isolation is not the difference: subagents can open their own worktree (`isolation: worktree`). The difference is the model and the process.
168
+ File isolation is not the difference: a subagent can open a worktree too. The difference is the model and the process.
199
169
 
200
170
  | | Claude Code subagent | codex-supervisor worker |
201
171
  |---|---|---|
202
- | Models | Claude only | `model` goes to the Codex CLI; DeepSeek works |
172
+ | Model | Claude only | `model` passed to the Codex CLI; DeepSeek works |
203
173
  | Who does the work | Claude Code itself | A separate `codex exec` process |
204
- | Two workers, one file | Separate worktrees, no path declaration | `ownedPaths` intersection before dispatch; overlap is refused |
205
- | Main thread dies | Workers die with it | `thread_id` is in SQLite; `resume_codex_worker` picks the conversation back up |
174
+ | Two writers on one file | Worktrees keep them apart, no path declaration | `ownedPaths` overlap is refused before dispatch |
175
+ | Main-thread process dies | Workers die with it | `thread_id` is in sqlite; `resume_codex_worker` picks the same conversation up |
206
176
  | Who can drive it | Claude Code only | Any MCP client |
207
- | Watching the work | Only the returned conclusion | Raw JSONL and the web board |
177
+ | Seeing the process | Only the returned conclusion | Raw JSONL and the web board |
208
178
 
209
179
  ## The state machine
210
180
 
211
- `status` is the lifecycle, one value per work:
212
-
213
- | Value | Meaning |
181
+ | `status` | Meaning |
214
182
  |---|---|
215
183
  | `queued` | Dispatched, not started |
216
- | `running` | Running |
217
- | `completed` | Finished with exit code 0 |
218
- | `failed` | Non-zero exit, `turn.failed`, or spawn failure |
184
+ | `running` | Running. `phase`: `starting → thinking → command → editing → reporting` |
185
+ | `completed` | Done |
186
+ | `failed` | Non-zero exit, `turn.failed`, spawn failure |
219
187
  | `cancelled` | Stopped by `cancel_codex_worker` |
220
- | `lost` | Killed by an outside signal, the MCP process vanished, or the row was written and no process ever started |
221
-
222
- `phase` has a value only while `running`: `starting → thinking → command → editing → reporting`.
188
+ | `lost` | Killed by an outside signal, MCP process gone, or a row whose process never started. `resume_codex_worker` picks it up |
223
189
 
224
- `failed` sends you to the logs; `lost` means run it again. A terminal state lands in two steps: `turn.completed` sets `completed`, the process exit writes `exit_code`. `wait_codex_workers` waits for the second step; a direct status read that sees `completed` with `exit_code: null` is in the gap, read again.
225
-
226
- Windows has no signals. An outside kill and the process calling `exit(1)` look the same to the parent, so there it reports `failed` with the exit code.
227
-
228
- Native Codex goal states map like this: `active` / `paused` / `blocked` are `running` (the last two land in `needs_attention`), `usageLimited` / `budgetLimited` are `failed`, `complete` is `completed`.
190
+ 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`.
229
191
 
230
192
  ## Where state lives
231
193
 
@@ -233,42 +195,31 @@ Native Codex goal states map like this: `active` / `paused` / `blocked` are `run
233
195
 
234
196
  | File | Content |
235
197
  |---|---|
236
- | `data/supervisor.sqlite` | `tasks` (one row per work), `task_events` (structured events), `sessions` (titles and notes) |
237
- | `data/runs/<taskId>.jsonl` | The raw `codex --json` output |
238
- | `data/update-check.json` | Cache for the update check |
239
- | `worktrees/<taskId>/` | That worker's Git worktree |
240
-
241
- `changed_files` has three sources: Codex's `file_change` events; `git status --porcelain` in the worktree (uncommitted); `git diff --name-only <base_commit> HEAD` (committed). The last two exist because a worker editing through the shell emits no `file_change` event, and once it commits `git status` is clean again. A real batch of five did exactly that and every read came back empty. `base_commit` is recorded at dispatch; older rows fall back to the oldest reflog entry of the branch. Every git read passes `core.quotePath=false`, so non-ASCII file names come back as written instead of octal-escaped.
242
-
243
- A 0.1.x database migrates itself the first time it is opened, without losing a row.
244
-
245
- ## Update check
246
-
247
- When the MCP process starts it asks the npm registry which version is `latest` and what that tarball's integrity is, then compares two things with the install:
198
+ | `data/supervisor.sqlite` | `tasks` (one row per work), `task_events`, `sessions`, `side_sessions` / `side_turns` (side chat) |
199
+ | `data/runs/<taskId>.jsonl` | Raw `codex --json` output |
200
+ | `data/update-check.json`, `auto-update.json` | Update check and background update records |
201
+ | `worktrees/<taskId>/` | The worker's Git worktree |
248
202
 
249
- - The version. If it is behind, `get_orchestration_overview`, the dispatch receipt and the `wait_codex_workers` response gain an `update` field with `latest_version` and `npm i -g codex-supervisor-mcp@latest`. The skill tells the main thread to pass that on.
250
- - The files. A global install records the unpacked tarball's integrity in `node_modules/.package-lock.json`; if it differs from the registry's value for that version, the files on disk are not the published build and the notice says to reinstall. A git checkout has no such value and reports its commit.
251
-
252
- Cached an hour, re-checked every six while running. An unreachable registry is not an error; the result says `source: "offline"`. The board shows the same result in the lower left. `CODEX_SUPERVISOR_NO_UPDATE_CHECK=1` turns it off, `CODEX_SUPERVISOR_REGISTRY` points at a private registry.
203
+ `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.
253
204
 
254
205
  ## Environment variables
255
206
 
256
207
  | Variable | Default | Effect |
257
208
  |---|---|---|
258
- | `SUPERVISOR_HOME` | `~/.codex-supervisor` | State root. The MCP and the board must use the same one |
259
- | `CODEX_HOME` | `~/.codex` | Read-only, for Codex's native `goals_1.sqlite` |
260
- | `CODEX_BIN` | `codex` | Path to the Codex CLI. The Windows `.cmd` shim is bypassed; a `.js` target is started with `node` |
209
+ | `SUPERVISOR_HOME` | `~/.codex-supervisor` | State root. The MCP and the board must point at the same one |
210
+ | `CODEX_HOME` | `~/.codex` | Read-only: the native `goals_1.sqlite` and the MCP config |
211
+ | `CODEX_BIN` | `codex` | Path to the Codex CLI. The Windows `.cmd` shim is bypassed |
261
212
  | `GIT_BIN` | `git` | Path to git |
262
- | `SUPERVISOR_WEB_PORT` / `SUPERVISOR_WEB_HOST` | `7877` / `127.0.0.1` | Where the board listens |
213
+ | `SUPERVISOR_WEB_PORT` / `SUPERVISOR_WEB_HOST` | `7877` / `127.0.0.1` | Board address |
263
214
  | `CODEX_SUPERVISOR_NO_UPDATE_CHECK` | unset | `1` disables the update check |
264
- | `CODEX_SUPERVISOR_REGISTRY` | `https://registry.npmjs.org` | Registry for the update check |
215
+ | `CODEX_SUPERVISOR_REGISTRY` | `https://registry.npmjs.org` | Registry for the update check and the auto-update |
265
216
  | `CODEX_SUPERVISOR_UPDATE_TIMEOUT_MS` | `4000` | How long to wait for the registry |
266
- | `CODEX_SUPERVISOR_SKIP_SETUP` | unset | `1` skips the `postinstall` setup |
267
217
  | `CODEX_SUPERVISOR_NO_AUTO_UPDATE` | unset | `1` turns the background auto-update off (notify only) |
268
218
  | `CODEX_SUPERVISOR_SKIP_SKILL_SYNC` | unset | `1` turns the skill sync at server start off |
269
- | `CODEX_SUPERVISOR_NPM` | unset | npm for the auto-update (path to `npm-cli.js` or an executable); default is the one shipped with the running node |
219
+ | `CODEX_SUPERVISOR_SKIP_SETUP` | unset | `1` skips the `postinstall` setup |
220
+ | `CODEX_SUPERVISOR_NPM` | unset | npm for the auto-update; default is the one shipped with the running node |
270
221
 
271
- A process started by a GUI client often has no `codex` on `PATH`; set `CODEX_BIN` in the config:
222
+ GUI clients (Claude Desktop, Cursor, Windsurf) do not run `postinstall`: add this to their MCP config file, and since their `PATH` often lacks `codex`, give `CODEX_BIN` explicitly:
272
223
 
273
224
  ```json
274
225
  {
@@ -282,124 +233,76 @@ A process started by a GUI client often has no `codex` on `PATH`; set `CODEX_BIN
282
233
  }
283
234
  ```
284
235
 
285
- ## Install details
286
-
287
- ### GUI clients
288
-
289
- GUI clients do not run `postinstall`; add the JSON above to the config file:
290
-
291
- | Client | macOS | Windows | Linux |
292
- |---|---|---|---|
293
- | Claude Desktop | `~/Library/Application Support/Claude/claude_desktop_config.json` | `%APPDATA%\Claude\claude_desktop_config.json` | `~/.config/Claude/claude_desktop_config.json` |
294
- | Cursor | `~/.cursor/mcp.json` | `%APPDATA%\Cursor\mcp.json` | `~/.config/cursor/mcp.json` |
295
- | Windsurf | `~/.codeium/windsurf/mcp_config.json` | `%APPDATA%\Codeium\windsurf\mcp_config.json` | `~/.config/.codeium/windsurf/mcp_config.json` |
296
-
297
- ### Running the setup again
298
-
299
- ```bash
300
- codex-supervisor-setup # detect clients, install the skill, register the MCP
301
- codex-supervisor-setup --target claude,codex
302
- codex-supervisor-setup --skill-only
303
- codex-supervisor-setup --mcp-only
304
- codex-supervisor-setup --dry-run # print the plan only
305
- ```
306
-
307
- An existing skill with different content is backed up to `SKILL.md.bak-<timestamp>` before it is overwritten.
308
-
309
- ### Upgrading
236
+ ## Updating
310
237
 
311
- Nothing to do by hand. Every server start asks the registry in the background (then every six hours); when a newer version is published it starts a detached process that runs `npm i -g codex-supervisor-mcp@<that version>` into the same global path. **The running session is untouched; the next session starts on the new version.** Progress lands in `~/.codex-supervisor/data/auto-update.json` and `auto-update.log`, and tool results carry it as `update.auto_update` (`started / running / done / failed`).
238
+ 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>`.
312
239
 
313
- Only a copy that `npm i -g` installed is touched, and the updater checks the path against `npm root -g` first. A git checkout, an `npm link`, a project-local dependency and an `npx`-started copy are left alone. Each published version is attempted once, and several sessions starting together share one updater. `CODEX_SUPERVISOR_NO_AUTO_UPDATE=1` turns it off; CI is skipped automatically.
240
+ 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. A Node version switch breaks the registered path: `claude mcp remove -s user codex-supervisor`, `codex mcp remove codex-supervisor`, reinstall. To run the setup again: `codex-supervisor-setup` (`--skill-only` / `--mcp-only` / `--dry-run`).
314
241
 
315
- On a machine where the global directory needs sudo the install fails, the `update` field says why, and the manual way still works:
316
-
317
- ```bash
318
- npm install -g codex-supervisor-mcp@latest
319
- ```
320
-
321
- Versions up to 0.6.1 only notify and never install. Coming from one of those, upgrade by hand once; after that it is automatic. No re-registration needed.
322
-
323
- Manual-update pitfalls:
324
-
325
- - The registry takes a few minutes to move `latest` after a publish. If the version did not change, wait, or pin the version.
326
- - Switching Node versions breaks the registered absolute path. Run `claude mcp remove -s user codex-supervisor` and `codex mcp remove codex-supervisor` first, then install.
327
- - The skill takes care of itself: every server start copies the bundled skill into whichever of `~/.claude/skills/`, `~/.agents/skills/` and `~/.codex/skills/` already exist, backing up a differing file as `SKILL.md.bak-<timestamp>`. A session that already loaded the skill sees the new text only after loading it again. `CODEX_SUPERVISOR_SKIP_SKILL_SYNC=1` turns the sync off.
328
-
329
- ### Uninstall
242
+ Uninstall:
330
243
 
331
244
  ```bash
332
245
  npm uninstall -g codex-supervisor-mcp
333
246
  claude mcp remove -s user codex-supervisor
334
247
  codex mcp remove codex-supervisor
335
- rm -rf ~/.claude/skills/codex-supervisor ~/.agents/skills/codex-supervisor ~/.codex/skills/codex-supervisor
336
- rm -rf ~/.codex-supervisor
248
+ rm -rf ~/.claude/skills/codex-supervisor ~/.agents/skills/codex-supervisor ~/.codex/skills/codex-supervisor ~/.codex-supervisor
337
249
  ```
338
250
 
339
- ### Windows
251
+ ## Windows
340
252
 
341
- - The npm-installed CLI is `codex.cmd`, and Node refuses to spawn it directly since 18.20 / 20.12 (the behaviour after CVE-2024-27980). `shell: true` is not used, because cancelling would then only kill the shell. Instead the package's own entry, `node_modules/@openai/codex/bin/codex.js`, is started with `node`.
342
- - Cross-process cancel runs `taskkill /PID <pid> /T /F` on the whole tree, after `Get-CimInstance Win32_Process` confirms the pid runs codex.
343
- - Beyond `PATH` it probes `%APPDATA%\npm`, `%LOCALAPPDATA%\pnpm`, `%LOCALAPPDATA%\Volta\bin` and `%ProgramFiles%\nodejs`.
253
+ - 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.
254
+ - Cross-process cancel uses `taskkill /PID <pid> /T /F` for the whole tree, after confirming that pid runs codex.
255
+ - Besides `PATH`, `%APPDATA%\npm`, `%LOCALAPPDATA%\pnpm`, `%LOCALAPPDATA%\Volta\bin` and `%ProgramFiles%\nodejs` are probed.
344
256
 
345
- ### Troubleshooting
257
+ ## Troubleshooting
346
258
 
347
259
  | Symptom | Cause | Fix |
348
260
  |---|---|---|
349
261
  | Not in `claude mcp list` | The install method skipped `postinstall` | `codex-supervisor-setup`, or `claude mcp add` by hand |
350
262
  | 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` |
351
- | Worker is `failed` at once with `spawn codex ENOENT` | No `codex` on the process's `PATH` | Set `CODEX_BIN` in the config |
263
+ | Worker `failed` at once with `spawn codex ENOENT` | No codex on the process `PATH` | Set `CODEX_BIN` in the config |
352
264
  | `Cannot find module 'node:sqlite'` | Node older than 22.13.0 | Upgrade Node |
353
- | Worker stuck in `lost` | The MCP process was killed and the worker orphaned | `resume_codex_worker`, or dispatch again |
265
+ | Worker `lost` | The MCP process was killed and took the worker with it | `resume_codex_worker` |
266
+ | Worker reports `git add` failing with `index.lock: Operation not permitted` | The default sandbox keeps `.git` read-only | `land_codex_worker` with `commitMessage`, or dispatch with `danger-full-access` |
354
267
  | `ownedPaths overlap with active worker(s)` | Two workers claimed the same paths | Split differently, or cancel the one holding them |
355
- | The board is empty | The board and the MCP use different `SUPERVISOR_HOME`s | Start it inside a project with a `.mcp.json`, or pass the same `SUPERVISOR_HOME`; the second startup line names the store in use |
356
- | `port 7877 ... is already in use` | A board is already running | Open `http://127.0.0.1:7877`, or start a second one with `SUPERVISOR_WEB_PORT=8080` |
268
+ | 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` |
269
+ | `port 7877 ... is already in use` | A board is already running | Open it, or start another with `SUPERVISOR_WEB_PORT=8080` |
357
270
 
358
271
  ## Known limitations
359
272
 
360
- - A worker is a child of the MCP process. Kill the MCP and the worker goes with it, settled as `lost` on the next read. Its worktree and `thread_id` survive: `resume_codex_worker` continues the same thread. Keeping it alive across that takes a resident daemon; see the Roadmap.
361
- - In the default `workspace-write` sandbox a worker cannot commit: Codex keeps `.git` read-only. Either let it edit only and pass `commitMessage` to `land_codex_worker`, or dispatch with `danger-full-access`.
362
- - The worktree is cut from a commit, so uncommitted work in your checkout is not in it. Give the task absolute paths, or commit first.
363
- - Only the working directory is isolated. Temp directories, databases and ports are shared; workers that would hit the same dev server need to be kept apart in the task.
364
- - `ownedPaths` is checked at dispatch only; it does not stop a worker from creating a file it never listed. Review the diff.
365
- - It reports "finished", not "correct". `exit_code: 0` means it did not crash; acceptance is the main thread's job.
366
- - Do not expect one `wait_codex_workers` call to cover a long job. The client's MCP tool timeout is a hard wall; the default returns a snapshot after two minutes, loop instead.
367
- - Nothing is written to Codex's native goal store; `goals_1.sqlite` is read-only here. The worker creates its own goal and sometimes skips it, in which case `native_goal` is `null` and the state machine is unaffected.
368
- - `search_works` is substring matching. Fine at hundreds of rows; revisit at tens of thousands.
273
+ - A worker is a child of the MCP process. Kill the MCP and the worker goes with it, settled as `lost`; its worktree and `thread_id` survive and `resume_codex_worker` picks it up. Keeping it alive across that takes a resident daemon; see the Roadmap.
274
+ - In the default `workspace-write` sandbox a worker cannot commit (Codex keeps `.git` read-only). Either `land_codex_worker` with `commitMessage` commits for it, or dispatch with `danger-full-access`.
275
+ - The worktree is cut from a commit; uncommitted work in your checkout is not in it.
276
+ - Only the working directory is isolated. Temp directories, databases and ports are shared.
277
+ - `ownedPaths` is checked at dispatch only; it does not stop a worker from creating files outside its list. Read the diff.
278
+ - It knows "finished", not "correct". Acceptance is the main thread's job.
279
+ - One `wait_codex_workers` cannot wait to the end; the client's MCP tool timeout is a hard wall. Call it again.
280
+ - `search_works` is substring matching, fine for hundreds of works.
369
281
 
370
282
  ## Roadmap
371
283
 
372
- 1. ~~`CODEX_BIN` / `SUPERVISOR_HOME` / `GIT_BIN`~~ ✅
373
- 2. ~~`status` and `phase` split, `lost` added~~ ✅
374
- 3. ~~`ownedPaths` / `goal` / `dependsOn`, event gates~~ ✅
375
- 4. ~~`thread_id` on disk + `resume_codex_worker`~~ ✅
376
- 5. ~~Concurrency: crash points, ownership conflicts, multi-process writes~~ ✅
377
- 6. ~~`session_id` + `get_session_works`~~ ✅
378
- 7. ~~`search_works`~~ ✅
379
- 8. ~~Native worker goals~~ ✅
380
- 9. ~~Windows~~ ✅
381
- 10. ~~Web board~~ ✅
382
- 11. ~~Session titles, update check, `baseRef`, committed changes visible~~ ✅
383
- 12. ~~Collecting work: `get_worker_diff` / `ask_codex_worker` / `land_codex_worker`; background auto-update~~ ✅
384
- 13. Resident daemon: move dispatch and process lifetime out of the MCP process
385
-
386
- 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), a layered memory index (not enough data to need one).
284
+ 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.
285
+
286
+ Next: a resident daemon, moving dispatch and process lifetime out of the MCP process.
287
+
288
+ 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).
387
289
 
388
290
  ## Development
389
291
 
390
292
  ```bash
391
293
  npm install
392
- npm test # truncation, state machine, migration, setup, Windows routing, 23 regression cases, 40 edge cases
393
- npm run test:edge # test/edge only: update check against a fake registry, session titles, baseRef, non-ASCII paths, ghost rows, board API
394
- npm run test:real # end to end with the real codex CLI
395
- npm run smoke:mcp # MCP protocol smoke test
396
- npm run monitor # Ink terminal board
397
- npm run web:install # board dependencies
398
- npm run web:dev # board with hot reload, /api proxied to 7877
399
- npm run web:build # bundle into web/dist; runs before publish
294
+ npm test # fake-codex replay, fast and deterministic
295
+ npm run test:edge # test/edge only
296
+ npm run test:real # end to end against the real codex CLI
297
+ npm run web:dev # board development, /api proxied to 7877
298
+ npm run web:build # bundle to web/dist, runs before npm publish
400
299
  ```
401
300
 
402
- `npm test` replays fixed Codex event streams through `src/test-fixtures/fake-codex.js`, fast and deterministic; `npm run test:real` is the evidence of compatibility with the current Codex. CI runs Ubuntu / macOS / Windows plus one Node 22.13.0 job that pins the `engines` floor.
301
+ CI runs Ubuntu / macOS / Windows, plus a Node 22.13.0 job that pins the `engines` floor.
302
+
303
+ ## Contributing
304
+
305
+ 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).
403
306
 
404
307
  ## License
405
308