What is a context window?
Your assistant answers well for twenty minutes, then forgets the rule you set at the start. This is why.
Context window
context lengthcontext limit
A context window is all the text a language model can refer to while writing a reply, counted in tokens and including that reply. Anthropic calls it working memory. It is separate from what the model learned in training, and it is refilled on every request.
Everything you send counts. Anthropic's docs are specific about this. The system prompt, every message, tool results, images, files and your tool definitions all take space. So does the answer being written.
Sizes vary by model. Claude Opus 5 and Claude Sonnet 5 carry a one-million-token window on the Claude API. Sonnet 4.5 carries 200,000. A token is roughly three quarters of a word in English, so the numbers are large but not unlimited.
What happens when you exceed it
Two different things go wrong, and they look nothing alike. If the input alone is over the limit, Anthropic's API rejects the request with a 400 error reading "prompt is too long". Nothing runs. That failure is loud, and loud is the good case.
The other case is quieter. On Claude 4.5 models and newer, a request whose input plus requested output could overflow is still accepted. If generation then hits the ceiling, it stops and reports the stop reason model_context_window_exceeded. Your user sees an answer that ends halfway through a sentence.
Chat products often hide both by dropping the oldest messages. Nothing errors. The instruction you gave at the start is simply gone.
- SystemYour rules, sent every turn.
- ToolsEvery schema you defined.
- HistoryGrows with each exchange.
- DocumentsPasted text, images, PDFs.
- AnswerThe reply counts too.
History is the only one that grows on its own. A conversation fails on turn forty with the same prompt that worked on turn two.
Related questions
01Does a bigger context window remove the need for RAG?
No. Retrieval still wins when the source material is larger than any window, changes often, or carries access rules. A million tokens is generous, but a document store is not bounded and permissions have to be applied before text reaches the model.
02How many words fit in a context window?
Roughly 750,000 words in a one-million-token window, taking a token as about three quarters of an English word. Treat that as an estimate. Code, punctuation and other languages split up differently. Anthropic offers a token counting API to measure a request before you send it.
03Why does my AI assistant forget earlier instructions?
The conversation outgrew the window and older turns were dropped to make room. Products that manage context on a first-in, first-out basis do this silently. Repeating standing rules in the system prompt each turn is the usual fix, since that part is resent every time.

