yuting0624/antigravity-for-claude-code
Über uns
Claude-Code-Plugin: Führt die Antigravity-CLI (Gemini) als kooperierenden Subagenten aus und übernimmt das intelligente Modell-Routing über den gesamten Softwareentwicklungszyklus hinweg. Community-Projekt; nicht mit Google/Anthropic verbunden.
EntwicklerwerkzeugeGemessener Sternzuwachs
- in 24h
- +7
- in 7 days
- +24
- in 15 days
- +54
- in 1 month
- Verlauf wird gesammelt
Nettoänderungen in überlappenden Zeiträumen, keine Tagessummen. Fehlende Messwerte bleiben leer. Sterne zeigen Interesse, nicht Qualität.
README.md
Original🛰️ Antigravity for Claude Code
Run the Antigravity CLI (Gemini) as a collaborating sub-agent, right inside Claude Code.
Claude conducts the judgement; Gemini does the heavy lifting — intelligent model routing across the SDLC.
[!NOTE] Terms of Service & Authentication (
v0.32.2+, behavior change fromv0.32.0–v0.32.1): Per Antigravity Additional Terms §6 and the Antigravity FAQ (retrieved2026-12-01), "running the unmodified Antigravity harness through its supported interfaces—such as wrapping it with a third-party UI (e.g., via agent client protocol), calling it as a tool or subagent from another harness, using the Antigravity CLI in headless mode, or configuring it through supported customization and extension mechanisms...—is permitted." Extracting OAuth tokens outside the official Antigravity runtime, modifying/bypassing the runtime or repurposingagyas a raw model proxy, and sharing/pooling/reselling entitlements remain prohibited; per the same FAQ/Terms, "Violations may result in suspension of your Antigravity access with an appeal path for re-enablement. This will have no impact on your broader Google account."Since
v0.32.2, Consumer OAuth works out of the box (including personal Google AI Pro / Ultra) alongside Google Cloud project OAuth (2. Use a Google Cloud project— Pay As You Go or Gemini Enterprise), Vertex AI ADC (AGY_ADC_AUTH=true), Gemini API key ({"modelProvider": "gemini"}in~/.gemini/antigravity-cli/settings.json+GEMINI_API_KEY), and Enterprise LLM Gateway. Google Workspace users wanting Gemini 4 / Vertex billing should still choose2. Use a Google Cloud projectorAGY_ADC_AUTH=trueto avoid consumer starter quota. Upgrading fromv0.32.0–v0.32.1and want to keep blocking Consumer OAuth? SetAGY_BLOCK_CONSUMER_OAUTH=1(1|true|on) to opt into the synchronous fail-closed guard (exit 11,CONSUMER_OAUTH_BLOCKED). For lightweight stateless Gemini API-key calls from Claude Code without Google Cloud setup, see the officialgoogle-gemini/gemini-api-cli.
⚡ Quick look

Claude stays the conductor; the bulk, token-heavy read ran on cheaper Gemini, and Claude verified the result.
💡 Why
| Claude (conductor) | Gemini / agy (executor) |
|
|---|---|---|
| Owns | requirements · architecture · the hard 20% · verification · review | scaffold · implementation · test generation · search |
| Strength | judgement | cheap, fast throughput |
you → Claude Code (conduct: design / verify / review)
└── agy → Gemini (execute: implement / test / search)
Generation is solved; verification, judgement, and direction are the craft.
✨ What it does
- Routes work across the SDLC — Claude keeps the judgement calls; Antigravity handles scaffolding, test generation, first-pass review, and migrations under a shared
AGENTS.md. - Adds tools Claude lacks natively — live Google/web search, Vertex AI Search over your internal data, deep research, Cloud Logging. Claude reviews and re-checks the results.
- Hears audio, watches video —
/antigravity:mediadelegates the perception to Gemini (natively multimodal, no local ffmpeg/Whisper stack): you get a timestamped digest while the full transcript is written to a file, so a 1-hour recording never lands in Claude's context. - Cross-model verification — an independent, different-model opinion on your code.
- Background jobs — fire a long delegation, keep working, collect later.
- Internal fan-out — one delegation, and agy spawns its own subagents on the cheap side (dynamic
define_subagenton agy ≥ 1.0.16;TypeName "self"+ Role on any version); each leaves a readable trajectory you audit withagy-trace. - Hand-off mode —
/antigravity:handoffgives agy a whole, test-covered task; Claude reads nothing and verifies only by running the tests. The one delegation shape that measured cheaper than Claude Code alone on implementation work (0.58× per passing task; 0.43× on large tasks — and a loss on small ones), at the price of a 3–4× longer wall-clock and code that needs the human review a first draft gets. - Built-in cost discipline — measured, not guessed (see below).
- Drops in with the discipline on — a
SessionStarthook injects the cost-aware routing policy automatically (toggle in plugin settings), and theantigravity-delegatesubagent does file writing on Gemini, so Claude spends no tokens generating file contents. - No slash command required — the delegate subagent is picked up proactively for bulk
work, and a prompt-level nudge flags bulk-looking requests as delegation candidates.
Both are advisory: the break-even judgment stays with Claude (full auto-routing is a
measured net loss below the break-even), and the nudge is toggleable (
delegation_nudge).
📊 Measured results
On a large ADK multi-agent build (+ adk eval), same task / same model, 3 ways:
| Claude solo @high | solo @max | hybrid | |
|---|---|---|---|
| frontier cost (COST-WEIGHTED) | 2.62M | 5.34M | 1.91M |
quality (adk eval) |
✅ 3/3 | ✅ 3/3 | ✅ 3/3 |
→ −27% vs solo@high, −64% vs solo@max, at equal quality — and the cheap Gemini work isn't even counted. Savings scale with task size; tiny one-off tasks are cheaper to just run on Claude. Full A/B: docs/AB-RESULTS.md.
Note on cost figures: numbers are estimates — token counts are approximated and rates live in
prices.json. Set your real Vertex rates there before quoting any figure.
Hand-off mode, measured on real pull requests (2026-09, on agy 1.2.2 only; #91). Eight merged PRs from caddy,
cli/cli, k6 and zoekt (52–2,242 lines), replayed with the PR's tests restored before
scoring, Claude Opus 5 conducting, agy on Gemini 3.8 Flash, n = 2 per cell, blinded
two-family review. Delegating file by file while Claude reads and specifies cost
1.33–1.68× a solo run per passing task. Handing the whole task to agy and verifying
only by running the tests (agy-handoff) cost 0.58× (95% CI 0.39–0.96) at the
pre-registered price deck — 0.43× on large tasks, 1.20× on small ones — with 16/16
tests passed and the Claude side alone at 0.16×; the blinded Claude judge rated that code
0.6 of 5 below the solo run (dead code, duplicated helpers), about 0.2 below the human-merged
PR. At the Gemini unit price this project was actually billed (2× the promotional rate) the
overall saving disappears and large tasks keep 0.77×. Full protocol, per-run records and
deviations: PR #91.
🚀 Install
In Claude Code:
/plugin marketplace add yuting0624/antigravity-for-claude-code
/plugin install antigravity@antigravity-for-claude-code
/antigravity:setup # verifies agy is installed + authenticated
Prerequisites: the Antigravity CLI (agy) installed and authenticated (personal Google OAuth, Google Cloud project, Vertex AI ADC, Gemini API key, or Enterprise LLM Gateway — see below), plus Claude Code. For the same-bill cost benefit, run Claude Code on Vertex too.
🔐 Authentication & Terms guidance
Per Antigravity Additional Terms §6 and the Antigravity FAQ (retrieved 2026-12-01), running the unmodified Antigravity harness through its supported interfaces — including calling agy -p in headless mode as a tool or subagent from Claude Code — is permitted. Extracting/reusing Antigravity OAuth tokens directly inside third-party software outside the official agy runtime, modifying/bypassing the runtime or repurposing agy as a raw model proxy for an external agent loop or inference backend, and sharing/pooling/reselling individual entitlements across multiple users remain prohibited. Per the Terms & FAQ, violations may result in suspension of Antigravity access with an appeal path for re-enablement, with no impact on your broader Google account.
| Auth route | Status with this plugin | How to configure |
|---|---|---|
| Consumer OAuth (Free, Google AI Pro / Ultra) | ✅ Supported out of the box (Terms §6) | Run agy and sign in via 1. Google OAuth (permitted for unmodified agy -p as a subagent/tool; optional enterprise block via AGY_BLOCK_CONSUMER_OAUTH=1) |
| Google Cloud project OAuth (Pay As You Go or Gemini Enterprise) | ✅ Supported (GCP Service Terms) | Run agy → /logout → 2. Use a Google Cloud project → 1. Continue with Google Cloud → PayGo or Gemini Enterprise Subscriptions (recommended for Google Workspace / Vertex billing) |
| Vertex AI ADC (headless / VM / CI) | ✅ Supported (GCP Service Terms) | gcloud auth application-default login + export AGY_ADC_AUTH=true GOOGLE_CLOUD_PROJECT=<id> GOOGLE_CLOUD_LOCATION=global (true, 1, or on — not yes) |
| Gemini API key | ✅ Supported (Gemini API Terms) | Add {"modelProvider": "gemini"} to ~/.gemini/antigravity-cli/settings.json and export GEMINI_API_KEY=<key> (install docs) |
| Enterprise LLM Gateway (MDM policy) | ✅ Supported (Enterprise docs) | Configured by your organization's admin_settings.json |
Two common traps (both checked by
/antigravity:setup/agy-doctor):
- Google Workspace
1. Google OAuthtrap: Signing in with a Google Workspace account via1. Google OAuth("Continue with Google") still issues a consumer OAuth token ("auth_method": "consumer"), ignoressettings.json's"gcp"block at runtime, and resolves to starter quota (~6 models, no Gemini 4) (FAQ). Runagy→/logoutand choose2. Use a Google Cloud project(or setAGY_ADC_AUTH=true) for Gemini 4 and Vertex AI billing.- Bare
GEMINI_API_KEYtrap: Per Antigravity CLI install docs, "Only setting aGEMINI_API_KEYenvironment variable on its own has no effect" —agykeeps using OAuth unless~/.gemini/antigravity-cli/settings.jsonalso sets"modelProvider": "gemini". Standard Gemini API Additional Terms apply when routing via API key (Paid tier required in EEA/UK/CH and for non-training data handling; distillation, competing-model development, and leaked keys remain prohibited).Optional enterprise policy guard (
AGY_BLOCK_CONSUMER_OAUTH=1,v0.32.2+): Consumer OAuth is allowed by default. Enterprise or team environments that want to require Google Cloud, Vertex AI ADC, Gemini API key, or Enterprise LLM Gateway auth can setexport AGY_BLOCK_CONSUMER_OAUTH=1(accepted values:1,true,on— human-only env var, never a CLI flag, and env-var prefixes/unsets are blocked for theantigravity-delegatesubagent byhooks/validate-delegate-bash.sh). When enabled,agy-delegate,agy-handoff, andagy-job startdetect the active auth route without reading OS Keychain secrets (probingpython3/python/py -3with a pure-POSIX shell fallback when Python is unavailable) and abort synchronously withexit 11(CONSUMER_OAUTH_BLOCKED, creating no background job) on high-confidence Consumer OAuth (agy-doctorfails andhooks/check-agy.shemits a non-blocking stderr warning); ambiguous states warn inagy-doctoronly and never false-block. A human-only shell override (AGY_ALLOW_CONSUMER_OAUTH=1) takes precedence ifAGY_BLOCK_CONSUMER_OAUTH=1is inherited from a shared profile.
🤝 Choosing between this plugin and official gemini-api-cli
These two tools are complementary:
- Use official
google-gemini/gemini-api-cli(Apache 2.0, single Go binary,gemini-api install-skill --agent claude-code) when you want lightweight, stateless Gemini API-key calls from Claude Code — especially multimodal generation/analysis (image,tts,music,video,analyze,transcribe) or managed Deep Research (agent run --background) with zero Google Cloud setup. - Use
antigravity-for-claude-code(on personal Google AI Pro/Ultra Consumer OAuth, Google Cloud PayGo / Gemini Enterprise, Vertex AI ADC, Enterprise LLM Gateway, ormodelProvider: "gemini"+GEMINI_API_KEY) when you want full multi-file repository agent delegation (--dir), test-gated/antigravity:handoff, internal subagent fan-out,/antigravity:statusbackground jobs, Cloud Run debugging, Vertex AI Search grounding, trajectory/cost auditing (agy-trace/agy-cost-compare), and enterprise IAM/VPC/Gateway governance.
Platform support: macOS, Linux, and WSL are the supported targets for headless delegation. Native Windows (Git Bash/MSYS) is not recommended — agy -p can hang with a 0-byte log when run without a real console (ConPTY); see issue #6. The wrapper now bounds this with a wall-clock guard (GNU timeout/gtimeout, returning a clean TIMEOUT instead of hanging), and doctor distinguishes a hang from an auth failure — but for reliable headless use, run from WSL/macOS/Linux.
🧩 Slash commands

The plugin's commands show up natively in Claude Code's / menu.
| command | what it does |
|---|---|
/antigravity:setup |
health check — agy installed + authenticated, scripts ready |
/antigravity:delegate [--tier flash|flash-lo|pro] <task> |
delegate a subtask to agy under cost discipline, then verify |
/antigravity:handoff [--dir <repo>] [--tests <files>] <requirement> |
hand a whole test-covered task to agy; Claude reads nothing, the wrapper runs the tests, allows one fix-up, and reports — 0.58× a solo run per passing task on the PR-replay benchmark (small tasks: more) |
/antigravity:review [--adversarial] |
independent cross-model review of the current diff; Claude reconciles |
/antigravity:research [--tier flash|flash-lo|pro] [--timeout 15m] <topic> |
Claude-orchestrated deep research — agy does grounded web legwork, Claude verifies citations across ≥2 sources |
/antigravity:media <file> [focus] [--convert] |
understand audio / video / images — agy transcribes + analyzes, returns a timestamped digest; full transcript goes to a file, not your context |
/antigravity:cloud-run-debug [--service <s>] [--region <r>] [--project <id>] [--since 1h] [--apply] |
diagnose a failing Cloud Run service — agy digests the error logs, Claude infers the root cause + fix; read-only by default (--apply writes to a branch) |
/antigravity:status [id] · :result <id> · :cancel <id> |
manage background delegation jobs (:cancel terminates the full job process tree and marks state=cancelled) |
/antigravity:migrate [--apply] [--include-repos] |
move an existing Claude Code setup onto agy — skills, CLAUDE.md, memory, MCP, plugins, permissions; dry-run by default, --uninstall reverses it |
Background jobs are for interactive sessions (fire-and-collect). In headless
claude -p(one-shot), delegate synchronously — there's no later turn to collect a result.
📦 Bringing your Claude Code setup across
/antigravity:migrate moves an existing Claude Code configuration onto agy. Dry-run
by default; --apply backs up first and --uninstall --apply reverses it. Your
~/.claude is never written to.
/antigravity:migrate # see the plan
/antigravity:migrate --apply # global assets
/antigravity:migrate --apply --include-repos # also AGENTS.md + per-repo memory
| your Claude Code asset | becomes |
|---|---|
~/.claude/skills/ |
read in place — a skills.json entry, not a copy, so one edit serves both tools |
| installed plugins | ~/.gemini/config/plugins/ via the native importer, with its output repaired |
CLAUDE.md |
an AGENTS.md symlink beside it |
| auto-memory | always-on rules — global ones in a plugin, per-repo ones in <repo>/.agents/rules/ |
| MCP servers (project + desktop app) | merged into ~/.gemini/config/mcp_config.json |
| trusted projects | trustedWorkspaces |
permissions.allow |
a proposal file — see below |
~/.claude/agents/ |
nothing. A user subagent's model: names a Claude tier (opus / sonnet / haiku) and its tools: lists Claude tool names, so there is no honest mapping; subagents shipped inside a plugin come across with the plugin |
~/.claude/CLAUDE.md, ~/.claude/commands/, hooks in settings.json |
nothing — only the copies that ship inside a plugin are carried across |
| session history | nothing. Antigravity stores conversations as protobuf blobs inside per-conversation SQLite files; there is no writer |
Two things are deliberately not automatic. Permissions widen when translated —
Claude's allow-list holds whole command lines, while agy's command() matches a
prefix — so the result is written out for review and merged only with
--apply-permissions. model / effortLevel / env are reported and never
written, because no honest mapping exists.
Worth knowing if you would rather do it by hand: an Antigravity rule without
trigger: always_on in its frontmatter is ignored with no error and no warning,
workspace .agents/ is ignored entirely unless the session is bound to an agy project,
and agy plugin import claude finds nothing on a current Claude Code because it only
looks one directory deep. docs/MIGRATION.md has the full layout
reference, the compatibility matrix, and how each of these was measured.
🗳️ The same two models, arranged differently
This plugin is one shape of Claude and Gemini working together: conductor and executor — judgement on one side, throughput on the other, one workflow. It is also the shape for people who live in a terminal.
gemini-studio-mcp is the same thesis on the other surface: Claude Desktop, for the colleagues who will never open one. An MCP server rather than a CLI delegation, and the verb flips from execute to ingest — Gemini reads the recording, the PDF corpus, the internal search index, and only the digest reaches Claude. The split is not cosmetic: you can hand a developer a --tier flag and an AGENTS.md, but a business user drags a PDF into a chat window, so the routing that is explicit here is automatic there, and the cost discipline that is a documented practice here is a number printed on every response there. They also fail differently — delegated writing can silently not happen and has to be checked against the filesystem; delegated reading can quietly summarise away the one paragraph that mattered and has to be checked against citations. Same author as this plugin.
quorum-review is the third shape: the two as peers. Both read the same pull request independently, neither sees the other's output, and where they agree independently that is the result — only the disagreements are worth a second opinion. Both run on one Google Cloud credential, so no vendor API keys live in the repository. Same author as this plugin.
This repo is its client zero. It runs on every pull request opened here, alongside a Claude review — including the ones that change this plugin. Keeping the habit of not quoting numbers we haven't measured, here is what that has actually been worth:
- On a fixture holding three known bugs it found two, with no false positives, and reached the correct root cause on one that the single-model review took two rounds to get right.
- Reviewing this repo's own CI, both of its models independently caught a fork-guard hole in the review workflow itself — one that would have put an outside contributor's code on the runner next to live credentials.
- It has also produced a confident false positive that both models agreed on — the code disproving it lived outside the checkout either model could read.
That last one is the useful lesson, and it cuts against the obvious pitch: two independent scans insure you against one model's blind spot. They do not insure you against a gap in what you handed both of them.
🛠️ Direct script usage & tiers
# one-shot delegation (plain text on stdout)
scripts/agy-delegate.sh --tier flash "Summarize this changelog in 3 bullets: ..."
# give Antigravity a workspace for multi-file agentic work
scripts/agy-delegate.sh --tier pro --dir ./src "List every TODO with file:line"
# bulk read -> digest-only reply (the biggest cost lever; wrapper warns on dump-sized replies)
scripts/agy-delegate.sh --digest --dir . "Map the auth flow end to end"
# scoped read-only web / URL research (agy >= 1.4.10; sets agentMode="", allowNonWorkspaceAccess=false, request-review + read_url(*) without --yolo; disables 1.5.7+–1.5.16+ Auto mode)
scripts/agy-delegate.sh --tier flash --read-only --allow-url "Web-search <X>. Give URLs + dates."
# write task: explicit grants — permissions.allow write_file(<dir>), --mode accept-edits (agy >= 1.5.7, workspace writes only), --mode auto, or --yolo (run on a branch)
scripts/agy-delegate.sh --yolo --dir ./app "Implement X per SPEC.md"
# resume a specific conversation by ID (-r / --resume / --conversation) or the latest one (-c / --continue)
scripts/agy-delegate.sh --tier pro -r <conversation-id> "Follow up on item 2"
# reasoning effort override + structured JSON Schema output (agy >= 1.4.10 / 1.5.8)
scripts/agy-delegate.sh --tier flash --effort xhigh --json-schema '{"type":"object","properties":{"summary":{"type":"string"}},"required":["summary"]}' "Summarize repo layout"
# Vertex AI Search over internal data
scripts/agy-delegate.sh --tier pro --yolo "List Vertex AI Search engines (list_engines)."
# cross-model review / stdin / background job (cancel terminates the full job process tree)
scripts/agy-delegate.sh --tier pro --read-only "Review for bugs, be skeptical: <paste>"
cat big-prompt.txt | scripts/agy-delegate.sh -
ID=$(scripts/agy-job.sh start --tier pro --dir . "big task"); scripts/agy-job.sh status "$ID"; scripts/agy-job.sh result "$ID" # or: scripts/agy-job.sh cancel "$ID"
| tier | model | use for |
|---|---|---|
flash (default) |
Gemini 4 Hydrogen (High) | most bulk work (~2.5× faster agentic throughput) |
flash-lo (lite) |
Gemini 4 Hydrogen (Low) | cheapest, low-latency tasks |
pro |
Gemini 4 Neon (High) | harder coding / reasoning / cross-checks (Low–XHigh effort) |
neon · carbon · argon · flash-38 (aliases) |
Gemini 4 Neon / Carbon / Argon (High) · Gemini 3.8 Flash (High) | explicit frontier overrides (carbon/argon at $2/$10 intro through 2026-11-30) or $0.75/$3.75 promo 3.8 Flash |
agy is multi-model. Tiers default to Gemini 4, but you can use any model agy models lists
(Claude / GPT on plans that expose them): pass --model "<exact name>" (and optional --effort low|medium|high|xhigh|max), or set it persistently
via plugin options — default_model, or per-tier tier_flash / tier_flash_lo / tier_pro / tier_neon / tier_carbon
(in ~/.claude/settings.json under pluginConfigs["antigravity@antigravity-for-claude-code"].options
or via env CLAUDE_PLUGIN_OPTION_*). Keep the executor a different, cheaper model than the Claude
conductor — that's what gives both the cost saving and the cross-model verification.
The default tiers run on the Gemini 4 family (measured manually on Linux via Vertex AI ADC,
AGY_ADC_AUTH=true, onagy 1.5.9,1.5.14, and1.5.16):flash/flash-lo(lite) use Gemini 4 Hydrogen (High) / (Low) ($1.50 in / $7.50 out / $0.075 cached-in per 1M tokens — standard non-promotional pricing with a 95% implicit prefix cache discount ≥ 4,096 tokens, plus(XHigh)via--effort xhigh), andpro(plus--tier neon) uses Gemini 4 Neon (High) ($3.00 in / $15.00 out / $0.15 cached-in per 1M global tokens, withLow/Medium/High/XHighreasoning effort; per upstream Antigravity docs/changelog, offered on Google AI Pro and Ultra as well as Vertex AI, Gemini Enterprise, and Gemini API —agy 1.5.12+API key,1.5.13+ADC/Gateway; consumer AI Pro/Ultra, API-key, and Gateway routes not re-measured here).--tier carbonand--tier argontarget Gemini 4 Carbon (High) and Gemini 4 Argon (High) ($2.00 / $10.00 / $0.10 introductory through 2026-11-30, settling at $4.00 / $20.00 / $0.20 standard from 2026-12-01;prices.jsoncarries both sets alongsideGemini 3.8 Flash's $0.75 / $3.75 promotional rate through 2026-12-31, accessible via--tier flash-38). Whentier_flash,tier_flash_lo, ortier_prois unremapped and your active plan or CLI version does not expose the primary Gemini 4 model (for exampleagy 1.5.9underAGY_ADC_AUTH=trueas measured here, free/starter consumer plans, or Google Workspace accounts signed in via1. Google OAuthinstead of2. Use a Google Cloud project— see Authentication & Terms guidance above anddocs/TROUBLESHOOTING.md),agy-delegateresolves an entitled fallback in two layers: first, it parses theAvailable models:list fromagy's error output to jump directly to the first entitled fallback in a single retry (pro: Neon → Carbon → Argon → 3.1 Pro → 3.1 Pro High/Low → Hydrogen → 3.8 Flash, cappingxhightoHighon Carbon/Argon/Flash;flash: Hydrogen → 3.8 Flash → 3.7 Flash → 3.5 Flash;flash-lo: Hydrogen Low → 3.8 Flash Low → 3.5 Flash Lite → 3.1 Flash Lite); second, it caches the resolved model for 6 hours in~/.cache/antigravity-claude/tier-models-v1.tsv(keyed byagybinary stat + auth fingerprint, and pre-seeded byagy-doctor) so subsequent calls hit the entitled model on attempt #1 with zero retry delay. CheckAGY_USAGE.modelon stderr for the model that actually ran. (Note: onGemini 3.8 Flash (High)under--digest, a bare "reply OK" ping with nothing to inspect was measured to run a command 6 of 7 times — exit 15 headless without a grant; give it a real task or drop--digestfor a ping. Both slugs and display names work with--model, anddoctormatches either.)
💸 How to actually get the savings (cost discipline)
Delegation doesn't save money by itself — these do (also in the skill):
- Delegate above the break-even — bulk/parallel/repetitive work, not tiny tasks.
- Keep Claude's context lean — don't re-read what agy already handled; take a digest, not raw output. (Biggest lever — it collapses
cache_read.) Enforced in code:--digestappends a digest-only output contract, and the wrapper warns when a reply comes back dump-sized (tune via thedigest_warn_charsplugin option). - Batch — one big delegation beats many round-trips.
- Review the diff, not the whole tree.
scripts/measure-session.py <session-id> prints the COST-WEIGHTED + est. USD breakdown for a session (Claude side; Gemini side priced separately). scripts/agy-cost-compare.sh shows the per-token gap for a task — using exact AGY_USAGE token counts (including additive cache_read) on agy ≥ 1.1.8 and falling back to char-count estimates on older plain-text runs; verify prices.json first.
Running a PoC in your org? docs/POC-PLAYBOOK.md is the step-by-step method — quality gate first, baseline, one lever at a time, break-even reporting, and org-level rollout/enforcement (incl. Windows/WSL requirements).
🚧 Guardrails & known limits
Something broken? See docs/TROUBLESHOOTING.md — symptom-first fixes for Windows/WSL, writes that silently don't happen, quota/auth/timeout codes, and updating.
Guardrails
- Always verify agy's output (it can be wrong, and may even alter its environment to make a check pass — re-run gates yourself in a clean state).
--yoloauto-approves every tool call — a grant over your whole machine, not over--dir.--sandboxdoes not contain it. Measured on macOS with agy 1.1.19: with--yolo,--sandboxchanged nothing — a write to an absolute path OUTSIDE--dirsucceeded (rc 0),idran and returned a real uid, andcurl https://example.comreturned 200. agy's own help says "terminal restrictions"; whatever it restricts, it is not those, and not in this combination. Not tested on Linux. Use a throwaway checkout, or apermissions.allowrule instead of the flag.- Write tasks: run on a dedicated branch/worktree, review the diff before merging.
Known limits (agy v1.0.x)
-p/--printtakes the prompt as its value and must come last — the wrapper handles this.--printdrops stdout on a non-TTY unless stdin is detached (handled via< /dev/nullup to 64 KB, or via a rewindable temp file< "$PROMPTF"without-pabove 64 KB to avoid LinuxE2BIG; measured onagy 1.4.8and1.5.9with--output-format json). Structured output arrived in agy 1.1.8 (--output-format json): the wrapper now uses it internally on ≥1.1.8 to classify failures from the structured error and to report the executor's real token usage (incl.cache_read) as anAGY_USAGEline on stderr — stdout is unchanged. Since 0.28.0 that line also names the model that ran and the tier it was picked from (empty for an explicit--model), plus agy's ownduration_seconds/num_turns(1.2.x; 0 on older agy), so a usage log prices itself per tier. Older agy falls back to plain text (toggle with thestructured_outputoption). If you're measuring, setAGY_USAGE_LOG=/path(or theusage_logoption): stderr is easily lost —2>&1 | tail -N, the natural way to keep Claude's context lean, keeps the digest and drops the usage line.Pipe hang and empty-output semantics moved upstream. agy 1.1.24 fixed the cause of the issue-#37 hang (its MCP children kept the caller's pipes open); the wrapper keeps routing agy's output through files, which costs nothing and still covers older builds. Since agy 1.1.18 a dropped agent stream exits non-zero instead of rc 0 + empty, so the wrapper's exit
3now means agy genuinely returned nothing (from agy's changelog; not reproduced here).An expired
--print-timeoutreturns a partial reply (1.1.28+). On agy 1.1.28–1.4.x, agy returns the partial reply with rc 0 and[agy] print timeout after ...on stderr; on agy 1.5.0+ (reported on 1.5.1 in #115, measured on 1.5.9), agy exits3withfinished_reason: "print_timeout"in the JSON envelope andAGY_ERROR"reason":"print_timeout"on stderr (for both mid-turn and background-task wait timeouts). Either way, the wrapper prints any partial reply on stdout and exits12(TIMEOUT), so a truncated answer never passes as a finished one and never misreports asAGY_FAILED;--continueresumes the conversation.The executor's trajectory is auditable. Every agy run writes a step-by-step
transcript.jsonl, and theconversationIdinAGY_USAGEjoins it to the cost 1:1.agy-trace --audit <id>(or--audit --last) shows step-type counts and every non-zero exit — a delegation can report SUCCESS while commands inside it failed. The command strings are recorded nowhere, so to attribute a filesystem change you must diff the tree.Write grants,
Automode (1.5.7+–1.5.16+), and--read-only. Onagy 1.5.7+when the OS terminal sandbox is active, unflaggedagydefaults toAutomode, which auto-approves in-workspace file edits and vetted/sandboxed commands (1.5.7+), outside-workspaceread_file(1.5.14+), and outside-workspace VCS-repository or additivewrite_file/edit_file(1.5.16+) — pass--read-only(setsagentMode: "",allowNonWorkspaceAccess: false,toolPermission: "request-review",ask: ["write_file(*)","command(*)"]; incompatible with--yolo,--settings, or--mode accept-edits|auto) whenever a run must stay strictly workspace read-only, or--mode accept-edits(1.5.7+) to restrict edits to--dir/--add-dirwith shell commands denied. Prior to1.5.7(and wheneverAutomode is off or--read-only/request-reviewis active), headless agy's no-permission behavior shifted every few releases (describe-only pre-1.1.0 · scratch-divert 1.1.0–1.1.2 · soft-deny 1.1.3+ · hard error by 1.1.13 · soft again from 1.1.20, measured on 1.1.25: rc 0, empty output, theauto-deniednotice on stderr). WithoutAutomode, an ungranted write leaves your workspace untouched; what changed is how the run admits it — a stderr notice from 1.1.3, a failed run on 1.1.13–1.1.19, the notice again since 1.1.20 (#10). Two things grant broader tool access explicitly:permissions.allowin~/.gemini/antigravity-cli/settings.json— awrite_file(<dir>)entry allows writes recursively beneath<dir>and needs no flag. This is the narrower grant and usually the right one.<dir>is a placeholder — substitute a real path. Left as written it grants nothing on any agy version, and the write is denied with the rule sitting visibly in the file. A different mistake is the version-sensitive one: acommand(...)rule that names no command (command(time), a comment-only entry,()) matched every command before agy 1.1.11 and silently auto-approved anything the agent ran — broader than the--yoloit was chosen instead of. 1.1.11 makes that entry match nothing too.agy-doctorchecks your entries and reports the consequence that actually applies.--yolo— the wrapper's flag, sent to agy as--dangerously-skip-permissions(agy 1.1.25 rejects a literal--yolo) — auto-approves all tools, not just writes. Needed when no rule covers the target, and for web search / URL reads (agy 1.1.28 made fetching URLs ask first; the narrow rule isread_url(<target>)) / Vertex AI Search / terminal tools. Since agy 1.1.27 the wrapper names the refused tool from the envelope'sdenied_actions(measured on 1.2.0).
Confirmed on agy 1.1.9 by a controlled A/B (#37): a covered target wrote with no flag; an uncovered one came back
PERMISSION_DENIEDwith the rule as the only variable. agy's own denial text names the rule and offers--yoloas the alternative. Not verified on other versions, and a glob form (write_file(/path/**)) was reported not to match. Either way: run write tasks on a branch and verify withgit status; the wrapper maps both denial shapes — the soft one (agy 1.1.3+, and again from 1.1.20; re-measured on 1.1.25) and 1.1.13's hard error — to exit15.Native Windows (no ConPTY): headless
agy -p/agy modelscan hard-hang with a 0-byte log when stdio is redirected (issue #6). The wrapper wraps agy in a wall-clocktimeout/gtimeoutguard so it returns a structured TIMEOUT (exit 12) instead of hanging;doctorreports the likely hang instead of a misleading "not authenticated". Withouttimeouton PATH there's no safety net — use WSL/macOS/Linux for headless delegation.WSL: running agy with
--add-diron a Windows mount (/mnt/c/...) is very slow — agy reads the workspace over a 9p bridge, so even trivial calls can take 20s+. Keep the repo on the WSL Linux filesystem (~). The wrapper anddoctorwarn about this.
📦 What's inside · local dev · tests
.claude-plugin/ plugin (+ userConfig: default_tier, timeout, coding_policy) + marketplace manifests
skills/antigravity/SKILL.md WHEN + HOW Claude collaborates with agy
agents/ antigravity-delegate subagent (file work runs on Gemini, not Claude)
commands/ slash commands (delegate, handoff, review, research, media, cloud-run-debug, setup, status, result, cancel, migrate)
hooks/ SessionStart: agy health & optional Consumer OAuth policy check + auto-inject the cost-aware policy
bin/ PATH shims (bare names): agy-delegate · agy-handoff · agy-job · agy-cost-compare · agy-doctor · cloud-debug · agy-trace · agy-media · measure-session · agy-migrate
scripts/ agy-delegate · agy-handoff · agy-job · agy-cost-compare · cloud-debug · agy-trace · agy-media · measure-session · doctor · agy-migrate · lib/ (plugin-options, auth-check)
docs/ AB-RESULTS (measured A/B) · POC-PLAYBOOK · TROUBLESHOOTING · DEMO-KIT
prices.json Vertex rate config (verify before quoting)
Local development (hack on the plugin — loads live files, $CLAUDE_PLUGIN_ROOT resolves):
git clone https://github.com/yuting0624/antigravity-for-claude-code ~/antigravity-for-claude-code
claude --plugin-dir ~/antigravity-for-claude-code
Tests (no dependencies; stubs agy):
bash tests/run-tests.sh
🤝 Contributing
Early-stage and MIT — issues, PRs, and ⭐ all welcome. See CONTRIBUTING.md and the good first issue list.
Automated review: PRs get two reviews in CI on top of the usual tests/shellcheck — a Claude review carrying this repo's own contracts, and quorum-review — see the section above.
From a fork: quorum doesn't run at all. The Claude review runs only once a maintainer with write access applies the claude-review label — the label alone isn't authorisation, since triage collaborators can apply labels too — and it re-runs on every later push, so an approved review can't go stale behind new commits. Your code never reaches the runner at all — the reviewer sees it as a diff (gh pr diff), with this repository's base checkout for context. Nothing of yours is fetched or executed.
⚠️ Disclaimer
Community project. Not affiliated with, endorsed by, or supported by Google or Anthropic. "Antigravity", "Gemini", "Claude", and "Claude Code" are trademarks of their respective owners. This plugin orchestrates the third-party agy CLI; you are responsible for your own API/cloud costs, credentials, and data-sharing choices. MIT licensed — see LICENSE.
Ähnliche Projekte entdecken
Wird geladen…