Google Antigravity Silently Truncates Chats: A Developer Built a 0-Token Context Counter
Desktop Antigravity 2.0 has no chat-fill indicator, and the server silently cuts off the beginning of the conversation, including the original spec. The author noticed that the IDE writes the exact token count to a transcript.jsonl log and built a /chat command that reads the file and responds without calling the model, so it costs 0 quota tokens. That lets you close a session early instead of waiting for auto-compaction.
AI-processed from Habr AI; edited by Hamidun News
Picture this: you are two hours into refactoring a project with an AI agent in Google Antigravity 2.0, and a banner suddenly appears in the chat: "This conversation grew too large, so the history before this point may be missing or incomplete". That means the conversation with the model has grown too long, and the server has silently cut off its beginning or collapsed the early steps into a compressed summary.
The amount of conversation the model holds in memory is called the context, and it is measured in tokens (roughly, word fragments). The author of a write-up on Habr noticed that the desktop app lacks even a simple fill counter, so he built one himself: a command that shows how much context is used while spending zero tokens, meaning it never calls the model and does not eat into quota.
Why losing the start of a chat is so dangerous
In an ordinary chatbot, a truncated beginning is a forgotten "hello". In an agentic development environment, the beginning holds the most valuable material: the original spec, architectural constraints, agreements about what must not be touched, and the history of background processes. Forums have already named the effect Compaction Amnesia: the model keeps working with confidence, but it brings back decisions that were reversed two hours ago and breaks rules it has just forgotten.
The author generally dislikes marathon chats. He maintains a multi-level project memory: a file with the current status, a dated decision log, a list of verified knowledge, and summaries of individual sessions. Before closing a chat, he runs an audit: he walks through the whole dialogue and records the outcome of every promise and remark. But if part of the conversation has already been compressed, an honest audit is impossible. To hit the brakes in time, you need to see how much context has been consumed.
In neighboring tools, this has long been standard. Cursor and OpenAI Codex put a circular indicator next to the input field. Claude Code shows tokens, window percentage, and cost in the status line, plus a /context command. Cline, Roo Code, and Windsurf keep a progress bar above the chat. The console Antigravity CLI also has a /context command. Only desktop Antigravity 2.0 leaves the area around the input field empty. Developers complain on the Google AI Developers forum and on Reddit: truncation arrives at 200–275 thousand tokens, even when a model with a million-token window is selected.
The author can only guess why Google did not surface the number. Internally, things are more complicated than in an ordinary chat: 95–99% of tokens are read from cache, Orchestrator mode runs different models with different prompts, and some rules are loaded as the task progresses.
How to count tokens without spending tokens
The paradox is that Antigravity itself counts tokens precisely after every step and writes them to disk in plain text. A line-by-line log lives at ~/.gemini/antigravity/brain/<conversationId>/.system_generated/logs/transcript.jsonl. For each step it records input_tokens, cache_read_tokens, and output_tokens. The active context is the sum of input_tokens and cache_read_tokens. The list of all conversations is stored in the SQLite database conversation_summaries.db. No private APIs or IDE patches are needed: reading the local files in read-only mode is enough.
The first version is a chat_tokens plugin with the commands /chat and /ctx. The catch is that an ordinary skill would send a message to the model, so checking the context would cost quota. That is why the commands are defined as empty skills, just so they show up in the autocomplete menu, while the actual work is done by a PreInvocation hook written in Python. It receives the input text and the path to the transcript, computes the fill percentage, the increment, and the cache share within milliseconds, and returns a terminate directive. The request is aborted before it reaches the LLM. The warning threshold can be set right in the command, for example /chat 256k.
The output looks like a traffic light: "🟢 Context: 142 300 / 200k (71%) · +3 420 · cache 96% · 4 Neon High · msgs 6".
Along the way, the author hit three snags:
- The hook documentation promises Markdown output via metadata.user_markdown, but the Go runtime panics and the entire hook response is discarded, terminate included. The channel that actually works turned out to be errorMessage.userMessage.
- After a restart, Antigravity picked up the system Python 3.9.6 on macOS, and the hook crashed on annotations like
int | None. The fix is the linefrom __future__ import annotations. - The Markdown parser merged single line breaks, so a decorative separator had to be replaced with a short traffic-light line.
From plugin to ContextRing
Next, the author added a Context Monitor side panel to the plugin using the built-in sidecar_sdk. But when working with code, the right-hand panel is almost always closed, and opening it just to see a number quickly gets tiresome. So the idea grew into a native macOS app, ContextRing, which the author describes later in the text.
What to take away in practice
This is a personal engineering project, not a Google product. It depends on the format of local logs, which the company can change without notice. But the lesson is broader than one tool. If your agentic environment does not show context fill, look for the numbers in its local logs. Close a session at your own threshold, not when the auto-compaction banner appears. And run state checks through a hook that aborts the request before the model: that way, diagnostics consume neither quota nor the context itself.
- Nov 22, 2026A Backend Developer With No Unity Experience Built a 3D Game With an AI Agent: Subscriptions Cost $112
- Nov 22, 2026OpenAI's Chief Scientist Proposes an AI Speed Limit: GPT-4 Perplexity at 0.91, Now Below 0.8
- Nov 22, 2026Anthropic Shares Fell 8.5% in a Day, Nearly Back to the $83 IPO Price
- Nov 22, 2026Linger Runs an AI Agent on a 16 GB Mac With No Token Fees and Promises a 5x Speedup
Key Questions Answered
Why losing the start of a chat is so dangerous?
In an ordinary chatbot, a truncated beginning is a forgotten "hello". In an agentic development environment, the beginning holds the most valuable material: the original spec, architectural constraints, agreements about what must not be touched, and the history of background processes. Forums have already named the effect Compaction Amnesia: the model keeps working with confidence, but it brings back decisions that were reversed two hours ago and breaks rules it has just forgotten.
How to count tokens without spending tokens?
The paradox is that Antigravity itself counts tokens precisely after every step and writes them to disk in plain text. A line-by-line log lives at ~/.gemini/antigravity/brain/<conversationId>/.system_generated/logs/transcript.jsonl. For each step it records input_tokens, cache_read_tokens, and output_tokens. The active context is the sum of input_tokens and cache_read_tokens. The list of all conversations is stored in the SQLite database conversation_summaries.db.
What are the key details on From plugin to ContextRing?
Next, the author added a Context Monitor side panel to the plugin using the built-in sidecar_sdk. But when working with code, the right-hand panel is almost always closed, and opening it just to see a number quickly gets tiresome. So the idea grew into a native macOS app, ContextRing, which the author describes later in the text.
Test Frontier LLMs & Autonomous Agents in One Workspace
Run Claude Opus 5.5, GPT-6, Gemini 3.1, and DeepSeek side-by-side in Nomad AI (nomadnet.ai) — unified model routing, deep research, and multimodal workflows under one subscription.
The AI world, distilled — once a week
Seven stories that actually mattered, hand-picked. No noise, no reposts, no press releases.
Done! Check your inbox for a confirmation.