Skip to main content
Glama
README.md
<div align="center">
  <img src="assets/logo.svg" alt="OpenAI & Codex Suite" width="96" height="96" />
  <h1>OpenAI &amp; Codex Suite for Antigravity</h1>
  <p>
    <strong>Dual-engine Antigravity plugin &amp; interactive MCP App bridging local Codex CLI (any ChatGPT subscription: Plus / Pro) and OpenAI Platform API (GPT-Image, Responses, Audio) — built for Antigravity and <code>/swarm</code>.</strong>
  </p>
  <p>
    <a href="https://github.com/aurelianvolturi/openai-suite/actions/workflows/ci.yml"><img src="https://github.com/aurelianvolturi/openai-suite/actions/workflows/ci.yml/badge.svg" alt="CI" /></a>
    <img src="https://img.shields.io/badge/version-2.0.0-10A37F" alt="Version 2.0.0" />
    <img src="https://img.shields.io/badge/node-%3E%3D20-2563EB" alt="Node >= 20" />
    <img src="https://img.shields.io/badge/MCP_Apps-SEP--1865-6366F1" alt="MCP Apps SEP-1865" />
    <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-green" alt="MIT License" /></a>
  </p>
</div>

---

## Overview

**OpenAI & Codex Suite** connects **both** OpenAI billing pools cleanly into [Google Antigravity](https://antigravity.google) without mixing quotas or bloating agent context:

1. **ChatGPT Subscription Pool (`codex login`)** — works with **any** ChatGPT subscription (**Plus**, **Pro 100**, **Pro 200**, **Pro 500**) via your local Codex CLI:
   - Coding, debugging, refactoring, thread continuation (`codex_resume`), warm-context session branching (`codex_fork`), managed Git worktrees (`worktree: true`), and multi-mode read-only code reviews (`standard`, `adversarial`, `design`, and parallel `two-pass`).
2. **OpenAI Platform API Pool (`OPENAI_API_KEY`)** — optional, uses your OpenAI Platform API credits:
   - **Responses API** with automatic async background polling for deep `xhigh`/`max` reasoning, structured JSON Schema outputs, `web_search` with extracted citations, sandboxed `code_interpreter`, vision, and PDF/document inputs.
   - **GPT-Image API** (`gpt-image-2.6-sunburst`, `gpt-image-2.6-flare`, `gpt-image-1.5`) for transparent PNG/WEBP, JPEG, GIF, and scalable SVG generation & editing.
   - **Audio API** for transcription (`gpt-4o-transcribe` / `whisper-1`) and speech synthesis (`gpt-4o-mini-tts`).

```mermaid
flowchart LR
    AGY["Antigravity / /swarm"] --> Guard["hooks.json PreToolUse Guard"]
    AGY --> Worker["codex-worker (flash_lite)"]
    AGY --> MCP["openai-suite_bridge MCP Server"]
    Worker --> MCP
    MCP --> Codex["Local Codex CLI (ChatGPT Plus / Pro)"]
    MCP --> OAI["OpenAI Platform API (Responses / GPT-Image / Audio)"]
    MCP --> UI["Interactive MCP App UI (ui://openai-suite/app.html)"]
    MCP --> Store["PLUGIN_DATA (jobs + usage.jsonl)"]
```

---

## Quick Start

### Prerequisites

- **Node.js `>= 20`**
- **Codex CLI** authenticated with your ChatGPT account (`codex login`) — required for `codex_*` tools
- **OpenAI API Key** *(optional)* — only needed for `openai_*` Platform API tools (`Responses`, `GPT-Image`, `Audio`) or `use_api_key: true`

### Install into Antigravity

Clone directly into Antigravity's global plugins folder and install production dependencies:

```bash
git clone https://github.com/aurelianvolturi/openai-suite.git ~/.gemini/config/plugins/openai-suite
cd ~/.gemini/config/plugins/openai-suite
npm ci --omit=dev
```

Antigravity automatically discovers plugins placed under `~/.gemini/config/plugins/<name>/` (no manual registration needed). The prebuilt MCP App UI bundle (`ui/dist/app.html`) is included so the interactive dashboard works immediately after `npm ci --omit=dev`.

> **Optional API Key:** Open Antigravity **Customizations → Installed → OpenAI & Codex Suite** and enter your `OPENAI_API_KEY` (or leave it as `skip` if you only want local Codex CLI tools).

### Updating

```bash
cd ~/.gemini/config/plugins/openai-suite
git pull && npm ci --omit=dev
```

Then restart `openai-suite_bridge` from **MCP Servers** settings (or reload Antigravity).

---

## Tools Reference

### ChatGPT Subscription Tools (Local Codex CLI)

| Tool | Loading | Background | Description |
| :--- | :---: | :---: | :--- |
| `codex_run` | Eager | Always | Run coding, debugging, or research with dynamic family aliases (`sol`, `astra`, `terra`, `luna`), `effort`, `service_tier`, `sandbox`, `worktree` path/branch surfacing, `lightweight`, `ignore_user_config`, `output_schema_json`, and opt-in `trust`. |
| `codex_resume` | Eager | Always | Continue an existing Codex thread by `thread_id` or `last: true` (`all: true` to ignore `cwd`), with `sandbox`, `output_schema_json`, `worktree`, and `ignore_user_config`. |
| `codex_fork` | Lazy | Always | Fork an existing `thread_id` (`codex exec fork`) into an independent branch preserving warm context & prompt cache — ideal for parallel `/swarm` fan-out after a scout pass. |
| `codex_review` | Eager | Always | Read-only `standard`, `adversarial`, `design`, or parallel `two-pass` (`pass1_mode`: `standard`/`adversarial` + Pass 2 `design`) code review with risk signals, sensitive untracked file exclusion, finding deduplication, and inline Review Viewer UI. |
| `codex_status` | Lazy | Sync | Async health check: Codex CLI version, auth status, cached models, resolved aliases, API key status, usage telemetry, recent jobs, and optional `diagnose: true` (`codex doctor --json`). |
| `codex_job_status` | Lazy | Sync | Inspect a recorded job by `job_id` or list recent jobs. |
| `codex_job_cancel` | Lazy | Sync | Cleanly terminate a running Codex process tree. |

### OpenAI Platform API & Dashboard Tools

| Tool | Loading | Background | Description |
| :--- | :---: | :---: | :--- |
| `openai_suite_dashboard` | Lazy | Sync | Opens the interactive **OpenAI & Codex** MCP App panel in the side pane (`+` menu) or left sidebar (`global` view). |
| `openai_usage` | Lazy | Sync | Usage telemetry split by ChatGPT subscription vs OpenAI Platform API (`today` / `7d` / `30d` / `all`), with optional `prune_jobs: true`. |
| `openai_responses` | Lazy | Always | Responses API with automatic async `background` polling + cancel-on-abort for `xhigh`/`max`, strict `output_schema_json`, `web_search` with extracted citations, `code_interpreter`, vision, and PDF/document `file_paths`. |
| `openai_image_generate` | Lazy | Always | Generate PNG, WEBP, JPEG, GIF, or SVG assets (`gpt-image-2.6-sunburst`, `gpt-image-2.6-flare`, `gpt-image-1.5`) with format validation, optional `return_preview`, and inline Asset Preview UI. |
| `openai_image_edit` | Lazy | Always | Edit, inpaint, or composite local images with optional `mask_path`, `input_fidelity`, `output_compression`, and inline Asset Preview UI. |
| `openai_audio_transcribe` | Lazy | Sync | Transcribe audio/video files (`gpt-4o-transcribe`, `gpt-4o-mini-transcribe`, `whisper-1`). |
| `openai_audio_speech` | Lazy | Sync | Synthesize speech audio (`gpt-4o-mini-tts`, `tts-1`, `tts-1-hd`) directly to disk. |
| `openai_list_models` | Lazy | Sync | List models enabled on your OpenAI Platform API organization. |

> **App-only UI helpers** (`app_get_dashboard_state`, `app_get_job_detail`, `app_cancel_job`, `app_prune_jobs`, `app_get_image_preview`) are declared with `visibility: ["app"]` — hidden from the model so they add **zero** context-window overhead.

---

## Interactive MCP App UI

Served from `ui://openai-suite/app.html` (`text/html;profile=mcp-app`) as a single self-contained CSP-compliant HTML bundle that automatically adapts to Antigravity's light/dark theme:

- **Control Panel & Usage Dashboard** (`aux_pane` & `global` sidebar): monitor CLI/API readiness, active & historical jobs, inspect unclipped outputs without extra `read_file` calls, run `codex doctor`, cancel running jobs, prune old logs, and launch `Resume` / `Fork` prompts directly into chat.
- **Code Review Viewer** (inline on `codex_review`): verdict banner, risk-signal badges, `P0`/`P1`/`P2` severity filters, pass filters (`bugs` / `adversarial` / `design`), live text search, clickable `file:line` jumps into Antigravity's side pane, and one-click **Ask to Fix** handoff.
- **Visual Asset Preview** (inline on `openai_image_*`): renders generated PNG/WEBP/JPEG/GIF/SVG assets with `checker` / `light` / `dark` backdrop toggles and one-click **Iterate / Edit**.

---

## Bundled Customizations

| Component | Path | Purpose |
| :--- | :--- | :--- |
| **Skills** | `skills/codex-rescue/SKILL.md` | Task delegation, debugging, `codex_fork`, and worktree workflows |
| | `skills/codex-review/SKILL.md` | Cross-model `standard`, `adversarial`, `design`, and `two-pass` reviews |
| | `skills/codex-swarm/SKILL.md` | Multi-agent `/swarm` orchestration, warm-context forking, and quota discipline across Plus / Pro plans |
| | `skills/openai-image/SKILL.md` | GPT-Image generation, transparent UI assets, SVG/GIF, and editing |
| **Subagent** | `agents/codex-worker.md` | Thin `flash_lite` forwarding bridge keeping Antigravity token spend minimal |
| **Rule** | `rules/AGENTS.md` | Compact always-on billing & tier discipline rule |
| **Hook** | `hooks.json` + `hooks/pre-tool-guard.mjs` | `PreToolUse` safety guardrail prompting confirmation on `danger-full-access`, `ultrafast`, `use_api_key: true`, or `trust: true` |

---

## Security, Reliability & Configuration

- **Cancellation & Progress:** Honors MCP `extra.signal` (immediately terminating Codex process trees or calling OpenAI `/responses/{id}/cancel`) and streams `notifications/progress` updates.
- **Non-blocking Event Loop:** All Git, Codex status, and job-list operations are asynchronous; Codex binary resolution is memoized.
- **Secret & Disk Hygiene:** Untracked sensitive files (`.env*`, `*.pem`, `*.key`, `id_ed25519`, `*credentials*.json`) are excluded from inline review prompts; `PLUGIN_DATA` directories and files use `0700`/`0600` permissions, atomic writes, orphaned `running`-job reconciliation on startup, SHA-256 API-key rotation detection, and automatic log pruning.
- **Guardrail Hook:** To disable the `PreToolUse` confirmation prompt, set `"enabled": false` in `hooks.json`.

### Optional Environment Variables

| Variable | Default | Description |
| :--- | :--- | :--- |
| `CODEX_BIN` | Auto-detected | Explicit path to the `codex` binary |
| `OPENAI_BASE_URL` | `https://api.openai.com/v1` | Custom OpenAI-compatible API base URL |
| `OPENAI_SUITE_MAX_JOBS` | `100` | Maximum historical job records kept in `PLUGIN_DATA/jobs` |
| `OPENAI_SUITE_RETENTION_DAYS` | `14` | Maximum age (days) of retained job artifacts |
| `OPENAI_SUITE_UI_HTML` | `ui/dist/app.html` | Override path to MCP App HTML for rapid UI iteration |

---

## Development & Testing

```bash
npm ci              # Install runtime + devDependencies (esbuild, @modelcontextprotocol/ext-apps)
npm run build:ui    # Rebuild self-contained ui/dist/app.html
npm test            # Run unit & MCP protocol integration tests (node --test)
npm run check       # Syntax checks + full test suite
```

## License

[MIT](LICENSE)