Everything It Can See
Leila's agent has read a few files, run some commands and chatted with her for an hour. She asks it about something she mentioned at the very start, and it answers as if it had never heard of it. Nothing is broken. To see why, you need to know exactly what the model can see, and how much of it there is room for.
The context
In the last lesson you saw that each request carries everything the model needs, because the model keeps nothing. Everything in one request is called the context. For an agent, the context holds much more than your messages:
- instructions from the app about how to behave (the next lesson is about these);
- descriptions of the tools it can ask for;
- notes and rules that you or your team wrote for it, loaded at the start;
- the conversation so far, yours and its;
- everything it has read or run: the contents of files, the output of commands, web pages.
All of it is text, so all of it is tokens. The model reads all of it, every request, and nothing else. If a fact isn't somewhere in the context, the model can only use what it picked up in training, which knows nothing about your files, your company or this morning's conversation.
The window
Leila So the context can just keep growing? Every file it reads, every message?
Omid What do you think? Is there any reason it couldn't?
Leila Well, it costs more, we saw that. But you said "can". Is there a hard limit?
Omid There is. A model can take in only so many tokens at once. That limit is called the context window: everything in the request, plus the reply it writes, has to fit inside it.
Leila How big is it?
Omid In late 2026, about a million tokens for Claude's current models. Some smaller or older models have 200,000.
Leila A million tokens is... about 750,000 words? That's several long novels. Surely it never fills up.
Omid For a chat, it rarely does. Now think about an agent. You ask it to fix something in a project. It reads twenty files. One of them is 3,000 lines long. It runs the tests and gets 400 lines of output, five times.
Leila Ah. Every file and every output goes into the context, and they all stay there for every later request.
Omid Right. A single big file can take tens of thousands of tokens. A long agent session can fill even a million.
Where the space goes
You can picture the context window as a bar that fills from the top. Some of it is taken before you type anything: the app's instructions, the tool descriptions and any notes you wrote for it arrive at the start of every session. Then the conversation grows, and for an agent, the things it reads and runs grow fastest of all.
When the window is nearly full, something has to give: the app must remove or shorten older parts to make room. That's why, in a very long session, the agent can lose track of something from the start. The last lesson in this module is about what happens then, and how to avoid it.
In Claude Code you can see the bar for yourself: type /context and it shows how much of the window each part is using, and how much is free.
The reply has to fit too
The reply is written into the same window, one token at a time, after everything else. So the space left over is also the room the model has to answer, or to think. A model with a full window can't write a long reply, however much you ask for one. Apps also set a separate limit on how long one reply may be, which is usually much smaller than the window.
Try it
If you have Claude Code, start a session in a project folder and type
/contextstraight away, before asking anything. Notice how much is already used. Then ask it to read one large file and look again. With a chat assistant, you can see a milder version: paste in a very long document, and many apps warn you it's too long, or quietly cut part of it.
Using it well
- Give the agent what it needs, not everything you have. Point it to the right file or section, so the window holds what matters for this task.
- Watch out for huge outputs. A command that prints thousands of lines, or a giant data file, can take a big share of the window in one go. Ask for a summary, the first lines, or a search instead.
- Restate anything important from long ago. In a long session, an instruction from the start may have been shortened away. If it still matters, say it again.
- In Claude Code, check
/contextwhen a session feels slow or forgetful. It tells you whether the window is nearly full.
Words to know
- context - everything in one request to the model: instructions, tool descriptions, the conversation, and everything it has read or run
- context window - the most text, in tokens, a model can take in at once, counting the reply it writes; about a million tokens for Claude's current models in late 2026
Big idea
The model sees only its context: everything in the current request. The context window limits how much that can be, and an agent fills it quickly with what it reads and runs, so what you put in matters.