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.
npx agentmods add commands/cognitive-fab/polygraph/verifygit clone --depth 1 https://github.com/cognitive-fab/polygraphWhat 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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00031 | $0.01160 |
| Opus 5 | $0.00015 | $0.00580 |
| Sonnet 5 | $0.00006 | $0.00232 |
| Haiku 4.5 | $0.00003 | $0.00116 |
Grade A, and why
verify 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 yesterday.
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.
How it starts
The opening of the file, as written. The whole thing — 81 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Run the Polygraph verification loop over the arguments in $ARGUMENTS.
This drives ${CLAUDE_PLUGIN_ROOT}/scripts/verify.mjs. The generated artifact
is a v2 SAM strict-profile module (named intents with schemas and finite
domains, keyed acceptors, observable reject(reason), sealed model). The 1.x
bare next(state, action, data) artifact was removed in 8.0.0. Two modes:
- Generate + replay (needs
ANTHROPIC_API_KEYand--model):node ${CLAUDE_PLUGIN_ROOT}/scripts/verify.mjs \ --contract <c.json> --source <file> --traces <dir> \ --model <id> --n 5 --out out/ - Replay saved specs (no key):
node ${CLAUDE_PLUGIN_ROOT}/scripts/verify.mjs \ --contract <c.json> --traces <dir> --specs <dir> --out out/
Useful flags:
--tla— TLC escalation tier: after the verdict, the winning live spec (most windows passed; tie → first) is mechanically transpiled to TLA+ (out/tla/*.tla+.cfg) and model-checked with TLC; the outcome (states, per-invariant verdicts, counterexample steps, skipped invariants with reasons) lands in a "TLC escalation" subsection offindings.mdPart 2. Toolchain discovery:POLYGRAPH_JAVA(orjavaon PATH) andPOLYGRAPH_TLA_JAR(path totla2tools.jar; no PATH fallback). A missing toolchain is reported as a note — the.tla/.cfgartifacts are still written. Optional:--tla-bound N,--tla-timeout <seconds>.--invariants <inv.mjs>/--max-states N— the model-checking half (Part 2); runs automatically wheninvariants.mjssits beside the contract.--no-auto-regen— generation mode regenerates ONCE automatically when the first pass hits the reject-as-annotation signature uniformly (every live spec rejected ≥2 windows the code acted on); this flag disables that. Both spec sets are kept (out/specs/,out/specs_regen/) and findings.md names both passes.--initial-states <states.json>— a JSON array of state objects seeded into every per-spec model check alongsideinit(). This is the remedy for aFROZEN STATE KEYwarning infindings.md(a key no action changes leaves Part 2 structurally blind to behavior it gates — seed non-default values to unfreeze it).
Recommended model: opus-5 for spec derivation; if the API refuses on policy
grounds, retry with opus-4.8 (per-step source of truth: RECOMMENDED_MODELS
in scripts/models.mjs). No default — pass the exact Anthropic model id if
you are not using a known alias.
Prerequisite: a REAL captured trace corpus. The corpus is the verification — if the code cannot be run and instrumented to capture traces, this tool does not apply (recommend hand-written modeling instead); never substitute synthetic traces derived from reading the source.
Steps to perform:
- If no
contract.jsonexists yet, help the user build one from${CLAUDE_PLUGIN_ROOT}/templates/contract.example.json(see the polygraph skill for the full method). In the v2 default pipeline every action with data fields MUST have adataDomainentry — it is also the exploration and transpilation domain, and a gap blocks generation loudly. - Validate the corpus first:
node ${CLAUDE_PLUGIN_ROOT}/scripts/validate_corpus.mjs <c.json> <traces>. Every action appearing in the traces must be declared in the contract — the v2 strict artifact has no silent-unknown-action fallback. - Run
verify.mjswith the parsed arguments. - Read
out/findings.mdand walk the user through each finding, classifying it as a code-finding, contract-error, or spec-error per the skill's Step 5. In the v2 default, each finding window also carries a step classification —rejected(reason)andidentity-by-mutationare the two GOOD no-op classes;unhandled(the spec neither acted nor rejected) is itself a finding.
Always state that this is a consistency check, not a proof — exhaustive only over the declared finite (action, data) domains, not unbounded real data — and that findings are leads to investigate by hand.
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.
- yesterday First seen · 81 lines · 31 tokens per session scan A 4193428c3c8a
verify is a command published in the GitHub repository cognitive-fab/polygraph (11 stars, last pushed 5d ago), licensed Apache-2.0. It adds 31 tokens to every session and 1,160 once invoked, about $0.0002 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.
Other commands, from other repositories
sonicjs-pr-fixer
You are a specialized agent that helps fix and merge problematic PRs in the SonicJS repository. This includes PRs from forks that need cherry-picking, Dependabot PRs that need e2e tests enabled, and any PR that needs fixes before merging.
sonicjs-seo-blog
Generate a high-quality, SEO-optimized blog post for SonicJS on the topic: $ARGUMENTS.
upgrade-nodejs
This guide explains how to upgrade the Node.js version that Bun reports for compatibility with Node.js packages and native addons.
upgrade-webkit
Upgrade Bun's WebKit fork to the latest upstream version of WebKit.
dedupe
Find duplicate GitHub issues.
gh-debug-issue
../../.mastracode/commands/gh-debug-issue.md.