AI Field Guide
Claude Code commands

/compact

Updated 2026-08-04

Questions this answers

  • My long Claude Code session gets slow and starts losing track of what we're doing.
  • I'm running low on context and don't want to lose the important stuff.
  • How do I keep a session going without starting over?
  • Claude forgets decisions we made earlier in a long session.

The Fix

When a session gets long, /compact squeezes the conversation down to a summary and keeps going, so you free up room without starting over. The part most people miss is that you can tell it what to keep. Plain /compact summarizes everything evenly, while /compact keep the database schema and the auth refactor plan protects what you care about and lets the rest fall away.

When to Use It

Use it early, at a natural break right after you wrap a chunk of work, before Claude starts losing the thread. Point the instructions at whatever the next chunk needs, since everything you don't flag gets compressed hard.

If you're jumping to something unrelated, /clear beats /compact, since a fresh start is cleaner than a summary of work you're already done with. Keep /compact for when you want to stay in the same thread but travel lighter.

Best Practices

Related