Add newConversationWithPrompt(prompt: string) and submitCurrentInput() for extension-driven session automation

Resolved 💬 1 comment Opened Apr 17, 2026 by HardenedDiscipline Closed May 25, 2026

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:

  1. Cursor CLI overview documentation (documents the same pattern at the CLI layer): https://cursor.com/docs/cli/overview
  2. Cursor CLI parameters reference: https://cursor.com/docs/cli/reference/parameters
  3. 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

  1. 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.
  2. Bug-tagging workflow: a /bug command fires a background task; when it completes, the extension opens a new session seeded with the bug report context.
  3. 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: newConversationWithPrompt alone is sufficient for the session-closeout case (the most common automation scenario).
  • Ideal surface: adding submitCurrentInput enables 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

  1. Activation: both commands available once the extension host loads the Claude Code extension.
  2. Return semantics: Promise<void> resolves after the prompt is visible in the webview input (for newConversationWithPrompt) or after submission completes (for submitCurrentInput). Rejects on webview-not-ready with a typed error.
  3. 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.

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗