Context Compression

Domain: Memory & State

🎯 Motivation

When the conversation gets long, compress older messages into a summary to fit within the context window.

πŸ“‹ Concrete Example

40 messages of conversation = 8000 tokens. Compress messages 1-30 into: β€˜User asked about Python loops, lists, and dictionaries. Understood all three.’ Now 200 tokens. Recent messages 31-40 stay detailed.

πŸ”— Analogy

Summarizing a long meeting - instead of reading 10 pages of notes, you write a 1-page summary. You keep recent details but compress old ones. Context compression does this for conversations.