RETAIN · COMPRESS · VERIFY
Agent memory compression: preserve the user’s report preference
Inspect whether a concise-bullets preference survives a long incident conversation.
Preserve a preference with its source
This local conversation starts with a user preference for concise bullets in T2. The agent repeats it in T3; later messages describe an incident and ask for owners. At 24 teaching tokens with Evict oldest, seek to 30 seconds. The first four turns would total 29 tokens. Removing the eight-token user turn leaves T1, T3 and T4 at 21. The preference is still mentioned by the agent but lacks retained user provenance. The status reports both facts explicitly. Repetition is not accepted as a fresh user instruction under this fixture policy.
Measure retention rather than a fictional memory score
At sixty seconds, 24-token eviction retains T1, T7 and T8 for twenty tokens, with no supported formatting preference. Choose Summarize older turns and Preserve critical fact: T1, source-backed summary S and T8 also use twenty tokens, yet now justify concise bullets. Drop critical fact keeps the same size but removes the justification. At 64 tokens all eight original turns fit in 57 tokens. This is bounded working-context compression, not a persistent ADK Java memory service. A real durable preference store additionally needs consent, correction, retention and isolation policies, none of which are simulated here.
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.