The context window
Claude's context window holds your conversation history, file contents, command outputs, CLAUDE.md, auto memory, loaded skills, and system instructions. As you work, it fills up.
When context fills up, Claude Code manages it automatically: it clears older tool outputs first, then summarizes the conversation if needed. Your requests and key code snippets are preserved, but detailed instructions from early in the conversation may be lost — put persistent rules in CLAUDE.md rather than relying on chat history.
# see what is using space/context
# compact now, steering what to keep/compact focus on the API changes
# check per-server MCP context cost/mcpTo control what survives compaction, add a "Compact Instructions" section to CLAUDE.md or run /compact with a focus. MCP tool definitions are deferred by default — only tool names consume context until Claude uses a specific tool.
Check your understanding
Section titled “Check your understanding”Question 1What does Claude Code clear first when context fills?
Older tool outputs go first; then the conversation is summarized if needed.
Question 2Where should persistent rules live?
Early conversation instructions can be lost to compaction; CLAUDE.md loads every session.