Earendil Engineering published a technical explainer on 22 July 2026 describing how prompt (KV) caching affects the cost, latency and architecture of coding agents, and which cache controls its Pi agent exposes. It covers session affinity versus distributed KV block storage, Anthropic-style explicit `cache_control` breakpoints versus automatic prefix caching, and why mid-prompt changes such as tool-loadout edits, reordered schemas, dynamic system prompts or history pruning invalidate everything after the first mismatch. Pi supports message-anchored additive tool loading via `setActiveTools()`, using deferred definitions and `tool_reference` on supported Anthropic models and tool-search items on supported OpenAI models, with a full tool-list resend as fallback. Pi follows Anthropic's five-minute default cache TTL, and notes Claude Code raises it to one hour for subscription users; `PI_CACHE_RETENTION=long` requests longer retention on supported direct APIs.
Sources