codex-supervisor-mcp 0.14.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/README.en.md +34 -45
  2. package/README.md +34 -45
  3. package/package.json +1 -1
  4. package/skills/codex-supervisor/SKILL.md +86 -90
  5. package/src/app/acceptance.js +5 -5
  6. package/src/app/auto-cleanup.js +6 -5
  7. package/src/app/cleanup-facts.js +7 -4
  8. package/src/app/cleanup-plan.js +3 -2
  9. package/src/app/context-compiler.js +2 -1
  10. package/src/app/dispatch.js +17 -15
  11. package/src/app/followup.js +5 -4
  12. package/src/app/land-chain.js +5 -4
  13. package/src/app/landing.js +8 -8
  14. package/src/app/ownership.js +1 -1
  15. package/src/app/rebase.js +1 -1
  16. package/src/app/restore-worktree.js +2 -1
  17. package/src/app/resume.js +6 -5
  18. package/src/app/worktree-setup.js +15 -14
  19. package/src/domain/acceptance-spec.js +1 -1
  20. package/src/domain/failure-class.js +2 -2
  21. package/src/domain/prompt.js +7 -7
  22. package/src/domain/status.js +9 -0
  23. package/src/domain/thread-health.js +2 -2
  24. package/src/domain/worker-branch.js +6 -0
  25. package/src/domain/worker-changes.js +3 -3
  26. package/src/infra/cleanup-hint.js +1 -1
  27. package/src/infra/external-output.js +2 -2
  28. package/src/infra/sandbox-roots.js +1 -1
  29. package/src/infra/store/events.js +2 -1
  30. package/src/infra/store/reconcile.js +4 -3
  31. package/src/infra/store/tasks.js +1 -1
  32. package/src/infra/update/auto-update-worker.js +3 -3
  33. package/src/infra/update/auto-update.js +4 -4
  34. package/src/infra/update/update-check.js +3 -3
  35. package/src/infra/workspace-kind.js +8 -8
  36. package/src/infra/worktree.js +4 -3
  37. package/src/interface/bin/acceptance-cli.js +4 -4
  38. package/src/interface/bin/monitor.jsx +6 -6
  39. package/src/interface/bin/setup.js +3 -3
  40. package/src/interface/bin/stage.js +2 -2
  41. package/src/interface/mcp/{tools → handlers}/delivery.js +30 -62
  42. package/src/interface/mcp/handlers/dispatch.js +233 -0
  43. package/src/interface/mcp/{tools → handlers}/facts.js +30 -65
  44. package/src/interface/mcp/handlers/overview.js +103 -0
  45. package/src/interface/mcp/{tools → handlers}/results.js +31 -60
  46. package/src/interface/mcp/{tools → handlers}/review.js +16 -36
  47. package/src/interface/mcp/{tools → handlers}/wait.js +8 -14
  48. package/src/interface/mcp/server.js +18 -51
  49. package/src/interface/mcp/tools/deliver.js +48 -0
  50. package/src/interface/mcp/tools/dispatch.js +78 -257
  51. package/src/interface/mcp/tools/optional.js +57 -0
  52. package/src/interface/mcp/tools/read.js +115 -0
  53. package/src/interface/mcp/tools/run.js +57 -0
  54. package/src/interface/mcp/tools/shapes.js +66 -0
  55. package/src/interface/mcp/tools/track.js +84 -0
  56. package/src/interface/mcp/views/task.js +8 -7
  57. package/src/interface/web/views.js +2 -1
  58. package/src/run-host/launch.js +7 -7
  59. package/src/runners/codex/tool-guard.js +6 -6
  60. package/src/domain/overview-delta.js +0 -77
  61. package/src/interface/mcp/tools/overview.js +0 -202
  62. package/src/interface/mcp/tools/poll.js +0 -58
package/README.en.md CHANGED
@@ -22,12 +22,12 @@ codex-supervisor-mcp is an MCP server. A main thread (Claude Code, Codex, or any
22
22
 
23
23
  | Problem | What it does |
24
24
  |---|---|
25
- | Workers step on each other's files | One worktree per worker; `ownedPaths` is checked for conflicts before dispatch |
25
+ | Workers step on each other's files | One worktree per worker; `owned_paths` is checked for conflicts before dispatch |
26
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 |
27
+ | A restart or a new session loses the workers | One SQLite row per work, with its `thread_id`; `resume_worker` rejoins the same Codex session |
28
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
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 |
30
+ | Changes sit on a local branch | `land_worker` merges into the integration branch; `verify_push` proves the commit is on the remote |
31
31
  | Worktrees pile up | Landed or unchanged ones are removed during polling. Unlanded work is kept for 7 days, and its uncommitted edits are committed to its branch before the worktree goes. Branches and evidence stay |
32
32
 
33
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.
@@ -56,15 +56,15 @@ Then say it in plain words in Claude Code:
56
56
  The skill walks the main thread through this:
57
57
 
58
58
  ```
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
59
+ preflight_worker run a probe in the same environment first
60
+ create_worker ×3 each with session, owned_paths, goal
61
+ wait_workers 60 seconds at most per call; call again until done
62
+ get_worker ×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_worker ×3 reviewed; commit on its behalf and land
65
65
  ```
66
66
 
67
- Workers never commit. Their changes stay on `codex/<taskId>` until the main thread has read the diff.
67
+ Workers never commit. Their changes stay on `worker/<taskId>` until the main thread has read the diff.
68
68
 
69
69
  To watch them work, open the board:
70
70
 
@@ -93,7 +93,7 @@ One block of text passes between the two sessions, pasted into the main-brain se
93
93
  [Background] Why this block exists, what the previous one left behind
94
94
  [Read first] Which sections of which documents, and which one wins when they disagree
95
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;
96
+ [Dispatch] find_works first so nothing is dispatched twice; one session.id for the batch;
97
97
  parallel only when write sets are disjoint; the verify command goes in acceptance too;
98
98
  a worker's word is not enough, the diff you read is
99
99
  [Red lines] What not to change, push or read
@@ -102,37 +102,26 @@ One block of text passes between the two sessions, pasted into the main-brain se
102
102
 
103
103
  ## Tools
104
104
 
105
- 39 of them. Arguments and edge cases are in the [reference](docs/reference.en.md#tools).
105
+ Fourteen by default. Arguments and edge cases are in the [reference](docs/reference.en.md#tools).
106
106
 
107
107
  | Stage | Tool | What it does |
108
108
  |---|---|---|
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 |
109
+ | Before dispatch | `preflight_worker` | Starts a short probe in the target worker's environment, or runs the acceptance commands for real first |
110
+ | Dispatch | `create_worker` | Dispatches one worker. With `followup_of` it builds on another worker's work |
111
+ | | `resume_worker` | Continues the same session, optionally rebased onto the new head first |
112
+ | | `cancel_worker` | Stops a worker |
113
+ | Tracking | `poll_workers` | Without a cursor, the whole table; with one, only what changed since, and it recovers a dead first run and removes worktrees that are safe to remove |
114
+ | | `wait_workers` | Waits for a result, 60 seconds at most per call |
115
+ | Collecting | `get_worker` | Reads one worker: summary, report, status, events, goal, whichever parts you ask for |
121
116
  | | `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` | Shows each worktree as SAFE, REVIEW or BLOCKED with the reason. SAFE ones are removed automatically; you can also remove one right away |
127
- | Sessions | `get_session_works` / `search_works` | Finds a batch again, or searches history by substring |
117
+ | | `ask_worker` | Asks the worker a side question. Read-only; its thread is untouched |
118
+ | Delivery | `land_worker` | Commits on the worker's behalf and cherry-picks onto the integration branch; refuses if acceptance failed |
119
+ | | `verify_push` | Proves the landed commit is on the remote. It verifies; it never pushes for you |
120
+ | | `cleanup` | Shows why a worktree is still there, or removes it now. Normally cleanup is automatic |
121
+ | Batches | `find_works` | Finds a batch again, or searches history by substring |
128
122
  | | `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 |
123
+
124
+ Three more are registered only with `AGENT_SUPERVISOR_TOOLS=all`: `facts` (the ledger of verified facts), `review` (an independent read-only verifier) and `get_artifact` (stored evidence). A normal batch never needs them, and leaving them out saves context in every session.
136
125
 
137
126
  ## How this differs from Claude Code subagents
138
127
 
@@ -142,8 +131,8 @@ A subagent can open its own worktree too, so file isolation is not the differenc
142
131
  |---|---|---|
143
132
  | Which models | Claude only | Anything the Codex CLI has a provider for |
144
133
  | Who does the work | Claude Code itself | A separate `codex exec` process |
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` |
134
+ | Two workers writing one file | No path declaration | `owned_paths` overlap is checked before dispatch and rejected |
135
+ | The main thread dies | The work cannot be collected | Workers and acceptance run to the end; a new window finds them again with `find_works` |
147
136
  | Who can drive it | Claude Code only | Any MCP client |
148
137
  | Seeing the process | Only the conclusion it returns | Raw JSONL and the web board |
149
138
 
@@ -156,7 +145,7 @@ Everything lives under `~/.codex-supervisor/`: `data/supervisor.sqlite` is the l
156
145
  | `SUPERVISOR_HOME` | `~/.codex-supervisor` | State root. The MCP server and the board must point at the same one |
157
146
  | `CODEX_BIN` | `codex` | Path to the Codex CLI. GUI clients often lack it on `PATH` |
158
147
  | `SUPERVISOR_WEB_PORT` | `7877` | Board port |
159
- | `CODEX_SUPERVISOR_NO_AUTO_UPDATE` | unset | `1` turns off background updates and only notifies |
148
+ | `AGENT_SUPERVISOR_NO_AUTO_UPDATE` | unset | `1` turns off background updates and only notifies |
160
149
 
161
150
  The remaining variables, the six worker states and the cache directories the sandbox opens by default are in the [reference](docs/reference.en.md).
162
151
 
@@ -179,9 +168,9 @@ rm -rf ~/.claude/skills/codex-supervisor ~/.agents/skills/codex-supervisor ~/.co
179
168
  | Worker `failed` at once, `spawn codex ENOENT` | No codex on the process `PATH` | Set `CODEX_BIN` |
180
169
  | `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` |
181
170
  | `Cannot find module 'node:sqlite'` | Node older than 22.13.0 | Upgrade Node |
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 |
171
+ | Worker is `lost` | The worker or its run process was killed | Read the events, then `resume_worker` |
172
+ | `git add` fails with `index.lock: Operation not permitted` | The sandbox makes `.git` read-only. That is the intended boundary | Let `land_worker` commit with `commit_message` |
173
+ | `owned_paths overlap with active worker(s)` | Two workers claimed the same paths | Split the work differently, or cancel the one holding them |
185
174
  | The board is empty | The board and the MCP server use different `SUPERVISOR_HOME` | Point both at the same directory |
186
175
  | `port 7877 ... is already in use` | A board is already running | Open that one, or change `SUPERVISOR_WEB_PORT` |
187
176
 
@@ -191,8 +180,8 @@ rm -rf ~/.claude/skills/codex-supervisor ~/.agents/skills/codex-supervisor ~/.co
191
180
  - Only the working directory is isolated. Temp directories, databases and ports are shared.
192
181
  - 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
182
  - 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.
183
+ - The client's MCP tool timeout is a hard wall, so one `wait_workers` call cannot wait to the end. Call it again.
184
+ - `find_works` is substring matching, which is enough for a few hundred works. Vector search is not planned.
196
185
 
197
186
  ## Development
198
187
 
package/README.md CHANGED
@@ -22,12 +22,12 @@ codex-supervisor-mcp 是一个 MCP server。主线程(Claude Code、Codex 或
22
22
 
23
23
  | 问题 | 做法 |
24
24
  |---|---|
25
- | 几个 worker 互相踩文件 | 一个 worker 一个 worktree,`ownedPaths` 在派单前查冲突 |
25
+ | 几个 worker 互相踩文件 | 一个 worker 一个 worktree,`owned_paths` 在派单前查冲突 |
26
26
  | worker 的输出塞爆主线程 | 事件写 JSONL,主线程只读压缩过的概览(全部 worker 不超过 7000 字节) |
27
- | 重启或换会话后接不上 | 每个 work 一行 SQLite,带 `thread_id`;`resume_codex_worker` 接回同一个 Codex 会话 |
27
+ | 重启或换会话后接不上 | 每个 work 一行 SQLite,带 `thread_id`;`resume_worker` 接回同一个 Codex 会话 |
28
28
  | 分不清跑失败还是进程没了 | 状态机把 `failed` 和 `lost` 分开,失败带来源和错误码 |
29
29
  | worker 说做完了其实没有 | 派单带 `acceptance` 验收命令,supervisor 在 worker 退出后自己跑,不过就拒绝合入 |
30
- | 改动留在本地没上线 | `land_codex_worker` 合回主分支,`verify_delivery_push` 核对远端真有这笔提交 |
30
+ | 改动留在本地没上线 | `land_worker` 合回主分支,`verify_push` 核对远端真有这笔提交 |
31
31
  | worktree 越堆越多 | 已合入或没有改动的在轮询时自动清;没合入的留 7 天,删之前先把未提交的改动存进它的分支。分支和证据不删 |
32
32
 
33
33
  worker 跑的是 `codex exec`,`model` 透传。主线程留在 Claude,worker 挂 DeepSeek 或别的 provider,账单分开算。
@@ -56,15 +56,15 @@ Claude Desktop、Cursor、Windsurf 这类 GUI 客户端要自己改 MCP 配置
56
56
  skill 会带着主线程走完这几步:
57
57
 
58
58
  ```
59
- preflight_codex_worker 先在同样的环境里跑一遍 probe
60
- create_codex_worker ×3 每路带 session_id、ownedPaths、goal
61
- wait_codex_workers 一次最多等 60 秒,没完接着等
62
- get_worker_result ×3 每路的汇报,带它真跑过的命令和退出码
63
- get_worker_diff ×3 它实际改了什么
64
- land_codex_worker ×3 核过了,代它提交并合入
59
+ preflight_worker 先在同样的环境里跑一遍 probe
60
+ create_worker ×3 每路带 session、owned_paths、goal
61
+ wait_workers 一次最多等 60 秒,没完接着等
62
+ get_worker ×3 每路的汇报,带它真跑过的命令和退出码
63
+ get_worker_diff ×3 它实际改了什么
64
+ land_worker ×3 核过了,代它提交并合入
65
65
  ```
66
66
 
67
- worker 自己不提交。它的改动留在 `codex/<taskId>` 分支,等主线程看过 diff 再合。
67
+ worker 自己不提交。它的改动留在 `worker/<taskId>` 分支,等主线程看过 diff 再合。
68
68
 
69
69
  想看着它们跑,开看板:
70
70
 
@@ -92,7 +92,7 @@ codex-supervisor-web # 或 npx -p codex-supervisor-mcp codex-supervisor-web
92
92
  【背景】 这一块为什么做,上一块留下了什么
93
93
  【先读】 哪几份文档的哪几节,说法冲突时以哪份为准
94
94
  【做什么】照任务书第几节那张表做,表里没有的不做
95
- 【派活】 先 search_works 查重;整批同一个 session_id;
95
+ 【派活】 先 find_works 查重;整批同一个 session.id;
96
96
  写入范围不重叠才并行;验证命令同时填 acceptance;
97
97
  worker 说过了不算,你看到 diff 才算
98
98
  【红线】 不改什么,不推什么,不读什么
@@ -101,37 +101,26 @@ codex-supervisor-web # 或 npx -p codex-supervisor-mcp codex-supervisor-web
101
101
 
102
102
  ## 工具
103
103
 
104
- 39 个。入参和边界见[参考手册](docs/reference.md#工具)。
104
+ 默认 14 个。入参和边界见[参考手册](docs/reference.md#工具)。
105
105
 
106
106
  | 阶段 | 工具 | 干什么 |
107
107
  |---|---|---|
108
- | 派单前 | `check_acceptance` | 先把验收命令真跑一遍,看它本身对不对 |
109
- | | `preflight_codex_worker` / `get_worker_preflight` | 用和目标 worker 相同的环境起一个短 probe,再读它的结果 |
110
- | 派单 | `create_codex_worker` | 派一路。必填 `ownedPaths` 和 `goal` |
111
- | | `create_codex_followup_worker` | 新会话接着父任务的成果干 |
112
- | | `resume_codex_worker` | 同一个 Codex 会话继续跑,可先 rebase 到主线新头 |
113
- | | `cancel_codex_worker` | 终止一路 |
114
- | 盯进度 | `overview_delta` | 默认轮询入口,只返回上次之后的变化 |
115
- | | `check_workers` | 报新结束的和出故障的,死掉的第一轮自动恢复一次 |
116
- | | `wait_codex_workers` | 等到有结果,单次最多 60 秒 |
117
- | | `get_orchestration_overview` / `list_codex_workers` | 全部 worker 的状态表 |
118
- | | `get_codex_worker_status` / `get_codex_worker_events` | 单路的状态细节和原始事件 |
119
- | 收活 | `get_worker_result` / `get_worker_summary` | worker 的汇报,长版和一段话版 |
108
+ | 派单前 | `preflight_worker` | 用和目标 worker 相同的环境起一个短 probe,或者先把验收命令真跑一遍 |
109
+ | 派单 | `create_worker` | 派一路。带 `followup_of` 就是接着另一路的成果干 |
110
+ | | `resume_worker` | 同一个会话继续跑,可先 rebase 到主线新头 |
111
+ | | `cancel_worker` | 终止一路 |
112
+ | 盯进度 | `poll_workers` | 不带 cursor 给全表;带 cursor 只给上次之后的变化,顺带恢复死掉的第一轮、清掉可清的 worktree |
113
+ | | `wait_workers` | 等到有结果,单次最多 60 秒 |
114
+ | 收活 | `get_worker` | 读一路:摘要、汇报、状态、事件、goal,要哪块取哪块 |
120
115
  | | `get_worker_diff` | 实际改动,按文件和 hunk 分页 |
121
- | | `get_worker_goal` | 派单时的 goal 和 Codex 原生 goal 的用量 |
122
- | | `ask_codex_worker` | 旁路问它一句,只读,不动它的线程 |
123
- | | `land_codex_worker` | 代提交并 cherry-pick 到集成分支,验收没过就拒 |
124
- | 交付 | `verify_delivery_push` | 证明合入的提交已经在远端。只验证,不替你 push |
125
- | | `cleanup_plan` / `apply_cleanup` / `cleanup_history` | 看每个 worktree 是 SAFE、REVIEW 还是 BLOCKED 以及原因;SAFE 项平时自动清,也可以手动立刻清 |
126
- | session | `get_session_works` / `search_works` | 找回一批活,或按关键字搜历史 |
116
+ | | `ask_worker` | 旁路问它一句,只读,不动它的线程 |
117
+ | 交付 | `land_worker` | 代提交并 cherry-pick 到集成分支,验收没过就拒 |
118
+ | | `verify_push` | 证明合入的提交已经在远端。只验证,不替你 push |
119
+ | | `cleanup` | 看某个 worktree 为什么还在,或立刻清掉。平时是自动清的 |
120
+ | 批次 | `find_works` | 找回一批活,或按关键字搜历史 |
127
121
  | | `describe_session` | 给一批活记标题、目标、默认验收和审批状态 |
128
- | 事实 | `search_worker_facts` / `get_fact` | 查已验证的事实和它的版本 |
129
- | | `promote_worker_fact` / `revoke_worker_fact` | 主线程把候选事实升为已验证,或撤销 |
130
- | | `get_context_snapshot_meta` | worker 开工时拿到了哪些上下文 |
131
- | | `get_worker_evidence` / `get_artifact` | 证据索引和单份证据 |
132
- | 复核 | `create_independent_verifier` | 起一个只读、断网的 verifier 重新检查 |
133
- | | `record_independent_finding` / `resolve_independent_finding` / `get_independent_review` | 记结论,记怎么收口,查整条记录 |
134
- | 其他 | `check_for_update` | 问 registry 有没有新版 |
122
+
123
+ 另有 3 个默认不注册,设 `AGENT_SUPERVISOR_TOOLS=all` 才出现:`facts`(已验证事实的台账)、`review`(起一个只读 verifier 独立复核)、`get_artifact`(读留存的证据)。日常派活用不到,不注册能省下每个会话的上下文。
135
124
 
136
125
  ## 和 Claude Code 的 subagent 有什么区别
137
126
 
@@ -141,8 +130,8 @@ subagent 自己也能开 worktree,所以文件隔离不算差别。差别在
141
130
  |---|---|---|
142
131
  | 能跑什么模型 | 只能选 Claude | Codex CLI 配了 provider 的都行 |
143
132
  | 干活的是谁 | Claude Code 自己 | 独立的 `codex exec` 进程 |
144
- | 两路写同一个文件 | 没有路径声明 | 派单前查 `ownedPaths` 交集,重叠直接拒 |
145
- | 主线程挂了 | 收不回来 | worker 和验收照常跑完,新窗口用 `session_id` 收 |
133
+ | 两路写同一个文件 | 没有路径声明 | 派单前查 `owned_paths` 交集,重叠直接拒 |
134
+ | 主线程挂了 | 收不回来 | worker 和验收照常跑完,新窗口用 `find_works` 找回 |
146
135
  | 谁能驱动 | 只有 Claude Code | 任何 MCP 客户端 |
147
136
  | 看过程 | 只有它返回的结论 | 原始 JSONL 和网页看板 |
148
137
 
@@ -155,7 +144,7 @@ subagent 自己也能开 worktree,所以文件隔离不算差别。差别在
155
144
  | `SUPERVISOR_HOME` | `~/.codex-supervisor` | 状态根目录。MCP 和看板要指同一个 |
156
145
  | `CODEX_BIN` | `codex` | Codex CLI 路径。GUI 客户端的 `PATH` 里常常没有它 |
157
146
  | `SUPERVISOR_WEB_PORT` | `7877` | 看板端口 |
158
- | `CODEX_SUPERVISOR_NO_AUTO_UPDATE` | 未设 | `1` 关掉后台自动更新,只提醒 |
147
+ | `AGENT_SUPERVISOR_NO_AUTO_UPDATE` | 未设 | `1` 关掉后台自动更新,只提醒 |
159
148
 
160
149
  其余变量、worker 的六种状态、沙箱默认放开哪些缓存目录,都在[参考手册](docs/reference.md)。
161
150
 
@@ -178,9 +167,9 @@ rm -rf ~/.claude/skills/codex-supervisor ~/.agents/skills/codex-supervisor ~/.co
178
167
  | worker 一起来就 `failed`,`spawn codex ENOENT` | 进程 `PATH` 里没有 codex | 设 `CODEX_BIN` |
179
168
  | `codex only resolved to a shell shim` | Windows 只找到 `.cmd`,包入口没了 | 重装 `@openai/codex`,或 `CODEX_BIN` 指到 `codex.js` |
180
169
  | `Cannot find module 'node:sqlite'` | Node 低于 22.13.0 | 升 Node |
181
- | worker `lost` | worker 或它的运行进程被杀了 | 查事件,`resume_codex_worker` 接回 |
182
- | `git add` 报 `index.lock: Operation not permitted` | 沙箱把 `.git` 设成只读,这是正常边界 | 让 `land_codex_worker` 带 `commitMessage` 代提交 |
183
- | `ownedPaths overlap with active worker(s)` | 两路认领了同一片路径 | 改拆法,或取消占着的那路 |
170
+ | worker `lost` | worker 或它的运行进程被杀了 | 查事件,`resume_worker` 接回 |
171
+ | `git add` 报 `index.lock: Operation not permitted` | 沙箱把 `.git` 设成只读,这是正常边界 | 让 `land_worker` 带 `commit_message` 代提交 |
172
+ | `owned_paths overlap with active worker(s)` | 两路认领了同一片路径 | 改拆法,或取消占着的那路 |
184
173
  | 看板是空的 | 看板和 MCP 的 `SUPERVISOR_HOME` 不一样 | 两边指同一个目录 |
185
174
  | `port 7877 ... is already in use` | 已经有一个看板在跑 | 直接开它,或换 `SUPERVISOR_WEB_PORT` |
186
175
 
@@ -190,8 +179,8 @@ rm -rf ~/.claude/skills/codex-supervisor ~/.agents/skills/codex-supervisor ~/.co
190
179
  - 只隔离工作目录。临时目录、数据库、端口是共用的。
191
180
  - 守卫拦直接写文件,但它不是文件沙箱。你声明放行的脚本可以有清单外的副作用,要靠 land 前的 diff 检查兜住。
192
181
  - `acceptance` 里写了什么就查什么,没写的不会替你查。剩下的靠主线程看 diff。
193
- - 客户端的 MCP 超时是硬墙,一次 `wait_codex_workers` 等不到底,只能反复调。
194
- - `search_works` 是子串匹配,几百条够用。向量检索不打算做。
182
+ - 客户端的 MCP 超时是硬墙,一次 `wait_workers` 等不到底,只能反复调。
183
+ - `find_works` 是子串匹配,几百条够用。向量检索不打算做。
195
184
 
196
185
  ## 开发
197
186
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codex-supervisor-mcp",
3
- "version": "0.14.0",
3
+ "version": "1.0.0",
4
4
  "mcpName": "io.github.zriyox/codex-supervisor-mcp",
5
5
  "type": "module",
6
6
  "description": "MCP server that dispatches and supervises parallel Codex CLI workers, one isolated Git worktree each, with a persisted work state machine.",
@@ -11,131 +11,127 @@ description: 用 Codex CLI 并行做可独立验收的功能包,每路一个 G
11
11
 
12
12
  适合能拆成几路、每路能单独验收的活,也适合耗时长、中途可能断、需要保留证据的工作。纯问答、单文件小改、需要频繁来回确认的活,主线程自己做更快。
13
13
 
14
+ ## 14 个工具
15
+
16
+ | 阶段 | 工具 |
17
+ |---|---|
18
+ | 派单前 | `preflight_worker` |
19
+ | 派单 | `create_worker`、`resume_worker`、`cancel_worker` |
20
+ | 盯进度 | `poll_workers`、`wait_workers` |
21
+ | 收活 | `get_worker`、`get_worker_diff`、`ask_worker` |
22
+ | 交付 | `land_worker`、`verify_push`、`cleanup` |
23
+ | 批次 | `find_works`、`describe_session` |
24
+
25
+ 参数全是 snake_case,写错名字会被直接拒绝,不会被悄悄忽略。失败的调用带 `isError` 和一个稳定的 `error` 码。`facts`、`review`、`get_artifact` 默认不开,要用时让用户设 `AGENT_SUPERVISOR_TOOLS=all`。
26
+
14
27
  ## 派单前必须确认
15
28
 
16
- 1. 先 `search_works`,确认没有重复派工。
29
+ 1. 先 `find_works`,确认没有重复派工。
17
30
  2. 按功能闭环拆包,不按 DTO、方法或单个测试拆。每路要有清楚的输入、产出和 acceptance。
18
- 3. `ownedPaths` 要覆盖完整写集:实现、测试、路由、注册表、DI、配置、迁移、i18n、模板接线都算。拿不准就给唯一模块目录。
19
- 4. 依赖必须提前放进 worktree。前端链接 `node_modules` 并执行 `nuxi prepare`;后端初始化 submodule。不要 sleep 抢时间,也不要等主线程事后补。
20
- 5. 写 worker 先跑同 contract 的 `preflight_codex_worker`。`get_worker_preflight` 必须是 `passed`,再把 preflight task id 填进 `preflight_id`。`check_acceptance` 不能代替 worker 环境预检。
21
- 6. 只要 worker 会 land,就必须有能证明结果的 acceptance。文件存在检查只能当附加条件,不能单独当完成证据。
22
- 7. `workspace-write` worker 不执行 `git add`、`git commit` 或 `amend`。验收通过后由主线程 `land_codex_worker(commitMessage)` 代提交并落地。
23
- worker acceptance 验功能与实际测试;Git 干净、提交数量和提交信息由主线程在 land 后检查,不能让未提交编辑的 worker 同时满足“必须无 diff”。契约冲突先报告规划/集成负责人修订,不手工 cherry-pick 或忽略门禁绕过。
24
- 8. worker 不 push、不合并、不再派生 worker。临时 `codex/<id>` 分支不是交付物。
25
-
26
- `preflight_id` 是 AI 派单硬规则。MCP schema 为了兼容旧客户端仍允许省略,但不能把“没被 schema 拒绝”当成可以跳过预检。
31
+ 3. `owned_paths` 要覆盖完整写集:实现、测试、路由、注册表、DI、配置、迁移、i18n、模板接线都算。拿不准就给唯一模块目录。
32
+ 4. 依赖必须提前放进 worktree,用 `workspace.setup`。前端链接 `node_modules` 并执行 `nuxi prepare`;后端初始化 submodule。不要等主线程事后补。
33
+ 5. 写 worker 先用同一套参数跑 `preflight_worker`(带 `probe_commands`)。`get_worker` 的 `include: ["preflight"]` 必须是 `passed`,再把那个 task id 填进 `preflight_id`。只给 `acceptance` 的 preflight 只是试跑验收命令,不能代替环境预检。
34
+ 6. 只要 worker 会 land,就必须有能证明结果的 acceptance。文件存在检查只能当附加条件。
35
+ 7. `workspace-write` worker 不执行 `git add`、`git commit` 或 `amend`。验收通过后由主线程 `land_worker` 带 `commit_message` 代提交并落地。Git 干净、提交数量和提交信息由主线程在 land 后检查。
36
+ 8. worker 不 push、不合并、不再派生 worker。`worker/<id>` 分支不是交付物。
27
37
 
28
- ## 标准派单
38
+ ## create_worker 的参数
29
39
 
30
- 前端示例,preflight 和目标 worker 必须使用同一份 contract:
40
+ 顶层:`task`、`cwd`、`owned_paths`、`goal`、`title`、`followup_of`、`depends_on`、`preflight_id`、`model`、`reasoning_effort`。其余按组放进对象:
31
41
 
32
42
  ```json
33
43
  {
34
- "workspaceSetup": {
35
- "links": [{ "path": "node_modules", "source": "node_modules" }],
36
- "submodules": true,
37
- "commands": ["npx nuxi prepare"]
38
- }
44
+ "task": "背景、文档出处、完整写集、验证命令、输出格式",
45
+ "cwd": "/repo",
46
+ "owned_paths": ["src/feature", "test/feature"],
47
+ "goal": { "objective": "一句话说清做完是什么样" },
48
+ "session": { "id": "batch-1", "title": "补单测" },
49
+ "workspace": {
50
+ "setup": {
51
+ "links": [{ "path": "node_modules", "source": "node_modules" }],
52
+ "submodules": true,
53
+ "commands": ["npx nuxi prepare"]
54
+ }
55
+ },
56
+ "sandbox": { "allowed_commands": ["pnpm vitest run test/feature/*"] },
57
+ "acceptance": { "commands": ["pnpm vitest run test/feature"] }
39
58
  }
40
59
  ```
41
60
 
42
- `package.json` 项目如果用 `npm`、`pnpm`、`vitest`、`vue-tsc`、`eslint`、`nuxi` 等本地工具做验收,却没传 `workspaceSetup`,supervisor 会直接返回 `workspace_setup_required`。
43
-
44
- ## 关键参数
45
-
46
61
  | 参数 | 怎么填 |
47
62
  |---|---|
48
- | `task` | 写清目标、背景、要改的交付面、边界和验收。不要写“优化一下”。最终报告格式由 supervisor 追加,不在这里重复 |
49
- | `cwd` | Git 项目根,或非 Git 输入目录;实际执行目录由 `workspaceKind` 决定 |
50
- | `workspaceKind` | Git 代码默认 `git_worktree`;非 Git 只读用 `read_only_in_place`;联网研究用 `scratch`;明确授权修改非 Git 目录才用 `in_place_write` |
51
- | `workspaceSetup` | Git worktree 启动前准备依赖。支持 `links`、`submodules`、`commands`。`links.source` 按 `cwd` 解析,也可写绝对路径;链接 `node_modules` 时会给 `.vite`、`.vite-temp`、`.cache` 可写缓存根 |
52
- | `ownedPaths` | 必填。完整写入范围;不同 worker 的写入范围不能重叠。读取不排他。`[]` 只用于不 land 的只读或研究 worker |
53
- | `sandbox` | 默认 `workspace-write`。这个沙箱不能 commit,这是正常边界;不要为了提交改用 `danger-full-access` |
54
- | `preflight_id` | 写 worker 必填。preflight 的 base、`workspaceKind`、`sandbox`、`workspaceSetup`、`ownedPaths`、命令、context、contracts、network、可写根有任何变化都要重跑 |
55
- | `acceptance` | worker 退出后由 supervisor 在 worktree 里执行。worker 自查统一运行 `node "$CODEX_SUPERVISOR_ACCEPTANCE_CLI"`,不要手抄到 zsh;CLI 只读状态库,不需要也不能写 supervisor 数据。每个检查必须真实证明功能 |
56
- | `allowedCommands` | 声明会执行、会写入或有副作用的验证命令。read 命令有安全白名单;命令末尾 `*` 表示只匹配单条命令的前缀 |
57
- | `forbid` | 明确禁止的命令片段。forbid 优先于 allowedCommands 和 acceptance |
58
- | `goal.objective` | 必填。worker 会创建 Codex 原生 goal |
59
- | `goal.tokenBudget` | 可选。不传就是不限预算,worker 必须完全省略 `token_budget`;传 `0`、`1` 或 `null` 会被 runtime guard 拒绝 |
60
- | `session_id` | 同一批使用同一个值。它只负责分组、默认验收和审批,不会把同批 worker 的上下文互相注入 |
61
- | `session_title` | 建议 30 字内,schema 上限 120 字;漏了可用 `describe_session` 补 |
62
- | `dependsOn` | 填上游 task id。上游必须成功结算、acceptance 通过并 `land_codex_worker`,且本路 base 包含上游 landed head |
63
- | `baseRef` | worktree 从哪个提交切。下一步要包含上一步时,填 `codex/<task_id>` 或已集成分支 |
64
-
65
- 派 `create_codex_worker` 后,回执不回传 task 原文。回执至少带 `id`、`worktree_path`、`branch`、`owned_paths`、`status`;有 base、session、failure 或 run log 时也会返回。
66
-
67
- ## worker 形状
68
-
69
- | 形状 | 参数 | 用途 |
63
+ | `task` | 写清目标、背景、要改的交付面、边界和验收。最终报告格式由 supervisor 追加,不在这里重复 |
64
+ | `owned_paths` | 完整写入范围;不同 worker 不能重叠,读取不排他。`[]` 只用于不 land 的只读或研究 worker |
65
+ | `goal.objective` | worker 会创建 Codex 原生 goal。`goal.token_budget` 不传就是不限;别传 `0`、`1` 或 `null` |
66
+ | `session.id` | 同一批用同一个值。只负责分组、默认验收和审批,不会把同批 worker 的上下文互相注入 |
67
+ | `workspace.kind` | Git 代码默认 `git_worktree`;非 Git 只读用 `read_only_in_place`;联网研究用 `scratch`;明确授权才用 `in_place_write` |
68
+ | `workspace.base_ref` | worktree 从哪个提交切。要包含上一步时填上一路的 `worker/<task_id>` 或已集成分支 |
69
+ | `workspace.setup` | `links.source` 按 `cwd` 解析,也可写绝对路径。验收用了 npm、pnpm、vitest、eslint、nuxi 这类本地工具却没给 setup,会直接返回 `workspace_setup_required` |
70
+ | `sandbox.mode` | 默认 `workspace-write`。这个沙箱不能 commit,是正常边界;不要为了提交改用 `danger-full-access` |
71
+ | `sandbox.allowed_commands` | 会执行、会写入或有副作用的验证命令。只读命令有白名单;末尾 `*` 表示前缀匹配 |
72
+ | `sandbox.forbid` | 明确禁止的命令片段,优先于 allowed_commands 和 acceptance |
73
+ | `acceptance.commands` | worker 退出后由 supervisor 在 worktree 里执行,全部退出 0 才算过。worker 自查统一跑 `node "$AGENT_SUPERVISOR_ACCEPTANCE_CLI"`,不要手抄命令 |
74
+ | `depends_on` | 上游 task id。上游必须已结算、验收通过并 land,且本路 base 包含它 |
75
+ | `followup_of` | 接着一路已结束的 worker 干:从它的分支切新 worktree,没给的参数沿用它的 |
76
+ | `preflight_id` | 写 worker 必填。base、workspace、sandbox、owned_paths、context 有任何变化都要重跑 preflight |
77
+
78
+ 回执不回传 task 原文,带 `id`、`worktree_path`、`branch`、`owned_paths`、`status`。
79
+
80
+ | worker 形状 | 参数 | 用途 |
70
81
  |---|---|---|
71
- | Git 编辑 | `workspaceKind: "git_worktree"`、非空 `ownedPaths` | 改代码、跑 acceptance、等待主线程 land |
72
- | 只读验收 | `workspaceKind: "read_only_in_place"`、`sandbox: "read-only"`、`ownedPaths: []` | 无写入、无网络,只给结论 |
73
- | 联网研究 | `workspaceKind: "scratch"`、`workspace-write`、`networkAccess: true`、`ownedPaths: []` | 可以 curl/gh,只写 supervisor 管理的 scratch,永不 land |
74
- | 非 Git 写入 | `workspaceKind: "in_place_write"`、授权、完整 `ownedPaths`、acceptance | 只改明确授权的非 Git 目录,不能 land |
82
+ | Git 编辑 | 默认 workspace,非空 `owned_paths` | 改代码、跑 acceptance、等主线程 land |
83
+ | 只读验收 | `workspace.kind: "read_only_in_place"`、`sandbox.mode: "read-only"`、`owned_paths: []` | 无写入、无网络,只给结论 |
84
+ | 联网研究 | `workspace.kind: "scratch"`、`sandbox.network_access: true`、`owned_paths: []` | 可以 curl/gh,只写 scratch,永不 land |
85
+ | 非 Git 写入 | `workspace.kind: "in_place_write"`、`workspace.in_place_authorization`、acceptance | 只改明确授权的非 Git 目录 |
75
86
 
76
87
  ## 等待与状态
77
88
 
78
- - 日常增量看 `overview_delta`,保存 `next_cursor`。需要全量状态时才用 `get_orchestration_overview`。
79
- - 短等用 `wait_codex_workers`,默认最多60秒、`compact: true`;`timeout_capped` 表示长请求被限为短等,`still_running` 只表示预算用完。仅确认宿主允许长调用时才传 `allowLongWait: true`;已有后台 wait 就接回,不重复创建。
80
- - 长任务用宿主 `/loop 5m check_workers`。不同主线程设置不同的 `CODEX_SUPERVISOR_OBSERVER_ID`。
81
- - `check_workers` 在活跃线程超过交接阈值时每个 run 提醒一次;先看状态与 stage,等当前步骤结算或明确取消后再整理 checkpoint 接续,不能因 token 多重复起同一任务。
82
- - `idle_seconds` 是距上一条 Codex 事件的时间。`command_running: true` 时长命令可能仍在跑;没有命令且长时间无事件,再查 `get_codex_worker_events`。
83
- - 不要用 shell 循环 grep `data/runs/*.jsonl` 判断状态。`failed`、`lost`、退出码和恢复状态以 supervisor 状态机为准。
89
+ - `poll_workers` 不带 `cursor` 返回全表和一个 `next_cursor`,只读,不启动任何东西。
90
+ - 带上那个 `cursor` 再调,只返回这之后的变化:`transitions` 里是结束、失败或需要关注的 worker 和下一步;`quiet: true` 表示没事发生。带 cursor 的调用还会顺带做两件事:把已死的第一轮恢复一次,把可以清的 worktree 清掉。
91
+ - 长任务用宿主 `/loop 5m` 调带 cursor 的 `poll_workers`。cursor 存在状态库里,主线程重启后接着用。
92
+ - 短等用 `wait_workers`,一次最多 60 秒;`timeout_capped` 表示请求被限成短等,`still_running` 只表示预算用完。确认宿主允许长调用才传 `allow_long_wait: true`。
93
+ - `idle_seconds` 是距上一条事件的时间。`command_running: true` 时长命令可能还在跑;没有命令又长时间无事件,再用 `get_worker` 的 `include: ["events"]` 查。
94
+ - 活跃线程超过交接阈值时每个 run 提醒一次;先看状态,等当前步骤结算或明确取消后再用 `followup_of` 接续,不要因为 token 多就重复起同一个任务。
95
+ - 不要用 shell 循环 grep `data/runs/*.jsonl` 判断状态,以 supervisor 状态机为准。
84
96
 
85
97
  ## 收活顺序
86
98
 
87
- 1. 先看 `acceptance`。失败时把 `checks[].output_tail` 原样带回 resume,不改验收标准。
88
- 2. 读 `get_worker_result`。注意 `commands_run`、命令退出码和 `last_command_failed`,不要只听结论。
89
- 3. 读 `get_worker_diff`。默认先看文件和 hunk 索引,再按 `file` + `hunk`/`cursor` 分页读 patch。
90
- 4. 对不上就问 `ask_codex_worker`。旁路只读,不改 worker 线程。
91
- 5. 要改就 `resume_codex_worker`。不要要求 worker commit 或 amend;主线前进时按需带 `rebaseOnto: "HEAD"`。原生 goal 未明确 complete 或状态不可读时,supervisor 续跑省略 output schema,避免 `ActiveTurnOutputSchemaMismatch`。
92
- 6. 验收和 diff 都过了,用 `land_codex_worker({commitMessage})` 把未提交改动提交到 worker 分支并 cherry-pick 到当前集成分支。
93
-
94
- `create_codex_followup_worker` 在父任务未 land 时从其 `codex/<parent>` 当前提交起新 worktree;父任务已 land 则用当前集成 HEAD,显式 `baseRef` 优先。父 worktree 未提交改动留在原任务,checkpoint 丢失时先恢复或明确选新 base。整条接续链先审各路 acceptance 和 diff,再用 `land_codex_worker({includeFollowupParents: true, commitMessages: { [task_id]: "..." }})` 按 root-first 落地;途中失败保留已落地部分,修复后重调,不手工压 WIP。
95
-
96
- 零改动祖先可跳过;`ignoreAcceptance` / `allowOutsideOwned` 只对指定 leaf 生效,不豁免祖先的验收或写入范围。
97
-
98
- `invalid_report` 不是业务失败。常见情况是单个字符串字段、缺一个 `]`/`}`,或内容完整但 schema 不合规。先让 `check_workers` 做一次 report-only 修复;仍失败时,acceptance 通过且 diff 审过,可以显式 land。报告只是摘要,不是交付证据。
99
+ 1. `get_worker` 的 `include: ["result"]`:先看 `acceptance`,再看它真跑过的命令和退出码。失败时把 `checks[].output_tail` 原样带回 resume,不改验收标准。
100
+ 2. `get_worker_diff`:先看文件和 hunk 索引,再按 `file` + `hunk` / `cursor` 分页读 patch。它说做了什么不算,diff 里有才算。
101
+ 3. 对不上就 `ask_worker`。旁路只读,不改 worker 线程。
102
+ 4. 要改就 `resume_worker`。主线前进时带 `rebase_onto: "HEAD"`。原生 goal 未明确 complete 时,续跑会省略 output schema,避免 `ActiveTurnOutputSchemaMismatch`。
103
+ 5. 验收和 diff 都过了,`land_worker` 带 `commit_message`。
99
104
 
100
- ## 上下文与事实
105
+ 接续链:整条链先审各路 acceptance 和 diff,再 `land_worker` 带 `include_followup_parents: true` 和 `commit_messages`,按 root-first 落地;途中失败保留已落地部分,修复后重调。`ignore_acceptance`、`allow_outside_owned` 只对指定的那一路生效,只在用户明说时用。
101
106
 
102
- - worker capsule 只在新派单或 resume 时生成。默认注入 L0 身份、当前任务、依赖摘要和路径/SHA 命中的 verified facts。
103
- - `session_id` peers、完整事件、完整 diff、历史报告和 candidate facts 不会自动注入。
104
- - 主线程看事实摘要用 `search_worker_facts`;追溯来源用 `get_fact`;看证据索引用 `get_worker_evidence` / `get_artifact`。
105
- - worker 的报告先记为 candidate。只有 supervisor acceptance 通过后,才有资格成为当前 work 的 verified outcome。
106
- - schema-free resume 的纯文本报告只留 candidate;合成的 verification/not_done 空数组不是已验证结论。
107
- - base SHA、watched path、context hash 或 in-place manifest 变化后,旧 fact 会过期并从后续 capsule 排除。
107
+ `invalid_report` 不是业务失败,通常是报告 JSON 不合规。带 cursor 的 `poll_workers` 会自动让它重发一次;仍失败时,acceptance 通过且 diff 审过,可以直接 land。报告只是摘要,不是交付证据。
108
108
 
109
109
  ## 中断与恢复
110
110
 
111
111
  | 情况 | 处理 |
112
112
  |---|---|
113
- | 主线程挂了 | worker 的独立 run host 会继续记录日志、状态和验收。新窗口用 `get_session_works` 接回 |
114
- | worker 变 `lost` | 当前 run 有 durable `turn.completed` 且 worker/run host 均退出时,reconcile 恢复 completed;验收中断仍需重跑。确实中断才 resume,worktree、改动和 thread id 都保留 |
115
- | worktree 落后主线 | `resume_codex_worker` 带 `rebaseOnto: "HEAD"` |
113
+ | 主线程挂了 | worker 的独立进程会继续记录日志、状态和验收。新窗口用 `find_works` 按 session 接回 |
114
+ | worker 变 `lost` | 确实中断才 `resume_worker`;worktree、改动和线程都保留 |
115
+ | worktree 落后主线 | `resume_worker` 带 `rebase_onto: "HEAD"` |
116
116
  | worker 失败 | 先看 `failure.source` 和 `error`,区分 provider、supervisor、workspace setup、model output、acceptance、worker process |
117
- | 没有 thread id 的旧行 | 用 `create_codex_followup_worker`,通过文本重述上下文 |
117
+ | worktree 被清掉了 | 照常 `resume_worker` / `land_worker` / `get_worker_diff` / `ask_worker`,会从分支切回来 |
118
118
 
119
- `check_workers` 会自动恢复一次已死的第一轮 `lost`、`no_work` 或 `invalid_report`,不会盲重试审批、认证、权限、quota 或时间限制。`completed` 但 `exit_code: null` 是中间态;验收已跑完的 durable 事件会优先于 PID 推断。
119
+ 审批、认证、权限、quota 和时间限制造成的停顿不会被自动重试。
120
120
 
121
121
  ## 落地、push 和清理
122
122
 
123
- `land_codex_worker` 只完成本地集成,不等于远端交付。
123
+ `land_worker` 只完成本地集成,不等于远端交付。
124
124
 
125
- 1. 主线程自己的改动要 commit 并 push。用户批准的集成分支也要在 push 后核对远端 SHA。
126
- 2. worker 分支通常不 push。只有用户明确要求保留远端 worker 分支时再推。
127
- 3. push 后用 `verify_delivery_push` 证明 landed head 已到远端。
128
- 4. 清理是自动的:`check_workers` / `overview_delta` 会顺带删掉已合入或没有改动的 worktree,返回里的 `cleaned` 就是删了哪些。不用为清理调任何工具。
129
- 5. 没合入的活保留 7 天;到期先把未提交改动存进 `codex/<id>` 分支再删。还想要的活在这之前 land 或 resume。
130
- 6. worktree 被清掉后照常 `resume_codex_worker` / `land_codex_worker` / `get_worker_diff`,会自动从分支切回来。
131
- 7. 想立刻清:`cleanup_plan` 看判定,`apply_cleanup(plan_id, item_ids)` 清 SAFE 项。branch、task、event、JSONL、artifact 永远保留。
125
+ 1. 主线程自己的改动要 commit 并 push。集成分支 push 后用 `verify_push` 证明 landed head 已到远端。它只验证,不替你 push。
126
+ 2. worker 分支通常不 push。
127
+ 3. 清理是自动的:已合入或没有改动的 worktree 在轮询时直接删;没合入的保留 7 天,到期先把未提交改动存进它的分支再删。分支、事件、日志、证据永远保留。
128
+ 4. 想知道某个 worktree 为什么还在,或想立刻清:`cleanup` 的 `action: "plan"` 看判定,`action: "apply"` 带 `plan_id` 和 `item_ids` 清 SAFE 项。
132
129
 
133
130
  ## 常见坑
134
131
 
135
- - worktree 从提交创建。主工作区未提交的依赖不会被 worker 看到,先 commit 或用受控 context。
132
+ - worktree 从提交创建。主工作区未提交的东西 worker 看不到,先 commit。
136
133
  - `exit_code: 0` 不等于业务完成;acceptance 和 diff 才是证据。
137
- - `ownedPaths` 的写冲突在派单时预留。运行时 guard 会拦直接文件写入,land 会再查完整 diff;声明脚本仍可能有清单外副作用,不能把它当完整文件系统沙箱。
138
- - worktree 只隔离工作目录。端口、数据库、临时目录和其它外部资源仍可能共享。
139
- - `resume_codex_worker` 不会再次创建 goal。
140
- - 看板用 `codex-supervisor-web` 打开 `http://127.0.0.1:7877`。看板只观察,不派单、不取消。
134
+ - `owned_paths` 的冲突在派单时预留,运行时守卫拦直接写文件,land 再查完整 diff。你放行的脚本仍可能有清单外的副作用,它不是文件系统沙箱。
135
+ - worktree 只隔离工作目录。端口、数据库、临时目录仍然共享。
136
+ - 看板用 `codex-supervisor-web` 打开 `http://127.0.0.1:7877`。看板只看,不派单、不取消。
141
137
  - 安装或升级后要重开会话,MCP 和 skill 才会加载新版本。
@@ -44,7 +44,7 @@ async function readCheckEvidence(check, cwd, checkId, baseCommit) {
44
44
  const path = resolve(cwd, check.reportPath);
45
45
  const canonical = await realpath(path);
46
46
  const outside = relative(root, canonical);
47
- if (outside === ".." || outside.startsWith(`..${process.platform === "win32" ? "\\" : "/"}`) || isAbsolute(outside)) throw new Error("reportPath escapes the worktree");
47
+ if (outside === ".." || outside.startsWith(`..${process.platform === "win32" ? "\\" : "/"}`) || isAbsolute(outside)) throw new Error("report_path escapes the worktree");
48
48
  const info = await lstat(path);
49
49
  if (!info.isFile() || info.isSymbolicLink() || info.size > 1024 * 1024) throw new Error("report must be a regular file of at most 1 MiB");
50
50
  const report = JSON.parse(await readFile(path, "utf8"));
@@ -221,9 +221,9 @@ export async function runAcceptance(commands, options = {}) {
221
221
  ...env,
222
222
  NO_COLOR: "1",
223
223
  CI: env.CI ?? "1",
224
- CODEX_SUPERVISOR_TASK_ID: taskId ?? "",
225
- CODEX_SUPERVISOR_BASE_COMMIT: baseCommit ?? "",
226
- CODEX_SUPERVISOR_RUN: run == null ? "" : String(run)
224
+ AGENT_SUPERVISOR_TASK_ID: taskId ?? "",
225
+ AGENT_SUPERVISOR_BASE_COMMIT: baseCommit ?? "",
226
+ AGENT_SUPERVISOR_RUN: run == null ? "" : String(run)
227
227
  };
228
228
  for (const check of normalizeAcceptance(commands) ?? []) {
229
229
  const command = typeof check === "string" ? check : check.command;
@@ -233,7 +233,7 @@ export async function runAcceptance(commands, options = {}) {
233
233
  const checkId = randomUUID();
234
234
  const result = await runOne(command, {
235
235
  cwd,
236
- env: { ...checkEnv, CODEX_SUPERVISOR_CHECK_ID: checkId },
236
+ env: { ...checkEnv, AGENT_SUPERVISOR_CHECK_ID: checkId },
237
237
  timeoutMs,
238
238
  onSpawn: (kill) => {
239
239
  control.kill = kill;