Context: how Claude 'remembers' within a session
Module 4 — Context: how Claude “remembers” within a session
← Module 3 | Index | Next: Module 5 →
This is the concept that, once understood, makes everything else click.
The context window is Claude’s working memory. Picture a desk of a fixed size. Everything Claude is currently “thinking about” has to fit on that desk: your messages, its replies, the files it has read, the results of commands it ran, and its standing instructions (CLAUDE.md, loaded skills, etc.). The desk is large — hundreds of thousands of words — but it is not infinite.
Three consequences
1. Claude reads selectively, not everything. It won’t slurp your entire codebase onto the desk. It searches, opens the few files it needs, reads the relevant parts, and moves on. This is why it uses search tools instead of reading every file — it’s budgeting desk space.
2. The desk fills up over a long session. After a lot of back-and-forth, reading big files, and running commands, the desk gets crowded. When it’s nearly full, older material has to be cleared to make room. If you’ve ever noticed Claude “forgetting” something from much earlier in a very long session, this is why.
3. You can manage the desk deliberately. This is a real skill. The main moves:
/clear— wipe the desk and start fresh. Use this between unrelated tasks. A clean desk means sharper focus and fewer mistakes. This is the most underused good habit in Claude Code./compact— summarize the conversation so far into a short brief, freeing space while keeping the gist. Claude also does this automatically when the desk gets too full (“auto-compact”).- Start new sessions for new tasks. Don’t run a week of unrelated work in one endless conversation.
The practical rule of thumb
One focused task per “clean desk.” When you switch to something unrelated, /clear. When a single task gets long and the history is mostly noise, /compact. Treating context as a resource you spend wisely is one of the biggest levers for getting good results.
A related idea: memory files (CLAUDE.md, Cowork’s memory) are how Claude remembers things across sessions, since the desk is wiped between them. Context = within a session; memory files = between sessions. Use both.