Cache 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.
Antigravity 缓存命中率监控插件 (Cache Monitor v3.0)
一个原生 Antigravity MCP App 插件(基于 SEP-1865 / @modelcontextprotocol/ext-apps),零端口监听、零外部依赖、纯本地只读,直接在 Antigravity 右侧辅助栏(Side Pane) 或 左侧导航栏全页视图(Sidebar) 实时监控 Prompt 缓存效率、5 小时滚动消耗、工具输出膨胀、子代理/Swarm 缓存税以及本地 brain/ 磁盘空间。
为什么做这个插件?
重度使用 Antigravity 写代码时,长会话和多代理任务极易触发隐式缓存失效(cache_read_tokens = 0)或单步上下文暴涨,迅速消耗滚动窗口额度。界面默认看不到这些关键指标:
过去 5 小时滚动窗口 内,我的本地等效输入消耗和冷未命中浪费占比有多高?
当前会话距离 5 分钟隐式缓存过期 还剩多久?上下文是不是快到自动压缩阈值、该主动
/compact了?刚才单步上下文突然暴涨几万 Token,究竟是哪个工具(
read_file/run_command/grep等)把输出灌爆的?开启 Subagent / Swarm 多代理后,每个子任务的冷启动税到底额外消耗了多少 Token?
遇到
<1m突发性异常未命中想提 Issue 反馈,如何一键导出严格脱敏的取证报告?本地
~/.gemini/antigravity/brain/的历史日志与 chunks 占了多少磁盘空间?
Cache Monitor v3.0 直接只读解析本机 transcript.jsonl,把以上诊断变成侧栏里触手可及的实时驾驶舱。
Related MCP server: AGY Flow Monitor
v3.0 核心特性
5 小时滚动消耗仪表 + S/A/B/C/D 缓存健康评级:
始终基于最近 5 小时真实日志统计本地等效输入(
未命中输入 + 缓存命中 × 10%)、5h 命中率、冷重传浪费占比,并绘制纯 SVG 10 柱(每柱 30 分钟)消耗曲线与冷 Miss 标记。(注:均为本地日志估算,不冒充服务端官方剩余额度。)按命中率、冷未命中率与
<1m异常率计算透明的S / A / B / C / D综合评级。
实时 5 分钟 TTL 保活 + 模型感知
/compact顾问:每秒无闪烁局部刷新距上次交互时长、5m 保活倒计时与若冷失效预计重传量。
结合模型估算上下文软上限(如 1M 模型软预警
~260K / ~240K,200K 模型~150K,透明标注「估算」)和近 5 轮增长斜率,动态给出/compact最佳时机建议。
单步上下文膨胀 & 工具输出归因(Tool Bloat):
直接从
transcript.jsonl的GENERIC记录精确还原工具原始输出字节数(零额外读盘),按字节占比分摊单轮正向Δ输入,定位最吃上下文的 Top 工具与 Top 单步飙升(+≥15K)。逐轮视图支持 命中率 % / 上下文体积 双模式纯 SVG 曲线,标注红点(冷 Miss)与琥珀色菱形(膨胀飙升),点击圆点或明细行即可展开该步触发工具明细。
父会话 + Subagent / Swarm 任务树聚合:
双向关联父子会话与 Swarm 角色(如
@researcher/@architect),汇总子任务总输入与首步冷启动税,并支持在「会话」Tab 展开/收起子任务树、在「逐轮」Tab 通过面包屑快速切换父子会话。
中途冷未命中 5 类根因自动诊断:
自动将排除首轮后的冷未命中归类为:闲置超 5m TTL、中途切换模型、上下文压缩/截断、1–5m 提前失效、<1m 异常未命中。
一键脱敏 Bug Report 导出(严格隐私保护):
支持导出「当前范围 / 仅
<1m异常 / 当前会话」三种粒度的 GitHub Issue Markdown 报告。强脱敏保障:绝不包含对话预览文本、本地文件路径、工具参数或原始会话 UUID(自动映射为
Session #1、Session #2…)。适配沙箱 iframe 剪贴板策略(Clipboard API →
execCommand降级 → 全选引导Ctrl/Cmd+C),并支持一键附到对话上下文。
本地
brain/只读磁盘审计(独立按需拉取):进入「诊断」Tab 时才通过独立 app-only 工具
get_disk_audit按需扫描(服务端带 60 秒缓存,绝不拖慢 5 秒实时轮询),展示总占用、日志放大倍数、主日志 / chunks / 步骤输出 / 其他4 类占比及 Top 15 大目录。
侧栏 ↔ 对话双向联动(MCP App 原生能力):
在右侧辅助栏中可一键 「附到对话诊断」(
updateModelContext)或 「让 Agent 分析」(sendMessage);无绑定对话的全页视图自动隐藏对应按钮。
深浅主题 & 中英双语自适应:
自动同步 Antigravity 宿主主题变量与
locale,右上角支持中 / EN一键切换,340px 窄侧栏与 1100px+ 宽屏全页均零横向溢出。
隐私与安全
100% 本地只读:仅只读访问本机
~/.gemini/antigravity/brain/,绝不修改或删除任何对话、日志或缓存文件。零外联与严格 CSP:前端打包为单文件内联 HTML(严格遵守
default-src 'none'CSP),所有图表均为纯 SVG,无外部脚本、样式或网络请求。严格脱敏导出:Bug Report 导出器仅保留模型名、UTC 时间戳、间隔、Token/字节统计、根因标签与工具名计数,剥离一切用户输入、路径、参数与原始 UUID。
安装方式
方式一:通过 agy CLI 一键安装
agy plugin install https://github.com/laiwanjunzi/antigravity-cache-monitor.git方式二:克隆后运行本地安装脚本(零构建、无需 npm install)
仓库已包含预构建的单文件产物 dist/server.mjs 与 dist/app.html(仅需 Node.js >= 20):
git clone https://github.com/laiwanjunzi/antigravity-cache-monitor.git
cd antigravity-cache-monitor
node scripts/install-local.mjs插件会自动安装到 ~/.gemini/config/plugins/cache-monitor/,Antigravity 无需重启即可自动发现并启用。
打开方式
右侧辅助栏(推荐):点击右侧辅助栏顶部
+菜单 → 选择 「缓存命中率」。左侧导航栏全页视图:直接点击左侧导航栏中的 「缓存命中率」。
对话内唤起:直接对 Agent 说「打开缓存命中率监控面板」。
本地开发与测试
npm install
npm run build # 重新打包 dist/app.html 和 dist/server.mjs
npm test # 运行 v3.0 MCP 协议、归因、工具膨胀、任务树与磁盘审计测试
npm run install:local # 热更新到 ~/.gemini/config/plugins/cache-monitor开源协议
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
Query your AI agent traces, root-cause verdicts and issues, and run investigations, from your agent.
Read-only production context for AI agents: Docker/K8s health, deploys, logs, traffic, code graph
Inspect AI brand visibility, tracked prompts, competitors, citations and search fan-outs.
Data + AI observability — monitor and troubleshoot production-grade agents and the context they use.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceEnables 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
- 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
- AlicenseNot gradedqualityBmaintenanceProvides local-first real-time telemetry and a dashboard for Antigravity Desktop, enabling users to track tokens, cache efficiency, models, subagent rollups, tool calls, and storage entirely on-device.1MIT
- AlicenseNot gradedqualityBmaintenanceEnables live read-only visibility into Antigravity 2.0 context-window usage, cache hit rate, token trends, and estimated API costs from local logs without model calls or client modification.MIT