# 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

```terminal
$ /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.

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

- The files you will edit
- CLAUDE.md, auto memory, MCP tool names and skill descriptions
- The output of your tests
- Nothing, the window starts empty

**Answer:** CLAUDE.md, auto memory, MCP tool names and skill descriptions. Instruction files, memory, tool names and skill descriptions load first. Files and tool results come later, as the work happens.


## 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.

```flow
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.

> **Imports do not save space**
Writing `@path/to/file` inside CLAUDE.md feels like moving text out of the way. It is not: an imported file loads together with the file that imports it. Imports help you organise, not spend less.


## 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.

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

- Continue in the same session so Claude remembers more
- Run /clear so the old history is not re-read each turn
- Switch to a larger model
- Edit CLAUDE.md

**Answer:** Run /clear so the old history is not re-read each turn. Unrelated history is re-read on every turn. /clear is free and removes that weight.


> **Look at your own window**
Open a session you have used for an hour and run `/context`. Find the single largest item. Ask yourself whether the next ten turns need it. If not, that is your first cut.


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.
