Skip to content

Extension API to read and restore the composer draft (unsent input) #5338

Description

@YippityOddity

Describe the feature or problem you'd like to solve

Extensions cannot read or restore the text the user is still typing in the input box (the composer draft), so an extension that changes the session on its own cannot protect the user's unsent input.

Proposed solution

Expose the composer draft to extensions, for example:

  • session.rpc.ui.getDraft() returning { text, attachments }, and session.rpc.ui.setDraft({ text });
  • and/or a debounced ui.draft_changed session event that extensions can subscribe to.

Extensions can already act on the conversation without the user. An extension tool can call session.history.clearContext to continue a long session in a fresh context window, which saves a lot on long agentic loops such as PR review rounds. Messages the user has already submitted are covered too: session.queue.pendingItems and queue.insertAt reach them, and they survive a clear.

The one piece of user input an extension cannot see is the draft still being typed. Being able to read and set it would let an extension snapshot the draft before a programmatic change and put it back afterwards, or save it to a file. Unsent text would then never be lost, whatever the CLI does to the composer on such a change now or in a later version.

Example prompts or workflows

  1. A context-switch extension (a terminal tool that calls history.clearContext when the context gets expensive) saves the draft just before the clear and restores it afterwards, while the user is mid-sentence.
  2. An extension autosaves the draft to a per-session file, so a crash or a stray keystroke never loses a long prompt.
  3. A prompt-template extension puts a template into the composer for the user to edit before sending.
  4. A companion integration keeps a draft in sync between a terminal and another client.

Additional context

Activity

  1. added
    area:input-keyboardKeyboard shortcuts, keybindings, copy/paste, clipboard, mouse, and text input
    area:pluginsPlugin system, marketplace, hooks, skills, extensions, and custom agents
    and removed on Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:input-keyboardKeyboard shortcuts, keybindings, copy/paste, clipboard, mouse, and text inputarea:pluginsPlugin system, marketplace, hooks, skills, extensions, and custom agents

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions