# 🤖 mapa — design

**Status:** **APPROVED by Paul, 2026-11-12** ("Yes to all recommendations
and repos"), revision 5. Fable approved revision 3 conditional on three
text edits, which revision 4 made. Paul's approval covers the author's
proposals in §1, as recommended, and the §13 items marked ruled below. The
hub repository `oficina/mapa` exists, with amadan workflow on. **Slice 1
items 1 to 5 are built** on `feat/slice-1`, for review: not merged, not
deployed, no CARLOS app. Item 6 waits for the team host. §15 records the
build's notes. This line is the one to keep current.

**Reviews.** Fable 5.2 reviewed revision 1 (`48e72e6`) and asked for
changes (5 high, 9 medium, 9 low). Revision 2 (`2345d97`) answered them.
Fable re-reviewed revision 2 and asked for a narrower set of changes (1
high, 6 medium, 6 low), which revision 3 (`057d474`) answers. Fable
approved revision 3 conditional on three text edits (M1 to M3) and three
minor notes, all of which revision 4 makes. Fable said no further review
was needed once they were applied. Appendix A maps every
finding from both rounds to the section that answers it.

**Consumed suite rulings.** This spec consumes `oficina/suite`
`docs/superpowers/specs/2026-09-05-suite-sharing-doctrine.md` at
**revision 11, commit `91affa1`**, including revision 10's "hold private
too, check per person". It cites rulings 7, 8, 9 and 15, plus doctrine
§§4.3, 6, 6.1, 6.3, 6.4, 6.6, 8 and 14. It never restates them (suite
ruling 7). §7 proposes a new contract call, which would be revision 12 of
that doctrine. That is a proposal to the suite, not a ruling.

*Mapa* is Spanish for map. The name is Paul's.

---

## 0. The one rule

**Mapa is the team's knowledge base. Fichas is the team's database. Docs is
where the team publishes.** Paul, 2026-11-12: *"In traditional terms,
Fichas is database, Mapa is knowledge base."*

- If something wants typed fields, sorting, grouping or a table, it belongs
  in Fichas, and Mapa embeds it (§7).
- If something wants pagination, page layout or DOCX/PDF export, it belongs
  in Docs, and Mapa can promote a page into one (§9).
- **Mapa is an app of record.** It owns its pages, answers for them, and is
  the only thing that may delete them. memoria indexes Mapa as a sibling. A
  team's notes are not a memoria feature, for the reason Fichas decision 1
  gives for cards: that would make memoria the app of record for content
  people author elsewhere.

---

## 1. Decisions, and who made them

**The `Who` column matters: most of this table is the spec author's
proposal and has not been ruled on.** Do not read a proposal as a ruling.

| # | Decision | Rejected | Who, when |
|---|---|---|---|
| 1 | **Mapa is a new per-team instance app**, with its own DEK, at `<team>.mapa.oficina.works` | Wiki pages as a Docs mode, because Docs is "the same document everywhere": paginated, WYSIWYG, DOCX/PDF out. Notes inside memoria, per Fichas decision 1's reasoning. Notes as a Fichas card type, because Fichas entries are append-only and its unit is a typed record, not prose | Paul, 2026-11-12 |
| 2 | **Linked notes, not a spatial mindmap.** The unit is a page of prose. Structure comes from `[[links]]` in the text. A graph view may come later as one way of looking at the pages | A canvas of nodes and edges as the primary surface | Paul, 2026-11-12 |
| 3 | **Fichas = database, Mapa = knowledge base.** No properties, table views or typed fields in Mapa | Notion's database-inside-a-page | Paul, 2026-11-12 |
| 4 | **Embeds go both ways.** A Fichas card or saved view can be embedded in a Mapa page, and a Mapa page in a Fichas card | One-way references only | Paul, 2026-11-12 |
| 5 | **Daily notes.** One page per person per day. Today's note is the landing page | A blank "new note" as the entry point | Paul, 2026-11-12 ("I'd love to see daily notes") |
| 6 | **One shared namespace per team.** `[[Acme]]` means one page for everyone in the team | Per-person namespaces with team pages layered on top | Paul leaned yes, 2026-11-12 ("Shared namespace makes sense?"); author recommends. **Confirm** |
| 7 | **Only team pages hold titles in the namespace.** Private material is daily notes and untitled scratch pages, and both may link *to* team pages | Private titled pages, which either collide with a teammate's `[[Acme]]` or reveal that a private page exists by refusing the title | **Proposed** (§3.3) |
| 8 | **A page's rung is fixed when it is created.** Sharing private writing creates a new team page from the chosen text. The private page is never re-ruled | Moving a page between rungs, which either makes its private-era revisions team-readable or needs per-revision rungs | **Proposed** (§3.4) |
| 9 | **Bodies keep link text exactly as typed. Titles resolve through aliases at render.** **This is a trade-off, and it reverses revision 1:** links are keyed on text, so deleting a page or freeing an alias, then creating a page with that title, rebinds every link typed with that text, private notes included (§3.4) | Rewriting every linking page's body on rename, which mints revisions in pages nobody edited and, for private notes, in pages the renamer cannot see. Revision 1's id-keyed links, which needed exactly that rewrite to keep S3's bytes fixed (doctrine §6.6) | **Proposed** (§3.2) |
| 10 | **The body is Markdown. A page is a document, not an outliner** | A strict bullet outliner (Logseq, Roam) | Paul, 2026-11-12 ("Document sounds good") |
| 11 | **Saves are revision-checked and merged by block. There is no real-time co-editing in v1** | Docs' collaboration machinery, which is built for paginated layout | **Proposed** |
| 12 | **Embeds are a suite contract call, not glue between two apps.** The owning app serves a typed payload, with no markup, for a named asker. The embedding app renders it with a shared estilo partial (§7) | An iframe from the owning origin, which needs a session at every sibling and relaxes framing refusals. HTML or Markdown handed between siblings, which lets one app put markup into another | **Proposed** |
| 13 | **A team container may embed only team-visible items.** This is checked when the embed is written (§7.4) | Hiding non-team embeds at render only, which cannot hide them from the editor, history, S3 or export | **Proposed** |
| 14 | **SQLite, cgo-free, like every sibling. Everything that is free text or derived from free text is sealed, the link graph included. Search, backlinks and the graph live in an in-memory index rebuilt from sealed rows on wake** | Plaintext link and reference tables, which fail Fichas §4.1's test ("plaintext only where the durable file must answer without the key"), since the graph can be derived at wake | **Proposed** (§4) |
| 15 | **Export is an Obsidian-compatible Markdown vault**: the team's pages, plus the exporter's own private pages | No export; a proprietary format | **Proposed** |

## 2. What Mapa is, and is not

**Is:** a per-team instance app holding pages of Markdown prose, the links
between them, each person's daily notes, and references to items in
sibling apps. Those references render as embeds, resolved per viewer at
render time.

**Is not:**

- **Not a database** (decision 3).
- **Not a publishing tool.** It paginates nothing and exports only Markdown.
- **Not an app of record for what it did not author.** An embed is a
  reference. The owning app decides every time whether to resolve it.
- **Never an actor** (suite ruling 9). Every write names the person who
  made it.

## 3. The data model

### 3.1 Objects (durable)

- **Page:** `(id, kind, rung, owner, revision, created_at, updated_at)`
  plus a sealed record holding the title (team pages), the date (daily
  notes) and the Markdown body.
  - `kind` is `page`, `daily` or `scratch`.
  - `rung` is `team` or `private`, fixed at creation (decision 8).
  - `owner` is a member row id, as in Fichas, not an address.
- **Alias:** `(page_id, sealed title)`. Every title a team page has had.
- **Title print:** `(print, page_id)`, where `print` is HMAC under the
  instance key of the title after case- and accent-folding. It covers
  current titles and aliases, and is unique. It lets the durable file
  refuse a duplicate title without holding it (§4).
- **Daily print:** `(print, page_id)`, the HMAC of `(owner, date)`, unique.
  It enforces one daily note per person per day without a plaintext date.
- **Revision store:** `(page_id, revision, at, actor)` plus the sealed
  body at that revision. It is kept for the history window (§5) and pruned
  after it.
- **Draft:** `(page_id | daily print, person, base_revision, updated_at)`
  plus a sealed body. One per person per page. A draft for a daily note
  that does not exist yet is keyed by its daily print, and its first commit
  creates the page. A draft holds coalesced autosave text before it
  becomes a revision (§5). It is not an item, has no revision, and is never
  in S1 or S3.
- **Member:** `(id, address print, sealed address, time zone setting)`.
  This is the lone-shape admission list's local mirror, as in Fichas. The
  sealed time zone is the person's setting. The team's default time zone
  is an instance setting in config.
- **Sessions and sign-in rows:** rastrillo's own tables, unchanged from
  every sibling.
- **Event:** `(id, nonce, at, actor, object, verb, revision)`, one row for
  every write. It feeds the in-memory index and S1 (§8). A write that logs no
  event is invisible to both. Gate 8 checks this.
  - *Amended by the Notion import (its spec §14.2, §21):* object kind
    `import` names a person's own act on the import (`connected`,
    `token_replaced`, `disconnected`, `finished`, `forgotten`, `started`,
    `stopped`, `resumed`, `started_over`). The index and S1 ignore it.
- *Amended by the Notion import:* the sealed record gains two optional
  fields. `origin` (`{source, created, edited}`) says an imported page
  came from Notion, with Notion's own times; every later commit carries
  it forward. `imported` marks a revision the import wrote; `tx.commit`
  clears it on every write but `ImportCreate`'s and `ImportUpdate`'s.
- *Amended by the Notion import:* its own tables, `notion_connections`,
  `notion_runs` and `notion_pages`, are listed in its spec §15 and in §4
  below.

### 3.2 Derived, in memory only

Rebuilt from sealed bodies on wake and kept current from the event log.
None of it is written to the durable file:

- **Links:** `from_page → to_page`, resolved by matching each `[[text]]` in
  a body against current titles and aliases.
- **Pending links:** `[[text]]` that resolves to no page.
- **References:** `![[app:item]]` in a body.
- **Unlinked mentions:** team-page titles and aliases that appear in a body
  without a link.
- **The search index:** titles, aliases and bodies.

**What a body holds.** The link text exactly as typed: `[[Acme]]` stays
`[[Acme]]` after Acme is renamed "Acme Ltd". It resolves through the alias
at render. Renaming a page therefore mints a revision for that page only.
Pages that link to it are untouched, which keeps doctrine §6.6's "a
revision names one byte sequence for ever" true for S3 (§8). The editor
offers "Update links to the new title" as an explicit, attributed edit, and
never does it silently.

**Blocks.** A block is a paragraph, a list item, a heading or a code fence.
Backlink context is "the block that contains the link", found at render,
and needs no stored id. **A block gets a stable id only when something
targets it.** That uses Obsidian's syntax: a `^id` marker at the end of the
block. **A marker is minted only by an edit to the page that holds the
block, by someone editing that page.** Minting it from elsewhere would
write into the target page. If Ana links from her private note to a block
in team page Acme, the marker would appear in Acme's history as an edit by
Ana, telling teammates she linked to it privately. So from a private note,
a block reference is a page link plus a quoted excerpt, and `[[Acme#^id]]`
works only for markers that already exist. In a team page, "Link to this
block" mints the marker as an ordinary attributed edit to that page. The marker is visible text, so it survives the scriptless
textarea. Deleting the block drops it, and links to it then resolve to the
page with a "block removed" note.

### 3.3 Rungs, and the namespace

The doctrine's ladder (ruling 15) has three rungs. Mapa v1 uses two:

| Kind | Rung | Title in namespace? | Who opens it |
|---|---|---|---|
| `page` | `team` | yes: unique per team, after folding, across titles and aliases | every member |
| `daily` | `private` | no: shown as its date | its owner |
| `scratch` | `private` | no: shown as its first line | its owner |

- **The `granted` rung is not in v1.** Its trigger is in §12.
- **Backlinks, unlinked mentions, search, autocomplete and "Create" are all
  ruled per viewer, and so is the order they come in** (§6.3). Every read
  of the in-memory index is scoped to team pages plus the viewer's own
  private pages. **Nothing anywhere shows a count of what the viewer cannot
  see** (Fichas §9).

### 3.4 Verbs

- **Create a team page:** any member. Its title must not match any current
  title or alias (title print).
- **Rename:** any member. The old title becomes an alias.
- **Delete:** any member, through a confirm page. Delete is the only verb
  that changes what teammates can open, so it is logged with its actor. The
  page's title and aliases are freed. Inbound `[[text]]` stays as typed and
  becomes pending, which is honest: the text was written by its authors and
  still says what they wrote. If a new page later takes that title, those
  links bind to it (decision 9's trade-off).
- **Restore a deleted page:** possible inside the history window (§5), as a
  **new item with a new id** at its first revision. S1 has already said
  `gone` for the old id, and it stays gone. If the title has been taken
  meanwhile, the restorer picks another.
- **Update links:** after a rename, "Update links to the new title" edits
  **team pages and the actor's own private pages only**, as edits by the
  actor. It reports how many of *those* it changed, and never a count that
  includes anyone else's private pages. Other people's private links keep
  working through the alias.
- **Free an alias:** an explicit action on the page that owns it. It frees
  the title for a new page, and links typed with that text become pending
  or rebind to the new page. Aliases otherwise reserve titles until their
  page is deleted.
- **Share private writing:** select blocks in a daily or scratch note and
  choose "Make team page". This creates a **new** team page holding only
  those blocks, at its first revision. The private note gets a link to it
  in place of the moved blocks. No private-era revision ever becomes
  team-readable (decision 8).
- **Undoing an accidental share:** delete the team page. The spec does not
  pretend this unshares anything: teammates may already have read it, and
  memoria may hold it until its feed pulls `gone`. A team page cannot be
  moved to private, for the same reason, and because the move would claim
  more than it can deliver.
- **Date links:** a link whose text is an ISO date (`[[2026-11-12]]`, and
  nothing else) is reserved. It never names a team page: a date-shaped
  title or alias is refused on create, on rename and when "Make team page"
  is used. It opens **the viewer's own daily note** for that date. The
  resolution is per viewer and reveals nothing, because each reader reaches
  only their own note. Changing your time zone changes which date "today"
  is from then on. It never moves or re-dates a note already written.
  **Proposed.** The product cost: when Ana writes "see `[[2026-11-12]]`" in
  a team page, Bo lands on his own note for that day, probably empty, not
  on Ana's. Pointing at what happened on a day means a team page.

### 3.5 Document, not outliner — ruled

Reflect and Obsidian are document-shaped: prose, with lists where you want
them. Logseq and Roam are outliners: every line is a bullet in a tree.

**RULED, Paul, 2026-11-12: document** ("Document sounds good"). Mapa's
pages are meant to become reference material that people read. Block links
(§3.2) give the addressability outliners are loved for, without forcing
bullets.

## 4. The seal boundary

Under Fichas §4.1's test, plaintext is allowed only where the durable file
must answer a question without the key. The complete plaintext list:

| Column(s) | Why it must be plaintext | What it leaks |
|---|---|---|
| ids, `kind`, `rung` | rows must be addressable and S1/S2 must answer per rung | how many pages, daily notes and scratch pages exist |
| page and event nonces, event ids | S1 cursors and revision nonces (§5, doctrine §6.6) | nothing beyond row counts |
| revision store `(page_id, revision, at, actor)` | history lists and restore without unsealing every body | **how many times each page was saved, by whom, and when**, inside the window. Ciphertext sizes show how each body grew |
| drafts `(page_id or daily print, person, base_revision, updated_at)` | the coalescing rule (§5) runs without unsealing | that a person has an uncommitted edit to a page, and when they last typed in it |
| member `id`, address print | admission and S2 by address without unsealing | how many members there are. The print shows equality only |
| rastrillo session and sign-in rows (`sessions`, `auth_links`, `auth_sessions`) | inherited, as in every sibling | when each person signed in, **and their address, in the clear** (corrected after review M4: rastrillo writes it into `auth_links` and `auth_sessions` on every sign-in, in every sibling). Sealing it is a suite-wide follow-up in rastrillo, not Mapa's. Gate 4 allows it there by name, and nowhere else |
| *(shown, not stored)* "Ana is editing" on team pages | presence while a draft is under 2 minutes old | that Ana is editing a team page, including edits she later discards. Never shown for private pages |
| `owner` (member row id) | S2 answers `private` → owner without unsealing | who has how many private pages |
| `created_at`, `updated_at`, `revision` | ordering, S1, §6.6 | **when each person writes**, including private notes. A daily note's creation time narrows its date to about a day. Creation on first edit (§6), not first open, means this records writing, not visiting |
| events `(at, actor, object, verb)` | S1 is the event log (Fichas §5's shape) | who did what to which object, and when. Not content |
| title prints, daily prints | uniqueness without the key | equality: two attempts at the same folded title are visibly the same. The number of aliases per page is a rename count. Prints are HMAC under the instance key, so they cannot be checked against a guessed title without that key |
| ciphertext sizes | inherent | roughly how long each body and each draft is |
| *Notion import (its spec §15):* `notion_connections (id, created_by, created_at, verified_at)` | a person's acts on the connection, and the 90-day idle retention, without the key | that a Notion connection exists, who made it, when it was last checked. The token and workspace are sealed |
| *Notion import:* `notion_runs` (id, actor, state, lease, its clocks, its counters, error code) | single-flight, leases, liveness and the status page without the key | when imports ran, who ran them, and how many pages each created, updated, kept and failed. The lease is random |
| *Notion import:* `notion_pages` (id, notion print, state, error code, surveyed run, seen run) | re-runs find a page without the key | how many Notion pages the import has seen and their states. The coordinate (Notion id, Mapa page, revision) and staged tree are sealed. **But the plaintext event log joins them**: a run's `created` events, by its actor, in its window, mark which team pages it made, and sequential ids line them up in Notion's survey order. Not their titles, bodies or Notion ids |
| *Notion import:* egress | the import reads Notion | Mapa dials `api.notion.com` and Notion's file hosts during a run and once when a token is saved. Notion and its storage provider learn the instance's egress address and when it imports. No team content goes out |

**Sealed:** titles, aliases, dates, bodies, revision bodies, draft
bodies, member addresses (in Mapa's own tables; see the sessions row), time zone settings, and so links, pending links,
references and `^id` markers too. The link graph exists only in memory
(decision 14).

## 5. History

Every write is logged with its actor. Page bodies keep their revisions for
**90 days** (proposed), and restore works inside that window, using Fichas
decision 2's shape. Restore mints a **new** revision. Revisions are random int63 values,
and cursors carry random nonces (doctrine §6.6, as Docs and Fichas adopted
for revision 11).

**Autosave is coalesced through a draft.** While a person types, autosave
writes their **draft** (§3.1): a sealed row per person per page, separate
from the page. The page body and its revision are never touched in place,
so `(item, revision)` always names one byte sequence (doctrine §6.6).
**The draft is committed as a new revision**, with one event, and every
commit is a `POST` made by the person. A `GET` never writes, and the
platform runs no timers (doctrine §13):
- **On Save**, or **after 2 minutes idle**, the open tab's script `POST`s
  the commit. Without script, Save is the only commit.
- **A draft left by a closed tab** is offered on the person's next visit to
  that page, or to today's note: "You have unsaved changes: Save or
  Discard". Both are `POST`s.
- **A commit is a revision-checked save.** If a teammate's revision landed
  in between, the §6 block merge runs. **If two people edited the same
  block, the commit does not happen.** It stays a draft, and the person
  is shown both versions to choose from the next time they are present.
  Nothing is committed that nobody chose.
- **If the base revision has aged out of the 90-day window,** there is no
  merge base. The person is shown the current page and their draft side
  by side, and chooses.
- **If the draft's page was deleted,** the draft is offered as a new
  scratch page.
- **Two tabs** of the same person share one draft, with a version check: a
  stale tab's autosave is refused, and that tab reloads the draft rather
  than overwriting newer text.
- **An abandoned draft** is kept for 30 days after its last write, then
  discarded (proposed).

Meanwhile:
- A teammate sees the last committed revision, plus "Ana is editing" while
  Ana's draft on a **team** page is less than 2 minutes old. It is never
  shown for a draft on a private page. Who is editing a team page is not a
  rung leak, but it is a disclosure: it shows edits Ana later discards,
  which never reach history. It is in the leak list (§4).
- S1, memoria and the history list see revisions, not drafts.

Two write paths are exempt from gate 8's "every write logs an event",
**by name**: draft writes, because a draft is not an item (its commit is
logged), and retention, which removes what the 90-day and 30-day windows
have passed and changes no item anyone can still reach (added after
review L7; build note 27).

*Amended by the Notion import (its spec §14.2):* a third exemption,
**bookkeeping**: an import run's own rows, heartbeats, progress, staged
trees and map state that changes no page. It goes through one function
whose transaction may touch only `notion_*` tables (gate I19). A page
write is never bookkeeping, and a person's acts on the import log events.

## 6. The surface

The rastrillo floor applies: **every screen works with JavaScript off.**

- **Today.** `/` shows today's daily note. Until there is something to
  save, it is an empty editor and **no row exists**: the note is created
  when its first draft is committed (§5), so a day on which nothing was written leaves no trace in
  S1, memoria or the database file. A `GET` never writes.
- **The date and its time zone.** "Today" is in the person's own time zone:
  a per-person setting, defaulting to the team's time zone (an instance
  setting). Script offers to switch when the browser's zone differs. It
  never switches silently.
- **A page.** It shows the rendered Markdown, then backlinks grouped by
  source page with their context block, then unlinked mentions (§6.4).
- **Editing.** The scriptless floor is a Markdown `<textarea>` with a Save
  button, revision-checked. Script adds live preview, `[[` autocomplete,
  coalesced autosave (§5) and link paste.
- **Conflicts.** A save against an older revision is merged three ways by
  block. Edits to different blocks merge silently. When two people edit
  the same block, the second sees both versions and chooses. Nothing is
  lost silently.
- **⌘K.** One box over titles, aliases and bodies, offering "Create *X*"
  when nothing in the viewer's scope matches. Without scripts it is
  `GET /search?q=` as a full page.
- **Links.** `[[Title]]`, `[[Title|shown text]]`, `[[Title#^id]]`. A
  pending link renders as one, and following it offers to create the page.
- **Embeds.** `![[fichas:…]]` and friends (§7). A page that embeds is
  served `no-store`.
- **Calma**, and the Oficina door for sign-in.

### 6.1 Search speed — targets, and what they rest on

| Measure | Target |
|---|---|
| Server time per typeahead query, at 10,000 pages | p95 ≤ 5 ms |
| Keystroke to results painted, warm, same region | p95 ≤ 100 ms |
| Cold wake to first search answered, at 10,000 pages | **unmeasured.** Target ≤ 2 s, to be confirmed by gate 6 before it is promised |

**What the precedents measured, exactly.** Fichas commit `9179761`
measured, at 5,000 customers with 10,000 calls, a 225 ms cold load once per
wake, and 0.37 ms for a search with a filter and a sort. Those are short
structured fields matched by substring, not ranked search over prose.
memoria §7.2 measured 6.8 s to build its index at 90,000 chunks. That is
the closer precedent for prose, and the reason the cold-wake number is
marked unmeasured rather than borrowed.

### 6.2 Ranking

Titles and aliases are prefix-matched and rank first. Bodies are matched by
term and ranked BM25-style. **Every statistic a ranking uses is computed
over team pages only:** document frequencies, the backlink boost and the
average length. A viewer's own private pages are scored against those
team-only statistics. So nobody's private writing can change the order of
anybody else's results, including the viewer's own. A term that appears in
no team page has document frequency 0, and is smoothed as if it appeared in
one (BM25's +1).

**The scope filter runs before traversal, not after.** Postings are
partitioned: one team partition, plus one partition per person for their
private pages. A query reads the team partition and the viewer's own
partition only, so the time Bo's query takes cannot depend on what Ana's
private notes contain.

### 6.3 What the viewer's scope covers

Every read of the in-memory index is scoped to team pages plus the viewer's
own private pages. That covers search results and their order, ⌘K's
"Create" offer, `[[` autocomplete (team titles and aliases, and the
viewer's own pending link texts only), backlinks, unlinked mentions and any
future graph view. Gate 1 checks this.

### 6.4 Unlinked mentions

Text in a page that matches a team page's title or alias without linking to
it shows on the target page as "Mentioned without a link", with "Link it".
It is computed in memory, never stored, and scoped per viewer (§6.3).

## 7. Embeds: a suite contract call (proposed revision 12)

### 7.1 What has to be true

1. **The viewer decides what shows.** An embed renders only if the person
   looking may open the item in its own app, checked at that moment.
2. **Not visible renders nothing, and never a count** (Fichas §9).
3. **An unavailable sibling is loud** (doctrine §6.3): "Fichas did not
   answer", naming the app, with a retry link.
4. **No copy at rest.** Embed content is never written to the embedding
   app's database and never enters its index.
5. **Scriptless.** Embeds render server-side.
6. **No markup crosses apps.** Payloads are typed data. The receiver parses
   nothing.

### 7.2 Numbering

**S10.** S4 and S5 are not calls (doctrine §6). S7 is retired (doctrine
§6). S8 is write-as-self. **S9 is reserved** by the cross-rung reach draft
(suite `design/cross-rung-reach`, `2026-09-19-cross-rung-reach-draft.md`
§5, `RouteS9 = "/suite/s9"`) and by Fichas §6 ("S9 (reach) depends on an
unresolved ruling"). This spec does not ask for that draft to be withdrawn.

### 7.3 The call

**S10 embed:** sibling → sibling, consumer token **+ named asker**, which is
S2's credential shape (ruling 8, doctrine §6.1).

- **Request:** up to 32 `(item, view?)` pairs plus one asker.
  - **The asker's subject kind:** `address` while either side is lone
    shape. Fichas answers `UNKNOWN` to every `person_ref` (Fichas §6.3).
    `person_ref` arrives with the home's identity layer.
  - **A view** is a named object in the owning app (§7.6), not an S1 item.
- **Response:** one result per pair, with **three** values. There is no
  revision in an embed, so `STALE` does not apply (doctrine §6.6 defines it
  against an asked revision).
  - `VISIBLE` carries a payload.
  - `NOT_VISIBLE` carries nothing. It covers an unknown or deleted item or
    view, and one the asker may not open.
  - `UNKNOWN` carries nothing and is rendered loudly.
- **Payloads** are a closed set of typed shapes in the suite module, each
  with a strict decoder and size caps. **None contains HTML or Markdown
  source:**
  - **`card`:** a title, up to 12 `(label, value, kind)` fields, the last 3
    entries `(kind, actor, at, text)`, an app URL, and `team_visible: bool`
    (§7.4).
  - **`list`:** a title, column labels, up to 25 rows of `(cells, app
    URL)`, `more: bool`, an app URL, and `team_visible`. **The rows, the
    25-row cut and `more` are computed over rows the asker may open,**
    after ruling, so `more` is never a signal that unseen rows exist. In
    Fichas today every member sees every card (Fichas §6.1), so the per-row
    rule is vacuous there and binding for any app with a ladder.
  - **`page`:** a title, an app URL, `team_visible`, `more: bool`, and up
    to 40 **typed blocks**: `heading(level, spans)`, `paragraph(spans)`,
    `list(ordered, items[spans])`, `quote(spans)`, `code(text)`. A span is
    `text`, `emphasis`, `strong`, `code` or `link(spans, url)`. Embeds
    inside an embedded page are not expanded: one level only, so cycles
    cannot happen.
- **Two classes of URL, checked differently by the receiver's suite
  client:**
  - **App URLs** (every "open in app" and row URL) must be `https`, with
    no userinfo, and a host exactly
    `<own team>.<answering app>.oficina.works`.
  - **Author links** inside page spans, and Fichas card fields of kind URL
    (which a person typed), may be `http` or `https` only. Every
    other scheme (`javascript:`, `data:` and the rest) is refused by the
    decoder. They render with `rel="noopener noreferrer"`. They are not
    team-checked, because a person may link anywhere.
  - Both classes get hostile fixtures beside `hostile_hosts.json`.
- **Never cached.** A payload crosses no request boundary. **Doctrine §6.4
  is amended** by this proposal: "any passage shown to a person without an
  S2 `VISIBLE` **or an S10 `VISIBLE`** for that person in the same
  request".
- **Deadline and wake.** One deadline per page render, concurrent across
  siblings. It starts at **800 ms**, doctrine §14's unmeasured default, and
  is to be tuned by measurement. The embedding app **pre-warms** the
  siblings it embeds from when it wakes (doctrine §6.3), or the first
  render after idle would always say "did not answer". A page with more
  than 32 embeds makes several concurrent calls. Past 64 embeds, the rest
  render as nothing, and the page carries one note: "This page has more
  embeds than can be shown at once." A plain link would show where an embed
  the viewer may not open must render nothing (§7.1(2)).
- **Rendering:** one estilo partial per shape, so a Fichas card looks the
  same inside Mapa as inside Fichas.

**What S10 adds to a consumer token, stated plainly:** a holder of a
consumer token can already read every live item through S3 since revision
10. S10 adds **rendered, per-person views**: entry actors and times, which
Fichas' S3 body omits (Fichas §6.4), and saved views with their names and
columns. That goes in the suite leak list (doctrine §9) as a revision-12
entry. It is not presented as "says less than S3".

### 7.4 Team containers embed only team-visible items

Hiding a non-team embed at render cannot hide it everywhere. The reference
string sits in a team page's Markdown, which every member opens in the
editor, and it is in history, S3 and export. So the rule is enforced
twice.

**At render, always.** A team container renders nothing for a payload whose
`team_visible` is false, even for a viewer who could open the item. The
one exception is a notice, shown only to a viewer whose own answer was
`VISIBLE`: "This embed isn't shown here because it isn't shared with the
whole team." Without it the item's owner would see the reference in the
editor and nothing on the page. Nobody whose answer was not `VISIBLE` sees
the notice, so it reveals nothing. This
closes every path a reference can arrive by: restore, merge, "Make team
page", text typed during slice 1 before the check existed, a later import,
and the race between the write-time check and commit. It is also the
answer for an item moved down the ladder after it was embedded.

**At write, for references new in this save.** Only references that are
absent from the base revision are checked. So Bo can always save a page
that holds an embed Ana added, even if that item has since moved down.
- **The embedding app asks S10 with the writer as asker**, and reads
  `team_visible`.
- **`VISIBLE`, team-visible:** saved.
- **`VISIBLE`, not team-visible, in a team container:** refused, with a
  plain message.
- **`NOT_VISIBLE`:** refused with one message, identical for an unknown
  item and one the writer may not open. **When the sibling answers,**
  nobody can plant a reference to something they cannot see.
- **`UNKNOWN`, in Markdown:** the save goes through and the typed text is
  kept. There is no "unchecked" mark: references live only in memory
  (decision 14), so a mark would not survive hibernation, and the diff
  rule would never look at the reference again. **Render enforcement
  alone covers it.** A reference saved under `UNKNOWN` renders nothing in
  a team container unless its payload says `team_visible`. Planting one
  leaks only an id the writer already had. Refusing instead would make
  every page with an embed unsavable while Fichas is cold.
- **The same check runs on restore and on "Make team page"** for the
  references they bring into a team container. A private daily note may
  embed anything its owner can open.

**What the writer learns.** A writer who gets `VISIBLE` may open the item.
In Fichas and Mapa, learning whether it is team-visible tells them nothing
new. In a future app with a `granted` rung, a grantee learns the item's
rung. S1 deliberately carries no visibility flag, so `team_visible` goes in
revision 12's leak-list entry.

**Fichas → Mapa.** Every Fichas card is team-visible (Fichas §6.1), so a
card's reference field may reference **team Mapa pages only**. There is no
picker: no call lets Fichas list Mapa titles, and S1 carries none. The
person pastes a Mapa page URL. **A reference field is a typed value, so
Fichas refuses that one field on anything but `VISIBLE` with
`team_visible`,** `UNKNOWN` included, and the card still saves without it.
"Mapa did not answer, so this reference wasn't saved; try again." Given
that, and while Mapa answers truthfully, a teammate never sees an empty
reference field, or history naming a change to one, that points at
someone's private note.

**While both apps are lone shape,** "the team" means each app's own
admission list, and the two lists may differ. `team_visible` is the owning
app's statement about its own list. Provisioning both apps for one team
label from one roster (§10) is what makes the two lists agree.
- **What remains, and goes in the leak list:** an item that was
  team-visible when embedded, and that its app later moves down the ladder,
  leaves a reference string in team pages and their history. It renders as
  nothing. The string is an id. It is never a title or content.

### 7.5 The reverse direction

A Fichas card holds a reference to a Mapa page and asks Mapa's S10 for a
`page` payload for the viewer. Mapa answers `VISIBLE` for a team page to
any member, and `NOT_VISIBLE` for a deleted page. Given §7.4, a private
page never appears there.

### 7.6 What it needs from Fichas

- **Saved views,** for `list` embeds. List state already lives in the URL
  (`list.go`), so a view is a named, stored copy of that state per card
  type, with an id. **Both personal and team views** (Paul, 2026-11-12:
  "should be both"). A personal view is visible to its owner only, so S10
  answers `NOT_VISIBLE` for it to anyone else, and §7.4 means a team Mapa
  page may embed only a team view. One question is still open (§13). **It waits until
  `feat/level-up` merges** (as of 2026-11-12, `9976eb1`, one commit ahead
  of `origin/main`), because it touches the same handlers and templates.
- **An S10 server half for `card` and `list`.**
- **A reference field kind** on cards, for the reverse direction. This
  overlaps the "link to another card" field already open with Paul.

### 7.7 Mentions across apps (later)

A Fichas card showing "Mentioned in 4 Mapa pages", with context. This is a
second call: Mapa answers which team blocks reference item X. It is held to
slice 3, so S10 is proved first.

## 8. memoria

Mapa serves the producer half, S1, S2 and S3, from **slice 1**.

- **S1** lists every live page, daily and scratch included (revision 10).
  `gone` means deleted. Rows come from the event log, coalesced as in §5.
- **S2** is Mapa's own read check: `team` → every admitted member;
  `private` → its owner. The person is checked before any revision
  (doctrine §6.6).
- **S3** serves a layout that **omits absent parts and their separator**,
  as Fichas §6.4 does ("a card with only a title is exactly its title"):
  - A team page is its title, then a blank line, then the body. With an
    empty body it is exactly its title.
  - A daily note is its ISO date (fixed at creation, so memoria can answer
    by day), then a blank line, then the body.
  - A scratch page is exactly its body.

  The body is served **exactly as stored**:
  link text as typed, embeds as their reference string, never expanded. Its
  bytes change only when that page's revision changes (§3.2). memoria gets
  Fichas content from Fichas.
- **A removed member's private pages.** Doctrine §14 asks Paul whether
  ownership survives removal. **Until he rules, gate 5's reading holds**
  (doctrine §11 gate 5 and §14): losing team standing does not revoke
  ownership. So S2 keeps answering `private` → its owner, whether or not
  the owner is still on the roster. In the lone shape, "removed" means off
  the admission list. The person cannot sign in to Mapa, but S2, asked
  about them by name, still answers `VISIBLE` for their own pages. The
  doctrine's §4.3 alternative, "reaches nothing, ownership included", is
  marked there as an unruled proposal, and Mapa does not build it. Rows
  are kept: Mapa decides nothing about deletion before the ruling.
- **Egress** follows doctrine §8 unchanged. Until Paul rules, private pages
  are not embedded for semantic recall. memoria finds them by their own
  words only, and says so.
- **Conformance.** Mapa uses `conformance.CheckProducer` with pinned
  expectations, as Fichas does (Fichas §6.7). `fixtures/custody.json` at
  `91affa1` is static: each case is a state to seed, and no transition is
  driven. Mapa has two rungs and no grants, guests or links. Expected:

  | Case | Fixture state | Mapa seeds | Expected |
  |---|---|---|---|
  | `doc-team`, `doc-team-link` | team | a team page | passes, by honest representation |
  | `doc-private` | private, owned by the asker | a private page owned by the asker | passes, by honest representation (unlike Fichas) |
  | `doc-deleted` | deleted | a deleted page | passes |
  | `doc-was-team`, `doc-link`, `doc-link-added-late` | private, owned by someone else | someone else's private page | passes, by seeding equivalence. Mapa holds no link or move history, and the fixture asks for none |
  | `doc-guest` | granted to a guest only | someone else's private page | passes, by seeding equivalence: `NOT_VISIBLE` throughout, as the fixture wants |
  | `doc-granted` | granted to the asker | **cannot be represented** | **three pinned S2 failures**: the fixture wants `VISIBLE`, `STALE` and `UNKNOWN` at the current, prior and never-issued revisions. Mapa answers `NOT_VISIBLE` to each |

  **Seeding.** The fixture's private cases are seeded as **scratch
  pages**, so S3 is exactly the fixture's one-line `s3_body`
  (`conformance.go` compares bytes). A daily note always carries its date
  line and could not match. The team cases are seeded as team pages with
  the fixture string as the title and an empty body, so S3 is exactly that
  string.

  That is eight passing cases and one unrepresentable case. The final table
  is written from the running harness, as Fichas §6.7 was, and sent to the
  suite as evidence.
- **Later, not in the contract today:** outbound links in S3, so memoria
  can rank by the link graph.

## 9. Promote to Doc (later)

This creates a Docs document from a team page's Markdown through the
person's own session: the doctrine §7.1 hand-off, not a sibling write. The
Mapa page keeps a reference to the new document. The thinking stays in
Mapa, and the published version lives in Docs.

## 10. Where things live

- **Repository:** `amadan.net/oficina/mapa`, created on the hub when Paul
  approves this spec. Until then, a local repository only.
- **CARLOS:** account `oficina`, sqid `bds`, app `mapa`, channel `edge`
  (`teams/provision-team.py`).
- **Host form: a prerequisite, and Paul's.** The suite client accepts only
  `<team>.<app>.oficina.works` (`CheckSiblingHost`), and
  `hostile_hosts.json` refuses bare `docs.oficina.works`. Paul's own
  instances serve bare hosts today (`fichas.oficina.works`), so no sibling
  call can reach them. This is the same question already waiting on Paul
  for the memoria hookup: **his team's label.** Mapa launches on
  `<label>.mapa.oficina.works` from day one. **Paul, 2026-11-12: the team
  stays in the hostname** (home ruling 16 stands). `mapa.oficina.works` is
  the front door, which sends you to your last-used or only team and has a
  team switcher. `mapa.oficina.works/<team>` redirects to
  `<team>.mapa.oficina.works`. A self-hosted Mapa keeps its oficina.works
  name through a DNS record pointing at its own server, never through a
  proxy of ours. Fichas needs the same before S10 can work, and both
  apps join `provision-team.py`'s `APPS` (Fichas is not in it today).
- **Framework:** rastrillo at its current module path. Sign-in is the
  Oficina door, with Docs' `auth_navigation.go` keymail continuation ported
  from the first commit.

## 11. Testing gates

The suite conformance harness (S1/S2/S3) runs in CI from slice 1, and S10
from slice 2. On top of that:

1. **Scope leaks nothing.** Bo's search results, their order, ⌘K's Create
   offer, `[[` autocomplete, backlinks, unlinked mentions, and the report
   from "Update links" are **byte-identical** whether or not Ana's private
   notes contain the term, link to the page, hold a pending link with that
   text, or link to a block in it. Linking from a private note never writes
   to the target page. A mutation
   test proves the gate fails when one scope check is removed.
2. **Titles cannot reveal anything.** No path lets a private page claim a
   title. "Make team page" with a taken title asks for another. A
   date-shaped title or alias is refused on create, on rename and on "Make
   team page".
3. **Renames keep links and keep revisions honest.** After renaming B,
   every `[[Old]]` resolves to B. Page A's revision and S3 bytes are
   unchanged.
4. **The plaintext gate.** Dump the database file. No title, alias, date,
   body, link, reference or `^id` appears in the clear, and the plaintext
   columns are exactly §4's list. This is Fichas' gate, ported.
5. **Embeds** (slice 2). `NOT_VISIBLE` renders nothing. `UNKNOWN` renders
   loudly and names the app. No payload byte reaches the database or the
   index. Embedded pages do not expand embeds. A team container refuses a
   non-team item at write. A Markdown save under `UNKNOWN` goes through and
   renders nothing until the payload says `team_visible`. A Fichas
   reference field under `UNKNOWN` is refused while the card saves. Only a
   `VISIBLE` viewer sees the "not shared with the whole team" notice.
   Hostile app URLs and author-link schemes are refused.
6. **Speed at size.** A 10,000-page synthetic fixture. §6.1's warm targets
   are asserted. The cold-wake figure is measured and recorded.
7. **Scriptless.** `make browser` walks today's note, ⌘K, create, link,
   save and conflict with JavaScript off, then on, and fails on any console
   error.
8. **Event completeness.** Every write path logs an event, except draft
   writes and retention, which are exempt by name (§5). A mutation test
   proves the check works.
9. **A removed member** (§8). Taking a real member off the admission list
   stops them signing in. Under gate 5's reading, S2 still answers
   `VISIBLE` for their own private pages. When Paul rules on doctrine §14,
   this gate is rewritten to his ruling.
10. **No trace of an unwritten day.** Opening today's note and leaving
    without typing creates no row, no draft, no event and no S1 entry.
11. **Drafts.** Autosave never changes a page body or revision in place.
    No `GET` commits. A closed tab's draft is offered on return as Save or
    Discard. A same-block conflict leaves the draft uncommitted. A base
    revision past the window gets the side-by-side view. A deleted page's
    draft is offered as a scratch page. A stale tab cannot overwrite a
    newer draft. Drafts are discarded 30 days after their last write.
    "Ana is editing" never appears for a private page.
12. **Render enforcement** (slice 2). A team page whose text holds an embed
    of a non-team item renders nothing for it, whatever path brought the
    text in.

*Amended by the Notion import:* its gates I1 to I19 (its spec §18; I14
with Mapa images) join these, and M1 to M8 hold the notion module.

## 12. Deliberately not built

| Thing | Trigger |
|---|---|
| Real-time co-editing | Same-block conflicts annoying people in real use |
| The `granted` rung | Someone asks to share a daily or scratch note with one colleague |
| Properties, tables, typed fields | Never in Mapa (decision 3) |
| Graph view | Enough pages that a map tells you something a backlink list does not |
| Folders | Never as the primary structure |
| Public publishing | A real need. Docs is the publishing path first |
| Plugins | Never as a general mechanism |
| Import from Obsidian, Reflect | Paul has a vault to bring. **Notion is met** by the Notion import (`2026-11-17-notion-import.md`), phase 1: pages into Mapa |
| Native Mac app | The web app has been lived in |
| AI features | After memoria's AI answer has been lived with. Doctrine §8 governs it |

## 13. Open — for Paul

1. ~~Document or outliner~~ **Ruled: document** (Paul, 2026-11-12).
2. ~~Shared namespace; only team pages hold titles~~ **Ruled: yes to
   both** (decisions 6 and 7).
3. ~~Your team's label~~ **Ruled: `paulca`**. Paul's teams are `paulca`,
   `campbells`, `tito`, `carlos` and `test`, created by Alta (see oficina
   `portero` Part B).
4. **Saved views in Fichas.** ~~Personal, team, or both?~~ **Ruled: both**
   (Paul, 2026-11-12). Still open: when a field a view filters on is
   removed, does the view break loudly or drop the filter? **Ruled: break
   loudly.**
5. **A Fichas reference field** (§7.6): is it the same thing as the "link
   to another card" field already open, extended to any Oficina item?
6. ~~Date links open your own daily note~~ **Ruled: yes** (§3.4), with
   its stated cost.
7. ~~Slice 1 without embeds~~ **Ruled: yes** (Paul, 2026-11-12: "makes
   sense").
8. ~~History window~~ **Ruled: 90 days of page history, abandoned drafts
   kept 30 days** (§5).

## 14. Slices

**Slice 1: a knowledge base someone can live in.** No embeds: Paul ruled
on 2026-11-12 that slice 1 ships without them.
1. The repo, rastrillo scaffold, schema, seal, event log and the plaintext
   gate.
2. Team pages, the shared namespace, aliases, `[[links]]`, backlinks,
   pending links, and the §3.4 verbs.
3. Daily notes and scratch pages. "Make team page".
4. The in-memory index with per-viewer scope, ⌘K, the search page, and
   gates 1 and 6.
5. The scriptless editor, then the script layer.
6. The S1/S2/S3 producer half with pinned conformance. Wire it to memoria
   once Paul approves the hookup and gives the team label.

**Slice 2: embeds.**
1. Suite revision 12: S10, its fixtures, the doctrine §6.4 amendment, the
   leak-list entry, and estilo's three partials.
2. Fichas: the team label and provisioning (§10). Saved views after
   `feat/level-up` merges. The S10 server half and the reference field.
3. Mapa: embeds of cards and views, the S10 server half for pages, and
   pre-warm.
4. Fichas: embedded Mapa pages on cards.

**Slice 3:** mentions across apps (§7.7), Promote to Doc (§9), and vault
export (decision 15).

## 15. Build notes (slice 1)

Places where the build had to choose because this spec is silent or
ambiguous. Each is the smallest reasonable choice, with its reason. None
changes a ruling. A reviewer who disagrees with one changes the code and
this list together.

1. **`pages.gone` is plaintext.** §4's table does not name it. It is S1's
   `gone` (§8) and must answer without the key, so it is classed under the
   "ids, `kind`, `rung`" row. It leaks how many pages were deleted.
2. **Drafts carry a random `version`.** §5's two-tab check needs one. It is
   redrawn on every draft write and is random, not a counter, so it shows
   only that a draft changed, which `updated_at` already shows.
3. **Events name an object kind.** §3.1's event row says "object". Gate 8
   needs every write logged, and a person's member row and time zone are
   written too, so an event's object is a page or a member
   (`object_kind`). Its vocabulary is Mapa's own.
4. **Members carry no timestamps**, so their plaintext is exactly §4's
   "member `id`, address print".
5. **A member row is created by the person's first write**, not by signing
   in or opening a page. A `GET` never writes (§5), and gate 10 forbids any
   row for an unwritten day.
6. **`MAPA_TIME_ZONE` is the team's time zone** (§3.1's "instance setting
   in config"), and UTC when unset.
7. **Mapa wears the suite's Oficina accent and mark.** estilo's ring is a
   closed set that only Paul changes, and it has no Mapa hue or icon yet.
   Placing Mapa on the ring is his call.
8. **Link syntax cannot be a title.** A title or alias may not contain
   `[`, `]`, `|`, `#` or `^`, which `[[Title#^id|shown]]` needs, and is at
   most 120 characters. The date reservation of §3.4 refuses any
   ISO-date shape, including one that is no real date (`2026-02-30`).
9. **Restoring a deleted daily note** brings it back as that day's note.
   If the person has since written a new note for that day, it comes back
   as a scratch page headed with the date, because a day holds one note.
10. **The Markdown is Mapa's own subset**, not CommonMark: paragraphs,
    headings, list items, quotes, code fences and rules, with emphasis,
    inline code, `[[links]]` and `http`, `https` and `mailto` links. No raw
    HTML is ever rendered. A block is exactly §3.2's, which the block merge
    and `^id` markers need, and the parser's typed blocks are what S10's
    `page` payload (§7.3) will carry.
11. **"Update links" keeps each link's `^id` and shown text**, and changes
    only the target text. It runs over the candidates the in-memory index
    finds in the actor's scope, and the store checks each again before
    editing it.
12. **A deleted page's title prints, aliases and daily print are removed
    with it**, so the title and the day are free at once (§3.4). A restore
    does not bring the aliases back: it is a new page at its first
    revision.

13. **A scratch page is created by its first save**, as a daily note is:
    "New scratch page" opens an empty editor and writes nothing until Save
    carries some text.
14. **`/d/<date>` always means the viewer's own note for that date.** It
    is where every date link leads, so the link is the same bytes for
    every reader and resolves per viewer at request time. An unwritten day
    still lists its backlinks: the team pages, and the viewer's own, that
    link that date.
15. **The time zone is typed as an IANA name** ("Europe/Dublin") and
    checked on the server, so the setting works with scripts off. Settings
    and Deleted pages sit in the account menu, beside Appearance.
16. **`Store.MayRead` is S2's rule**, built now as the seam for item 6:
    a team page for every admitted member, a private page for its owner
    whether or not they are still admitted (gate 9, under gate 5's
    reading). Nothing serves it over the suite contract yet.

17. **Gate 6's cold wake is measured: 1.34 s** from opening the database
    to the first search answered, at 10,000 synthetic team pages, on Paul's
    development Mac (Apple silicon), not production hardware. Warm, through
    the real handler with its JSON: ⌘K search p50 0.33 ms, p95 0.65 ms;
    `[[` autocomplete p95 0.16 ms. §6.1's 2 s cold target held here, but
    this is one machine; the gate logs the figure on every run and fails
    only past 10 s.
18. **Writers keep the index current; readers only read** (review M3
    and its follow-up). Fichas asks `MAX(events.id)` on every request
    and the reader that notices a change replays it. In Mapa every write
    goes through `Store.write`, which, after its transaction commits,
    catches the index up in the writer's own request. A reader takes only
    the read lock and never parses someone else's write, so Bo's query
    costs the same whatever Ana just wrote. Writes another process makes
    (two processes share the file during a CARLOS zero-downtime swap)
    are caught up off-request by a watcher that reads the log's head
    about once a second and takes the write lock only when the index is
    behind. It commits nothing, so it is not one of the timers doctrine
    §13 rules out. The first read after a wake loads everything. The
    viewer cache still follows an in-process write count.
19. **Ranking details §6.2 leaves open.** Titles and aliases match when
    every query word starts a word of the title. They rank exact title
    first, then titles the query begins, then the rest. Bodies need every
    word, the last as a prefix. A prefix stands for at most its 32 most
    frequent terms in each partition. One typed letter searches titles
    only. BM25 uses k1 1.2 and b 0.75. The backlink boost is
    0.5 × ln(1 + team pages linking here), applied to the head of the
    BM25 order. The viewer's own daily notes also match by date prefix.
20. **`[[` autocomplete's "the viewer's own pending link texts"** is read
    as the pending texts in the viewer's scope: those typed in team pages
    (which every member reads) and in the viewer's own private pages. They
    are partitioned like the postings, so a query never reads another
    person's.
21. **Print keys are derived apart from sealing keys** (HKDF info
    `oficina/mapa:print:<purpose>`), so no key both encrypts and prints.

22. **The keystroke-to-paint target is asserted as keystroke to results
    in the page**, warm, at 10,000 pages: p50 6 ms, p95 9 to 12 ms on the
    development Mac. Paint follows in the next frame on a real screen.
    Headless Chromium has no display to pace frames: its next animation
    frame came 20 to 150 ms after the list had rendered, and a DevTools
    key event waits for that frame too. So the test types from inside the
    page and logs the headless frame time without asserting it. Paul or a
    reviewer may want this confirmed by hand in a real browser.
23. **The block merge refines diff3.** Where both sides kept the same
    number of blocks in a changed stretch (edits in place), each block is
    resolved on its own, so Ana's edit to one block and Bo's to the next
    do not conflict for being neighbours. A save that needs no merge
    keeps every byte. *Revised by the level-up (§6.4, D13):* a merged
    body keeps the current revision's bytes too. Its blocks, and the
    bytes between two of its blocks that are still neighbours, are
    emitted as they are; blocks taken from the saver's text bring their
    own source and seams; only a seam where the two sides meet is
    re-joined with one blank line (a tight list stays tight). If the
    result would not parse back to the settled blocks, the whole body is
    re-joined that way instead. Resolve's chosen text settles the same
    way.
24. **A conflict offers Yours, Theirs, or Both (yours first)** for each
    block both people changed. With no merge base, it is Yours or Theirs
    whole. Choosing only what is saved now discards the draft and commits
    nothing. "Decide later" leaves the draft as it is.
25. **New pages have no autosave until their first Save.** A draft is
    keyed by a page or by a day (§3.1), and a new team or scratch page has
    neither until it exists, so its text is lost if the tab closes before
    Save. A fix needs a draft key of its own (a random id from the tab):
    a new plaintext column, so a change to §4's list. It is left as a
    known limit (README), after review.
26. **Where a closed tab's draft is offered** (§5): on its page, and on
    today's note. Today's note also offers drafts on deleted pages ("Save
    as a scratch page" or Discard) and links to drafts on other pages.
27. **Retention runs when the app wakes** (the platform runs no timers):
    drafts past 30 days, revisions past 90 days except each live page's
    current one, and a page deleted more than 90 days ago loses its
    revisions and sealed record but keeps its gone row for S1. Like draft
    writes, it is exempt from gate 8 by name. Between wakes, every read
    already ignores what has aged out.
28. **Restoring from history restores the body.** The title stays as it
    is: taking an old title back is a rename, with the namespace's
    checks. The event's verb is `reverted`.
29. **The script layer's timings**: an autosave 1.2 s after typing stops;
    the commit two minutes after the last autosave; a pending autosave
    flushed when the tab closes. ⌘K is ⌘K or Ctrl+K, and its Create offer
    is the last row. The time zone offer remembers "Not now" for that
    browser zone.
30. **GORM's automatic timestamps are off** on pages and drafts: the store
    sets every time from its own clock, so the history window, the draft
    window and "is editing" all count from the same clock.

31. **A stale tab never destroys a newer draft** (review M1). Save and
    Discard carry the draft version their page showed. A Save from a tab
    that had not seen the person's newest draft still commits when it can
    (outcome Kept), and the draft is kept with its base unchanged, so
    committing it later merges against that save. Re-basing it onto the
    new revision instead would let it overwrite the save. A stale Save
    that cannot commit without a choice is refused, and the editor shows
    that tab's text again. A stale Discard is refused, and the draft is
    offered again as it is now.

32. **Pages are named in URLs by a random public id** (review M2): the
    page nonce, written once at creation, in base 36 (`/p/2kq9xw3m1ab`),
    with a unique index. The sequential row id stays inside the store. It
    counted everyone's pages, private ones included, so `/p/1` then
    `/p/5` told Bo that someone had written three private pages between.
    Alias ids in a team page's rename form stay sequential: they count
    renames of team pages, which every member can see in history anyway.
    Gate 1 now interleaves Ana's private writes with the team's pages,
    drawing team and private nonces from separate repeatable streams in
    the test, and `make mutate` holds that it catches a link drawn from
    the row id.

33. **Small rules the review's lows added.** A deleted page restores
    once: the restore moves its text into the new page and leaves only
    the gone row (L3). A merge base, a conflict's base and history all
    stop at the 90-day window even before retention runs (L2). A query
    reads at most 16 words of at most 512 bytes (L6). A return address
    with a control character or a backslash is refused (L4). Unlinked
    mentions are checked in display order and stop at 100, and gate 6
    times page views, a title of the commonest words included, against
    50 ms (L5).

---

## Appendix A — revision 2's answers to the Fable review of revision 1

| Finding | Answered in |
|---|---|
| H1: S9 reserved, S7 retired | §7.2: S10 |
| H2: search, ranking and Create unscoped | §6.2, §6.3, gate 1 |
| H3: non-team embeds visible in source, history, S3 and export | decision 13, §7.4, §7.5 |
| H4: Markdown and URLs crossing apps | decision 12, §7.3 typed blocks and two URL classes |
| H5: bare hosts fail `CheckSiblingHost`; subject kind | §10, §13 item 3, §7.3 subject kind |
| M1: four values without a revision | §7.3: three values |
| M2: "says less than S3" false | §7.3: "What S10 adds", leak-list entry |
| M3: per-row citation; `more` | §7.3 `list` |
| M4: S3 bytes under rename | decision 9, §3.2, §8, gate 3 |
| M5: custody fixture cases | §8 conformance table |
| M6: removed owner | §8, gate 9 |
| M7: plaintext list incomplete; plaintext graph | decision 14, §3.1, §3.2, §4, gate 4 |
| M8: unspecified verbs | decision 8, §3.4, §6 time zone |
| M9: block ids under a textarea | §3.2 `^id` markers |
| L1: precedent numbers | §6.1 |
| L2: memoria citation | §0, decision 1: Fichas decision 1 |
| L3: unused rulings cited | header |
| L4: ordinal | decision 1 |
| L5: account | §10 |
| L6: level-up stale | §7.6 |
| L7: deadline, pre-warm, caps, no-store | §7.3, §6 |
| L8: creation on open, autosave churn | §5, §6, gate 10 |
| L9: doctrine §6.4 | §7.3 |

### Round 2 — Fable's re-review of revision 2 (`2345d97`)

| Finding | Answered in |
|---|---|
| H1: removed member inverted | §8, gate 9: gate 5's reading, ownership holds |
| M1: write-time check gaps and race | §7.4: render enforcement, base-revision diff, each S10 value, restore and Make team page; gate 12 |
| M2: `^id` minted from a private note | §3.2: minted only by an edit to the target page; gate 1 |
| M3: coalesced autosave storage | §3.1 draft, §5, gate 11 |
| M4: plaintext list | §3.1, §4: nonces, revision store, drafts, members, sessions; 90-day window |
| M5: text-keyed links trade-off; Update links scope | decision 9, §3.4, gate 1 |
| M6: conformance table | §8: eight pass, one unrepresentable with three pinned failures; S3 layout |
| L1: zero frequency; timing | §6.2: smoothing, partitioned postings |
| L2: date link format, refusals, time zone | §3.4, gate 2, §13 item 6 |
| L3: restoring a deleted page | §3.4: new id |
| L4: past 64 as links | §7.3: render nothing plus a page note |
| L5: URL fields, picker, lone-shape lists | §7.3, §7.4 |
| L6: daily note date in S3 | §8 S3 layout |

### Round 3 — Fable's conditional approval of revision 3 (`057d474`)

| Finding | Answered in |
|---|---|
| M1: S3 layout fails the byte comparison | §8: absent parts omitted; private cases seeded as scratch pages |
| M2: draft commit on `GET`; unattended conflicts | §5: every commit a `POST` by the person; conflicts stay drafts; window, deleted page, tab version check, 30-day retention; gate 11 |
| M3: `UNKNOWN` saves, the lost mark, the orphaned sentence | §7.4: render enforcement alone for Markdown; Fichas refuses the field; sentence qualified; gate 5 |
| L1: "Ana is editing" | §5, §4 leak list |
| L2: owner sees nothing | §7.4: notice for `VISIBLE` viewers only |
| L3: §13 numbering | §13 |
