Google Antigravity
Antigravity support is in beta. The adapter installs a user-level plugin at
~/.gemini/config/plugins/token-optimizer/, wires PreInvocation / PreToolUse /
Stop hooks, and records the R20 consent flag. Data collection stays off until that
consent record exists.
Prerequisites
Section titled “Prerequisites”- The
agyCLI, Antigravity 2.0 app, or Antigravity IDE. - Python 3.9+ on your PATH; repository CI covers 3.11-3.14.
- For the fresh clone path:
git.
Install
Section titled “Install”Run from any folder. The clone creates a token-optimizer/ folder, then you move into it and install.
git clone --depth 1 https://github.com/alexgreensh/token-optimizer.gitcd token-optimizerbash install.sh --antigravityIf Token Optimizer is already installed as a Claude Code plugin or script install, do not clone again. The install.sh script exists only at the repo root, so call the engine directly:
TOKEN_OPTIMIZER_RUNTIME=antigravity python3 ~/.claude/skills/token-optimizer/scripts/measure.py antigravity-installOr, if you used the Claude Code script install:
bash ~/.claude/token-optimizer/install.sh --antigravityThe install is idempotent. It writes only ~/.gemini/config/plugins/token-optimizer/
(the plugin payload, hooks.json, plugin.json) and records consent in
~/.gemini/token-optimizer/config.json. It never touches your own
~/.gemini/config/hooks.json, config.json, or settings.json.
Verify
Section titled “Verify”TOKEN_OPTIMIZER_RUNTIME=antigravity python3 skills/token-optimizer/scripts/measure.py antigravity-doctorConfirm Antigravity accepts the plugin:
agy plugin validate ~/.gemini/config/plugins/token-optimizerTo preview the install without writing anything:
bash install.sh --antigravity --dry-runEngine commands
Section titled “Engine commands”All require the TOKEN_OPTIMIZER_RUNTIME=antigravity prefix.
measure.py antigravity-install # wire the plugin and record consentmeasure.py antigravity-doctor # readiness checkmeasure.py antigravity-summary # per-surface session summarymeasure.py antigravity-rollup # ingest sessions into trends.db (auto on Stop)measure.py antigravity-uninstall # remove only what was installedmeasure.py antigravity-home # print the resolved Antigravity homeConsent (R20)
Section titled “Consent (R20)”Collection is opt-in. The installer records antigravity_consent: true in
~/.gemini/token-optimizer/config.json; the hooks and rollup are no-ops until that
record exists.
Config variables
Section titled “Config variables”TOKEN_OPTIMIZER_ANTIGRAVITY_HOME (default ~/.gemini)TOKEN_OPTIMIZER_ANTIGRAVITY_BIN (override the agy binary the doctor probes)TOKEN_OPTIMIZER_BASH_COMPRESS (set 0 to disable command-output compression)See Configuration for the full variable list.
Auto-update
Section titled “Auto-update”Re-run the install after a git pull:
bash install.sh --antigravityUninstall
Section titled “Uninstall”TOKEN_OPTIMIZER_RUNTIME=antigravity python3 skills/token-optimizer/scripts/measure.py antigravity-uninstallantigravity-uninstall removes only ~/.gemini/config/plugins/token-optimizer/.
Conversation data under ~/.gemini/ and Token Optimizer’s collected data and
trends are left in place by design.
See also
Section titled “See also”- Antigravity platform reference for the full capability and gap list.
- Configuration.
