# Plannotator A Plannotator button beside Files and Changes opens a tab in the side panel that says what is in the Plannotator Inbox — the questions, summaries and reviews agents left for the person. Each thread carries a dot for what it needs (yellow asks something, blue is new since the person looked, grey is read); any thread opens to read its messages in the panel, answer its questions by clicking their choices, mark the todo-style actions the agents left (Done, Can't do it, a note), and reply in words — with the files the agents attached to those messages drawn and readable there too. Under the threads sits the annotate list: the last message, the review, the space's folder, a file tree for picking one file or folder, and another folder from a picker — each starts a background `plannotator` session in the folder being worked in. A decision made in a Plannotator session lands as a Herdr toast the second it happens, panel open or not, because the panel's tab keeps running while it is hidden — and one that brought annotations back comes as the panel's own toast popup, the footer styled as a card with its three buttons on it. The view — the thread on screen, the folders open in the tree — sticks to its space and comes back with it. ![Plannotator](preview.png) ## What you see - The panel is a card in the side panel (368 px in the person's layout, Files and Changes' width), 13 px text in `foreground`, its content column capped at 760 px and centred; everything scrolls together and nothing floats but the palette and a row's menu. - **Header**: "Plannotator", a count chip for how many threads wait on the person, a magnifier button (the palette) and a page button (the Inbox). There is no cross — the tab bar's button is what puts the panel away. With a thread open, the header is a back chevron and the thread's subject, and the page button opens the Inbox on that thread. - **Threads**: up to five rows, each two lines — a 7 px dot in its bucket's colour, the project's name (in `accent` when it is the space's own project) and its age at 11 px; the subject at 13 px, one line. Yellow first, then blue, then grey, newest first inside each group. More than five: an "N more in the Inbox" row. An empty Inbox says "No threads yet"; a failed read adds its one-line error there. - **Annotate**: "Last message", "Review changes" and "This space" (with the space's folder in `~/…` form at its right), then a "Files · N" toggle that opens the space folder's tree — folders first then files, alphabetically, indented a step per level, a pen button on every folder's row, a file's row the action itself — and last "Another folder…". - **The row the keys are on** is filled `selected`; it starts on the thread that most needs the person, or "Last message" when the Inbox is empty. - **A thread, opened**, replaces the list as a page: a pinned crumb (project · age) with the thread's id copy, a read/unread toggle and an archive button at its right — the page's own calls (`threads//read`, `threads//mark-unread`, `messages//resolve` with the thread id in the message route, `{resolved: true}`), the envelope saying the state and the click asking for the other; mark read sets every open question with a skip answer aside the way the page's does, and an archived thread is in no bucket of the list, so the panel goes back to its own — a scrolling middle of messages — each drawn as markdown with its author line, the person's own boxed with a 2 px `accent` rule down the left — their questions as cards (a dot and the state in its colour, ringed choices, a "Recommended" chip on the choice it names, and an "Answer in the Inbox" row) and their `:::action` blocks as todo cards (the two marks Done and Can't do it, a Take back under a mark, the Where link, and the same dot and state), the reply band pinned at the bottom (the field grows 2→8 rows, Send goes live for words or a picked answer or a marked action, and the line under it says what the Send carries: "1 answer goes with this reply", "1 answer and 1 task"); the "Open in Inbox for picks and pictures" row is gone — the top bar's file-text button is the way there, its tooltip carrying the words, and Return's row with it. A comment on the words sits in that band above the field — the quote it stands for, its own words, and a ✕ — until the Send carries it. Pictures written into the words are drawn where they were written — between the paragraphs that were either side of them, as a thumbnail no taller than 240 px and no narrower than 130 — and a click opens the picture at its own size in a dialog over the window; the files an agent attached are the message's own: a picture drawn under the words with its name and size beneath it, and every other file a card the width of the column, drawn as the Inbox draws one: the kind's glyph in a square of its own, the name over "Markdown · 1.2 KB", a chevron at the end. Under the lot, a count — "3 attachments" — the way the Inbox heads its cards. Chips side by side read as tags, and a tag is the one thing on this page a person does not think to press. A click on either opens the file. A picture whose path is not a file any more is counted instead, and the count leads to the Inbox. A refused send says why in the Inbox's own sentence. - **The picture dialog** is the picture at its own size, over the window (no bigger than 820×560, shrunk to fit), with the name it was sent under, Esc and a cross in its top row — and one row under it: a pen and **Comment on this picture**, with "goes with your reply" at the right edge. That row closes the dialog and opens the comment's field under the picture in the thread, because a window the picture's own size has no room for one. - **A file, opened**, is a page of its own under the thread: the header is the back chevron and the file's name, a `dim` row under it says what kind of file it is, how big, and for a picture or a film its size in pixels and length, and the body is the file — a markdown document as the markdown it is, and code, a patch and every other text file in the code view: line numbers, its language by extension, and a scroll of its own rather than the panel's. A picture is drawn at the panel's width. Read-only: nothing here edits, downloads or uploads. The one write is a comment on the file — a row above the code view, the same row above a picture, and for markdown a press-and-release in a paragraph, as in a thread. A video is a row that plays it in the browser, and a web page is its source plus a row to the Inbox, which renders it; both say so. - **A comment, made**: a drag across a paragraph opens a "Comment" bar over the highlight's first line — which end that is comes from the two pointer positions, so a drag that ran upwards still opens over the top of the highlight — above the line, or under it when that is the paragraph's first line and there is no room above. A highlight that starts in one paragraph and runs into the next is a comment on the earlier of the two, with the bar at its end. One that ends in the air around a paragraph — no paragraph under the pointer — is still a comment, on the paragraph the drag started in: the bar is drawn at the press when the drag ran down into the air, and in the panel's own box, at the point the highlight reached, when the drag ran up into it (a release event's `bounds` are the box the handler is on, so the panel's own box turns a window position into a panel position). The bar itself is three targets in one surface — "Comment", a bin and a thumbs up — and the last two skip the field and stage the comment the field would have made ("Please delete this", "👍 Looks good"), which is the one-click path: the row lands in the band, and its ✕ is the way to take it back. The bar becomes a field under that paragraph: the quote it stands for above it, the words in it, Cancel and Comment, and Comment files it in the band below, keeping the paragraph for the person to go on reading. A click anywhere else is a highlight put away, and the bar goes with it. - **The palette** (520×340 at the pointer): a search line over six rows — Annotate the last message, Review my changes, Annotate all files, Annotate another folder…, Open the Inbox, Open Plannotator as a tab — each with the key that binds it where one does. Typing filters by subsequence. - **A tree row's menu** (right-click): annotate this file or folder, annotate all files, review changes here. - **The tab bar's button**: a pill at the right end of the bar, a page-with-a-check glyph and the label with a badge chip while the panel is closed, filled `selected` while its tab shows. A click or `cmd-alt-i` shows the panel on this tab; again hides it. ## How it behaves - **The button and `cmd-alt-i` are `tab-host`'s toggle.** Showing this tab takes two layout commands (`layout.select {stack, child}`, then `layout.show {id}`); a key can run only one, so the binding is `tab-host.toggle:plannotator`, the same handler the click runs, on a copy that lives in the tab bar and never sleeps. `layout.toggle:panel` would land on whatever tab the panel was last on — that is why the key is not it. (Without tab-host, `install.sh` docks the panel on the right and binds the key to that plain toggle anyway: better a panel that lands on its last tab than no panel.) - **The tab keeps the mod alive, and that is what the toast needed.** Herdr keeps a block's copy running once it has shown, hidden or not, so after one press of the button in a session the sessions folder stays watched and a decision is a Herdr toast within the second. Only a copy nobody has shown is deferred: after a restart, the first decision waits for one press of the button. - **One keyboard list.** The drawing and the keys both read `rowIds()` — the threads, "N more", the annotate rows, the Files toggle, every drawn tree row, "Another folder…", and in a thread the last row and the way back — so the highlight is always the row Return runs. The reply field and a comment's field are the exceptions: while the caret is in one, every key but Esc belongs to the caret, and Esc puts a comment away before it leaves the thread. The panel is not handed the keyboard when it appears (that would pull it out of the terminal); a click into it hands it over. - **The Inbox owns the list and the read state; the store is only the trigger.** `~/.plannotator/inbox/projects` is watched (`watchFolder`) for changes, and the rows come from the Inbox server's own model, `GET http://127.0.0.1:/api/inbox/threads` (the port in `~/.plannotator/inbox/inbox.json`), which returns them already sorted into its buckets — stopped/holding/waiting, new, sent/quiet — folded here into yellow, blue and grey. A message an agent sends is a row within a second, in the list or in the open thread. Without the server the panel says so and fills itself in when it returns. Nothing is polled from Herdr: spaces, focus, theme and the space's folder arrive by themselves. - **Reading a thread is `seen`, never `read`.** Opening it POSTs `threads//seen` with the newest drawn seq — exactly what the Inbox page does — so the blue dot goes and nothing else moves. Mark read is the thread head's own toggle (the envelope beside the copy button, archive beside it): the person presses it, the endpoint sets every open question with a skip answer aside as the page's does, and a thread with an open question stays yellow until then — the badge keeps counting it. - **Picks are the Inbox's drafts, saved as they are made.** A click on a ring POSTs `messages//picks` — the same draft the Inbox's own page keeps, so a pick here follows to the browser and back. The reply's Send POSTs `messages//reply` with `words`, the picked answers named `{message_id, key, revision}`, an `idempotency_key`, and `seen_through_seq` — the newest seq drawn. Picks alone are a reply. A skip — the card's own Skip, as the page's — is a record of the same shape that names no choice (`answer.skipped`, a note beside it is welcome): "Skipped, not sent" in `accent` before the Send, "Skipped" in `dim` once it has gone, and what the person does after it replaces it — a note after a skip is a note on the skip, not a taking of it back. Beside Skip the card carries Accept recommended when the recommendation names one of the choices — the pick, saved like a click. If the agent wrote after what was drawn, the Inbox refuses with `thread_moved_on`: nothing sends, the words stay in the field, the thread re-reads to show what moved it. **This is the whole write surface** — a cursor, an answer's draft, a reply, a comment, a mark. No resolve, upload, tag or handoff leaves the panel; a skip does now, and it is the same draft the page's Skip writes. - **An action is the todo the agent left, answered here.** `:::action` comes out of the words like a question fence and draws as its own card from the `questions` record: its context, its `Where:` link (opened in the person's browser by `open` or `xdg-open` — the panel itself still talks to nothing but the Inbox), the two marks Done and Can't do it, and the note they carry. A mark POSTs `messages//actions/` with `{outcome, note?, staged}`, the way the Inbox page stages it to go with the next reply; the Send names the marked ones `{message_id, key}` and the band counts them ("1 task goes with this reply"). The Inbox takes no note without an outcome — a note typed before any mark stays the draft the mark carries — and a mark whose outcome has not moved sends `note_only`, so it does not re-mark. `{outcome: null}` takes a mark back; once the Send has carried it (`sent_revision` caught up), the card reads the result back and nothing on it is clickable. - **A comment is filed on a block, because the panel cannot read a highlight.** `TextView` and `EditorState` hand out no selection, and a `copy` a mod dispatches moves nothing — the action reaches no handler that holds the selection, and an attempt wipes the clipboard — so the words a comment is about are the ones in the paragraph under the pointer: a press and release in the same block with 4 px of travel between them (a click is a click) opens the "Comment" bar, and the block's first line is the quote. The one road a highlight's words take out of the host is `cmd+c`: the native copy works, and the mod reads the clipboard (`copied`). A snapshot of the clipboard at the press makes the copy the gesture's own — only a clipboard changed between press and comment, naming words the block holds, becomes the quote; anything else falls back to the block's line. `rowsOf` cuts a message's markdown into the blocks that survive being drawn alone — checked against a sample board with `herdr-app shot`: a top-level list item (`- `, `1. `) is a block of its own, carrying its hanging paragraphs and nested lists (an item alone keeps its number; a nested bullet alone loses its indent, so it stays); a blank line ends a block only when a flush-left, non-list line follows, so a loose list keeps its shape; a fence stays whole. Every block is drawn as its own `TextView`, so a selection cannot run across two paragraphs and the anchor is never guessed. A file's blocks carry their line numbers as well (a list item reads its own "lines 3-5"), which is what a comment on a file can name; a message's cannot, the agent's words being nobody's numbered lines. The code view has no blocks to press, so it has one row instead, "Comment on this file", above the `Editor`: that one is a `GLOBAL_COMMENT`, the Inbox's own general comment, with no lines to name. A block that opens with a fence quotes its first line of code, not the fence line — "code" said nothing. - **A picture has no document under it, so its comment is the whole picture.** The row that opens it is in the picture's dialog and above the picture on its page — "Comment on this picture" — and the field it opens draws under the picture: under the row of a message's attached pictures, under the picture the agent wrote into its words, under the picture on its page. What is filed is, for an attached picture, the shape the Inbox's own picture comment has: `blockId: "image"`, `type: "COMMENT"`, the picture's name in `originalText` and no offsets (`postNote` skips the end offset it gives a block). A picture written into a message is no record the Inbox has, so its comment is a comment on the message — `type: "COMMENT"`, no `blockId`, and the `![alt](path)` the agent wrote as the quote — because a message takes no `GLOBAL_COMMENT` (`saveMessageAnnotation` refuses one). A picture is the one thing with nothing to select and nowhere to click in it, which is why the row exists rather than a press-and-release on the image. - **A comment is saved as it is made, and carries on the Send.** Comment puts the words in the reply band — quote, words, ✕, and no other edit, because the words are the band's to carry now — and POSTs the annotation at once: `messages//annotations` for a message, `annotations` with the attachment and its `sent_sha256` for a file. Those are the drafts the Inbox's own page keeps, so its count and the panel's are the same number (`row.unsent.comments`, less the ones on screen); the browser's page draws them back as it draws any comment. The Send names them in `annotation_ids` and renders them into the reply's `feedback`, which is where the Inbox puts them in the message the agent reads — the agent gets the words the person highlighted, not a separate record to go and find. A comment on a file is headed `**Comment on \`spec.md\` lines 3-5:**` (or `line 3`, or no lines for the whole file), the quote under it, the words under that; a comment on a picture is headed for the picture's name (or for the message, when the agent wrote the picture into its words), and the quote is left out where it would only say the name again. An id the Inbox does not know refuses the whole reply, so the reply goes out again without `annotation_ids` and the words still arrive in `feedback`. A reply that only comments is a reply. - **The files come from the Inbox, not from the path the agent named.** An attachment is a record — `id`, `name`, `kind` (markdown, text, code, html, image, video), `size`, its hash — and the file the agent pointed at is usually gone by the time the person reads the thread, so what is drawn is the copy the Inbox kept: `GET attachments/?version=sent` for the words, `/image` and `/video` for the bytes. Each is pulled once into `~/.config/herdr-app/data/plannotator/att//`, named `-.`, and a file already there is the answer — a sent attachment cannot change. The copies are a cache for what is on screen, not an archive: a thread's folder goes when the person leaves the thread, and the panel clears the whole folder when it starts, so nothing piles up. A file the Inbox no longer has says so on its page and offers the thread; a thread whose pictures cannot be read keeps their rows. Pictures are pulled when a thread opens (once each, then kept) so a message can draw them; every other kind is read only when the person opens it. The files are read-only in both directions: the panel shows them and sends nothing about their contents — the one thing it says about a file is the comment the person writes on it. - **A picture written into the words is a path, not an attachment.** The agents write `![alt](/abs/a.png)`, or a name relative to the project the thread is about. `TextView` cannot load an image, so the picture is copied into the app's folder (`.`) and the message is drawn in pieces: the markdown between one picture and the next, and the picture between them, which is where the agent wrote it, centred in the column. `COPY` also says how many pixels the file is — `sips` where it exists, `file` after that — because `image()` cannot be asked, and without it a portrait screenshot at the panel's width is a column of screen: 240 px of height and 130 px of width is the thumbnail, and the dialog is the rest. That copy can go stale where an attachment's cannot — the path is a file the agent may write again — so a copy older than its source is replaced (`[ "$src" -nt "$dest" ]`). A path that is gone stays a count under the words, and the count goes to the Inbox's own page, which has the picture if anything does. What is code is not a picture: `![alt](path)` in a backtick span or in a fenced block is the words an agent is talking about, so `codeSpans` blanks those before the search and a message about pictures draws none — a quote of the markdown read as one, and said "1 picture could not be read here" under a message holding no picture at all. The blanking is per line for a span, so a span broken across a line break still reads as a picture. The click is on a box around the picture, not on the picture: an `image()` takes styles, but a press lands on a `div()` or an `h_flex()`. - **The rest of an answer is a page away.** "Open in Inbox for picks and pictures" (and the header's page button) opens the Inbox at `#thread=` through `plannotator inbox --background`, which prints the address without a browser, so `open` lands one tab on the thread instead of two. - **The tree follows the focused pane.** Its root is the focused folder; each folder's children are read once, when its row first opens, and kept until the root changes. Collapsing keeps what was read. "This space" annotates the space folder, a folder's pen annotates that folder, a file's row annotates the file, and "Another folder…" opens `pickFolder` and annotates what it returns. - **Sessions run in the background, and the log is the channel.** One `sh` per run backgrounds `plannotator last|review|annotate … --json` with `nohup` in the working folder; `--json` changes only the log's verdict line, nothing on the page. The output lands in `~/.config/herdr-app/data/plannotator/sessions/-