Strategic Compact
Save current session state before context window compaction so critical context is not lost.
When to Use
- Before running
/compact - When conversation is getting long (100+ messages)
- Before switching to a complex new task mid-session
- When you want to preserve decisions and progress
Algorithm
Gather session state by scanning the current conversation for:
- Decisions made (architectural choices, trade-offs, rejected alternatives)
- Files modified or created (with brief description of changes)
- Current task and its status (in-progress, blocked, completed)
- Next steps planned but not yet executed
- Key findings (bugs found, patterns discovered, constraints identified)
- Open questions or blockers
Ensure target directory exists:
~/.claude/sessions/Write checkpoint file to
~/.claude/sessions/checkpoint_{YYYY-MM-DD}_{HHMM}.mdwith this structure:# Session Checkpoint - {date} {time} ## Current Task {What we're working on and current status} ## Decisions Made - {decision 1}: {rationale} - {decision 2}: {rationale} ## Files Modified - `{path}`: {what changed and why} ## Key Findings - {finding 1} - {finding 2} ## Next Steps 1. {next action 1} 2. {next action 2} ## Open Questions - {question or blocker}Confirm to user with file path and summary of what was saved.
Post-compaction reload: After compaction, user can ask to read the checkpoint file to restore context.
Notes
- Keep checkpoint concise: max 100 lines to avoid bloating future context
- One checkpoint per save (overwrite if same minute, otherwise new file)
- Suggest compaction when conversation feels slow or repetitive