Resume: offer to restore the session's last working directory
Status Closed — duplicate
Reported on v2.1.217
Maintainer reply None cached
Activity 0 comments · opened Jul 31, 2026 · closed Jul 31, 2026
Feature request
When resuming a session, offer the option to resume in the directory the session was suspended in (the shell's last working directory), rather than always using the directory the resume is launched from.
Context
- A session is started in a repo's base checkout.
- During the session, work moves into a git worktree (
.worktrees/<name>inside the repo) — the agentcds there and all subsequent work happens in that worktree. - The session is suspended and later resumed. The resumed session's shell starts in the original launch directory (the base checkout), not the worktree it was suspended in.
Problem
After resume, the model continues issuing commands that assume the suspended cwd, but they execute in the base checkout. In our case a bare git branch -m <new-name> intended to rename the worktree's feature branch ran in the base checkout and renamed the local master branch instead — the user had to interrupt and restore it.
Suggestion
- On
claude --resume, let the user choose to restore the session's last shell working directory (e.g. a prompt, or a flag like--restore-cwd). - At minimum, surface the previous working directory prominently at resume time (to both the user and the model) so the mismatch is visible before any state-changing command runs.
Environment
- Claude Code 2.1.217
- macOS (darwin 25.5.0)
🤖 Filed with Claude Code on the user's behalf