Show HN:Tmux-restore 在重启后保留 tmux 窗口与代理会话
Show HN: Tmux-restore saves tmux windows and agent sessions across reboots

原始链接: https://github.com/andrewboldi/tmux-restore

tmux-restore 每分钟并关机前自动保存 tmux 会话、窗口、窗格、工作目录和滚动历史,启动时恢复。它会在之前的位置重新打开支持的编码代理对话(Claude Code、Codex、Gemini CLI、opencode、pi),重启编辑器/监视器,并为其他命令预填供手动执行。可通过一行 curl 脚本安装;使用简短适配器即可轻松添加代理。MIT 许可,基于 tmux-resurrect 和 tmux-continuum。

Hacker News 新帖 | 过去 | 评论 | 提问 | 展示 | 工作 | 提交 登录 Show HN:Tmux-restore 在重启后保存并恢复 tmux 窗口和智能体会话 (github.com/andrewboldi) 7 分,由 boldi 发布于 1 小时前 | 隐藏 | 过去 | 收藏 | 1 条评论 帮助 boldi 29 分钟前 [–] 大家好,我做了这个,因为重启电脑(例如安装驱动)时,所有带有不同路径和布局的 tmux 窗口都会被销毁,这太令人沮丧了。它还能恢复例如 Claude Code 的会话。希望它能帮到你! 回复 指南 | 常见问题 | 列表 | API | 安全 | 法律 | 申请 YC | 联系 搜索:
相关文章

原文

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.

  • 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.
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.

  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.

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

联系我们 contact @ memedata.com