Repository navigation
Description
Updated 2026-10-29: rewritten for the design as it works now on my fork. The first version of this description (inline cards with a Pending badge) is in the edit history; what changed is summarized in the comment below.
Problem
I work spec first: before an agent writes code, it writes a plan or a spec, and I review it. Most of my answers are remarks on single points ("batch this", "ask instead"). Today each one means:
- copy the passage
- paste it into the message box and quote it by hand
- write the remark under it
- repeat for every point
On a phone, that is a long-press selection, copy, scrolling down to the message box and paste, for every point. If I skip the quotes, the agent has to guess which remark belongs to which step. The same holds for a spec the agent wrote into a file, and for code.
Proposal
Comment on an agent's reply, a Markdown file or code the way a code review comments on a diff: select text, write a comment, and send all comments together with the next message.
Comment mode
- One toggle switches commenting on for the whole app: in the chat it sits at the top right (beside Find), in the file viewer in the header. Its badge counts the comments of this pane or this file.
- Off, text selects as it does today, with the system's selection and menu, for copying. Saved comments still show, read-only.
- On, a selection is a comment's text. Nothing in the chat moves while text is selected: no row joins the composer, the button floats over the text.
Writing a comment
- With a mouse, a pen or the keyboard (Shift+arrows), letting go of a selection shows a floating Comment button under it. Its click opens a small field at the selection, above or below it, so it does not cover the words it is about. Settings can open the field at once instead.
- Enter saves, Shift+Enter breaks the line. Leaving the field (Escape, a click outside) saves what was typed; an emptied comment is deleted. There is no Cancel.
- Several selections in one paragraph are several comments. One selection across several paragraphs or list items is one comment. User messages, a reply that is still streaming and the narration between tool calls take none.
- Every comment's text keeps a soft highlight (CSS Custom Highlight API, so the reply's DOM is not changed); where comments overlap, the text reads darker.
Where comments show
- Beside the text, in the free space right of it: cards in the margin where there is room, else counts beside the lines (a small speech bubble with the number). The text never moves or narrows for them.
- A click on a card or a count opens the comment to edit, in place. Pointing at one brings its text forward.
Phones and tablets
- In comment mode, a long press selects a word and shows two handles and a Comment pill where the system menu would be. This is the app's own selection: the system's Copy/Share menu cannot be turned off while keeping its selection. With the mode off, the system's selection is back.
- The comment is written in a bottom sheet that quotes the selected text.
Files
- Markdown preview: works as the chat does, with a selection.
- Code: a ⊕ beside the line number opens a field under the line (or a click on the line, as Settings say); arrows move the ⊕ for the keyboard. On a phone, a long press or a tap opens it, in a bottom sheet or under the line. The quote names the file and lines.
- Comments on files join the comments of the pane the file was opened from.
The message box and the comments panel
- A bar above the text says "2 comments on the reply". Its X removes them all.
- A tap on the bar opens the comments panel: every comment of the pane that goes with the next message, grouped by where it is (the reply, then each file), each with its quote, editable in place, deletable with Undo, and a link to its place. Docked beside the panes on a desktop, a sheet on a phone.
Sending
-
The next message sends the comments first, in reading order, each as a quote of its text and then the comment. The typed text comes after them, and a message may be comments alone:
> backfill it from updated_at Backfill in batches of 1,000, the table has 40 million rows. > docs/spec.md:14 > Older revision | 409 Conflict with the stored note Also return the stored revision, so the client can show what changed. > src/sync.ts:7-9 > if (incoming.revision < stored.revision) { Compare with <=, a replayed write reuses the revision. Go ahead with step 1. -
A slash command, or an answer to the agent's open question, goes without the comments. They wait for the next message, and the bar says "2 comments waiting".
-
Comments only ever go to an agent. In a pane without an agent, the typed text goes alone, because a shell would run
> quoteas a redirect. The submit carries anagent_onlyflag, and the server refuses it when no agent runs in the pane. A queued message keeps that rule, so it stays in the queue instead of being typed into a shell.
Storage
- Comments are kept per pane on this device, in localStorage. Reply comments and file comments share one store and one anchor model: the text (or lines) a comment is on, its offsets in the block, and the block's content.
- A comment shows only while its text still reads the same, so a changed reply or file never marks the wrong place. A comment whose text is gone stays in the panel with its quote.
Settings → Comments (a page of its own, all per device)
| Setting | Options | Default |
|---|---|---|
| Comments | the whole feature; turning it off with comments saved asks first and deletes them | On |
| When you select text | Show a Comment button · Open the comment field | Button |
| Comments beside the text | Cards in the margin · Counts beside the lines | Cards |
| Click a line to comment (code) | a click anywhere on a line, or only the ⊕ | Off |
| On mobile, comment with (code) | Long press · Tap | Long press |
| On mobile, write comments in (code) | Bottom sheet · Below the line | Bottom sheet |
Screenshots
From my fork's demo, dark theme. The demo has no file contents, so the files were filled in for the shots.
| Comment mode on: select text, a Comment button floats under it | The field opens at the selection |
|---|---|
![]() |
![]() |
| Saved: highlights, cards in the margin, the bar in the message box | A command: the comments wait |
|---|---|
![]() |
![]() |
| What the agent gets | No room for cards: counts beside the lines |
|---|---|
![]() |
![]() |
| Markdown preview in the file viewer (a count: the dialog has no room for cards) | Code: the ⊕ beside the line number, a saved comment under its line |
|---|---|
![]() |
![]() |
| The comments panel: the reply, then each file |
|---|
![]() |
| Phone: long press, handles and the Comment pill | Phone: the sheet | Phone: saved |
|---|---|---|
![]() |
![]() |
![]() |
What changes outside the client
- the optional
agent_onlyflag onsubmit, and asubmit-agent-onlyserver feature, inshared/protocol.tsandserver/core/composer.ts, with a contract test typed: falseon a submit or pending result when nothing reached the pane- the same answers from the demo transport
The comments themselves add no dependency.
Not in this issue
- A Git view (a repository's tree beside a file or its diff): my fork has one, and the comments work there the same way (a comment below shows it). The view itself is separate and would need its own implementation.
- Tags on comments (@vibewriter-hand's good / bad / adopt list): not built. The store has room for it.
Where
Chat, file viewer
Workarounds and alternatives
- Today: quote by hand in the message box.
- A comment button on each paragraph: the first version (feat(chat): comment on parts of an agent's reply and send the comments with the next message #409, closed) worked this way. It can only take a whole part, not half a sentence or several items, and a button per part adds noise to every reply.
- Cards inline under the paragraph (this issue's first description): they pushed the reply's text down on every comment.
- Quote in message (feat(chat): quote selected reply text into the editable draft #1845, removed in fix(chat): remove the reply Quote in message that shook the chat #1922): a row that joined the composer moved the chat while the selection was still being dragged. The floating button here takes no room.
- Sending each comment at once: this interrupts the agent once per remark. Collecting them, as a review does, keeps it to one turn.
Implementation
It is built on aNNdii/herdr-web-ui next, kept in sync with main (last merge: up to #2291). Most of it lives in files of its own (MarkdownComments.tsx, ChatComments.tsx, CommentMargin.tsx, CommentPopover.tsx, CommentsPanel.tsx, TouchSelection.tsx, lib/blockComments.ts, lib/fileComments.ts, …), with browser regressions (scripts/block-comments-regression.ts, scripts/file-viewer-comments-regression.ts), DESIGN.md sections and ko/ja/zh translations.
It is too big for one PR. If the shape is wanted, I would bring it in as a stack, each usable on its own:
- the store, the anchors and sending (
agent_only, the bar, the quotes) - comments on a reply in the chat (comment mode, selection, highlights, margin)
- touch: the app's selection and the sheet
- comments on files: the Markdown preview and code lines
- the comments panel and Settings → Comments
Questions:
- Is this shape (comment mode, a selection, comments beside the text, sent with the next message) what you want in the chat?
- Is the
agent_onlyflag onsubmitfine as the guard against sending quotes into a shell? - Would you take it as the stack above, or rather a different cut?












Activity
aNNdii commentedon Oct 14, 2026
Update: comments on code in the file viewer
The follow-up from "Later, not built yet" is built for code. It is on aNNdii/herdr-web-ui
feat/code-view-comments, merged into my fork'snextin aNNdii/herdr-web-ui#19. It doesn't use a text selection. It works like Claude's code preview: a ⊕ beside the line number opens a field under the line, and a saved comment stays in the code as a card. The Markdown preview keeps the selection, as described above.Comments on code join the pane's comment bar, the same bar as the chat's, and are sent with the next message:
How it works
shared/orserver/changes.Settings
Settings → File viewer gets a new Comments group. Like every comment feature, it follows the existing master switch in Settings → Chat → Comments: while that is off, the group is greyed out and links to it.
The comment mode itself is switched from the viewer's header, not from Settings, and is remembered per device like the other settings. All settings are per device, in localStorage, and translated into ko/ja/zh.
Long files (20,000 lines)
The viewer loads the first 256 KB of a file, so a 20,000-line file with short lines opens in full. Commenting has to stay fast there, and in the first version it didn't. The main changes:
<pre>.data-source-line, not from a CSS counter. With a counter, WebKit renumbered every later line, and Firefox recounted the whole file on every room.innerTextstay exactly the file's.content-visibilityand no virtualization: both broke Ctrl+F, copy orinnerText.The numbers are in-page timings on the demo. The iPad row was measured on a real iPad, on a lab page that uses the same technique.
Checked so far:
scripts/file-viewer-comments-regression.ts).Not checked yet: iPhone and VoiceOver.
Known limits:
devtm1123 commentedon Oct 20, 2026
Any updates?
devswha commentedon Oct 22, 2026
Status from the AoE borrowings plan run (2026-10-22)
Implemented a narrow first step on the local branch
feat/reply-selection-quote(2 commits, not pushed yet). It doesn't close this issue.What it does:
Verification: the work was independently reviewed and needs fixes. Still wrong:
Left to do: fix the above, get the visual reviews, then push and open a PR with
Refs #511(notCloses). The full comment workflow this issue describes is still a separate design decision.feat(chat): quote selected reply text into the editable draft (#1845)
vibewriter-hand commentedon Oct 26, 2026
I would like to add my use case to this issue.
I review plans, specifications, research notes and drafts before code is written, on a desktop and on a phone. Three sources matter to me: local Markdown and text files, documents an agent wrote, and selected passages in an agent's reply. For each passage I want a comment and a tag from a short list I maintain — good, bad, improve, reject, adopt — with editable names and order. The record has to stay useful before anything is sent: I want to revisit the passage, the comment and the tag, and then choose what goes into the next message.
I have read the 2026-10-22 status and the #1845/#1922 history. The selection must stay where it is: a composer row that moves the selected text fails the use case, and on the phone the native selection handles have to keep working.
Questions I would like to settle before code:
Tags are personal labels. They do not edit files, run commands or send anything by themselves.
Human Review is the closest reference I have found for quote anchoring and batched feedback, and its pure anchor functions may be reusable. Claude Docs shows the value of commenting on a passage of a document. Neither is a drop-in component, and I am not claiming either covers the storage model or the phone.
A Markdown notes panel is #1196 and the separate write API is #771; I am not mixing those into this issue.
I need this workflow for my own writing and review, so I intend to build it either way. If the scope fits upstream, I would rather contribute the reply-and-file comment path as a focused PR after the anchor and storage model are agreed, rather than land the whole feature at once. I am not asking for a promise to merge it whole.
phirschybar commentedon Oct 28, 2026
A data point from using the quick quote while it was on main (#1845), before #1922 removed it.
Selecting a passage in a reply and pressing Quote in message was the fastest way I've had to answer a plan point by point, and I'd like that step back. The removal was right for the version that shipped, though. The row joined the composer stack, so the chat moved while I was still dragging, and the selection grew or shrank under the pointer. I often ended up with more or less text than I meant to select.
That makes me agree with the point above: whatever comes back must not change the layout while a selection is in progress. A floating button drawn over the chat near the selection end (with a mouse, where the button was released, as the original proposal says) takes up no room, so nothing under the selection moves. On a phone it would sit clear of the selection handles and the system menu.
If the fuller comment workflow needs time to settle, a floating Quote in message that only appends to the draft could be a first step that later becomes the Comment entry point. Happy to help test either on desktop and phone.
aNNdii commentedon Oct 29, 2026
Update: the description now shows the current design
I rewrote the description above for how the comments work now on my fork, with new screenshots. What changed since the first version:
@devswha, the narrow first step from your 2026-10-22 status fits this: a floating Quote in message would sit where the Comment button is now, and could become it later.
@vibewriter-hand, on your questions, from what I have built:
The next comment shows the same comment flow in my fork's Git view, which is separate from this issue.
aNNdii commentedon Oct 29, 2026
The same comments in a Git view
On my fork, the comments also work in a review of a repository's changes: a Git view with the repository's tree beside a file or its diff. That view is separate and would have to be implemented on its own; it is not part of this issue. It is only here to show that the comment flow is the same there:
Select text on a line and press Comment: the same field opens, and a saved comment shows under its line.
The quote names the file and the line:
The comments join the same bar in the message box and the same comments panel, and go with the next message.
feat(chat): comment on selected reply text and send the comments with…
fix(chat): keep comments on a reply away from a shell on Edit, a vani…
fix(chat): keep an Edit's agent-only mark through a storage refusal, …
fix(chat): leave comments a send carries under the pane ID it went wi…
feat(chat): comment on selected reply text and send the comments with…
fix(chat): keep comments on a reply away from a shell on Edit, a vani…
9 remaining items
feat(chat): comment on selected reply text and send the comments with…
chore(release): 0.4.21 (#2422)
fix(chat): offer one comment action on a selection, the chat's annota…
feat(chat): quote a chat selection into the message box, Comment besi…
fix(chat): offer one comment action on a selection, the chat's annota…
fix(chat): offer one comment action on a selection, the chat's annota…
fix(chat): offer one comment action on a selection, the chat's annota…
fix(chat): offer one comment action on a selection, the chat's annota…
fix(chat): offer one comment action on a selection, the chat's annota…
refactor(src): drop comments the code can say, part 9 of 9 (#4076)
fix(chat): offer one comment action on a selection, the chat's annota…
fix(chat): offer one comment action on a selection, the chat's annota…
fix(chat): offer one comment action on a selection, the chat's annota…
fix(chat): offer one comment action on a selection, the chat's annota…