Your coding agent loses its cache while it waits for you
- The Core Problem & Gap: Coding agents resend the full conversational context on every turn; during tight tool-execution loops, prompt prefix caching hits 90–99%, but cache retention plummets to ~18% after just an hour of human idle time.
- Two Distinct Modes of Cache Eviction:
- Capacity Misses (Memory Full): Dominate inside rapid autonomous tool loops when GPU/host memory pools overflow under concurrent sessions; addressable via tiered memory offloading, cache eviction policies, and smarter request routing.
- Retention Misses (Timeout Expirations): Occur during human-paced interruptions (reviewing diffs, eating lunch, answering prompts); require session-aware TTLs, cache pinning, client keepalives, or harness-level lifecycle hints.
- Benchmark Realism Gap: Standard evaluation suites (e.g., SWE-bench, TerminalBench) only simulate synthetic or non-human tool loops, needing merely ~5-minute cache retention to achieve near-optimal hit rates; in contrast, real human-in-the-loop workflows demand day-scale retention.
- Quantified Pause Dynamics (FreeInference & Production Data):
- Tool calls experience a P90 gap of ~17.2 seconds with ~97% cache hits.
- Subagent and "Ask User" queries experience ~6-minute P90 gaps (~91–92% cache hits).
- Human idle intervals beyond 15–30 minutes drop hit rates to ~58%, falling to ~18% after 1 hour.
- A 15-minute provider TTL forces ~60.9% additional prefill compute on human-driven sessions compared to unbounded cache retention.
- System-Level & Harness Inefficiencies:
- Subagents frequently spawn without sharing parent prefix tokens, preventing KV reuse across threads.
- Context compaction (condensing conversation history) and dynamic model-switching aggressively invalidate prefix matching.
- Non-LLM execution (sandboxes, tool latency, user wait time) constitutes up to 72% of total session wall-clock time.