From b456147149fd3df25dd660f9bf710f3aa15ec77f Mon Sep 17 00:00:00 2001 From: pallaoro Date: Tue, 3 Nov 2026 11:47:18 +0100 Subject: [PATCH] feat(visualize): draw with the harness's own renderers when text can't carry it /visualize had one way to show a picture that text can't carry: write an HTML file and `open` it. That steered agents past renderers the harness already provides (an Artifact tool, a board's show_page, docs with diagram blocks) and past the harness's own drawing guidance. The skill now checks what the session can render with before it picks a form. The question still picks the form; a renderer only draws it. When several renderers qualify, it uses the one that reaches the user where they are looking. It loads the drawing guidance for that renderer and keeps the file:line anchors and ASSUMED tags on the rendered nodes. Uploading counts as publishing, and a subagent hands the picture back unless it was asked to render. With no renderer in the session, the text forms work as before. Checked with two fresh-context runs. In a dry run, a simple request stayed a text call tree and a dense one picked a renderer. A real run rendered the repo-to-clients flow on the Ateam board with 53 file:line anchors, all of which resolve. --- README.md | 2 +- skills/visualize/SKILL.md | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index fe59196..5e2e450 100644 --- a/README.md +++ b/README.md @@ -222,7 +222,7 @@ Use `/sidenote ` to park one, or `/sidenote` to see what's parked. Ask an agent to explain how something works and you get paragraphs. Ask it to *draw* the thing and you get comprehension — a call tree, a component tree, a sequence diagram. But a diagram is also the easiest place in the world to launder a guess: prose hedges out loud (*"it probably calls…"*), while boxes and arrows just assert. An architecture diagram drawn from priors reads as **verified**, and people build on it for weeks. -[`skills/visualize/SKILL.md`](./skills/visualize/SKILL.md) is the §7 rule applied to pictures. It gives the agent a menu of visual forms — pseudocode, call tree, component tree, file tree, text sequence diagrams, shaped `diff`s, or one focused HTML file — and tells it to pick the *smallest* one that makes the point, **matched to the surface it lands on**: a terminal has no diagram renderer, so a `mermaid` fence there just prints its own source; the text forms are the picture already. Mermaid is reserved for surfaces that actually render it. Then the Greybeard part: **read the code before drawing it** (the actual files, this session — if the diagram has five nodes, you opened five things), **anchor every node** to a real `file:line`, **trace the current shape with the real input** (an anchor proves the node exists, not that the arrow fires — if the concrete key dead-ends in the registry, the dead end is the picture), and **tag anything unread as ASSUMED** with the check that would settle it. A diagram that's 90% verified and 10% quietly invented is 100% untrustworthy. +[`skills/visualize/SKILL.md`](./skills/visualize/SKILL.md) is the §7 rule applied to pictures. It gives the agent a menu of visual forms — pseudocode, call tree, component tree, file tree, text sequence diagrams, shaped `diff`s, or one focused HTML file — and tells it to pick the *smallest* one that makes the point, **matched to the surface it lands on**: a terminal has no diagram renderer, so a `mermaid` fence there just prints its own source; the text forms are the picture already. Mermaid is reserved for surfaces that actually render it. Those forms are the floor: before settling on one, the agent checks what the current harness can render with, such as an artifact or page tool, and what drawing guidance it offers, such as a diagramming or charting skill. When the question needs more than text, it draws there and follows that guidance. The anchors and ASSUMED tags go on the rendered nodes, and a renderer that uploads counts as publishing. Then the Greybeard part: **read the code before drawing it** (the actual files, this session — if the diagram has five nodes, you opened five things), **anchor every node** to a real `file:line`, **trace the current shape with the real input** (an anchor proves the node exists, not that the arrow fires — if the concrete key dead-ends in the registry, the dead end is the picture), and **tag anything unread as ASSUMED** with the check that would settle it. A diagram that's 90% verified and 10% quietly invented is 100% untrustworthy. Use `/visualize `, or a bare `/visualize` to draw whatever's currently on the table. diff --git a/skills/visualize/SKILL.md b/skills/visualize/SKILL.md index ca49e91..74b5647 100644 --- a/skills/visualize/SKILL.md +++ b/skills/visualize/SKILL.md @@ -23,6 +23,17 @@ Use one, sometimes a few, rarely all. Match the form to the question being asked **Check the surface before you pick.** A terminal has no diagram renderer: a `mermaid` fence there prints its own source code, which is strictly worse than the plain-text form it replaced. So in a terminal (Claude Code, a shell, a plain log) every form below must be *text that is already the picture* — trees, indentation, box-drawing characters. Reach for Mermaid only when the output lands somewhere that actually renders it: a published artifact, a `.md` file read on GitHub, the desktop or web app. When in doubt, assume it won't render and draw it as text. +**Then check what this session can render with.** The forms below are the floor, not the ceiling. The harness you're running in may already have a better way to show a picture than anything this skill can hand-roll. Look at the tools and skills it actually gave you this session, including tools listed only by name until you load them, not the ones harnesses usually ship. You're looking for two things. First, anything that renders: a page or artifact publisher (an `Artifact` tool, a board's `show_page`), a document tool with diagram blocks, or a whiteboard or design connector. Second, any guidance on drawing well there: a diagramming or charting skill (`artifact-diagramming`, `dataviz`), or the rendering notes in a tool's own description. What you find feeds the pick below; it doesn't make it. When the question needs more than text can carry (a dense flow, a state comparison, a chart, a UI), a renderer the harness provides beats a hand-rolled file, because it shows the picture where this harness shows things to the user. + +- **The question picks the form; the renderer only draws it.** A call tree that answers the question is still a call tree, even when an artifact tool is one call away. Use a renderer only when the form you chose needs one. +- **If several renderers qualify, use the one that reaches the user where they're looking**, and prefer one the harness's own instructions name for showing things. +- **Load the drawing guidance for that renderer, if there is any, and follow its mechanics**: format, theming, size limits. Guidance written for one page tool may still cover another HTML page, so check what it says it applies to. This skill decides *what* goes in the picture; that guidance decides *how* it renders there. +- **The grounding rules travel with the picture.** The `file:line` anchors and `ASSUMED` tags go on the rendered nodes, not only in the chat reply. A polished render looks even more verified than a text tree, so it needs the tags more. +- **Uploading is publishing.** A renderer that hosts the page or sends it to a service takes the code you drew off the machine. Follow that tool's own rules on when it may be used and when it may publish. If they say nothing and the repo is private, ask first. +- **Running as a subagent, hand the picture back.** Your reply goes to the agent that spawned you, and a user-facing renderer may replace what that agent is showing. Return the text form or a file path, unless that agent asked you to render it. + +If nothing in the session renders, or you can't tell, the forms below are complete on their own. + - **Logic or an algorithm** — pseudocode: ```text @@ -102,7 +113,7 @@ Use one, sometimes a few, rarely all. Match the form to the question being asked } ``` -- **One focused HTML file** — for a visual UI, a layout, a state comparison, or a concept too dense for Mermaid: a diagram, an infographic, or a short slide deck, whichever fits. Match the product's real colors, type, spacing, and components; use real labels and real data. Then open it: +- **One focused HTML file** — for a visual UI, a layout, a state comparison, or a concept too dense for Mermaid: a diagram, an infographic, or a short slide deck, whichever fits. Match the product's real colors, type, spacing, and components; use real labels and real data. Show it through the renderer picked above, if there is one. Otherwise, write the file and open it locally: ``` Bash(open path/to/visualize-{description}.html) @@ -112,4 +123,4 @@ Use one, sometimes a few, rarely all. Match the form to the question being asked Place each visual next to the short text it supports. Keep only the calls, files, props, states, and boundaries needed to answer the question actually being asked — an exhaustive diagram is a refusal to decide what matters. Prune every node that doesn't earn its place, then say what you left out. -Close with the anchors: the `file:line` list behind the drawing, and any `ASSUMED` node with the one check that would settle it. +Close with the anchors: the `file:line` list behind the drawing, and any `ASSUMED` node with the one check that would settle it. If the picture went to a renderer, the reply still says where it landed (a link, a path, or the panel it's on), along with the short text and the anchors, so a reader who never opens it still gets the answer.