omp-worker-mcp 0.1.0 → 0.2.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.
package/README.md CHANGED
@@ -1,263 +1,430 @@
1
- <div align="center">
2
-
3
- # omp-worker-mcp
4
-
5
- **Durable Model Context Protocol (MCP) server for delegating asynchronous coding tasks and DAG workflows to local Oh My Pi (OMP) CLI sub-agents.**
6
-
7
- <p align="center">
8
- <a href="README.md">English</a> •
9
- <a href="README.zh-CN.md">简体中文</a>
10
- </p>
11
-
12
- [![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
13
- [![Node.js](https://img.shields.io/badge/node-%3E%3D22.0.0-brightgreen.svg)](package.json)
14
- [![CI](https://github.com/divenire990/omp-worker-mcp/actions/workflows/ci.yml/badge.svg)](https://github.com/divenire990/omp-worker-mcp/actions/workflows/ci.yml)
15
- [![MCP Protocol](https://img.shields.io/badge/MCP-1.30.0-orange.svg)](https://modelcontextprotocol.io/)
16
- [![M8ven Score](https://m8ven.ai/badge/mcp/divenire990-omp-worker-mcp-4fc9xm?v=4dd1b4cec6489cf043b8630c80138c73)](https://m8ven.ai/mcp/divenire990-omp-worker-mcp-4fc9xm)
17
-
18
- <br />
19
-
20
- <img src="assets/orchestration.gif" alt="Async DAG Orchestration Flow" width="800" />
21
-
22
- <p align="center">
23
- <em>Asynchronous task execution, DAG dependency resolution, path ownership isolation, and structured result verification.</em>
24
- </p>
25
-
26
- [Quick Start](#installation-quick-start) • [Author Experience](#author-workflow-experience) • [MCP Configuration](#mcp-client-configuration) • [Configuration](#configuration-environment-variables) • [State Lifecycle](#state-lifecycle-retention-restart-recovery) • [Available Tools](#available-mcp-tools) • [Safety Contract](#task-safety-ownership-contract) • [Compatibility](#compatibility-changelog) • [Upstream Attribution](#upstream-attribution-support-boundaries)
27
-
28
- </div>
29
-
30
- ---
31
-
32
- ## Key Highlights
33
-
34
- - ⚡ **Asynchronous Delegated Execution**: Offload heavy coding, refactoring, and exploration tasks to background OMP worker instances without blocking your main conversation session.
35
- - 🔀 **Topological DAG Orchestration**: Execute interdependent batch tasks with automatic topological sorting, concurrency control, and dependency propagation.
36
- - 🛡️ **Workspace Path Isolation**: Enforce explicit write-path boundaries and prevent overlapping file modifications between concurrent tasks.
37
- - 🔍 **Supervised Resumption & Envelopes**: Inspect interim logs in real time, extract structured JSON outcome envelopes (`OMP_WORKER_RESULT`), and supply supervisory guidance to retry or adjust tasks.
38
- - 💾 **Persistent State & Configurable Retention**: File-backed state persistence for job metadata and logs with configurable time-to-live (TTL) and disk capacity bounds.
39
-
40
- ---
41
-
42
- ## Author Workflow Experience
43
-
44
- In the author's daily local workflow, `omp-worker-mcp` is configured with **Gemini 3.7 Flash** as the underlying model for background OMP workers. Within the author's personal Antigravity account and quota environment, where model quotas are relatively generous, this setup has provided a very fast and dependable subjective experience across multi-step coding, research, and batch orchestration workflows.
45
-
46
- > **Disclaimer & Boundary Notice**:
47
- > This note reflects the author's personal setup and qualitative workflow experience only. It is **not** an independent benchmark, performance guarantee, or formal service commitment. Model availability, generation speed, quota allocations, and task execution quality vary significantly across different accounts, regions, model versions, task scopes, and local runtime environments. Neither Google Gemini nor Antigravity endorses or sponsors this project.
48
-
49
- ---
50
-
51
- ## Upstream Attribution & Support Boundaries
52
-
53
- - **External Upstream CLI**: This project interfaces with [Oh My Pi (OMP)](https://github.com/can1357/oh-my-pi), an open-source tool released under the [MIT License](https://github.com/can1357/oh-my-pi/blob/main/LICENSE).
54
- - **Package Scope**: The upstream OMP CLI binary is **not bundled** in this package. Users must install and configure their own local instance of the OMP CLI.
55
- - **Runtime Requirements**:
56
- - Node.js **>= 22.0.0** (relies on native ECMAScript Modules and standard library capabilities).
57
- - Users are responsible for complying with the OMP CLI license and terms applicable to their environment.
58
- - **Platform Support**:
59
- - **Windows** (win32) and **macOS** (Darwin / Apple Silicon, verified with real Node 22+ and OMP CLI E2E testing) are fully verified and supported.
60
- - **Linux** (x86_64, aarch64) is an architectural design target and remains to be verified in production environments.
61
- ---
62
-
63
- ## Features
64
-
65
- - **Asynchronous Task Delegation**: Launch background coding workers for long-running workflows while keeping the primary conversational agent responsive.
66
- - **DAG & Batch Orchestration**: Run interdependent batch tasks with automatic dependency resolution, concurrency limiting, and failure containment.
67
- - **Strict Task Safety & Ownership**: Built-in validation checks prevent parallel tasks from declaring overlapping write paths within the same workspace.
68
- - **Continuous Supervision & Feedback**: Stream logs, inspect structured verification details, and inject guidance into failed or blocked jobs.
69
- - **Conservative State Storage**: Safely persists job metadata, prompts, and output logs to disk with optional configurable cleanup policies.
70
-
71
- ---
72
-
73
- ## Installation & Quick Start
74
-
75
- ### Current Installation: Building from Source
76
-
77
- Before the package is published to the npm registry, building and running from source is the currently available path:
78
-
79
- ```bash
80
- # 1. Clone the repository
81
- git clone https://github.com/divenire990/omp-worker-mcp.git
82
- cd omp-worker-mcp
83
-
84
- # 2. Install dependencies
85
- npm ci
86
-
87
- # 3. Build TypeScript to dist/
88
- npm run build
89
-
90
- # 4. Run test suite
91
- npm test
92
- ```
93
-
94
- ### Post-Publish Quick Start: Running via npx or global npm install
95
-
96
- Once published to the npm registry, you can run `omp-worker-mcp` directly without cloning the repository:
97
-
98
- ```bash
99
- # Run directly via npx (post-publish)
100
- npx omp-worker-mcp
101
-
102
- # Or install globally (post-publish)
103
- npm install -g omp-worker-mcp
104
- omp-worker-mcp --help
105
- ```
106
-
107
- ## MCP Client Configuration
108
-
109
- `omp-worker-mcp` communicates over standard I/O (stdio). Below are configuration examples for various MCP clients.
110
-
111
- ### Codex Configuration (`config.toml`)
112
-
113
- #### Using Local Source Build (Currently Available)
114
- ```toml
115
- [mcp_servers.omp-worker]
116
- command = "node"
117
- args = ["/path/to/omp-worker-mcp/dist/index.js"]
118
-
119
- [mcp_servers.omp-worker.env]
120
- OMP_WORKER_OMP_COMMAND = "omp"
121
- ```
122
-
123
- #### Using npx (Available Once Published to npm)
124
- ```toml
125
- [mcp_servers.omp-worker]
126
- command = "npx"
127
- args = ["-y", "omp-worker-mcp"]
128
-
129
- [mcp_servers.omp-worker.env]
130
- OMP_WORKER_OMP_COMMAND = "omp"
131
- ```
132
-
133
- ### Claude Desktop Configuration (`claude_desktop_config.json`)
134
-
135
- #### Using Local Source Build (Currently Available)
136
- ```json
137
- {
138
- "mcpServers": {
139
- "omp-worker": {
140
- "command": "node",
141
- "args": ["/path/to/omp-worker-mcp/dist/index.js"],
142
- "env": {
143
- "OMP_WORKER_OMP_COMMAND": "omp"
144
- }
145
- }
146
- }
147
- }
148
- ```
149
-
150
- #### Using npx (Available Once Published to npm)
151
- ```json
152
- {
153
- "mcpServers": {
154
- "omp-worker": {
155
- "command": "npx",
156
- "args": ["-y", "omp-worker-mcp"],
157
- "env": {
158
- "OMP_WORKER_OMP_COMMAND": "omp"
159
- }
160
- }
161
- }
162
- }
163
- ```
164
-
165
- ---
166
-
167
- ## Configuration & Environment Variables
168
-
169
- All settings can be configured via environment variables in your system or within the MCP client configuration.
170
-
171
- | Variable | Description | Default |
172
- | :--- | :--- | :--- |
173
- | `OMP_WORKER_OMP_COMMAND` | Path or executable name for the OMP CLI binary. | `omp` |
174
- | `OMP_WORKER_OMP_PREFIX_ARGS` | JSON array string of arguments prepended to OMP CLI invocations (e.g. `["--profile", "default"]`). | `[]` |
175
- | `OMP_WORKER_STATE_DIR` | Base directory for storing job states, prompt files, and execution logs. | `~/.codex/state/omp-worker` |
176
- | `OMP_WORKER_BROWSER_RULES` | Optional custom browser automation instructions injected into worker prompts. | *(none)* |
177
- | `OMP_WORKER_RETENTION_TTL_SECONDS` | Optional retention TTL in seconds for terminal job/group records. Unset disables TTL cleanup. | *(none)* |
178
- | `OMP_WORKER_RETENTION_MAX_BYTES` | Optional maximum disk storage in bytes for terminal records. Unset disables size cleanup. | *(none)* |
179
- | `OMP_WORKER_AUTO_CLEANUP_ON_START` | Optional boolean (`"true"` / `"1"`) to trigger a cleanup sweep once when MCP server starts. | `false` |
180
-
181
- ---
182
-
183
- ## State Lifecycle, Retention & Restart Recovery
184
-
185
- ### On-Disk Directory Layout
186
-
187
- All state records are stored under `OMP_WORKER_STATE_DIR` (defaults to `~/.codex/state/omp-worker`):
188
- ```text
189
- ~/.codex/state/omp-worker/
190
- ├── jobs/
191
- │ └── job-<timestamp>-<hash>/
192
- │ ├── job.json # Job metadata, parameters, and status
193
- │ ├── cancel.request.json # Cancellation signal (if requested)
194
- │ ├── attempt-01.prompt.md # Generated prompt for attempt 1
195
- │ ├── stdout.log # Execution standard output
196
- │ └── stderr.log # Execution standard error
197
- └── groups/
198
- └── group-<timestamp>-<hash>/
199
- ├── group.json # Batch DAG metadata, tasks, and status
200
- └── cancel.request.json # Group cancellation signal (if requested)
201
- ```
202
-
203
- ### Retention and Cleanup Policies
204
-
205
- - **Conservative by Default**: By default, `omp-worker-mcp` **never automatically deletes completed or historical records**, preventing unexpected data loss.
206
- - **Explicit Cleanup Rules**: Users can opt in to automatic retention by setting `OMP_WORKER_RETENTION_TTL_SECONDS` (pruning terminal records older than N seconds) or `OMP_WORKER_RETENTION_MAX_BYTES` (pruning oldest terminal records when total disk usage exceeds threshold).
207
- - **Protection for Active Jobs**: Non-terminal records (`dispatched`, `running`, `pending`, `validating`, `cancelling`) are **strictly protected and never pruned**.
208
- - **Corrupted Record Protection**: Any record that cannot be verified as terminal is preserved to prevent accidental deletion. Symbolic links within state directories are rejected and never traversed.
209
- - **Transparent Diagnostics**: Cleanup failures or permission issues are surfaced in structured error logs rather than silently ignored.
210
-
211
- ### Server Restart & Crash Recovery
212
-
213
- - **Metadata Persistence**: Job and DAG group metadata are written atomically to disk. Dispatched and completed task records remain fully accessible across server restarts via `omp_result` and `omp_wait`.
214
- - **Process Decoupling**: If the MCP server restarts while an external worker process is executing, the server does not attempt unmanaged re-attachment to orphaned processes; the persisted state and captured logs accurately reflect the recorded state.
215
-
216
- ---
217
-
218
- ## Available MCP Tools
219
-
220
- ### Single Task Delegation Tools
221
-
222
- | Tool | Purpose |
223
- | :--- | :--- |
224
- | `omp_run_compact` | **Recommended for single tasks**: Delegates a coding task and waits up to `wait_seconds` for completion in one turn, returning a compact summary. |
225
- | `omp_delegate` | Low-level dispatch: Spawns an asynchronous background worker and immediately returns a `job_id`. |
226
- | `omp_wait` | Waits for a running background job to finish or poll until a timeout is reached. |
227
- | `omp_result` | Inspects full attempt history, execution logs, generated artifacts, and parsed structured outcome envelopes. |
228
- | `omp_continue` | Injects supervisory guidance/correction into a failed or blocked task to trigger a new attempt within the same session. |
229
- | `omp_cancel` | Gracefully terminates a running task and its spawned child process tree. |
230
-
231
- ### Batch & DAG Orchestration Tools
232
-
233
- | Tool | Purpose |
234
- | :--- | :--- |
235
- | `omp_run_batch_compact` | **Recommended for multi-task workflows**: Spawns an interdependent batch task graph (DAG) with concurrency limits and waits for aggregated completion. |
236
- | `omp_wait_group` | Waits for an asynchronous batch task group to make progress or complete. |
237
- | `omp_cancel_group` | Cancels all active and queued tasks within a batch task group. |
238
-
239
- ---
240
-
241
- ## Task Safety & Ownership Contract
242
-
243
- 1. **Write vs. Read-Only Boundaries**:
244
- - `write` tasks must explicitly declare the file paths they own via `ownership_paths`.
245
- - `read_only` tasks are prohibited from performing workspace modifications.
246
- 2. **DAG Overlap Verification**:
247
- - Parallel tasks within the same batch cannot declare overlapping write boundaries.
248
- - Tasks operating on shared paths must declare explicit linear dependencies (`depends_on`).
249
- 3. **Structured Verification Contract**:
250
- - Subagents deliver final results using the structured `OMP_WORKER_RESULT` format, returning status, summary, modified artifacts, verification checks, and remaining items.
251
-
252
- ---
253
-
254
- ## Compatibility & Changelog
255
-
256
- - **Upgrade & Versioning Policies**: Review [COMPATIBILITY.md](./COMPATIBILITY.md) for public contract definitions, deprecation policies, and upgrade guarantees.
257
- - **Release History**: Review [CHANGELOG.md](./CHANGELOG.md) for notable changes across releases.
258
-
259
- ---
260
-
261
- ## License
262
-
263
- This project is licensed under the [MIT License](LICENSE).
1
+ <div align="center">
2
+
3
+ # omp-worker-mcp
4
+
5
+ **Let your main AI agent plan and review — and hand the hands-on coding to local [Oh My Pi](https://github.com/can1357/oh-my-pi) workers.**
6
+
7
+ An MCP server that turns ChatGPT, Codex, Claude Code, Cursor and other MCP clients into a *supervisor*,<br />
8
+ and Oh My Pi (OMP) on your own machine into its background *workforce*.
9
+
10
+ [![npm version](https://img.shields.io/npm/v/omp-worker-mcp.svg)](https://www.npmjs.com/package/omp-worker-mcp)
11
+ [![CI](https://github.com/divenire990/omp-worker-mcp/actions/workflows/ci.yml/badge.svg)](https://github.com/divenire990/omp-worker-mcp/actions/workflows/ci.yml)
12
+ [![Node.js](https://img.shields.io/badge/node-%3E%3D22-brightgreen.svg)](package.json)
13
+ [![MCP Registry](https://img.shields.io/badge/MCP%20Registry-io.github.divenire990%2Fomp--worker--mcp-6f42c1.svg)](server.json)
14
+ [![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
15
+
16
+ English · [简体中文](README.zh-CN.md) · [Documentation](docs/README.md)
17
+
18
+ <br />
19
+
20
+ <img src="assets/how-it-works.svg" alt="The supervisor agent delegates tasks to omp-worker-mcp, which runs OMP workers in the background and returns structured results for review" width="860" />
21
+
22
+ [Quick start](#quick-start) · [Usage](#usage) · [Tools](#tools) · [Configuration](#configuration) · [Safety model](#safety-model) · [FAQ](#faq)
23
+
24
+ </div>
25
+
26
+ ---
27
+
28
+ ## What it does
29
+
30
+ Most coding agents do everything in one place: read the code, plan, edit, run tests, fix — all inside one conversation and one model's budget. `omp-worker-mcp` splits that work into two roles:
31
+
32
+ | Role | Who | Responsibility |
33
+ | :--- | :--- | :--- |
34
+ | **Supervisor** | The agent you talk to: ChatGPT, Codex, Claude Code, Cursor… | Understands the request, splits the work, writes acceptance criteria, reviews the results |
35
+ | **Worker** | The OMP CLI on your machine, using the model you picked in `omp setup` | Reads files, edits code, runs shell commands and tests, reports back |
36
+
37
+ `omp-worker-mcp` is the bridge between them. It gives the supervisor a small set of MCP tools, starts OMP in the background, keeps every job on disk, and returns a short structured report instead of a wall of logs.
38
+
39
+ **Highlights**
40
+
41
+ - **One task or a whole plan** — `omp_run_compact` delegates a single task; `omp_run_batch_compact` runs up to 50 tasks as a dependency graph (DAG), up to 10 at a time.
42
+ - **Declared write-scope validation** — parallel write tasks in a batch must declare the paths they own; overlapping declared scopes and dependency cycles are rejected before any worker starts (a scheduling check and prompt constraint, not an OS filesystem lock).
43
+ - **Results you can review** — every worker finishes with an `OMP_WORKER_RESULT` envelope: status, summary, changed files, verification evidence and remaining items.
44
+ - **Correct instead of restart** — `omp_continue` sends feedback to the *same* OMP session, so the worker keeps its context.
45
+ - **Persistent jobs** — job records, logs and results live on disk and can still be read after the MCP server restarts.
46
+ - **Works from ChatGPT on the web** — through OpenAI's Secure MCP Tunnel: no inbound port, plus an allowlist (`OMP_WORKER_ALLOWED_ROOTS`, available since `0.2.0`; npm `0.1.1` lacks this feature) for the directories jobs may run in.
47
+
48
+ ## When to use it
49
+
50
+ **A good fit when**
51
+
52
+ - you want a strong model to make the decisions while a faster or cheaper model does the typing;
53
+ - the task is big enough to hand off: a feature, a bug fix with tests, a multi-module refactor, a long read-only investigation;
54
+ - you want several parts of a repo worked on in parallel without agents overwriting each other;
55
+ - you think with ChatGPT and want it to act on files on your own machine.
56
+
57
+ **Probably not worth it when**
58
+
59
+ - the change is one line or the question is quick — the supervisor's own tools are faster;
60
+ - you need a real OS-level sandbox. This project controls *where* jobs start and *what* they are told to touch, not what OMP is technically able to do (see [Safety model](#safety-model)).
61
+
62
+ ---
63
+
64
+ ## Quick start
65
+
66
+ **You need:** Node.js ≥ 22 · [Oh My Pi](https://github.com/can1357/oh-my-pi) installed · an MCP client (Codex, Claude Code, Cursor, ChatGPT, …).
67
+
68
+ ### 1. Install and set up OMP
69
+
70
+ Install OMP by following [its official instructions](https://github.com/can1357/oh-my-pi), then:
71
+
72
+ ```bash
73
+ omp --version # confirm the CLI is on your PATH
74
+ omp setup # sign in and choose the default model
75
+ ```
76
+
77
+ The default model you pick here is the model every worker will use. (Advanced: set `modelRoles.default: <provider>/<model>` in `~/.omp/agent/config.yml`.)
78
+
79
+ > If `omp` is not on your `PATH`, set `OMP_WORKER_OMP_COMMAND` to the full path of the executable in the MCP config below.
80
+
81
+ ### 2. Register the MCP server in your client
82
+
83
+ There is nothing to install globally — the client runs the published package with `npx -y omp-worker-mcp`. Pick your client:
84
+
85
+ <details open>
86
+ <summary><b>Codex</b> — the author's daily setup</summary>
87
+
88
+ Edit `~/.codex/config.toml` (Windows: `C:\Users\<you>\.codex\config.toml`):
89
+
90
+ ```toml
91
+ [mcp_servers.omp-worker]
92
+ command = "npx"
93
+ args = ["-y", "omp-worker-mcp"]
94
+
95
+ [mcp_servers.omp-worker.env]
96
+ OMP_WORKER_OMP_COMMAND = "omp"
97
+
98
+ # Optional (Codex Code Mode only): let Codex call omp-worker tools directly
99
+ # without code-mode wrapping. Per the current Codex config reference, merge into
100
+ # your existing [features.code_mode] table (do not create a duplicate table header)
101
+ # and append "mcp__omp_worker" while preserving any other list entries:
102
+ [features.code_mode]
103
+ direct_only_tool_namespaces = ["mcp__omp_worker"]
104
+ ```
105
+
106
+ *(If `[features.code_mode]` already exists in your `config.toml`, merge into that table and append `"mcp__omp_worker"` to `direct_only_tool_namespaces` rather than duplicating the table or overwriting existing entries. Legacy Codex builds used a top-level `direct_only_tool_namespaces = ["mcp__omp_worker"]` key before any `[table]` header. Neither setting is required to register the MCP server; see [Codex direct namespace setup](docs/author-workflow.md#codex-direct-namespace-setup) and the [official Codex Config Reference](https://learn.chatgpt.com/docs/config-file/config-reference).)*
107
+
108
+ </details>
109
+
110
+ <details>
111
+ <summary><b>ChatGPT (web)</b> — via Secure MCP Tunnel</summary>
112
+
113
+ > **Version requirement (`>= 0.2.0`):** `OMP_WORKER_ALLOWED_ROOTS` is available since `omp-worker-mcp` `0.2.0` (historical npm `0.1.1` lacks this feature and does not enforce `OMP_WORKER_ALLOWED_ROOTS`). Confirm `npx -y omp-worker-mcp@latest --version` reports `0.2.0` or newer before exposing local execution remotely.
114
+
115
+ Run the server locally behind OpenAI's `tunnel-client`; your machine only makes outbound connections.
116
+
117
+ ```bash
118
+ export OMP_WORKER_OMP_COMMAND=omp
119
+ export OMP_WORKER_ALLOWED_ROOTS='["/Users/you/Projects"]' # strongly recommended for remote access (available since 0.2.0; 0.1.1 lacks this feature)
120
+ export CONTROL_PLANE_API_KEY='<runtime-api-key>'
121
+
122
+ tunnel-client init \
123
+ --sample sample_mcp_stdio_local \
124
+ --profile omp-worker \
125
+ --tunnel-id <your-tunnel-id> \
126
+ --mcp-command "npx -y omp-worker-mcp"
127
+
128
+ tunnel-client doctor --profile omp-worker --explain
129
+ tunnel-client run --profile omp-worker
130
+ ```
131
+
132
+ Windows PowerShell commands, `0.1.1` upgrade / local-build notes, managed runtime alternatives (`tunnel-client runtimes connect`), permission requirements and the full trust boundary: [ChatGPT Secure MCP Tunnel guide](docs/chatgpt-secure-tunnel.md).
133
+ </details>
134
+
135
+ <details>
136
+ <summary><b>Claude Code</b></summary>
137
+
138
+ ```bash
139
+ claude mcp add omp-worker --scope user --env OMP_WORKER_OMP_COMMAND=omp -- npx -y omp-worker-mcp
140
+ ```
141
+
142
+ Use `--scope project` to register it for the current project only. On Windows `cmd.exe`, if `npx` fails to resolve, use `cmd /c npx`.
143
+
144
+ </details>
145
+
146
+ <details>
147
+ <summary><b>Cursor · VS Code / Copilot · Windsurf · Continue · any JSON-config client</b></summary>
148
+
149
+ ```json
150
+ {
151
+ "mcpServers": {
152
+ "omp-worker": {
153
+ "command": "npx",
154
+ "args": ["-y", "omp-worker-mcp"],
155
+ "env": {
156
+ "OMP_WORKER_OMP_COMMAND": "omp"
157
+ }
158
+ }
159
+ }
160
+ }
161
+ ```
162
+
163
+ File locations and client-specific notes: [Client configurations](docs/client-configurations.md).
164
+
165
+ </details>
166
+
167
+ Restart the client after changing its config.
168
+
169
+ ### 3. Tell your agent when to delegate
170
+
171
+ Registering the server makes the tools *available*; it does not make the agent *choose* them. Add a short policy to your project's instruction file — `AGENTS.md` (Codex), `CLAUDE.md` (Claude Code), `.cursorrules` / `.github/copilot-instructions.md` (others) — or to ChatGPT's project instructions:
172
+
173
+ ```markdown
174
+ ## Delegation policy (omp-worker-mcp)
175
+ - Quick questions, single-file edits, design discussion: do it yourself.
176
+ - Substantive single tasks (feature, bug fix, refactor, long investigation): inspect briefly,
177
+ then delegate with `omp_run_compact`, giving a clear `goal` and `acceptance` criteria.
178
+ - Multi-part work: use `omp_run_batch_compact`. Parallel write tasks need disjoint `ownership`;
179
+ tasks touching the same files must be ordered with `depends_on`.
180
+ - Review every result. If acceptance is not met, use `omp_continue` with specific feedback.
181
+ - Never delegate `git push`, publishing, deployments or secret changes — confirm those with the user.
182
+ ```
183
+
184
+ A fuller template: [Author workflow → Policy template](docs/author-workflow.md#policy-template).
185
+
186
+ ### 4. Run your first task
187
+
188
+ Start with something read-only:
189
+
190
+ ```text
191
+ Use omp-worker-mcp to do a read-only inspection of this workspace: summarize the
192
+ project structure and dependencies. Do not modify any files.
193
+ ```
194
+
195
+ **What you should see:** the agent calls `omp_run_compact`, OMP works in the background, and a short summary comes back with no files changed. If the job runs longer than the wait window (60 s by default), the call returns a `job_id` with status `running` and the agent keeps going with `omp_wait` — that is normal.
196
+
197
+ ---
198
+
199
+ ## Usage
200
+
201
+ Once the policy is in place you can just describe the outcome you want. The examples below show what the supervisor sends under the hood.
202
+
203
+ ### A single task
204
+
205
+ > *"Add exponential backoff to the HTTP client in `src/net/`, cover it with unit tests, and make sure `npm test` passes."*
206
+
207
+ ```jsonc
208
+ // omp_run_compact
209
+ {
210
+ "cwd": "/path/to/repo",
211
+ "goal": "Add exponential backoff (max 5 retries) to src/net/client.ts for 5xx and network errors.",
212
+ "acceptance": [
213
+ "Unit tests cover the retry and give-up paths",
214
+ "npm test passes"
215
+ ],
216
+ "timeout_minutes": 30
217
+ }
218
+ ```
219
+
220
+ What comes back is compact (abridged example):
221
+
222
+ ```jsonc
223
+ {
224
+ "job_id": "job-…",
225
+ "status": "completed",
226
+ "attempt": 1,
227
+ "max_attempts": 3,
228
+ "session_id": "sess-…",
229
+ "summary": "Added retry with exponential backoff to the HTTP client.",
230
+ "artifacts": [
231
+ { "path": "src/net/client.ts", "description": "retry loop + backoff helper" },
232
+ { "path": "test/net/client.test.ts", "description": "retry / give-up tests" }
233
+ ],
234
+ "verification": ["npm test: all tests passed"],
235
+ "remaining": [],
236
+ "details_path": "…/jobs/job-…/job.json"
237
+ }
238
+ ```
239
+
240
+ ### Several tasks as a DAG
241
+
242
+ > *"Add a `/health` endpoint to the API and a status badge to the UI in parallel, then add an integration test that covers both."*
243
+
244
+ ```mermaid
245
+ graph LR
246
+ api["api · write src/api/"] --> tests["tests · write tests/"]
247
+ ui["ui · write src/ui/"] --> tests
248
+ ```
249
+
250
+ ```jsonc
251
+ // omp_run_batch_compact
252
+ {
253
+ "cwd": "/path/to/repo",
254
+ "max_parallel": 2,
255
+ "tasks": [
256
+ { "id": "api", "goal": "Add GET /health returning build info.", "access": "write", "ownership": ["src/api/"] },
257
+ { "id": "ui", "goal": "Show a status badge fed by /health.", "access": "write", "ownership": ["src/ui/"] },
258
+ { "id": "tests", "goal": "Add an integration test for /health and the badge.",
259
+ "depends_on": ["api", "ui"], "access": "write", "ownership": ["tests/"],
260
+ "acceptance": ["npm test passes"] }
261
+ ]
262
+ }
263
+ ```
264
+
265
+ Rules worth knowing:
266
+
267
+ - `write` tasks must list the paths they own in `ownership` (relative to `cwd`); `read_only` tasks list none.
268
+ - Two tasks that may run at the same time cannot own overlapping paths — order them with `depends_on` instead.
269
+ - `max_parallel` is 1–10 (default 4); the whole group has a deadline (`group_timeout_minutes`, default 60).
270
+ - If the group is still running when the wait window ends, you get a `group_id`; continue with `omp_wait_group`.
271
+
272
+ ### Supervising a job
273
+
274
+ | Situation | Tool |
275
+ | :--- | :--- |
276
+ | Still running | `omp_wait` / `omp_wait_group` |
277
+ | Need logs, attempts or the full final answer | `omp_result` |
278
+ | Result doesn't meet acceptance | `omp_continue` with concrete feedback (counts toward `max_attempts`, default 3) |
279
+ | Wrong direction, stop it | `omp_cancel` / `omp_cancel_group` |
280
+
281
+ ---
282
+
283
+ ## Tools
284
+
285
+ | Tool | Kind | What it does |
286
+ | :--- | :--- | :--- |
287
+ | `omp_run_compact` | **Recommended** | Start one task and wait up to `wait_seconds` (≤ 60) for a compact result |
288
+ | `omp_run_batch_compact` | **Recommended** | Validate and run a DAG of up to 50 tasks; wait up to `wait_seconds` (≤ 240) |
289
+ | `omp_delegate` | Low-level | Start one task and return a `job_id` immediately |
290
+ | `omp_wait` | Low-level | Wait for a job to finish |
291
+ | `omp_wait_group` | Low-level | Wait for a batch group to finish |
292
+ | `omp_result` | Inspect | Full status, attempts, `attempt-NN.stdout.jsonl` / `attempt-NN.stderr.log` paths, final response |
293
+ | `omp_continue` | Supervise | Send feedback to the same OMP session for another attempt |
294
+ | `omp_cancel` | Control | Stop a job and its process tree |
295
+ | `omp_cancel_group` | Control | Stop every pending and running task in a group |
296
+
297
+ Full parameters and limits: [Tool reference](docs/tool-reference.md).
298
+
299
+ ---
300
+
301
+ ## Configuration
302
+
303
+ Everything is configured through environment variables, set in the client's MCP config (`env`) or in the shell that launches the server.
304
+
305
+ | Variable | Default | Purpose |
306
+ | :--- | :--- | :--- |
307
+ | `OMP_WORKER_OMP_COMMAND` | `omp` | OMP executable name or full path |
308
+ | `OMP_WORKER_ALLOWED_ROOTS` | *(unset = no restriction)* | JSON array of absolute directories that jobs must run inside. **Set this for any remote use.** *(Available since `0.2.0`; npm `0.1.1` lacks this feature.)* |
309
+ | `OMP_WORKER_STATE_DIR` | `~/.codex/state/omp-worker` | Where job state, prompts and logs are stored (the default path is used even if you don't use Codex) |
310
+ | `OMP_WORKER_RETENTION_TTL_SECONDS` | *(unset = keep forever)* | Delete finished records older than N seconds |
311
+ | `OMP_WORKER_RETENTION_MAX_BYTES` | *(unset = no limit)* | Delete the oldest finished records once the store exceeds N bytes |
312
+
313
+ All variables, the on-disk layout and restart behaviour: [Operations](docs/operations.md) · [`.env.example`](.env.example).
314
+
315
+ ---
316
+
317
+ ## Safety model
318
+
319
+ **What `omp-worker-mcp` enforces**
320
+
321
+ - With `OMP_WORKER_ALLOWED_ROOTS` set *(available since `0.2.0`; npm `0.1.1` lacks this feature)*, a job's `cwd` must resolve (via `realpath`) inside an approved root. Sibling-prefix tricks and symlink/junction escapes are rejected before OMP starts; a present-but-invalid value fails closed.
322
+ - In a batch, parallel `write` tasks must have disjoint `ownership`, and the graph must be acyclic — checked before any worker is spawned.
323
+ - Ownership and read-only intent are passed to each worker as explicit constraints.
324
+
325
+ **What it does not do**
326
+
327
+ - It is **not a sandbox**. OMP and anything it runs have the same permissions as the user account that started the server. Ownership is a scheduling check plus an instruction to the worker, not a filesystem lock.
328
+ - It does not decide what is safe to run. Keep `git push`, publishing, deployments and secret changes with you and the supervisor.
329
+
330
+ For remote access (e.g. ChatGPT via Secure MCP Tunnel), always set `OMP_WORKER_ALLOWED_ROOTS`, and consider a dedicated low-privilege account, a container or a VM. To report a vulnerability, see [SECURITY.md](SECURITY.md).
331
+
332
+ ---
333
+
334
+ ## Platform support
335
+
336
+ | Platform | Status |
337
+ | :--- | :--- |
338
+ | Windows | ✅ Verified end-to-end with the real OMP CLI and in CI (`windows-latest`) |
339
+ | macOS | 🟡 Full test suite runs in CI (`macos-latest`, with a fake OMP); not yet verified end-to-end with the real OMP CLI |
340
+ | Linux | 🟡 Full test suite runs in CI (`ubuntu-latest`, with a fake OMP); not yet verified end-to-end with the real OMP CLI |
341
+
342
+ | Client | Status |
343
+ | :--- | :--- |
344
+ | Codex | ✅ Used daily by the author |
345
+ | ChatGPT web (Secure MCP Tunnel) | 📄 Documented workflow — see the [guide](docs/chatgpt-secure-tunnel.md) |
346
+ | Claude Code, Cursor, VS Code / Copilot, Windsurf, Continue | 📄 Documented configurations, not integration-tested in CI |
347
+ | Cloud / remote agent hosts | ⚠️ Only if they provide Node.js ≥ 22, OMP on `PATH`, a writable workspace and process spawning |
348
+
349
+ Linux reports and client configs that you have verified are very welcome — see [Contributing](CONTRIBUTING.md).
350
+
351
+ ---
352
+
353
+ ## FAQ
354
+
355
+ <details>
356
+ <summary><b>The agent ignores the tools and does everything itself.</b></summary>
357
+
358
+ Tools being available doesn't mean they get chosen. Add the delegation policy from [step 3](#3-tell-your-agent-when-to-delegate), or name the server explicitly in your prompt ("use omp-worker-mcp to…"). On Codex with Code Mode enabled, you can also optionally configure `features.code_mode.direct_only_tool_namespaces`.
359
+ </details>
360
+
361
+ <details>
362
+ <summary><b>The job fails right away with "command not found" / <code>ENOENT</code>.</b></summary>
363
+
364
+ The MCP server can't find OMP. Set `OMP_WORKER_OMP_COMMAND` to the full path of the executable — GUI clients often start with a shorter `PATH` than your terminal.
365
+ </details>
366
+
367
+ <details>
368
+ <summary><b>I got a <code>job_id</code> with status <code>running</code> instead of a result.</b></summary>
369
+
370
+ Expected for longer tasks: the call only waits up to `wait_seconds`. The job keeps running in the background; call `omp_wait` (or `omp_wait_group`) to keep waiting.
371
+ </details>
372
+
373
+ <details>
374
+ <summary><b>Which model do the workers use?</b></summary>
375
+
376
+ OMP's default model — the one chosen in `omp setup` (or `modelRoles.default` in `~/.omp/agent/config.yml`). The supervisor's model is whatever your client uses. That's the point: they can be different.
377
+ </details>
378
+
379
+ <details>
380
+ <summary><b>"outside OMP_WORKER_ALLOWED_ROOTS" error.</b></summary>
381
+
382
+ The task's `cwd` is not inside any approved root. This is the allowlist working; add the directory to `OMP_WORKER_ALLOWED_ROOTS` if it should be allowed (note: `OMP_WORKER_ALLOWED_ROOTS` is available since `0.2.0`; npm `0.1.1` lacks this feature).
383
+ </details>
384
+
385
+ <details>
386
+ <summary><b>"Concurrent write ownership conflict" error.</b></summary>
387
+
388
+ Two tasks that could run at the same time own overlapping paths. Give them separate `ownership` scopes, or add `depends_on` so one runs after the other.
389
+ </details>
390
+
391
+ <details>
392
+ <summary><b>How is this different from the subagents built into my client?</b></summary>
393
+
394
+ The worker is a separate agent (OMP) with its own model and provider, runs in the background across conversation turns, keeps its state on disk, and can be driven by any MCP client — including ChatGPT on the web. Batches add dependency ordering and write-scope checks on top.
395
+ </details>
396
+
397
+ ---
398
+
399
+ ## Documentation
400
+
401
+ | Guide | Read it when you want to… |
402
+ | :--- | :--- |
403
+ | [Author workflow](docs/author-workflow.md) | Set up the delegation policy and understand the supervise → review → correct loop |
404
+ | [Client configurations](docs/client-configurations.md) | Configure Codex, Claude Code, Cursor, VS Code, Windsurf or Continue |
405
+ | [ChatGPT Secure MCP Tunnel](docs/chatgpt-secure-tunnel.md) | Drive local OMP from ChatGPT on the web |
406
+ | [Tool reference](docs/tool-reference.md) | See every tool, parameter and the result envelope |
407
+ | [Operations](docs/operations.md) | Tune environment variables, storage, retention and restarts |
408
+ | [Benchmark protocol](benchmarks/README.md) | Compare direct execution with supervisor–worker delegation |
409
+ | [Registry publishing](docs/registry-publishing.md) | Release to npm and the Official MCP Registry (maintainers) |
410
+
411
+ [COMPATIBILITY.md](COMPATIBILITY.md) defines the public contract and versioning policy; [CHANGELOG.md](CHANGELOG.md) lists releases.
412
+
413
+ ## Contributing
414
+
415
+ Issues and pull requests are welcome — especially Linux verification and tested client configs. Start with [CONTRIBUTING.md](CONTRIBUTING.md). To build from source:
416
+
417
+ ```bash
418
+ git clone https://github.com/divenire990/omp-worker-mcp.git
419
+ cd omp-worker-mcp
420
+ npm ci
421
+ npm test # builds, then runs the test suite against a fake OMP
422
+ ```
423
+
424
+ ## Acknowledgements
425
+
426
+ Built on the [Model Context Protocol TypeScript SDK](https://github.com/modelcontextprotocol/typescript-sdk) and designed around [Oh My Pi](https://github.com/can1357/oh-my-pi) (MIT). OMP is not bundled and must be installed separately. This project is independent and not affiliated with OMP, OpenAI or Anthropic.
427
+
428
+ ## License
429
+
430
+ [MIT](LICENSE)