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.
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
MessageActionsinsrc/features/chat/components/message-item.tsxcan prepend the entire message as a Markdown quote through theatlas:chat-replyevent.MessageInputalready owns non-destructive draft insertion and focus throughatlas:chat-insert.Acceptance criteria