Compaction

When a conversation grows into the reserve headroom near the model’s context limit, the provider writes a structured summary and replay continues from it. The full history never leaves your store, so transcript views stay complete. On by default whenever the model’s window is known.

agent.context_usage
# => { tokens: 141_000, window: 200_000, fraction: 0.705 }
agent.compact # the manual button
Mistri.agent("claude-opus-4-8", compaction: false) # opt out

Visible, never silent

:compacting fires when a fold starts and :compaction carries the summary when it lands, so users can see exactly what the model still remembers. Wire them to a banner or a collapsible block in your UI.

What gets cut

Only conversation history is summarized. Open approvals are never folded away, and the cut lands on user-message boundaries so a resumed run replays cleanly.