How Xudanu detects, indexes, and queries content reuse across documents — the core intellectual property inherited from Udanax-Gold, enhanced with BLAKE3 fingerprinting, the Bert Canopy tree, Recorder pub/sub, and the Hoist propagation algorithm.
Transclusion is Ted Nelson's foundational concept: content is linked, not copied. When the same text appears in multiple documents, the system should know they are the same content, not independent copies.
Xudanu's transclusion engine is a five-layer pipeline:
Figure 1: The five-layer transclusion pipeline. Content fingerprints flow left-to-right; queries flow top-to-bottom.
The TransclusionIndex is the foundation. Every RangeElement in every Edition has a 256-bit BLAKE3 content fingerprint. The index is a HashMap<[u8;32], Vec<EditionId>> that maps each fingerprint to the editions containing it.
Transclusion class with a similar fingerprint-to-edition mapping, but used a weaker hash. Xudanu replaces this with BLAKE3, which is both faster ( SIMD-optimized) and cryptographically collision-resistant.
The TrailBlazer struct wraps the index and provides query methods:
find_editions_with_content(fingerprint) — all editions containing a specific elementfind_works_with_content(fingerprint) — all works (across all editions) containing the elementfind_shared_content(edition_a, edition_b) — the XnRegion of content shared between two editionsA TransclusionQuery specifies what to search for (a specific edition, or all works). The TransclusionResult returns matched works with their fossil_id (from the Recorder), edition_be_id, and whether the match is direct or transitive.
The Bert Canopy is a binary tree structure where each node ("crum") holds computed property flags for the editions beneath it. This is the key data structure that makes transclusion queries efficient across large corpora.
Figure 2: The Bert Canopy tree. Leaf nodes hold per-edition property flags. Interior nodes hold the union of their children's flags. The PropFinder can prune entire subtrees when flags don't match.
Each crum contains:
| Field | Type | Purpose |
|---|---|---|
child1, child2 | Option<Arc<Mutex<CanopyCrumData>>> | Binary tree children |
parent | Option<Arc<Mutex<CanopyCrumData>>> | Upward link for hoisting |
flags | u32 | Computed property bitmask (union of children) |
own_flags | u32 | Flags specific to this node (not inherited) |
recorders | Vec<RecorderId> | Persistent queries installed at this node |
BertProp is a bitmask computed from an Edition's content. Each bit indicates the presence of a particular content type (text elements, edition references, work references, etc.). The canopy tree propagates these flags upward via compute_join() so a parent crum's flags are the bitwise OR of all descendants.
During a transclusion query, the PropFinder checks a crum's flags before descending. If the sought property bit is not set, the entire subtree is pruned — turning a full-corpus scan into a logarithmic search.
Heaper-based object hierarchy; Xudanu replaces this with Arc<Mutex<CanopyCrumData>> for thread-safe shared ownership.
Indexes content properties — what types of elements exist. Used for pruning transclusion queries. Every edition has a Bert crum in the canopy.
Indexes recorder properties — what persistent queries are active. The sensor canopy's IS_SENSOR_WAITING_FLAG indicates whether any recorder in the subtree is still waiting for results.
Recorders are the Udanax-Gold equivalent of persistent database queries. A recorder is "planted" on specific content, and when matching content appears in new editions, the recorder "fires" and accumulates a result (a Fossil).
| Type | Role |
|---|---|
RecorderQuery | Defines what to search for: Transcluders (editions containing shared content) or Works (works containing shared content). Can include region filters, authority clubs, endorsement filters, and watched content. |
Fossil | The accumulated results of a recorder. Contains RecordedResult entries, each with the matched element, source edition/work, and whether the match was direct. A fossil can be extinguished (no longer active). |
Matcher | An AgendaItem that executes a one-shot query against the transclusion index, feeding results into a fossil. |
RecorderTrigger | An AgendaItem that fires when new matching content is detected, recording the result in the fossil. |
RecorderQuery is created and installed at a canopy crum. A new Fossil is allocated.Matcher agenda item runs the query against the current transclusion index, populating the fossil with existing matches.RecorderTrigger fires, adding a new RecordedResult to the fossil.Fossil::record().
When recorders are installed at leaf nodes of the canopy, they need to be visible to ancestors for efficient querying. The RecorderHoister is an AgendaItem that incrementally propagates recorders upward through the tree.
The hoister walks from the current crum upward to the parent. At each step, it removes the recorders from child nodes and installs them at the parent. This continues until the recorders already exist at an ancestor (deduplication) or the root is reached.
Once recorders are installed, property flags need to be recomputed upward. The change_canopy() call recomputes flags = own_flags | children.flags at each level, walking to the root.
A naive approach would recompute the entire canopy on every edition registration. The hoister instead does the minimum work: it only walks the path from the affected leaf to the root, touching O(log n) nodes. For a corpus of 10,000 editions, this means ~13 nodes instead of 10,000.
The BackfollowEngine is the top-level query engine. Given an edition or work, it finds all other works that share content with it.
TransclusionIndex to find other editions containing the same contentPropFinder to walk the Bert Canopy, pruning subtrees whose flags don't match the queryTransclusionResult structs with work IDs, edition IDs, and match types (direct or transitive)| Query | Returns | Use case |
|---|---|---|
WorkQuery::ByEdition(id) | All works sharing content with the given edition | "What documents reuse this content?" |
WorkQuery::AllWorks | Full cross-reference of all works | Document Map visualization |
RecorderQuery::Transcluders | Editions that transclude from the target | "Who cited this passage?" |
RecorderQuery::Works | Works containing shared content | "Related documents" |
Here's what happens when a user pastes a transclusion (copies content from Document A into Document B):
Figure 3: End-to-end transclusion flow when content is pasted between documents.
| Aspect | Udanax-Gold (C++) | Xudanu (Rust) |
|---|---|---|
| Content hashing | Basic FNV hash | BLAKE3 (256-bit, SIMD-optimized, collision-resistant) |
| Thread safety | Single-threaded, no concurrency | Arc<Mutex> throughout; concurrent queries |
| Memory model | Manual Heaper allocation with garbage collection | Rust ownership + Arc reference counting |
| Recorder dedup | No fingerprint deduplication | BLAKE3-based dedup in Fossil::record() |
| Provenance | No cryptographic signing | Ed25519-signed element and span provenance |
| Real-time push | No live updates (batch only) | WebSocket content-watch notifications |
| Persistence | In-memory only (no disk) | WAL + dual manifest + chunk store |
| Query API | Internal C++ API, no network access | 140+ WebSocket operations with JSON/binary codecs |
| Operation | Complexity | Notes |
|---|---|---|
| Register edition (fingerprint indexing) | O(n) | n = elements in edition. One HashMap insert per element. |
| Canopy flag propagation | O(log N) | N = total editions. Only path from leaf to root. |
| Recorder hoist | O(log N) | Walk from affected crum to root, O(log N) steps. |
| Backfollow query (single edition) | O(k · log N) | k = unique fingerprints in edition, each with canopy pruning. |
| Full cross-reference (all works) | O(N · k_avg) | Linear in corpus size, mitigated by canopy pruning. |
| Recorder trigger (new match) | O(1) | Single fingerprint lookup + fossil insert. |
| Fossil dedup check | O(1) | HashSet lookup by BLAKE3 fingerprint. |