Skip to content

Light version: pages open quickly, without the 3D graphics. You are seeing the light version because the 3D graphics would be slow on this device. The content is the same.

Turn on 3D

Preparing the graphics. This can take a moment on the first visit.

Henry Lõiv

Web design & development

Quick Answer

Claude Code /compact vs /clear: which should you use?

Artificial Intelligence 2 min read

Use /compact to continue the same task; use /clear to start a new conversation. Compaction summarizes the existing discussion. Clearing starts with empty conversational context—it does not revert edits in your project. 1

When the current investigation continues

Before compacting, identify what must survive: the suspected cause, changed files, failing test and next check. A summary should not be treated as a word-for-word archive.

For example:

/compact Preserve the bug diagnosis, changed files and next test.

Store approved, lasting project decisions in an appropriate project document rather than relying on chat alone. After a summary, confirm that an earlier hypothesis has not become an asserted fact. 2

When you are changing tasks

Use /clear to avoid carrying an unrelated investigation into a fresh job. Current Claude Code lets you return to the previous conversation through /resume, so describing this as irreversible deletion of all history would be misleading. 1

Debugging a contact form and drafting a blog post are good examples of separate tasks. Investigating the next stage of the same form failure usually benefits from a compacted handoff instead.

Neither command replaces backups or version control. Review your file diff and keep recovery information outside the conversation before making a major change of direction.

Related reading

Choosing an AI model

Sources

  1. Anthropic: Claude Code commands
  2. Anthropic: Claude Code best practices

Fact checked:

Let’s talk about your project

Tell me about your project

Tell me what you’d like to build or improve. You don’t need a finished brief — we’ll work out the scope and next steps together.

01 How can I help?
02 How many pages do you need?
03 Which extras do you need? Choose all that apply
04 When does it need to be ready?
05 Project details
06 Your contact details

Enquiry received

Thank you!

Your enquiry has been received. I usually reply by email within 2 working days.