Skip to content

About

100% read-only live monitor for Google Antigravity (Desktop & CLI) — context occupancy, Prompt Cache hit rate, output speed (tok/s), TTFT, and 12-week heatmap.

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Context & Usage Monitor Logo

Context & Usage Monitor

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.

Official Plugin + Sidecar 100% Read-Only · 0 Extra Tokens Zero Patching · Zero CDP macOS · Linux · Windows License: MIT

English | 简体中文


Why This Plugin?

  • No more surprise 256K compactions: Most flagship models auto-compact near 256K (CHECKPOINT), not 1M. Auto mode calibrates directly to 256K by default and adapts via observed CHECKPOINT peaks 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 — 0 extra prompt tokens, Apple code signatures stay intact, and survives every Antigravity client update.

Preview

macOS Titlebar Floating Capsule and Session Popover
macOS Titlebar Capsule & Session Popover — Auto (256K) gauge, Base/Growth breakdown, Avg / Last tok/s, Avg / Last TTFT, and session switcher

History Popover with 12-Week Activity Heatmap
Global History & 12-Week Heatmap — Desktop + CLI totals
Settings Popover with Bilingual and Placement Controls
Instant Settings — English / 中文, position, density & limit

Cross-Platform Auxiliary Pane Web Dashboard
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.


Quick Install

git clone https://github.com/heywalter/antigravity-context-monitor.git \
  ~/.gemini/config/plugins/context-monitor

Restart 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.


How It Works, Security & Compatibility

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)"]
Loading
  • 100% Within Official Rules: Uses only Antigravity's official plugin.json, hooks.json, and sidecar_sdk (sidecar.json with "allows_user_interactions": false); passes agy plugin validate with 0 errors and 0 warnings, and never edits config.json.
  • Pure Local Read-Only Logic: A minimal SessionStart / PreInvocation hook records active_hook.json; the sidecar reads Antigravity's own transcript.jsonl (tokens, checkpoints, speed), annotations/*.pbtxt (live & renamed titles), and read-only SQLite conversations/*.db (created_at → viewable_at TTFT), calibrating Auto limits via 256K default, CHECKPOINT peaks, model hints, and overflow promotion.
  • Security & Privacy: Zero Antigravity.app patching, zero CDP (--remote-debugging-port), zero outbound network requests (127.0.0.1 only), per-launch random CONTEXT_MONITOR_HUD_TOKEN protecting /api/hud, strict ID_RE path-traversal checks, and { readOnly: true } SQLite handles (SECURITY.md).
  • Cross-Platform & Graceful Fallback: Full Aux Pane UI runs on macOS, Linux, and Windows (hudSupported === false auto-hides Mac controls); macOS adds the native arm64/x86_64 HUD (skips safely if swiftc is absent); on Node 20 without node:sqlite, TTFT falls back cleanly to — with zero errors; survives Antigravity app updates intact.

Notes & Development

  • Telemetry & Reference Cost: Token counts are 100% raw Antigravity telemetry from transcript.jsonl; TTFT measures 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 dist

Runtime 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

About

100% read-only live monitor for Google Antigravity (Desktop & CLI) — context occupancy, Prompt Cache hit rate, output speed (tok/s), TTFT, and 12-week heatmap.

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages