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/polygengit 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.00043 | $0.01120 |
| Opus 5 | $0.00022 | $0.00560 |
| Sonnet 5 | $0.00009 | $0.00224 |
| Haiku 4.5 | $0.00004 | $0.00112 |
Grade A, and why
polygen 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 — 78 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Run polygen over the arguments in $ARGUMENTS. This is the AUTHOR side of the
method (companion to /polygraph:verify, which AUDITS existing code): instead
of deriving a spec from code that already exists, it writes new code that is
verifiable from the moment it's written.
This drives ${CLAUDE_PLUGIN_ROOT}/scripts/polygen.mjs:
node ${CLAUDE_PLUGIN_ROOT}/scripts/polygen.mjs \
--intent "<feature description>" --model <id> \
[--contract <c.json>] [--lang javascript] [--out out/] \
[--repair-max 3] [--max-tokens 32000]
The scripted run needs ANTHROPIC_API_KEY and an explicit --model (no
default — pass the exact Anthropic model id if not using a known alias).
Recommend opus-5 with the repair loop on (the default); fable-5 only for
one-shot runs with --repair-max 0; on an API policy refusal retry with
opus-4.8 (per-step source of truth: RECOMMENDED_MODELS in
scripts/models.mjs). v1 is JS/TS only.
No ANTHROPIC_API_KEY in the environment? Do not fail — ASK the user,
with the tradeoffs. Only the authoring model call needs the key; every
gate is keyless local execution. Put the choice to them per the polygen
skill's Step 0: "I don't have an API key — (a) continue keyless: I author
the artifacts in this session and run every mechanical gate locally (same
checking strength, zero API cost; you give up a pinned model id and a
scripted, re-runnable authoring step), or (b) supply a key for the scripted
CI-grade run (pinned model, automated repair loop, standard report)?" If
they choose keyless: author in-session in the same artifact style, run the
same gates (check.mjs, corpus synthesis + validate_corpus.mjs,
separate-process replay), fix code at counterexamples until clean, and
record the provenance ("authored in-session, keyless") in the handoff.
What it does, in order:
- Drafts a
contract.jsonfrom the feature description (or uses one you supply with--contract) — the observable state, action alphabet,dataDomain(concrete enumerable values — required for model checking to see parameterized actions at all), terminal states, and special rules. - Authors the module against that contract — by default a SAM v2
strict-profile module (named intents/schemas/domains, keyed acceptors,
reject(reason), sealed model; must load strict-clean through thevalidate()gate). - Proposes
invariants.mjs— rules encoding intent, not just behavior. - Self-repairs: model-checks the code against its own invariants (exhaustive
reachability, same engine as
check.mjs), and on a reachable violation, patches the code and re-checks — capped at--repair-max(default 3). A run that does not converge within budget is reported as NOT converged, never silently presented as clean. - Synthesizes a demo/regression trace corpus by driving the final code through model-proposed scenarios, validates it, and independently replays it in a separate process as a sanity check.
Steps to perform:
- Run the command above with the parsed arguments.
- Read
<out>/polygen-report.mdand walk the user through it: the contract (flag if model-drafted — review before use), the code, the invariants (flag as proposed, not authoritative), the repair-loop outcome (converged or not), and the corpus/replay results. - Tell the user the next steps explicitly: review the contract and
invariants by hand, wire the module into the real handler/reducer (v2:
dispatch
actions[name](data)and readgetState(); legacy: callnext()— either way call it, don't reimplement the logic inline), then run/polygraph:verifyagainst REAL captured traces after integration to catch drift between this pure model and the glue code around it.
Always state that this is a consistency check, not a proof — the code has been model-checked against its OWN stated invariants, over its OWN declared finite action/data domains, and independently replayed, which is not the same as being correct. The contract and invariants are the model's reading of intent; they need human review.
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 · 78 lines · 43 tokens per session scan A 7bcd1593e788
polygen is a command published in the GitHub repository cognitive-fab/polygraph (11 stars, last pushed 5d ago), licensed Apache-2.0. It adds 43 tokens to every session and 1,120 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
You are an SEO expert agent for SonicJS, a modern headless CMS built for Cloudflare's edge platform. Your goal is to help SonicJS rank for relevant keywords and grow organic traffic through legitimate, high-quality content strategies.
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.