Skip to main content
Glama

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_commands and 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 Store OpenAI.Codex MSIX 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

  1. Antigravity (2.0 / IDE / CLI)

  2. Node.js >= 18 available in PATH

  3. Codex 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-executor

Antigravity 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

CODEX_DEFAULT_MODEL

gpt-6.2-sol

Default Codex model slug

CODEX_DEFAULT_REASONING_EFFORT

max

Default reasoning effort (low, medium, high, xhigh, max)

CODEX_AUTO_ROTATE_TOKENS

175000

Soft context token threshold before rotating a hot lane to a fresh thread

CODEX_LANE_IDLE_MINUTES

45

Idle expiration window for cached workspace lanes

CODEX_DEFAULT_MAX_COMMANDS

80

Default per-job shell command ceiling

CODEX_BIN

(auto-discovered)

Optional explicit path to the codex executable


MCP Tools (codex-worker)

Tool

Purpose

codex_exec

Execute a guarded Work Order on a workspace cache lane (supports allowed_paths, forbidden_paths, strict_guard, auto_revert_violations, profile, lane, session_mode, and async)

codex_batch_exec

Dispatch multiple independent Work Orders in parallel on separate cache lanes with upfront disjoint allowed_paths validation

codex_resume

Send a follow-up or fix directive to an existing thread_id while preserving identical cache flags and guardrails

codex_job_status

Inspect live command progress, guard_audit, observed_evidence, and cache_metrics (supports wait_sec long-polling)

codex_job_cancel

Immediately terminate a running Codex worker process tree

codex_cache_manage

List (status), reset (reset), or prune (prune) persistent workspace cache lanes

codex_health

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.mjs

Repository 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 suite

License

MIT

Available Tools

7 tools
codex_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

    B3.4/5.0

    Scored across 7 tools

    Disambiguation4/5

    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.

    Naming Consistency4/5

    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.

    Tool Count5/5

    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.

    Completeness5/5

    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

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables Grok Build to orchestrate the local Codex CLI for code reviews, adversarial reviews, task rescue, session transfer, and background job management through MCP tools.
      1
      Apache 2.0
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables MCP clients to run declarative agents and DAG workflows as plain tools, with parallel nodes, review loops, and per-run least-privilege sandboxing.
      10 npm
      MIT
    • A
      license
      B
      quality
      B
      maintenance
      Enables 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.
      2
      190 npm
      1
      MIT