The dead man's switch for Claude Code — writes the handoff before your prompt cache dies.
Sessions die. Context shouldn't.
Claude Code keeps your conversation in a 1-hour prompt cache. Walk away from a long session and the clock starts: at 60 minutes, everything Claude knows gets 10x more expensive to read back.
14:02 ● deadman armed · 5f3759df · cache dies ~15:02 · handoff 14:57 if you ghost └ you close the laptop and go live your life 14:52 ▲ phone: "claude idle 50m: myproject — auto-handoff in 5m unless you return" 14:57 ◆ session wakes itself — writes its will: .claude/handoffs/2026-07-30-1457-auth-refresh-tokens.md goal · verified state · decisions · next action — then stops, cache re-warmed until ~15:57 next ● claude in that repo: "an auto-handoff was written 2h ago — read it if resuming that work."
API billing. On a subscription plan the meter never moves — there, the win is the handoff itself, not the bill.
deadman arms a switch every time Claude stops. Come back — it disarms, nothing happens, ever. Ghost — your phone gets a warning at 50m, and at 55m the idle session wakes itself, reads everything at cache prices, and writes a dated handoff. The wake re-warms the cache for another hour: the fire resets the clock instead of racing it. Next session in that workspace, the handoff is offered back.
The failure mode this exists for:
14:02 you drop the task and step away — the agents keep working 14:09 last agent reports done. session stops. the clock starts 15:02 cache dies. nobody noticed 16:30 you're back. continuing — or a manual /compact — re-reads all ~180k tokens at full price: 10x what the same read cost at 14:57. the session you abandoned is now the most expensive thing in your day
With deadman armed, 14:57 is when the switch spends the dying cache on your behalf: the will gets written — or, in compact mode, the session compacts itself in place — and the cache is re-warmed until 15:57. Coming back late costs a read of the summary, not the archive.
Two slash commands — the repo is its own marketplace:
> /plugin marketplace add thevibeworks/deadman > /plugin install deadman@deadman
One install wires everything: the Stop + SessionStart hooks, the deadman CLI, and the bundled /deadman:handoff skill.
Or as one bash file (needs jq). Either way: no daemon, no service, nothing resident — the switch is a Claude Code hook.
$ curl -fsSL https://raw.githubusercontent.com/thevibeworks/deadman/main/bin/deadman -o /tmp/deadman $ bash /tmp/deadman install $ deadman doctor # everything wired? $ deadman drill # 10-second live self-test drill green. # the real one fires at 55m idle
Both dials work globally, per repo (.claude/deadman.env overlay), or per shell (env always wins):
| DEADMAN_WAKE=handoff | default — the session wakes and writes its will to .claude/handoffs/ |
| DEADMAN_WAKE=compact | runs the real /compact against the idle session — in place, same session file, at cache prices. Falls back to the handoff wake on any failure |
| DEADMAN_MIN_CTX=200k | arm only context-heavy sessions — past 200k every turn bills the premium tier, and those are exactly the ones expensive to lose |
| DEADMAN_COMPACT_ARGS | focus hint appended to /compact ("focus on the auth work") |
The hard part isn't firing — it's not firing. The transcript file is not append-only while you're away: Claude writes housekeeping into it, and a turn's final message can flush to disk after the Stop hook already started. File size and mtime are lies. deadman trusts one signal only — the timestamp of the last real user/assistant entry — and re-checks every gate every 30 seconds:
| you came back | a newer sleeper superseded this one → dies instantly |
| claude exited | parent process gone → dies |
| real activity | user/assistant entry after schedule + grace → dies |
| already fired | same activity position → deduped |
| /clear, session switch | sibling session went active → aborts the fire |
Every decision lands in a host-tagged event log: deadman status shows what's armed and counting down, deadman events shows every fire and every abort with its reason. Notifications are pluggable — Bark, ntfy, terminal-notifier, or any command — and optional: with none configured the wake still fires. Your statusline can watch the countdown too: deadman chip is a one-file-read contract that renders as [☠ armed 42m] in claude-code-statusline.