@lotics/cli 0.271.0 → 0.273.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/src/cli.js +108 -63
  2. package/package.json +1 -1
package/dist/src/cli.js CHANGED
@@ -31913,6 +31913,18 @@ var bindingSchema = zod_default.object({
31913
31913
 
31914
31914
  // ../shared/src/schemas/app_spec_rules.ts
31915
31915
  var LANE_LOADS = 2;
31916
+ function pressFields(reading) {
31917
+ switch (reading.kind) {
31918
+ case "breakdown":
31919
+ return reading.where.some((held) => held.field === reading.by && held.values === 1) ? [] : [reading.by];
31920
+ case "pivot":
31921
+ return [reading.rows, reading.columns];
31922
+ case "metric":
31923
+ return reading.where.filter((held) => !held.me).map((held) => held.field);
31924
+ default:
31925
+ return [];
31926
+ }
31927
+ }
31916
31928
  function filterField(filter2) {
31917
31929
  return typeof filter2 === "string" ? filter2 : filter2.field;
31918
31930
  }
@@ -32109,7 +32121,7 @@ var MODEL_RULES = {
32109
32121
  note: true
32110
32122
  },
32111
32123
  "register.filter-unshown": {
32112
- sentence: "A filter, and a narrowing the register `opens` on, names a field its rows show \u2014 a column; the row's title, the line under it, its picture, status or figure, or a meter's bound; a deadline; a warning its line says; the group or lane it stands under."
32124
+ sentence: "A filter, a narrowing the register `opens` on, and a press in its band (a breakdown's part, a pivot's cell, a figure's `where`) name a field its rows show \u2014 a column; the row's title, the line under it, its picture, status or figure, a meter's bound, or the unit or currency a drawn figure is read in; a deadline; a warning its line says; the group or lane it stands under. A narrowing to the reader (`\"me\"`) needs none."
32113
32125
  },
32114
32126
  "register.tiers": { sentence: "`tiers` band a number read in one unit on every row; a figure read in each row's own unit or currency is named bare." },
32115
32127
  "register.search": { sentence: "`search` names text, a code, or a link \u2014 matched by its row's title." },
@@ -32382,7 +32394,7 @@ var tieredFilterSchema = zod_default.object({
32382
32394
  var registerSchema = zod_default.object({
32383
32395
  columns: zod_default.array(fieldAlias).optional().describe("Fields read as columns after the row's title \u2014 on a calendar's entry or a lane's block, its facts after its title; never what the row draws itself (its subtitle, image, status, figure, or the bound its figure's meter reads against), which the runtime places"),
32384
32396
  filters: zod_default.array(zod_default.union([fieldAlias, tieredFilterSchema])).max(LINE_FILTERS, { error: `a register states at most ${LINE_FILTERS} filters \u2014 keep the ones narrowed by daily` }).optional().describe(
32385
- `The fields the reader narrows the rows by every day, in that order \u2014 each earns its place by that daily use, so none to ${LINE_FILTERS} is normal and ${LINE_FILTERS} is a cap, never a quota (a select, a member, a link, a date, a yes/no, a number as a range, or its \`tiers\` where the business narrows by those bands daily) \u2014 each on a desk's line, in one Filters sheet on a phone. Never the status (its chips); each a field the rows show \u2014 a column, or a part of the row. A press on a breakdown's part or a pivot's cell in the band narrows by its field too. A threshold the business names ("large orders") is a formula yes/no here; a column's header sorts by a day or an amount`
32397
+ `The fields the reader narrows the rows by every day, in that order \u2014 each earns its place by that daily use, so none to ${LINE_FILTERS} is normal and ${LINE_FILTERS} is a cap, never a quota (a select, a member, a link, a date, a yes/no, a number as a range, or its \`tiers\` where the business narrows by those bands daily) \u2014 each on a desk's line, in one Filters sheet on a phone. Never the status (its chips); each a field the rows show \u2014 a column, or a part of the row. A threshold the business names ("large orders") is a formula yes/no here; a column's header sorts by a day or an amount`
32386
32398
  ),
32387
32399
  search: zod_default.array(fieldAlias).min(1).optional().describe(
32388
32400
  "The fields the search box matches (a link by its row's title); a pasted list searches each line and names the lines no row matched. Absent, every word of the row"
@@ -32445,7 +32457,9 @@ var registerSchema = zod_default.object({
32445
32457
  ]).optional().describe(
32446
32458
  "The rows in view saved as the register's report \u2014 its title, a line per thing narrowing the rows, the readings and every row: `true`, one workbook of the register's columns; a list, the reports a reader picks from one export menu"
32447
32459
  ),
32448
- readings: zod_default.array(figureReadingSchema).min(1).optional().describe("Readings of the register's own entity above its rows, over the rows in view \u2014 the search, the status and the filters narrow them")
32460
+ readings: zod_default.array(figureReadingSchema).min(1).optional().describe(
32461
+ "Readings of the register's own entity above its rows, over the rows in view \u2014 the search, the status and the filters narrow them, but a picture's own field, read as the register opens on it. A press on a breakdown's part, a pivot's cell or a figure with `where` narrows the rows by its field, as a filter does"
32462
+ )
32449
32463
  }).strict();
32450
32464
  var shownWhen = conditionsHold(
32451
32465
  "Shown only while each named select of the record holds one of these options, and each named yes/no (stored, or a formula) is this value"
@@ -35650,12 +35664,14 @@ function partsOf(display) {
35650
35664
  [display.title, "its title"]
35651
35665
  ]);
35652
35666
  }
35653
- function splitBy(reading) {
35654
- const split2 = "breakdown" in reading ? [reading.by] : "pivot" in reading ? [reading.rows, reading.columns] : [];
35655
- return split2.filter((name) => {
35656
- const kept = reading.where?.[name];
35657
- return kept === void 0 || Array.isArray(kept) && kept.length > 1;
35658
- });
35667
+ function heldBy(narrowing) {
35668
+ return Object.entries(narrowing ?? {}).map(([field, held]) => ({ field, values: Array.isArray(held) ? held.length : 1, me: held === NARROW_ME }));
35669
+ }
35670
+ function modelPressed(reading) {
35671
+ if ("breakdown" in reading) return { kind: "breakdown", by: reading.by, where: heldBy(reading.where) };
35672
+ if ("pivot" in reading) return { kind: "pivot", rows: reading.rows, columns: reading.columns };
35673
+ if ("metric" in reading) return { kind: "metric", where: heldBy(reading.where) };
35674
+ return { kind: "trend" };
35659
35675
  }
35660
35676
  function meterBounds(display, columns) {
35661
35677
  if (display === void 0) return /* @__PURE__ */ new Map();
@@ -35820,7 +35836,7 @@ function checkApp(model, app, at2) {
35820
35836
  if (first2 !== void 0) findings.push(error51("register.column-drawn", path15, `"${name}" is already column ${first2} \u2014 a field is one column`));
35821
35837
  else columns.set(name, index);
35822
35838
  }
35823
- const splits = new Set((app.register?.readings ?? []).flatMap(splitBy));
35839
+ const splits = new Set((app.register?.readings ?? []).flatMap((reading) => "metric" in reading ? [] : pressFields(modelPressed(reading))));
35824
35840
  for (const [index, stated] of (app.register?.filters ?? []).entries()) {
35825
35841
  const name = filterField(stated);
35826
35842
  const path15 = `${at2}.register.filters.${index}`;
@@ -36457,26 +36473,39 @@ function checkFiltersShown(model, entity, app, at2) {
36457
36473
  const display = recordDisplay(withAppRow(model, app), entity.alias);
36458
36474
  if (register === void 0 || display === void 0) return [];
36459
36475
  const columns = register.columns ?? [];
36476
+ const drawn = [...partsOf(display).keys(), ...meterBounds(display, columns).keys(), ...columns];
36460
36477
  const shown = /* @__PURE__ */ new Set([
36461
- ...partsOf(display).keys(),
36462
- ...meterBounds(display, columns).keys(),
36478
+ ...drawn,
36479
+ // A figure read in its row's own unit or currency says that select beside its number.
36480
+ ...drawn.flatMap((name) => {
36481
+ const field = fieldOf(entity, name);
36482
+ const select = field === void 0 ? void 0 : contractFigureSelect(field, entity, model.entities);
36483
+ return select === void 0 ? [] : [select.alias];
36484
+ }),
36463
36485
  ...display.due ?? [],
36464
- ...columns,
36465
36486
  // A guard waits at the act it refuses; a register's row says its warnings.
36466
36487
  ...(app.checks ?? []).flatMap((check2) => check2.of === void 0 && check2.blocks === void 0 ? [check2.field] : []),
36467
36488
  ...register.group === void 0 ? [] : [register.group],
36468
36489
  ...register.lanes === void 0 ? [] : [register.lanes]
36469
36490
  ]);
36470
- const fixed = /* @__PURE__ */ new Set([...Object.keys(register.where ?? {}), ...app.scope === void 0 ? [] : [app.scope]]);
36491
+ const fixed = /* @__PURE__ */ new Set([...heldBy(register.where).flatMap((held) => held.values === 1 ? [held.field] : []), ...app.scope === void 0 ? [] : [app.scope]]);
36492
+ const unshown = (name) => `"${name}" is drawn nowhere on the rows it narrows \u2014 make it a column or part of the row's line, or drop it`;
36493
+ const pressed = (part) => (name) => `a press on its ${part} narrows the rows by "${name}", which is drawn nowhere on them \u2014 make it a column or part of the row's line, or drop the reading`;
36471
36494
  const narrowed = [
36472
- ...(register.filters ?? []).map((stated, index) => ({ name: filterField(stated), path: `${at2}.register.filters.${index}` })),
36473
- ...Object.keys(register.opens ?? {}).map((name) => ({ name, path: `${at2}.register.opens.${name}` }))
36495
+ ...(register.filters ?? []).map((stated, index) => ({ name: filterField(stated), path: `${at2}.register.filters.${index}`, says: unshown })),
36496
+ ...Object.entries(register.opens ?? {}).flatMap(([name, held]) => held === NARROW_ME ? [] : [{ name, path: `${at2}.register.opens.${name}`, says: unshown }]),
36497
+ ...(register.readings ?? []).flatMap((reading, index) => {
36498
+ const path15 = `${at2}.register.readings.${index}`;
36499
+ if (readingEntity(reading) !== entity.alias || checkReading(model, reading, path15).length > 0) return [];
36500
+ const part = "metric" in reading ? "figure" : "pivot" in reading ? "cell" : "part";
36501
+ return pressFields(modelPressed(reading)).map((name) => ({ name, path: path15, says: pressed(part) }));
36502
+ })
36474
36503
  ];
36475
- return narrowed.flatMap(({ name, path: path15 }) => {
36504
+ return narrowed.flatMap(({ name, path: path15, says }) => {
36476
36505
  const field = fieldOf(entity, name);
36477
36506
  const type = field === void 0 ? void 0 : resolvedFieldType(field, entity, model.entities) ?? field.type;
36478
36507
  if (shown.has(name) || fixed.has(name) || type === void 0 || !FILTER_TYPES.has(type)) return [];
36479
- return [error51("register.filter-unshown", path15, `"${name}" is drawn nowhere on the rows it narrows \u2014 make it a column or part of the row's line, or drop it`)];
36508
+ return [error51("register.filter-unshown", path15, says(name))];
36480
36509
  });
36481
36510
  }
36482
36511
  function checkBlock(model, entity, block, at2, place, scoped) {
@@ -37451,7 +37480,7 @@ function resultSideEffects(result) {
37451
37480
  }
37452
37481
 
37453
37482
  // src/version.ts
37454
- var VERSION = "0.271.0";
37483
+ var VERSION = "0.273.0";
37455
37484
  var APP_SDK_VERSION = "0.103.0";
37456
37485
 
37457
37486
  // src/timezone.ts
@@ -37468,7 +37497,7 @@ function machineTimezone() {
37468
37497
  import { spawn as spawn2 } from "node:child_process";
37469
37498
 
37470
37499
  // src/model_reference.md
37471
- var model_reference_default = '# The Lotics workspace model (`model.json`)\n\nOne JSON file describing a workspace: its tables, fields, options, views, roles,\nfirst rows, how a row of each table is recognised, and the apps over them. Each \xA7\nis `lotics docs model/<section>`. Complete models of several trades, to read as\nworked examples: `https://lotics.ai/presets/index.json`.\n\n**What a model composes with**\n\n- **Entities and fields** (\xA7 Entity, \xA7 Field) \u2014 the tables, their columns, options and links.\n- **Records** (\xA7 Records) \u2014 how a row of each entity is RECOGNISED: its title, the line\n under it, its picture, its status, the one number it stands for. Stated once per entity\n and read by every surface that draws one of its rows.\n- **Write rules** (\xA7 Write rules) \u2014 what a write finds, copies, bounds and picks among.\n- **Apps** (\xA7 Apps) \u2014 one register over one entity and the record each row opens: which\n fields go where, the acts, and the checks that guard them \u2014 or a dashboard of readings.\n How each thing LOOKS is the runtime\'s, one treatment per concept; no key here changes it.\n A screen the job needs and no key states is a `lotics report` \u2014 the job, what the model\n drew, the word wanted \u2014 never keys bent to approximate it.\n\n**The working order**\n\n1. Name the people and each one\'s JOB \u2014 the work they alone decide or write.\n2. The entities and fields those jobs touch, and a `records` entry for every entity an\n app lists, opens or picks.\n3. One app per job in `apps[]`, each one register over one entity.\n4. `lotics model apply model.json` \u2014 the file is checked first, every problem in one run;\n then the tables, then a new version of every app, live\n (`lotics setup model.json --email you@company.com` where no account exists yet).\n5. Change the file and apply it again; `lotics model pull` writes what the workspace holds.\n Rolling an app back (`lotics run rollback_app`) restores its earlier version \u2014 table\n changes and data writes stay.\n\n## The rules\n\n- **At least one entity, at most 50.** More tables than that is a data model\n being designed, not applied \u2014 apply the rest in a second call.\n- **An existing table is adopted.** `lotics model apply` binds an entity whose `label`\n already names a table in the workspace, and adds the fields, options and\n views it is missing. No stored value is ever changed or deleted: a field it\n adopts takes the model\'s `default`, and the `format` and `unit` it reads in,\n where that only relabels \u2014 a date\'s format and a unit converting its figures are\n left. Applying the same model twice changes nothing the second time.\n- **Renaming a field is `lotics run update_table`**, then the same label in this\n file; deleting is `lotics run delete_table`. Neither goes through the file\n (\xA7 What a run remembers).\n- **The file\'s own majority is the language.** A model names no locale \u2014 which\n language it is in is what it mostly says, and `model apply` notes the label\n written the other way. The generated screens read the kit\'s pack, and a\n generated WRITE cannot: its refusals run on the server, so they are worded in\n that same majority. Mix the two and the workspace answers in two languages.\n- **Rows land only where every bound table is empty.** One table already holding\n records and no rows are written anywhere: sample rows landing among a\n customer\'s real ones cannot be told apart from them.\n- **`lotics model apply` checks all of it before anything is written**, and\n reports every problem in one run rather than the first. Each section of this\n page ends its keys with the rules the check enforces there, one sentence each\n under an id; a finding names its rule\'s id (`[register.filter]`), and\n `lotics docs model/<rule id>` prints that one rule.\n\n<!-- generated:start rules-model -->\n\n#### Rules the check enforces\n\n| Rule | |\n|---|---|\n| `model.schema` | Every key is one its table lists, holding the type its row gives, and every required key is stated. |\n| `model.retired` | `field_roles`, `table_workflows` and `connections` are no longer part of a model: `records` states how a row is recognised, and an app\'s own writes do what a table automation did. |\n| `model.names-declared` | Every alias a key names is declared: an entity of this model, a field of the entity the key reads, an option of the select it names, an act of the app, a template or an app of this model. |\n| `model.tables` | A model declares at least one table and at most 50; apply the rest as a second model. |\n| `model.rows-cap` | Rows are a sample: at most 200 per entity, 2000 per model and 2000 documents attached \u2014 a real data set belongs in an import. |\n| `model.language` | *Noted, never refused:* A label or description written in the other language than the model\'s majority \u2014 with or without diacritics. |\n| `model.alias-unique` | An alias is unique where it is named: entities, roles and templates in the model, fields and views in their entity, options in their select. |\n| `model.label-unique` | A label is unique where apply finds it by label: entities, roles and templates in the model, fields and views in their entity, options in their select \u2014 and no view takes its entity\'s own label, which names the whole-table grid apply makes. |\n| `model.template-sha` | A template\'s `content_sha256`, where stated, is the 64-character lowercase hex sha256 of its content. |\n| `model.template-kind` | An act makes its document from an html template; a register\'s `export` fills an html or an excel one. |\n| `model.filter` | A filter \u2014 a view\'s, a rollup\'s \u2014 tests fields of the entity it reads, through links as `entity.field` hops each standing on the entity the last lands on, by options its select declares. |\n\n<!-- generated:end rules-model -->\n\n## Top level\n\nEvery table of keys on this page is generated from the schema `model apply`\nparses the file with, so it is the whole of what a key may hold.\n\n<!-- generated:start top-level -->\n\n#### Model file\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `entities` | list of [Entity](#entity) | yes | The tables this model creates, with their fields, options and views |\n| `roles` | list of [Role](#role) | no | Workspace groups to create; members are added to them afterwards |\n| `templates` | list of [Template](#template) | no | Document templates: html and email inline, excel made from an uploaded workbook |\n| `rows` | map of alias \u2192 list of [Row](#row) | no | First records, keyed by entity alias \u2014 written only where every table they land in is empty |\n| `records` | map of alias \u2192 [Record](#record) | no | How a row of each entity is recognised, keyed by entity alias. Every entity an app lists, opens or picks has one |\n| `write_rules` | map of alias \u2192 [Entity write rules](#entity-write-rules) | no | Entity alias \u2192 what a create of that entity finds, copies and refuses |\n| `apps` | list of ([App](#app) \\| [Dashboard app](#dashboard-app)) | no | The apps this workspace will have \u2014 each one register over an entity, or a dashboard of readings |\n\n<!-- generated:end top-level -->\n\n**A model carries no** `fixtures`, `knowledge` or `knowledge_expects`, and no\n`word` / `pdf-form` template: file content is uploaded to the workspace, never\nstated in a model \u2014 an `excel` template names its uploaded workbook by `file_id`. `apps` here is what an agent states to make an app,\nnever built code. An unknown top-level key is an error, never ignored.\n\n### Aliases\n\nEvery `alias` is a lowercase slug \u2014 a letter, then letters, digits and\nunderscores (`unit_price`, `so_1001`). Aliases are how the file cross-references\nitself; they are never shown to anyone. `label` is what a person sees.\n\nLabels must be unique within their namespace \u2014 two entities, two fields on one\nentity, two options on one field, two views on one entity, two roles or two\ntemplates cannot share a label, because `apply` matches by label.\n\n## Entity\n\n<!-- generated:start entity -->\n\n#### Entity\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `alias` | alias | yes | Stable entity alias, unique within the contract |\n| `label` | text | yes | The table\'s name in the workspace, which apply names it |\n| `singular` | text | no | One row of this table, in the business\'s own words \u2014 what a create\'s button and panel name |\n| `description` | text | no | The table\'s description, written onto the table in the workspace |\n| `writes` | `false` | no | false: no person writes this table\'s rows \u2014 only the writes that keep it do, and no app opens or edits one |\n| `fields` | list of [Field](#field) (at least one) | yes | The table\'s columns |\n| `read_scope` | [Read scope](#read-scope) | no | Which rows a member reads. Absent, every member with access to the table reads every row. |\n| `unique` | list of list of alias (at least one) (at least one) | no | Sets of fields whose values no two live rows share \u2014 each a list of field aliases (text, number, date, a single select, or a link of cardinality "one"). A create or update landing a second row with the same values is refused. |\n| `views` | list of [View](#view) | no | Saved views, in the order they are listed; with none, the table still opens on its default grid |\n\n#### Read scope\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `any` | list of ([Read scope by role](#read-scope-by-role) \\| [Read scope by member](#read-scope-by-member) \\| [Read scope by option](#read-scope-by-option)) (at least one) | yes | A row is readable when ANY of these holds |\n\n#### Read scope by role\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `member_of` | alias | yes | A role alias: whoever is in the group it binds to reads the row |\n\n#### Read scope by member\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `through` | list of alias (1\u20133) | no | select_record_link aliases from this entity outward, each of cardinality "one" \u2014 the clause\'s field is on the entity the last hop lands on |\n| `field` | alias | yes | A select_member field alias on this entity, or on the entity `through` lands on |\n| `is` | `"self"` | yes | The members this column names on a row read that row |\n\n#### Read scope by option\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `through` | list of alias (1\u20133) | no | select_record_link aliases from this entity outward, each of cardinality "one" \u2014 the clause\'s field is on the entity the last hop lands on |\n| `field` | alias | yes | A single-select field alias on this entity, or on the entity `through` lands on |\n| `is` | list of alias (at least one) | yes | Its option aliases whose rows are readable \u2014 naming none would hide every row |\n\n<!-- generated:end entity -->\n\n<!-- generated:start rules-entity -->\n\n#### Rules the check enforces\n\n| Rule | |\n|---|---|\n| `entity.singular` | An entity a create is mounted over \u2014 a register that adds, a rows block \u2014 states its `singular`: one row of it, in the business\'s words. |\n| `entity.required-cycle` | Required links never wait on each other in a loop: no row of the loop could be created first. |\n| `entity.link-format` | A text field of `format: "link"` holds web addresses; one whose rows hold a phone or a mail address states no format. |\n| `entity.read-scope` | A `read_scope` clause names a declared role (`member_of`) or a field of its entity reached through one-row links: `"self"` a member field, options a single select declares. |\n| `entity.unique` | A `unique` set names two fields or more of its entity once each, each holding one value to compare \u2014 text, a number, a date, a single select, a one-row link \u2014 and is stated once; one field alone is `unique: true` on it. |\n\n<!-- generated:end rules-entity -->\n\n**`unique` is a set of values no two live rows share.** Each entry names fields\nof this entity holding ONE value \u2014 text, number, date, a single select, a link\nof cardinality `"one"` \u2014 and a create or update landing a second row with the\nsame values is refused. A set of one text field is that field\'s own `unique:\ntrue`, so it is refused here. A create carries each set in the names its panel\nsends, so the panel can name the duplicate before the write does.\n\n**`singular` is what a create says** \u2014 `New Order`, `Add Claim line`, `H\u1ED3 s\u01A1\nm\u1EDBi` \u2014 while `label` names the table, so without it the button reads `New\nOrders`. Nothing derives it: English plurals are irregular, and no language is\nexempt. In a language without plural forms it is usually the label itself,\nless any word for the collection. `model apply` REFUSES a model where a table\nsome create opens \u2014 a register\'s own, or a record section\'s add \u2014 states none.\n\n**`writes: false` says only the workspace\'s automations write these rows** \u2014 a\nlog of what the system sent, a copy of what another system holds. No app opens,\nedits or files one: a record listing them keeps the section and opens each row\nat rest, with no Add; a screen over the entity operates at most the rows its\nrecord owns; a party of it is picked, never found or minted; and the generator\nwrites no create and no update for it, and never notes it as created nowhere.\nA `lifecycle` on it is refused \u2014 a row walked\nthrough stages is worked by a person \u2014 and so is a publish desk over it. Absent,\npeople write the rows; `true` is not a value.\n\n**`read_scope` is a ROW rule, enforced by the platform.** It is resolved at\napply into the table\'s own row filters, so an app, a workflow reading for a\nviewer, and the API all answer the same rows \u2014 a per-record visibility field the\napp merely honours is a convention, not a gate. A `"self"` clause reads a column\nof one member or several, and every role alias and option alias a clause names\nmust be one this model declares. `apply` writes the rule onto a table it\nCREATES; a table it adopted that ALREADY CARRIES a rule keeps that one, because\nthe rule is the workspace\'s own statement about its rows \u2014 and a run whose model\nstates a different rule reports the entity rather than leaving the claim silent.\n\n**An app may state that its sharing is its read gate: `"reads": "shared"`.** An\napp reads as its owner, so the rule reaches a viewer only as the predicate every\nquery and editor guard of every app over the entity carries \u2014 right for a desk of\none\'s own rows, wrong for a desk whose audience its sharing already decides, where\nwidening the rule meant a role group nobody remembers to fill. Stated on an APP,\nits queries, pickers and guards carry no entity\'s rule and whoever the app is\nshared with reads and writes every row it draws; every other app and the table\'s\nown filters keep the rule. Share it deliberately. Refused on an app none of whose\ntables states a `read_scope`.\n\n**The rows under a private record INHERIT its rule.** An entity that states no\n`read_scope` and hangs under one that does \u2014 through its `parent` link, over one\nhop or several \u2014 is read by the ancestor\'s rule, answered through that link, on\nits table\'s own filters and in every query and guard alike; nothing is restated,\nso a child needs none of the ancestor\'s columns. Stating a rule on the child\nkeeps that one instead, an ancestor with no rule passes nothing down, and a row\nhanging further under the scoped one than a row filter reaches is refused by\nname \u2014 state a rule on it. So is a hop over a link that names more than one row:\nthe rule would admit a reader any one of them admits while the editor\'s guard\nreads the first, so give the link `"cardinality": "one"` or state a rule on the\nchild.\n\n**ONLY the `parent` role is walked.** A register a scoped record reaches by any\nother link \u2014 the rows that NAME it \u2014 is read by that record\'s id with no rule\ntravelling to it, so it is refused until it states one of its own.\n\n## Field\n\nEvery field carries the keys below, and its `type`\'s section adds the rest; a\ntype whose section names no `default` takes none. `label` may not contain `{` or\n`}` (formulas reference fields by label at the platform level). Every row in `rows` states each\n`required` field it carries (a default is not applied to them), and a required\nLINK is written with its row: the entity it names is created first, and entities\nwhose required links name each other are refused, since none of their rows could\never be created.\n\n<!-- generated:start field -->\n\n#### Field\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `type` | `"text"` \\| `"number"` \\| `"date"` \\| `"boolean"` \\| `"select"` \\| `"select_member"` \\| `"select_record_link"` \\| `"files"` \\| `"formula"` \\| `"rollup"` \\| `"lookup"` \\| `"autonumber"` | yes | What the field holds \u2014 each type takes the further keys its own section lists |\n| `alias` | alias | yes | Stable local alias, unique within the entity |\n| `label` | text | yes | The field\'s name in the workspace, which apply names it |\n| `description` | text | no | The field\'s description, written onto the field in the workspace |\n| `required` | boolean | no | Refuse a record whose cell for this field is empty. Apply writes it onto the field, and every write path \u2014 create, update, an agent\'s tool call, a workflow\'s set \u2014 refuses the row by field name. |\n\n<!-- generated:end field -->\n\n### `text`\n\n<!-- generated:start field-text -->\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `default` | text | no | Value pre-filled into a new record when none is supplied for this field. Applied on create only \u2014 existing records are never backfilled. |\n| `unique` | boolean | no | Unique values required |\n| `format` | `"text"` \\| `"link"` \\| `"markdown"` | no | How the words are drawn \u2014 plain, as a link that opens, or as markdown |\n\n<!-- generated:end field-text -->\n\n### `number`\n\n<!-- generated:start field-number -->\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `default` | number | no | Value pre-filled into a new record when none is supplied for this field. Applied on create only \u2014 existing records are never backfilled. |\n| `format` | `"number"` \\| `"currency"` \\| `"percentage"` | no | What the figure is \u2014 a plain number, money in `currency`, or a percent |\n| `currency` | text | no | ISO 4217 code |\n| `unit` | text | no | What a plain figure counts or measures, drawn after it: a measured code (g, kg, t, l, m3, cbm, mm, cm, m, km, m2, min, h, day), which converts and scales within its dimension, or any other noun of at most 12 characters (ki\u1EC7n, pallet, TEU), which never does. Only beside format "number". |\n| `unit_field` | alias | no | A single select on the same row, or a lookup of one through a one-link, whose chosen option is that row\'s unit: every option label is a unit as `unit` takes one. In place of `unit`; only beside format "number". |\n| `currency_field` | alias | no | A single select on the same row, or a lookup of one through a one-link, whose chosen option is that row\'s currency: every option label is an ISO 4217 code. In place of `currency`; only beside format "currency". |\n\n<!-- generated:end field-number -->\n\n`format` is what the number IS, and every surface reads it: `currency` prints as\nmoney in the code the row or the field states, `percentage` as a whole percent\nwith its sign. An ABSENT number is drawn absent \u2014 the one exception is a\n`sum` or count rollup the plan reads as a **`measure`**: that is the thing\naccumulated toward a bound, so nothing accumulated yet is zero and the meter\ndraws it. The same rollup read as an `amount` keeps its blank, and so does every\nother role: nothing added to what a row is WORTH means unpriced, not free. A\nformula reading only such sums and counts, and reading zero where each does\n(`{received} - {refunded}`), is one too. A `min`, an `avg`, a percentage of\nnothing and every other formula stay blank in any role, because none of them has\nan answer to give. This is why the pair on one\nscreen reads two ways \u2014 what has come in against what is owed \u2014 and why a\nmeasure\'s own LIMIT, an amount, leaves an unquoted row out of the count rather\nthan reporting it as nothing collected. **AND WHERE THAT LIMIT IS ABSENT \u2014 OR\nZERO \u2014 THERE IS NO LEVEL AT ALL**: a level is a reading AGAINST a bound, so a row\nthat states no bound, or a bound of nothing, draws nothing \u2014 cell, fact and all \u2014\nrather than a numerator whose whole meaning was the comparison. "Collected 0"\nbeside a blank total reads as money against a job worth nothing, and "0 of 0"\nagainst a count of nothing owed claims a comparison nobody can make. A measure the model gives no limit is a plain figure\nand is unaffected. A share is stored in percent units \u2014 68.1 is 68.1 % \u2014 and the\ncolumn, the fact behind it, the meter it is judged by and the figure over the\nregister all say so.\n\n`unit` is what a plain figure counts or measures, and stands only beside\n`format: "number"`. A **measured** unit is a code of one catalog \u2014 mass `g`\n`kg` `t`, volume `l` `m3` `cbm` (a cubic metre under freight\'s name), length\n`mm` `cm` `m` `km`, area `m2`, duration `min` `h` `day` \u2014 so a figure typed in\nanother unit of its dimension converts (`12,5 t` into a `kg` field is 12 500),\nand a tile or a chart reads it in the largest unit it reaches (12 500 kg as\n12,5 t\u1EA5n; CBM never scales) while a cell, a fact and a column always read in the\nfield\'s own. Any other noun of at most 12 characters (`ki\u1EC7n`, `pallet`, `TEU`) is a\n**counted** unit: a word after the figure that never converts. A measured unit is\nwritten as its code \u2014 `t\u1EA5n`, `KG` or `m\xB3` is refused, naming the code. A formula\nstates its own in `formula.unit`; a rollup that keeps the value (`sum`, `avg`,\n`median`, `min`, `max`, `range`) and a lookup carry the unit of the figure they\nread, exactly as they carry a currency, and a count carries none. A quantity is a\nnumber with its unit, never words (`3 cartons` in a text field): only a number\nsums, converts and reads down a column.\n\nA field\'s cells always hold figures in its own unit, so moving it between two\nunits of one dimension (`kg` to `t`) converts every stored figure \u2014 a change made\nin the workspace, in the field\'s settings (which say how many first) or through\n`lotics run update_table`. `model apply` never makes it: the model states the\nworkspace\'s unit until then. Any other change of unit\nrelabels.\n\nA figure whose unit or currency varies by row names a single select of its own\nrow in `unit_field` or `currency_field` (a formula in `formula.unit_field` /\n`formula.currency_field`) \u2014 or a lookup of one through a one-link, a line\nreading its shipment\'s currency. That select\'s options are the vocabulary:\neach label a unit as `unit` takes one (`chi\u1EBFc`, `kg`), or an ISO 4217 code\n(`USD`). A label outside it is refused when the figure is written and when the\nselect is \u2014 its options, its type or its deletion while a figure names it. A row\nwhose select is empty reads its figure bare. Every app reads each row\'s figure in\nits own row\'s unit, and a sum never mixes units: totals are one per unit, a\nchart draws one at a time. A rollup that keeps the value (`sum`, `avg`, `min`\u2026)\nover such a figure stands only where the child\'s select is a lookup, through\nthe rollup\'s own link, of a select on this entity \u2014 the rollup reads that\nselect\'s unit; otherwise it is refused, as is any lookup of such a figure (its\nunit lives on the other row). A count is unaffected. Moving a field between a\nfixed and a per-row unit relabels.\n\n### `date`\n\n<!-- generated:start field-date -->\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `default` | text | no | Value pre-filled into a new record when none is supplied for this field. Applied on create only \u2014 existing records are never backfilled. A date string in the field\'s format. |\n| `format` | `"date"` \\| `"datetime"` \\| `"date_range"` \\| `"datetime_range"` | no | Whether the field holds a day or a moment, alone or as a span |\n| `timezone` | text | no | IANA timezone |\n| `derive_from` | `"created_at"` \\| `"updated_at"` | no | Auto-populate from the row\'s system timestamp; the field becomes read-only. |\n\n<!-- generated:end field-date -->\n\nA `default` is refused beside `derive_from`: the platform stamps that date.\n\n### `boolean`\n\n<!-- generated:start field-boolean -->\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `default` | boolean | no | Value pre-filled into a new record when none is supplied for this field. Applied on create only \u2014 existing records are never backfilled. |\n\n<!-- generated:end field-boolean -->\n\n### `select`\n\n<!-- generated:start field-select -->\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `default` | list of alias | no | Value pre-filled into a new record when none is supplied for this field. Applied on create only \u2014 existing records are never backfilled. Option alias(es) this field declares \u2014 one for single-select. |\n| `options` | list of [Select option](#select-option) (at least one) | yes | The choices, in the order every picker and every ladder lists them |\n| `multi` | boolean | no | Allow multiple selections |\n\n#### Select option\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `alias` | alias | yes | Stable local alias, unique within the field |\n| `label` | text | yes | Display label for the option |\n| `color` | [colour](#select) | yes | The colour the option\'s badge is drawn in |\n| `mark` | [mark](#select) | no | The option\'s own mark, drawn in place of its colour dot wherever the option is shown: the brand it is ({kind: "brand", name: one of facebook, instagram, threads, meta, tiktok, google-ads, zalo, linkedin, x, google-meet, youtube, telegram, whatsapp, gmail, google-drive, outlook, kiotviet, misa, lark, payos}) or a kit glyph ({kind: "icon", name: "wrench"}). Every option of a field has one, or none does. A mark a reader does not draw falls back to the dot |\n\n<!-- generated:end field-select -->\n\n`color` is one of: `red`, `orange`, `amber`, `yellow`, `lime`, `green`,\n`emerald`, `teal`, `cyan`, `sky`, `blue`, `indigo`, `violet`, `purple`,\n`fuchsia`, `pink`, `rose`, `slate`, `gray`, `zinc`, `neutral`, `stone`.\nEvery option is drawn in its colour wherever it shows \u2014 a cell, a row\'s line,\na record, a picker, the bar a reading splits the rows by.\n\nAn option may carry its own `mark`, drawn in place of its colour dot wherever\nthe option is shown \u2014 a stage, a chip, a filter, a fact, an entry of a log, a\nreading\'s part, a lookup of the select on another entity. A select a reader scans\ndown a column \u2014 how a payment was made, the channel, the mode \u2014 states one on every\noption, since a glyph reads before its word: the brand it IS\n(`{"kind": "brand", "name": "tiktok"}` \u2014 one of `facebook`, `instagram`,\n`threads`, `meta`, `tiktok`, `google-ads`, `zalo`, `linkedin`, `x`,\n`google-meet`, `youtube`, `telegram`, `whatsapp`, `gmail`, `google-drive`,\n`outlook`, `kiotviet`, `misa`, `lark`, `payos`), or a glyph the kit draws\n(`{"kind": "icon", "name": "wrench"}`; any other name is refused). Every option of a select has one, or none does: a run of chips\nwhere one carries no mark reads as the one missing something. `apply` writes the\nmarks onto the table, sets one an adopted option lacks, and reports one it wears\ndifferently rather than overwrite it. The glyphs:\n\n<!-- generated:start field-select-glyphs -->\n\nactivity, align-center, align-left, align-right, arrow-down, arrow-down-up, arrow-down-wide-narrow, arrow-left, arrow-left-from-line, arrow-right, arrow-right-from-line, arrow-right-left, arrow-up, arrow-up-down, arrow-up-wide-narrow, ban, banknote, bed, bell, bold, bolt, book-marked, book-open, book-text, bot, box, brackets, brain, briefcase, building-2, calculator, calendar, calendar-clock, calendar-off, camera, car, chart-column, check, chevron-down, chevron-left, chevron-right, chevron-up, chevrons-down-up, chevrons-up-down, circle-alert, circle-check, clipboard-list, clock, code, code-xml, columns-3, columns-3-cog, construction, container, copy, credit-card, database, download, ellipsis, eraser, expand, external-link, eye, eye-off, facebook, file, file-csv, file-down, file-question, file-spreadsheet, file-stack, file-text, file-up, folder, folder-closed, folder-open, folder-pen, form, funnel-plus, funnel-x, gauge, globe, gpu, grip-vertical, group, hand-coins, heading, heading-1, heading-2, heading-3, history, house, image, inbox, info, instagram, italic, keyboard, languages, layout-dashboard, layout-grid, library-big, link-2, link-2-off, linkedin, list, list-checks, list-collapse, list-filter, list-filter-plus, list-ordered, loader, lock, lock-keyhole, lock-keyhole-open, lock-open, log-in, log-out, mail, map-pin, maximize-2, megaphone, menu, message-circle, message-circle-question-mark, message-square, messages-square, mic, minimize-2, minus, monitor, mouse, mouse-pointer-click, music, newspaper, notepad-text-dashed, package, paint-bucket, palette, panel-left, panel-left-close, panel-left-open, panel-right, panel-right-close, panel-right-open, paperclip, pause, pencil, phone, pin, pin-off, plane, play, plug, plus, receipt, rectangle-ellipsis, redo, refresh-cw, repeat, rotate-ccw, rotate-cw, scan, search, send, settings, share, share-2, shield, shield-alert, shield-check, shopping-cart, sliders-horizontal, smile, smile-plus, sparkles, split, square, square-check, square-pen, square-sigma, stethoscope, sticky-note, table, table-2, tag, target, text-quote, thumbs-down, thumbs-up, ticket, trash, trending-down, trending-up, triangle-alert, truck, tv-minimal, twitter, underline, undo, upload, user, user-check, user-pen, users, utensils, waypoints, workflow, wrench, x, zap\n\n<!-- generated:end field-select-glyphs -->\n\n```jsonc\n"options": [\n { "alias": "short_video", "label": "Short video", "color": "zinc", "mark": { "kind": "brand", "name": "tiktok" } },\n { "alias": "print", "label": "Print", "color": "amber", "mark": { "kind": "icon", "name": "newspaper" } }\n]\n```\n\n### `select_member`\n\nA person picker over the workspace\'s members. No default: a model cannot name\nmembers of a workspace that does not exist yet. With no role it is still drawn \u2014\nface and name, ranked as a `party` \u2014 in a screen\'s `columns` and in the register\na record draws of these rows.\n\n<!-- generated:start field-select_member -->\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `multi` | boolean | no | Allow multiple selections |\n\n<!-- generated:end field-select_member -->\n\n### `select_record_link`\n\n<!-- generated:start field-select_record_link -->\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `target_entity` | alias | yes | Alias of the entity this field links to |\n| `sync_both_ways` | boolean | no | Create a paired link field on the target entity for bidirectional sync |\n| `paired_field_alias` | alias | no | The pair edge of a bidirectional link: the field alias ON THE TARGET ENTITY that is this link\'s sync partner. Both sides of a pair carry it, each naming the other. Apply creates whichever side it reaches first WITH the pairing (the platform auto-creates the partner) and binds the partner alias to the auto-created field \u2014 without this edge the two contract fields would be created independently and collide with the auto-created partner. |\n| `cardinality` | `"one"` \\| `"many"` | no | How many linked records this field holds. Default \'many\'. \'one\' holds a single row and needs no partner; where the link IS paired, the partner side holds many. |\n| `display_field_aliases` | list of alias | no | Field aliases on the target entity shown as the link\'s display text / picker columns |\n\n<!-- generated:end field-select_record_link -->\n\nA two-way link is declared on BOTH sides, each naming the other as its\n`paired_field_alias`; the pair must be symmetric or the model is refused.\n\n**A single-valued link needs no partner.** `"cardinality": "one"` on its own is a\nlink that holds one row \u2014 one customer on an invoice, one project on a device \u2014\nand nothing is created on the target. The mirror invariant belongs to a PAIRED\nlink: pair a link when the target\'s own record should list what points at it, and\nleave it unpaired when it should not. Either way the record plan draws the\nrelation as a section on the side it points at, so an unpaired link costs the\ntarget nothing.\n\n### `files`\n\nNo keys beyond every field\'s; a row attaches documents to it (\xA7 Rows). Each file\nis drawn by its kind, with no key to choose: a picture (an image, a video) as its\nthumbnail, a document (a PDF, a sheet) as its type\'s badge and its filename.\n\n### `formula`\n\n<!-- generated:start field-formula -->\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `formula` | [Formula](#formula) | yes | Formula config. The expression references other fields on the SAME entity by alias in braces, e.g. `{quantity} * {unit_price}`. |\n\n#### Formula\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `expression` | text | yes | The expression, over fields of THIS entity by alias in braces \u2014 `{quantity} * {unit_price}` |\n| `format` | `"number"` \\| `"currency"` \\| `"percentage"` \\| `"link"` | no | Display format. \'number\' / \'currency\' / \'percentage\' for numeric results; \'link\' for text-output formulas that return a URL \u2014 renders the result as a clickable link. |\n| `currency` | text | no | ISO 4217 currency code, e.g. USD, VND, EUR |\n| `unit` | text | no | What a plain figure counts or measures, drawn after it: a measured code (g, kg, t, l, m3, cbm, mm, cm, m, km, m2, min, h, day), which converts and scales within its dimension, or any other noun of at most 12 characters (ki\u1EC7n, pallet, TEU), which never does. Only beside format "number". |\n| `unit_field` | alias | no | A single select on the same row, or a lookup of one through a one-link, whose chosen option is that row\'s unit: every option label is a unit as `unit` takes one. In place of `unit`; only beside format "number". |\n| `currency_field` | alias | no | A single select on the same row, or a lookup of one through a one-link, whose chosen option is that row\'s currency: every option label is an ISO 4217 code. In place of `currency`; only beside format "currency". |\n| `options` | list of [Select option](#select-option) (at least one) | no | The categories the formula yields, drawn as a single select\'s options are (read-only). The expression yields one of them as `{this_field:option}`, or null \u2014 `{days_idle} > 30 ? {warmth:cold} : {warmth:hot}`. Omit for a formula yielding a plain value. |\n| `output_type` | `"number"` \\| `"text"` \\| `"date"` \\| `"datetime"` \\| `"boolean"` \\| `"select"` | no | What the expression YIELDS \u2014 the kind the platform infers at write time, declared here so the offline checks can read it. `format` beside it is how that result is drawn, not what it is. Ignored on the wire (the platform re-infers it); `lotics model pull` writes the inferred value. |\n\n<!-- generated:end field-formula -->\n\n`output_type` is what lets a role or a screen clause accept a computed value: a\ncaption over a derived name (`output_type: "text"`), a period over a settled date\n(`"date"`). A formula declaring neither it nor a `format` says nothing about its\nresult, and every rule that needs one refuses it by name. A formula stating\n`options` is a computed category: read-only, and read as a single select\nwherever it is drawn \u2014 a column, a filter, a reading\'s `by` or `where`.\n\n**A select reaches a formula as the KEYS of its chosen options**, a list \u2014\nnever their labels, and never their aliases \u2014 and a model has no keys: the\nworkspace mints them when the table is made. So an option is named in a formula\nas `{field:option}`, both aliases, and the copy writes that option\'s key in its\nplace: `includes({kind}, {kind:crate})` for a select holding one or several,\n`{kind}[0] == {kind:crate}` for a single one. A select compared to its own words\n(`{kind} != "Crate"`) matches no row and computes the other branch everywhere,\nso the check refuses it and names the token. A select looked up from another\nentity is tested there, in a formula of its own, and that result looked up.\n\n**The language.** The offline check and the platform compute a formula with one\nengine, and the check refuses a call or a name it cannot run, naming what to write:\n\n<!-- generated:start field-formula-language -->\n\n- Operators: `+ - * / %`, `== != > < >= <=`, `&& || !`; `+` also joins text\n- Conditionals: a ternary only \u2014 `{amount} > 100 ? "High" : "Low"`\n- Not supported: optional chaining (`?.`), nullish coalescing (`??`), template literals, arrow functions \u2014 use `get(obj, "path", default)`, `coalesce(v1, v2)`\n- Helpers are these names, spelled exactly; a spreadsheet function (`IF`, `SUM`, `LEN`, `DATEDIF`) is none of them, and a formula calling one is refused\n- Math: round(n,decimals?), ceil(n), floor(n), abs(n), min(a,b), max(a,b), sum(arr), mean(arr), clamp(n,min,max), percentage(part,total,decimals?), pow(base,exp), sqrt(n), mod(n,divisor)\n- Strings: upper(s), lower(s), trim(s), capitalize(s), length(s), contains(s,search), join(arr,sep), split(s,sep), replace(s,search,rep), replaceAll(s,search,rep), startsWith(s,prefix), endsWith(s,suffix), substring(s,start,end?), padStart(s,len,char), padEnd(s,len,char), numberToWords(n)\n- Lists: includes(list,value), first(list), last(list), unique(list), compact(list) \u2014 length(list) counts one\n- Dates: now(), formatDate(d,fmt), addDays(d,n), subDays(d,n), addHours(d,n), subHours(d,n), addMinutes(d,n), subMinutes(d,n), startOfDay(d), endOfDay(d), differenceInCalendarDays(later,earlier), differenceInHours(later,earlier), differenceInMinutes(later,earlier), isBefore(d1,d2), isAfter(d1,d2), isSameDay(d1,d2), isToday(d), isWithinRange(d,start,end), parseDate(d)\n- Null/type: isNull(v), isEmpty(v) (also true for "" and []), coalesce(v1,v2,...), isString(v), isNumber(v), isBoolean(v), isArray(v), toNumber(v), toString(v)\n- Other: formatCurrency(amount,locale,currency), formatDecimal(value,decimals,locale) (grouped quantity, no symbol), get(obj,"path",default?)\n- Empty cells: a cell nobody filled is null inside a formula, whatever its type; one holding 0, false or "0" is not empty. Test it with `isEmpty({note})` \u2014 `{note} == ""` and `{done} == false` are false on an unset cell\n- Arithmetic over an empty cell: `+` and `-` read it as 0 beside a value (`{fee} + {surcharge}` is `{fee}` when the surcharge is empty, null when both are); `*`, `/`, `%` and a unary `-` yield null (`{price} * {qty}` is null, not 0, when the quantity is empty)\n- No helper throws on an empty cell: the math helpers and toNumber return null, the string helpers "". A value of the wrong type still errors. When EVERY field a formula reads is empty it is null \u2014 unless it reads each only as the argument of isEmpty, isNull or isNotNull (`!isEmpty({file})` is false there, not null)\n\n<!-- generated:end field-formula-language -->\n\n### `rollup`\n\nAggregates the records reached through a link on this entity.\n\n<!-- generated:start field-rollup -->\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `source_field_alias` | alias | yes | Alias of a select_record_link field on this entity to roll up from |\n| `aggregate_option` | [aggregation](#rollup) | yes | Aggregation operation. Its `field_key` names a field alias on the linked entity. |\n| `filter` | [filter](#views) group | no | Only linked records matching this filter are aggregated; one condition on its own is a group of one. Every `field_key` in it names a field alias on the linked entity, and a select condition\'s value names an option alias there. A traversal node reaches past that entity, so its `path` hops and inner `field_key` are fully-qualified `entity.field` aliases. |\n\n<!-- generated:end field-rollup -->\n\n`aggregate_option` is `{ "operation": \u2026, "field_key": \u2026 }` \u2014 `field_key` a field\nalias on the linked entity (`count` may omit it), and `operation` one of `count`,\n`sum`, `avg`, `median`, `min`, `max`, `range`, `empty`, `filled`,\n`percent_empty`, `percent_filled`, `unique`, `percent_unique`, `earliest`,\n`latest`, `date_range`, `checked`, `unchecked`, `percent_checked`,\n`percent_unchecked`. The operation must be one the aggregated field\'s type\nallows \u2014 `sum` over a number, `earliest` over a date, `filled` over any stored or\nformula field. A lookup is never rolled up: roll up the child\'s own field, or a formula\nover it.\n\n### `lookup`\n\nDisplays a field from the linked records.\n\n<!-- generated:start field-lookup -->\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `source_field_alias` | alias | yes | Alias of a select_record_link field on this entity to look up through |\n| `lookup_field_alias` | alias | yes | Alias of the field on the linked entity to display |\n| `order_by` | [Lookup order](#lookup-order) | no | Show ONE linked row\'s value \u2014 the first in this order \u2014 rather than every linked row\'s |\n\n#### Lookup order\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `field_key` | text | yes | A field alias on the linked entity the rows are ordered by |\n| `direction` | `"asc"` \\| `"desc"` | yes | Which end of that order the one row is taken from |\n\n<!-- generated:end field-lookup -->\n\nInside a formula, a lookup holding one value is that value (`{due_soon}` is\n`true`, not `[true]`); several values are a list.\n\n### `autonumber`\n\n<!-- generated:start field-autonumber -->\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `prefix` | text | no | Literal prefix prepended to every display value (e.g. \'KH-\' \u2192 \'KH-001\'). Ignored when `template` is set. |\n| `padding` | integer | no | Zero-pad the integer to this width. Default 1 (no padding). 3 \u2192 \'001\', \'012\', \'123\', \'1234\' (overflow uses the actual width). Ignored when `template` is set. |\n| `template` | text | no | Format template with placeholder tokens evaluated at insert time. Tokens: {N} (raw integer), {N:W} (zero-padded to width W, e.g. {N:3} \u2192 001), {YEAR} (4-digit year), {YEAR:2} (2-digit year), {MONTH} (2-digit month), {DAY} (2-digit day). Date tokens use the workspace timezone. Example: \'HM-{YEAR}-{N:3}\' yields \'HM-2026-001\'. Stored as the composed string; subsequent template edits do NOT re-format existing rows (date tokens would lose the original creation date). |\n\n<!-- generated:end field-autonumber -->\n\n<!-- generated:start rules-field -->\n\n#### Rules the check enforces\n\n| Rule | |\n|---|---|\n| `field.default` | A default names options its select declares \u2014 one on a single select \u2014 and a date stamped by `derive_from` states none. |\n| `field.option-mark` | An option\'s `mark` is one the kit draws, and a select\'s options mark every one or none. |\n| `field.unit-select` | A `unit_field` or `currency_field` is a single select of the same row, or a lookup of one through a one-link, whose every option label is a unit, or an ISO 4217 code. |\n| `field.link` | A link targets a declared entity: its `display_field_alias` a field of it, its `paired_field_alias` a link on it naming this one back \u2014 and of two paired links at most one reads one row. |\n| `field.formula` | A formula parses, reads fields of its own entity by alias, names an option as `{field:option}` of one a select declares, and compares a select to its options\' keys, never their words. |\n| `field.rollup` | A rollup aggregates, through a link of its entity, a field of the linked entity by an operation a model declares and that field\'s type takes \u2014 never a figure read in each row\'s own unit or currency \u2014 filtered on fields of the linked entity. |\n| `field.lookup` | A lookup reads, through a link of its entity, a field of the linked entity \u2014 never one read in each row\'s own unit or currency \u2014 ordered by a field of it. |\n| `field.computed-cycle` | Computed fields never wait on each other in a loop: each is computed after what it reads. |\n\n<!-- generated:end rules-field -->\n\n## Views\n\nSaved views live under the entity they belong to. Every field reference is a\nfield ALIAS on that entity.\n\n<!-- generated:start views -->\n\n#### View\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `alias` | alias | yes | Stable view alias, unique within the entity |\n| `label` | text | yes | Display name of the view |\n| `description` | text | no | The view\'s description, written onto the view in the workspace |\n| `columns` | list of [View column](#view-column) (at least one) | no | The columns the view shows, in this order and no others; absent, every field |\n| `filters` | [filter](#views) | no | The rows the view keeps |\n| `sort` | [sort](#views) | no | The order the view reads its rows in |\n| `summary` | map of text \u2192 text | no | Field alias \u2192 the operation its footer cell states |\n| `frozen_columns` | integer \\| `null` | no | How many leading columns stay in place while the rest scroll |\n\n#### View column\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `field_alias` | alias | yes | A field of this entity |\n| `visibility` | `"visible"` \\| `"hidden"` | yes | Field visibility state: \'visible\' = shown to everyone, \'hidden\' = not shown by default but members can toggle |\n| `width` | number | no | The column\'s width, in pixels |\n\n<!-- generated:end views -->\n\nA filter is a group \u2014 `{ "node_type": "group", "logic": "and" | "or",\n"children": [ \u2026 ] }` \u2014 or one condition on its own, `{ "node_type":\n"condition", "type": "select", "field_key": "tier", "operator": "has_any_of",\n"value": ["gold"] }`. A sort is a list of `{ "field_key": \u2026, "order": "asc" |\n"desc" | null }`. A condition\'s `type` is the field\'s type and its `operator` is\none that type admits \u2014 `has_any_of` / `has_none_of` / `has_all_of` / `is_empty` /\n`is_not_empty` for a select, `equals` / `greater_than` / `less_than` for a\nnumber, `on` / `before` / `after` / `between` for a date, `contains` /\n`is_any_of` for text. A select condition\'s `value` names option ALIASES.\n\n<!-- generated:start rules-view -->\n\n#### Rules the check enforces\n\n| Rule | |\n|---|---|\n| `view.fields` | A view\'s columns, summary, sort and filters name fields of its entity. |\n\n<!-- generated:end rules-view -->\n\n## Roles\n\nA role becomes a workspace group.\n\n<!-- generated:start roles -->\n\n#### Role\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `alias` | alias | yes | Stable role alias, bound to a workspace group when the model is applied |\n| `label` | text | yes | The group\'s name in the workspace |\n\n<!-- generated:end roles -->\n\n## Templates\n\nAn `html` or `email` template carries its content inline, and `{{name}}` in it is filled\nfrom the workflow\'s data; an `excel` template names an uploaded workbook by its `file_id`,\nfilled with the register\'s report by its `export` alone.\n\n<!-- generated:start templates -->\n\n#### Template\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `type` | `"html"` \\| `"email"` \\| `"excel"` | yes | html is a page a workflow renders to a PDF; email is a message a workflow sends; excel is a workbook a register\'s export fills |\n| `alias` | alias | yes | Stable template alias, unique within the contract |\n| `label` | text | yes | The template\'s name in the workspace |\n\n<!-- generated:end templates -->\n\n### `html` and `email`\n\n<!-- generated:start template-inline -->\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `content` | text | yes | Inline template content; placeholders reference field aliases |\n| `content_sha256` | text | no | sha256 (64-char lowercase hex) of the utf-8 content; derived where the template is written when absent |\n\n<!-- generated:end template-inline -->\n\n### `excel`\n\n<!-- generated:start template-excel -->\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `file_id` | text | yes | The uploaded .xlsx (`fil_\u2026`) the template is made from; its markers read what the export fills it with |\n\n<!-- generated:end template-excel -->\n\nA paper that has to look like a counterparty produced it \u2014 an official letter,\nan acceptance minute, a supplier\'s bill \u2014 is the same `html` template with a\nshell around the body: a letterhead, a reference line, a seal and a signature\nblock, and paper grain over everything. One shell, many bodies; the data is the\nonly thing that changes, so a workflow can re-issue it over any record.\n\n```jsonc\n{ "alias": "cong_van", "label": "C\xF4ng v\u0103n", "type": "html",\n "content": "\u2026the page below, as one JSON string\u2026" }\n```\n\n```html\n<style>\n .sheet{position:relative;width:718px;padding:44px 58px 30px;background:#fbfaf6;color:#111;font:14.2px/1.5 \'Liberation Serif\',serif}\n .grain{position:absolute;inset:0;opacity:.34;mix-blend-mode:multiply;background:url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\' width=\'140\' height=\'140\'><filter id=\'f\'><feTurbulence baseFrequency=\'.9\' numOctaves=\'2\'/><feColorMatrix values=\'0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .35 0\'/></filter><rect width=\'140\' height=\'140\' filter=\'url(%23f)\'/></svg>")}\n .top{display:flex;text-align:center;font-size:13.4px} .top>div{flex:1} .u{display:inline-block;border-bottom:1px solid #111;font-weight:700}\n .ref{display:flex;text-align:center;font-size:13.4px;margin-top:6px} .ref>div{flex:1} .ref .r{font-style:italic}\n h1{text-align:center;font-size:15.6px;margin:26px 0 18px} p{text-align:justify;text-indent:26px;margin:0 0 9px}\n .sig{display:flex;margin-top:20px} .sig .l{flex:1} .sig .r{width:290px;text-align:center;position:relative}\n .sig .nm{font-weight:700;margin-top:96px} .seal{position:absolute;left:4px;top:8px;width:166px;height:166px;opacity:.66;mix-blend-mode:multiply;transform:rotate(-17deg)}\n </style>\n <div class=\'sheet\'><div class=\'grain\'></div>\n <div class=\'top\'><div><b>{{issuer_parent}}</b><br><span class=\'u\'>{{issuer}}</span></div>\n <div><b>C\u1ED8NG H\xD2A X\xC3 H\u1ED8I CH\u1EE6 NGH\u0128A VI\u1EC6T NAM</b><br><span class=\'u\'>\u0110\u1ED9c l\u1EADp - T\u1EF1 do - H\u1EA1nh ph\xFAc</span></div></div>\n <div class=\'ref\'><div>S\u1ED1: {{number}}</div><div class=\'r\'>{{place}}, ng\xE0y {{day}} th\xE1ng {{month}} n\u0103m {{year}}</div></div>\n <h1>{{title}}</h1>\n <p>K\xEDnh g\u1EEDi: {{recipient}}.</p>\n {{{body}}}\n <div class=\'sig\'><div class=\'l\'><b>N\u01A1i nh\u1EADn:</b><br>- Nh\u01B0 tr\xEAn;<br>- L\u01B0u VT.</div>\n <div class=\'r\'><img class=\'seal\' src=\'{{seal_url}}\'><b>{{signer_title}}</b><div class=\'nm\'>{{signer}}</div></div></div>\n </div>\n```\n\n**What an act\'s template is handed** is its record\'s own fields by alias: a\nselect, a member and a link as their words (a link as the linked row\'s title), a\nnumber, a date and a computed value that declares its kind raw (`2800000`,\n`2026-09-14`) \u2014 never a files field or a computed select. On one record it is\nhanded, too, the rows of each child the record draws as `rows` whose alias the\ntemplate names, listed under that alias for `{{#each <alias>}}` in place of the\nrecord\'s own link to them: every row filed under the record, oldest first, each\nby its own fields as the record\'s are, less its link back to the record. Over\nseveral rows the rows are listed under the entity\'s alias, for\n`{{#each <alias>}}`, without their child rows.\n\n## Rows\n\nFirst records, keyed by entity alias. Up to 200 rows per entity and 2000 across\nthe model, attaching at most 2000 documents between them \u2014 a real data set\nbelongs in an import, not a model.\n\n```jsonc\n"rows": {\n "customer": [\n { "ref": "acme", "fields": { "name": "Acme Trading", "tier": "gold" } }\n ]\n}\n```\n\n<!-- generated:start rows -->\n\n#### Row\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `ref` | text | yes | Local handle for this row, referenced by other rows\' link fields |\n| `fields` | map of text \u2192 any value | yes | Field alias \u2192 the value, read against the field\'s declared type |\n\n<!-- generated:end rows -->\n\n<!-- generated:start rules-rows -->\n\n#### Rules the check enforces\n\n| Rule | |\n|---|---|\n| `rows.ref` | A row\'s `ref` is unique within its entity. |\n| `rows.required` | A row states every field its entity requires: it is created with what it states, its fields\' defaults unapplied. |\n| `rows.distinct` | Open rows of an entity a register lists read apart: no two state the same title and the same line under it. |\n| `rows.value` | A row\'s value fits its field: an option alias for a select, `"<entity>:<ref>"` of a row of the linked entity in this file for a link, `"self"` for a member, a relative path beside the file or a `fil_` id for files, a date in the date grammar (an hour only on a datetime), a text, number, yes/no or null otherwise \u2014 and none on a computed field. |\n\n<!-- generated:end rules-rows -->\n\nA `ref` is lowercase letters, digits and underscores, and is never persisted.\n\nA `files` cell attaches documents: paths relative to this file (no `..`, never\nabsolute), which the check proves exist and `apply` uploads into the workspace\nbefore any row is written \u2014 a paperwork business seeds its papers with its\nrows. The server accepts only `fil_` ids of files this workspace owns, which is\nwhat the upload leaves behind. After a run that wrote rows, the WORKSPACE holds\nwhich record each row became, under the row\'s own `<entity>:<ref>`:\n`delete_records` over them is how a seeded set is reset, and applying again\nre-dates it.\n\n`fields` is keyed by field alias, and every value is read against the field\'s\nDECLARED type:\n\n| Field type | Value |\n|---|---|\n| `text` / `number` / `boolean` | the value itself |\n| `date` | `"2026-03-14"`, or a relative expression (below) |\n| `select` | the option ALIAS \u2014 `"gold"`, or `["gold","vip"]` for a multi-select |\n| `select_record_link` | `"<entity-alias>:<ref>"` naming another row in this file \u2014 `"customer:acme"`, or an array for several; a paired link is stated on ONE side (the child\'s link to its parent) and its partner fills itself |\n| `select_member` | `"self"` only \u2014 the person applying the model |\n| `files` | paths beside this file \u2014 `["scans/pccc_letter.png"]` \u2014 uploaded by `model apply`/`setup` before the model is sent; or `fil_` ids of files already in this workspace |\n| `formula`, `rollup`, `lookup`, `autonumber` | not allowed \u2014 the platform writes these |\n\n### Relative dates\n\nA date cell holds a literal `YYYY-MM-DD`, or an expression relative to the day\nthe model is applied, so a screen that opens on "this month" is not empty a month\nlater:\n\n- `@today` \u2014 the day of the run, in the workspace\'s timezone\n- `@month-start` \u2014 the 1st of that month\n- either with a whole-day offset: `@today-14`, `@month-start+9`\n- on a date that holds its hour (`format: "datetime"`), that hour after the day, and always stated:\n `@today 14:30`, `@today+1 06:00`\n\n`@month-start` exists because `@today-N` cannot promise a month: applied on the\n2nd, `@today-3` lands in the previous one.\n\n## Records\n\n`records` says how a row of each entity is RECOGNISED \u2014 once per entity, keyed by\nentity alias \u2014 and every surface that draws one of its rows reads the same\nstatement: the register\'s row, a picker\'s option, a link\'s chip, a child table\'s\nrow and the record\'s header. Every entity an app lists, opens or picks has one.\n\n```jsonc\n"records": {\n "visit": {\n "title": "container_no",\n "subtitle": ["customer", "arrived_on"],\n "image": "photos",\n "status": { "field": "stage", "closed": ["gone"], "history": "visit_history" },\n "figure": "total_fees",\n "due": ["free_until"]\n },\n // A release order read against what it allows: a meter wherever it shows.\n "release": { "title": "release_no", "figure": "issued", "limits": { "issued": "units" } },\n // A dossier\'s stage is the last date it reached \u2014 no stored select.\n "dossier": { "title": "applicant", "status": { "milestones": ["received_on", { "field": "appraised_on", "when": { "kind": ["loan"] } }, "signed_on"], "closed": ["signed_on"] } }\n}\n```\n\n<!-- generated:start records -->\n\n#### Record\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `title` | alias | yes | The field that names a row \u2014 the first thing every surface shows: who or what it is, a link naming it by the linked row (a job read by its customer). An autonumber is refused; a typed number is the subtitle |\n| `subtitle` | list of alias (1\u20132) | no | Up to two fields read under the title wherever a row is drawn (a code, a date, a party) |\n| `image` | alias | no | A files field that pictures the row \u2014 never one an act keeps the document it makes in |\n| `description` | alias | no | A text field saying what the row is about \u2014 a plan\'s brief, a customer\'s note: read in its record\'s head under the title\'s line, its first lines at rest and whole on a press, and written from the head\'s \u270E. Never on a row\'s line |\n| `party` | `"person"` \\| `"organization"` | no | What each row is where the rows are people (a contact, a patient) or organisations (a customer, a supplier, a carrier); absent, the rows are things (an order, an item, a paper) |\n| `status` | [Status](#status) | no | The stage a row moves through \u2014 a single select or its milestone dates \u2014 drawn as a badge beside its title |\n| `figure` | alias | no | The one number the row stands for, read at its right (a total, a quantity left) |\n| `limits` | map of alias \u2192 (alias \\| number) | no | A number read against a bound \u2014 a field of the same row or a constant \u2014 drawn as a meter wherever it shows |\n| `gates` | map of alias \u2192 (alias \\| number) | no | A pass mark on a meter `limits` bounds \u2014 a field of the same row or a constant; a percent field is its share of the bound, any other number an amount. The meter marks it and fills complete once past it |\n| `tolerance` | map of alias \u2192 number | no | How far past its `limits` bound a meter may stand, in percent of the bound: the bound is an amount expected (received against ordered), not a cap. Without one the bound is a cap, and past it is an overrun |\n| `due` | list of alias (at least one) | no | Dates that are deadlines (stored, or computed as a date): each counts down and turns overdue |\n| `frees` | alias | no | A date ending the row\'s span of days on which what the row holds is free again (a check-out, a hire\'s return): a stay from the 3rd to the 5th holds the 3rd and the 4th, and another may start on the 5th \u2014 on a lanes board, a calendar, a roster and in `no_overlap` alike. Absent, a span of days holds its last day; a span of moments always frees its end |\n| `task` | `true` | no | A row is work someone finishes: wherever rows of it stand in a table \u2014 a register, a record\'s rows, the rows filed under one \u2014 each is led by a ring ticking it done and unticking it by the one write of the app making that move. Its status is a stored select with `closed` |\n| `starts` | map of alias \u2192 `"today"` \\| `"me"` | no | What a field of a row being added starts at, where that start is certain: `today` a date (a moment starts now), `me` a member, the reader adding it; every other field starts empty unless the reader narrowed the register to a value or the field declares a `default` |\n\n#### Status\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `field` | alias | no | The single select that is the row\'s state \u2014 or `milestones` instead |\n| `milestones` | list of (alias \\| [Milestone](#milestone)) (at least 2) | no | Dates in the order the work reaches them, instead of a stored select: the stage is the last one filled, ticking one stamps today, and clearing one clears every later one |\n| `closed` | list of alias (at least one) | no | Options (or milestones) that end the work: a register opens on the rows not at them, and the badge reads muted |\n| `history` | alias | no | A child entity every status change appends one row to (its link to this entity, the new status, the moment and who) \u2014 written by the app\'s own writes, never a table automation; a row the model seeds opens it at its status, the day the rows land, unless the model states its rows; with `field` only |\n\n#### Milestone\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `field` | alias | yes | A date field: the stage is reached on the day it holds |\n| `when` | map of alias \u2192 (list of alias (at least one) \\| boolean) | yes | The stage applies only while each named select holds one of these options, and each named stored yes/no is this value; otherwise the row skips it |\n\n<!-- generated:end records -->\n\n<!-- generated:start rules-records -->\n\n#### Rules the check enforces\n\n| Rule | |\n|---|---|\n| `records.title` | A title names the row by what it is \u2014 never an autonumber; a code is its subtitle. |\n| `records.image` | `image` is a files field, never one an act keeps the documents it makes in (`into`). |\n| `records.description` | `description` is a text field, read in the record\'s head \u2014 never a section\'s too. |\n| `records.status` | A status is one single select, `closed` naming options of it \u2014 or its `milestones`. |\n| `records.history` | A declared status `history` has exactly one link to the row it records, one single select holding every option of the status (or a text), exactly one date and at most one member. |\n| `records.history-derived` | A `history` the model does not declare is derived and keeps one entity\'s moves, labelled by that entity ("L\u1ECBch s\u1EED <entity label>", or "<entity label> history"): no declared table holds that label, and the entity has no other field under the link it adds. |\n| `records.history-scope` | A status history reads by its record\'s `read_scope`, answered through its one-row link to the record within the links a row rule reaches \u2014 or it states its own. |\n| `records.milestones` | Milestones are dates a person ticks, each named once; `closed` names some of them, and a deadline (`due`) is never one. |\n| `records.milestone-add` | An add asks the first milestone at most \u2014 each after it is ticked in order. |\n| `records.figure` | A figure is a number. |\n| `records.limits` | `limits` bounds a number by a number field of the row, in its unit or one of the same dimension \u2014 or by a constant, where every row reads the figure in one unit. |\n| `records.gates` | `gates` marks a pass on a meter `limits` bounds: a percent field (its share of the bound), another number in the bound\'s unit, or a constant. |\n| `records.tolerance` | `tolerance` stands on a meter `limits` bounds. |\n| `records.starts` | `starts` starts a field a person writes \u2014 `today` a date or a moment (never a span), `me` a member \u2014 and an add that does not ask a field it starts writes that start. |\n| `records.due` | A deadline (`due`) is a date. |\n| `records.frees` | `frees` names a stored day, never a moment: a span of moments already frees its end. |\n| `records.task` | A task entity (`task`) states a `status` of a stored single select with `closed` options \u2014 its ring ticks a row done by moving it to one. |\n\n<!-- generated:end rules-records -->\n\n- **The title names the row** by who or what it is \u2014 a link by the linked row (a job\n read by its customer). An autonumber is refused as a title; a typed number is the\n subtitle.\n- **The status** is one single select. `closed` options end the work: a register opens\n on the rows not in them. A `history` entity gets one row per move \u2014 its link to this\n entity, the new status (a select holding the same option aliases, or text), the\n moment and who \u2014 appended by the app\'s own writes that move the status, never by a\n table automation. A `history` the model does not declare is derived, and needs no\n `records` entry of its own.\n- **Milestones** are the alternative to a stored select: dates in the order the work\n reaches them, the stage being the last one filled (never stored). A milestone with a\n `when` applies only while its select holds those options and its stored yes/no that\n value; otherwise the row skips it.\n The record draws them as one block where ticking stamps today and clearing one clears\n every later one; every save and act re-checks that a date comes after each earlier one\n that applies. `closed` names the milestones that end the work. A register\'s add may ask\n the first milestone, never a later one; an act may stamp one, never clear it.\n- **A limit** reads a number against a bound \u2014 another field of the row, or a constant.\n A `gates` entry marks a pass on that meter: a percent field is its share of the\n bound, any other number an amount.\n- **A deadline** (`due`) counts down wherever it is drawn and is overdue once past while\n the work is open. A register over the entity says how many rows in view are overdue on\n its summary line, and pressing that count narrows to them \u2014 no reading to state.\n- **A span\'s free day** (`frees`) is the end date on which what the row held is free\n again \u2014 a check-out, a hire\'s return. A stay from the 3rd to the 5th holds two nights:\n a lanes board, a calendar and a roster draw it through the 4th, and `no_overlap` lets\n the next stay start on the 5th. Without it a span of days holds its last day; a span of\n moments always ends as the next may begin.\n- **`starts`** is where an add\'s field begins, stated only where that is certain \u2014 a\n log\'s own day at `today`, a request\'s requester at `me`. Nothing else starts a field\n but its declared `default` and what the reader narrowed the register to.\n\n## Write rules\n\n`write_rules` is what a WRITE meets, keyed by entity alias; each entity\'s is held\nby its table. Every generated write of an\napp (`create_<entity>`, `update_<entity>`, each act) re-checks these on the\nserver; the screen only mirrors them.\n\n```jsonc\n"write_rules": {\n // A customer is RECOGNISED by their address. An add that names one \u2014 from the\n // customers register or from a picker\'s "new" \u2014 reuses the row it matches and\n // opens one only where nothing does, so the book never grows a second Acme.\n "customer": { "natural_key": ["email"] },\n "order_line": {\n "fields": {\n // A line of nothing is not a line. Refused on create and on update.\n "quantity": { "min": 1, "max": 9999 },\n // Shipped inside its order\'s window: a bound read off the row a link names\n // is held from both sides \u2014 moving the order\'s dates never strands a line.\n "ships_on": { "min": "order.placed_on", "max": "order.due_on" },\n // The price is fixed at the moment of ordering \u2014 COPIED off the product,\n // not looked up for ever after.\n "unit_price": { "default_from": "product.price" },\n // Nothing is sold off an empty shelf. The picker reads only the rows that\n // answer this, and the write refuses the same rows again.\n "product": {\n "options_where": {\n "node_type": "group", "logic": "and",\n "children": [{ "node_type": "condition", "type": "number",\n "field_key": "in_stock", "operator": "greater_than", "value": 0 }]\n }\n }\n }\n },\n // One booking per room at a time, while it is held: a create or a save whose\n // span overlaps another held booking of the same room is refused.\n "booking": {\n "fields": { "ends_on": { "min": "starts_on" } },\n "no_overlap": { "from": "starts_on", "to": "ends_on", "by": ["room"], "while": { "state": ["held"] } }\n }\n}\n```\n\n<!-- generated:start write-rules -->\n\n#### Entity write rules\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `natural_key` | list of alias (at least one) | no | The field aliases a row of this entity is RECOGNISED by. A write that names a row of this entity by these values reuses the row it finds, minting one only where nothing matches. |\n| `fields` | map of alias \u2192 [Field write rule](#field-write-rule) | no | Field alias \u2192 what that field\'s value is copied from, bounded by or picked among |\n| `no_overlap` | [No overlap](#no-overlap) | no | No two rows hold overlapping spans \u2014 a create or update that would is refused |\n\n#### Field write rule\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `default_from` | text | no | Copy this field\'s value from the linked row at CREATE time \u2014 `<link alias>.<field alias>`, the link being a one-row link on this entity, required or filled by the add (the record a row is added under). The value is copied rather than looked up, so the source changing later leaves the row alone. |\n| `min` | number \\| text | no | Refuse a create or update whose value is below this: a constant for a number, or a field \u2014 `<field alias>` of the same row, or `<link alias>.<field alias>` of the one row a link names \u2014 of the same type (a return date after the departure, a line\'s day inside its trip). On a figure whose unit or currency is per row (`unit_field`, `currency_field`) a constant bound is only 0; bound it by a field of the row |\n| `max` | number \\| text | no | Refuse a create or update whose value is above this: a constant for a number, or a field of the same row or of the one row a link names |\n| `options_where` | [filter](#views) | no | Which rows of the target this link may point at \u2014 an `and` group of plain conditions over the TARGET entity\'s own fields, each `field_key` a field alias. It narrows the picker\'s read and is refused again where the write lands. |\n| `same` | list of alias (at least one) | no | One-row links this row and each row this link points at must name alike \u2014 a fee\'s invoice is one of its own visit\'s, a box\'s seal one of its own shipping line\'s: each a one-row link of both entities to the same entity. It narrows the picker\'s read to the rows naming what this row names, and a write is refused wherever it lands \u2014 on the link, or on what the two rows compare. |\n\n#### No overlap\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `from` | alias | yes | The stored date (or datetime) a row\'s span starts on |\n| `to` | alias | yes | The stored date (or datetime) a row\'s span ends on \u2014 a day it holds, unless `records` names it the day the row `frees`; a moment another row may start at |\n| `by` | list of alias (at least one) | no | Fields two rows share to compete for a span (the same employee, the same room); absent, every row |\n| `while` | map of alias \u2192 list of alias (at least one) | no | Only rows at these options of these selects hold their span (running, not closed); absent, every row |\n\n<!-- generated:end write-rules -->\n\n<!-- generated:start rules-write -->\n\n#### Rules the check enforces\n\n| Rule | |\n|---|---|\n| `write.natural-key` | A `natural_key` is text or a number a person types back, or a one-row link; a text key is unique \u2014 `unique: true`, or the key\'s fields as a set in the entity\'s `unique`. |\n| `write.default-from` | `default_from` copies `<link>.<field>` off the row a one-row link names, wherever an add fills that link (asked, or the record it is added under), into a field of the same type: a select into one declaring each of its options by alias, several options only into a multi-select. |\n| `write.bounds` | `min` and `max` bound a number or a date \u2014 by a constant a number, by a field of this row or of the one row a one-row link names either, of the same type and unit, never by itself \u2014 and `min` is never above `max`. |\n| `write.bound-per-row-unit` | On a figure whose unit or currency is the row\'s own (`unit_field`, `currency_field`) a constant bound is only 0 \u2014 bound it by a field of the row. |\n| `write.same` | `same` stands on a link and names one-row links this entity and the link\'s target both hold to one entity. |\n| `write.options-where` | `options_where` narrows a link by an `and` group of plain conditions over the target\'s own fields \u2014 a number compared in one unit on every row, a select by options it declares. |\n| `write.no-overlap` | `no_overlap` spans two date fields; `by` names values rows share \u2014 a link, a person, one option, a text or a number; `while` names single selects by their options. |\n\n<!-- generated:end rules-write -->\n\n- A `natural_key` is `text` or `number`, because a person types it back, or a\n one-row link, because a row is also recognised by the one row it belongs with (a\n fee by its visit and its kind). A key holding a `text` field is unique: `unique:\n true` on that field, or the key\'s fields as a set in the entity\'s `unique` (a\n site by its customer and its name) \u2014 two rows sharing it would make\n find-or-create pick whichever the read answered first. An add asks the key by\n default.\n- A `min` or `max` naming a field is read off the row as the save would leave it,\n and one naming `<link>.<field>` off the row the link names \u2014 the link\'s side\n re-checks its own rows when that bound moves.\n- A `default_from` copies where the add is sure to hold its link\'s row \u2014 a\n required link, or the record the row is added under (an appointment added under a\n plan takes the plan\'s patient) \u2014 and the two field types match. The copied field is\n not asked there; through an optional link the add leaves empty, it is asked.\n- A `same` link names only rows that name what this row names \u2014 a fee\'s invoice\n is one of its own visit\'s \u2014 through a one-row link both entities hold to one\n entity; its picker offers nothing until the row names one. A row added under a\n record names what it copies off it (`default_from`) from the start, so a block\n expecting one line per row of the link lists that record\'s rows alone. A save\n moving what the two compare, on either row, is refused while they would name apart.\n- An `options_where` link may be left empty; a row it names is refused again\n where the write lands unless it holds the narrowing. A link naming one kind of\n a book\'s rows (a "Shipping line" among the parties) narrows to that kind, or\n its picker offers every row.\n\nA field\'s own `required` is not here: the contract carries it, and every write\npath refuses the row by field name from it. `unique` is the text field\'s own\nclause (\xA7 `text`) \u2014 an add says so at the control before the column does. A\nfield the workspace writes (a formula, a rollup, a lookup, an autonumber, a date\nwith `derive_from`) is never asked, written or edited.\n\n## Apps\n\nAn app is ONE register over one entity and the record each row opens \u2014 or a dashboard\nof readings. The author states COMPOSITION \u2014 which fields go where; the runtime owns\nhow each thing looks, one treatment per concept. Nothing is drawn that the app does not\nname, and each fact appears once on a record. What the vocabulary has no word for is an\nact\'s own `workflow`.\n\n```jsonc\n"apps": [{\n "alias": "gate", "name": "Gate in and out", "entity": "visit",\n "register": { "columns": ["service"], "filters": ["customer", "service"] },\n "record": {\n "sections": [\n { "title": "In", "fields": ["customer", "service"], "blocks": [{ "rows": "fee", "columns": ["amount"] }] },\n { "title": "Out", "at": ["in_yard"], "fields": ["release", "seal"], "blocks": [{ "files": ["photos"] }], "acts": ["gate_out"] }\n ]\n },\n "acts": [{ "alias": "gate_out", "label": "Gate out", "when": { "stage": ["in_yard"] },\n "requires": ["release", "seal"], "set": { "stage": "gone", "left_on": "now" }, "confirm": true }],\n "checks": [{ "field": "unpaid", "blocks": ["gate_out"] }]\n}]\n```\n\n<!-- generated:start apps -->\n\n#### App\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `alias` | alias | yes | The app\'s name within the model \u2014 what `--from model.json#<alias>` picks |\n| `name` | text | yes | The job, in the words of the people who do it |\n| `description` | text | no | What the job is for, in a sentence |\n| `icon` | text | no | A lucide icon name the launcher tile draws |\n| `theme` | [Theme](#theme) | no | The launcher tile\'s colour |\n| `entity` | alias | yes | The entity whose rows this job works \u2014 the register\'s rows |\n| `scope` | alias | no | A required one-row link of the entity: the app works inside one row of the linked entity at a time (a project, a branch), picked from a list of them, and every row it reads, counts and adds is that row\'s |\n| `reads` | `"shared"` | no | Every member reads every row, whatever the entity\'s read scope |\n| `writes` | `"children"` | no | The reader adds and edits the record\'s child rows but not the record\'s own fields; the app\'s acts still move it |\n| `row` | [App row](#app-row) | no | How this job reads the entity\'s rows where it reads them otherwise than `records` (a cashier\'s figure is what is owed): the subtitle, figure and image stated replace the entity\'s wherever this app draws its rows \u2014 the register, a card, the record\'s header, a calendar, lane or roster entry. The title stays the entity\'s |\n| `register` | [Register](#register) | no | The rows: which columns and filters, the order, how a row is added |\n| `record` | [Record page](#record-page) | no | What a row opens: the door, its sections, and beside them its comment thread and its status history where stated |\n| `acts` | list of [Act](#act) | no | What the reader does to a record \u2014 each a press with its conditions and its write |\n| `checks` | list of [Check](#check) | no | Formulas that warn while they stand, or refuse the acts and saves they name |\n\n#### Theme\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `color` | text | yes | The tile\'s colour |\n\n#### App row\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `subtitle` | list of alias (1\u20132) | no | Up to two fields read under the title in this app, in place of the entity\'s |\n| `figure` | alias | no | The one number a row stands for in this app, in place of the entity\'s; a `limits` bound on it reads as its meter |\n| `image` | alias | no | A files field that pictures a row in this app, in place of the entity\'s |\n\n#### Dashboard app\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `alias` | alias | yes | The app\'s name within the model \u2014 what `--from model.json#<alias>` picks |\n| `name` | text | yes | The job, in the words of the people who do it |\n| `description` | text | no | What the job is for, in a sentence |\n| `icon` | text | no | A lucide icon name the launcher tile draws |\n| `theme` | [Theme](#theme) | no | The launcher tile\'s colour |\n| `reads` | `"shared"` | no | Every member reads every row, whatever the entity\'s read scope |\n| `dashboard` | list of ([Metric](#metric) \\| [Breakdown](#breakdown) \\| [Trend](#trend) \\| [Pivot](#pivot) \\| [List](#list)) (at least one) | yes | The readings, in order \u2014 each over every row of its entity, windowed by the one period the reader switches |\n\n<!-- generated:end apps -->\n\n<!-- generated:start rules-app -->\n\n#### Rules the check enforces\n\n| Rule | |\n|---|---|\n| `app.alias-unique` | An app\'s alias is unique among the model\'s apps, and an act\'s among its app\'s acts. |\n| `app.records-entry` | Every entity an app lists, opens or picks \u2014 its own, a block\'s, a linked row\'s, a document\'s \u2014 has a `records` entry. |\n| `app.reads-shared` | `reads: "shared"` stands only where a table the app reads states a `read_scope`. |\n| `app.writes-children` | An app that writes only the record\'s children (`writes: "children"`) adds no row of its own entity. |\n| `app.scope` | `scope` is a required one-row link of the app\'s entity, the same on every row the app lists \u2014 never a column, filter, search field, group, `where`, `opens`, section field or add question. |\n| `app.when` | A `when` holds single selects to options and yes/nos to `true` or `false`, stored or a formula of one \u2014 a milestone\'s `when` only a stored yes/no, read before any formula over it is computed. |\n| `app.asked-written` | What an add, an act or `starts` fills is a field a person writes \u2014 never a formula, rollup, lookup, autonumber or a date the workspace stamps. |\n| `app.own-rows` | A many-link to rows that each belong to one row of this entity is never a section\'s field, an add\'s question or an act\'s ask: those rows are the record\'s own, read as a `rows` block. |\n| `app.create-asks` | An add asks fields of a table people write \u2014 never the link or the folder it files the row under, which the add sets itself. |\n| `app.create-required` | An add (`create`) asks every field its entity requires that nothing else fills \u2014 a `default`, `starts`, the record or folder it files the row under, or a `default_from` over a link it fills \u2014 or the server refuses every add. |\n| `app.row` | An app\'s `row` states only what differs from `records`: a line that is not the title, a number for its figure, a files picture no act makes documents into. |\n| `app.files-shown` | Every files field is drawn by some app over its entity \u2014 a section\'s `fields`, a `files` block, a column, the `image`, or where an act making papers into it stands: the field an act keeps its document in (`into`) is placed where the paper reads. |\n| `app.document-image` | *Noted, never refused:* A linked entity holding one files field and no `image`: `image` lets a link preview its paper. |\n| `app.tasks` | *Noted, never refused:* A task entity an app lists whose rows no write of the app moves to a closed option (its ring stands disabled), or that an act ticks done and none moves back. |\n\n<!-- generated:end rules-app -->\n\n`writes: "children"` is a desk that adds and edits a record\'s child rows and never\nthe record itself. `reads: "shared"` lifts every read scope the app\'s tables state \u2014\nrefused where none of them states one.\n\n`scope` names a required one-row link of the entity: the app works inside ONE row of\nthe linked entity at a time \u2014 a project, a branch, a season. With no folder remembered\nit opens on the list of them, each with how many of the app\'s rows it holds; inside,\nevery read, count and reading narrows to that one, an add files its row under it (the\nlink is never asked), and the record states its folder in the header. A scope narrows\nthe view; who may read what stays the entity\'s `read_scope`. The folder link is never a\ncolumn, a filter, a search field, a fact or an add\'s question.\n\nA dashboard is `{ "alias", "name", "dashboard": [readings] }` with no entity, register\nor record: each reading reads every row of its entity, and one period the reader\nswitches (this month \xB7 30 days \xB7 this quarter \xB7 this year) windows each reading placed\nin time; one placed in no time reads the rows as they stand now, and its head says so.\nA `list` reading lists rows, each opening in its `app`. The readings answer the one\nquestion the dashboard\'s owner asks, in the order they ask it \u2014 rows to act on lead where\nthe answer is rows; no order of kinds is the rule.\n\n```jsonc\n// The depot owner\'s morning question: which boxes are past their free days, whose are they, is it growing?\n{ "alias": "overview", "name": "Depot overview", "dashboard": [\n { "list": "visit", "where": { "overdue": true }, "columns": ["line"], "app": "gate", "label": "Past free days" },\n { "breakdown": "visit", "by": "line", "where": { "overdue": true }, "label": "Past free days by line" },\n { "trend": "visit", "over": "arrived_on", "where": { "overdue": true }, "label": "Past free days, by arrival" }\n] }\n```\n\n### Register\n\n```jsonc\n"register": { "columns": ["service", "release"], "filters": ["customer", "service"], "create": ["container_no", "customer"] }\n```\n\n<!-- generated:start apps-register -->\n\n#### Register\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `columns` | list of alias | no | Fields read as columns after the row\'s title \u2014 on a calendar\'s entry or a lane\'s block, its facts after its title; never what the row draws itself (its subtitle, image, status, figure, or the bound its figure\'s meter reads against), which the runtime places |\n| `filters` | list of (alias \\| [Tiered filter](#tiered-filter)) (at most 3) | no | The fields the reader narrows the rows by every day, in that order \u2014 each earns its place by that daily use, so none to 3 is normal and 3 is a cap, never a quota (a select, a member, a link, a date, a yes/no, a number as a range, or its `tiers` where the business narrows by those bands daily) \u2014 each on a desk\'s line, in one Filters sheet on a phone. Never the status (its chips); each a field the rows show \u2014 a column, or a part of the row. A press on a breakdown\'s part or a pivot\'s cell in the band narrows by its field too. A threshold the business names ("large orders") is a formula yes/no here; a column\'s header sorts by a day or an amount |\n| `search` | list of alias (at least one) | no | The fields the search box matches (a link by its row\'s title); a pasted list searches each line and names the lines no row matched. Absent, every word of the row |\n| `group` | alias | no | The field the rows open grouped by, the reader\'s grouping starting there \u2014 a period\'s rows read under each period, one per person; absent, ungrouped |\n| `sort` | [Register order](#register-order) | no | The order rows open in; absent, the first deadline soonest first, else the newest first |\n| `layout` | `"table"` \\| `"cards"` \\| `"calendar"` \\| `"roster"` \\| `"lanes"` | no | `cards` for rows read by their picture; `calendar` for rows read by their day \u2014 a month, a week, a day or a list, an entry at its hour where its date holds one and over its span where its line holds a second date; `roster` for what each row did on each day of a week or a month (who worked which shift, which vehicle ran), or with `expect` which of a set each row holds; `lanes` for rows booked on a resource over time (an appointment in its chair, a hire on its machine); absent, a table |\n| `roster` | alias | no | With `layout: "roster"`: the entity whose rows fill the days \u2014 one single link to this entity, and a date on its row line (`records` title or subtitle). A cell reads its row\'s status, else the first single select on its line, several rows a mark each, the cell read by the one latest in that select\'s options; a row whose line holds a second date after the first fills every day to it; a day with none stays empty, never an absence |\n| `expect` | alias | no | With `roster`: a single select of the roster\'s rows whose options are the columns in place of days \u2014 each cell the row holding that option, read by its status, an empty one added there (a checklist of papers per case); the roster then has no period |\n| `of` | alias | no | With `expect`: this entity\'s own multi-select holding the options each row expects \u2014 its other columns stand blank on that row, never added. Its options are among `expect`\'s |\n| `lanes` | alias | no | With `layout: "lanes"`: a one-link of this entity whose target\'s rows are the lanes (a chair, a machine, a room), each drawn even when empty. A row is a block from the first date on its line to the second \u2014 within one day by the hour where the first holds one, else by the day over one day, a week or a month; a free stretch between blocks adds a row there, its lane, its start and the end the stretch reaches filled |\n| `loads` | map of alias \u2192 alias | no | With `lanes`: what a lane carries against what it holds, at most 2 \u2014 a number of this entity each block adds (a weight) to a number of the lane\'s row it is held within (a payload), in one unit or two of one dimension. Each lane reads the most its blocks add up to at one time in the window \u2014 a day\'s rows together \u2014 and names by how much and when a lane runs over |\n| `where` | map of alias \u2192 (list of alias (at least one) \\| boolean) | no | Only the rows whose select holds one of these options and whose yes/no (stored, or a formula) is this value \u2014 read so on the server and never offered as a chip: the rows this app works of an entity other apps read whole (the purchases, of orders both ways). A row added here holds a select\'s one option and a stored yes/no\'s value |\n| `opens` | map of alias \u2192 (list of alias (at least one) \\| boolean \\| `"me"`) | no | The view the register opens on: each entry a narrowing on a field the rows show that stands as a chip the reader may take away (the rows still owed), `"me"` a member field holding the reader (the rows mine). One on the status replaces the chips\' opening on the open work |\n| `create` | list of alias (at least one) \\| `false` | no | The fields asked when a row is added; absent, the title, the subtitle and figure no default fills, the natural key and every required field \u2014 each a person writes; false, rows are not added here |\n| `export` | `true` \\| list of [Register report](#register-report) (at least one) | no | The rows in view saved as the register\'s report \u2014 its title, a line per thing narrowing the rows, the readings and every row: `true`, one workbook of the register\'s columns; a list, the reports a reader picks from one export menu |\n| `readings` | list of ([Metric](#metric) \\| [Breakdown](#breakdown) \\| [Trend](#trend) \\| [Pivot](#pivot)) (at least one) | no | Readings of the register\'s own entity above its rows, over the rows in view \u2014 the search, the status and the filters narrow them |\n\n#### Tiered filter\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `field` | alias | yes | A number \u2014 stored, or a formula or rollup reading one \u2014 in one unit for every row |\n| `tiers` | list of number (at least one) | yes | The breakpoints between its bands, ascending, in the field\'s stored unit: under the first, from each to the next, from the last up \u2014 each band worded by the field\'s own format, several picked at once |\n\n#### Register order\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `field` | alias | yes | The field rows are ordered by |\n| `desc` | `true` | no | Latest or largest first; absent, soonest or smallest first |\n\n#### Register report\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `label` | text | yes | The report\'s name, in the reader\'s words \u2014 its entry in the export menu and its file\'s title |\n| `description` | text | no | What the report holds, under its name in the menu |\n| `template` | alias | no | A template filled with the report \u2014 `title`, `lines`, `readings`, and every row in view (at most 20,000) under the entity\'s alias: an html one made a PDF, an excel one a workbook; absent, the workbook of the register\'s columns |\n| `where` | map of alias \u2192 (list of alias (at least one) \\| boolean \\| `"me"`) | no | The rows the report is of, set on the register as the chips they are before its file is made \u2014 the screen shows what the file holds |\n| `per` | alias | no | A select, a member or a one-link the reader picks one value of from the menu \u2014 the rows narrowed to it, as its chip, and one file of that value |\n\n<!-- generated:end apps-register -->\n\n<!-- generated:start rules-register -->\n\n#### Rules the check enforces\n\n| Rule | |\n|---|---|\n| `register.export-report` | A register\'s reports each have their own label; `per` picks one option, person or one-link row \u2014 never of the status, the folder or a field its `where` fixes. |\n| `register.export-template` | A template an export fills reads at its root only `title`, `lines`, `readings` and its rows under the register entity\'s alias \u2014 an entity named none of those three \u2014 and is the document of no act. |\n| `register.column-drawn` | A column never names what the row draws itself \u2014 its title, subtitle, image, status, figure, or the bound its figure\'s meter reads against \u2014 and names a field once. |\n| `register.filter` | A filter names a select, a member, a link, a date, a yes/no or a number of the register\'s own rows \u2014 a lookup through one-row links as the field it reads \u2014 never the status (its chips), nor one `where` fixes. |\n| `register.filter-split` | *Noted, never refused:* A filter on a field a breakdown or pivot in the band splits the rows by \u2014 a press on its part narrows by it too; a member\'s filter, which narrows to the reader\'s own rows, is never noted. |\n| `register.filter-unshown` | A filter, and a narrowing the register `opens` on, names a field its rows show \u2014 a column; the row\'s title, the line under it, its picture, status or figure, or a meter\'s bound; a deadline; a warning its line says; the group or lane it stands under. |\n| `register.tiers` | `tiers` band a number read in one unit on every row; a figure read in each row\'s own unit or currency is named bare. |\n| `register.search` | `search` names text, a code, or a link \u2014 matched by its row\'s title. |\n| `register.group` | `group` names one value per row \u2014 a single select, a one-row link, one member, a date, a yes/no or a text, a lookup through one-row links as the field it reads \u2014 never the status (its chips); only a table groups, and grouping by the title needs a subtitle to lead each row. |\n| `register.readings-own` | A register\'s `readings` read its own entity; another entity\'s stand on a dashboard. |\n| `register.readings-restate` | A register\'s metric never sums the row\'s figure or counts the rows without a `where`: the summary line totals the figure and the status chips count the rows. |\n| `register.where-opens` | `where` and `opens` hold the register\'s own selects and yes/nos, and `opens` a member field holding the reader (`"me"`); a field `where` fixes is never a filter nor opened otherwise, and `opens` stays among the options `where` keeps. |\n| `register.roster` | `layout: "roster"` and `roster` go together: the roster\'s entity has one single link to this one and a date on its line, a roster draws no `columns`, `expect` needs `roster` and `of` needs `expect`. |\n| `register.roster-expect` | A roster\'s `expect` is a single select of its rows, and `of` this entity\'s multi-select whose every option is one of `expect`\'s. |\n| `register.lanes` | `layout: "lanes"` and `lanes` go together: `lanes` is a one-row link to an entity with a `records` entry, the rows name a date on their line, a block\'s two ends are read alike (two days or two moments), and `loads` needs `lanes`. |\n| `register.loads` | `loads` names one to 2 numbers a block adds \u2014 never a percent \u2014 each against a number of the lane\'s row, in one unit or two of one dimension. |\n| `register.band-pivot` | *Noted, never refused:* A pivot in a register\'s band: its grid reads on a dashboard, and the band leads with a `metric`. |\n| `register.band-headline` | *Noted, never refused:* A register over rows that move (a status or a deadline) stating no `readings`: the band leads with the job\'s headline number. |\n\n<!-- generated:end rules-register -->\n\nThe row is the entity\'s `records` entry: its picture, title and the line under it,\nthen the status, the columns, and the figure at the right; the title, the status and a\ncolumn of days or amounts sort the rows by their header. The status is always the chips, with\ncounts, opening on the rows not closed (every row on a calendar or a lanes board, whose\nwindow of time narrows them) \u2014 never one of `filters`. `filters` are the ones a reader\nnarrows by every day \u2014 none to three, never a quota \u2014 in order of use, each a field the\nrows show (a column, a part of the row), each on the line\nwith the search and the chips, the grouping one\nchip at its end; a member filter offers "mine". A date filters by a range of days \u2014 of\nminutes on a `datetime` field, its end not held, so back-to-back shifts read each row\nonce \u2014 and can keep the rows holding no date too (in the yard at a moment: in before it,\nout after it or not yet). A number filters by a range typed in its\nunit or currency \u2014 a figure read in each row\'s own, in the one picked beside it \u2014 with a\nslider over a percent or a figure against a constant `limits`; `{ "field", "tiers" }`\noffers the bands its breakpoints cut in place of a range (`[1000, 5000]` on a weight in\nkg: under 1.000 kg, 1.000\u20135.000 kg, 5.000 kg and over), refused on a figure read in each\nrow\'s own unit. A threshold with a name is a formula yes/no, never a range. A\ncolumn the row already draws is refused. Absent `sort`, rows open soonest\ndeadline first where the row has a `due`, else newest first. `search` names the fields\nthe search box matches \u2014 a link by its row\'s title \u2014 and a pasted list searches each\nline, naming the lines no row matched; absent, it matches every word of the row.\n`export` saves the register as its report \u2014 the title, a line per chip, the search and\nthe moment it was exported, the readings, and every row in view, at most 20,000 of them.\n`export: true` saves it as a workbook, the readings on a sheet before the rows. A list\nstates the reports the business sends \u2014 one a button, several one menu \u2014 each a `label`,\na `description`, and a `template` filled with `title`, `lines`, `readings` and the rows\nunder the entity\'s alias (an html one made a PDF, an `excel` one a workbook; absent, the\nworkbook). A report of some rows (`where`), or of one value the reader picks (`per`: one\nline\'s file), first narrows the register as its chips, so the screen shows what the file holds.\n`readings` read the register\'s own rows above them: the rows in view, so the search,\nthe status and the filters narrow each one. They are optional \u2014 state them where a\npicture answers something the rows cannot \u2014 and stand under the title in one compact\nband: lead with the job\'s headline number (a `metric`), then at most the mix (a\n`breakdown`) and the movement (a `trend`) \u2014 a `pivot` stands under the band as a whole table, every line and its totals. A picture\nstands only where it splits the rows in view into two parts or more, one of them\nholding two rows or more, by a field no chip narrows to one value; a split whose rows\nall fall in one part, and a lone figure with no picture beside it, are said on the\nsummary line instead, so a band stands only holding a picture or two figures. The summary line already totals the\nfigure over the rows in view and the status chips count them, so a `metric` summing the\nfigure, or counting the rows of an entity with a status, is refused unless its `where`\nnarrows it. Pressing a bar, a cell or a metric with a `where` adds its condition as a filter.\n\n`where` keeps the rows the app works, read so on the server and never a chip: a\npurchase desk over orders of both directions states `"where": { "direction":\n["purchase"] }`, and a row added there is written holding the one option (a select kept\nat several is asked among them). `opens` is the view the register opens on, each entry a\nchip the reader may take away: a cashier opens on `"opens": { "owes": true }`. Both take\na select\'s options or a yes/no\'s value, stored or a formula; `opens` on the status is\nthe chips\' opening choice. `opens` also takes `"me"` on a member field \u2014 `"opens": {\n"assignee": "me" }` opens on the rows assigned to whoever reads, the server reading the\nreader, never the page; `where` refuses it, since it fixes the rows for every reader\n(who may read a row at all is the entity\'s `read_scope`).\n\n`layout: "calendar"` places each row on its day \u2014 a month, a week, a day or a list (a\nphone reads the list or a day): at its hour where the date holds one, over its span\nwhere the row\'s line holds a second date after it, its line\'s other words and the\nregister\'s `columns` after its title. The calendar reads the window in view, and its\ncount and the status chips count that window, opening on every row.\n\n`layout: "lanes"` with `lanes` naming a one-link draws each row of the linked entity as\na lane (a chair, a machine, a room), empty ones too, and each register row as a block\nfrom the first date on its line to the second: over the hours of one day where the first\nholds its hour, else over the days of one day, a week or a month. A block reads the row\'s\nname and the first of its `columns`; a free stretch between blocks adds a row there, its\nlane and its start set, and its end where the next block bounds it. A phone lists each\nlane\'s blocks and free stretches in clock order. Rows naming no lane stand first, in a lane\nof their own; where the app writes the link, each block moves to another lane from its menu.\nInside a folder (`scope`), the lanes are the ones whose own one-link names that folder \u2014 a\nbranch\'s rooms, never every branch\'s. A span\'s end holds its day unless `records` names it\nthe day the row `frees`.\n\n`loads` names what a lane carries: `{ "weight": "payload", "volume": "box" }` sums each\nblock\'s number and reads it against the lane row\'s own, at most two. A lane holds its\nblocks while they stand, so it reads the most they add up to at one time in the window \u2014\na day\'s rows together \u2014 named, past its bound, by how much and on which day or at which\nhour. The two are in one unit, or two of one dimension (kg against t); a block then reads\nwhat it adds, and the move menu reads each lane as it would stand with the block on it.\nA bound a single row must keep (no parcel heavier than its van) is a `write_rules` `max`\nthrough the link, which refuses the move.\n\n`layout: "roster"` draws the register\'s rows down the side and the days of a week or a\nmonth across; `roster` names the entity whose rows fill the days \u2014 each stands on one\nregister row by its single link to it, and on the first date of its line (a shift on a\nperson\'s day, a run on a vehicle\'s), on every day through the second date where its line\nholds one. A cell reads its row\'s status, else the first single select on its line (a\nshift\'s kind), several rows their count; a week\'s cells say their words and one more\nfact of the line, a month\'s keep their marks. A day holding none stays empty: nothing\nwas due, which is never an absence. A filled cell opens its row; an empty one adds a row\nthere, the register row and the day set, asking what any add of it asks \u2014 unless no\nperson writes those rows (`writes: false`). With `expect` (a single select of those\nrows) the columns are its options in place of days \u2014 a checklist of papers \u2014 and `of`\n(this entity\'s multi-select) names the ones each row expects: a gap among them reads as\none and adds its row, the others stand blank, and each row reads what it holds of them,\n`2/3`. A roster states no `columns` and needs no `readings`: its legend counts each\nstate in view.\n\n```jsonc\n"register": { "layout": "roster", "roster": "run", "filters": ["operator"] }\n```\n\nAn app whose job reads its rows otherwise than the entity\'s `records` restates them in\nits own `row` \u2014 the cashier\'s figure is what is still owed, its line the service and the\nday. The subtitle, figure and image it states replace the entity\'s wherever that app\ndraws a row of it; every other app reads `records`, and the title is the entity\'s.\n\n### Readings\n\nA reading is one number, or one picture of numbers, over rows. Where it stands decides\nwhich rows: a dashboard reads every row, a register\'s `readings` the rows in view, a\nrecord\'s reading block the child rows under the record. The picture is the runtime\'s,\nchosen from what the reading means \u2014 no key picks a chart.\n\n```jsonc\n{ "metric": "visit", "value": "fees", "where": { "paid": false }, "over": "arrived_on", "label": "Unpaid" }\n{ "breakdown": "visit", "by": "line" }\n{ "trend": "visit", "over": "arrived_on", "value": "fees" }\n{ "pivot": "visit", "rows": "size", "columns": "line" }\n{ "list": "visit", "where": { "stage": ["in_yard"] }, "columns": ["line"], "app": "gate", "label": "In the yard" }\n{ "list": "task", "where": { "assignee": "me" }, "label": "My tasks" }\n```\n\nA reading\'s `where` keeps rows by a select\'s options, a yes/no\'s value, or `"me"` on a\nmember field \u2014 the rows that name whoever reads, read so on the server.\n\n<!-- generated:start apps-readings -->\n\n#### Metric\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `metric` | alias | yes | The entity whose rows are counted, or summed, into one number |\n| `value` | alias | no | A number field summed over the rows; absent, the rows are counted |\n| `where` | map of alias \u2192 (list of alias (at least one) \\| boolean \\| `"me"`) | no | Only the rows whose select holds one of these options, whose yes/no (stored, or a formula) is this value \u2014 each its own, or looked up through one-row links \u2014, or whose member field holds the reader (`"me"`) \u2014 every entry ANDed |\n| `over` | alias | no | The date that places a row in time \u2014 its own (stored, or a formula), or its parent\'s through a lookup over a one-link: a dashboard\'s period windows the rows by it (a reading without one reads the rows as they stand now), and a metric reads its recent periods beside the number |\n| `target` | number | no | The number it is read against, where no `limits` bounds its value (a bounded value is read against the sum of its bound) |\n| `better` | `"up"` \\| `"down"` | no | Which way its change over the recent periods `over` reads is good; absent, a sum\'s rise and a count kept by `where` falling |\n| `label` | text | yes | What the reading is, in the reader\'s words |\n\n#### Breakdown\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `breakdown` | alias | yes | The entity whose rows are split into parts |\n| `by` | alias | yes | The single select, one link, member or yes/no (stored, a formula, or a lookup of one through one-row links) each row is counted under |\n| `value` | alias | no | A number field summed over the rows; absent, the rows are counted |\n| `where` | map of alias \u2192 (list of alias (at least one) \\| boolean \\| `"me"`) | no | Only the rows whose select holds one of these options, whose yes/no (stored, or a formula) is this value \u2014 each its own, or looked up through one-row links \u2014, or whose member field holds the reader (`"me"`) \u2014 every entry ANDed |\n| `over` | alias | no | The date that places a row in time \u2014 its own (stored, or a formula), or its parent\'s through a lookup over a one-link: a dashboard\'s period windows the rows by it (a reading without one reads the rows as they stand now), and a metric reads its recent periods beside the number |\n| `label` | text | no | What the reading is, in the reader\'s words; absent, the `by` field\'s label |\n\n#### Trend\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `trend` | alias | yes | The entity whose rows are counted, or summed, per period |\n| `over` | alias | yes | The date each row falls on \u2014 its own (stored, or a formula), or its parent\'s through a lookup over a one-link |\n| `ahead` | `true` | no | Counts forward: the current period first, then the ones after it, over the rows dated today or later (arrivals by their ETA); absent, the periods up to today |\n| `value` | alias | no | A number field summed over the rows; absent, the rows are counted |\n| `where` | map of alias \u2192 (list of alias (at least one) \\| boolean \\| `"me"`) | no | Only the rows whose select holds one of these options, whose yes/no (stored, or a formula) is this value \u2014 each its own, or looked up through one-row links \u2014, or whose member field holds the reader (`"me"`) \u2014 every entry ANDed |\n| `label` | text | no | What the reading is, in the reader\'s words; absent, the value\'s label, else the entity\'s |\n\n#### Pivot\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `pivot` | alias | yes | The entity whose rows are counted, or summed, in a grid |\n| `rows` | alias | yes | The single select, one link, member or yes/no (stored, a formula, or a lookup of one through one-row links) down the side |\n| `columns` | alias | yes | The single select, one link, member or yes/no (stored, a formula, or a lookup of one through one-row links) across the top |\n| `value` | alias | no | A number field summed over the rows; absent, the rows are counted |\n| `where` | map of alias \u2192 (list of alias (at least one) \\| boolean \\| `"me"`) | no | Only the rows whose select holds one of these options, whose yes/no (stored, or a formula) is this value \u2014 each its own, or looked up through one-row links \u2014, or whose member field holds the reader (`"me"`) \u2014 every entry ANDed |\n| `over` | alias | no | The date that places a row in time \u2014 its own (stored, or a formula), or its parent\'s through a lookup over a one-link: a dashboard\'s period windows the rows by it (a reading without one reads the rows as they stand now), and a metric reads its recent periods beside the number |\n| `label` | text | no | What the reading is, in the reader\'s words; absent, the two fields\' labels |\n\n#### List\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `list` | alias | yes | The entity whose rows are listed, each in its `records` anatomy |\n| `where` | map of alias \u2192 (list of alias (at least one) \\| boolean \\| `"me"`) | no | Only the rows whose select holds one of these options, whose yes/no (stored, or a formula) is this value \u2014 each its own, or looked up through one-row links \u2014, or whose member field holds the reader (`"me"`) \u2014 every entry ANDed |\n| `columns` | list of alias | no | Fields read after each row\'s title |\n| `app` | alias | no | An app of this model over the same entity that a row opens in |\n| `label` | text | yes | What the reading is, in the reader\'s words |\n\n<!-- generated:end apps-readings -->\n\n<!-- generated:start rules-reading -->\n\n#### Rules the check enforces\n\n| Rule | |\n|---|---|\n| `reading.value` | A reading sums a number, never a percent \u2014 percents do not add up. |\n| `reading.split` | `by`, `rows` and `columns` split by one value each row holds \u2014 a single select, a one-row link, one member or a yes/no, stored or a formula, a lookup through one-row links as the field it reads \u2014 and a pivot crosses two different fields. |\n| `reading.over` | `over` is a date: the row\'s own, stored or a formula, or its parent\'s through a lookup over a one-row link. |\n| `reading.where` | A reading\'s `where` keeps rows by a select\'s options, a yes/no\'s `true` or `false`, or a member field holding the reader (`"me"`). |\n| `reading.target` | `target` reads a value nothing bounds \u2014 a value `limits` bounds reads against the sum of its bound. |\n| `reading.better` | `better` needs `over`: a change is read over the periods its date places the rows in. |\n| `reading.list-app` | A list\'s `app` is a register app of this model over the list\'s own entity. |\n\n<!-- generated:end rules-reading -->\n\nA reading counts its rows, or sums the number `value` names \u2014 never a percent. `by`,\n`rows` and `columns` split the rows by one value each: a single select, a one-row link,\none member, or a yes/no \u2014 stored or a formula, its parts read as its label and the\nothers. `over` is a date, the row\'s own (stored or a formula) or its parent\'s through a\nlookup over a one-link: a trend\'s periods, a metric\'s recent periods beside its number,\nand what a dashboard\'s period windows. `ahead: true` reads a trend forward from the\ncurrent period over the rows still to come. `where` keeps rows whose select holds one\nof the options, or whose yes/no is the value, every entry ANDed \u2014 a band leads with the\njob\'s exception as a formula\'s yes/no (what is late, what is short), never a stage the\nstatus chips already count. A metric summing a value `limits` bounds reads against the\nsum of its bound (`10 / 14`); `target` reads one against a number nothing bounds. A\nmetric\'s change is green where it moves the good way: a sum\'s rise, a count kept by\n`where` falling; `better` states the other way where that reads wrong \u2014 money going out\n(`"better": "down"`). A register reads only its own entity; a `list` stands only on a\ndashboard.\n\n### Record\n\n```jsonc\n"record": {\n "door": "page",\n "sections": [\n { "title": "Details", "fields": ["size", "line", "built_on"] },\n { "title": "Gate in", "at": ["arriving", "in_yard"], "fields": ["arrived_on", "truck"],\n "blocks": [{ "rows": "fee", "where": { "leg": ["in"] }, "expect": "kind", "columns": ["amount", "paid_by"] }],\n "acts": ["gate_in_paper"] },\n { "title": "Sell to a buyer", "description": "Moves the container to the buyer\'s stock once it has left.", "acts": ["sell"] }\n ]\n}\n```\n\n<!-- generated:start apps-record -->\n\n#### Record page\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `door` | `"page"` \\| `"drawer"` | no | A page for work read at length; a drawer for rows worked one after another from the register. Either stacks its sections, and from three sections on navigates them \u2014 a page by a rail, a drawer by tabs; absent, a page where a section has `at` or is a `page` or the record has more than three sections, else a drawer |\n| `sections` | list of [Section](#section) (at least one) | no | The record in the order its work reaches it \u2014 each section its fields, then its blocks, then its acts. Absent, one section of every field a person writes that no other place shows |\n| `comments` | `true` | no | The record\'s comment thread beside the sections \u2014 who wrote what and when, with a composer \u2014 stated only where the job\'s people discuss a record or the owner asks for one. Absent, it is drawn nowhere |\n| `history` | `true` | no | The record\'s status history beside the sections \u2014 each move, when and who \u2014 stated only where the owner asks for an audit trail of the moves: the rail already marks the steps passed, and the entity\'s `status.history` is written either way. Absent, it is drawn nowhere |\n\n#### Section\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `title` | text | yes | What the section is, in the reader\'s words \u2014 its heading, and its name on the record\'s rail or tab |\n| `description` | text | no | One sentence under the title: what the section is for, or what its act does |\n| `at` | list of alias (at least one) | no | Options of the record\'s status (or its milestones) during which this section is the work now \u2014 a step of the path the record moves through: its rail item reads now while the status holds one and this app has work there, done once the record\'s history says it went through one \u2014 or it is a step of the path before where that history opens (with none, where the record stands) that no act moves the work past \u2014 and it stands before the section that is the work now, and waiting otherwise; a section every option of which ends the work, past the path\'s end or entered by its own act, is an exit: no item and nothing drawn until the record stands in it, then set apart after the steps and never one; A page opened from the register opens at it. It never locks what the section holds: its fields are written as the write rules and checks allow at any stage. An act it names is offered during these alone: its `when` holds the status to them, or on milestones it stamps the step after one of them \u2014 a detour and an exit are sections of their own, a detour stated before the step it returns to |\n| `fields` | list of alias (at least one) | no | The record\'s own fields in this section, in the order they are read \u2014 never one the header draws: the row\'s title, subtitle, image, status or figure |\n| `blocks` | list of [block](#blocks) (at least one) | no | What the section holds besides its own fields, under them, in order |\n| `acts` | list of alias (at least one) | no | Acts of this app drawn under the section\'s fields, their asks as more of them and what each lacks said above its button; the header draws no act, so every act of the record itself is named by one section \u2014 an act of a child (`of`) stands on the child\'s row and is never named here. An act moving the status, offered at ONE step (the stage its `when` holds), stands at that step\'s foot when it moves the work forward \u2014 to a later option, an exit too \u2014 or back to a step the work passes anyway; one offered at several steps, or moving back into a detour, stands in the section it enters, which draws it while the work waits \u2014 an exit\'s in the header\'s \u22EF, since an exit stands only once the record is in it. A correction \u2014 `danger` and not one of its step\'s outcomes (no other status move offered at the same moment) \u2014 waits in the section heading\'s \u22EF, and one no section names in the header\'s \u22EF; every other act is named by a section |\n| `when` | map of alias \u2192 (list of alias (at least one) \\| boolean) | no | Shown only while each named select of the record holds one of these options, and each named yes/no (stored, or a formula) is this value |\n| `page` | `true` | no | A page of its own, off the record\'s scroll: its own heading and a way back, reached from the record\'s rail after the scroll\'s sections, or from a link at its place where the record has no rail \u2014 for what makes the record worse stacked in it: a long list of related rows, a workspace of its own. Only on a page door, never a step (`at`) |\n\n<!-- generated:end apps-record -->\n\n<!-- generated:start rules-record -->\n\n#### Rules the check enforces\n\n| Rule | |\n|---|---|\n| `record.placed-once` | A field, a block and an act each stand once on a record: the header draws the title, subtitle, image, status (or milestones), figure and folder, and a field\'s one other place is a section\'s `fields`, a files block or a text block \u2014 save the image, which one files block may draw again, whole. |\n| `record.foot-total` | A rows block\'s foot totals the child\'s figure and each summed column over the rows it lists; the record\'s rollup summing that field over those rows (the same `where`) is that foot, never also one of a section\'s `fields`. |\n| `record.fact-restates` | A section\'s field never looks up what its link already reads where it stands: the linked row\'s title and line beside the link, the figure or bound its meter reads on the header\'s line. |\n| `record.section-holds` | A section holds fields, blocks or acts. |\n| `record.at` | `at` names options of the record\'s stored status, or its milestones; a record with no status has no steps. |\n| `record.page` | A section is a `page` only on a page door and never a step (`at`), its title naming an address no other page shares (a letter or a digit at least), and never every section. |\n| `record.history` | `record.history` draws a status history the entity records (`status.history`); no block reads that history. |\n| `record.section-acts` | A section\'s `acts` name acts of the record itself: an act of a child (`of`) stands on the child\'s row, and one over the register\'s rows (`on`) on the register. |\n| `record.act-in-section` | Every act of the record stands in the `acts` of the section whose work it is; only a correction no section owns \u2014 `danger`, and no other status move offered at the same moment \u2014 waits in the header\'s \u22EF. |\n| `record.move-home` | A status move offered at one step stands at that step\'s foot when it moves the work forward, to an exit, or back to a step it passes anyway; one offered at several steps, or moving back into a detour, stands in the section `at` the status it enters. |\n| `record.act-staged` | An act at a staged section\'s foot is offered only during that section\'s steps: its `when` holds the status to options the section names \u2014 on milestones, it stamps the step after one of them. |\n| `record.act-hidden` | An act is never offered only while its section\'s `when` hides the section. |\n\n<!-- generated:end rules-record -->\n\nThe record is its `sections`, stacked in the order the work reaches them. A section is\nits fields, the acts under them, then its blocks \u2014 the acts at its foot instead where one\nreads what a block holds or none of its fields \u2014 and holds at least one of them. From\nthree sections on, the record is navigated by their titles: a page by a rail that jumps\nto each (a strip of the same names on a phone), a drawer by tabs, the companion the last;\nwith fewer, the sections just stack. `description` is one sentence under the title.\n`at` names the status options (or the milestones) during which the section is the work\nnow \u2014 only on a record that truly moves through those stages: the rail marks it done,\nnow or waiting (an item of no `at` is its title alone), and the section stands even holding\nnothing yet \u2014 it never hides a field, locks it or gates an act, and a record opens at its\nhead. `page: true` makes a section a page of its own under the\nrecord\'s, off its scroll, with a way back \u2014 rarely, for a long related list or a workspace\nof its own that would make the record worse stacked; never on a drawer or a step. The\nheader draws no act: every act on the record is named by the section whose work it is, and one no section names is refused, naming its likely\nsection \u2014 only a correction no section owns waits in the header\'s \u22EF beside Delete. An act\nmoving the status and offered at ONE step (its `when`) stands at that step\'s foot when it\nmoves the work forward \u2014 to the next step, or to an exit later in the status\'s options\n(Reject beside Approve) \u2014 or back to a step the work passes anyway. One offered at SEVERAL\nsteps, or moving back into a detour, is named by the section it enters: a detour draws it and its\ngaps alone while it waits. A `danger` act is a correction \u2014 waiting in the \u22EF of what it acts\non: its section\'s heading, its row, the header\'s where no section names it \u2014 unless it moves\nthe status while another status move is offered at the same moment; then it is one of that\nstep\'s outcomes, a button. Cancel offered at Held and at Confirmed, beside Confirm, is an\noutcome into an exit: state `{ "title": "Cancelled", "at": ["cancelled"], "fields": ["reason"],\n"acts": ["cancel"] }`. An exit stands only once the record is in it, its reason there and its\nrail item apart from the path; until then Cancel waits in the header\'s \u22EF. `comments: true`\nputs the record\'s comment thread beside the sections, and `history: true` its status history \u2014\nthe history never as a section. Both are opt-in: state them only where the job\'s people\ndiscuss a record, or the owner asks for an audit trail of its moves.\n\nA field, a block and an act is each placed ONCE on a record \u2014 the header, one section;\na second place is refused. The header draws the entity\'s `records` title, subtitle,\nimage, status (or milestones) and figure, so none of them is named again in a section\'s\n`fields` or the register\'s `columns` \u2014 save the image, which one `files` block may draw\nagain, whole at reading size (an incident\'s photo, a scan), the header keeping its mark. Refused too: a section holding nothing, an `at`\non a record with no status, and a section\'s act that is a child\'s or runs over the\nregister\'s rows.\nAbsent `sections`, one section holds every field a person writes that the header does\nnot show. An editable field rests as its control and saves as it changes; everything\nelse is plain text. A section or a block with `when` is shown only while each named\nselect of the record holds one of its options. The one layout serves every entity: a\ncustomer or a product is sections without `at`.\n\n### Blocks\n\n```jsonc\n"blocks": [\n { "rows": "fee", "columns": ["kind", "amount"] },\n { "rows": "fee", "where": { "leg": ["out"] }, "columns": ["kind", "amount"], "under": "invoice" },\n { "agenda": "booking", "columns": ["guide"], "start": "arrival" },\n { "timeline": "note" },\n { "files": ["photos", "papers"] },\n { "text": "remarks", "when": { "stage": ["held"] } },\n { "metric": "fee", "value": "amount", "label": "Fees" },\n { "breakdown": "fee", "by": "kind" },\n { "trend": "fee", "over": "charged_on", "value": "amount" },\n { "pivot": "fee", "rows": "kind", "columns": "method" }\n]\n```\n\n<!-- generated:start apps-blocks -->\n\n#### Rows block\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `rows` | alias | yes | A child entity whose rows belong to this record |\n| `via` | alias | no | The child\'s link to this record, where it has more than one |\n| `title` | text | no | The block\'s heading; absent, the child entity\'s or the field\'s own label |\n| `columns` | list of alias | no | The child\'s fields read as columns after its title \u2014 never what its row draws (subtitle, image, status, figure, or the bound its figure\'s meter reads against), though an `expect` block\'s figure is a column, filled in place |\n| `create` | list of alias (at least one) \\| `false` | no | The child\'s fields asked when a row is added here; absent, its title, its picture, the subtitle and figure no default fills, the block\'s columns, its natural key and every required field \u2014 each a person writes; false, rows are not added here |\n| `where` | map of alias \u2192 list of alias (at least one) | no | Only the child rows whose single select holds one of these options \u2014 every entry ANDed, read so on the server; a row added here holds them (one leg\'s fees, of a record holding both legs\'). Each select is one the child requires, so no row stands in no block |\n| `expect` | alias | no | The child\'s title when the record holds one row per value of it \u2014 a single select (one per option, in order) or a one-row link to a catalog (one per row the link may point at): a value not yet filled reads as its own empty line, and no value holds two rows. The block\'s `columns` name at least one field a person fills in place |\n| `of` | alias | no | With `expect` on a select: the record\'s own multi-select holding the options this record expects a line for \u2014 the options it holds, in order, rather than every option. Its options are among the title\'s |\n| `under` | alias | no | The child\'s one-link to a document that covers its rows (an invoice over its fee lines), whose many-link points back and which links to this record: each document stands as a heading over the lines it covers; a filled line no document covers says so on its own row with a make for one document over it, and two or more waiting take a combined make in the block\'s heading. Never also a rows block of the document |\n| `when` | map of alias \u2192 (list of alias (at least one) \\| boolean) | no | Shown only while each named select of the record holds one of these options, and each named yes/no (stored, or a formula) is this value |\n\n#### Timeline block\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `timeline` | alias | yes | A child entity read as a log of dated entries, newest first, with a composer where the app adds entries, each corrected and removed where it stands as a rows block\'s row (entries planned ahead are an `agenda`) \u2014 never the record\'s status history, which `record.history` draws beside the record |\n| `via` | alias | no | The child\'s link to this record, where it has more than one |\n| `title` | text | no | The block\'s heading; absent, the child entity\'s or the field\'s own label |\n| `create` | list of alias (at least one) \\| `false` | no | The child\'s fields asked when a row is added here; absent, its title, the subtitle and figure no default fills, its natural key and every required field \u2014 each a person writes; false, rows are not added here |\n| `when` | map of alias \u2192 (list of alias (at least one) \\| boolean) | no | Shown only while each named select of the record holds one of these options, and each named yes/no (stored, or a formula) is this value |\n\n#### Agenda block\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `agenda` | alias | yes | A child entity read as planned entries on a time axis: by day, soonest first, each entry with its picture and the day that is today marked. The day is the first date on the child\'s row line (its `records` title or subtitle); within a day entries follow a datetime there, else the first single select after the date \u2014 its options in the day\'s order |\n| `via` | alias | no | The child\'s link to this record, where it has more than one |\n| `title` | text | no | The block\'s heading; absent, the child entity\'s or the field\'s own label |\n| `columns` | list of alias | no | The child\'s facts read on an entry\'s line after its title \u2014 never what its line already draws (subtitle, image, status, figure) |\n| `create` | list of alias (at least one) \\| `false` | no | The child\'s fields asked when a row is added here; absent, its title, its picture, the subtitle and figure no default fills, the block\'s columns, its natural key and every required field \u2014 each a person writes; false, rows are not added here |\n| `start` | alias | no | The record\'s date that is the first day: each day\'s heading counts from it (Day 1, Day 2); absent, the weekday and the date alone |\n| `when` | map of alias \u2192 (list of alias (at least one) \\| boolean) | no | Shown only while each named select of the record holds one of these options, and each named yes/no (stored, or a formula) is this value |\n\n#### Files block\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `files` | list of alias (at least one) | yes | Files fields of this record, read as pictures and documents |\n| `title` | text | no | The block\'s heading; absent, the child entity\'s or the field\'s own label |\n| `when` | map of alias \u2192 (list of alias (at least one) \\| boolean) | no | Shown only while each named select of the record holds one of these options, and each named yes/no (stored, or a formula) is this value |\n\n#### Text block\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `text` | alias | yes | A long text field read as prose |\n| `title` | text | no | The block\'s heading; absent, the child entity\'s or the field\'s own label |\n| `when` | map of alias \u2192 (list of alias (at least one) \\| boolean) | no | Shown only while each named select of the record holds one of these options, and each named yes/no (stored, or a formula) is this value |\n\n#### Metric block\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `metric` | alias | yes | The entity whose rows are counted, or summed, into one number |\n| `value` | alias | no | A number field summed over the rows; absent, the rows are counted |\n| `where` | map of alias \u2192 (list of alias (at least one) \\| boolean \\| `"me"`) | no | Only the rows whose select holds one of these options, whose yes/no (stored, or a formula) is this value \u2014 each its own, or looked up through one-row links \u2014, or whose member field holds the reader (`"me"`) \u2014 every entry ANDed |\n| `over` | alias | no | The date that places a row in time \u2014 its own (stored, or a formula), or its parent\'s through a lookup over a one-link: a dashboard\'s period windows the rows by it (a reading without one reads the rows as they stand now), and a metric reads its recent periods beside the number |\n| `target` | number | no | The number it is read against, where no `limits` bounds its value (a bounded value is read against the sum of its bound) |\n| `better` | `"up"` \\| `"down"` | no | Which way its change over the recent periods `over` reads is good; absent, a sum\'s rise and a count kept by `where` falling |\n| `label` | text | yes | What the reading is, in the reader\'s words |\n| `via` | alias | no | The child\'s link to this record, where it has more than one |\n| `when` | map of alias \u2192 (list of alias (at least one) \\| boolean) | no | Shown only while each named select of the record holds one of these options, and each named yes/no (stored, or a formula) is this value |\n\n#### Breakdown block\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `breakdown` | alias | yes | The entity whose rows are split into parts |\n| `by` | alias | yes | The single select, one link, member or yes/no (stored, a formula, or a lookup of one through one-row links) each row is counted under |\n| `value` | alias | no | A number field summed over the rows; absent, the rows are counted |\n| `where` | map of alias \u2192 (list of alias (at least one) \\| boolean \\| `"me"`) | no | Only the rows whose select holds one of these options, whose yes/no (stored, or a formula) is this value \u2014 each its own, or looked up through one-row links \u2014, or whose member field holds the reader (`"me"`) \u2014 every entry ANDed |\n| `over` | alias | no | The date that places a row in time \u2014 its own (stored, or a formula), or its parent\'s through a lookup over a one-link: a dashboard\'s period windows the rows by it (a reading without one reads the rows as they stand now), and a metric reads its recent periods beside the number |\n| `label` | text | no | What the reading is, in the reader\'s words; absent, the `by` field\'s label |\n| `via` | alias | no | The child\'s link to this record, where it has more than one |\n| `when` | map of alias \u2192 (list of alias (at least one) \\| boolean) | no | Shown only while each named select of the record holds one of these options, and each named yes/no (stored, or a formula) is this value |\n\n#### Trend block\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `trend` | alias | yes | The entity whose rows are counted, or summed, per period |\n| `over` | alias | yes | The date each row falls on \u2014 its own (stored, or a formula), or its parent\'s through a lookup over a one-link |\n| `ahead` | `true` | no | Counts forward: the current period first, then the ones after it, over the rows dated today or later (arrivals by their ETA); absent, the periods up to today |\n| `value` | alias | no | A number field summed over the rows; absent, the rows are counted |\n| `where` | map of alias \u2192 (list of alias (at least one) \\| boolean \\| `"me"`) | no | Only the rows whose select holds one of these options, whose yes/no (stored, or a formula) is this value \u2014 each its own, or looked up through one-row links \u2014, or whose member field holds the reader (`"me"`) \u2014 every entry ANDed |\n| `label` | text | no | What the reading is, in the reader\'s words; absent, the value\'s label, else the entity\'s |\n| `via` | alias | no | The child\'s link to this record, where it has more than one |\n| `when` | map of alias \u2192 (list of alias (at least one) \\| boolean) | no | Shown only while each named select of the record holds one of these options, and each named yes/no (stored, or a formula) is this value |\n\n#### Pivot block\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `pivot` | alias | yes | The entity whose rows are counted, or summed, in a grid |\n| `rows` | alias | yes | The single select, one link, member or yes/no (stored, a formula, or a lookup of one through one-row links) down the side |\n| `columns` | alias | yes | The single select, one link, member or yes/no (stored, a formula, or a lookup of one through one-row links) across the top |\n| `value` | alias | no | A number field summed over the rows; absent, the rows are counted |\n| `where` | map of alias \u2192 (list of alias (at least one) \\| boolean \\| `"me"`) | no | Only the rows whose select holds one of these options, whose yes/no (stored, or a formula) is this value \u2014 each its own, or looked up through one-row links \u2014, or whose member field holds the reader (`"me"`) \u2014 every entry ANDed |\n| `over` | alias | no | The date that places a row in time \u2014 its own (stored, or a formula), or its parent\'s through a lookup over a one-link: a dashboard\'s period windows the rows by it (a reading without one reads the rows as they stand now), and a metric reads its recent periods beside the number |\n| `label` | text | no | What the reading is, in the reader\'s words; absent, the two fields\' labels |\n| `via` | alias | no | The child\'s link to this record, where it has more than one |\n| `when` | map of alias \u2192 (list of alias (at least one) \\| boolean) | no | Shown only while each named select of the record holds one of these options, and each named yes/no (stored, or a formula) is this value |\n\n<!-- generated:end apps-blocks -->\n\n<!-- generated:start rules-block -->\n\n#### Rules the check enforces\n\n| Rule | |\n|---|---|\n| `block.child-link` | A block reads a child linked to the record; `via` names the link where the child links more than once. |\n| `block.column-drawn` | A child block\'s column never names what the child\'s row draws \u2014 its title, subtitle, image, status, figure, or the bound its figure\'s meter reads against \u2014 nor its link back to the record, and names a field once; an `expect` block\'s figure is its filled-in-place column. |\n| `block.title-back` | Where a child\'s title is its link back to the record a block lists it under, its first other subtitle names it there \u2014 a text, a code, a select, a link or a member, never a number or a date. |\n| `block.where` | A rows block\'s `where` names single selects the child requires, by options they hold; one held at a single option is never also a column. |\n| `block.under` | `under` names the child\'s one-row link to a document entity that pairs a many-link back and is read under this record by its one link; the lines\' columns never read the document (its heading does) nor hold long text. |\n| `block.under-once` | Documents drawn over their lines (`under`) are never listed again as a block of their own. |\n| `block.expect` | `expect` names the child\'s title \u2014 a single select or a one-row link a person writes, never the link back \u2014 on a child added in the block; the block\'s `columns` name at least one field a person fills in place, and its `create` takes the file where the child is pictured by one. |\n| `block.expect-fills` | An expected line is made from its key and its first filled column, so every other field the child requires has a default, a start or a `default_from`, or is read first. |\n| `block.expect-of` | A block\'s `of` needs `expect` on a select, and names the record\'s multi-select whose every option is one of the title\'s. |\n| `block.agenda` | An agenda\'s child names a date on its row line (`records` title or subtitle); `start` is a date of the record. |\n| `block.timeline` | A timeline\'s child holds a date to place its entries by. |\n| `block.field-kind` | A files block names files fields of the record, and a text block a text field. |\n| `block.read-scope` | A child read under a record whose rows a `read_scope` narrows states its own \u2014 a row rule is not inherited, save the status history\'s, which takes its record\'s. |\n| `block.agenda-note` | *Noted, never refused:* Rows each on a day and within it (at an hour, in a part of the day) listed as a table: an `agenda` draws them by day. |\n| `block.under-note` | *Noted, never refused:* Rows holding a paper that cover another block\'s lines, listed apart with no add of their own stated: `under` draws them over the lines they cover. |\n\n<!-- generated:end rules-block -->\n\nA `rows`, `agenda` or `timeline` block reads a child entity through its link to the\nrecord \u2014 `via` names it where the child links more than once. A rows block adds rows\n(asking the child\'s title, its picture, the block\'s columns and its required fields)\nand opens each in a drawer. An `agenda` draws planned entries by day, soonest first:\nthe first date on the child\'s row line is the day, a datetime there or the first single\nselect after the date orders a day, and `start` \u2014 the record\'s date \u2014 is day 1. `under`\nnames the child\'s one-link to a document covering its lines (an invoice over its fees,\nits many-link paired back, linking to the record): each document heads the lines it\ncovers, the uncovered lines first \u2014 the record never lists the documents again as a\nblock of their own. A filled line no document covers says so on its own row, where one\npress makes a document over that line alone, its figure starting at the line\'s amount;\nwhere two or more wait, the block\'s heading makes one over those ticked in its dialog.\nA timeline reads its child\'s first date as the moment and its member field as who, with\na composer where the app writes it. An agenda\'s or a timeline\'s entry with no day yet is\na plan, listed first and dated in place. `create` names the child\'s fields an add here asks \u2014\nthe link to this record is filled, never asked \u2014 and `false` adds none. `expect`\nnames the child\'s title where the record holds one row per value of it \u2014 a select\'s\noptions, or the rows a link to a catalog may point at (`options_where`): every value\nis a line, one not yet filled a quiet line whose first column makes its row \u2014 or, where\nthe child is pictured by a file a person brings (its `records` `image`), a placeholder\nnaming the paper whose upload makes the row with its file \u2014 the add\noffers only the values not yet held, and every write path refuses a second row of one\nvalue under one record. A field that starts from the catalog row (`default_from`)\nshows that value as its hint, taken with one press. `where` keeps only the child rows\nwhose single select holds one of its options \u2014 read so on the server, a row added\nthere holding them, its lines expected once per value among them (one leg\'s fees\nbeside the other\'s), and its foot totalled by the record\'s sum narrowed alike. A `metric`, `breakdown`, `trend`\nor `pivot` block is a reading (\xA7 Readings) of a child entity\'s rows under this record,\nread only \u2014 `via` names the link where the child has more than one.\n\n### Tasks\n\nAn entity whose `records` states `"task": true` \u2014 its status a stored select with `closed` \u2014 is\nwork someone finishes. Every table of its rows draws it alike \u2014 a rows block of the record it\nbelongs to, its own register, the rows filed under one of its rows (its steps) \u2014 each row led by a\nring. Ticking the ring moves the row to a closed option by the one write the app already has for\nthat move \u2014 the act of that entity setting a closed option (its first preferred), offered on an\nopen row and asking nothing, else its own save where people write the status \u2014 stamping what\nthat act stamps and appending the status history. Unticking runs the act moving a closed row\nback (its `when` holding a closed option), else the save back to the status\'s default. A move no\nwrite reaches leaves the ring disabled, never hidden, and the check notes it. The status is moved\nin place on the row by the same moves; every other field is edited where the row opens. A\nfiles column reads on a task\'s line as how many files it holds. An act `of` the child with\n`on: "rows"` completes several at once: the list\'s heading offers to select rows, and the act\nruns on those picked. A block with `expect` or `under` draws its own lines, never rings.\n\n```json\n{\n "entities": [\n {\n "alias": "project",\n "label": "Projects",\n "singular": "Project",\n "fields": [\n { "alias": "name", "label": "Name", "type": "text", "required": true },\n { "alias": "lead", "label": "Lead", "type": "select_member" }\n ]\n },\n {\n "alias": "task",\n "label": "Tasks",\n "singular": "Task",\n "fields": [\n { "alias": "title", "label": "Title", "type": "text", "required": true },\n {\n "alias": "project",\n "label": "Project",\n "type": "select_record_link",\n "target_entity": "project",\n "cardinality": "one",\n "required": true\n },\n { "alias": "assignee", "label": "Assignee", "type": "select_member" },\n {\n "alias": "status",\n "label": "Status",\n "type": "select",\n "required": true,\n "options": [\n { "alias": "todo", "label": "To do", "color": "slate" },\n { "alias": "done", "label": "Done", "color": "green" }\n ],\n "default": ["todo"]\n },\n { "alias": "due", "label": "Due", "type": "date", "format": "date" },\n { "alias": "done_on", "label": "Done on", "type": "date", "format": "date" }\n ]\n }\n ],\n "records": {\n "project": { "title": "name" },\n "task": {\n "title": "title",\n "subtitle": ["assignee"],\n "status": { "field": "status", "closed": ["done"] },\n "due": ["due"],\n "task": true,\n "starts": { "assignee": "me" }\n }\n },\n "apps": [\n {\n "alias": "projects",\n "name": "Projects",\n "entity": "project",\n "record": {\n "sections": [{ "title": "Work", "fields": ["lead"], "blocks": [{ "rows": "task", "columns": ["due"] }] }]\n },\n "acts": [\n { "alias": "complete", "label": "Complete", "of": "task", "when": { "status": ["todo"] }, "set": { "status": "done", "done_on": "now" } },\n { "alias": "reopen", "label": "Reopen", "of": "task", "when": { "status": ["done"] }, "set": { "status": "todo", "done_on": null } },\n { "alias": "complete_all", "label": "Complete", "of": "task", "on": "rows", "when": { "status": ["todo"] }, "set": { "status": "done", "done_on": "now" } }\n ]\n },\n {\n "alias": "my_tasks",\n "name": "My tasks",\n "entity": "task",\n "register": {\n "opens": { "assignee": "me" },\n "readings": [{ "metric": "task", "where": { "status": ["todo"] }, "label": "Open" }]\n },\n "record": { "door": "drawer" },\n "acts": [\n { "alias": "finish", "label": "Finish", "when": { "status": ["todo"] }, "set": { "status": "done", "done_on": "now" } },\n { "alias": "undo", "label": "Undo", "when": { "status": ["done"] }, "set": { "status": "todo", "done_on": null } }\n ]\n }\n ]\n}\n```\n\n### Acts\n\n```jsonc\n"acts": [{\n "alias": "gate_out", "label": "Gate out",\n "when": { "stage": ["in_yard"] }, "requires": ["release", "seal"],\n "asks": ["seal", { "input": "note", "label": "Note", "type": "long_text" }],\n "set": { "stage": "gone", "left_on": "now", "left_by": "me", "remark": "input:note" },\n "confirm": true\n}]\n```\n\n<!-- generated:start apps-acts -->\n\n#### Act\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `alias` | alias | yes | The act\'s name within its app \u2014 its workflow is `act_<alias>` |\n| `label` | text | yes | The verb, as the reader says it |\n| `on` | `"record"` \\| `"rows"` \\| `"view"` | no | `rows` runs on the rows ticked in the register \u2014 with `of`, on the child rows ticked in the record\'s task list; `view` on every row the register shows (offered while the view is narrowed to its `when`; it states no `requires`); absent, on one record (its page and its row\'s menu) |\n| `of` | alias | no | A rows block\'s child entity the act works on: offered on each child row \u2014 or, `on: "rows"`, on the rows ticked together in a task list \u2014 its conditions and its write that row\'s |\n| `when` | map of alias \u2192 (list of alias (at least one) \\| boolean) | no | The act works only while each named select holds one of these options, and each named yes/no (stored, or a formula) is this value |\n| `requires` | list of alias (at least one) | no | Fields that must be filled first, each drawn where the act stands (its section\'s fields, a block\'s, or the act\'s asks \u2014 never the header alone); a blocked act names each one missing |\n| `recommends` | list of alias (at least one) | no | Fields the act runs without and reads when filled: while one is empty, the act says what it will leave blank |\n| `asks` | list of (alias \\| [Act input](#act-input)) (at least one) | no | What the reader states when pressing it \u2014 fields of the record (written by the act) or inputs |\n| `set` | map of alias \u2192 (text \\| number \\| boolean \\| `null`) | no | What the act writes: an option alias, a value, `"now"`, `"me"` or `"input:<name>"` |\n| `workflow` | alias | no | An authored workflow (src/workflows/<alias>.ts) the act runs after its checks, for what `set` cannot say |\n| `template` | alias | no | A document template the act makes a file from \u2014 over several rows, one file of them all, the rows listed under the entity\'s alias |\n| `templates` | list of [Act template](#act-template) (at least 2) | no | Several papers the act makes into `into` (a case\'s forms), instead of one `template`: drawn where the act stands as a list of its papers \u2014 each made one as its file, each not yet made as a placeholder naming it \u2014 the reader ticks which to make, and one press makes those, each replacing the paper its template made before |\n| `into` | alias | no | The files field of the one record the made document is kept in |\n| `intake` | alias | no | A child the record lists in a rows block whose rows are its papers: the press takes papers, an agent reads them, and each is filed as a row of this child \u2014 its kind the child\'s title, its file in the child\'s files field |\n| `record` | [Act record](#act-record) | no | The press records a call, visit or meeting through the host \u2014 Stop ends it \u2014 and files it as a new row of a child the record lists: its audio, its screen where captured, its transcript |\n| `fills` | list of text (at least one) | no | With `intake`, what the papers read may fill: a field of the record, `<link>.<field>` on the row a required one-row link of the record names, or a child whose rows the papers add \u2014 shown before and after, and saved where it differs. With `record`, fields of the new row an agent fills from the transcript, saved as they come |\n| `confirm` | `true` | no | The press asks first; the question lists every active warning |\n| `danger` | `true` | no | The act destroys or cannot be undone |\n\n#### Act input\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `input` | alias | yes | A value the act asks for that is not a field of the record |\n| `label` | text | yes | What the reader is asked, in their words |\n| `type` | `"text"` \\| `"long_text"` \\| `"number"` \\| `"date"` \\| `"select"` \\| `"link"` \\| `"member"` | yes | What the reader states |\n| `options` | list of [Select option](#select-option) (at least one) | no | The choices a `select` input offers, one picked \u2014 written into a select holding the same option aliases |\n| `entity` | alias | no | The entity a `link` input picks one row of |\n| `required` | `true` | no | The act is refused without it |\n| `default` | alias | no | A field of the row whose value the input starts from, still changed at will |\n\n#### Act template\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `template` | alias | yes | A document template the act makes a paper of, kept in `into` |\n| `when` | map of alias \u2192 (list of alias (at least one) \\| boolean) | no | The paper starts ticked while each named select of the record holds one of these options and each named yes/no (stored, or a formula \u2014 how a multi-select is tested: `includes({needs}, {needs:x})`) is this value \u2014 a suggestion the reader changes, never a refusal; absent, it starts ticked |\n\n#### Act record\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `into` | alias | yes | A child the record lists in a timeline or rows block, linking back to it by a single link: each recording is filed as a new row of it |\n| `audio` | alias | yes | The child\'s files field the recording\'s audio is kept in |\n| `transcript` | alias | yes | The child\'s text field the transcript is kept in, a speaker\'s turn per line |\n| `video` | alias | no | The child\'s files field the screen is kept in, where the recording captured it |\n| `at` | alias | no | The child\'s date field stamped with the moment the recording started |\n| `by` | alias | no | The child\'s member field set to the person who recorded |\n\n<!-- generated:end apps-acts -->\n\n<!-- generated:start rules-act -->\n\n#### Rules the check enforces\n\n| Rule | |\n|---|---|\n| `act.set-not-asked` | A field an act `set`s is the act\'s to write: read-only everywhere else and never asked by an add (`create`) \u2014 a required one takes a `default`. |\n| `act.of` | An act\'s `of` names a child the record lists in a rows block; it works on the one child row it is pressed on \u2014 or, `on: "rows"`, on the rows ticked together where the record lists that child as tasks \u2014 never on the rows in view. |\n| `act.writes-line-key` | An act never writes the link or the key naming an expected line under its record \u2014 a line\'s key is stated by filling it. |\n| `act.makes-or-runs` | An act makes a document (`template`, `templates`) or runs an authored `workflow`, never both \u2014 the workflow makes what it needs. |\n| `act.view` | An act over every row in view (`on: "view"`) writes (`set`), makes a document or runs a workflow, and states no `requires`. |\n| `act.requires-drawn` | Every field an act `requires` is drawn where the act stands \u2014 its section\'s fields, a block\'s, its asks, or an unstaged section\'s where its own is unstaged \u2014 never the header alone. |\n| `act.requires-written` | A field an act requires that only an act writes is written by an act offered together with it, or asked by the act itself. |\n| `act.recommends` | A field an act `recommends` is not also in its `requires`. |\n| `act.set` | `set` writes each field a value it holds \u2014 an option alias, a number, a yes/no, a text, `"now"` on a date, `"me"` on a member, `"input:<name>"` of an input the act asks of the same kind \u2014 or clears an optional one with `null`. |\n| `act.set-milestone` | An act stamps a milestone, never clears one \u2014 unticking clears it and every later one. |\n| `act.into` | `into` is a files field of the one record the act is pressed on, beside its `template` or `templates`. |\n| `act.templates` | `templates` names each template once, kept in `into`, on one record pressed alone \u2014 never beside `template`, `asks`, `of` or an `on` over several rows. |\n| `act.history-copy` | What a status move asks is copied onto the history\'s field of the same name, which holds the same kind of value. |\n| `act.intake` | `intake` names a child the record lists in a rows block that expects its title \u2014 a single select, the paper\'s kind \u2014 and is narrowed by no `where`, holding exactly one files field and needing nothing an added line does not fill; the act runs on one record, states `fills`, and states nothing but its `label`, `when` and `requires` beside them. |\n| `act.record` | `record` names a child the record draws in a timeline block or a rows block with no `expect`, `under` or `where`, linking back by one single link, whose row nothing requires beyond what the recording writes: `audio` and `video` its files fields, `transcript` a text field, `at` a date, `by` a member field, each a field of its own; the act runs on one record and states nothing but its `label`, `when`, `requires` and `fills` beside it. |\n| `act.fills` | `fills` names each once, only beside `intake` or `record`. Beside `record`, each is a field of the recording\'s row that the recording itself does not write. Beside `intake`: a field of the record, `<link>.<field>` on the row a required one-row link of the record names, or a child the record adds rows of in a rows block with no `expect`, `under` or `where` \u2014 its rows filled in the fields that block adds them with, among them every field an added row cannot be made without. Each field filled is one a person writes holding text, a number, a date, a yes/no or options, never a status, a milestone or a field an act writes. |\n| `act.fills-drawn` | *Noted, never refused:* A field `fills` writes that the record draws nowhere: the review shows the change, the record does not. |\n| `act.fills-new` | *Noted, never refused:* A child `fills` adds rows of, whose natural key the papers cannot state: every row read is added, so the same papers read twice list them twice. |\n| `act.input` | An input has a name of its own \u2014 never another ask\'s, a field\'s, or the record input its workflow takes \u2014 `options` exactly when it is a select, `entity` exactly when it is a link, and a `default` field holding what it states. |\n\n<!-- generated:end rules-act -->\n\nAn act whose `when` does not hold is not offered \u2014 each select named holding one of its\noptions, each yes/no named (stored, or a formula: a period that has ended) its `true` or\n`false`; every one that holds stands at the\nfoot of the section naming it in `acts` \u2014 a correction in that section heading\'s \u22EF, one\nof a child row on its row (a correction in the row\'s \u22EF). An act\'s `requires` are fields\nits section draws \u2014 its `fields`, a block\'s, the act\'s `asks`, or those of another section\nwith no `at` where its own has none; one shown only in the header or a staged section\nelsewhere is refused. One whose `requires` are\nempty is offered disabled, naming each; one whose `recommends` are empty names what\nit will leave blank and still presses; one a standing check blocks is offered\ndisabled in the check\'s words. An input\'s `default` is the row\'s field it starts from. The generated `act_<alias>` workflow re-checks all three on the\nserver, writes `set` and what was asked, and appends the status history where the\nact moves the status \u2014 each thing it asked copied onto the history row where the\nhistory has a field of the same name. `template` makes a document from the row and\nkeeps it in `into`; over several rows it makes one document of them all, the rows\nlisted under the entity\'s alias, and hands it back. `templates` instead names a set of\npapers kept in `into`, listed where the act stands \u2014 each made one as its file, each\nnot made yet as a placeholder \u2014 those whose `when` holds ticked to start; the press\nmakes the ticked ones (sent in `templates`), each replacing the file its template made\nbefore (the file whose `document_template_id` is that template \u2014 never a file a person\nput there), and the set downloads as one archive (`archive_<alias>`). A field an act writes is read-only everywhere else, never asked by an add \u2014 a required one takes a `default`. A `select` input offers its own options and is written into\na select holding the same option aliases; a `link` input picks one row of its `entity`\nand a `member` input one person, each written into a field of its kind. A field an act\nboth `requires` and `asks` never disables the press \u2014 the act asks it, required.\n\n`on: "view"` runs on every row the register shows \u2014 its search, status and filters \u2014\neach row checked before any is written. `of` names a rows block\'s child entity: the\nact is offered on each child row (its menu and its drawer), its `when`, `requires`,\n`set` and checks are the child\'s, it runs on that row, and a check of the record that\nlocks the child rows locks it too. With `on: "rows"` it runs on the child rows ticked\ntogether in the record\'s task list (\xA7 Tasks) \u2014 every row checked before any is written;\nit is refused where the record lists no tasks of that child.\n\n`intake` reads papers: the press takes files, an agent (`act_<alias>` among the app\'s\nagents) reads them, and each is filed as the record\'s line of its kind in the named\nchild \u2014 that child\'s title \u2014 or a new line, its file in the child\'s one files field.\nWhat they state of each field `fills` names is shown beside what the row holds; the save\nwrites only what differs \u2014 the record\'s fields, `<link>.<field>` on the row a required\none-row link names, a child\'s rows (one found by the child\'s `natural_key` changed, else\nadded) \u2014 each refused as its own save is, and nothing written while one refuses.\n\n```jsonc\n{ "alias": "read_papers", "label": "Read papers", "intake": "customer_paper", "fills": ["phone", "contact.email", "branch"] }\n```\n\n### Checks\n\n```jsonc\n"checks": [{ "field": "release_warning" }, { "field": "unpaid", "blocks": ["gate_out"] }, { "field": "locked", "blocks": ["edit"] }]\n```\n\n<!-- generated:start apps-checks -->\n\n#### Check\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `field` | alias | yes | A yes/no or text formula of the record (or of the child `of` names): true or non-empty means the check stands; its label is its short name on a row\'s line, and a text formula\'s words are the sentence the record and a tooltip say |\n| `of` | alias | no | A rows block\'s child entity this check is a formula of: standing on a child row, it refuses what it blocks of that row |\n| `blocks` | `"all"` \\| list of (alias \\| `"edit"` \\| `"delete"`) (at least one) | no | Acts, "edit" (the saves and the Delete), "delete" (the Delete alone) or "all" that the standing check refuses; absent, it only warns |\n| `resolve` | alias | no | An act of this app, on the rows the check stands on, that clears it: the check\'s line links to the act where it stands, and the act keeps its own conditions |\n\n<!-- generated:end apps-checks -->\n\n<!-- generated:start rules-check -->\n\n#### Rules the check enforces\n\n| Rule | |\n|---|---|\n| `check.field` | A check\'s `field` is a yes/no or text formula of the record, or of the child `of` names. |\n| `check.of` | A check\'s `of` names a child the record lists in a rows block. |\n| `check.not-placed` | A check\'s field is never also placed on the record \u2014 the line under the header says it. |\n| `check.blocks` | A check of the record blocks its acts, `"edit"`, `"delete"` or `"all"`; a check of a child blocks that row\'s saves, its Delete, the acts `of` that child, or all \u2014 never the record\'s acts. |\n| `check.resolve` | `resolve` names an act of this app on the rows the check stands on, pressed on one row, not refused by the check, and drawn as a button \u2014 never a correction. |\n| `check.restates-meter` | A warning reading a gated meter\'s figure against its bound or pass mark is refused \u2014 the meter draws it. |\n\n<!-- generated:end rules-check -->\n\nA check is a yes/no or text formula of the record: it stands while true or\nnon-empty, and a text formula\'s words are what the reader sees. Without `blocks`\nit warns; with them it refuses the acts named, `"edit"` the record\'s own saves (and\nits Delete), `"delete"` its Delete alone, or `"all"` \u2014 on the server, in every write it\nnames. A check `of` a rows block\'s child stands on each child row: it refuses that\nrow\'s saves (`edit`), its Delete (`delete`), the acts `of` that child it names, or\n`all` of them \u2014 never the record\'s acts. A warning reading the figure of a meter that\n`gates` marks against its bound or its pass mark is refused: the meter already draws it.\n\nThe check field\'s `label` is its short name \u2014 "Over budget", "Release expired": a row\'s\nline says it in the check\'s tone (the most severe of several, and how many more), while\nits words whole are the row\'s tooltip and stand under the record\'s header. So label it\nas the reader names the problem, in a few words, and let a text formula say the\nsentence. The compiler records the fields a formula reads: a row drawing each of them\nas a control says nothing of the check on its line (the empty control says it), and a\ncheck with no `resolve` links to the first of them the record draws.\n\n## What a run remembers\n\nThe WORKSPACE remembers what each entity, field, select option, role and\ntemplate alias became here, plus which record each first row landed on and the\nfile each document path was uploaded as. The model file itself holds no live id\n\u2014 it is the portable half, and the same file applies to a demo workspace and to\na customer\'s \u2014 so the join lives where the things it names live, and one model\napplied to two workspaces holds two bindings that know nothing of each other.\n\nIt is the workspace\'s and not the file\'s because a model file is never\ncommitted: memory kept beside it is one author\'s disk, absent for a teammate, on\na second machine or after a delete \u2014 and every one of those goes quietly back to\nbinding by label, which is what grows the second table.\n\nEvery later apply binds through it: it takes the remembered id first and falls\nback to a label only for an alias nothing has bound \u2014 a field you have just\nadded, or a workspace nothing has applied this model to. That is what makes a\nrelabel on EITHER side a rename rather than one thing the workspace lacks and\none the model lacks: `apply` binds the thing it has always meant and reports the\nmove \u2014 which side is right is yours to decide, not a reason to refuse the run.\n\nA bound target the workspace no longer holds IS a refusal, by name: re-binding\nto whatever carries that label today is how the model comes to point at\nsomebody else\'s table. `lotics run restore_table` puts a deleted table back.\n\n`lotics model pull` writes a workspace that already works as a model file \u2014 the\nstarting point for another business\'s model, never a source of truth: it carries\none business\'s words and stops describing that workspace the moment either\nchanges.\n\n## A complete model\n\n```json\n{\n "entities": [\n {\n "alias": "customer",\n "label": "Customers",\n "singular": "Customer",\n "fields": [\n { "alias": "name", "label": "Name", "type": "text", "required": true },\n { "alias": "logo", "label": "Logo", "type": "files" },\n {\n "alias": "tier",\n "label": "Tier",\n "type": "select",\n "options": [\n { "alias": "standard", "label": "Standard", "color": "slate" },\n { "alias": "gold", "label": "Gold", "color": "amber" }\n ],\n "default": ["standard"]\n },\n {\n "alias": "orders",\n "label": "Orders",\n "type": "select_record_link",\n "target_entity": "order",\n "cardinality": "many",\n "sync_both_ways": true,\n "paired_field_alias": "customer",\n "display_field_aliases": ["code"]\n },\n {\n "alias": "total_ordered",\n "label": "Total ordered",\n "type": "rollup",\n "source_field_alias": "orders",\n "aggregate_option": { "operation": "sum", "field_key": "amount" }\n }\n ],\n "views": [\n {\n "alias": "gold",\n "label": "Gold customers",\n "filters": {\n "node_type": "condition",\n "type": "select",\n "field_key": "tier",\n "operator": "has_any_of",\n "value": ["gold"]\n },\n "sort": [{ "field_key": "name", "order": "asc" }]\n }\n ]\n },\n {\n "alias": "order",\n "label": "Orders",\n "singular": "Order",\n "fields": [\n { "alias": "code", "label": "Order no.", "type": "text", "unique": true },\n { "alias": "placed_on", "label": "Placed on", "type": "date", "format": "date" },\n {\n "alias": "amount",\n "label": "Amount",\n "type": "number",\n "format": "currency",\n "currency": "VND"\n },\n {\n "alias": "total",\n "label": "Total with VAT",\n "type": "formula",\n "formula": { "expression": "{amount} * 1.1", "format": "currency", "currency": "VND" }\n },\n {\n "alias": "customer",\n "label": "Customer",\n "type": "select_record_link",\n "target_entity": "customer",\n "cardinality": "one",\n "sync_both_ways": true,\n "paired_field_alias": "orders",\n "display_field_aliases": ["name"]\n },\n { "alias": "note", "label": "Note", "type": "text" }\n ]\n }\n ],\n "roles": [{ "alias": "sales", "label": "Sales" }],\n "records": {\n "customer": { "title": "name", "image": "logo", "party": "organization", "figure": "total_ordered" },\n "order": { "title": "customer", "subtitle": ["code", "placed_on"], "figure": "amount", "starts": { "placed_on": "today" } }\n },\n "apps": [\n {\n "alias": "customers",\n "name": "Customers",\n "entity": "customer",\n "register": {\n "columns": ["tier"],\n "readings": [{ "breakdown": "customer", "by": "tier", "value": "total_ordered" }]\n },\n "record": {\n "sections": [\n { "title": "Account", "fields": ["tier"] },\n { "title": "Orders", "blocks": [{ "rows": "order", "columns": ["total"], "create": ["code", "amount"] }] }\n ]\n }\n },\n {\n "alias": "orders",\n "name": "Orders",\n "entity": "order",\n "register": {\n "filters": ["customer"],\n "create": ["code", "customer", "placed_on"],\n "readings": [{ "trend": "order", "over": "placed_on", "value": "amount" }]\n },\n "record": { "door": "drawer" }\n }\n ],\n "rows": {\n "customer": [\n { "ref": "acme", "fields": { "name": "Acme Trading", "tier": "gold" } },\n { "ref": "bluebird", "fields": { "name": "Bluebird Foods", "tier": "standard" } }\n ],\n "order": [\n {\n "ref": "so_1001",\n "fields": {\n "code": "SO-1001",\n "placed_on": "@month-start+2",\n "amount": 4200000,\n "customer": "customer:acme"\n }\n },\n {\n "ref": "so_1002",\n "fields": {\n "code": "SO-1002",\n "placed_on": "@today-3",\n "amount": 1150000,\n "customer": "customer:bluebird"\n }\n }\n ]\n }\n}\n```\n\nEach app of this file, as its reader will see it:\n\n```\nApp customers \u2014 "Customers" over Customers (customer)\n Register \u2014 table (default), newest first (default)\n row [Logo] \xB7 Name \xB7 figure Total ordered\n columns Tier\n filters \u2014\n readings "Tier" \u2014 Total ordered summed per Tier, over the rows in view (default)\n add Name (default)\n Record \u2014 a drawer (default)\n header image Logo \xB7 title Name \xB7 figure Total ordered\n checks \u2014\n header \u22EF Delete\n sections 1. "Account"\n fields Tier\n 2. "Orders"\n block Orders (default) \u2014 rows of Orders through Customer; columns Total with VAT; add asks Order no., Amount\n thread \u2014\n history \u2014\n acts \u2014\n Reads Customers, Orders\n\nApp orders \u2014 "Orders" over Orders (order)\n Register \u2014 table (default), newest first (default)\n row Customer \xB7 under it Order no., Placed on \xB7 figure Amount\n columns \u2014\n filters Customer\n readings "Amount" \u2014 Amount summed per period by Placed on, over the rows in view (default)\n add Order no., Customer, Placed on \u2014 starting Placed on at today\n Record \u2014 a drawer\n header title Customer \xB7 subtitle Order no., Placed on \xB7 figure Amount\n checks \u2014\n header \u22EF Delete\n sections 1. the record\'s details (default)\n fields Note\n thread \u2014\n history \u2014\n acts \u2014\n Reads Orders, Customers\n\n```\n\nEach `(default)` is a value the model left to the system: the door a record opens\nthrough \u2014 a drawer, since neither record has a stage or more than three sections \u2014 the\norder rows open in, what an add asks, and the order\'s one section \u2014 every field a\nperson writes that the header does not already show. The customer\'s orders\nare a block in its "Orders" section, never its own `Orders` link as a field as well:\none fact, one place. An order is titled by its customer and read by its number under\nit; the block names what its add asks, since a subtitle or a figure is never asked by\ndefault. `Total ordered` is a rollup, so it is read and never asked; the\norders app\'s record opens in a drawer, because its rows are worked one after another.\n';
37500
+ var model_reference_default = '# The Lotics workspace model (`model.json`)\n\nOne JSON file describing a workspace: its tables, fields, options, views, roles,\nfirst rows, how a row of each table is recognised, and the apps over them. Each \xA7\nis its own page at `model/<section>` \u2014 `lotics docs`, or the `docs` tool. Complete models of several trades, to read as\nworked examples: `https://lotics.ai/presets/index.json`.\n\n**What a model composes with**\n\n- **Entities and fields** (\xA7 Entity, \xA7 Field) \u2014 the tables, their columns, options and links.\n- **Records** (\xA7 Records) \u2014 how a row of each entity is RECOGNISED: its title, the line\n under it, its picture, its status, the one number it stands for. Stated once per entity\n and read by every surface that draws one of its rows.\n- **Write rules** (\xA7 Write rules) \u2014 what a write finds, copies, bounds and picks among.\n- **Apps** (\xA7 Apps) \u2014 one register over one entity and the record each row opens: which\n fields go where, the acts, and the checks that guard them \u2014 or a dashboard of readings.\n How each thing LOOKS is the runtime\'s, one treatment per concept; no key here changes it.\n A screen the job needs and no key states is a `lotics report` \u2014 the job, what the model\n drew, the word wanted \u2014 never keys bent to approximate it.\n\n**The working order**\n\n1. Name the people and each one\'s JOB \u2014 the work they alone decide or write.\n2. The entities and fields those jobs touch, and a `records` entry for every entity an\n app lists, opens or picks.\n3. One app per job in `apps[]`, each one register over one entity.\n4. `lotics model apply model.json` \u2014 the file is checked first, every problem in one run;\n then the tables, then a new version of every app, live\n (`lotics setup model.json --email you@company.com` where no account exists yet).\n5. Change the file and apply it again; `lotics model pull` writes what the workspace holds.\n Rolling an app back (`lotics run rollback_app`) restores its earlier version \u2014 table\n changes and data writes stay.\n\n## The rules\n\n- **At least one entity, at most 50.** More tables than that is a data model\n being designed, not applied \u2014 apply the rest in a second call.\n- **An existing table is adopted.** `lotics model apply` binds an entity whose `label`\n already names a table in the workspace, and adds the fields, options and\n views it is missing. No stored value is ever changed or deleted: a field it\n adopts takes the model\'s `default`, and the `format` and `unit` it reads in,\n where that only relabels \u2014 a date\'s format and a unit converting its figures are\n left. Applying the same model twice changes nothing the second time.\n- **Renaming a field is `lotics run update_table`**, then the same label in this\n file; deleting is `lotics run delete_table`. Neither goes through the file\n (\xA7 What a run remembers).\n- **The file\'s own majority is the language.** A model names no locale \u2014 which\n language it is in is what it mostly says, and `model apply` notes the label\n written the other way. The generated screens read the kit\'s pack, and a\n generated WRITE cannot: its refusals run on the server, so they are worded in\n that same majority. Mix the two and the workspace answers in two languages.\n- **Rows land only where every bound table is empty.** One table already holding\n records and no rows are written anywhere: sample rows landing among a\n customer\'s real ones cannot be told apart from them.\n- **`lotics model apply` checks all of it before anything is written**, and\n reports every problem in one run rather than the first. Each section of this\n page ends its keys with the rules the check enforces there, one sentence each\n under an id; a finding names its rule\'s id (`[register.filter]`), and\n `model/<rule id>` is that one rule\'s page.\n\n<!-- generated:start rules-model -->\n\n#### Rules the check enforces\n\n| Rule | |\n|---|---|\n| `model.schema` | Every key is one its table lists, holding the type its row gives, and every required key is stated. |\n| `model.retired` | `field_roles`, `table_workflows` and `connections` are no longer part of a model: `records` states how a row is recognised, and an app\'s own writes do what a table automation did. |\n| `model.names-declared` | Every alias a key names is declared: an entity of this model, a field of the entity the key reads, an option of the select it names, an act of the app, a template or an app of this model. |\n| `model.tables` | A model declares at least one table and at most 50; apply the rest as a second model. |\n| `model.rows-cap` | Rows are a sample: at most 200 per entity, 2000 per model and 2000 documents attached \u2014 a real data set belongs in an import. |\n| `model.language` | *Noted, never refused:* A label or description written in the other language than the model\'s majority \u2014 with or without diacritics. |\n| `model.alias-unique` | An alias is unique where it is named: entities, roles and templates in the model, fields and views in their entity, options in their select. |\n| `model.label-unique` | A label is unique where apply finds it by label: entities, roles and templates in the model, fields and views in their entity, options in their select \u2014 and no view takes its entity\'s own label, which names the whole-table grid apply makes. |\n| `model.template-sha` | A template\'s `content_sha256`, where stated, is the 64-character lowercase hex sha256 of its content. |\n| `model.template-kind` | An act makes its document from an html template; a register\'s `export` fills an html or an excel one. |\n| `model.filter` | A filter \u2014 a view\'s, a rollup\'s \u2014 tests fields of the entity it reads, through links as `entity.field` hops each standing on the entity the last lands on, by options its select declares. |\n\n<!-- generated:end rules-model -->\n\n## Top level\n\nEvery table of keys on this page is generated from the schema `model apply`\nparses the file with, so it is the whole of what a key may hold.\n\n<!-- generated:start top-level -->\n\n#### Model file\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `entities` | list of [Entity](#entity) | yes | The tables this model creates, with their fields, options and views |\n| `roles` | list of [Role](#role) | no | Workspace groups to create; members are added to them afterwards |\n| `templates` | list of [Template](#template) | no | Document templates: html and email inline, excel made from an uploaded workbook |\n| `rows` | map of alias \u2192 list of [Row](#row) | no | First records, keyed by entity alias \u2014 written only where every table they land in is empty |\n| `records` | map of alias \u2192 [Record](#record) | no | How a row of each entity is recognised, keyed by entity alias. Every entity an app lists, opens or picks has one |\n| `write_rules` | map of alias \u2192 [Entity write rules](#entity-write-rules) | no | Entity alias \u2192 what a create of that entity finds, copies and refuses |\n| `apps` | list of ([App](#app) \\| [Dashboard app](#dashboard-app)) | no | The apps this workspace will have \u2014 each one register over an entity, or a dashboard of readings |\n\n<!-- generated:end top-level -->\n\n**A model carries no** `fixtures`, `knowledge` or `knowledge_expects`, and no\n`word` / `pdf-form` template: file content is uploaded to the workspace, never\nstated in a model \u2014 an `excel` template names its uploaded workbook by `file_id`. `apps` here is what an agent states to make an app,\nnever built code. An unknown top-level key is an error, never ignored.\n\n### Aliases\n\nEvery `alias` is a lowercase slug \u2014 a letter, then letters, digits and\nunderscores (`unit_price`, `so_1001`). Aliases are how the file cross-references\nitself; they are never shown to anyone. `label` is what a person sees.\n\nLabels must be unique within their namespace \u2014 two entities, two fields on one\nentity, two options on one field, two views on one entity, two roles or two\ntemplates cannot share a label, because `apply` matches by label.\n\n## Entity\n\n<!-- generated:start entity -->\n\n#### Entity\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `alias` | alias | yes | Stable entity alias, unique within the contract |\n| `label` | text | yes | The table\'s name in the workspace, which apply names it |\n| `singular` | text | no | One row of this table, in the business\'s own words \u2014 what a create\'s button and panel name |\n| `description` | text | no | The table\'s description, written onto the table in the workspace |\n| `writes` | `false` | no | false: no person writes this table\'s rows \u2014 only the writes that keep it do, and no app opens or edits one |\n| `fields` | list of [Field](#field) (at least one) | yes | The table\'s columns |\n| `read_scope` | [Read scope](#read-scope) | no | Which rows a member reads. Absent, every member with access to the table reads every row. |\n| `unique` | list of list of alias (at least one) (at least one) | no | Sets of fields whose values no two live rows share \u2014 each a list of field aliases (text, number, date, a single select, or a link of cardinality "one"). A create or update landing a second row with the same values is refused. |\n| `views` | list of [View](#view) | no | Saved views, in the order they are listed; with none, the table still opens on its default grid |\n\n#### Read scope\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `any` | list of ([Read scope by role](#read-scope-by-role) \\| [Read scope by member](#read-scope-by-member) \\| [Read scope by option](#read-scope-by-option)) (at least one) | yes | A row is readable when ANY of these holds |\n\n#### Read scope by role\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `member_of` | alias | yes | A role alias: whoever is in the group it binds to reads the row |\n\n#### Read scope by member\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `through` | list of alias (1\u20133) | no | select_record_link aliases from this entity outward, each of cardinality "one" \u2014 the clause\'s field is on the entity the last hop lands on |\n| `field` | alias | yes | A select_member field alias on this entity, or on the entity `through` lands on |\n| `is` | `"self"` | yes | The members this column names on a row read that row |\n\n#### Read scope by option\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `through` | list of alias (1\u20133) | no | select_record_link aliases from this entity outward, each of cardinality "one" \u2014 the clause\'s field is on the entity the last hop lands on |\n| `field` | alias | yes | A single-select field alias on this entity, or on the entity `through` lands on |\n| `is` | list of alias (at least one) | yes | Its option aliases whose rows are readable \u2014 naming none would hide every row |\n\n<!-- generated:end entity -->\n\n<!-- generated:start rules-entity -->\n\n#### Rules the check enforces\n\n| Rule | |\n|---|---|\n| `entity.singular` | An entity a create is mounted over \u2014 a register that adds, a rows block \u2014 states its `singular`: one row of it, in the business\'s words. |\n| `entity.required-cycle` | Required links never wait on each other in a loop: no row of the loop could be created first. |\n| `entity.link-format` | A text field of `format: "link"` holds web addresses; one whose rows hold a phone or a mail address states no format. |\n| `entity.read-scope` | A `read_scope` clause names a declared role (`member_of`) or a field of its entity reached through one-row links: `"self"` a member field, options a single select declares. |\n| `entity.unique` | A `unique` set names two fields or more of its entity once each, each holding one value to compare \u2014 text, a number, a date, a single select, a one-row link \u2014 and is stated once; one field alone is `unique: true` on it. |\n\n<!-- generated:end rules-entity -->\n\n**`unique` is a set of values no two live rows share.** Each entry names fields\nof this entity holding ONE value \u2014 text, number, date, a single select, a link\nof cardinality `"one"` \u2014 and a create or update landing a second row with the\nsame values is refused. A set of one text field is that field\'s own `unique:\ntrue`, so it is refused here. A create carries each set in the names its panel\nsends, so the panel can name the duplicate before the write does.\n\n**`singular` is what a create says** \u2014 `New Order`, `Add Claim line`, `H\u1ED3 s\u01A1\nm\u1EDBi` \u2014 while `label` names the table, so without it the button reads `New\nOrders`. Nothing derives it: English plurals are irregular, and no language is\nexempt. In a language without plural forms it is usually the label itself,\nless any word for the collection. `model apply` REFUSES a model where a table\nsome create opens \u2014 a register\'s own, or a record section\'s add \u2014 states none.\n\n**`writes: false` says only the workspace\'s automations write these rows** \u2014 a\nlog of what the system sent, a copy of what another system holds. No app opens,\nedits or files one: a record listing them keeps the section and opens each row\nat rest, with no Add; a screen over the entity operates at most the rows its\nrecord owns; a party of it is picked, never found or minted; and the generator\nwrites no create and no update for it, and never notes it as created nowhere.\nA `lifecycle` on it is refused \u2014 a row walked\nthrough stages is worked by a person \u2014 and so is a publish desk over it. Absent,\npeople write the rows; `true` is not a value.\n\n**`read_scope` is a ROW rule, enforced by the platform.** It is resolved at\napply into the table\'s own row filters, so an app, a workflow reading for a\nviewer, and the API all answer the same rows \u2014 a per-record visibility field the\napp merely honours is a convention, not a gate. A `"self"` clause reads a column\nof one member or several, and every role alias and option alias a clause names\nmust be one this model declares. `apply` writes the rule onto a table it\nCREATES; a table it adopted that ALREADY CARRIES a rule keeps that one, because\nthe rule is the workspace\'s own statement about its rows \u2014 and a run whose model\nstates a different rule reports the entity rather than leaving the claim silent.\n\n**An app may state that its sharing is its read gate: `"reads": "shared"`.** An\napp reads as its owner, so the rule reaches a viewer only as the predicate every\nquery and editor guard of every app over the entity carries \u2014 right for a desk of\none\'s own rows, wrong for a desk whose audience its sharing already decides, where\nwidening the rule meant a role group nobody remembers to fill. Stated on an APP,\nits queries, pickers and guards carry no entity\'s rule and whoever the app is\nshared with reads and writes every row it draws; every other app and the table\'s\nown filters keep the rule. Share it deliberately. Refused on an app none of whose\ntables states a `read_scope`.\n\n**The rows under a private record INHERIT its rule.** An entity that states no\n`read_scope` and hangs under one that does \u2014 through its `parent` link, over one\nhop or several \u2014 is read by the ancestor\'s rule, answered through that link, on\nits table\'s own filters and in every query and guard alike; nothing is restated,\nso a child needs none of the ancestor\'s columns. Stating a rule on the child\nkeeps that one instead, an ancestor with no rule passes nothing down, and a row\nhanging further under the scoped one than a row filter reaches is refused by\nname \u2014 state a rule on it. So is a hop over a link that names more than one row:\nthe rule would admit a reader any one of them admits while the editor\'s guard\nreads the first, so give the link `"cardinality": "one"` or state a rule on the\nchild.\n\n**ONLY the `parent` role is walked.** A register a scoped record reaches by any\nother link \u2014 the rows that NAME it \u2014 is read by that record\'s id with no rule\ntravelling to it, so it is refused until it states one of its own.\n\n## Field\n\nEvery field carries the keys below, and its `type`\'s section adds the rest; a\ntype whose section names no `default` takes none. `label` may not contain `{` or\n`}` (formulas reference fields by label at the platform level). Every row in `rows` states each\n`required` field it carries (a default is not applied to them), and a required\nLINK is written with its row: the entity it names is created first, and entities\nwhose required links name each other are refused, since none of their rows could\never be created.\n\n<!-- generated:start field -->\n\n#### Field\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `type` | `"text"` \\| `"number"` \\| `"date"` \\| `"boolean"` \\| `"select"` \\| `"select_member"` \\| `"select_record_link"` \\| `"files"` \\| `"formula"` \\| `"rollup"` \\| `"lookup"` \\| `"autonumber"` | yes | What the field holds \u2014 each type takes the further keys its own section lists |\n| `alias` | alias | yes | Stable local alias, unique within the entity |\n| `label` | text | yes | The field\'s name in the workspace, which apply names it |\n| `description` | text | no | The field\'s description, written onto the field in the workspace |\n| `required` | boolean | no | Refuse a record whose cell for this field is empty. Apply writes it onto the field, and every write path \u2014 create, update, an agent\'s tool call, a workflow\'s set \u2014 refuses the row by field name. |\n\n<!-- generated:end field -->\n\n### `text`\n\n<!-- generated:start field-text -->\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `default` | text | no | Value pre-filled into a new record when none is supplied for this field. Applied on create only \u2014 existing records are never backfilled. |\n| `unique` | boolean | no | Unique values required |\n| `format` | `"text"` \\| `"link"` \\| `"markdown"` | no | How the words are drawn \u2014 plain, as a link that opens, or as markdown |\n\n<!-- generated:end field-text -->\n\n### `number`\n\n<!-- generated:start field-number -->\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `default` | number | no | Value pre-filled into a new record when none is supplied for this field. Applied on create only \u2014 existing records are never backfilled. |\n| `format` | `"number"` \\| `"currency"` \\| `"percentage"` | no | What the figure is \u2014 a plain number, money in `currency`, or a percent |\n| `currency` | text | no | ISO 4217 code |\n| `unit` | text | no | What a plain figure counts or measures, drawn after it: a measured code (g, kg, t, l, m3, cbm, mm, cm, m, km, m2, min, h, day), which converts and scales within its dimension, or any other noun of at most 12 characters (ki\u1EC7n, pallet, TEU), which never does. Only beside format "number". |\n| `unit_field` | alias | no | A single select on the same row, or a lookup of one through a one-link, whose chosen option is that row\'s unit: every option label is a unit as `unit` takes one. In place of `unit`; only beside format "number". |\n| `currency_field` | alias | no | A single select on the same row, or a lookup of one through a one-link, whose chosen option is that row\'s currency: every option label is an ISO 4217 code. In place of `currency`; only beside format "currency". |\n\n<!-- generated:end field-number -->\n\n`format` is what the number IS, and every surface reads it: `currency` prints as\nmoney in the code the row or the field states, `percentage` as a whole percent\nwith its sign. An ABSENT number is drawn absent \u2014 the one exception is a\n`sum` or count rollup the plan reads as a **`measure`**: that is the thing\naccumulated toward a bound, so nothing accumulated yet is zero and the meter\ndraws it. The same rollup read as an `amount` keeps its blank, and so does every\nother role: nothing added to what a row is WORTH means unpriced, not free. A\nformula reading only such sums and counts, and reading zero where each does\n(`{received} - {refunded}`), is one too. A `min`, an `avg`, a percentage of\nnothing and every other formula stay blank in any role, because none of them has\nan answer to give. This is why the pair on one\nscreen reads two ways \u2014 what has come in against what is owed \u2014 and why a\nmeasure\'s own LIMIT, an amount, leaves an unquoted row out of the count rather\nthan reporting it as nothing collected. **AND WHERE THAT LIMIT IS ABSENT \u2014 OR\nZERO \u2014 THERE IS NO LEVEL AT ALL**: a level is a reading AGAINST a bound, so a row\nthat states no bound, or a bound of nothing, draws nothing \u2014 cell, fact and all \u2014\nrather than a numerator whose whole meaning was the comparison. "Collected 0"\nbeside a blank total reads as money against a job worth nothing, and "0 of 0"\nagainst a count of nothing owed claims a comparison nobody can make. A measure the model gives no limit is a plain figure\nand is unaffected. A share is stored in percent units \u2014 68.1 is 68.1 % \u2014 and the\ncolumn, the fact behind it, the meter it is judged by and the figure over the\nregister all say so.\n\n`unit` is what a plain figure counts or measures, and stands only beside\n`format: "number"`. A **measured** unit is a code of one catalog \u2014 mass `g`\n`kg` `t`, volume `l` `m3` `cbm` (a cubic metre under freight\'s name), length\n`mm` `cm` `m` `km`, area `m2`, duration `min` `h` `day` \u2014 so a figure typed in\nanother unit of its dimension converts (`12,5 t` into a `kg` field is 12 500),\nand a tile or a chart reads it in the largest unit it reaches (12 500 kg as\n12,5 t\u1EA5n; CBM never scales) while a cell, a fact and a column always read in the\nfield\'s own. Any other noun of at most 12 characters (`ki\u1EC7n`, `pallet`, `TEU`) is a\n**counted** unit: a word after the figure that never converts. A measured unit is\nwritten as its code \u2014 `t\u1EA5n`, `KG` or `m\xB3` is refused, naming the code. A formula\nstates its own in `formula.unit`; a rollup that keeps the value (`sum`, `avg`,\n`median`, `min`, `max`, `range`) and a lookup carry the unit of the figure they\nread, exactly as they carry a currency, and a count carries none. A quantity is a\nnumber with its unit, never words (`3 cartons` in a text field): only a number\nsums, converts and reads down a column.\n\nA field\'s cells always hold figures in its own unit, so moving it between two\nunits of one dimension (`kg` to `t`) converts every stored figure \u2014 a change made\nin the workspace, in the field\'s settings (which say how many first) or through\n`lotics run update_table`. `model apply` never makes it: the model states the\nworkspace\'s unit until then. Any other change of unit\nrelabels.\n\nA figure whose unit or currency varies by row names a single select of its own\nrow in `unit_field` or `currency_field` (a formula in `formula.unit_field` /\n`formula.currency_field`) \u2014 or a lookup of one through a one-link, a line\nreading its shipment\'s currency. That select\'s options are the vocabulary:\neach label a unit as `unit` takes one (`chi\u1EBFc`, `kg`), or an ISO 4217 code\n(`USD`). A label outside it is refused when the figure is written and when the\nselect is \u2014 its options, its type or its deletion while a figure names it. A row\nwhose select is empty reads its figure bare. Every app reads each row\'s figure in\nits own row\'s unit, and a sum never mixes units: totals are one per unit, a\nchart draws one at a time. A rollup that keeps the value (`sum`, `avg`, `min`\u2026)\nover such a figure stands only where the child\'s select is a lookup, through\nthe rollup\'s own link, of a select on this entity \u2014 the rollup reads that\nselect\'s unit; otherwise it is refused, as is any lookup of such a figure (its\nunit lives on the other row). A count is unaffected. Moving a field between a\nfixed and a per-row unit relabels.\n\n### `date`\n\n<!-- generated:start field-date -->\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `default` | text | no | Value pre-filled into a new record when none is supplied for this field. Applied on create only \u2014 existing records are never backfilled. A date string in the field\'s format. |\n| `format` | `"date"` \\| `"datetime"` \\| `"date_range"` \\| `"datetime_range"` | no | Whether the field holds a day or a moment, alone or as a span |\n| `timezone` | text | no | IANA timezone |\n| `derive_from` | `"created_at"` \\| `"updated_at"` | no | Auto-populate from the row\'s system timestamp; the field becomes read-only. |\n\n<!-- generated:end field-date -->\n\nA `default` is refused beside `derive_from`: the platform stamps that date.\n\n### `boolean`\n\n<!-- generated:start field-boolean -->\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `default` | boolean | no | Value pre-filled into a new record when none is supplied for this field. Applied on create only \u2014 existing records are never backfilled. |\n\n<!-- generated:end field-boolean -->\n\n### `select`\n\n<!-- generated:start field-select -->\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `default` | list of alias | no | Value pre-filled into a new record when none is supplied for this field. Applied on create only \u2014 existing records are never backfilled. Option alias(es) this field declares \u2014 one for single-select. |\n| `options` | list of [Select option](#select-option) (at least one) | yes | The choices, in the order every picker and every ladder lists them |\n| `multi` | boolean | no | Allow multiple selections |\n\n#### Select option\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `alias` | alias | yes | Stable local alias, unique within the field |\n| `label` | text | yes | Display label for the option |\n| `color` | [colour](#select) | yes | The colour the option\'s badge is drawn in |\n| `mark` | [mark](#select) | no | The option\'s own mark, drawn in place of its colour dot wherever the option is shown: the brand it is ({kind: "brand", name: one of facebook, instagram, threads, meta, tiktok, google-ads, zalo, linkedin, x, google-meet, youtube, telegram, whatsapp, gmail, google-drive, outlook, kiotviet, misa, lark, payos}) or a kit glyph ({kind: "icon", name: "wrench"}). Every option of a field has one, or none does. A mark a reader does not draw falls back to the dot |\n\n<!-- generated:end field-select -->\n\n`color` is one of: `red`, `orange`, `amber`, `yellow`, `lime`, `green`,\n`emerald`, `teal`, `cyan`, `sky`, `blue`, `indigo`, `violet`, `purple`,\n`fuchsia`, `pink`, `rose`, `slate`, `gray`, `zinc`, `neutral`, `stone`.\nEvery option is drawn in its colour wherever it shows \u2014 a cell, a row\'s line,\na record, a picker, the bar a reading splits the rows by.\n\nAn option may carry its own `mark`, drawn in place of its colour dot wherever\nthe option is shown \u2014 a stage, a chip, a filter, a fact, an entry of a log, a\nreading\'s part, a lookup of the select on another entity. A select a reader scans\ndown a column \u2014 how a payment was made, the channel, the mode \u2014 states one on every\noption, since a glyph reads before its word: the brand it IS\n(`{"kind": "brand", "name": "tiktok"}` \u2014 one of `facebook`, `instagram`,\n`threads`, `meta`, `tiktok`, `google-ads`, `zalo`, `linkedin`, `x`,\n`google-meet`, `youtube`, `telegram`, `whatsapp`, `gmail`, `google-drive`,\n`outlook`, `kiotviet`, `misa`, `lark`, `payos`), or a glyph the kit draws\n(`{"kind": "icon", "name": "wrench"}`; any other name is refused). Every option of a select has one, or none does: a run of chips\nwhere one carries no mark reads as the one missing something. `apply` writes the\nmarks onto the table, sets one an adopted option lacks, and reports one it wears\ndifferently rather than overwrite it. The glyphs:\n\n<!-- generated:start field-select-glyphs -->\n\nactivity, align-center, align-left, align-right, arrow-down, arrow-down-up, arrow-down-wide-narrow, arrow-left, arrow-left-from-line, arrow-right, arrow-right-from-line, arrow-right-left, arrow-up, arrow-up-down, arrow-up-wide-narrow, ban, banknote, bed, bell, bold, bolt, book-marked, book-open, book-text, bot, box, brackets, brain, briefcase, building-2, calculator, calendar, calendar-clock, calendar-off, camera, car, chart-column, check, chevron-down, chevron-left, chevron-right, chevron-up, chevrons-down-up, chevrons-up-down, circle-alert, circle-check, clipboard-list, clock, code, code-xml, columns-3, columns-3-cog, construction, container, copy, credit-card, database, download, ellipsis, eraser, expand, external-link, eye, eye-off, facebook, file, file-csv, file-down, file-question, file-spreadsheet, file-stack, file-text, file-up, folder, folder-closed, folder-open, folder-pen, form, funnel-plus, funnel-x, gauge, globe, gpu, grip-vertical, group, hand-coins, heading, heading-1, heading-2, heading-3, history, house, image, inbox, info, instagram, italic, keyboard, languages, layout-dashboard, layout-grid, library-big, link-2, link-2-off, linkedin, list, list-checks, list-collapse, list-filter, list-filter-plus, list-ordered, loader, lock, lock-keyhole, lock-keyhole-open, lock-open, log-in, log-out, mail, map-pin, maximize-2, megaphone, menu, message-circle, message-circle-question-mark, message-square, messages-square, mic, minimize-2, minus, monitor, mouse, mouse-pointer-click, music, newspaper, notepad-text-dashed, package, paint-bucket, palette, panel-left, panel-left-close, panel-left-open, panel-right, panel-right-close, panel-right-open, paperclip, pause, pencil, phone, pin, pin-off, plane, play, plug, plus, receipt, rectangle-ellipsis, redo, refresh-cw, repeat, rotate-ccw, rotate-cw, scan, search, send, settings, share, share-2, shield, shield-alert, shield-check, shopping-cart, sliders-horizontal, smile, smile-plus, sparkles, split, square, square-check, square-pen, square-sigma, stethoscope, sticky-note, table, table-2, tag, target, text-quote, thumbs-down, thumbs-up, ticket, trash, trending-down, trending-up, triangle-alert, truck, tv-minimal, twitter, underline, undo, upload, user, user-check, user-pen, users, utensils, waypoints, workflow, wrench, x, zap\n\n<!-- generated:end field-select-glyphs -->\n\n```jsonc\n"options": [\n { "alias": "short_video", "label": "Short video", "color": "zinc", "mark": { "kind": "brand", "name": "tiktok" } },\n { "alias": "print", "label": "Print", "color": "amber", "mark": { "kind": "icon", "name": "newspaper" } }\n]\n```\n\n### `select_member`\n\nA person picker over the workspace\'s members. No default: a model cannot name\nmembers of a workspace that does not exist yet. With no role it is still drawn \u2014\nface and name, ranked as a `party` \u2014 in a screen\'s `columns` and in the register\na record draws of these rows.\n\n<!-- generated:start field-select_member -->\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `multi` | boolean | no | Allow multiple selections |\n\n<!-- generated:end field-select_member -->\n\n### `select_record_link`\n\n<!-- generated:start field-select_record_link -->\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `target_entity` | alias | yes | Alias of the entity this field links to |\n| `sync_both_ways` | boolean | no | Create a paired link field on the target entity for bidirectional sync |\n| `paired_field_alias` | alias | no | The pair edge of a bidirectional link: the field alias ON THE TARGET ENTITY that is this link\'s sync partner. Both sides of a pair carry it, each naming the other. Apply creates whichever side it reaches first WITH the pairing (the platform auto-creates the partner) and binds the partner alias to the auto-created field \u2014 without this edge the two contract fields would be created independently and collide with the auto-created partner. |\n| `cardinality` | `"one"` \\| `"many"` | no | How many linked records this field holds. Default \'many\'. \'one\' holds a single row and needs no partner; where the link IS paired, the partner side holds many. |\n| `display_field_aliases` | list of alias | no | Field aliases on the target entity shown as the link\'s display text / picker columns |\n\n<!-- generated:end field-select_record_link -->\n\nA two-way link is declared on BOTH sides, each naming the other as its\n`paired_field_alias`; the pair must be symmetric or the model is refused.\n\n**A single-valued link needs no partner.** `"cardinality": "one"` on its own is a\nlink that holds one row \u2014 one customer on an invoice, one project on a device \u2014\nand nothing is created on the target. The mirror invariant belongs to a PAIRED\nlink: pair a link when the target\'s own record should list what points at it, and\nleave it unpaired when it should not. Either way the record plan draws the\nrelation as a section on the side it points at, so an unpaired link costs the\ntarget nothing.\n\n### `files`\n\nNo keys beyond every field\'s; a row attaches documents to it (\xA7 Rows). Each file\nis drawn by its kind, with no key to choose: a picture (an image, a video) as its\nthumbnail, a document (a PDF, a sheet) as its type\'s badge and its filename.\n\n### `formula`\n\n<!-- generated:start field-formula -->\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `formula` | [Formula](#formula) | yes | Formula config. The expression references other fields on the SAME entity by alias in braces, e.g. `{quantity} * {unit_price}`. |\n\n#### Formula\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `expression` | text | yes | The expression, over fields of THIS entity by alias in braces \u2014 `{quantity} * {unit_price}` |\n| `format` | `"number"` \\| `"currency"` \\| `"percentage"` \\| `"link"` | no | Display format. \'number\' / \'currency\' / \'percentage\' for numeric results; \'link\' for text-output formulas that return a URL \u2014 renders the result as a clickable link. |\n| `currency` | text | no | ISO 4217 currency code, e.g. USD, VND, EUR |\n| `unit` | text | no | What a plain figure counts or measures, drawn after it: a measured code (g, kg, t, l, m3, cbm, mm, cm, m, km, m2, min, h, day), which converts and scales within its dimension, or any other noun of at most 12 characters (ki\u1EC7n, pallet, TEU), which never does. Only beside format "number". |\n| `unit_field` | alias | no | A single select on the same row, or a lookup of one through a one-link, whose chosen option is that row\'s unit: every option label is a unit as `unit` takes one. In place of `unit`; only beside format "number". |\n| `currency_field` | alias | no | A single select on the same row, or a lookup of one through a one-link, whose chosen option is that row\'s currency: every option label is an ISO 4217 code. In place of `currency`; only beside format "currency". |\n| `options` | list of [Select option](#select-option) (at least one) | no | The categories the formula yields, drawn as a single select\'s options are (read-only). The expression yields one of them as `{this_field:option}`, or null \u2014 `{days_idle} > 30 ? {warmth:cold} : {warmth:hot}`. Omit for a formula yielding a plain value. |\n| `output_type` | `"number"` \\| `"text"` \\| `"date"` \\| `"datetime"` \\| `"boolean"` \\| `"select"` | no | What the expression YIELDS \u2014 the kind the platform infers at write time, declared here so the offline checks can read it. `format` beside it is how that result is drawn, not what it is. Ignored on the wire (the platform re-infers it); `lotics model pull` writes the inferred value. |\n\n<!-- generated:end field-formula -->\n\n`output_type` is what lets a role or a screen clause accept a computed value: a\ncaption over a derived name (`output_type: "text"`), a period over a settled date\n(`"date"`). A formula declaring neither it nor a `format` says nothing about its\nresult, and every rule that needs one refuses it by name. A formula stating\n`options` is a computed category: read-only, and read as a single select\nwherever it is drawn \u2014 a column, a filter, a reading\'s `by` or `where`.\n\n**A select reaches a formula as the KEYS of its chosen options**, a list \u2014\nnever their labels, and never their aliases \u2014 and a model has no keys: the\nworkspace mints them when the table is made. So an option is named in a formula\nas `{field:option}`, both aliases, and the copy writes that option\'s key in its\nplace: `includes({kind}, {kind:crate})` for a select holding one or several,\n`{kind}[0] == {kind:crate}` for a single one. A select compared to its own words\n(`{kind} != "Crate"`) matches no row and computes the other branch everywhere,\nso the check refuses it and names the token. A select looked up from another\nentity is tested there, in a formula of its own, and that result looked up.\n\n**The language.** The offline check and the platform compute a formula with one\nengine, and the check refuses a call or a name it cannot run, naming what to write:\n\n<!-- generated:start field-formula-language -->\n\n- Operators: `+ - * / %`, `== != > < >= <=`, `&& || !`; `+` also joins text\n- Conditionals: a ternary only \u2014 `{amount} > 100 ? "High" : "Low"`\n- Not supported: optional chaining (`?.`), nullish coalescing (`??`), template literals, arrow functions \u2014 use `get(obj, "path", default)`, `coalesce(v1, v2)`\n- Helpers are these names, spelled exactly; a spreadsheet function (`IF`, `SUM`, `LEN`, `DATEDIF`) is none of them, and a formula calling one is refused\n- Math: round(n,decimals?), ceil(n), floor(n), abs(n), min(a,b), max(a,b), sum(arr), mean(arr), clamp(n,min,max), percentage(part,total,decimals?), pow(base,exp), sqrt(n), mod(n,divisor)\n- Strings: upper(s), lower(s), trim(s), capitalize(s), length(s), contains(s,search), join(arr,sep), split(s,sep), replace(s,search,rep), replaceAll(s,search,rep), startsWith(s,prefix), endsWith(s,suffix), substring(s,start,end?), padStart(s,len,char), padEnd(s,len,char), numberToWords(n)\n- Lists: includes(list,value), first(list), last(list), unique(list), compact(list) \u2014 length(list) counts one\n- Dates: now(), formatDate(d,fmt), addDays(d,n), subDays(d,n), addHours(d,n), subHours(d,n), addMinutes(d,n), subMinutes(d,n), startOfDay(d), endOfDay(d), differenceInCalendarDays(later,earlier), differenceInHours(later,earlier), differenceInMinutes(later,earlier), isBefore(d1,d2), isAfter(d1,d2), isSameDay(d1,d2), isToday(d), isWithinRange(d,start,end), parseDate(d)\n- Null/type: isNull(v), isEmpty(v) (also true for "" and []), coalesce(v1,v2,...), isString(v), isNumber(v), isBoolean(v), isArray(v), toNumber(v), toString(v)\n- Other: formatCurrency(amount,locale,currency), formatDecimal(value,decimals,locale) (grouped quantity, no symbol), get(obj,"path",default?)\n- Empty cells: a cell nobody filled is null inside a formula, whatever its type; one holding 0, false or "0" is not empty. Test it with `isEmpty({note})` \u2014 `{note} == ""` and `{done} == false` are false on an unset cell\n- Arithmetic over an empty cell: `+` and `-` read it as 0 beside a value (`{fee} + {surcharge}` is `{fee}` when the surcharge is empty, null when both are); `*`, `/`, `%` and a unary `-` yield null (`{price} * {qty}` is null, not 0, when the quantity is empty)\n- No helper throws on an empty cell: the math helpers and toNumber return null, the string helpers "". A value of the wrong type still errors. When EVERY field a formula reads is empty it is null \u2014 unless it reads each only as the argument of isEmpty, isNull or isNotNull (`!isEmpty({file})` is false there, not null)\n\n<!-- generated:end field-formula-language -->\n\n### `rollup`\n\nAggregates the records reached through a link on this entity.\n\n<!-- generated:start field-rollup -->\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `source_field_alias` | alias | yes | Alias of a select_record_link field on this entity to roll up from |\n| `aggregate_option` | [aggregation](#rollup) | yes | Aggregation operation. Its `field_key` names a field alias on the linked entity. |\n| `filter` | [filter](#views) group | no | Only linked records matching this filter are aggregated; one condition on its own is a group of one. Every `field_key` in it names a field alias on the linked entity, and a select condition\'s value names an option alias there. A traversal node reaches past that entity, so its `path` hops and inner `field_key` are fully-qualified `entity.field` aliases. |\n\n<!-- generated:end field-rollup -->\n\n`aggregate_option` is `{ "operation": \u2026, "field_key": \u2026 }` \u2014 `field_key` a field\nalias on the linked entity (`count` may omit it), and `operation` one of `count`,\n`sum`, `avg`, `median`, `min`, `max`, `range`, `empty`, `filled`,\n`percent_empty`, `percent_filled`, `unique`, `percent_unique`, `earliest`,\n`latest`, `date_range`, `checked`, `unchecked`, `percent_checked`,\n`percent_unchecked`. The operation must be one the aggregated field\'s type\nallows \u2014 `sum` over a number, `earliest` over a date, `filled` over any stored or\nformula field. A lookup is never rolled up: roll up the child\'s own field, or a formula\nover it.\n\n### `lookup`\n\nDisplays a field from the linked records.\n\n<!-- generated:start field-lookup -->\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `source_field_alias` | alias | yes | Alias of a select_record_link field on this entity to look up through |\n| `lookup_field_alias` | alias | yes | Alias of the field on the linked entity to display |\n| `order_by` | [Lookup order](#lookup-order) | no | Show ONE linked row\'s value \u2014 the first in this order \u2014 rather than every linked row\'s |\n\n#### Lookup order\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `field_key` | text | yes | A field alias on the linked entity the rows are ordered by |\n| `direction` | `"asc"` \\| `"desc"` | yes | Which end of that order the one row is taken from |\n\n<!-- generated:end field-lookup -->\n\nInside a formula, a lookup holding one value is that value (`{due_soon}` is\n`true`, not `[true]`); several values are a list.\n\n### `autonumber`\n\n<!-- generated:start field-autonumber -->\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `prefix` | text | no | Literal prefix prepended to every display value (e.g. \'KH-\' \u2192 \'KH-001\'). Ignored when `template` is set. |\n| `padding` | integer | no | Zero-pad the integer to this width. Default 1 (no padding). 3 \u2192 \'001\', \'012\', \'123\', \'1234\' (overflow uses the actual width). Ignored when `template` is set. |\n| `template` | text | no | Format template with placeholder tokens evaluated at insert time. Tokens: {N} (raw integer), {N:W} (zero-padded to width W, e.g. {N:3} \u2192 001), {YEAR} (4-digit year), {YEAR:2} (2-digit year), {MONTH} (2-digit month), {DAY} (2-digit day). Date tokens use the workspace timezone. Example: \'HM-{YEAR}-{N:3}\' yields \'HM-2026-001\'. Stored as the composed string; subsequent template edits do NOT re-format existing rows (date tokens would lose the original creation date). |\n\n<!-- generated:end field-autonumber -->\n\n<!-- generated:start rules-field -->\n\n#### Rules the check enforces\n\n| Rule | |\n|---|---|\n| `field.default` | A default names options its select declares \u2014 one on a single select \u2014 and a date stamped by `derive_from` states none. |\n| `field.option-mark` | An option\'s `mark` is one the kit draws, and a select\'s options mark every one or none. |\n| `field.unit-select` | A `unit_field` or `currency_field` is a single select of the same row, or a lookup of one through a one-link, whose every option label is a unit, or an ISO 4217 code. |\n| `field.link` | A link targets a declared entity: its `display_field_alias` a field of it, its `paired_field_alias` a link on it naming this one back \u2014 and of two paired links at most one reads one row. |\n| `field.formula` | A formula parses, reads fields of its own entity by alias, names an option as `{field:option}` of one a select declares, and compares a select to its options\' keys, never their words. |\n| `field.rollup` | A rollup aggregates, through a link of its entity, a field of the linked entity by an operation a model declares and that field\'s type takes \u2014 never a figure read in each row\'s own unit or currency \u2014 filtered on fields of the linked entity. |\n| `field.lookup` | A lookup reads, through a link of its entity, a field of the linked entity \u2014 never one read in each row\'s own unit or currency \u2014 ordered by a field of it. |\n| `field.computed-cycle` | Computed fields never wait on each other in a loop: each is computed after what it reads. |\n\n<!-- generated:end rules-field -->\n\n## Views\n\nSaved views live under the entity they belong to. Every field reference is a\nfield ALIAS on that entity.\n\n<!-- generated:start views -->\n\n#### View\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `alias` | alias | yes | Stable view alias, unique within the entity |\n| `label` | text | yes | Display name of the view |\n| `description` | text | no | The view\'s description, written onto the view in the workspace |\n| `columns` | list of [View column](#view-column) (at least one) | no | The columns the view shows, in this order and no others; absent, every field |\n| `filters` | [filter](#views) | no | The rows the view keeps |\n| `sort` | [sort](#views) | no | The order the view reads its rows in |\n| `summary` | map of text \u2192 text | no | Field alias \u2192 the operation its footer cell states |\n| `frozen_columns` | integer \\| `null` | no | How many leading columns stay in place while the rest scroll |\n\n#### View column\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `field_alias` | alias | yes | A field of this entity |\n| `visibility` | `"visible"` \\| `"hidden"` | yes | Field visibility state: \'visible\' = shown to everyone, \'hidden\' = not shown by default but members can toggle |\n| `width` | number | no | The column\'s width, in pixels |\n\n<!-- generated:end views -->\n\nA filter is a group \u2014 `{ "node_type": "group", "logic": "and" | "or",\n"children": [ \u2026 ] }` \u2014 or one condition on its own, `{ "node_type":\n"condition", "type": "select", "field_key": "tier", "operator": "has_any_of",\n"value": ["gold"] }`. A sort is a list of `{ "field_key": \u2026, "order": "asc" |\n"desc" | null }`. A condition\'s `type` is the field\'s type and its `operator` is\none that type admits \u2014 `has_any_of` / `has_none_of` / `has_all_of` / `is_empty` /\n`is_not_empty` for a select, `equals` / `greater_than` / `less_than` for a\nnumber, `on` / `before` / `after` / `between` for a date, `contains` /\n`is_any_of` for text. A select condition\'s `value` names option ALIASES.\n\n<!-- generated:start rules-view -->\n\n#### Rules the check enforces\n\n| Rule | |\n|---|---|\n| `view.fields` | A view\'s columns, summary, sort and filters name fields of its entity. |\n\n<!-- generated:end rules-view -->\n\n## Roles\n\nA role becomes a workspace group.\n\n<!-- generated:start roles -->\n\n#### Role\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `alias` | alias | yes | Stable role alias, bound to a workspace group when the model is applied |\n| `label` | text | yes | The group\'s name in the workspace |\n\n<!-- generated:end roles -->\n\n## Templates\n\nAn `html` or `email` template carries its content inline, and `{{name}}` in it is filled\nfrom the workflow\'s data; an `excel` template names an uploaded workbook by its `file_id`,\nfilled with the register\'s report by its `export` alone.\n\n<!-- generated:start templates -->\n\n#### Template\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `type` | `"html"` \\| `"email"` \\| `"excel"` | yes | html is a page a workflow renders to a PDF; email is a message a workflow sends; excel is a workbook a register\'s export fills |\n| `alias` | alias | yes | Stable template alias, unique within the contract |\n| `label` | text | yes | The template\'s name in the workspace |\n\n<!-- generated:end templates -->\n\n### `html` and `email`\n\n<!-- generated:start template-inline -->\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `content` | text | yes | Inline template content; placeholders reference field aliases |\n| `content_sha256` | text | no | sha256 (64-char lowercase hex) of the utf-8 content; derived where the template is written when absent |\n\n<!-- generated:end template-inline -->\n\n### `excel`\n\n<!-- generated:start template-excel -->\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `file_id` | text | yes | The uploaded .xlsx (`fil_\u2026`) the template is made from; its markers read what the export fills it with |\n\n<!-- generated:end template-excel -->\n\nA paper that has to look like a counterparty produced it \u2014 an official letter,\nan acceptance minute, a supplier\'s bill \u2014 is the same `html` template with a\nshell around the body: a letterhead, a reference line, a seal and a signature\nblock, and paper grain over everything. One shell, many bodies; the data is the\nonly thing that changes, so a workflow can re-issue it over any record.\n\n```jsonc\n{ "alias": "cong_van", "label": "C\xF4ng v\u0103n", "type": "html",\n "content": "\u2026the page below, as one JSON string\u2026" }\n```\n\n```html\n<style>\n .sheet{position:relative;width:718px;padding:44px 58px 30px;background:#fbfaf6;color:#111;font:14.2px/1.5 \'Liberation Serif\',serif}\n .grain{position:absolute;inset:0;opacity:.34;mix-blend-mode:multiply;background:url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\' width=\'140\' height=\'140\'><filter id=\'f\'><feTurbulence baseFrequency=\'.9\' numOctaves=\'2\'/><feColorMatrix values=\'0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .35 0\'/></filter><rect width=\'140\' height=\'140\' filter=\'url(%23f)\'/></svg>")}\n .top{display:flex;text-align:center;font-size:13.4px} .top>div{flex:1} .u{display:inline-block;border-bottom:1px solid #111;font-weight:700}\n .ref{display:flex;text-align:center;font-size:13.4px;margin-top:6px} .ref>div{flex:1} .ref .r{font-style:italic}\n h1{text-align:center;font-size:15.6px;margin:26px 0 18px} p{text-align:justify;text-indent:26px;margin:0 0 9px}\n .sig{display:flex;margin-top:20px} .sig .l{flex:1} .sig .r{width:290px;text-align:center;position:relative}\n .sig .nm{font-weight:700;margin-top:96px} .seal{position:absolute;left:4px;top:8px;width:166px;height:166px;opacity:.66;mix-blend-mode:multiply;transform:rotate(-17deg)}\n </style>\n <div class=\'sheet\'><div class=\'grain\'></div>\n <div class=\'top\'><div><b>{{issuer_parent}}</b><br><span class=\'u\'>{{issuer}}</span></div>\n <div><b>C\u1ED8NG H\xD2A X\xC3 H\u1ED8I CH\u1EE6 NGH\u0128A VI\u1EC6T NAM</b><br><span class=\'u\'>\u0110\u1ED9c l\u1EADp - T\u1EF1 do - H\u1EA1nh ph\xFAc</span></div></div>\n <div class=\'ref\'><div>S\u1ED1: {{number}}</div><div class=\'r\'>{{place}}, ng\xE0y {{day}} th\xE1ng {{month}} n\u0103m {{year}}</div></div>\n <h1>{{title}}</h1>\n <p>K\xEDnh g\u1EEDi: {{recipient}}.</p>\n {{{body}}}\n <div class=\'sig\'><div class=\'l\'><b>N\u01A1i nh\u1EADn:</b><br>- Nh\u01B0 tr\xEAn;<br>- L\u01B0u VT.</div>\n <div class=\'r\'><img class=\'seal\' src=\'{{seal_url}}\'><b>{{signer_title}}</b><div class=\'nm\'>{{signer}}</div></div></div>\n </div>\n```\n\n**What an act\'s template is handed** is its record\'s own fields by alias: a\nselect, a member and a link as their words (a link as the linked row\'s title), a\nnumber, a date and a computed value that declares its kind raw (`2800000`,\n`2026-09-14`) \u2014 never a files field or a computed select. On one record it is\nhanded, too, the rows of each child the record draws as `rows` whose alias the\ntemplate names, listed under that alias for `{{#each <alias>}}` in place of the\nrecord\'s own link to them: every row filed under the record, oldest first, each\nby its own fields as the record\'s are, less its link back to the record. Over\nseveral rows the rows are listed under the entity\'s alias, for\n`{{#each <alias>}}`, without their child rows.\n\n## Rows\n\nFirst records, keyed by entity alias. Up to 200 rows per entity and 2000 across\nthe model, attaching at most 2000 documents between them \u2014 a real data set\nbelongs in an import, not a model.\n\n```jsonc\n"rows": {\n "customer": [\n { "ref": "acme", "fields": { "name": "Acme Trading", "tier": "gold" } }\n ]\n}\n```\n\n<!-- generated:start rows -->\n\n#### Row\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `ref` | text | yes | Local handle for this row, referenced by other rows\' link fields |\n| `fields` | map of text \u2192 any value | yes | Field alias \u2192 the value, read against the field\'s declared type |\n\n<!-- generated:end rows -->\n\n<!-- generated:start rules-rows -->\n\n#### Rules the check enforces\n\n| Rule | |\n|---|---|\n| `rows.ref` | A row\'s `ref` is unique within its entity. |\n| `rows.required` | A row states every field its entity requires: it is created with what it states, its fields\' defaults unapplied. |\n| `rows.distinct` | Open rows of an entity a register lists read apart: no two state the same title and the same line under it. |\n| `rows.value` | A row\'s value fits its field: an option alias for a select, `"<entity>:<ref>"` of a row of the linked entity in this file for a link, `"self"` for a member, a relative path beside the file or a `fil_` id for files, a date in the date grammar (an hour only on a datetime), a text, number, yes/no or null otherwise \u2014 and none on a computed field. |\n\n<!-- generated:end rules-rows -->\n\nA `ref` is lowercase letters, digits and underscores, and is never persisted.\n\nA `files` cell attaches documents: paths relative to this file (no `..`, never\nabsolute), which the check proves exist and `apply` uploads into the workspace\nbefore any row is written \u2014 a paperwork business seeds its papers with its\nrows. The server accepts only `fil_` ids of files this workspace owns, which is\nwhat the upload leaves behind. After a run that wrote rows, the WORKSPACE holds\nwhich record each row became, under the row\'s own `<entity>:<ref>`:\n`delete_records` over them is how a seeded set is reset, and applying again\nre-dates it.\n\n`fields` is keyed by field alias, and every value is read against the field\'s\nDECLARED type:\n\n| Field type | Value |\n|---|---|\n| `text` / `number` / `boolean` | the value itself |\n| `date` | `"2026-03-14"`, or a relative expression (below) |\n| `select` | the option ALIAS \u2014 `"gold"`, or `["gold","vip"]` for a multi-select |\n| `select_record_link` | `"<entity-alias>:<ref>"` naming another row in this file \u2014 `"customer:acme"`, or an array for several; a paired link is stated on ONE side (the child\'s link to its parent) and its partner fills itself |\n| `select_member` | `"self"` only \u2014 the person applying the model |\n| `files` | paths beside this file \u2014 `["scans/pccc_letter.png"]` \u2014 uploaded by `model apply`/`setup` before the model is sent; or `fil_` ids of files already in this workspace |\n| `formula`, `rollup`, `lookup`, `autonumber` | not allowed \u2014 the platform writes these |\n\n### Relative dates\n\nA date cell holds a literal `YYYY-MM-DD`, or an expression relative to the day\nthe model is applied, so a screen that opens on "this month" is not empty a month\nlater:\n\n- `@today` \u2014 the day of the run, in the workspace\'s timezone\n- `@month-start` \u2014 the 1st of that month\n- either with a whole-day offset: `@today-14`, `@month-start+9`\n- on a date that holds its hour (`format: "datetime"`), that hour after the day, and always stated:\n `@today 14:30`, `@today+1 06:00`\n\n`@month-start` exists because `@today-N` cannot promise a month: applied on the\n2nd, `@today-3` lands in the previous one.\n\n## Records\n\n`records` says how a row of each entity is RECOGNISED \u2014 once per entity, keyed by\nentity alias \u2014 and every surface that draws one of its rows reads the same\nstatement: the register\'s row, a picker\'s option, a link\'s chip, a child table\'s\nrow and the record\'s header. Every entity an app lists, opens or picks has one.\n\n```jsonc\n"records": {\n "visit": {\n "title": "container_no",\n "subtitle": ["customer", "arrived_on"],\n "image": "photos",\n "status": { "field": "stage", "closed": ["gone"], "history": "visit_history" },\n "figure": "total_fees",\n "due": ["free_until"]\n },\n // A release order read against what it allows: a meter wherever it shows.\n "release": { "title": "release_no", "figure": "issued", "limits": { "issued": "units" } },\n // A dossier\'s stage is the last date it reached \u2014 no stored select.\n "dossier": { "title": "applicant", "status": { "milestones": ["received_on", { "field": "appraised_on", "when": { "kind": ["loan"] } }, "signed_on"], "closed": ["signed_on"] } }\n}\n```\n\n<!-- generated:start records -->\n\n#### Record\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `title` | alias | yes | The field that names a row \u2014 the first thing every surface shows: who or what it is, a link naming it by the linked row (a job read by its customer). An autonumber is refused; a typed number is the subtitle |\n| `subtitle` | list of alias (1\u20132) | no | Up to two fields read under the title wherever a row is drawn (a code, a date, a party) |\n| `image` | alias | no | A files field that pictures the row \u2014 never one an act keeps the document it makes in |\n| `description` | alias | no | A text field saying what the row is about \u2014 a plan\'s brief, a customer\'s note: read in its record\'s head under the title\'s line, its first lines at rest and whole on a press, and written from the head\'s \u270E. Never on a row\'s line |\n| `party` | `"person"` \\| `"organization"` | no | What each row is where the rows are people (a contact, a patient) or organisations (a customer, a supplier, a carrier); absent, the rows are things (an order, an item, a paper) |\n| `status` | [Status](#status) | no | The stage a row moves through \u2014 a single select or its milestone dates \u2014 drawn as a badge beside its title |\n| `figure` | alias | no | The one number the row stands for, read at its right (a total, a quantity left) |\n| `limits` | map of alias \u2192 (alias \\| number) | no | A number read against a bound \u2014 a field of the same row or a constant \u2014 drawn as a meter wherever it shows |\n| `gates` | map of alias \u2192 (alias \\| number) | no | A pass mark on a meter `limits` bounds \u2014 a field of the same row or a constant; a percent field is its share of the bound, any other number an amount. The meter marks it and fills complete once past it |\n| `tolerance` | map of alias \u2192 number | no | How far past its `limits` bound a meter may stand, in percent of the bound: the bound is an amount expected (received against ordered), not a cap. Without one the bound is a cap, and past it is an overrun |\n| `due` | list of alias (at least one) | no | Dates that are deadlines (stored, or computed as a date): each counts down and turns overdue |\n| `frees` | alias | no | A date ending the row\'s span of days on which what the row holds is free again (a check-out, a hire\'s return): a stay from the 3rd to the 5th holds the 3rd and the 4th, and another may start on the 5th \u2014 on a lanes board, a calendar, a roster and in `no_overlap` alike. Absent, a span of days holds its last day; a span of moments always frees its end |\n| `task` | `true` | no | A row is work someone finishes: wherever rows of it stand in a table \u2014 a register, a record\'s rows, the rows filed under one \u2014 each is led by a ring ticking it done and unticking it by the one write of the app making that move. Its status is a stored select with `closed` |\n| `starts` | map of alias \u2192 `"today"` \\| `"me"` | no | What a field of a row being added starts at, where that start is certain: `today` a date (a moment starts now), `me` a member, the reader adding it; every other field starts empty unless the reader narrowed the register to a value or the field declares a `default` |\n\n#### Status\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `field` | alias | no | The single select that is the row\'s state \u2014 or `milestones` instead |\n| `milestones` | list of (alias \\| [Milestone](#milestone)) (at least 2) | no | Dates in the order the work reaches them, instead of a stored select: the stage is the last one filled, ticking one stamps today, and clearing one clears every later one |\n| `closed` | list of alias (at least one) | no | Options (or milestones) that end the work: a register opens on the rows not at them, and the badge reads muted |\n| `history` | alias | no | A child entity every status change appends one row to (its link to this entity, the new status, the moment and who) \u2014 written by the app\'s own writes, never a table automation; a row the model seeds opens it at its status, the day the rows land, unless the model states its rows; with `field` only |\n\n#### Milestone\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `field` | alias | yes | A date field: the stage is reached on the day it holds |\n| `when` | map of alias \u2192 (list of alias (at least one) \\| boolean) | yes | The stage applies only while each named select holds one of these options, and each named stored yes/no is this value; otherwise the row skips it |\n\n<!-- generated:end records -->\n\n<!-- generated:start rules-records -->\n\n#### Rules the check enforces\n\n| Rule | |\n|---|---|\n| `records.title` | A title names the row by what it is \u2014 never an autonumber; a code is its subtitle. |\n| `records.image` | `image` is a files field, never one an act keeps the documents it makes in (`into`). |\n| `records.description` | `description` is a text field, read in the record\'s head \u2014 never a section\'s too. |\n| `records.status` | A status is one single select, `closed` naming options of it \u2014 or its `milestones`. |\n| `records.history` | A declared status `history` has exactly one link to the row it records, one single select holding every option of the status (or a text), exactly one date and at most one member. |\n| `records.history-derived` | A `history` the model does not declare is derived and keeps one entity\'s moves, labelled by that entity ("L\u1ECBch s\u1EED <entity label>", or "<entity label> history"): no declared table holds that label, and the entity has no other field under the link it adds. |\n| `records.history-scope` | A status history reads by its record\'s `read_scope`, answered through its one-row link to the record within the links a row rule reaches \u2014 or it states its own. |\n| `records.milestones` | Milestones are dates a person ticks, each named once; `closed` names some of them, and a deadline (`due`) is never one. |\n| `records.milestone-add` | An add asks the first milestone at most \u2014 each after it is ticked in order. |\n| `records.figure` | A figure is a number. |\n| `records.limits` | `limits` bounds a number by a number field of the row, in its unit or one of the same dimension \u2014 or by a constant, where every row reads the figure in one unit. |\n| `records.gates` | `gates` marks a pass on a meter `limits` bounds: a percent field (its share of the bound), another number in the bound\'s unit, or a constant. |\n| `records.tolerance` | `tolerance` stands on a meter `limits` bounds. |\n| `records.starts` | `starts` starts a field a person writes \u2014 `today` a date or a moment (never a span), `me` a member \u2014 and an add that does not ask a field it starts writes that start. |\n| `records.due` | A deadline (`due`) is a date. |\n| `records.frees` | `frees` names a stored day, never a moment: a span of moments already frees its end. |\n| `records.task` | A task entity (`task`) states a `status` of a stored single select with `closed` options \u2014 its ring ticks a row done by moving it to one. |\n\n<!-- generated:end rules-records -->\n\n- **The title names the row** by who or what it is \u2014 a link by the linked row (a job\n read by its customer). An autonumber is refused as a title; a typed number is the\n subtitle.\n- **The status** is one single select. `closed` options end the work: a register opens\n on the rows not in them. A `history` entity gets one row per move \u2014 its link to this\n entity, the new status (a select holding the same option aliases, or text), the\n moment and who \u2014 appended by the app\'s own writes that move the status, never by a\n table automation. A `history` the model does not declare is derived, and needs no\n `records` entry of its own.\n- **Milestones** are the alternative to a stored select: dates in the order the work\n reaches them, the stage being the last one filled (never stored). A milestone with a\n `when` applies only while its select holds those options and its stored yes/no that\n value; otherwise the row skips it.\n The record draws them as one block where ticking stamps today and clearing one clears\n every later one; every save and act re-checks that a date comes after each earlier one\n that applies. `closed` names the milestones that end the work. A register\'s add may ask\n the first milestone, never a later one; an act may stamp one, never clear it.\n- **A limit** reads a number against a bound \u2014 another field of the row, or a constant.\n A `gates` entry marks a pass on that meter: a percent field is its share of the\n bound, any other number an amount.\n- **A deadline** (`due`) counts down wherever it is drawn and is overdue once past while\n the work is open. A register over the entity says how many rows in view are overdue on\n its summary line, and pressing that count narrows to them \u2014 no reading to state.\n- **A span\'s free day** (`frees`) is the end date on which what the row held is free\n again \u2014 a check-out, a hire\'s return. A stay from the 3rd to the 5th holds two nights:\n a lanes board, a calendar and a roster draw it through the 4th, and `no_overlap` lets\n the next stay start on the 5th. Without it a span of days holds its last day; a span of\n moments always ends as the next may begin.\n- **`starts`** is where an add\'s field begins, stated only where that is certain \u2014 a\n log\'s own day at `today`, a request\'s requester at `me`. Nothing else starts a field\n but its declared `default` and what the reader narrowed the register to.\n\n## Write rules\n\n`write_rules` is what a WRITE meets, keyed by entity alias; each entity\'s is held\nby its table. Every generated write of an\napp (`create_<entity>`, `update_<entity>`, each act) re-checks these on the\nserver; the screen only mirrors them.\n\n```jsonc\n"write_rules": {\n // A customer is RECOGNISED by their address. An add that names one \u2014 from the\n // customers register or from a picker\'s "new" \u2014 reuses the row it matches and\n // opens one only where nothing does, so the book never grows a second Acme.\n "customer": { "natural_key": ["email"] },\n "order_line": {\n "fields": {\n // A line of nothing is not a line. Refused on create and on update.\n "quantity": { "min": 1, "max": 9999 },\n // Shipped inside its order\'s window: a bound read off the row a link names\n // is held from both sides \u2014 moving the order\'s dates never strands a line.\n "ships_on": { "min": "order.placed_on", "max": "order.due_on" },\n // The price is fixed at the moment of ordering \u2014 COPIED off the product,\n // not looked up for ever after.\n "unit_price": { "default_from": "product.price" },\n // Nothing is sold off an empty shelf. The picker reads only the rows that\n // answer this, and the write refuses the same rows again.\n "product": {\n "options_where": {\n "node_type": "group", "logic": "and",\n "children": [{ "node_type": "condition", "type": "number",\n "field_key": "in_stock", "operator": "greater_than", "value": 0 }]\n }\n }\n }\n },\n // One booking per room at a time, while it is held: a create or a save whose\n // span overlaps another held booking of the same room is refused.\n "booking": {\n "fields": { "ends_on": { "min": "starts_on" } },\n "no_overlap": { "from": "starts_on", "to": "ends_on", "by": ["room"], "while": { "state": ["held"] } }\n }\n}\n```\n\n<!-- generated:start write-rules -->\n\n#### Entity write rules\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `natural_key` | list of alias (at least one) | no | The field aliases a row of this entity is RECOGNISED by. A write that names a row of this entity by these values reuses the row it finds, minting one only where nothing matches. |\n| `fields` | map of alias \u2192 [Field write rule](#field-write-rule) | no | Field alias \u2192 what that field\'s value is copied from, bounded by or picked among |\n| `no_overlap` | [No overlap](#no-overlap) | no | No two rows hold overlapping spans \u2014 a create or update that would is refused |\n\n#### Field write rule\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `default_from` | text | no | Copy this field\'s value from the linked row at CREATE time \u2014 `<link alias>.<field alias>`, the link being a one-row link on this entity, required or filled by the add (the record a row is added under). The value is copied rather than looked up, so the source changing later leaves the row alone. |\n| `min` | number \\| text | no | Refuse a create or update whose value is below this: a constant for a number, or a field \u2014 `<field alias>` of the same row, or `<link alias>.<field alias>` of the one row a link names \u2014 of the same type (a return date after the departure, a line\'s day inside its trip). On a figure whose unit or currency is per row (`unit_field`, `currency_field`) a constant bound is only 0; bound it by a field of the row |\n| `max` | number \\| text | no | Refuse a create or update whose value is above this: a constant for a number, or a field of the same row or of the one row a link names |\n| `options_where` | [filter](#views) | no | Which rows of the target this link may point at \u2014 an `and` group of plain conditions over the TARGET entity\'s own fields, each `field_key` a field alias. It narrows the picker\'s read and is refused again where the write lands. |\n| `same` | list of alias (at least one) | no | One-row links this row and each row this link points at must name alike \u2014 a fee\'s invoice is one of its own visit\'s, a box\'s seal one of its own shipping line\'s: each a one-row link of both entities to the same entity. It narrows the picker\'s read to the rows naming what this row names, and a write is refused wherever it lands \u2014 on the link, or on what the two rows compare. |\n\n#### No overlap\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `from` | alias | yes | The stored date (or datetime) a row\'s span starts on |\n| `to` | alias | yes | The stored date (or datetime) a row\'s span ends on \u2014 a day it holds, unless `records` names it the day the row `frees`; a moment another row may start at |\n| `by` | list of alias (at least one) | no | Fields two rows share to compete for a span (the same employee, the same room); absent, every row |\n| `while` | map of alias \u2192 list of alias (at least one) | no | Only rows at these options of these selects hold their span (running, not closed); absent, every row |\n\n<!-- generated:end write-rules -->\n\n<!-- generated:start rules-write -->\n\n#### Rules the check enforces\n\n| Rule | |\n|---|---|\n| `write.natural-key` | A `natural_key` is text or a number a person types back, or a one-row link; a text key is unique \u2014 `unique: true`, or the key\'s fields as a set in the entity\'s `unique`. |\n| `write.default-from` | `default_from` copies `<link>.<field>` off the row a one-row link names, wherever an add fills that link (asked, or the record it is added under), into a field of the same type: a select into one declaring each of its options by alias, several options only into a multi-select. |\n| `write.bounds` | `min` and `max` bound a number or a date \u2014 by a constant a number, by a field of this row or of the one row a one-row link names either, of the same type and unit, never by itself \u2014 and `min` is never above `max`. |\n| `write.bound-per-row-unit` | On a figure whose unit or currency is the row\'s own (`unit_field`, `currency_field`) a constant bound is only 0 \u2014 bound it by a field of the row. |\n| `write.same` | `same` stands on a link and names one-row links this entity and the link\'s target both hold to one entity. |\n| `write.options-where` | `options_where` narrows a link by an `and` group of plain conditions over the target\'s own fields \u2014 a number compared in one unit on every row, a select by options it declares. |\n| `write.no-overlap` | `no_overlap` spans two date fields; `by` names values rows share \u2014 a link, a person, one option, a text or a number; `while` names single selects by their options. |\n\n<!-- generated:end rules-write -->\n\n- A `natural_key` is `text` or `number`, because a person types it back, or a\n one-row link, because a row is also recognised by the one row it belongs with (a\n fee by its visit and its kind). A key holding a `text` field is unique: `unique:\n true` on that field, or the key\'s fields as a set in the entity\'s `unique` (a\n site by its customer and its name) \u2014 two rows sharing it would make\n find-or-create pick whichever the read answered first. An add asks the key by\n default.\n- A `min` or `max` naming a field is read off the row as the save would leave it,\n and one naming `<link>.<field>` off the row the link names \u2014 the link\'s side\n re-checks its own rows when that bound moves.\n- A `default_from` copies where the add is sure to hold its link\'s row \u2014 a\n required link, or the record the row is added under (an appointment added under a\n plan takes the plan\'s patient) \u2014 and the two field types match. The copied field is\n not asked there; through an optional link the add leaves empty, it is asked.\n- A `same` link names only rows that name what this row names \u2014 a fee\'s invoice\n is one of its own visit\'s \u2014 through a one-row link both entities hold to one\n entity; its picker offers nothing until the row names one. A row added under a\n record names what it copies off it (`default_from`) from the start, so a block\n expecting one line per row of the link lists that record\'s rows alone. A save\n moving what the two compare, on either row, is refused while they would name apart.\n- An `options_where` link may be left empty; a row it names is refused again\n where the write lands unless it holds the narrowing. A link naming one kind of\n a book\'s rows (a "Shipping line" among the parties) narrows to that kind, or\n its picker offers every row.\n\nA field\'s own `required` is not here: the contract carries it, and every write\npath refuses the row by field name from it. `unique` is the text field\'s own\nclause (\xA7 `text`) \u2014 an add says so at the control before the column does. A\nfield the workspace writes (a formula, a rollup, a lookup, an autonumber, a date\nwith `derive_from`) is never asked, written or edited.\n\n## Apps\n\nAn app is ONE register over one entity and the record each row opens \u2014 or a dashboard\nof readings. The author states COMPOSITION \u2014 which fields go where; the runtime owns\nhow each thing looks, one treatment per concept. Nothing is drawn that the app does not\nname, and each fact appears once on a record. What the vocabulary has no word for is an\nact\'s own `workflow`.\n\n```jsonc\n"apps": [{\n "alias": "gate", "name": "Gate in and out", "entity": "visit",\n "register": { "columns": ["service"], "filters": ["customer", "service"] },\n "record": {\n "sections": [\n { "title": "In", "fields": ["customer", "service"], "blocks": [{ "rows": "fee", "columns": ["amount"] }] },\n { "title": "Out", "at": ["in_yard"], "fields": ["release", "seal"], "blocks": [{ "files": ["photos"] }], "acts": ["gate_out"] }\n ]\n },\n "acts": [{ "alias": "gate_out", "label": "Gate out", "when": { "stage": ["in_yard"] },\n "requires": ["release", "seal"], "set": { "stage": "gone", "left_on": "now" }, "confirm": true }],\n "checks": [{ "field": "unpaid", "blocks": ["gate_out"] }]\n}]\n```\n\n<!-- generated:start apps -->\n\n#### App\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `alias` | alias | yes | The app\'s name within the model \u2014 what `--from model.json#<alias>` picks |\n| `name` | text | yes | The job, in the words of the people who do it |\n| `description` | text | no | What the job is for, in a sentence |\n| `icon` | text | no | A lucide icon name the launcher tile draws |\n| `theme` | [Theme](#theme) | no | The launcher tile\'s colour |\n| `entity` | alias | yes | The entity whose rows this job works \u2014 the register\'s rows |\n| `scope` | alias | no | A required one-row link of the entity: the app works inside one row of the linked entity at a time (a project, a branch), picked from a list of them, and every row it reads, counts and adds is that row\'s |\n| `reads` | `"shared"` | no | Every member reads every row, whatever the entity\'s read scope |\n| `writes` | `"children"` | no | The reader adds and edits the record\'s child rows but not the record\'s own fields; the app\'s acts still move it |\n| `row` | [App row](#app-row) | no | How this job reads the entity\'s rows where it reads them otherwise than `records` (a cashier\'s figure is what is owed): the subtitle, figure and image stated replace the entity\'s wherever this app draws its rows \u2014 the register, a card, the record\'s header, a calendar, lane or roster entry. The title stays the entity\'s |\n| `register` | [Register](#register) | no | The rows: which columns and filters, the order, how a row is added |\n| `record` | [Record page](#record-page) | no | What a row opens: the door, its sections, and beside them its comment thread and its status history where stated |\n| `acts` | list of [Act](#act) | no | What the reader does to a record \u2014 each a press with its conditions and its write |\n| `checks` | list of [Check](#check) | no | Formulas that warn while they stand, or refuse the acts and saves they name |\n\n#### Theme\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `color` | text | yes | The tile\'s colour |\n\n#### App row\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `subtitle` | list of alias (1\u20132) | no | Up to two fields read under the title in this app, in place of the entity\'s |\n| `figure` | alias | no | The one number a row stands for in this app, in place of the entity\'s; a `limits` bound on it reads as its meter |\n| `image` | alias | no | A files field that pictures a row in this app, in place of the entity\'s |\n\n#### Dashboard app\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `alias` | alias | yes | The app\'s name within the model \u2014 what `--from model.json#<alias>` picks |\n| `name` | text | yes | The job, in the words of the people who do it |\n| `description` | text | no | What the job is for, in a sentence |\n| `icon` | text | no | A lucide icon name the launcher tile draws |\n| `theme` | [Theme](#theme) | no | The launcher tile\'s colour |\n| `reads` | `"shared"` | no | Every member reads every row, whatever the entity\'s read scope |\n| `dashboard` | list of ([Metric](#metric) \\| [Breakdown](#breakdown) \\| [Trend](#trend) \\| [Pivot](#pivot) \\| [List](#list)) (at least one) | yes | The readings, in order \u2014 each over every row of its entity, windowed by the one period the reader switches |\n\n<!-- generated:end apps -->\n\n<!-- generated:start rules-app -->\n\n#### Rules the check enforces\n\n| Rule | |\n|---|---|\n| `app.alias-unique` | An app\'s alias is unique among the model\'s apps, and an act\'s among its app\'s acts. |\n| `app.records-entry` | Every entity an app lists, opens or picks \u2014 its own, a block\'s, a linked row\'s, a document\'s \u2014 has a `records` entry. |\n| `app.reads-shared` | `reads: "shared"` stands only where a table the app reads states a `read_scope`. |\n| `app.writes-children` | An app that writes only the record\'s children (`writes: "children"`) adds no row of its own entity. |\n| `app.scope` | `scope` is a required one-row link of the app\'s entity, the same on every row the app lists \u2014 never a column, filter, search field, group, `where`, `opens`, section field or add question. |\n| `app.when` | A `when` holds single selects to options and yes/nos to `true` or `false`, stored or a formula of one \u2014 a milestone\'s `when` only a stored yes/no, read before any formula over it is computed. |\n| `app.asked-written` | What an add, an act or `starts` fills is a field a person writes \u2014 never a formula, rollup, lookup, autonumber or a date the workspace stamps. |\n| `app.own-rows` | A many-link to rows that each belong to one row of this entity is never a section\'s field, an add\'s question or an act\'s ask: those rows are the record\'s own, read as a `rows` block. |\n| `app.create-asks` | An add asks fields of a table people write \u2014 never the link or the folder it files the row under, which the add sets itself. |\n| `app.create-required` | An add (`create`) asks every field its entity requires that nothing else fills \u2014 a `default`, `starts`, the record or folder it files the row under, or a `default_from` over a link it fills \u2014 or the server refuses every add. |\n| `app.row` | An app\'s `row` states only what differs from `records`: a line that is not the title, a number for its figure, a files picture no act makes documents into. |\n| `app.files-shown` | Every files field is drawn by some app over its entity \u2014 a section\'s `fields`, a `files` block, a column, the `image`, or where an act making papers into it stands: the field an act keeps its document in (`into`) is placed where the paper reads. |\n| `app.document-image` | *Noted, never refused:* A linked entity holding one files field and no `image`: `image` lets a link preview its paper. |\n| `app.tasks` | *Noted, never refused:* A task entity an app lists whose rows no write of the app moves to a closed option (its ring stands disabled), or that an act ticks done and none moves back. |\n\n<!-- generated:end rules-app -->\n\n`writes: "children"` is a desk that adds and edits a record\'s child rows and never\nthe record itself. `reads: "shared"` lifts every read scope the app\'s tables state \u2014\nrefused where none of them states one.\n\n`scope` names a required one-row link of the entity: the app works inside ONE row of\nthe linked entity at a time \u2014 a project, a branch, a season. With no folder remembered\nit opens on the list of them, each with how many of the app\'s rows it holds; inside,\nevery read, count and reading narrows to that one, an add files its row under it (the\nlink is never asked), and the record states its folder in the header. A scope narrows\nthe view; who may read what stays the entity\'s `read_scope`. The folder link is never a\ncolumn, a filter, a search field, a fact or an add\'s question.\n\nA dashboard is `{ "alias", "name", "dashboard": [readings] }` with no entity, register\nor record: each reading reads every row of its entity, and one period the reader\nswitches (this month \xB7 30 days \xB7 this quarter \xB7 this year) windows each reading placed\nin time; one placed in no time reads the rows as they stand now, and its head says so.\nA `list` reading lists rows, each opening in its `app`. The readings answer the one\nquestion the dashboard\'s owner asks, in the order they ask it \u2014 rows to act on lead where\nthe answer is rows; no order of kinds is the rule.\n\n```jsonc\n// The depot owner\'s morning question: which boxes are past their free days, whose are they, is it growing?\n{ "alias": "overview", "name": "Depot overview", "dashboard": [\n { "list": "visit", "where": { "overdue": true }, "columns": ["line"], "app": "gate", "label": "Past free days" },\n { "breakdown": "visit", "by": "line", "where": { "overdue": true }, "label": "Past free days by line" },\n { "trend": "visit", "over": "arrived_on", "where": { "overdue": true }, "label": "Past free days, by arrival" }\n] }\n```\n\n### Register\n\n```jsonc\n"register": { "columns": ["service", "release"], "filters": ["customer", "service"], "create": ["container_no", "customer"] }\n```\n\n<!-- generated:start apps-register -->\n\n#### Register\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `columns` | list of alias | no | Fields read as columns after the row\'s title \u2014 on a calendar\'s entry or a lane\'s block, its facts after its title; never what the row draws itself (its subtitle, image, status, figure, or the bound its figure\'s meter reads against), which the runtime places |\n| `filters` | list of (alias \\| [Tiered filter](#tiered-filter)) (at most 3) | no | The fields the reader narrows the rows by every day, in that order \u2014 each earns its place by that daily use, so none to 3 is normal and 3 is a cap, never a quota (a select, a member, a link, a date, a yes/no, a number as a range, or its `tiers` where the business narrows by those bands daily) \u2014 each on a desk\'s line, in one Filters sheet on a phone. Never the status (its chips); each a field the rows show \u2014 a column, or a part of the row. A threshold the business names ("large orders") is a formula yes/no here; a column\'s header sorts by a day or an amount |\n| `search` | list of alias (at least one) | no | The fields the search box matches (a link by its row\'s title); a pasted list searches each line and names the lines no row matched. Absent, every word of the row |\n| `group` | alias | no | The field the rows open grouped by, the reader\'s grouping starting there \u2014 a period\'s rows read under each period, one per person; absent, ungrouped |\n| `sort` | [Register order](#register-order) | no | The order rows open in; absent, the first deadline soonest first, else the newest first |\n| `layout` | `"table"` \\| `"cards"` \\| `"calendar"` \\| `"roster"` \\| `"lanes"` | no | `cards` for rows read by their picture; `calendar` for rows read by their day \u2014 a month, a week, a day or a list, an entry at its hour where its date holds one and over its span where its line holds a second date; `roster` for what each row did on each day of a week or a month (who worked which shift, which vehicle ran), or with `expect` which of a set each row holds; `lanes` for rows booked on a resource over time (an appointment in its chair, a hire on its machine); absent, a table |\n| `roster` | alias | no | With `layout: "roster"`: the entity whose rows fill the days \u2014 one single link to this entity, and a date on its row line (`records` title or subtitle). A cell reads its row\'s status, else the first single select on its line, several rows a mark each, the cell read by the one latest in that select\'s options; a row whose line holds a second date after the first fills every day to it; a day with none stays empty, never an absence |\n| `expect` | alias | no | With `roster`: a single select of the roster\'s rows whose options are the columns in place of days \u2014 each cell the row holding that option, read by its status, an empty one added there (a checklist of papers per case); the roster then has no period |\n| `of` | alias | no | With `expect`: this entity\'s own multi-select holding the options each row expects \u2014 its other columns stand blank on that row, never added. Its options are among `expect`\'s |\n| `lanes` | alias | no | With `layout: "lanes"`: a one-link of this entity whose target\'s rows are the lanes (a chair, a machine, a room), each drawn even when empty. A row is a block from the first date on its line to the second \u2014 within one day by the hour where the first holds one, else by the day over one day, a week or a month; a free stretch between blocks adds a row there, its lane, its start and the end the stretch reaches filled |\n| `loads` | map of alias \u2192 alias | no | With `lanes`: what a lane carries against what it holds, at most 2 \u2014 a number of this entity each block adds (a weight) to a number of the lane\'s row it is held within (a payload), in one unit or two of one dimension. Each lane reads the most its blocks add up to at one time in the window \u2014 a day\'s rows together \u2014 and names by how much and when a lane runs over |\n| `where` | map of alias \u2192 (list of alias (at least one) \\| boolean) | no | Only the rows whose select holds one of these options and whose yes/no (stored, or a formula) is this value \u2014 read so on the server and never offered as a chip: the rows this app works of an entity other apps read whole (the purchases, of orders both ways). A row added here holds a select\'s one option and a stored yes/no\'s value |\n| `opens` | map of alias \u2192 (list of alias (at least one) \\| boolean \\| `"me"`) | no | The view the register opens on: each entry a narrowing on a field the rows show that stands as a chip the reader may take away (the rows still owed), `"me"` a member field holding the reader (the rows mine). One on the status replaces the chips\' opening on the open work |\n| `create` | list of alias (at least one) \\| `false` | no | The fields asked when a row is added; absent, the title, the subtitle and figure no default fills, the natural key and every required field \u2014 each a person writes; false, rows are not added here |\n| `export` | `true` \\| list of [Register report](#register-report) (at least one) | no | The rows in view saved as the register\'s report \u2014 its title, a line per thing narrowing the rows, the readings and every row: `true`, one workbook of the register\'s columns; a list, the reports a reader picks from one export menu |\n| `readings` | list of ([Metric](#metric) \\| [Breakdown](#breakdown) \\| [Trend](#trend) \\| [Pivot](#pivot)) (at least one) | no | Readings of the register\'s own entity above its rows, over the rows in view \u2014 the search, the status and the filters narrow them, but a picture\'s own field, read as the register opens on it. A press on a breakdown\'s part, a pivot\'s cell or a figure with `where` narrows the rows by its field, as a filter does |\n\n#### Tiered filter\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `field` | alias | yes | A number \u2014 stored, or a formula or rollup reading one \u2014 in one unit for every row |\n| `tiers` | list of number (at least one) | yes | The breakpoints between its bands, ascending, in the field\'s stored unit: under the first, from each to the next, from the last up \u2014 each band worded by the field\'s own format, several picked at once |\n\n#### Register order\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `field` | alias | yes | The field rows are ordered by |\n| `desc` | `true` | no | Latest or largest first; absent, soonest or smallest first |\n\n#### Register report\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `label` | text | yes | The report\'s name, in the reader\'s words \u2014 its entry in the export menu and its file\'s title |\n| `description` | text | no | What the report holds, under its name in the menu |\n| `template` | alias | no | A template filled with the report \u2014 `title`, `lines`, `readings`, and every row in view (at most 20,000) under the entity\'s alias: an html one made a PDF, an excel one a workbook; absent, the workbook of the register\'s columns |\n| `where` | map of alias \u2192 (list of alias (at least one) \\| boolean \\| `"me"`) | no | The rows the report is of, set on the register as the chips they are before its file is made \u2014 the screen shows what the file holds |\n| `per` | alias | no | A select, a member or a one-link the reader picks one value of from the menu \u2014 the rows narrowed to it, as its chip, and one file of that value |\n\n<!-- generated:end apps-register -->\n\n<!-- generated:start rules-register -->\n\n#### Rules the check enforces\n\n| Rule | |\n|---|---|\n| `register.export-report` | A register\'s reports each have their own label; `per` picks one option, person or one-link row \u2014 never of the status, the folder or a field its `where` fixes. |\n| `register.export-template` | A template an export fills reads at its root only `title`, `lines`, `readings` and its rows under the register entity\'s alias \u2014 an entity named none of those three \u2014 and is the document of no act. |\n| `register.column-drawn` | A column never names what the row draws itself \u2014 its title, subtitle, image, status, figure, or the bound its figure\'s meter reads against \u2014 and names a field once. |\n| `register.filter` | A filter names a select, a member, a link, a date, a yes/no or a number of the register\'s own rows \u2014 a lookup through one-row links as the field it reads \u2014 never the status (its chips), nor one `where` fixes. |\n| `register.filter-split` | *Noted, never refused:* A filter on a field a breakdown or pivot in the band splits the rows by \u2014 a press on its part narrows by it too; a member\'s filter, which narrows to the reader\'s own rows, is never noted. |\n| `register.filter-unshown` | A filter, a narrowing the register `opens` on, and a press in its band (a breakdown\'s part, a pivot\'s cell, a figure\'s `where`) name a field its rows show \u2014 a column; the row\'s title, the line under it, its picture, status or figure, a meter\'s bound, or the unit or currency a drawn figure is read in; a deadline; a warning its line says; the group or lane it stands under. A narrowing to the reader (`"me"`) needs none. |\n| `register.tiers` | `tiers` band a number read in one unit on every row; a figure read in each row\'s own unit or currency is named bare. |\n| `register.search` | `search` names text, a code, or a link \u2014 matched by its row\'s title. |\n| `register.group` | `group` names one value per row \u2014 a single select, a one-row link, one member, a date, a yes/no or a text, a lookup through one-row links as the field it reads \u2014 never the status (its chips); only a table groups, and grouping by the title needs a subtitle to lead each row. |\n| `register.readings-own` | A register\'s `readings` read its own entity; another entity\'s stand on a dashboard. |\n| `register.readings-restate` | A register\'s metric never sums the row\'s figure or counts the rows without a `where`: the summary line totals the figure and the status chips count the rows. |\n| `register.where-opens` | `where` and `opens` hold the register\'s own selects and yes/nos, and `opens` a member field holding the reader (`"me"`); a field `where` fixes is never a filter nor opened otherwise, and `opens` stays among the options `where` keeps. |\n| `register.roster` | `layout: "roster"` and `roster` go together: the roster\'s entity has one single link to this one and a date on its line, a roster draws no `columns`, `expect` needs `roster` and `of` needs `expect`. |\n| `register.roster-expect` | A roster\'s `expect` is a single select of its rows, and `of` this entity\'s multi-select whose every option is one of `expect`\'s. |\n| `register.lanes` | `layout: "lanes"` and `lanes` go together: `lanes` is a one-row link to an entity with a `records` entry, the rows name a date on their line, a block\'s two ends are read alike (two days or two moments), and `loads` needs `lanes`. |\n| `register.loads` | `loads` names one to 2 numbers a block adds \u2014 never a percent \u2014 each against a number of the lane\'s row, in one unit or two of one dimension. |\n| `register.band-pivot` | *Noted, never refused:* A pivot in a register\'s band: its grid reads on a dashboard, and the band leads with a `metric`. |\n| `register.band-headline` | *Noted, never refused:* A register over rows that move (a status or a deadline) stating no `readings`: the band leads with the job\'s headline number. |\n\n<!-- generated:end rules-register -->\n\nThe row is the entity\'s `records` entry: its picture, title and the line under it,\nthen the status, the columns, and the figure at the right; the title, the status and a\ncolumn of days or amounts sort the rows by their header. The status is always the chips, with\ncounts, opening on the rows not closed (every row on a calendar or a lanes board, whose\nwindow of time narrows them) \u2014 never one of `filters`. `filters` are the ones a reader\nnarrows by every day \u2014 none to three, never a quota \u2014 in order of use, each a field the\nrows show (a column, a part of the row), each on the line\nwith the search and the chips, the grouping one\nchip at its end; a member filter offers "mine". A date filters by a range of days \u2014 of\nminutes on a `datetime` field, its end not held, so back-to-back shifts read each row\nonce \u2014 and can keep the rows holding no date too (in the yard at a moment: in before it,\nout after it or not yet). A number filters by a range typed in its\nunit or currency \u2014 a figure read in each row\'s own, in the one picked beside it \u2014 with a\nslider over a percent or a figure against a constant `limits`; `{ "field", "tiers" }`\noffers the bands its breakpoints cut in place of a range (`[1000, 5000]` on a weight in\nkg: under 1.000 kg, 1.000\u20135.000 kg, 5.000 kg and over), refused on a figure read in each\nrow\'s own unit. A threshold with a name is a formula yes/no, never a range. A\ncolumn the row already draws is refused. Absent `sort`, rows open soonest\ndeadline first where the row has a `due`, else newest first. `search` names the fields\nthe search box matches \u2014 a link by its row\'s title \u2014 and a pasted list searches each\nline, naming the lines no row matched; absent, it matches every word of the row.\n`export` saves the register as its report \u2014 the title, a line per chip, the search and\nthe moment it was exported, the readings, and every row in view, at most 20,000 of them.\n`export: true` saves it as a workbook, the readings on a sheet before the rows. A list\nstates the reports the business sends \u2014 one a button, several one menu \u2014 each a `label`,\na `description`, and a `template` filled with `title`, `lines`, `readings` and the rows\nunder the entity\'s alias (an html one made a PDF, an `excel` one a workbook; absent, the\nworkbook). A report of some rows (`where`), or of one value the reader picks (`per`: one\nline\'s file), first narrows the register as its chips, so the screen shows what the file holds.\n`readings` read the register\'s own rows above them: the rows in view, so the search,\nthe status and the filters narrow each one, but a picture\'s own field, which it reads as\nthe register opens on it. They are optional \u2014 state them where a\npicture answers something the rows cannot \u2014 and stand under the title in one compact\nband: lead with the job\'s headline number (a `metric`), then at most the mix (a\n`breakdown`) and the movement (a `trend`) \u2014 a `pivot` stands under the band as a whole table, every line and its totals. A picture\nstands only where it splits the rows in view into two parts or more, one of them\nholding two rows or more; a split whose rows\nall fall in one part, and a lone figure with no picture beside it, are said on the\nsummary line instead, so a band stands only holding a picture or two figures. The summary line already totals the\nfigure over the rows in view and the status chips count them, so a `metric` summing the\nfigure, or counting the rows of an entity with a status, is refused unless its `where`\nnarrows it.\n\n`where` keeps the rows the app works, read so on the server and never a chip: a\npurchase desk over orders of both directions states `"where": { "direction":\n["purchase"] }`, and a row added there is written holding the one option (a select kept\nat several is asked among them). `opens` is the view the register opens on, each entry a\nchip the reader may take away: a cashier opens on `"opens": { "owes": true }`. Both take\na select\'s options or a yes/no\'s value, stored or a formula; `opens` on the status is\nthe chips\' opening choice. `opens` also takes `"me"` on a member field \u2014 `"opens": {\n"assignee": "me" }` opens on the rows assigned to whoever reads, the server reading the\nreader, never the page; `where` refuses it, since it fixes the rows for every reader\n(who may read a row at all is the entity\'s `read_scope`).\n\n`layout: "calendar"` places each row on its day \u2014 a month, a week, a day or a list (a\nphone reads the list or a day): at its hour where the date holds one, over its span\nwhere the row\'s line holds a second date after it, its line\'s other words and the\nregister\'s `columns` after its title. The calendar reads the window in view, and its\ncount and the status chips count that window, opening on every row.\n\n`layout: "lanes"` with `lanes` naming a one-link draws each row of the linked entity as\na lane (a chair, a machine, a room), empty ones too, and each register row as a block\nfrom the first date on its line to the second: over the hours of one day where the first\nholds its hour, else over the days of one day, a week or a month. A block reads the row\'s\nname and the first of its `columns`; a free stretch between blocks adds a row there, its\nlane and its start set, and its end where the next block bounds it. A phone lists each\nlane\'s blocks and free stretches in clock order. Rows naming no lane stand first, in a lane\nof their own; where the app writes the link, each block moves to another lane from its menu.\nInside a folder (`scope`), the lanes are the ones whose own one-link names that folder \u2014 a\nbranch\'s rooms, never every branch\'s. A span\'s end holds its day unless `records` names it\nthe day the row `frees`.\n\n`loads` names what a lane carries: `{ "weight": "payload", "volume": "box" }` sums each\nblock\'s number and reads it against the lane row\'s own, at most two. A lane holds its\nblocks while they stand, so it reads the most they add up to at one time in the window \u2014\na day\'s rows together \u2014 named, past its bound, by how much and on which day or at which\nhour. The two are in one unit, or two of one dimension (kg against t); a block then reads\nwhat it adds, and the move menu reads each lane as it would stand with the block on it.\nA bound a single row must keep (no parcel heavier than its van) is a `write_rules` `max`\nthrough the link, which refuses the move.\n\n`layout: "roster"` draws the register\'s rows down the side and the days of a week or a\nmonth across; `roster` names the entity whose rows fill the days \u2014 each stands on one\nregister row by its single link to it, and on the first date of its line (a shift on a\nperson\'s day, a run on a vehicle\'s), on every day through the second date where its line\nholds one. A cell reads its row\'s status, else the first single select on its line (a\nshift\'s kind), several rows their count; a week\'s cells say their words and one more\nfact of the line, a month\'s keep their marks. A day holding none stays empty: nothing\nwas due, which is never an absence. A filled cell opens its row; an empty one adds a row\nthere, the register row and the day set, asking what any add of it asks \u2014 unless no\nperson writes those rows (`writes: false`). With `expect` (a single select of those\nrows) the columns are its options in place of days \u2014 a checklist of papers \u2014 and `of`\n(this entity\'s multi-select) names the ones each row expects: a gap among them reads as\none and adds its row, the others stand blank, and each row reads what it holds of them,\n`2/3`. A roster states no `columns` and needs no `readings`: its legend counts each\nstate in view.\n\n```jsonc\n"register": { "layout": "roster", "roster": "run", "filters": ["operator"] }\n```\n\nAn app whose job reads its rows otherwise than the entity\'s `records` restates them in\nits own `row` \u2014 the cashier\'s figure is what is still owed, its line the service and the\nday. The subtitle, figure and image it states replace the entity\'s wherever that app\ndraws a row of it; every other app reads `records`, and the title is the entity\'s.\n\n### Readings\n\nA reading is one number, or one picture of numbers, over rows. Where it stands decides\nwhich rows: a dashboard reads every row, a register\'s `readings` the rows in view, a\nrecord\'s reading block the child rows under the record. The picture is the runtime\'s,\nchosen from what the reading means \u2014 no key picks a chart.\n\n```jsonc\n{ "metric": "visit", "value": "fees", "where": { "paid": false }, "over": "arrived_on", "label": "Unpaid" }\n{ "breakdown": "visit", "by": "line" }\n{ "trend": "visit", "over": "arrived_on", "value": "fees" }\n{ "pivot": "visit", "rows": "size", "columns": "line" }\n{ "list": "visit", "where": { "stage": ["in_yard"] }, "columns": ["line"], "app": "gate", "label": "In the yard" }\n{ "list": "task", "where": { "assignee": "me" }, "label": "My tasks" }\n```\n\nA reading\'s `where` keeps rows by a select\'s options, a yes/no\'s value, or `"me"` on a\nmember field \u2014 the rows that name whoever reads, read so on the server.\n\n<!-- generated:start apps-readings -->\n\n#### Metric\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `metric` | alias | yes | The entity whose rows are counted, or summed, into one number |\n| `value` | alias | no | A number field summed over the rows; absent, the rows are counted |\n| `where` | map of alias \u2192 (list of alias (at least one) \\| boolean \\| `"me"`) | no | Only the rows whose select holds one of these options, whose yes/no (stored, or a formula) is this value \u2014 each its own, or looked up through one-row links \u2014, or whose member field holds the reader (`"me"`) \u2014 every entry ANDed |\n| `over` | alias | no | The date that places a row in time \u2014 its own (stored, or a formula), or its parent\'s through a lookup over a one-link: a dashboard\'s period windows the rows by it (a reading without one reads the rows as they stand now), and a metric reads its recent periods beside the number |\n| `target` | number | no | The number it is read against, where no `limits` bounds its value (a bounded value is read against the sum of its bound) |\n| `better` | `"up"` \\| `"down"` | no | Which way its change over the recent periods `over` reads is good; absent, a sum\'s rise and a count kept by `where` falling |\n| `label` | text | yes | What the reading is, in the reader\'s words |\n\n#### Breakdown\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `breakdown` | alias | yes | The entity whose rows are split into parts |\n| `by` | alias | yes | The single select, one link, member or yes/no (stored, a formula, or a lookup of one through one-row links) each row is counted under |\n| `value` | alias | no | A number field summed over the rows; absent, the rows are counted |\n| `where` | map of alias \u2192 (list of alias (at least one) \\| boolean \\| `"me"`) | no | Only the rows whose select holds one of these options, whose yes/no (stored, or a formula) is this value \u2014 each its own, or looked up through one-row links \u2014, or whose member field holds the reader (`"me"`) \u2014 every entry ANDed |\n| `over` | alias | no | The date that places a row in time \u2014 its own (stored, or a formula), or its parent\'s through a lookup over a one-link: a dashboard\'s period windows the rows by it (a reading without one reads the rows as they stand now), and a metric reads its recent periods beside the number |\n| `label` | text | no | What the reading is, in the reader\'s words; absent, the `by` field\'s label |\n\n#### Trend\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `trend` | alias | yes | The entity whose rows are counted, or summed, per period |\n| `over` | alias | yes | The date each row falls on \u2014 its own (stored, or a formula), or its parent\'s through a lookup over a one-link |\n| `ahead` | `true` | no | Counts forward: the current period first, then the ones after it, over the rows dated today or later (arrivals by their ETA); absent, the periods up to today |\n| `value` | alias | no | A number field summed over the rows; absent, the rows are counted |\n| `where` | map of alias \u2192 (list of alias (at least one) \\| boolean \\| `"me"`) | no | Only the rows whose select holds one of these options, whose yes/no (stored, or a formula) is this value \u2014 each its own, or looked up through one-row links \u2014, or whose member field holds the reader (`"me"`) \u2014 every entry ANDed |\n| `label` | text | no | What the reading is, in the reader\'s words; absent, the value\'s label, else the entity\'s |\n\n#### Pivot\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `pivot` | alias | yes | The entity whose rows are counted, or summed, in a grid |\n| `rows` | alias | yes | The single select, one link, member or yes/no (stored, a formula, or a lookup of one through one-row links) down the side |\n| `columns` | alias | yes | The single select, one link, member or yes/no (stored, a formula, or a lookup of one through one-row links) across the top |\n| `value` | alias | no | A number field summed over the rows; absent, the rows are counted |\n| `where` | map of alias \u2192 (list of alias (at least one) \\| boolean \\| `"me"`) | no | Only the rows whose select holds one of these options, whose yes/no (stored, or a formula) is this value \u2014 each its own, or looked up through one-row links \u2014, or whose member field holds the reader (`"me"`) \u2014 every entry ANDed |\n| `over` | alias | no | The date that places a row in time \u2014 its own (stored, or a formula), or its parent\'s through a lookup over a one-link: a dashboard\'s period windows the rows by it (a reading without one reads the rows as they stand now), and a metric reads its recent periods beside the number |\n| `label` | text | no | What the reading is, in the reader\'s words; absent, the two fields\' labels |\n\n#### List\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `list` | alias | yes | The entity whose rows are listed, each in its `records` anatomy |\n| `where` | map of alias \u2192 (list of alias (at least one) \\| boolean \\| `"me"`) | no | Only the rows whose select holds one of these options, whose yes/no (stored, or a formula) is this value \u2014 each its own, or looked up through one-row links \u2014, or whose member field holds the reader (`"me"`) \u2014 every entry ANDed |\n| `columns` | list of alias | no | Fields read after each row\'s title |\n| `app` | alias | no | An app of this model over the same entity that a row opens in |\n| `label` | text | yes | What the reading is, in the reader\'s words |\n\n<!-- generated:end apps-readings -->\n\n<!-- generated:start rules-reading -->\n\n#### Rules the check enforces\n\n| Rule | |\n|---|---|\n| `reading.value` | A reading sums a number, never a percent \u2014 percents do not add up. |\n| `reading.split` | `by`, `rows` and `columns` split by one value each row holds \u2014 a single select, a one-row link, one member or a yes/no, stored or a formula, a lookup through one-row links as the field it reads \u2014 and a pivot crosses two different fields. |\n| `reading.over` | `over` is a date: the row\'s own, stored or a formula, or its parent\'s through a lookup over a one-row link. |\n| `reading.where` | A reading\'s `where` keeps rows by a select\'s options, a yes/no\'s `true` or `false`, or a member field holding the reader (`"me"`). |\n| `reading.target` | `target` reads a value nothing bounds \u2014 a value `limits` bounds reads against the sum of its bound. |\n| `reading.better` | `better` needs `over`: a change is read over the periods its date places the rows in. |\n| `reading.list-app` | A list\'s `app` is a register app of this model over the list\'s own entity. |\n\n<!-- generated:end rules-reading -->\n\nA reading counts its rows, or sums the number `value` names \u2014 never a percent. `by`,\n`rows` and `columns` split the rows by one value each: a single select, a one-row link,\none member, or a yes/no \u2014 stored or a formula, its parts read as its label and the\nothers. `over` is a date, the row\'s own (stored or a formula) or its parent\'s through a\nlookup over a one-link: a trend\'s periods, a metric\'s recent periods beside its number,\nand what a dashboard\'s period windows. `ahead: true` reads a trend forward from the\ncurrent period over the rows still to come. `where` keeps rows whose select holds one\nof the options, or whose yes/no is the value, every entry ANDed \u2014 a band leads with the\njob\'s exception as a formula\'s yes/no (what is late, what is short), never a stage the\nstatus chips already count. A metric summing a value `limits` bounds reads against the\nsum of its bound (`10 / 14`); `target` reads one against a number nothing bounds. A\nmetric\'s change is green where it moves the good way: a sum\'s rise, a count kept by\n`where` falling; `better` states the other way where that reads wrong \u2014 money going out\n(`"better": "down"`). A register reads only its own entity; a `list` stands only on a\ndashboard.\n\n### Record\n\n```jsonc\n"record": {\n "door": "page",\n "sections": [\n { "title": "Details", "fields": ["size", "line", "built_on"] },\n { "title": "Gate in", "at": ["arriving", "in_yard"], "fields": ["arrived_on", "truck"],\n "blocks": [{ "rows": "fee", "where": { "leg": ["in"] }, "expect": "kind", "columns": ["amount", "paid_by"] }],\n "acts": ["gate_in_paper"] },\n { "title": "Sell to a buyer", "description": "Moves the container to the buyer\'s stock once it has left.", "acts": ["sell"] }\n ]\n}\n```\n\n<!-- generated:start apps-record -->\n\n#### Record page\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `door` | `"page"` \\| `"drawer"` | no | A page for work read at length; a drawer for rows worked one after another from the register. Either stacks its sections, and from three sections on navigates them \u2014 a page by a rail, a drawer by tabs; absent, a page where a section has `at` or is a `page` or the record has more than three sections, else a drawer |\n| `sections` | list of [Section](#section) (at least one) | no | The record in the order its work reaches it \u2014 each section its fields, then its blocks, then its acts. Absent, one section of every field a person writes that no other place shows |\n| `comments` | `true` | no | The record\'s comment thread beside the sections \u2014 who wrote what and when, with a composer \u2014 stated only where the job\'s people discuss a record or the owner asks for one. Absent, it is drawn nowhere |\n| `history` | `true` | no | The record\'s status history beside the sections \u2014 each move, when and who \u2014 stated only where the owner asks for an audit trail of the moves: the rail already marks the steps passed, and the entity\'s `status.history` is written either way. Absent, it is drawn nowhere |\n\n#### Section\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `title` | text | yes | What the section is, in the reader\'s words \u2014 its heading, and its name on the record\'s rail or tab |\n| `description` | text | no | One sentence under the title: what the section is for, or what its act does |\n| `at` | list of alias (at least one) | no | Options of the record\'s status (or its milestones) during which this section is the work now \u2014 a step of the path the record moves through: its rail item reads now while the status holds one and this app has work there, done once the record\'s history says it went through one \u2014 or it is a step of the path before where that history opens (with none, where the record stands) that no act moves the work past \u2014 and it stands before the section that is the work now, and waiting otherwise; a section every option of which ends the work, past the path\'s end or entered by its own act, is an exit: no item and nothing drawn until the record stands in it, then set apart after the steps and never one; A page opened from the register opens at it. It never locks what the section holds: its fields are written as the write rules and checks allow at any stage. An act it names is offered during these alone: its `when` holds the status to them, or on milestones it stamps the step after one of them \u2014 a detour and an exit are sections of their own, a detour stated before the step it returns to |\n| `fields` | list of alias (at least one) | no | The record\'s own fields in this section, in the order they are read \u2014 never one the header draws: the row\'s title, subtitle, image, status or figure |\n| `blocks` | list of [block](#blocks) (at least one) | no | What the section holds besides its own fields, under them, in order |\n| `acts` | list of alias (at least one) | no | Acts of this app drawn under the section\'s fields, their asks as more of them and what each lacks said above its button; the header draws no act, so every act of the record itself is named by one section \u2014 an act of a child (`of`) stands on the child\'s row and is never named here. An act moving the status, offered at ONE step (the stage its `when` holds), stands at that step\'s foot when it moves the work forward \u2014 to a later option, an exit too \u2014 or back to a step the work passes anyway; one offered at several steps, or moving back into a detour, stands in the section it enters, which draws it while the work waits \u2014 an exit\'s in the header\'s \u22EF, since an exit stands only once the record is in it. A correction \u2014 `danger` and not one of its step\'s outcomes (no other status move offered at the same moment) \u2014 waits in the section heading\'s \u22EF, and one no section names in the header\'s \u22EF; every other act is named by a section |\n| `when` | map of alias \u2192 (list of alias (at least one) \\| boolean) | no | Shown only while each named select of the record holds one of these options, and each named yes/no (stored, or a formula) is this value |\n| `page` | `true` | no | A page of its own, off the record\'s scroll: its own heading and a way back, reached from the record\'s rail after the scroll\'s sections, or from a link at its place where the record has no rail \u2014 for what makes the record worse stacked in it: a long list of related rows, a workspace of its own. Only on a page door, never a step (`at`) |\n\n<!-- generated:end apps-record -->\n\n<!-- generated:start rules-record -->\n\n#### Rules the check enforces\n\n| Rule | |\n|---|---|\n| `record.placed-once` | A field, a block and an act each stand once on a record: the header draws the title, subtitle, image, status (or milestones), figure and folder, and a field\'s one other place is a section\'s `fields`, a files block or a text block \u2014 save the image, which one files block may draw again, whole. |\n| `record.foot-total` | A rows block\'s foot totals the child\'s figure and each summed column over the rows it lists; the record\'s rollup summing that field over those rows (the same `where`) is that foot, never also one of a section\'s `fields`. |\n| `record.fact-restates` | A section\'s field never looks up what its link already reads where it stands: the linked row\'s title and line beside the link, the figure or bound its meter reads on the header\'s line. |\n| `record.section-holds` | A section holds fields, blocks or acts. |\n| `record.at` | `at` names options of the record\'s stored status, or its milestones; a record with no status has no steps. |\n| `record.page` | A section is a `page` only on a page door and never a step (`at`), its title naming an address no other page shares (a letter or a digit at least), and never every section. |\n| `record.history` | `record.history` draws a status history the entity records (`status.history`); no block reads that history. |\n| `record.section-acts` | A section\'s `acts` name acts of the record itself: an act of a child (`of`) stands on the child\'s row, and one over the register\'s rows (`on`) on the register. |\n| `record.act-in-section` | Every act of the record stands in the `acts` of the section whose work it is; only a correction no section owns \u2014 `danger`, and no other status move offered at the same moment \u2014 waits in the header\'s \u22EF. |\n| `record.move-home` | A status move offered at one step stands at that step\'s foot when it moves the work forward, to an exit, or back to a step it passes anyway; one offered at several steps, or moving back into a detour, stands in the section `at` the status it enters. |\n| `record.act-staged` | An act at a staged section\'s foot is offered only during that section\'s steps: its `when` holds the status to options the section names \u2014 on milestones, it stamps the step after one of them. |\n| `record.act-hidden` | An act is never offered only while its section\'s `when` hides the section. |\n\n<!-- generated:end rules-record -->\n\nThe record is its `sections`, stacked in the order the work reaches them. A section is\nits fields, the acts under them, then its blocks \u2014 the acts at its foot instead where one\nreads what a block holds or none of its fields \u2014 and holds at least one of them. From\nthree sections on, the record is navigated by their titles: a page by a rail that jumps\nto each (a strip of the same names on a phone), a drawer by tabs, the companion the last;\nwith fewer, the sections just stack. `description` is one sentence under the title.\n`at` names the status options (or the milestones) during which the section is the work\nnow \u2014 only on a record that truly moves through those stages: the rail marks it done,\nnow or waiting (an item of no `at` is its title alone), and the section stands even holding\nnothing yet \u2014 it never hides a field, locks it or gates an act, and a record opens at its\nhead. `page: true` makes a section a page of its own under the\nrecord\'s, off its scroll, with a way back \u2014 rarely, for a long related list or a workspace\nof its own that would make the record worse stacked; never on a drawer or a step. The\nheader draws no act: every act on the record is named by the section whose work it is, and one no section names is refused, naming its likely\nsection \u2014 only a correction no section owns waits in the header\'s \u22EF beside Delete. An act\nmoving the status and offered at ONE step (its `when`) stands at that step\'s foot when it\nmoves the work forward \u2014 to the next step, or to an exit later in the status\'s options\n(Reject beside Approve) \u2014 or back to a step the work passes anyway. One offered at SEVERAL\nsteps, or moving back into a detour, is named by the section it enters: a detour draws it and its\ngaps alone while it waits. A `danger` act is a correction \u2014 waiting in the \u22EF of what it acts\non: its section\'s heading, its row, the header\'s where no section names it \u2014 unless it moves\nthe status while another status move is offered at the same moment; then it is one of that\nstep\'s outcomes, a button. Cancel offered at Held and at Confirmed, beside Confirm, is an\noutcome into an exit: state `{ "title": "Cancelled", "at": ["cancelled"], "fields": ["reason"],\n"acts": ["cancel"] }`. An exit stands only once the record is in it, its reason there and its\nrail item apart from the path; until then Cancel waits in the header\'s \u22EF. `comments: true`\nputs the record\'s comment thread beside the sections, and `history: true` its status history \u2014\nthe history never as a section. Both are opt-in: state them only where the job\'s people\ndiscuss a record, or the owner asks for an audit trail of its moves.\n\nA field, a block and an act is each placed ONCE on a record \u2014 the header, one section;\na second place is refused. The header draws the entity\'s `records` title, subtitle,\nimage, status (or milestones) and figure, so none of them is named again in a section\'s\n`fields` or the register\'s `columns` \u2014 save the image, which one `files` block may draw\nagain, whole at reading size (an incident\'s photo, a scan), the header keeping its mark. Refused too: a section holding nothing, an `at`\non a record with no status, and a section\'s act that is a child\'s or runs over the\nregister\'s rows.\nAbsent `sections`, one section holds every field a person writes that the header does\nnot show. An editable field rests as its control and saves as it changes; everything\nelse is plain text. A section or a block with `when` is shown only while each named\nselect of the record holds one of its options. The one layout serves every entity: a\ncustomer or a product is sections without `at`.\n\n### Blocks\n\n```jsonc\n"blocks": [\n { "rows": "fee", "columns": ["kind", "amount"] },\n { "rows": "fee", "where": { "leg": ["out"] }, "columns": ["kind", "amount"], "under": "invoice" },\n { "agenda": "booking", "columns": ["guide"], "start": "arrival" },\n { "timeline": "note" },\n { "files": ["photos", "papers"] },\n { "text": "remarks", "when": { "stage": ["held"] } },\n { "metric": "fee", "value": "amount", "label": "Fees" },\n { "breakdown": "fee", "by": "kind" },\n { "trend": "fee", "over": "charged_on", "value": "amount" },\n { "pivot": "fee", "rows": "kind", "columns": "method" }\n]\n```\n\n<!-- generated:start apps-blocks -->\n\n#### Rows block\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `rows` | alias | yes | A child entity whose rows belong to this record |\n| `via` | alias | no | The child\'s link to this record, where it has more than one |\n| `title` | text | no | The block\'s heading; absent, the child entity\'s or the field\'s own label |\n| `columns` | list of alias | no | The child\'s fields read as columns after its title \u2014 never what its row draws (subtitle, image, status, figure, or the bound its figure\'s meter reads against), though an `expect` block\'s figure is a column, filled in place |\n| `create` | list of alias (at least one) \\| `false` | no | The child\'s fields asked when a row is added here; absent, its title, its picture, the subtitle and figure no default fills, the block\'s columns, its natural key and every required field \u2014 each a person writes; false, rows are not added here |\n| `where` | map of alias \u2192 list of alias (at least one) | no | Only the child rows whose single select holds one of these options \u2014 every entry ANDed, read so on the server; a row added here holds them (one leg\'s fees, of a record holding both legs\'). Each select is one the child requires, so no row stands in no block |\n| `expect` | alias | no | The child\'s title when the record holds one row per value of it \u2014 a single select (one per option, in order) or a one-row link to a catalog (one per row the link may point at): a value not yet filled reads as its own empty line, and no value holds two rows. The block\'s `columns` name at least one field a person fills in place |\n| `of` | alias | no | With `expect` on a select: the record\'s own multi-select holding the options this record expects a line for \u2014 the options it holds, in order, rather than every option. Its options are among the title\'s |\n| `under` | alias | no | The child\'s one-link to a document that covers its rows (an invoice over its fee lines), whose many-link points back and which links to this record: each document stands as a heading over the lines it covers; a filled line no document covers says so on its own row with a make for one document over it, and two or more waiting take a combined make in the block\'s heading. Never also a rows block of the document |\n| `when` | map of alias \u2192 (list of alias (at least one) \\| boolean) | no | Shown only while each named select of the record holds one of these options, and each named yes/no (stored, or a formula) is this value |\n\n#### Timeline block\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `timeline` | alias | yes | A child entity read as a log of dated entries, newest first, with a composer where the app adds entries, each corrected and removed where it stands as a rows block\'s row (entries planned ahead are an `agenda`) \u2014 never the record\'s status history, which `record.history` draws beside the record |\n| `via` | alias | no | The child\'s link to this record, where it has more than one |\n| `title` | text | no | The block\'s heading; absent, the child entity\'s or the field\'s own label |\n| `create` | list of alias (at least one) \\| `false` | no | The child\'s fields asked when a row is added here; absent, its title, the subtitle and figure no default fills, its natural key and every required field \u2014 each a person writes; false, rows are not added here |\n| `when` | map of alias \u2192 (list of alias (at least one) \\| boolean) | no | Shown only while each named select of the record holds one of these options, and each named yes/no (stored, or a formula) is this value |\n\n#### Agenda block\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `agenda` | alias | yes | A child entity read as planned entries on a time axis: by day, soonest first, each entry with its picture and the day that is today marked. The day is the first date on the child\'s row line (its `records` title or subtitle); within a day entries follow a datetime there, else the first single select after the date \u2014 its options in the day\'s order |\n| `via` | alias | no | The child\'s link to this record, where it has more than one |\n| `title` | text | no | The block\'s heading; absent, the child entity\'s or the field\'s own label |\n| `columns` | list of alias | no | The child\'s facts read on an entry\'s line after its title \u2014 never what its line already draws (subtitle, image, status, figure) |\n| `create` | list of alias (at least one) \\| `false` | no | The child\'s fields asked when a row is added here; absent, its title, its picture, the subtitle and figure no default fills, the block\'s columns, its natural key and every required field \u2014 each a person writes; false, rows are not added here |\n| `start` | alias | no | The record\'s date that is the first day: each day\'s heading counts from it (Day 1, Day 2); absent, the weekday and the date alone |\n| `when` | map of alias \u2192 (list of alias (at least one) \\| boolean) | no | Shown only while each named select of the record holds one of these options, and each named yes/no (stored, or a formula) is this value |\n\n#### Files block\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `files` | list of alias (at least one) | yes | Files fields of this record, read as pictures and documents |\n| `title` | text | no | The block\'s heading; absent, the child entity\'s or the field\'s own label |\n| `when` | map of alias \u2192 (list of alias (at least one) \\| boolean) | no | Shown only while each named select of the record holds one of these options, and each named yes/no (stored, or a formula) is this value |\n\n#### Text block\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `text` | alias | yes | A long text field read as prose |\n| `title` | text | no | The block\'s heading; absent, the child entity\'s or the field\'s own label |\n| `when` | map of alias \u2192 (list of alias (at least one) \\| boolean) | no | Shown only while each named select of the record holds one of these options, and each named yes/no (stored, or a formula) is this value |\n\n#### Metric block\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `metric` | alias | yes | The entity whose rows are counted, or summed, into one number |\n| `value` | alias | no | A number field summed over the rows; absent, the rows are counted |\n| `where` | map of alias \u2192 (list of alias (at least one) \\| boolean \\| `"me"`) | no | Only the rows whose select holds one of these options, whose yes/no (stored, or a formula) is this value \u2014 each its own, or looked up through one-row links \u2014, or whose member field holds the reader (`"me"`) \u2014 every entry ANDed |\n| `over` | alias | no | The date that places a row in time \u2014 its own (stored, or a formula), or its parent\'s through a lookup over a one-link: a dashboard\'s period windows the rows by it (a reading without one reads the rows as they stand now), and a metric reads its recent periods beside the number |\n| `target` | number | no | The number it is read against, where no `limits` bounds its value (a bounded value is read against the sum of its bound) |\n| `better` | `"up"` \\| `"down"` | no | Which way its change over the recent periods `over` reads is good; absent, a sum\'s rise and a count kept by `where` falling |\n| `label` | text | yes | What the reading is, in the reader\'s words |\n| `via` | alias | no | The child\'s link to this record, where it has more than one |\n| `when` | map of alias \u2192 (list of alias (at least one) \\| boolean) | no | Shown only while each named select of the record holds one of these options, and each named yes/no (stored, or a formula) is this value |\n\n#### Breakdown block\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `breakdown` | alias | yes | The entity whose rows are split into parts |\n| `by` | alias | yes | The single select, one link, member or yes/no (stored, a formula, or a lookup of one through one-row links) each row is counted under |\n| `value` | alias | no | A number field summed over the rows; absent, the rows are counted |\n| `where` | map of alias \u2192 (list of alias (at least one) \\| boolean \\| `"me"`) | no | Only the rows whose select holds one of these options, whose yes/no (stored, or a formula) is this value \u2014 each its own, or looked up through one-row links \u2014, or whose member field holds the reader (`"me"`) \u2014 every entry ANDed |\n| `over` | alias | no | The date that places a row in time \u2014 its own (stored, or a formula), or its parent\'s through a lookup over a one-link: a dashboard\'s period windows the rows by it (a reading without one reads the rows as they stand now), and a metric reads its recent periods beside the number |\n| `label` | text | no | What the reading is, in the reader\'s words; absent, the `by` field\'s label |\n| `via` | alias | no | The child\'s link to this record, where it has more than one |\n| `when` | map of alias \u2192 (list of alias (at least one) \\| boolean) | no | Shown only while each named select of the record holds one of these options, and each named yes/no (stored, or a formula) is this value |\n\n#### Trend block\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `trend` | alias | yes | The entity whose rows are counted, or summed, per period |\n| `over` | alias | yes | The date each row falls on \u2014 its own (stored, or a formula), or its parent\'s through a lookup over a one-link |\n| `ahead` | `true` | no | Counts forward: the current period first, then the ones after it, over the rows dated today or later (arrivals by their ETA); absent, the periods up to today |\n| `value` | alias | no | A number field summed over the rows; absent, the rows are counted |\n| `where` | map of alias \u2192 (list of alias (at least one) \\| boolean \\| `"me"`) | no | Only the rows whose select holds one of these options, whose yes/no (stored, or a formula) is this value \u2014 each its own, or looked up through one-row links \u2014, or whose member field holds the reader (`"me"`) \u2014 every entry ANDed |\n| `label` | text | no | What the reading is, in the reader\'s words; absent, the value\'s label, else the entity\'s |\n| `via` | alias | no | The child\'s link to this record, where it has more than one |\n| `when` | map of alias \u2192 (list of alias (at least one) \\| boolean) | no | Shown only while each named select of the record holds one of these options, and each named yes/no (stored, or a formula) is this value |\n\n#### Pivot block\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `pivot` | alias | yes | The entity whose rows are counted, or summed, in a grid |\n| `rows` | alias | yes | The single select, one link, member or yes/no (stored, a formula, or a lookup of one through one-row links) down the side |\n| `columns` | alias | yes | The single select, one link, member or yes/no (stored, a formula, or a lookup of one through one-row links) across the top |\n| `value` | alias | no | A number field summed over the rows; absent, the rows are counted |\n| `where` | map of alias \u2192 (list of alias (at least one) \\| boolean \\| `"me"`) | no | Only the rows whose select holds one of these options, whose yes/no (stored, or a formula) is this value \u2014 each its own, or looked up through one-row links \u2014, or whose member field holds the reader (`"me"`) \u2014 every entry ANDed |\n| `over` | alias | no | The date that places a row in time \u2014 its own (stored, or a formula), or its parent\'s through a lookup over a one-link: a dashboard\'s period windows the rows by it (a reading without one reads the rows as they stand now), and a metric reads its recent periods beside the number |\n| `label` | text | no | What the reading is, in the reader\'s words; absent, the two fields\' labels |\n| `via` | alias | no | The child\'s link to this record, where it has more than one |\n| `when` | map of alias \u2192 (list of alias (at least one) \\| boolean) | no | Shown only while each named select of the record holds one of these options, and each named yes/no (stored, or a formula) is this value |\n\n<!-- generated:end apps-blocks -->\n\n<!-- generated:start rules-block -->\n\n#### Rules the check enforces\n\n| Rule | |\n|---|---|\n| `block.child-link` | A block reads a child linked to the record; `via` names the link where the child links more than once. |\n| `block.column-drawn` | A child block\'s column never names what the child\'s row draws \u2014 its title, subtitle, image, status, figure, or the bound its figure\'s meter reads against \u2014 nor its link back to the record, and names a field once; an `expect` block\'s figure is its filled-in-place column. |\n| `block.title-back` | Where a child\'s title is its link back to the record a block lists it under, its first other subtitle names it there \u2014 a text, a code, a select, a link or a member, never a number or a date. |\n| `block.where` | A rows block\'s `where` names single selects the child requires, by options they hold; one held at a single option is never also a column. |\n| `block.under` | `under` names the child\'s one-row link to a document entity that pairs a many-link back and is read under this record by its one link; the lines\' columns never read the document (its heading does) nor hold long text. |\n| `block.under-once` | Documents drawn over their lines (`under`) are never listed again as a block of their own. |\n| `block.expect` | `expect` names the child\'s title \u2014 a single select or a one-row link a person writes, never the link back \u2014 on a child added in the block; the block\'s `columns` name at least one field a person fills in place, and its `create` takes the file where the child is pictured by one. |\n| `block.expect-fills` | An expected line is made from its key and its first filled column, so every other field the child requires has a default, a start or a `default_from`, or is read first. |\n| `block.expect-of` | A block\'s `of` needs `expect` on a select, and names the record\'s multi-select whose every option is one of the title\'s. |\n| `block.agenda` | An agenda\'s child names a date on its row line (`records` title or subtitle); `start` is a date of the record. |\n| `block.timeline` | A timeline\'s child holds a date to place its entries by. |\n| `block.field-kind` | A files block names files fields of the record, and a text block a text field. |\n| `block.read-scope` | A child read under a record whose rows a `read_scope` narrows states its own \u2014 a row rule is not inherited, save the status history\'s, which takes its record\'s. |\n| `block.agenda-note` | *Noted, never refused:* Rows each on a day and within it (at an hour, in a part of the day) listed as a table: an `agenda` draws them by day. |\n| `block.under-note` | *Noted, never refused:* Rows holding a paper that cover another block\'s lines, listed apart with no add of their own stated: `under` draws them over the lines they cover. |\n\n<!-- generated:end rules-block -->\n\nA `rows`, `agenda` or `timeline` block reads a child entity through its link to the\nrecord \u2014 `via` names it where the child links more than once. A rows block adds rows\n(asking the child\'s title, its picture, the block\'s columns and its required fields)\nand opens each in a drawer. An `agenda` draws planned entries by day, soonest first:\nthe first date on the child\'s row line is the day, a datetime there or the first single\nselect after the date orders a day, and `start` \u2014 the record\'s date \u2014 is day 1. `under`\nnames the child\'s one-link to a document covering its lines (an invoice over its fees,\nits many-link paired back, linking to the record): each document heads the lines it\ncovers, the uncovered lines first \u2014 the record never lists the documents again as a\nblock of their own. A filled line no document covers says so on its own row, where one\npress makes a document over that line alone, its figure starting at the line\'s amount;\nwhere two or more wait, the block\'s heading makes one over those ticked in its dialog.\nA timeline reads its child\'s first date as the moment and its member field as who, with\na composer where the app writes it. An agenda\'s or a timeline\'s entry with no day yet is\na plan, listed first and dated in place. `create` names the child\'s fields an add here asks \u2014\nthe link to this record is filled, never asked \u2014 and `false` adds none. `expect`\nnames the child\'s title where the record holds one row per value of it \u2014 a select\'s\noptions, or the rows a link to a catalog may point at (`options_where`): every value\nis a line, one not yet filled a quiet line whose first column makes its row \u2014 or, where\nthe child is pictured by a file a person brings (its `records` `image`), a placeholder\nnaming the paper whose upload makes the row with its file \u2014 the add\noffers only the values not yet held, and every write path refuses a second row of one\nvalue under one record. A field that starts from the catalog row (`default_from`)\nshows that value as its hint, taken with one press. `where` keeps only the child rows\nwhose single select holds one of its options \u2014 read so on the server, a row added\nthere holding them, its lines expected once per value among them (one leg\'s fees\nbeside the other\'s), and its foot totalled by the record\'s sum narrowed alike. A `metric`, `breakdown`, `trend`\nor `pivot` block is a reading (\xA7 Readings) of a child entity\'s rows under this record,\nread only \u2014 `via` names the link where the child has more than one.\n\n### Tasks\n\nAn entity whose `records` states `"task": true` \u2014 its status a stored select with `closed` \u2014 is\nwork someone finishes. Every table of its rows draws it alike \u2014 a rows block of the record it\nbelongs to, its own register, the rows filed under one of its rows (its steps) \u2014 each row led by a\nring. Ticking the ring moves the row to a closed option by the one write the app already has for\nthat move \u2014 the act of that entity setting a closed option (its first preferred), offered on an\nopen row and asking nothing, else its own save where people write the status \u2014 stamping what\nthat act stamps and appending the status history. Unticking runs the act moving a closed row\nback (its `when` holding a closed option), else the save back to the status\'s default. A move no\nwrite reaches leaves the ring disabled, never hidden, and the check notes it. The status is moved\nin place on the row by the same moves; every other field is edited where the row opens. A\nfiles column reads on a task\'s line as how many files it holds. An act `of` the child with\n`on: "rows"` completes several at once: the list\'s heading offers to select rows, and the act\nruns on those picked. A block with `expect` or `under` draws its own lines, never rings.\n\n```json\n{\n "entities": [\n {\n "alias": "project",\n "label": "Projects",\n "singular": "Project",\n "fields": [\n { "alias": "name", "label": "Name", "type": "text", "required": true },\n { "alias": "lead", "label": "Lead", "type": "select_member" }\n ]\n },\n {\n "alias": "task",\n "label": "Tasks",\n "singular": "Task",\n "fields": [\n { "alias": "title", "label": "Title", "type": "text", "required": true },\n {\n "alias": "project",\n "label": "Project",\n "type": "select_record_link",\n "target_entity": "project",\n "cardinality": "one",\n "required": true\n },\n { "alias": "assignee", "label": "Assignee", "type": "select_member" },\n {\n "alias": "status",\n "label": "Status",\n "type": "select",\n "required": true,\n "options": [\n { "alias": "todo", "label": "To do", "color": "slate" },\n { "alias": "done", "label": "Done", "color": "green" }\n ],\n "default": ["todo"]\n },\n { "alias": "due", "label": "Due", "type": "date", "format": "date" },\n { "alias": "done_on", "label": "Done on", "type": "date", "format": "date" }\n ]\n }\n ],\n "records": {\n "project": { "title": "name" },\n "task": {\n "title": "title",\n "subtitle": ["assignee"],\n "status": { "field": "status", "closed": ["done"] },\n "due": ["due"],\n "task": true,\n "starts": { "assignee": "me" }\n }\n },\n "apps": [\n {\n "alias": "projects",\n "name": "Projects",\n "entity": "project",\n "record": {\n "sections": [{ "title": "Work", "fields": ["lead"], "blocks": [{ "rows": "task", "columns": ["due"] }] }]\n },\n "acts": [\n { "alias": "complete", "label": "Complete", "of": "task", "when": { "status": ["todo"] }, "set": { "status": "done", "done_on": "now" } },\n { "alias": "reopen", "label": "Reopen", "of": "task", "when": { "status": ["done"] }, "set": { "status": "todo", "done_on": null } },\n { "alias": "complete_all", "label": "Complete", "of": "task", "on": "rows", "when": { "status": ["todo"] }, "set": { "status": "done", "done_on": "now" } }\n ]\n },\n {\n "alias": "my_tasks",\n "name": "My tasks",\n "entity": "task",\n "register": {\n "opens": { "assignee": "me" },\n "readings": [{ "metric": "task", "where": { "status": ["todo"] }, "label": "Open" }]\n },\n "record": { "door": "drawer" },\n "acts": [\n { "alias": "finish", "label": "Finish", "when": { "status": ["todo"] }, "set": { "status": "done", "done_on": "now" } },\n { "alias": "undo", "label": "Undo", "when": { "status": ["done"] }, "set": { "status": "todo", "done_on": null } }\n ]\n }\n ]\n}\n```\n\n### Acts\n\n```jsonc\n"acts": [{\n "alias": "gate_out", "label": "Gate out",\n "when": { "stage": ["in_yard"] }, "requires": ["release", "seal"],\n "asks": ["seal", { "input": "note", "label": "Note", "type": "long_text" }],\n "set": { "stage": "gone", "left_on": "now", "left_by": "me", "remark": "input:note" },\n "confirm": true\n}]\n```\n\n<!-- generated:start apps-acts -->\n\n#### Act\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `alias` | alias | yes | The act\'s name within its app \u2014 its workflow is `act_<alias>` |\n| `label` | text | yes | The verb, as the reader says it |\n| `on` | `"record"` \\| `"rows"` \\| `"view"` | no | `rows` runs on the rows ticked in the register \u2014 with `of`, on the child rows ticked in the record\'s task list; `view` on every row the register shows (offered while the view is narrowed to its `when`; it states no `requires`); absent, on one record (its page and its row\'s menu) |\n| `of` | alias | no | A rows block\'s child entity the act works on: offered on each child row \u2014 or, `on: "rows"`, on the rows ticked together in a task list \u2014 its conditions and its write that row\'s |\n| `when` | map of alias \u2192 (list of alias (at least one) \\| boolean) | no | The act works only while each named select holds one of these options, and each named yes/no (stored, or a formula) is this value |\n| `requires` | list of alias (at least one) | no | Fields that must be filled first, each drawn where the act stands (its section\'s fields, a block\'s, or the act\'s asks \u2014 never the header alone); a blocked act names each one missing |\n| `recommends` | list of alias (at least one) | no | Fields the act runs without and reads when filled: while one is empty, the act says what it will leave blank |\n| `asks` | list of (alias \\| [Act input](#act-input)) (at least one) | no | What the reader states when pressing it \u2014 fields of the record (written by the act) or inputs |\n| `set` | map of alias \u2192 (text \\| number \\| boolean \\| `null`) | no | What the act writes: an option alias, a value, `"now"`, `"me"` or `"input:<name>"` |\n| `workflow` | alias | no | An authored workflow (src/workflows/<alias>.ts) the act runs after its checks, for what `set` cannot say |\n| `template` | alias | no | A document template the act makes a file from \u2014 over several rows, one file of them all, the rows listed under the entity\'s alias |\n| `templates` | list of [Act template](#act-template) (at least 2) | no | Several papers the act makes into `into` (a case\'s forms), instead of one `template`: drawn where the act stands as a list of its papers \u2014 each made one as its file, each not yet made as a placeholder naming it \u2014 the reader ticks which to make, and one press makes those, each replacing the paper its template made before |\n| `into` | alias | no | The files field of the one record the made document is kept in |\n| `intake` | alias | no | A child the record lists in a rows block whose rows are its papers: the press takes papers, an agent reads them, and each is filed as a row of this child \u2014 its kind the child\'s title, its file in the child\'s files field |\n| `record` | [Act record](#act-record) | no | The press records a call, visit or meeting through the host \u2014 Stop ends it \u2014 and files it as a new row of a child the record lists: its audio, its screen where captured, its transcript |\n| `fills` | list of text (at least one) | no | With `intake`, what the papers read may fill: a field of the record, `<link>.<field>` on the row a required one-row link of the record names, or a child whose rows the papers add \u2014 shown before and after, and saved where it differs. With `record`, fields of the new row an agent fills from the transcript, saved as they come |\n| `confirm` | `true` | no | The press asks first; the question lists every active warning |\n| `danger` | `true` | no | The act destroys or cannot be undone |\n\n#### Act input\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `input` | alias | yes | A value the act asks for that is not a field of the record |\n| `label` | text | yes | What the reader is asked, in their words |\n| `type` | `"text"` \\| `"long_text"` \\| `"number"` \\| `"date"` \\| `"select"` \\| `"link"` \\| `"member"` | yes | What the reader states |\n| `options` | list of [Select option](#select-option) (at least one) | no | The choices a `select` input offers, one picked \u2014 written into a select holding the same option aliases |\n| `entity` | alias | no | The entity a `link` input picks one row of |\n| `required` | `true` | no | The act is refused without it |\n| `default` | alias | no | A field of the row whose value the input starts from, still changed at will |\n\n#### Act template\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `template` | alias | yes | A document template the act makes a paper of, kept in `into` |\n| `when` | map of alias \u2192 (list of alias (at least one) \\| boolean) | no | The paper starts ticked while each named select of the record holds one of these options and each named yes/no (stored, or a formula \u2014 how a multi-select is tested: `includes({needs}, {needs:x})`) is this value \u2014 a suggestion the reader changes, never a refusal; absent, it starts ticked |\n\n#### Act record\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `into` | alias | yes | A child the record lists in a timeline or rows block, linking back to it by a single link: each recording is filed as a new row of it |\n| `audio` | alias | yes | The child\'s files field the recording\'s audio is kept in |\n| `transcript` | alias | yes | The child\'s text field the transcript is kept in, a speaker\'s turn per line |\n| `video` | alias | no | The child\'s files field the screen is kept in, where the recording captured it |\n| `at` | alias | no | The child\'s date field stamped with the moment the recording started |\n| `by` | alias | no | The child\'s member field set to the person who recorded |\n\n<!-- generated:end apps-acts -->\n\n<!-- generated:start rules-act -->\n\n#### Rules the check enforces\n\n| Rule | |\n|---|---|\n| `act.set-not-asked` | A field an act `set`s is the act\'s to write: read-only everywhere else and never asked by an add (`create`) \u2014 a required one takes a `default`. |\n| `act.of` | An act\'s `of` names a child the record lists in a rows block; it works on the one child row it is pressed on \u2014 or, `on: "rows"`, on the rows ticked together where the record lists that child as tasks \u2014 never on the rows in view. |\n| `act.writes-line-key` | An act never writes the link or the key naming an expected line under its record \u2014 a line\'s key is stated by filling it. |\n| `act.makes-or-runs` | An act makes a document (`template`, `templates`) or runs an authored `workflow`, never both \u2014 the workflow makes what it needs. |\n| `act.view` | An act over every row in view (`on: "view"`) writes (`set`), makes a document or runs a workflow, and states no `requires`. |\n| `act.requires-drawn` | Every field an act `requires` is drawn where the act stands \u2014 its section\'s fields, a block\'s, its asks, or an unstaged section\'s where its own is unstaged \u2014 never the header alone. |\n| `act.requires-written` | A field an act requires that only an act writes is written by an act offered together with it, or asked by the act itself. |\n| `act.recommends` | A field an act `recommends` is not also in its `requires`. |\n| `act.set` | `set` writes each field a value it holds \u2014 an option alias, a number, a yes/no, a text, `"now"` on a date, `"me"` on a member, `"input:<name>"` of an input the act asks of the same kind \u2014 or clears an optional one with `null`. |\n| `act.set-milestone` | An act stamps a milestone, never clears one \u2014 unticking clears it and every later one. |\n| `act.into` | `into` is a files field of the one record the act is pressed on, beside its `template` or `templates`. |\n| `act.templates` | `templates` names each template once, kept in `into`, on one record pressed alone \u2014 never beside `template`, `asks`, `of` or an `on` over several rows. |\n| `act.history-copy` | What a status move asks is copied onto the history\'s field of the same name, which holds the same kind of value. |\n| `act.intake` | `intake` names a child the record lists in a rows block that expects its title \u2014 a single select, the paper\'s kind \u2014 and is narrowed by no `where`, holding exactly one files field and needing nothing an added line does not fill; the act runs on one record, states `fills`, and states nothing but its `label`, `when` and `requires` beside them. |\n| `act.record` | `record` names a child the record draws in a timeline block or a rows block with no `expect`, `under` or `where`, linking back by one single link, whose row nothing requires beyond what the recording writes: `audio` and `video` its files fields, `transcript` a text field, `at` a date, `by` a member field, each a field of its own; the act runs on one record and states nothing but its `label`, `when`, `requires` and `fills` beside it. |\n| `act.fills` | `fills` names each once, only beside `intake` or `record`. Beside `record`, each is a field of the recording\'s row that the recording itself does not write. Beside `intake`: a field of the record, `<link>.<field>` on the row a required one-row link of the record names, or a child the record adds rows of in a rows block with no `expect`, `under` or `where` \u2014 its rows filled in the fields that block adds them with, among them every field an added row cannot be made without. Each field filled is one a person writes holding text, a number, a date, a yes/no or options, never a status, a milestone or a field an act writes. |\n| `act.fills-drawn` | *Noted, never refused:* A field `fills` writes that the record draws nowhere: the review shows the change, the record does not. |\n| `act.fills-new` | *Noted, never refused:* A child `fills` adds rows of, whose natural key the papers cannot state: every row read is added, so the same papers read twice list them twice. |\n| `act.input` | An input has a name of its own \u2014 never another ask\'s, a field\'s, or the record input its workflow takes \u2014 `options` exactly when it is a select, `entity` exactly when it is a link, and a `default` field holding what it states. |\n\n<!-- generated:end rules-act -->\n\nAn act whose `when` does not hold is not offered \u2014 each select named holding one of its\noptions, each yes/no named (stored, or a formula: a period that has ended) its `true` or\n`false`; every one that holds stands at the\nfoot of the section naming it in `acts` \u2014 a correction in that section heading\'s \u22EF, one\nof a child row on its row (a correction in the row\'s \u22EF). An act\'s `requires` are fields\nits section draws \u2014 its `fields`, a block\'s, the act\'s `asks`, or those of another section\nwith no `at` where its own has none; one shown only in the header or a staged section\nelsewhere is refused. One whose `requires` are\nempty is offered disabled, naming each; one whose `recommends` are empty names what\nit will leave blank and still presses; one a standing check blocks is offered\ndisabled in the check\'s words. An input\'s `default` is the row\'s field it starts from. The generated `act_<alias>` workflow re-checks all three on the\nserver, writes `set` and what was asked, and appends the status history where the\nact moves the status \u2014 each thing it asked copied onto the history row where the\nhistory has a field of the same name. `template` makes a document from the row and\nkeeps it in `into`; over several rows it makes one document of them all, the rows\nlisted under the entity\'s alias, and hands it back. `templates` instead names a set of\npapers kept in `into`, listed where the act stands \u2014 each made one as its file, each\nnot made yet as a placeholder \u2014 those whose `when` holds ticked to start; the press\nmakes the ticked ones (sent in `templates`), each replacing the file its template made\nbefore (the file whose `document_template_id` is that template \u2014 never a file a person\nput there), and the set downloads as one archive (`archive_<alias>`). A field an act writes is read-only everywhere else, never asked by an add \u2014 a required one takes a `default`. A `select` input offers its own options and is written into\na select holding the same option aliases; a `link` input picks one row of its `entity`\nand a `member` input one person, each written into a field of its kind. A field an act\nboth `requires` and `asks` never disables the press \u2014 the act asks it, required.\n\n`on: "view"` runs on every row the register shows \u2014 its search, status and filters \u2014\neach row checked before any is written. `of` names a rows block\'s child entity: the\nact is offered on each child row (its menu and its drawer), its `when`, `requires`,\n`set` and checks are the child\'s, it runs on that row, and a check of the record that\nlocks the child rows locks it too. With `on: "rows"` it runs on the child rows ticked\ntogether in the record\'s task list (\xA7 Tasks) \u2014 every row checked before any is written;\nit is refused where the record lists no tasks of that child.\n\n`intake` reads papers: the press takes files, an agent (`act_<alias>` among the app\'s\nagents) reads them, and each is filed as the record\'s line of its kind in the named\nchild \u2014 that child\'s title \u2014 or a new line, its file in the child\'s one files field.\nWhat they state of each field `fills` names is shown beside what the row holds; the save\nwrites only what differs \u2014 the record\'s fields, `<link>.<field>` on the row a required\none-row link names, a child\'s rows (one found by the child\'s `natural_key` changed, else\nadded) \u2014 each refused as its own save is, and nothing written while one refuses.\n\n```jsonc\n{ "alias": "read_papers", "label": "Read papers", "intake": "customer_paper", "fills": ["phone", "contact.email", "branch"] }\n```\n\n### Checks\n\n```jsonc\n"checks": [{ "field": "release_warning" }, { "field": "unpaid", "blocks": ["gate_out"] }, { "field": "locked", "blocks": ["edit"] }]\n```\n\n<!-- generated:start apps-checks -->\n\n#### Check\n\n| Key | Type | Required | Meaning |\n|---|---|---|---|\n| `field` | alias | yes | A yes/no or text formula of the record (or of the child `of` names): true or non-empty means the check stands; its label is its short name on a row\'s line, and a text formula\'s words are the sentence the record and a tooltip say |\n| `of` | alias | no | A rows block\'s child entity this check is a formula of: standing on a child row, it refuses what it blocks of that row |\n| `blocks` | `"all"` \\| list of (alias \\| `"edit"` \\| `"delete"`) (at least one) | no | Acts, "edit" (the saves and the Delete), "delete" (the Delete alone) or "all" that the standing check refuses; absent, it only warns |\n| `resolve` | alias | no | An act of this app, on the rows the check stands on, that clears it: the check\'s line links to the act where it stands, and the act keeps its own conditions |\n\n<!-- generated:end apps-checks -->\n\n<!-- generated:start rules-check -->\n\n#### Rules the check enforces\n\n| Rule | |\n|---|---|\n| `check.field` | A check\'s `field` is a yes/no or text formula of the record, or of the child `of` names. |\n| `check.of` | A check\'s `of` names a child the record lists in a rows block. |\n| `check.not-placed` | A check\'s field is never also placed on the record \u2014 the line under the header says it. |\n| `check.blocks` | A check of the record blocks its acts, `"edit"`, `"delete"` or `"all"`; a check of a child blocks that row\'s saves, its Delete, the acts `of` that child, or all \u2014 never the record\'s acts. |\n| `check.resolve` | `resolve` names an act of this app on the rows the check stands on, pressed on one row, not refused by the check, and drawn as a button \u2014 never a correction. |\n| `check.restates-meter` | A warning reading a gated meter\'s figure against its bound or pass mark is refused \u2014 the meter draws it. |\n\n<!-- generated:end rules-check -->\n\nA check is a yes/no or text formula of the record: it stands while true or\nnon-empty, and a text formula\'s words are what the reader sees. Without `blocks`\nit warns; with them it refuses the acts named, `"edit"` the record\'s own saves (and\nits Delete), `"delete"` its Delete alone, or `"all"` \u2014 on the server, in every write it\nnames. A check `of` a rows block\'s child stands on each child row: it refuses that\nrow\'s saves (`edit`), its Delete (`delete`), the acts `of` that child it names, or\n`all` of them \u2014 never the record\'s acts. A warning reading the figure of a meter that\n`gates` marks against its bound or its pass mark is refused: the meter already draws it.\n\nThe check field\'s `label` is its short name \u2014 "Over budget", "Release expired": a row\'s\nline says it in the check\'s tone (the most severe of several, and how many more), while\nits words whole are the row\'s tooltip and stand under the record\'s header. So label it\nas the reader names the problem, in a few words, and let a text formula say the\nsentence. The compiler records the fields a formula reads: a row drawing each of them\nas a control says nothing of the check on its line (the empty control says it), and a\ncheck with no `resolve` links to the first of them the record draws.\n\n## What a run remembers\n\nThe WORKSPACE remembers what each entity, field, select option, role and\ntemplate alias became here, plus which record each first row landed on and the\nfile each document path was uploaded as. The model file itself holds no live id\n\u2014 it is the portable half, and the same file applies to a demo workspace and to\na customer\'s \u2014 so the join lives where the things it names live, and one model\napplied to two workspaces holds two bindings that know nothing of each other.\n\nIt is the workspace\'s and not the file\'s because a model file is never\ncommitted: memory kept beside it is one author\'s disk, absent for a teammate, on\na second machine or after a delete \u2014 and every one of those goes quietly back to\nbinding by label, which is what grows the second table.\n\nEvery later apply binds through it: it takes the remembered id first and falls\nback to a label only for an alias nothing has bound \u2014 a field you have just\nadded, or a workspace nothing has applied this model to. That is what makes a\nrelabel on EITHER side a rename rather than one thing the workspace lacks and\none the model lacks: `apply` binds the thing it has always meant and reports the\nmove \u2014 which side is right is yours to decide, not a reason to refuse the run.\n\nA bound target the workspace no longer holds IS a refusal, by name: re-binding\nto whatever carries that label today is how the model comes to point at\nsomebody else\'s table. `lotics run restore_table` puts a deleted table back.\n\n`lotics model pull` writes a workspace that already works as a model file \u2014 the\nstarting point for another business\'s model, never a source of truth: it carries\none business\'s words and stops describing that workspace the moment either\nchanges.\n\n## A complete model\n\n```json\n{\n "entities": [\n {\n "alias": "customer",\n "label": "Customers",\n "singular": "Customer",\n "fields": [\n { "alias": "name", "label": "Name", "type": "text", "required": true },\n { "alias": "logo", "label": "Logo", "type": "files" },\n {\n "alias": "tier",\n "label": "Tier",\n "type": "select",\n "options": [\n { "alias": "standard", "label": "Standard", "color": "slate" },\n { "alias": "gold", "label": "Gold", "color": "amber" }\n ],\n "default": ["standard"]\n },\n {\n "alias": "orders",\n "label": "Orders",\n "type": "select_record_link",\n "target_entity": "order",\n "cardinality": "many",\n "sync_both_ways": true,\n "paired_field_alias": "customer",\n "display_field_aliases": ["code"]\n },\n {\n "alias": "total_ordered",\n "label": "Total ordered",\n "type": "rollup",\n "source_field_alias": "orders",\n "aggregate_option": { "operation": "sum", "field_key": "amount" }\n }\n ],\n "views": [\n {\n "alias": "gold",\n "label": "Gold customers",\n "filters": {\n "node_type": "condition",\n "type": "select",\n "field_key": "tier",\n "operator": "has_any_of",\n "value": ["gold"]\n },\n "sort": [{ "field_key": "name", "order": "asc" }]\n }\n ]\n },\n {\n "alias": "order",\n "label": "Orders",\n "singular": "Order",\n "fields": [\n { "alias": "code", "label": "Order no.", "type": "text", "unique": true },\n { "alias": "placed_on", "label": "Placed on", "type": "date", "format": "date" },\n {\n "alias": "amount",\n "label": "Amount",\n "type": "number",\n "format": "currency",\n "currency": "VND"\n },\n {\n "alias": "total",\n "label": "Total with VAT",\n "type": "formula",\n "formula": { "expression": "{amount} * 1.1", "format": "currency", "currency": "VND" }\n },\n {\n "alias": "customer",\n "label": "Customer",\n "type": "select_record_link",\n "target_entity": "customer",\n "cardinality": "one",\n "sync_both_ways": true,\n "paired_field_alias": "orders",\n "display_field_aliases": ["name"]\n },\n { "alias": "note", "label": "Note", "type": "text" }\n ]\n }\n ],\n "roles": [{ "alias": "sales", "label": "Sales" }],\n "records": {\n "customer": { "title": "name", "image": "logo", "party": "organization", "figure": "total_ordered" },\n "order": { "title": "customer", "subtitle": ["code", "placed_on"], "figure": "amount", "starts": { "placed_on": "today" } }\n },\n "apps": [\n {\n "alias": "customers",\n "name": "Customers",\n "entity": "customer",\n "register": {\n "columns": ["tier"],\n "readings": [{ "breakdown": "customer", "by": "tier", "value": "total_ordered" }]\n },\n "record": {\n "sections": [\n { "title": "Account", "fields": ["tier"] },\n { "title": "Orders", "blocks": [{ "rows": "order", "columns": ["total"], "create": ["code", "amount"] }] }\n ]\n }\n },\n {\n "alias": "orders",\n "name": "Orders",\n "entity": "order",\n "register": {\n "filters": ["customer"],\n "create": ["code", "customer", "placed_on"],\n "readings": [{ "trend": "order", "over": "placed_on", "value": "amount" }]\n },\n "record": { "door": "drawer" }\n }\n ],\n "rows": {\n "customer": [\n { "ref": "acme", "fields": { "name": "Acme Trading", "tier": "gold" } },\n { "ref": "bluebird", "fields": { "name": "Bluebird Foods", "tier": "standard" } }\n ],\n "order": [\n {\n "ref": "so_1001",\n "fields": {\n "code": "SO-1001",\n "placed_on": "@month-start+2",\n "amount": 4200000,\n "customer": "customer:acme"\n }\n },\n {\n "ref": "so_1002",\n "fields": {\n "code": "SO-1002",\n "placed_on": "@today-3",\n "amount": 1150000,\n "customer": "customer:bluebird"\n }\n }\n ]\n }\n}\n```\n\nEach app of this file, as its reader will see it:\n\n```\nApp customers \u2014 "Customers" over Customers (customer)\n Register \u2014 table (default), newest first (default)\n row [Logo] \xB7 Name \xB7 figure Total ordered\n columns Tier\n filters \u2014\n readings "Tier" \u2014 Total ordered summed per Tier, over the rows in view (default)\n add Name (default)\n Record \u2014 a drawer (default)\n header image Logo \xB7 title Name \xB7 figure Total ordered\n checks \u2014\n header \u22EF Delete\n sections 1. "Account"\n fields Tier\n 2. "Orders"\n block Orders (default) \u2014 rows of Orders through Customer; columns Total with VAT; add asks Order no., Amount\n thread \u2014\n history \u2014\n acts \u2014\n Reads Customers, Orders\n\nApp orders \u2014 "Orders" over Orders (order)\n Register \u2014 table (default), newest first (default)\n row Customer \xB7 under it Order no., Placed on \xB7 figure Amount\n columns \u2014\n filters Customer\n readings "Amount" \u2014 Amount summed per period by Placed on, over the rows in view (default)\n add Order no., Customer, Placed on \u2014 starting Placed on at today\n Record \u2014 a drawer\n header title Customer \xB7 subtitle Order no., Placed on \xB7 figure Amount\n checks \u2014\n header \u22EF Delete\n sections 1. the record\'s details (default)\n fields Note\n thread \u2014\n history \u2014\n acts \u2014\n Reads Orders, Customers\n\n```\n\nEach `(default)` is a value the model left to the system: the door a record opens\nthrough \u2014 a drawer, since neither record has a stage or more than three sections \u2014 the\norder rows open in, what an add asks, and the order\'s one section \u2014 every field a\nperson writes that the header does not already show. The customer\'s orders\nare a block in its "Orders" section, never its own `Orders` link as a field as well:\none fact, one place. An order is titled by its customer and read by its number under\nit; the block names what its add asks, since a subtitle or a figure is never asked by\ndefault. `Total ordered` is a rollup, so it is read and never asked; the\norders app\'s record opens in a drawer, because its rows are worked one after another.\n';
37472
37501
 
37473
37502
  // AGENTS.md
37474
37503
  var AGENTS_default = "# @lotics/cli \u2014 agent index\n\nThe model an agent needs before driving this CLI: which surface answers which question, what the\nconventions are, and where the traps are.\n\n| Read | For |\n|---|---|\n| `lotics --help` | The verb inventory (\xA7 COMMANDS) and global flags. The verb LIST is generated and never stale; the prose beside each verb is hand-written, so where it disagrees with `docs/cli_reference.md`, the reference wins. |\n| `lotics tools` \xB7 `lotics tools <name>` | The agent tool registry and one tool's full JSON Schema. |\n| `lotics docs` \xB7 `lotics docs <area>[/<section>]` | This CLI's references, carried inside it so each describes the binary answering. Capped at a page: a doc that does not fit hands back its opening and the addresses into it, so the next call is smaller than the last. A custom-code app's SDK reference is `node_modules/@lotics/app-sdk/AGENTS.md` inside the app. |\n| `lotics docs model` \xB7 `lotics docs model/<section>` | How to write a `model.json` \u2014 the file a workspace is built from: its tables, how a row of each is recognised (`records`), and the apps stated over them. Every top-level key, every field type with the config it needs, the row format, the rules, and a worked example; complete example models of several trades are listed at `https://lotics.ai/presets/index.json`. `lotics model apply` checks the file (every problem in one run), applies its tables and mints a version of each app; the WORKSPACE remembers what each alias became, so every later apply binds by id and a relabel on either side is a rename it reports rather than a second table it adds. `lotics model pull` goes the other way \u2014 the workspace's model, rebuilt from what owns each part. |\n| [docs/building_an_app.md](./docs/building_an_app.md) | The SEQUENCE \u2014 clarify, model, apply or build, prove, look \u2014 for an app stated in a model and for a custom-code app. Read it once before starting an app. Looking is `lotics run screenshot_app`, then `lotics download` for each PNG. |\n| [docs/cli_reference.md](./docs/cli_reference.md) | Per-command contracts, flags, exit codes, and gotchas \u2014 the detail `--help` compresses. |\n| [docs/data_model.md](./docs/data_model.md) | How tables RELATE \u2014 one entity per table and the NAME-OVERLAP probe that says when a split has broken, one vocabulary wherever values are copied between tables, a copy boundary that accounts for every source field, provenance as a link rather than a flag, a declared natural key so find-or-create never compares rendered text, and why derived DEPTH costs more than row count. Separate from building_an_app because every workspace starts with tables and many never get an app. The within-table half (one fact, one column) is stated at `create_table` / `update_table`, where you meet it while deciding. |\n| [docs/document_templates.md](./docs/document_templates.md) | Generating PDF/Excel/Word/email from reusable templates. |\n| [docs/knowledge_docs.md](./docs/knowledge_docs.md) | Authoring the workspace facts an agent can't guess; who can read a doc; catalog-then-stage retrieval. |\n| [docs/migration.md](./docs/migration.md) | What to DO when something an earlier CLI wrote to disk no longer matches what it does \u2014 local app projects are gone, and each verb that read one has a replacement. |\n| [README.md](./README.md) | Install, auth, and worked examples. |\n\n## Two surfaces, and the trap between them\n\n**`lotics tools` is not the CLI's capability list.** There are two disjoint surfaces:\n\n- **Tools** (`lotics tools`, `lotics run <tool>`) \u2014 the *agent tool registry*: what an agent, workflow,\n or automation may call. Workspace data, templates, knowledge, admin.\n- **Commands** (`lotics --help` \xA7 COMMANDS) \u2014 the CLI's *own verbs*: auth and org/workspace scoping,\n file upload and download, and the four that touch a local file for an app \u2014 `model apply`,\n `model pull`, `app create --custom` and `app deploy`.\n\nSeveral capabilities exist **only** as commands and appear nowhere in `lotics tools` \u2014 downloading a\nfile is the one most often mistaken for missing. Concluding \"the platform can't do X\" from the tool\nlist alone is a mistake; check both.\n\n**`lotics <verb> --help` prints that verb's entries from \xA7 COMMANDS** (`lotics model --help`,\n`lotics file download --help`); `lotics report --help` prints the report frame. To find out whether\nsomething exists, read `lotics --help` \xA7 COMMANDS \u2014 the whole section, not a narrow grep.\n\n## Conventions that hold across every command\n\n- **Scope is resolved per invocation.** `LOTICS_ORG` / `LOTICS_WORKSPACE` (or `LOTICS_API_KEY`) scope a\n single call without changing the active org or a directory pin \u2014 the safe way to touch one tenant\n from a shell serving many. Every command that resolves a workspace echoes its target to **stderr**\n (`lotics \u2192 <org> / <workspace>`); read it back before trusting a write. Resolution precedence is\n in README \xA7 Organizations.\n- **A machine with no key can still sign in, and the sign-in never blocks you.** `lotics auth\n login <email>` prints the page a person opens (also mailed) and the code that page must show,\n records the request, and EXITS. They press Confirm whenever they get to it; the next command that\n NEEDS a credential collects the key before doing its own work, so \"sign in\" costs you one command\n and then re-running what you wanted. Never wrap it in a timeout waiting for a human \u2014 `--wait`\n exists if you really want one blocking command, and killing that one is safe too (the request\n survives and the next command claims it). A command run before Confirm exits 1 naming the page and\n code again; once the 15 minutes are up it says to ask again. `lotics setup` falls into the same\n flow by itself when the email it was given already has an account: it stops having created\n nothing, and the SAME command run again carries on.\n- **A credential is either a SIGN-IN or an API KEY, and `logout` treats them differently.** A profile\n from `auth login` / `auth signup` acts as the person who confirmed it and is theirs \u2014 `lotics auth\n logout` revokes it server-side, and it lapses on its own after 90 idle days (each use pushes that\n out). A profile from `auth api-key` holds a key an ADMIN issued. A key created in Settings carries\n its OWN access \u2014 every app and table, or only the ones chosen on the key, so a listing that comes\n back short is the key's reach, not a bug \u2014 while a key created FOR a person carries that\n person's access and dies with their membership. Either is routinely also on a server and on\n other machines, so logout only forgets it locally and says so; only an admin revokes it. A profile that states no kind (saved before the field existed) is resolved against the SERVER\n and revoked only if the answer is a sign-in; a bare `--api-key` / `LOTICS_API_KEY` names no\n profile to remove at all. Nothing is ever revoked on a guess \u2014 between two, the destructive one is\n wrong. `lotics auth whoami` prints the kind, asking the server when the store cannot say.\n- **A key created in Settings never administers the organization, whatever its access.** The verbs\n `docs/cli_reference.md` marks *admin only* split in two under a key: `workspace doctor`, which only\n reads inside a workspace the key reaches, runs as before, while applying or pulling a model\n (`model apply`, `model pull`, `setup`), managing people, sharing or\n ownership, creating or deleting a workspace, changing workspace settings, setting credit limits,\n reading the access log and publishing an app's API answer `403` and name the remedy: an admin signed in, so\n `lotics auth login <email>` and run it again. A sign-in acts as that person and is refused none of\n them. Do not retry a `403` with the same credential and do not ask for a wider key \u2014 no answer on\n the key's own screen grants this.\n- **A 401 names its remedy \u2014 act on the hint, do not retry.** \"This credential expired / was\n revoked / belongs to a member who is no longer active\" carries the one remedy that ends this\n credential: run `lotics auth login <email>` for a sign-in, or ask the admin who issued it for a\n new key. A credential minted before that was recorded carries BOTH, because nothing on the row\n tells them apart \u2014 so on a box with no browser, take the second. Only an UNRECOGNIZED key gets\n the generic \"Invalid or disabled API key\", and that one is generic on purpose, so re-sending it\n teaches nothing. A `reason` rides on the body for a script to branch on, since the code stays\n `unauthorized` for every 401.\n- **Large payloads bypass `ARG_MAX`** \u2014 `lotics run <tool> @args.json`, or piped stdin behind `-`. A leading `@` is\n unambiguously a file path (JSON args start with `{`).\n- **stdout is the payload, stderr is the narration.** Progress, status lines, and the target echo go to\n stderr; the result goes to stdout, so piping stays clean. `--json` switches stdout from the\n agent-readable summary to the full structured object.\n- **Every tool is invoked one way \u2014 `lotics run <tool>`.** Including the ones that RUN something\n (`run_app_workflow`, `run_app_agent`, `run_app_query`) and every one that changes an app\n (`set_app_query`, `set_app_workflow`, `set_app_agent`, `update_app`, `rollback_app`, the\n `sandbox_*` tools). A command exists only for work that touches a local file.\n- **Every change to an app mints a version of it, and rolling back is the undo.** An apply, a\n deploy, a single `set_app_*` or `remove_app_*`: each is a new version, and `rollback_app` makes an\n earlier one current again. It restores the app \u2014 never a table change or a row a workflow wrote,\n so try a write on a throwaway record.\n- **Exit codes are assertable, and they report the WORK rather than the call.** `lotics run` exits\n non-zero when a `run_app_workflow` or `run_app_agent` result's own envelope carries a failed\n `status` (`error`/`failed`/`cancelled`) \u2014 any other tool's top-level status is data and exits 0 \u2014\n so `lotics run \u2026 && next-step` cannot walk past a refused run; `workspace doctor` exits non-zero on\n findings. An unrecognized status exits 0 \u2014 the list is an allowlist of failure, so a status added\n later never turns a working script red \u2014 and a parked run (`awaiting_input`) is not a failure.\n- **An app that PUBLISHES an API turns every later binding write into a release.** Publishing\n snapshots what the app's queries, workflows and agents promise to callers outside it \u2014 a\n customer's own site or server, which nobody here can redeploy. From then on an additive change\n re-snapshots silently and a breaking one is REFUSED, naming each change; the tool's\n `acknowledge_breaking_api_change` carries it out and snapshots the break as a new contract version.\n- **Exposure is per app, all or nothing** \u2014 a public share or a key reaches every alias an app\n declares, so what outsiders may call is a second app over the same tables\n ([docs/building_an_app.md](./docs/building_an_app.md) \xA7 7).\n- **`--print-created` / `--cleanup` on any call that reports `side_effects`.** The first prints the\n records created plus a paste-ready cleanup plan and what cannot be auto-undone; the second runs\n those deletes (records only \u2014 never files, integrations or notifications). Neither is a rollback.\n- **Text output is the default and is built for reading**; reach for `--json` only when a field is\n needed programmatically.\n- **`lotics report '<json>'` is the channel for what nothing else records.** Reach for it\n when the platform is genuinely missing something (a capability that does not exist \u2014 no\n command ran), when a success was wrong (exited 0, wrong effect), or when an error did\n not name the remedy \u2014 not for your own mistakes, which the logs already show.\n **It is a frame, not a paragraph** \u2014 `{goal, actual, expected?, tried?, wanted?}`, because a log\n reconstructs what you RAN and never what you WANTED, and that gap is the report. `goal` and\n `actual` are required; there is no severity or category to pick. The\n session's commands attach themselves \u2014 do not retype them. Run it bare for the full prompt; a\n long one rides `@file.json` or an explicit `-` for stdin (bare NEVER reads stdin).\n- **`LOTICS_TELEMETRY=1` correlates a whole session** so the authoring loop's rough edges can be\n found and fixed. Off by default; set it in the shell profile, not per command (each invocation is\n its own process). It sends no arguments, no file contents, and no record data \u2014 see README\n \xA7 Diagnostics.\n\n## Where this CLI is not the answer\n\n- **Editing an app in a local directory.** An app stated in a model is changed by applying the\n model again; its bindings through their `set_app_*` tools; a custom-code app's code by deploying\n its directory again. Nothing reads a local copy of a live app back.\n- **OAuth connections.** Attaching a connected account is web-only; the CLI can list them.\n";
@@ -37491,20 +37520,22 @@ var knowledge_docs_default = '# Knowledge Docs\n\nKnowledge docs are the AI\'s *
37491
37520
  // docs/migration.md
37492
37521
  var migration_default = "# @lotics/cli \u2014 migration notes\n\nWhat to DO when a release changes the shape of something the CLI once wrote to disk. Every other\ncontract is `docs/cli_reference.md`; this file is the one a reader opens once, because something\nalready on disk no longer matches what the CLI does.\n\n## Local app projects are gone\n\nAn app built from a model no longer lives in a directory. The live app is the only edit surface:\neach change mints a new version of it, and rolling back to an earlier version is the undo. What\nthe app is \u2014 its screens (`app.json`), its queries, workflows, agents and capabilities, and the\nmodel body it was compiled from \u2014 is held by that version, and the model's tables, fields, options,\ntemplates and roles are the workspace's own.\n\n| What you ran | What replaces it |\n|---|---|\n| `lotics scaffold check` + `scaffold apply` | `lotics model apply <model.json>` \u2014 checks the file, applies the tables and rows, then mints a version of every app it declares |\n| `lotics workspace build <model.json>` | `lotics model apply <model.json>` |\n| `lotics app create --from <model.json>#<app>` | `lotics model apply <model.json> --app <app>` |\n| `lotics app regenerate` | change the model file, then `lotics model apply` |\n| `lotics scaffold diff` | `lotics model apply <model.json> --plan` \u2014 what the apply would change, writing nothing |\n| `lotics scaffold export` | `lotics model pull [-o <model.json>]` \u2014 the workspace's model, rebuilt from what owns each part |\n| `lotics app pull`, `app codegen`, `app check`, `app dev`, `app preview` | nothing local: read an app with `lotics run get_app`, and change it through its tools |\n| `lotics app workflow set` / `app query set` / `app agent set` | `lotics run set_app_workflow` / `set_app_query` / `set_app_agent` \u2014 each mints a version |\n| `lotics app versions` + a redeploy of an old tree | `lotics run query_app_versions`, then `lotics run rollback_app` \u2014 restores the app's earlier version; table changes and data writes stay |\n| `lotics app rename`, `app subdomain`, `package.json#lotics.capabilities` | `lotics run update_app` (`name`, `public_subdomain`, `capabilities`) |\n| `lotics app api publish` / `unpublish` | `lotics run publish_app_api` / `unpublish_app_api` |\n| `lotics field rename` | `lotics run update_table`, then the same label in the model file |\n| `lotics app kit` | nothing: a custom-code app depends on `@lotics/app-sdk` (below) |\n| `@lotics/xlsx` / `@lotics/docx` to build a template's file | any `.xlsx` / `.docx` library, then `lotics upload` (`lotics docs document_templates`) |\n| `lotics file preview` | `lotics file download <fil_id>`, then open it |\n| `model.json#apply` (`[{package, bind}]`) | state the tables under `entities` \u2014 a model carrying `apply` is refused |\n| `lotics library list` / `library show <slug>`, `lotics preset list` / `preset show <slug>` | the example models at `https://lotics.ai/presets/index.json`, each a complete `model.json` to adapt |\n| `model.json#from` (with `variants`, `rename`) | state every table under `entities` \u2014 a model carrying `from` is refused |\n| `lotics library init <apg_id>`, `lotics setup <apg_id>`, `lotics app upgrade`, `lotics library fixtures` | nothing copies a package any more: write a `model.json` (`lotics docs model`), then `lotics setup model.json` or `lotics model apply model.json` |\n\n`lotics tools` lists every tool, and `lotics tools <name>` prints its input.\n\n**An existing JSON app moves on the first `lotics model apply`** of the model it came from: that\napply binds each app alias to the app it already became and mints its next version from the file.\nA directory an earlier CLI wrote (`app.json`, `src/workflows/`, `.lotics/`, `package.json#lotics`\nwith `plan`, `queries` or `workflows`) is no longer read by anything; keep the model file, delete the\nrest.\n\n**Authored workflow bodies** an act names (`workflow` on an act) are the live workflow's own body:\nthe apply keeps it, and `lotics run set_app_workflow` changes it.\n\n**A model written before `party`** draws its people and organisations as things \u2014 a row with no\npicture shows no initials: state `party` (`person` or `organization`) on those entities' `records`.\n\n## Custom-code apps use `@lotics/app-sdk`\n\nA hand-written app depends on `@lotics/app-sdk` alone \u2014 the hooks (`useQuery`, `useWorkflow`, \u2026),\n`mount`, and `AppRouter` from `@lotics/app-sdk/router` \u2014 and draws with its own React.\n`@lotics/app-runtime` and `@lotics/ui` are no longer published: the runtime is what the platform\ndraws a model's app with, and it ships with the platform.\n\nAn app that listed `@lotics/app-runtime`:\n\n1. **The dependency.** `@lotics/app-sdk` replaces `@lotics/app-runtime` in `package.json`.\n2. **The import specifiers.** `@lotics/app-runtime/sdk` becomes `@lotics/app-sdk`, and\n `@lotics/app-runtime/router` becomes `@lotics/app-sdk/router` \u2014 in `src/` and in\n `vite.config.ts`.\n3. **The kit.** An app that imports `@lotics/ui` keeps the version it already installed; no newer one\n is published. Its screens can stay on it, or move to plain React (or any library) one screen at a\n time.\n4. **`package.json#lotics`** needs only `app_id`, `workspace_id` and `current_version_id`. The live\n app owns its `queries`, `workflows`, `agents` and `capabilities`, and `lotics app deploy` refuses\n a directory that still declares any of them; delete them, and the unread `synced` block.\n5. `lotics app deploy` builds the directory and uploads it as a new version.\n\nA deployed app keeps running on the bundle it shipped until it is deployed again.\n";
37493
37522
 
37494
- // src/docs_command.ts
37523
+ // ../shared/src/doc_pages.ts
37524
+ var SOURCES = [
37525
+ { area: "model", file: "src/model_reference.md", marker: "a workspace starts here", readers: ["cli", "tool"] },
37526
+ { area: "cli", file: "AGENTS.md", marker: "start here", readers: ["cli"] },
37527
+ { area: "building_an_app", file: "docs/building_an_app.md", marker: "read once, first", readers: ["cli"] },
37528
+ { area: "cli_reference", file: "docs/cli_reference.md", readers: ["cli"] },
37529
+ { area: "data_model", file: "docs/data_model.md", readers: ["cli", "tool"] },
37530
+ { area: "document_templates", file: "docs/document_templates.md", readers: ["cli", "tool"] },
37531
+ { area: "knowledge_docs", file: "docs/knowledge_docs.md", readers: ["cli", "tool"] },
37532
+ { area: "migration", file: "docs/migration.md", readers: ["cli"] }
37533
+ ];
37534
+ var DOC_SOURCES = SOURCES;
37535
+ var docSourcesFor = (reader) => DOC_SOURCES.filter((source) => source.readers.includes(reader));
37495
37536
  function titleOf(text) {
37496
37537
  return /^#\s+(.+?)\s*$/m.exec(text)?.[1] ?? "";
37497
37538
  }
37498
- var DOC_AREAS = [
37499
- { area: "model", text: model_reference_default, marker: "a workspace starts here" },
37500
- { area: "cli", text: AGENTS_default, marker: "start here" },
37501
- { area: "building_an_app", text: building_an_app_default, marker: "read once, first" },
37502
- { area: "cli_reference", text: cli_reference_default },
37503
- { area: "data_model", text: data_model_default },
37504
- { area: "document_templates", text: document_templates_default },
37505
- { area: "knowledge_docs", text: knowledge_docs_default },
37506
- { area: "migration", text: migration_default }
37507
- ];
37508
37539
  function matchDocArea(areas, query) {
37509
37540
  const q = query.trim().toLowerCase().replace(/\.md$/, "");
37510
37541
  const exact = areas.filter((a) => a.area === q);
@@ -37513,7 +37544,6 @@ function matchDocArea(areas, query) {
37513
37544
  var PAGE_BYTES = 16e3;
37514
37545
  var NAV_BYTES = PAGE_BYTES / 2;
37515
37546
  var CUT_MARK = "\n[cut \u2014 the whole document is at the path above]";
37516
- var slugOf = (title) => title.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
37517
37547
  function docSections(text) {
37518
37548
  const lines = text.split("\n");
37519
37549
  const found = [];
@@ -37530,7 +37560,7 @@ function docSections(text) {
37530
37560
  for (const open of found) {
37531
37561
  if (open.end === lines.length && open.level >= level) open.end = index;
37532
37562
  }
37533
- found.push({ level, title: m[2], slug: slugOf(m[2]), line: index, end: lines.length });
37563
+ found.push({ level, title: m[2], slug: pageSegment(m[2]), line: index, end: lines.length });
37534
37564
  });
37535
37565
  return found;
37536
37566
  }
@@ -37558,11 +37588,12 @@ function docRows(text) {
37558
37588
  }
37559
37589
  const key = first2.replace(/[`*[\]]/g, "").trim();
37560
37590
  if (key === "") return;
37561
- found.push({ key, slug: slugOf(key), line: index });
37591
+ found.push({ key, slug: pageSegment(key), line: index });
37562
37592
  });
37563
37593
  return found;
37564
37594
  }
37565
- var byteLength = (s) => Buffer.byteLength(s, "utf-8");
37595
+ var utf8 = new TextEncoder();
37596
+ var byteLength = (s) => utf8.encode(s).length;
37566
37597
  var oneNewline = (s) => `${s.replace(/\n+$/, "")}
37567
37598
  `;
37568
37599
  var wrap = (names, width = 92) => names.reduce((out, name) => {
@@ -37609,7 +37640,7 @@ function renderDocPage(text, args) {
37609
37640
  const sections = docSections(text);
37610
37641
  const rows = docRows(text);
37611
37642
  const trail = [];
37612
- const address = (slug) => ` lotics docs ${[args.address, ...trail, slug].join("/")}`;
37643
+ const address = (slug) => ` ${args.link([args.area, ...trail, slug].join("/"))}`;
37613
37644
  const navFor = (parent2) => {
37614
37645
  const children2 = childrenOf(sections, parent2);
37615
37646
  if (children2.length > 0) {
@@ -37631,7 +37662,7 @@ function renderDocPage(text, args) {
37631
37662
  let current;
37632
37663
  const segments = (args.section ?? "").split("/").filter((s) => s !== "");
37633
37664
  for (const [index, segment] of segments.entries()) {
37634
- const q = slugOf(segment);
37665
+ const q = pageSegment(segment);
37635
37666
  const scope = current;
37636
37667
  const inScope = (s) => scope === void 0 || s.line > scope.line && s.line < scope.end;
37637
37668
  const pick3 = (all) => {
@@ -37645,7 +37676,7 @@ function renderDocPage(text, args) {
37645
37676
  const last2 = index === segments.length - 1;
37646
37677
  const hitRows = hitSections.length > 0 || !last2 ? [] : pick3(rows.filter(inScope));
37647
37678
  if (hitSections.length + hitRows.length !== 1) {
37648
- const where = [args.address, ...trail].join("/");
37679
+ const where = [args.area, ...trail].join("/");
37649
37680
  const ambiguous = [...hitSections.map((s) => s.slug), ...hitRows.map((r) => r.slug)];
37650
37681
  const list2 = listed(ambiguous.length > 1 ? ambiguous.map(address) : navFor(scope ?? titled));
37651
37682
  return {
@@ -37681,45 +37712,59 @@ ${listed(nav)}`;
37681
37712
  text: oneNewline(`${head.kept.join("\n")}${head.dropped > 0 ? CUT_MARK : ""}${navText}`)
37682
37713
  };
37683
37714
  }
37684
- function renderDocIndex(areas) {
37715
+ function renderDocIndex(areas, usage) {
37685
37716
  const names = areas.map((a) => a.marker === void 0 ? a.area : `${a.area} \u2190 ${a.marker}`);
37686
37717
  const width = Math.max(0, ...names.map((name) => name.length)) + 2;
37687
37718
  const lines = areas.map((a, index) => ` ${names[index].padEnd(width)}${titleOf(a.text)}`);
37688
- return [
37689
- ...lines,
37690
- "",
37691
- " lotics docs <area> print one, e.g. `lotics docs model`",
37692
- " lotics docs <area>/<section> one section \u2014 a long doc prints its section list",
37693
- " A custom-code app's SDK reference is node_modules/@lotics/app-sdk/AGENTS.md in the app."
37694
- ].join("\n");
37719
+ return [...lines, "", ...usage].join("\n");
37695
37720
  }
37696
- function docsCommand(args) {
37697
- if (args.area === void 0 || args.area === "") {
37698
- console.log(renderDocIndex(DOC_AREAS));
37699
- return;
37700
- }
37701
- const asked = args.area.trim();
37702
- let hits = matchDocArea(DOC_AREAS, asked);
37721
+ function readDocs(areas, path15, surface) {
37722
+ const asked = (path15 ?? "").trim();
37723
+ if (asked === "") return { text: oneNewline(renderDocIndex(areas, surface.usage)) };
37724
+ let hits = matchDocArea(areas, asked);
37703
37725
  let section;
37704
37726
  for (let cut = asked.lastIndexOf("/"); hits.length === 0 && cut > 0; cut = asked.lastIndexOf("/", cut - 1)) {
37705
- const head = matchDocArea(DOC_AREAS, asked.slice(0, cut));
37727
+ const head = matchDocArea(areas, asked.slice(0, cut));
37706
37728
  if (head.length > 0) {
37707
37729
  hits = head;
37708
37730
  section = asked.slice(cut + 1);
37709
37731
  }
37710
37732
  }
37711
- if (hits.length === 0) {
37712
- console.error(`No reference area matching "${args.area}".
37713
- Run \`lotics docs\` for the list.`);
37714
- process.exit(1);
37715
- }
37733
+ if (hits.length === 0) return { error: `No reference area matching "${path15}".
37734
+ ${surface.listHint}` };
37716
37735
  if (hits.length > 1) {
37717
- console.error(`"${args.area}" matches more than one reference:
37718
- ${hits.map((a) => ` \u2022 lotics docs ${a.area}`).join("\n")}`);
37719
- process.exit(1);
37736
+ return {
37737
+ error: `"${path15}" matches more than one reference:
37738
+ ${hits.map((a) => ` \u2022 ${surface.link(a.area)}`).join("\n")}`
37739
+ };
37720
37740
  }
37721
37741
  const hit = hits[0];
37722
- const page = renderDocPage(hit.text, { address: hit.area, section });
37742
+ return renderDocPage(hit.text, { area: hit.area, section, link: surface.link });
37743
+ }
37744
+
37745
+ // src/docs_command.ts
37746
+ var TEXTS = {
37747
+ "src/model_reference.md": model_reference_default,
37748
+ "AGENTS.md": AGENTS_default,
37749
+ "docs/building_an_app.md": building_an_app_default,
37750
+ "docs/cli_reference.md": cli_reference_default,
37751
+ "docs/data_model.md": data_model_default,
37752
+ "docs/document_templates.md": document_templates_default,
37753
+ "docs/knowledge_docs.md": knowledge_docs_default,
37754
+ "docs/migration.md": migration_default
37755
+ };
37756
+ var DOC_AREAS = docSourcesFor("cli").map(({ area, marker, file: file2 }) => ({ area, marker, text: TEXTS[file2] }));
37757
+ var CLI_SURFACE = {
37758
+ usage: [
37759
+ " lotics docs <area> print one, e.g. `lotics docs model`",
37760
+ " lotics docs <area>/<section> one section \u2014 a long doc prints its section list",
37761
+ " A custom-code app's SDK reference is node_modules/@lotics/app-sdk/AGENTS.md in the app."
37762
+ ],
37763
+ listHint: "Run `lotics docs` for the list.",
37764
+ link: (path15) => `lotics docs ${path15}`
37765
+ };
37766
+ function docsCommand(args) {
37767
+ const page = readDocs(DOC_AREAS, args.area, CLI_SURFACE);
37723
37768
  if ("error" in page) {
37724
37769
  console.error(page.error);
37725
37770
  process.exit(1);