DEV Community

Jitendra Kumar
Jitendra Kumar

Posted on

Claude Code Slow? Master /clear and /compact in 2 Minutes (Day 3 of 10)

TL;DR β€” Long Claude Code conversations slow down because the context window fills up. Use /clear when starting a brand new task, and /compact when you want to keep working on the same task but free up memory. Master this rule and your Pro plan will go 2x further.

Welcome back to Day 3 of my "10 Days of Claude Code" series! πŸš€

If you missed the earlier days:

  • πŸ“Œ Day 1 β€” How /init instantly understands your entire project
  • πŸ“Œ Day 2 β€” /review and /ask for instant code audits

Today we're solving a problem every Claude Code user faces but most don't know how to fix.


😩 The Problem Nobody Talks About

You start a Claude Code session in VS Code. Everything is fast and crisp. You build a feature, fix a bug, refactor some code.

Then 30 minutes in...

  • ⏳ Replies become slower
  • πŸ’Έ Tokens deplete faster
  • πŸ€” Claude starts giving slightly off answers
  • 😀 You're getting frustrated

What's happening?

Every message you send adds to Claude's context window. Your old chat from 30 minutes ago β€” the one about a totally different file β€” is still being processed with every new request. It's like asking your friend a quick question while they're holding 200 sticky notes from earlier in the day.

Two slash commands solve this completely.


⚑ Command #1: /clear

What it does: Wipes the entire conversation history and starts fresh. Same session, same project, but Claude forgets everything you've discussed.

When to use it:

  • βœ… Starting a completely new task (e.g., done with auth, now working on payments)
  • βœ… Switching to an unrelated file or feature
  • βœ… Claude is giving weird/confused responses
  • βœ… You want maximum speed and a clean slate

How to use it:

/clear
Enter fullscreen mode Exit fullscreen mode

That's it. One command. Fresh terminal, fresh brain, full speed.

Real example from my workflow:

[Worked on user authentication for 20 min]
[Bug fixed, feature shipped βœ…]

Me: /clear

[New conversation begins]
Me: Now help me build the Stripe payment integration.
Enter fullscreen mode Exit fullscreen mode

Claude doesn't carry over the auth context β€” which is exactly what I want. Less noise, faster response.


πŸ—œοΈ Command #2: /compact

What it does: Summarizes your current conversation, keeps the important parts, and discards the fluff. You don't lose context β€” you compress it.

When to use it:

  • βœ… Continuing the same task but the chat is getting long
  • βœ… You're deep in a complex feature and need Claude to remember decisions
  • βœ… You see token usage climbing but can't afford to lose context
  • βœ… Mid-debugging session where history matters

How to use it:

/compact
Enter fullscreen mode Exit fullscreen mode

Claude generates a summary of what you've discussed and replaces the long history with that summary. Same context, way less memory.

Real example:

[60 messages deep into building a dashboard]
[Multiple component decisions, design choices made]

Me: /compact

Claude: [summarizes the entire session into ~5 key points]

Me: Now add a filter dropdown to the chart we built earlier.
Enter fullscreen mode Exit fullscreen mode

Claude still remembers the chart, the design system, the framework choice β€” but it's not re-reading 60 messages every time.


🎯 The Golden Rule (memorize this)

Situation Command
Starting a new task /clear
Continuing the same task /compact
Claude is confused /clear
Conversation is long but relevant /compact

That's it. Two commands, infinite productivity.


πŸ’° Why This Matters for Pro Users

If you're on the Pro plan (like me), this is money saved.

  • Every token in your context window counts toward your usage
  • Bloated conversations = wasted Pro quota
  • A 5-second /clear or /compact can save you hundreds of tokens per task

I personally run /clear between every major task switch. My Pro plan now lasts way longer than it did before I knew this.


πŸ§ͺ Try It Right Now

Open Claude Code in VS Code, run a few prompts, then try:

  1. Type /compact β€” watch the conversation collapse into a clean summary
  2. Type /clear β€” see a fresh terminal, ready for a new task

You'll feel the difference immediately.


🎬 Watch the 60-Second Version

If you prefer video, I made a quick reel covering this:


πŸ“… What's Next?

Tomorrow β€” Day 4 I'm covering the /model command β€” when to use Sonnet vs Opus and how to save tokens by picking the right model for the right job. This one's a game-changer for Pro users.

πŸ”” Follow me on Dev.to so you don't miss it!


πŸ’¬ Your Turn

  • Did you know about /clear and /compact?
  • Which one will you use more often?
  • What's your biggest Claude Code pain point?

Drop a comment β€” I read every single one. πŸ‘‡


About the series: I'm sharing one Claude Code productivity tip every day for 10 days. Follow along on:

Let's master Claude Code together! πŸš€

ClaudeCode #AI #Productivity #VSCode #DevTools

Top comments (0)