The context budget
Every model has a fixed context window measured in tokens. As a chat grows, it eventually fills that window.
Manage it deliberately:
- Recent messages are always kept, the model needs them.
- Old messages are trimmed or summarized.
- A running summary preserves long-term knowledge.
Balance memory against cost: keep what matters, forget what does not. A well-tuned bot stays fast and affordable while remembering enough to feel natural.