[Feature Request / RFC] Beyond Passive Counters: Tackling "Context Rot" via Real-Time Telemetry & Native "Summarize & Branch" Session Forking

[Feature Request / RFC] Beyond Passive Counters: Tackling “Context Rot” via Real-Time Telemetry & Native “Summarize & Branch” Session Forking

:glowing_star: Acknowledging Great Community Discussions

First, a big shoutout to earlier community members who raised the critical issue of token visibility—especially @mdaniiauskas 's excellent proposal on granular metrics and quota transparency (Topic #116597), and @Rene_Augusto_Negrao 's thoughtful posts on progressive visual indicators and accessible multi-sensory alerts (Topic #111192 and Topic #111809).

They brilliantly highlighted an inescapable truth: Developers cannot optimize or budget what they cannot see in real time.

Building directly upon these insightful foundations, this proposal aims to explore the next natural frontier of the conversation:
What happens when the token count does climb high? How does accumulated context impact agentic reasoning quality? And crucially, how can Antigravity provide developers with an effortless, one-click exit strategy to keep working at peak performance?


:bullseye: Executive Summary (TL;DR)

Theoretical 1M–2M context windows are a triumph of modern AI research. However, in day-to-day production coding, Context Hygiene is King. Multi-step reasoning benchmarks (Lost in the Middle, Chroma’s MECW, RULER) demonstrate that autonomous agent accuracy decays sharply once prompt context passes 60,000–80,000 tokens (“Context Rot”).

We propose a two-part architectural solution:

  1. Live Context Telemetry Badge: Real-time visibility into active prompt tokens, steps, and attention health directly in the UI.
  2. Native “Summarize & Branch” (Session Forking): A one-click handoff mechanism that autonomously compresses a bloated 120k-token session into a 2k-token executive synthesis and launches a fresh, lightning-fast session with zero state loss.

:collision: The Problem: “Context Rot” & Silent Token Bloat in Long Sessions

In real-world software engineering, agentic conversations easily extend to 150–250 steps. In our recent strategy and troubleshooting session (79777e7d):

  • Step Count: 226 steps
  • Transcript on Disk: 408.13 KB
  • Active Prompt Footprint: ~119,400 tokens!

The Compounding Domino Effect:

  1. Inference Latency: Time To First Token (TTFT) slows down noticeably because the model re-evaluates 120k tokens before emitting a single word.
  2. Compute & Quota Burn: Even replying “Yes, proceed” consumes ~120k input tokens on every subsequent turn.
  3. Attention Dilution & Error Loops: Models begin treating past failed tool attempts or voluminous terminal logs as stylistic guides, drifting away from high-priority system instructions located at the top of the prompt.
  4. Handoff Friction: Developers know they should start a fresh chat, but manually copying architectural context, settled decisions, and modified files is tedious and prone to human error. So developers stay in the bloated chat despite degrading quality.

:bar_chart: Feature 1: Real-Time Context Telemetry Badge

Antigravity should give users ambient awareness of their conversation’s physical footprint:

[ 🟢 34.2k tokens | Step 28 | Optimal ]
[ 🟡 68.5k tokens | Step 84 | Attention Dilution Warning ]
[ 🔴 119.4k tokens | Step 226 | Context Rot Alert — Branching Recommended ]
Token Range Step Range Level Visual & Text Indicator Recommended Action
< 50,000 < 75 Optimal :green_circle: Green badge Normal agentic operation. Full reasoning accuracy.
50,000 - 80,000 75 - 120 Caution :yellow_circle: Amber badge Avoid large log dumps; consider wrapping up task.
> 80,000 > 120 Critical :red_circle: Red badge + alert High hallucination risk. Branch recommended.

(Note: In alignment with Rene’s accessibility points in #111809, the status level should always include clear textual badges like “Optimal” / “Caution” / “Critical” alongside color coding).


:high_voltage: Feature 2: Native “Summarize & Branch” (Session Forking)

Instead of forcing users to manually recap everything, Antigravity should introduce a native [⚡ Summarize & Branch to Clean Chat] action in the toolbar.

The 4-Part Structured Handoff Schema:

When triggered, a lightweight agent call generates:
:counterclockwise_arrows_button: Session Handoff Summary (Branched from Session )

1. Active Goal & Primary Objective

  • Exact feature, bug, or milestone being worked on.

2. Settled Decisions & Architectural Commitments

  • Locked-in choices and rejected alternatives (strictly prevents looping or re-debating).

3. Artifact State & Files Modified

  • Files created, modified, or deleted in the parent session.

4. Immediate Next Step

  • The exact next command, test, or code change to execute right now.

:rocket: Measurable ROI

  • Instant Context Reset: Drops prompt size from 120k+ tokens to ~2,000 tokens (an instant 98.3% token reduction).
  • Latency: Sub-second TTFT restored immediately.
  • Accuracy: System instructions, safety rules, and architectural guidelines regain 100% attention weight.
  • Auditability: Parent session remains archived ([Branched -> Session XYZ]) for historical auditing.

We believe this is a low-effort, massive-impact DX feature that will solidify Google Antigravity as the most efficient, cost-effective, and reliable agentic coding environment in the industry.

Looking forward to hearing thoughts from the community and the Antigravity engineering team!

1 Like