Google Antigravity provider plugin for OpenCode
  • TypeScript 99.8%
  • JavaScript 0.2%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-11-23 11:50:02 +11:00
src Initial commit: opencode-antigravity plugin 2026-11-23 11:50:02 +11:00
test Initial commit: opencode-antigravity plugin 2026-11-23 11:50:02 +11:00
.gitignore Initial commit: opencode-antigravity plugin 2026-11-23 11:50:02 +11:00
bun.lock Initial commit: opencode-antigravity plugin 2026-11-23 11:50:02 +11:00
opencode-antigravity.js Initial commit: opencode-antigravity plugin 2026-11-23 11:50:02 +11:00
package.json Initial commit: opencode-antigravity plugin 2026-11-23 11:50:02 +11:00
README.md Initial commit: opencode-antigravity plugin 2026-11-23 11:50:02 +11:00
tsconfig.json Initial commit: opencode-antigravity plugin 2026-11-23 11:50:02 +11:00

opencode-antigravity

Google Antigravity CLI (agy) provider plugin for OpenCode v2 and OpenChamber.

Routes OpenCode / OpenChamber chat requests through your local agy CLI in headless stream-json mode — no API keys, no credential scraping, persistent multi-turn sessions, and native reasoning effort variants.

How it works

OpenCode v2 / OpenChamber
  │  OpenAI-compatible Chat Completions (SSE)
  ▼
opencode-antigravity  (localhost proxy on 127.0.0.1)
  │  persistent stdin/stdout NDJSON (stream-json)
  ▼
agy CLI  (your local Antigravity login & settings)
  • Local CLI auth only: Sign in once with agy in a terminal. This plugin never reads, copies, or stores tokens.
  • Persistent sessions: Each OpenCode session reuses a single agy --input-format stream-json --output-format stream-json process to avoid startup overhead and keep Antigravity's prompt cache warm. Stateless utility calls (title, generate, compaction) run in isolated one-shot invocations.
  • Dynamic model catalog: Runs agy models in the background and groups effort-suffixed slugs (e.g. gemini-4-neon-low/medium/high/xhigh) into clean OpenCode models with effort variants.
  • Dual tool modes:
    • toolMode: "opencode" (default): Spawns agy in --mode plan and bridges OpenCode's tool schemas via <opencode_tool_call> blocks so OpenCode / OpenChamber executes all file reads, edits, commands, diffs, permissions, and MCP tools directly.
    • toolMode: "native" (opt-in): agy executes its own built-in tools in your project workspace and streams tool calls/results into OpenCode's reasoning/thinking stream.
  • Permissions respected: By default, agy uses your own ~/.gemini/antigravity-cli/settings.json (agentMode and permissions.allow). --dangerously-skip-permissions is never passed unless you explicitly opt in.

Prerequisites

  1. OpenCode v2 (@opencode/cli 2.x) / OpenChamber
  2. Antigravity CLI (agy) installed and authenticated interactively (agy once in a terminal; verify with agy models)

Install / Configure

Build the plugin locally:

bun install
bun run build

Then register the local folder in ~/.config/opencode/opencode.json:

{
  "plugins": ["/dir/to/opencode-antigravity"]
}

Or with plugin options:

{
  "plugins": [
    {
      "package": "/dir/to/opencode-antigravity",
      "options": {
        "toolMode": "opencode",
        "mode": "",
        "dangerouslySkipPermissions": false,
        "sandbox": false,
        "debug": false
      }
    }
  ]
}

Restart OpenCode / OpenChamber and pick an Antigravity model.

Plugin Options

Option Env Override Default Description
toolMode OPENCODE_ANTIGRAVITY_TOOL_MODE "opencode" "opencode" (OpenCode/OpenChamber executes all tools; agy runs in --mode plan) or "native" (delegate tools to agy)
mode OPENCODE_ANTIGRAVITY_MODE "" Optional agy --mode override: "" (respect settings.json), "plan", "accept-edits", or "auto"
dangerouslySkipPermissions OPENCODE_ANTIGRAVITY_DANGEROUSLY_SKIP_PERMISSIONS=1 false Pass --dangerously-skip-permissions to agy (ignored in toolMode: "opencode")
sandbox OPENCODE_ANTIGRAVITY_SANDBOX=1 false Pass --sandbox to agy
agyPath OPENCODE_ANTIGRAVITY_CLI_PATH auto Explicit path to the agy executable
printTimeout OPENCODE_ANTIGRAVITY_PRINT_TIMEOUT none Optional --print-timeout duration (e.g. "15m")
compactAt — none Optional earlier compaction token threshold
debug OPENCODE_ANTIGRAVITY_DEBUG=1 false Write debug logs to ~/.local/share/opencode-antigravity/debug.log

Additional environment variables:

  • OPENCODE_ANTIGRAVITY_PROXY_PORT: Pin a fixed localhost port instead of an ephemeral port.
  • OPENCODE_ANTIGRAVITY_CWD: Fallback working directory when no project directory header is present.
  • OPENCODE_ANTIGRAVITY_HISTORY_MAX_CHARS: Max characters to replay on a fresh/stateless turn (default 400000, 0 disables truncation).

Development & Tests

bun run typecheck
bun run build
bun test

License

MIT