oracle

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

A command that builds randomised tests from a Lean 4 model, a formally checked description of how software should behave. It compares the model with the real implementation across sequences of operations.

In plain words
What is it for?
Use it to test Swift, TypeScript, Python, or Kotlin code against a Lean 4 reference model, with random operation sequences and an optional state-mapping function.
Why use it?
It finds cases where the implementation behaves differently from the checked model, including combinations of operations that hand-written tests may miss.

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/oracle
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 oracle

README.md
[![agentmods](https://agentmods.dev/badge/commands/punt-labs/z-spec/oracle.svg)](https://agentmods.dev/commands/punt-labs/z-spec/oracle)
Your own site
<a href="https://agentmods.dev/commands/punt-labs/z-spec/oracle"><img src="https://agentmods.dev/badge/commands/punt-labs/z-spec/oracle.svg" alt="Measured on agentmods" height="20"></a>
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,021 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. 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.1 $0.00012 $0.12021
Opus 5 $0.00006 $0.06011
Sonnet 5 $0.00002 $0.02404
Haiku 4.5 $0.00001 $0.01202

Measured 5d ago against content hash de47c42abc2b, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, from the pricing page.

Security

Grade A, and why

oracle 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 5d 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.

Runs shell commandslowCapability

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

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

This is a copy

89% identical to oracle-dev — 50 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/oracle.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:oracle - Property-Based Oracle Testing

Generate a property-based test harness that uses the executable Lean 4 model (from /z-spec:prove) 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:setup lean to install the Lean 4 toolchain via elan.

Verify the Lean project from /z-spec:prove 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:prove first to generate the Lean model, then run /z-spec:oracle.

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:check). If the user has not done this, suggest it but do not block.

1. Locate the Specification

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. 5d ago First seen · 1,636 lines · 12 tokens per session scan A de47c42abc2b

Subscribe to this mod's changes

oracle is a command published in the GitHub repository punt-labs/z-spec (5 stars, last pushed 2d ago), licensed MIT. It adds 12 tokens to every session and 12,021 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 1 finding (runs shell commands). It is 89% identical to oracle-dev, differing in 50 lines, and is treated as a copy.