[RFC] Building a Context Rot Guardian Agent Skill (a /compact equivalent) — hitting a wall reading live tokens #493
cubaseuser123
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
What problem are you trying to solve?
When agent sessions in Antigravity get too heavy, they hit the hard 200k IDE context limit (or Claude limits) and start losing context, auto-truncating, or going into initialization loops. There is no built-in
/compactequivalent to gracefully shed token weight while preserving architectural state. I am trying to build an automated background watcher that reads live token metrics to warn the user before this rot sets in, but I cannot find a clean way to read the live "Customization token usage" or prompt size from the IDE without hacking the internal gRPC stream.Proposed idea
I am building an Antigravity Agent Skill called the "Context Rot Guardian".
SKILL.mdthat can be triggered (e.g., "checkpoint"). It takes all architectural decisions, constraints, and open tasks, and turns them into a highly compressed Knowledge Item (KI) artifact in.gemini/knowledge.monitor.pyscript packaged with the skill. Because I can't find a live token endpoint, this script acts as a "Shadow Tracker". It parses static files (mcp_config.json, active skills) for a baseline, watches thebrain/<uuid>/folder to count agent turns, and uses a generic math rule (total log characters / 3.5) or a local Gemma tokenizer to estimate the token payload entirely offline. When it hits 65%, it pops a Windows notification.My question for the community: Before I build this shadow-tracking logic, is there a hidden debug endpoint, CLI flag, or globalStorage key that just writes the live token count to a local file? Is there a cleaner hook inside Antigravity where an agent can read its own metrics?
Real use cases
Related skills, tools, or prior art
/compactslash commands found in other LLM CLI tools (like Claude Code).Are you willing to help build this?
Yes, but I need guidance
Before posting
Beta Was this translation helpful? Give feedback.
All reactions