7.1 — Context window and tokens: see what your session uses
The context window holds everything Claude can see during a session. That includes your messages, the files it read, command output and Claude's own replies. All of it is counted in tokens.
On every turn, Claude Code sends the whole conversation back to the model. A session that has piled up three unrelated tasks rereads all three on every message of the fourth. You pay for that unused context in tokens, whether you're billed by usage or capped by your plan.
Most current models have a one-million-token window. Claude Code also summarizes the history on its own when the window gets close to its limit. So you're unlikely to run out of room. What matters is cost and accuracy. A context focused on the current task costs less and gets you better answers.
The prompt cache lowers that cost. While it's warm, the start of the conversation, already sent, is billed at a reduced rate. It lasts about an hour on a subscription, and five minutes with an API key. When you come back to a long session after it expires, the whole history is reread at full price.
Three commands show you where you stand:
| Command | What it shows |
|---|---|
/context |
What fills the window, category by category, with suggestions to free up space |
/usage |
The session's usage and your plan limits (/cost and /stats open the same screen) |
/statusline |
Sets up the status line, which can show how full the context is at all times |
/context also lists the CLAUDE.md files and the auto memory loaded at startup. On a subscription, /usage breaks your usage down by skill, subagent, plugin and MCP server. Start with that screen when a session feels expensive.
For the status line, describe what you want to /statusline:
/statusline show the model and the percentage of context used
Claude Code then writes a script that reads the context_window.used_percentage field. You see the percentage under your input box without typing anything.
The rest of the module follows this order. Sections 7.2 to 7.6 keep your session light. Sections 7.7 to 7.9 run Claude Code without you, from a script, in CI/CD or in parallel. Sections 7.10 and 7.11 cover sessions, rewinding and scheduled tasks.
Key takeaways
• Claude Code sends the whole conversation on every turn, so a cluttered context is paid for on every message.
• With a one-million-token window and automatic compaction, you rarely run out of room.
• A context focused on a single task costs less and gets you better answers.
• /context shows what fills the window, and /usage shows what the session uses.
