polyviz

A command that turns Polygraph and polyvers verification artifacts into fixed diagrams. Polygraph artifacts describe checked state-machine behavior, while polyvers artifacts describe compatibility checks between versions.

In plain words
What is it for?
Use it to render state-machine, invariant, counterexample, compatibility-gate, or model-card diagrams from a JSON visualization model or an artifacts directory, in SVG or optionally PNG.
Why use it?
It provides a readable view of verification data without rerunning verification or relying on a model. The output is deterministic, so the same input produces the same diagram.

Command

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 commands/cognitive-fab/polygraph/polyviz
Clone the repo
git clone --depth 1 https://github.com/cognitive-fab/polygraph
Per session 64 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 710 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.00064 $0.00710
Opus 5 $0.00032 $0.00355
Sonnet 5 $0.00013 $0.00142
Haiku 4.5 $0.00006 $0.00071

Measured 2d ago against content hash dd05cdc9d7f9, 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/commands/polyviz.md · 47 lines

What it actually says

Run polyviz over the arguments in $ARGUMENTS. polyviz is the VISUALIZATION side of the method: it turns the artifacts Polygraph/polyvers already produced into a fixed catalog of clean, brand-consistent diagrams. Rendering is a pure function artifacts → SVG — deterministic (byte-identical on repeat), no model call, no network. It does not run verification; it only visualizes.

This drives ${CLAUDE_PLUGIN_ROOT}/bin/polyviz.mjs:

node ${CLAUDE_PLUGIN_ROOT}/bin/polyviz.mjs render --in <dir|polyviz.json> \
    --diagram <all|state-machine|invariants|counterexample|compat-gate|model-card> \
    --out <dir> [--format svg,png] [--theme dark|light] [--tokens f.json] [--scale 2]
node ${CLAUDE_PLUGIN_ROOT}/bin/polyviz.mjs hash --in <...> --diagram <...>
node ${CLAUDE_PLUGIN_ROOT}/bin/polyviz.mjs schema

Inputs:

  • A viz-model JSON (*.polyviz.json, the stable contract — polyviz schema prints it): pure viz-model → SVG, executes no user code, no optional deps for SVG.
  • A Polygraph/polyvers artifacts directory: adapters derive the machine graph (bounded BFS that executes the SAM/next module), read invariants.mjs, resolve a failing findings.json to its counterexample trace, and map compat-report.json. A polyviz.annotations.json in the dir supplies the narrative the raw artifacts don't carry.

Optional runtime components (mention when relevant): state-machine/model-card need elkjs; --format png needs @resvg/resvg-js (native/WASM). The SVG path for invariants/counterexample/compat-gate needs neither. Missing optional deps fail loud with the exact npm i to run.

Workflow:

  1. Default to --format svg (deterministic, diffable). Add png only for a raster deliverable.
  2. When --in is a run directory, warn that the machine graph is derived by executing the module, and offer a polyviz.annotations.json for nicer copy.
  3. Use hash to prove determinism in CI. The reference figures under ${CLAUDE_PLUGIN_ROOT}/reference/ are the visual acceptance bar.
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 · 47 lines · 64 tokens per session scan A dd05cdc9d7f9

Subscribe to this mod's changes

polyviz is a command published in the GitHub repository cognitive-fab/polygraph (11 stars, last pushed 6d ago), licensed Apache-2.0. It adds 64 tokens to every session and 710 once invoked, about $0.0003 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.