Skip to content

Repository files navigation

OpenCode Antigravity CLI Plugin

npm version npm downloads CI License GitHub stars

An OpenCode plugin for the Antigravity CLI (agy). It ships one provider, google-agy-acp, which drives your local agy binary over the Agent Client Protocol (agy acp).

Installation

Add the plugin to your OpenCode configuration (opencode.json in your project, or ~/.config/opencode/opencode.json):

{
  "$schema": "https://opencode.ai/config.json",
  "plugin": ["@anthonyhaussman/opencode-agy-auth"]
}

Then connect the google-agy-acp provider in OpenCode and pick an authentication method (see below).

Requirements

  • OpenCode >= 2.4.0, required by google-agy-acp (this package supports the v2 plugin API only; older OpenCode versions cannot load the provider). OpenCode 2.2.3 to 2.3.2 can load the provider, but their system prompt names the Code Mode tool tools.opencode.session_move, and agy answers every prompt that contains this string with RESOURCE_EXHAUSTED (code 429) (antigravity-cli#1684). OpenCode 2.4.0 renamed the tool to tools.opencode.session.move.
  • agy >= 1.5.10 for google-agy-acp. The binary is agy on your PATH, or the path in OPENCODE_AGY_PATH.

google-agy-acp provider

The provider starts agy acp --agent opencode (one process per OpenCode session, no shell) and exposes agy's models in OpenCode. OpenCode keeps ownership of tools: they are presented to agy through a local MCP bridge (127.0.0.1, random port, per-process bearer token) served by an agy plugin named opencode-bridge, so file edits and commands still run inside OpenCode with OpenCode's permission prompts. Model ids carry the thinking level (for example gemini-4-neon-low), so models have no variants. The model list comes from agy models shortly after startup and refreshes when agy reports a different list at session start. If agy models fails later, the provider keeps the last list that worked for the current account; if agy is missing, too old, or has never answered for that account, the provider lists no models.

Authentication

Pick a method when connecting the google-agy-acp provider:

  • Gemini API key (recommended): stored by OpenCode, passed to agy as GEMINI_API_KEY in the child environment.
  • Vertex AI / Agent Platform (recommended): uses your Application Default Credentials. Nothing is stored by OpenCode.
  • Google login (personal or Gemini Enterprise / Workspace): you sign in with agy itself; the plugin never reads, refreshes or forwards agy's OAuth tokens and never reads the OS keyring.

What this provider changes on your machine

  • Global agy plugin. On first use the provider runs agy plugin install and adds the opencode-bridge plugin to agy's global plugins in ~/.gemini/config/plugins/. A one-time notice is shown. Remove it at any time with agy plugin uninstall opencode-bridge. The plugin never edits ~/.gemini/config/* by hand.
  • read_file is not sandboxed. agy's own read_file can read any file your user can read, including files outside the workspace, without a permission prompt. It is read-only and appears in OpenCode as a provider-executed call. Other agy built-ins (write_file, run_command and so on) are rejected.
  • Shared schema cache. agy caches tool schemas in ~/.gemini/antigravity-cli/mcp/opencode-bridge_bridge/, shared by all sessions. Concurrent sessions with different tool sets can see each other's schemas; calls to a tool the session does not have are rejected by the bridge.
  • Other MCP servers are blocked. MCP servers from other agy plugins are blocked by permission rejection.
  • Long tool runs. agy times MCP calls out at 180 s. OpenCode tools that run longer than 170 s return "still running" to agy, and the result is delivered with the next message.
  • Process lifetime. agy child processes are not killed when the plugin unloads (the v2 setup hook has no disposer), but they exit after 5 minutes idle or when OpenCode exits.

Environment variables

  • OPENCODE_AGY_PATH: path to the agy binary (default: agy on PATH).
  • AGY_ACP_DEBUG=1: write a debug log of each agy child process (spawn, ACP JSON-RPC traffic, stderr, exit). The bridge token and the Gemini API key are redacted; prompts and tool output are logged as-is. Off by default.
  • AGY_ACP_DEBUG_FILE: debug log path (default: $XDG_DATA_HOME/opencode/agy-acp/debug.log, or ~/.local/share/opencode/agy-acp/debug.log). Created with mode 0600.

Migrating from the google-agy provider

The direct Code Assist provider google-agy, its agy_quota and agy_quota_summary tools and the /agyquota and /agyquotasummary commands were removed. To migrate:

  • Switch your models from google-agy/<model> to google-agy-acp/<model>.
  • Delete any provider.google-agy block (for example options.projectId) from opencode.json. OPENCODE_AGY_PROJECT_ID, OPENCODE_AGY_AUTH_PROXY, OPENCODE_AGY_ENDPOINT and OPENCODE_AGY_VERBOSE_LOGS are no longer read.
  • The google-agy entry in ~/.local/share/opencode/auth.json is no longer used and can be deleted.
  • The antigravity-turn-states.json file under ~/.config/opencode/ is no longer written and can be deleted.

Quota

For quota in OpenCode, a google-agy-acp provider for opencode-quota is proposed in anthonyhaussman/opencode-quota#2. It reads agy -p /usage --output-format json and shows the weekly and five-hour windows for each model family. You can also run /usage in agy directly.

Local Testing

To test and develop the plugin locally with OpenCode before publishing:

  1. Build the plugin locally: Clone the repository, install dependencies, and build the source code:

    npm install
    npm run build
  2. Configure OpenCode to use the local build: In the target project where you want to test the plugin, open your opencode.json (or ~/.config/opencode/opencode.json for global testing) and add the absolute local path to the plugin:

    {
      "$schema": "https://opencode.ai/config.json",
      "plugin": ["/absolute/path/to/opencode-agy-auth"]
    }

    Note: OpenCode also supports dropping plugin files directly into the .opencode/plugins/ folder in your project.

  3. Verify the plugin: Launch OpenCode in your target project. OpenCode will automatically resolve and load your local plugin directory. You can test your changes by running npm run build in the plugin directory and restarting your OpenCode session.

Pre-release Channel

To test bleeding-edge features or upcoming changes before official releases, configure the @alpha distribution tag:

npm install @anthonyhaussman/opencode-agy-auth@alpha

Or configure it directly in your opencode.json:

{
  "plugin": ["@anthonyhaussman/opencode-agy-auth@alpha"]
}

Warning

Instability Warning: The @alpha release contains experimental features and active development builds. It may be unstable or cause disruptions in session authentication and model requests. Use only for testing and development. For day-to-day work, use the stable release.

Star History & Support

If this plugin saved you time or made using Antigravity models in OpenCode smoother, consider giving the repository a star on GitHub - it helps others discover the project.

Releases

Packages

Contributors

Languages