Skip to main content
Declare an invariant where the host can enforce it:
  • Field types (t.*) refuse a fact that breaks them with Invalid.
  • unique: [["number"]] refuses a second fact with the same field set (Exists), and makes the set a point: invoices({ number }).
  • machine: { field, initial, edge } names the states one field may hold and the edges it may change along. The host refuses any other change on every write. An edge with due: "<instant field>" is taken when that instant arrives, exactly once.
For a rule that involves other facts, read what it depends on and write in the same mutation: a strict write’s assumption and every read join the read set, so a concurrent change that falsifies them refuses or retries the transaction. For a rule that must hold for every writer, declare a guard: forbid(act.write(requests), { where, message }).