agent-formal-verify
Model-check protocols with TLA+, prove invariants with Lean 4, and check bounded Rust functions with Kani.
Package details
Install agent-formal-verify from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:agent-formal-verify- Package
agent-formal-verify- Version
0.4.13- Published
- Nov 26, 2026
- Downloads
- 2,282/mo · 218/wk
- Author
- code-den
- License
- GPL-3.0-only
- Types
- skill
- Size
- 455.9 KB
- Dependencies
- 0 dependencies · 0 peers
Pi manifest JSON
{
"skills": [
"./skills"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
Agent formal verify

A skill for Claude Code, Codex, Pi, OpenCode and Antigravity that implements the targeted formal-verification method recently promoted by Boris Cherny. The agent models selected parts of your code, checks their properties, maps counter-examples to source lines, and helps reproduce and fix reachable bugs.
It uses TLA+ and TLC for thread interleavings, shutdown and resource ownership, and Lean 4 for arithmetic, bounds and sequential state transitions. A protocol that depends on arithmetic can use both. For Rust functions with bounded inputs and loops, Kani checks the production code for overflow, invalid memory access, panics and broken invariants.
Install
Claude Code
Run in Claude Code:
/plugin marketplace add michael-denyer/agent-formal-verify
/plugin install agent-formal-verify@agent-formal-verify
Codex
Run in your terminal:
codex plugin marketplace add michael-denyer/agent-formal-verify
codex plugin add agent-formal-verify@agent-formal-verify
Pi
Run in your terminal:
pi install npm:agent-formal-verify
To install from Git instead, use pi install git:github.com/michael-denyer/agent-formal-verify.
OpenCode
OpenCode 2.2 or later. Run in your terminal:
opencode plugin add agent-formal-verify
To install from Git instead, use opencode plugin add 'git+https://github.com/michael-denyer/agent-formal-verify.git'.
Antigravity
Clone or check out the repository, then run in your terminal:
agy plugin install /absolute/path/to/agent-formal-verify
Run setup once to prepare the shared Java, Python, TLC, elan, Lean, Rust and Kani tools. In Claude Code, use /agent-formal-verify:setup. In Codex, request the plugin's setup skill. In Pi, use /skill:setup. In OpenCode or Antigravity, request the setup skill. It reuses installed prerequisites and needs no target repository.
For local checkouts and skills-only installs, see shared installation.
Getting started
Use formal-verify to check this queue's shutdown protocol and window arithmetic.
In Claude Code, use /agent-formal-verify:formal-verify. In Codex, type $formal-verify or request the plugin's formal-verify skill. In Pi, use /skill:formal-verify. In OpenCode or Antigravity, request the formal-verify skill.
How it works

- Choose what to check. If the repository already has models, the agent reads the source changes since each model was last checked, reruns its checks and mutations, and records what it promises before editing it. For new targets, it builds a TLA+ or Lean model or writes a Kani harness that calls the production Rust function.
- Test the guarantees. The agent reruns the checks itself, tests each property against deliberate mistakes, and compares existing guarantees with the record. Past bug fixes supply mutations where practical. You can also request an independent review of the properties against the code.
- Follow failures back to the code. The agent maps each counter-example to source lines, checks whether shipped settings can reach it, and tries to reproduce it. It reports a proposed fix and changes production code only if you ask. It gives you commands to rerun the checks and adds them to CI if you request it or the repository already runs models there.
A passing check establishes its stated properties under its assumptions and bounds. Reports must identify omitted constraints and unfinished proofs. See scope and evidence.
Details
- Skills and slash commands
- Shared installation
- Runtime setup and tool pins
- Plugin updates
- Verification workflow
- Release history
- Agent instructions
Data handling
The plugin configures no MCP servers or hooks, requires no credentials and has no telemetry. Its OpenCode entry point, opencode.mjs, reads and registers the bundled skills without running commands or making network requests. The agent sends selected source excerpts, models and results to its model provider. Verification runs locally. Setup verifies a TLC JAR you obtain from the pinned TLA+ release and uses elan to install a missing Lean toolchain. The Kani helpers use the pinned installation you prepare through Cargo. See tool setup.
Contributing
Bug reports, documentation fixes and runtime improvements are welcome. See CONTRIBUTING.md for development checks and pull requests.
License
Copyright (c) 2026 Michael Denyer. Licensed under the GNU General Public License, version 3, SPDX identifier GPL-3.0-only.