Repository navigation
Description
What I'd like to build
Review a change inside bb before a PR exists: read the diff in the thread's diff panel, leave comments anchored to lines, and hand them to an agent as work.
Today that loop leaves bb. An agent changes something, I read the diff, then either describe the problem in prose ("in session.ts, the TTL thing") or push a branch and review on GitHub. "Add to chat" comes closest: it quotes lines into the composer, but nothing persists, nothing is anchored, and there is no open review item.
Prior art: Orca.
Why it fits the diff panel
Most of the substrate exists:
DiffFilesPanel→DiffFileCard→GitDiffCardBodyrenders@pierre/diffs'sFileDiff, with virtualization, merge-base handling, and patch paging.usePierreLineSelectionActionsdoes line-range selection, the gutter utility button, and an anchoredTimelineSelectionMenu, with one action today: "Add to chat".@pierre/diffssupports inline annotations and we don't use them.FileDifftakeslineAnnotationsplusrenderAnnotation(annotation)and projects the returned React subtree into a shadow slot namedannotation-<side>-<lineNumber>. Pierre is a code review product, so we already depend on the primitive.
Missing is the comment model: storage, an anchor that survives edits, and a way to turn a comment into agent work.
Prototype
Two things I couldn't get from reading code: can that slot host a real interactive thread, and does a line selection convert to a stable anchor?
poc/inline-review, ~250 lines across 4 new files and 4 edited. UI only: comments live in localStorage and "assign" inserts a composer draft. A prototype, not a merge candidate.
The slot works: a focusable textarea with buttons renders inline between diff rows, split and unified, with the library reserving row height. Verified in a browser against the running app.
The loop closes: comment on a line, agent edits the code. Verified against a live claude-code thread and real checkout.
Anchoring naively misleads agents. The panel renders unified at real widths, where a modified line is one row carrying the OLD line number and the library reports side: "deletions". Anchoring that verbatim cited and quoted the removed line. An agent flagged it unprompted: "The comment was anchored to the deletion side of the diff … but the intended target was the replacement line."
Fixed on the branch. A deletion-side anchor resolves to the new-file line: a context line carries both numbers, and a replaced line pairs positionally, Nth deletion to Nth addition of its change block. A deletions anchor survives only for a genuinely removed line, where the prompt says so instead of citing a number that means something else. Unified and split now agree.
That last one is why I want alignment first: it is the anchor format, and it gets expensive to change once comments persist.
The decision I need
Is the reviewable unit the environment or the pull request?
The prototype uses the environment: a thread's checkout or worktree diffed against its merge base, where agent work lands and which predates any PR. Comments key on environmentId, not a thread, since several threads can share one.
Scoping to a PR instead overlaps the GitHub plugin. If you want both, do they share one comment store with different diff targets, or stay separate? This decides the schema.
Rough shape
- Line-selection enablement becomes a capability set instead of deriving from
onSelectionAddToChat, andGitDiffCardBodypasses annotations through. Core only, no feature, and it isolates churn in a component that also backs timeline diff cards. - Server-owned comments with SDK and
bb reviewCLI surfaces, no UI.localStoragecomments can't be read by an agent, which is half the value; server-side, an agent reads its own environment's open comments before any UI exists. - The UI, ported off
localStorage. - Re-anchoring: re-resolve stored anchors against a fresh patch, mark outdated ones. Least understood part.
- Assignment:
threads.sendinto the owning thread, orthreads.spawna child per review. Today's "assign" is only a composer draft.
Other questions
- Should
diffSelectionActionand diff annotations become plugin slots? The GitHub plugin would want the same hook. I'd defer until the core shape is proven. - A comment on a removed line has no code to edit. Keep it and say so in the prompt, or refuse to assign it?
- Anchoring to the post-change file means clicking a context line in split view's left column renders its thread in the right column. Correct for handoff, but not where the user clicked.
If you don't want inline review in core, fine: the prototype was cheap and the annotation-slot finding is useful regardless.
Activity
lanjak commentedon Nov 21, 2026
Hi, I'd like to build this. Your prototype answered the hard parts, so here is the anchor format I plan to use before anything persists. Objections welcome before I start.
Checked against main at 4e45c9bc12, where the Diff tab, Viewed marks and
bb gitnow live in the bundled Git plugin (#6157, #6165).Reviewable unit: the environment. Comments key on
environmentId, as in your prototype. They show on every Git plugin target (uncommitted, branch, all, commit), so a commit does not hide them. Comments on the GitHub plugin's PR view (no environment) come later, on the same Diff props.Storage: the Git plugin database, next to Viewed marks. No core schema change.
Anchor, stored once and never rewritten:
path,side(neworold),start_line,end_lineanchor_lines: the exact code, max 50 linescontext_before/context_after: up to 3 lines eachanchor_blob: the blob id of that side when the comment was madeSelection to anchor: your rule. A context row uses the new number. A modified row in unified view pairs with the Nth addition of its change block.
side: "old"only for a genuinely removed line, and the prompt says so.Re-anchoring on read, computed and not stored:
anchor_lines, score matches by context, then by distanceDelivery: one "N review comments" chip in the composer, resolved at send through the existing plugin mention path (the one agent-annotations uses). The CLI sends the same mention. The agent closes each comment with
bb git comments resolve <id> --note "...".API: selection actions and line annotations become
experimental_props on the pluginDiff, and core's Add to chat moves onto the same selection-action list.On your other questions: comments on removed lines are kept and labelled as removed in the prompt. A context line clicked in split view's left column renders on the right, as you describe.
lanjak commentedon Nov 21, 2026
Prototype: main...lanjak:bb:diff-comments-3-ui (three stacked commits on 35a03bbbb3). It uses the anchor format from my comment above, unchanged. No PR until we agree on the feature.
The three commits match the split I'd propose for PRs:
diff-comments-1-core: a selection-action list that core's Add to chat and plugins share, selection-to-anchor mapping, andexperimental_selection-action and line-annotation props on the pluginDiff, with audit and Plugin Guide entries.diff-comments-2-server: comments in the Git plugin database, re-anchoring on read (cached by blob id), batches, a mention chip resolved at send, andbb git comments list|add|send|resolve|reopen. Agents can use it without any UI.diff-comments-3-ui: inline comment cards, a Comments list with filters, and Send.Details that go beyond the format I posted:
Checked live in a dev bb with a real Claude Code thread:
Not checked yet: the iOS Simulator drawer (only a touch-emulated Chromium so far), and the desktop and mobile apps.
lanjak commentedon Dec 2, 2026
Update: I rebased the prototype onto 4d7a9af609. Same link: main...lanjak:bb:diff-comments-3-ui (head
7a511f792d; the stack isdiff-comments-1-core0f70040708,diff-comments-2-server4828f00a50).TimelineSelectionMenuits ownactionslist. The diff selection actions now come in through a separateselectionActionsprop, and core's Add to chat uses the shared action, so plain text is trimmed as before on the diff side.