Skip to content

Instantly share code, notes, and snippets.

@SeanHeelan
Created January 14, 2026 12:17
Show Gist options
  • Select an option

  • Save SeanHeelan/f19e1daab26530b9de8b063fe49340d9 to your computer and use it in GitHub Desktop.

Select an option

Save SeanHeelan/f19e1daab26530b9de8b063fe49340d9 to your computer and use it in GitHub Desktop.
Claude prepare-compact command
$ cat $HOME/.claude/commands/prepare-compact.md
---
description: Prepare for context compaction by updating the plan with all necessary information
allowed-tools: [TodoWrite, Read]
---
# Prepare for Compaction
Your context window is almost full and I need to compact the conversation. Update your plan to ensure:
1. There is a detailed explanation of your high level task, why it is necessary, and any information you have learned
from the user (or by your own efforts) that help in understanding it
2. Everything you have done is included and marked as done
3. Everything in the plan that is ongoing is included and marked as ongoing, along with a brief explanation of what is
done, what remains, and any other useful context
4. Everything in the plan that has not been started is included and remains marked as a to-do
5. It is clear what you need to do next, and all the context required to do it is included
DO NOT delete any work items from the plan. Mark their status accordingly and provide any explanation necessary to
understand that status.
Then please ensure the plan contains all the context you require from our conversation in order to complete your work.
Compaction is a destructive operation that may remove all useful information you need from the conversation. If the information you require is in a particular file, then reference that file and mention that it should be loaded, and why.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment