GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • snappea
  • Docs
  • Playground
  • GitHub

This view

  • Original page
  • New address

GeezerVison is showing snappea.dev — Snap Pea

Formal models for developers and their agents.

Explore how your application behaves under retries, failures and unexpected event orderings. Check the design before you build, then use the same specs in your application tests.

Try the playgroundRead the docsGitHub

What a model looks like

A model is a short program that describes a design. This one is written in P: state machines that send each other messages. The checker runs it under many message orderings and reports any ordering that breaks a rule.

Here, two clients each add one to a shared counter.

Each client reads, then writes Model.p

send input.counter, eRead, this;
receive { case eValue: (x: int) { v = x; } }
send input.counter, eWrite, v + 1;

The test starts two clients, then checks the total Test.p

assert final == 2;

The checker finds an ordering that loses an increment

  1. Client A reads 0
  2. Client B reads 0
  3. Client A writes 1
  4. Client B writes 1

Assertion failed: expected 2 increments, counter is 1

This is the result for the model as written. Run it to get the checker's own output, then try Atomic increment.

Runs in your browser; no code leaves this page. 2-second budget, mutation testing off.Open these files in the full Playground →

Walk through this model step by step →

One spec checks the design and the running code

A spec is a state machine that watches events and checks rules about them. Check the model's events while you design. Then check your application's events from ordinary tests, against the same spec.

You, or an agent, write a model of the design. snappea check runs it thousands of times, each with a different ordering of messages, and the spec flags any run that breaks a rule. None of your service code is involved.

When the checker finds a failing ordering in the model, turn it into a regression test that forces the same ordering on the real code.

The diagram is an illustration, not a live check. Model checks cover the behavior and assumptions you modeled. Application checks cover the events your tests produce; they do not explore every execution of your code.

Models are tested like code

A model can pass because it is right, or because its checks never look at the part that is wrong. Four checks tell the two apart.

Coverage

Shows which branches, handlers and scenarios the checks reached, and which they never ran.

Understand coverage →

Mutation testing

Changes the model in small ways and reports each change your specs did not notice.

Mutation testing →

Lints

Flag specs no test selects, assertions that are always true, and specs that accept everything.

Model lints →

Driver limits

List what the test never tried: fixed client counts, input values and event orders.

Driver limits →

Built for agents

Most model checkers were designed for a person at a terminal. Snap Pea's commands, guide, error messages and checks were designed for an agent to run, and changes to them are measured with agent evals.

Fewer missed design mistakes in pilot evals

In pilot evals, agents modeled a design. Hidden broken versions of that design were then run against the specs and tests the agents wrote. Agents using snappea missed 22 of 180. Agents using the same checker through the upstream p command line missed 50. That is 56% fewer.

Haiku agents, three to six runs per task. Eval setup and results

The guide is in the binary

snappea guide teaches the workflow: what to model, where to stop, and how to test the implementation against the specs. There is no skill file to write or keep in sync.

One command runs every check

snappea check lints the model, tries message orderings, and reports coverage and mutation results. It picks the search strategies; the caller sets a time budget. It is one binary with no .NET or Java to install, so it runs in a bare CI image or agent sandbox.

JSON results, and errors that name the fix

snappea check --json prints structured results. Every error says what went wrong, where, and what to try next.

A model with untested behavior fails the check

Lint findings, coverage gaps and undetected mutants fail the check, so an agent cannot stop at a model that passes without testing anything.

What the checker prints when the counter model misspells an event:

error: could not find name 'eWrit'
   --> Model.p:16:27
   |
15 |       receive { case eValue: (x: int) { v = x; } }
16 |       send input.counter, eWrit, v + 1;
   |                           ^^^^^
   |
   = help: did you mean 'eWrite'? Otherwise declare the name before using it

Work with your agentRun checks in CI

How it compares

Upstream P

Snap Pea runs the P models you already have, through either of two commands. Both are one binary that reads .p files directly. Upstream P compiles a model to C# and runs it on .NET; Snap Pea needs no .NET, C# or Java toolchain and has no compile step.

snappea-compat: a drop-in for p, about 100 times faster

It takes the same options and prints the same output and replayable schedules, so existing scripts keep working. See compatibility and migration.

snappea: the command line designed for agents

It adds automatic search, lints, coverage and mutation testing. In pilot evals, agents using it missed 56% fewer hidden design mistakes than agents using the p command line. Eval results.

Six P tutorial tests, 19,120 schedules:

snappea-compat takes 1.8 seconds. P 3.1.0 takes 189 seconds, 13 of them compiling. Same runner, one worker, measured 2026-11-12. Results vary by model. Benchmark setup and results

snappea0.0 s
P 3.1.00.0 s
compile checkPlayed at 40× speed.

TLA+

TLA+ describes a system as logic formulas over its state. P describes it as state machines that send each other messages, which reads closer to service code.

Verus

Verus proves properties of Rust code itself, which suits low-level work such as data structures and memory safety. P checks the design of a distributed system: message orderings, retries and failures.

Install

The checker is one binary with no runtime dependencies. On Linux or macOS, install it and read the built-in guide:

$ curl -fsSL https://raw.githubusercontent.com/crowecawcaw/snappea/main/scripts/install.sh | sh
$ export PATH="$HOME/.local/bin:$PATH"
$ snappea guide

The installation guide covers Windows, pinned versions, Cargo and PyPI. To check events from application tests, add the helper for Python, Rust, Go or Java.

Try the playgroundRead the docs
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.