Skip to content

Let users cite selected agent-output text in a follow-up prompt #74

Description

@uzayer

Problem

Users cannot directly reference a precise passage from an agent response. Atlas offers a whole-message Reply action and the Knowledge Base already supports “Send selection to chat,” but highlighting text inside a rendered agent message has no contextual action.

Existing implementation

  • MessageActions in src/features/chat/components/message-item.tsx can prepend the entire message as a Markdown quote through the atlas:chat-reply event.
  • MessageInput already owns non-destructive draft insertion and focus through atlas:chat-insert.
  • The Knowledge editor’s bubble menu already extracts a text selection and sends it to agent chat.
  • Agent output is rendered through the Markdown cache / sanitized HTML path, so the selection UI must coexist with links, code copy controls, streamed output, and virtualized messages.

Acceptance criteria

  • Selecting non-empty text in a completed agent response reveals a small, contextual Cite action near the selection.
  • Activating Cite appends a quoted/reference-formatted version of exactly the selected text to the active chat composer, preserves any existing draft, and focuses the composer.
  • The citation format is readable to the agent and clearly distinguishable from the user’s new instruction; include a source hint only if it is stable and useful.
  • Do not show the action for selections in user messages, UI chrome, or transient/streaming output unless that path is explicitly supported.
  • It works for prose, code blocks, and multi-line selections; it does not interfere with selecting/copying text, links, Markdown actions, or virtualized scrolling.
  • The action is keyboard-accessible, positions safely inside the panel viewport, and dismisses predictably when the selection collapses or focus changes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions