Feature request: /cd command to change working directory mid-session

Status Closed — duplicate
Maintainer reply None cached
Activity 3 comments · opened Jan 29, 2026 · closed Feb 1, 2026

Problem

Currently, Claude Code sessions are tied to the directory where they were started. When working with git worktrees or multiple related projects, users need to:

  1. Exit the current Claude Code session (Ctrl+C)
  2. Change directory to the new location
  3. Start a new Claude Code session

This workflow interrupts the conversation context and requires manual re-orientation in the new directory.

Proposed Solution

Add a /cd (or /chdir) slash command that changes the working directory mid-session:

/cd ../my-project-feature-branch
/cd /absolute/path/to/directory

Use Case: Git Worktrees

This is especially useful for git worktree workflows:

~/projects/my-app/                    # main worktree (master)
~/projects/my-app-feature-xyz/        # feature worktree
~/projects/my-app-bugfix-123/         # bugfix worktree

Users often need to:

  • Review a PR in one worktree
  • Switch to another worktree to continue different work
  • Compare implementations across worktrees

Currently, each switch requires restarting Claude Code entirely.

Expected Behavior

user: /cd ../my-app-feature-xyz

Claude: Working directory changed to /Users/me/projects/my-app-feature-xyz
        
        This directory contains:
        - Branch: feature/xyz
        - 3 uncommitted changes
        - PR #123 (open)

Alternatives Considered

  • --add-dir flag: Allows access to multiple directories but doesn't change the primary working directory
  • Session resume: Doesn't help when switching between unrelated directories/worktrees

Additional Context

  • Sessions could optionally persist history when changing directories
  • The command could show a brief summary of the new directory (git status, branch info)
  • Could integrate with existing worktree tooling

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗