A 100% read-only, zero-injection plugin for Google Antigravity (Desktop & CLI) — live context pressure, Prompt Cache savings, output speed (tok/s), First Token Latency (TTFT), and a 12-week heatmap.
English | 简体中文
- No more surprise
256Kcompactions: Most flagship models auto-compact near256K(CHECKPOINT), not1M.Automode calibrates directly to256Kby default and adapts via observedCHECKPOINTpeaks and model hints, so you know right when to/compact. - See what bloated your context: Splits usage into Base vs. Growth tokens and attributes per-turn and per-tool (
read_file,run_command, etc.) deltas. - Know if it's thinking or lagging: Tracks both session average and latest-step First Token Latency (
Avg / Last TTFT) alongside End-to-End Output Speed (Avg / Last tok/s). - Track Cache savings & total usage: Shows live Prompt Cache hit rate, reference API cost/savings (
USD/CNY), and an 84-day activity heatmap combining Antigravity Desktop + CLI. - Zero app mods, zero risk: Pure official plugin —
0extra prompt tokens, Apple code signatures stay intact, and survives every Antigravity client update.
macOS Titlebar Capsule & Session Popover — Auto (256K) gauge, Base/Growth breakdown, Avg / Last tok/s, Avg / Last TTFT, and session switcher
Global History & 12-Week Heatmap — Desktop + CLI totals |
Instant Settings — English / 中文, position, density & limit
|
Cross-Platform Auxiliary Pane Web UI — Overview (with TTFT & Speed cards), History, Steps, Tools, and Raw
Two ways to inspect: On macOS, left-click the floating titlebar capsule to open the 3-tab popover (right-click for quick controls, drag to reposition). On all platforms, click
+→ Context & Usage in any conversation header to open the Auxiliary Pane.
git clone https://github.com/heywalter/antigravity-context-monitor.git \
~/.gemini/config/plugins/context-monitorRestart Antigravity (or enable Context & Usage in Customizations), or validate/install via CLI (agy plugin validate . && agy plugin install .). On macOS, hud_bar.swift auto-compiles locally on first launch when swiftc (Xcode Command Line Tools) is installed, or skips the floating HUD cleanly while keeping the Aux Pane active.
flowchart LR
Hook["Hook + Local Files\n(track_active.sh · transcript.jsonl · annotations · .db)"] -->|"100% Read-Only"| Sidecar["Node Sidecar\n(main · metrics · ttft · titles · prefs · history)"]
Sidecar -->|"localhost via sidecar_sdk"| Aux["Aux Pane Web UI\n(macOS · Linux · Windows)"]
Sidecar -->|"auto swiftc + token"| HUD["Native HUD Capsule\n(macOS AppKit)"]
- 100% Within Official Rules: Uses only Antigravity's official
plugin.json,hooks.json, andsidecar_sdk(sidecar.jsonwith"allows_user_interactions": false); passesagy plugin validatewith 0 errors and 0 warnings, and never editsconfig.json. - Pure Local Read-Only Logic: A minimal
SessionStart/PreInvocationhook recordsactive_hook.json; the sidecar reads Antigravity's owntranscript.jsonl(tokens, checkpoints, speed),annotations/*.pbtxt(live & renamed titles), and read-only SQLiteconversations/*.db(created_at→viewable_atTTFT), calibratingAutolimits via256Kdefault,CHECKPOINTpeaks, model hints, and overflow promotion. - Security & Privacy: Zero
Antigravity.apppatching, zero CDP (--remote-debugging-port), zero outbound network requests (127.0.0.1only), per-launch randomCONTEXT_MONITOR_HUD_TOKENprotecting/api/hud, strictID_REpath-traversal checks, and{ readOnly: true }SQLite handles (SECURITY.md). - Cross-Platform & Graceful Fallback: Full Aux Pane UI runs on macOS, Linux, and Windows (
hudSupported === falseauto-hides Mac controls); macOS adds the nativearm64/x86_64HUD (skips safely ifswiftcis absent); on Node 20 withoutnode:sqlite,TTFTfalls back cleanly to—with zero errors; survives Antigravity app updates intact.
- Telemetry & Reference Cost: Token counts are 100% raw Antigravity telemetry from
transcript.jsonl;TTFTmeasures request start to first visible output chunk (including extended thinking). USD/CNY estimates use a static benchmark (Input $2 / Cache $0.2 / Out $10 per 1M,1 USD = 7.25 CNY) for reference intuition only.
Development & Verification Commands (zero external npm dependencies)
# 1. Check hook & JS syntax
sh -n hooks/track_active.sh
cd sidecars/context_monitor
node --check main.mjs && node --check prefs.mjs && node --check titles.mjs && node --check ttft.mjs && node --check metrics.mjs && node --check history.mjs && node --check app.js
# 2. Run unit tests & validate manifests
npm test
cd ../.. && agy plugin validate .
# 3. Build & self-test macOS Universal Binary (arm64 + x86_64)
./scripts/build-hud-universal.sh && rm -rf distRuntime data lives under ~/.gemini/antigravity/sidecar_data/context-monitor/context_monitor/ (logs/sidecar.log, data/hud_prefs.json, data/bin/hud_bar).
CONTRIBUTING.md · SECURITY.md · CHANGELOG.md · MIT © 2026 Walter

