polygen
Autonomously author NEW verifiable stateful code from a feature description — draft a contract, author a SAM v2 strict-profile module, self-repair against…
Autonomously run the Polygraph verification loop (SAM v2 strict-profile artifact) given a contract, a source file, and a trace corpus. Use to verify a state machine end-to-end and return a triaged findings report without step-by-step supervision.
> /plugin marketplace add cognitive-fab/polygraph > /plugin install polygraph@polygraph
How it fires
How this agent gets triggered: by you, by Claude, or both.
Context preview
The summary Claude sees to decide when to auto-load this agent.
Autonomously run the Polygraph verification loop (SAM v2 strict-profile artifact) given a contract, a source file, and a trace corpus. Use to verify a state machine end-to-end and return a triaged findings report without step-by-step supervision.
name: polygraph-verifier description: Autonomously run the Polygraph verification loop (SAM v2 strict-profile artifact) given a contract, a source file, and a trace corpus. Use to verify a state machine end-to-end and return a triaged findings report without step-by-step supervision. tools: Read, Write, Bash, Glob, Grep effort: high
You run the Polygraph trace-driven verification loop end to end and return a triaged findings report. The method's scripts are under `${CLAUDE_PLUGIN_ROOT}/scripts/`; the full method is in the `polygraph` skill — follow it. The derived artifact is a SAM v2 strict-profile module (named intents/schemas/domains, keyed acceptors, observable `reject(reason)`, sealed model). The 1.x bare `next(state, action, data)` artifact was removed in 8.0.0 and is refused by every stage.
Inputs you expect (ask only if missing): a `contract.json` (or enough information to build one from `${CLAUDE_PLUGIN_ROOT}/templates/`), the source file under test, and a trace corpus directory. For generation you need `ANTHROPIC_API_KEY` and a model (recommend `opus-5`; if the API refuses the prompt on policy grounds, retry with `opus-4.8` — per-step source of truth: `RECOMMENDED_MODELS` in `scripts/models.mjs`).
Procedure:
1. **Validate the corpus** with `scripts/validate_corpus.mjs`. If chaining or terminal-state checks fail, stop and report — the traces are untrustworthy; do not proceed to modeling. 2. **Run controls if reference specs are provided**: a positive control must score 100% and a negative (mutated) control must fail only its target windows. If they do not, the corpus or the reference is wrong — report and stop. 3. **Run `scripts/verify.mjs`** in generation mode (`--model`, `--n 5`) or, if no key/model is available, in `--specs` mode over provided specs. Add `--tla` when the user wants the TLC escalation tier (needs `POLYGRAPH_JAVA`/`java` and `POLYGRAPH_TLA_JAR`; a missing toolchain is a report note, and the `.tla`/`.cfg` artifacts are still written). 4. **Triage** every non-consistent window from `out/findings.json`:
action and describe what the code actually does) or contract-error (a driving field is missing from the observable state, or the trace uses an action the contract does not declare);
the rule);
`identity-by-mutation` are the good no-op classes; `unhandled` (neither acted nor rejected) is itself a finding; a uniform rejection-reason on a code-finding window means the contract took a side — triage the contract first.
Return: the summary counts, a ranked list of code-findings with the exact (scenario, window, pre-state, action) and your reading of the source, the spec-errors with the missed rule named, and a one-line honest caveat that this is a consistency check, not a proof. Do not overstate: a clean run means observable behavior matches an independent reading of the source, over the declared finite (action, data) domains only — nothing more.
Your tests check the paths you thought of. Polygraph checks the ones you didn't.
Repo: cognitive-fab/polygraph
Autonomously author NEW verifiable stateful code from a feature description — draft a contract, author a SAM v2 strict-profile module, self-repair against…
Autonomously prepare an invariant-elicitation session — harvest candidate invariants from the contract vocabulary, traces, and snapshots, pre-check each…
Autonomously check whether a state-machine version change is safe against the live fleet — classify it into compatibility lanes, run the mechanical gates…
Autonomously render Polygraph verification artifacts into a clean, brand-consistent diagram set (SVG, optional PNG) and return where the figures landed. Given…