URL and DOM: a place, and a place inside it
Status: 2026-11-27, v3. Step 1 implemented locally (not published): npm/src/place.ts (the place),
npm/src/record.ts (the record in .me), entry this.url/place; tests in npm/tests/. Steps 2-4 not implemented. The four decisions are approved (§7); the
URL ↔ me:// contract was corrected first (§1), as the review required.
The use case that sets the bar: I opened the German Shepherd article on Wikipedia, went to the 1990 section, highlighted three lines and tagged two friends. They have to land right there.
Two structures
URL (this.url) |
DOM (this.DOM) |
|
|---|---|---|
| Shape | a graph: pages and the links between them | a tree: what is inside one page |
| A node | a page | an element, or a span of text inside it |
| Navigated by | following links (the crawler discovers and indexes) | going down branches (section, paragraph, line) |
| Joined | each page has one DOM tree | each DOM tree belongs to one page |
Cleaker navigates and indexes both; .me keeps the references, the highlights and their audiences.
1. A URL, declared (this.url) — the contract
The structured place is the source of truth; href is its exact, reversible serialization.
place("https://es.wikipedia.org/wiki/Pastor_alemán?oldid=123#Historia") = {
href: "https://es.wikipedia.org/wiki/Pastor_alem%C3%A1n?oldid=123#Historia", // exact; place(href).href === href (normalized by WHATWG URL)
scheme: "https",
host: "es.wikipedia.org",
path: ["wiki", "Pastor_alemán"], // segments as an array: a "." or "/" inside a segment is never a separator
query: [["oldid", "123"]], // CONTENT address (which revision). Not an NRP selector.
fragment: "Historia", // the page's own fragment, kept as is
}
me:// addresses the RECORD, in the saver’s own tree — never the external host. (v3, replaces the v2 “alter ego”,
which turned es.wikipedia.org into a namespace and lost information.)
me://suign.cleaker.me:read/web.pages.page_<32 hex>
↓ resolve (the normal NRP read: namespace, disclosure, audience)
{ type: "this.url", version: 1, href, scheme, host, pathname, search, hash }
↓ href
https://es.wikipedia.org/wiki/Pastor_alem%C3%A1n?oldid=123#Historia
- Two addresses, two jobs:
me://locates the record in your tree;https://locates the external page. Wikipedia gets no .me namespace, and the NRP selector keeps its meaning (an HTTP query is content, never[selector]). - The record stores text only:
hrefis the truth;scheme,host,pathname,search(''none,'?'empty),hash(same) are derived and checked on every read (a record that disagrees with its href is refused). Segments and query parts are derived when reading, never stored. - Identity: a random opaque id
page_<32 hex>: stable if the URL is updated, reveals no order, cannot be derived from the href. - Deduplication: a private index
web.index.h_<sha256(href)>→ id, under the same audience. Saving the same href reuses its record; a duplicate is explicit. Equality for now: identical normalized hrefs only; another revision, query or fragment is another place. Equivalences are a later, explicit policy. - Because the record’s path is built from keys we choose (
web.pages.page_…), it never carries accents,%or foreign dots: the existingme://parsers need no change for it. - Proven end to end (tests/resolve.e2e.test.ts): saved in a disposable monad, found again with
cleaker('me://…:read/web.pages.<id>').resolve()(HTTP to the monad’s NRP read), not by reading the kernel.
What moves into this.url from where it lives today (cleaker and GUI then import it; behavior unchanged):
cleaker surfaceOf/positionOf; GUI atParam, pagePlaceUrl, placeAfterHost, readArrivalPlace, takeArrival.
The question this package owns: when are two places the same (/index.html vs /, a trailing slash, another
revision of the same article).
The crawler stays, rebuilt for this: it reads a page’s links resolved against the page’s own URL
(new URL(href, page); today /wiki/Algo gets http:// prepended, which is wrong) and returns places + edges. No log
files, no media downloads, no shadowing of the global URL; it fetches only where allowed (a server, §5).
2. A place inside the page, declared (this.DOM)
anchor = {
path: ["body", "#content", "#mw-content-text", "section[2]", "p[3]"], // segments as an array, like the URL path
text: { quote: "En 1990 era una de las razas…", prefix: "…", suffix: "…", start: 412, end: 530 }
}
- The path goes back to the element:
resolve(document, path)→ the element (missing today). Segments:tag,#id(when the element has one),tag[n](n-th of that tag among its siblings). No classes: pages change them with JavaScript (client-nojs→client-jschanged every path on Wikipedia). Serialized with the same quoting rule as §1, so an id with a dot stays one segment (today.is both the separator and the class prefix:.client-js..mediawiki..cannot be read back). - Text, not only elements. this.DOM’s tree already keeps full text in its text nodes (only the per-element preview is cut at 120 characters). What it lacks is the selection anchor: the quote, a little context before and after, and its position (W3C Web Annotation TextQuote + TextPosition). If the page changed, the anchor is found again by its quote and context, not only by its path.
- Measured on es.wikipedia “Pastor alemán”: 1667 elements, 13 ms, 0.6 MB as JSON. Wikipedia’s ids (
#Historia,#mwKA) are stable per revision, sooldid+ path is a firm address.
3. The two together, in one address
The page’s own fragment and the DOM anchor are kept apart, so #Historia keeps its meaning. The boundary is the
fragment directive delimiter browsers already reserve, :~: (what text fragments use):
https://es.wikipedia.org/wiki/Pastor_alem%C3%A1n?oldid=123#Historia:~:dom=…&text=…
\________________ place.href (exact, with its own #Historia) _______/\__ anchor ___/
A browser that supports fragment directives (the same ones that support text fragments, §4) strips everything from
:~: out of location.hash, so the page sees only #Historia; an older one passes #Historia:~:dom=… to the page,
which then finds no element with that id and stays at the top. this.url/this.DOM read the directive either way. In the structured form they are simply two fields: { place, anchor }.
4. The invite lands inside the DOM
The card (“Someone shared a place with you”) resolves the shared reference to { place, anchor }, keeps the original
address, and offers two ways in:
- Go there (the site itself):
place.href+ a text fragment built from the anchor (#Historia:~:text=En%201990-,era%20una,populares). The browser scrolls to those lines and highlights them (Chrome/Edge, Safari 16.1+, Firefox 131+); where unsupported it still lands on#Historia. A site we do not run cannot be told more than that. - Open in .me (inside the graph): the page is read on the server (§5), parsed by this.DOM, shown as nodes of the .me graph, the anchored span marked and focused.
5. Rendering inside the .me graph
GUI already draws .me as a graph (the LLMS graph: {nodes: [{path, value}], edges}), so URL and DOM become .me paths
and the same renderer draws them. Two capabilities, each with its own test: drawing the nodes, and resolving a
node back to its exact place/element (a node’s identity is {place, anchor}, not its label).
web.pages.<id> <- a page (its this.url record)
web.<…>.links -> … <- edges to other pages (crawler)
web.<…>.dom.<anchor path> <- inside it (this.DOM), the highlight focused
Reading a foreign page needs a server fetch (browsers block cross-site reads). That fetch is a request the server makes on someone’s behalf, so it gets the guard the monad already applies to the mesh bridge: public http(s) only, never loopback/private/metadata addresses, size and time limits, no cookies.
6. Private places: sealed for their audience (implemented locally, this.url/sealed)
The monad answers a read public (everyone) or closed (everyone, the owner too): its “opened with key
material” disclosure is not implemented (pathResolver.ts). A .me audience is not a list checked at the door: it is
the set of keys that can decrypt. So a private place is sealed on the client (this.me sealAudience, exported for
this) and stored as an opaque envelope; resolving its me:// returns the envelope to anyone, and only a member’s key
opens it.
- Record:
{ type: "this.url/sealed", version: 1, envelope }atweb.pages.<id>; the envelope carries neither the URL nor its host.openPlace(value, keys)opens it and checks the record inside (href and derived fields). - Index:
web.index.k_<HMAC-SHA256(indexSecret, href)>→ id. Without the saver’s index secret a guessed URL cannot be looked up (a plain hash would let anyone test URLs). Reuse opens the indexed record and requires the same href. - Proven end to end on a disposable monad through
me://(tests/resolve.e2e.test.ts): the resolved wire has nowikipedia/Pastor/oldid/Historia/https://; a member opens the exact href, an outsider cannot; a plain hash of a guessed URL finds nothing; the saver reuses with the secret. - Not solved here: how members’ public keys are found (the kernel leaves key distribution out of scope), where the saver keeps the index secret (it must not be stored in the clear in the same tree), and concurrent dedup.
The highlight follows the same shape: highlights.<id> sealed for [author, ana, pablo], holding
{ place, anchor, quote, by, at }.
7. Decisions (approved 2026-11-27)
- Path segments are arrays, kept raw. (v3: no longer serialized into a
me://path at all; the record’s address uses our own keys, §1.) #/:~:: the page’s own fragment and the DOM anchor are kept separately (§3).- The crawler’s index lives in the tree of whoever starts the indexing, private by default. A namespace can keep a shared index only by an explicit operation, with its audience declared. Visiting a URL never publishes browsing history.
?at=for a highlight is a pointer by default: the author’s namespace +highlights.<id>. Resolving it respects the audience; knowing the link grants nothing. The full anchor in the link is an explicit option for public content only, because a quote in a link travels outside the tree’s restrictions.
Order of work
- this.url:
place(), the record in .me (random id, dedup index, checked reads),this.url/place, resolution proven throughme://(done locally); the place code from cleaker/GUI copied with parity tests (they switch to importing this.url once it is published); still open: the crawler with relative links resolved. - this.DOM: path as segments + reversible serialization +
resolve(); the text anchor + re-anchoring; tested on real pages. - The invite: resolve the pointer (audience-checked), Go there with a text fragment; then Open in .me.
- The server fetch with its guard; drawing and resolving in the graph; the highlight record.
See also
- Place: A URL, declared: the exact address as data.