codex-worker
Orchestrates OpenAI Codex CLI workers as a guarded execution engine via codex exec/resume, with cache lanes, batch dispatch, and runtime guardrails.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@codex-worker Add input validation to signup.py, edit only files in src/auth/"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Codex Executor
An Antigravity plugin that turns Antigravity into the orchestrator (planning, architecture, design, copywriting, and verification) and Codex CLI into a strictly guarded, high-cache, minimal-output execution engine via MCP.
Antigravity 负责总控(规划、架构、审美、文案与验收) · Codex 负责执行(严格按边界写代码、跑命令与验证)
Why Codex Executor?
Clear division of labor: Antigravity pre-decides design, copy, and architecture, then dispatches crisp imperative work orders to Codex—eliminating verbose GPT prose and unrequested freelancing.
Minimal output overhead: Enforces
model_reasoning_summary="none",hide_agent_reasoning=true, zero pre-tool narration, and a 2-field JSON ACK ({"ok": boolean, "err": string}). All real file diffs, commands, and exit codes are captured directly by the MCP bridge from JSONL events and Git/filesystem snapshots.Lean prefix & persistent cache lanes: Disables unused Codex Desktop plugins/UI features on worker runs to cut cold input tokens, and persists workspace cache lanes (
session_mode: "auto") keyed by exact prefix signature(cwd, lane, model, reasoning_effort, sandbox, prompt_hash, schema_hash)for high prompt-cache reuse across turns.Engine-level runtime guardrails:
Destructive command blocker: Real-time JSONL watchdog kills processes attempting unauthorized
git reset --hard,git clean -f,git push --force, root deletes, sensitive dotfile edits, or remote pipe execution.File-scope cage (
allowed_paths/forbidden_paths): Real-time and post-run verification of all touched files, with automatic revert (auto_revert_violations) of unauthorized edits in Git repositories while preserving valid in-scope changes.Runaway loop breaker: Enforces
max_commandsand terminates identical failing command loops automatically.
Parallel batch dispatch (
codex_batch_exec): Runs up to 4 concurrent Codex workers on separate cache lanes with upfront disjoint-path validation and sibling Git delta isolation.Zero npm dependencies: Pure Node.js ESM (
>=18), instant startup, automatic Codex binary discovery (CODEX_BIN,PATH, and Windows StoreOpenAI.CodexMSIX packages).
Related MCP server: subagent-harness-mcp
Architecture
Antigravity (Orchestrator: Plan · Design · Audit · User Chat)
│
│ MCP (Stdio JSON-RPC 2.0) — codex-worker
▼
codex-executor/server/
├── Runtime Guardrails (Command Watchdog · Scope Cage · Auto-Revert · Loop Breaker)
├── Persistent Cache Lanes (lanes.json · Rollout Telemetry · Auto-Rotation)
└── Parallel Batch Scheduler (codex_batch_exec · Disjoint Path Check)
│
│ codex exec / codex exec resume (--json, --output-schema, lean flags)
▼
Local Codex CLI (default: gpt-6.2-sol, reasoning_effort=max)Prerequisites
Antigravity (2.0 / IDE / CLI)
Node.js
>= 18available inPATHCodex CLI or Codex Desktop installed and configured (authentication/provider configured in
~/.codex/config.toml)
Installation
Clone this repository directly into your global Antigravity plugins directory:
Windows (PowerShell)
git clone https://github.com/WSDyi/codex-executor.git "$env:USERPROFILE\.gemini\config\plugins\codex-executor"macOS / Linux
git clone https://github.com/WSDyi/codex-executor.git ~/.gemini/config/plugins/codex-executorAntigravity automatically discovers plugins placed under ~/.gemini/config/plugins/<name>/ (with plugin.json), loads rules/AGENTS.md, skills/codex-orchestrator/SKILL.md, and starts the codex-worker MCP server without requiring a manual build step.
Configuration
Defaults are configured in mcp_config.json under mcpServers.codex-worker.env and can be adjusted at any time:
Environment Variable | Default | Description |
|
| Default Codex model slug |
|
| Default reasoning effort ( |
|
| Soft context token threshold before rotating a hot lane to a fresh thread |
|
| Idle expiration window for cached workspace lanes |
|
| Default per-job shell command ceiling |
| (auto-discovered) | Optional explicit path to the |
MCP Tools (codex-worker)
Tool | Purpose |
| Execute a guarded Work Order on a workspace cache lane (supports |
| Dispatch multiple independent Work Orders in parallel on separate cache lanes with upfront disjoint |
| Send a follow-up or fix directive to an existing |
| Inspect live command progress, |
| Immediately terminate a running Codex worker process tree |
| List ( |
| Check Codex binary discovery, CLI version, model catalog status, guardrail defaults, and active cache lanes |
Testing
Run the end-to-end integration test suite (unit guardrail tests + MCP handshake + live parallel batch & hot cache-lane reuse):
npm test
# or
node server/test-mcp.mjsRepository Layout
codex-executor/
├── plugin.json # Antigravity plugin manifest
├── mcp_config.json # Stdio MCP server definition
├── package.json # Zero-dependency ESM metadata & scripts
├── assets/logo.svg # Plugin icon
├── rules/AGENTS.md # Always-on orchestration rules
├── skills/codex-orchestrator/SKILL.md # Orchestration playbook
├── prompts/
│ ├── codex-worker.md # Minimal silent worker instructions
│ └── worker-output-schema.json # 2-field JSON ACK schema ({"ok","err"})
└── server/
├── index.mjs # Zero-dependency MCP stdio server
├── codex-runner.mjs # Runner, runtime guardrails, cache lanes, batch scheduler
└── test-mcp.mjs # Unit & live integration test suiteLicense
Available Tools
7 toolscodex_batch_execB
Execute up to 6 independent Codex work orders in parallel on separate cache lanes. Enforces strictly disjoint allowed_paths for write tasks sharing a workspace, isolates concurrent sibling edits in Git, runs all runtime guardrails on each worker, and returns consolidated ground-truth reports.
Inputs: tasks (required), cwd, profile, sandbox, +6 more.
codex_cache_manageC
Inspect, reset, or prune persistent workspace cache lanes (thread_id, context fill %, last-call cache hit %, idle age, busy state).
Inputs: cwd, lane, action, max_idle_minutes.
codex_execA
Execute a scoped, guarded coding or shell Work Order on Codex CLI (default model="gpt-6.2-sol", reasoning_effort="max"). Enforces real-time destructive command blocking, file-scope whitelist/blacklist verification (allowed_paths/forbidden_paths with auto-revert), spin-loop circuit breaking, lean prefix stripping, persistent workspace cache lanes, and 2-field {"ok","err"} JSON ACK.
Inputs: cwd (required), task (required), lane, async, +22 more.
codex_healthB
Verify Codex binary discovery, CLI version, model catalog readiness, runtime guardrail defaults, active cache lanes, and recent jobs.
Inputs: no named parameters.
codex_job_cancelA
Immediately terminate a stuck, looping, or off-track Codex worker process tree.
Inputs: job_id (required).
codex_job_statusB
Inspect live progress (active command, commands executed) or final ground-truth report, guard_audit, and cache_metrics for a job. Omit job_id to list recent jobs. Supports wait_sec (0-60).
Inputs: limit, job_id, wait_sec.
codex_resumeC
Send a guarded follow-up or fix directive to an existing thread_id while preserving cache-identical flags and runtime guardrails.
Inputs: thread_id (required), instruction (required), cwd, async, +17 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 7 tools
Each tool maps to a distinct lifecycle stage: single execution, batch execution, status inspection, cancellation, resume, cache management, and health checking. The only mild overlap is between codex_exec, codex_batch_exec, and codex_resume, since all can start or continue coding work, but descriptions clearly differentiate new jobs, parallel jobs, and follow-ups to existing threads.
All names use a consistent snake_case codex_ prefix, making the family easy to recognize. However, the suffix ordering is mixed: some are object_action (codex_job_status, codex_cache_manage) and others are action or bare noun (codex_exec, codex_resume, codex_health), which is a minor inconsistency but still readable.
Seven tools is well-scoped for a Codex worker orchestration server. Each tool covers a meaningful capability—execution, monitoring, cancellation, resumption, batching, cache control, and health—without obvious redundancy.
The surface covers the full worker lifecycle: launch single or batch jobs, inspect status, cancel stuck jobs, resume threads, manage cache lanes, and verify environment health. No obvious operational gaps remain for the stated purpose.
Maintenance
Related MCP Connectors
A paid remote MCP for OpenAI Codex agent coordination MCP, built to return verdicts, receipts, usage
Hosted MCP server for task-first delegation to remote workstations and workers.
Build, test, publish, and run Kovca workflows from AI agents over remote MCP.
Control plane for autonomous software labor. Agents claim objectives over MCP with audit trail.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceEnables Grok Build to orchestrate the local Codex CLI for code reviews, adversarial reviews, task rescue, session transfer, and background job management through MCP tools.1Apache 2.0
- AlicenseNot gradedqualityBmaintenanceA local MCP server that enables Codex and other MCP clients to orchestrate native external coding-agent harnesses through a normalized lifecycle, with guarded execution and deterministic testing.MIT
- AlicenseNot gradedqualityBmaintenanceEnables MCP clients to run declarative agents and DAG workflows as plain tools, with parallel nodes, review loops, and per-run least-privilege sandboxing.10 npmMIT
- AlicenseBqualityBmaintenanceEnables launching and supervising local Codex and Claude Code agent sessions and one-shot tasks, exposing run, list, stop, and output operations over MCP with session-scoped permissions and sandbox controls.2190 npm1MIT