Claude Code Basics Lesson 28 of 46
Cleaning Up: Compact and Clear
- Two different moves: compact summarizes and keeps the thread, clear empties the table.
- Same work continuing → compact. New topic → clear.
- With compact you can tell it what to absolutely keep.
- Instructions written in the file come back; the ones only spoken out loud can get lost.
Two moves, not one
When the table is full you have two moves, and they're genuinely different:
compact — takes the conversation so far and summarizes it. What you've settled stays, in short form; the detail of how you got there disappears. The thread of the conversation continues.
clear — empties. New conversation, clean table, like you'd just opened it.
They're not two levels of the same thing: they answer two different situations.
Which one, when
You're continuing the same job and the conversation has run long → compact. Throwing everything away would force you to re-explain where you'd gotten to.
You're switching to a different job in the same window → clear. A summary of the previous thing, here, is just noise you're carrying around and paying for on every turn.
There's only one criterion: do I still need what's on the table? If yes, you compress it; if no, you toss it.
Compact with a pointer (almost nobody knows this)
It writes the summary itself, and decides on its own what matters. On a long conversation it can get it wrong: it throws out the plan you'd agreed on or that clarification of yours that you cared about.
You avoid it by telling it: along with the command, add what to absolutely keep — "keep the plan we defined and my corrections on the file names". It costs five seconds and changes the quality of what survives.
What survives the cleanup
Here's the thing that closes the loop with the previous two lessons. After a compact:
The file's instructions come back. The project's CLAUDE.md gets re-read from disk and put back on the table: it's written somewhere, so it can't get lost.
What you'd only said out loud can disappear. If you gave a clarification only in chat, it goes through the summary's meat grinder and might not come out the other side.
Which is the best possible argument for the CLAUDE.md lesson: if something really matters, don't say it — write it.
What's next
So far you've been managing memory yourself: you write the instructions, you decide when to clean up. But there's also a piece that writes itself: Claude takes notes on how you work, without you telling it anything. In the next lesson we go read what it's written.
Did you get it?
Two minutes, no grade. Trying to answer — even getting it wrong — cements the concepts far more than rereading. Not in the mood? Skip it: the lesson still counts as complete.
You've been working on the same thing for an hour and the table is full. What do you use?
The work is still going, so throwing everything away would cost you re-explaining where you'd gotten to. `compact` summarizes the conversation and frees up space while keeping the sense of what you've done.
You're done and you switch to a completely different job in the same window. What do you use?
A summary of the previous job, on a new topic, is just noise you're carrying around and paying for on every turn. New topic, clean table.
After a compact, what happens to your permanent instructions?
What lives in a file comes back, because it gets re-read from disk. What you'd only said out loud in chat, though, goes through the summary's meat grinder and can disappear — which is the best argument for writing down, in the file, the things you care about.
-
Chapter 1 Introduction
-
Chapter 2 What's Underneath
-
Chapter 3 You Choose the Engine
-
Chapter 4 First Time at the Controls
-
Chapter 5 What You Let It Touch
-
Chapter 6 What It Knows About You
-
Chapter 7 Skills
-
Chapter 8 How Many You Put to Work
-
Chapter 9 What It's Connected To
-
Chapter 10 Automating the Setup
-
Chapter 11 Wrap-Up