claude-code-toolkit

Command

/compact

Compresses the current conversation into a shorter summary so Claude Code can keep working without hitting the context window limit.

Long sessions eventually fill up the model's context window — every file read, every tool call, every back-and-forth adds up. /compact asks Claude to summarize everything so far into a much shorter version, then continues the session from that summary instead of the full history.

You can just run /compact on its own, or steer what gets kept by adding an instruction, e.g. /compact focus on the auth refactor and drop the earlier exploration. That's worth doing on any session where the first half was spent exploring dead ends — you don't want that noise preserved in detail.

It's not free: summarizing loses detail, and Claude can occasionally forget a small decision made earlier in the conversation. For genuinely fresh starts, /clear is the better tool — see the /clear entry.

/compact focus on the bug we're fixing, drop the earlier exploration

Frequently asked questions

What does /compact do in Claude Code?

Compresses the current conversation into a shorter summary so Claude Code can keep working without hitting the context window limit.

How do I use it?

Try: /compact focus on the bug we're fixing, drop the earlier exploration

Any caveats to know about?

It's not free: summarizing loses detail, and Claude can occasionally forget a small decision made earlier in the conversation. For genuinely fresh starts, /clear is the better tool — see the /clear entry.

Is this covered in the Claude Code Toolkit?

Yes — /compact and patterns like it are part of the full command, hook, and template pack included with a Claude Code Toolkit subscription.

Want the full command, hook, and template pack?

This is one pattern out of the full Claude Code Toolkit — subscribe for the complete set, plus everything we add going forward.

Subscribe to the toolkit — $79/mo

← See everything in Explore