/resume can't find sessions started in a different directory (picker is cwd-scoped)

Status Fixed / completed
Maintainer reply ✓ Yes — bcherny
Activity 3 comments · opened Jun 6, 2026 · closed Aug 17, 2026
💡 Likely answer: A maintainer (bcherny, collaborator) responded on this thread — see the highlighted reply below.

Summary

/resume (both the interactive picker and /resume <session-id>) only surfaces sessions whose working directory matches the current one. Sessions started from a different directory are reported as "Session not found" or simply don't appear in the picker — even though their transcript .jsonl files are fully intact on disk under ~/.claude/projects/.

Nothing is actually lost; it's purely a discoverability gap in how the picker scopes results.

Steps to reproduce

  1. Start a session in directory A (e.g. ~/projects/foo). Note its session ID.
  2. cd to a different directory B (e.g. ~/projects/bar).
  3. Run claude and /resume <session-id-from-A>.

Expected: the session resumes (or is at least offered).
Actual: Session not found. The same session is also missing from the interactive /resume picker while in directory B.

Confirm the transcript exists the whole time:

SESSION_ID=<id-from-A>
find ~/.claude/projects -name "*.jsonl" | xargs grep -l "$SESSION_ID"

Why this is surprising

The transcript records the originating directory in a cwd field on its first line:

head -1 path/to/session.jsonl | python3 -c "import sys,json; print(json.load(sys.stdin).get('cwd',''))"

So the information needed to find and correctly relaunch the session already exists — it just isn't used by the picker.

Suggested fix

  • When an explicit /resume <id> isn't found in the current scope, fall back to searching all of ~/.claude/projects/ before reporting "Session not found".
  • Optionally let the picker list (or offer a "search everywhere" toggle for) sessions across directories, decoding each session's real cwd from the transcript's cwd field rather than from the directory-name encoding (the -→/ heuristic is ambiguous for paths containing hyphens).
  • On resume, restore the original cwd so the session continues in the right place.

Workaround

I ended up writing a small plugin (recover-session) that scans ~/.claude/projects/, decodes the cwd field, summarizes the transcript, and relaunches in the original directory — but this really feels like it should be built into /resume.

Environment

  • Claude Code CLI on macOS (darwin)

View original on GitHub ↗

3 Comments

alexander-posztos · 3 months ago

yeah i ran into this too, so i ended up building a project wide session picker myself. it reads ~/.claude/projects directly so it shows every project's session no matter where you launch it, along with a short recap of each (generated with haiku) and the git state. feel free to try it out: https://github.com/alexander-posztos/ccdash

bcherny collaborator · 1 month ago

Both halves of this are covered today:

  • In the /resume (or claude --resume) picker, press Ctrl+A to switch from the current repository to sessions from all projects on this machine; each row then shows its project path.
  • As of a recent release, claude --resume <session-id> works from any directory: it checks the current project and its worktrees first, then every other project on the machine, and resumes the session with its original working directory.

Docs: https://code.claude.com/docs/en/sessions — changelog: https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md

Closing as available; if --resume <id> still reports not-found on a current version, please open a bug with the version and steps.

🤖 Generated with Claude Code

github-actions[bot] · 8 days ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.