how to run claude code 24/7 (without babysitting your laptop)

how to run claude code 24/7 (without babysitting your laptop)


you kick off a long task, close the lid, and an hour later nothing’s done. the laptop slept. claude code slept with it.

if you want an agent that’s actually working while you’re not, “running” and “running 24/7” are two different problems. here’s every honest way to solve the second one, weakest to strongest, and what each one actually costs you.

option 1: just keep the laptop awake

the laziest fix. on mac, caffeinate -i stops the machine idling while a command runs. on linux, disable sleep in your power settings. windows has powercfg.

this works until it doesn’t. the lid still kills wifi on most setups, an os update reboots you overnight, and your laptop is now a space heater you can’t take to a cafe. fine for a 40-minute job. not a way to run anything continuously.

option 2: tmux or screen

run claude code inside a tmux session and it keeps going after you disconnect your terminal. tmux new -s agent, start the agent, ctrl-b d to detach. reattach later with tmux attach -t agent.

this solves the wrong half. tmux keeps the session alive after you close the terminal, but only as long as the host stays on. on a laptop that sleeps, tmux sleeps too. it’s the right tool on a machine that’s already always-on, and pointless on one that isn’t.

option 3: a systemd service on a box that never sleeps

this is the real answer. put claude code on a machine that’s on 24/7, usually a cheap linux VPS, and run it as a systemd service so the os supervises it:

[Service]
ExecStart=/usr/bin/claude ...
Restart=on-failure

Restart=on-failure means if the agent crashes, the os brings it back. logs go to journald. it survives reboots. this is genuinely how you run something continuously, and it’s the setup most “run claude code on a vps” guides land on.

the catch is everything around it. now you own a server. you ssh in to check on the agent, which is miserable from a phone. you keep your anthropic credentials sitting on a box you’re maintaining. you handle os updates, the firewall, restarts after the machine reboots, and a way to actually talk to the agent when you’re not at a keyboard. the agent runs 24/7. so do you, now, as its sysadmin.

what “24/7” actually requires

strip it down and a real always-on setup needs five things:

  • a host that never sleeps
  • auto-restart when the agent or the box falls over
  • it survives reboots without you
  • a way to reach the agent from your phone
  • your model credentials available to it, securely

options 1 and 2 give you none of that. option 3 gives you the first three and hands you a second job for the last two.

or let 5dive handle the glue

the supervision, the telegram control, the agent talking to other agents: that’s the glue 5dive is. two ways to run it.

self-host it. the cli is open-source and mit: github.com/5dive-ai/5dive. it’s the supervision + telegram + multi-agent layer that sits on top of systemd, on a box you own. you still run the box, but you’re not hand-wiring every piece around it.

or skip the box. the hosted version runs your agent on its own always-on VM as a supervised service, so auto-restart and surviving reboots are the default, not something you set up. you drive it from telegram, and it runs on the claude pro or max subscription you already pay for, in an interactive session. no server to maintain, no second billing meter.

the honest version: option 3 is a real answer if you enjoy running a server. if you just want the agent working while you’re asleep, the server is the part worth skipping.

run claude code 24/7 the hard way, self-host the cli, or let it run on your plan without the sysadmin job.