Feature request: /cd command to change working directory mid-session
Resolved 💬 7 comments Opened Jan 21, 2026 by Zycroft Closed Mar 12, 2026
Feature Request
Add a built-in /cd command that changes Claude Code's working directory mid-session.
Problem
Currently, Claude Code's working directory (workspace.current_dir) is set at session start and cannot be changed during a session. This is problematic when:
- Working with git worktrees - Users create a worktree and want to switch to it without restarting Claude
- Navigating monorepos - Moving between packages/services in a large codebase
- Context switching - Moving to a different project directory during a session
The shell's cd command resets after each Bash invocation, so it doesn't persist. Custom commands can't modify the internal workspace state.
Current Workaround
Users must exit and restart Claude Code in the new directory:
cd /path/to/new/dir && claude
This loses conversation context and is disruptive to workflow.
Proposed Solution
Add a built-in /cd <path> command that:
- Validates the target directory exists
- Updates
workspace.current_dirinternally - Updates the statusline to reflect the new directory
- Persists the new directory for all subsequent tool calls
Example Usage
/cd ../my-worktree
/cd ~/projects/other-repo
/cd ..
Additional Context
- The statusline hook reads from
data.workspace.current_dir, so updating this internal state would automatically fix statusline display - This would make Claude Code much more flexible for users who work across multiple directories in a session
This issue has 7 comments on GitHub. Read the full discussion on GitHub ↗