# Personal Grimoire

> **Read the paper:** [Personal Grimoire — The File Is the Grammar](paper/Personal-Grimoire-The-File-Is-the-Grammar.md) — provenance-preserving question answering over a personal corpus, without a language model. Working draft.

<img src="Grimoire-card.jpg" alt="A tooled leather grimoire with a brass clasp and an eye set in its cover." width="360">

A one-page web app: **a corpus of your own words that answers in them.** You type sentences,
or feed in whole `.md` and `.txt` files, and the page breaks them into *percepts* — nounish
**things** and verbish **vectors** — one forms beliefs about the things, reasons along the
vectors, and answers questions the way a primitive Q/A system or an LLM chat would. The
difference is that it only knows what you've told it. 

 It replies 4 ways:
 - **what you said**
 - **what follows from what you said** (with the chain shown)
 -  **that you have said both**
 - **what no longer holds** (with what you said since)

Static files, no build step, no dependencies. One TTDB file is the foundation, the
blueprint and the data; one HTML page runs it.

This folder is the corollary of [global_models](../global_models/) — the same corpus
discipline pointed inward instead of at the Earth. See [Corollaries](#corollaries).

The page opens on this file. [`@LAT95LON0`](lat95lon0) is a record that shows `README.md`
itself rather than a copy of it, rendered by the same renderer every record body uses — so
every record token below is a live link into the store when you read it there, and a plain
coordinate when you read it here.

---

## Run it

```bash
python -m http.server        # then open http://localhost:8000/
```

Opened straight from `file://`, the page cannot fetch its store and says so — and offers an
**Open a TTDB store…** button instead, so it still works with no server at all.

The page keeps your store in the browser (`localStorage`) after every change. **Download
store** gives you the whole file back, corpus included; **Open store…** loads any store;
**Reset to seed** throws your copy away; **Start empty** keeps the grammar and deletes every
episode and term, which is how you make the corpus your own.

---

## What is in here

| File | What it is |
|---|---|
| [index.html](index.html) | The app: a TTDB parser and round-trip writer, a rule interpreter, a consolidator, a reasoner, a small sphere. **No words of any language.** |
| [personal_grimoire_ttdb.md](personal_grimoire_ttdb.md) | The store. The blueprint, an English grammar and a Spanish one, every reply phrase, every constant, and the corpus. |
| [RFCs/](RFCs/) | The specs, five of them new. Start at [RFCs/INDEX.md](RFCs/INDEX.md). |
| [tests/](tests/) | Three Node scripts, a DOM stub and a Spanish grammar fixture. No dependencies, no test runner. |
| [tools/](tools/) | Command-line access to the same engine: ask, feed, re-consolidate, re-read and take re-readings, and run a bAbI task. |
| [paper/](paper/) | A working draft of the paper, [Personal Grimoire — The File Is the Grammar](paper/Personal-Grimoire-The-File-Is-the-Grammar.md), and the recorded bAbI results it cites. |

---

## Tests

```bash
node tests/app.test.mjs      # the engine, headless, against the real store
node tests/docs.test.mjs     # the docs against the store and the engine
node tests/embed.test.mjs    # the page as a host that embeds the engine sees it
```

All three load `index.html`'s real script — the page only boots its UI when a DOM exists — so
they exercise the shipping code. `embed.test.mjs` goes further and runs it the way a host
does: a classic script in a context of its own, with the boot gate shut, against the smallest
DOM the page will accept (`tests/dom.mjs`, a stub with no dependencies like everything else
here). It calls what a host calls — `load`, `after`, `select`, `renderTerms`, `preview`,
`draw`, `send` — first with the page's own markup, then with each chrome element missing in
turn, then with every one of them missing at once, and asserts that nothing throws: a surface
the host leaves out costs that surface and nothing else. It also holds the list of ids in
[Blueprint 9](lat85lon0) to the ones the code actually reaches, so the two cannot drift. Between them they check that the store round-trips byte for
byte and that a sync with nothing new rewrites nothing; that every stored belief recomputes
from its episodes; fifteen parses, from *Cats are mammals* to *Cats chase mice but they don't
eat grass*; fourteen questions and their verdicts; that the penguin answer names *bird* as the
ancestor it overrules and quotes the owner's own sentence; that a new statement lands at
`@LAT90LON9`, that its terms land in the right hemispheres beside the terms that introduced
them, and that the tail of the file survives the write; that saying the opposite of a belief
is reported at once and leaves the belief contested rather than overwritten; that *Start
empty* keeps exactly the kit, and that the fixture it keeps is never searchable as your words;
that a later place retires an earlier one in the order things were said, whatever clock the
host passed in, while a later denial of the same place stays a contradiction; and that the
store's description of the runtime's surface names exactly what the runtime exports. They
check the shapes too: fifteen readings, from *Pixel chases mice that eat cheese* to *Swim.*;
that every reading, in either language, reads back as itself; that marks overrule the parser
and a join makes one term; that *Coffee.* is a mention and *coffee* a look-up; that a
relative clause closes at the next verb, whether its antecedent is its subject or its object,
and a stance clause inside one closes with it, while a bare verb goes on with the relative's
chain when the sentence's own verb is still to come or cannot agree with it, and a verb
straight after a relative's own is the sentence's; that where two readings are both
grammatical both are held, each named, so a question sees one saying the owner can settle
with a choice; that a chain verb is learned from your own sentences, and a held saying
teaches what a verb takes; that an unlisted *-ly* word before a verb is an adverb and a
Spanish verb in the speaker's own form needs no subject; that a phrase's head sits where each
language puts it, and Spanish *a* marks an object except after a verb of motion; that what
*or* joins, a stance verb or noun takes or a relative word reports is held — seen, never
believed, never a contradiction, keeping its own *not* — unless the *or* is denied, and that
an aside turns a hedge into a plain saying; that an amendment stands in for a sentence
without touching its episode, and is withdrawn by reading the sentence back the episode's
way; and that a re-reading reports what a grammar edit changes, in the context the sentences
before it stand as, writes nothing, and can be taken as an amendment that names the grammar —
one sentence, or all of them in order, each read again after the ones before it.

And they check the claim the whole design rests on, three ways:

1. **Delete the grammar records** and the runtime sees only word order — *Cats are mammals*
   comes out as `cats | are | mammals`, with no copula, no plural and no class — and the
   librarian has no words at all.
2. **Swap in another language.** [tests/fixtures/es_ttdb.md](tests/fixtures/es_ttdb.md) is a
   small Spanish grammar on the same runtime. *Los gatos son mamíferos. Los gatos cazan
   ratones. Yo no como queso.* parses to `gato | es_un | mamífero`, `gato | cazar | ratón`,
   `yo | comer | queso | -`, and *¿Los gatos cazan ratones?* is answered *Sí.* The seed
   store goes further and keeps both: every English parse case still reads as English beside
   its Spanish grammar, and merging the two into one lexicon instead is shown to break three.
3. **Grep for leaks.** None of the 800-odd words the two grammars list appears as a string literal
   in `index.html`, no reply phrase is copied into it, and every number the store declares is
   named in it.

The first version of that third check failed on five words, and three of them were real:
`on` was a CSS class, `change` a DOM event name, and a comment quoted `ok`. Two were the
grammar colliding with the file format — `kind` and `said` are block keys as well as English
words — and block keys are schema, so the check exempts them by name. It caught three more
while shapes were built, all real: `none` as the name of a predicate with no vector, and
`am` and `keep` as a class and an action name in the reading controls.

`node tests/*.test.mjs` exits non-zero on failure.

`node tools/babi.mjs <task file>` runs a bAbI task (Weston et al., 2015; data not included)
through the same engine, with any adaptation as declared lines of grammar data, a
letter-permuted copy of grammar and data, and a control. The outcomes are unchanged, question
for question, since the parser learned shapes. Task 1, *single supporting fact*:
100% of 1,000 answers right with exactly the gold sentences quoted, from four lines of data;
54.9% with the `exclusive` flag removed. Task 15, *basic deduction*: 100% from one line. The
permuted runs match question by question. Results are in [paper/](paper/).

---

## The one design decision

### The file is the grammar

`index.html` knows how to split text, look a token up in a class, strip a suffix, walk a
typed edge and fill a `{slot}`. It does not know that *the* is a determiner, that *mice* is
the plural of *mouse*, that *is a* is transitive, or how to say *yes*. All of that is in the
store, south of the origin on the prime meridian:

| Record | Kind | Holds |
|---|---|---|
| [`@LAT-10LON0`](lat-10lon0) | `lexicon` | closed-class words, contractions, sentence punctuation |
| [`@LAT-20LON0`](lat-20lon0) | `morphology` | irregular forms, plural and verb suffix rules |
| [`@LAT-30LON0`](lat-30lon0) | `seed` | common verbs, a head start for finding predicates |
| [`@LAT-40LON0`](lat-40lon0) | `vectors` | structural roles, vector algebra, naming phrases |
| [`@LAT-50LON0`](lat-50lon0) | `questions` | the words that open each kind of question |
| [`@LAT-60LON0`](lat-60lon0) | `responses` | every phrase the librarian can say |
| [`@LAT-70LON0`](lat-70lon0) | `numbers` | every constant |
| [`@LAT-80LON0`](lat-80lon0) | `rules` | what follows from what, beyond the vector flags |

Spanish has the same records on the antimeridian, [`@LAT-10LON180`](lat-10lon180) to
[`@LAT-60LON180`](lat-60lon180), each marked `lang: es`. It borrows the numbers and the vector
algebra and supplies everything else.

That is *the file IS the model, the runtime is a generic interpreter* from global_models,
taken as literally for language as global_models took it for climate — and falsifiable the
same way. The runtime refers to grammar only by schema keys (`cop`, `class_of`,
`label_said`), the way global_models' app refers to `shift_deg_per_c` and never to 2.0.

### Corollaries

| global_models | personal_grimoire |
|---|---|
| The Earth as its instruments know it | A person as their words know them |
| `index.html` holds no climate number | `index.html` holds no word |
| A rendering is a pure function plus a `ttdb-render` block | A rule is a function kind plus a `ttdb-grammar` block |
| A measurement and a model output are never printed alike | **What you said and what follows from it are never printed alike** |
| A computed value declares its method and what re-runs it | A belief is derived and `node tools/consolidate.mjs` re-derives it |
| An undated collapse is drawn as its two ends, and no mean | A contradiction is quoted as both sayings, and no verdict |
| A planned layer names its blocker instead of being drawn | A word with no purchase is named instead of guessed |
| EPS decides the roadmap | EPS decides what the librarian asks you about |
| Latitude is real, so lanes need a `lane:` field | The sphere is a knowledge map, so lanes are latitudes again |
| Beliefs sit beside their subjects | Beliefs sit *inside* their subjects, as `belief:` lines |
| Bouvet Island holds the fixture | [`@LAT99LON1`](lat99lon1) holds the fixture — with three malformed percepts |
| The South Pole switches discovery off | The South Pole declares a kind no viewer knows, so discovery stays on |

---

## The grammar sphere

The origin [`@LAT0LON0`](lat0lon0) is **you** — the record your *I*, *me* and *my* resolve to.
The prime meridian is **the grammar**: nine blueprint records north of you, eight grammar
records south. **Things sit east, vectors west**, because the rule that decides which side a
word falls on belongs on the line between the sides. The antimeridian is the other line between
them, and holds **a second language**.

### Two languages

Each sentence is read by whichever grammar recognises more of its words, and a question is
answered in its own language. The languages share their structural vectors, so *es un* and
*is a* are one edge:

```
> ¿Es Pixel un animal?
Probablemente — se sigue de lo que dijiste.
  [inferido, no dicho] pixel es un cat → cat es un mammal → mammal es un animal
    — “Pixel is a cat.” “Cats are mammals.” “Mammals are animals.”
```

Content words are not translated: `gato` and `cat` are two terms until you say *Un gato es un
cat.* After that, anything said about cats in English is inherited by `gato` in Spanish.
What doesn't cross yet is at [`@LAT98LON7`](#roadmap).

A question whose subject stands behind its verb is read by agreement. English never has to
choose — *what do cats chase* puts an auxiliary in the way, and *what chases mice* has none —
but Spanish has no such auxiliary, so *¿qué cazan los gatos?* and *¿qué caza ratones?* differ
only in the thing behind the verb. The object mark rules that thing out as the subject when it
carries one (*¿qué persigue a los ratones?*), and otherwise the verb agrees with its subject
in number, so a thing that does not agree cannot be it. Both come from the store — the
lexicon's `object_mark` and the morphology's `plural_verb_ending` — and a grammar that
declares no plural verb ending is saying its subject does not stand behind its verb.

A new term sits **beside the term that first gave it meaning**: *Pixel is a cat* puts
`pixel` a degree or two from `cat`, so the sphere clusters by meaning in the order meaning
arrived. With no partner a term hashes into its hemisphere. IDs never move (TTDB-RFC-0004).

Latitude 90 is the timeline — every episode, verbatim, `lon` = its ordinal. Latitude 91 holds
your corrections to how an episode was read, at the episode's own longitude. Latitude 95 holds the
documents about the store — this file is one of them — 96 [a scene](lat96lon0), 98 beliefs
about the design, 99 the fixture, −90 the special record.

### Relations are drawn

A term's `relates:` edges *are* its beliefs — `cat` carries `chase@<mouse>` — so the sphere
draws them, as great circles along the surface rather than chords through it. The edges of the
record you have open, and of anything your last answer lit, are bright and carry an arrow near
the far end; **every relation** draws the rest, and so does zooming past 2×. A negative belief
is dashed and amber. A belief with no object points at its vector's own record, and vectors
live in the *other* hemisphere — so *penguins do not fly* is an arc reaching a third of the way
round the globe. That is not decoration; it is where the store keeps the two halves of a
sentence.

When an answer is an inference, the chain it reasoned along travels as a moving dash for a few
seconds and then settles — and never moves at all if you have asked your system for less
motion.

### Weight, and what the librarian would ask you

Every record carries the four TTDB-RFC-0005 weights and the **EPS** derived from them:
`sal × (255 − conf) / 255`, high when you lean on something and have not settled it. On the
sphere that is a ring around each record, and under **EPS lens** it becomes the whole reading:
the kinds fall away and what stays lit is what is unresolved. Bars are a share of the top
weight in the record's own population — the map, or the lanes beyond it — never of the RFC's
255, which would print every derived term at a fortieth of a bar.

Salience halves every `sal_half_life` episodes a term goes unmentioned, counted in episodes and
never in clock time, so a store nobody has added to does not decay under its own feet. That is
what makes the top of the list a question about *now*: the term list carries it, and so does the
one line the librarian offers unprompted, above the terms.

### A scene is a walk

[`@LAT96LON0`](lat96lon0) has `type: scene` in its header and a `ttdb-scene` block: seven legs
from `pixel` to the speaker, through the chain, the exception that breaks it, and the long arc
west. Open it and it lists its legs under a **play the scene** button; the same switch appears
in the store bar, which is where it stays once the walk has moved on to its first stop. The
globe then turns to each stop in turn and holds while it is read. Any hand on the globe stops
it, and so does asking anything.

---

## The pipeline

Each stage is one blueprint record in the store and one section of an RFC.

1. **Read** — one input, one episode. Files are cleaned structurally; every sentence is kept.
2. **Classify** — function word or content word; noun and verb lemmas; then **segments**: a
   clause is any alternating run of nounish and verbish segments, each a phrase or a list, and
   six rules decide where a verbish one begins. *A candidate lemma the corpus already knows
   wins*, so the grammar gets better at exactly the words you use.
3. **Percept** — `sentence | subject | vector | object | polarity | quantifier`, one per verb,
   relating the segments either side of it. *Cats chase mice* is `cat | chase | mouse | + | -`;
   *I saw the man eat cheese* is two. Your verbs become the store's edge types. A one-word
   statement is a mention; what *or* joins or *I doubt* takes is held, polarity `?` (`?-` if
   it is a denial); and every
   sentence's shape is written beside it.
4. **Terms** — a THING or VECTOR record per lemma, placed on the sphere.
5. **Consolidate** — per triple, count **episodes, not sentences**, for and against;
   conf = Laplace's rule of succession. One saying reads 170; *I like coffee* followed by *I
   do not like coffee* reads 128 and is **contested**.
6. **Reason** — said, then transitive, then inverse and symmetric, then rules, then inherited
   from the nearest `is_a` ancestor. Specificity is the only defeasible rule. Along an
   `exclusive` vector, a later object retires an earlier one.
7. **Answer** — find purchase, pick the intent from the shape of the input, and build the
   reply out of grounds.
8. **Write back** — only what changed; everything else byte for byte.

A ninth record, [`@LAT85LON0`](lat85lon0), is not a stage. It names the runtime's surface —
where the engine is, the calls, the store and reply objects, the page's conventions — so the
engine can be lifted into another app from the store alone.

---

## What it can answer

The seed store carries eight demo episodes from [tools/seed_corpus.txt](tools/seed_corpus.txt):
a small bestiary, a cat called Pixel, and one change of mind about coffee.

| You type | Intent | The librarian says |
|---|---|---|
| *Does Pixel chase mice?* | verify | Probably — it follows from what you said. |
| *Is Pixel an animal?* | verify | Probably — it follows from what you said. |
| *Can penguins fly?* | verify | No. |
| *Do I like coffee?* | verify | Your words disagree, and neither is chosen. |
| *Is a whale a fish?* | verify | Your words don't reach that yet. |
| *What eats cheese?* | subjectsOf | … eat cheese |
| *Where does Pixel sleep?* | objectsOf | pixel sleep_in … |
| *Tell me about penguins.* | portrait | What your words hold about penguin. |
| *Are penguins flightless?* | verify | Probably — it follows from what you said. |
| *¿Es Pixel un animal?* | verify | Probablemente — se sigue de lo que dijiste. |

*Does Pixel chase mice?* is answered with the chain `pixel —is a→ cat ⟹ cat —chase→ mouse`
and both sentences it rests on, labelled **inferred, not said**. *Can penguins fly?* quotes
*Penguins do not fly.* and adds that *penguin is an exception — bird would suggest
otherwise*. *Is a whale a fish?* ends *No purchase: whale, fish.*

Nobody said penguins are flightless. *Are penguins flightless?* is answered by a rule in
[`@LAT-80LON0`](lat-80lon0), `not_fly X -, is_a X bird => has_property X flightless`, which
joins *Penguins do not fly.* to *A penguin is a bird.* and names itself in the chain.

### What no longer holds

`in` is declared `exclusive` in the grammar: a thing is in one place at a time. So order
matters along it, and only along it:

```
> Pixel moved to the kitchen.
Noted 1 percept from 1 sentence.
  …
This replaces something you said before.
> Is Pixel in the sun?
No longer — you said something since.
  [no longer] pixel sleep_in sun → pixel is in sun (sleeping somewhere is being there)
    — “Pixel sleeps in the sun.”
  since [inferred, not said] pixel move_to kitchen → pixel is in kitchen (moving somewhere puts you there)
    — “Pixel moved to the kitchen.”
```

*Later* is the order of the file — the episode, then the sentence — never a clock, so a
store needs none. The retired saying stays in its belief line and is still quoted; *I do not
like coffee* still contests *I like coffee*, because the flag compares places, not yes and no.
How several devices hearing one person could share that order is proposed in
[TTG-RFC-0004](RFCs/TTG-RFC-0004-Time-and-the-Fleet.md) §4, on the fleet pulse of
[TTN-RFC-0010](RFCs/TTN-RFC-0010-Fleet-Pulse.md).

Every answer lights the records it touched on the sphere, opens the first one, and writes
`last_query`, `last_answer` and `answer_records` into the store's cursor.

### How it read you

Under every tell, and under every sentence in an episode's panel, the page shows the sentence's
**shape**: nounish segments boxed as things, verbish ones dashed as vectors, the words between
them bare. The same shape is written into the episode, in the lexicon's marks:

```
said: 1 | Pixel chases mice that eat cheese.
shape: 1 | [pixel] {chases} [mice] that {eat} [cheese].
percept: 1 | pixel | chase | mouse | + | -
percept: 1 | mouse | eat | cheese | + | -
```

Any reading can be overruled. Tap a word, shift-tap to take in more, then mark the span a
*thing*, a *vector*, or *one term*. *I like fly fishing* reads `self | like | fishing`; make
*fly fishing* one term and it reads `self | like | fly_fishing`. Do it in the preview, before
you send, and the episode is written that way. Do it under a reply and press *keep this
reading*, and it becomes an **amendment**: a record at `@LAT91LON<n>` beside the episode
`@LAT90LON<n>`, holding the shape that stands and what it reads as. The episode is never
touched, the corrected saying still counts and quotes as the saying it was, and reading the
sentence back the episode's way withdraws the amendment.

You can also type the marks, or join words yourself. *Fruit flies like bananas.* reads
`[fruit] {flies} [like bananas]` — `fruit | fly | banana`, the famous wrong reading.
`[Fruit flies] {like} [bananas].` fixes the segments (`fly | like | banana`), and
`[Fruit_flies] {like} [bananas].` makes the insect one term (`fruit_fly | like | banana`). Once
the corpus holds a joined term, the words find it unmarked.

A sentence of one word is allowed. *Coffee.*, said as a statement, is kept as a **mention**:
the term is counted and searchable, and nothing is believed about it. Typed bare, *coffee* is
still a look-up.

Not everything you say is something you assert. *I doubt cats like fish.* reads
`[i] {doubt} [cats] {like} [fish]`: `self | doubt | -` is said, and `cat | like | fish | ?`
is **held** — written, counted and searchable, never believed, and never a contradiction of
*Cats like fish*. What *or* joins is held the same way (*Pixel is a cat or a dog*), and the
reply names what it held. *Pixel is not a cat or a dog*, on the other hand, is a plain
denial of each.

If you meant the hedge as fact, set it aside: select *I think*, mark it an **aside**, and
`(i think) [cats] {bark}` reads `cat | bark | - | +`, said. Parentheses you type are asides
too, so *Pixel (my old cat) purrs.* is about Pixel purring, and the parentheses stay in your
words.

Clauses open and close inside a sentence. A relative clause closes at the next verb, so *Cats
that chase mice are fast* is `cat | has_property | fast`, not a claim about mice, and *The dog
that the cat chased ran away* is `cat | chase | dog`. A verb in its bare form goes on with the
relative instead while the sentence still waits for its own: *The man that saw the cat eat
cheese is tall* is the cat eating and the man tall. It goes on, too, after a verb that takes a
thing and then a bare verb — *see*, *make*, *let*, and any verb you have used that way
yourself: once you say *I spied the cat eat fish*, *I like the man that spied the cat eat
cheese* is the cat eating, not the man. When the thing before a relative word is
not what the verb after it acts on, the relative word was reporting a clause: *I emailed the
man that the cat sleeps* holds `cat | sleep`, and so is a noun that holds a clause: *the idea
that cats bark is silly* holds the barking and says the idea is silly. *Cats that hunt eat
mice* is two verbs, hunting and eating. Which word of a phrase is its head is the lexicon's
to say: last in English, first in Spanish, so *el gato negro* is a `gato`. Whether a verb
takes the thing before a relative word depends on what you have said of that verb, held or
not: after *I doubt dogs bite*, *the rule that dogs bite is old* holds the biting.

Where the grammar can see two readings, it holds both and says only what they share. *The men
that saw the cats eat cheese.* says `man | see | cat` and holds `cat | eat | cheese | ? | - | a`
and `man | eat | cheese | ? | - | b`: the last column names the reading, so the two are one
saying, not two. The reply says it read the sentence two ways; *Do men eat cheese?* answers
that your words don't reach that yet, and names the sentence with both its readings. Under
the sentence, each reading has an *I meant this* button; press one and the choice is kept as
an amendment with a `reading: 1 | b` line, and that reading is said.

A grammar change reads old sentences differently, and so does your own corpus as it grows —
a verb you come to use with a thing. An episode's panel shows the new reading under the one
that stands, with what it would say, and *take this reading* keeps it as an amendment that
names the grammar it came from; the store bar counts the ones you have not ruled on and takes
them all at once. Each is read in the context of the sentences before it as they stand, so
what is offered is what taking it writes; taking them all goes in order and reads each again
after the ones before it, so after *The ice cream melted* is taken as `ice_cream`, *It was
sweet* follows it. `node tools/reread.mjs` lists them under a hash of the grammar, and
`--accept <hash>` takes every one you have not already amended; nothing is written until you
do, because the grammar's new opinion is not yours until you take it.

---

## Make your own

This file is meant to be forked, and there are four depths to fork it at.

1. **Your own corpus.** Press *Start empty*, then talk to it. Or run
   `node tools/feed.mjs notes.md journal.txt` against an emptied store. Download the store now
   and then; it is the only copy that leaves the browser.
2. **Your own language.** Rewrite the records south of the origin — seven will do, rules are optional — and leave
   `index.html` alone. [tests/fixtures/es_ttdb.md](tests/fixtures/es_ttdb.md) is a working
   minimal example — about sixty lines of grammar. Or keep English and add yours beside it,
   as the six Spanish records do: give each one `lang:`, supply `label:` lines instead of
   vector algebra, and you can ask in either language.
3. **Your own runtime.** The first eight blueprint records up the meridian are the whole
   contract, compressed: block formats, the percept line, placement, the conf formula, the
   inference order, the intent table, the write rules. The five TTG RFCs are their expansion,
   and the `mmpdb` constraints say what a runtime may and may not contain.
4. **This runtime, inside another app.** Point the app's developer, or its development agent,
   at the ninth, [`@LAT85LON0`](lat85lon0): `openStore`, `answer`, render the grounds by kind,
   persist `serializeStore(S.st)`. The first embedding by someone else found what that record
   now covers — function names, the store object, the boot gate, the `data-*` convention — had
   to come from this page and this README instead. `docs.test.mjs` now holds the record to the
   runtime's real exports.

---

## Roadmap

The order is EPS over the design beliefs in lane 98, as it was over the layers in
global_models.

| Record | Belief | conf | sal | EPS |
|---|---|---|---|---|
| [`@LAT98LON5`](lat98lon5) | What the parser cannot see | 70 | 190 | **138** |
| [`@LAT98LON8`](lat98lon8) | Order, not clocks: a fleet shares a tempo | 90 | 180 | **116** |
| [`@LAT98LON4`](lat98lon4) | The lemmatizer is a guess the corpus corrects | 120 | 210 | **111** |
| [`@LAT98LON7`](lat98lon7) | Two languages, one sphere | 100 | 140 | **85** |
| [`@LAT98LON9`](lat98lon9) | A reading is a guess the owner can overrule | 150 | 160 | 66 |
| [`@LAT98LON3`](lat98lon3) | Said outranks inferred; a contradiction is kept | 190 | 200 | 51 |
| [`@LAT98LON1`](lat98lon1) | A verb is a vector, and the edge is the datum | 200 | 180 | 39 |
| [`@LAT98LON6`](lat98lon6) | Mentions are not evidence | 215 | 150 | 24 |
| [`@LAT98LON2`](lat98lon2) | Lanes are latitudes again | 230 | 60 | 6 |

**First, the parser's blind spots** — one reading or two, adverbs after a verb,
attributive adjectives, tense and modality. Every sentence passes through
them and they are the least settled thing here, though you can now correct any reading they
get wrong, and what the parser cannot tell is asserted is held rather than believed. The test for any fix is the one in [`@LAT98LON5`](lat98lon5): if it needs English in
`index.html`, it is the wrong fix. Each is a rule kind the grammar could declare.

**Second, the lemmatizer.** It is right about the words you use and wrong about the first use
of anything irregular, and a wrong first lemma becomes the term later uses are matched
against. Every merged surface form is visible on the term record's `forms:` line.

**Third, the second language.** Spanish brings blind spots English never showed:
verb-first questions (*¿Dónde duerme Pixel?*), adjectives that agree in number (*son
negros*), and dropped subjects other than yours — *No como carne* is read as you, *Come
queso* is not read as anyone. Verbs link across languages only one rule at a time
(`cazar X Y => chase X Y`).

**Then, time across devices** — [`@LAT98LON8`](lat98lon8), second on the list before a line of
it runs. One store orders what you said by its file. Several agents hearing you (a phone, a Pi,
a badge) share no file and disagree about the time. The proposal is a band's: share a tempo,
stamp each saying with how far your clock can be trusted, and call two sayings contested when
their bounds overlap.

**And the readings you correct** — [`@LAT98LON9`](lat98lon9). A correction lives beside the
episode, never in it, and never counts twice. But a term you bind once is found everywhere
after, silently at parse time; the `forms:` line is the only place it shows.

**Not on the list: a recency rule for contradictions.** *I like coffee* on Monday and *I do not
like coffee* on Friday is a change of mind, and the store cannot tell it from a contradiction.
A recency window would be one line in the numbers record and a large claim about you. The
`exclusive` flag is not that: it is a claim about a relation, and it never settles yes against
no.

---

## Known limits

- **Relatives lean on what you have said.** Whether *the thing that X verbs* makes the thing
  the verb's object depends on whether you have used that verb with an object; until you
  have, *I told the man that the cat bit* holds two readings, a bite reported and the man
  bitten, until you say which you meant, and a re-reading offers the second once you have
  said the verb with a thing. Where both readings of a sentence are grammatical and the
  grammar can see it, both are held (*the men that saw the cats eat cheese.*); where it
  cannot (*Birds that sing love songs.*, before *love* is a thing to you), the reading with a
  verb wins. What the store learns about a verb comes from the readings that stand, its own
  guesses included, until you amend them. Questions that
  invert word order beyond the declared forms fall back to search. Where it reads you
  wrongly, [correct the reading](#how-it-read-you).
- **Modifiers are dropped.** *Black cats* is *cats*, unless you make *black cats* one term.
- **Held is all-or-nothing.** *Pixel is a cat or a dog* holds both, which is safe but says
  less than you did.
- **A file is one episode**, however long. One long document cannot outvote two typed remarks.
  That is a claim about what feeding a file in means — *here is something I read* — and it is
  written down at [`@LAT98LON6`](lat98lon6).
- **Replies quote rather than generate.** Articles and agreement are whatever your sentences
  had; a chain prints as triples.
- **`localStorage` is small.** Browsers allow a few megabytes. The page tells you if a save is
  refused; download the store before feeding it a library.

---

## Conformance

The store is a conformant TTDB (TTDB-RFC-0001) and exercises the failure paths on purpose:

- [`@LAT99LON1`](lat99lon1) carries a **dead edge**, an **unknown header field** and **no
  `[ew]` block**, and an episode block holding **three malformed percept lines**, which the
  consolidator skips, counts and reports (the page's status bar says *3 malformed skipped*).
  Its `said:` line is not your words: only episode blocks at lat 90 are, so it is never quoted,
  searched or counted — including after *Start empty*, which keeps it. An earlier version did
  search it, and a code review of someone else's embedding caught that before this suite did.
- `@LAT-90LON0` is the South Pole special record, declaring a `kind` no viewer knows.
- The page implements TTCP-RFC-0001 §11 (weights shown with EPS) and §12 (edges as
  navigation, dead edges visibly dead), TTCP-RFC-0002 §2, §4 (typed edges drawn, with the
  selected record's bright and the rest quiet), §5–6 for the sphere and §10 (scene records and
  playback, with a control and a step indicator), and TTCP-RFC-0003 §2.2 record tokens and §6
  search over the term list.
- An edge is drawn only where both ends are on the map, so the episode lane's `perceives`
  edges are left off; a dead edge has nowhere to draw to and stays a struck-through link in
  the record, which is what §12 asks for.
- **Embedding.** The page reaches for no element without finding it first, so a host that
  takes the engine and wires its own page supplies the surfaces it wants and leaves out the
  rest; [Blueprint 9](lat85lon0) lists them, `tests/embed.test.mjs` holds that list to the
  code, and `#panel` is a window the host must size. `recordHtml`, `includeUrl` and
  `saveLocal` are the functions a host replaces — every record render goes through the first,
  so it is the one place to decorate records.

Not implemented: the guided tour, side globes, URL sync (the page reads `?ask=` to run a
question on load and `?seed` to ignore the local copy, and nothing else). §10's `audio_path`
is parsed past rather than played: this page has no sound.

---

## Credit and licence

Specs and format: [toot-toot-engineering](https://antfriend.github.io) by antfriend. The
demo sentences are invented. Licence: [LICENSE](LICENSE).
