Skip to content
zero2vibecodelearn vibe coding
Level 0 · Session control 5 min Reviewed by the author · Oct 15, 2026 Verified against Claude Code v2.1.292 · Oct 15, 2026Official docs: Context window, CommandsSomething out of date? Tell us

/compact or /clear: carry on or start fresh

/compact squeezes the conversation into a summary and frees up room so you can continue the same task. /clear starts a clean conversation for a new one. The difference is simple; choosing well is the core skill of a long session.

Level 0 · 0 / 4 lessons0%
In this lesson

No hands-on task in this lesson — just read it through and answer the questions.

In the last lesson you learned to see how full the is. Now — what to do about it. There are two tools, and mixing them up is a mistake.

/compact — squeeze and carry on

/compact

Claude Code replaces the whole conversation with a short summary: what the task is, what you have found out, what has been done. The window frees up, and the work continues from the same spot.

The key move is to say what matters:

/compact keep what we found out about the link checker

Without a hint, Claude decides for itself what goes into the summary, and may throw out a detail you will need ten minutes later. With a hint, you control the notes.

After compacting, type /context: the “messages” share drops noticeably and there is more free room. Right after a couple of questions the difference is small — compacting pays off when the conversation really is long.

/clear — a clean slate

/clear

The conversation starts over with an empty context. The previous one does not disappear: you can return to it with /resume — more on that in lesson 0.4.

How to choose

Ask yourself one question: is this still the same task?

SituationWhat to do
Same feature, window nearly full/compact with a hint about what to keep
Finished one task, starting another/clear
The conversation drifted and got tangled/clear and a short, clear request from scratch
You need to get back to yesterday’s workneither — /resume

A common beginner mistake is dragging one endless session through the whole day. The pro habit is the opposite: one task, one session, and /clear between tasks.

Quick check

You fixed a bug in the payment flow and now want to work on the layout of the About page. What do you do?

Careful

Check your understanding

Answered 0/3
Mode:

You have spent an hour on one feature, the window is nearly full, but the task is not finished. What do you pick?

Why write something after /compact, as in "/compact keep what we found out about the link checker"?

What happens to the old conversation after /clear?

Finish the task in the terminal and answer the questions to complete the lesson.

📝 My notes

Saved automatically in this browser · shows up on the Notes page.

Lesson Q&A

You have spent an hour on one feature, the window is nearly full, but the task is not finished. What do you pick?

/compact — squeeze the conversation and continue the same task — /compact replaces the conversation with a short summary and frees up room, while the task carries on. /clear is for when you start a different task.

Why write something after /compact, as in "/compact keep what we found out about the link checker"?

To say what must be kept in the summary — A hint after /compact says what has to survive the compaction. Without it, Claude decides for itself what matters and may drop a detail you need.

What happens to the old conversation after /clear?

A new conversation starts with an empty context, and the old one stays available to go back to — /clear starts the conversation over, but the previous one is not erased — you can open it again with /resume.

You fixed a bug in the payment flow and now want to work on the layout of the About page. What do you do?

The layout has nothing to do with payments: details of that bug would only take up room and distract. A new task gets a clean context.

Terms in this lesson

Move between lessons with ← → · search with ⌘K

Written and reviewed by Mikhail Kuzmitskii