Add newConversationWithPrompt(prompt: string) and submitCurrentInput() for extension-driven session automation
Summary
The Claude Code VS Code extension would benefit from two public commands that enable reliable extension-driven automation of session creation and input submission. These complement the existing 21-command surface without changing existing webview behavior.
Motivation
Extension authors building companion tooling around Claude Code currently rely on chaining claude-vscode.newConversation + claude-vscode.focus with clipboard manipulation and OS-level keystroke simulation to seed a new conversation with an initial prompt. This works (Cline ships the same pattern) but carries OS-specific dependencies, focus-timing races, and fragility against clipboard collisions from other processes.
A direct-parameter command would eliminate all three failure modes and bring the Claude Code extension surface to parity with the Cursor 2.3 pattern.
Requested commands
// Creates a new conversation and seeds the initial prompt in one call.
claude-vscode.newConversationWithPrompt(prompt: string): Promise<void>
// Submits the current input field (equivalent to the user pressing Enter).
claude-vscode.submitCurrentInput(): Promise<void>
Peer-product precedent (proof of feasibility)
Cursor 2.3 introduced cursor.startComposerPrompt(prompt: string) after a community forum request for the same capability. Cursor's adoption demonstrates this pattern integrates cleanly with a webview-hosted chat UI and webview focus handling.
References:
- Cursor CLI overview documentation (documents the same pattern at the CLI layer): https://cursor.com/docs/cli/overview
- Cursor CLI parameters reference: https://cursor.com/docs/cli/reference/parameters
- Community forum thread confirming implementation: https://forum.cursor.com/t/a-command-for-passing-a-prompt-to-the-chat/138049
Expected extension-developer use cases
- Session-closeout automation: a companion extension detects a Claude Code session ending and programmatically opens a fresh session with a pickup line describing the next action. Zero user keystrokes between sessions.
- Bug-tagging workflow: a
/bugcommand fires a background task; when it completes, the extension opens a new session seeded with the bug report context. - Branching context from an active session: mid-session, a command forks a new session with the parent session's relevant state as the seed prompt.
Narrow vs. ideal surface
- Narrow surface:
newConversationWithPromptalone is sufficient for the session-closeout case (the most common automation scenario). - Ideal surface: adding
submitCurrentInputenables extension authors to handle cases where the prompt is prepared incrementally (e.g., mic dictation injecting text, then submitting separately). Both commands are pure additions — no existing behavior changes.
Integration notes
- Activation: both commands available once the extension host loads the Claude Code extension.
- Return semantics:
Promise<void>resolves after the prompt is visible in the webview input (fornewConversationWithPrompt) or after submission completes (forsubmitCurrentInput). Rejects on webview-not-ready with a typed error. - Security: no change to existing webview sandbox; the commands accept arbitrary string input, same as the user typing manually.
Our implementation
While waiting for this feature, we ship the composed pattern (watcher + clipboard + keystroke) as a private companion VS Code extension. We will switch to the official commands as soon as they land — the switch is a 10-line change isolated to a single module. Usage metrics from the composed-pattern v1 will be contributed back to this issue thread.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗