# AIM Values, Checks, and Stated Rows (Normative Reference)

Normative details for AIM v8.0 values, schema types, requirement strength, ownership modifiers, comparisons/calculations, and Record lifecycle blocks (`Rows`, `Period`, `Replaces`, `Complete`). Load this module when authoring or validating schemas with advanced types, `check` / `Criteria` expressions, ownership grants, or fixed/temporal rows. Core summary lives in `specification.md` (§3, §4.2, §4.3).

## Requirement strength, formatting, and full schema grammar (§3)

### A requirement's strength

A requirement is a "must" unless it says otherwise. It MAY carry the mark `(should)` right after its label:

```markdown
- **MY-WORDS** — What I wrote in an entry is never changed.
- **DAILY** (should) — I write an entry every day.
- **HEALTH** (should) — I sleep eight hours — over [me#Requirements[DAILY]]
```

- **Two strengths.**
  - A "must" always holds, and a broken one is something to fix.
  - A "should" is meant seriously and may bend: whoever does the work may depart from it and says so.
  - A "should" that was not kept is reported with a request for the reason and is not an error. The reason may be kept as an entry that names the requirement (§6).
  - There is nothing between the two.
  - A wish or topic with an end is a Subject (§4.1) — or a Project from the `work` package (§4.12).
- **Everything else stays.** A "should" has a label, may cite its source, and is a target of `satisfies`.
- **Which "should" wins.** A "must" always wins over a "should". Between two "should" requirements, the one that wins MAY name the one that gives way in the trailer `over [<address>]`.
  - The address is a labelled Requirements item that is a "should" too. An `over [...]` address MUST resolve to a labelled Requirements item.
  - An `over [...]` MUST NOT stand on a "must" and MUST NOT name one.
  - An `over [...]` MUST NOT close a circle.
  - Several addresses are separated by commas.
  - `over` stands before `from`.
  - It is said once, on the requirement that wins, and never as a number.
- **A "must" never gives way.** Two "must" requirements that can collide are a mistake in the rules. They are shown side by side with their sources, and the owner mends them. Either the exception is written into the rule itself, as in "read by a second lawyer, unless the deadline would be missed", or one of the two becomes a "should".
- **No guessing.** Two requirements that collide with nothing said are shown side by side with their sources and the owner is asked. Whoever does the work never picks. When both cannot be kept, the report names which requirement gave way and to which.
- **Not an edge.** The trailer is a structured reference like `from`. It derives `over` and its inverse, outside the closed taxonomy of §5 and outside traceability.

### Preservation of meaning vs. canonical formatting

Tools that parse `.aim` files into an intermediate representation and re-serialize them MUST distinguish **preservation of meaning** from **canonical formatting**:

- **Preservation of meaning** requires retaining every one of these:
  - intent and facet node;
  - requirement label, strength (`(should)`), text, precedence (`over`) and source (`from`);
  - typed edge;
  - schema attribute and modifier;
  - stated row with its key, words and values as the author wrote them;
  - `### Period`, `### Replaces` and `### Complete` line (§4.2);
  - Criteria rule and `check` line (§4.3);
  - label (`### Label`, `label(...)`, enum value labels);
  - `## Dependencies` (`### Requires`, and deprecated `### Imports` until rewritten);
  - frontmatter authority and lifecycle metadata (`provenance`, `owner`, `status`, `approved_by`, `approved_at`, `tags`, `display`, `nature`, `timezone`, `calendar`);
  - realization binding (including merging any deprecated `kind: binding` sidecar `## Bind:` entries into inline `### Bindings` before retiring the sidecar).

  A tool that reads and writes an Entries file retains every key, value, text, link label, list order, origin trailer and anchor (§6).
- **Canonical formatting** normalizes whitespace, heading order, and deprecated spellings (`## Subintents` → `## Children`, `aim-attrs` → `schema`, inline `### Bindings` for `## Bind:`, a short address → its full address, an imported alias → the full address it names, `<From> → unchanged` → `### Only in`, `Flow` → `Process` and `Contract` → `Operation` in every place the type is written). It does so without altering the derived graph, bindings, or authority metadata. An automated migration MUST NOT run if the intermediate representation drops any of these elements.

### Markdown restrictions

- **Structured blocks.** Structured blocks use the specified bullet, `schema` fence, and edge-token forms. Requirements, Tests, Steps, Ends on, Schema, Payload, Input, Contains, Format, Authz, Expects, Ensures, Returns, Decides, Criteria, Display, Actions, Access, Of, States, Moves, Only in, Ends, Rows, Period, Replaces, Complete, and Bindings are structured blocks. Label is one line of text.
- **Inside a structured block.** Tables, blockquotes, task lists, and footnotes are forbidden there. Bold, italic, links, and inline code are permitted within list items.
- **Fences.** Fences in Schema, Input, Contains, Payload and Returns blocks use `schema`. The fence in Criteria uses `criteria` (§4.3). A `check` fence stands only in Expects and Constraints (§4.2, §4.3). Arbitrary fences are permitted elsewhere where the block's defined syntax allows them.
- **Free prose.** Free prose, including Summary and descriptive paragraphs, permits ordinary CommonMark.
- **Raw HTML.** Raw HTML is forbidden everywhere.
- **Status.** Task lists MUST NOT express implementation or verification status in structured intent; that status belongs in work reports. Frontmatter `status` concerns specification lifecycle only.

### Schema properties

Schemas use a fenced `schema` block, with one attribute per line:

```schema
title: string required min(1) max(200)
code: string required unique
seats: integer required min(1)
price: decimal required min(0)
contactEmail: email required
website: url
phone: phone
ownerId: string required ref(team#Member.id) owner
reviewerId: string ref(team#Member.id) !owner
items: list(expenses#ExpenseItem)
laengeInMm: number label("Länge in mm")
```

Grammar: `<name>: <type> <modifier>*`.

| Position | Allowed forms |
|---|---|
| Scalar type | `string`, `number`, `integer`, `decimal`, `boolean`, `date`, `datetime`, `email`, `url`, `phone`, `file`, `duration`, `position` |
| Other type | `enum(a, b, c)`, `list(<type>)`, `ref(<intent>#<Record>.<field>)`, `ref(<intent>#<field>)`, `part(<intent>#<Record>)`, `map(<type>)`, `map(ref(<intent>#<Record>.<field>), <type>)`, `modelref(<Type>)`, `fingerprint(<field>)` |
| Modifier | `required`, `optional`, `unique`, `min(n)`, `max(n)`, `ref(<intent>#<Record>.<field>)`, `ref(<intent>#<field>)`, `enum(a, b, c)`, `default(<value>)`, `list(<type>)`, `owner`, `!owner`, `label("…")`, `key`, `rough`, `unit(<unit>, …)` |

**Full addresses.** Every Record named in `ref`, `part`, `list` and `map` is written as its full address: `<intent>#<Record>` for a Record facet, `<intent>` for a promoted entity (an intent with a top-level `## Schema`, §5).

**Presence and defaults.**

- A field is absent when no value is given. Null is absent.
- `required` means a stored row and an accepted Input MUST hold a value.
- `optional` says explicitly that the field is not required, and it is the default.
- A `default(<value>)` fills an absent field when the row is created or the Input accepted, before `required` is checked. So `required default(A)` never fails for absence. It fills nothing on an update that leaves the field out.
- The default is a literal of the field's type, valid like any value of it: `default(false)` is a boolean, `default(0)` a number, `default(open)` one of the enum's values.
- An empty text or an empty list is a value, not an absence. Refusing it is a constraint (`min(1)`), never implied.
- `required` together with `optional`, a default its type does not admit, and two conflicting types are hard errors.

**Scalar types.** Each says which values are valid; a realization MUST refuse any other before it stores it.

| Type | Valid values |
|---|---|
| `string` | Any text. |
| `number` | Any number. |
| `integer` | A whole number, positive, negative or zero. |
| `decimal` | A number with or without a fractional part, kept exactly as given — never rounded through binary floating point. |
| `boolean` | `true` or `false`. |
| `date` | A calendar date, ISO 8601 (`2026-10-26`). |
| `datetime` | A moment, ISO 8601 with a time zone or offset. |
| `email` | One e-mail address, `local@domain`, with a dot in the domain and no spaces; the domain compares case-insensitively. |
| `url` | One absolute web address beginning `http://` or `https://`. |
| `phone` | One telephone number in international form: `+`, then 7 to 15 digits. Spaces, dashes, dots and parentheses MAY be written; the stored value has none. |
| `file` | A document (below). |
| `duration` | A length of time: a whole number and a unit, `21 days`. The units are `minutes`, `hours`, `days`, `business-days`, `weeks`, `months` and `years` (below). |
| `position` | A point on earth: latitude, then longitude, in decimal degrees, `47.3769, 8.5417`. The latitude lies between -90 and 90 and the longitude between -180 and 180. |

**Bounds.** `min(n)` and `max(n)` bound a number's value and a text's length.

**A type outside the table.** A type outside this table is not an error.

- Tools MUST read `int` as `integer`, `float` as `decimal`, `bool` as `boolean`, and `text` and `uuid` as `string`, and any other word as `string`, reporting it as an unknown type with the nearest defined one (§13).
- For `object`, `array`, `json` and `dict` the nearest defined one is `part(...)`, `list(part(...))` or `map(...)`.
- A bare Record name is no exception: it is read as `string`, and the notice names `ref(<intent>#<Record>.id)` and `part(<intent>#<Record>)`. A reference or a part is written out, never inferred from a name.
- A new scalar type is admitted only with its row in this table — what is valid, and how it is stored where that is not obvious — and its check in every conforming realization.

**References.** A field that points at a row of another Record is a reference.

- *Two positions.* `ref(<intent>#<Record>.<field>)` may stand as the type itself — `owner: ref(team#Member.id)` — or follow a scalar as a modifier — `ownerId: string ref(team#Member.id)`. Both mean the same: the field holds a value of the target field, and that row MUST exist.
- *A promoted entity's own field* is `ref(<intent>#<field>)` — `kunde: ref(company.kunde#id)`. A lowercase field straight after `#` belongs to the intent's own Schema. A capitalized name is a Record facet inside it (`ref(company.kunde#Angebot.id)`).
- *The scalar before it.* A scalar written before `ref(...)` MUST be the target field's type: `quantity: string ref(shop#Product.quantity)` where `quantity` is an integer is a hard error. Values compare as the target field's type.
- *The target.* The Record MUST be declared in the named intent, or the intent itself MUST be a promoted entity for `ref(<intent>#<field>)`. The field MUST exist. A non-Record target or missing field is a hard error. Because every reference names its intent, unrelated Records with the same name (`billing#Record:Account`, `identity#Record:Account`) coexist without collision.
- *Resolution and edges.* A reference resolves like any address (§9) and derives a `refs` edge (§8). `ref(<intent>#<Record>.<field>)` derives a `refs` edge between schema attributes.
- *Deletion.* A row other rows still refer to cannot be deleted while they do, unless the same change deletes or re-points them.

**Lists.** `list(<type>)` holds repeated scalars, references (`list(<Record>)`, a `refs` edge to the Record) or parts (`list(part(<Record>))`). `list(<intent>#<Record>)` holds several references to that Record's rows.

**Parts.** `part(<Record>)` holds one value whose fields are that Record's schema — `result: part(builds#BuildResult)` — and `list(part(<Record>))` holds several, in order.

- *A value, not a row.* A part is a value of that shape kept inside its holder. The holder is a row, an Input, a Returns, a Payload, or a Result's Input or Contains (§4.11). A part need not come from any row: it is not a row of the Record, has no identity of its own, and is created, changed and deleted with its holder.
- *Value rules apply.* A part follows its Record's value rules: the field rules (types, `required`, `enum`, `min`/`max`, nested parts, lists and maps) and the Record's `### Constraints`.
- *Only the named fields.* A part holds only the fields its Record names. A realization MUST refuse any other key, like any invalid value, before it stores or sends it.
- *Row rules do not apply.* The rules of stored rows stay with stored rows: identity, `unique`, `owner`, `!owner`, `### Immutable` and the Record's States (§4.8) do nothing inside a part.
- *References inside a part.* Every `ref(...)` inside a part MUST resolve. In a stored row, a part's references are the row's own, at any depth of nesting. The row is the referrer, so the referenced row cannot be deleted while the part names it (above). The row also inherits the referenced row's ownership restriction as through a field of its own (below).
- *Outside a stored row.* A part in an Input, Returns or Payload, or in a Result's Input or Contains, is checked when it is accepted, sent or handed over and carries no lasting obligation. A row that stores it takes the obligations on.
- *Rows of the Record.* A Record used only as a part — never referenced, read or mutated as a store — has no rows. A Record that is also stored keeps its rows, and its parts are values of the same shape, independent of them.
- *The `holds` edge.* `part(<Record>)` derives a `holds` edge from the schema field that names it to the Record. The field is identified by its facet, its block (`### Schema`, top-level `## Schema`, `### Input`, `### Returns`, `### Payload`, a Result's `### Contains`, or a promoted Result's top-level `## Input` or `## Contains`) and its name, so an Input field and a Returns or Contains field of one name stay distinct. A `holds` edge has cardinality 1 for a `required` field whose part stands alone, 0..1 for an optional one, and 0..* inside any list or map.

**Maps.** `map(<type>)` holds values of one type under keys — `shas: map(string)`, `marks: map(part(cases#CaseMark))`. A key is non-empty text.

- *Keyed by rows.* `map(ref(<intent>#<Record>.<field>), <type>)` keys the values by rows of a Record instead — `quantities: map(ref(shop#Product.id), integer)`, where `shop#Record:Product` declares `id: string required unique`.
- *The key field.* The target field MUST be a scalar field declared `unique`. No uniqueness is inferred from a field's name, so an `id` without `unique` cannot key a map.
- *Each key.* Each key MUST be present, non-empty and resolve to exactly one existing row, and a realization MUST refuse a key that does not. Otherwise it is checked like any `ref(...)`, with the same deletion and ownership consequences.
- *No duplicate keys.* Keys are unique within a map. Reference keys compare by the target field's stored value, so two spellings of one e-mail address or phone number are one key. A realization MUST refuse a duplicate.
- *No order.* A map has no order.
- *Values.* Each value MUST satisfy its type, as a list's items do.
- *Not a list of parts.* A `list(part(...))` whose part carries a `ref(...)` field is a different value — ordered, and allowing repeats unless a Constraint forbids them — not another spelling of a keyed map.

**Edges through containers.** Edges are derived through containers at any depth: `stock: map(ref(shop#Product.id), list(part(shop#Batch)))` derives `refs` to `shop#Record:Product.id` from its keys and `holds` to `shop#Record:Batch` from its values.

**Files.** `file` is a document value, not a storage or parsing mechanism.

- An Operation or a Result invoking a document-reading Capability (with `systems`) for a caller's document declares a `file` Input. The Capability reads it, and the Operation or Result owns the resulting commitments (§4.11).
- A document acquired by an external service does not imply a caller upload.
- Parsed text and source addresses remain ordinary values.

**Unique.** `unique` declares that no two rows of the Record may hold the same non-empty value for that attribute.

**The key.** A Record names its key with the modifier `key`: `id: string required unique key`.

- At most one field of a Record carries it.
- The field is declared `required unique` and has an enum type or a scalar type other than `file`. Neither form of `ref(...)` stands in the key position.
- The key belongs to the Record, so stated rows (§4.2), entries (§6), row addresses (§8) and supplied rows (§7) all use this one declaration.
- A field that is merely named `key` is an ordinary field, because a modifier stands after the type.

**Rough dates.** A `date` field with the modifier `rough`, as in `born: date rough`, takes a date written as roughly as it is known, in the spelling of ISO 8601-2. Without the modifier a date is an exact day.

| Written | Means |
|---|---|
| `1969-07-20` | That exact day |
| `1969-07` | Some day in July 1969 |
| `1969` | Some day in 1969 |
| `199X` | Some time in the nineties |
| `1650~` | About 1650 |
| `1984?` | Probably 1984, not sure |

- *A range of days.* A rough date stands for a range of days: `1969` is every day of that year.
- *Comparing.* A comparison (§4.3) holds only when it holds for the whole range, so `1969` is before 1970 and does not fall into a period from 2012 to 2019. Where it holds for part of the range the answer is "possibly" and never a flat yes. A `check` or Criteria line that only possibly holds does not hold.
- *About and probably.* A value marked `~` or `?` compares like the value it names. AIM gives "about" no width, and an answer that rests on such a value says so: `1650~` is before 1700, and the answer is "yes, about". Whoever knows a range writes the range, as in `165X`.
- *Kept as written.* The value is kept as written and no tool widens or narrows it.
- *Seasons.* The season codes of the standard are not taken over.

**Lengths of time.** A `duration` is a whole number and a unit, written as steps and deadlines write one (§4.4, §4.7): `21 days`, `10 business-days`, `6 months`.

- `minutes`, `hours`, `days` and `weeks` compare with one another.
- `months` and `years` compare with one another.
- `business-days` compares only with itself and counts by the `calendar` in reach (§16).
- Any other pair is a hard error, because the answer would depend on the calendar.
- Adding a length to a date is calculation (§4.3).

**Units.** A number field MAY name what it measures with `unit(...)`: `weight: decimal unit(kg)`, `price: decimal unit(EUR, CHF)`.

- *One unit.* With one unit the value is the bare number, `75`, and the shape says what it measures. A unit written beside it is refused.
- *Several units.* With several the value names its own, `19.99 EUR`. A value naming a unit the field does not list is refused.
- *Shown.* Wherever the value is shown, its unit is shown.
- *Comparing.* Only like compares with like (§4.3).
- *Which units.* Money names its currency by ISO 4217 code. Apart from that AIM keeps no list of units: the unit is the owner's word, and two units are the same when they are spelled the same.
- *No conversion.* AIM does not convert. Turning one unit or currency into another is a function the work must be able to do, which is a Capability (§4.12).

**Positions.** A `position` is a point on earth: `47.3769, 8.5417`.

- A place is already a thing, an entry with a name that other entries point at, and "Zürich is in Switzerland" is a link from one place to another. The position says where on earth it is.
- Any tool can put the point on a map, and "what is near here?" is answered exactly from the points (§10).
- Areas, borders and routes have no type.

**Model references.** `modelref(<Type>)` is a field type of a Record with Entries (§6). The field holds one link to a node of the model.

- *Targets.* `modelref(Requirement)` accepts a labelled Requirements item, `aim:<intent>#Requirements[<label>]`. `modelref(<FacetType>)` accepts a facet of that type, `aim:<intent>#<FacetType>:<Name>`, for any facet type of §4. An intent as a whole is not a target in this version.
- *The value.* The value is the full address and the link's label is display text.
- *What it says.* It says that the entry is about that node, explains it or illustrates it. It derives a backlink from the node to the entry and field (§10).
- *Not an edge.* It is a structured reference outside the closed taxonomy of §5, like a requirement's `from`.

**Fingerprints.** `fingerprint(<field>)` names a `file` field of the same Record and holds a code calculated from that file's content, written `<algorithm>:<hex digits>`, as in `sha256:9f2c…`. A tool fills it in and nobody types it (§6).

**Ownership.** `owner` and `!owner` govern row-level ownership and separation of duties:

- **`owner`** marks the referenced actor (`ref(...)`) to whom the row belongs.
  - On creation, the field is bound to the acting caller's identity.
  - At most one field on a Record may carry `owner`. A plain reference to a person does not imply ownership.
  - A row referencing an owned row through one or more `ref(...)` links — its own fields, the parts it holds, its map keys — inherits that row's ownership restriction.
  - All applicable ownership restrictions MUST hold: by default, a caller may see or mutate a directly or indirectly owned row only when every applicable owner matches the caller's identity.
  - Records with no ownership path are not owner-scoped.
  - A different local Persona, including one linked through `plays`, does not widen scope.
- **`!owner`** restricts an otherwise authorized action: the acting caller MUST differ from every applicable owner of the target row.
  - It may follow a backticked role in `### Authz`, qualify an Operation's `### Input` field identifying the target row, or qualify a Record's reviewer `ref(...)` field.
  - A field-level restriction applies when that Input is supplied or that Record field is written. An Authz restriction applies when acting under that entry.
  - It never grants visibility or mutation rights.
  - To permit action on others' rows while forbidding self-action, declare both an explicit cross-owner grant and `!owner`.

**Explicit cross-owner scope.** `cross-owner(<Record-address>)` is a modifier, not a graph verb. `<Record-address>` is the Record's full address, `<namespace>#Record:<Name>` or a promoted entity's `<namespace>`, without `aim:`. It MUST resolve to a Record. Repeat the modifier to name several Records. It is permitted only:

- After a backticked role on an Operation or Process's `### Authz` entry. It lifts ownership scope only for that operation's declared `reads` or `mutates` targets named by the modifier, while acting under that entry. It grants no permission beyond the entry's Authz and no scope to invoked operations.
- After a Persona's `[accesses](aim:<View-address>)` edge in `### Access`. It qualifies that edge and lifts ownership scope only for the named Record among that View's declared `reads` targets. It grants no scope to other Views or to operations exposed or invoked by the View; each operation still needs its own authorization and scope.

A grant applies only to rows of its named Record, including that Record's inherited ownership restrictions. It grants no access to related Records, ancestors or descendants. It is not inherited through `ref(...)`, `plays`, or other graph edges. The named Record MUST be a declared read/mutation target of the operation or a declared read target of the accessed View, respectively.

```markdown
### Authz
- `claims#Persona:Approver` cross-owner(claims#Record:Claim) !owner

### Access
- Review claims — [accesses](aim:claims#View:Claims) cross-owner(claims#Record:Claim)
```

The first entry permits the Approver to act on others' claims under that operation's rules. The second permits that Persona to see claims across owners in Claims; it does not authorize approval.

**Older spellings.**

- The short spellings `ref(<Record>.<field>)`, `part(<Record>)` and `list(<Record>)` are deprecated (§8).
- The deprecated `ref(<Record>.<field>)` resolves from the containing intent (§9).
- In `cross-owner(...)`, the short `#Record:<Name>` is deprecated (§8).

## Record constraints, stated rows, periods, replacing, and completeness (§4.2)

- **One schema grammar.** The same schema grammar serves every data property: Operation `### Input`, Event `### Payload`, an Output's `### Input` and `### Contains`, and a promoted entity's top-level `## Schema`.
- **Ownership.** Ownership is declared on the schema: `owner` marks the field naming whose row it is, rows referencing an owned row inherit its owner, and `cross-owner(...)` and `!owner` state the exceptions (§3).
- **A Record that holds itself.** A Record MUST NOT hold itself through `required` single parts alone, directly or through other parts, since no finite value satisfies it. An optional part, a list or a map ends the cycle with an absent or empty value.
- **Checked constraints.** `### Constraints` MAY hold one `check` fence, alone or beside bullets.
  - *Form.* The fence holds one comparison per line in the grammar of §4.3 (*Comparisons*). The operands are the Record's own fields. A block that holds only the fence is not empty.
  - *When the lines are checked.* Every create and every update MUST satisfy every line before it commits (§4.3). The lines are evaluated on the row as it will stand: on a create after `default(...)` values are filled, on an update with the written fields laid over the stored ones. A delete evaluates nothing.
  - *No clock.* The clock MUST NOT appear. A rule true only at the moment of writing is a precondition of the operation that writes and belongs in its Expects: `arrival >= today` on a Reservation would refuse the check-out the day after arrival.
  - *Parts.* A part is held to its Record's lines wherever its value rules are checked (§3).
  - *The bullets.* The bullets stay prose and are judged, never claimed as proven. A bullet written as a check line is replaced by it, not kept beside it: `departure > [arrival]` checked, "the nights are every date from the arrival to the day before the departure" judged.
- **One source of rows.** A Record's rows have one authoritative source: its `### Rows`, its Entries (§6) or the running system. A Record with Rows has no Entries. A Record with Entries takes no further rows from a seed file or a second writable store.
- **Stated rows.** `### Rows` states a closed set that the owner decides and the running system only reads: the levels of a game, the tiers of a plan, the moods a diary offers. A Record with Rows declares a key (§3).

  ```markdown
  ### Rows

  - **Free** — Fast models only.
    - pricePerBuilder: 0
    - peopleIncluded: 2
  - **Standard**
    - pricePerBuilder: 9.99
    - peopleIncluded: 10
  ```

  - *Form.* Every top-level bullet is `- **<key>**` or `- **<key>** — <words>`. The key names one row and has its field's type. The words say what the row is for and may continue on indented lines. Each nested bullet states one value, `- <field>: <value>`. The field MUST be a field of the Record's Schema other than the key, and its type MUST be an enum, a scalar other than `file`, or a `ref(...)` to one of those. A row MUST NOT state the same field in two value bullets. Parts, lists, maps and files are assembled outside the block (§7). A misplaced or repeated Rows block is a hard error.
  - *Literals.* Booleans are `true` or `false`. Numbers use JSON number syntax, and decimals are read exactly. Text-like and enum values are a JSON-quoted string or a bare token of ASCII letters, digits, periods, underscores and hyphens. A date, a `duration`, a `position` and a number with its unit are written as §3 writes them. A reference is written as a literal of its target field or, where the target field is the target Record's key, as a link to the row, `[<label>](aim:<row address>)`. A tool keeps the form the author wrote. A blank value and a bare `null` state nothing and are errors. The quoted `"null"` is a text.
  - *A closed set.* The keys are the complete membership of the Record. Adding, removing or changing a stated key or value is a change to the model. The running system may load and cache the rows. They are read-only there, fields filled outside the model included. A `mutates` edge to the Record is a hard error. A fact about a row that changes while the system runs lives in another Record that references it. A State (§4.8) cannot govern a Record with Rows. `### Immutable` adds nothing to one. Ownership and `cross-owner(...)` apply to its reads as to any Record (§3).
  - *Typed equality.* Keys and stated values compare as their Schema types. The order of the rows means nothing unless a field or a requirement gives it a meaning.
  - *Assembly by key.* A row may leave fields unstated, which the realization makes or the owner supplies (§7). Assembly starts one row per stated key and joins made and supplied fields onto it by key. Each source contributes at most one fragment per key. A fragment names only a stated key and fields its row leaves unstated. Each unstated field has at most one source. After joining, Schema defaults fill absent fields, and the completed rows are checked as stored rows.
  - *Checked in the model.* Key and value literals are checked against their types, `min`, `max` and `enum`, and `unique` among the stated values. A `check` line of Constraints is evaluated where all its operands are stated, and on the completed row otherwise. A reference is proved when a target row states a matching value. A missing match is an error only when the target has Rows and every target row states the referenced field. Otherwise it is decided on the completed data.
  - *Words are judged.* A row's words are judged, never checked. A guarantee that must be traced, such as a level in which nothing can hurt the player, is a requirement. A row is outside traceability and is never an edge endpoint. Its address is the row address of §8.
- **Periods.** What holds only for a while is a row with a start and an end: a home, a price, a membership, a job. A single field carries no time, which keeps every check free of the question "at which time?". `### Period` MUST name the two fields, which are fields of the Record and both `date` or both `datetime`. A row may leave the end empty:

  ```markdown
  ### Period

  - from `since` until `until`
  ```

  - *When a row holds.* A row holds from its start through its end, both included. With no end it still holds. It holds from its start also when it was written down earlier.
  - *Derived from the dates.* Which rows hold on a given day, and which hold now, follow from the dates alone. Nothing is linked by hand.
  - *Dated rows of other Records.* A row of another Record that carries a date falls into every row whose period contains that date: a diary entry of 1 May 2015 falls into the home in Zürich. This is derived and never written (§10).
  - *One at a time.* A second bullet, `- one at a time` or ``- one at a time per `<field>` ``, says that only one row may hold on a day, for the Record or for each value of that field. The `per` field MUST be a field of the Record. The next period ends the one before it: the older row holds until the day before the newer one starts, and its end need not be written. A written end that reaches past the next start disagrees and is reported. Two rows that start on the same day cannot be put in order and are an error.
  - *Rough dates.* With a rough start or end (§3), "holds on that day" may be only possible, and an answer says so.
- **Replacing.** `### Replaces` names one field, a `ref(...)` to the Record's own key or a list of such references. A row that names another row in it replaces that row. The older row stays exactly as it was: it is not edited, marked or deleted.
  - *Without a period.* What holds now is every row that no other row replaces, from the moment the newer row is written.
  - *With a period.* The dates decide what holds and the link gives only the order. "What is the newest written?" and "what holds on a day?" are two questions and may have two answers. A price of €12.99 from 1 December, written down on 20 November and naming the price of €9.99 it replaces, is the newest written from 20 November on, and €9.99 holds through 30 November.
  - *Several rows.* A row may replace several. An older row that two newer rows replace is reported, because it may have been split. A row that replaces itself through a chain is an error.
  - *Not ruling out.* Replacing is not ruling out. A claim that was ruled out is replaced by nothing. How settled a claim is, is a field of its own (§6).
- **Complete.** A list is open unless its owner says otherwise. An absence in an open list is "not recorded" and never a "no". `### Complete` holds `- the collection`, a backticked list field of the Record, or both.
  - *What a complete list answers.* With the homes of a diary complete, "did you ever live in Basel?" is answered "no". With the `attendees` of a meeting complete, "was Ben there?" is answered "no". An answer says which of the two it means. A check that rests on an absence holds only where the list is complete.
  - *The whole list at hand.* A "no" also needs the whole list at hand: a reader that holds only part of a collection answers "not in what I have".
  - *Stated rows.* The keys of `### Rows` are always complete and need no mark.
  - *The owner's statement.* Saying that a list is complete is a statement by its owner, and a tool never adds it.
- **A promoted Record.** Promoted under the universal rule (§4.0) with `nature: record`. Its operations co-locate as facets, and it is read, mutated, and referenced by its namespace (`[reads](aim:company.kunde)`, `ref(company.kunde#id)`, §5).
- **Older spellings.** `## Schema: <Name>` is the deprecated spelling of this facet and is read as a Record.

## Operation decisions, Criteria, comparisons, and calculation (§4.3)

- For a caller's document, the Input declares a `file`. The reading Capability parses it, and the Operation owns the resulting records.
  - Acquisition may be a collect operation that invokes the Capability and mutates a Record. Later operations read that Record.
- **Decisions.** The Operation (or Process) that reaches a judgment is the decision. There is no separate decision node.
  - Each `### Decides` bullet is one outcome. It holds a bold label, the criteria after the dash, and the outcome's edges (`emits`, `invokes`, `mutates`, `reads`).
  - The label is in the facet-name grammar and is addressable as `<intent>#Operation:<Name> → Decides[<Label>]`.
  - The criteria are normative: the realization MUST decide on them.
  - The block MUST hold at least two outcomes. It asserts that they are mutually exclusive and exhaustive.
  - The block derives one exclusivity group for the node. Operations that share a step without such a decision are joint work.
- **Criteria.** A `### Criteria` block states the decision as rules, one per line, in a `criteria` fence:

  ```text
  <Outcome> when <comparison>[, <comparison>]...
  otherwise <Outcome>
  ```

  - *The whole decision.* When present, the block is the whole decision: the rules decide, completely. The outcomes' bullets keep their words. Those words explain and MUST NOT add a condition the rules do not test.
  - *What the rules cannot express.* A judgement the rules cannot express is made first, by an earlier human or automated operation, and arrives as an Input the rules read.
  - *Conditions.* Each condition is a comparison (below) over the operation's Input fields, the rows its `ref` Inputs name and the clock: `FreeOfCharge when now < [reservationId.cancellationDeadline]`. The conditions of one rule all hold together.
  - *Outcomes.* An outcome that a rule names MUST be declared under `### Decides`.
  - *Order.* Rules are tried in order, and the first that holds decides.
  - *`otherwise`.* `otherwise` is required, so no combination of inputs is left unmatched. A block with no `otherwise`, or with two, is a hard error.
  - *On a Process.* A Process that decides (§4.4) carries Criteria the same way.

  ```criteria
  Red when wind > 30, clearingForecastInWindow = false
  Red when lightningWithinTenMiles = true, clearingForecastInWindow = false
  otherwise Green
  ```
- **Comparisons.** A comparison is `<left> <op> <right>` with `=`, `!=`, `<`, `<=`, `>`, `>=`, `in (a, b, c)` or `between a and b`, or `<operand> present` / `<operand> absent`. Every comparison names at least one field.
  - *Operands.* Its operands are:
    - *A literal* of the other side's type, on the right only. A bare word on the left is a field name, so a misspelled field is an error, never a comparison of two values.
    - *A field of the place.* This is an Input field of the operation; in Constraints, it is a field of the Record or of the Output's Contains (§4.2, §4.11). It is written by its bare name on the left and in brackets on the right: `status = open` compares with the value `open`, `status = [open]` with a field named `open`. Brackets are allowed on the left and mean the same: `[departure] > [arrival]`.
    - *A field of the row an Input names*, `[<input>.<field>]`, on either side. `<input>` is an Input field declared `ref(...)` whose target field is declared `unique`, so it names exactly one row, or an Input field declared `part(<Record>)`, whose value is in hand and needs no lookup. `<field>` is a field of that Record. The path is one step, never longer.
    - *The clock*: `now` beside a `datetime`, `today` beside a `date`. `now` is an instant. `today` is the date in the `timezone` in reach (§4.7), and without one a realization MUST NOT evaluate it. On the left, a field of the place named `now` or `today` is that field, and the clock is meant only where no such field exists. On the right, a bare `now` or `today` beside an enum or a string is the literal it was.
  - *Types.* Both sides MUST be of one type.
    - `integer`, `number` and `decimal` compare with one another, exactly.
    - `date` compares with `date` and `datetime` with `datetime`, never one with the other. Two `datetime` values compare by instant, whatever offset each was written with.
    - An enum compares with a literal of its values or with a field whose enum has the same set of values, enums being declared inline (§3).
    - Two `ref(...)` fields compare with `=` and `!=` only, and only when they reference the same field of the same Record (`reviewerId != [ownerId]`).
    - `<`, `<=`, `>`, `>=` and `between` apply to numbers, `date`, `datetime` and `duration` (among the units that compare, §3) and to nothing else. `between` and `in` take their operands in the same way.
  - *One evaluation* reads one consistent set of row values and the clock once.
  - *Evaluated or judged.* A line in a `criteria` or `check` fence is evaluated, never judged. A prose bullet is judged, never claimed as proven.
  - *A check line.* A `check` line MUST NOT hold more than one comparison and MUST NOT name an outcome.
  - *An absent operand.* `present` and `absent` are always evaluated. Any other comparison with an absent operand depends on where it stands:
    - In Criteria it does not hold.
    - In an Expects check its line is not applied when an optional Input field of the operation itself is absent. Its line does not hold, so the operation is refused, when a field read through `[<input>.<field>]`, from the row a `ref` names or from a part that was given, is absent.
    - In a Constraints check its line is not applied (`closedAt >= [openedAt]` says nothing while `closedAt` is empty).
  - *A value that follows from others* is still written by the work that maintains it. A check may state what it must equal (*Calculation*, below), and the comparison reads the stored field.
  - *The reference a comparison derives.* A comparison that names a field derives a structured reference from the facet or intent that holds it to that field, outside the closed taxonomy of §5, like a State's moves.
- **Calculation.** Either side of a comparison MAY calculate, in a `check` fence and in Criteria:

  ```check
  amount = sum(lines.amount)
  count(attendees) >= 3
  due <= filedOn + 21 days
  born + 18 years <= today
  ```

  - *Arithmetic.* `+`, `-`, `*` and `/` over the operands of a comparison, with parentheses. An operand of arithmetic MUST be a number, a date, an instant or a length of time. Inside a calculation a literal may stand on either side, and every comparison still names at least one field.
  - *Adding up a list.* `sum(<list>.<field>)` and `count(<list>)` run over the items one row holds, whether they are parts or references. `<list>` MUST be a list field of the place. The field that `sum` adds up MUST be a number.
  - *Time.* A `date` or a `datetime` plus or minus a `duration` (§3) gives a date or an instant. One date minus another gives a length in days, which compares with `days` and `weeks` and never with `months` or `years`; an age is therefore checked from the birthday forward. Where adding `months` or `years` lands on a day that does not exist, the result is the last day of that month: 29 February 2008 plus 18 years is 28 February 2026, and 31 January plus one month is 28 February, or 29 February in a leap year. Whoever counts differently, as some laws do, states that as a rule of their own.
  - *Units.* Only values of one unit are added, subtracted or compared (§3). A value with a unit is multiplied or divided by a plain number only. Two fields whose shapes name different units are a hard error. Where a value brings its own unit, a line that meets another unit is refused when it is evaluated.
  - *Exactness.* Decimals are calculated exactly, as they are compared. A line that would divide by zero does not hold. A rough date (§3) calculates as its range, and a line that only possibly holds does not hold.
  - *Still yes or no.* AIM fills no value in. The line checks that the value written down equals what the calculation gives. There is no calculation across several rows, no average, and no function of the owner's own.
- **Checked preconditions.** `### Expects` MAY hold one `check` fence, alone or beside bullets, with exactly one comparison per line and operands as in Criteria. Every line must hold: `tageBeantragt <= [mitarbeiterId.tageUebrig]`.
  - *Refusal.* A realization MUST refuse the operation when a line does not hold, before it performs anything, and say which line.
  - *After permission.* A realization evaluates the check only after `### Authz` and the ownership rules of §3 have passed, so a refusal never tells a caller about a row the caller may not read.
  - *One commit.* The values a check read and the writes the Operation makes commit as one: no other write to those values falls in between.
  - *Guarding, not reserving.* A comparison guards; it does not reserve. Two vacation requests cannot use the same days only because the operation that passes the check also takes the days off the balance in the same act, which is its Ensures. A check on an operation that changes nothing it compared with protects nothing against the next caller.
  - *The bullets* are further preconditions, judged as before. A bullet written as a check line is replaced by it, not kept beside it.
- **Every write is held to the model.** However a realization performs an Operation — coded, interpreted or by a runtime engine — every Record mutation it makes MUST satisfy the Record's `### Schema`, the `check` lines of its `### Constraints` (§4.2) and `### Immutable`, ownership (`owner`, `!owner`, grants; §3) and every State governing the Record (§4.8), before it commits. When a realization may perform an Operation without interpretation is realization, not language.
