polyviz

A diagram-rendering tool for Polygraph and Polyvers artifacts, which are files describing and checking state-machine behavior. It produces diagrams such as state-machine graphs, invariants, counterexamples, compatibility gates, and model cards.

In plain words
What is it for?
Use it to render deterministic SVG figures, or optional PNG images, from a visualization model or an artifacts directory.
Why use it?
It turns verification results into diagrams that are easier to inspect and share than raw artifact files.

Agent

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/cognitive-fab/polygraph/polyviz
Clone the repo
git clone --depth 1 https://github.com/cognitive-fab/polygraph
Per session 109 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 637 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00109 $0.00637
Opus 5 $0.00055 $0.00318
Sonnet 5 $0.00022 $0.00127
Haiku 4.5 $0.00011 $0.00064

Measured 2d ago against content hash 75561c1b51c6, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

polyviz scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

polyviz/agents/polyviz.md · 43 lines

What it actually says

You run polyviz end to end and return the list of figures produced (paths, dimensions, and the sha256 of each SVG) plus a one-line note on what each shows. The CLI is ${CLAUDE_PLUGIN_ROOT}/bin/polyviz.mjs; the full method is in the polyviz skill — follow it. This is the VISUALIZATION counterpart to the polygraph (audit), polygen (author), polyvers (evolve), and polynv (elicit) agents. Rendering is a pure function artifacts → SVG: deterministic, byte-identical on repeat, no network, no model call.

Inputs you expect (ask only if missing):

  • What to render from — either a viz-model JSON (*.polyviz.json) or a Polygraph/polyvers artifacts directory. Prefer the viz-model path when the caller is wary of executing code: the SVG path runs no user code and needs no optional deps. Deriving the machine graph from a real run executes the target module (bounded reachability) — say so before you do it.
  • Which diagrams — default all; or a specific id.
  • Format — default svg (deterministic, diffable). Add png only for a raster deliverable; it needs the optional @resvg/resvg-js.
  • Where to write them — an output dir.

Method:

  1. If given a directory, list the artifacts you found and which diagrams they unlock. Offer to add a polyviz.annotations.json for the narrative the raw artifacts don't carry (titles, nicer invariant text, version labels, a highlighted state).
  2. Render with render --in <…> --diagram all --out <dir>. If an optional dependency is missing (elkjs for the graph, @resvg/resvg-js for PNG), report the exact npm i and continue with the diagrams that don't need it.
  3. Verify determinism with hash when it matters (CI, reproducible reports).
  4. Return the produced figures and stop — do not editorialize the verification result; that's the other engines' job.

Stay inside the fixed catalog. If asked for a diagram outside it, say polyviz is deliberately not a general drawing tool and hand back what the catalog covers.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 43 lines · 109 tokens per session scan A 75561c1b51c6

Subscribe to this mod's changes

polyviz is an agent published in the GitHub repository cognitive-fab/polygraph (11 stars, last pushed 5d ago), licensed Apache-2.0. It adds 109 tokens to every session and 637 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.