Skip to content

Inline comments on plans and .md files → attach to composer → send to agent #56

Description

@Daniel-tabz

This was generated by AI during triage.

Summary

Add the ability to leave inline comments on plans (and on .md files in the codebase) by selecting/hovering text, typing a comment in a small popup, and attaching those comments to the chat composer. The collected comments can then be sent to an agent as actionable feedback to revise the plan/spec.

This mirrors the "review comments" UX people know from Google Docs / GitHub PR review, but wired directly into Helmor's agent loop: comment on the plan → send → agent fixes the plan.

Motivation

Today, when an agent produces a plan (plan-review card) or when a .md spec/plan lives in the repo, the only way to give feedback is to write a free-form prose message describing what to change and where. This is imprecise and slow:

  • You have to re-describe which part of the plan you're talking about ("in the third bullet under Migration…").
  • Multiple small notes get squashed into one paragraph.
  • The agent loses the anchor between your comment and the exact text it refers to.

Spec-driven development is increasingly common: teams keep plans and specs as .md files and iterate on them. A precise, inline, comment-to-agent flow makes reviewing and revising those documents dramatically faster.

Proposed UX

  1. Select text in a rendered plan or markdown document. On selection (or on hovering the selection), a small inline affordance appears — an icon/button (e.g. a comment bubble) near the selection.
  2. Click the icon → a small popup with a text input appears, anchored to the selection. The user types their comment ("make this step optional", "this is wrong, we use X not Y", etc.).
  3. Submit the comment → it becomes an attached comment "chip" on the chat composer, showing the quoted/anchored text + the user's note. The original selected text stays highlighted to show it has a pending comment.
  4. Repeat for multiple selections — several comments can be queued, each anchored to a different span.
  5. Send to agent → all queued comments are bundled into the prompt sent to the agent, with enough anchoring context (the quoted span + comment + source: which plan or which file/path) for the agent to locate and revise the right text.

Where it should work

  • Agent plan content rendered in the chat thread (the plan-review card / assistant markdown).
  • .md / .markdown / .mdx files opened in the codebase editor — both the rendered preview mode and ideally source mode. This is the spec-driven use case.

Relevant code (pointers for implementation)

Markdown rendering is centralized, which makes a single shared selection/comment layer feasible:

  • Markdown renderer (shared by chat + editor preview): src/components/streamdown-loader.tsx, src/components/streamdown-components.tsx
  • Plan rendering: PlanReviewCard in src/features/panel/message-components/content-parts.tsx, type guards in src/features/panel/message-components/shared.ts, assistant markdown in src/features/panel/message-components/assistant-message.tsx. Plan parts already carry metadata (plan markdown, planFilePath, allowedPrompts).
  • Markdown editor surface: src/features/editor/index.tsx; EditorViewMode ("source" | "preview") and isMarkdownPath() in src/lib/editor-session.ts. Preview mode reuses LazyStreamdown.
  • Composer + attached chips/badges (the model for comment chips): src/features/composer/index.tsx, the context-bar chip strip src/features/composer/context-bar/index.tsx, and inline decorator/badge nodes (file-badge-node.tsx, custom-tag-badge-node.tsx) + src/components/inline-badge/index.tsx.
  • Sending to agent: AgentSendRequest in src/lib/api.ts (already supports files, images, pastedTexts ranges) and startAgentMessageStream(). A new comments? payload (quoted span + note + source anchor) would slot in here, plus the matching Rust AgentSendRequest in src-tauri.
  • Popover/selection UI primitives available: src/components/ui/popover.tsx, tooltip.tsx, hover-card.tsx, context-menu.tsx. No global text-selection toolbar exists yet — this feature introduces one.

Open questions / scope to refine

  • Anchoring strategy: how robustly do we map a selected span back to source text the agent can find? For plans, quoting the exact text may be enough. For .md files, include the file path + quoted span (and maybe line numbers in source mode).
  • Comment persistence: are queued comments ephemeral (cleared after send) or do they persist on the message/file until resolved? MVP can be ephemeral, attached only to the composer.
  • Source vs preview in the editor: Monaco has its own selection model — supporting source mode may need a Monaco-specific affordance vs. the DOM-selection affordance used in rendered markdown.
  • How comments are serialized into the prompt so the agent reliably edits the right plan/spec.

Suggested MVP

  1. DOM text-selection → floating comment icon → popup input, scoped to rendered plan content in chat first.
  2. Submitted comments become composer chips (reuse the context-bar/inline-badge pattern), each showing quoted text + note.
  3. On send, serialize comments into the agent prompt with quoted-span anchoring.
  4. Follow-up: extend the same affordance to .md preview mode in the editor, then source mode.

Labels

enhancement

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