Use /clear to Wipe the Slate Clean Without Closing Your Session
You've just spent 30 minutes debugging a payment issue. Now you want to work on a completely unrelated feature. The problem: Claude is still carrying context from the debugging session — old error messages, file reads, hypotheses — and it might influence how it approaches your new task.
/clear
The conversation resets. Claude forgets everything from the previous thread and starts fresh, but the session itself stays open — same terminal, same configuration, same MCP servers. No need to close and relaunch.
This is different from /compact:
/compact— summarizes and compresses the conversation but preserves context. Use this when you want to keep working on the same task but need more context space./clear— erases the conversation entirely. Use this when you're switching to a completely different task and the old context would just be noise.
When to use /clear:
# Finished debugging, now want to add a feature
/clear
"Add a search endpoint to the API"
# Done with code review, now want to write tests
/clear
"Write tests for the UserService class"
# Experimented with an approach that didn't work — start over
/clear
"Let's try a different approach to the caching layer"
One thing to watch: /clear truly clears everything. If Claude made decisions or established context you still need, use /compact instead — or jot down the key points and re-state them after clearing.
/clear is for context switches. When you're done with one thing and starting another, give Claude a clean slate — it'll think better without yesterday's baggage.
via Claude Code
Log in to leave a comment.
When Claude starts referencing files you've since deleted, remembering old code you've already changed, or getting confused by contradictory instructions from a long session — type /clear to wipe the slate clean. Unlike /compact which preserves context, /clear gives you a true fresh start without restarting the CLI.
Not every task needs deep reasoning. Type /fast to switch Claude Code into fast mode — same model, faster output — for quick edits, simple questions, and routine changes. Toggle it off when you need Claude to think harder on complex problems.
Long sessions eat through your context window as conversation history piles up. Type /compact to summarize the conversation so far and reclaim space — keeping Claude's understanding of what you're working on while freeing up room for more work.