Claude Code PreCompact Hook: Save Task State Before Compaction and Re-Inject It After
Set up a Claude Code PreCompact hook that saves task state to a file, then re-inject a capped summary after compaction with a SessionStart compact hook.
Read the story