`/resume` cannot surface sessions launched from a bare+worktrees root
Resolved 💬 2 comments Opened Apr 22, 2026 by mr-pinzhang Closed May 27, 2026
Summary
When claude is launched from the root of a "bare + sibling worktrees" git layout — where the launch dir contains .bare/ and a .git file (gitdir: ./.bare) but is itself not a registered worktree — session JSONLs are written correctly, but /resume cannot list them under any scope toggle except Ctrl+A (all projects).
Repro
Layout:
myrepo/ # launch dir: contains `.git` file pointing at .bare/, NOT a registered worktree
├── .bare/ # the gitdir (bare repo)
├── main/ # registered worktree (branch: main)
└── docs/ # registered worktree
git worktree list from the root:
/path/to/myrepo/.bare (bare)
/path/to/myrepo/main abc1234 [main]
git rev-parse --show-toplevel from the root: fatal: this operation must be run in a work tree.
cd myrepo && claude→ runs fine; jsonls written to~/.claude/projects/-path-to-myrepo/withcwd: /path/to/myrepoandgitBranch: main.- Accumulate N sessions this way.
/resumefrom the same dir → empty list. Header shows scope.bare · myrepo.Ctrl+B(current branch): still empty — filter is branch.bare, but stored sessions havegitBranch: main.Ctrl+W(all worktrees): shows only sessions stored under registered worktrees (main/,docs/) — never the sessions at the root project dir, becausegit worktree listhas no entry for the root.Ctrl+A(all projects): finally shows them, mixed in with every other project globally.
Expected
Either:
- Default scope should include the launch dir's own project dir under
~/.claude/projects/…, even when the launch dir isn't a registered worktree, or - A settings key (e.g.
resume.defaultScope: "project" | "worktrees" | "all") to pin the default.
Actual
Sessions are reachable only via Ctrl+A (noisy) or claude -c / --resume <id> (bypass the picker). From the user's POV: "my history disappeared" when launching from the root.
Workarounds tried
Ctrl+W— only walksgit worktree list, root isn't listed, so misses the sessions.- Moving jsonls into a sibling worktree's project dir — works until next new session is written.
- Registering the root as a worktree (
git worktree add --force . <branch>) — changes repo layout and pollutes the root dir.
Environment
- Claude Code 2.1.117
- macOS 26.4 (arm64)
- git worktree layout: bare at
./.bare, siblings for each branch
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗