You went to bed with the agent working and woke up to a prompt that never advanced. The first instinct is to blame the model or the vendor. Most of the time the answer is in the machine’s own logs: something stopped the process, and it was a settings default you never looked at.
Start with the machine, not the agent
Two commands separate all five causes before you read a word of the agent’s output.
journalctl --list-boots | tail -5 # did the machine restart, and when
journalctl -b -1 -p warning --no-pager | tail -40 # the previous boot's warnings
If there is one more boot entry than you expected, the host restarted: that is cause four or the tail of cause one. If the machine has been up the whole time, the process died while the system lived, which narrows you to memory, the network, or SIGHUP.
1. The machine slept anyway
Every desktop OS will suspend a machine that looks idle, and a process waiting on a network response looks idle. The agent is not “using” the CPU, so the power manager does exactly what it was configured to do.
macOS. The Energy settings stop system sleep on power, but display sleep is separate and the defaults are aggressive.
caffeinate -s # prevent system sleep for as long as this runs
pmset -g # read the current sleep and display timers
sudo pmset -c sleep 0 # on AC power, never sleep the system
With the lid closed, some Macs suspend regardless. A machine on a desk with the lid shut is the case that keeps failing, which is why the durable fix is a machine without a lid.
Windows. Two timeouts matter and both are per power plan. Modern Standby machines can also enter a low-power state that looks like being awake to the network and is not.
powercfg /change standby-timeout-ac 0 # never sleep on AC
powercfg /change hibernate-timeout-ac 0
powercfg /change monitor-timeout-ac 15 # the display may sleep; the system may not
powercfg /requests # what is currently blocking sleep
Linux. Suspend is usually the desktop environment’s, and the lid switch is systemd’s.
systemctl status sleep.target
# /etc/systemd/logind.conf
# HandleLidSwitch=ignore
# HandleLidSwitchExternalPower=ignore
sudo systemctl restart systemd-logind # applies logind settings; ends that user's sessions
2. The network card went to sleep
A cheaper failure that looks identical. The process is alive, the machine is awake, and the TLS connection has been silently dropped by a NIC that powered down to save two watts.
# Linux: Intel and most laptop wireless
sudo iw dev wlan0 set power_save off
ethtool --show-eee eth0 # Energy Efficient Ethernet, a common culprit
sudo ethtool --set-eee eth0 eee off
On Windows the setting is per adapter, under Device Manager → the adapter → Power Management → “Allow the computer to turn off this device to save power”. Untick it. On a headless server this cause is rare; on a desktop under a desk with a USB Ethernet dongle it is common.
The symptom to look for is a gap in the agent’s log with no error, followed by a retry storm or a hang. A dropped TCP connection does not raise an exception in most HTTP clients until a timeout expires, which can be hours.
3. The kernel killed it for memory
The OOM killer picks the largest resident process, and a Node-based agent with a language server beside it is usually the largest. It leaves one line in the kernel log and nothing in the agent’s.
dmesg -T | grep -i -E 'killed process|out of memory' | tail -20
journalctl -k -b -1 | grep -i oom | tail
free -h
If that is your cause, the fix is headroom, not a retry. Add swap so the kernel has somewhere to go before it starts choosing victims, and stop running the agent beside a four-worker test suite on a 4 GB box.
sudo fallocate -l 4G /swapfile && sudo chmod 600 /swapfile
sudo mkswap /swapfile && sudo swapon /swapfile
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
A subtler variant: the process was not killed, it was throttled to a crawl by swap on a slow disk. If the log shows minutes between lines that normally take seconds, check vmstat 1 for si/so before concluding the model is slow.
4. An unattended update restarted the host
Ubuntu and Debian install security updates on a timer and, depending on configuration, reboot at 03:00 to finish. Snap refreshes do the same on desktop installs. The machine comes back and every process that was not a service is gone.
systemctl status unattended-upgrades
grep -r Automatic-Reboot /etc/apt/apt.conf.d/
# /etc/apt/apt.conf.d/50unattended-upgrades
# Unattended-Upgrade::Automatic-Reboot "false";
Turning reboots off is not the same as turning updates off, and you should not do the latter. Let the packages install; choose when the reboot happens, and let a supervisor bring the agent back afterwards. A systemd unit with Restart=on-failure will not help across a reboot unless the unit is enabled, which is the argument for making the work a service rather than a terminal.
5. The process was never detached from your shell
The one everyone knows about and still hits, because the agent was started correctly in tmux and something inside it was not.
# A process started from an SSH login shell dies with the session
nohup ./long-task.sh > task.log 2>&1 &
# Or give it a real parent that outlives you
sudo loginctl enable-linger "$USER"
systemd-run --user --unit=agent-task --collect --property=Restart=on-failure \
claude -p "Run the migration and the full test suite"
journalctl --user -u agent-task -f
Ctrl-b d detaching from tmux is safe. Closing the terminal window that tmux itself was started from is not, if tmux’s parent is your shell: the tmux server usually survives, but a wrapper script around it may not.
A diagnostic table
| Symptom | Likely cause | First command |
|---|---|---|
| Log stops mid-line, machine uptime unchanged | SIGHUP or OOM | dmesg -T | grep -i oom |
| Log stops, uptime reset | Reboot (update or crash) | journalctl --list-boots |
| Gap with no error, then a timeout | Network adapter power saving | journalctl -k | grep -i link |
| Everything stopped at a round time | Power management | pmset -g / powercfg /requests |
| Process alive, nothing progressing | Blocked on an approval prompt | read the terminal, not the log |
That last row is worth naming: an agent waiting for permission prints nothing and looks dead. If you run unattended, decide the permission policy up front rather than hoping it never asks.
Where Cubs fits
Cubs removes four of the five causes by construction: the machine has its own power so there is no lid or sleep timer, it is a server NIC rather than a laptop radio, and pausing is something you do deliberately instead of something the OS does at 03:00. The fifth — a process that was never detached — is handled by the machine being the thing that runs, so closing the browser or the laptop changes nothing about the process. Resetting the machine is still an explicit action, and it still wipes the disk, so the habits in the next guide matter.