Expand description
LLM-based context compaction — summarize old messages to stay within limits.
Unlike simple sliding window (trim_messages), compaction preserves key decisions and file changes by summarizing old messages through a fast LLM.
Structs§
- Compactor
- Compacts conversation history using LLM summarization.
Enums§
- Compaction
Error - Errors from compaction.
Functions§
- estimate_
tokens - Estimate token count for messages (rough: chars / 4). Uses char count (not byte length) for correct non-ASCII estimation.