Stop hook auto-writes Claude Code handoffs 10 min before the prompt cache dies

Impossible-Bee1746 · reddit · 2026-10-15

Juggling 3-4 Claude Code projects, the author's costliest failure is a missed 1-hour prompt cache TTL: a cold 'yes' after two hours reprocesses the whole history—roughly 20x the warm cost (150k tokens: $0.03 warm vs $1.20 cold on Opus 5.5). His fix: a Stop hook starts a 50-minute timer, reset by each prompt; on expiry it runs a headless /handoff on a fork of the session, which reads the still-warm cache and writes an 80-line note (Goal, Done, Decisions, Didn't work, Open questions, Next step) so the next session can start fresh after /clear. Measured over 3 days: 13 fires, $0.19 per note vs $2 for one cold read. Gotchas: guard against the headless run scheduling its own handoff, and pre-authorize writable dirs with --add-dir. Check your TTL bucket first—5m caches need a 4-minute timer. Script and skill on gist.

Original post →

More from coding & agent

coding & agent channel →