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.
PTY and phone reconnect
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.
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.
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.
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
This catches the difference between a preserved session and a sleeping dev box.
while true; do date >> ~/pty-host-survival.log; sleep 30; done
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.
Take A Coffee gives Codex a temporary awake mode, host checks, restore step, and receipt for macOS and Windows notebook runs.