audit

audit is a command for coding agents from punt-labs/z-spec. It costs 7 tokens per session (2,501 once invoked), scanned A, a copy of audit-dev, MIT.

A plugin for creating, checking, and testing Z specifications, which are mathematical descriptions of software states and rules. It supports stateful systems—systems whose behavior depends on stored state—using fuzzing and ProB.

In plain words
What is it for?
Use it to create Z models, validate them with ProB, generate varied test inputs with fuzzing, and compare specifications with implementation tests.
Why use it?
It helps detect invalid states, rule violations, and missing test coverage in systems with complex state changes. Formal checks make requirements more precise than examples alone.

Command

Part of the z-spec-dev plugin — 42 commands, 1 hook shipped together

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/punt-labs/z-spec/audit
Clone the repo
git clone --depth 1 https://github.com/punt-labs/z-spec

Or install z-spec-dev, the plugin that ships this one along with the rest of its 42 commands, 1 hook.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for audit

README.md
[![agentmods](https://agentmods.dev/badge/commands/punt-labs/z-spec/audit.svg)](https://agentmods.dev/commands/punt-labs/z-spec/audit)
Your own site
<a href="https://agentmods.dev/commands/punt-labs/z-spec/audit"><img src="https://agentmods.dev/badge/commands/punt-labs/z-spec/audit.svg" alt="Measured on agentmods" height="20"></a>
Per session 7 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,501 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin 89% copy Near-identical to another mod 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.00007 $0.02501
Opus 5 $0.00003 $0.01251
Sonnet 5 $0.00001 $0.00500
Haiku 4.5 $0.00001 $0.00250

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

Security

Grade A, and why

audit 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 4d 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.

Origin

This is a copy

89% identical to audit-dev — 12 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

plugin/commands/audit.md · 285 lines

How it starts

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

/z-spec:audit - Test Coverage Audit

Audit unit test coverage against constraints defined in a Z specification. Extracts invariants, preconditions, effects, and bounds from the spec, then searches the test suite for coverage.

Input

Arguments: $ARGUMENTS

Parse arguments:

  • First positional argument: Z specification file (default: search docs/*.tex)
  • --json: Output JSON instead of markdown table
  • --test-dir=DIR: Override test directory detection

Process

0. Prerequisites

This command does not require fuzz or probcli. It reads existing Z specifications and searches test files using pattern matching. The specification should already exist (created via /z-spec:code2model).

1. Locate the Specification

If a file path is provided, use it directly.

If no file specified:

  • Look in docs/ for .tex files containing Z specifications
  • If multiple found, ask user to specify

Read the specification file.

2. Detect Language and Test Directory

If --test-dir specified, use it.

Otherwise, auto-detect from project files:

Indicator Language Test Directory Pattern
Package.swift, *.xcodeproj, project.yml Swift *Tests/
package.json, tsconfig.json TypeScript __tests__/, *.test.ts, *.spec.ts
pyproject.toml, setup.py, requirements.txt Python tests/, test_*.py, *_test.py
build.gradle.kts, pom.xml Kotlin src/test/

Use Glob to find test files matching the detected pattern.

3. Extract Constraints from Z Specification

Parse the specification and extract constraints into 4 categories:

Category 1: Schema Invariants

Location: \where clauses in state schemas (non-operation schemas without \Delta or \Xi)

Examples:

\begin{schema}{State}
level : \nat
\where
level \geq 1 \\
level \leq 26
\end{schema}

Extracts: level >= 1, level <= 26

Category 2: Operation Preconditions

Location: Predicates in operation schemas (\Delta or \Xi) that reference only unprimed state variables and inputs.

Read the full file on GitHub · 285 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. 4d ago First seen · 285 lines · 7 tokens per session scan A 2249fc7d866c

Subscribe to this mod's changes

audit is a command published in the GitHub repository punt-labs/z-spec (5 stars, last pushed yesterday), licensed MIT. It adds 7 tokens to every session and 2,501 once invoked, about $0.0000 per session on Opus 5. A static security scan graded it A with 0 findings. It is 89% identical to audit-dev, differing in 12 lines, and is treated as a copy.