[FEATURE] `claude-vscode.editor.open`: expose cwd parameter to support per-session working directory in single-window setups
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
Problem
The VS Code extension spawns Claude with a fixed cwd = workspaceFolder[0]. Internally, spawnClaude() already accepts cwd as an override parameter — it just isn't exposed through any public command.
This blocks a class of workflows where multiple Claude sessions within a single VS Code window need to operate on different working directories — which is the natural model for our team doing parallel agentic work.
Proposed Solution
Expose cwd as an optional 4th argument to claude-vscode.editor.open:
vscode.commands.executeCommand('claude-vscode.editor.open', sessionId, prompt, viewColumn, cwd)
Since spawnClaude(cwd) already exists internally, this is a one-line change in the command registration. It will simplify VS Code + Claude orchestration a lot.
Alternative Solutions
Current workaround
A static CLAUDE.md at the workspace root that redirects Claude at session start:
Run `cat ~/.active-worktree` to get the real project root,
then read CLAUDE.md from that path and use it as your working root.
This works for new sessions but doesn't give true cwd isolation — git context, relative path resolution, and CLAUDE.md discovery all stay anchored to the workspace root.
Priority
High - Significant impact on productivity
Feature Category
Developer tools/SDK
Use Case Example
Team runs code-server (browser-based VS Code) on a shared lab server. Each user has one window, one workspace root (~/repos/project/). Opening new windows or multi-root workspaces is not viable — it breaks the single-folder display and multiplies resource usage per user.
We built git-switchd: a tool that manages git worktrees invisibly beneath the workspace root. When a developer switches to a PR:
git-switchd switch <branch> activates the corresponding worktree and syncs its files into the workspace root
Lab calls claude-vscode.editor.open(sessionId) to open or resume the Claude chat associated with that PR
The gap: step 2 opens the chat but Claude runs with cwd = ~/repos/project/ regardless of which worktree is active. With a cwd parameter:
executeCommand('claude-vscode.editor.open', sessionId, null, viewColumn, worktreePath)
each chat would operate against its own isolated directory. The user sees one window, one workspace, one chat per PR — Claude sees the right root for each.
Additional Context
related issues:
#58591 — --cwd on --resume
#36949 — claudeCode.workingDirectory setting
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗