tmux-restore 发布 重启后恢复 tmux 窗口与智能体会话

原标题:Show HN: Tmux-restore saves tmux windows and agent sessions across reboots
58AI 研判分

tmux-restore 是一个开源工具,每分钟及关机前自动保存 tmux 的会话、窗口、分屏、工作目录与回滚缓冲,重启后原样恢复。运行 Claude Code、Codex、Gemini CLI 等智能体的窗格可重新打开此前的对话,编辑器与监控类进程直接重启,部署、开发服务器等则仅回填命令等待确认,避免误执行。

报道正文

本文目录3 个章节

tmux-restore

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

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