Skip to main content
Glama

MACA — Multi-Agent Cooperative Architects (maca-orchestrator v2.2)

CI

English | 简体中文

Zero-dependency Node.js Multi-Agent Delivery Gate, independent verifier, and MCP orchestrator that lets any MCP controller host (Codex / GPT, Claude Code, Cursor, Google Antigravity) safely coordinate any review & execution AI (codex-cli, claude-code, DeepSeek Harness dsh-cli, and openai-compat for DeepSeek/Qwen/GLM/Ollama).

Instead of blindly trusting model self-reports or granting unrestricted disk access, every delegation runs through an isolated git worktree, an independent filesystem-vs-baseline audit, snapshot verification, transactional allowlist patching, and a real cross-module integration gate.


Architecture

Antigravity (Planner / Verifier / Integrator)
   │  uses Skill + thin stdio MCP (`src/mcp-adapter.mjs`, timeoutSeconds: 960)
   ▼
Core Runner & Guards (`src/*.mjs`)
   ├─ M1 Registry & Path Guard      : project whitelist, git toplevel check, NTFS junction/ADS guard
   ├─ M2 Workspace Manager          : atomic run_token locks, disabled git hooks, detached worktree
   ├─ M3 Codex Runner               : direct binary spawn, UTF-8 stdin, `--ignore-user-config`, process-tree kill
   ├─ M4 Verifier & Patch Applier   : filesystem-vs-baseline audit, snapshot test run, wx create + rollback
   └─ M5 Integration Gate           : full-tree content digest + real cross-module smoke/integration tests

Why --ignore-user-config --ignore-rules?

When Codex CLI runs on a machine that also has the Codex Desktop App installed, default invocations inherit desktop MCP servers and memory stores outside the CLI sandbox. Passing --ignore-user-config --ignore-rules -c windows.sandbox="elevated" -c forced_login_method="chatgpt" keeps your ChatGPT Plus OAuth login while isolating each worker run cleanly.


Related MCP server: codex-antigravity-mcp

Prerequisites

  1. OS: Windows, macOS, or Linux (continuously verified on all 3 platforms via GitHub Actions).

  2. Node.js >= 20 (tested on Node 20, 22, and 26; zero third-party npm dependencies).

  3. Git (on Windows, portable MinGit or Git for Windows; on macOS/Linux, system git).

  4. Worker CLI / API (pick any combination): OpenAI Codex CLI (npm install -g @openai/codex + codex login), Claude Code (claude), DeepSeek Harness (dsh), or any OpenAI-compatible API (DeepSeek / Qwen / GLM / Ollama).


Quick Start (Zero-Clone via npx / Global Install, or Git Clone)

Option A: Zero-Clone CLI (npm / npx)

# Install globally (or run directly via `npx maca-orchestrator <cmd>`)
npm install -g maca-orchestrator

# Try the zero-quota contract-mismatch verification demo immediately (no Codex login required)
maca demo

# 1. Auto-detect toolchain & initialize ~/.maca/config/*.json + host MCP config
maca setup
#    Or generate configs for Codex / Claude Code / Cursor:
#    maca host codex|claude|cursor

# 2. Register a Git repository you want MACA to orchestrate
maca register my-app /path/to/my-app --modes review,implement,integrate --shared-dep node_modules

# 3. Verify environment & launch the local bilingual dashboard
maca doctor
maca ui

When installed via npm/npx, MACA stores writable config & state cleanly under ~/.maca/ (override with MACA_HOME=/custom/dir), keeping the package directory read-only.

Option B: Local Git Checkout

git clone https://github.com/georgeee817-L/maca-orchestrator.git
cd maca-orchestrator

# Optional: verify everything works on a fresh clone (no Codex login or config/runtime.json required)
npm test
npm run demo:contract

# 1. Auto-detect node/git/codex, generate local config/*.json, and install the host MCP config
node scripts/setup.mjs
#    Or generate configs for Codex / Claude Code / Cursor:
#    node scripts/setup.mjs host codex|claude|cursor

# 2. Register a Git repository you want MACA to orchestrate
#    (Add `--shared-dep node_modules` so isolated verification snapshots can copy local dependencies)
node scripts/setup.mjs register my-app /path/to/my-app --modes review,implement,integrate --shared-dep node_modules

# 3. Verify environment & launch the local bilingual dashboard
node scripts/setup.mjs doctor
npm run ui

Note: Local machine files (config/runtime.json, config/projects.json, state/, scratch/) are gitignored so your personal paths and task logs are never committed. Templates live in config/runtime.example.json and config/projects.example.json.


Capability Profiles, Model Catalog, Quota Cooldown & Auth Fallback (v1.3)

  • Dynamic Codex Model Catalog & Aliases (codex_list_models / node src/cli.mjs models): Queries codex debug models (with automatic --bundled fallback) so any model supported by your Codex CLI / ChatGPT account (gpt-6.2-sol, gpt-6.2-astra, gpt-6.1-terra, gpt-6-luna, etc.) can be inspected and selected dynamically via model or shorthand model_aliases (sol, astra, terra, luna).

  • Separated Review vs. Execution Routing, Strict deep Guard & L4 Escalation (light | standard | deep): Profiles distinguish the review layer (codex_review: light/standard = gpt-6.2-astra medium, deep = gpt-6.2-astra high) from the execution layer (codex_implement: light = gpt-6.2-sol high, standard = gpt-6.2-sol xhigh, deep = gpt-6.2-astra medium). Heavy deep runs are capped at quota.max_deep_runs_24h (default 4 per 24h), while routine astra/medium reviews do not consume the heavy deep cap. Elevated combinations (gpt-6.2-astra + xhigh or any model at max) and deep runs beyond the 24h budget require explicit user approval via a local CLI order with --approve-elevated. ultra remains hard-blocked by policy.

  • Quota Circuit Breaker & 24h Tracking: state/quota_state.json tracks 24h token usage (including model and reasoning_effort) and arms a temporary ChatGPT cooldown when 429 / rate_limited occurs (cooldown_blocked: true short-circuits repeat hits). Unsupported model errors return model_unsupported without consuming code retries. Inspect or clear early with:

    node src/cli.mjs models
    node src/cli.mjs quota
    node src/cli.mjs quota --reset
  • Per-Task Launch Cap & Allowed Profiles (quota.max_launches_per_task, quota.allowed_profiles, order.max_launches): Optional hard boundaries in config/runtime.json (both default to null for backward compatibility). When max_launches_per_task or order.max_launches is set (e.g. 1), initial runs, reworks, and API fallbacks share one atomically persisted launch counter per task, while duplicate non-rework submissions stay idempotent without double-counting. When allowed_profiles is set (e.g. ["light", "standard"]), disallowed profiles and out-of-band model/effort overrides are rejected before spawning Codex.

  • Compact Return Summaries & Per-Attempt Log Index (compact: true / status --attempt <id>): codex_review, codex_implement, codex_status, and CLI run --compact / status --compact can return a deterministic, locally generated compact summary (with first actionable error, file locations, and detail_ref) without invoking an extra model. Every attempt (1.1, 1.2, 2.1, v1, ...) persists its sanitized detail JSON under state/tasks/<task_id>.attempts/ so historical runs stay independently readable via codex_status(task_id, attempt_id) even after rework.

  • Account Window Calibration & Multi-Milestone Estimation (codex_estimate_usage / node src/cli.mjs estimate <spec.json> [--live-account]): Queries codex app-server account/rateLimits/read (stripping all account identifiers) to sample 5-hour (primary) and 7-day (secondary) ChatGPT Plus window deltas across natural work orders (quota.sample_account_window: true), excluding cross-reset, API-fallback, and overlapping-task samples. Supports both single-order and multi-milestone project estimates (completable_milestones, first_bottleneck_stage, account_quota_status: sufficient|tight|insufficient|unknown), plus chronological leave-future-out backtesting.

  • Multi-Adapter Role Binding & DeepSeek Harness Adapters (adapter: "codex-cli" | "dsh-cli" | "deepseek-harness"): Profiles and work orders can bind review and implement to different adapters (e.g. codex-cli gpt-6.2-astra/medium for review + DeepSeek Harness for implementation). Supports both dsh-cli (DeepSeek Harness Desktop's dsh.cmd headless CLI with direct shell: false spawn, --permission-mode, and --session-id rework) and deepseek-harness (built-in zero-dependency HTTP API harness with light=deepseek-chat, standard/deep=deepseek-reasoner, thinking-mode reasoning_content preservation, HTTPS/SSRF/redirect defense, and pre-request token reservation).

  • Tier 3 API Key Fallback Switch (Opt-In, Disabled by Default): config/runtime.example.json defaults to auth: { primary: "chatgpt", allow_api_key_fallback: false, api_key_env_var: "OPENAI_API_KEY" } so ChatGPT Plus users never incur unexpected API billing. Maintainers or CI users who want automatic API fallback can set allow_api_key_fallback: true and export OPENAI_API_KEY.


Verification permissions

For MCP implementation and integration, register the exact executable and arguments of each approved check in the local project entry in config/projects.json. For example, add "mcp_check_argv": [["<absolute-node-executable>", "--test", "tests/contract.test.mjs"]] and list the same executable in allowed_command_bins. Read-only review works without a registered command. After running project registration again, check the local entry before dispatching work.

Verification commands run as the orchestrator's Windows user. Their scripts, imports and candidate code require your trust. Use an isolated, least-privileged Windows environment for untrusted projects. A temporary working directory limits accidental edits and does not enforce OS access controls. The verifier copies declared dependency directories and rejects links in the copied tree. Large dependency trees use extra time and disk space.

MCP cannot grant elevated reasoning approval or skip implementation verification. Use a local, operator-approved CLI order for elevated work. Keep task records and logs private.

Using with Antigravity

node scripts/setup.mjs automatically renders plugin/ into ~/.gemini/config/plugins/codex-orchestrator/ with:

  • plugin.json

  • mcp_config.json (using resolved absolute paths and timeoutSeconds: 960)

  • skills/codex-orchestrator/SKILL.md (5-stage workflow: prototype → blind adversarial review → final contract → module-by-module implementation → integration gate)

Open a new conversation in Antigravity and toggle Codex Orchestrator under Customizations / Plugins if needed.


CLI Usage (Direct / Scripted)

node src/cli.mjs run orders/my-task.order.json
node src/cli.mjs estimate orders/my-task.order.json
node src/cli.mjs verify <task_id>
node src/cli.mjs apply <task_id>
node src/cli.mjs integrate <project_id> orders/integration.json
node src/cli.mjs status <task_id>
node src/cli.mjs cancel <task_id>
node src/cli.mjs doctor
node src/cli.mjs cleanup [--project <id>] [--include-failed] [--dry-run]
node src/cli.mjs unlock <project_id> --force-reconciled

# Zero-dependency local bilingual dashboard (roles, one-click AI auto-setup prompts, write-only API key vault)
npm run ui

# Generate host MCP + rules configs for Codex, Claude Code, Cursor, or Antigravity
node scripts/setup.mjs host codex
node scripts/setup.mjs host claude
node scripts/setup.mjs host cursor
node scripts/setup.mjs host antigravity

# Reproducible cross-module contract-mismatch demo (zero quota cost), local metrics & P3 comparison harness
npm run demo:contract
npm run report:metrics
npm run compare:workflows -- --plan --rounds 3
npm run compare:workflows -- --snapshot-bench --files 200 --shared-files 200

The estimate command and MCP tool codex_estimate_usage use completed work orders from the same project, mode, model, reasoning profile, and authentication method. The first estimate needs three complete samples. Pass an existing task ID to refresh the remaining range using its recorded input and output tokens. Account quota feasibility is shown as unknown.


Repository Layout

  • src/ — Core orchestrator modules (config.mjs, path-guard.mjs, registry.mjs, workspace-manager.mjs, codex-runner.mjs, verifier-applier.mjs, integration-gate.mjs, cli.mjs, mcp-adapter.mjs)

  • plugin/ — Portable Antigravity Plugin source (plugin.json, mcp_config.template.json, skills/codex-orchestrator/SKILL.md)

  • scripts/setup.mjs — Cross-machine auto-setup, project registration, and plugin installer

  • config/ — Example templates (*.example.json); local runtime.json & projects.json are gitignored

  • tests/ — Automated unit & negative-boundary test suite (node --test)

  • PILOT_REPORT.md — Recorded 4-gate end-to-end Windows validation report

License

MIT

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables Codex users to delegate engineering, refactoring, auditing, and test execution tasks to Google Antigravity CLI as a persistent autonomous subagent, with tools for managing sessions and running prompts.
      1
      MIT
    • A
      license
      B
      quality
      C
      maintenance
      Enables a local Codex chat to ask a second opinion, review staged, unstaged, or revision-based diffs, and delegate coding tasks to the Antigravity CLI running in isolated or disposable workspaces. Supports starting, polling, retrieving, and cancelling tasks with returned answers, diffs, changed-file lists, exit codes, and time/output limits, while never auto-applying returned patches.
      8
      1
      MIT