Skip to content
Swap Meet

Free

No. 018Free

precompact-protector: keep your last request through compaction

Two Claude Code hooks: one saves the last turns before compaction, the other hands back your last request and the files in play after it. Python standard library.

by Lucas Cooper-Bey

About it

When Claude Code compacts a long session it can lose the thread. The PreCompact hook writes a checkpoint of the last turns; the SessionStart hook reads it back as an orientation card: what you asked last, which files were open. Nothing leaves your machine. Limits: Orientation only; verify specifics against the conversation. Checkpoints live under ~/.claude/precompact until you delete them. Door 20 of 100 Doors.