Managing Context
Context management
Part of: The Context Window
So the desk fills up and old sheets slide off. You're not helpless about it. The whole craft of building good AI features is deciding what stays on the desk , and there are three reliable moves for keeping the important stuff in view. What it is Context management is the practice of choosing what goes into the window so the model always has what it needs and nothing it doesn't. Three core strategies do most of the work: 1. Trim old turns. Drop the oldest messages once you're near the limit, like silent truncation, but deliberate and on your terms. 2. Summarize history. Replace many old turns with one short summary. Fifty turns of chatter become a three-line recap that costs a fraction of the tokens but preserves the gist. 3. Keep only relevant chunks. Instead of stuffing everything in, include just the pieces that matter for this question. (Retrieval, a later module, automates picking those pieces.) How it works The shared idea is spend the budget on signal, not noise. Summarizing is the highest-impact move because it shrinks a lot of text into a little while keeping meaning: You can mix strategies: keep the system prompt and the last few turns verbatim, summarize the older middle,
Challenge: Summarize-or-Truncate