Skip to main content
Glama
Antigravity Context Radar

Antigravity Context Radar

by AIProS212026
README.md
<p align="center">
  <img src="assets/logo.svg" alt="Antigravity Context Radar logo" width="96" height="96" />
</p>

<h1 align="center">Antigravity Context Radar</h1>

<p align="center">
  An Antigravity <strong>skill + plugin</strong> for real-time <strong>context window health</strong>, <strong>token speed (<code>tok/s</code>)</strong>, <strong>prompt cache efficiency &amp; resets</strong>, <strong>request &amp; subagent telemetry</strong>, and <strong>active-project auto-follow</strong>.
</p>

---

## What Context Radar Tracks (and What It Doesn't)

- **Tracked locally from Antigravity logs & hooks:**
  - **Context Window Fill:** Current and peak prompt context (`input_tokens + cache_read_tokens`) vs. estimated model window (`1M` for Gemini models, `200k` for Claude / GPT / `o1`–`o4`), with configurable Warning & Danger thresholds.
  - **Token Speed (`tok/s`):** Exact generation throughput from `PreInvocation` + `Stop` hooks (`timings.jsonl`), plus turn-local transcript fallback estimates (`avg`, `median`, `peak`).
  - **Prompt Cache Efficiency:** **Warm Cache Hit Rate** (excluding turn `#1` cold start), **Overall Hit Rate**, and automatic **Cache Reset** detection (`model_switch`, `compaction`, `ttl_or_prefix_change`).
  - **Requests & Subagent Rollups:** Model calls (`PLANNER_RESPONSE`), compactions (`CHECKPOINT`), user turns, tool calls, and nested `invoke_subagent` runs linked back to their parent conversation.
  - **Active Project Auto-Follow:** Automatically detects and follows the active workspace project and conversation across `~/.gemini/config/projects/*.json`, hook context, and `annotations/*.pbtxt` (`last_user_view_time`).
- **Not tracked (intentional):**
  - Antigravity **server-side subscription quotas**, rate-limit buckets, or billing reset timers are not exposed locally by Antigravity and are never fabricated.

## Features

- **3 Interfaces — Always in Sync:**
  1. **Side-Pane & Left Sidebar (`open_context_radar`):** Interactive MCP App dashboard with **Overview**, **Subagents**, **Conversations**, **Timeline**, and **Settings** tabs, SVG context/cache & speed charts, and Project/Conversation scope controls.
  2. **Frameless Windows Floating HUD (`open_floating_radar` / `close_floating_radar`):** Borderless, transparent, draggable, single-instance WPF overlay (`Pill` or `Card` view, `35%–100%` opacity, HUD-only Always on Top, `Active Conv` / `Active Project` / `Global` scope), plus a standalone browser Full Window fallback (`mode: "window"`).
  3. **Chat Report & CLI (`get_telemetry_report` / `skills/context-radar/scripts/radar_report.mjs`):** Query Markdown or JSON summaries without opening a UI.
- **Themes & Task Sound Effects (`${PLUGIN_DATA}/settings.json`):**
  - **Auto (Host)**, **Light**, or **Dark** palette override across both the dashboard and Floating HUD.
  - Synthesized Web Audio cues + background OS WAV chimes (`Stop` hook) for **Turn Complete**, **Error / Budget Alert**, **Context Threshold Crossed**, **Cache Reset Detected**, and **Subagent Completed**.

## Installation

### Windows (PowerShell)

```powershell
powershell -ExecutionPolicy Bypass -File .\scripts\install.ps1
```

### macOS / Linux

```bash
bash ./scripts/install.sh
```

> **Upgrading from prototype `usage-monitor`:** Both installers automatically copy existing `settings.json`, `timings.jsonl`, `conv_projects.json`, and `active_context.json` from `~/.gemini/antigravity/plugin_data/usage-monitor` into `context-radar` if present. Remove the old `~/.gemini/config/plugins/usage-monitor` folder if migrating manually so hooks do not fire twice.

## CLI & MCP Usage

### MCP Tools

- `open_context_radar` (`{ days?, conversationId?, projectId? }`) — Open the dashboard (entrypoints in top-right `+` side pane and global left sidebar).
- `open_floating_radar` (`{ mode?: "widget" | "window" }`) — Launch the frameless Floating HUD or standalone Full Window.
- `close_floating_radar` — Close the Floating HUD process.
- `get_telemetry_report` (`{ days?, conversationId?, projectId? }`) — Return a concise Markdown telemetry summary in chat.

### Standalone CLI

```powershell
agy-node ./skills/context-radar/scripts/radar_report.mjs --days 7
agy-node ./skills/context-radar/scripts/radar_report.mjs --active-project --days 7
agy-node ./skills/context-radar/scripts/radar_report.mjs --project "Skills" --all
agy-node ./skills/context-radar/scripts/radar_report.mjs --conversation <id> --json
```

## Development & Build

```bash
npm install
npm run build
```

`npm run build` bundles zero-dependency artifacts into `dist/app.html`, `dist/server.cjs`, `hooks/record_timing.mjs`, and `skills/context-radar/scripts/radar_report.mjs`.

## Repository Structure

```text
antigravity-context-radar/
├── plugin.json
├── package.json
├── mcp_config.json
├── hooks.json
├── TODO.md
├── CHANGELOG.md
├── CONTRIBUTING.md
├── LICENSE
├── assets/logo.svg
├── hooks/record_timing.mjs
├── widgets/floating_widget.ps1
├── skills/context-radar/
│   ├── SKILL.md
│   └── scripts/radar_report.mjs
├── src/
│   ├── metrics.mjs
│   ├── projects.mjs
│   ├── settings.mjs
│   ├── sound_wav.mjs
│   ├── hook_timing.mjs
│   ├── floating.mjs
│   ├── cli.mjs
│   ├── server.mjs
│   └── ui/
│       ├── app.ts
│       ├── sound.ts
│       └── template.html
├── scripts/
│   ├── build.mjs
│   ├── install.ps1
│   └── install.sh
└── dist/
    ├── server.cjs
    └── app.html
```

## Roadmap & Changelog

- Planned features (tool profiler, context burn rate & compaction runway, live HUD turn timer, cache savings, exports): see [TODO.md](TODO.md).
- Release history: see [CHANGELOG.md](CHANGELOG.md).
- Contributing guidelines: see [CONTRIBUTING.md](CONTRIBUTING.md).

## License

MIT — see [LICENSE](LICENSE).