deadman

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.

● armed→▲ warned 50m→◆ fired 55m→● re-armed
└ come back anywhere in there → ○ disarmed — nothing happens, ever
what a fire looks like
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."
read context at 55m idle
~10% price
cache hit — nearly free
read context at 61m idle
100% price
cache dead — full re-read

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 hour you weren't there

The failure mode this exists for:

without deadman
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.

Install

Two slash commands — the repo is its own marketplace:

claude
> /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.

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 one fires at 55m idle

Pick your fire

Both dials work globally, per repo (.claude/deadman.env overlay), or per shell (env always wins):

DEADMAN_WAKE=handoffdefault — the session wakes and writes its will to .claude/handoffs/
DEADMAN_WAKE=compactruns 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=200karm only context-heavy sessions — past 200k every turn bills the premium tier, and those are exactly the ones expensive to lose
DEADMAN_COMPACT_ARGSfocus hint appended to /compact ("focus on the auth work")

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. Your statusline can watch the countdown too: deadman chip is a one-file-read contract that renders as [☠ armed 42m] in claude-code-statusline.

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.