agentsclimarketplace

Dt visual reply

Skill plumbdataio/discussion-tree/skills/dt-visual-reply

Use when replying on a discussion-tree (dt) board, map, or diagram and a picture would land faster than prose — a before/after comparison, a route or topology, a measured timeline, a branching procedure, relative magnitudes, a UI mockup. The authoritative reference for sending images INTO dt. Covers: deciding whether to draw at all; choosing between dt's mermaid diagram surface and a rendered image; generating the image (matplotlib through uv, including CJK fonts that would otherwise render as tofu); uploading it to the broker; embedding it inline at the right point in the post. Trigger contexts: "explain this", "why did it break", "compare these options", "what's the flow", "show me the difference" — or any moment you are about to write three paragraphs describing a shape, a sequence, or a set of numbers.From its SKILL.md

Install
npx -y skills add plumbdataio/discussion-tree --skill dt-visual-reply

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

8.5 KB, as published. Nobody here has run it

Replying with a picture in discussion-tree (dt)

Why this skill exists — read this once

The mechanism to post images has existed for a long time and was almost never used. server/instructions.ts even says so in as many words ("HIGH VALUE and under-used") and still it went unused. The gap was never capability; it was recall — the procedure lived somewhere you did not look at the moment you were writing a reply.

So this skill is a recall device, and the trigger is behavioural, not technical: when you notice you are about to describe a shape, a route, a sequence, or a set of numbers in prose, stop and draw it instead. If you only remember one line from this file, remember that one.

Keeping this file accurate is part of the job — if the upload path or the tool names change, update it here, or the next session will follow a dead procedure.

1. Should this be a picture at all?

Draw when the content has a shape that prose has to serialise:

SignalExample
Before / after, A vs Bwhat the code did before the fix vs after
A route or topologywhich hop broke, what talks to what
A timelinemeasured phases, what happens at t+3s
A branching procedure"if X then A, else B, then rejoin"
Relative magnitudeswhich session burned the quota, by how much
A UI mockupoption layouts, icon variants, spacing

Do NOT draw when:

  • the point fits in one sentence — a picture of one fact is noise;
  • a markdown table already says it (tables render fine in dt, and they are searchable and copyable — prefer them for pure tabular data);
  • the "picture" would just be a bulleted list with boxes around it.

A picture never replaces the conclusion. Always write the takeaway in text as well: the reader may be on a phone, and text is what search and later sessions can read. A post whose meaning exists only inside a PNG is a bad post.

2. Which surface: mermaid diagram, or an image in the post?

dt has two visual surfaces and they are not interchangeable.

Use the mermaid diagram surface (upsert_diagram) when the drawing is an artifact the user will come back to: a system diagram, a decision tree, an architecture the discussion will keep referring to. It is live-updating, zoomable, has its own chat thread, and lives in the sidebar.

Use an image in the post (this skill) when the drawing is evidence for this reply: a chart of real numbers, a measured timeline, a mockup, a screenshot, anything with a visual style mermaid cannot express. It sits inline in the thread exactly where the argument needs it.

When in doubt, ask "could mermaid express this?" — not "will they look at it again?". Longevity is the weaker test: a scaled floor plan, a chart of real numbers, or a rendered mockup can all be long-lived assets the user revisits for weeks, and none of them fit mermaid. If the shape needs real coordinates, real data, or a specific visual style, it is an image no matter how permanent it is.

For a long-lived image, keep the SOURCE in the repo (a YAML/JSON description plus a small render script) and treat the PNG as a build artifact you re-post on each change. The user then reviews the picture while you reason over the text — and nothing drifts, because there is one source of truth. Say where the source lives when you post it.

3. Generate the image

Use uv, not a bare python3

uv run --with matplotlib python3 /path/to/figure.py

Do not call a bare python3. Its meaning depends on the session's PATH — on this machine it has resolved to an unrelated project's virtualenv. uv run --with matplotlib resolves the dependency itself and behaves the same from any session. (First run builds matplotlib's font cache and takes a few seconds.)

Write the script into your scratchpad directory, not into the repo.

Template (CJK-safe)

import matplotlib
matplotlib.use("Agg")           # no GUI backend in a headless session
import matplotlib.pyplot as plt

# REQUIRED for Japanese labels. Without an explicit CJK family every CJK glyph
# renders as tofu (□□□). These families are present on this machine.
plt.rcParams["font.family"] = ["Hiragino Sans", "Arial Unicode MS"]

fig, ax = plt.subplots(figsize=(10, 4))
fig.patch.set_facecolor("white")   # dt threads render on a light card
# ... draw ...
fig.tight_layout()
fig.savefig("out.png", dpi=150, facecolor="white",
            bbox_inches="tight", pad_inches=0.25)

Make it readable in a thread

  • Width ~10-11in at dpi 150 — a dt thread column is narrow, so a wide, short figure reads better than a tall one.
  • White background explicitly (facecolor="white" in both savefig and the figure). A transparent PNG looks broken in dark mode.
  • Font sizes 9-13pt. Anything smaller is unreadable once the image is scaled into the column.
  • Label directly on the drawing instead of using a legend when you can — a legend forces the eye to bounce.
  • Drop chart junk: no grid unless it carries information, no box spines.

Matplotlib is not the only option: a headless-browser screenshot of HTML/SVG works for UI mockups, and a plain screenshot of something you built is often the most honest evidence. The upload path below is the same for any PNG.

4. Put it where the browser can already see it

dt serves a static asset folder: the broker exposes ~/.discussion-tree/uploads/<board_id>/ on the web at /uploads/<board_id>/… — that's where the user's pasted images live too. So there is nothing to "upload" and no base64 to encode: you copy the finished PNG into that folder and link it. The file being in the folder IS the publish step.

# <board_id> = the board / map / diagram id you're about to post to.
DIR="${DISCUSSION_TREE_HOME:-$HOME/.discussion-tree}/uploads/<board_id>"
mkdir -p "$DIR"
NAME="agent_$(date +%s)_$RANDOM.png"   # unique; agent_ marks it as yours
cp out.png "$DIR/$NAME"
echo "/uploads/<board_id>/$NAME"       # <- the URL to embed

Then put that URL in the message body, at the point in the argument where it belongs:

post_to_node(board_id=..., node_id=..., message="""
...prose leading up to it...

![measured timeline](/uploads/<board_id>/agent_…​.png)

...what the reader should conclude from it...
""")
  • The folder is keyed by the board / map / diagram id — a map or diagram id works the same (post_to_map_node, post_diagram_chat).
  • Use a UNIQUE filename (timestamp + $RANDOM) so you never clobber another image; the agent_ prefix keeps yours distinct from the user's pasted ones.
  • The broker serves ONLY from inside that folder (path traversal is blocked), so writing there is safe and self-contained — no API call, no base64, nothing lands in your context.
  • Off-box fallback (rare — e.g. the broker's home dir isn't reachable): POST base64 to the broker's /upload-image ({board_id, filename, data_base64}) and use the returned url. Same result, more steps; pipe base64 through the shell, never into your context. The direct copy above is preferred.

A matplotlib PNG is typically ~100 KB; there's no practical size ceiling on the direct copy (the /upload-image fallback caps at 10 MB).

5. Before you send

  • Is the takeaway also written in text? (image-only posts are bad posts)
  • Does the image have a white background and readable font sizes?
  • Are CJK labels actually rendered — not tofu? If you cannot be sure, read the PNG back with the Read tool and look at it. It costs one tool call and catches the failure the user would otherwise have to report.
  • Is the image placed at the point in the prose where it is needed, not dumped at the end?

Keep looking

Skills are one crate of 607,533. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.