Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Agent verification loop

How agents (and humans) should iterate on Assura without treating every green check as full mathematical coverage.

Loop

1. Write / edit contract surface
   - Preferred: .assura contracts
   - Optional: /// @requires / @ensures on Rust + assura check-rust
2. Propose an implementation
   - IR sidecar, auto-implement, or ordinary Rust body
3. Run a machine check
   - assura check path.assura --json
   - assura check-rust src/ --json
4. Branch on structured results (below)
5. Fix contract or body; repeat

Demo that shows CE then success: demos/check-rust/fail/clamp_wrong.rs (expect fail) vs demos/check-rust/ok/clamp.rs (expect pass).

assura check-rust demos/check-rust/fail/clamp_wrong.rs --json   # errors >= 1
assura check-rust demos/check-rust/ok/clamp.rs --json           # verified >= 1

JSON field contract

assura check path.assura --json

Top-level keys commonly used by agents:

FieldMeaning
file_info.successParse/resolve/type path succeeded (not the same as SMT proof)
file_info.vacuous / vacuous reasonsNo SMT obligations; do not treat as full coverage
diagnosticsStructural / type diagnostics
verification[]Per-clause SMT outcomes
verification[].clausee.g. Name::ensures
verification[].statusverified / counterexample / timeout / unknown (and related)

Agent policy (LLM IR / auto-implement):

OutcomeAction
Any counterexampleReject; fix body or contract
unknown with reason containing not yet encoded in SMTWarning / non-proof; do not claim Verified (CLI often exit 0)
Other unknown / timeoutTreat as inconclusive; tighten, raise timeout, or simplify
All modeled clauses verified, not vacuousAccept for those clauses
Vacuous successNot coverage of ensures

See What we prove and SMT portfolio note.

assura infer / MCP assura_infer

CLI --json and MCP assura_infer return a JSON envelope, not raw .assura text.

FieldMeaning
successNo hard error. Vacuous infer (no functions / no-risk Rust) is true.
vacuous / vacuous_reasonNothing inferred; do not treat as a generated contract
textInferred contract source. Write this field to a .assura file.

Vacuous infer: success true, vacuous true, text empty or a placeholder. success: false is parse/IO/LLM/unknown-function/jail only.

assura check-rust path --json

FieldMeaning
verifiedCount of proved annotation clauses / items (see CLI version)
errorsFailures including counterexamples on annotated items
body_not_modeledEnsures present but body not encoded and no .ir (fail closed; exit 1)
files / items / clausesCounts
results[]Per-item: status (verified, error, body_not_modeled, …), item, file
policyHuman-readable body-proof policy string

Agent policy (check-rust):

OutcomeAction
errors > 0Reject; inspect CE / fix
body_not_modeled > 0Not proved; simplify body, add .ir, or see CHECK-RUST-SURFACE
verified > 0 and errors == 0 and BNM == 0Accept for those annotations

Do not require every pipeline clause to be verified when using .assura auto-implement (Unknown from unmodeled features is common). Do require no Counterexample for IR acceptance.