HAVE AI NEWS HAVE AI NEWS
tg subscribe
Models

Google Antigravity Unexpectedly Shrinks Context: Gemini’s Solution

Google Antigravity Unexpectedly Shrinks Context: Gemini’s Solution

Antigravity 2.0 has no built-in context window indicator, so a developer created the chat_tokens plugin and the ContextRing macOS app.

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.jsonl and transcript_full.jsonl — step logs containing input_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_markdown channel specified in the documentation, errorMessage.userMessage proved 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:

Criterionchat_tokensContextRing
PlatformsmacOS, Linux, WindowsmacOS 13+, arm64 and Intel
InterfaceSidecar and chat commandsFloating ring and menu bar
Commands without tokensYes, through a PreInvocation hookNo, it is a visual interface
Window modes and SpacesNot requiredSupported
DependenciesNode.js IDE and Python 3Native 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/contextring

chat_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_tokens

Both 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.

Author: vladsboev

Source: habr.com

Google introduces Gemini 4 Neon for fast, complex AI workflows
Models

Google introduces Gemini 4 Neon for fast, complex AI workflows

Gemini 4 Neon is Google’s new frontier-level model for software engineering, enterprise analysis, science, cybersecurity and long-running agent tasks. It offers a one-million-token context window, flexible reasoning levels and lower per-task costs, with access beginning across Google AI Studio, Gemini for business, Antigravity and the Gemini app.

Google Unveils Gemini 4 Argon: A Return to the Race for Advanced AI Models
Models

Google Unveils Gemini 4 Argon: A Return to the Race for Advanced AI Models

The new flagship Gemini 4 Argon neural network outperformed leading competitors in most tests, although access will be limited at launch.

The AI race accelerates: Meta unveils Muse Spark 1.3, while Google updates Gemini to version 3.8 Flash
Models

The AI race accelerates: Meta unveils Muse Spark 1.3, while Google updates Gemini to version 3.8 Flash

Meta has released the affordable Muse Spark 1.3 model with near-flagship performance, Google has introduced Gemini 3.8 Flash, and insiders have revealed architectural innovations in the upcoming OpenAI Astra.

Google introduces Tool Retrieval for Gemini: fewer tokens when working with hundreds of tools
Tools

Google introduces Tool Retrieval for Gemini: fewer tokens when working with hundreds of tools

The new Gemini API mechanism loads tool schemas only on request. In Google's calculated scenario, token usage for an agent with 200 functions falls from approximately 164,000 to 23,650.

Google Releases Gemini 4 Neon: New Model Nearly Catches Up with Flagship Carbon
Models

Google Releases Gemini 4 Neon: New Model Nearly Catches Up with Flagship Carbon

Gemini 4 Neon is Google’s fourth model in two months, delivering strong results in 16 of 19 tests and offering a lower API price than its competitors.

Google Pulls Ahead: Gemini 4 Carbon Model Unveiled with Record-Breaking Performance
Models

Google Pulls Ahead: Gemini 4 Carbon Model Unveiled with Record-Breaking Performance

Google has announced Gemini 4 Carbon, a specialized AI model for coding and cybersecurity that has outperformed competitors in most industry benchmarks.