# /compact or /clear: carry on or start fresh

Course: Claude Code: Pro Level — https://zero2vibecode.com/learn/claude-code-pro
Canonical URL: https://zero2vibecode.com/learn/claude-code-pro/0-2-compact-or-clear
Verified against: Claude Code v2.1.292 (2026-10-15)
Last updated: 2026-10-15

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

In the last lesson you learned to see how full the context window 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?**

| Situation | What 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 work | neither — `/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.

**Careful.** 
Compacting is retelling, and retelling loses detail. If the conversation contained a precise agreement — a function name, an API response format, "do not touch this file" — either name it in the /compact hint or write it into CLAUDE.md, where it survives any cleanup.
