Skip to content

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

ContractDomainEntitiesPersonasRulesStrataKey Features
EscrowFinancial services2472BranchStep, HandoffStep, Compensate, bounded quantification
SaaS SubscriptionMulti-tenant SaaS1362Payment gating, trial lifecycle, suspension/reactivation
Healthcare Prior AuthHealthcare payer26134SubFlowStep, Escalate, 4-stratum rules, appeal lifecycle
Supply Chain InspectionLogistics / customs3472ParallelStep, Compensate, multi-entity effects, import
Energy Procurement RFPEnergy commodities25123Approval tiers, Escalate, Money comparisons, multi-file import
Trade Finance LCInternational trade2582UCP 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

FeatureEscrowSaaSHealthcareSupply ChainEnergyTrade Finance
Named types (TypeDecl)YesYesYesYesYesYes
Money typeYes------YesYes
Date type----Yes--YesYes
Enum facts--YesYesYesYesYes
Bool with defaultYesYesYesYesYesYes
List + bounded quantificationYes--YesYesYesYes
Multi-entity effectsYes--YesYesYesYes
Multi-file import------YesYes--
BranchStepYesYesYesYesYesYes
HandoffStepYes--Yes----Yes
SubFlowStep----Yes------
ParallelStep------Yes----
Compensate handlerYes----Yes----
Escalate handler----Yes--Yes--
Stratum 0 rulesYesYesYesYesYesYes
Stratum 1 rulesYesYesYesYesYesYes
Stratum 2+ rules----Yes--Yes--

Running the Domain Contracts

Every domain contract passes tenor check:

bash
# 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
done

Each domain directory contains:

  • The .tenor contract file(s)
  • One or more .facts.json files with evaluation scenarios
  • Corresponding .verdicts.json files 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.