During a prolonged session in Google Antigravity 2.0, a warning about conversation history overflowing may appear: the beginning of the dialogue becomes unavailable or is replaced with a compressed checkpoint. To monitor this process, a developer created the chat_tokens plugin and the native macOS app ContextRing, which analyze the IDE’s local logs.
Why losing the beginning of a chat is dangerous for an agent
In an ordinary conversation, a missing greeting is almost irrelevant. In an agent-based development environment, the beginning of a conversation may contain the technical specification, architectural constraints, approved decisions, and information about background processes.
If this data disappears after automatic compaction, the model continues working confidently but may return to canceled decisions or violate constraints it has forgotten. The author calls this effect Compaction Amnesia.
To reduce the risk, the author uses a session wrap-up procedure. It involves auditing tasks, updating project memory files, and preparing a brief state summary for the next chat. However, without information about how full the context window is, it is impossible to know whether the user will be able to complete this process before automatic compaction begins.
Antigravity 2.0 has no context indicator
In the desktop version of Antigravity 2.0, the input field does not show the number of tokens used, the fill percentage, or a warning that the limit is approaching. At the same time, Antigravity CLI provides the /context command, which shows context distribution, as well as the /compact command.
Users on the Google AI Developers forums and Reddit are discussing the need for such an indicator. According to the author’s observations, automatic trimming may occur at roughly 200,000–275,000 tokens even when a model with a larger theoretical window is selected.
Several Antigravity-specific features make the situation more complicated:
static context is processed extensively through Prompt Caching;
Orchestrator mode uses different models for planning and execution;
rules and skills may be loaded during operation.
At the same time, token data is already written locally after every step. The problem is that the interface does not display it.
What data is stored on the computer
Antigravity uses two local data sources for each session:
~/.gemini/antigravity/brain//.system_generated/logs/transcript.jsonlandtranscript_full.jsonl— step logs containinginput_tokens,cache_read_tokens,output_tokens, the model name, timestamps, tools, and files;~/.gemini/antigravity/conversation_summaries.db— an SQLite database containing chat names, working folders, the number of steps, and the time of the last user input.
The active context volume is calculated as the sum of input_tokens and cache_read_tokens. As a result, the tools do not need network APIs, authentication tokens, or changes to Electron binaries: they only need to read local data in read-only mode.
chat_tokens: commands without contacting the model
The first part of the solution was the chat_tokens plugin. It adds the /ctx and /чат commands and lets users set a warning threshold, such as /чат 256k or /ctx 1M.
A regular skill would send such a command to the LLM and consume part of the quota itself. The plugin therefore uses a local PreInvocation hook. It receives JSON containing the input text and transcript location, reads the log, calculates the context size, fill percentage, increase, cache share, model, and step count, then stops processing before a request is sent to the model.
As a result, the check uses no context tokens. Development required accounting for several environment-specific details:
instead of the
metadata.user_markdownchannel specified in the documentation,errorMessage.userMessageproved more reliable;the hook must work correctly with the system Python 3.9.6 on macOS;
the output format had to be adapted to the interface’s Markdown rendering.
From a sidebar to a standalone app
chat_tokens also includes a Sidecar for Antigravity’s right-hand panel. It displays charts, a context breakdown, and session history, but it is inconvenient to use when the panel is closed.
According to the author, Antigravity 2.0 plugins and hooks cannot open the sidebar or register their own keyboard shortcut. The next stage was therefore ContextRing, a native macOS app that displays information over the IDE window.
How ContextRing works
ContextRing is written in Swift using AppKit and SwiftUI. The app is built directly with swiftc as a Universal Binary for arm64 and x86_64, without third-party frameworks or a heavyweight Xcode project.
The ring’s position is saved relative to the nearest window edges, separately for normal mode and macOS Fullscreen. A free-positioning mode is also available. Using NSWorkspace, CGWindowListCopyWindowInfo, and AXObserver, the app tracks Antigravity windows across different desktops.
The interface scale is synchronized with the zoomLevel setting in ~/Library/Application Support/Antigravity/User/settings.json. This allows the ring and text to change size together with the IDE scale.
Event-driven updates instead of constant polling
In version 1.1.0, data collection was switched to an event-driven model. DispatchSourceFileSystemObject watchers monitor the active transcript, the brain directory, and the SQLite files.
Because transcript.jsonl is an append-only log, the parser stores the last processed position and reads only new bytes using FileHandle.seek. Window tracking is handled through AXObserver. When Antigravity is inactive or minimized, no continuous polling loop runs; the author reports idle CPU usage of 0%.
How the app distinguishes compaction from a model change
Testing showed that a drop in context size does not always indicate compaction. Drops of 10–35% without a system CHECKPOINT were associated with a model change or a switch between Orchestrator phases.
When the model is changed manually, the service tag appears in the log. The cache may then stop being used, and the conversation is loaded into the new model again. In Orchestrator mode, transitions between planning and execution are accompanied by exit_plan_mode and enter_plan_mode calls or a system message describing the mode.
The ContextRing parser separates actual signs of compaction from configuration changes. The history uses separate markers for compaction, the model, and the reasoning level. Analysis can be switched between the overall context, Orchestrator and Executor modes, and individual models.
What the tools show
Current session
The “Context” tab displays the warning threshold, recent chats, and the context structure. Data is divided into the following categories:
system and rules;
files in context;
tools and commands;
model responses;
reasoning;
user messages.
It also provides summary metrics for the model and reasoning level, growth during the last step, cache efficiency, message count, historical peak, input and output tokens, and session duration.
Statistics for 24 hours and 7 days
The statistics section aggregates data by chats, messages, model calls, and compactions. It also displays recent input, cache reads, output generation, active time, models used, files, tools, and a list of active chats.
Settings allow users to choose the ring style, link its scale to zoomLevel, change the diameter and arc thickness, adjust font sizes, and select the launch mode. Both projects support Antigravity’s light and dark themes, as well as English and Russian.
Why the projects were split
chat_tokens and ContextRing solve related but different problems:
| Criterion | chat_tokens | ContextRing |
|---|---|---|
| Platforms | macOS, Linux, Windows | macOS 13+, arm64 and Intel |
| Interface | Sidecar and chat commands | Floating ring and menu bar |
| Commands without tokens | Yes, through a PreInvocation hook | No, it is a visual interface |
| Window modes and Spaces | Not required | Supported |
| Dependencies | Node.js IDE and Python 3 | Native Swift and Accessibility |
Both tools can be used at the same time: chat_tokens keeps quick commands in the chat, while ContextRing continuously displays the state over the IDE window.
Open source and installation
The projects are released under the MIT license. The author states that they include no telemetry, hidden network requests, or modifications to Antigravity system files.
ContextRing is available in the github.com/vladsboev-web/ContextRing repository. To install it through Homebrew, use:
brew install --cask vladsboev-web/tap/contextringchat_tokens is hosted in the github.com/vladsboev-web/chat_tokens repository. Installation through the Antigravity CLI is performed with:
agy plugin install https://github.com/vladsboev-web/chat_tokensBoth projects emerged as an attempt to compensate for the lack of a built-in context window counter in the desktop version of Google Antigravity 2.0 and give users a way to finish long sessions in advance.