Take A Coffee

PTY and phone reconnect

Keeping the terminal alive is not the same as keeping the host alive.

A PTY daemon, phone client, or reconnect tool can preserve the Claude Code session. It still needs a dev box that stays awake, reachable, cool, and restorable.

PTY

Reconnect should preserve state

Disconnect the client mid-run, switch networks, reconnect from the phone, and verify the same prompt, cwd, pending approval, and output stream are still there.

Host

Sleep should be tested separately

Run a heartbeat outside Claude Code, then test lock, sleep/wake, lid close, Wi-Fi change, and reboot. Missing timestamps mean the host failed, not the PTY.

Restore

Awake mode needs an off switch

If the dev box is a notebook, temporary awake mode should end with battery, heat, reachability, and restored sleep settings in the receipt.

Host heartbeat

Keep proof outside the PTY.

This catches the difference between a preserved session and a sleeping dev box.

while true; do date >> ~/pty-host-survival.log; sleep 30; done
Copy prompt

Ask the agent to split the layers.

Use this before trusting a PTY wrapper, phone terminal, or reconnect tool for unattended work.

Test this Claude Code PTY/reconnect setup in two layers. First verify PTY survival: disconnect, reconnect, switch networks, and confirm prompt, cwd, pending approval, and output state are preserved. Then verify host survival separately: heartbeat file outside Claude, sleep/wake, lid close if relevant, Wi-Fi change, battery, heat, and restore. Stop if the host sleeps, network dies, battery/heat is unsafe, or normal sleep settings cannot be restored.

Want Codex to handle the local host layer?

Take A Coffee gives Codex a temporary awake mode, host checks, restore step, and receipt for macOS and Windows notebook runs.

Run it with Codex