Print session resume ID on SIGTERM/forced shutdown

Resolved 💬 3 comments Opened Feb 19, 2026 by xiuyechen Closed Feb 19, 2026

Feature Request

Problem

When Claude Code is killed by a terminal restart (e.g., VS Code reloading extensions, macOS restart, terminal emulator crash), all running sessions are terminated without any indication of their session IDs. If you had many sessions running across multiple terminals (as is common with VS Code's multi-terminal workflow), there's no easy way to figure out which session was in which terminal.

claude --resume shows a list, but when you've lost 10+ sessions simultaneously, matching them back to their context is painful — you're just guessing from first-prompt snippets.

Proposed Solution

On receiving SIGTERM/SIGHUP (the signals sent when a terminal closes), Claude Code should:

  1. Catch the signal gracefully
  2. Print the session ID before exiting, e.g.:

``
Session interrupted. Resume with:
claude --resume 5e6b5043-0ffa-485e-8e67-74970ce1c690
``

This is a small change with high quality-of-life impact for power users running multiple concurrent sessions.

Alternatives Considered

  • claude --resume works but doesn't help you match sessions to terminals after a bulk kill
  • The sessions-index.json exists but is often stale and doesn't update in real-time
  • Could also persist the session ID to a file (e.g., /tmp/claude-session-<PID>) as a fallback if stdout is already closed

Context

VS Code periodically restarts terminals (extension updates, window reload, etc.), which sends SIGTERM to all child processes. This is a common workflow disruption for users who keep multiple Claude Code sessions open in different terminal tabs.

View original on GitHub ↗

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