tmux-restore:重啟後自動恢復 tmux 視窗與 AI 代理對話
Show HN: Tmux-restore saves tmux windows and agent sessions across reboots
tmux-restore 能在每分鐘與系統關機時自動備份 tmux 會話,並在重新啟動時恢復視窗、分頁、工作目錄與 AI 代理對話。
\n- 備份頻率:每分鐘 + 系統關機時一次。
AI 伴隨問答
針對這篇報導有疑問?可直接點選快捷問題或向 AI 追問背景脈絡與技術細節:
Reboot-proof tmux. Your coding agents pick up mid-conversation.
What it does · 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.
What it does
- Everything comes back. Sessions, windows, splits, working directories and scrollback.
- Agents resume mid-conversation. Each one reopens its own conversation, with the same flags.
- Saved at shutdown, not just on a timer. Every minute, plus once more as the machine goes down.
- Nothing risky re-runs. Editors and monitors restart. Anything else (a deploy, a dev server) comes back typed on the prompt, waiting for Enter.
Install
curl -fsSL https://raw.githubusercontent.com/andrewboldi/tmux-restore/main/install.sh | bashIt installs whatever is missing (tmux, TPM, the plugins) and turns everything on. Run it again to update.
How it works
- Save. Every minute, tmux-resurrect records every session, window, pane and its scrollback.
- Rewrite. For each pane running an agent, a small adapter finds the conversation's id in the agent's own session files and saves the command that resumes it.
- Shutdown. A background service (systemd on Linux, launchd on macOS) saves once more the moment the machine starts going down.
- Restore. When tmux starts, tmux-continuum puts it all back, and the agents reopen their conversations.
More in how it works. Using another agent? An adapter is one short file; see CONTRIBUTING.md.
License
MIT. Built on tmux-resurrect and tmux-continuum by Bruno Sutic and contributors.
