The bare /compact command compresses your conversation but reads everything first—tool output, file contents, web fetches, search results. That takes minutes and often loses important context.
Create ~/.claude/commands/compact-guide.md with one line:
/compact Focus on: current task, file paths modified, decisions made, user preferences stated. Drop: tool output, search results, web content, file contents already acted on.
Now /compact-guide expands to the full instruction automatically.
Why not
compact.md? Claude Code has a built-in/compactcommand that triggers actual context compression. A customcompact.mdoverrides it—your instructions expand but compression never happens. Use a different name likecompact-guide.mdso both work.
A typical session context breakdown:
| Content type | Share of tokens |
|---|---|
| Tool output (bash, file reads) | ~50–60% |
| Web fetches, search results | ~15–20% |
| Actual conversation + decisions | ~15–20% |
| File contents already acted on | ~10% |
Without instructions, /compact reads all of it before writing the summary. With instructions, it skips 70–80% of the tokens entirely—only extracting the small slice that matters going forward.
Result: seconds instead of minutes, and a leaner summary with more headroom.
Adjust the keep/drop lists to match what you need:
/compact Focus on: current task, file paths modified, decisions made, user preferences stated, open questions. Drop: tool output, search results, web content, file contents already acted on, error messages that were resolved.