Expose session/conversation ID to enable terminal session restore

Resolved 💬 3 comments Opened Mar 16, 2026 by Saisreenivas Closed Mar 19, 2026

Problem

When using Claude Code inside tmux, there's no way to restore Claude sessions after a system reboot or tmux kill-server.

tmux-resurrect/continuum can restore sessions, windows, panes, and working directories — but not running processes like Claude Code. The workaround would be to re-launch claude --resume <id> in each restored pane, but:

  1. Session IDs are not accessible from outside the process. They're not in ps args (unless the user explicitly started with --resume <id>), not written to any file, and not queryable via CLI.
  2. claude --continue doesn't work because it resumes the most recent conversation per working directory. Users commonly have multiple Claude sessions in the same directory (e.g., 5 sessions in a monorepo root), so -c would resume the same conversation in all panes.

Proposed Solution

Expose the current conversation/session ID externally. Some options:

  • Write session ID to a file, e.g., ~/.claude/sessions/<PID> or a path set via $CLAUDE_SESSION_FILE env var
  • Write to a tmux environment variable (if inside tmux), e.g., tmux setenv -t <pane> CLAUDE_SESSION_ID <id>
  • Add a claude sessions list CLI command that shows active/recent sessions with their IDs and working directories

Any of these would allow tooling (tmux hooks, resurrect plugins, wrapper scripts) to capture session IDs before shutdown and bulk-restore them after reboot.

Context

  • Power users run 20+ concurrent Claude Code sessions inside tmux
  • tmux-resurrect can save/restore terminal layout but not interactive processes
  • This is the missing piece for full session persistence across reboots

Environment

  • macOS, Ghostty terminal, tmux with resurrect + continuum
  • Claude Code CLI

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗