The hidden cost of context compaction: re-prefilling 400K tokens after cache expiry

dotey · x · 2026-10-30

dotey highlights a counterintuitive cost lesson for long agent sessions: compressing after the prompt cache expires is expensive.

The real cost isn't the summary's tokens — the model must fully prefill the entire session (400K tokens in the author's test) before it can write the summary. Starting a fresh session and fetching history on demand skips that full re-read, and that's where the bill difference comes from, not summary length.

Related event: Context Compraction Called Costly and Unnecessary for Long Agent Sessions(2 posts)→

Original post →

More from coding & agent

coding & agent channel →