polyvers

A version-compatibility checker for state machines, which are programs that move between defined states after receiving actions. It compares two artifact versions, runs the checks required by the detected change, and can prepare migration files.

In plain words
What is it for?
Use it to classify a state-machine change, test it against snapshots or generated cases, validate migrations, scaffold migration code, and check parent-and-child version combinations.
Why use it?
It helps catch changes that could break saved state, existing messages, running processes, or related machines before deployment. The checks are repeatable and do not need an API key.

Command

Install

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.

agentmods
npx agentmods add commands/cognitive-fab/polygraph/polyvers
Clone the repo
git clone --depth 1 https://github.com/cognitive-fab/polygraph
Per session 56 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 976 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What 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.

ModelPer sessionOnce invoked
Fable 5 $0.00056 $0.00976
Opus 5 $0.00028 $0.00488
Sonnet 5 $0.00011 $0.00195
Haiku 4.5 $0.00006 $0.00098

Measured yesterday against content hash dca39880914f, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

polyvers 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.

commands/polyvers.md · 59 lines

What it actually says

Run polyvers over the arguments in $ARGUMENTS. This is the VERSIONING side of the method (Polygraph audits, polygen authors, polyrun executes, polyvers EVOLVES): given two versions of a machine's artifact family, classify the change, run exactly the gates its lanes require, and gate the deploy on the compat-report. Everything is deterministic and needs no API key.

This drives ${CLAUDE_PLUGIN_ROOT}/polyvers/bin/polyvers.mjs:

node ${CLAUDE_PLUGIN_ROOT}/polyvers/bin/polyvers.mjs classify --old <dir> --new <dir> [--json]
node ${CLAUDE_PLUGIN_ROOT}/polyvers/bin/polyvers.mjs check    --old <dir> --new <dir> \
    (--snapshots <path> | --synthesize) [--max-states N] [--allow-bounded] [--out out/compat] [--json]
node ${CLAUDE_PLUGIN_ROOT}/polyvers/bin/polyvers.mjs migrate scaffold --old <dir> --new <dir> [--force]
node ${CLAUDE_PLUGIN_ROOT}/polyvers/bin/polyvers.mjs matrix \
    --parent-old <dir> --parent-new <dir> --child-old <dir> --child-new <dir> --child-id <machineId>

An artifact dir holds contract.json + the SAM v2 module + optional invariants.mjs, effects.manifest.json, effects.cjs, migrate.cjs — exactly what polygen emits.

Workflow:

  1. classify first — it names the lanes (shape / vocabulary / intent / semantic / migration / composition) and the gates they demand, without running anything.
  2. Pick the snapshot corpus honestly — fleet exports (--snapshots: polyrun archive output or state dumps; "live" means a FRESH export fed to this flag — polyvers never connects to a database) > --synthesize (BFS-reachable states of the OLD machine — the weakest tier: it contains only states the old MODEL says are reachable, which is exactly the assumption a landmine violates). Always tell the user which tier was used; the report records it.
  3. check — exit 0 is the gate. Read the report's failures BY LANE, and triage with this vocabulary: migration-defect (migrate.cjs is wrong — fix it), rule-regression (the new rules can hurt live state — the seeded model check's counterexample is the repro), meaning-gap (a live state has no honest image in the new version — escalate to the human with the named snapshots; NEVER auto-repair this one).
  4. Shape change? migrate scaffold, have the human fill/confirm the TODO holes and the MIGRATION-NOTE, re-run check (the migrate gate validates purity, acceptance, projection equality, state+transition invariants, then every downstream gate runs over the MIGRATED corpus). polyrun migrate (dry run, then --apply) remains the apply-time gate over live snapshots.
  5. Parent/child machines? matrix checks the 2×2 rollout-window pairings of the spawn/completion protocol and its delivery (--parent-snapshots / --child-snapshots seed fleet states into discovery and delivery).

A BOUNDED exploration is a failing gate unless the operator explicitly accepts it with --allow-bounded. An empty corpus, a missing invariants file, or an unreadable stimulus set are refusals, never vacuous passes. The gates are exactly as good as the invariants the artifacts state — say so.

Changes

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.

  1. yesterday First seen · 59 lines · 56 tokens per session scan A dca39880914f

Subscribe to this mod's changes

polyvers is a command published in the GitHub repository cognitive-fab/polygraph (11 stars, last pushed 5d ago), licensed Apache-2.0. It adds 56 tokens to every session and 976 once invoked, about $0.0003 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.