[BUG] wrong working directory

Resolved 💬 2 comments Opened Aug 3, 2025 by jlb0170 Closed Aug 3, 2025

Environment

  • Platform (select one):
  • [ ] Anthropic API
  • [ ] AWS Bedrock
  • [ ] Google Vertex AI
  • [X] Other: claude code on a mac
  • Claude CLI version: 1.0.67 (Claude Code)
  • Operating System: macos ventura 13.7.5
  • Terminal: iterm2

Bug Description

not sure, but i had it in one directory (firehouse-rl) for one project, and wanting to start something new, i quit claude and started it in the other directory (sunnyside), and it can't seem to start up properly or switch to the current directory even when asked.

Steps to Reproduce

i don't know if it matters, but i had claude installed as a local npm package first, and then global (i noticed that doctor wasn't working), and then when i noticed this happening i also removed the npm local package. now doctor gives this:

$ sudo claude doctor

 Claude CLI Diagnostic
 Currently running: npm-global (1.0.67)
 Path: /usr/local/Cellar/node/24.1.0/bin/node
 Invoked: /usr/local/bin/claude
 Config install method: unknown
 Auto-updates enabled: true
 Update permissions: Yes
 Press Enter to continue…
 jeffbay@JEFFs-iMac:~/src/firehouse-rl (main) $

i don't know if i should need to use sudo to run it, but it seems hinky. 

Expected Behavior

for claude to be in the sunnyside folder

Actual Behavior

started from a different project directory to start something new and it went back to a different project instead of just starting in the new cwd. it also did it even when corrected, which is a problem i've been having with claude a lot.

Additional Context

jeffbay@JEFFs-iMac:~/Documents/compliance/sunnyside $ claude
╭───────────────────────────────────────────────────╮
│ ✻ Welcome to Claude Code!                         │
│                                                   │
│   /help for help, /status for your current setup  │
│                                                   │
│   cwd: /Users/jeffbay/src/firehouse-rl            │
╰───────────────────────────────────────────────────╯

  ↑ Connect Claude to Cursor · /ide

> why did your cwd not start this session from the director i just ran from?

⏺ The working directory shown in my environment (/Users/jeffbay/src/firehouse-rl) should
  match where you ran Claude Code from. If it doesn't match your expected directory, it could
   be because:

  1. You ran claude from a different directory than intended
  2. There's a configuration setting that changed the working directory
  3. You have a shell alias or script that changes directories

  You can check your current directory with:

⏺ Bash(pwd)
  ⎿  sourced jbay bash profile from ~/.bash_profile
     run jeff-bloke/bash/common.aliases
     /Users/jeffbay/src/firehouse-rl

⏺ The current directory is /Users/jeffbay/src/firehouse-rl. Is this different from where you
  expected Claude Code to start?

> yes, i just ran it from ~/Documents/compliance/sunnyside to work on a different project - i
   expect claude to start with the cwd of the directory i start the binary from

⏺ You're absolutely right - Claude Code should start with the working directory from where
  you launched it. Starting in /Users/jeffbay/src/firehouse-rl when you ran it from
  ~/Documents/compliance/sunnyside is definitely unexpected behavior.

  This sounds like a bug with Claude Code's directory initialization. You should report this
  issue at https://github.com/anthropics/claude-code/issues since the CLI should respect the
  directory you launch it from.

  For now, you can navigate to your intended directory:

⏺ Bash(cd ~/Documents/compliance/sunnyside && pwd)
  ⎿  sourced jbay bash profile from ~/.bash_profile
     run jeff-bloke/bash/common.aliases
     /Users/jeffbay/Documents/compliance/sunnyside
  ⎿  Shell cwd was reset to /Users/jeffbay/src/firehouse-rl

⏺ That's strange - the shell is being reset back to the firehouse-rl directory. This
  definitely confirms there's an issue with Claude Code's directory handling that should be
  reported as a bug.

View original on GitHub ↗

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