Keep Claude Code, Codex, and OpenCode running when your laptop sleeps (Wi‑Fi drops, lid close, resume)

A practical continuity plan: run sessions where they won’t sleep, use better transports for roaming, and use handoff/queues so you don’t lose work.

Based on
CLI
0.1.0
Preview ref
f36aa45

I used to treat “laptop sleep” like a minor inconvenience.

But when you’re running longer coding sessions (Claude Code, Codex, OpenCode), sleep becomes a real failure mode:

  • your Wi‑Fi drops
  • your lid closes
  • the terminal freezes
  • the web UI stream goes stale

…and then you’re stuck trying to answer the worst question:

Did the session actually stop, or did I just lose my view of it?

This guide is the continuity plan I wish I’d adopted earlier.

It’s not one magic trick. It’s a few layered choices that make “lid close + roam + resume” boring.

TL;DR

  1. If you want sessions to survive laptop sleep, don’t run them on the laptop.
    • Run the session on a machine that won’t sleep (server / desktop / dev box).
  2. If you must connect over SSH from a roaming laptop/phone, use a transport designed for drops (Mosh).
  3. If you want a phone-first workflow:
    • use a UI that can reconnect safely and show “what needs attention”, and
    • use a queue so follow-ups don’t disappear when the session is offline/resuming.
  4. Happier is one option that helps because it supports session handoff (move the live session to another machine) and a pending queue (store messages until ready).

The problem (in plain language)

There are two different problems that get conflated:

  1. The process stopped.
  2. The process is fine, but your connection/view broke.

Laptop sleep mostly breaks (2).

But once you’re in the middle of it, it feels like (1), and people do the worst thing:

  • start a new session
  • paste a summary
  • lose the thread

What I tried first (and where I bounced off)

  • “Just don’t let my laptop sleep”: works until it doesn’t.
  • SSH + tmux: better than nothing, but still fragile when you roam or switch networks.
  • Remote desktop: heavy, and still doesn’t fix sleep.

The two upgrades that actually changed things for me:

  • run sessions on a stable host (so the laptop is just a client)
  • make “reconnect + follow-up” reliable (transport + queue)

Happier is one of the tools I use for that second part.

Option A (best): run the session where it won’t sleep

If the session matters, I run it on:

  • a server
  • a desktop
  • a dev box

Then laptop sleep is a client problem, not a session problem.

This also makes phone usage sane: you’re connecting to the stable host, not betting on a laptop that’s about to go in your bag.

Option B: if you SSH from a roaming machine, use Mosh

Mosh exists for the exact class of pain we’re talking about.

It’s designed to survive:

  • IP changes
  • Wi‑Fi drops
  • laptop sleep

The trade-off: it needs UDP, and it’s not a drop-in replacement for every SSH feature.

But for “I just need my terminal session to keep existing,” it’s the easiest win.

Option C: use a phone-friendly UI and treat reconnect as a first-class feature

This is where tools diverge.

Some products are basically “terminal first” and you’re expected to handle transport.

Others provide a phone/browser UI that can reconnect, show session state, and surface approvals.

The Happier workflow (handoff + pending queue)

If your specific problem is:

  • “I started on my laptop, but I need to close it”

Then the cleanest fix is not to keep the laptop alive.

It’s to move the live session to a machine that can keep running.

In Happier, that is Session handoff:

  • same session id
  • owner machine changes
  • conversation continues on the destination

And for the “I tried to send a follow-up while it was offline/resuming” class of pain, Happier’s pending queue is the safety net:

  • store messages when the session is offline/not ready
  • edit/reorder/remove them
  • send now when you truly need an interrupt

Troubleshooting

The stream is stale after sleep

Treat it as a reconnect issue first:

  • reload/reconnect
  • confirm you’re pointed at the correct machine/session

If the tool has known stale-state issues after sleep, upgrades often matter.

I sent a message and it disappeared

This is exactly what a queue is for.

If your tool doesn’t have a durable pending queue, your only safe option is to wait until you’re sure the session is ready.

mobilecontinuityclaudecodexopencoderemote
Last updated: 2026-04-03