How to reduce Claude Code token usage / The session
/clear, /compact or /rewind: which to use and what each costs
Use /clear when the next task is unrelated, /compact at a pause inside one long task, and /rewind when the last steps were a mistake. In Claude Code, /clear starts a new conversation and costs nothing, by Anthropic's documentation read on 4 October 2026. /compact replaces the history with a summary, and writing that summary is one request that reads the whole conversation. /rewind returns the conversation to an earlier prompt, and the next request reads text the prompt cache already holds. This page compares the three, explains automatic compaction and the auto-compact window, and lists what survives a compaction.
Published October 4, 2026. Editorial.
Key takeaways
- `/clear` starts a new Claude Code conversation with an empty context and costs nothing, by Anthropic's documentation read on 4 October 2026, and `/resume` opens the old conversation again.
- `/compact` sends one extra request that reads the whole conversation, so Anthropic's documentation calls compacting a large context a large request.
- After a compaction, Claude Code reads again up to five recently changed files, and a file over 5,000 tokens returns as a file path without its content.
- Models that run with a 1 million token window compact automatically at a default that Anthropic gives as 967K tokens, and the command `/autocompact 500k` sets a lower point.
- `/rewind` goes back to text the prompt cache already holds, and Claude Code keeps the 100 most recent checkpoints in a session.
Claude Code, Anthropic's coding tool, sends the whole conversation to the model with every request. Usage is counted in tokens, which are the pieces of text a model processes, and a longer conversation means more tokens on every request. Three commands make the conversation shorter: /clear, /compact and /rewind. Each one removes different text and has a different cost.
Our position, from Anthropic's documentation as read on 4 October 2026: use /clear when the next task is unrelated to the last one, use /compact at a pause inside one long task, and use /rewind when the last few steps were a mistake. This page explains why, and it belongs to the guide on how to reduce Claude Code token usage.
The three commands compared
Three terms need explaining first. The context window is the largest amount of text the model can read in one request. The prompt cache is a store, kept by the service that runs the model, of request text it has already processed, so that unchanged text can be read again at a lower price. A skill is a packaged set of instructions that loads when a task needs it.
/clear |
/compact |
/rewind |
|
|---|---|---|---|
| What it does | Starts a new conversation with an empty context [7] | Replaces the message history with a summary [6] | Returns the conversation to an earlier prompt, or summarises one part of it [3] |
| What stays in the context | Start-up content only, loaded again | The summary, start-up content, up to five recent files and the skills you used [2] | Everything before the point you choose, unchanged |
| What the command itself costs | Nothing, by Anthropic's statement [1] | One request that reads the whole conversation [1] | A restore writes no summary. A summarise option writes one |
| Effect on the prompt cache | The new conversation builds its own stored text | The stored conversation is rebuilt for the shorter summary [6] | The next request reads text that is already stored [6] |
| What happens to the old messages | Saved, and opened again with /resume [4] |
The summary replaces them in the context [2] | Messages after the chosen point leave the context |
| Pick it when | The next task is unrelated | The same task continues and old detail is no longer needed | The recent steps were a mistake |
/clear starts a new conversation and costs nothing
Anthropic's command reference, read on 4 October 2026, describes /clear in one line: "Start a new conversation with empty context." It can also be typed as /reset or /new [7].
The command itself uses no tokens. Anthropic's cost documentation says: "When you want a fresh start instead of continuity, /clear costs nothing" [1]. The same page gives the reason to use it often. Old conversation that no longer matters is sent again, and counted again, on every later message [1].
The old conversation is saved. Claude Code writes every session to a file on your computer as you work, so you can return to it with /resume [4]. Anthropic recommends a sequence of three commands: /rename to give the session a name you will recognise, then /clear, and later /resume to return [1]. There is a shorter way. The session documentation says that a name typed after the command, as in /clear release-prep, labels the conversation you are leaving, and the new conversation starts without a name. With no name typed, the new conversation keeps a name you set earlier with /rename [4].
Two more facts from the documentation:
- If you ran
/clearby mistake, open the rewind menu in the same run of Claude Code. Its first entry, labelled/resume <session-id> (previous session), returns you to the conversation that was active before [3]. - The session totals in
/usagego back to zero when/clearstarts a new session [1].
After /clear, Claude Code loads the start-up content again. That includes CLAUDE.md, the file of instructions that you write and that Claude reads at the start of every session. An edit you made to CLAUDE.md during a session takes effect only at the next /clear, /compact or restart [6]. The page on how long CLAUDE.md should be covers that file.
What you lose is everything that existed only in the conversation: decisions, findings, and instructions you gave by typing. Before you clear, Reveneau recommends asking Claude to write anything you will need again into a file in the project.
/compact replaces the history with a summary
Compaction means replacing the message history with a summary of it. The command reference describes /compact as "Free up context by summarizing the conversation so far", with optional instructions for what the summary should focus on [7].
The summary keeps a fixed list of things. Anthropic's documentation, read on 4 October 2026, says it keeps your requests and intent, the main technical ideas, the files examined or changed with important pieces of code, errors and how they were fixed, tasks still to do, and the current work. The full output of tools and the model's earlier reasoning are removed [2].
Compaction has a cost. To write the summary, Claude Code sends one extra request that contains the whole conversation plus an instruction to summarise it [6]. The cost documentation says it directly: "compacting a large context is itself a large request" [1]. How large depends on the prompt cache. If you compact while you are working, most of that request is read from stored text at the lower price. If you compact after a long break, the stored text has expired and the whole history is processed at the full input price [6]. The page on what /compact costs works through both cases.
What survives compaction
Some content is loaded again from files after compaction, and some exists only in the summary. This table follows Anthropic's own table, read on 4 October 2026 [2]. Three terms in it need a short explanation. Auto memory is a set of notes Claude writes for itself. Plan mode is a mode in which Claude studies the code and proposes a plan before it edits anything. A hook is a script that Claude Code runs by itself at a fixed point, such as after each edit.
| Content | After compaction |
|---|---|
| System prompt (Anthropic's instructions to the model) | Still applies |
| CLAUDE.md in the project's top folder | Loaded again from the file |
| Auto memory | Loaded again from the file |
| The plan Claude wrote in plan mode | Loaded again from the file |
| Files Claude read or edited | Up to five are read again, the most recently changed first |
| Skills you used | Loaded again, up to 5,000 tokens for each skill and 25,000 tokens in total |
| Rules limited to certain file paths, and CLAUDE.md files in subfolders | Loaded again only when Claude next reads a matching file |
| Text that hooks added earlier | Summarised with the rest of the conversation |
| The list of one-line skill descriptions | Left out after compaction [2] |
Two limits in that table matter in practice. A file over 5,000 tokens comes back as a file path without its content. And a rule that applies only to certain file paths is summarised away until Claude reads a matching file again, so Anthropic's advice is to move a rule that must always apply into the project's main CLAUDE.md [2].
Tell the summary what to keep
You can direct the summary in two ways, both from Anthropic's documentation [1][2]:
- Type instructions after the command. Anthropic's examples are
/compact Focus on code samples and API usageand/compact focus on the auth bug fix. - Add a section to the CLAUDE.md in the project's top folder, under a heading named
Compact instructions. Anthropic's example text for that section is: "When you are using compact, please focus on test output and code changes".
Use the second way for anything you would type every time. A summary that keeps the wrong things costs a second round of file reads to recover what was dropped.
Automatic compaction and the auto-compact window
If you never run /compact, Claude Code runs it for you. The documentation says: "Claude Code compacts automatically as you approach the limit, so a full context window doesn't end your session." [2]
The point at which this happens is called the auto-compact window. Anthropic defines it as "how full the context window can get before Claude Code compacts the conversation" [5]. By the documentation read on 4 October 2026 [5][7]:
- Without a setting, Claude Code compacts when the conversation reaches the model's context limit. Models that run with a window of 1 million tokens compact earlier, at a default that Anthropic puts at 967K tokens. Sonnet 4.6 and Opus 4.6 without the larger window compact at 200K.
- The command
/autocompact 500ksets the window for the current model. It accepts sizes from 100K to 1M tokens./autocompact autoreturns to the default. The command requires Claude Code v2.1.221 or later, and before v2.1.288 it saved one window for every model. - The setting
autoCompactWindowin a settings file sets one window for every model. The flag--autocompactsets it for one start of the program.
Our position is that waiting for automatic compaction is the worst of the available choices. It happens in the middle of a task, at a moment you did not choose, with a summary you did not direct. Anthropic's advice is the same: run /compact "at a natural break in your work, such as between tasks, instead of waiting for auto-compaction to trigger mid-task" [6]. On a model with a 1 million token window, the default lets the conversation grow to the 967K tokens that Anthropic states before compaction runs, and each request until then contains the conversation so far. Reveneau recommends choosing a lower window yourself. Anthropic's own example value is 500k [2].
/rewind goes back to an earlier point
/rewind opens a menu that lists each prompt you sent in the session. You can also open it by pressing Esc twice when the input line is empty. The command can be typed as /checkpoint or /undo [3][7]. A checkpoint is a saved copy of the state of your code, which Claude Code makes before each prompt. It keeps the 100 most recent ones in a session [3].
You choose a prompt, and then one of these actions [3]:
- Restore code and conversation: both go back to that point.
- Restore conversation: the conversation goes back and the code stays as it is now.
- Restore code: the files go back and the conversation stays.
- Summarize from here: the conversation from that point forward becomes a summary.
- Summarize up to here: the conversation before that point becomes a summary, and later messages stay.
A restore is the right choice after a mistake, for two reasons. The wrong steps leave the context completely, where a summary would keep a description of them. And the remaining conversation is text the prompt cache already holds, so the next request reads it at the lower price. Anthropic's documentation says that rewinding goes back to stored text, where compaction builds new text to store [6]. The page on actions that keep the cache lists the other actions with this property.
The two summarise options are a compaction of one part of the conversation. Anthropic calls this "like a targeted /compact" [3]. "Summarize from here" suits a long period of debugging: the instructions you gave at the start stay unchanged, and the long middle becomes a short summary. You can type instructions for the summary in the menu before you press Enter [3].
Three limits apply, by Anthropic's documentation [3]:
- File changes made by commands that Claude runs in the terminal, such as deleting or moving a file, are outside the checkpoints and cannot be undone by a rewind.
- Edits made by a subagent, which is a second copy of Claude working in its own context window, are usually outside the checkpoints too.
- Checkpoints are for recovery inside a session. Anthropic says to keep using a version control tool such as Git for permanent history.
An early rewind leaves fewer wrong steps to send again. Anthropic's cost advice is to press Esc to stop Claude as soon as it starts doing the wrong thing, and then rewind [1].
/recap gives a summary and removes nothing
One more command looks similar and does a different job. /recap writes a one-line summary of the session for you to read. Anthropic's documentation says it adds the summary as command output and leaves the message history unchanged, so the stored text in the prompt cache stays usable [6]. Claude Code limits a recap to 400 characters. It also shows one by itself when you return to a session after at least three minutes away, and you can turn that off under Session recap in /config [8].
Use /recap to remember where you were. It frees no space in the context window.
Returning to an old session
One case combines these choices. On a Pro or Max plan, when you resume a session that is over 100,000 tokens and has been inactive for a period that Anthropic gives as "more than about an hour", Claude Code opens a dialog before your first message. Anthropic's documentation, read on 4 October 2026, lists three options: resume from a summary, which runs /compact immediately; resume the full session as it is; or stop showing the dialog [4]. The stored text has expired by then, so the next request processes the full history once in either case. The difference is in every request after that.
Pick the summary unless you need exact details from the old conversation. The page on why usage keeps rising in a long session explains what a full history costs on each request.
How to choose
| Situation | Command |
|---|---|
| The next task has nothing to do with this one | /clear, with a name for the old conversation |
| Same task, long history, and you are at a pause | /compact with one line on what to keep |
| The last few steps were wrong | /rewind, then Restore code and conversation |
| Only the start of the conversation is still needed | /rewind, then Summarize from here |
| You only need to remember where you were | /recap |
Reveneau is an AI software development consultancy, and all of its code is written by AI, so token use is a running cost of every Reveneau build. Reveneau is independent of Anthropic. Its recommendation is to treat /clear as the default at the end of every task, and to check the result with the two commands explained in how to read /usage and /context.
Common questions
What is the difference between /clear and /compact in Claude Code?
`/clear` starts a new conversation with an empty context, and `/compact` keeps the same conversation and replaces its history with a summary. Anthropic's documentation, read on 4 October 2026, says `/clear` costs nothing, while `/compact` reads the whole conversation in one request to write the summary. Use `/clear` when the next task is unrelated, and `/compact` when the same task continues.
Does /clear delete my conversation?
No. `/clear` removes the conversation from the context window, and Claude Code keeps it saved on your computer. Anthropic's documentation, read on 4 October 2026, says you can return to it with `/resume`, or from the first entry of the rewind menu while the same run of Claude Code is open. Typing a name after the command, as in `/clear release-prep`, labels the old conversation so it is easy to find.
Does running /compact use tokens?
Yes. Running `/compact` sends one extra request that contains the whole conversation plus an instruction to summarise it. Anthropic's documentation, read on 4 October 2026, says compacting a large context is itself a large request. While you are working, most of that request is read from the prompt cache at a lower price. After a long break the stored text has expired, and the whole history is processed at the full input price.
What does Claude remember after /compact?
After `/compact`, Claude has a summary of the conversation plus content that Claude Code loads again from files. Anthropic's documentation, read on 4 October 2026, says the summary keeps your requests, the files examined or changed, errors and their fixes, and tasks still to do. The main CLAUDE.md and auto memory load again, and up to five recently changed files are read again. Full tool output and earlier reasoning are removed.
When should I run /compact?
Run `/compact` at a pause in your work, such as between two parts of one task, while you are still active in the session. Anthropic's documentation, read on 4 October 2026, advises this over waiting for automatic compaction in the middle of a task. Compacting while you are working is cheaper, because the request that writes the summary reads most of the conversation from the prompt cache.
How do I tell /compact what to keep?
You tell `/compact` what to keep by typing instructions after the command, or by adding a section to CLAUDE.md. Anthropic's documentation, read on 4 October 2026, gives the example `/compact Focus on code samples and API usage`. For a permanent instruction, add a heading named `Compact instructions` to the CLAUDE.md in the project's top folder, followed by a sentence that says what the summary should focus on.
What is the auto-compact window in Claude Code?
The auto-compact window in Claude Code is how full the context window can get before Claude Code compacts the conversation by itself. Anthropic's documentation, read on 4 October 2026, says that without a setting, compaction runs when the conversation reaches the model's context limit. Models that run with a 1 million token window compact earlier, at a default that Anthropic gives as 967K tokens.
How do I change when Claude Code compacts automatically?
You change it with the `/autocompact` command followed by a size, such as `/autocompact 500k`. Anthropic's documentation, read on 4 October 2026, says the command accepts sizes from 100K to 1M tokens, saves the value for the current model, and requires Claude Code v2.1.221 or later. `/autocompact auto` returns to the default. The setting `autoCompactWindow` in a settings file sets one window for every model.
What does /rewind do in Claude Code?
`/rewind` opens a menu of the prompts you sent in the session and lets you go back to one of them. Anthropic's documentation, read on 4 October 2026, lists five actions: restore code and conversation, restore the conversation only, restore the code only, summarise from that point forward, or summarise up to that point. Pressing `Esc` twice on an empty input line opens the same menu.
Can /rewind undo every file change?
No. `/rewind` restores only the edits that Claude made with its file editing tools. Anthropic's documentation, read on 4 October 2026, says file changes made by commands run in the terminal, such as deleting or moving a file, are left as they are, and that edits made by a subagent are usually left too. Anthropic advises keeping a version control tool such as Git for permanent history.
What is the difference between /recap and /compact?
`/recap` writes a short summary for you to read and leaves the conversation unchanged, while `/compact` replaces the conversation with a summary. Anthropic's documentation, read on 4 October 2026, says a recap is added as command output and is limited to 400 characters, so the prompt cache stays usable. `/recap` frees no space in the context window. Use it to remember where you were.
Should I resume an old session from a summary or in full?
Resume an old session from a summary unless you need exact details from it. Anthropic's documentation, read on 4 October 2026, says Claude Code offers this choice on Pro and Max plans when a session is over 100,000 tokens and has been inactive for a period Anthropic gives as "more than about an hour". The first request processes the full history in both cases. After that, the summary option sends fewer tokens on every request.
References
- Anthropic, Manage costs effectively (code.claude.com), read 4 October 2026
- Anthropic, Explore the context window (code.claude.com), read 4 October 2026
- Anthropic, Checkpointing (code.claude.com), read 4 October 2026
- Anthropic, Manage sessions (code.claude.com), read 4 October 2026
- Anthropic, Model configuration (code.claude.com), read 4 October 2026
- Anthropic, How Claude Code uses prompt caching (code.claude.com), read 4 October 2026
- Anthropic, Commands (code.claude.com), read 4 October 2026
- Anthropic, Interactive mode (code.claude.com), read 4 October 2026