noun · AI concept
Context Window
also called context lengthcontext limit
The AI's field of view. Everything it can "see" right now, your messages, its replies, any files, has to fit inside one fixed-size box.
The maximum number of tokens a model can take in on a single request, counting the system prompt, tool definitions, the whole conversation so far, tool results and the reply it writes.
The model is stateless. On every request, the app (the harness) resends everything it wants the model to know, and the context window is the hard limit on that bundle. Anything not in the bundle does not exist for the model.
Real-life example
You start a coding session by telling the agent "never touch the `/legacy` folder." Two hours and fifty file reads later, it edits `/legacy`. It didn't disobey you. Your rule got squeezed out, or summarized away, to make room for newer stuff.
Error: prompt is too long: 212,481 tokens > 200,000 maximum Playground
Watch it happen once, then break it yourself.
- 0.0sThis is the AI's backpack. It can only hold so much.
- 1.5sYou give it a rule.
- 3.5sThen you keep working…
- 7.0sThe backpack is full.
- 8.5sYour rule just fell out.
- 10.5sIt didn't disobey you. It can't see it anymore.
- 12.0sNow you try →
This is the AI's backpack. It can only hold so much.
8% full600 / 8,000estimating…
Request #0 · 600 input tokens
This request ≈ 600 input tokens ≈ $0.0018example pricing · $3 / 1M input
Messages stack up from the bottom.
lost in the middleIllustrative, not computed.
Try to break it
Plant the rule, then chat for a while. Does the AI still know it?
Add stuff
When it's full
Where the analogy breaks
-
It doesn't "forget" over time. The model remembers nothing between requests at all. The app decides what to resend each time. "Forgetting" is the app dropping or summarizing old messages.
-
Inside the box, it doesn't see everything equally well. In long contexts, details buried in the middle get missed more often than things at the start or end.
-
The reply needs room too. The answer the model writes counts toward the same limit, so a nearly full window leaves little space for a long reply.