[FEATURE] Change the session's default working directory mid-session

Status Open
Maintainer reply None cached
Activity 1 comment · opened Jul 17, 2026

Preflight Checklist

  • [x] I have searched existing requests and this feature hasn't been requested yet
  • [x] This is a single feature request (not multiple features)

Problem Statement

The default working directory is fixed when a session starts and cannot be changed afterwards. The shell resets to it between Bash calls, so when a session starts (or resumes) in the wrong place - e.g. an auto-created .claude/worktrees/<name> folder that is no longer a registered git worktree - every relative path and git command silently resolves somewhere unexpected. Worse, the default dir is nearly invisible day-to-day: you usually only discover it once it has already caused a problem.

Real case: a long-running session's default dir was <repo>/.claude/worktrees/guitar-bleed-phase-0, a stale leftover that is not a registered worktree, while the actual work targeted the repo root on another branch. Git commands run from that folder silently resolved to the primary repo. That happened to be benign in our case, but confirming it required git worktree list and manually comparing paths.

Proposed Solution

  • A /cwd <path> (or similar) command that re-bases the session's default working directory - the one the harness resets to between tool calls - without losing conversation context.
  • Surface the effective default directory prominently (e.g. in the status line), and warn when it is a stale/unregistered worktree path.

Alternative Solutions

  • /add-dir grants access to additional directories but does not change the default.
  • Prefixing every command with cd <path> && ... works but defeats prefix-based permission allowlists (constant re-prompts) and relies on the model remembering to do it on every call.
  • Starting a fresh session in the right directory loses the conversation context.

Priority

Medium - Would be very helpful

Feature Category

Configuration and settings

Use Case Example

Long-running sessions in a monorepo with several .claude/worktrees/* checkouts where phases/branches rotate: the "right" directory changes over the life of the work, but the session stays pinned to whatever was current at session start.

Additional Context

Related but distinct: #76708 (Bash cwd does not persist across tool calls) is about cwd persistence within a session; this request is about deliberately re-basing the default directory the session resets to. Environment: Claude Code desktop app, Windows 11.

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗