Expand description
Context collapse (snip compaction).
An alternative to full LLM-based compaction that works by selectively snipping (removing) older message groups to stay within the context window. The full conversation history is preserved for UI scrollback, but only a subset is sent to the API.
Snipping preserves:
- The system prompt (always)
- Any compact boundary / summary messages
- The most recent N messages (configurable)
Snipped messages are replaced with a “[messages snipped]” marker in the API-facing view, while the UI retains the full history.
Structs§
- Collapse
Result - Result of a context collapse operation.
Functions§
- collapse_
to_ budget - Collapse the message history to fit within a token budget.
- recover_
from_ overflow - Recover from a prompt-too-long error by collapsing more aggressively.