Skip to content

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.

terminal
# see what is using space
/context
# compact now, steering what to keep
/compact focus on the API changes
# check per-server MCP context cost
/mcp

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

Question 1What does Claude Code clear first when context fills?

Question 2Where should persistent rules live?