What is a context window?
A context window is a model's working memory. Everything the model can "see" when it writes an answer has to fit inside it: the system instructions, the conversation so far, files you attached, results from tools and the answer being written. Anything outside the window does not exist as far as the model is concerned.
The size is measured in tokens, not words, and it differs by model. Sizes have grown quickly, from a few thousand tokens in early models to hundreds of thousands or more in current ones. Check the provider's documentation for the figure that applies to the model you use.
What counts toward the context window?
| Item | Notes |
|---|---|
| System prompt | Standing instructions, sent on every request |
| Tool definitions | Descriptions of each tool the model may call |
| Conversation history | Every earlier message, resent on each turn |
| Attached documents | Files, retrieved passages, web pages |
| Tool results | What searches and other tools returned |
| The model's output | The reply, and any reasoning, as it is generated |
What happens when the context window fills up?
It depends on the product. Some refuse the request. Some drop the oldest messages. Some summarise earlier parts of the conversation to free space. In the last two cases the model may appear to forget something you said earlier, because that text is no longer in front of it.
Is a bigger context window always better?
No. A bigger window lets you supply more, but more is not always better:
- Cost. You pay for every input token on every turn.
- Speed. Longer input takes longer to process.
- Attention. Models can give less weight to details buried in the middle of a very long input, and accuracy can fall as irrelevant material piles up.
A focused 2,000-token prompt with the right passage often beats a 200,000-token one with the right passage somewhere inside.
How do you manage context well?
- Give the model the relevant passages, not the whole archive. Retrieval exists for this.
- Put key instructions at the start, and repeat the question after long documents.
- Start a fresh conversation when the subject changes.
- Summarise long threads and carry the summary forward.
- For agents, save notes to a file instead of relying on the conversation to hold them.
Context window vs memory
The context window is temporary. It is cleared when a conversation ends. "Memory" features work by saving notes outside the model and inserting them into the window in later sessions.