Context window
The maximum amount of text (in tokens) an LLM can process at once, including conversation history, instructions, and loaded files.
Definition
The context window is an LLM's "working memory": everything that happens in a session must fit within this window. It's measured in tokens (roughly 0.75 words per token in English). Recent models have context windows ranging from 32k tokens (lightweight models) to several million tokens for the most generous long-context models. For a coding agent, this corresponds to the amount of source code that can be loaded simultaneously in a session.
postcursors perspective
A large context window isn't always better. Models tend to "forget" information at the beginning of the context when it's very long (that's context rot). For coding tasks, 32-128k tokens are sufficient in most cases as long as you only load the relevant files. Context window size is a useful marketing spec but not the most important indicator for daily use.
In practice
Practically: if you load 10 PHP files of 300 lines each (~3000 tokens per file), you're using ~30k tokens just for code context. Add instructions, conversation, and agent responses: a 128k context window is comfortable. Claude Sonnet 4.5 (200k tokens) can hold a medium-sized codebase without too much chunking.
Common misconceptions
- ✗ Believing a 1M token context window means you can dump your entire codebase in it — performance degrades well before the theoretical limit
- ✗ Confusing context window with persistent memory between sessions — the context resets with each new session