Sessions in worktrees cannot be resumed after worktree cleanup
Bug
When using claude --worktree / claude -w, the session runs inside a temporary worktree directory (e.g. .claude/worktrees/<name>/). On /exit, Claude prints:
Resume this session with claude --resume <session-id>
But running claude --resume <session-id> fails because the worktree directory no longer exists — it was cleaned up when the session ended.
Expected behavior
Sessions started in worktrees should always be resumable, just like any other session. The resume mechanism should not depend on the worktree directory still being present. Possible approaches:
- Resume into the parent repo directory instead of the now-deleted worktree path
- Recreate the worktree on resume if needed
- Store session state in a location that survives worktree cleanup
It should never be the case that a conversation simply cannot be resumed just because it was started in a worktree. The --resume suggestion on exit is misleading if it doesn't actually work.
Repro steps
claude -w(starts a session in a new worktree)- Do some work, then
/exit - Copy the
--resumecommand from the exit message - Run
claude --resume <session-id>— fails because the worktree directory is gone
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗