Polygraph doesn't review — it verifies: aim it at any stateful code, it walks every reachable state and hands back the exact steps that break your rules. A repro, not a hunch. This page takes you from zero to that moment in three demos, on one small machine.
Polygraph is a Claude Code plugin, and the repo is its own marketplace.
# inside Claude Code /plugin marketplace add cognitive-fab/polygraph /plugin install polygraph@polygraph
Update later with /plugin marketplace update polygraph. Or clone directly into ~/.claude/plugins/polygraph.
Type /plugin and pick Manage plugins, then:
https://github.com/cognitive-fab/polygraph and hit Addpolygraph appears under Available → Install
click to enlarge
One gotcha: VS Code may not inherit your shell's ANTHROPIC_API_KEY — set it in the env block of ~/.claude/settings.json, which both surfaces share.
npm install for the core loop — the SAM runtime is vendored. Replay, model checking, and the version gate run without any API key; only spec generation and code authoring call a model.The demo repo is a show-and-tell on one small machine — a Dual-Authorization Action Order: an order needs two distinct approvers inside a time window before it can fire two real-world effects (transmit, execute), each exactly once.
Small, but it's the shape of every approval, checkout, and payment flow — and the two-person rule is exactly the kind of property that hides from code review. The machine has 28 reachable states; the gate visits all of them.
git clone https://github.com/cognitive-fab/polygraph-demo-daao
Demos 1 and 3 are deterministic and need no key; Demo 2 authors code, so it needs an ANTHROPIC_API_KEY.
The code under test is AI-generated. Delete the one guard that stops a redelivered approval from counting twice — the classic two-person bug — and point Polygraph at it. It walks all 28 reachable states and hands back the shortest path to disaster:
That failing path is the reproduction — paste it into a test. The clean build passes the identical gate. No test was written; the gate found the bug class regardless of who wrote the code.
daao/verify/, make a copy with the distinct-approver guard removed, and run the Polygraph gate on both. Show me it clears the clean build and, on the buggy one, returns the shortest path to a state that violates the two-person rule — the reproduction — without me writing a test.Turn it around. One paragraph of English → a machine born with a contract, its invariants, and a regression corpus, model-checked before you ever see it. A frontier model wrote the whole DAAO and converged on the first try — for $1.81 of model spend.
polygen from this description: [the states, the two-distinct-approver rule, the in-window exactly-once effects, recall, and expiry]. Model-check it against its own invariants, self-repair any reachable violation, and give me the contract, invariants, and a regression corpus.Change one rule — two approvers to three — and the gate replays it against the orders already in flight under the old rule. It blocks the deploy, naming the four live orders the new rule would strand and the exact path by which one still reaches execute. Before you ship, not after in an incident.
daao/verify/ is verified under a two-approver rule. Tighten it to three, build in-flight fleet snapshots (orders already approved or released under the old rule), and run polyvers to version-gate the change against them. If it's unsafe, block it and name which in-flight orders break and the path by which one reaches execute.# Demo 1 (the catch) + Demo 3 (the version gate) + liveness + differential bash daao/run_demo.sh