Sessions started inside a git submodule are not listed by --resume
Type
Bug
Summary
A Claude Code session started inside a git submodule working directory is saved correctly, but does not appear in the --resume / -r picker when launched again from that same directory. The transcripts exist on disk and are recoverable by session ID, but they are invisible in the interactive list — so from the user's point of view the sessions are "lost."
Reproduction
- Have a superproject containing a git submodule, e.g.
~/rrwebcloudwith submodule at~/rrwebcloud/vendor/rrweb.
- The submodule's
.gitis a file (gitdir: ../../.git/modules/rrweb), not a directory.
cd ~/rrwebcloud/vendor/rrweband start a Claude session; do some work.- From the same directory, run
claude -r(orclaude --resume). - The session(s) just created are not listed.
What I verified on disk
- The directory is a submodule:
cat ~/rrwebcloud/vendor/rrweb/.git->gitdir: ../../.git/modules/rrweb- Transcripts are stored under the expected, cwd-derived project dir:
~/.claude/projects/-home-eoghan-rrwebcloud-vendor-rrweb/contains 12.jsonlsessions (recent, up to 2 MB each).- The recorded
cwdin those sessions is exactly/home/eoghan/rrwebcloud/vendor/rrweb, which matches the project-dir name. So storage is correct and consistent. - Despite that, the resume picker shows none of them.
Likely cause (hypothesis)
For a submodule, git resolves the git directory outside the working tree:
$ cd ~/rrwebcloud/vendor/rrweb
$ git rev-parse --show-toplevel -> /home/eoghan/rrwebcloud/vendor/rrweb
$ git rev-parse --git-dir -> /home/eoghan/rrwebcloud/.git/modules/rrweb
$ git rev-parse --git-common-dir -> /home/eoghan/rrwebcloud/.git/modules/rrweb
$ git rev-parse --show-superproject-working-tree -> /home/eoghan/rrwebcloud
Sessions are written to a project dir derived from cwd (vendor/rrweb), but the resume picker appears to compute the project key differently — likely from the git-dir/common-dir or by walking up to a .git directory (which skips the submodule's .git pointer file and lands on the superproject ~/rrwebcloud). Either way the picker's lookup key no longer matches the storage key, so the submodule's sessions are filtered out.
(Note: this is the same class of "storage key vs picker key mismatch" as worktree sessions not showing in -r, but the trigger here is submodules, not worktrees.)
Expected behavior
Sessions started in a submodule working directory should be listed by --resume when launched from that same directory, consistent with where they are stored (the cwd-derived project dir).
Workaround
Resume by explicit session ID: claude --resume <session-id> still works; only the interactive listing is broken.
Environment
- Claude Code v2.1.x
- Linux
- Submodule working tree with
.gitpointer file ->.git/modules/<name>