--resume shows no sessions when cwd is a bare repo root with worktrees

Resolved 💬 2 comments Opened Apr 14, 2026 by signe Closed May 27, 2026

Description

When running Claude Code from the root of a bare git repository that uses linked worktrees, claude --resume (interactive picker) shows "No conversations found to resume" — even though sessions exist and claude --resume <UUID> works fine.

Version: Claude Code 2.1.108, macOS (Darwin, arm64)

Setup

A bare repo with linked worktrees using the common "bare + worktree" pattern:

~/work/myrepo/           ← bare repo root (cwd when launching claude)
~/work/myrepo/.bare/     ← actual git database
~/work/myrepo/.git       ← file containing: gitdir: ~/work/myrepo/.bare
~/work/myrepo/develop/   ← worktree (branch: develop)
~/work/myrepo/featureA/  ← worktree (branch: feature/A)

Root cause

When multiple worktrees are detected, loadSameRepoMessageLogsProgressive discovers worktrees via git worktree list --porcelain, hashes each worktree path, then scans ~/.claude/projects/ for matching directories.

The bare repo root is not listed as a worktree by git:

$ git worktree list --porcelain
worktree ~/work/myrepo/.bare
bare

worktree ~/work/myrepo/develop
HEAD abc123
branch refs/heads/develop
...

Notice ~/work/myrepo/ (the actual cwd) is absent — only .bare appears.

Session creation uses getProjectDir(cwd) which hashes the cwd directly:

  • cwd ~/work/myrepo/ → project dir -work-myrepo

Session listing searches project dirs matching worktree paths:

  • .bare-work-myrepo--bare
  • develop/-work-myrepo-develop
  • featureA/-work-myrepo-featureA

The project dir -work-myrepo (where sessions are stored) doesn't match any worktree-derived path, so it is never searched. Sessions are created but invisible to --resume.

Reproduction

# Set up a bare repo with worktrees
mkdir myrepo && cd myrepo
git clone --bare <repo-url> .bare
echo "gitdir: $(pwd)/.bare" > .git
git worktree add develop develop

# Start a session from the bare root
cd ~/work/myrepo
claude   # creates session in ~/.claude/projects/-work-myrepo/

# Try to resume
claude --resume   # → "No conversations found to resume"

# But direct resume by UUID works:
claude --resume <session-uuid>   # → works fine

Expected behavior

claude --resume should list sessions for the current working directory regardless of whether the cwd appears in git worktree list output.

Suggested fix

In the multi-worktree branch of loadSameRepoMessageLogsProgressive, always include getProjectDir(getOriginalCwd()) in the set of directories to scan, even if it doesn't match any discovered worktree path. This ensures the cwd's own sessions are always visible.

View original on GitHub ↗

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