github →

New request

#2543: Add named context blocks for multiple text selections

We'll provision a sandbox, run an agent against the issue, and open a draft PR. You can pull the branch and iterate from there.

Issue
enhancementux

Following up from #2481.

The new “Reply with selection” feature is already very useful, especially with multiple selected passages. I’d like to propose a more productized version for handling multiple selections in the composer.

Use case

A common scenario is selecting several different parts of a conversation, then writing one follow-up message that refers to each of them separately.

For example:

  • select one paragraph from an earlier assistant message
  • select a different paragraph from another message
  • select an error message or code snippet
  • then ask something like: “Compare the first two, and explain how the error relates to them.”

With the current blockquote approach, this works, but multiple selections are merged together visually, so it becomes hard to tell where one selection starts or ends.

Proposed UX

Instead of inserting all selections directly as one long quoted block, the composer could show them as separate context blocks above or inside the input area.

For example:

  • Selection 1
  • Selection 2
  • Error message

Each block could:

  • show a short preview by default
  • expand to show the full selected text
  • be removable before sending
  • be renameable, e.g. “Selection 1” → “error message” or “install instructions”

Referring to selections

A nice follow-up would be the ability to reference these blocks in the prompt, for example with @selection-1 or @error-message, ideally using autocomplete.

That would make it easier to write prompts like:

Compare @selection-1 and @selection-2, then explain how @error-message relates to them.

Possible MVP

To keep the first version simpler, the UI could manage the selections as separate blocks in the composer, but still flatten them to regular Markdown blockquotes when the message is sent.

So the model/provider compatibility could stay the same initially, while the user gets a much clearer interface for managing multiple selections.

Later, this could evolve into structured context if that makes sense.

Assessmentadvisory
feature●● medium80% confidence

Implementing detachable, nameable context blocks in the composer requires new UI components, selection state handling, and composer interaction logic.

Likely files
  • static/js/composer.js
  • static/js/chat_canvas.js
  • static/css/dark-theme.css
  • static/index.html
  • static/js/context_manager.js
Create the request

This opens a fresh agent run and a draft PR for issue #2543.

Cancel