deadman_

Dead man's switch for Claude Code — writes the handoff before your prompt cache dies.

Claude Code keeps your conversation in a 1-hour prompt cache. The moment you walk away from a long session is exactly the moment its state gets expensive to save:

read context at 50m idle
~10% price
cache hit — nearly free
read context at 61m idle
100% price
cache dead — full re-read

deadman arms a switch every time Claude stops. Come back — it disarms, nothing happens, ever. Stay away — it pings your phone at 45m, then at 50m wakes the idle session for one last cheap read of everything and has Claude write a dated handoff. Next session in that workspace, the handoff is offered back.

what a fire looks like
14:02   deadman armed: auto-handoff in 50m, warn at 45m if idle
        └ you close the laptop and go live your life
14:47   phone: "claude idle 45m: myproject — auto-handoff in 5m
               unless you return"
14:52   session wakes itself — writes
          .claude/handoffs/2026-07-30-1452-5f3759df.md
          goal · verified state · decisions · next action — then stops
next    claude in that repo: "an auto-handoff was written 2h ago —
               read it before starting."

Install

One bash file, needs jq. No daemon, no service, nothing resident — the switch is a Claude Code hook.

bash
$ 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 thing runs at AFTER=3000s (50m idle).

Why it doesn't misfire

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 backa newer sleeper superseded this one → dies instantly
claude exitedparent process gone → dies
real activityuser/assistant entry after schedule + grace → dies
already firedsame activity position → deduped
/clear, session switchsibling 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.

The wake rides on asyncRewake, an undocumented Claude Code hook field (≥ 2.1.220). If a future release removes it, deadman degrades to doing nothing — it can never break your session.