跳到正文
Hacker News (official RSS)(github.com)·· 19 天前品質評分74

tmux-restore:重啟後自動恢復 tmux 視窗與 AI 代理對話

Show HN: Tmux-restore saves tmux windows and agent sessions across reboots

重點導讀

tmux-restore 能在每分鐘與系統關機時自動備份 tmux 會話,並在重新啟動時恢復視窗、分頁、工作目錄與 AI 代理對話。

\n- 備份頻率:每分鐘 + 系統關機時一次。

AI 伴隨問答

自備 Key 深度分析

針對這篇報導有疑問?可直接點選快捷問題或向 AI 追問背景脈絡與技術細節:

正文

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

tests MIT license tmux plugin

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.

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 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 | bash

It installs whatever is missing (tmux, TPM, the plugins) and turns everything on. Run it again to update.

How it works

  1. Save. Every minute, tmux-resurrect records every session, window, pane and its scrollback.
  2. 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.
  3. Shutdown. A background service (systemd on Linux, launchd on macOS) saves once more the moment the machine starts going down.
  4. 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.

讀者討論

理性交流 · 即時討論