Skip to main content
Glama

Context Meter (agy-ct)

CI License: MIT Node.js >= 22

Live context window observer plugin & MCP App for Antigravity IDE, Antigravity 2.0 (App), and Antigravity CLI.

Inspect real-time token consumption, model context limit percentage, cache hit rate, compaction events, and per-turn growth directly inside Antigravity's Side Pane, Global Sidebar, or inline in chat via /context.


Features

  • Live Context Meter (MCP App UI):

    • Tracks current context tokens (input_tokens + cache_read_tokens), limit percentage, and health status (Healthy, Warning, Near Limit).

    • Segmented meter showing Cache Read vs New Input vs Remaining capacity, plus 75% and 90% markers and quick limit overrides (Auto, 200K, 1M, 2M).

    • Interactive SVG Turn-by-Turn Context Growth chart with compaction (↓ Compact) detection and per-turn tool-call inspection.

    • Per-Turn Ledger preserving scroll position across 2.5s live polling updates.

    • Surface filter (All, IDE, App, CLI) and conversation picker displaying real Antigravity conversation titles (annotations.title via ConversationService and .pbtxt annotations).

  • /context Slash Command:

    • Registers /context in the chat slash menu (skills/context/SKILL.md).

    • Pairs with a PreInvocation hook (hooks.json -> dist/hook-context.mjs) to render a compact single-line Context Window bar inline with zero model tokens.

  • Zero External Runtime Dependencies:

    • Single-file bundled MCP server (dist/server.mjs), hook (dist/hook-context.mjs), and CSP-compliant single-file HTML app (dist/app.html).


Related MCP server: context-tree_monitor

Requirements

  • Node.js >= 22.0.0 (used both to run the plugin MCP server/hook and to run native TypeScript tests)

  • Antigravity IDE, Antigravity 2.0, or Antigravity CLI


Installation

Clone, build, and install into ~/.gemini/config/plugins/context-meter/:

git clone https://github.com/nhanhehehe/agy-ct.git
cd agy-ct
npm ci
npm run build
npm run install:plugin

Antigravity automatically discovers plugins in ~/.gemini/config/plugins/context-meter/ (on Windows: %USERPROFILE%\.gemini\config\plugins\context-meter\).

Uninstall

npm run uninstall:plugin

Usage

  • Side Pane: Click + in Antigravity's Side Pane and select Context Meter.

  • Global Sidebar: Open Context Meter from the left sidebar.

  • Chat: Ask the agent "Open the Context Meter to inspect my current context window" or type /context in the chat input.


Architecture

agy-ct/
├── plugin.json                # Antigravity plugin manifest
├── mcp_config.json            # MCP stdio server definition
├── hooks.json                 # PreInvocation hook for /context
├── assets/logo.svg            # Plugin icon
├── skills/context/SKILL.md    # /context slash skill definition
├── src/
│   ├── core/
│   │   ├── models.ts          # Context window limits per model family
│   │   ├── scanner.ts         # Scans ~/.gemini/{antigravity,antigravity-ide,antigravity-cli}/brain
│   │   ├── parser.ts          # JSONL transcript parser, cache/compaction metrics
│   │   └── titles.ts          # ConversationService & .pbtxt annotation title resolver
│   ├── hook-context.ts        # /context PreInvocation hook logic
│   ├── hook-cli.ts            # Async stdin/stdout CLI entrypoint for hook
│   ├── server.ts              # MCP server (open_context_meter, get_context_snapshot, ui:// resource)
│   └── ui/                    # Single-file Vite MCP App (@modelcontextprotocol/ext-apps)
├── scripts/
│   ├── install-plugin.mjs     # Copies built bundle to ~/.gemini/config/plugins/context-meter/
│   └── uninstall-plugin.mjs   # Removes installed plugin directory
└── tests/                     # Unit & MCP stdio smoke tests (node --test)

Development

npm ci
npm run typecheck
npm run build
npm test

See CONTRIBUTING.md for guidelines on submitting pull requests.


Security & Privacy

Context Meter reads only local files under ~/.gemini/ (and optionally queries the local Antigravity Language Server on ANTIGRAVITY_LS_ADDRESS for conversation titles). It makes zero external network requests. See SECURITY.md for reporting vulnerabilities.


License

MIT © 2026 Nguyễn Thiện Nhân

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
      C
      maintenance
      An Antigravity MCP App plugin that surfaces real-time context window occupancy, remaining tokens, prompt cache hit rate, output speed, rolling 5-hour/7-day quota usage, and a 28-day activity heatmap by read-only parsing of local transcript logs. It presents these metrics in a theme-aware sidebar dashboard without patching or injecting into the host client.
      MIT