Files
shard-wiki/research/260614-trilium-deep-dive/README.md
tegwick 5697669063 research: Trilium (TriliumNext) deep dive (note cloning/DAG hierarchy, attribute inheritance, HTML-native); UC-66/67
SQLite-local PKB whose standout is note cloning — a single note can sit in
multiple tree locations at once via the note (identity) vs branch
(placement) split, so the hierarchy is a DAG, not a tree, with no single
canonical path. The identity-not-equal-placement model is the clean way to
represent a page in multiple locations/shards and the namespace-level form
of the clone/reference primitive. Also: attributes (labels + typed
relations) are inherited + templated, so metadata is computed (own +
inherited + template), not a flat bag; content opacity is per-item
(per-note encryption / protected notes), refining the proposed 12th
spectrum; HTML-native (CKEditor, lossy to Markdown); dual extension
surface (scripting code notes + ETAPI token REST). TriliumNext is the
active community fork of zadam's Trilium (TWiki->Foswiki pattern). Added
UC-66 (DAG hierarchy / note cloning), UC-67 (inherited/templated
attributes, effective vs own); enriched UC-15/22/34/38/42/61. Catalog now
67 UCs. Architecture for SHARD-WP-0002 T11/T12/T14/T15/T16: DAG namespace
+ identity/placement split, computed/inherited metadata, per-item content
opacity, HTML source model, scripting + ETAPI host surfaces.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-14 16:44:49 +02:00

54 lines
2.9 KiB
Markdown

# 260614 — Trilium (TriliumNext) deep dive (note cloning, attribute inheritance, HTML-native)
Date: 2026-06-14
## What this is
A focused study of **Trilium / TriliumNext** — the open-source hierarchical personal
knowledge base — read through shard-wiki's lens. It is another SQLite-local note app, but
it brings a structural feature **none of the prior twelve systems had: note cloning**
a single note can sit in **multiple places in the tree at once**, so the hierarchy is a
**DAG, not a tree**, with **note identity cleanly separated from placement** (a note has
many "branches"). It also has an **attribute system with inheritance + templates**
(computed metadata) and is one of the few **HTML-native** (not Markdown) tools.
Lineage: **TriliumNext** is the community fork of the original **Trilium** (zadam, now
maintenance-only) — the same pattern as TWiki→Foswiki.
Distinctive material:
- **Architecture** — single **SQLite** file (`document.db`); desktop or self-host server;
multi-instance **sync protocol w/ conflict resolution** + WebSocket; 12-char IDs
(`noteId`/`branchId`/`attributeId`/`attachmentId`)
- **Note cloning** — note vs **branch** (identity vs placement); DAG hierarchy; no single
canonical path
- **Attributes** — labels (`#tag`) + typed relations (`~relation`), **inheritable** +
**templates** (`~template`) → effective vs own metadata
- **Content** — **HTML** (CKEditor5), plus canvas/mindmap/spreadsheet/geo/render note
types; export to MD/HTML (lossy)
- **Extension** — **scripting** (frontend/backend code notes, Script API) + **ETAPI**
(token REST); **per-note encryption** (protected notes)
## Contents
| Path | Role |
|------|------|
| `findings.md` | Architecture, note cloning/DAG, attributes+inheritance, HTML content, scripting/ETAPI, per-note encryption, capability profile, INTENT mapping, UC seeds, sources |
## Status
Initial deep dive complete. Two new use cases promoted to `spec/UseCaseCatalog.md` (UC-66
attach a shard with a DAG hierarchy / note cloning, identity separated from placement;
UC-67 preserve inherited/templated attributes — effective vs own metadata); UC-15/22/34/
38/42/61 enriched. Logged for `SHARD-WP-0002` (T11/T12/T14/T15/T16): DAG namespace +
identity/placement (note/branch) split, computed/inherited metadata in the page model,
**per-item** content opacity (refining the 12th spectrum), HTML as a source content model,
and scripting + ETAPI host surfaces.
**Key takeaways recorded:** Trilium's **note/branch split (identity ≠ placement)** is the
clean model for pages that live in multiple locations/shards and the namespace-level form
of the clone/reference primitive; metadata is **computed** (own + inherited + template),
not a flat bag; and **content opacity is per-item** (per-note encryption), not only
whole-shard. **Boundary:** one SQLite-local candidate shard (DAG hierarchy, HTML-native),
best attached via ETAPI; not a substrate and not the federation layer.
</content>