Appearance
Text size
Typeface
Line spacing
1
Chapter 1 · 4 min

The context window is the one budget

Everything Claude knows in a session sits in one window, and most of it is read again on every turn. Managing what goes in is the main skill of long sessions.


Before you type anything

A session does not start empty. By the time you write your first prompt, context already holds your CLAUDE.md files, the auto memory index, the names of MCP tools and the descriptions of your skills. You paid for those words before the work began.

Then it grows. Every file Claude reads, every rule that loads, every hook output and every tool result is appended. Nothing is removed on its own. The window is a single budget that all of these spend from, and Claude Code does not keep a second one for "important" things.

Some models offer a window of one million tokens. That is a bigger budget, not a different kind of budget: the same things fill it, only later.

See it before it surprises you

$ /context✻ Shows a coloured grid of what is using the window✻ Adds suggestions for what to trim# Look before a long task, not after it fails.

/context is the honest view. If the grid is mostly files Claude read an hour ago, you now know what to cut.

Check yourself

Which of these is already in context before you type your first prompt?

What it costs to keep everything

The part that surprises people is not the size but the repetition. The guide's wording is plain: three unrelated tasks in one session means all three are re-read on every turn of the fourth.

So an old task is not just clutter. You pay to carry it again each turn, and it stays in front of the model while it works on something else. This is why the guide's advice for a stuck session is blunt: after two failed corrections, run /clear and write a better prompt, instead of making a third correction on top of the first two.

Start: instructions and tool names
Work: files and results append
History is re-read each turn
Window nears its limit
Compaction replaces history with a summary

Four habits that spend less

Clear between unrelated tasks. /clear is free, and it stops the old history from being re-read. /clear name also labels the old session so /resume can find it.

Send big reads elsewhere. A subagent reads many files in its own window and returns an answer. The file contents never enter yours.

Ask side questions on the side. /btw <question> answers without growing the history.

Shrink output before it arrives. A PreToolUse hook can rewrite a test command so only the failures reach Claude. A thousand lines of passing tests were never going to help.

Images count too

Screenshots and PDFs accumulate. When the limits near, a batch of the oldest images and PDFs is dropped, and you get one slow turn for each batch. If you pasted ten screenshots of a bug an hour ago, they are probably still costing you.

Check yourself

You finished a bug fix and now want Claude to help with an unrelated feature. What does the guide suggest?

The rest of this course is this one budget seen from different sides: what you load on purpose (CLAUDE.md, rules, memory), what happens when it runs out (compaction), what each turn costs (caching), and which model spends it.

Read further