Agent Runs That Finish What They Start.
How we layered macOS notification hooks, sleep prevention, mobile continuity, and tuned permission allowlists to turn Claude Code from a session that needs babysitting into one that runs reliably overnight.

The Problem
Long Claude Code sessions were failing for three reasons: laptop sleep killing the process mid-run, permission prompts that paused the agent until manually acknowledged, and notification systems that didn't reliably surface alerts when away from the desk.
Each failure mode was individually minor but collectively fatal to overnight and untethered runs. A session that needs babysitting every 45 minutes isn't autonomous — it's just automation with more steps.
What We Built
We layered four fixes: macOS notification hooks via terminal-notifier to surface agent alerts as native system notifications, caffeinate to prevent sleep during active sessions, Remote Control for mobile continuity so sessions can be monitored and responded to from a phone, and tuned permission allowlists that reduce prompt frequency for safe file and tool operations.
The allowlist configuration required the most judgment — distinguishing operations the agent can perform without confirmation (reading files, running tests, writing to designated output directories) from operations that genuinely need a human decision (git pushes, external API calls, system-level changes).
“Long Claude Code runs were breaking on laptop sleep, unanswered permission prompts, and missed notifications. Fixing the infrastructure was simpler than it looked — it just required knowing what to layer.”
The System Architecture
terminal-notifier for macOS native notification delivery. caffeinate for sleep prevention during active sessions. Remote Control for mobile session monitoring and response. Permission allowlists configured per tool category: read ops (auto-approve), write ops (auto-approve to designated directories), external calls (prompt). Session health monitoring with alert thresholds.
The Results
Overnight and untethered agent runs that finish reliably. Sessions that used to require check-ins every hour now run for 6–8 hours without human intervention, with alerts only for moments that actually require judgment.
The infrastructure has become the foundation for all long-running autonomous work at Automaton — including the video pipeline, SEO engine, and sales director systems.