Context Monitor
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Context Monitor
Context Monitor is a side-pane and sidebar MCP App plugin built for Google Antigravity 2.0 (AGY 2.0). It reads local Antigravity transcripts, configuration files, and language server metadata to show how much of the active conversation's context window is in use, which skills and MCP servers are loaded, which plugins are enabled, and how many tokens have been processed across local sessions.
This started as a personal side project to inspect context usage while working in Antigravity 2.0. It is published under the MIT License for anyone who wants to use it or adapt it.
Requirements
Google Antigravity 2.0 (AGY 2.0). This plugin depends on Antigravity 2.0 native plugin loading, MCP App UI entrypoints (
aux_paneandglobal), lifecycle hooks, and the~/.gemini/antigravity/and~/.gemini/config/directory layout. It does not work on Antigravity 1.x or other editors.Node.js 22.5.0 or newer (used for the built-in
node:sqlitemodule to readconversation_summaries.db).
Related MCP server: Usage Monitor
What it shows
Section | Data displayed | Source |
Context breakdown | Total tokens used, percentage of the model context window, free space, deferred MCP tool schemas, and | Active |
Accordions | Expandable lists for | Workspace and global |
MCP Servers | Custom MCP servers configured by the user, with connection status and model-visible tool counts. |
|
Plugins | Installed user and built-in plugins with component counts ( | Antigravity Language Server |
Usage (Local) | Total |
|
Installation
The repository includes the prebuilt single-file bundle at dist/app.html, so end users only need to clone the plugin into Antigravity's plugins directory and install runtime dependencies.
Windows (PowerShell):
git clone https://github.com/atinasinf/context-monitor.git "$HOME\.gemini\config\plugins\context-monitor"
cd "$HOME\.gemini\config\plugins\context-monitor"
npm install --omit=devmacOS and Linux:
git clone https://github.com/atinasinf/context-monitor.git ~/.gemini/config/plugins/context-monitor
cd ~/.gemini/config/plugins/context-monitor
npm install --omit=devOpen Antigravity 2.0 and confirm that Context Monitor is enabled under Customizations -> Plugins. To open the panel:
Click
+in the right side pane and pickContext.Click
Context Monitorin the left sidebar for the full-page view.Ask the agent to open Context Monitor (uses the bundled
context-monitorskill andopen_context_monitortool).
How it works
The plugin has three runtime parts:
Lifecycle hooks (
hooks.json,hooks/track-active.mjs) listen toSessionStart,PreInvocation, andStop. The script writes active conversation metadata and per-conversation workspace paths atomically to~/.gemini/antigravity/plugin_data/context-monitor/active.json, ignoring/btwside questions and subagents.The local MCP server (
server.mjs,snapshot.mjs) serves the bundled UI resource (ui://context-monitor/app.html) and exposesopen_context_monitorand the app-onlyget_context_snapshottool. Conversation resolution follows four modes in priority order: explicitmanualID,hostmetadata (extra._meta['antigravity.google/conversation_id']walked back to the root conversation for/btwand nested subagents),draft(emptyNew Chattab in the side pane), andautofallback for the sidebar view.The frontend (
src/app.html,src/app.js, bundled intodist/app.htmlwithesbuild) follows Antigravity's light and dark theme variables. It uses aResizeObserverand visibility checks to refresh immediately on tab switch while pausing background polling when the pane is hidden.
When /compact runs, Antigravity logs a CHECKPOINT entry whose input_tokens + cache_read_tokens reflects the pre-compaction context sent to generate the summary. Context Monitor ignores that pre-compaction input count and computes a temporary estimate (~) from the first-turn baseline plus the checkpoint summary length until the next model response reports the exact post-compaction token count.
Known limitations
This plugin is read-only and relies on local files and undocumented Antigravity 2.0 internals, which introduces several limitations:
Overhead token estimates use
Math.ceil(utf8Bytes / 4)forSKILL.mdfrontmatter,AGENTS.md/GEMINI.md, and MCP schemas because no model-specific tokenizer is bundled. Total conversation usage comes directly frominput_tokens + cache_read_tokensreported intranscript.jsonl, andMessagesis computed astotalUsed - overheadTokens.Immediately after
/compact, the~token count is an approximation anchored to the first model turn. If you switched models or toggled several MCP servers mid-conversation before compacting, the temporary number can drift by a few thousand tokens until you send the next message.scanSkills()reads~/.gemini/antigravity/builtin/skills/directly, which currently includes two internal built-in skills (permissioned-githubandswarm_narrator) that are not mounted in standard conversations.The
PluginsandMCP Serverssections are strictly read-only. Antigravity 2.0 does not expose a public API for an MCP App to toggle plugins, so enabling or disabling plugins still happens in Customizations. App-level integrations like GitHub do not appear inGetAllPluginsor on disk and are omitted.Usage (Local)sums local transcript logs (input_tokens + output_tokens, excluding cache reads) and is not Google server-side account quota. Individualtranscript.jsonlfiles larger than 4 MB are skipped to keep polling fast, and each folder underbrain/*/(including/btwbranches and subagents) is currently counted in thechatstotal.scanMemoryFiles()reads workspace rootAGENTS.md/GEMINI.mdand.agents/rules/*.md,.gemini/rules/*.md. It does not recurse into nested subdirectories for subdirectoryAGENTS.mdfiles, and it does not enforce Antigravity's 24 KB per-rule truncation cap.On the first
PreInvocationof a newly spawned subagent before its transcript flushes to disk,hooks/track-active.mjscan briefly record that subagent ID inactive.json(filtered out on read bysnapshot.mjs).
Planned updates
Separate main conversation counts from subagent and
/btwcounts inUsage (Local).Filter out unmounted internal built-in skills so the
Skillsaccordion matches the active prompt skill list.Guard
hooks/track-active.mjsagainst writing uninitialized subagent invocations toactive.json.Display the active model name next to the context window ratio (
1Mor200K) and add tooltips on breakdown rows.Apply Antigravity's 24 KB per-file rule cap in
scanMemoryFiles().
Development
Install development dependencies (esbuild), rebuild dist/app.html, and run the unit test suite (15 tests using node:test):
npm install
npm run build
npm testIf Antigravity 2.0 is already running and you want the MCP server to reload without restarting the app, call RefreshMcpServers on the local language server with {"serverName":"context-monitor_context-monitor"}, then close and reopen the Context side-pane tab once to load the rebuilt dist/app.html.
License
MIT License. See LICENSE for details.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Your org's AI agents, tasks, runs, search, and brain files as MCP tools and resources.
Hosted MCP server and Agent Skills for specs, engineering threads, and project memory.
MCP-native notes and memory for ChatGPT, Claude, and other AI tools.
Your StoryOS workspace (records, approvals and agents) for Claude, ChatGPT and any MCP client.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceAn 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
- AlicenseNot gradedqualityCmaintenanceEnables Google Antigravity users to view 5-hour and weekly model quota balances alongside offline local token usage, context size, and cache hit rates from a side-pane interface.MIT
- AlicenseNot gradedqualityCmaintenanceEnables 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
- AlicenseBqualityBmaintenanceEnables Antigravity users to monitor real-time token generation speed and per-model-group rolling 5-hour and 7-day quota clocks in the Side Pane and Sidebar, alongside a reactive pixel-art cockpit.5MIT