1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
//! System-anchor identity.
//!
//! Every fresh repo seeded by `mnem init` writes a single, deterministic
//! "anchor" node so the graph is non-empty from the first second and so
//! every commit chain shares a common ancestor (the BUG-56 fast-forward
//! guarantee that lets a fresh subscriber `mnem pull` from a publisher
//! without manual base resolution).
//!
//! The anchor is structural, not content. It carries no summary, no
//! content, and no agent-written semantics; surfacing it in a
//! `mnem retrieve` result is always noise.
//!
//! This module exposes a single canonical identity for the anchor so
//! every layer that needs to recognise (and skip) it does so against
//! the same constant. Without that, the `Query` / `Retriever` filters,
//! the reindex candidate collector, and `mnem init` would each have to
//! re-declare the UUID and drift would be inevitable.
//!
//! Surfaces that filter the anchor by default:
//!
//! - [`crate::index::query::Query`] (CLI `mnem query`, MCP
//! `mnem_list_nodes`, HTTP `/list-nodes`)
//! - [`crate::retrieve::retriever::Retriever`] (CLI `mnem retrieve`,
//! MCP `mnem_retrieve`, HTTP `/retrieve`)
//!
//! Audit / admin tooling can opt back in with `include_system(true)` on
//! either builder, mirroring the existing `include_tombstoned(true)`
//! escape hatch.
use crateNodeId;
use crateNode;
/// Canonical UUID of the system anchor written by `mnem init`.
///
/// Bytes spell `mnem` (`6d 6e 65 6d`) in the low-order tail; the rest
/// is a UUIDv7-shaped sentinel that no `NodeId::new_v7()` call can
/// produce (the version-7 bits + timestamp prefix would never roll
/// over to all-zero). Hard-coded here, not derived, so a string
/// comparison or byte slice in any caller will match.
pub const ANCHOR_NODE_UUID: &str = "00000000-0000-7000-8000-6d6e656d0001";
/// Parsed [`NodeId`] form of [`ANCHOR_NODE_UUID`]. Computed eagerly via
/// `Once`-like init at first call so callers in the hot path
/// ([`crate::retrieve::retriever::Retriever::execute`],
/// [`crate::index::query::Query::execute`]) don't re-parse on every
/// candidate.
/// Returns `true` when `id` matches the system anchor's identity.
///
/// Use this from filter sites where you have a `NodeId` in hand but
/// haven't yet loaded the full `Node` (cheap path).
/// Returns `true` when `node` is the system anchor (or any future
/// system-reserved node). Today this is only the anchor, but new
/// callers should prefer this over `is_anchor_node_id` so adding a
/// second system node later is a one-line change inside this module
/// rather than a sweep across every filter site.