Skip to main content
A contract defines a thread’s steps, owners, prerequisites, and content checks. Its Gherkin-style source compiles into deterministic rules; no AI interprets them.

A complete contract

Save this as refund.feature:
Feature names the contract. A Step block describes a step’s business meaning and registers the context fields the Engine may use. Add one Required context: or Optional context: line for each field; repeat either line type to register multiple fields. Required context must be present; optional context can be absent. A field meaning after means is an optional classifier hint. Duplicate fields or conflicting required and optional declarations fail validation. Each Rule defines the executable checks for one matching step, and all its clauses must hold. Only the supported vocabulary is accepted.

Parallel steps

If two or more defined steps can run in parallel, add a Group that lists their step names:
Each member needs its own Rule; a Step block supplies business meaning and context for classification. The group needs at least two distinct members; the success and duration clauses are optional. If a later step needs both reviews, declare both as prerequisites in its Rule:

Preview and create

In the dashboard, open Contracts and use the contract editor. Or use the CLI:
Preview checks the contract and displays its compiled structure without saving. To update, increase Version and run:
Use .feature for contracts.

Common clauses

Dependencies allow intervening work. Once you use explicit next step rules, declare every allowed immediate transition. These are different flow policies. See the complete rule vocabulary for timeout, retry, and thread-wide clauses.

Content and earlier steps

Content checks read the context added to a step. Values are represented as strings. Dotted field names are literal keys, not nested paths. An unquoted approval.reference reads the same thread’s latest validated successful approval. A quoted "approval.reference" is literal text. A cross-step reference also implies a dependency. Missing data or unavailable state rejects the submission; Threadify does not silently use an older value. Regex matching uses Go’s RE2-style syntax. Use ^ and $ for a whole-value match. Lookaround and backreferences are unsupported. Double backslashes in quoted Gherkin strings, or use [0-9] rather than \d. Invalid patterns are rejected during preview and creation.

Validation timing

Content and owner checks can reject a submission before recording it. Flow, prerequisite, retry, and timing validation uses asynchronous workers; an acknowledged event can later be marked violated. Use execution waits for permission before an action or to wait for the exact validation result after reporting it.