Back
65/65
Lesson 65
5 min
PFR: Power Failure Recovery
Detect and resume crashed agent sessions after a hard power cut
Ready to level up?
Mark complete to track your learning progress.
Detect and resume crashed agent sessions after a hard power cut
Mark complete to track your learning progress.
Bring your whole agent fleet back after a blackout with Power Failure Resumer.
pfr (Power Failure Resumer) recovers crashed agent sessions after a hard power cut. Its forensic insight: when the machine dies, every crashed session's file stops changing at nearly the same moment before boot. PFR clusters that pocket of last-modified timestamps, then scores each candidate's confidence as high, medium, or low, with printed reasons.
Sessions that were already resumed are skipped automatically, so running it twice never double-opens anything.
Clusters sessions whose files froze together before boot
Decisions are frozen into last-plan.json before acting
Reopens each victim with its recorded model in its own tab
Checks ps, writes last-report.json, non-zero exit on silent failures
# After the machine comes back up, see what diedpfr --dry-run# Happy with the plan? Resume everythingpfr -y# Each victim reopens with its recorded model:# Claude Code sessions -> cc --resume# Codex sessions -> cod resume# ...each in its own terminal tab.# Afterward, pfr verifies against ps and writes last-report.json.# A silent failure (tab opened but no live process) exits non-zero.
The plan-then-act split matters: last-plan.json freezes the detection decisions so you can inspect or re-run them with --last-plan --pick, and last-report.json records what actually happened.