Add Antigravity backend (producer + statusline) — replaces Gemini [WIP]#3
Open
pkyIntelligence wants to merge 4 commits into
Open
Add Antigravity backend (producer + statusline) — replaces Gemini [WIP]#3pkyIntelligence wants to merge 4 commits into
pkyIntelligence wants to merge 4 commits into
Conversation
Migrate the Gemini backend toward Antigravity (agy CLI), which Google is replacing gemini-cli with. This checkpoint lands the usage-pressure dashboard half end-to-end; delegation, routing-policy prose, docs, and removal of the old gemini files remain (tracked in the plan). Quota source (reverse-engineered): Antigravity's real Pro quota is exposed only by its local language server (cloud Code Assist APIs report free-tier/null for this account). The producer queries that server over Connect-RPC (GetUserStatus) on a loopback port using the process's CSRF token — no credentials handled. Two provider buckets are surfaced: "gemini" (Google internal models) and "ext" (outside Google: Claude Opus/Sonnet 4.6, GPT-OSS), each a weekly rate cap. Prompt/flow credit meters are captured for /tokenmaxxer:status but not rendered (the API exposes no reset, so they cannot be paced). Producer (new): - hooks/refresh-antigravity.sh — local-server query + sidecar build; opportunistic (status ok when agy is running, else agy_not_running/fetch_failed preserving prior buckets so the statusline dims rather than blanks). No set -euo pipefail. Consumer + wiring: - scripts/statusline.sh — migrate the gemini cell-kind to antigravity: new .buckets[] loader (provider/used_percent/resets_at), ag-gem/ag-ext labels, weekly (WEEK_S) pacing, 5h=gemini / 7d=ext slots (monthly slot dropped). - hooks/hooks.json — SessionStart runs refresh-antigravity.sh. - hooks/refresh-stale-sidecars.sh — mid-session refresh for the antigravity sidecar. - hooks/usage-sidecars.sh — TMX_ANTIGRAVITY_SIDECAR + antigravity bucket TSV and context lines. - hooks/nudge-on-reset.sh — antigravity weekly buckets with friendly route names. Verified: all edited shell files pass bash -n; hooks.json valid; producer parses real data into 2 buckets; statusline renders ag-gem/ag-ext and exits 0 on populated, empty, and missing-sidecar paths. debug_scripts/ contains the reverse-engineering harness (local-server probe, mitmproxy/transparent capture). No secrets committed; .gitignore excludes the agy workspace file, pycache, and stray payload captures. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…te Gemini Finish the Gemini → Antigravity backend migration begun in the previous commit. Delegation (new): - scripts/antigravity-run.sh — agy -p harness; model comes from ~/.gemini/antigravity-cli/settings.json (agy has no -m flag), kill switch TOKENMAXXER_ANTIGRAVITY_DISABLED, --dangerously-skip-permissions for non-interactive tool use. - commands/antigravity.md, agents/antigravity-run.md — thin wrappers. Routing / telemetry prose repointed to Antigravity (weekly buckets, agy session readiness, antigravity-run dispatch): - skills/route.md, commands/route.md (allowed-tools now references antigravity-run.sh, not the deleted gemini-run.sh), skills/check-usage.md, commands/status.md, commands/setup.md. Docs: - New docs/backends/antigravity.md (local-language-server quota source, two weekly provider buckets, opportunistic freshness, kill switch). - docs/backends/facts.md, README.md, SECURITY.md, docs/setup.md, docs/ui.md, CONTRIBUTING.md, docs/claude-code-customization.md updated. - scripts/setup-statusline.py: seed/summary helpers migrated to the antigravity sidecar + provider-bucket schema (py_compile clean). Deletions (old Gemini backend): - hooks/refresh-gemini.sh, hooks/gemini-quota-payload.jq, scripts/gemini-run.sh, commands/gemini.md, agents/gemini-run.md, docs/backends/gemini.md. Housekeeping: - .gitignore excludes .antigravitycli/ (now untracked). - debug_scripts/_migrate_gemini_refs.py records the prose migration. Remaining "gemini" references are intentional: the provider-bucket label "gemini" (Antigravity's Google-internal model group), code that groups models by provider, the agy credential dir ~/.gemini/antigravity-cli/, and CHANGELOG history. Functional shell files pass bash -n; setup-statusline.py passes py_compile; statusline render verified earlier (ag-gem / ag-ext, exit 0). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- docs/backends/facts.md: replace leftover Gemini route row + "Gemini notes" with the Antigravity row + notes (sidecar/credential rows were already done). - docs/claude-code-customization.md: /tokenmaxxer:gemini -> :antigravity; agents/gemini-run.md -> agents/antigravity-run.md. - docs/setup.md: drop TOKENMAXXER_GEMINI_RPD_LIMIT (Antigravity has no RPD cap); TOKENMAXXER_GEMINI_DISABLED -> TOKENMAXXER_ANTIGRAVITY_DISABLED. - skills/check-usage.md: bottleneck list "Gemini daily bucket" -> "Antigravity weekly bucket". - CHANGELOG.md: add Unreleased entry for the Antigravity migration. Remaining "gemini" references are intentional (provider-bucket label, agy credential dir ~/.gemini/antigravity-cli/, "runs Gemini models" capability notes, CHANGELOG history). Verified: all edited shell pass bash -n, setup-statusline.py passes py_compile, all JSON valid, statusline renders ag-gem/ag-ext and exits 0. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…lot comment Edits that silently failed in the prior commit (display-bug-corrupted matches), now applied against fresh reads: - docs/setup.md: drop TOKENMAXXER_GEMINI_RPD_LIMIT row; rename the kill-switch row to TOKENMAXXER_ANTIGRAVITY_DISABLED. - docs/claude-code-customization.md: /tokenmaxxer:gemini -> :antigravity; agents/gemini-run.md -> agents/antigravity-run.md. - CHANGELOG.md: add the [Unreleased] Antigravity-migration entry (the section did not exist before). - scripts/copilot-run.sh: drop stale "gemini-run" mention from a comment. Audit clean: no TOKENMAXXER_GEMINI_*, /tokenmaxxer:gemini, or gemini-run refs remain outside CHANGELOG history. All other "gemini" occurrences are the intentional Antigravity provider-bucket label and the ~/.gemini/antigravity-cli credential path. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Migrates the Gemini backend → Antigravity (
agyCLI), which Google is replacing gemini-cli with (gemini-cli deprecates ~2026-06-18). This is a checkpoint PR: the usage-pressure dashboard half is done and verified end-to-end; delegation, routing-policy prose, docs, and removal of the old gemini files remain (see plan / checklist below).The user's primary use of tokenmaxxer is the dashboard, so that was built and verified first.
The hard part: where the quota actually lives
Antigravity's real Pro quota is only exposed by its local language server — the cloud Code Assist APIs report
free-tier/nullfor this account (the Pro plan is a Codeium/Windsurf entitlement invisible to Google's GCA cloud view). The credit-view gRPC endpoint (aicode.googleapis.com … FetchQuotaStatus) needs anauth/aicode-scoped tokenagymints through a channel a standalone hook can't reproduce.So the producer queries the local language server over Connect-RPC (
GetUserStatus) on a loopback port using the process's own CSRF token — no credentials handled. (Approach validated against the publicskainguyen1412/antigravity-usage/wusimpl/AntigravityQuotaWatchertools.)Two provider buckets are surfaced, matching what
agy /usageshows:ag-gem— Google-internal models (Gemini 3.x)ag-ext— outside-Google (Claude Opus/Sonnet 4.6, GPT-OSS)Each is a weekly rate cap (paced like the old gemini cells). Prompt/flow credit meters are captured for
/tokenmaxxer:statusbut not rendered — the API exposes no reset for them, so they can't be paced.What's in this PR
Producer (new):
hooks/refresh-antigravity.sh— local-server query + sidecar build; opportunistic (fresh when agy is running, elseagy_not_running/fetch_failedpreserving prior buckets so the statusline dims rather than blanks).Consumer + wiring:
scripts/statusline.sh— gemini cell-kind → antigravity (provider buckets,ag-gem/ag-ext,WEEK_Spacing, 5h=gemini / 7d=ext, monthly slot dropped).hooks/hooks.json— SessionStart →refresh-antigravity.sh.hooks/refresh-stale-sidecars.sh,hooks/usage-sidecars.sh,hooks/nudge-on-reset.sh— repointed to the antigravity sidecar / buckets.Reverse-engineering harness:
debug_scripts/(local-server probe, mitmproxy/transparent capture). No secrets committed;.gitignoreexcludes the agy workspace file, pycache, and stray payload captures.Verification
Live render (real data):
bash -n;hooks.jsonvalid.GetUserStatusinto 2 buckets.ag-gem/ag-extand exits 0 on populated, empty-buckets, and missing-sidecar paths.Remaining (follow-up — tracked in plan)
skills/route.md§2.4 (weekly window),commands/status.md,skills/check-usage.md,commands/route.mdscripts/antigravity-run.sh,commands/antigravity.md,agents/antigravity-run.mddocs/backends/antigravity.md; update facts.md, README, SECURITY, CLAUDE.mdhooks/refresh-gemini.sh,hooks/gemini-quota-payload.jq,scripts/gemini-run.sh,commands/gemini.md,agents/gemini-run.md,docs/backends/gemini.md)--plugin-dirrestart,/tokenmaxxer:setup)🤖 Generated with Claude Code