Skip to content

Quickstart for Antigravity (agy) Users ​

NOTE

Gemini CLI is retired — Antigravity (agy) is the Gemini CLI route in Kompile. Any workflow that previously targeted Gemini CLI now runs through agy (--provider gemini --auth native or --mode passthrough --agent agy).

Kompile has first-class support for the Google Antigravity CLI (agy) over its Agent Client Protocol (agy acp). You get Antigravity's models and personal Google AI login inside Kompile's harness — with Kompile's tools, persistent memory, policy enforcer, subagent containment, and quota tracking wired in automatically.

Prerequisites ​

  • Kompile CLI installed (Installation & Updates)
  • The agy CLI installed and on your PATH (check with agy --version)

You don't need to type provider or auth flags every time. Run the interactive wizard once to connect Antigravity (agy), pick your model, and save your defaults — after that, just run kompile chat:

bash
cd /path/to/your/repo
kompile chat             # Launches SetupWizard on first run (or `kompile chat --setup` anytime)

In SetupWizard, choose Standard Chat → Gemini → Antigravity (or Passthrough → agy). You can also sign in at any time with bare kompile auth login (or /auth inside chat).


1. Sign in with your Google account ​

Antigravity does not have a standalone agy login subcommand; its real login runs via agy acp --login. Kompile wraps that flow inside kompile auth login (interactive Auth Wizard → Antigravity (agy)) and /auth inside chat, or directly from the command line:

bash
# Direct command: drives `agy acp --login`, surfaces the Google consent URL, and relays your auth code
kompile auth login agy

# Check active account and previously seen Google accounts (zero-cost probe via `agy models`)
kompile auth list agy

Credential ownership: Kompile stores no Antigravity token. Your OAuth token stays inside agy's own OS keyring under ~/.gemini. Kompile only inspects agy's login log to display which Google account email is active. To switch accounts, run kompile auth login (or kompile auth login agy) again; to sign out, use agy's own /logout.


2. Start chatting through Kompile ​

Once configured via kompile chat --setup, simply run kompile chat.

For scripts or one-off launches, Kompile maps Antigravity to the gemini vendor's native route (VendorAgentRoutes: agy/antigravity → gemini + native):

bash
cd /path/to/your/repo

# Interactive setup wizard (pick Gemini → Antigravity and save defaults)
kompile chat --setup

# Direct CLI commands (scripts / overrides)
kompile chat --provider gemini --auth native
kompile chat --mode passthrough --agent agy

Want to use a Gemini API key or Google Code Assist directly in Kompile's own agentic loop without spawning agy?

bash
kompile auth login gemini            # Stores GEMINI_API_KEY (or export GEMINI_API_KEY)
kompile chat --provider gemini --auth api-key --model gemini-2.5-pro

3. How Kompile integrates with agy under the hood ​

Understanding these three mechanics explains why an agy session inside Kompile behaves differently from bare agy:

Long-lived ACP session + compaction reload ​

Kompile keeps a single agy acp subprocess alive per client (AgyCliClient / AgyAcpSession). Each user turn is a session/prompt, session/update events stream directly into Kompile's TUI, and restarts resume with session/resume. When agy compacts its context, Kompile automatically re-delivers the memory files and skills the conversation loaded (NativeCompactionReload).

Native tool guard (AgyNativeToolGuard) ​

Kompile passes an extra Kompile-owned workspace (~/.kompile/guards/agy-native-tools) via --add-dir. That directory contains:

  • .agents/hooks.json with three PreToolUse guards:
    • kompile-native-tool-guard: denies agy's built-in file, shell, search, and web tools (read_file, view_file, write_file, edit_file, run_command, list_dir, find_by_name, grep_search, search_web, read_url_content, etc.) and redirects the model to mcp_kompile_<tool> (read, write, edit, bash, process, list, glob, grep, websearch, webfetch).
    • kompile-brain-guard: blocks direct reads/writes to ~/.gemini/antigravity-cli/brain and redirects to Kompile's persistent memory tool.
    • kompile-memory-mandate-guard: enforces session memory recall when the memory mandate is enabled.
  • AGENTS.md: informs the model up front to call mcp_kompile_* directly on its first turn, avoiding wasted denied calls.

Tools Kompile does not duplicate (browser, interactive questions, MCP plumbing) remain available on agy.

Shared MCP config (~/.gemini/config/mcp_config.json) ​

Over ACP, agy reads user-wide ~/.gemini/config/mcp_config.json (it does not load per-project .agents/mcp_config.json). Kompile manages the kompile stdio server entry there automatically and passes each session's transcript, working directory, and workflow identity through agy's launch environment.

If you run standalone agy outside Kompile and want Kompile's MCP tools available, verify ~/.gemini/config/mcp_config.json includes:

json
{
  "mcpServers": {
    "kompile": {
      "command": "kompile",
      "args": ["mcp-stdio"]
    }
  }
}

4. How resolve_model works with Antigravity (agy) & Gemini ​

Before dispatching a subagent (task, multi_task, or quorum_task), Kompile agents call resolve_model — a read-only discovery tool that never invokes a model, never triggers a login, and never silently switches accounts:

When a delegation names a gemini-* model without an explicit provider, ModelRouting keeps your active gemini route (or routes deterministically to gemini if it is configured).


IMPORTANT

For Antigravity (agy), mainly use a worker model like Hydrogen (gemini-4-hydrogen) rather than Neon (gemini-4-neon). Neon ($3/M input, $15/M output) is double the cost of Hydrogen ($1.5/M input, $7.5/M output) — keep Neon for the main agent and ban top-tier models (*neon*, *opus*, *fable*, *astra*) from subagents unless you are sure of the cost.

WARNING

Google personal-login restriction on unattended subagents (SubagentChatConfig): Google allows personal Google logins only for a person working directly. Kompile enforces this policy automatically (AgyAccountPolicy) — an unattended delegated subagent on agy or Gemini Code Assist cannot run on a personal Google login. Route subagents to a Gemini API key (provider=gemini auth=api-key), Agent Platform, a business sign-in with GOOGLE_CLOUD_PROJECT, or another provider (such as OpenAI Luna).

RoleRecommended ModelWhy
Main agent (lead)gemini-4-neon (or gemini-4-argon / gemini-4-carbon)Top reasoning quality for interactive planning and synthesis on your agy session
Subagent workersgemini-4-hydrogen (or gemini-3.8-flash for lightweight sweeps)Half the token price of Neon with strong coding and tool-use accuracy
Banned from subagents*neon*, *opus*, *fable*, *astra*Prevents unintended premium spend across parallel workers

Configure these defaults once in ~/.kompile/config/subagent-config.json (subagents never borrow the parent chat's managed credential, so name the Gemini API credential from kompile auth list gemini):

text
/subagent-config ban *neon*
/subagent-config ban *opus*
/subagent-config ban *fable*
/subagent-config ban *astra*
/subagent-config route gemini/gemini-4-hydrogen auth=api-key credential=default
/subagent-config role-route explorer gemini/gemini-3.8-flash auth=api-key credential=default
/subagent-config per-session 4
/subagent-config cost-budget 2.00
/subagent-config preload-tools read,grep,glob,edit,write,bash

What Kompile adds for Antigravity workflows ​

  • Unified Enforcer & Judge: Every file edit, search, and shell command passes through Kompile's MCP layer, so build lanes, read-before-edit, diff indexing, and judge rules apply identically to agy sessions.
  • Cross-agent persistent memory: Memories saved via mcp_kompile_memory are immediately visible to Claude, Codex, and direct-API sessions in the same repo.
  • Quota & usage reporting: /usage queries Antigravity's quota state alongside Kompile's local tool/token ledger (VendorUsageService).
  • Contained subagents: When Kompile spawns an agy worker (~/.kompile/guards/agy-worker), it declares tools: [] so the worker uses only Kompile's shared MCP surface and respects KOMPILE_SUBAGENT_DEPTH.

Importing & resuming Antigravity sessions ​

Kompile's agy adapter discovers Antigravity sessions from ~/.gemini/antigravity-cli/conversation_summaries.db and ~/.gemini/antigravity-cli/brain/<uuid>/.system_generated/logs/transcript.jsonl (and still supports historical legacy Gemini CLI sessions via --source=gemini from ~/.gemini/tmp/):

bash
# Import existing Antigravity sessions into Kompile's portable store
kompile session import --source=agy
kompile agent chat-import sync --source=agy

# Browse and resume an Antigravity session — or hand it off to another vendor
kompile resume --filter-source agy
kompile resume -t <session-uuid> --agent agy           # Resumes natively over agy acp (session/resume)
kompile resume -t <session-uuid> --agent claude        # Hand off an agy session to Claude or Codex
kompile resume-all --agent agy                         # Restore recently active Antigravity windows

Inside a managed agy session, kompile-brain-guard blocks direct file reads of ~/.gemini/antigravity-cli/brain — use Kompile's conversation_import and resume MCP tools (or kompile resume in the shell) whenever you want to inspect, import, or continue prior Antigravity conversations.

See Import & Resume for cross-agent compaction and batch recovery details.

Common gotchas ​

  • Don't rely on Antigravity's brain directory inside Kompile: kompile-brain-guard intentionally blocks ~/.gemini/antigravity-cli/brain so persistent state stays portable in Kompile's memory store.
  • Lazy vs eager MCP tools: Redirect targets (read, write, edit, bash, process, list, glob, grep, websearch, webfetch, memory) are loaded eagerly as mcp_kompile_<tool>; the rest of Kompile's catalog is available on demand via call_mcp_tool with ServerName: "kompile".

Next steps ​

Released under the Apache-2.0 License.