Labsco
varadfromeast logo

Async Parallel Antigravity for Codex & Claude Code

โ˜… 3

from varadfromeast

Run parallel, resumable, human-operable Antigravity CLI sessions from Codex, Claude Code, or any MCP-capable agent harness.

๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅโœ“ VerifiedFreeQuick setup

codex-agy-bridge

Run Antigravity from an agent harness as durable, parallel, human-operable agy sessions over MCP.

codex-agy-bridge wraps the official Antigravity CLI with a resumable MCP control plane. Agent harnesses like Codex, Claude Desktop, or your own GPT/Claude-powered MCP client can start agy runs, wait on sparse events, attach a real terminal, send guarded input, cancel safely, continue exact conversations, and collect final results later by run_id.

What Makes It Different

  • Parallel Antigravity sessions: launch multiple independent agy runs, each with its own durable state, logs, transcript projection, and result.
  • Human-operable terminals: foreground runs live in persistent tmux sessions, so Terminal.app can attach without killing the agent.
  • Resumable MCP control: MCP calls can time out, the harness can restart, and the run can still be observed later by run_id.
  • Goal orchestration: create a goal, start named targets with bounded parallelism, and inspect the whole batch as one coordinated effort.
  • Sparse wake events: agy_run_wait short-polls lifecycle, attention, progress, and terminal events without transcript-polling spam.
  • Guarded input: agy_run_input can reject stale writes when event or transcript cursors changed after the caller observed the run.
  • Trajectory-aware observability: bounded transcript summaries and terminal evidence are exposed without private model reasoning.
  • Operational hygiene: duplicate active starts are deduplicated, process groups are cancelled safely, and completed result artifacts are preserved.

How It Works

flowchart LR
  H["Agent harness<br/>(Codex, Claude, custom MCP client)"]
  M["codex-agy-bridge<br/>MCP stdio server"]
  S["Durable control plane<br/>runs, goals, events, results"]
  W["Detached run supervisor"]
  A["Antigravity CLI<br/>agy"]
  T["Persistent tmux session<br/>human attach/input"]
  L["Local Antigravity<br/>trajectory files"]

  H <-->|"MCP tools"| M
  M <--> S
  S --> W
  W --> A
  W <--> T
  A --> L
  W -->|"bounded transcript projection"| S
  T -->|"terminal logs and attention prompts"| S

The bridge keeps the MCP server responsive while detached supervisors own the long-running agy processes. State and events are persisted locally, so a run can continue after the original MCP call returns. For the deeper process model, see docs/ARCHITECTURE.md. For the MCP control-loop vision, see docs/MCP_VISION.md.

MCP Tools

ToolPurpose
agy_run_startStart, continue, or open an interactive foreground run
agy_run_waitShort-poll until selected runs emit sparse wake events
agy_run_observeRead full, status, transcript, or raw terminal views
agy_run_inputSend input with optional event/transcript preconditions
agy_run_cancelCancel one active run
agy_run_resultRead final result metadata or bounded result chunks
agy_goalCreate goals, start targets, and read aggregate status
agy_adminRead diagnostics, models, plugins, validation, and changelog

Typical flow:

agy_run_start -> agy_run_wait -> agy_run_observe -> agy_run_result

In Codex MCP, tools may be exposed with the server prefix, for example codex_agy_bridge_agy_run_wait. Run responses include exact wait_call arguments; note that agy_run_wait always takes run_ids: ["..."], even for a single run. Supported wait conditions are any_attention, any_terminal, all_terminal, any_event, and aliases attention, terminal, finished, finish, complete, completed, result, all_finished, all_complete, and all_completed.

Use agy_goal when the harness should split work into named targets with a shared objective and bounded parallelism.

Status And Risk

This project is experimental. It currently targets Python 3.11+, macOS, tmux, and Antigravity CLI 1.0.8-compatible commands and trajectory files.

Antigravity is an agentic CLI. It can read and write files, execute commands, and access the network with the current user's privileges. This bridge is not a sandbox or security boundary.

The bridge always enables Antigravity's dangerous permission-skip policy so unattended runs do not stall on CLI approval prompts. Any dangerously_skip_permissions=false input is rejected; the only allowed value is true. sandbox=true and additional_directories are CLI policy hints, not filesystem containment.

The bridge does not read or copy Antigravity OAuth credentials. It invokes the installed agy binary and reads ordinary local conversation metadata and trajectory files.

Development

git clone https://github.com/varadfromeast/codex-agy-bridge.git
cd codex-agy-bridge
uv sync --extra dev
uv run pytest
uv run ruff check .
uv build

Run the server directly:

uv run codex-agy-bridge

The server uses stdio transport. Do not print diagnostic text to stdout; it would corrupt MCP framing.

Publishing

A pushed version tag runs .github/workflows/publish.yml, which verifies versions, runs checks, builds distributions, publishes to PyPI through GitHub OIDC, creates a GitHub release, and publishes server.json to the MCP Registry.

Compatibility

The current reader expects Antigravity trajectory JSONL under:

~/.gemini/antigravity-cli/brain/<conversation-id>/
  .system_generated/logs/transcript.jsonl

If Antigravity moves to SQLite or a local daemon API, a new adapter can replace this reader without changing the MCP tool contract.