cognitive-fab/polygraph

10 stars · Last commit 2026-07-31

A polygraph for your state machine: an LLM derives a formal model from your code, then Polygraph replays real traces against it and exhaustively model-checks it against your invariants.

README preview

<p align="center">
  <img src="assets/polygraph-verify.jpg" alt="Polygraph — /verify" width="640">
</p>

# Polygraph

**Your tests check the paths you thought of. Polygraph checks the ones you didn't.**

Polygraph is a Claude Code plugin (and standalone CLI) that finds bugs in
**stateful code** — workflows, reducers, protocol handlers, checkout flows,
session managers — by exhaustively exploring every state the code can reach
over a finite, declared domain of actions and payloads, and flagging the
ones that break rules you care about, like *"a customer is never charged
twice."*

You don't need to know anything about formal verification to use it. You
write the rules as plain JavaScript predicates. The heavy lifting — deriving a
formal model of your code, exploring the state space, producing a shortest
path to each violation — is done for you.

View full repository on GitHub →