# Chat quotes and message editing

## Quote a selection

| Aspect | Rule |
| --- | --- |
| Shows | **Add to chat** above the selection, after the pointer is released or a keyboard selection completes |
| Hides | During dragging, on a new pointer press, on a cancelled selection |
| Result | Appends a Markdown blockquote to that conversation's draft and focuses its composer. Drafts and attachments stay; sending is explicit |
| Only route | The message action row has no Quote action |
| Owner | Each pane names its own session, so a quote lands in the pane it came from. Separate side-chat windows are out of scope |

**Toolbar look and icon**

- One compact action, 3 px outer padding, 8 px corners, subtle border and shadow, opaque theme-aware popover background.
- Hover and pressed states mix solid theme colours, never a translucent overlay. Keyboard focus has a visible outline.
- `QuoteIcon` is in the shared animated-icons set. The upstream [catalog](https://github.com/pqoqubbw/icons/tree/main/icons) has no Quote, so it uses the official Lucide glyph with the shared start/stop interface and the `CopyIcon` spring and translation.
- The whole button drives the animation on hover and keyboard focus; it resets when neither remains. Disabled controls and reduced motion get a static icon.

## Edit a sent message

| Aspect | Rule |
| --- | --- |
| Editor | Inline, with the bottom composer's text field, file mention picker, attachment processing and preview strip |
| Attachments | Existing ones can be removed; images and documents can be picked, pasted or dropped. URLs stay editable text |
| **Cancel** | Discards only the edit |
| **Save and resend** | Creates a sibling branch through `POST /api/chat/edit` |
| Failure | Keeps the edit and shows a retryable message |

**Storage and permissions**

- Uploaded bytes use the bounded attachment persistence and image dispatch path. Retained image copies are read through the authorized raw-file API; retained legacy attachment blocks stay lossless.
- No automatic submission and no new permission modes.

## Implementation status

Implemented. Browser tests cover quote draft preservation, split-pane ownership, inline attachment editing, failure retention and the icon under normal and reduced motion; REST tests cover edit attachment validation and dispatch.

The selection action follows a user-supplied Codex screenshot; no parity with another product is claimed.
