Home / Tools / Agent Survival Check
Free tool

Will your agent survive the night?

Answer a few questions about your setup. Find out whether Claude Code keeps working when you close the lid, and what to fix if it does not.

Claude Code runs on your machine. Close the lid and the OS suspends the process mid task. The refactor you started at 6pm is dead by dinner, and there is no resume. The same goes for Codex and most CLI agents.

This check walks through your setup: where the agent runs, how the session stays alive, and what happens on sleep, network drops, and reboots. It answers honestly. For some setups tmux on a VPS is enough, and the result says so.

Where does the agent run?
How does the session stay alive?
Laptop sleep behavior
Do you reach it over SSH?
What restarts it after a crash?
Reboots and updates on that machine
RAM where the agent runs
Network where the agent runs
How do you check on it remotely?
Survival score
26/ 100

Does not survive tonight

How this setup dies, worst first

1. Lid close suspends the machine-35 pts

You close the lid at 11pm. The OS suspends every process mid tool call, network sockets die, and the run is gone by morning. No error, no resume.

Free fix: keep the machine awake while the agent runs. On macOS, caffeinate holds off sleep for as long as it runs. On Linux, set HandleLidSwitch=ignore in /etc/systemd/logind.conf. Honest tradeoff: battery drain, heat, and a laptop you cannot close or carry.

caffeinate -dimsu
2. A crash is permanent-15 pts

The agent hits an unhandled error at 2am and exits. Nothing notices and nothing restarts it. The box is fine; the process is just gone.

Free fix: a systemd unit that starts the agent in a detached tmux session and restarts it on failure. Replace User=you with your username, then run: sudo systemctl enable --now agent. Honest tradeoff: it restarts a fresh session, not your conversation. Whatever context the run had is gone.

# /etc/systemd/system/agent.service
[Unit]
Description=Agent tmux session
After=network-online.target

[Service]
Type=forking
User=you
ExecStart=/usr/bin/tmux new-session -d -s agent claude
Restart=on-failure
RestartSec=10

[Install]
WantedBy=multi-user.target
3. Reboot comes back empty-10 pts

unattended-upgrades reboots the box at 4am for a kernel patch. The machine comes back up clean. The agent does not, because nothing starts it at boot.

Free fix: the same systemd unit covers this. WantedBy=multi-user.target makes it start at boot, so a reboot brings the agent back on its own.

sudo systemctl enable agent.service
4. Failures go unnoticed for hours-8 pts

The run died at midnight. You find out at 9am. The failure cost you the whole night, not the ten minutes the fix would have taken.

Free fix: an SSH client on your phone (Termius, Blink) plus tmux attach lets you check and restart from anywhere. Honest tradeoff: a phone terminal is a rough place to read diffs.

tmux attach -t agent
5. Wifi drops cost you runs-6 pts

The wifi drops for two minutes mid tool call. The API request times out, and if you were attached over SSH, that session went down with it.

Free fix: plug into ethernet, or move the run onto a machine with a wired or datacenter connection. Honest answer: there is no config flag that fixes a bad link. tmux limits the damage to the one interrupted call.

What this costs you:interruptions a week xminutes to restore at $an hour is about $170 a week of your time.

Shareable verdict
Agent Survival Check: 26/100 (Does not survive tonight)
Top failure modes:
1. Lid close suspends the machine
2. A crash is permanent
3. Reboot comes back empty
https://hivra.cloud/tools/agent-survival-check

Assumptions: severities and interruption counts are rough estimates from common failure reports, not measurements of your machine. The free fixes are real and often enough; a VPS with tmux and a systemd unit is a fine setup if you want to run it. Commands and defaults last verified 2026-07-15.

Every failure mode on this list is structural on a managed always-on box: no lid, no SIGHUP, no forgotten restart unit. Hivra runs Claude Code on a cloud VM with your own sign-in. Free is $0 for one agent that sleeps after 4 idle days; Pro is $9.99 a month, always on.

Skip the failure modes
Common questions
Why does Claude Code stop when I close my laptop?

Sleep suspends every process on the machine, including your terminal and the agent inside it. On wake, network connections have dropped and long running tool calls have timed out. If the agent ran over SSH, the disconnect usually kills the remote session too unless it was inside tmux or screen.

Does tmux keep Claude Code running?

On an always-on machine, yes. tmux detaches the session from your terminal, so closing the SSH connection does not kill the agent. It does nothing for a laptop that goes to sleep, because the whole machine suspends, tmux included.

Can I just stop my laptop from sleeping?

You can. caffeinate on macOS or the equivalent on Linux keeps it awake. You pay in battery, heat, and a machine you cannot close or carry. Reboots, updates, and network changes still kill the run.

How do I keep an AI agent running overnight?

Run it on a machine that never sleeps. Three ways: a desktop that stays on, a VPS with tmux, or a managed box. Hivra runs Claude Code on a cloud VM with your own Anthropic sign-in. Free launches one agent at $0 that sleeps after 4 idle days. Pro is $9.99 a month and stays always on.

Is a VPS with tmux enough?

Often yes. A $5 VPS plus tmux keeps the process alive around the clock. You handle the install, the updates, and the restart when something crashes, and checking in from a phone means SSH. Managed hosting is the same idea with the ops handled, plus chat, a web terminal, and files.

Put your agent on a box that stays on.

Live in minutes. Free tier available. Pro is $9.99/mo.

Get Started
Related
Run Claude Code 24/7Run Codex 24/7Keep Claude Code running 24/7Run Codex 24/7 in the cloudClaude Code Plan CalculatorAI Agent Hosting Cost Calculator