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.