Add claudeCode.workingDirectory VS Code setting for multi-root workspaces
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
In a multi-root VS Code workspace, the extension always uses the first folder as the working directory. There is no way to override this.
My workspace has 40+ repos under a shared parent directory (~/Development/MyProject/), with shared Claude context (CLAUDE.md, .claude/, memory) in that parent directory. The .code-workspace file lives there too. But the extension always starts in the first listed folder, so:
- Sessions created from the CLI in the parent directory don't appear in
/resume - Project-level memory is scoped to the wrong directory
- CLAUDE.md discovery starts from the wrong root
Attempted workarounds (all failed)
claudeCode.claudeProcessWrapperwith a script thatcds to the parent beforeexecing claude — the wrapper runs andcdsucceeds (verified via logging), but the extension sends the working directory over the JSON stream protocol after spawn, overriding it- Adding
"."as the first workspace folder — causes VS Code to scan all subdirectories, discover every nested git repo, duplicate folders in the explorer, and slow everything down significantly - Opening the parent folder directly instead of using a workspace file — breaks git behavior in sub-repos
Proposed Solution
Add a claudeCode.workingDirectory VS Code extension setting:
{
"settings": {
"claudeCode.workingDirectory": "/Users/me/Development/MyProject"
}
}
This would let users explicitly set the working directory independent of the workspace folder list.
Alternatively, respecting terminal.integrated.cwd from the workspace file would also solve this (as suggested in #24739).
Related issues
- #12808 — OP wants active-file-based folder selection (different ask, but same underlying inflexibility)
- #24739 — requested respecting
terminal.integrated.cwd(closed as duplicate of #12808) - #29825 — multi-root workspace support
Priority
High - This is a blocker for my workflow
Feature Category
IDE Integration
Use Case Example
Multiple independent repos (40+) under a shared parent directory, each in its own git repo, managed via a .code-workspace file. Shared Claude context (CLAUDE.md, .claude/, memory) lives in the parent directory alongside the workspace file.
Additional Context
Claude Code v2.1.81, macOS, VS Code multi-root workspace
4 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
Workaround found — adding the parent directory as the first workspace folder, with a
.vscode/settings.jsonat the parent root to hide subdirectories:.code-workspace:<parent-dir>/.vscode/settings.json:Note: per-folder
settingsinside workspace file folder entries are silently ignored — you need.vscode/settings.jsonin the folder itself.git.autoRepositoryDetection: falseandgit.repositoryScanMaxDepth: 1prevent VS Code from scanning all subdirectories for.gitrepos. The.vscode/settings.jsonexcludes keep the explorer, search, and file watcher from indexing everything under..This makes the extension use the parent directory as its cwd, so CLAUDE.md discovery, memory, and session resume all work correctly. Not ideal — a
claudeCode.workingDirectorysetting would be much cleaner — but functional.I vote for this: making a parent directory first breaks other tools in my case, so I would really ask to support this option.
Sharing a related pain point that stems from the same root cause:
Even if claude config living in a single working directory is acceptable, the problem is that a session has no concept of a VS Code workspace (.code-workspace file). VS Code workspaces let you group multiple unrelated repositories/folders into a named context — and that grouping is persistent across window reloads.
Since Claude Code sessions are tied to a directory rather than a workspace, any additional repos or folders that the agent needs to be aware of are lost when the session or VS Code window is reloaded. You have to manually re-add them every time.
Expected behavior: Starting a session from a VS Code workspace should restore the full set of workspace folders automatically, so the agent has the right context without manual re-configuration on every reload.