Repository navigation
Comments
A comment ties a note to the part of a file or pane it refers to. This gives Canopy one shared representation for selections, browser elements, image regions and PDF pages.
Each comment has one typed anchor:
| Anchor | What it refers to |
|---|---|
| Text | A quoted span and its start and end UTF-8 byte offsets into the target's content. |
| Region | A rectangle in a pane or image. |
| Element | A browser selector and its rectangle. |
| Page | A page number and rectangle in a PDF. |
| Page quote | A quoted passage and occurrence on a PDF page. |
Comments also have an identifier, creation time and text. Canopy formats them as plain text before putting them into an agent prompt. A text comment uses @<absolute path> on its own line, followed by the selected quote and the note. The quote identifies the passage; Canopy's stored UTF-8 byte offsets are not shown as line numbers.
Canopy stores each target's comments in a JSON file under ~/.config/canopy/comments. If HERDR_APP_HOME points to another app home, the comments live there instead. The store uses persist::write_atomic so an interrupted write cannot leave a partially written comment set.
For files, plans, PDFs and images, the store hashes the content bytes with SHA-256. If a plan changes, its old comments are cleared. If another text file changes, Canopy searches for each comment's quoted text near its previous location and moves the anchor there; it drops a text comment if the quote no longer exists. Browser and simulator targets do not have a file revision.
A comment may have a screenshot still. Its path is stable for that comment and stays inside the app home's comments/stills folder, so restoring the comment also restores its image. The store exposes cleanup for a still when its comment is sent or deleted.
A mod can inspect comments already loaded for a pane target and ask Canopy to add or send comments:
const target = { kind: "plan", value: "/work/docs/plan.md" };
const comments = paneComments(target);
addPaneComment(target, { kind: "text", start: 120, end: 145, quote: "Check the retry behavior" }, "Please cover the offline case too.");
sendPaneComments(target, "t4"); // send the full set to t4
if (comments[0]) sendPaneComments(target, "t4", comments[0].id); // send one loaded commentpaneComments returns the loaded comments for that target, or an empty array when none are loaded. addPaneComment and sendPaneComments queue the normal Canopy UI action; Canopy reports action errors with a toast. The target uses the same tagged shape as the stored data (kind plus value), and anchors use the shapes above. See herdr.d.ts for the TypeScript declarations.
The shared sender pastes each saved still, then the formatted text, into the chosen agent's prompt. If the agent is waiting for approval, Canopy stops and asks you to handle it first. After the prompt changes, Canopy waits for it to settle before pressing Enter. If the prompt changes after the paste but before submission, Canopy reports that the text is present but unsent, so you do not accidentally send it twice.
These pages come from docs/wiki. Change them with a pull request. Edits made on the wiki are overwritten.
Get started
Guides
The canvas
Panes
Agents
Make it yours
Reference
Help