Skip to main content
Glama
AGY Usage Monitor
by vinhthang

AGY Usage Monitor

CI License: MIT Node.js >= 22.18

Clean-room, MIT-licensed, strictly read-only telemetry monitor and MCP App (ui://agy-usage-monitor/app.html) for Google Antigravity (Antigravity App, Antigravity IDE, Antigravity Remote Web, and agy CLI).


Highlights

  • Native MCP App (postMessage, zero open ports): Renders inside Antigravity's Right Auxiliary Pane (aux_pane), Left Sidebar (global), and Antigravity Remote Web directly over MCP App RPC — zero localhost HTTP/CORS servers and zero --remote-debugging-port Electron CDP injection.

  • Live Topbar & Sidebar Quota Capsule: Dynamically updates the tool and entrypoint title via notifications/tools/list_changed (e.g., Usage Monitor · 4h 15m 92% · Wk 50%), replacing static 5h labels with a live rolling reset countdown alongside the weekly limit.

  • Dual-Window Quota Pacing (RetrieveUserQuotaSummary): Tracks both the rolling 5-Hour Limit and Weekly Limit across Gemini 4 (Neon, Carbon, Hydrogen, Orchestrator) and Claude & GPT pools, complete with linear even-pace target ticks, paused-when-weekly-exhausted detection, and proto3 zero-fraction handling.

  • Instant Session Switcher (Ctrl+K / ⌘K): Fuzzy-search across recent root conversations and auto-follow the latest running session without leaving the dashboard.

  • Near-Zero Prompt Footprint: Registers a single model-visible tool (open_usage_monitor), while polling (app_get_snapshot) and Markdown export (app_export_markdown) use visibility: ["app"] so they stay hidden from LLM context.


Related MCP server: AGY Flow Monitor

Read-Only Security & Privacy Architecture

Surface

Source Read

Read-Only Guarantee

Session & Subagent Index

~/.gemini/antigravity/conversation_summaries.db

Opened via node:sqlite with { open: true, readOnly: true } + PRAGMA query_only = ON

Live Quotas & Trajectories

hub_*.json + Loopback Connect RPC (GetUserStatus, RetrieveUserQuotaSummary, GetCascadeTrajectory)

Strictly pinned to 127.0.0.1 / localhost / ::1; refuses non-loopback addresses

Fallback Transcript Metrics

~/.gemini/antigravity/brain/<id>/.system_generated/logs/transcript.jsonl

Read-only JSONL parser; safely ignores incomplete trailing appends

Safety Monitor & 429 Tailer

Desktop language_server.log (~/Library/Logs/Antigravity/ on macOS, ~/.config/Antigravity/logs/ on Linux, %APPDATA% on Windows) & ~/.gemini/antigravity/log/cli-*.log

Incremental byte-offset reader that handles rotation/truncation and deduplicates multi-line LLM safety evaluations

Host Binaries & Settings

None

Never touches launchers, shortcuts, .desktop entries, argv.json, config.json, or settings.json; never reads or forwards OAuth tokens externally


Dashboard Walkthrough

  1. Overview

    • 6-Card Bento Summary: Output Speed (tok/s), Avg TTFT (ms), Active Context & Cache hit %, Quota Remaining (4h 15m 92% · Wk 50%), Session Tokens (Out · Think), and Est. API Cost.

    • Model Quota Pools: Per-window progress bars (5-Hour Limit + Weekly Limit) with linear pace badges (Under pace, On pace, Burning fast) and vertical target ticks.

    • Context Cache & Session Agents: Visual Cached-vs-Uncached input bar plus Main + Subagent/Swarm roster filterable from the topbar.

  2. Steps

    • Searchable, sortable per-turn telemetry (Context, Cache Hit, Output (Think), TTFT, Speed, Est. Cost) with anomaly chips (Flagged, Low Cache, Slow TTFT, Context Spike, Compacted).

  3. Analytics

    • 24h / 7d / 14d / 30d / All Time rollups showing exact API-equivalent spend, real KV-cache USD savings (saved $...), an SVG daily token chart, a 90-day activity heatmap, and Top Models / Top Workspaces tables.

  4. Safety

    • Health cards for Language Server, Session Database, Tool Safety Gate (agy_tool_safety), Flash-Lite Pre-check (sir_flash_lite), Deep Risk Review (severe_internal_risks_agy), and Rate Limits (429) plus the recent event log.

Keyboard Shortcuts

Shortcut

Action

Ctrl+K / ⌘K

Toggle searchable Session Switcher modal

↑ / ↓ / Enter / Esc

Navigate and select session inside modal

1 – 4

Switch between Overview, Steps, Analytics, Safety tabs

/

Focus step search box (on Steps tab)


Installation (Antigravity Plugin)

Committed dist/ bundles are included so the plugin runs directly with Node.js >= 22.18:

mkdir -p ~/.gemini/config/plugins
git clone https://github.com/vinhthang/agy-usage-monitor.git ~/.gemini/config/plugins/agy-usage-monitor
cd ~/.gemini/config/plugins/agy-usage-monitor
npm ci && npm run build   # optional if rebuilding from source

Enable AGY Usage Monitor in Antigravity's Plugins Manager (Extensions / Plugins), then open Usage Monitor from the side pane + menu or left sidebar (or ask Antigravity: "Open the Usage Monitor panel"). Because Antigravity renders MCP Apps over postMessage, the panel also works automatically when accessing your workstation through Antigravity Remote Web.

Opt-In agy CLI Statusline

To inspect your live statusline capsule (● working · Gemini 4 Neon (High) · ctx 42% · 4h 15m 92% · wk 50% · $0.123) in the terminal agy CLI without any automatic config mutation, print the ready-to-paste snippet:

node ~/.gemini/config/plugins/agy-usage-monitor/dist/cli-statusline.mjs --print-config

Merge the printed "statusLine" object into ~/.gemini/antigravity-cli/settings.json (or manage it via /statusline inside agy).


Development & Verification

npm ci
npm run typecheck
npm run build
npm test
npm run verify:dist

All source modules under src/ are kept modular (< 300 lines each), and GitHub Actions CI (.github/workflows/ci.yml) runs typecheck, verify:dist, and node --test across ubuntu-latest, macos-latest, and windows-latest on Node 22.18.0.


License

MIT — Clean-room implementation built exclusively on @modelcontextprotocol/ext-apps and Node.js built-in modules (node:sqlite, node:fs, node:test).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables users to inspect real-time prompt cache hit rate, task throughput, and per-model token usage for Antigravity sessions and 5h/1d/7d windows through an interactive local dashboard. It combines lifecycle hook timing with local transcript data, with zero outbound network telemetry.
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables real-time visualization of Google Antigravity agent execution, including tool calls, parallel subagents, MCP routing, context usage, and local session telemetry through an embedded side-pane dashboard.
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables users to view live session context window occupancy, step-by-step growth charts, and compaction thresholds alongside a GitHub-style daily token usage heatmap with per-day, per-model, and per-session breakdowns and persistent filters. All data is read strictly read-only from local Antigravity transcripts with no network calls, telemetry, or token overhead.
      MIT