docs(engram): cognitive architecture design, prior-art scan, M10 reification, M8 perf profile, cutover-reversal runbooks, and 2026-08-12 session record
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,148 @@
|
||||
# M10 — Reification: Persisted First-Class Neighborhood Geometry
|
||||
|
||||
**Date:** 2026-08-12
|
||||
**Branch:** `engram-tiered-storage` (worktree `/tmp/engram-tiered-wt`)
|
||||
**Status:** Reification substrate = **GO** (additive, geometry-priming stays default-OFF).
|
||||
Enabling geometry-priming = **NO-GO** (latency blocker removed; recall-quality benefit still absent).
|
||||
**Live `:8742` never touched. Not pushed. Not tagged.**
|
||||
|
||||
This is the sequel to [M9 geometry priming](perf/engram-geometry-priming-profile.md), whose A/B
|
||||
showed enabling the flag cost **3.2× median / 13× p90** latency for **no reliable quality gain**.
|
||||
The M9 profile named two prerequisites before re-evaluating: **(1) amortize the per-query
|
||||
descriptor cost** (eigensolve + paged reads on every `engram_activate`) and **(2) center recall
|
||||
quality against the true store-wide mean**, not a per-query gathered-set approximation. M10 does both.
|
||||
|
||||
## What changed vs the original brief (important)
|
||||
|
||||
The task began as "reify the geometry into a durable **cache**." Will corrected this mid-flight, and
|
||||
the correction is the design: **do not build a cache — reify densely co-wired neighborhoods into
|
||||
first-class, PERSISTED store records** that survive restart, load on boot, and evolve via
|
||||
supersede+provenance. *"A cache that lies is worse than a slow lookup."* This matches
|
||||
[the cognitive-architecture design §2](engram-cognitive-architecture.md) (reification = durable
|
||||
structure, not a fragile derived shortcut) and the memory-core discipline (evolve or forget, never
|
||||
a stale canonical). Two modes, **no general cache layer**:
|
||||
|
||||
1. **Persist first-class** — reified/crystallized neighborhoods (the self; stable topology). The
|
||||
geometry-priming **hot path reads these**. Never compute geometry on the activation path.
|
||||
2. **Compute on the fly** — ad-hoc/transient domain geometries (viz, exploration). Uses the
|
||||
existing M9 `engram_geometry_descriptor`, fresh each call, no storage. Occasional, so its cost
|
||||
is acceptable.
|
||||
|
||||
## Storage schema (first-class, on the existing TLV node store — no new on-disk format)
|
||||
|
||||
A reified neighborhood is an ordinary store **node**, so it inherits durability, boot-load,
|
||||
`store_supersede`, and adjacency for free (design §2: *structure all the way down under one rule*).
|
||||
|
||||
| Record | `node_type` | `emb` | `metadata` (`GEO1` text schema) | id |
|
||||
|---|---|---|---|---|
|
||||
| Centering frame | `GeoMeanFrame` | the true store-wide mean vector (persisted **once**) | `{}` | `geo-meanframe` |
|
||||
| Neighborhood | `Neighborhood` | the **raw centroid** (prototype; centroid-ANN-able; `centered = emb − meanframe`) | hub id · meanframe ref · scalars (`radius`, `total_variance`, `k_core`, `co_registration`, `n_embedded`) · axis **extents** · member list `{id → membership, centrality, core}` | `nbhd-<hub>-<built_at_ms>` |
|
||||
|
||||
Member links are also persisted as edges `relation="member"` (`nbhd → member`). The membership
|
||||
`{id → w}` in the metadata is what priming reads; it is computed **centered against the persisted
|
||||
true mean**, which is what resolves the M9 quality caveat.
|
||||
|
||||
**Detection (v1, honest).** Hub-anchored neighborhoods over the strong-edge hebb-weighted graph:
|
||||
compute per-node weighted degree `Σ eff_w` (`eff_w = weight·(1+0.5·hebb)`, non-tombstoned /
|
||||
non-inhibitory, ≥ `edge_min_weight`) over from+to edges; rank descending; **greedy non-redundant
|
||||
cover** — reify each hub's descriptor once, skip a hub already a member (`w ≥ cover_membership`) of an
|
||||
accepted neighborhood, stop at `max_neighborhoods` (default 128). Env-tunable (`min_weighted_degree`,
|
||||
`max_neighborhoods`, refresh frac) without rebuild.
|
||||
|
||||
**Honest caveat — hebb ≈ 0 today.** On the current store there is ~no Hebbian potentiation, so
|
||||
`eff_w` reduces to the **authored** edge weight; the detected neighborhoods currently reflect
|
||||
authored graph structure, not learned co-activation. The design is unchanged and self-correcting
|
||||
once hebb accrues (degree ranking and skeleton shift automatically).
|
||||
|
||||
## Boot isolation — why priming-OFF stays byte-identical
|
||||
|
||||
The persisted records carry embeddings (centroid / mean) but are **structure, not corpus content**.
|
||||
On boot they are routed **out** of the resident activation graph into a dedicated resident reify
|
||||
index, and member edges are skipped from adjacency (matched by the `nbhd-…` id convention, so no real
|
||||
edge of any relation is affected). Consequences, all verified:
|
||||
|
||||
- store-wide mean, hub-degree scan, and the descriptor never admit a structural record as a member
|
||||
(`geo_is_structural_id` / `node_type` guards);
|
||||
- vindex / seed selection / results / embedding backfill are **identical** to a store that was never
|
||||
reified ⇒ `ENGRAM_GEOMETRY_PRIMING` OFF is **byte-identical to M8/M9**.
|
||||
|
||||
The resident index is the **loaded form** of the durable records (like the resident node array is the
|
||||
loaded form of node records, or adjacency of edges). Geometry is computed **once**, offline, and
|
||||
**persisted**; boot only *parses* — it never recomputes geometry.
|
||||
|
||||
## Hot path
|
||||
|
||||
`ENGRAM_GEOMETRY_PRIMING=1` resolves the M8 seed set to the best persisted neighborhood — O(seeds)
|
||||
membership hash lookup; miss → centroid-nearest against the loaded centered centroids — and applies
|
||||
the M9 damp+prime logic from the persisted membership. **No geometry computed on activation.** Set
|
||||
`ENGRAM_GEO_PRIMING_NOCACHE=1` to fall back to the M9 per-query descriptor (ad-hoc / A/B control).
|
||||
|
||||
## Results (A/B on COPIES; `store_reified` = 128 neighborhoods; live untouched)
|
||||
|
||||
**Correctness / durability**
|
||||
|
||||
| Check | Result |
|
||||
|---|---|
|
||||
| Reified records inert: `A_off` (reified store) vs `C_clean` (no records), id sequence all 15 queries | **MATCH** (byte-identical) |
|
||||
| Restart survival: reify → checkpoint+close → fresh-process reopen | 128 `Neighborhood` + 1 `GeoMeanFrame` present; index loads **28 ms**; hub-seed lookup HIT **~1 µs** |
|
||||
| Supersede/provenance: re-reify | prior same-hub record superseded (new timestamped id, old tombstoned); live count stable |
|
||||
| Build warnings from `el_runtime.c` / `engram_geometry.c` (−O2) | **0** (3 pre-existing in generated `engram.c`) |
|
||||
| ASan/UBSan — module (write/load/lookup) + full server hot path, priming ON, 6 queries | **CLEAN** (all http 200, no trap) |
|
||||
|
||||
**Latency (median / p90, 15 queries)**
|
||||
|
||||
| config | median | p90 | vs A_off |
|
||||
|---|---|---|---|
|
||||
| C_clean (no records, OFF) | 78.6 ms | 82.7 ms | — |
|
||||
| **A_off** (reified, OFF) | **77.4 ms** | **83.1 ms** | 1.00× |
|
||||
| **B_on** (reified, **hot path / persisted**) | **81.7 ms** | **85.7 ms** | **1.06× / 1.03× — FLAT** |
|
||||
| D_nocache (reified, ON, M9 per-query) | 255.3 ms | 872.3 ms | **3.30× / 10.5×** |
|
||||
|
||||
Reading a persisted first-class record instead of computing a per-query descriptor **removes the M9
|
||||
latency blocker** (3.3×/10.5× → 1.06×/1.03×). There is no cold first-query penalty — the index loads
|
||||
at boot.
|
||||
|
||||
**Recall quality (mean pairwise cosine, top-20, TRUE store-wide centered frame, stored vectors)**
|
||||
|
||||
| | OFF | ON | Δ |
|
||||
|---|---|---|---|
|
||||
| mean over 15 queries | 0.1721 | 0.1555 | **−0.0166** |
|
||||
| polysemous cues (9) | 0.1442 | 0.1441 | −0.0001 |
|
||||
| queries where ON > OFF | — | — | **3 / 15** |
|
||||
|
||||
Even with the true mean and persisted structure there is **no reliable coherence gain** — slightly
|
||||
negative on average, one sparse win (`self identity values` +0.078) and one notable regression
|
||||
(`precision over brute force` −0.215). On dense polysemous cues the top-20 head is unchanged
|
||||
(sub-threshold priming does not reorder it), so their coherence is flat.
|
||||
|
||||
## Verdict
|
||||
|
||||
- **Reification substrate: GO** (merge additive, geometry-priming default-OFF). It is the durable
|
||||
first-class structure the memory core needs — persisted, boot-loaded, restart-surviving,
|
||||
supersede-able, provably inert when OFF — and it turns priming into a flat-latency lookup.
|
||||
Groundwork for the self-as-structure, multi-scale neighborhoods, and the §5 operators.
|
||||
- **Enable geometry-priming: NO-GO (still).** The M9 *latency* objection is resolved; the *quality*
|
||||
objection is not. Keep the flag default-OFF.
|
||||
|
||||
### Uncertainties / limits (memory core — flagged)
|
||||
|
||||
1. **hebb ≈ 0** ⇒ neighborhoods reflect authored edges, not learned co-activation. The quality result
|
||||
is likely **understated**; re-evaluate after hebb accrues (or seed hebb from usage).
|
||||
2. **Hub-anchored detection** can resolve a sparse query to a semantically mismatched neighborhood
|
||||
(the −0.215 regression). Semantic-aware / co-registration-gated detection is future work.
|
||||
3. **Top-20 coherence is insensitive** to sub-threshold priming on dense cues — it may be the wrong
|
||||
metric for what priming does (it warms a floor, it does not reorder the head). A retrieval-utility
|
||||
or disambiguation-accuracy metric would measure the intended effect better.
|
||||
4. **v1 simplifications:** axis **direction** vectors are not persisted (extents only; directions
|
||||
recomputable on the fly); member edges are persisted but inert to activation.
|
||||
|
||||
## Reversal
|
||||
|
||||
Fully additive and reversible.
|
||||
|
||||
- The binary is **byte-identical to M8/M9 when `ENGRAM_GEOMETRY_PRIMING` is unset/0** — the default.
|
||||
- Reified records live only in stores you explicitly run the reify step against; a store that was
|
||||
never reified behaves exactly as before (the resident index is empty ⇒ priming no-ops).
|
||||
- To remove reified structure from a store: tombstone the `Neighborhood` / `GeoMeanFrame` records and
|
||||
compact (they are ordinary nodes). No format change to undo.
|
||||
- `ENGRAM_GEO_PRIMING_NOCACHE=1` restores the M9 per-query path for ad-hoc geometries / comparison.
|
||||
@@ -0,0 +1,120 @@
|
||||
# Engram Prior-Art Scan
|
||||
|
||||
*Dated 2026-08-12. This is an **engineering novelty read**, not legal advice. It is intended to feed a patent/whitepaper priority decision by identifying which claims sit in a clean lane and which are wholly or partly anticipated by existing work. A patent attorney and a formal search (USPTO/Google Patents/Espacenet) should confirm before filing. Where a claim is anticipated, this document says so plainly — the goal is honest scoping, not inflated novelty.*
|
||||
|
||||
## How to read this
|
||||
|
||||
Engram is an immutable, temporally-provenanced knowledge graph (tombstone-not-delete, supersede-not-overwrite; every node carries `created_at` + `superseded_at` + provenance). Over that graph it computes **geometry descriptors** `G = (centroid, covariance/ellipsoid, skeleton graph, membership weights)` in a joint embedding+graph space, and runs named operators (overlap, combine, distance, difference, analogy=Procrustes, traverse=geodesic) over them. A "self" is a reified geometry. Time-travel is a **query filter** (`created_at ≤ T < superseded_at`), not a transaction-log replay. "Self-occupation" reconstructs the self-geometry/knowledge-state as of `T`, locks it read-only, and converses with it with all post-`T` data masked.
|
||||
|
||||
The recurring pattern in the findings below: **every individual primitive is prior art.** Bitemporal reconstruction, memory streams, vector-symbolic composition, geometric KG operators, hindsight-leakage auditing, embedding drift detection — all exist and are well-published. Novelty, where it exists, lives in *specific integrated mechanisms*, and must be claimed narrowly against those primitives. Broad claims ("reasoning as geometry," "reconstruct what was known at T," "detect drift by distance") will be rejected on sight.
|
||||
|
||||
---
|
||||
|
||||
## (a) Hindsight-free decision auditing via immutable temporal knowledge-state reconstruction + future-masked occupation
|
||||
|
||||
**Claim (restated narrowly).** A method for auditing a past decision by (1) *constructively reconstructing* the exact knowledge-state a decision-maker held at time `T` from an immutable, tombstone+supersede provenance graph (selecting nodes live-at-`T` via `created_at ≤ T < superseded_at`), (2) recomputing the derived concept/self geometry over only that live-at-`T` slice, and (3) presenting that reconstructed state read-only, with all post-`T` nodes masked, as the sole evidentiary basis for judging the decision — such that the reconstruction is tamper-evident *because* nothing is ever overwritten or deleted.
|
||||
|
||||
**Closest prior art.**
|
||||
- **HindsightBench** (Aug 2026) — a *black-box behavioral audit protocol* that detects parametric hindsight in time-indexed LLM decision tasks by manipulating the *asserted date* in the prompt (Revealed/Date-only/Masked/Transplant arms) and measuring behavioral shift. It explicitly does **not** reconstruct a knowledge state from provenance; it does not require corpus access or logprobs. It also reports that *instructed forgetting fails* — a 52% performance gap vs. true ignorance. https://arxiv.org/abs/2607.18867
|
||||
- **Agentic Time Machine** (Jun 2026) — wraps web tools with a *leakage filter* that blocks post-cutoff or answer-revealing content before it reaches the agent (for forecasting benchmarks). https://arxiv.org/pdf/2606.21013
|
||||
- **Zep/Graphiti** — bitemporal KG memory that can answer "what was the user's plan in January?" via point-in-time recall over event-time + ingestion-time. https://arxiv.org/abs/2501.13956 , https://www.getzep.com/ai-agents/temporal-knowledge-graph/
|
||||
- **Auditable clinical-AI provenance frameworks** — immutable, timestamped "source-to-decision" trails recording the exact evidence shown to a clinician, for FDA transparency/liability. https://pmc.ncbi.nlm.nih.gov/articles/PMC12913532/
|
||||
- **Hindsight-bias clinical literature** — retrospective case-note review is critically distorted by outcome knowledge; reconstructing the decision-maker's past perspective is the known mitigation. https://www.researchgate.net/publication/330427526 , https://kevinmd.com/2026/03/how-hindsight-bias-distorts-clinical-medicine.html
|
||||
|
||||
**What is genuinely differentiated.** The primitives — bitemporal point-in-time recall (Zep), immutable evidence trails (clinical AI), hindsight-bias mitigation by perspective reconstruction (clinical psych), leakage filtering (Agentic Time Machine), hindsight auditing (HindsightBench) — are all taken. What appears *unclaimed* is the specific combination: **constructive knowledge-state reconstruction from an immutable tombstone+supersede graph, used as the affirmative evidentiary substrate for judging a decision**, where correctness of the future-mask is *guaranteed by the data model* (a node is either live-at-`T` or it is not) rather than by prompt instruction or a heuristic content filter. HindsightBench and Agentic Time Machine both operate on the *model's* contaminated parametric memory and fight leakage behaviorally/heuristically; Engram sidesteps parametric leakage by making the *evidence set itself* provably `T`-clean and then recomputing geometry over it. The tamper-evidence-by-construction angle (append-only provenance ⇒ the reconstruction cannot be silently backdated) is also not present in the behavioral-audit line.
|
||||
|
||||
**Scoped-claim recommendation.** Claim the *pipeline*, not the goal: "reconstructing a decision-maker's knowledge-state as of `T` by selecting live-at-`T` nodes from an append-only tombstone+supersede provenance graph and recomputing derived concept/self geometry over that slice, then serving it read-only with post-`T` nodes masked as the evidentiary basis for decision review." Anchor on (i) constructive reconstruction from immutable provenance (not prompt-based date assertion), (ii) mask-correctness guaranteed by the data model, (iii) recomputed *geometry* (not just fact recall) as the reconstructed state. Do **not** claim "hindsight-free auditing" broadly, "point-in-time recall," or "immutable audit log" — all taken.
|
||||
|
||||
**Verdict: PARTIALLY TAKEN** (the goal and every primitive are taken; the constructive-reconstruction-from-immutable-provenance-as-evidentiary-substrate integration looks clean if narrowly scoped).
|
||||
|
||||
---
|
||||
|
||||
## (b) Drift detection via geodesic displacement of an anchored self-geometry
|
||||
|
||||
**Claim (restated narrowly).** A method that reifies an agent's "self" as a geometry descriptor with a *designated stable value-core anchor* and a mutable *periphery*, and classifies change by **decomposition**: extension of the periphery (core displacement ≈ 0) is scored as *growth*, whereas geodesic displacement of the *core* is scored as *corruption* — measured as geodesic distance between `self(now)` and the anchored `self(reference)` on the graph+embedding manifold.
|
||||
|
||||
**Closest prior art.**
|
||||
- **Embedding / concept-drift detection** — mature field: distribution-distance of embeddings, per-label distributions (Drift Lens), K-core-distance from a dense "core" of baseline logic, growing average distance from baseline anchors as the drift signal. https://www.evidentlyai.com/blog/embedding-drift-detection , https://ieeexplore.ieee.org/iel7/9679833/9679835/09679880.pdf , https://www.sciencedirect.com/science/article/pii/S0925231225018624
|
||||
- **Agent identity/goal-drift governance** — identity-hash functions over characteristic behavior for drift detection; "dominant" core persona preventing fragmentation; reflection-based long-term self-model evolution vs. short-term compensation. https://arxiv.org/pdf/2604.14717 (Layered Mutability) , https://www.researchgate.net/publication/397950116 (Agent Goal Drift in Stateful Systems)
|
||||
- **Persistent Identity multi-anchor architecture** — explicit *anchors* for resilient agent identity/memory continuity. https://arxiv.org/pdf/2604.09588
|
||||
|
||||
**What is genuinely differentiated.** "Distance from an anchored baseline core = drift" is squarely prior art (K-core-distance, baseline-anchor distance growth). Agent-identity work already has *core-vs-drift* and *anchors*. What is not obviously present is the **core/periphery decomposition of drift into two distinct, oppositely-valenced outcomes on a reified self-*geometry*** — i.e., using a *geometric* self-model (centroid + covariance/ellipsoid + skeleton) where *growth* is formally "periphery ellipsoid expands while core centroid/anchor stays fixed" and *corruption* is "core centroid/anchor is geodesically displaced." Existing drift work treats all displacement as drift (bad); it does not carve legitimate growth from corruption via a *fixed value-core* on a self-geometry. The specific formalization — geodesic (graph-aware, non-Euclidean) displacement of a *pinned* value-core sub-geometry vs. free peripheral expansion — is the differentiator.
|
||||
|
||||
**Scoped-claim recommendation.** Claim "detecting agent value-corruption by measuring geodesic displacement of a *pinned value-core sub-geometry* of a reified self-geometry, while treating expansion of the peripheral geometry with a stationary core as non-corrupting growth." Emphasize (i) the self is a *geometry descriptor* with an explicitly designated immutable core anchor, (ii) growth vs. corruption is a *decomposition* (two signals), not a threshold on one distance, (iii) geodesic/graph-aware metric. Do **not** claim "drift detection by embedding distance" or "anchored baseline comparison" — taken.
|
||||
|
||||
**Verdict: PARTIALLY TAKEN** (distance-from-anchor drift is taken; the growth/corruption core-vs-periphery decomposition on a reified self-geometry is the narrow clean sliver — and it's the weakest/most crowded of the five).
|
||||
|
||||
---
|
||||
|
||||
## (c) Reasoning as composable geometry operations over a persistent temporally-provenanced graph
|
||||
|
||||
**Claim (restated narrowly).** A reasoning method in which inference steps are *explicit, named, first-class operators* (overlap, combine, distance, difference, analogy=Procrustes alignment, traverse=geodesic) applied to geometry descriptors computed over a *persistent, immutable, temporally-provenanced* knowledge graph — such that each reasoning step is individually inspectable, logged with provenance, and *replayable* against a past graph state; as distinct from implicit, unnamed activation/attention transforms inside a neural net.
|
||||
|
||||
**Closest prior art.**
|
||||
- **Vector Symbolic Architectures / HRR / SDM** (Plate, Kanerva) — the canonical "algebra over vectors": binding, bundling/superposition, permutation, similarity; explicitly compositional/symbolic reasoning via vector operations. This is the strongest prior art for "named composable operators over vectors." https://www.emergentmind.com/topics/holographic-reduced-representations-hrrs , https://arxiv.org/pdf/2512.14709 (Attention as Binding)
|
||||
- **Geometric KG query embeddings (Query2Box-lineage)** — reasoning as *named geometric operators* (projection, intersection) over box/region embeddings; geometric multi-hop reasoning; geometry-interaction KG embeddings. https://arxiv.org/html/2505.12369v2 , https://ojs.aaai.org/index.php/AAAI/article/view/20491/20250
|
||||
- **Geometry-of-reasoning / embedding-space reasoning** — CoT as trajectories/flows in representation space; vector algebra + manifold geometry for deduction/induction/analogy. https://arxiv.org/abs/2510.09782 , https://arxiv.org/pdf/2504.02018
|
||||
- **Riemannian knowledge manifolds** — geodesics as shortest semantic paths with a convergent geodesic solver. https://arxiv.org/html/2606.05907v2
|
||||
- **Neuro-symbolic propose-verify** — explicit symbolic operations + solver verification.
|
||||
|
||||
**What is genuinely differentiated.** "Reasoning as composable vector/geometry operations" is *thoroughly* prior art — VSA/HRR own the compositional-operator framing; Query2Box owns named geometric operators (projection/intersection) for KG query answering; geodesic traversal over semantic manifolds is published. The individual operators (overlap≈intersection, distance, geodesic-traverse, Procrustes-analogy) each exist. The candidate differentiator is *not* any operator and *not* "geometry as reasoning" — it is the **coupling of the operator calculus to the immutable temporal-provenance substrate**: every operator input is a live-at-`T` geometry, every step is provenance-stamped, and the whole derivation is *replayable against a reconstructed past graph state* (i.e., operator-level temporal reproducibility + auditability). VSA/Query2Box run over static/atemporal embedding stores with no provenance and no time-travel; geometry-of-reasoning work is about a neural net's *internal* trajectory, not an external audited calculus. So the calculus itself is taken; "an *auditable, replayable* geometry calculus whose operands are temporally-reconstructed geometries" is the narrow lane.
|
||||
|
||||
**Scoped-claim recommendation.** Do **not** claim a "calculus of thought," "reasoning as geometry," or any specific operator (overlap/difference/geodesic/Procrustes) — all taken. Claim only the integration: "an audit trail in which each named geometric reasoning operator is provenance-stamped and its operands are geometry descriptors reconstructed from an immutable temporal graph as-of a query time, enabling deterministic replay of a reasoning derivation against a past knowledge-state." The defensible novelty is *temporal reproducibility + provenance of the operator chain*, not the operators.
|
||||
|
||||
**Verdict: TAKEN** (as "reasoning as composable geometry ops" — VSA/HRR + Query2Box + geometry-of-reasoning fully occupy it). Only the *auditable/replayable-over-immutable-temporal-substrate* framing survives, and it survives as a thin sliver of (a)/(e), not as an independent claim.
|
||||
|
||||
---
|
||||
|
||||
## (d) Self-occupation with engineered future-masking
|
||||
|
||||
**Claim (restated narrowly).** A method for reasoning *as* a past self: reconstruct the self-geometry and knowledge-state as of `T` from the immutable provenance graph, *rigorously enforce the `created_at ≤ T` cut at the data layer* (all post-`T` nodes structurally excluded, not instructed-away), lock the reconstruction read-only, and drive a conversational/reasoning session that is provably uncontaminated by hindsight — the mask being a property of the substrate, not of a prompt or the model's willingness to "forget."
|
||||
|
||||
**Closest prior art.**
|
||||
- **HindsightBench** — establishes the *problem* rigorously and shows that prompt-level "pretend it's `T`" fails badly (instructed forgetting ≠ ignorance; 52% gap; date assertions obeyed but hindsight still leaks). This is the strongest adjacent art and, helpfully, *motivates* Engram's substrate-level approach rather than anticipating it. https://arxiv.org/abs/2607.18867
|
||||
- **Agentic Time Machine** — closest *mechanism*: a leakage filter blocking post-cutoff content before it reaches the agent. But it filters *tool outputs* heuristically for a forecasting benchmark; it does not reconstruct and occupy a *reified past self/knowledge-state*. https://arxiv.org/pdf/2606.21013
|
||||
- **Causal Agent Replay** — counterfactual replay/attribution of agent failures (replay, but not future-masked past-self occupation). https://arxiv.org/abs/2606.08275
|
||||
- **Chronologically-consistent pretraining / counterfactual-anchored decoding / forget-retain logit adjustment** — model-internal mitigations of parametric leakage (named in HindsightBench). Different layer entirely.
|
||||
|
||||
**What is genuinely differentiated.** The field is actively fighting hindsight leakage at the *model* layer (pretraining, decoding, logit surgery) and at the *tool-output* layer (heuristic leakage filters). Engram's move is orthogonal and, per HindsightBench's own findings, addresses the failure mode the field just documented: **enforce the cut at the evidence/data layer via an immutable time-indexed graph, so the "past self" is a reconstructed read-only geometry whose accessible universe is exactly the live-at-`T` slice.** No source found reconstructs a *reified self-geometry* as of `T` and *converses with it* as a first-class object. The differentiators: (i) the masked entity is a *reconstructed self*, not just filtered context; (ii) mask correctness is structural (a node's `created_at` either satisfies the cut or the node is absent) rather than heuristic/instructed; (iii) it is tamper-evident via append-only provenance. Note the residual honesty caveat: if the *underlying LLM* used for the conversation has parametric hindsight, Engram's substrate-clean evidence does not fully neutralize it — the claim must be about the *evidence/state* being `T`-clean, which is the part Engram genuinely controls.
|
||||
|
||||
**Scoped-claim recommendation.** Claim "reconstructing a reified agent self-geometry and knowledge-state as-of `T` from an append-only temporal provenance graph and conducting a read-only reasoning/conversation session over it in which the accessible node universe is structurally restricted to the live-at-`T` slice (data-layer future-masking), yielding a `T`-clean evidentiary state." Lean on *structural* (data-model-guaranteed) masking vs. *instructed/heuristic* masking, and on the *reified-past-self* object. Explicitly scope to the evidence-state cleanliness (not a claim that the LLM has zero parametric leakage). Do **not** claim "prevent hindsight in LLMs" or "leakage filtering" broadly.
|
||||
|
||||
**Verdict: CLEAN LANE** (narrowly — data-layer/structural future-masking over a *reconstructed reified past self* is not occupied; adjacent art is behavioral-audit, tool-output filtering, or model-internal mitigation. This is the strongest of the five, precisely because HindsightBench shows the prompt-level approach fails and no one is doing substrate-level self-reconstruction).
|
||||
|
||||
---
|
||||
|
||||
## (e) Query→geometry temporal reconstruction with NO transaction logs
|
||||
|
||||
**Claim (restated narrowly).** Reconstructing a past knowledge-state as a *query-time filter* over immutable, per-node timestamped provenance (`created_at ≤ T < superseded_at`) followed by *recomputation of the geometry descriptors* over that slice — with **no event/transaction log and no periodic snapshots**; the immutable per-node provenance *is* the temporal record, and derived geometry is recomputed rather than stored/replayed.
|
||||
|
||||
**Closest prior art.**
|
||||
- **Bitemporal databases (XTDB, et al.) / event sourcing** — "as-of" point-in-time queries over valid-time + transaction-time; immutability as audit log. Critically, XTDB describes reading bitemporal data as a process *"similar to event sourcing… playing through the history… in reverse system-time order"* — i.e., the mainstream bitemporal model *is* replay/reconstruction-through-history. https://v1-docs.xtdb.com/concepts/bitemporality/ , https://www.juxt.pro/blog/value-of-bitemporality/
|
||||
- **Zep/Graphiti** — bitemporal (event-time T + ingestion-time T′) fact validity + supersession chains; point-in-time recall. https://arxiv.org/abs/2501.13956
|
||||
- **TKG reasoning frameworks / ElephantBroker-class runtimes** — "immutable fact store, all temporal weighting applied at query time; facts created after the query timestamp excluded, facts superseded after query timestamp treated as current; invalidate by writing `t_invalid` rather than delete." This is *very* close to Engram's filter and supersede/tombstone semantics. https://www.emergentmind.com/topics/temporal-knowledge-graph-reasoning-tkgr , https://arxiv.org/pdf/2603.25097
|
||||
- **Numerous bitemporal/immutable-DB patents** (point-in-time reconstruction, retroactive/historical transactions). e.g. US 11,935,046; US 8,812,512 (via USPTO search) — a patent attorney must clear these.
|
||||
|
||||
**What is genuinely differentiated.** The *temporal filter* (created-before, superseded-after) and *tombstone-not-delete / supersede-not-overwrite* are **standard bitemporal KG practice** — Zep and the TKGR frameworks describe almost exactly this. So the reconstruction-by-filter primitive is TAKEN, and "immutable provenance instead of a mutable audit log" is TAKEN (that's the bitemporal value prop). The only thing that is *not* standard: what gets reconstructed is not just a set of *facts/edges* but a set of **derived geometry descriptors (centroid/covariance/skeleton/membership) recomputed over the live-at-`T` slice** — i.e., recompute-geometry-on-read rather than store-and-replay. Bitemporal DBs reconstruct *records*; Engram reconstructs *derived manifold structure*. The "no transaction log / no snapshot — provenance IS the temporal record, geometry is recomputed" framing is a design stance that is defensible only if paired with the *geometry recomputation*; on its own it is indistinguishable from XTDB/Zep.
|
||||
|
||||
**Scoped-claim recommendation.** Do **not** claim bitemporal reconstruction, "as-of" queries, tombstone/supersede, or "immutable provenance as audit record" — all squarely taken (Zep, XTDB, TKGR, patents). Claim only: "reconstructing a *derived geometry descriptor set* (centroid/covariance/skeleton/membership) for a past knowledge-state by recomputing it on-read over the live-at-`T` node slice, without storing per-`T` geometry snapshots or a geometry-mutation log." The novelty is *geometry-recompute-on-read over a bitemporal slice*, not the slice.
|
||||
|
||||
**Verdict: TAKEN** (as "query-filter temporal reconstruction over immutable provenance" — Zep + XTDB + TKGR own it outright). Only "recompute *derived geometry* on-read, snapshot-free" survives, and it is really a facet of (c)/(a) rather than an independent claim.
|
||||
|
||||
---
|
||||
|
||||
## Summary
|
||||
|
||||
| Claim | Verdict | Narrowest defensible (clean-lane) framing |
|
||||
|---|---|---|
|
||||
| **(a)** Hindsight-free decision auditing via reconstructed knowledge-state + future-masked occupation | **PARTIALLY TAKEN** | Constructive knowledge-state reconstruction from an *append-only tombstone+supersede* graph, used as the *affirmative evidentiary substrate* for decision review, with mask-correctness guaranteed by the data model and tamper-evidence by construction — not prompt/date-assertion (cf. HindsightBench) and not tool-output filtering (cf. Agentic Time Machine). |
|
||||
| **(b)** Drift as geodesic displacement of anchored self-geometry | **PARTIALLY TAKEN** | Growth-vs-corruption *decomposition* of change on a reified self-*geometry* via geodesic displacement of a *pinned value-core sub-geometry* vs. free peripheral-ellipsoid expansion. (Crowded; weakest lane.) |
|
||||
| **(c)** Reasoning as composable geometry ops over a temporal graph | **TAKEN** | Only survivor: *provenance-stamped, replayable* operator chain whose operands are geometries reconstructed as-of a query time (temporal reproducibility of the derivation) — never the operators or "geometry as reasoning" themselves. |
|
||||
| **(d)** Self-occupation with engineered future-masking | **CLEAN LANE** (narrow) | Reconstruct a *reified past self-geometry* and converse with it read-only, with the accessible node universe *structurally* restricted to the live-at-`T` slice (data-layer masking) — not instructed forgetting (which HindsightBench shows fails) and not heuristic content filtering. |
|
||||
| **(e)** Query→geometry temporal reconstruction, no transaction logs | **TAKEN** | Only survivor: recompute *derived geometry descriptors* on-read over the live-at-`T` slice, snapshot-free — never the bitemporal filter, tombstone/supersede, or "immutable provenance as record," all of which Zep/XTDB/TKGR own. |
|
||||
|
||||
## Overall posture
|
||||
|
||||
**Broad claims over primitives will be rejected.** Each of the five candidate claims decomposes into (i) a primitive that is unambiguously prior art and (ii), in three of five cases, a thin integrated mechanism that appears unclaimed. The prior art is strong and specific: Zep/Graphiti and XTDB own bitemporal point-in-time reconstruction and supersession (kills the broad reads of (a) and (e)); VSA/HRR and Query2Box own composable geometric/symbolic operators (kills the broad read of (c)); embedding concept-drift and agent-identity-anchor work own distance-from-baseline drift (kills the broad read of (b)); and HindsightBench + Agentic Time Machine own hindsight *auditing* and *leakage filtering* (bound (a) and (d)).
|
||||
|
||||
**Novelty lives in the specific integrated mechanisms, narrowly scoped.** The two genuinely defensible ideas are: **(d) substrate-level future-masking of a reconstructed, reified *past self*** — which is the strongest, and is *strengthened* by HindsightBench's finding that the prompt-level approach everyone else uses fails by ~52%; and **(a) constructive knowledge-state reconstruction from immutable provenance as the affirmative evidentiary basis for decision auditing**, distinct from behavioral probing. The unifying, defensible thread across (a)/(d)/(c)/(e) is *structural guarantee by the immutable data model* — the future-mask, the tamper-evidence, and the operator-chain replayability are all properties of the append-only substrate rather than of prompts, heuristics, or model cooperation. That "guaranteed-by-construction" framing is the honest core of any priority filing. Claims (c) and (e) should be folded in as *facets* (auditable/replayable geometry over reconstructed slices) rather than filed as standalone claims, and (b) should be filed only if the core/periphery decomposition can be made rigorous, since the surrounding drift-detection art is dense.
|
||||
|
||||
*Caveats for the filing team: (1) this scan covered academic/product/blog prior art via web search, not a formal patent search — several bitemporal/immutable-DB patents surfaced (e.g. US 11,935,046; US 8,812,512) and must be cleared on Google Patents/Espacenet/USPTO. (2) Claim (d)'s guarantee is that the *evidence-state* is `T`-clean; it does not by itself neutralize parametric hindsight in whatever LLM reasons over that state — scope the language accordingly. (3) Dates on several 2606–2607 arXiv preprints are very recent; confirm publication precedence relative to Engram's earliest documented conception date.*
|
||||
@@ -0,0 +1,140 @@
|
||||
# Engram Tiered Storage — M8 Performance Profile (milestone-0 sample)
|
||||
|
||||
**Milestone:** M8 (ANN wired into `engram_activate` seed selection). Trunk =
|
||||
worktree `/tmp/engram-tiered-wt`, branch `engram-tiered-storage`, HEAD `1507614`.
|
||||
**Date:** 2026-08-12. **Author:** first full-binary build + profile of the tiered trunk.
|
||||
|
||||
This is **sample zero** of an accumulating per-milestone profile series (see the
|
||||
BUILD-LEDGER "keep performance telemetry CONTINUOUSLY" decision). Compare future
|
||||
milestones (M9, M10, …) against these numbers.
|
||||
|
||||
## Methodology (read this before trusting a number)
|
||||
|
||||
- **On a COPY, never live.** All runtime measurements used a read-only copy of the
|
||||
live store booted on a **non-live port (:8798)** with a **throwaway `$HOME`**. The
|
||||
live engram service (:8742, `~/.neuron/engram`) was never touched.
|
||||
- **Two store substrates were used:**
|
||||
1. *Live-egm copy* (`neuron.egm` 458 MB + `neuron.wal` 44 MB, copied read-only) —
|
||||
**this substrate crashes both the M8 binary and the live binary on boot** (see
|
||||
Integration Findings). Unusable for runtime measurement.
|
||||
2. *Clean import* — a dir seeded with only `snapshot.json` (65 MB, stable 06:10),
|
||||
which the binary imported into a **fresh 59.9 MB `neuron.egm`**. All healthy
|
||||
runtime numbers below are from this substrate (real graph content, healthy store).
|
||||
- **Build machine:** Apple Silicon (arm64), macOS. Native `cc -O2` compile; fold done
|
||||
in a memory-capped (`--memory=3g --memory-swap=3g`, no swap) `linux/amd64` container
|
||||
running `elc-linux-amd64`.
|
||||
- Hardware/thermals uncontrolled; single run per metric unless noted. Treat as
|
||||
order-of-magnitude, not benchmark-grade, except the module benchmark (Test suite).
|
||||
|
||||
## Build
|
||||
|
||||
| Metric | Value |
|
||||
|---|---|
|
||||
| Fold input | `engram/src/server.el` (44,273 B El, no imports) |
|
||||
| Fold output | `engram.c` (30,855 B, 645 lines C), `ELC_EXIT=0`, **0 fold warnings** |
|
||||
| Fold time (pure elc) | sub-second (server.el is small, importless) |
|
||||
| Fold container wall | ~38 s (dominated by one-time `apt-get install libcurl4` in the throwaway container; the elc invocation itself is <1 s) |
|
||||
| Compile | `cc -O2 -DHAVE_CURL engram.c el_runtime.c engram_store.c engram_vindex.c -lssl -lcrypto -lcurl -lpthread -lm` |
|
||||
| Compile time | **1.83 s** wall |
|
||||
| Compile warnings | **3**, all `-Wparentheses-equality` in the *folded* `engram.c` (El if-expr codegen emits `if ((x == 0))`); cosmetic. `el_runtime.c` / `engram_store.c` / `engram_vindex.c` compiled **0 warnings** — notably none around the M8 deferred `free(e_eff)` or the vindex integration. |
|
||||
| Binary | **482,008 B (471 KB)** Mach-O arm64 executable |
|
||||
| ANN linkage verified | `nm`: `vindex_search`, `vindex_build_from_store`, `eg_vindex_sync`, `_eg_vindex`, `store_scan_nodes`, `engram_store_boot`, `engram_activate` all present |
|
||||
|
||||
## Boot & footprint (clean-import substrate)
|
||||
|
||||
| Metric | Value |
|
||||
|---|---|
|
||||
| Boot from healthy `neuron.egm` | **~2 s** to listening |
|
||||
| Boot from `snapshot.json` (one-time import + fresh egm) | **~9 s** |
|
||||
| node_count | **13,036** (matches ledger import-dedup: 13,038 snapshot − 2 dup-id entries) |
|
||||
| edge_count / layer_count | 43,402 / 5 |
|
||||
| embedded_count | 4,190 |
|
||||
| Fresh egm size | **59.9 MB** (vs the live egm's bloated 458 MB — see Findings) |
|
||||
| RSS after boot | **126.2 MB** (whole 13k-node/43k-edge/4,190-emb graph resident + fresh egm) |
|
||||
|
||||
## Activation latency — q="bullshit" (clean-import substrate)
|
||||
|
||||
50 sequential `GET /api/activate?q=bullshit&limit=10&depth=3`:
|
||||
|
||||
| Metric | Value |
|
||||
|---|---|
|
||||
| p50 | **34.35 ms** |
|
||||
| p95 | **35.26 ms** |
|
||||
| min / max | 33.50 ms / 9,886 ms |
|
||||
| Sample | n=50 |
|
||||
|
||||
- The **max = 9.9 s is the first call only** — a cold query-embedding fetch
|
||||
(`eg_embed_fetch` → Ollama `nomic-embed-text`, cold model load). All subsequent
|
||||
calls hit the single-slot query-embedding cache (`_eg_qcache`) → **34 ms steady state**.
|
||||
- **This 34 ms is the lexical/spread path, NOT the ANN seed path.** The store's 4,190
|
||||
embeddings were generated by the live neuron's native embedding model; the harness's
|
||||
`nomic-embed-text` query vectors are a **different vector space**, so no candidate
|
||||
cleared `ENGRAM_EMBED_SEED_MIN=0.60` (`act-stats`: `dup_seeds:0`, `ctx_cos:-2.000`
|
||||
sentinel) → results empty, ANN discovery produced no admitted seeds. Environmental
|
||||
(embedding provenance), **not** an M8 defect. The ANN wiring still *executed*
|
||||
(embed fetch succeeded, `embed_breaker_open:0`; `eg_vindex_sync` + seed block +
|
||||
`free(e_eff)` all ran) **without crashing** on the real store.
|
||||
|
||||
## KEY M8 METRIC — ANN vs O(n) seed selection (authoritative)
|
||||
|
||||
Because the HTTP path can't exercise ANN seeding without embedding-space parity, the
|
||||
authoritative ANN-vs-exact-scan numbers come from the **module benchmark**
|
||||
(`engram/test/run_vindex_tests.sh`, PASS 1, optimised), which measures the exact
|
||||
`vindex_search` code the M8 wiring calls, at full size:
|
||||
|
||||
| N (768-dim vectors) | Brute-force (O(n)) | ANN (HNSW) | **Speedup** |
|
||||
|---|---|---|---|
|
||||
| 5,000 | 3.475 ms/query | 0.353 ms/query | **9.8×** |
|
||||
| 20,000 | 13.809 ms/query | 0.698 ms/query | **19.8×** |
|
||||
|
||||
- **recall@10 = 0.9365** at `ef_search=128` (gate ≥0.90 — **PASS**). Lower ef trades
|
||||
recall for latency: ef=64→0.844, ef=32→0.750, ef=10→0.625.
|
||||
- **Determinism:** two independent seeded builds give byte-identical query results.
|
||||
- **`vindex_build_from_store`** over a real `engram_store`: inserts exactly the
|
||||
embedded nodes, top-1 resolves to the correct node id at ~0 distance.
|
||||
- **HNSW build cost (single-threaded, note for boot/index-build budgeting):**
|
||||
5,000 vectors ≈ 15–35 s, 20,000 vectors ≈ 75 s. In-process the index is built
|
||||
**lazily on first activation** (`eg_vindex_sync`) and grown incrementally; the
|
||||
M8 seed block only fires once `vindex_size ≥ ENGRAM_EMBED_SEED_K`. At the real
|
||||
store's 4,190 embedded nodes this is a **one-time few-second first-activation
|
||||
cost** — worth watching as the embedded set grows (a future milestone may want
|
||||
to build the index at boot or persist it via `vindex_save`/`vindex_load`).
|
||||
|
||||
## Seed-set parity note (why there is no runtime A/B toggle)
|
||||
|
||||
M8 has **no ANN on/off env flag** by design (`ENGRAM_EMBED_SEED_K` is a compile-time
|
||||
constant). The exact O(n) cosine scan is **preserved verbatim** and "tops up" any seed
|
||||
slot the ANN leaves unfilled; every ANN candidate is admitted through the *identical*
|
||||
cosine/dedup/threshold gate the exact scan uses. So ANN changes only *which nodes are
|
||||
discovered and how fast*, never the final seed set — parity is **structural**, not
|
||||
A/B-tested via flag. Recovered-behaviour-when-index-absent is the pre-M8 exact scan.
|
||||
|
||||
## Integration Findings (first full build of the tiered trunk)
|
||||
|
||||
1. **CRITICAL / pre-existing (NOT M8): `btree_insert` stack-buffer-overflow on
|
||||
opening the live 458 MB `neuron.egm`.** `SIGABRT` (`__stack_chk_fail`) via
|
||||
`btree_insert ← btree_put ← edge_place/apply_edge_put ← engram_open ←
|
||||
engram_store_boot`. Reproduces on the M8 binary **and** the deployed live binary —
|
||||
**the live engram :8742 was crash-looping (18 crash reports 16:18→17:44 on this
|
||||
date; service refusing connections).** A clean import into a fresh 59.9 MB egm does
|
||||
**not** crash (43k edges load fine), so the trigger is the specific pathological
|
||||
live store: 458 MB (8× the healthy 59.9 MB) from a day of churn/tombstones with no
|
||||
M5 compaction + a 44 MB un-checkpointed WAL replayed on open. The bug is in
|
||||
`engram_store.c` (the edge B-tree / WAL-redo path), **upstream of everything M8
|
||||
touched** (M8 lives in `el_runtime.c::engram_activate`). Fix required before any
|
||||
re-cutover; `btree_insert` must bound-check regardless of on-disk content.
|
||||
2. **M8 deferred `free(e_eff)`** (the flagged memory-management concern): compiled
|
||||
warning-free, and the wired path executed end-to-end over HTTP on the real store
|
||||
(with a real query embedding) with **no crash / no new crash report** — no
|
||||
double-free or use-after-free observed. Freed on all early-return paths and exactly
|
||||
once post-seed-selection.
|
||||
3. **Write durability + retrieval-fix dedup**: create → checkpoint → clean SIGTERM →
|
||||
restart → node found **by id and by search** (node_count 13,036→13,037 preserved).
|
||||
|
||||
## Caveats
|
||||
|
||||
- All on a copy; healthy-substrate numbers are from a re-imported store, not the live
|
||||
paged store (which is currently un-bootable — Finding 1).
|
||||
- Single-run metrics; no thermal control.
|
||||
- Embedding-space mismatch prevented a real semantic `q=bullshit` activation in this
|
||||
harness; the ANN speedup number is the module benchmark, which is the correct gauge.
|
||||
Reference in New Issue
Block a user