# Wayfinder A panel that draws a [wayfinder](https://github.com/mattpocock/skills/blob/main/skills/engineering/wayfinder/SKILL.md) map, kept as Markdown notes, as a left-to-right graph of its decision tickets. Each ticket's colour says where it stands: on the frontier, blocked, resolved, being worked by a live Claude Code session, or waiting on you. Click a ticket for its question, answer and relations, and start it in a new tab with one click. The map redraws itself when the notes change. ![Wayfinder](preview.png) ## What you see Top to bottom, in a panel docked on the right (368px on first install): - **Header row** (24px): the map's name, 12px semibold, with `โ–พ`. It opens a 280px popup titled "Active maps" listing every active map; the shown one has the theme's `selected` background. - **Legend row** (11px text): coloured count chips, 18px high, 4px radius, filled with their colour at alpha `26`: - "๐Ÿ”” N needs you" in `ansi6`, semibold, only when N > 0; - "N in progress" in `working`; - "N frontier" in `accent`; - "N resolved" in `ansi2`. On the right is a zoom control, `โˆ’ 100% +`, in `muted`. - **Graph**, filling the rest: Graphviz `dot` with `rankdir=LR`, `nodesep=0.12`, `ranksep=0.45`, and edges in `dim`. - Each node is 168px wide and 16 + 15 ร— lines px high. - The label "`n` `name`" is 12px, wrapped at 23 characters, at most 3 lines (the third ends in `โ€ฆ`). - Research tickets (AFK) have a 10px radius; the other types (HITL) have 3px. - **Ticket sheet**, over the bottom of the graph when a ticket is selected. It is as tall as its content, at most 55% of the panel; only a longer ticket scrolls. From the top: - Header: the number in a `raised` badge, the name (13.5px semibold, truncated), a copy button, and a close button. - Chips: the type with its icon; HITL or AFK; the status label in the node's colour. - Any problems in the ticket's notes, in `blocked`, each with an alert icon. - A `raised` card with two columns, "Blocked by" (lock icon) and "Blocks" (unlock icon). Each lists ticket names, each with a 6px dot in that ticket's node colour, or "None". - "Question" and "Answer" as markdown. Wikilinks show as their names. - Actions: "Start" (`solid`, only for a frontier ticket with no tab yet), "Go to session" (`solid`, when a live session holds it), "Open in Obsidian". Ticket states, with their border and fill (alpha suffix on the colour): | State | Border | Fill | Text | Extra | |---|---|---|---|---| | Frontier: open, every blocker closed | `accent` | `accent`+`26` | `foreground` | | | Blocked: open, a blocker still open | `dim` | none | `muted` | | | Resolved | `ansi2`+`59` | `ansi2`+`14` | `muted` | check icon top-right, in `ansi2` | | Live, working | `working` | `working`+`2e` | `foreground` | pulsing ring | | Live, idle or done | `ansi6` | `ansi6`+`2e` | `foreground` | pulsing ring, bell icon top-right | | Live, blocked | `blocked` | `blocked`+`2e` | `foreground` | pulsing ring, bell icon | | Stale claim: claimed, but no tab has that name | `blocked`, dashed | none | `foreground` | | | Notes broken (bad type, status, `n` or blocker) | `blocked`, 2px | as its state | | | | Selected | `foreground`, 2px | as its state | | | - **Live** means a claimed ticket whose `claimed_by` names an open tab, or a frontier ticket that a tab is already named after ("Starting"). - **The ring** sits 5px outside the node: a 2px border in the node's colour whose opacity swings between 0.15 and 1 every 1400ms. Out-of-scope tickets are hidden. ## How it behaves - **Agent status.** A live session's status is its tab's status. - `working`: yellow, ringed. Sheet chip "In progress ยท working". - `idle`, `done` or `blocked`: ringed, with a bell, and counted in "needs you". Sheet chip "Needs you ยท ". A session that stopped with its ticket unresolved is most likely waiting on a reply. - When the session resolves the ticket, the ticket turns green and the ring stops. - **Panning.** Two-finger scroll pans both axes at once. A left-drag on the graph also pans, with a grabbing cursor, once it moves 4px; a drag that starts on a node doesn't open it. The view never scrolls past the graph's edges, and gains extra room below while the sheet is open. - **Zoom.** โŒ˜ or ctrl + two-finger scroll zooms around the pointer (factor `exp(-dy/200)`, from 30% to 250%). `โˆ’` and `+` step by ร—1.25 around the centre, and clicking the percentage resets to 100%. With the panel focused, โŒ˜= / โŒ˜- / โŒ˜0 do the same, unless the app's global zoom keys take them first. Text, edges and nodes all scale. - **Click a node** to select it and open the sheet; click it again or press Esc to close. In the sheet, a name under Blocked by / Blocks selects that ticket. - **"needs you"** selects the next waiting ticket in turn and scrolls it to the middle, a quarter of the way down. - **Copy** puts the ticket's name on the clipboard; the icon is an `ansi2` check for 1.5s. - **Start** runs `tab.new` with the ticket's name as the tab name, in the focused space and its folder, with argv `["claude", "/wayfinder [[]] [[]]"]`. The mod writes nothing; the skill claims the ticket. - **Go to session** runs `agent.focus` on the tab's agent. - **Open in Obsidian** runs `open "obsidian://open?path="`. - **The picker** stores the chosen map in shared state `wayfinder.map`, so it is kept across restarts. Switching maps closes the sheet and resets the view. - **Refresh.** The mod watches `ROOT` and reloads maps and tickets on any change; the graph is laid out again only when tickets or edges change. ## Built from - One mod, `wayfinder`, in `mods/wayfinder/` (`mod.json`: `place: "right"`, `size: 368`). - `main.js` is the view. - `data.js` reads notes and lays out the graph. - `icons/*.svg` are Lucide icons, tinted. - `map.svg` is an icon for a launcher button that a layout may add. - The same mod opened with props `{picker: true}` as a popup (`openOverlay`) is the map picker. - **Notes.** - Maps: `rg -l --glob '*.md' '^wayfinder: map\s*$' ROOT`, kept when `status: active`. - Tickets: `/tickets/*.md`, read with `readTextFile`. - A small frontmatter parser handles scalars, `[]`, `[a, b]` and indented `- item` lists, and reads the body's `## Question` and `## Answer` sections. - Derived state: frontier = open with no open blocker. A blocker missing from the map counts as open. - **Graph.** - `dot -Tsvg -o .svg -Tjson -o .json` under `~/.config/herdr-app/mods/wayfinder/.cache/`, older renders deleted first. - Nodes are `style=invis`, `fixedsize`. The SVG holds only the edges. - The mod draws each node as an absolute `div` at the JSON position: x = pad + x โˆ’ w/2, y = pad + bbH โˆ’ y โˆ’ h/2, with pad = 7.2. - It shows the SVG with `image()` underneath. - **Viewport.** - An `overflow_hidden` div with the content absolutely offset by the view. - `on_scroll_wheel` pans or zooms; `on_mouse_down`/`on_mouse_move`/`on_mouse_up` drag; `on_hover(false)` ends a drag. - The ring uses `.loop("opacity", {from: 0.15, to: 1, period: 1400})`. - **Sessions.** - `spaces()` tabs that are named, keyed by both `` and ` / `. - Each tab's `status` gives the colour; `agents()` gives the agent to focus. - **herdr functions:** `spaces`, `agents`, `focused`, `run` (`tab.new`, `agent.focus`), `theme`, `props`, `shared`/`setShared`, `openOverlay`/`closeOverlay`, `watchFolder`, `exec`, `readTextFile`, `home`, `appHome`. - **Programs:** `rg`, `dot`, `sh`, `ls`, `open`; `claude` when Start is pressed. ## Watch out - `ROOT` in `data.js` is the folder searched for maps (default `~/obsidian/Projects`); set it per setup. - Mods can't draw lines; that's why Graphviz draws the edges. - Write its output under a hidden folder: a write under `mods//` otherwise reloads the mod. - The SVG and the node divs must use the same coordinates, or edges miss their nodes. - `overflow_scroll` panning snapped between axes on a trackpad, and mods get no pinch event; hence the hand-made viewport. It clamps on every render. - Colours must be `#rgb`, `#rrggbb[aa]` or theme names; `"transparent"` throws (use `#00000000`). - `line_height(n)` with a bare number is a multiplier, not px. - A scroll area fills the height it's given. To size the sheet to its content, measure an inner element with `on_size_change` and set the scroll area to `min(content, cap)`. - Runtime render errors show in `herdr-app shot` as a red banner, not in `herdr-app status`. - Hot reload ignores a symlinked mod folder; install a real copy. - Sessions write `claimed_by` as either the bare tab name or ` / `; match both, or live tickets read as stale claims. - Limits: - Labels past 3 lines are cut. - Zoom is 30% to 250%. - The picker lists active maps only, and there is no "New map". ## Done when - `herdr-app check ~/.config/herdr-app/mods/wayfinder` passes, and the map shows in the docked panel. - A note with `wayfinder: map` and `status: active` under `ROOT` appears in the picker after saving; set it to anything else and it leaves. - Tickets show in their colours, edges join the right nodes, and out-of-scope tickets are hidden. - Set a ticket's `claimed_by` to an open tab's name and `status: claimed`. The ticket rings in that tab's status colour, and "needs you" counts it while the tab isn't working. - Rename that tab and the ticket shows the dashed stale-claim border. - Two-finger scroll moves diagonally; a drag pans; โŒ˜+scroll zooms around the pointer, and the label shows the new percentage. - Clicking a node opens the sheet sized to its content; Copy puts the name on the clipboard; Start opens a tab named after the ticket running `claude "/wayfinder [[map]] [[ticket]]"`.