# tmux-assistant-resurrect

A tool that hooks into tmux-resurrect to save and relaunch AI coding assistant sessions, such as Claude Code, Cursor Agent CLI, GitHub Copilot CLI, OpenCode, Codex CLI and Pi, after a tmux restart or reboot.

When a computer shuts down, tmux sessions are lost along with any running coding-assistant process inside them. This project hooks into tmux-resurrect to automatically save each assistant's session ID, CLI flags and environment variables, then re-launch it with the same configuration after a restore.

Detection works by taking a single ps snapshot of every tmux pane's child processes and matching known assistant binary names. Session-ID extraction uses each tool's own mechanism where possible, such as a hook-written state file keyed by process ID, falling back to reading command-line arguments or, for Claude Code, the newest matching transcript under its projects directory, with documented edge cases where two unresolved instances in one directory remain ambiguous.

The project describes itself as entirely built through conversation with AI coding assistants, and end-to-end tested in Docker with real CLI binaries across a save, kill and restore lifecycle, though real-world use so far has been limited.

Website: https://github.com/timvw/tmux-assistant-resurrect
