Assura
OfficialAssura
Write what it should do. AI proves it does.
A contract-first language for the AI era. You write behavioral contracts. AI writes the implementation. An SMT solver proves it correct, or hands you the exact input that breaks it. Ships as Rust.
Docs · Getting started · Try in browser · What we prove · Contributing
A test tells you it failed. Assura tells you why.
Here is a real invariant from the zip crate's
central-directory parser. The archive offset is computed as
cd_offset - relative_cd_offset, an unchecked subtraction on a u64:
contract FindCdSubtractSafe {
input(cd_offset: Nat, relative_cd_offset: Nat, eocd_offset: Nat)
requires { cd_offset <= 18446744073709551615 }
requires { relative_cd_offset <= 18446744073709551615 }
requires { eocd_offset <= 18446744073709551615 }
requires { cd_offset <= eocd_offset }
// archive_offset = cd_offset - relative_cd_offset (unchecked)
ensures { cd_offset >= relative_cd_offset }
}Run it:
$ assura check demos/zip-crate-audit.assura
FindCdSubtractSafe:
ensures ... COUNTEREXAMPLE
| cd_offset = 0, eocd_offset = 0, relative_cd_offset = 1This file has no implementation body. The check asks whether those preconditions imply the ensures. They do not. For this linear query the solver returns one input inside the preconditions that underflows: a crafted archive whose central directory claims a relative offset larger than its absolute one. A fuzzer might find this. A complete decision procedure for this fragment does not miss it. Where the encoding is incomplete, the result is Unknown, not a green check.
The human line keeps the raw digits. A value on a width bound, within 32
of one, or an exact power of two from 2^8 up also gets a note, for
example 18446744073709551586 (u64::MAX - 29). --json leaves
variables as the raw digits.
You get Verified, a Counterexample, or an honest Unknown.

Regenerate: vhs assets/demo/assura-check.tape (requires VHS and assura on PATH).
Related MCP server: CSL-Core
Try it without installing anything
The devcontainer installs Rust and libz3-dev. The first build takes a few
minutes. A warm start needs Codespaces prebuilds
enabled in the repo settings. Without that, the build still runs when the
container is created. After the build:
cargo run --bin assura -- check demos/zip-crate-audit.assura # counterexamples (intentional)
cargo run --bin assura -- check demos/heartbleed.assura # a clean proofInstall
cargo install assura --lockedNeeds a Rust toolchain (edition 2024 / rustc 1.88+). Z3
comes prebuilt via the z3 crate. No manual Z3 install for a normal build.
See Getting started for Homebrew, the LSP, and
the unpublished VS Code extension.
Prefer a binary? Use the shell installer (Linux x86_64, macOS arm64/x64):
curl --proto '=https' --tlsv1.2 -LsSf \
https://github.com/assura-lang/assura/releases/latest/download/assura-installer.sh | shThen:
assura init my-project
cd my-project
assura check contracts/lib.assura # prove the scaffold (add --json for agents)
assura build contracts/lib.assura # emit RustFull command reference, LSP, VS Code extension, and library embedding: Getting started · Cheatsheet
MCP server
This repository contains the MCP server. The implementation is the Rust crate
crates/assura-mcp. It uses the rmcp
SDK with the server and transport-io features. There is no separate
assura-mcp binary. The assura command starts that server on stdio:
assura mcp{
"mcpServers": {
"assura": {
"command": "assura",
"args": ["mcp"]
}
}
}The process speaks MCP on stdin and stdout. With no host attached, the terminal looks idle.
crates/assura-mcp registers these tools:
Tool | What it does |
| Parse, type-check, and verify a contract. Pass |
| Infer skeleton contracts from Rust source. |
| Explain an Assura error code. |
| Map a Rust type such as |
| Render a prompt that asks for Implementation IR. |
| Check that IR against the contract with Z3 or CVC5. |
A check returns Verified, a Counterexample, or Unknown. Unknown means the solver did not decide. Stop when there is no Counterexample. Do not keep rewriting because a clause is Unknown.
The official MCP Registry name is io.github.assura-lang/assura. Agent
details: For AI agents.
Why this exists
AI writes a lot of new code, and reviewing it is the bottleneck. AI-generated
tests are especially weak here: they tend to mirror the implementation. If
divide(10, 0) returns 0 because of a bug, the generated test asserts == 0.
The test passes. The bug ships.
Assura replaces that trust with proof. Contracts state what must hold.
With an implementation (IR, synthesized body, or check-rust), Z3/CVC5
checks that body against the contract. With no body, as in the zip example
above, it checks whether the ensures follows from the requires. Either way
you get a counterexample the AI can fix against, for the fragments the
solver can model. A loop can close without a human guessing at edge cases.
Property tests and fuzzing sample the input space. A solver reasons over all of
it, for the fragments it can model. Where it cannot, Assura says Unknown
rather than pretending. The honest map of that boundary is
What we prove.
How it works
contracts (.assura) ──► AI generates implementation
│
▼
Assura verifies (Z3 / CVC5)
│
┌─────────────────────┴──────────────────────┐
│ │
counterexample ──► back to the AI proof holds
▲ │ │
└────────────────────┘ ▼
Rust source ──► rustc ──► binary / WASMThree tiers, fastest first:
Tier | Time | Checks |
Structural | < 10ms | Types, syntax, names |
Decidable SMT | < 200ms | Refinement types, flow analysis, effects |
Heavy SMT | < 10s | Full invariants, temporal properties |
Real CVEs, as contracts
Demo | Models |
CVE-2014-0160, TLS heartbeat over-read | |
CVE-2023-4863, CVSS 9.8 heap overflow that hit every major browser | |
Offset arithmetic in a real Rust crate |
More in demos/ and one worked example per feature in examples/.
Case studies: docs/CASE-STUDIES.md.
Contributing
New here? Good first issues are kept stocked and scoped. Each one names the file to open and how to verify it.
Bug reports are just as valuable as patches. If assura check gives you a wrong
answer, a confusing counterexample, or an Unknown you think should verify,
open an issue. Those
reports are how the solver encoding gets better.
Start with CONTRIBUTING.md. Architecture and crate map: docs/INTERNALS.md.
Documentation
Site: assura-lang.github.io/assura (not assura.dev, a different product)
Install → check → build | |
Your first contract | |
Types, clauses, effects, CLI on one page | |
Ready-to-copy contract patterns | |
The honesty map: Verified / Unknown / Counterexample | |
Dafny, Verus, Liquid Haskell, tests | |
JSON output and IR acceptance. The MCP server in this repo is above. | |
Greenfield, retrofit, audit, CI, onboarding | |
Z3 timeouts, counterexamples, common errors | |
Architecture, crate map, SMT encoding | |
EBNF, 50 verification features, error codes | |
Phased implementation plan | |
How Assura compares in the survey | |
Canonical links, including installers |
Category | Features |
CORE Verification Infrastructure | Ghost code, lemmas, frame conditions, axiomatic definitions, quantifier triggers, opaque functions, prophecy variables, liveness contracts |
MEM Memory Safety | Memory regions, fixed-width integers, allocator contracts, circular buffer contracts |
TYPE Types and Contracts | Interface contracts, recursive structural invariants, error propagation |
SEC Trust and Security | Taint tracking, dependent types, constant-time execution, secure erasure, cryptographic spec conformance |
CONC Concurrency | Shared memory protocols, callback re-entrancy, determinism, lock ordering, temporal deadlines, weak memory ordering |
NUM Numerical and Precision | Numerical precision contracts, precomputed table verification |
PERF Performance | Unsafe escape with proof obligation, complexity bounds |
FMT Binary Formats | Binary/bit-level format contracts, string encoding, codec dispatch, checksum, protocol grammar |
STOR Storage | Crash recovery, page cache, MVCC, rollback, monotonic state, failure models |
PLAT Platform | Platform abstraction, feature flags, resource limits |
TEST Testing | Test generation from contracts, behavioral equivalence, multi-pass refinement |
MISC Miscellaneous | Incremental contracts, scoped invariant suspension |
A project activates only the categories it needs. CORE is always on.
License
Dual-licensed under MIT or Apache-2.0, at your option.
Available Tools
6 toolsassura_checkA
Parse, type-check, and verify an Assura contract. Returns structured diagnostics and verification results. Provide either source (inline code) or file (path to .assura file).
Inputs: file, source.
assura_explainA
Explain an Assura error code. Returns the error name, description, example, and suggested fix.
Inputs: code (required).
assura_inferA
Infer skeleton Assura contracts from Rust source code. Provide either source (inline Rust) or file (path to .rs file).
Inputs: file, source.
assura_ir_promptB
Render an AI prompt to generate Implementation IR (.ir sidecar) for an Assura contract. Provide source or file, optional decl, and pattern (auto by default).
Inputs: decl, file, source, pattern.
assura_ir_verifyA
Verify an Implementation IR against an Assura contract using SMT solvers (Z3/CVC5). Returns per-clause verification results with counterexamples and progress tracking. The core tool for the AI verification loop: generate IR, submit for verification, and read feedback. Stop when there is no Counterexample. Unknown is acceptable because some features are not encoded in SMT; do not keep rewriting the IR because a clause is Unknown. Provide contract via source/file and IR via ir/ir_file. When the file has more than one contract, pass decl (same names as assura_ir_prompt) so IR is not checked against the first contract only.
Inputs: ir, decl, file, source, +1 more.
assura_type_mapA
Map a Rust type to the equivalent Assura type (e.g. Vec -> List).
Inputs: rust_type (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 6 tools
Each tool targets a distinct stage of the verification workflow: check (contract verification), ir_verify (IR verification), ir_prompt (IR generation prompt), infer (contract inference), type_map (type conversion), and explain (error lookup). The closest pair is assura_check and assura_ir_verify, but the descriptions clearly distinguish whole-contract verification from Implementation IR clause checking.
All tools share the assura_ prefix and snake_case, which gives a predictable namespace. The suffixes mix verbs (check, infer, explain) with noun-ish compounds (ir_verify, ir_prompt, type_map), a minor deviation but still readable and grouped by the ir_ family.
Six tools is well-scoped for a contract verification server, with each tool corresponding to a clear step (infer, type map, prompt, verify, check, explain). No tool feels redundant or trivial.
The surface covers the full loop: infer a contract from Rust, map types, render an IR prompt, verify IR, check contracts, and explain errors. Minor gaps exist, such as no tool to apply or auto-fix diagnostics or to list/decompose multi-contract files beyond the decl parameter.
Maintenance
Related MCP Connectors
A deterministic verification engine for agents. Proves a fix: fails on the old code, passes on new.
Jailbreak-proof AI guardrails. Automated Reasoning SMT solver, not an LLM. ZK proofs included.
Certified program synthesis. Pay per call in USDC via x402; refusals never billed.
Runs your code against a contract; HELD or BROKE at the exact input. Deterministic. 0.10 USDC/call.
Related MCP Servers
- AlicenseNot gradedqualityNot gradedmaintenanceEnables formal verification of LLM outputs against compliance ontologies using Z3 SMT solver. Validates that AI-generated content adheres to regulatory requirements like HIPAA or mortgage compliance rules.MIT
- AlicenseAqualityBmaintenanceDeterministic AI safety policy engine with Z3 formal verification. Write, verify, simulate, and enforce machine-verifiable safety constraints for AI agents. Completely outside the LLM.1198 PyPI27Apache 2.0
- AlicenseAqualityCmaintenanceEnables logical entailment and satisfiability checks by dispatching formal SMT-LIB queries to both Z3 and cvc5, returning auditable solver verdicts, counterexamples, and caveats.4MIT
- AlicenseAqualityCmaintenanceEnables AI coding agents and IDEs to prove SystemVerilog assertions with SymbiYosys (smtbmc+z3) and lint SVA syntax, returning honest verdicts such as PROVEN, FAILED, UNKNOWN, ERROR, or TIMEOUT.38 npmApache 2.0