aallan/vera
Vera: a programming language designed for LLMs to write
What it solves
Vera tackles the problem that large language models (LLMs) struggle to keep code correct across large codebases. Models often make naming mistakes, lose track of which name refers to which value, and fail to maintain invariants. Vera eliminates variable names entirely and makes every function's behaviour explicit through mandatory contracts that the compiler verifies, so wrong code is caught before it runs.
How it works
Vera replaces variable names with structural references (like @Int.0 for the most recent Int binding and @Int.1 for the one before). Every function must declare three clauses: requires (preconditions), ensures (postconditions), and effects (what side effects it may have). The compiler uses the Z3 theorem prover to attempt static proofs of these contracts. Contracts that can be proved become guaranteed; those the solver cannot decide become runtime checks. If a proof fails, the compiler refuses the program with a counterexample; if the solver is unsure, a runtime trap catches the violation instead of returning a wrong answer.
Effects are explicit: functions are pure by default, and any function that calls an LLM, makes an HTTP request, or touches a database must declare that in its signature. Callers must explicitly allow those effects, so unexpected side effects cannot sneak in.
The compiler also prevents SQL injection structurally: SQL query text must be written literally into the source, and external data can only reach the database through placeholder parameters. Building a query string from user input is a compile error.
Vera compiles to WebAssembly and runs on the command line, in the browser, or as a WASI Preview 2 component. Diagnostics carry stable error codes, include a description of what went wrong, why, and a concrete fix with a code example, and are available as structured JSON for agent feedback loops.
Who it’s for
Vera is aimed at LLM agents that write code, and at developers who want machine-written code to be trustworthy. It ships with a SKILL.md file that serves as a complete language reference for agents, and includes editor tooling (a language server, VS Code extension, Vim and TextMate support) for human developers who want to review or guide the process.
Highlights
- Mandatory contracts (requires, ensures, effects) on every function, verified either statically by the SMT solver or at runtime.
- No variable names: structural references eliminate a whole class of naming errors that plague LLM-generated code.
- Effect system makes all side effects explicit and compiler-enforced, so pure functions stay pure.
- SQL injection is impossible by construction: queries must be literal strings, external data only through placeholders.
- Compiles to WebAssembly: runs on the command line, in the browser, or as a WASI 0.2 component, with HTTP serving support.
- Diagnostics include explanations, rationale, concrete fixes, and spec references, designed for direct consumption by coding agents.
- Language server provides incremental verification, hover, slot go-to-definition, and typed-hole completion at editor latency.
- Rich agent integration: JSON diagnostics, skill file, and stable error codes enable tight agent-compiler feedback loops.
Related
- Dispatch
- Project
- Project
- Project
- Project