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.
More from coding & agent
- Index Network open-sources Social Discovery Protocol: agents negotiate fit on your behalf — carsonfarmer · 2026-10-23
- Installed a formal-verification skill: it silently installed Java, MacBook runs 10 degrees hotter — zealcaiden · 2026-10-23
- OpenAI's Decisions API hits GA: near real-time routing up to 10x faster than GPT-6 Luna — OpenAIDevs · 2026-10-23
- Ruff author warns: upgrade Node/Bun now — --use-system-ca still accepts the eMudhra cert — charliermarsh · 2026-10-23
- Proof of Agent: paste one prompt and your AI mines, grades, and self-governs — adamamcbride · 2026-10-23
- DeepLearning.AI weekly: GPT-6.1 hits 97.9% byte parity on COBOL migration — DeepLearningAI · 2026-10-23