RETAIN · COMPRESS · VERIFY
Context compaction: retain the retry policy or lose the answer
Watch eight turns enter a bounded window and inspect the exact retained messages.
Test the retry-policy boundary
The user introduces a three-attempt retry limit in T2, with eight teaching tokens. T1 uses seven and T3 repeats the limit in eight. Set 24 tokens and Evict oldest, then seek to 30 seconds. T4 adds nine tokens, pushing the total from 23 to 32. Evicting T2 leaves exactly 24: T1, the agent restatement T3, and T4. Fact mentioned is yes, but user-backed evidence is no. Use this boundary to distinguish surviving words from the missing provenance before deciding whether to trust a retained answer.
Compare preservation with deliberate loss
Continue to sixty seconds: eviction leaves T1, T7 and T8, totaling 24 tokens, and cannot support the final answer. Choose Summarize older turns with Preserve critical fact at the same budget. The final window contains T1, summary S with source T2, and T8, totaling 22. The answer is retry limit: three attempts. Drop critical fact gives the same 22-token total without support. Thus identical token counts can conceal very different evidence quality. At 64 tokens with eviction, all eight turns total 64 exactly and the original user evidence survives. Compare 48 tokens, where the early evidence is eventually lost.
Distinguish a mention from evidence
The green rows carry user-backed evidence, identified by source turn T2. An agent response can repeat the same fact while its original user turn has been evicted. The status deliberately reports fact mentioned separately from user-backed evidence. This fixture requires either T2 itself or a summary that explicitly retains its provenance before answering. This is a conservative teaching policy, not an ADK rule or a claim that repeated text is unreadable to a model. Turn annotations are explicit fixture data; there is no semantic fact extractor, inference call or automatic truth detector.
Read the exact overflow operations
Context budget selects 24, 36, 48 or 64 teaching tokens. The system instruction T1 stays pinned and counts against that budget. Evict oldest removes the earliest retained non-system turn until the total fits. Summarize older turns replaces such turns with one six-token summary, recording every affected turn ID. Preserve critical fact copies user-backed evidence into that summary. Drop critical fact deliberately omits it. Agent-only restatements cannot create provenance. Fidelity has no effect on eviction. The summary remains pinned after creation while additional original turns are folded into it; this policy is a small local algorithm, not the ADK event-window implementation.
Control the replay and retain an observation
Play messages reveals eight arrivals over sixty seconds, one every 7.5 seconds; no message has arrived at zero. Pause messages freezes the inspection and Resume continues. Restart rewinds without changing the policy. Timeline pauses and seeks, and Speed changes only playback pace, including during a running replay. Changing budget, policy or fidelity recomputes the fixture and returns to zero. At sixty seconds Replay starts again. Buttons work with Space and the timeline with arrow keys. Capture baseline stores the visible token and provenance status for comparison; Replace baseline updates it and Clear baseline removes it. Notes persist in this browser and can be exported separately. Expand experiment enlarges the workspace.
Inspect the evidence without inventing measurements
The retained-message list and expandable exact-state JSON describe the current arrival only. Export fixture JSON includes every computed arrival and separately labels the inspection position; it is intentionally not a partial trace export. Teaching tokens are fixed weights, not tokenizer output or a billable count. Six-token summary cost is a model assumption even when its displayed sentence is longer. No latency saving, answer-quality score, external storage, durable preference, privacy control, deletion guarantee or model service is measured. ADK compaction summarizes older event history using configurable windows and a summarizer; this lesson isolates budgeting and provenance instead of claiming to implement that API.
Exact retained evidence
Inspect current arrival JSON
The export includes all computed arrivals and a separately labeled inspection position.