Open Standard · Working Draft
mekaniskt·kontrakt

Worked examples · the corpus

Seven contracts, simple to brutal

A specification is only as honest as the contracts it has been run against. Each example is written end-to-end against the specification and names exactly what it stresses; where a primitive creaked, the creak is recorded rather than papered over. An example that forces nothing is decoration - it gets cut.

Every example ends in tests: because a mechanical contract is executable, it is testable. Each contract carries behaviour tests - in Gherkin and JavaScript - that exercise its ports and rules, so the claims on the page are checked, not asserted.

  1. 01 Webshop sale tiny · mk-se-b2c (proposed) Template/instance at consumer volume, mandatory statutory ångerrätt, opaque as a GDPR firewall, and executor-attested payloads outside Peppol.
  2. 02 Patient journal small, hard · mk-se-health (hypothetical) Receipted reads as first-class events, disclosure scopes with per-level widening (nödöppning), opaque content the machine must never judge, and append-only-forever access control.
  3. 03 Cabin rental small · mk-se-b2c / b2b Time-sliced occupancy (the keyed-pool gap), deposit-as-escrow with a claim window, cancellation ladders as which-over-event-math, and disputed human judgment parking money in escrow.
  4. 04 School renovation very complex · mk-se-public Every section of the spec at once: milestones, retention, vite, ÄTA change management, a back-to-back child contract, index math, and a third-party inspector.
  5. 05 Metered API fleet-scale · mk-se-b2b Machine-speed cadence with batch windows, template/instance at fleet scale, and the invoice as a projection of the receipt chain rather than a document judged against it.
  6. 06 Marketplace order medium · mk-se-b2c Aggregates over a multi-line cart, a conservation-checked multi-party split, and the facts-vs-money boundary for imports.
  7. 07 The hospital master small, structural · any Genesis as a chain of binding stages, party slots bound late under declared constraints, and upgrade-by-transform instead of fork-and-drift.
  8. 08 Regional IT framework very complex, five-year · mk-se-public Everything at once, across five years: three index-adjusted consultant-hour pools, goods by despatch advice, milestone retention gated by an appointed inspector, monthly invoicing, nested budget ceilings, and a proforma the machine judges before the binding invoice exists.
  9. 09 House sale, financed very complex · mk-se-fastighet (hyp.) Six parties, neutral-party escrow, two conditions that unwind the deal, a three-contract atomic settlement, retention of title, a registration authority - and both integration mechanisms at once: modules flattened vs banks referenced as remote contracts.

What the ladder proved: six domains, zero new computational power needed - every creak was vocabulary (pool stages, party roles, keyed pools, aggregate combinators), never semantics. The smallest examples broke the most: the cabin rental found a core-model gap in an afternoon, while the 24M SEK renovation mostly composed cleanly. Open design questions surfaced here are tracked in the working draft and resolved into spec text, section by section.