Sessions run in git worktrees don't appear in the parent repo's history picker
What happened
I ran several agents in parallel, each isolated in its own git worktree (.claude/worktrees/<name>, the pattern Claude Code itself uses with --worktree). After restarting my machine, none of those conversations appeared in the session history picker while I had the main repo folder open. They looked permanently lost.
Why (root cause)
Claude Code keys each session's transcript folder to the session's working directory: ~/.claude/projects/<sanitized-cwd>/. A git worktree is a different directory, so worktree sessions are written to sibling project folders (e.g. ...--claude-worktrees-<name>/) and never roll up into the parent repo's history list. The transcripts are safe on disk, they just aren't discoverable from the UI you'd expect to find them in.
Expected behavior
Sessions launched in a worktree of a repo should be findable from that repo's history picker, ideally grouped or tagged by worktree. At minimum, an option to "show sessions from all worktrees of this repo."
Impact
Since Claude Code actively encourages worktree isolation for parallel or risky sessions, this makes the encouraged workflow's history effectively invisible after the fact. Users reasonably conclude their conversations were deleted, which is alarming when an agent did hours of real work.
Workaround
Hard-linking each worktree transcript's .jsonl into the root project folder makes the sessions appear in the picker and remain live/resumable (a hard link shares the same bytes, unlike a snapshot copy). A small script on a schedule keeps it in sync for new worktree sessions.
Environment
- Claude Code VSCode extension
- Windows 11