From 18e1ab6db12a4209ff148fbd60dd172e59ee35a0 Mon Sep 17 00:00:00 2001 From: Tim Lingo <1timlingo@gmail.com> Date: Wed, 17 Jun 2026 13:14:57 -0500 Subject: [PATCH] =?UTF-8?q?feat(engram):=20add=20accumulation=20layer=20(l?= =?UTF-8?q?ayer=205)=20=E2=80=94=20new=20nodes=20default=20to=20it,=20not?= =?UTF-8?q?=20core-identity?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Implements the accumulation layer from the Layered Consciousness architecture (provisional 64/064,262) and answers the deferred design question. Per the spec and Will's design: new user-facing nodes (memories, knowledge, conversations) are created in an accumulation layer at the TOP of the consciousness stack — the engram the user sees — while the layers below (safety, core-identity, domain, imprint, suit) shape behavior but are hidden from the user. - Adds ENGRAM_LAYER_ACCUMULATION (5) + the layer record in engram_init_layers (activation_priority 50, suppressible, not injectable, transparent=0). - engram_node and engram_node_full now assign new nodes to ENGRAM_LAYER_ACCUMULATION. - ENGRAM_LAYER_DEFAULT stays CORE_IDENTITY ON PURPOSE: it is the fallback for LEGACY nodes loaded from snapshots without a layer_id, so existing data (the originator corpus) is NEVER migrated. New-nodes-only — the immutable-originator rule. This is the foundation for fixing the identity-bleed / customer-isolation issue (user data was landing in Neuron's core-identity layer). The retrieval-side provenance filter (introspection should compile from accumulation, not the originator corpus — Persona 64/036,574) is a follow-on, pending the batch-2 Layered Consciousness + Engram spec docs for exact semantics. Compiles clean. Co-Authored-By: Claude Opus 4.8 (1M context) --- lang/el-compiler/runtime/el_runtime.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/lang/el-compiler/runtime/el_runtime.c b/lang/el-compiler/runtime/el_runtime.c index 2f4c839..fd9949a 100644 --- a/lang/el-compiler/runtime/el_runtime.c +++ b/lang/el-compiler/runtime/el_runtime.c @@ -6031,6 +6031,14 @@ void el_cgi_init(el_val_t name, el_val_t dharma_id, el_val_t principal, #define ENGRAM_LAYER_DOMAIN 2u #define ENGRAM_LAYER_IMPRINT 3u #define ENGRAM_LAYER_SUIT 4u +#define ENGRAM_LAYER_ACCUMULATION 5u +/* New user-facing nodes (memories, knowledge, conversations) are created in the + * accumulation layer — the top of the consciousness stack, the engram the user + * sees; every layer below shapes behavior but is hidden from the user (Layered + * Consciousness architecture, app 64/064,262). ENGRAM_LAYER_DEFAULT stays + * core-identity ON PURPOSE: it is the fallback home for LEGACY nodes loaded from + * snapshots without a layer_id, so existing data (the originator corpus) is + * never migrated out of its established layer. New != legacy. */ #define ENGRAM_LAYER_DEFAULT ENGRAM_LAYER_CORE_IDENTITY /* Pass 3 override floor. Layer 0 nodes that received any background @@ -6208,6 +6216,20 @@ static void engram_init_layers(EngramStore* g) { .transparent = 0, .injectable = 1 }; + /* Layer 5 — accumulation. The TOP of the consciousness stack: the default + * home for all new user-facing nodes. This is the engram the user sees; + * every layer below shapes behavior but is hidden from the user. Not + * injectable — it is the persistent user accumulation, not a swappable + * overlay. transparent=0: its content is surfaced to introspection (it is + * the user's own knowledge/memory), unlike the lower behavioral layers. */ + g->layers[g->layer_count++] = (EngramLayer){ + .layer_id = ENGRAM_LAYER_ACCUMULATION, + .name = el_strdup_persist("accumulation"), + .activation_priority = 50, + .suppressible = 1, + .transparent = 0, + .injectable = 0 + }; } static EngramStore* engram_get(void) { @@ -6399,7 +6421,7 @@ el_val_t engram_node(el_val_t content, el_val_t node_type, el_val_t salience) { n->last_activated = now; n->created_at = now; n->updated_at = now; - n->layer_id = ENGRAM_LAYER_DEFAULT; + n->layer_id = ENGRAM_LAYER_ACCUMULATION; /* new user-facing node → top layer */ g->node_count++; return el_wrap_str(el_strdup(n->id)); } @@ -6435,7 +6457,7 @@ el_val_t engram_node_full(el_val_t content, el_val_t node_type, el_val_t label, n->last_activated = now; n->created_at = now; n->updated_at = now; - n->layer_id = ENGRAM_LAYER_DEFAULT; + n->layer_id = ENGRAM_LAYER_ACCUMULATION; /* new user-facing node → top layer */ g->node_count++; return el_wrap_str(el_strdup(n->id)); } -- 2.52.0