Tenor ships with six validated domain contracts that serve as both conformance tests and learning material. Each contract models a real-world business process, passes tenor check with all S-properties satisfied, and exercises a different combination of language features.
These are not toy examples. They model actual regulatory, financial, and operational workflows with multiple personas, stratified verdict chains, multi-entity state machines, and flow orchestration patterns including compensation, escalation, parallel execution, and sub-flows.
The Six Domain Contracts
| Contract | Domain | Entities | Personas | Rules | Strata | Key Features |
|---|---|---|---|---|---|---|
| Escrow | Financial services | 2 | 4 | 7 | 2 | BranchStep, HandoffStep, Compensate, bounded quantification |
| SaaS Subscription | Multi-tenant SaaS | 1 | 3 | 6 | 2 | Payment gating, trial lifecycle, suspension/reactivation |
| Healthcare Prior Auth | Healthcare payer | 2 | 6 | 13 | 4 | SubFlowStep, Escalate, 4-stratum rules, appeal lifecycle |
| Supply Chain Inspection | Logistics / customs | 3 | 4 | 7 | 2 | ParallelStep, Compensate, multi-entity effects, import |
| Energy Procurement RFP | Energy commodities | 2 | 5 | 12 | 3 | Approval tiers, Escalate, Money comparisons, multi-file import |
| Trade Finance LC | International trade | 2 | 5 | 8 | 2 | UCP 600 rules, HandoffStep, document lifecycle, Money+Date |
What Each Contract Demonstrates
Escrow Release
The integration test contract from Appendix D of the Tenor specification. Exercises every construct type in a single file: named types, facts with defaults, two entities with interleaved state machines, stratum 0 and stratum 1 rules, bounded universal quantification over line items, seven operations with persona restrictions, and two flows featuring BranchStep, HandoffStep, and Compensate handlers. This is the canonical "does the elaborator work?" contract.
SaaS Subscription
A clean, minimal contract demonstrating the trial-to-active-to-suspended subscription lifecycle. Uses a single Subscription entity with four states, payment-gated operations, and a linear flow with a BranchStep that routes to suspension when payment fails. Good starting point for understanding Tenor's entity state machines and verdict-driven operations.
Healthcare Prior Authorization
The most complex domain contract. Models the full prior authorization lifecycle from physician submission through clinical review, peer review escalation, medical director override, denial with appeal rights, and appeals board adjudication. Uses 6 personas, 4 rule strata, 2 entities (PriorAuth with 7 states, AppealCase with 3 states), SubFlowStep for the appeal sub-process, HandoffStep for authority transfer, and Escalate handlers for clinical review failures. This is the "wow" contract that demonstrates Tenor can express genuinely complex, real-world business logic.
Supply Chain Inspection
Models cargo inspection at a port with concurrent quality and compliance inspections. The standout feature is ParallelStep -- two inspection branches run concurrently with a JoinPolicy that proceeds only when both succeed. Also demonstrates multi-entity effects (a single begin_inspection operation transitions three entities simultaneously), Compensate handlers for rollback, and multi-file imports for shared types.
Energy Procurement RFP
A realistic Request for Proposal lifecycle for energy commodity procurement. Features four approval tiers based on spend amount (procurement manager up to $50K, category lead up to $500K, VP up to $2M, CFO above $2M), implemented as stratum 1 rules feeding into BranchStep routing. Demonstrates the Escalate handler when a category lead denial escalates to VP, Money type comparisons for tier determination, and multi-entity effects (RFP + PurchaseOrder on award).
Trade Finance Letter of Credit
Models an international documentary credit lifecycle under UCP 600 rules. Five distinct personas represent the parties in an LC transaction (applicant, beneficiary, issuing bank, advising bank, confirming bank). Uses HandoffStep to model the document flow between parties, bounded quantification to verify all required documents are present and valid, Money and Date types for amount and deadline compliance, and BranchStep for the compliant/discrepant routing decision.
Spec Features Coverage Matrix
| Feature | Escrow | SaaS | Healthcare | Supply Chain | Energy | Trade Finance |
|---|---|---|---|---|---|---|
| Named types (TypeDecl) | Yes | Yes | Yes | Yes | Yes | Yes |
| Money type | Yes | -- | -- | -- | Yes | Yes |
| Date type | -- | -- | Yes | -- | Yes | Yes |
| Enum facts | -- | Yes | Yes | Yes | Yes | Yes |
| Bool with default | Yes | Yes | Yes | Yes | Yes | Yes |
| List + bounded quantification | Yes | -- | Yes | Yes | Yes | Yes |
| Multi-entity effects | Yes | -- | Yes | Yes | Yes | Yes |
| Multi-file import | -- | -- | -- | Yes | Yes | -- |
| BranchStep | Yes | Yes | Yes | Yes | Yes | Yes |
| HandoffStep | Yes | -- | Yes | -- | -- | Yes |
| SubFlowStep | -- | -- | Yes | -- | -- | -- |
| ParallelStep | -- | -- | -- | Yes | -- | -- |
| Compensate handler | Yes | -- | -- | Yes | -- | -- |
| Escalate handler | -- | -- | Yes | -- | Yes | -- |
| Stratum 0 rules | Yes | Yes | Yes | Yes | Yes | Yes |
| Stratum 1 rules | Yes | Yes | Yes | Yes | Yes | Yes |
| Stratum 2+ rules | -- | -- | Yes | -- | Yes | -- |
Running the Domain Contracts
Every domain contract passes tenor check:
# Check a single domain contract
tenor check domains/saas/saas_subscription.tenor
# Check a domain with multi-file imports
tenor check domains/supply_chain/inspection.tenor
# Run evaluation with a fact set
tenor eval domains/saas/saas_subscription.tenor \
--facts domains/saas/saas_activate.facts.json
# Run all domain contracts
for dir in domains/*/; do
tenor check "$dir"*.tenor
doneEach domain directory contains:
- The
.tenorcontract file(s) - One or more
.facts.jsonfiles with evaluation scenarios - Corresponding
.verdicts.jsonfiles with expected evaluation output
These form a complete test harness: tenor eval against the facts should produce exactly the verdicts in the corresponding verdicts file.