No way to configure shell working directory for multi-project sessions
Summary
When Claude Code is launched from directory A but the work session spans directory B (added as an additional working directory), the shell CWD stays anchored to A with no configuration option to override it. This creates a risk of files being written or commands running in the wrong project.
Steps to reproduce
- Launch Claude Code from
/home/user/project-a - Add
/home/user/project-bas an additional working directory - Ask Claude to run shell commands or write files scoped to project-b
- Observe: the shell CWD remains
/home/user/project-a; the permission dialog confirms this by offering "don't ask again for similar commands in project-a"
Expected behaviour
A setting (project-level .claude/settings.json or global) that pins the shell working directory to a specified path, independent of where the session was launched.
Actual behaviour
Shell CWD is inherited from the OS at launch time and cannot be overridden by any current setting. permissions.additionalDirectories controls permission scope only, not CWD. A SessionStart hook cannot fix it because hooks run in subshells — a cd there does not affect the parent shell.
Workaround
Use absolute paths in every shell command. This mitigates file-placement risk but does not fix the permission dialog showing the wrong project, and requires discipline to maintain consistently.
Suggested fix
Add a workingDirectory field to the settings schema (project or global scope) that sets the shell CWD at session start, regardless of launch location.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗