Compaction & Cache
Keep long sessions focused and prompt-cache reuse high.
Long sessions accumulate context. BudgetAI compacts older turns into summaries while preserving recent task state, so prompts stay focused and cheap.
Compaction lifecycle
- As a session grows, older turns are summarized.
- Recent task state and the active workstream are preserved verbatim.
- Compaction events are reported so you can see when and why it happened.
Prompt-cache continuity
BudgetAI orders context to maximize provider prompt-cache reuse across turns. The router guardrails (anti-downgrade, sticky tier) also protect cache continuity by avoiding needless model switches mid-workstream.
Combined with tool compression, compaction keeps even multi-hour sessions inside a small, cache-friendly context window.