The context window, and compaction
Everything Claude knows in a session is in one window, and the window has an end. What happens when it fills is the difference between a session that stays sharp and one that starts forgetting your instructions.
The window holds more than your conversation. It holds the system instructions, your CLAUDE.md, the notes it has saved for itself between sessions, which lesson 11 covers, the descriptions of every skill available, and then, growing all session, the files it read and the output of every command it ran.
/context shows what is using space right now. Run it once in a long session and the number that surprises you is the thing to fix.What happens at the end
Claude Code compacts on its own as you approach the limit. It clears older tool output first, since that is bulky and rarely needed twice, and if that is not enough it summarises the conversation. Your requests and the important code survive. Detailed instructions from early on may not.
That last sentence is the practical one, and it has a fix that costs nothing: rules you need followed all session do not belong in the conversation at all. They belong in CLAUDE.md, which is reloaded rather than summarised. Lesson 10 is that file.
Compacting on purpose
/compact summarises now rather than waiting, and it takes instructions.
/compact focus on the API changes and the failing testNothing is printed. The conversation is replaced by a summary written to that focus, and a marker appears in its place showing where the compressed messages were.
You can set the same steer permanently by adding a section headed Compact Instructions to your CLAUDE.md, and you can move the threshold itself with /autocompact.
Two other things keep the window small, and both have their own lessons. Skills load their full text only when used, so twenty skills cost you twenty descriptions rather than twenty documents. Subagents work in their own window entirely and hand back a summary, which is lesson 20.
- Run
/contextnow, then read one large file and run it again. - Compact with a focus, then ask about something outside that focus and see what survived.
You understood something today that you didn't yesterday.