oficina / mapa Public

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

Plain git — no account needed to clone.

Download

Download this file

1# 🤖 mapa
2
3The Oficina suite's knowledge base. One instance per team.
4
5Linked notes for a team: pages of Markdown, `[[links]]` between them,
6backlinks, and a daily note for each person. Fichas is the team's
7database, Docs is where the team publishes, and Mapa is where the team
8thinks. memoria indexes all three.
9
10## Status
11
12**Slice 1, items 1 to 5, is built** on `feat/slice-1`, for review. Nothing
13is merged or deployed, and there is no CARLOS app. Item 6, the suite
14producer half (S1, S2, S3), waits for the team host (see below). Embeds,
15S10, Fichas, the graph view, export and Promote to Doc are later slices.
16
17## The design
18
19`docs/superpowers/specs/2026-11-12-mapa-design.md`, approved by Paul on
202026-11-12. Read §1 first, then §13 for his rulings. §15 lists every
21build note: a place the build had to choose where the spec was silent.
22
23## What works
24
25- **Today** is your daily note, in your own time zone, created by its
26 first save and never by opening it.
27- **Team pages** share one namespace: create, edit, rename (the old title
28 stays an alias), free an alias, delete through a confirm page, restore
29 a deleted page as a new one, and update links after a rename.
30- **Links**: `[[Title]]`, `[[Title|shown]]`, `[[Title#^id]]`, pending
31 links that offer to create their page, date links that open your own
32 note, backlinks with their context, and unlinked mentions with "Link
33 it". "Link to a block" mints a `^id` as an edit to that page.
34- **Scratch pages**, and **Make team page** from chosen blocks of a
35 private note.
36- **Search**: `GET /search?q=`, and ⌘K with scripts on. Team-only ranking
37 statistics; every read scoped to team pages and your own.
38- **Editing**: a textarea and Save, revision-checked and merged by block,
39 with a conflict view when two people changed the same block. With
40 scripts on: live preview, `[[` completion, link paste, and autosave
41 through your draft, committed on Save or after two minutes idle.
42- **History** for 90 days, with restore; abandoned drafts kept 30 days.
43- **Import from Notion** (`docs/superpowers/specs/2026-11-17-notion-import.md`,
44 phase 1): pages shared with a read-only Notion integration become team
45 pages, with mentions, dates and nesting as links. Re-runnable until
46 Finish: an untouched page updates, an edited one is kept, nothing is
47 deleted on absence. Only the people in `MAPA_IMPORTERS` (each also in
48 `MAPA_OWNERS`) see it; unset, its routes do not exist. Images are left
49 as a line saying they were not imported until Mapa has images.
50
51## What the Notion import leaks
52
53Beside spec §4's list (its §5, §15):
54- **Mapa holds a Notion token** while a connection exists, sealed, never
55 rendered, deleted on Disconnect, on Finish and after 90 days unused.
56- **Mapa dials `api.notion.com` and Notion's file hosts**, only through
57 the pinned `amadan.net/oficina/notion.git` module, during a run and
58 once when a token is saved. Notion and its storage provider learn the
59 instance's egress address and when it imports. No content goes out.
60- **The file shows** when imports ran, who ran them, how many Notion
61 pages they saw and wrote and how many failed, and, through the event
62 log, which team pages an import created and roughly their order in
63 Notion. Not their titles, bodies or Notion ids.
64
65## Known limits
66
67- **A new page's text is lost if its tab closes before the first Save.**
68 Autosave writes a draft, and a draft is keyed by a page or a day (spec
69 §3.1); a new team page or scratch page has neither until it is saved.
70 Keeping it would need a draft key of its own (a random id from the
71 tab), which is a new plaintext column and so a change to §4's list. It
72 waits for a review of that change (spec §15, build note 25).
73- **Addresses are in the clear in rastrillo's sign-in rows**, as in every
74 sibling (spec §4). Sealing them is a suite-wide follow-up in rastrillo.
75
76## Seams for item 6 (S1, S2, S3)
77
78The producer half needs the team host (spec §10) and Paul's approval of
79the memoria hookup. What it will stand on is already built and tested:
80
81- **S1** is the event log: `events` holds one row per write, with a
82 random nonce for the cursor, written in the same transaction as the
83 change (gate 8). Pages carry their own nonce and random revisions.
84- **S2** is `Store.MayRead`: team pages for every admitted member,
85 private pages for their owner, whether or not still admitted (gate 9).
86- **S3** is `Record.S3`: §8's layout, absent parts omitted with their
87 separator, the body exactly as stored.
88- What remains is the suite contract module, `conformance.CheckProducer`
89 with §8's pinned expectations, and the routes, as Fichas has them.
90
91## Deploying
92
93`make release` builds `releases/mapa-linux-arm64`. Ship it declaring that
94the build sends through CARLOS mail submission, then promote it:
95
96 carlos ship --app mapa --account bds --mail submit \
97 --version "$(git describe --tags --always)" releases/mapa-linux-arm64
98 carlos promote --app mapa --account bds <version>
99
100`--mail submit` is what lets `carlos email submission on --app mapa`
101switch Mapa's mail to the platform: every instance must run a build
102shipped with it. Until then Mapa keeps sending over `CARLOS_SMTP_*`, and
103after it the agent sets `CARLOS_MAIL=submit` and Mapa holds no mail
104credential (`mail.FromCarlos`, `internal/mapa/mailer.go`). `carlos
105deploy` has no `--mail` flag yet (carlos main 9eec0236), so ship and
106promote instead of deploying in one step.
107
108## Working on it
109
110`AGENTS.md` is the source of truth for the code. `make ci` is the gate;
111`make browser` is gate 7 and `make mutate` proves gates 1, 4 and 8 can
112fail. `make preview` serves the real app over synthetic pages.
113