RFE: Allow session cwd relocation when remote machine is no longer available

Resolved 💬 3 comments Opened May 22, 2026 by eamondowling Closed May 22, 2026

Problem

When a Claude Code session was started over SSH and the remote machine is permanently decommissioned, the session becomes non-re-entrant on the host machine. The cwd (e.g. /home/duncan/Projects/02-crash-forensics) is embedded in every record of the session JSONL. Claude Code validates the cwd on open, so even though the full transcript is stored locally the session cannot be resumed.

There is currently no built-in path to recover from this. The manual workaround requires finding the JSONL in ~/.claude/projects/ssh-{id}/, creating a new local project directory, and doing a raw string replacement across ~229 records — error-prone and undocumented.

Proposed solution

When Claude Code detects that a session's cwd does not exist at open time, offer one of:

  1. Prompt to relocate — ask the user for a new local working directory, update the session metadata going forward (without rewriting history)
  2. Read-only fallback — open the session in transcript-view mode so the history is accessible even if the cwd is unreachable
  3. Session export/migrate command — a first-class CLI option (claude session migrate <id> --cwd <new-path>) that handles the JSONL rewrite safely

Context

  • Session file: ~/.claude/projects/ssh-{sessionId}/{sessionId}.jsonl
  • The cwd field appears in user, assistant, and queue-operation record types
  • Only the structural cwd fields need updating; cwd mentions in message content are benign

Related: #61111 (local processes spawned with remote cwd), #58701 (SSH session showing "No messages" after restart)

View original on GitHub ↗

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