[FEATURE] Allow VS Code commands to accept a `prompt` parameter for extension-to-extension integration

Status Open
Maintainer reply None cached
Activity 3 comments · opened Apr 1, 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

Currently, there's no reliable way to programmatically send a prompt to Claude Code from another extension.

What I tried:

  • vscode.commands.executeCommand('claude-vscode.sidebar.open') - opens the sidebar but accepts no prompt parameter
  • vscode://anthropic.claude-code/open?prompt=... - pre-fills the prompt but always opens a new tab (not the sidebar), and doesn't submit
  • Clipboard workaround - copies the prompt and tells the user to paste. Works, but poor UX

Proposed Solution

Add an optional prompt parameter to claude-vscode.sidebar.open (and other open commands):

// From another VS Code extension:
await vscode.commands.executeCommand('claude-vscode.sidebar.open', {
  prompt: 'Implement the auth module...',
});

### Alternative Solutions

Alternative would be using an URI option and add the sidebar instead of new tab.
vscode://anthropic.claude-code/open?prompt=..&location=sidebar

### Priority

High - Significant impact on productivity

### Feature Category

Developer tools/SDK

### Use Case Example

I'm building a VS Code extension ([TaskPlanner](https://marketplace.visualstudio.com/items?itemName=refined.taskplanner)) that generates task implementation prompts and dispatches them to Claude Code. 
When a user clicks "Implement with AI" on a task, the extension composes a detailed
prompt including the task description, priority, tags, and workflow steps, then needs
to hand it off to Claude Code.

### Additional Context

Cursor added this capability in v2.3 (January 2026) after a
[community request](https://forum.cursor.com/t/a-command-for-passing-a-prompt-to-the-chat/138049).
VS Code's built-in Copilot Chat also supports it via
`workbench.action.chat.open` with a `prompt` argument.

View original on GitHub ↗

3 Comments

swasti7 · 5 months ago

This is a major pain point.

I need to programmatically dispatch prompts to Claude, but the URI approach forces a new panel while the sidebar command ignores the prompt argument. I am essentially stalled until the sidebar command supports prompt.

swasti7 · 5 months ago

Is there a workaround until this is supported?

gorynychzmey · 1 month ago

+1 on this. Adding a data point and a partial workaround for @swasti7's question, since the two paths behave differently at the last step.

Answering "is there a workaround until this is supported?": partially, yes — you can get as far as a pre-filled prompt without any user interaction, but not the submit.

What I traced in the bundled extension (2.1.267, so this is reverse-engineered from the minified bundle rather than documented behaviour):

  • The URI route lands on claude-vscode.primaryEditor.open(session, prompt), which calls createPanel(sessionId, prompt, ...).
  • In the webview the prompt is consumed as setInputText(prompt) and then immediately cleared. There is no submit/send call on that path — this is where auto-submit is missing, not in the URI layer.
  • The only autoSubmit in the bundle belongs to voice mode (hold-to-talk) and is unrelated to the URI prompt.

So the current ceiling is "new tab + pre-filled input, waiting for Enter".

One extra note that may help others scripting this: the openExternal flag on the code CLI is gated behind a WSL-only check, so on plain Linux (I hit this over a VS Code remote tunnel) code --openExternal is unavailable. Writing to the IPC socket directly still works:

node -e '
const http=require("http");
const req=http.request({socketPath:process.env.VSCODE_IPC_HOOK_CLI,
  path:"/",method:"POST",
  headers:{"content-type":"application/json"}}, r=>r.resume());
req.end(JSON.stringify({type:"openExternal",
  uris:["vscode://anthropic.claude-code/open?prompt=" + encodeURIComponent("...")]}));
'

That reaches the handler fine — it is genuinely just the submit that is missing.

My use case is the same shape as the original report: driving a second Claude Code session from a script, where requiring a manual Enter defeats the point. A prompt parameter on the commands (or an explicit opt-in submit flag on the URI) would close this.