CompactionProvider Ladder

Gentlest-first strategies, each gated by whether history still exceeds the token budget

CompactionProvider Ladder Gentlest-first strategies, each gated by whether history still exceeds the token budget 01 / Budget check 02 / Compaction strategy Compact if over budget Call History · over budget · Budget check History over budget Collapse · drop tool results · Compaction strategy › Compact if over budget · gentlest Collapse drop tool results gentlest Summarize · condense turns · Budget check › Compact if over budget Summarize condense turns Slide Window · keep recent · Compaction strategy › Compact if over budget · last resort Slide Window keep recent last resort Model Call · fits budget · Budget check › Call Model Call fits budget over budget still over still over compacted Legend User UI Agent logic Policy Tool action Context / trace

Gentlest First

  • • Tool-result collapse loses the least information
  • • Summarization condenses only older turns
  • • The sliding window is the last resort

Gated By Budget

  • • Each stage runs only if history still exceeds budget
  • • The ladder stops the moment the context fits
  • • No strategy runs harder than it needs to

Skip When You Can

  • • If already within budget, compaction is skipped
  • • The model call always sees a budget-fitting history
  • • Compaction never blocks a request that fits