Add claudeCode.workingDirectory VS Code setting for multi-root workspaces

Status Open
Maintainer reply None cached
Activity 4 comments · opened Mar 21, 2026

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)

  1. claudeCode.claudeProcessWrapper with a script that cds to the parent before execing claude — the wrapper runs and cd succeeds (verified via logging), but the extension sends the working directory over the JSON stream protocol after spawn, overriding it
  2. 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
  3. 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

View original on GitHub ↗

4 Comments

github-actions[bot] · 5 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/12808
  2. https://github.com/anthropics/claude-code/issues/24739
  3. https://github.com/anthropics/claude-code/issues/18814

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

ffjeremy · 5 months ago

Workaround found — adding the parent directory as the first workspace folder, with a .vscode/settings.json at the parent root to hide subdirectories:

.code-workspace:

{
  "folders": [
    {
      "name": "MyProject",
      "path": "."
    },
    { "path": "repo-a" },
    { "path": "repo-b" }
  ],
  "settings": {
    "git.autoRepositoryDetection": false,
    "git.repositoryScanMaxDepth": 1
  }
}

<parent-dir>/.vscode/settings.json:

{
  "files.exclude": {
    "[a-z0-9]*": true,
    ".DS_Store": true
  },
  "search.exclude": {
    "[a-z0-9]*": true
  },
  "files.watcherExclude": {
    "[a-z0-9]*/**": true
  }
}

Note: per-folder settings inside workspace file folder entries are silently ignored — you need .vscode/settings.json in the folder itself.

git.autoRepositoryDetection: false and git.repositoryScanMaxDepth: 1 prevent VS Code from scanning all subdirectories for .git repos. The .vscode/settings.json excludes 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.workingDirectory setting would be much cleaner — but functional.

vheathen · 4 months ago

I vote for this: making a parent directory first breaks other tools in my case, so I would really ask to support this option.

manjunath-satyamurthy · 3 months ago

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.