Your laptop is silently sabotaging your AI coding agent. Here’s the fix.
If you've ever asked Claude Code (or Borg, or any terminal-based AI coding agent) to refactor an entire module, you may have returned hours later to find it dead, hung on a network hiccup, or only 30% done because your laptop decided to nap. The problem isn’t the agent. It’s that you’re running it on the wrong hardware.
Agents need two things that a laptop rarely delivers for long: uninterrupted compute and a stable internet connection. Even with a caffeinate command or an insomniac app, you’re still betting against sleep timers, Wi-Fi blips, and thermal throttling. The real fix is simpler than tweaking power management: stop running the agent locally. Give it a persistent remote shell instead.
The sleep problem
Close your lid and macOS sleeps the machine. On Linux, even with systemd-inhibit, a lid-close event can still suspend the system unless you explicitly mask it. You can fight this with:
sudo pmset disablesleep 1 # macOS
systemctl mask sleep.target suspend.target # Linux
But that’s a fragile band-aid. You forget to undo it, your laptop dies in your bag, and the moment you reboot, the agent’s progress is lost. The agent might resume after wake, but often the TCP connections to the model API are broken and it sits there retrying until you kill it. Running inside a local tmux doesn’t help because the whole machine was asleep, so the process was frozen in RAM, not running.
Wi-Fi dropouts and the SSH hang
Even if the laptop stays awake, Wi-Fi is not a datacenter link. A momentary blip, a roaming event between access points, or a microwave can tear down the SSH session. Tools like tmux or screen preserve your shell process after a disconnect, but they don’t magically keep an agent from crashing when it can’t reach the LLM API for 30 seconds. The agent calls out to a remote model on almost every turn. A short interruption can leave it in a broken loop or a hung state that requires manual intervention.
A remote server with a wired, unmetered connection eliminates that variable entirely. The agent’s session stays up and its API calls don’t drop because your coffee shop’s Wi-Fi decided to reauthenticate.
CPU throttling kills speed
Laptops throttle aggressively under sustained load. The burst speed is great, but a refactor that takes 40 minutes of continuous CPU work will push the thermals into steady throttling after 5 minutes. What should have been a quick job drags on, and you might not notice because you’re not watching the fan curve. A $5 VPS offers a consistent, if modest, CPU quota that finishes the task predictably. No turbo fall-off, no lid-closed fan starvation.
The persistent remote shell
The pattern that works: an always-on Linux box with a tmux session that never closes. You SSH in, start the agent, detach, and walk away. Hours later you reconnect and the agent’s output is waiting.
Here’s the concrete workflow:
- Get a remote Linux machine. Any cheap VPS, a home server, or a preconfigured shell like those from xShellz (which come with Borg baked in and a persistent environment).
- Set up key-based SSH.
- Install
tmuxif it’s not already present. - Start a named session:
ssh yourbox
tmux new -s agent
- Inside the session, launch your agent:
borg refactor src/ # or claude, etc.
- Detach:
Ctrl-b d. Close your laptop, go to sleep, commute, whatever. - Reattach later from anywhere:
ssh yourbox -t tmux attach -t agent
The agent never stopped. It never lost its network. It never had its CPU throttled by a warm lap. You get the full output, exactly as if you’d been watching the whole time.
This is exactly the model that xShellz built Borg around: a remote shell that stays up 24/7 so your coding agent can run long refactors, autonomous background tasks, or batch modifications without you needing to keep a laptop awake. You can roll your own with a Linode and tmux, or grab an xShellz shell that’s already hardened, pre-installed with Borg, and integrated with always-on IRC bouncers if that’s your thing.
But doesn’t remote mean lag?
For interactive typing, maybe, but an AI coding agent’s work is mostly batch. You give it a task, it runs for minutes or hours, spitting out occasional status updates. Latency of 30ms vs. 5ms doesn’t matter. If you need a snappier feel, mosh or SSH connection sharing eliminates perceptible keystroke delay. The real win is reliability, not shaving milliseconds off echo.
Security notes
Don’t open SSH to the world with a password. Use key auth, disable root login, and consider a simple firewall. Most VPS providers give you those defaults. xShellz shells come with SSH keys, fail2ban, and automatic updates so you don’t have to think about it. Either way, the setup is under 5 minutes.
Stop fighting your laptop
AI coding agents are a new breed of tool that expect long, uninterrupted runs. Your laptop was never designed for that. A persistent remote shell is the cheap, simple, and correct foundation for this workflow. Once you try it, you’ll wonder why you ever left an agent grinding away on local hardware while you closed the lid and hoped for the best.