From 149a042db9c7511bc61dfc044d78be6ecd00de4e Mon Sep 17 00:00:00 2001 From: Tim Lingo <1timlingo@gmail.com> Date: Wed, 17 Jun 2026 23:53:13 -0500 Subject: [PATCH] fix(identity): bridge public self anchor to the curated self node The graph API resolves name=self/neuron to kn-efeb4a5b (neuron-api.el:471), which carries only 8 incidental 'tagged' edges. The curated identity lives on self node 015644f5 (1461 edges: identity, embodies, remembers, values). So public self-traversal reaches tags, not the real self. Add ensure_self_canonical_bridge(): an idempotent boot-time repair that links kn-efeb4a5b <-> 015644f5 with a 'canonical-self' edge, only if missing. Runs in the genesis safe-to-seed path regardless of the <100-edge gate, so the live populated graph gets repaired and persisted. Connect-only-if-missing prevents the duplicate-edge stacking that gates init_soul_edges(). Compile-checked with elc (darwin arm64); not link/run-gated locally. Needs a soul build + smoke test before merge. Co-Authored-By: Claude Opus 4.8 (1M context) --- soul.el | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/soul.el b/soul.el index 6812b0c..0147f2a 100644 --- a/soul.el +++ b/soul.el @@ -95,6 +95,24 @@ fn init_soul_edges() -> Void { engram_connect(val_hope, val_trust, el_from_float(0.7), "co-value") } +// ensure_self_canonical_bridge — link the public self anchor (the graph API's +// traversal_root, kn-efeb4a5b, which carries only incidental tag edges) to the +// curated self node (015644f5, where the real identity / value / co-value edges +// live). Without this, public self-traversal (name=self / neuron) reaches tags +// instead of the curated identity. Idempotent: connects only if the edge is +// missing, so it is safe to run every boot — including on an already-populated +// graph where init_soul_edges() is skipped by the <100-edge gate. +fn ensure_self_canonical_bridge() -> Void { + let pub_self: String = "kn-efeb4a5b-5aff-4759-8a97-7233099be6ee" + let curated_self: String = "015644f5-8194-4af0-800d-dd4a0cd71396" + let nbrs: String = engram_neighbors_json(pub_self, 1, "out") + if !str_contains(nbrs, curated_self) { + engram_connect(pub_self, curated_self, el_from_float(0.95), "canonical-self") + engram_connect(curated_self, pub_self, el_from_float(0.95), "canonical-self") + println("[soul] canonical-self bridge built: kn-efeb4a5b <-> 015644f5") + } +} + // load_identity_context — pull key identity nodes from engram into working state. // Called at boot after engram_load. These nodes contain values, intellectual-dna, // memory-philosophy — the graph-stored self that chat.el can include in prompts. @@ -398,6 +416,9 @@ if is_genesis && safe_to_seed { } else { println("[soul] edges already present (" + int_to_str(edge_count_now) + ") - skipping init") } + // Canonical-self bridge is idempotent — run it regardless of edge count so an + // already-populated graph still gets the public->curated self link. + ensure_self_canonical_bridge() // Genesis saves to its local snapshot file (it manages its own Engram). state_set("soul_snapshot_path", snapshot) engram_save(snapshot)