# AIM Entries Grammar (Normative Reference)

Normative specification for AIM v8.0 `kind: entries` files — structured collections of Record rows written in AIM with line-level provenance, AI proposal marks, multi-language texts, file fingerprints, and in-text anchors. Load this module when reading, authoring, or validating `.entries.aim` files. Core summary lives in `specification.md` (§6).

A Record defines a shape. An Entries file holds rows of that shape, written in AIM: the entries of a diary and the people it names, a meeting with its decisions and actions, the accounts of a historical event. A person writes an entry and its links by hand, and a tool validates and follows the same source.

An entry keeps two things apart. A text holds its author's words as they were written. What is recorded about those words is separate: who the entry mentions, what it follows up on, which two accounts differ. Each of these is a line of its own, and each line can say where it comes from.

A diary is a history with one witness and a catalogue of sources a history with many. An assistant that helps with either is one more witness, and its lines never pass for someone else's.

| Form | Holds | In a diary |
|---|---|---|
| `### Rows` on a Record (§4.1) | A fixed membership and the values the model commits to | The moods the diary offers |
| An Entries file | Editable rows of a Record, with text, values and typed links | Today's entry mentions Anna and follows up on an earlier one |
| Knowledge (§4.11) | A collection that work consults or that is read as background | The weekly reflection consults the journal and cites the entries it used |

§2 shows a diary and a meeting as whole files.

### The file

An Entries file has the frontmatter and the H1 of every source file (§16). Its `aim` names an existing intent and its `kind` is `entries`. There are two kinds of Entries file.

| File | Frontmatter | Holds |
|---|---|---|
| A list | `record`, the full address of a Record | Rows of that one Record: the people of a diary |
| A document | `subject`, the row address of one entry | That entry and the entries that belong to it, so that the file reads like the thing itself: one meeting with its decisions and actions |

- **The header.** A header that names both `record` and `subject`, or neither, is a data validation error. A header whose Record or subject does not resolve is a data validation error. A `key` line in the frontmatter is a data validation error, since the key is declared in the Schema.
- **One collection, many files.** A Record's collection is its list, if it has one, together with its entries in every document. A Record has at most one list. IDs are unique across the list and all the documents. A Record has Entries when it has a list or appears in a document. A list with only frontmatter and H1 declares an empty collection.
- **Belonging.** An entry belongs to a document when one of its reference fields, a `ref(...)` or a reference list, names the subject itself. The subject's own entry belongs by being the subject. A link to another entry of the file is not enough, so a nested entry names the subject too. Rows that reference a case's record belong to that case in the same way (§4.4).
- **What a document holds.** An entry that does not belong to its document is a data validation error. A document without its subject's entry is a data validation error.
- **A document need not be complete.** An action agreed later names the meeting from wherever it is written, and the context of the meeting finds it there (§10).
- **Addresses do not change.** A row address names the Record and the ID and never the file (§8). Moving an entry from a list into a document, or back, changes no address and breaks no link.

The names of the files are in §17.

### An entry

```markdown
## DiaryEntry: 2026-11-28

- date: 2026-11-28
- mood: [Calm](aim:diary#Record:Mood[calm])
- mentions:
  - [Anna](aim:diary#Record:Person[Anna]) — from: proposed by Claude, 2026-11-28
- followsUpOn: [21 November](aim:diary#Record:DiaryEntry[2026-11-21]) — from: proposed by Claude, 2026-11-28

### Text: body

Anna and I walked by the river. We decided to take the train.
```

- **Heading.** `## <Record>: <ID>` introduces a row of that Record of the file's own intent. A row of a Record that another intent owns is headed by the full Record address, as in `## company#Record:Action: 2026-11-28-a1`. In the list of an intent with its own top-level Schema the heading is `## Entry: <ID>`.
- **ID.** The ID is the value of the Record's key (§3), which for a Record with Entries is a `string`. IDs are case-sensitive and match `[A-Za-z0-9][A-Za-z0-9_-]*`.
- **Values.** A bullet `- <field>: <value>` assigns a Schema field other than the key, in the literal grammar of stated rows (§4.2). A field occurs once.
- **Text.** `### Text: <field>` supplies a `string` field as Markdown. The text runs from the first nonblank line below the heading to the next H2 or H3 outside a fence, or to the end of the file. Blank lines at its boundaries are trimmed. Headings inside a text are H4 or deeper. A field is given either as a value or as a text.
- **Links.** A `ref(...)` field whose target is the target Record's key is always written as a link, `- <field>: [<label>](aim:<row address>)`.
  - A reference list, `list(<intent>#<Record>)`, holds one nested bullet per link, in list order. `- <field>: []` is an empty list.
  - A reference to a field that is not the key is written as a literal of that field.
  - The field supplies the kind of relationship, such as `mentions` or `followsUpOn`. The label is display text.
  - A link resolves to an entry, or to a stated row whatever the type of its key (§8, §9). The target's Record and key field match the field's `ref(...)`.
  - Only links in such fields declare a relationship. Markdown links inside a text are kept and mean nothing to the graph. An Entries file is never searched for edge tokens.
- **Model links.** A `modelref(...)` field (§3) is written the same way with a model address: `- explainsOperation: [List shifts for a date](aim:scheduling#Operation:ListShiftsForDate)`.
- **Files.** A `file` field holds a `/`-separated path relative to the project root, the directory of `AGENTS.md`, as in `- document: files/exhibits/contract-2024.pdf`.
  - The file itself stays outside `.aim`, as supplied material does (§7).
  - Where the Record declares a `fingerprint(...)` field for it (§3), a tool writes the fingerprint, `- fingerprint: sha256:9f2c…e41a`.
  - A file that is missing, or whose content no longer fits its fingerprint, is a data validation error: this is "words kept as written", applied to a file.
  - The entry carries the meaning, which is who handed the file in, when, and what it shows.
  - A new version of a file is a new entry that replaces the earlier one (§4.2).
- **Not in this version.** Parts, maps and lists of scalars have no source form in an entry.

### Who said each line

A line with no mark is the author's own. A line MAY end with one origin trailer, the trailer a requirement uses for its source (§3).

| Trailer | Says |
|---|---|
| `— from: proposed by <name>, <date>` | An assistant or a tool added the line on its own, under the name it goes by, on that day, and nobody has confirmed it. The bare `— from: proposed` says only that the line is a suggestion; it is for a mark that someone sets by hand. |
| `— from: <who>, <date>, proposed by <name>, <date>` | A suggestion that was confirmed: who confirmed it and when, and still who proposed it and when. A bare mark that is confirmed becomes `— from: <who>, <date>, proposed`. |
| `— from: <words>` | Who said it and when, for a line the author took from someone else. |
| `— from [<address>]` | What the line is drawn from: a row, such as a source entry, or a Knowledge facet. |

- **Waiting or confirmed.** A trailer that begins with `proposed` is a suggestion that waits. Any other trailer is confirmed, or is the author's own account of where the line comes from.
- **The form of a trailer.** A trailer that is neither `from: <words>` nor `from [<address>]` is a data validation error. A second trailer on one line is a data validation error. A `from [<address>]` that resolves to neither a row nor a Knowledge facet is a data validation error. A mark that begins with `proposed` and has neither of the two forms in the first row of the table, `proposed by <name>, <date>` or the bare `proposed`, is a data validation error.
- **Where a trailer stands.** The trailer may end any of these, and the nearest mark applies:
  - a field bullet;
  - each nested link of a reference list;
  - a `### Text: <field>` heading, for a text the author did not write;
  - an entry heading, where it covers every line of that entry that has no trailer of its own.
- **Whole files.** A whole file that an assistant compiled carries `provenance: inferred` (§15). A whole document is approved as any AIM file is, through `owner`, `status`, `approved_by` and `approved_at` (§16).
- **Tools mark what they add.** An assistant or a tool that writes into a collection for its author marks every line it adds on its own, with the name it goes by and the day. It never removes a mark and never changes a line it did not write. This cannot be read off a file, because an unmarked line looks like the author's. It is a rule of conduct and is verified as a procedure is (§12).
- **The collection's rules say who confirms.** A board's rules say an action is accepted by the person who gets it, and a law firm's that a citation is confirmed by the lawyer who signs. In a diary it is the diarist. Confirming rewrites the trailer as the table shows and changes nothing else in the entry. Rejecting a line removes the line. Where the rule has to be enforced, confirming is an Operation with Authz (§4.3).
- **Marks are checked and kept.** A proposed line is validated like any other: its type fits and its target exists. Reading and writing a file preserves every trailer.
- **Marks travel.** A relationship, a backlink or a context (§10) derived from a marked line carries the mark. A reader of "which entries mention Anna" sees which mentions are proposed.
- **Confirmed lines only.** A query, a skill or a derived context can leave out proposed lines, or everything one assistant proposed. Whether proposed lines count for a piece of work is a rule of the collection's owner, stated in Requirements.
- **Origin, source and standing are three things.**
  - *Origin.* The trailer says who put a line into the collection.
  - *Source.* A field such as `source` says where a claim comes from, and other entries can link to it.
  - *Standing.* How settled a claim is — alleged, admitted, found, or suspected, confirmed, ruled out — is an ordinary enum field in the owner's own words. A State (§4.8) says which step may follow which where operations take them. The trailer is never used for it, and an answer says the standing: "suspected, not confirmed".

### Languages

A text heading MAY name the language of the text in brackets, with a BCP 47 code. A second text block for the same field in another language is a translation.

```markdown
### Text: body (de)

Anna und ich sind am Fluss spazieren gegangen.

### Text: body (en) — from: proposed by Claude, 2026-11-28

Anna and I walked by the river.
```

- **The original.** A field has one original text, the first block written for it. It stays as written and is the value of the field.
- **A translation.** A translation is a reading: it names its language, carries its origin like any line, and never replaces the original. An answer cites the original and may show a translation beside it.
- **One text per language.** Two texts of one field in one language are a data validation error.
- **Without a language.** Without a language a field has one text block: several texts of one field where one names no language are a data validation error. Short values such as a name carry no language.

### Pointing inside a target

A link points at an entry or a file as a whole unless it says where inside.

| The target | How a link points inside |
|---|---|
| A text that can be edited | At a named anchor in the text |
| A text that cannot change, which is a field under `### Immutable`, or a file with a fingerprint | At quoted words, a page or a time, checked once when the link is written |

An anchor is `{#<name>}` at the end of a passage, with a name in the ID syntax. A link names it after its address.

```markdown
### Text: body

We talked about the trip for an hour.
We decided to take the train. {#train}
```

```markdown
- basis: [Note of 28 November](aim:trip#Record:Note[2026-11-28]) at #train
- shown: [Contract](aim:case#Record:Exhibit[contract-2024]) at page 4
- said: [Diary, 28 November](aim:diary#Record:DiaryEntry[2026-11-28]) at "We decided to take the train"
- heard: [Recording](aim:board#Record:Recording[2026-11-28]) at 12:40
```

- **The reader of a text sees the anchor.** Whoever is about to edit the passage knows that something may point at it.
- **Editing the words breaks nothing.** The link holds as long as the anchor is there. Only the removal of an anchor that a link names is reported, which is the check made whenever a target disappears.
- **No edit of a text causes a check of the links into it.** Where a text can change, a link points at an anchor. Where a link points at words, a page or a time, the target cannot change.
- **The author places the anchor.** An assistant may suggest one, marked like any suggestion. Nobody adds an anchor to a text that never changes, to a file, or to a text in another model.
- **What is checked.**
  - An anchor's name is unique within its entry.
  - Quoted words are checked to be there exactly as written. They are looked for in the target entry's texts or in its file.
  - A page or a time applies to the target entry's file. A page and a time are checked when a tool can read that kind of file and are otherwise *not checkable*, never wrong.
  - Lines are not addressed, because one added line would shift them.

### Authority and keeping

- **The source form.** The Entries form is the authoritative source form of its Record's rows: the collection holds what that form says.
- **Where it is kept.** Where the collection is kept is realization (§1). It may be a file in the repository, a database or a document store, provided the realization reads and writes the Entries form without loss and there is one writable authority. A search index, a cache or a table used for queries is derived from it.
- **Giving or taking the form.** Giving an existing Record an Entries form, or taking it away, transfers its rows and preserves their references.
- **Writing by hand.** People with write access may edit the file directly. A personal collection needs no operation, because writing an entry is writing.
- **An application for many users.** An application that keeps a collection for many users declares its writes through the Record's `mutates` operations. A file-editing path it offers has the same authorization and data obligations as its other writes. Its rows can be scoped to a person with `owner` (§3).
- **Data or model.** Adding an entry, editing its text or changing a link changes the recorded data. Editing the Schema, the requirements or the stated rows changes the model.
- **Nothing is hidden.** Nothing in an AIM file is hidden. The file is plain text, and whoever has it reads all of it. Who may read a collection is therefore decided by who is given which files, and what is private is kept in an area of its own that is not handed over.
- **Rules about reading.** A rule about reading is an ordinary requirement, kept by whoever serves the entries. A reader that holds only part of a collection answers "not in what I have" and never "no" (§4.2).

### Validation

- **Stored data.** The whole resolved collection and its links are validated as stored data (§3, §4.2): presence, types, uniqueness, `check` lines, periods and replacing.
- **Defaults.** A new row has its Schema defaults written.
- **Nothing is lost.** Reading and writing a file preserves keys, text, values, link labels, list order, trailers and anchors.
- **One change is one check.** One change, an editor's or a tool's, is checked as a whole, inbound links included.
- **Renaming and moving.** A renamed key or a moved Record updates every address and link in the same change (§14).
- **Deleting.** A row is not deleted while a link names it, unless the same change removes or repoints that link.
