Google Antigravity provider plugin for OpenCode
- TypeScript 99.8%
- JavaScript 0.2%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| src | ||
| test | ||
| .gitignore | ||
| bun.lock | ||
| opencode-antigravity.js | ||
| package.json | ||
| README.md | ||
| tsconfig.json | ||
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
agyin 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-jsonprocess 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 modelsin 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): Spawnsagyin--mode planand 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):agyexecutes its own built-in tools in your project workspace and streams tool calls/results into OpenCode's reasoning/thinking stream.
- Permissions respected: By default,
agyuses your own~/.gemini/antigravity-cli/settings.json(agentModeandpermissions.allow).--dangerously-skip-permissionsis never passed unless you explicitly opt in.
Prerequisites
- OpenCode v2 (
@opencode/cli2.x) / OpenChamber - Antigravity CLI (
agy) installed and authenticated interactively (agyonce in a terminal; verify withagy 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 (default400000,0disables truncation).
Development & Tests
bun run typecheck
bun run build
bun test
License
MIT