capture-ready

A coding rule for making stateful code record its own execution as it is written. A state machine is a program that changes stored data in response to actions; capture-ready code exposes the listener needed to collect those actions and results.

In plain words
What is it for?
Use it when writing or substantially changing a state machine, workflow, reducer, store, or protocol handler in Python, Go, Rust, JavaScript, TypeScript, or another language.
Why use it?
It avoids later modifying or copying code just to obtain traces for testing. The rule makes verification easier, but following it alone does not prove that the code is correct.

Skill for Claude CodeCodex

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 skills/cognitive-fab/polygraph/capture-ready
Any agent
npx skills add cognitive-fab/polygraph --skill capture-ready
Clone the repo
git clone --depth 1 https://github.com/cognitive-fab/polygraph

Made for: Claude Code, Codex.

Per session 215 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,694 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.00215 $0.01694
Opus 5 $0.00108 $0.00847
Sonnet 5 $0.00043 $0.00339
Haiku 4.5 $0.00021 $0.00169

Measured 2d ago against content hash 3c4561f1a9fe, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

capture-ready 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 2d ago.

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.

skills/capture-ready/SKILL.md · 117 lines

How it starts

The opening of the file, as written. The whole thing — 117 lines — stays where its author put it; the contents beside it link to each section on GitHub.

capture-ready — write it instrumented, so nobody retrofits traces

The Polygraph toolchain starts working at code-generation time, not at verification time. Every other capture path in this repo answers "the code exists; how do I get traces out of it?" — instrument a copy, keep a patch, hope it doesn't rot. That retrofit is only ever necessary because the code was shaped without capture in mind. This skill states the rule for code an agent writes: get the shape right at authoring time and the corpus falls out of a listener registration — no patch, no seam hunt, nothing to re-derive when the code moves.

Source of truth (ships with the plugin — read it when detail is needed): ${CLAUDE_PLUGIN_ROOT}/docs/capture-ready.md. The retrofit path for code we did NOT write is unchanged (polygraph skill Step 2 + docs/capture-spec.md) — never reshape someone else's target to make it easier to capture.

Scope disclosure: capture-ready is not verified and not evidence — a module can satisfy all eight requirements and be wrong. It is the precondition that makes verification cheap and repeatable.

When this fires

Any session where you are authoring or substantially reshaping stateful code — a state machine, workflow, reducer, store, saga, protocol handler — in ANY language, with or without polygen. Apply BEFORE the first commit: adding the listener seam to a well-shaped module later is a one-line change; adding a single step boundary to a module that grew three mutation paths is a rewrite. If polygen is in play (JS/TS), it enforces CR-1..CR-4 and CR-8 structurally; your job narrows to CR-5, CR-6, CR-7 as review points.

The eight requirements

  • CR-1 — One named step boundary. All state change flows through a single entry taking a named action and its data (dispatch(action, data), handle(msg), next(state, action, data)). No second mutation path, no transition logic in a route handler, view, or useEffect. A trace window is defined by this boundary.
  • CR-2 — Observable state is a declared projection. One function returns exactly the contract's state keys — a snapshot, never references into a live model (aliasing makes pre === post and every window silently reads as a no-op).
  • CR-3 — Rejections are observable. An action that does not apply produces an explicit reject(reason) and a window with pre == post — never a throw (the window is lost) and never a silent return state (deliberate no-op and unhandled become indistinguishable).
  • CR-4 — A step-listener seam exists from the first commit. The module accepts an optional observer firing once per step, after the transition settles, with {action, data, classification}. Defaults to a no-op; costs nothing unused. This single requirement is what replaces the instrumentation patch forever.
  • CR-5 — Non-determinism is injected. Clock, RNG, ID generation, env reads, locale formatting are constructor/config ports so a scenario can pin them at a seed. Ambient reads make deterministic re-capture impossible without redacting the very fields the transition depends on.
  • CR-6 — Effects are declared, then executed at the edge. The transition returns/records effect intent; a caller performs the I/O. No await fetch(...) mid-transition. (Also the precondition for running under polyrun, whose journal is the strongest corpus in the system.)
  • CR-7 — Scenarios are exported functions, callable from plain Node/CLI — not bodies buried in a test runner. The same drivers serve the test suite, the demo corpus, and any later capture run.
  • CR-8 — One in-flight step per instance. The step boundary serializes: a transition settles before the next action presents. This is an observable serialization point, not a thread-safety claim — transactional handlers, queue consumers, actor mailboxes, and per-node apply loops all satisfy it.

Read the full file on GitHub · 117 lines

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. 2d ago First seen · 117 lines · 0 tokens per session scan A 3c4561f1a9fe

Subscribe to this mod's changes

capture-ready is a skill published in the GitHub repository cognitive-fab/polygraph (11 stars, last pushed 6d ago), licensed Apache-2.0. It adds 215 tokens to every session and 1,694 once invoked, about $0.0011 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.