Rule signature
true if the data is correct. Return a string describing the violation if it’s wrong.
Rules are sync, deterministic, and cheap
Three constraints on rules in v1:Synchronous
Synchronous
No
async rules. Rules run synchronously during validation. If you need async checks (database lookups, API calls), do them before or after the contract.Deterministic
Deterministic
Same input, same output. No randomness, no side effects, no external state. This makes contracts testable and reproducible.
Cheap
Cheap
Rules run on every attempt (potentially 2-3 times per contract call). Keep them fast — in-memory checks only. No database queries, no network calls.
Domain examples
Lead scoring
Finance
Support ops
Agents
Compliance
String messages drive repair
The exact string you return from a failed rule becomes part of the repair prompt sent to the model. This is why specific messages matter:- Bad
- Good
Multiple rules
Rules are evaluated in order. All failing rules are collected — Boundary does not short-circuit on the first failure. All violations are sent to the model in a single repair message.Next steps
The Repair Loop
How violations become targeted fixes
Results
What you get back from a contract call