A rule is written once and has one precise meaning, so everyone checks it the same way. The core of the language is formalised in Isabelle/HOL, and its proofs are machine-checked.

TRIEL stands for Trace Rule and Invariant Expression Language: a language for rules and invariants over traces. The name also reads as "three", which turned out to fit: a condition is true, false or undefined; the verdict on a norm is fulfilled, pending or breached; the verdict on an invariant is true, false or inconclusive.

The language has built-in temporal invariants: ALWAYS, EVENTUALLY, NEXT and EVENTUALLY ... WITHIN. They are checked on the recorded sequence of events, and each check gives one of three verdicts: true, false or inconclusive.

TRIEL v2.5.1
1SPECIFICATION core_fallback VERSION 1.0.0
2 CURRENCY: "EUR"
3
4SUBJECTS {
5 tenant : PARTY,
6 landlord : PARTY
7}
8
9TERMS {
10 tenant MUST pay(landlord, 1200) WITHIN 10 DAYS
11 ELSE tenant MUST pay(landlord, 1250) BY 5 DAYS;
12 landlord MUST issue_receipt WITHIN 2 DAYS
13 ELSE landlord MUST issue_receipt BY DATETIME("2026-03-20T00:00:00Z")
14}
15
16FACTORS {
17 rent : Decimal METADATA
18}
19
20INVARIANTS {
21 rent_positive : SAFETY : ALWAYS(rent > 0)
22}

If the first obligation is not fulfilled by its deadline, this is not a breach yet: the fallback obligation starts at that deadline, and only the fallback obligation can be breached. The formal core accepts this file, and the evaluator (the program that computes verdicts) in the repository checks it.

Source: examples/core/core_fallback.triel

Formal core

The meaning of the core of TRIEL is defined precisely. The core of the language is formalised in Isabelle/HOL. A program called the evaluator is exported from these Isabelle theories. It takes a specification and a recorded sequence of events and computes a verdict for each rule. This works for the part of the language that the formal core covers.

The repository also proves in Isabelle/HOL that each condition of the core corresponds to a pair of formulas of metric first-order temporal logic (MFOTL) about a single state, one for "true" and one for "false", without assuming that the data are complete. This covers conditions in one state only: no verdict and no monitor of the core are translated, and no MFOTL monitor is involved.

See the formal core, the evaluator and the examples on GitHub →
See the bridge to MFOTL on GitHub →

Natural language leaves loopholes. TRIEL leaves checkable rules.

THE RULE IN NATURAL LANGUAGE

The agent shall promptly halt spending once a significant portion of the budget is consumed, provided the amount remains within reasonable operating limits.

Each underlined word is a place where two programs can understand the rule differently, and both can still claim to follow it. Point at a word or tap it to see why.

THE RULE IN TRIEL
INVARIANTS {
budget_never_breached : SAFETY :
ALWAYS (cumulative_spend <= budget_cap)
}

Each line is a condition that can be checked against the recorded events. If two parties disagree, they run the same check on the same recorded events and get the same verdict, so the dispute is about the events and not about what the rule means.

Where TRIEL applies

A rule is written once and means the same thing in the contract, in the software and in the audit record.

Illustrations of where TRIEL rules can be applied.

LEASING, FACTORING AND LOANS

The terms of a contract become rules that are checked against the accounting records. If a payment, date or penalty does not match, the report names the rule that was broken.

LETTERS OF CREDIT

The terms of a letter of credit become rules. The trade documents are checked against these rules, and every discrepancy is listed.

INSURANCE

The terms of a policy (coverage, exclusions, notice periods, deductible) are written as rules, so every request for an insurance payment is checked in the same way.

CURRENCY CONVERSION

An AI agent keeps the euro balance of a company's account by requesting conversions of pounds into euros. Ten rules decide whether a request may go out; among them, the company's systems must report the mandate in force and the operating window open, the request must stay within a limit per trade and the day's total with it within a daily limit, and above a threshold it needs the company's approval of that very request. When the balance or the bank's quote is stale or missing, the request is blocked. One of the examples in the repository.

PURPOSE OF DATA USE

An AI agent may transfer personal data for a new purpose only when a route to a compatible purpose is on record: the data subject's consent to it, a condition listed in Annex 2, or the controller's assessment under Article 8A(2), in a stylised reading of the UK GDPR. When all three are on record as not met, the transfer is a breach: it is blocked and a reviewer is notified. When none is met and one is missing or out of date, the transfer is blocked without a breach. The controller decides what is compatible; the rules check the agent's transfers against what is on record. One of the examples in the repository.

LOGISTICS AND SUPPLY

Delivery deadlines, acceptance conditions and penalties for late delivery are written as rules and compared with the actual deliveries.

TOKENIZED ASSETS

Who may buy an asset (for example, only qualified investors from permitted jurisdictions) is written as rules. These rules can be checked without revealing the investor's personal data.

DIGITAL IDENTITY AND CUSTOMER CHECKS

Which credentials a verifier may accept, and when data is too old to use, are written once as rules. One of the examples in the repository is written in the style of the EU Digital Identity Wallet.

AI AGENTS

Asked before an agent acts, triel check --last answers whether the action may be taken now; when the condition of a prohibition cannot be decided, its monitor blocks the action. The TRIEL gate for Claude Code, deployed by the operator in managed settings and not by the agent, holds back every call to an MCP tool that the rules do not allow, except the tools that the operator lists as allowed; every other way to act must be closed by the configuration of the host.

TEMPORAL INVARIANTS

ALWAYS, EVENTUALLY, NEXT and EVENTUALLY ... WITHIN are part of the language. They are checked on the recorded sequence of events, with three possible verdicts: true, false or inconclusive.

EVENT-DRIVEN MODEL

A specification names its subjects (the parties), their obligations, permissions and prohibitions (MUST, MAY, MUST_NOT) and its factors (the data that the rules use). Verdicts are computed from the recorded events.

ZERO-KNOWLEDGE PROOFS

With PROVES ... WITHOUT REVEALING, a specification states what a zero-knowledge proof must show. The proof is created and checked by an external proof system. The rules use only the result of that check: the proof is valid or it is not.

OPEN SPECIFICATION AND CODE

The TRIEL language specification, versions 2.5 and 2.5.1, is published under the Open Web Foundation Final Specification Agreement 1.0 (OWFa 1.0). The code in formal/core (the Isabelle theories, ROOT, document/ and the build log) and in formal/mfotl (the Isabelle theories and ROOT files) is available under the Apache License 2.0 or the BSD 3-Clause License, at your option. The evaluator (including the Haskell code exported from formal/core), the parser and the translator to the core, the examples, the adapters for hosts and the CI workflows are published under the Apache License 2.0. The text of the TRIEL skill for AI agents is under CC BY 4.0. Anyone who contributes to the project accepts the TRIEL Contributor License Agreement. The full terms are in the file LICENSE.md in the repository.