diff --git a/neuron-api.el b/neuron-api.el index f5db6eb..c45a8c2 100644 --- a/neuron-api.el +++ b/neuron-api.el @@ -304,10 +304,35 @@ fn handle_api_begin_session(body: String) -> String { let state_events: String = api_compact_node_array(state_events_raw, 5, 500) let recent_raw: String = engram_scan_nodes_json(10, 0) let recent: String = api_compact_node_array(recent_raw, 10, 240) + // SELF-SEEDED SLICE (2026-08-09). The design is explicit: "Every compilation + // query begins at the self-model node and traverses outward... structural + // reachability from the self-model node is a precondition for any node to + // appear in compiled context" (will-anderson patents/drafts/engram-claims.md, + // Self-Seeded Activation; DRAFT, not a filed provisional — cite it as such). + // + // Measured 2026-08-09 before this change: compiled context contained 0-1 + // identity records out of 10, because compilation seeds from a hardcoded + // TEXT STRING, never from the self. Even an explicit "my values identity who + // I am" query returned a boot counter and state-events. + // + // This restores the designed behaviour WITHOUT repeating the failure that got + // self_neighbors set to [] in the first place: that was an UNBOUNDED ~90KB + // neighbour dump which closed the socket on every call. Same bound as every + // other list here — cap 8, 240-char snippets. The self root has 34 direct + // neighbours of which 23 are identity records, so depth 1 is dense enough to + // be worth seeding and small enough to stay cheap. + let self_raw: String = engram_neighbors_json("kn-efeb4a5b-5aff-4759-8a97-7233099be6ee", 1, "both") + // Cap 24, not 8: measured 2026-08-09, the self root's first 8 neighbours are + // TAG nodes ("neuron", "tier:note", "disposition:experimental", "imprint", + // "traversal") which crowd out the substantive identity records behind them. + // The root has 34 neighbours of which 23 are identity; 24 captures them while + // staying bounded. Cost measured at ~+4KB on a ~12KB response, nowhere near + // the ~90KB unbounded dump that closed sockets and got this set to []. + let self_slice: String = api_compact_node_array(self_raw, 24, 240) return "{\"stats\":" + stats + ",\"recent\":" + recent + ",\"activated\":" + activated - + ",\"self_neighbors\":[]" + + ",\"self_neighbors\":" + self_slice + ",\"recent_state_events\":" + state_events + "}" }