# Part III. Code base

An OpenEik model is a folder of files: one record per file, at a path derived from the record, in a fixed text form. A folder and a stored version are the same format (Part VI), and the folder works with git, editors and an agent's file tools as a code base does.

## 1. The folder

```text
eik.json                                       format and units
AGENTS.md                                      conventions for agents (text)
project/project.json                           the project
project/levels.json                            the levels, in order
project/order.json                             the order of the record lists
project/materials/<id>.json                    and grids, scope-boxes, dimension-styles,
                                               detail-families, title-blocks, images,
                                               originals, copies
project/circuits/<id>.json                     circuits (Part XIII), and project/people/<id>.json
                                               the people of the registry (Part XIV)
types/<discipline>/<category>/<id>.json        types
<discipline>/<level>/<category>/<id>.json      elements: architecture, structure, ventilation,
                                               plumbing, electrical, sprinkler, site
drawings/<discipline>/views/<kind>/<id>/view.json
                                               a view
drawings/<discipline>/views/<kind>/<id>/details/<n>.json
                                               its detail items, in chunks
drawings/<discipline>/sheets/<id>.json         sheets (Part XIV)
documents/<list>/<id>.json                     reports, renders, deviations,
                                               area-adjustments, references (application records)
fabrication/pieces/<id>.json                   pieces and joints (fabrication profile)
fabrication/joints/<id>.json
<prefix>/…                                     an application's own files (section 7.7; Part I, 11.3)
anything else                                  kept files (section 7)
.eik/, .git/, …                                hidden: not part of the model
```

`examples/one-storey-house` is a complete folder of 34 files.

This is the owners' layout of 0.2: [section 4.4](https://openeik.org/spec/0.7/code-base#4.4) puts each element, type, view and sheet in the folder of the discipline that owns it, one of eight. A folder of 0.1 files them by category in four folders, `architecture`, `structure`, `systems` and `site`, its views under `drawings/views/` and its sheets, application records of 0.1, under `drawings/sheets/` (section 4.1). A reader of 0.2 reads either layout (section 4.4, rule 7).

1. A file or folder whose name starts with `.` is hidden. It is not part of the model; readers MUST skip it and writers MUST NOT remove it. Two hidden paths have a defined use: `.eik/derived/`, the optional derived layer of Part IV, section 1.1, and `.eik/remotes.json`, a folder's remote-tracking refs (Part VI, 6.1). From 0.6, a third, `.eik/rates/`, a project's own rate lists, which no version holds ([Part XXII, 4.3](https://openeik.org/spec/0.7/schedules#4.3)); in a folder of 0.5, with the proposal `costSchedules`.
2. A name that starts with `~` is reserved (Part VI uses it for shard folders). Writers MUST NOT create one in a folder.

Reference: `readFolder` in `server/eikSession.ts` (skips names starting with a dot); `keptPath` in `src/core/model/extras.ts`.

## 2. Path segments

Some names in a record's path are made from ids: an element's level folder from its `levelId`, a view's folder from the view's id, and every other record's file from its id, followed by `.json` (sections 3 and 4.2). Each is the id as a **path segment**: the id with some of its characters written as their **escape**, `%` followed by the two hexadecimal digits of the character's code point, so that every id gives one name that common file systems take and read as it is written. Rules 1 to 6 make an id's segment, in this order, each rule applied to what the rules before it give:

1. Every `%` is escaped as `%25`, first: the `%` of an escape is never escaped again.
2. Every character that a common file system refuses in a name is escaped: `/` as `%2F`, `\` as `%5C`, `:` as `%3A`, `*` as `%2A`, `?` as `%3F`, `"` as `%22`, `<` as `%3C`, `>` as `%3E`, `|` as `%7C`, and each control character, U+0000 to U+001F, as `%00` to `%1F`.
3. A leading `.` is escaped as `%2E`, and a leading `~` as `%7E`. Readers skip a hidden name and writers make no reserved one (section 1), so a record with the id `.x` would otherwise be lost.
4. A trailing `.` is escaped as `%2E`, and a trailing space as `%20`: some file systems drop them.
5. The first character of a segment that is a device name of a common operating system is escaped. What is compared is the segment's part before its first `.` (the whole segment where it has none), without the spaces that end that part; it is a device name when it is `CON`, `PRN`, `AUX`, `NUL`, `COM0` to `COM9`, `LPT0` to `LPT9`, or `COM` or `LPT` followed by `¹`, `²` or `³`, compared without regard to ASCII case. A record's file, its segment followed by `.json`, has the same part before its first `.`, so one comparison serves the segment and the file, and a device name is escaped with or without an extension: the ids `con`, `Aux.1` and `lpt¹` make the files `%63on.json`, `%41ux.1.json` and `%6Cpt¹.json`.
6. The hexadecimal digits of an escape are upper case.
7. A reader reads a segment back by decoding, in one pass from left to right, every `%` followed by two hexadecimal digits, of either case, as the character of that code point (U+0000 to U+00FF). Any other `%` stands for itself.
8. A writer MUST write each name made from an id as the id's segment. A reader MUST read each such name by rule 7.
9. A name that reads by rule 7 as its record's id, or as an element's `levelId`, but is not its segment, as a name written before these rules with a `:` in it, is at the record's path in an older form, and does not disagree with the record (section 4.2). A reader SHOULD warn about such a name, naming the path these rules give. A writer writes the record at that path, and removes the file it was read from (section 13, rule 4). A name that starts with `.` or `~` is hidden or reserved (section 1), and is never read as a record, whatever it decodes to.

A valid id holds no `/` (Part I, 6.4). Rule 2 escapes it all the same, so that every string has exactly one segment, and so that a reader can read a folder that breaks the rule and name the record it refuses. A category and a view's kind are names of the format, and are not escaped: a category is a plain name (Part II, 6.2, rule 1), and a view's kind one of the five its schema lists. Nor is a kept file's path escaped, which is its own: it holds no name that rules 2 to 5 would escape (section 7, rule 8). Part I, 6, rule 8 bounds a segment's length, and section 4.3 says when two names fold to one, which Part I, 6, rule 7 keeps two records' paths from doing.

*Note (informative).* These rules were decided by the steward on 14 October 2026. Before them, this section escaped only `%`, `/` and a leading `~`, so a folder written earlier may hold, as it is, the `:` of a derived id (Part I, 6, rule 6) in a file's name, which Windows cannot check out; rule 7 reads the name as the same id, and rule 9 has it reported. An escape is the percent-encoding of URIs (RFC 3986, 2.1) of an ASCII character, and a writer escapes no other character; rule 7 decodes a character, not an octet of UTF-8, so `%C3%A9` reads as `Ã©`, never as `é`. The names of rule 5 are those that current Windows documentation reserves ([Naming files, paths, and namespaces](https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file)), `COM0`, `LPT0` and the superscript digits among them; Windows reads `NUL.txt` and `NUL.tar.gz` as the device, and `NUL .txt` too.

Reference: `segment` and `unsegment` in `src/core/versions/layout.ts`, rules 1 to 7, and `manifestOfFolder` in `src/core/versions/eikFolder.ts`, rule 9, since Stomra 506 (live since 15 October 2026, `main` `a34cc1a1`); before it they escaped and decoded only `%`, `/` and a leading `~`.

## 3. File kinds and their schemas

| Path | Holds | Schema |
|---|---|---|
| `eik.json` | `{format, units}` | `eik.schema.json` |
| `AGENTS.md` | text | none |
| `project/project.json` | `{project, projectInformation?, schemaVersion?}` (`schemaVersion` deprecated in 0.2, Part I, 9.3) | `project/project.schema.json` |
| `project/levels.json` | the list of levels | `project/levels.schema.json` |
| `project/order.json` | list name → ids | `project/order.schema.json` |
| `project/grids/<id>.json` | a grid | `project/grid.schema.json` |
| `project/scope-boxes/<id>.json` | a scope box | `project/scope-box.schema.json` |
| `project/materials/<id>.json` | a material | `project/material.schema.json` |
| `project/dimension-styles/<id>.json` | a dimension style | `project/dimension-style.schema.json` |
| `project/detail-families/<id>.json` | a detail family | `project/detail-family.schema.json` |
| `project/title-blocks/<id>.json`, `project/images/<id>.json` | application records | `application-record.schema.json` |
| `project/originals/<id>.json`, `project/copies/<id>.json` | an original, a copy | `project/original.schema.json`, `project/copy.schema.json` |
| `project/circuits/<id>.json` | a circuit ([Part XIII, 3](https://openeik.org/spec/0.7/electrical)) | `project/circuit.schema.json` |
| `project/people/<id>.json` | a person or an agent of the registry ([Part XIV, 5](https://openeik.org/spec/0.7/drawings)) | `project/person.schema.json` |
| `types/<discipline>/<category>/<id>.json` | a type | `types/<category>.schema.json` |
| `<discipline>/<level>/<category>/<id>.json` | an element | `elements/<category>.schema.json` |
| `drawings/<discipline>/views/<kind>/<id>/view.json` | a view without its detail items | `drawings/view-record.schema.json` |
| `drawings/<discipline>/views/<kind>/<id>/details/<n>.json` | a chunk of detail items | `drawings/view-details.schema.json` |
| `drawings/<discipline>/sheets/<id>.json` | a sheet ([Part XIV, 2](https://openeik.org/spec/0.7/drawings#2)) | `drawings/sheet.schema.json` |
| `drawings/<discipline>/sets/<id>.json` | from 0.7, a drawing set ([Part XIV, 2.5](https://openeik.org/spec/0.7/drawings#2.5)) | `drawings/drawing-set.schema.json` |
| `documents/reports/<id>.json`, `documents/renders/<id>.json`, `documents/deviations/<id>.json`, `documents/area-adjustments/<id>.json`, `documents/references/<id>.json` | application records | `application-record.schema.json` |
| `fabrication/pieces/<id>.json`, `fabrication/joints/<id>.json` | a piece, a joint | `fabrication/piece.schema.json`, `fabrication/joint.schema.json` |

These are the paths of the owners' layout of 0.2 (section 4.4): `<discipline>` is the record's owner, one of eight, and a view and a sheet are under their owner's folder. In 0.1's layout (section 4.1), `<discipline>` is one of four, a view is at `drawings/views/<kind>/<id>/view.json`, its chunks beside it, and a sheet, an application record of 0.1, at `drawings/sheets/<id>.json`, of the same depths below `drawings/`. The schemas are those of 0.2, in `schemas/0.2/`; 0.1's are in `schemas/`.

[Part XIII](https://openeik.org/spec/0.7/electrical) adds the electrical records of 0.2, which are not 0.1's: the elements and types of the categories `electrical`, `cableCarrier` and `cable`, and the circuits at `project/circuits/<id>.json`. [Part XIV](https://openeik.org/spec/0.7/drawings) adds the drawing files of 0.2, which are not 0.1's either: sheets as standard records, people and agents at `project/people/<id>.json`, the drawing profile, issued drawings, registers, issues and reviews under `drawings/`, and assets by digest at `assets/<sha256>.<ext>`. [Part XV](https://openeik.org/spec/0.7/assets) says how a version and a store keep those assets: a pointer in the version's tree, and the bytes beside it. [Part XVI](https://openeik.org/spec/0.7/ownership) adds `project/owners.json` (`project/owners.schema.json`), and [Part XVIII](https://openeik.org/spec/0.7/review) a model's reviews and terms accepted. [Part XIX](https://openeik.org/spec/0.7/ground), from 0.5, adds `project/ground.json`, the ground, which a reader of a model of 0.4 keeps as a kept file unless it is asked for the proposal `ground`. [Part XXII](https://openeik.org/spec/0.7/schedules), from 0.6, adds `project/cost-schedules.json` and `project/work-schedules.json`, which a reader of a model of 0.5 keeps as kept files unless it is asked for the proposals `costSchedules` and `workSchedules`, or the model lists them (Part I, 9.12). From 0.7, [Part II, 2.4](https://openeik.org/spec/0.7/language#2.4) adds `project/plan-limits.json`, [Part XIV, 2.5](https://openeik.org/spec/0.7/drawings#2.5) the drawing sets at `drawings/<owner>/sets/<id>.json`, and [Part XXIII](https://openeik.org/spec/0.7/checks) a building's own tests in `checks/`, which a reader of a model of 0.6 reads only where it is asked for the proposals `planLimits`, `drawingSets` and `checks`, or the model lists them.

1. A path is a record's path only when it has exactly the depth shown: an element is three segments under a discipline folder (its level, its category and its file), a type three under `types` (its discipline, its category and its file), a list record one segment under its list folder. Any other file is a kept file (section 7), even if it ends in `.json`.
2. Every record file MUST validate against its schema, that of its model's version. [`schemas/0.2/index.json`](https://openeik.org/schemas/0.2/index.json) lists the same mapping for tools, and [`schemas/index.json`](https://openeik.org/schemas/0.1/index.json) 0.1's. An element or a type of a category that has no schema of its own here, one a later version adds, validates against `elements/element.schema.json` or `types/type.schema.json` (Part I, 10, rule 5).

Reference: `leafPlace` in `src/core/versions/tree.ts`; `recordFile` in `src/core/versions/eikFolder.ts`.

## 4. Where a record goes

A record's path is derived from the record. Its identity is its id, never its path: an element moved to another level is the same element in a new file.

### 4.1 Disciplines in 0.1

This section is 0.1's layout, which a writer of 0.1 writes and a reader of 0.2 reads (section 4.4, rule 7). A writer of 0.2 writes the owners' layout of section 4.4, whose rules replace this table and rules 1 and 2.

An element's discipline folder is its category's, with two exceptions:

| Discipline | Categories |
|---|---|
| `structure` | `beam`, `column`, `foundation`, `slabEdge`, `rebar`, `mesh` |
| `systems` | `pipe`, `duct`, `terminal` |
| `site` | `terrain`, `grading`, `propertyLine` |
| `architecture` | every other category |

1. An element that carries `frameHost` (a materialised framing member or truss) goes in `structure`.
2. A `component` element goes in `structure` when it is `structural`, or when its type is a plate (`component.family` is `"plate"`), a cast-in item (`insert`) or a connector of the writer's own library; otherwise in `architecture`. A `component` type goes in `structure` when it is a plate, a cast-in item or a connector, otherwise in `architecture`.

Walls, slabs and roofs stay in `architecture` even when they bear: the folder follows who places them, not what they carry.

3. A writer of 0.1 MUST place records by these rules, and a writer of 0.2 by section 4.4.
4. A reader MUST NOT derive a record's meaning from its folder. It MUST accept a `component` record in either `architecture` or `structure`, since which components are connectors is the writer's library. A reader reads a record wherever its folder puts it, by its own members, while a validator reports a record outside the folder its category or its owner gives it as an error (`path-discipline`; section 4.4, rule 7): the two do not conflict, since the finding is the writer's to fix, and the reading is the same wherever the record lies, a water in the `architecture` folder a water (Part II, 6.3.4, rule 1).
5. A `generic` element goes in the folder its `generic.discipline` names (its own, else its type's), and in `architecture` when neither names one; a `generic` type goes in the folder its own `generic.discipline` names, else in `architecture` (Part II, 6.6). A reader MUST accept a `generic` record in any discipline folder.
6. A reader MUST accept an element or a type of a category it does not know (Part I, 10, rule 5) in any discipline folder. A writer MUST write it back at the path it was read from, and, where it has none (the single-file form), under `architecture`: `architecture/<level>/<category>/<id>.json`, `types/architecture/<category>/<id>.json`.

Reference: `categoryDiscipline`, `elementDiscipline` and `typeDiscipline` in `src/core/versions/layout.ts`.

*Section 4.4 replaces this table and rules 1 and 2 in 0.2: there a record's folder is the discipline that owns it, one of eight, and rules 4 to 6 hold for the eight folders.*

### 4.2 Element, type and view paths

- An element: `<discipline>/<segment(levelId)>/<category>/<segment(id)>.json`.
- A type: `types/<discipline>/<category>/<segment(id)>.json`.
- A view: `drawings/<discipline>/views/<kind>/<segment(id)>/view.json`, where `kind` is the view's `kind`.
- A sheet: `drawings/<discipline>/sheets/<segment(id)>.json`.

`<discipline>` is the record's owner (section 4.4). In 0.1's layout (section 4.1) it is the discipline of section 4.1, a view is at `drawings/views/<kind>/<segment(id)>/view.json` and a sheet at `drawings/sheets/<segment(id)>.json`.

A writer MUST write each record at its path. A reader SHOULD report a record whose file name, level folder or category folder disagrees with the record; the record's own members win. A validator MUST report such a record as an error, naming its file, and a view whose folder or kind folder disagrees with it too.

*Note (informative).* The reference reader takes a record's members as they are and does not compare them with the path. `tools/check.mjs` does.

### 4.3 Names that fold to one

Some file systems ignore letter case, and some Unicode normalisation too: there `Wall-A.json` and `wall-a.json` are one file, and so are two names that differ only in how an accented letter is encoded, as one code point or as a letter and a combining mark. A folder that holds both names cannot be written there, nor checked out there ([Security and privacy, 6.2](https://openeik.org/spec/0.7/security-and-privacy#6.2)).

1. The **fold** of a name is the name in Normalization Form D ([UAX #15](https://www.unicode.org/reports/tr15/tr15-50.html), revision 50, of Unicode 13.0.0), each of its characters replaced by its full case folding, and the result in Normalization Form C, each step as [Unicode 13.0.0](https://www.unicode.org/versions/Unicode13.0.0/) defines it. The full case folding is that of the Unicode Character Database's `CaseFolding.txt` of that version: its mappings of status C and F, and not those of status T, which are for Turkic languages. A code point that Unicode 13.0.0 does not assign has, in that version, no case folding and no decomposition, and is a starter that composes with no other character: it stays as it is. Two names **fold to one** when their folds are equal: they are then canonical caseless matches (the Unicode Standard, section 3.13, D145).
2. Two paths **fold to one** when they differ and, compared name by name from the first, the first two names in which they differ fold to one: where names fold, the two are one file, or lie in one folder that they spell in two ways. `architecture/level-0/wall/Wall-A.json` and `architecture/level-0/wall/wall-a.json` fold to one, and so do `architecture/Level-1/wall/a.json` and `architecture/level-1/roof/b.json`.

Part I, 6, rule 7 keeps two records' paths from folding to one, and section 7, rule 8 a kept file's path from folding to one with another of the model's.

*Note (informative).* This section was decided by the steward on 15 October 2026 (open questions, 23). Under rule 1, `ß`, `ẞ`, `SS` and `ss` fold to one, as do the Kelvin sign (U+212A) and `k`, and `Σ`, `σ` and `ς`; the Turkic dotless `ı` and `i` do not, nor do `wall-a` and `wall-à`. File systems that ignore case do not all fold alike, and a few hold names to be one that this rule keeps apart (the dotless `ı` and `i`, by their upper case); the rule is the Unicode Standard's own, so that every implementation compares names alike. Folding the decomposed name before it is composed again catches the few characters whose folding depends on the order of their combining marks, such as `ᾴ`.

*Note (informative).* Rule 1 names a version of Unicode so that every implementation folds a name alike, whatever version its platform has: a later version folds some characters that 13.0.0 does not assign (16.0 folds U+A7CB to U+0264, and U+A7DC to U+019B) and decomposes others (16.0 decomposes U+105C9), and a platform's own case mappings and normalisation follow its own version. Normalisation is stable for the characters that a version assigns (normalization stability, in [the Unicode Character Encoding Stability Policies](https://www.unicode.org/policies/stability_policy.html)), so a platform whose Unicode is 13.0.0 or later normalises a name of 13.0.0's characters as 13.0.0 does. An implementation on such a platform that leaves each later character of a name as it is, normalises the runs of characters between them apart and folds their case by 13.0.0's `CaseFolding.txt` folds every name as 13.0.0 does. A platform of an earlier version lacks some of 13.0.0's characters, and needs 13.0.0's normalisation data for them too. The version was fixed on 15 October 2026, as a reading of the decision, after a review found that current platforms fold U+A7CB differently (open questions, 23).

### 4.4 Folders that follow owners

*Part of 0.2, with [Part XVI](https://openeik.org/spec/0.7/ownership). It writes open question 85, which the steward decided on 27 October 2026 for 0.2 ("85y"). OpenEik 0.1 had it with the proposal `ownership`: a 0.1 writer writes the folders of section 4.1, and a 0.1 reader keeps a file in a folder that only this section gives, `ventilation/`, `plumbing/`, `electrical/`, `sprinkler/`, `setup/` or `drawings/<discipline>/`, as a kept file (section 7).*

Section 4.1 files a record by its category, and keeps a wall, a slab or a roof in `architecture` even when it bears: the folder follows who places a record. Part XVI gives ownership by path, and its parties work in eight disciplines (Part XVI, 2, rule 4). In this section a record's discipline folder is the discipline that **owns** it, one of the eight: `architecture`, `structure`, `ventilation`, `plumbing`, `electrical`, `sprinkler`, `site` and `setup`. So a party owns its discipline's folders, and an owners file says who owns what by a plain glob (Part XVI, 3.1). One set of rules, rules 1 to 5, gives a record's owner and so its folder: the application that checks a change, the host that holds it for approval and a tool that knows only paths give the same answer.

1. **An owner set by hand.** An element, a type and a view MAY carry `owner`, one of the eight disciplines, set by hand. It wins over every rule below. A validator MUST report an `owner` that is none of the eight as an error; [`schemas/0.2/ownership/owner.schema.json`](https://openeik.org/schemas/0.2/ownership/owner.schema.json) states this rule.
2. **An element's owner.** An element that carries no `owner` is owned, by the first of these that holds:
   - `structure`: an element that carries `frameHost` (a materialised framing member or truss); a wall, a slab or a roof that is `structural`; a stair that is `structural`, or that carries no `structural` and whose type's `stair.construction` is `concreteCast`, `concretePrecast` or `clt`; an element of the categories `beam`, `column`, `foundation`, `slabEdge`, `rebar` and `mesh`, and `member` ([Part II, 6.2.1](https://openeik.org/spec/0.7/language#6.2.1)); and a `component` that section 4.1, rule 2 puts in `structure` because it is `structural` or because its type is a plate or a cast-in item;
   - `ventilation`: a `duct`, and a `terminal` that is an air device (rule 3);
   - `plumbing`: a `pipe`, and every other `terminal`;
   - `electrical`: an element of the categories `electrical`, `cableCarrier` and `cable` ([Part XIII](https://openeik.org/spec/0.7/electrical));
   - `site`: an element of the categories `terrain`, `grading`, `propertyLine`, `planting`, `road` and `parking`;
   - a `generic` element: `structure` or `site` where the `generic.discipline` that section 4.1, rule 5 reads (its own, else its type's) names it, else `architecture`;
   - a `provision` ([Part II, 6.10](https://openeik.org/spec/0.7/language#6.10)): its asker's, the owner this rule gives the run its `provision.forIds` names first, else `setup`;
   - `architecture`: every other element.

   A `component` that this rule gives no owner, which may be a connector of its writer's library (section 4.1, rules 2 and 4), and an element of a category the reader does not know (Part I, 10, rule 5), stay in the folder they were read from where that is one of the eight, and are `architecture`'s where it is not or where they have none (section 4.1, rule 6).
3. **An air device.** A terminal is an air device when its type's `terminal.kind` is a component in a duct (`damper`, `fireDamper`, `smokeDamper`, `flowRegulator`, `silencer` or `ductFan`; Part II, 6.9), `transferAir` or `ftxUnit`; when the kind is `heatPump` and one of its type's connections carries air; and otherwise when its system carries air (Part II, 6.9's table). A component's system is its run's (Part II, 6.9): the run's `mep.system`, else its type's `pipe.system` or `duct.system`, and a duct carries air where neither gives one. Any other terminal's system is its type's `terminal.system`, else the system of its type's first connection. A terminal type is an air device by its kind, as above, or, where its `terminal.mount` is not `pipe`, by its own system. A terminal without a type is no air device.
4. **A type's owner** is its `owner`. Else it is `structure` for a wall, slab, roof or stair type that an element uses which bears by its own members, a wall, a slab or a roof that is `structural` or a stair as rule 2 says, and which carries no `owner`: the type's layers, or its flights, are the bearing build-up. Else it is the owner its category gives: a `terminal` type `ventilation` when it is an air device (rule 3), else `plumbing`; a `component` type `structure` when it is a plate or a cast-in item, else, as an element of its type, where it was read from (rule 2); a `generic` type by its own `generic.discipline`, as rule 2 says; a `provision` type `architecture`'s; and the type of any other category as rule 2 gives an element of that category. So a type's folder follows its elements: a wall type moves to `types/structure/` when a wall that uses it is made `structural`, and back when none is.
5. **A view's and a sheet's owner.** A view's owner is its `owner`, else `setup`. A sheet's owner is that of its discipline code: its `discipline` ([Part XIV, 2.1](https://openeik.org/spec/0.7/drawings#2.1)), else the letters its `number` begins with, one to four of the letters A to Z, Å, Ä and Ö in either case, where a `-`, a space or a `.` follows them or the number ends, in upper case. `A` and `BR` are `architecture`'s, `K` `structure`'s, `V` and `VE` `ventilation`'s, `VS` `plumbing`'s, `E` `electrical`'s, and `M`, `L` and `G` the `site`'s; any other code, and none, `setup`'s. `sprinkler` and `setup` own an element or a type only by its `owner`, but for a provision that names no run of the model, which is `setup`'s (rule 2). From 0.7, and in a model of 0.6 with the proposal `sprinklerSheets`, a sheet coded `SP` is `sprinkler`'s ([section 4.4.1](https://openeik.org/spec/0.7/code-base#4.4.1)).
6. **The folders.** In the **owners' layout**:
   - an element: `<owner>/<segment(levelId)>/<category>/<segment(id)>.json`;
   - a type: `types/<owner>/<category>/<segment(id)>.json`;
   - a view: `drawings/<owner>/views/<kind>/<segment(id)>/view.json`, with its detail items in chunks beside it (section 10);
   - a sheet: `drawings/<owner>/sheets/<segment(id)>.json`.

   The other lists keep their folders (section 1): `project/` is the project setup's, `fabrication/` structure's, `project/circuits/` electrical's (Part XIII, 3.1), and `documents/` holds the records any writer adds. This replaces section 4.1's table and its rules 1 and 2; its rules 3 to 6 hold for the eight folders and for `types/` of each, with `architecture` where 4.1 says it. `architecture`, `structure` and `site` are folders of both layouts; `systems`, `drawings/views/` and `drawings/sheets/` are 0.1's alone; `ventilation`, `plumbing`, `electrical`, `sprinkler`, `setup` and `drawings/<discipline>/` the owners' alone, and Part I, 11.1, rule 2 reserves them.
7. **Reading and writing.** A writer of 0.2 writes the owners' layout, each record at its path in it, and writes a folder in one layout. A reader MUST accept a record in either layout, 0.1's or the owners': no path is a record's in both layouts with two meanings, and section 4.1, rule 4 already forbids reading meaning from a folder. A folder read in either layout gives the same model, record for record and hash for hash. A validator MUST report a record in a folder that neither layout gives it as an error (section 4.2), and SHOULD warn about a folder that holds records in both: one where only 0.1's layout puts it, and another where only the owners' does.
8. **The change of layout.** The first version a writer makes of a building in the owners' layout moves every record whose folder changes, once, a view with its detail chunks: for a building of 0.1, the version that migrates it to 0.2, in one write (Part I, 9.8, rule 1); for a folder of 0.2 still in 0.1's folders, a version that only moves. Its message says that it changes the layout. It SHOULD change no record but by moving it, and but those Part I, 9.8 rewrites, so that its diff shows each other record moved (Part VI, 4, rule 3). A record it moves touches the path it leaves and the path it takes (Part XVI, 4, rule 1), so it needs the owners of both by the owners file as it stood before; it SHOULD be made by a party that owns `**`. In the same version, a writer rewrites `project/owners.json`, where the building has one, for the new folders (Part XVI, 3.1). Every later version has the paths of its records' owners. Versions already stored are never rewritten (Part VI, 3, rule 2), and a reader reads each in its own layout (rule 7).
9. **What changes, and what stays.** The change of layout moves records and changes none; the migration to 0.2 in the same version rewrites only what Part I, 9.8 says. Each record's id, its members, the GlobalId an export gives it (Part VIII) and its hash (section 6) stay what they were: its object is the same object in every version. What changes is each moved record's path, so every tree that holds one, and the root tree of the migrating version and of every version after it; and every digest of pairs (Part VI, 8.3), whose paths are leaf paths. A reader that compares a pair with a version (Part VI, 8.4; Part XIV, 9) compares it with the record its path names in either layout, its list and its id, so that a record that only moved, its hash the same, is unchanged.

*Note (informative).* The discipline codes of rule 5 are those of the Swedish convention Bygghandlingar 90. There `V` is VVS, heating, ventilation and plumbing together, `VS` heating and plumbing, and `VE` ventilation alone: `V` is not ventilation's own code, which is `VE`. A sheet of VVS as a whole has no one owner among the eight, and rule 5 gives a sheet coded `V` to `ventilation` as its own choice, so that a sheet of heating and plumbing alone is coded `VS`, `plumbing`'s. A project whose own convention gives a code another meaning has its sheets filed by rule 5's table all the same: a sheet's owner follows its code, whatever convention the project names, and whether a sheet may name its own owner is open question 182. This note is erratum 0.6-E3, which changes no owner and no folder.

*Note (informative).* What a path does not say stays an application's in 0.2 (open question 85, point 4). Three rules of the reference implementation are finer than a record: the fields of a record that another discipline owns (the framing of a wall that architecture owns is structure's); the answer to a provision for a void (Part II, 6.10), which the owner of its host gives; and a record that only follows its host (studs moved with their wall), which the host's owner may change. A host that enforces paths asks the follower's owner too, and does not see the fields. An application MAY refuse more than its owners file says; it SHOULD NOT accept a change that the file's paths refuse without saying so.

*Note (informative).* The cost of the layout is a migration of every tree, once, and a type whose folder follows its elements; its gain, that one function decides a record's owner and its folder. On the reference implementation's seven example projects, 3 288 records were compared: its own owner functions and `@openeik/tools` give every one the same owner, and the change of layout moves from 10 records (the views and sheets of a balcony) to 368 (a villa with its electrical installation, whose 213 devices leave `systems/`). Rules 2 to 5 are the reference's `elementOwner`, `typeOwner` and `sheetOwner` but in one point, which does not arise in its examples: it gives a `generic` record whose discipline is `systems` to `setup`, where rules 2 and 4 give it to `architecture`, `systems` naming none of the eight; `owner` gives it to whom it belongs.

Reference: `elementOwner`, `typeOwner`, `bearingTypeIds` and `sheetOwner` in `src/core/access/owners.ts`, `terminalIsAir` and `terminalTypeIsAir` in `src/core/elements/mep.ts`, `stairCarries` in `src/core/views/disciplines.ts` and `sheetDiscipline` in `src/core/sheets/disciplines.ts` (the reference implementation's work 670, at its `main` `f2bc53d2`), which decide a record's owner; the reference implementation still writes the folders of section 4.1 (open questions, section 2). In this repository, `modelOwners` in `packages/openeik/src/layout.js`, `migrateFiles` and `migrateFolder` in `src/migrate.js`.

### 4.4.1 A sprinkler sheet

*Part of 0.7. OpenEik 0.6 had it as the proposal `sprinklerSheets` (open questions, 181): a validator, a reader and a writer apply it to a model of 0.6 only where it is asked for or listed (Part I, 9.12), and to no model of 0.1 to 0.5; a model of 0.6 migrated to 0.7 has its sheets coded `SP` moved to sprinkler's folder (Part I, 9.14, rule 3). It adds no member, no record and no schema, governs the sheets in sprinkler's folder, `drawings/sprinkler/sheets/<id>.json`, and `schemas/0.7/index.json` names it in its `rules`.*

By the editors' decision of 17 November 2026 (open questions, 181 and 126), on a finding of the reference implementation while it built its sets of drawings (Part XIV, 2.5). The eight owners of section 4.4 include `sprinkler`, and rule 5 names no code for it: a sheet coded `SP`, a sprinkler engineer's, is `setup`'s and in setup's folder, so that the party that owns setup approves a change to it and the party that owns sprinkler cannot (Part XVI, 3.1, rule 1).

1. **SP is sprinkler's.** From 0.7, and in a model of 0.6 with the proposal, section 4.4, rule 5 gives a sheet whose discipline code is `SP` to `sprinkler`: its `discipline`, else the letters its `number` begins with, as rule 5 reads them, so that `SP-101` and `SP 2` are sprinkler's, and `SPR-1` and `S-1` are not. Every other code is as rule 5 gives it. A sheet's file is in its owner's folder (rule 6): a sheet coded `SP` at `drawings/sprinkler/sheets/<segment(id)>.json`.
2. **A validator.** A validator reports a sheet coded `SP` in another discipline's folder as an error (`path-discipline`), as rule 7 reports any record outside its owner's folder. Without the proposal it reports one in sprinkler's folder, which 0.6 gives to setup.
3. **What else reads a sheet's owner.** Where the proposal applies, what reads a sheet's owner reads it by rule 1: an owners file's paths (Part XVI, 3.1), and a drawing set's field `discipline` (Part XIV, 2.5, rule 7), so that a set by the rule `{discipline: [sprinkler]}` holds the sheets coded `SP`. A print of IFC holds no sheet, and is unchanged.
4. **A writer lists it.** A writer that files a sheet coded `SP` in sprinkler's folder lists the proposal (Part I, 9.12, rule 5): what a model shows of it is such a sheet's file. A model in the single-file form has no folders and shows it in no record; its list alone says it.
5. **A model of 0.6 that takes it up.** A model that does not list the proposal keeps each sheet coded `SP` in setup's folder, as 0.6 files it, and is read as before. The first version a writer makes that lists the proposal moves each sheet coded `SP` from `drawings/setup/sheets/` to `drawings/sprinkler/sheets/`, once, as the change of layout moves a record (section 4.4, rules 8 and 9): its id, its members and its hash stay, and only its path changes. The move touches setup's folder and sprinkler's, so it needs the approval of the owners of both by the owners file as it stood before (Part XVI, 4, rule 1). A version that takes the proposal out of the list moves them back. A model of 0.6 migrated to 0.7 moves them so in the version that migrates it, whether or not it listed the proposal (Part I, 9.14, rule 3).
6. **A reader of 0.6 without it.** A reader of 0.6 that does not implement the proposal refuses a model that lists it (`proposal-unread`), unless it reads none of the sheets in sprinkler's folder (Part I, 9.12, rules 4 and 12); a reader of walls alone reads the model without it, and says so (`proposal-skipped`).

*Note (informative).* Why a proposal for 0.7 and not an erratum of 0.6: rule 5 is plain, "any other code, and none, `setup`'s", and the reference implementation and `@openeik/tools` both file a sheet coded `SP` in setup's folder. Giving it to sprinkler in 0.6 would move files in models that exist, and make invalid a model that 0.6 holds valid, one with a sheet coded `SP` in setup's folder. That is a change of the rule, not a correction of its text (Part I, 9.5, rules 2 and 3). A sheet that one discipline draws for several, a VVS sheet drawn by the plumbing engineer, follows its code all the same; whether a sheet may name its own owner, as a view does, is open question 182.

Reference: in `@openeik/tools`, `sheetOwner(sheet, {sprinklerSheets})` and `modelOwners(model, {sprinklerSheets})` in `packages/openeik/src/layout.js`, with `SPRINKLER_SHEETS`, applied to a model of 0.7, and to one of 0.6 asked for the proposal or listing it.

## 5. The stored form

Every JSON file a writer writes is in the **stored form**, so that the same record always gives the same bytes and a changed value is a one-line diff:

1. UTF-8 without a byte-order mark, and a final newline.
2. Object members sorted by name, comparing UTF-16 code units; members whose value is undefined are left out.
3. An object with members is written as `{`, a newline, one member per line indented two spaces deeper than the object as `"name": value`, the members separated by `,` and a newline, a newline, and `}` at the object's own indent. An empty object is `{}`.
4. An array whose items are all scalars (strings, numbers, booleans, `null`) is written on one line: `[` the items separated by `, ` `]`. An empty array is `[]`. Any other array has one item per line, indented as object members are.
5. Scalars are written as ECMAScript's `JSON.stringify` writes them: strings with its escapes, numbers in the shortest form that reads back as the same double, `-0` as `0`.

A point list is therefore one point per line, and a point is one line:

```json
{
  "category": "wall",
  "height": 2700,
  "id": "wall-south",
  "profile": [
    [10000, 0],
    [0, 0]
  ],
  "top": {
    "attach": {
      "face": "underside",
      "hostId": "roof-main"
    },
    "constraint": "unconnected"
  }
}
```

(abridged from `examples/one-storey-house/architecture/level-0/wall/wall-south.json`.)

6. A writer MUST write the stored form. A reader MUST accept any layout of a record, its white space and its members' order, that is I-JSON (RFC 7493): the form is for diffs, not for parsing. A reader SHOULD refuse a record that is not I-JSON, as Security and privacy, 7.3, rule 1 asks: an object with a member name twice, a string with an unpaired surrogate, or a number that expresses more magnitude or precision than a double provides, as that rule says. A validator MUST report a JSON file of the model's own that is not in the stored form, a record's, `project/order.json` or `eik.json`, as an error, naming the file: a reader reads it all the same.

Reference: `eikText` in `src/core/versions/eikFolder.ts`; `tools/lib/stored-form.mjs` in this repository is an independent implementation, used by `tools/check.mjs`.

## 6. Canonical form and hashes

1. The **canonical form** of a JSON value is the JSON Canonicalization Scheme of [RFC 8785](https://www.rfc-editor.org/rfc/rfc8785): no white space, members sorted by UTF-16 code units, scalars as ECMAScript writes them.
2. A record's **hash** is the SHA-256 of the UTF-8 bytes of its canonical form, written as 64 lowercase hexadecimal digits.
3. The stored form and the canonical form of a record differ only in white space, so a record's hash does not depend on how its file is laid out.
4. A kept file's hash is the hash of its text as a JSON string (the canonical form of the string).

Reference: `canonicalJson` in `src/core/versions/canonical.ts` (keys sorted, numbers as JavaScript writes them, absent values left out); `sha256` in `src/core/versions/sha256.ts`.

## 7. Kept files

A folder may hold files that are not records: another tool's results, requirements, a README. They travel with the model.

1. A **kept file** is a file at a plain relative path (no segment starting with `.` or `~`, no `\` and no NUL) that is not `eik.json`, not `AGENTS.md` and not at a record's path. Rule 8 keeps some plain paths from kept files too.
2. A kept file of at most 1 MiB (1 048 576 bytes) that is valid UTF-8 without NUL bytes is read as text and kept with the model. A writer MUST write it back unchanged where it was. A larger or binary file is left alone: not part of the model, never removed.
3. A writer of the model MUST NOT remove or rewrite a kept file, and MUST remove only the files of records that went. The application that owns a kept file may change or remove it.
4. A kept file MUST NOT occupy a record's path, that path without `.json` (the record's leaf in a version tree, Part VI, 2), or a folder a record needs; a reader MUST refuse such a folder and name the path.
5. In the single-file form (section 11) kept files are the `extras` member: text by path.
6. A kept file is not a record, and the units of Part I do not bind it. An application that keeps results in a folder (an analysis, a quantity take-off) MUST state their units in the files themselves; they need not be millimetres.
7. An application keeps its own files in a folder of its own at the top of the model's folder, `<application>/`, which Part I, 11.3 says to name by its prefix, with a model folder for each model of its own, `<application>/<model>/` (for example `acme/frame-a/`). Part VI, 8, says how it keeps its results, with their result manifests, and its proposals there.
8. A kept file's path is not escaped, and MUST NOT hold a name that a file system refuses or reads otherwise, which section 2 escapes in a name made from an id (its rules 2 to 5: a character a common file system refuses, a leading `.` or `~`, a trailing `.` or space, a device name), nor fold to one (section 4.3) with a record's path, with `eik.json` or `AGENTS.md`, whether or not the folder holds them, or with another kept file's path, nor pass through `eik.json` or `AGENTS.md`, or a name that folds to one with either, as through a folder: each is a file at the top of the model's folder (section 8). A writer MUST NOT write such a kept file: it refuses the model, naming the path, before it writes anything. A file at such a path in a folder is no kept file, and a reader MUST NOT refuse the folder for it. It leaves the file alone, as rule 2 leaves a larger or binary file: not part of the model, and never removed. It SHOULD warn, naming the path, and reads on. It takes the records' paths, `eik.json` and `AGENTS.md` first, and then the kept files in the order of their paths by UTF-16 code units, and leaves alone each kept file whose path folds to one with a path it took before it, or that passes through `eik.json` or `AGENTS.md`. A validator MUST report each such file of a folder as a warning, and each such entry of the `extras` of a model in the single-file form as an error, naming its path. A reader of versions MUST refuse a version that holds such a kept file, naming it (Security and privacy, 5.3, rule 2), unless its caller asks it to repair the version, when it reads the version, leaves the file out and gives it back, losing nothing (5.3, rule 4).

Reference: `keptPath` and `extrasSchema` in `src/core/model/extras.ts`; `textOf` and `KEPT_MOST` in `server/eikSession.ts`; `manifestOfFolder` ("a record of the model is kept at that name"); `writeFolder`.

*Note (informative).* Rule 8 was decided by the steward on 15 October 2026 (open questions, 25). A kept file is another tool's text, not a record (rule 6), so a validator reports such a file of a folder as a warning, not an error: the folder reads and checks on the system that holds it, and the file is in no version, so nothing but a checkout of the folder itself on a system that refuses or folds the name can fail. In the single-file form such an entry is part of the model as it was given, which no writer writes and a reader cannot leave alone without losing it, so it is an error there. The order of rule 8 gives every reader one model: where names fold, the second of two kept files could not be there at all. So `notes/con.txt`, `notes/12:30.md`, `C:/notes.md` and `notes/draft.` are left alone, as are `Types/notes.md` beside the folder `types/`, `notes/Readme.md` beside `notes/README.md`, which comes before it by code units, and `agents.md` in a folder without `AGENTS.md`, where a writer would write it (section 8.2), and `AGENTS.md/notes.md` in a folder named `AGENTS.md`, which takes the place of that file. No folder gives a version that holds such a kept file, since a reader of the folder leaves the file out; and a reader that left it out of a version it read would drop it from the next version it stores (Part VI, 6.3, rule 6). So a reader of versions refuses such a version, as it refuses a tree with a name that no folder holds, and whoever made it renames the file. Two kept files whose paths fold to one, one from each side of a merge, are a conflict (Part VI, 5, rule 5). A `%` is no such character, as a reading of the decision: Part VI, 8.1 names an application's folders by the segments of its own ids, escapes and all (`acme/frame%3Aa/source.json`), and those folders hold kept files; section 2 escapes a `%` only so that an escape reads back as one (its rule 1), and a kept path is never read back. So `notes/50%.md` is a kept file too. The reference implementation keeps such files as kept files, and holds them in its versions (open questions, section 2).

## 8. The engine files

### 8.1 `eik.json`

`{"format": "openeik/0.1-draft", "units": "mm"}`, in the stored form. Part I, 9.2, says what a reader does with it. Writers MAY add members in later versions; readers MUST ignore members they do not know.

A writer MUST keep the members of `eik.json` that it does not know: writing into a folder or a version whose `eik.json` it read, it writes them back as it read them, beside the `format` it writes (Part I, 9.2, rule 2) and `units`. No application adds one (Part I, 11.2, rule 8).

*Part of 0.6. OpenEik 0.5 had it as the proposal `declaredProposals` (Part I, 9.12; open questions, 157).* In a folder of 0.5 or of a later version, `eik.json` MAY give `proposals`, the sorted names of the proposals for the version after its own that the model is written by: in a folder of 0.5, the proposals for 0.6, `{"format": "openeik/0.5", "proposals": ["edgeNone"], "units": "mm"}`; in a folder of 0.6, those for 0.7, `{"format": "openeik/0.6", "proposals": ["replacedOpenings"], "units": "mm"}`; in a folder of 0.7, those for 0.8, of which there are none yet. A reader reads the folder by them (Part I, 9.12, rule 3), and a writer writes the list its model needs (rule 5) in place of the one it read, which is no member it does not know; a reader of 0.5 that does not implement the proposal ignores the member, as this section says of any it does not know.

*Note (informative).* The writer's rule was decided by the steward on 15 October 2026 (open questions, 27). A member of `eik.json` that a 0.1 writer does not know is a later version's, which a reader of the same major version reads from 1.0 on (Part I, 9.6, rule 2), or one that an application should not have added (`@openeik/tools` warns about it, `eik-extension`): either way it stays, as the members of a record that a reader does not know stay (Part I, 10, rule 1). The single-file form holds no `eik.json` (section 11): a writer that writes it out as a folder writes its own.

### 8.2 `AGENTS.md`

The conventions an agent cannot read off the files: units, level semantics, the meaning of profiles, that nothing derived is stored, that a hand edit adds 1 to the revision, and how to check the folder.

1. A writer MUST write `AGENTS.md` when the folder has none, and MUST NOT overwrite one that exists: a person's edits to it stay.
2. A reader MUST NOT read model data from it.

Reference: `AGENTS_TEXT` in `src/core/versions/eikFolder.ts`; `writeFolder` writes it only where there is none.

## 9. Order

1. `project/order.json` maps the name of each record list other than `elements` that the model has (`types`, `views`, `materials`, `sheets` and so on) to its ids in order.
2. A reader orders each list by it. Records it does not name follow, in path order; ids it names without a record are ignored.
3. The order of elements is not part of a model. Implementations MUST NOT give it meaning.
4. Levels keep their order in `project/levels.json`.
5. `project/order.json` is an index of the record lists, not a record: it names lists and their ids, and nothing else (Part I, 11.2, rule 8), and the single-file form has no counterpart for it (section 11, rule 4). Part I, 10, rule 1 does not hold for a member of it that names no record list the reader knows: a reader MAY drop such a member, and SHOULD warn when it does. A validator SHOULD warn about one, and MUST NOT refuse the folder for it.

Reference: `buildTree` and `readManifest` in `src/core/versions/tree.ts`.

*Note (informative).* In 0.1 such a member is always one that no writer should have written: a reader of 0.1 refuses a folder of a later minor version (Part I, 9.2, rule 3), so it never meets a later version's list there. `@openeik/tools` drops such a member and warns (`order-unknown`).

## 10. A view's detail items

A view's 2D items (lines, texts, dimensions, tags and the rest) can number tens of thousands. They are stored in chunks beside the view, so that an edit rewrites one chunk:

1. When a view has detail items, `view.json` holds the view without them, and the items go into chunk files `details/<n>.json`, in order. A view with an empty list keeps `"details": []` in `view.json`.
2. A chunk ends after an item whose id's hash is 0 modulo 64, or when it holds 256 items. The hash is 32-bit FNV-1a over the id's UTF-16 code units: start from `0x811c9dc5`; for each code unit, XOR it in, then multiply by `0x01000193` modulo 2³². This is not quite the FNV-1a of RFC 9923, which hashes octets: the two agree only for ids of ASCII characters.
3. Chunks are named by their index from 0 in decimal, zero-padded to the width of the largest index or 4 digits, whichever is more: `0000.json`, `0001.json`, ….
4. Where the folder a writer writes into, or the version whose files it writes (a clone, a pull; Part VI, 6), holds chunks of a view that, joined in name order, are the items the writer writes, the view keeps those chunks (the version's, where both hold such chunks): the writer MUST write each of them at its name, with its items, and MUST NOT rename, re-cut or remove them, though rules 2 and 3 would cut or name them otherwise. A writer MUST chunk every other view's items by rules 2 and 3. A reader MUST join a view's chunks in name order and MUST accept any chunking.

Reference: `detailChunks` and `HashCache.viewParts` in `src/core/versions/tree.ts`.

*Note (informative).* Rule 4's first two sentences are as erratum 0.7-E2 corrects them. A folder whose chunks are cut or named otherwise, one whose view was written by hand with `details/0.json`, say, is valid: a reader joins its chunks, and a validator reports nothing of their names. A drawing issued from it names each chunk it read by its path (Part XIV, 9.2), and its files are replaced only by a later revision of it (Part XIV, 7.4, rule 4), so a writer that renamed or re-cut the chunks of a view it did not change would leave the drawing's read set naming chunks the folder no longer holds, and a folder cloned from a version holding another tree than the version's (Part VI, 6.5). The single-file form holds a view's items, and not its chunks (section 11, rule 3): a model written from it into a folder that holds none of a view's chunks has them cut and named by rules 2 and 3. A view's chunks are kept as they are by writing the folder, or its versions, and not through the single-file form. `@openeik/tools` keeps them in `writeFolder`, `clone` and `pull` (`heldChunks`, `viewChunks`).

## 11. The single-file form

A model may also travel as one JSON object, for exchange and email. It is the folder's content without the layout:

`{format, units, project, projectInformation?, levels, grids?, scopeBoxes?, materials?, dimensionStyles?, detailFamilies?, titleBlocks?, images?, types, elements, views, sheets?, circuits?, people?, drawingSets?, reports?, renders?, deviations?, areaAdjustments?, references?, pieces?, joints?, originals?, copies?, extras?}`

In 0.1 the object began with `schemaVersion` and named no format; 0.2 deprecates `schemaVersion` (Part I, 9.3). `drawingSets` is 0.7's, and a model of 0.6's with the proposal `drawingSets` (Part XIV, 2.5).

1. Lists hold their records in order; views hold their detail items inline; `extras` holds the kept files.
2. `schemas/model.schema.json` validates it.
3. A reader that reads folders MUST also read the single-file form. Reading a folder and writing it as one file, or the reverse, MUST lose nothing but the order of elements, the files a reader leaves alone (section 7, rules 2 and 8), the members of `project/order.json` that name no record list (section 9, rule 5) and the members of `eik.json` other than `format` and `units` (section 8.1), since the single-file form holds those two only (rule 5). It holds a view's items and not its chunks (rule 1), so the round trip also loses the names and the cut of a view's chunks where section 10, rules 2 and 3 do not give them (section 10, rule 4).
4. `project/project.json` holds the members of the single-file object other than its record lists, `levels`, `extras`, `format` and `units`: `project`, `projectInformation`, and any other member at the top of either (`schemaVersion` among them, where a model gives it), a member a reader does not know or an extension member (Part I, 10 and 11.2). Reading and writing carry such a member from the one to the other. `project/order.json` has no counterpart in the single-file object: there the order of a list is the order of its records (section 9), and the file, an index and not a record, holds nothing else (section 9, rule 5; Part I, 11.2, rule 8).

5. The object names its format and its units at its top, `format` and `units`, as `eik.json` does for a folder (section 8.1; Part I, 9.2). A writer of 0.2 MUST write both. A reader reads the object's version from `format` and refuses one it does not implement, as it refuses such a folder (Part I, 9.2, rule 3), and refuses `units` other than `"mm"` (Part I, 3, rule 7). An object without `format` is one of 0.1, which named none.

*Part of 0.6. OpenEik 0.5 had it as the proposal `declaredProposals` (Part I, 9.12, rule 8; open questions, 157).* A model of 0.5 or of a later version in the single-file form MAY give `proposals` at its top, beside `format` and `units`, as `eik.json` does for a folder (section 8.1): it is one of the members rules 3 and 4 name with them, carried between the top and `eik.json`, and never into `project/project.json`.

Reference: `ek import` (folder to one file) and `ek export` (one file to folder) in `server/ek.ts`; the manifest type in `src/core/model/model.ts`. The reference implementation writes no `format` in its single-file models yet (open questions, section 2).

### 11.1 The file extension and the media type

1. A file that holds a model in the single-file form SHOULD have a name that ends in `.eik.json` (`one-storey-house.eik.json`): it ends in `.json`, so that every tool opens it as JSON, and `.eik` comes before that, so that people and tools tell a model from other JSON.
2. Its media type is `application/vnd.openeik+json`: JSON text (RFC 8259) in UTF-8, with the `+json` structured syntax suffix (RFC 6839), and without parameters. A server, a store or a tool that labels a model in the single-file form with a media type (an HTTP `Content-Type`, an upload, an attachment) SHOULD use it.
3. A reader MUST read the single-file form whatever its file is called and however it is labelled (as `application/json`, say, or in a file named after the application that wrote it): a name and a label say what a file is meant to hold, and its content decides.
4. The media type is not registered with IANA yet. Its registration is planned before 1.0 ([`GOVERNANCE.md`](https://gitlab.com/openeik/spec/-/blob/main/GOVERNANCE.md#reaching-10)), with the template of section 11.2.

*Note (informative).* The file extension and the media type were decided by the steward on 14 October 2026 (open questions, 20). The reference implementation names its own single-file models `*.stomra.json` and labels none with a media type; this text does not change what it writes (open questions: section 1, 24, and section 2, 21). A folder has neither a file extension nor a media type, and 0.1 gives none to an archive of a folder (a zip); 0.5 gives one its own, `.eik.zip` and `application/vnd.openeik+zip` (section 11.3).

### 11.2 The media type's registration template (informative)

*This section is informative. It is the template to be sent to IANA to register the media type of section 11.1 in the vendor tree (RFC 6838, sections 3.2 and 5.6), and the template of the media type of section 11.3, of 0.5, to be sent with it. Neither has been sent.*

```text
Type name: application

Subtype name: vnd.openeik+json

Required parameters: none

Optional parameters: none

Encoding considerations: binary. The content is JSON text (RFC 8259),
  which is UTF-8 when it is exchanged (RFC 8259, section 8.1).

Security considerations: A model is data: JSON text, which names no
  resource outside itself that a reader must fetch. The security
  considerations of JSON (RFC 8259, section 12) apply. A model can be large
  (many records, points, detail items and meshes); a reader bounds the
  memory and the time it spends on one. Some of its strings are
  expressions that a compiler evaluates: the arithmetic of the framing
  families (OpenEik, Part II, section 5.4), a closed language of numbers,
  names, the four operations and eight functions, with no loops, no calls
  out of it and no state, at most 240 characters long; an implementation
  evaluates them by that grammar alone, never as a programming language's
  code. Its kept files (the member "extras") are other applications' text
  by path; a reader keeps their text and does not run it, and an
  application that interprets one treats it as untrusted input. Written
  out as a folder, a model names the paths of its files: a record's is
  made of its id, its level's id, its category and, for a view, its kind
  (OpenEik, Part III, sections 2 and 4), and a kept file's is its own. A
  kept file is a file at a plain relative path: no name in it starts with
  "." or "~", so none is "..", and it holds no "\" and no NUL (Part III,
  section 7.1). A conforming writer, and any tool that writes a model's
  files (a clone, a pull, the single-file form written out as a folder),
  writes no file outside the model's folder (OpenEik, Security and
  privacy considerations, section 6.1): it escapes each name it makes
  from an id or a level's id (Part III, section 2); a category and a
  view's kind are plain names by their schemas; and it refuses the
  model, before it writes anything, where a kept file's path is not
  plain, holds a name that a file system refuses or reads otherwise
  (as a drive, a device or a second stream of a file, or with a
  trailing dot or space dropped), folds to one with another of the
  model's paths where a file system ignores case and Unicode
  normalisation, or passes through "eik.json" or "AGENTS.md" as
  through a folder (Part III, sections 4.3 and 7). So no path that such
  a tool builds from a model resolves outside the model's folder, and
  no two of them are one file. Content hashes (SHA-256) name
  content; they do not say who wrote it. A model may hold personal data,
  such as its authors' names and email addresses and a site's position,
  and gives it no protection of its own: whoever shares a model shares
  them.

Interoperability considerations: A model in this form holds the same
  content as an OpenEik folder (OpenEik, Part III, sections 1 and 11).
  Readers keep the members they do not know (Part I, section 10) and accept
  any JSON layout (Part III, section 5). Files written before this
  registration may be named "*.json", or after the application that wrote
  them; a reader reads the form whatever its file is called.

Published specification: OpenEik, Part III, section 11, "The single-file
  form" (https://openeik.org/). The URL of the published version is given
  at registration.

Applications that use this media type: building modelling and design
  applications, model checkers and validators, agent hosts, and exporters
  that read or write OpenEik models.

Fragment identifier considerations: as for application/json (RFC 6839,
  section 3.1). OpenEik defines none.

Additional information:

  Deprecated alias names for this type: none
  Magic number(s): none
  File extension(s): .eik.json
  Macintosh file type code(s): none

Person & email address to contact for further information: the steward of
  OpenEik (GOVERNANCE.md); the address is given at registration.

Intended usage: COMMON

Restrictions on usage: none

Author: the editors of OpenEik

Change controller: the steward of OpenEik, and the body that holds OpenEik
  after it (GOVERNANCE.md)
```

The second template, of 0.5 with section 11.3, registers the media type of an archive of a folder in the same tree. The steward decided on 5 November 2026 that it is registered together with the first, at 1.0 (open questions, 20). It has not been sent either.

```text
Type name: application

Subtype name: vnd.openeik+zip

Required parameters: none

Optional parameters: none

Encoding considerations: binary. The content is a zip archive (PKWARE's
  APPNOTE.TXT, version 6.3.10), as for the +zip suffix (RFC 6839,
  section 3.6).

Security considerations: An archive holds an OpenEik folder: its records,
  its kept files and its assets, each a file at its path in the folder.
  The security considerations of application/vnd.openeik+json apply to
  the model it holds, and its assets (PDF renditions, fonts, pictures,
  signed containers) are binary files that a reader never runs (OpenEik,
  Security and privacy considerations, section 11; Part XV, section 10).
  Zip archives have carried attacks of their own, which a reader of an
  archive guards against (OpenEik, Part III, section 11.3, rule 11, and
  Security and privacy, section 6.5): it reads the archive as the folder
  it holds, and refuses an entry whose name would lead out of the folder
  (empty, absolute, beginning with a drive, or holding "\", NUL, ".",
  ".." or an empty name), a link or a special file, two entries of one
  name or of names that fold to one where a file system ignores case
  and Unicode normalisation, a central directory that disagrees with its
  local headers, entries whose bytes overlap, an entry encrypted or of a
  method other than stored and deflated, and one whose bytes do not give
  its size and CRC-32. It bounds every entry's size, and the sizes of all
  of them, before it inflates anything; refuses a deflated entry that
  claims more than 1 032 times its compressed size, which deflate cannot
  give; and inflates no entry past the size its central directory gives.
  It does not open an archive held in an archive (a signed container
  among the assets) as an archive of a folder. A tool that writes the
  folder onto a disk writes it as a writer writes a folder, not by
  unpacking the entries as they are. An archive holds no hidden file
  of the folder, such as its remote-tracking refs or a git repository.
  A model may hold personal data, such as its authors' names, a site's
  position and the photographs attached to its reviews, and gives it no
  protection of its own: whoever shares an archive shares them.

Interoperability considerations: An archive is a zip that any zip tool
  opens, and unpacked it is an OpenEik folder (OpenEik, Part III,
  sections 1 and 11.3). Its entries are stored, not deflated, its first
  entry is eik.json, and its bytes are a function of the folder's
  version, so that one folder gives one archive, byte for byte, in every
  implementation. A reader reads an archive that another zip tool wrote,
  deflated entries included, as the folder it holds.

Published specification: OpenEik, Part III, section 11.3, "An archive of
  a folder" (https://openeik.org/). The URL of the published version is
  given at registration.

Applications that use this media type: building modelling and design
  applications, model checkers and validators, agent hosts, version
  stores, and exporters that read or write OpenEik models.

Fragment identifier considerations: as for application/zip (RFC 6839,
  section 3.6). OpenEik defines none.

Additional information:

  Deprecated alias names for this type: none
  Magic number(s): 50 4B 03 04 at offset 0, and "eik.json"
    (65 69 6B 2E 6A 73 6F 6E) at offset 30
  File extension(s): .eik.zip
  Macintosh file type code(s): none

Person & email address to contact for further information: the steward of
  OpenEik (GOVERNANCE.md); the address is given at registration.

Intended usage: COMMON

Restrictions on usage: none

Author: the editors of OpenEik

Change controller: the steward of OpenEik, and the body that holds OpenEik
  after it (GOVERNANCE.md)
```

### 11.3 An archive of a folder

*Part of 0.5. OpenEik 0.4 had it as the proposal `archives` (open questions, 20): what it asks is a reader's and a writer's of a folder of any version. The steward decided on 5 November 2026 that a folder may travel as one zip archive of it, laid out as this part lays out the folder, deterministic so that the same folder gives the same bytes, with the file extension `.eik.zip` and the media type `application/vnd.openeik+zip`, registered with that of section 11.1; and that the registration is made at 1.0, as planned. What an archive holds and in which form are the editors' (question 126). It changes no rule of a folder, of a version or of the single-file form: an archive holds a folder, which a reader reads as it reads that folder, and a model is held to its own version's rules in it. No schema describes a zip: 0.5's index names the rule in its `rules` (`schemas/0.5/index.json`), and [Security and privacy, 6.5](https://openeik.org/spec/0.7/security-and-privacy#6.5) says what a reader of one guards against.*

The single-file form holds a model's records and kept files as one JSON object, and carries no asset (Part XV, 9, rule 1). An **archive** is a folder in one file: a zip archive ([PKWARE's APPNOTE.TXT](https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT), version 6.3.10) of the files a version of the folder holds (Part VI, 2), each at its path in the folder, with each asset's bytes in place of its pointer (Part XV, 3). Any zip tool opens it, and unpacked it is the folder; it carries a model's assets, its PDFs, fonts, pictures and signed containers, where the single-file form cannot.

1. **What it holds.** An archive's entries are the files of its folder's version, each at its path in the folder: `eik.json`, each record's file, each kept file (section 7) and each asset, at `assets/<sha256>.<ext>` (Part XV, 2). It holds nothing else: no `AGENTS.md`, which no version holds (section 8.2; Part VI, 2, rule 1); no hidden or reserved name (section 1), `.eik/` and `.git/` among them; no file a reader of the folder leaves alone (section 7, rules 2 and 8; Security and privacy, 6.4); and no entry for a folder, which the files under it make. Its entries are at the folder's own paths, `eik.json` at its top, and not under a folder of the folder's name.
2. **What each entry holds.** Each entry holds the bytes that writing the version into a folder writes at its path (Part VI, 6.4, rule 3; Part XV, 3, rule 5): `eik.json` and each record's file in the stored form (section 5), each kept file its text in UTF-8, unchanged (section 7, rule 2), and each asset its bytes (Part XV, 2, rule 2). So a folder whose records are not in the stored form, and a folder in the stored form of the same version, give one archive.
3. **The order.** `eik.json` is the first entry. The others follow it in the order of their paths by UTF-16 code units, as section 7, rule 8 orders kept files; the central directory names them in the same order.
4. **Each entry's form.** Each entry is stored as it is, uncompressed (compression method 0), and its local file header and its central directory header give:
   - the version needed to extract 1.0 (10), or 4.5 (45) for an entry that rule 5 gives a ZIP64 field; and in the central header, the version made by 4.5 on MS-DOS (45, host 0), so that no entry carries a system's permissions;
   - the general purpose flags 0x0800: bit 11 alone, its name in UTF-8 ([APPNOTE, appendix D](https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT)); no data descriptor, no encryption;
   - the last modification time 0 and date 0x0021: 00:00:00 on 1 January 1980, the earliest a zip can give;
   - its CRC-32, and its compressed and uncompressed sizes, which are its length;
   - its name, its path in the folder, in UTF-8, its names separated by `/`, with no leading `/`;
   - no extra field but rule 5's, no comment, the internal and external attributes 0, and the disk 0.
5. **ZIP64.** An entry whose local header begins 0xFFFFFFFF bytes or more into the archive gives 0xFFFFFFFF for its offset in its central header, and a ZIP64 extended information extra field (header 0x0001, APPNOTE 4.5.3) that holds its offset in 8 bytes, and nothing else. An archive of 65 535 entries or more, or whose central directory begins 0xFFFFFFFF bytes or more into it or is that long or longer, ends with a ZIP64 end of central directory record (made by and needing 4.5, with no extensible data) and its locator, before the end of central directory record. No other entry and no other archive uses ZIP64. No entry needs it for its sizes: none is 4 GiB long (Part XV, 4, rule 2).
6. **The end.** The entries follow each other from the archive's first byte, and the central directory follows the last of them; then the end of central directory record, on disk 0 with every entry on it, each value it cannot hold given as 0xFFFF or 0xFFFFFFFF and held in the ZIP64 record of rule 5, and no comment. Nothing comes before the first entry, between two entries, or after the end.
7. **Writing it.** A writer that writes an archive MUST write it by rules 1 to 6. An archive's bytes are then a function of its folder's version alone: two folders of one version, or one folder written twice, give the same bytes, and the archive of a model in the single-file form is the archive of the folder a writer writes of it (section 13).
8. **Known by its bytes.** An archive begins with the bytes 50 4B 03 04 (`PK`, a zip's first local header) and has its first entry's name, `eik.json`, at byte 30, and that entry's bytes, `eik.json` in the stored form, at byte 38, which name the folder's format: as an EPUB's first entry, `mimetype`, gives its media type at byte 38 (EPUB 3's Open Container Format). A reader that is given a file that begins with `PK` 03 04 reads it as an archive, whatever the file is called and however it is labelled (section 11.1, rule 3).
9. **File extension and media type.** A file that holds an archive SHOULD have a name that ends in `.eik.zip` (`one-storey-house.eik.zip`): it ends in `.zip`, so that every tool opens it as a zip, and `.eik` comes before that, as in `.eik.json`. Its media type is `application/vnd.openeik+zip`, with the `+zip` structured syntax suffix ([RFC 6839](https://www.rfc-editor.org/rfc/rfc6839), 3.6), and without parameters. A server, a store or a tool that labels an archive with a media type (an HTTP `Content-Type`, an upload, an attachment) SHOULD use it. It is registered with IANA together with that of section 11.1, at 1.0 (section 11.1, rule 4; [`GOVERNANCE.md`](https://gitlab.com/openeik/spec/-/blob/main/GOVERNANCE.md#reaching-10)), with the second template of section 11.2.
10. **Reading it.** A reader that reads folders MUST also read archives. It reads one as the folder it holds (section 12): each entry is a file at its name, of the bytes the entry holds, stored, or inflated where it is deflated (method 8). It reads an archive that rules 3 to 6 do not hold, one that another zip tool wrote, as it reads one that they hold: its entries in another order, deflated, of another time or flags, with extra fields, comments or data descriptors. It reads an entry that rule 1 keeps out as a reader of a folder reads such a file: `AGENTS.md` as no file of the model, a hidden or reserved name skipped, a file a reader leaves alone left alone; and a folder's entry as no file. It performs the whole-model check where it does for a folder (section 12, rule 5), and refuses what it refuses of a folder.
11. **What a reader refuses.** Besides what it refuses of a folder, a reader MUST refuse an archive, naming the entry where there is one, before it reads any entry's bytes as the folder's:
    1. that is no zip that every reader reads alike: one without an end of central directory record, on more than one disk, or encrypted; whose central directory does not fill the room it says it takes; with a central header whose local header is not where it says, or disagrees with it on the entry's name, its method, its flags or, where no data descriptor follows the entry, its CRC-32 or its sizes; with a ZIP64 record that disagrees with the end record, or an extra field that names the entry otherwise (Info-ZIP's Unicode path field, 0x7075); with two entries whose bytes overlap; with an entry of a method other than 0 and 8; or with an entry whose bytes do not give its size and its CRC-32;
    2. that holds an entry whose name is not UTF-8, or would lead out of the folder: one that is empty, begins with `/` or a drive (`C:`), or holds `\`, NUL, or a name that is empty, `.` or `..`;
    3. that holds two entries of one name, a name that is a file's and a folder's at once, or two entries, neither of them hidden or reserved, whose paths fold to one (section 4.3): on a system where names fold, one file would stand for two;
    4. that holds an entry that is a link or a special file, by the mode its external attributes give where its version made by names Unix (host 3) or macOS (host 19): no folder holds one as a file of the model (Security and privacy, 6.4);
    5. past a bound of Security and privacy, 6.5, rule 2.
12. **Checking it.** A validator MUST report, as an error naming the entry, each entry that rule 1 keeps out of an archive and each way the archive is not as rules 3 to 6 say; a reader reads such an archive all the same (rule 10), and SHOULD warn, as it reads a record that is not in the stored form (section 5, rule 6). It reports each of rule 11's refusals as an error, and checks the folder the archive holds as it checks a folder.
13. **Writing out its folder.** A tool that writes the folder an archive holds onto a disk writes it as a writer writes a folder (section 13; Security and privacy, 6.1), from what it read, and `AGENTS.md` where the folder has none (section 8.2): it does not unpack an entry as it is. Whoever unpacks an archive with a tool that knows nothing of OpenEik relies on that tool to keep every entry inside the folder and to make no link (Security and privacy, 6.1).

*Note (informative).* The choices of rules 1 to 9 follow the containers that common practice already reads. EPUB's Open Container Format and ETSI's associated signature containers (ASiC, EN 319 162-1; the `asice` assets of Part XV, 4) put a first entry, `mimetype`, stored and without an extra field, so that a file is known by its bytes; an archive's first entry is `eik.json`, which names the format, its name eight bytes long as `mimetype` is, so a reader finds both at the same offsets, and no file is added that would be a kept file of the folder once unpacked. Office Open XML's packages (OPC, ISO/IEC 29500-2) hold no two parts whose names differ only in case, as rule 11.3 holds no two entries whose paths fold to one. Entries are stored, not deflated, because deflate does not give one stream for given bytes: two builds of zlib, or zlib and a browser's own, deflate one file to different bytes, and an archive deflated would be one folder's bytes in one tool and others in another; the same is why reproducible builds and Go's module archives name content by the hash of their files rather than of a zip. A model's JSON deflates to about a tenth, which a transport gains back where it compresses what it carries (HTTP's content coding, [RFC 9110](https://www.rfc-editor.org/rfc/rfc9110), 8.4); an asset (a PDF, a PNG, a JPEG) is compressed already. A version names a model by its root hash, which an archive does not change: reading it gives the folder's version, hash for hash. `AGENTS.md` is left out as a version leaves it out: it is no file of the model (section 8.2), a writer writes its own where a folder has none, and an archive from elsewhere then brings no instructions for the receiver's agents (Security and privacy, 3).

*Note (informative).* The archives of the examples, as `@openeik/tools` writes them and any writer of rules 1 to 7 does: `examples/one-storey-house` is 17 926 bytes of 33 entries, its SHA-256 `5a69352565cce5b98ff9d35ada92501e8f770a91ef5ac23bf43f59f62350f472`; `examples/l-house` is 110 295 bytes of 192 entries, its SHA-256 `1b8bc2161b9e698cd8a663047db520dd72fe4ad9173951ecf1d2e15c591df95b`. `@openeik/tools` writes an archive (`writeArchive`, `openeik archive <folder | model.json> <out.eik.zip>`), reads one as a folder (`readArchive`) and checks one (`checkArchive`, `openeik check <file.eik.zip>`); its commands that take a folder or a model in one file, `check`, `compile`, `ifc`, `ifcx`, `clash`, `hash`, `read` and `write`, take an archive too, and `openeik write <file.eik.zip> <folder>` writes its folder as rule 13 says (`unpackArchive`). It refuses as rule 11 says, with the codes `archive-invalid`, `archive-path`, `archive-twice`, `archive-fold`, `archive-link`, `archive-too-large` and `archive-ratio`, and reports `archive-entry` and `archive-form` as rule 12 says.

## 12. Reading a folder

A reader:

1. reads `eik.json` and checks the format (Part I, 9.2);
2. walks the folder, skipping hidden names, and sorts each file into a record, an engine file or a kept file (sections 3 and 7);
3. parses each record file, and refuses a file that is not JSON, naming its path;
4. assembles the model: the project, the levels, each list ordered by `project/order.json`, each view joined with its chunks, the kept files;
5. performs the **whole-model check**, where it does (below): validates every record against its schema and the whole model against Parts I and II, and refuses the folder, naming the file and the rule, when any fails; a record of a category it does not know it validates against the common schema only, keeps and warns about (Part I, 10, rule 5).

The whole-model check of rule 5 is required of the validator class, which reports what fails it (Conformance, 1), and a reader SHOULD perform it. A reader that performs the check MUST refuse a folder that fails it. A reader that does not perform the check reads the folder as it is. Every reader MUST refuse what it cannot read, which is what this list names; a reader that does not perform the check need refuse nothing else:

- a folder whose `eik.json` is not JSON, has no `format`, names a version it does not implement or gives `units` other than `"mm"`, or that has no `eik.json` where Part I, 9.2, rule 5 does not let it read it as `openeik/0.1-draft` (Part I, 3, rule 7, and 9.2);
- a project whose `schemaVersion` it does not implement (Part I, 9.3), or that gives `units` other than `"mm"` or an `upAxis` other than `"Z"` (Part I, 3, rule 7);
- a record file that is not JSON (rule 3), or that holds a number that is not finite (Part I, 3, rule 5);
- a record file, `eik.json` or a model in the single-file form that is not valid UTF-8 (section 5, rule 1): no text, which it cannot read;
- two records of one id in a list that Part I, 6, rule 1 names: elements, types, views, levels, grids, sheets or linked references;
- a kept file at a record's path or where a record needs a folder (section 7, rule 4);
- a file it cannot read whole, and a folder, a version or a model past a bound it sets on the number of files, records, a view's chunks or a store's objects, or on the depth of trees (Security and privacy, 7.2, rules 2 and 4);
- from 0.5, an archive that section 11.3, rule 11 refuses, and one past a bound of Security and privacy, 6.5, rule 2;
- from 0.6, and in 0.5 with the proposal `declaredProposals`, a model whose list names a proposal the reader does not implement, unless the reader reads none of what that proposal governs (Part I, 9.12, rules 4 and 12);
- an object or a tree from a store that Security and privacy, 5.3 refuses, among them a version that holds a name that no folder gives, a hidden one or one that starts with `~` and is no shard, or a kept file that a reader of a folder leaves alone or reads as another file (section 7, rules 1, 2, 4 and 8), unless it is asked to repair the version (Security and privacy, 5.3, rule 4).

A reader SHOULD also refuse a model's file that is not I-JSON, with or without the check: an object that repeats a member name, a string with an unpaired surrogate, or a number that expresses more magnitude or precision than a double provides (section 5, rule 6; Security and privacy, 7.3, rule 1).

A reader MUST NOT add, change or drop records while reading, except as Part II says for legacy members (6.4) and as this part says for kept files. It MUST keep members it does not know, and records of categories it does not know (Part I, section 10).

**Types are in the folder.** A conforming folder contains a type record for every type any of its records names. A reader MAY rely on `types/**` alone for types; it MUST NOT need a built-in library to read a conforming folder.

Reference: `modelOfFiles` and `readFolder` in `server/eikSession.ts`; `manifestOfFolder` in `src/core/versions/eikFolder.ts`; `parseImport` in `src/core/model/store.ts`.

*Note (informative).* What this section says of the whole-model check was decided by the steward on 15 October 2026 (open questions, 29). Each refusal of the list is a rule of its own elsewhere in this specification, and binds every reader. The check adds the schemas and the rules of Parts I and II: a reader that performs it refuses a model that fails them as well, and one that does not reads such a folder as it is and leaves the verdict to a validator. A model that fails the check alone, a member in the wrong place, a size that disagrees with its type or a reference that does not resolve, is one that a reader may read or refuse, as it performs the check or not. A validator reports more than the check covers: among it, a single-file model's kept file at a path that section 7, rules 1 and 8 keep from kept files, which a writer refuses to write. No rule has a reader refuse such a model, and a reader may read it as it is, the entry kept, or refuse it as a validator would. The reference reader performs the check, and so do `@openeik/tools`' `readFolder`, `readVersion` and `readModel`, unless told not to (`check: false`).

*Note (informative).* The reference reader goes further than this part allows on two points. It adds its built-in library of types, title blocks and detail families to every model it loads, so it would also read a folder that names a built-in type without containing it. And it migrates older records to the current form. A folder the reference writer writes always contains every type it names. Since Stomra 641 it leaves out the library's types that nothing names (section 13), and puts each back when it reads the folder again, by its id in `project/order.json`, where an id without a record is ignored (section 9, rule 2). The reference implementation's own single-file examples do not all conform: six of its nine `examples/*.stomra.json` name a built-in gutter type (`type-gutter-halfround-125-zinc`) that they do not contain. Exported with `ek export`, all nine conform. See the open questions.

## 13. Writing a folder

A writer:

1. writes every record at its path (section 4) in the stored form (section 5);
2. writes every type that any record names, and SHOULD NOT write library records the model does not use (below);
3. writes `eik.json`, keeping the members of the folder's own that it does not know (section 8.1), and `AGENTS.md` when there is none;
4. removes the file of each record that is no longer in the model, or no longer at that path (a record moved to another level, or read at a name in an older form, section 2, rule 9), and no other file;
5. SHOULD write only the files whose bytes change, so that a version control system sees exactly what changed.

Reference: `writeFolder` in `server/eikSession.ts`; `EikMirror` in `src/core/versions/eikFolder.ts` (writes only records whose content hash changed).

A **library record** is a type, title block, detail family, image or other record that a writer takes from its own built-in library rather than from the model. A writer SHOULD NOT write a library record that no record of the model names. A record the model holds of its own, such as a type made for the project that no element uses yet, is the model's and is written.

*Note (informative).* Rule 2's SHOULD NOT was decided on 11 October 2026. Until Stomra 641 (live since 23 October 2026, `main` `83aa3e13`) the reference writer wrote its whole built-in library (about 250 types, 6 title blocks and a detail family in the version examined) into every folder, so a minimal model exported as about 270 files. It now leaves out a type of its library that is exactly as the library gives it and that nothing in the model names; a type a person made or changed is always written. Since Stomra 685 (live since 25 October 2026, `main` `9bd96356`) it leaves out a title block or a detail family of its library on the same terms; a sheet that names no title block names the generic frame of its paper, which is written. A title block an earlier build gave otherwise, never edited and unused, is still written. The examples in this repository were pruned of library records that nothing names; see `tools/build-example.mjs`.

## 14. Editing by hand

People and agents may edit record files with any tool.

1. Whoever changes a record by hand MUST add 1 to its revision (Part I, section 8).
2. After an edit, a reader that performs the whole-model check (section 12, rule 5) MUST perform it again before it accepts the folder, and MUST refuse a folder that no longer checks, naming the file and the rule. A reader that does not perform the check reads the edited folder as it is, and refuses it only for what section 12 lists. An agent host checks the folder whole after an edit, as Part VII, 6, rule 4 says.
3. A hand edit that sets a size a type sets (Part II, 5.3) makes a folder that fails the whole-model check: a validator reports it, and a reader that performs the check refuses the folder (rule 2).

Reference: `EikSession.sync` in `server/eikSession.ts` (re-reads edited files and checks the whole model; keeps the last good model while an edit is wrong); `typeSetInFiles`.

*Note (informative).* A live engine that keeps a folder open holds a lock file in `.eik/lock` naming its process, so that two engines do not write one folder. The lock is implementation state, not part of the format.

## 15. Weight

*Part of 0.5. OpenEik 0.4 had it as the proposal `weight` (open questions, 138): a model of 0.4, read by 0.4's rules (Part I, 9.6, rule 3), is read by the members it adds only where a caller asks for it (decision D12). The steward asked on 5 November 2026 that the forms which made large models of the reference implementation slow be covered, so that every writer and every agent that draws in OpenEik avoids them; its shape is the editors' (question 126). It changes no rule of validity of 0.4's members: every rule here is a recommendation for a writer, a reader, a host or a caller of commands, and the findings of it that a validator or a command processor gives are warnings, never refusals (sections 15.7 and 15.8), but for what it makes of the members it adds, a detail item's exact arcs (`bulges`, section 15.2, rule 4), which a validator holds to its schema and to its points, and the heavy forms a record keeps on purpose (`weightAccepted`, section 15.7, rule 5), which it holds to its schema. A model that keeps a heavy form is as valid as one that does not. Its members' schemas are in [`schemas/0.5/weight/`](https://gitlab.com/openeik/spec/-/tree/main/schemas/0.5/weight), and [`guides/weight.md`](https://openeik.org/guides/weight.md) gives it as tips for writers and agents.*

A model's **weight** is the bytes its files take and the work a reader, a host and a renderer do to read and draw them. One building can weigh a thousand times more in one model than in another, by how it is said: a hatch as its strokes or as a pattern, a circle as its chords or as a circle, fifty flats as fifty sets of elements or as one group and its copies. The format allows every one of these forms. These rules say which to choose, so that a model stays light for every tool that reads it, and a writer that keeps a heavy form keeps it because it chose to.

### 15.1 Say what a thing is, not its strokes

1. A writer SHOULD write a thing by the item or the member that names it, not by the lines a drawing of it is made of:
   - a hatch, as a `region` with a `pattern`, or, where it is the cut of a material or a layer, by that material's or layer's `pattern` (Part II, 4 and 5.1), which every cut of it draws;
   - insulation, as an `insulation` item: its two ends, its `width` and its `insulationKind`;
   - a full circle or an ellipse, as an item of the kind `circle`: its box;
   - a mark, a fixture or a part drawn more than once, as a `symbol`, a `component` or a detail family's instance (`familyInstance`), and a row of them as one item with `repeat`;
   - a material's courses, boards, tiles or seams in elevation, as the material's `surface`, not as detail lines.
2. A writer SHOULD write a path as one item: segments of one style that meet end to end are one `line` with its `points`, and a filled shape with its outline one item (`filled`), not two.
3. A writer SHOULD NOT write an item that repeats another item of its view exactly, but for its id: drawn twice, it draws nothing more.
4. A converter, which writes a drawing of another format as detail items (a view whose `source` names the file and the page it was converted from), SHOULD do the same of what it converts: join a path's segments into one line, keep a fill with its outline, and write a hatch it recognises by its pattern.

*Note (informative).* Of the reference implementation's large models (its works 371, 375 and 376, and its plan for model versions, of October and November 2026): one plan was 374 MB of markup, 369 MB of it the cut hatch of mineral wool drawn wave by wave along every insulated wall, about 3.3 MB a wall. Its waves were 15 mm apart in a 45 mm layer, 0.3 mm on the paper at 1 : 50, which prints as a grey band; drawn no finer than 1 mm on the paper and written to 0.1 mm, one house's plan went from 11.2 MB, 9.4 MB of it hatch and 240 000 points, to 4.1 MB with 130 000 points. An insulation item draws a strip 5 990 mm long as 90 strokes or 450 curves from its two ends, a width and a ratio. A drafting view converted from a PDF held 11 402 items, 2.6 MB of a 5.4 MB model: each segment of a path an item, each curve cut into 5 to 50 straight steps, a fill and its outline two items. On that example, 249 elements and 21 094 detail items in 30 views, the checks of `@openeik/tools` (section 15.7) find 7 542 like strokes in one view, 970 points where two lines of one style meet end to end, 188 items drawn twice, and 105 676 numbers given to more than three decimals.

### 15.2 Curves stay exact; straight pieces are output's

1. Where the format has an exact form for a curve or a body, a writer SHOULD write it: a `custom` section's rounded corners and `through` entries (Part II, 5.2, rules 8 to 10), a `round` or a `CHS` section, a pipe's circle, an item of the kind `circle`, a detail item's arc by its `bulges` (rule 4), and a declared body of one outline between two heights as a `prism`, a round one as a `cylinder` (Part II, 12.1), not as a `mesh` or a `polyhedron`. The straight pieces and the triangles that draw it are output's: a compiler, a bridge or a renderer MAY draw an arc as straight pieces (Part II, 5.2, rule 10; Part IV, 12.3, rule 5), and a writer SHOULD NOT store them in its place.
2. Where it has none, as for an element's plan points or a terrain's points, and for a detail item whose writer keeps an arc's chords, a writer SHOULD write a curve's chords no finer than what is drawn of it: each chord within 0.1 mm of its arc on the paper at the largest scale its view is drawn at, and, for an element, within 1 mm of it, 0.1 mm on the paper at 1 : 10. An arc of radius `r` through an angle `θ` needs `θ / (2 arccos(1 − t / r))` chords within `t` of it: a circle of radius 1 000 mm, 32 chords at 1 : 50 (`t` = 5 mm), 100 at 1 : 5 and 71 for an element.
3. A writer SHOULD mark a detail line whose points stand for an arc or a circle with `curveKind`, so that a reader knows the curve and need not guess it from the chords.
4. **A detail item's arcs, exact.** A detail item of the kind `line`, `region` or `mask` that gives its `points` MAY give its `bulges`: one number for each point, the bulge of the segment from that point to the next, and for the last point of a region, a mask or a closed line the segment back to the first. A bulge is the tangent of a quarter of the angle the segment's arc turns through, positive where it turns counter-clockwise in the view's own coordinates (u along, v up, Part XIV, 6.2), negative where it turns clockwise, and 0 for a straight segment: 1 is a half circle, and the arc's height over its chord is the bulge times half the chord. Its schema is `schemas/0.5/weight/bulges.schema.json`, each bulge between −100 and 100 (an arc of at most 357.7°).
   1. A writer SHOULD write a detail item's arc so, by the points where it begins and ends and its bulge, not as its chords, and SHOULD write a bulge to nine decimals: within a thousandth of a millimetre of its arc over a chord of a kilometre. A bulge is no length, and section 15.3's three decimals are not its.
   2. `bulges` has as many numbers as `points`, and the last of an open line's is 0, since no segment follows its last point; an item of another kind gives none. A validator reports either as an error (`bulges-points`), and one of a model of 0.4 where it applies the proposal. The item's `a` and `b` are its first and last points as before, and every rule that reads its points, its anchors and what it follows (Part II, 14.4) reads them as before: a rigid move keeps each bulge.
   3. An item whose arcs are its bulges gives no `curveKind`: its points are no chords.
   4. A reader draws a segment whose bulge `b` is not 0, from `p` to `q`, its chord `c` long, as the arc of radius `c (1 + b²) / 4|b|` about the point `(1 − b²) / 4b` chords to the left of the chord's middle, from `p` to `q`, turning as its sign says; a reader of a model of 0.4 that does not apply the proposal draws its chord.
   5. An issuer draws such an item as a `path` whose `d` gives each segment with a bulge as an elliptical arc, `A r r 0 L S x y`: `r` the radius of rule 4.4, `L` 1 where `|b|` > 1 and else 0, and `S` 1 where `b` is positive and else 0, SVG's positive angle in the coordinates the path is given in, the viewport's own, v up; each straight segment as `L`; and `Z` after the segment back to the first point of a region, a mask or a closed line. Part XIV, 6.4 allows `A` in a path's `d`, its numbers to three decimals like every other, and its validator reads it (6.12, rule 26).
   6. `detail.draw`'s `tangentArc` and `fillet` (Part XIV, 17.1.2), which continue an item, keep its bulges on the points they keep, a 0 for each segment they draw; each refuses an item whose segment it draws from is an arc: a tangent arc's last segment, a fillet's corner's two sides.

   *Why bulges (informative).* The editors chose the exact form common practice already writes for such paths, DXF's polyline bulge (group code 42 of an LWPOLYLINE), over SVG's elliptical arc and IFC's arc of three points (`IfcArcIndex`). A bulge is one number for each point, beside `points`, so the points stay the item's own and every rule and tool that reads them reads them as before; it says an arc exactly in one number where SVG's `A` takes five, two of them flags, and can name a radius its ends do not allow, and where an arc of three points adds a point inside each arc; and it is what a CAD file a converter reads already carries, so a converter writes what it reads (rule 15.1.4). The cost is a reader without the proposal, which draws the chords between the points: one of 0.5 draws the arcs.

*Note (informative).* A detail item has an exact form for a full circle and an ellipse, the kind `circle`, and, from 0.5, for an arc: its `bulges` (rule 4). In 0.4, `curveKind` marks a line's points as an arc's chords. The reference implementation's sketch tools write an arc's chords within 2 mm of it by default, and at most 480 of them; the schema allows a line 500 points. Where output has to choose, exact arcs are not always the light form: a common IFC reader cuts every arc of a profile into 24 pieces, and took 61 s to mesh 300 windows of hollow sections drawn with exact arcs, against 9.3 s with four chords a quarter turn (the reference implementation's work 808). That is the bridge's choice (Part VIII, 1.4), which the record does not make for it.

### 15.3 Numbers

1. A writer SHOULD write a length, a coordinate or a line weight that it works out to no more than three decimals of a millimetre: a thousandth of a millimetre says as much of a building and of a drawing as seventeen digits do, in a third of the bytes or less.
2. A writer SHOULD NOT round a number it read and does not change: the record keeps its value and its hash (Part I, 10; section 6).

*Note (informative).* An issued SVG already gives its numbers to at most three decimals of a millimetre of paper (Part XIV, 6.4). In the records of the reference implementation's hatches and converted views, numbers had sixteen and seventeen digits (its work 376).

### 15.4 Repeated parts and types

1. A writer SHOULD write a group of elements that stands, as it is, at more than one place as an original and its copies (Part II, 10), not as the elements of each place: the copies' elements are derived, and never stored.
2. A writer SHOULD place a part that repeats along a line or over an area by the rule or the item that repeats it (a framing family, a layer's `drawing`, a detail item's `repeat`), where the format has one, not as each of its copies.
3. A writer SHOULD write one type for each build-up its elements share, not a type for each element.
4. A writer SHOULD choose for a thing a category and a kind whose body draws what the thing is: a kind that derives detail the thing does not have weighs on every view, print and bridge of the model.
5. A writer SHOULD declare a shape that every element of a type has once, on the type (Part II, 12.1), not on each element.

*Note (informative).* In the reference implementation (its works 389, 423 and 444, and its plan for large projects): a site of 28 houses, four drawn in full, stored 1 948 elements, and 1 271 as an original and copies, 0.52 MB against 0.36 MB with 2.1 kB of copy records; drawn in full, an edit of a pair of houses at 8 places took 0.8 s, at 16 places 2.2 s and at 32 places 6.9 s. A model of 8 041 elements and 6 978 types took 1.6 s for every command, and its summary was 372 000 tokens. Thirty-five storage racks written as a bookshelf, which is drawn with its books, were 159 936 triangles each and 5.6 million in all, where every other kind of furniture is 800 to 7 500.

### 15.5 Issued drawings and prints

1. An issuer SHOULD draw a hatch as a `pattern` in `defs`, which a region fills by `url(#…)`, not stroke by stroke; a shape drawn more than once (a mark, a symbol, a fixture) as one group in `defs` and a `use` at each place; and an arrowhead, a tick or a dot at a line's end as a `marker` (Part XIV, 6.3 to 6.5).
2. An issuer SHOULD draw a circle as a `circle` or an `ellipse`, and an arc as a path's arc (`A`), not as chords: a detail item's bulges as rule 15.2.4.5 says.
3. An issuer SHOULD draw nothing that a viewport does not show (Part XIV, 6.12, rule 26), and no hatch finer than its paper shows: a hatch's strokes or waves at least 1 mm apart on the paper.
4. A picture on a sheet SHOULD hold no more pixels than its paper shows: at most 24 to the millimetre of paper it covers (600 dots an inch). A picture is held in each file that shows it (Part XIV, 6.3), so a title block's logo is paid for on every sheet.

*Note (informative).* An issue of 26 sheets of the reference implementation was 46.8 MB of SVG, the largest sheet 5.2 MB with 36 365 elements, another 4.3 MB of coordinates in 5.0 MB; one picture of a title block, 219 kB, was in every sheet, 5.7 MB of the 46.8 MB (its work 728). Of the plan of 374 MB above, 363 MB lay outside the sheet's crop, drawn and then clipped away (its work 375). The limits of Part XIV, 6.5 (64 MiB, 2 000 000 elements, 1 000 000 from `use`) bound what a reader holds, not what a drawing should weigh.

### 15.6 Readers and hosts

1. A reader SHOULD read what it is asked for: a version's tree first, and of its records those the task needs, fetched by their hashes (Part VI); a host SHOULD NOT send a whole model where a part is asked for (Part VII, 5).
2. A store or a host SHOULD keep a version as its tree, each record once for every version that holds it (Part VI, 2), not as a whole copy of the model for each version. An undo, a redo or an import is a version of the records it changed.
3. A host that lists versions, records or objects SHOULD page the list and say where there are more, and SHOULD NOT stop at a limit without saying so.
4. A host that tells whether an issued drawing is current SHOULD compare its read set with the model (Part XIV, 9.4), not draw the sheet again.
5. A reader SHOULD hold a model's lists, its elements, a view's items and a mesh's triangles in a form that does not fail below the sizes the format allows: a view holds up to 50 000 items, and a building hundreds of thousands of bodies.

*Note (informative).* In the reference implementation (its works 725, 807, 814, 829, 831 and 833, and its plan for model versions): a whole snapshot of 5.5 MB was written where 48 kB had changed (0.9 %); 1 562 snapshots of 133 projects held 2 331 MB, and one project's 44 whole copies, 57 MB, held 1.9 MB of distinct records. A list of versions stopped at 300 without saying so, where one project had 1 075; a database read stopped at 1 000 rows. Telling 36 sheets current by drawing each took 640 s of CPU; with read sets, the check of the drawings in a publish went from 247 s to none. A client fetched the whole model, 15.8 MB, each time a sheet opened. One plan read as data was 3.7 to 8.2 million tokens. A browser failed on a tower of 162 380 bodies spread into one call.

### 15.7 Warnings

1. A validator MAY warn of a form these rules recommend against. A warning of weight never makes a model invalid (Conformance, 2), and SHOULD name the form that says the same and what it saves, so that a person or an agent can change it in one step. It SHOULD warn only where a form is far heavier than the compact one, so that a model written in the compact forms gets none.
2. An agent that writes a model SHOULD check it for weight after it writes (Part VII, 6), and change a heavy form it wrote to the compact one the warning names.
3. A writer MAY keep a heavy form on purpose: a survey's points, a scanned or converted drawing's strokes, elements that are to change apart. A validator that warns of weight SHOULD let it say so once, everywhere or under a path, after which it does not warn of it. An agent SHOULD NOT change a heavy form it did not write on a warning alone: it puts it to its person.

4. A warning of weight that a validator or a command processor gives SHOULD carry one of the codes below for the form it names, with the rule of this section as its `rule`. A form these codes do not name, or a finding of one application's own, carries that application's prefix (Part I, 11.1; Part XVII, 10.1), as `acme:copied-geometry`.

5. **Kept in the model.** A writer MAY say in the model that a record keeps a heavy form on purpose, so that every tool that reads it knows, where `accept` (rule 3) is one check's: an element, a type or a detail item MAY give `weightAccepted`, a list of 1 to 20 entries `{code, reason, by?, at?}`, held to `schemas/0.5/weight/accepted.schema.json`:
   - `code`, the code of the warning of weight it keeps, one of the thirteen below or an application's own under its registered prefix (Part I, 11.1), as `acme:copied-geometry`;
   - `reason`, why, for people, 1 to 200 characters: a survey's points, a drawing kept as it was traced, elements that are to change apart;
   - `by`, who keeps it, as a detail item's provenance says who made it (Part XIV, 3.2): `{person}`, a person by their id, or `{agent: {name, version}, actingFor}`, an agent and the person it acts for; and `at`, when, in UTC (Part XIV, 7.2).

   A record that keeps a code keeps the heavy form of that code it is part of: a set of like strokes, a path cut into segments, an item and the one it repeats, an item's points on a circle, an item's numbers, a group that stands again, a declared body, a set of elements of one shape on their type, a set of types that are one. It is said once, on any one of the form's records. A validator that warns of weight SHOULD NOT warn of a form one of whose records keeps its code, and warns of the others of its view or its model as before; a command processor SHOULD NOT give an advisory of a code on a record that keeps it (15.8). An agent SHOULD NOT write `weightAccepted` for a heavy form it did not write but on its person's word (rule 3), and SHOULD say whom it acts for. A validator holds the member to its schema, and one of a model of 0.4 where it applies the proposal; a check of weight honours it, of any version, as `accept`.

**The codes.** The codes of weight, each with the rule it names, what it finds, and the compact form it names. A validator gives the first eleven, of a folder or a model; a command processor the last two, of a session (section 15.8). The thresholds are `@openeik/tools`' (its README), which finds none of them on the examples of this repository or in the conformance suite. An application whose own copy command writes a group's copies out as elements, so that what it saves is commands rather than stored records, gives the same finding under `weight-copies`, its `compact` naming its own command.

| Code | Rule | Finds | The compact form |
|---|---|---|---|
| `weight-hatch-strokes` | 15.1.1 | 100 or more strokes of a view, parallel and of one length | a `region` with a `pattern`; a material's or a layer's `pattern`; an `insulation` item |
| `weight-split-path` | 15.1.2 | 200 or more points of a view where two lines of one style meet end to end | one `line` for each path, with its `points` |
| `weight-duplicate-items` | 15.1.3 | 10 or more items of a view that repeat another exactly, but for their ids | each item once (`detail.remove` of the others) |
| `weight-arc-points` | 15.2.2 | 64 or more points of one item on one circle: a full circle, or an arc whose chords are four times finer than its paper | an item of the kind `circle`; the arc exact, its ends and its `bulges` (15.2.4) |
| `weight-mesh-prism` | 15.2.1 | 10 or more declared bodies, meshes or polyhedra, of one outline between two heights | a `prism` |
| `weight-precision` | 15.3.1 | 1 000 or more numbers of a view's items to more than three decimals | three decimals |
| `weight-copies` | 15.4.1 | a group of elements that stands again as it is at 3 places or more, each at one offset (in plan, on its level or onto another), its records 24 or more in all (places × elements), of any number of kinds | an original and a copy at each other place (`original.make`, `copy.place`) |
| `weight-shared-shape` | 15.4.5 | 10 or more elements of one type that carry the same declared geometry of their own | the shape declared once on the type |
| `weight-same-types` | 15.4.3 | 20 or more types that are another type again, but for their ids and names | one type for each build-up |
| `weight-svg-path` | 15.5.1 | an issued SVG path of 20 000 or more segments | a `pattern`, a `use`, arcs (`A`) |
| `weight-svg-hatch` | 15.5.1 | 500 or more like strokes of an issued SVG, outside its patterns | one `pattern` in `defs`, filled `url(#…)` |
| `weight-rebuild` | 15.8.1 | in one session, a record deleted and one nearly the same created again | an `update` of the record in place |
| `weight-full-replace` | 15.8.2 | a command that sends a whole set, a record, a list or a chunk's items, to change a few of it | a patch of what changes (Part V, 4) |

`@openeik/tools` gives the first eleven with `openeik check --quality` (`quality: true`), and `--accept <code>[:<path>]` (`accept`) keeps a heavy form on purpose (rule 3), as a record's `weightAccepted` does (rule 5); its detectors are pure functions of records an application can call, `weightOfDetails`, `weightOfElements` and `weightOfSvg`, each finding with the compact form ready to write.

*Note (informative).* The steward's principle, of 5 November 2026: "Formatet ska såklart tillåta att man gör en batting hatch med en miljon små linjer men det är ju i 99% av fallen ett resulat av ett felbeslut från en agent" (the format should of course allow a batting hatch of a million small lines, but in 99 % of cases it is the result of a wrong decision by an agent). So section 15 adds no limit, no refusal and no error: it says which form to choose, and a validator or a command processor says where a model or a command chose otherwise.

### 15.8 Commands

1. A caller SHOULD change a record in place, by an `update` (Part V, 2.1), not delete it and create one nearly the same: the record keeps its id, its revision's history and what names it, and a diff and a merge see one change, not two.
2. A caller SHOULD send a patch of what changes (Part V, 4), not a whole record, a whole list or every item of a chunk to change a few of them: a command that resends a whole set writes it whole, and its answer, its log and every version's diff carry it.
3. A command processor MAY answer a command or a session that does either with an advisory in its answer's `warnings` (Part V, 9), `weight-rebuild` or `weight-full-replace`, naming the records and the command that would do the same in place. An advisory never refuses a command: the command is accepted as it would be without it. A processor that gives them:
   1. **Judges against the state before the write**, not the command alone: it compares what a command sends with the record as it was before the command. A member or an item resent as the record holds it is unchanged, and a command that changes none of what it resends, as one that repeats what the processor itself wrote earlier, is no full replace. What the processor writes itself on every write, a record's revision and an agent's detail item's provenance (Part XIV, 3.2), is not counted as sent.
   2. **`weight-rebuild`.** Gives it where a record that a `delete` or a `detail.remove` took earlier in the batch or the session, as it was before, is made again nearly the same by a `create` or a `detail.place`: of the same list, and for an item of the same view; of the same category or kind; and of their other members but the id, the revision, the name and the provenance, three quarters or more alike. The compact form is the `update` or the `detail.update` of the record deleted, at its revision as read, whose patch makes it the one made.
   3. **`weight-full-replace`.** Gives it where an `update` or a `detail.update` sends 6 members or more, three quarters or more of the record's, and changes one of them or more and a quarter of them at most; or where a `view.upsert` of a view that stands sends 20 items or more and changes, adds or removes one of them or more and a quarter of them at most. The compact form is the patch of what changes; for a view, the `detail.update`, `detail.place` and `detail.remove` of the items that change (Part XIV, 17.1 and 17.1.1), where the view's own members do not change. A kind that writes its record whole by definition, as `type.upsert`, `material.upsert` and `level.upsert`, has nothing lighter to send, and gets none.
   4. **Never suggests grouping records that are distinct model elements.** It pairs a record made with one deleted, one to one, and never with one that stands; and no advisory or weight line names an original and its copies: whether elements are a group is a whole model's check (`weight-copies`, 15.7).
   5. **Advises once per code per record in a session, and counts the repeats.** An advisory is about one record or one view, its target (`elements/<id>`, `views/<id>`, `views/<id>/details/<item>`), and comes once for each code and target in a session; each time it comes again, the processor counts it and says nothing in `warnings`. A session is what the caller keeps between batches and gives again, or the batch where it keeps none; it takes only a batch applied.
   6. **Says it in full.** The warning carries its code and rule, what the command did, the command or the batch that does the same lighter, ready to run, where there is one, what that saves, and the guide's topic, `guides/weight.md`, *Commands*; the answer's weight line carries the same as data (Part V, 9.1).
   7. Gives no advisory of a code on a record that keeps it (15.7, rule 5).

   The thresholds are `@openeik/tools`' (`WEIGHT_LIMITS`: `replaceMembers`, `replaceItems`, `replaceShare`, `rebuildShare`).
4. A command processor MAY give an accepted batch its running weight line, the answer's `weight` (Part V, 9.1): the records it wrote by kind, and the heavy forms the checks of section 15.7 find in what it wrote, each with its compact form, so that a caller sees what a batch weighs as it writes, and not only when a model is checked.

*Note (informative).* In the reference implementation, an undo, a redo and an import each wrote a whole snapshot of the model, 5.5 MB where 48 kB had changed (section 15.6's note): a whole set written where a part changed. Rules 3.1 and 3.4 are what its own advisories taught: judged by the patch alone, a resend of the members the processor had written itself read as a full replace; and a suggestion to make elements an agent had written apart into a group was wrong more often than right. `@openeik/tools`' command processor gives both advisories and the weight line for a model of 0.5, and for one of 0.4 with the proposal (`applyCommands(model, commands, {proposals: ["weight"], session})`, the session as `weightSession()` makes it).
