GitHub - andrewboldi/tmux-restore: Reboot-proof tmux: every session, layout and scrollback comes back, and Claude Code, Codex, Gemini CLI, opencode and pi reopen the conversations they were in.

GitHub

2 min read Original article ↗

Reboot-proof tmux. Your coding agents pick up mid-conversation.

tests MIT license tmux plugin

What it adds · Install · How it works · Agents · Caveats · Contributing

Ever rebooted and lost a dozen tmux windows, along with the agent conversations running in them? tmux-restore saves everything every minute and right before shutdown, and puts it back when tmux starts. Panes running Claude Code, Codex, Gemini CLI, opencode or pi reopen the exact conversation they were in.

A tmux window with Claude Code, vim and a dev server. tmux is killed and started again: the conversation, vim and the layout come back, and the dev server's command waits on the prompt.

What it adds to tmux-resurrect

tmux-restore runs on top of tmux-resurrect and tmux-continuum, which bring back sessions, windows, splits, working directories and scrollback. It adds:

  • Agents resume mid-conversation. Each pane reopens its own conversation, with the same flags. Supported agents
  • Saved at shutdown, not just on a timer. Every minute (continuum's default is 15), plus once more as the machine goes down. A crash or power cut loses at most the last minute.
  • The rest comes back typed, not lost. Editors, monitors, log followers (tail -f, journalctl -f, kubectl logs -f) and whatever you list in @resurrect-processes restart. With zsh, anything else waits on the prompt for Enter, where tmux-resurrect leaves an empty shell.
  • Python venvs come back, once you add one line to ~/.zshrc or ~/.bashrc.

Scrollback is saved to disk, so anything a pane showed, a password included, sits in a folder only you can read. To not save it, add set -g @resurrect-capture-pane-contents 'off'.

Install

curl -fsSL https://raw.githubusercontent.com/andrewboldi/tmux-restore/main/install.sh | bash

It installs whatever is missing (tmux, TPM, the plugins) and turns everything on. Run it again to update. Rather not run a script? Install by hand.

Already using tmux-resurrect and tmux-continuum? Keep them: your settings, your list of programs to restart and your saves carry over. The installer switches tmux-resurrect to a fork that lets only one restore run at a time (proposed upstream).

How it works

tmux-resurrect saves each pane and its command. For an agent's pane, a small adapter finds the conversation's id in the agent's own session files and saves the command that resumes it instead. A background service (systemd on Linux, launchd on macOS) makes the save at shutdown. More in how it works.

Using another agent? An adapter is one short file. Send it in (CONTRIBUTING.md), or keep it to yourself in ~/.config/tmux-restore/agents/.

License

MIT. Built on tmux-resurrect and tmux-continuum by Bruno Sutic and contributors.