Skip to content
all lessons
Agents in Practice6.2Locked

What's in the context window

Why does the assistant sometimes 'forget' what you told it earlier?

The idea inside

Each turn the model sees one bundle: system prompt, tools, your files, and the whole chat.

After this lesson

You can list what occupies the context window and explain why it's a fixed budget, not memory.

Where it leads

So what do you do when it starts to fill up?

Inside this lesson

That's the real lesson stage, paused. Claim your pass to operate it.

See how AI actually works, end to end.

This lesson is one stop on the full arc. Unlock all of it, and keep it for life.

What you get

  • The 34-lesson main path, a finishable route from a word to agents
  • Goal tracks for using AI at work and building AI features
  • Boss labs that make you apply a whole act, not just recognize it
  • Spaced recall that brings each idea back before you forget
  • Course memory: every term defined, with links to where it first appears
  • A shareable capability card when you finish the main path
  • Lifetime access on every device, every future lesson included

Not videos to watch. You predict, operate the machine, then prove it. That is why it stays.

99 interactive lessons and challenges. No videos, no code.

Free launch pass: lifetime access, no card needed

New here? The first lessons are free to try. Start with lesson 0.1

What this lesson shows

Each turn the model sees one bundle: system prompt, tools, your files, and the whole chat.

The question it opens with

Why does the assistant sometimes 'forget' what you told it earlier?

The walkthrough, in the lesson's own words

  • The window was full. One more turn, and the oldest one falls out.
  • The window is nearly full. Add one more turn and watch what gives.
  • Your turn. Add files and turns until the window overflows.
  • Watch one run fill the window past its limit.
  • Nothing is remembered. Whatever matters must be IN the window.
  • This chat just told the model its name. The window is 99% full. What do you think happens to that name when you add one more turn?
  • There's no memory. Every turn the model re-reads one bundle of a fixed size; when it's full the oldest turns fall out, so your name simply isn't there anymore.
  • The "oldest turns fall out" behavior is what many chat apps do; some instead just stop and ask you to start a new chat. A raw API call errors when you exceed the limit. Agent tools like Claude Code compact or summarize the history to keep going, that's the next lesson.
  • One window holds everything the model sees this turn.
  • 12 files plus 30 turns already burst a 200K window. The oldest turns got dropped to fit. Now make it happen yourself.
  • It's rebuilt every turn from whatever's inside it. In a chat app, when it fills, the oldest chat history is pushed out and is gone, though files on disk can still be re-read; the conversation itself can't. Bigger windows (200K → 1M) buy room, but the limit is always hard.
  • A raw API call instead errors when you exceed the limit; agent tools like Claude Code compact or summarize the history, the next lesson.
  • You told an assistant your name at the start of a long chat, and an hour later it has no idea who you are. It didn't 'lose' the memory. What actually happened?
  • There is no memory: every turn the model re-reads one fixed-size context window. Once it filled, the oldest turns (your name) fell out to make room. So put anything that must persist into a file or memory the agent can re-read, not just early in the chat.
  • Typical, illustrative token sizes; real prompts, files, and turns vary.

Key takeaway

Nothing is truly remembered; whatever matters must be in the window, and the window has a hard limit.

What you can do after this lesson

You can list what occupies the context window and explain why it's a fixed budget, not memory.

Check yourself: For the model to use a fact this turn, where must that fact be?
  • In the context window right now(correct)
  • Somewhere in its training data
  • Saved in a file on disk
  • Mentioned in an earlier session

The model can only use what is in the context window right now. Training data and files on disk don't count until they are loaded into context.

Prefer reading first? This lesson has a companion explainer: Context window

Where it leads: So what do you do when it starts to fill up?

This is the written summary. The lesson itself is interactive: you predict, drag and operate the mechanism above, and the reveal answers you.