Session history lost/hidden after renaming project folder (session discovery keyed only to old path)
Status Open
Maintainer reply None cached
Workaround ✓ Mentioned in description ↑
Activity 2 comments · opened Aug 14, 2026
Summary
Renaming a project folder makes Claude Code's existing session history for that project invisible in the session picker (observed in the VSCode extension), even though the transcript data is fully intact on disk.
Root cause
- Session transcripts live under
~/.claude/projects/<sanitized-abs-path>/<session-id>.jsonl, where the directory name encodes the workspace's absolute path (/and_both become-). - Each JSONL line also embeds the workspace path in a
cwdfield (and absolute paths appear throughout tool-call args/results). - After a folder rename, the session directory keyed to the old path is never associated with the new path, so the picker shows no history for the renamed workspace — despite the
.jsonltranscript being present and uncorrupted under the old path's directory.
Repro steps
- Open a project folder in VSCode with the Claude Code extension, start a session, do some work.
- Rename the project folder on disk (Finder/Explorer or
mv). - Reopen the renamed folder in VSCode.
- Session history for that workspace is empty in the sidebar — the prior session appears lost.
Workaround (manually verified)
- Find the old session dir:
~/.claude/projects/<old-sanitized-path>/. - Copy
<session-id>.jsonl(+ its sidecar dir) into~/.claude/projects/<new-sanitized-path>/. - Find/replace the old absolute path with the new one throughout the
.jsonl(appears incwdfields and in tool-call paths). - Fully restart VSCode (a reload wasn't enough in testing) — the session then appears in the picker for the renamed workspace.
Suggested fix
- Fall back to matching sessions by the
cwdfield(s) recorded inside the transcript, not solely by directory-name-encoded path, and/or - Add a "relink session to this workspace" command so users aren't hand-editing JSONL, and/or
- On opening a workspace with no matching session dir, detect orphaned session dirs (e.g. by git remote/dir-contents heuristics) and offer to migrate them.
Environment
- Claude Code VSCode extension
- macOS (Darwin 25.3.0)
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗