AI & Agents

How-To: Keep Your Coding Agent Running Through SSH Drops With tmux

Leave a comment

Omarchy’s new agent resume handles reboots. The more common way I lose an agent session is simpler: my laptop sleeps or Wi-Fi blips, and the SSH session to the box running the agent dies with it. tmux fixes that.

1. Install tmux

sudo pacman -S tmux      # Arch / Omarchy
sudo apt install tmux    # Debian / Ubuntu

2. Start a named session and launch the agent inside it

tmux new -s agent
# now start your agent CLI as usual inside this session

3. Detach on purpose (or let the network do it)

Press Ctrl+b then d. The session and the agent keep running on the remote box even if your SSH connection drops.

4. Reattach later

tmux ls
tmux attach -t agent

5. One-liner from your laptop

ssh -t your-server 'tmux new -A -s agent'

-A attaches if the session exists and creates it if it doesn’t, so one command does both. Swap in your own SSH alias.

Notes

  • tmux keeps things alive through disconnects, not reboots. For reboots, use your agent’s own resume or session flags.
  • Scroll back with Ctrl+b then [, and press q to exit.
  • Don’t leave an agent with broad permissions running unattended forever. Check in, and close the session when you’re done.

God Bless, and Happy hacking!

References & Further Reading

Subscribe (RSS) Follow AI & Agents via RSS

Leave a note

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.