oracle-dev

A test generator that compares a real program with a formally checked Lean 4 model. It runs many randomly created sequences of actions and checks whether both produce the same result.

In plain words
What is it for?
Use it to test Swift, TypeScript, Python, or Kotlin implementations when a Lean 4 specification and executable model are available.
Why use it?
It can uncover cases that hand-written tests miss by checking many possible action sequences against a reference model.

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/punt-labs/z-spec/oracle-dev
Clone the repo
git clone --depth 1 https://github.com/punt-labs/z-spec
Per session 12 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 12,073 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. 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.00012 $0.12073
Opus 5 $0.00006 $0.06037
Sonnet 5 $0.00002 $0.02415
Haiku 4.5 $0.00001 $0.01207

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

Security

Grade A, and why

oracle-dev scanned grade A with 1 finding 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.

Runs shell commandslowCapability

Expected in a hook, worth knowing in a rule or an instructions file.

import { execSync, spawn } from 'child_process';
Origin

Copies of this mod

1 near-identical copy found in the catalogue:

  • oracle — 89% identical, 50 lines differ
plugin/commands/oracle-dev.md · 1,636 lines

How it starts

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

/z-spec-dev:oracle-dev - Property-Based Oracle Testing

Generate a property-based test harness that uses the executable Lean 4 model (from /z-spec-dev:prove-dev) as a test oracle. For random sequences of operations, the harness executes them against both the Lean model and the real implementation, applies an abstraction function to map concrete state to abstract state, and asserts they match.

This is QuickCheck against a proven-correct reference implementation.

Input

Arguments: $ARGUMENTS

Parse arguments:

  • First positional argument: Z specification file (default: search docs/*.tex)
  • Second positional argument: target language (swift, typescript, python, kotlin)
    • If not specified, auto-detect from project files
  • --sequences N - number of random sequences to test (default: 100)
  • --steps N - max operations per sequence (default: 20)

Process

0. Prerequisites

Verify Lean 4 and Lake are installed:

which lean >/dev/null 2>&1 || echo "LEAN_NOT_FOUND"
which lake >/dev/null 2>&1 || echo "LAKE_NOT_FOUND"

If lean or lake not found: Stop and tell the user:

Lean 4 is not installed. Run /z-spec-dev:setup-dev lean to install the Lean 4 toolchain via elan.

Verify the Lean project from /z-spec-dev:prove-dev exists:

ls proofs/lakefile.toml 2>/dev/null && echo "PROJECT_EXISTS"
ls proofs/ZSpec/State.lean 2>/dev/null && echo "STATE_EXISTS"
ls proofs/ZSpec/Operations.lean 2>/dev/null && echo "OPS_EXISTS"

If proofs/ does not exist or is incomplete: Stop and tell the user:

The Lean 4 project is missing or incomplete. Run /z-spec-dev:prove-dev first to generate the Lean model, then run /z-spec-dev:oracle-dev.

Verify Lean version compatibility:

lean --version 2>&1

The output should show Lean 4.x. If it shows Lean 3.x or an error, advise the user to update via elan update.

The Z specification should already exist and have been type-checked (via /z-spec-dev:check-dev). If the user has not done this, suggest it but do not block.

Read the full file on GitHub · 1,636 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. yesterday First seen · 1,636 lines · 12 tokens per session scan A 95a1d1d94acb

Subscribe to this mod's changes

oracle-dev is a command published in the GitHub repository punt-labs/z-spec (5 stars, last pushed yesterday), licensed MIT. It adds 12 tokens to every session and 12,073 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 1 finding (runs shell commands). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.