agent-supervisor-mcp 2.0.1 → 2.0.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.md +122 -120
- package/README.ru.md +209 -0
- package/README.zh-CN.md +208 -0
- package/package.json +1 -1
- package/src/app/acceptance.js +2 -2
- package/src/app/start-run.js +89 -2
- package/src/domain/worker-preflight.js +11 -0
- package/src/infra/bin-resolver.js +5 -0
- package/src/infra/process.js +7 -2
- package/src/interface/bin/setup.js +4 -1
- package/src/run-host/entry.js +35 -3
- package/src/run-host/track.js +4 -4
- package/src/runners/codex/adapter.js +16 -2
- package/README.en.md +0 -208
package/README.en.md
DELETED
|
@@ -1,208 +0,0 @@
|
|
|
1
|
-
# agent-supervisor-mcp
|
|
2
|
-
|
|
3
|
-
English | [中文](README.md)
|
|
4
|
-
|
|
5
|
-
[](https://www.npmjs.com/package/agent-supervisor-mcp)
|
|
6
|
-
[](https://www.npmjs.com/package/agent-supervisor-mcp)
|
|
7
|
-
[](LICENSE)
|
|
8
|
-
[](https://github.com/zriyox/agent-supervisor-mcp/actions/workflows/ci.yml)
|
|
9
|
-
[](package.json)
|
|
10
|
-
|
|
11
|
-
Website [agent-supervisor.zriyo.com](https://agent-supervisor.zriyo.com) · for models [llms.txt](https://agent-supervisor.zriyo.com/llms.txt) · [reference](docs/reference.en.md)
|
|
12
|
-
|
|
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
|
-
agent-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
|
-
|
|
17
|
-

|
|
18
|
-
|
|
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
|
-
|
|
21
|
-
> **This package used to be codex-supervisor-mcp.** It was renamed because a worker is no longer only Codex. A machine with the old package is brought over by its last release: this package is installed, the MCP registration and the skill become `agent-supervisor`, and the state directory stays where it is. The command line tools change prefix from `codex-supervisor-` to `agent-supervisor-`.
|
|
22
|
-
>
|
|
23
|
-
> **Upgrading from 0.x to 1.x**: 39 tools became 14, with new names and arguments and no aliases for the old ones. Finish the workers in flight first, then reopen the session after upgrading so the new skill loads. The tool table is in the [reference](docs/reference.en.md); what changed is in the [1.0.0 release](https://github.com/zriyox/agent-supervisor-mcp/releases/tag/v1.0.0).
|
|
24
|
-
|
|
25
|
-
## What it solves
|
|
26
|
-
|
|
27
|
-
| Problem | What it does |
|
|
28
|
-
|---|---|
|
|
29
|
-
| Workers step on each other's files | One worktree per worker; `owned_paths` is checked for conflicts before dispatch |
|
|
30
|
-
| Worker output floods the main thread | Events go to JSONL; the main thread reads a compressed overview (every worker in under 7000 bytes) |
|
|
31
|
-
| 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 |
|
|
32
|
-
| 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 |
|
|
33
|
-
| 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 |
|
|
34
|
-
| Changes sit on a local branch | `land_worker` merges into the integration branch; `verify_push` proves the commit is on the remote |
|
|
35
|
-
| 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 |
|
|
36
|
-
|
|
37
|
-
A worker is a `codex exec` process by default 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.
|
|
38
|
-
|
|
39
|
-
A worker can also be Claude Code: pass `runner: "claude"` to `create_worker`. It has no OS sandbox, so it runs only in a git worktree or read-only, and it has no side chat (`ask_worker`); dispatch, acceptance, resume, landing and cleanup are the same. To add another CLI, see [docs/runner.md](docs/runner.md).
|
|
40
|
-
|
|
41
|
-
## Five minutes to a running batch
|
|
42
|
-
|
|
43
|
-
You need Node.js 22.13.0 or newer and the `codex` CLI on `PATH`. macOS, Linux and Windows all work.
|
|
44
|
-
|
|
45
|
-
```bash
|
|
46
|
-
npm install -g agent-supervisor-mcp
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
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 `agent-supervisor-setup`, or add it by hand:
|
|
50
|
-
|
|
51
|
-
```bash
|
|
52
|
-
claude mcp add -s user agent-supervisor -- npx -y agent-supervisor-mcp
|
|
53
|
-
codex mcp add agent-supervisor -- npx -y agent-supervisor-mcp
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
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/agent-supervisor-mcp`.
|
|
57
|
-
|
|
58
|
-
Then say it in plain words in Claude Code:
|
|
59
|
-
|
|
60
|
-
> Fill in the unit tests for these three modules. Use agent-supervisor, three workers in parallel, call the session "unit tests".
|
|
61
|
-
|
|
62
|
-
The skill walks the main thread through this:
|
|
63
|
-
|
|
64
|
-
```
|
|
65
|
-
preflight_worker run a probe in the same environment first
|
|
66
|
-
create_worker ×3 each with session, owned_paths, goal
|
|
67
|
-
wait_workers 60 seconds at most per call; call again until done
|
|
68
|
-
get_worker ×3 each worker's report, with the commands it ran and their exit codes
|
|
69
|
-
get_worker_diff ×3 what it actually changed
|
|
70
|
-
land_worker ×3 reviewed; commit on its behalf and land
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
Workers never commit. Their changes stay on `worker/<taskId>` until the main thread has read the diff.
|
|
74
|
-
|
|
75
|
-
To watch them work, open the board:
|
|
76
|
-
|
|
77
|
-
```bash
|
|
78
|
-
agent-supervisor-web # or: npx -p agent-supervisor-mcp agent-supervisor-web
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
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.
|
|
82
|
-
|
|
83
|
-
## How I use it
|
|
84
|
-
|
|
85
|
-
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.
|
|
86
|
-
|
|
87
|
-
| Who | Where | Does what |
|
|
88
|
-
|---|---|---|
|
|
89
|
-
| Me | | Decide what to build, make the calls, read the reports |
|
|
90
|
-
| Planning session | The requirements and docs repository | Talk through the requirement, write the design, write one brief per block of work |
|
|
91
|
-
| Main-brain session | A worktree of the code repository | Read the brief, dispatch workers, check diffs, report to me. Writes no business code |
|
|
92
|
-
| Codex workers | Their own worktrees | One worker per independently verifiable feature package. No commit, no push |
|
|
93
|
-
|
|
94
|
-
One block of text passes between the two sessions, pasted into the main-brain session and handed over with `/goal`:
|
|
95
|
-
|
|
96
|
-
```text
|
|
97
|
-
[Role] You are the main brain: dispatch workers, check results, update docs, report to me.
|
|
98
|
-
You write no business code. Load the agent-supervisor skill first.
|
|
99
|
-
[Background] Why this block exists, what the previous one left behind
|
|
100
|
-
[Read first] Which sections of which documents, and which one wins when they disagree
|
|
101
|
-
[Do] Follow the table in section N of the brief. Nothing outside the table
|
|
102
|
-
[Dispatch] find_works first so nothing is dispatched twice; one session.id for the batch;
|
|
103
|
-
parallel only when write sets are disjoint; the verify command goes in acceptance too;
|
|
104
|
-
a worker's word is not enough, the diff you read is
|
|
105
|
-
[Red lines] What not to change, push or read
|
|
106
|
-
[Report] Tables first, then stop and wait for me
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
## Tools
|
|
110
|
-
|
|
111
|
-
Fourteen by default. Arguments and edge cases are in the [reference](docs/reference.en.md#tools).
|
|
112
|
-
|
|
113
|
-
| Stage | Tool | What it does |
|
|
114
|
-
|---|---|---|
|
|
115
|
-
| Before dispatch | `preflight_worker` | Starts a short probe in the target worker's environment, or runs the acceptance commands for real first |
|
|
116
|
-
| Dispatch | `create_worker` | Dispatches one worker. With `followup_of` it builds on another worker's work |
|
|
117
|
-
| | `resume_worker` | Continues the same session, optionally rebased onto the new head first |
|
|
118
|
-
| | `cancel_worker` | Stops a worker |
|
|
119
|
-
| 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 |
|
|
120
|
-
| | `wait_workers` | Waits for a result, 60 seconds at most per call |
|
|
121
|
-
| Collecting | `get_worker` | Reads one worker: summary, report, status, events, goal, whichever parts you ask for |
|
|
122
|
-
| | `get_worker_diff` | The actual changes, paged by file and hunk |
|
|
123
|
-
| | `ask_worker` | Asks the worker a side question. Read-only; its thread is untouched |
|
|
124
|
-
| Delivery | `land_worker` | Commits on the worker's behalf and cherry-picks onto the integration branch; refuses if acceptance failed |
|
|
125
|
-
| | `verify_push` | Proves the landed commit is on the remote. It verifies; it never pushes for you |
|
|
126
|
-
| | `cleanup` | Shows why a worktree is still there, or removes it now. Normally cleanup is automatic |
|
|
127
|
-
| Batches | `find_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
|
-
|
|
130
|
-
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.
|
|
131
|
-
|
|
132
|
-
## How this differs from Claude Code subagents
|
|
133
|
-
|
|
134
|
-
A subagent can open its own worktree too, so file isolation is not the difference. The model and the process are.
|
|
135
|
-
|
|
136
|
-
| | Claude Code subagent | agent-supervisor worker |
|
|
137
|
-
|---|---|---|
|
|
138
|
-
| Which models | Claude only | Anything the Codex CLI has a provider for |
|
|
139
|
-
| Who does the work | Claude Code itself | A separate `codex exec` process |
|
|
140
|
-
| Two workers writing one file | No path declaration | `owned_paths` overlap is checked before dispatch and rejected |
|
|
141
|
-
| 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` |
|
|
142
|
-
| Who can drive it | Claude Code only | Any MCP client |
|
|
143
|
-
| Seeing the process | Only the conclusion it returns | Raw JSONL and the web board |
|
|
144
|
-
|
|
145
|
-
## Configuration and state
|
|
146
|
-
|
|
147
|
-
Everything lives under `~/.agent-supervisor` (a machine upgraded from codex-supervisor-mcp that already has `~/.codex-supervisor` keeps using it): `data/supervisor.sqlite` is the ledger, `data/runs/<taskId>.jsonl` is Codex's raw output, and `worktrees/<taskId>/` holds each worker's checkout.
|
|
148
|
-
|
|
149
|
-
| Variable | Default | What it does |
|
|
150
|
-
|---|---|---|
|
|
151
|
-
| `SUPERVISOR_HOME` | `~/.agent-supervisor` | State root. The MCP server and the board must point at the same one |
|
|
152
|
-
| `CODEX_BIN` | `codex` | Path to the Codex CLI. GUI clients often lack it on `PATH` |
|
|
153
|
-
| `SUPERVISOR_WEB_PORT` | `7877` | Board port |
|
|
154
|
-
| `AGENT_SUPERVISOR_NO_AUTO_UPDATE` | unset | `1` turns off background updates and only notifies |
|
|
155
|
-
|
|
156
|
-
The remaining variables, the six worker states and the cache directories the sandbox opens by default are in the [reference](docs/reference.en.md).
|
|
157
|
-
|
|
158
|
-
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.
|
|
159
|
-
|
|
160
|
-
Uninstall:
|
|
161
|
-
|
|
162
|
-
```bash
|
|
163
|
-
npm uninstall -g agent-supervisor-mcp
|
|
164
|
-
claude mcp remove -s user agent-supervisor
|
|
165
|
-
codex mcp remove agent-supervisor
|
|
166
|
-
rm -rf ~/.claude/skills/agent-supervisor ~/.agents/skills/agent-supervisor ~/.codex/skills/agent-supervisor ~/.agent-supervisor
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
## Troubleshooting
|
|
170
|
-
|
|
171
|
-
| Symptom | Cause | Fix |
|
|
172
|
-
|---|---|---|
|
|
173
|
-
| Missing from `claude mcp list` | The install did not run `postinstall` | `agent-supervisor-setup` |
|
|
174
|
-
| Worker `failed` at once, `spawn codex ENOENT` | No codex on the process `PATH` | Set `CODEX_BIN` |
|
|
175
|
-
| `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` |
|
|
176
|
-
| `Cannot find module 'node:sqlite'` | Node older than 22.13.0 | Upgrade Node |
|
|
177
|
-
| Worker is `lost` | The worker or its run process was killed | Read the events, then `resume_worker` |
|
|
178
|
-
| Worker is `timed_out` | Its time budget ran out and it was stopped | Read what it left; `resume_worker` after a per-run limit, `followup_of` with new `limits` after the total one |
|
|
179
|
-
| `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` |
|
|
180
|
-
| `owned_paths overlap with active worker(s)` | Two workers claimed the same paths | Split the work differently, or cancel the one holding them |
|
|
181
|
-
| The board is empty | The board and the MCP server use different `SUPERVISOR_HOME` | Point both at the same directory |
|
|
182
|
-
| `port 7877 ... is already in use` | A board is already running | Open that one, or change `SUPERVISOR_WEB_PORT` |
|
|
183
|
-
|
|
184
|
-
## Known limitations
|
|
185
|
-
|
|
186
|
-
- A worktree is cut from a commit. Uncommitted changes in your checkout are not in it.
|
|
187
|
-
- Only the working directory is isolated. Temp directories, databases and ports are shared.
|
|
188
|
-
- 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.
|
|
189
|
-
- Acceptance checks what you wrote in `acceptance` and nothing else. The rest is the main thread reading the diff.
|
|
190
|
-
- The client's MCP tool timeout is a hard wall, so one `wait_workers` call cannot wait to the end. Call it again.
|
|
191
|
-
- `find_works` is substring matching, which is enough for a few hundred works. Vector search is not planned.
|
|
192
|
-
|
|
193
|
-
## Development
|
|
194
|
-
|
|
195
|
-
```bash
|
|
196
|
-
npm install
|
|
197
|
-
npm test # fake-codex replay, under a minute
|
|
198
|
-
npm run test:real # real codex CLI end to end; needs a logged-in codex
|
|
199
|
-
npm run web:dev # board development, /api proxied to 7877
|
|
200
|
-
```
|
|
201
|
-
|
|
202
|
-
CI runs on Ubuntu, macOS and Windows, plus a Node 22.13.0 job that pins the lower bound of `engines`.
|
|
203
|
-
|
|
204
|
-
To contribute, read [CONTRIBUTING.en.md](CONTRIBUTING.en.md). Security reports go through the [private channel](https://github.com/zriyox/agent-supervisor-mcp/security/advisories/new); see [SECURITY.md](SECURITY.md).
|
|
205
|
-
|
|
206
|
-
## License
|
|
207
|
-
|
|
208
|
-
MIT
|