From 29f08010128fd570b42036781ce31fda4bfb3eeb Mon Sep 17 00:00:00 2001 From: gabewillen Date: Thu, 16 Jul 2026 11:52:01 -0500 Subject: [PATCH 01/18] Rearm consolidation on throughput drift --- docs/paper/_manuscript/index.md | 37 ++++++--- docs/paper/sections/10_implementation.qmd | 7 +- docs/paper/sections/7_consolidation.qmd | 14 +++- ...onsolidation_throughput_state_internal.hpp | 15 +++- tests/operations_consolidation.test.cpp | 82 +++++++++++++++++++ 5 files changed, 137 insertions(+), 18 deletions(-) diff --git a/docs/paper/_manuscript/index.md b/docs/paper/_manuscript/index.md index 8d55aba7..b880a131 100644 --- a/docs/paper/_manuscript/index.md +++ b/docs/paper/_manuscript/index.md @@ -2945,6 +2945,7 @@ z = (m_rate - r_floor) / range p_required(F,S,T) = p(F,S,T) / consolidation_escalation(T) p_rearm(F,S,T) = p(F,S,T) + (1 - p(F,S,T)) * T +p_drift(F,S,T) = 1 - p(F,S,T) consolidation_state = None, if armed = false @@ -2967,12 +2968,20 @@ cluster exists. The acknowledgment resets the next event-derived range to the current rate: both floor and peak become that rate. This prevents a historical spike from suppressing recommendations after a throughput regime shift. Ordinary throughput observations establish a new peak and -rearm the classifier only after normalized position *z* reaches -*p**r**e**a**r**m*; failed transactions restore the prior -armed state and range. No count or elapsed-time horizon controls the -reset. The floor, peak, initialization, and armed fields are stored in -the singleton processor state row and participate in rollback, restart, -and ephemeral-query snapshot restoration. The engine can recommend +rearm the classifier only after the observed relative range is material: +(*r**p**e**a**k* − *r**f**l**o**o**r*)/max (*r**p**e**a**k*, *ϵ*) ≥ *p**d**r**i**f**t*. +Because *p* is clamped to \[0.20, 0.70\], the material drawdown remains +between 0.30 and 0.80 across the complete knob domain, including +*T* = 1. Once material, either recovery to +*z* ≥ *p**r**e**a**r**m* or sustained degradation to +*z* ≤ *p* rearms the classifier. The lower branch prevents a gradually +falling write rate from remaining permanently silent after +acknowledgment, while the material-range guard keeps stable jitter from +repeatedly rearming. Failed transactions restore the prior armed state +and range. No count or elapsed-time horizon controls the reset. The +floor, peak, initialization, and armed fields are stored in the +singleton processor state row and participate in rollback, restart, and +ephemeral-query snapshot restoration. The engine can recommend consolidation, but the API call is the only way to start it. `source_id` and modality are never hint inputs or maintenance commands. @@ -5635,12 +5644,16 @@ snapshot, successful state persistence writes both values, and processor teardown erases its lifecycle-owned entry. A committed maintenance request disarms the hint and resets the next event-derived floor and peak to the acknowledged rate; ordinary rate recovery establishes a new -range and rearms at the F/S/T-derived threshold. This event boundary -lets a lower throughput regime recover independently of an old spike -without a count or wall-clock horizon. Empty replay is acknowledged, -while a rolled-back request restores the exact prior latch and range. -State-row restoration does not depend on a nonzero processed-signal -counter, so a maintenance-only disarmed state survives restart. +range and rearms at the F/S/T-derived threshold. A material relative +drawdown can also rearm at the lower envelope edge, so sustained slow +degradation cannot follow the moving floor indefinitely; the same +material-range threshold suppresses rearming from ordinary jitter. This +event boundary lets a lower throughput regime recover independently of +an old spike without a count or wall-clock horizon. Empty replay is +acknowledged, while a rolled-back request restores the exact prior latch +and range. State-row restoration does not depend on a nonzero +processed-signal counter, so a maintenance-only disarmed state survives +restart. ## Soft Anchor Implementation Status diff --git a/docs/paper/sections/10_implementation.qmd b/docs/paper/sections/10_implementation.qmd index 2e5a555e..ce0d4cab 100644 --- a/docs/paper/sections/10_implementation.qmd +++ b/docs/paper/sections/10_implementation.qmd @@ -225,8 +225,11 @@ snapshot, successful state persistence writes both values, and processor teardown erases its lifecycle-owned entry. A committed maintenance request disarms the hint and resets the next event-derived floor and peak to the acknowledged rate; ordinary rate recovery establishes a new range and rearms at -the F/S/T-derived threshold. This event boundary lets a lower throughput regime -recover independently of an old spike without a count or wall-clock horizon. +the F/S/T-derived threshold. A material relative drawdown can also rearm at the +lower envelope edge, so sustained slow degradation cannot follow the moving +floor indefinitely; the same material-range threshold suppresses rearming from +ordinary jitter. This event boundary lets a lower throughput regime recover +independently of an old spike without a count or wall-clock horizon. Empty replay is acknowledged, while a rolled-back request restores the exact prior latch and range. State-row restoration does not depend on a nonzero processed-signal counter, so a maintenance-only disarmed state survives restart. diff --git a/docs/paper/sections/7_consolidation.qmd b/docs/paper/sections/7_consolidation.qmd index 160275e8..fd20cb77 100644 --- a/docs/paper/sections/7_consolidation.qmd +++ b/docs/paper/sections/7_consolidation.qmd @@ -73,6 +73,7 @@ z = (m_rate - r_floor) / range p_required(F,S,T) = p(F,S,T) / consolidation_escalation(T) p_rearm(F,S,T) = p(F,S,T) + (1 - p(F,S,T)) * T +p_drift(F,S,T) = 1 - p(F,S,T) consolidation_state = None, if armed = false @@ -94,9 +95,16 @@ A committed forced request acknowledges the active excursion by persisting the next event-derived range to the current rate: both floor and peak become that rate. This prevents a historical spike from suppressing recommendations after a throughput regime shift. Ordinary throughput observations establish a -new peak and rearm the classifier only after normalized position $z$ reaches -$p_{rearm}$; failed transactions restore the prior armed state and range. No -count or elapsed-time horizon controls the reset. The floor, peak, +new peak and rearm the classifier only after the observed relative range is +material: $(r_{peak}-r_{floor})/\max(r_{peak}, \epsilon) \ge p_{drift}$. +Because $p$ is clamped to $[0.20, 0.70]$, the material drawdown remains +between $0.30$ and $0.80$ across the complete knob domain, including $T=1$. +Once material, either recovery to $z \ge p_{rearm}$ or sustained degradation +to $z \le p$ rearms the classifier. The lower branch prevents a gradually +falling write rate from remaining permanently silent after acknowledgment, +while the material-range guard keeps stable jitter from repeatedly rearming. +Failed transactions restore the prior armed state and range. No count or +elapsed-time horizon controls the reset. The floor, peak, initialization, and armed fields are stored in the singleton processor state row and participate in rollback, restart, and ephemeral-query snapshot restoration. The engine can recommend consolidation, but the API call is the only way to diff --git a/src/operations/consolidation_throughput_state_internal.hpp b/src/operations/consolidation_throughput_state_internal.hpp index f7c9e44d..bfb7eb9e 100644 --- a/src/operations/consolidation_throughput_state_internal.hpp +++ b/src/operations/consolidation_throughput_state_internal.hpp @@ -92,6 +92,12 @@ RearmFraction (double focus, double sensitivity, double stability) + (1.0 - recommended) * core::Clamp (stability, 0.0, 1.0); } +inline double +DriftRearmFraction (double focus, double sensitivity, double stability) +{ + return 1.0 - TriggerFraction (focus, sensitivity, stability); +} + inline void Observe (const ProcessorContext &ctx, double rate, double focus, double sensitivity, double stability) @@ -129,7 +135,14 @@ Observe (const ProcessorContext &ctx, double rate, double focus, if (!state.armed && range > kRangeEpsilon) { const double position = (rate - state.floor) / range; - if (position >= RearmFraction (focus, sensitivity, stability)) + const double relative_range + = range / std::max (state.peak, kRangeEpsilon); + const bool material_excursion + = relative_range + >= DriftRearmFraction (focus, sensitivity, stability); + if (material_excursion + && (position >= RearmFraction (focus, sensitivity, stability) + || position <= TriggerFraction (focus, sensitivity, stability))) { state.armed = true; } diff --git a/tests/operations_consolidation.test.cpp b/tests/operations_consolidation.test.cpp index 68af7de8..a690d76f 100644 --- a/tests/operations_consolidation.test.cpp +++ b/tests/operations_consolidation.test.cpp @@ -137,6 +137,13 @@ TEST_CASE ("Consolidation throughput trigger fraction is monotonic in F/S/T", < throughput::TriggerFraction (0.5, 0.5, 0.2)); REQUIRE (throughput::RequiredTriggerFraction (0.5, 0.5, 0.5) < throughput::TriggerFraction (0.5, 0.5, 0.5)); + REQUIRE (throughput::DriftRearmFraction (0.8, 0.5, 0.5) + > throughput::DriftRearmFraction (0.2, 0.5, 0.5)); + REQUIRE (throughput::DriftRearmFraction (0.5, 0.8, 0.5) + < throughput::DriftRearmFraction (0.5, 0.2, 0.5)); + REQUIRE (throughput::DriftRearmFraction (0.5, 0.5, 0.8) + > throughput::DriftRearmFraction (0.5, 0.5, 0.2)); + REQUIRE (throughput::DriftRearmFraction (0.5, 0.5, 1.0) >= 0.30); } TEST_CASE ("Consolidation throughput observation tracks moving floor and peak", @@ -310,6 +317,81 @@ TEST_CASE ("Consolidation recommendation rearms after a lower throughput regime" throughput::Erase (pctx); } +TEST_CASE ("Sustained throughput drift rearms consolidation after acknowledgment", + "[operations][consolidation][hint][drift]") +{ + namespace throughput + = operations::consolidation_throughput_state_internal; + ProcessorContext pctx; + const double knob_values[] = { 0.0, 0.5, 1.0 }; + for (const double focus : knob_values) + { + for (const double sensitivity : knob_values) + { + for (const double stability : knob_values) + { + CAPTURE (focus, sensitivity, stability); + throughput::Reset (pctx, { 20.0, 100.0, true, true }); + REQUIRE (throughput::Classify (throughput::Find (pctx), 20.0, + 1, focus, sensitivity, stability) + != ConsolidationState::None); + throughput::Acknowledge (pctx, 100.0); + + ConsolidationState later_hint = ConsolidationState::None; + for (int rate = 99; rate >= 0; --rate) + { + throughput::Observe (pctx, static_cast (rate), focus, + sensitivity, stability); + later_hint = throughput::Classify ( + throughput::Find (pctx), static_cast (rate), 1, + focus, sensitivity, stability); + if (later_hint != ConsolidationState::None) + { + break; + } + } + + REQUIRE (later_hint != ConsolidationState::None); + } + } + } + throughput::Erase (pctx); +} + +TEST_CASE ("Stable noisy throughput stays disarmed after acknowledgment", + "[operations][consolidation][hint][drift]") +{ + namespace throughput + = operations::consolidation_throughput_state_internal; + ProcessorContext pctx; + const double knob_values[] = { 0.0, 0.5, 1.0 }; + const double ordinary_noise[] = { 99.999, 97.0, 100.0, 98.0, 96.0, + 99.0, 95.0, 98.0, 100.0 }; + for (const double focus : knob_values) + { + for (const double sensitivity : knob_values) + { + for (const double stability : knob_values) + { + CAPTURE (focus, sensitivity, stability); + throughput::Reset (pctx, { 20.0, 100.0, true, true }); + throughput::Acknowledge (pctx, 100.0); + for (const double rate : ordinary_noise) + { + throughput::Observe (pctx, rate, focus, sensitivity, + stability); + REQUIRE (throughput::Classify ( + throughput::Find (pctx), rate, 1, focus, + sensitivity, stability) + == ConsolidationState::None); + } + REQUIRE_FALSE (throughput::Find (pctx).armed); + } + } + } + throughput::Erase (pctx); +} + TEST_CASE ("Elapsed time alone does not recommend consolidation", "[operations][consolidation][hint]") { From 5f9b1d60b115bf119ccfabcb54c1de654043ebf0 Mon Sep 17 00:00:00 2001 From: gabewillen Date: Thu, 16 Jul 2026 14:09:38 -0500 Subject: [PATCH 02/18] Flatten Natural rollback snapshots --- docs/paper/_manuscript/index.md | 106 ++- docs/paper/sections/10_implementation.qmd | 40 + docs/paper/sections/11_optimization.qmd | 43 +- src/cortext.cpp | 10 +- src/operations/accumulator.cpp | 2 + src/operations/accumulator_reset.cpp | 2 + src/operations/memory_storage.cpp | 2 + .../signal_record_rollback_internal.hpp | 141 ++++ src/operations/working_memory.cpp | 3 + src/signal_processor.cpp | 436 ++++++++++- tests/cortext.test.cpp | 49 ++ tests/signal_processor.test.cpp | 681 ++++++++++++++++++ 12 files changed, 1504 insertions(+), 11 deletions(-) create mode 100644 src/operations/signal_record_rollback_internal.hpp diff --git a/docs/paper/_manuscript/index.md b/docs/paper/_manuscript/index.md index b880a131..e222af65 100644 --- a/docs/paper/_manuscript/index.md +++ b/docs/paper/_manuscript/index.md @@ -5487,6 +5487,37 @@ flags and persisted-record cursors. Association writers invalidate the fanout cache in constant time and rebuild it lazily on the next traversal. +Natural and Durable retention enter the same operation chain and +accumulate the current signal before boundary evaluation. Natural leaves +boundary and write acceptance to the accumulator algorithms. Durable +adds an explicit boundary and accepted flush of that same pending unit; +it does not construct a second single-signal memory alongside the +accumulated unit. The Durable packet is the last signal in the flushed +unit exactly once. + +Rollback snapshots move the private accumulator map, working-memory +records, and their blob-reference vectors out of the generic context +copy and restore their ownership immediately afterward. The active +source’s bounded scalar accumulator fields remain in the rollback +snapshot. An ordinary non-boundary Natural packet therefore journals +original vector lengths and appends in place without copying the prior +unit. A private rollback hook takes one deep backup of the active source +immediately before a path may mutate or clear its pre-existing records: +accepted storage, an accumulator flush reset, or an accepted interrupt +reset. Working-memory appends roll back by original vector length; +eviction moves the erased slot’s record-vector ownership into the +journal and maps surviving slot identities without copying their +history. A separate full-map hook is reserved for operations that +explicitly mutate foreign-source accumulator topology. Failure restores +the applicable ownership or backup; successful processing discards it. +This changes snapshot ownership only, not public state layout, +accumulator scoring, boundary decisions, write acceptance, or retrieval +ranking. The ownership journal is enabled only for the private +production operation root, whose mutation sites carry that contract. A +caller-supplied `IOperation` root retains the automatic complete-context +snapshot, preserving exact rollback for hookless destructive operations +and synchronous nested processing without a new public API requirement. + ## Current Operation Pipeline The production operation chain is: @@ -5704,6 +5735,18 @@ Graph expansion after seed discovery is bounded by F/S/T-derived row and fanout limits. Working-memory and soft-anchor updates operate over bounded live state and remain independent of total store size. +For an open Natural unit containing `U` signal records, the ordinary +rollback snapshot performs constant-time accumulator-map ownership +transfer plus record-vector ownership moves per working-memory slot and +does not copy the `U` records. Appending the next record remains +amortized `O(1)`. A boundary, Durable flush, or other destructive +active-source transition may copy `O(U)` active-unit records once for +exact rollback, then persist `O(U)` records. Working-memory append and +eviction rollback moves or trims owned vectors and does not copy +unrelated or cumulative working-memory history. This removes the prior +cumulative `O(U^2)` record-copy path across a long open unit; it does +not change the separate `O(Nd)` exact durable candidate search. + The safety checks preserve these bounds: bind-result validation is one branch per existing parameter, working-memory decay advances one timestamp per bounded slot and schedules at most one memory-row update @@ -5888,11 +5931,19 @@ semantic seed surface rollback snapshots -detach rebuildable durable caches before copying processor state; -ephemeral queries roll back their transaction and restore that exact -snapshot without rebuilding the unchanged search surface -generic failures and public no-store queries restore durable and -volatile processor state exactly +detach rebuildable durable caches, move the private accumulator map, +and detach working-memory signal-record and blob-reference vectors +before copying remaining processor state; journal active-source vector +lengths for ordinary appends and lazily deep-back up only the active +source before accepted storage, flush reset, or interrupt reset can +mutate prior records; trim working-memory appends and move an evicted +slot’s record ownership into the journal; reserve a full-map hook for +explicit foreign-source accumulator-topology mutation +non-boundary Natural ingestion does not recopy the growing pending +unit or source map; a one-source flush does not copy unrelated +open-source or working-memory history; failed writes and public no-store +queries restore durable and volatile state exactly; public state layout +and retention semantics are unchanged synaptic tagging @@ -5914,6 +5965,51 @@ The important correctness point is that these are implementation changes to the retained engine. They do not reintroduce the removed semantic batch stack. +### Natural/Durable Write-Path Ownership + +Natural retention was introduced after the earlier retrieval-latency +work, and the contemporaneous benchmark ingress was explicitly kept +Durable. The July 14 durable-ingestion optimization therefore +established the one-packet Durable profile, not the scaling of a long +open Natural unit. Source tracing shows that both retention values +already enter the same `FullRoot`; the competing cost was snapshot +ownership. Durable forces a boundary/write and resets the unit after +each call, while Natural can retain many embeddings and payloads. The +generic rollback copy detached durable search caches but still +deep-copied those pending records and completed working-memory record +lists on every packet. + +The cutover retains one accumulator/write algorithm. Natural continues +to append and uses unchanged adaptive grouping. Durable only forces the +explicit flush/commit edge over the same pending unit, including its own +packet once. The private rollback journal makes ordinary Natural +snapshot work independent of pending-record count; an actual boundary +pays one exact active-unit backup/write cost. Deterministic 32-, 512-, +and 4,096-record accumulator plus matching working-memory regressions +verify unchanged payload/blob allocation identities and zero lazy record +backups on ordinary rollback. A failing-flush regression verifies one +three-record active-source backup restores cleared records plus mutated +payload/blob state while 4,096 unrelated-source and working-memory +records remain allocation-identical and add zero to the copy counter. A +working-memory eviction regression moves one erased slot into the +journal and restores it beside 4,096 untouched records with zero record +copies. Controlled failures after active-record detachment, +accumulator-map transfer, and working-memory detachment verify +exception-safe restoration. A direct 4,096-record working-memory append +regression verifies length trimming and payload allocation identity +without record copies. The journal is selected by a private marker on +the production operation root; arbitrary caller-supplied operation roots +retain complete automatic context snapshots, proven by hookless +destructive and nested different-source failure regressions. A public +integration regression verifies two Natural packets followed by one +Durable packet produce one three-signal memory and three ordered signal +rows. An explicitly marked escalation regression verifies that an exact +active-source backup remains authoritative when a later foreign-topology +mutation requests a full-map backup and the combined operation fails. +These are source-health and work-count proofs. They do not reproduce the +full 15,500-packet observation and do not turn the exact durable +candidate scan into an asymptotically flat store search. + On 2026-06-30, a full Meta MSC replay rerun verified the retrieval-cache optimization on the same 9,130-turn slice used for the hosted frontier-judge artifact. The run preserved native probe behavior diff --git a/docs/paper/sections/10_implementation.qmd b/docs/paper/sections/10_implementation.qmd index ce0d4cab..a64452e5 100644 --- a/docs/paper/sections/10_implementation.qmd +++ b/docs/paper/sections/10_implementation.qmd @@ -74,6 +74,35 @@ restores working-memory dirty flags and persisted-record cursors. Association writers invalidate the fanout cache in constant time and rebuild it lazily on the next traversal. +Natural and Durable retention enter the same operation chain and accumulate the +current signal before boundary evaluation. Natural leaves boundary and write +acceptance to the accumulator algorithms. Durable adds an explicit boundary and +accepted flush of that same pending unit; it does not construct a second +single-signal memory alongside the accumulated unit. The Durable packet is the +last signal in the flushed unit exactly once. + +Rollback snapshots move the private accumulator map, working-memory records, +and their blob-reference vectors out of the generic context copy and restore +their ownership immediately afterward. The active source's bounded scalar +accumulator fields remain in the rollback snapshot. An ordinary non-boundary +Natural packet therefore journals original vector lengths and appends in place +without copying the prior unit. A private rollback hook takes one deep backup +of the active source immediately before a path may mutate or clear its +pre-existing records: accepted storage, an accumulator flush reset, or an +accepted interrupt reset. Working-memory appends roll back by original vector +length; eviction moves the erased slot's record-vector ownership into the +journal and maps surviving slot identities without copying their history. A +separate full-map hook is reserved for operations that explicitly mutate +foreign-source accumulator topology. Failure restores the applicable ownership +or backup; successful processing discards it. This changes snapshot ownership only, +not public state layout, accumulator +scoring, boundary decisions, write acceptance, or retrieval ranking. +The ownership journal is enabled only for the private production operation root, +whose mutation sites carry that contract. A caller-supplied `IOperation` root +retains the automatic complete-context snapshot, preserving exact rollback for +hookless destructive operations and synchronous nested processing without a +new public API requirement. + ## Current Operation Pipeline The production operation chain is: @@ -279,6 +308,17 @@ is bounded by F/S/T-derived row and fanout limits. Working-memory and soft-anchor updates operate over bounded live state and remain independent of total store size. +For an open Natural unit containing `U` signal records, the ordinary rollback +snapshot performs constant-time accumulator-map ownership transfer plus +record-vector ownership moves per working-memory slot and does not copy the `U` +records. Appending the next record remains amortized `O(1)`. A boundary, +Durable flush, or other destructive active-source transition may copy `O(U)` +active-unit records once for exact rollback, then persist `O(U)` records. +Working-memory append and eviction rollback moves or trims owned vectors and +does not copy unrelated or cumulative working-memory history. +This removes the prior cumulative `O(U^2)` record-copy path across a long open +unit; it does not change the separate `O(Nd)` exact durable candidate search. + The safety checks preserve these bounds: bind-result validation is one branch per existing parameter, working-memory decay advances one timestamp per bounded slot and schedules at most one memory-row update per changed slot during normal diff --git a/docs/paper/sections/11_optimization.qmd b/docs/paper/sections/11_optimization.qmd index e2c26436..e539b454 100644 --- a/docs/paper/sections/11_optimization.qmd +++ b/docs/paper/sections/11_optimization.qmd @@ -66,13 +66,54 @@ The current branch includes the following implementation-level changes: | memory storage | avoid redundant object-store writes for single-signal memory payloads | durable payload identity is preserved | | exact durable-neighbor ranking | maintain private current/base embedding surfaces in a process-wide lifecycle registry, including signal-only rows that affect the sqlite-vec population; rank into typed borrowed/owned candidates; reuse the query norm across exact cosine checks | the registry follows processor teardown across sequential thread migration and mirrors authoritative SQL write decisions; the same candidate population, K, filters, tie order, cosine results, thresholds, and supersession edges are retained; SQL remains the fallback and no public header or API layout changes | | graph retrieval | score vector similarity first, restrict recency to a tie-break, cap graph bonus, and reserve final occupancy for direct semantic anchors | recent unrelated rows and noisy graph neighbors cannot displace the semantic seed surface | -| rollback snapshots | detach rebuildable durable caches before copying processor state; ephemeral queries roll back their transaction and restore that exact snapshot without rebuilding the unchanged search surface | generic failures and public no-store queries restore durable and volatile processor state exactly | +| rollback snapshots | detach rebuildable durable caches, move the private accumulator map, and detach working-memory signal-record and blob-reference vectors before copying remaining processor state; journal active-source vector lengths for ordinary appends and lazily deep-back up only the active source before accepted storage, flush reset, or interrupt reset can mutate prior records; trim working-memory appends and move an evicted slot's record ownership into the journal; reserve a full-map hook for explicit foreign-source accumulator-topology mutation | non-boundary Natural ingestion does not recopy the growing pending unit or source map; a one-source flush does not copy unrelated open-source or working-memory history; failed writes and public no-store queries restore durable and volatile state exactly; public state layout and retention semantics are unchanged | | synaptic tagging | use indexed temporal candidate supersets with boundary ties before applying the original exact score and order | the same nearest source-backed memories are tagged without a whole-source group scan | | live replay ingress | internal replay path can skip per-event hydration when no probe needs it | public processing APIs still hydrate normally | The important correctness point is that these are implementation changes to the retained engine. They do not reintroduce the removed semantic batch stack. +### Natural/Durable Write-Path Ownership + +Natural retention was introduced after the earlier retrieval-latency work, and +the contemporaneous benchmark ingress was explicitly kept Durable. The July 14 +durable-ingestion optimization therefore established the one-packet Durable +profile, not the scaling of a long open Natural unit. Source tracing shows that +both retention values already enter the same `FullRoot`; the competing cost was +snapshot ownership. Durable forces a boundary/write and resets the unit after +each call, while Natural can retain many embeddings and payloads. The generic +rollback copy detached durable search caches but still deep-copied those pending +records and completed working-memory record lists on every packet. + +The cutover retains one accumulator/write algorithm. Natural continues to +append and uses unchanged adaptive grouping. Durable only forces the explicit +flush/commit edge over the same pending unit, including its own packet once. +The private rollback journal makes ordinary Natural snapshot work independent +of pending-record count; an actual boundary pays one exact active-unit +backup/write cost. Deterministic 32-, 512-, and 4,096-record accumulator plus matching +working-memory regressions verify unchanged payload/blob allocation identities +and zero lazy record backups on ordinary rollback. A failing-flush regression +verifies one three-record active-source backup restores cleared records plus +mutated payload/blob state while 4,096 unrelated-source and working-memory +records remain allocation-identical and add zero to the copy counter. A +working-memory eviction regression moves one erased slot into the journal and +restores it beside 4,096 untouched records with zero record copies. Controlled +failures after active-record detachment, accumulator-map transfer, and +working-memory detachment verify exception-safe restoration. A direct +4,096-record working-memory append regression verifies length trimming and +payload allocation identity without record copies. The journal is selected by +a private marker on the production operation root; arbitrary caller-supplied +operation roots retain complete automatic context snapshots, proven by +hookless destructive and nested different-source failure regressions. A public integration +regression verifies two Natural packets followed by one +Durable packet produce one three-signal memory and three ordered signal rows. +An explicitly marked escalation regression verifies that an exact active-source +backup remains authoritative when a later foreign-topology mutation requests a +full-map backup and the combined operation fails. +These are source-health and work-count proofs. They do not reproduce the full +15,500-packet observation and do not turn the exact durable candidate scan into +an asymptotically flat store search. + On 2026-06-30, a full Meta MSC replay rerun verified the retrieval-cache optimization on the same 9,130-turn slice used for the hosted frontier-judge artifact. The run preserved native probe behavior exactly: all non-timing probe diff --git a/src/cortext.cpp b/src/cortext.cpp index 1a6d8c5e..a7f32271 100644 --- a/src/cortext.cpp +++ b/src/cortext.cpp @@ -10,6 +10,7 @@ #include "operations/constructive_recall_internal.hpp" #include "operations/meta_learning_internal.hpp" #include "operations/retrieval_trace_state.hpp" +#include "operations/signal_record_rollback_internal.hpp" #include "experimental_env.hpp" #include "signal_filter.hpp" #include "streaming_text_probe.hpp" @@ -1247,10 +1248,13 @@ BuildRootOperationSet (bool probe_mode) if (probe_mode) { - return std::make_unique (); + return operations::signal_record_rollback_internal::MarkJournalAware ( + std::make_unique ()); } - return std::make_unique ( - std::make_unique (), std::make_unique ()); + return operations::signal_record_rollback_internal::MarkJournalAware ( + std::make_unique ( + std::make_unique (), + std::make_unique ())); } namespace diff --git a/src/operations/accumulator.cpp b/src/operations/accumulator.cpp index 28285a6a..ac30f2e8 100644 --- a/src/operations/accumulator.cpp +++ b/src/operations/accumulator.cpp @@ -6,6 +6,7 @@ #include "cortext/signal.hpp" #include "cortext/telemetry/telemetry.hpp" #include "../experimental_env.hpp" +#include "signal_record_rollback_internal.hpp" #include #include @@ -164,6 +165,7 @@ UpdateAccumulator::Execute (OperationContext &context, if (accept) { + signal_record_rollback_internal::EnsureBackedUp (p_ctx); acc.ResetForNextUnit (signal.timestamp); context.SetInterruptAborted (true); telemetry::AddCounter ("cortext.accumulator.interrupt_abort_total", 1); diff --git a/src/operations/accumulator_reset.cpp b/src/operations/accumulator_reset.cpp index dff44f80..58f082de 100644 --- a/src/operations/accumulator_reset.cpp +++ b/src/operations/accumulator_reset.cpp @@ -3,6 +3,7 @@ #include "cortext/processor/accumulator_state.hpp" #include "cortext/processor/operation_context.hpp" #include "cortext/telemetry/telemetry.hpp" +#include "signal_record_rollback_internal.hpp" namespace cortext::operations { @@ -32,6 +33,7 @@ ResetAccumulatorAfterFlush::Execute (OperationContext &context, return; } + signal_record_rollback_internal::EnsureBackedUp (p_ctx); it->second.ResetForNextUnit (signal.timestamp); } diff --git a/src/operations/memory_storage.cpp b/src/operations/memory_storage.cpp index 84ca23f5..46c77836 100644 --- a/src/operations/memory_storage.cpp +++ b/src/operations/memory_storage.cpp @@ -1,6 +1,7 @@ #include "cortext/operations/memory_storage.hpp" #include "constructive_recall_internal.hpp" #include "historical_surface_search_cache_internal.hpp" +#include "signal_record_rollback_internal.hpp" #include "cortext/core/algorithms.hpp" #include "cortext/core/knobs.hpp" #include "cortext/core/utils.hpp" @@ -621,6 +622,7 @@ MemoryStorage::Execute (OperationContext &context, Transaction &tx) const } auto &p_ctx = context.GetProcessorContext (); + signal_record_rollback_internal::EnsureBackedUp (p_ctx); // Get accumulator state for this source auto acc_it = p_ctx.accumulator_states.find (signal.source_id); diff --git a/src/operations/signal_record_rollback_internal.hpp b/src/operations/signal_record_rollback_internal.hpp new file mode 100644 index 00000000..e1a0f2c7 --- /dev/null +++ b/src/operations/signal_record_rollback_internal.hpp @@ -0,0 +1,141 @@ +#pragma once + +#include "cortext/processor/processor_context.hpp" +#include "cortext/processor/operation.hpp" + +#include + +namespace cortext::operations::signal_record_rollback_internal +{ + +class JournalAwareOperation +{ +public: + virtual ~JournalAwareOperation () = default; +}; + +class JournalAwareOperationAdapter final : public IOperation, + public JournalAwareOperation +{ +public: + explicit JournalAwareOperationAdapter (std::unique_ptr operation) + : operation_ (std::move (operation)) + { + } + + void + Execute (OperationContext &context, Transaction &tx) const override + { + operation_->Execute (context, tx); + } + +private: + std::unique_ptr operation_; +}; + +inline std::unique_ptr +MarkJournalAware (std::unique_ptr operation) +{ + return std::make_unique ( + std::move (operation)); +} + +// Internal operations must call EnsureBackedUp before destructively changing +// the active source's accumulator records or working-memory record/blob-id +// vectors. Append-only active-source changes are journaled by retained +// ownership and do not require a backup. A path that mutates foreign +// accumulator topology must instead call EnsureAllBackedUp explicitly. + +class Scope +{ +public: + using BackupFn = void (*) (void *owner); + using PreserveSlotFn = void (*) (void *owner, std::size_t slot_index); + + Scope (ProcessorContext &context, void *owner, BackupFn backup, + BackupFn backup_all, PreserveSlotFn preserve_slot) + : context_ (&context), owner_ (owner), backup_ (backup), + backup_all_ (backup_all), preserve_slot_ (preserve_slot), + previous_ (active_) + { + active_ = this; + } + + ~Scope () + { + active_ = previous_; + } + + Scope (const Scope &) = delete; + Scope &operator= (const Scope &) = delete; + + static void + EnsureBackedUp (ProcessorContext &context) + { + for (auto *scope = active_; scope; scope = scope->previous_) + { + if (scope->context_ == &context) + { + scope->backup_ (scope->owner_); + return; + } + } + } + + static void + EnsureAllBackedUp (ProcessorContext &context) + { + for (auto *scope = active_; scope; scope = scope->previous_) + { + if (scope->context_ == &context) + { + scope->backup_all_ (scope->owner_); + return; + } + } + } + + static void + PreserveWorkingMemorySlotBeforeErase (ProcessorContext &context, + std::size_t slot_index) + { + for (auto *scope = active_; scope; scope = scope->previous_) + { + if (scope->context_ == &context) + { + scope->preserve_slot_ (scope->owner_, slot_index); + return; + } + } + } + +private: + ProcessorContext *context_ = nullptr; + void *owner_ = nullptr; + BackupFn backup_ = nullptr; + BackupFn backup_all_ = nullptr; + PreserveSlotFn preserve_slot_ = nullptr; + Scope *previous_ = nullptr; + static inline thread_local Scope *active_ = nullptr; +}; + +inline void +EnsureBackedUp (ProcessorContext &context) +{ + Scope::EnsureBackedUp (context); +} + +inline void +EnsureAllBackedUp (ProcessorContext &context) +{ + Scope::EnsureAllBackedUp (context); +} + +inline void +PreserveWorkingMemorySlotBeforeErase (ProcessorContext &context, + std::size_t slot_index) +{ + Scope::PreserveWorkingMemorySlotBeforeErase (context, slot_index); +} + +} // namespace cortext::operations::signal_record_rollback_internal diff --git a/src/operations/working_memory.cpp b/src/operations/working_memory.cpp index 015b358f..feda5b5d 100644 --- a/src/operations/working_memory.cpp +++ b/src/operations/working_memory.cpp @@ -1,4 +1,5 @@ #include "cortext/operations/working_memory.hpp" +#include "signal_record_rollback_internal.hpp" #include "cortext/core/algorithms.hpp" #include "cortext/core/knobs.hpp" @@ -527,6 +528,8 @@ WorkingMemory::Execute (OperationContext &context, Transaction &tx) const if (evict_idx >= 0) { + signal_record_rollback_internal::PreserveWorkingMemorySlotBeforeErase ( + p_ctx, static_cast (evict_idx)); p_ctx.wm_slots.erase (p_ctx.wm_slots.begin () + static_cast (evict_idx)); p_ctx.wm_slots_dirty = true; diff --git a/src/signal_processor.cpp b/src/signal_processor.cpp index 2dfcdf52..847b1f21 100644 --- a/src/signal_processor.cpp +++ b/src/signal_processor.cpp @@ -13,6 +13,7 @@ #include "operations/constructive_recall_internal.hpp" #include "operations/consolidation_throughput_state_internal.hpp" #include "operations/historical_surface_search_cache_internal.hpp" +#include "operations/signal_record_rollback_internal.hpp" #include "working_memory_time_internal.hpp" #include #include @@ -241,10 +242,398 @@ struct ProcessorRollbackSnapshot bool initialized = false; }; +struct DetachedWorkingMemoryRecords +{ + struct SlotRecords + { + std::size_t slot_index = 0; + std::vector records; + std::vector> blob_ids; + }; + + std::vector slots; +}; + +DetachedWorkingMemoryRecords +DetachWorkingMemoryRecords (ProcessorContext &context) +{ + DetachedWorkingMemoryRecords detached; + detached.slots.reserve (context.wm_slots.size ()); + for (std::size_t index = 0; index < context.wm_slots.size (); ++index) + { + auto &slot = context.wm_slots[index]; + detached.slots.push_back ( + { index, std::move (slot.signal_records), + std::move (slot.blob_ids) }); + slot.signal_records.clear (); + slot.blob_ids.clear (); + } + return detached; +} + +void +AttachWorkingMemoryRecords (ProcessorContext &context, + DetachedWorkingMemoryRecords &detached) +{ + for (auto &entry : detached.slots) + { + if (entry.slot_index < context.wm_slots.size ()) + { + context.wm_slots[entry.slot_index].signal_records + = std::move (entry.records); + context.wm_slots[entry.slot_index].blob_ids + = std::move (entry.blob_ids); + } + } +} + #if defined(CORTEXT_TESTING) std::atomic_size_t g_processor_rollback_snapshot_owner_count { 0 }; std::atomic_size_t g_processor_rollback_snapshot_reuse_count { 0 }; +std::atomic_size_t g_signal_record_rollback_backup_count { 0 }; +std::atomic_size_t g_signal_record_rollback_copied_record_count { 0 }; +std::atomic_int g_signal_record_snapshot_setup_throw_stage { 0 }; +#endif + +class SignalRecordRollbackJournal +{ +public: + SignalRecordRollbackJournal (ProcessorContext &context, + std::string source_id, bool journal_aware) + : context_ (context), source_id_ (std::move (source_id)), + journal_aware_ (journal_aware) + { + } + + void + CopyScalarSnapshotTo (ProcessorContext &snapshot) + { + if (!journal_aware_) + { + snapshot = context_; + return; + } + working_memory_sizes_.clear (); + working_memory_sizes_.reserve (context_.wm_slots.size ()); + working_memory_live_to_original_.clear (); + working_memory_live_to_original_.reserve (context_.wm_slots.size ()); + preserved_working_memory_.slots.clear (); + preserved_working_memory_.slots.reserve (context_.wm_slots.size ()); + for (std::size_t index = 0; index < context_.wm_slots.size (); ++index) + { + working_memory_live_to_original_.push_back (index); + } + + std::vector current_records; + std::vector> current_blob_ids; + std::unordered_map accumulators; + DetachedWorkingMemoryRecords detached; + bool current_records_detached = false; + bool accumulators_detached = false; + bool working_memory_detached = false; + try + { + auto current_it = context_.accumulator_states.find (source_id_); + if (current_it != context_.accumulator_states.end ()) + { + current_existed_ = true; + original_record_size_ = current_it->second.signals.size (); + original_blob_id_size_ = current_it->second.blob_ids.size (); + current_records = std::move (current_it->second.signals); + current_blob_ids = std::move (current_it->second.blob_ids); + current_records_detached = true; + MaybeThrowDuringSnapshotSetup (1); + current_before_ = current_it->second; + current_it->second.signals = std::move (current_records); + current_it->second.blob_ids = std::move (current_blob_ids); + current_records_detached = false; + } + accumulators = std::move (context_.accumulator_states); + context_.accumulator_states.clear (); + accumulators_detached = true; + MaybeThrowDuringSnapshotSetup (2); + detached = DetachWorkingMemoryRecords (context_); + working_memory_detached = true; + MaybeThrowDuringSnapshotSetup (3); + for (const auto &entry : detached.slots) + { + working_memory_sizes_.push_back ( + { entry.records.size (), entry.blob_ids.size () }); + } + snapshot = context_; + context_.accumulator_states = std::move (accumulators); + accumulators_detached = false; + AttachWorkingMemoryRecords (context_, detached); + working_memory_detached = false; + } + catch (...) + { + if (working_memory_detached) + { + AttachWorkingMemoryRecords (context_, detached); + } + if (accumulators_detached) + { + context_.accumulator_states = std::move (accumulators); + } + if (current_records_detached) + { + auto current_it = context_.accumulator_states.find (source_id_); + if (current_it != context_.accumulator_states.end ()) + { + current_it->second.signals = std::move (current_records); + current_it->second.blob_ids = std::move (current_blob_ids); + } + } + throw; + } + } + + void + RestoreRecordsInto (ProcessorContext &snapshot) + { + if (!journal_aware_) + { + return; + } + if (full_accumulator_backup_) + { + snapshot.accumulator_states = std::move (*full_accumulator_backup_); + full_accumulator_backup_.reset (); + } + else if (destructive_backup_) + { + if (current_existed_) + { + context_.accumulator_states.insert_or_assign ( + source_id_, std::move (*current_accumulator_backup_)); + } + else + { + context_.accumulator_states.erase (source_id_); + } + snapshot.accumulator_states = std::move (context_.accumulator_states); + current_accumulator_backup_.reset (); + } + else + { + RestoreCurrentAccumulator (context_.accumulator_states); + snapshot.accumulator_states = std::move (context_.accumulator_states); + } + RestoreWorkingMemoryRecordsInto (snapshot); + } + + void + EnsureBackedUp () + { + if (destructive_backup_ || full_accumulator_backup_) + { + return; + } + if (current_existed_) + { + current_accumulator_backup_ = CopyCurrentAccumulatorBefore (); + } +#if defined(CORTEXT_TESTING) + std::size_t copied_records = current_accumulator_backup_ + ? current_accumulator_backup_->signals.size () + : 0; + g_signal_record_rollback_backup_count.fetch_add ( + 1, std::memory_order_relaxed); + g_signal_record_rollback_copied_record_count.fetch_add ( + copied_records, std::memory_order_relaxed); +#endif + destructive_backup_ = true; + } + + void + EnsureAllBackedUp () + { + if (full_accumulator_backup_) + { + return; + } + auto accumulator_backup = context_.accumulator_states; + RestoreCurrentAccumulator (accumulator_backup); + if (current_accumulator_backup_) + { + accumulator_backup.insert_or_assign ( + source_id_, *current_accumulator_backup_); + } +#if defined(CORTEXT_TESTING) + std::size_t copied_records = 0; + for (const auto &[_, accumulator] : accumulator_backup) + { + copied_records += accumulator.signals.size (); + } + g_signal_record_rollback_backup_count.fetch_add ( + 1, std::memory_order_relaxed); + g_signal_record_rollback_copied_record_count.fetch_add ( + copied_records, std::memory_order_relaxed); +#endif + full_accumulator_backup_ = std::move (accumulator_backup); + current_accumulator_backup_.reset (); + destructive_backup_ = false; + } + + static void + EnsureBackedUpThunk (void *owner) + { + static_cast (owner)->EnsureBackedUp (); + } + + static void + EnsureAllBackedUpThunk (void *owner) + { + static_cast (owner)->EnsureAllBackedUp (); + } + + void + PreserveWorkingMemorySlotBeforeErase (std::size_t slot_index) + { + if (slot_index >= context_.wm_slots.size () + || slot_index >= working_memory_live_to_original_.size ()) + { + return; + } + auto &slot = context_.wm_slots[slot_index]; + preserved_working_memory_.slots.push_back ( + { working_memory_live_to_original_[slot_index], + std::move (slot.signal_records), std::move (slot.blob_ids) }); + slot.signal_records.clear (); + slot.blob_ids.clear (); + working_memory_live_to_original_.erase ( + working_memory_live_to_original_.begin () + + static_cast (slot_index)); + } + + static void + PreserveWorkingMemorySlotBeforeEraseThunk (void *owner, + std::size_t slot_index) + { + static_cast (owner) + ->PreserveWorkingMemorySlotBeforeErase (slot_index); + } + +private: + static void + MaybeThrowDuringSnapshotSetup (int stage) + { +#if defined(CORTEXT_TESTING) + int expected = stage; + if (g_signal_record_snapshot_setup_throw_stage.compare_exchange_strong ( + expected, 0, std::memory_order_relaxed)) + { + throw std::runtime_error ("injected snapshot setup failure"); + } +#else + (void)stage; #endif + } + + struct RecordVectorSizes + { + std::size_t records = 0; + std::size_t blob_ids = 0; + }; + + AccumulatorState + CopyCurrentAccumulatorBefore () const + { + const auto current_it = context_.accumulator_states.find (source_id_); + AccumulatorState copied = current_it->second; + copied.signals.resize ( + std::min (copied.signals.size (), original_record_size_)); + copied.blob_ids.resize ( + std::min (copied.blob_ids.size (), original_blob_id_size_)); + AccumulatorState restored = *current_before_; + restored.signals = std::move (copied.signals); + restored.blob_ids = std::move (copied.blob_ids); + return restored; + } + + void + RestoreCurrentAccumulator ( + std::unordered_map &accumulators) const + { + if (!current_existed_) + { + accumulators.erase (source_id_); + return; + } + auto current_it = accumulators.find (source_id_); + std::vector records; + std::vector> blob_ids; + if (current_it != accumulators.end ()) + { + records = std::move (current_it->second.signals); + blob_ids = std::move (current_it->second.blob_ids); + } + records.resize (std::min (records.size (), original_record_size_)); + blob_ids.resize (std::min (blob_ids.size (), original_blob_id_size_)); + AccumulatorState restored = *current_before_; + restored.signals = std::move (records); + restored.blob_ids = std::move (blob_ids); + accumulators.insert_or_assign (source_id_, std::move (restored)); + } + + void + TrimWorkingMemoryToOriginalSizes ( + DetachedWorkingMemoryRecords &records) const + { + for (auto &entry : records.slots) + { + const RecordVectorSizes original + = entry.slot_index < working_memory_sizes_.size () + ? working_memory_sizes_[entry.slot_index] + : RecordVectorSizes{}; + entry.records.resize ( + std::min (entry.records.size (), original.records)); + entry.blob_ids.resize ( + std::min (entry.blob_ids.size (), original.blob_ids)); + } + } + + void + RestoreWorkingMemoryRecordsInto (ProcessorContext &snapshot) + { + auto live_records = DetachWorkingMemoryRecords (context_); + DetachedWorkingMemoryRecords restored; + restored.slots.reserve (working_memory_sizes_.size ()); + const std::size_t retained_count = std::min ( + live_records.slots.size (), working_memory_live_to_original_.size ()); + for (std::size_t index = 0; index < retained_count; ++index) + { + auto &entry = live_records.slots[index]; + restored.slots.push_back ( + { working_memory_live_to_original_[index], + std::move (entry.records), std::move (entry.blob_ids) }); + } + for (auto &entry : preserved_working_memory_.slots) + { + restored.slots.push_back ( + { entry.slot_index, std::move (entry.records), + std::move (entry.blob_ids) }); + } + TrimWorkingMemoryToOriginalSizes (restored); + AttachWorkingMemoryRecords (snapshot, restored); + } + + ProcessorContext &context_; + std::string source_id_; + bool current_existed_ = false; + bool journal_aware_ = false; + std::size_t original_record_size_ = 0; + std::size_t original_blob_id_size_ = 0; + std::optional current_before_; + std::vector working_memory_sizes_; + std::vector working_memory_live_to_original_; + DetachedWorkingMemoryRecords preserved_working_memory_; + bool destructive_backup_ = false; + std::optional current_accumulator_backup_; + std::optional> + full_accumulator_backup_; +}; /// Owns the caller-provided operation and the rollback storage for its /// SignalProcessor. A single handle already requires external synchronization; @@ -293,7 +682,11 @@ class SnapshotOwningOperation final : public IOperation }; explicit SnapshotOwningOperation (std::unique_ptr operation) - : operation_ (std::move (operation)) + : journal_aware_ ( + dynamic_cast (operation.get ()) + != nullptr), + operation_ (std::move (operation)) { #if defined(CORTEXT_TESTING) g_processor_rollback_snapshot_owner_count.fetch_add ( @@ -328,6 +721,12 @@ class SnapshotOwningOperation final : public IOperation return Lease (*this, snapshot); } + bool + IsJournalAware () const + { + return journal_aware_; + } + void Execute (OperationContext &ctx, Transaction &tx) const override { @@ -341,6 +740,7 @@ class SnapshotOwningOperation final : public IOperation --active_depth_; } + bool journal_aware_ = false; std::unique_ptr operation_; std::vector> snapshots_; std::size_t active_depth_ = 0; @@ -2021,6 +2421,27 @@ ProcessorRollbackSnapshotReuseCountForTest () return g_processor_rollback_snapshot_reuse_count.load ( std::memory_order_relaxed); } + +std::size_t +SignalRecordRollbackBackupCountForTest () +{ + return g_signal_record_rollback_backup_count.load ( + std::memory_order_relaxed); +} + +std::size_t +SignalRecordRollbackCopiedRecordCountForTest () +{ + return g_signal_record_rollback_copied_record_count.load ( + std::memory_order_relaxed); +} + +void +SetSignalRecordSnapshotSetupThrowStageForTest (int stage) +{ + g_signal_record_snapshot_setup_throw_stage.store ( + stage, std::memory_order_relaxed); +} } // namespace testing #endif @@ -2128,11 +2549,14 @@ SignalProcessor::Process (const Signal &signal) = static_cast (*root_operation_); auto snapshot_lease = snapshot_owner.Acquire (); auto &rollback_snapshot = snapshot_lease.Get (); + SignalRecordRollbackJournal signal_record_journal ( + *context_, signal.source_id, snapshot_owner.IsJournalAware ()); { auto detached_caches = DetachRebuildableProcessorCaches (*context_); try { - rollback_snapshot.context = *context_; + signal_record_journal.CopyScalarSnapshotTo ( + rollback_snapshot.context); rollback_snapshot.caches = detached_caches; rollback_snapshot.consolidation_throughput = operations::consolidation_throughput_state_internal::Find ( @@ -2151,6 +2575,12 @@ SignalProcessor::Process (const Signal &signal) OperationContext op_context (signal, *context_, config_, store_.get (), object_tx.get ()); + operations::signal_record_rollback_internal::Scope + signal_record_rollback_scope ( + *context_, &signal_record_journal, + &SignalRecordRollbackJournal::EnsureBackedUpThunk, + &SignalRecordRollbackJournal::EnsureAllBackedUpThunk, + &SignalRecordRollbackJournal::PreserveWorkingMemorySlotBeforeEraseThunk); if (tx) { op_context.AddOperationTiming ("SignalProcessor.begin_transaction", @@ -2174,6 +2604,7 @@ SignalProcessor::Process (const Signal &signal) }; auto restore_context_snapshot = [&] { operations::historical_surface_search_cache_internal::Erase (*context_); + signal_record_journal.RestoreRecordsInto (rollback_snapshot.context); *context_ = std::move (rollback_snapshot.context); operations::consolidation_throughput_state_internal::Reset ( *context_, rollback_snapshot.consolidation_throughput); @@ -2187,6 +2618,7 @@ SignalProcessor::Process (const Signal &signal) } }; auto restore_read_only_context_snapshot = [&] { + signal_record_journal.RestoreRecordsInto (rollback_snapshot.context); *context_ = std::move (rollback_snapshot.context); operations::consolidation_throughput_state_internal::Reset ( *context_, rollback_snapshot.consolidation_throughput); diff --git a/tests/cortext.test.cpp b/tests/cortext.test.cpp index f02534e0..6389fe6c 100644 --- a/tests/cortext.test.cpp +++ b/tests/cortext.test.cpp @@ -480,6 +480,55 @@ TEST_CASE ("Retention Natural omits force flags; Durable forces boundary+write", REQUIRE_FALSE (ephemeral.output.stored_memory_id.has_value ()); } +TEST_CASE ("Durable flushes one shared Natural accumulator unit", + "[cortext][retention][accumulator][aist]") +{ + cortext::testing::ScopedEnvVar disable_natural_boundary ( + "CORTEXT_BOUNDARY_DISABLE_NATURAL", "1"); + cortext::testing::ScopedEnvVar disable_pressure_boundary ( + "CORTEXT_BOUNDARY_DISABLE_PRESSURE", "1"); + cortext::testing::ScopedEnvVar disable_surprisal_boundary ( + "CORTEXT_BOUNDARY_DISABLE_SURPRISAL", "1"); + ScopedTempDb temp_db; + cortext::Cortext::Config cfg; + auto unique_store = cortext::SQLiteStore::Create (temp_db.path ().c_str ()); + auto store = std::shared_ptr (std::move (unique_store)); + auto ctx = cortext::Cortext::Create (cfg, store); + REQUIRE (ctx != nullptr); + + const auto first = ctx->ProcessTextAt ( + "A calm sentence in one pending thought.", "stream/shared", 1000ULL, + cortext::Retention::Natural); + const auto second = ctx->ProcessTextAt ( + "A second calm sentence in the same thought.", "stream/shared", + 2000ULL, cortext::Retention::Natural); + REQUIRE_FALSE (first.output.stored_memory_id.has_value ()); + REQUIRE_FALSE (second.output.stored_memory_id.has_value ()); + REQUIRE (store->Execute ( + "SELECT memory_id FROM memories WHERE source_id = ?", + { std::string ("stream/shared") }) + .empty ()); + + const auto durable = ctx->ProcessTextAt ( + "The explicit turn closes that pending thought.", "stream/shared", + 3000ULL, cortext::Retention::Durable); + REQUIRE (durable.output.stored_memory_id.has_value ()); + const auto memory_rows = store->Execute ( + "SELECT memory_id, n_signals FROM memories WHERE source_id = ? " + "AND kind = 'LONG_TERM'", + { std::string ("stream/shared") }); + REQUIRE (memory_rows.size () == 1); + REQUIRE (AnyToLongLong (memory_rows[0].at ("n_signals")) == 3); + const auto signal_rows = store->Execute ( + "SELECT timestamp, serial_position FROM signals WHERE memory_id = ? " + "ORDER BY serial_position", + { AnyToLongLong (memory_rows[0].at ("memory_id")) }); + REQUIRE (signal_rows.size () == 3); + REQUIRE (AnyToLongLong (signal_rows[0].at ("timestamp")) == 1000); + REQUIRE (AnyToLongLong (signal_rows[1].at ("timestamp")) == 2000); + REQUIRE (AnyToLongLong (signal_rows[2].at ("timestamp")) == 3000); +} + TEST_CASE ("Cortext durable corrections supersede stale facts at default knobs", "[cortext][belief_revision][eval][aist]") { diff --git a/tests/signal_processor.test.cpp b/tests/signal_processor.test.cpp index 254f7493..1edff013 100644 --- a/tests/signal_processor.test.cpp +++ b/tests/signal_processor.test.cpp @@ -7,6 +7,7 @@ #include #include "../src/operations/historical_surface_search_cache_internal.hpp" #include "../src/operations/consolidation_throughput_state_internal.hpp" +#include "../src/operations/signal_record_rollback_internal.hpp" #include using namespace cortext; @@ -15,6 +16,9 @@ namespace cortext::testing { std::size_t ProcessorRollbackSnapshotOwnerCountForTest (); std::size_t ProcessorRollbackSnapshotReuseCountForTest (); +std::size_t SignalRecordRollbackBackupCountForTest (); +std::size_t SignalRecordRollbackCopiedRecordCountForTest (); +void SetSignalRecordSnapshotSetupThrowStageForTest (int stage); } struct InsertOp : IOperation @@ -163,6 +167,12 @@ struct ExerciseWholeContextRollbackOp : IOperation ++call_count; if (call_count == 1) { + AccumulatorState active; + active.n_signals = 1; + SignalRecord active_record; + active_record.payload.assign (8, 0x11); + active.signals.push_back (std::move (active_record)); + processor_context.accumulator_states["test"] = std::move (active); AccumulatorState foreign; foreign.n_signals = 7; foreign.mu_acc = Eigen::VectorXf::Constant (256, 0.125f); @@ -175,6 +185,9 @@ struct ExerciseWholeContextRollbackOp : IOperation } if (call_count == 2) { + processor_context.accumulator_states.at ("test") + .signals.front ().payload.assign (8, 0xFF); + processor_context.accumulator_states.at ("test").signals.clear (); processor_context.accumulator_states.erase ("foreign/source"); processor_context.accumulator_states["unexpected/source"].n_signals = 99; @@ -193,6 +206,9 @@ struct ExerciseWholeContextRollbackOp : IOperation && accumulator_it->second.mu_acc.size () == 256 && accumulator_it->second.mu_acc[0] == 0.125f && accumulator_it->second.primary_modality == "audio" + && processor_context.accumulator_states.at ("test") + .signals.front ().payload + == std::vector (8, 0x11) && !processor_context.accumulator_states.contains ( "unexpected/source") && processor_context.recent_scores @@ -205,6 +221,444 @@ struct ExerciseWholeContextRollbackOp : IOperation mutable int call_count = 0; }; +struct ExercisePendingUnitRollbackOwnershipOp : IOperation +{ + ExercisePendingUnitRollbackOwnershipOp (std::size_t record_count, + bool *restored_without_copy) + : record_count (record_count), + restored_without_copy (restored_without_copy) + { + } + + void + Execute (OperationContext &ctx, Transaction & /*tx*/) const override + { + auto &processor_context = ctx.GetProcessorContext (); + ++call_count; + if (call_count == 1) + { + AccumulatorState pending; + pending.n_signals = static_cast (record_count); + for (std::size_t index = 0; index < record_count; ++index) + { + SignalRecord record; + record.embedding = Eigen::VectorXf::Constant ( + 256, static_cast (index + 1)); + record.payload.assign (128, static_cast (index)); + record.serial_position = static_cast (index); + pending.signals.push_back (std::move (record)); + } + auto [inserted, _] + = processor_context.accumulator_states.insert_or_assign ( + "test", std::move (pending)); + first_payload = inserted->second.signals.front ().payload.data (); + middle_payload + = inserted->second.signals[record_count / 2].payload.data (); + last_payload = inserted->second.signals.back ().payload.data (); + ProcessorContext::WMSlot slot; + slot.memory_id = 91; + slot.signal_records = inserted->second.signals; + slot.blob_ids.push_back (std::vector (32, 0x5A)); + processor_context.wm_slots.push_back (std::move (slot)); + wm_first_payload = processor_context.wm_slots.front () + .signal_records.front ().payload.data (); + wm_first_blob + = processor_context.wm_slots.front ().blob_ids.front ().data (); + return; + } + if (call_count == 2) + { + auto &pending = processor_context.accumulator_states.at ( + "test"); + SignalRecord appended; + appended.embedding = Eigen::VectorXf::Ones (256); + appended.payload.assign (128, 0xA5); + appended.serial_position = static_cast (pending.signals.size ()); + pending.signals.push_back (std::move (appended)); + pending.n_signals += 1; + pending.s_sum = 99.0; + throw std::runtime_error ("force pending-unit rollback"); + } + + const auto &signals = processor_context.accumulator_states.at ( + "test").signals; + if (restored_without_copy) + { + *restored_without_copy + = signals.size () == record_count + && signals.front ().payload.data () == first_payload + && signals[record_count / 2].payload.data () + == middle_payload + && signals.back ().payload.data () == last_payload + && processor_context.wm_slots.size () == 1 + && processor_context.wm_slots.front () + .signal_records.front ().payload.data () + == wm_first_payload + && processor_context.wm_slots.front () + .blob_ids.front ().data () + == wm_first_blob; + } + } + + std::size_t record_count = 0; + bool *restored_without_copy = nullptr; + mutable int call_count = 0; + mutable const unsigned char *first_payload = nullptr; + mutable const unsigned char *middle_payload = nullptr; + mutable const unsigned char *last_payload = nullptr; + mutable const unsigned char *wm_first_payload = nullptr; + mutable const unsigned char *wm_first_blob = nullptr; +}; + +struct ExerciseFailingFlushRecordRollbackOp : IOperation +{ + explicit ExerciseFailingFlushRecordRollbackOp (bool *restored) + : restored (restored) + { + } + + void + Execute (OperationContext &ctx, Transaction & /*tx*/) const override + { + auto &processor_context = ctx.GetProcessorContext (); + ++call_count; + if (call_count == 1) + { + AccumulatorState pending; + pending.n_signals = 3; + for (int index = 0; index < 3; ++index) + { + SignalRecord record; + record.embedding = Eigen::VectorXf::Constant ( + 256, static_cast (index + 1)); + record.payload.assign (16, + static_cast (index + 10)); + record.serial_position = index; + pending.signals.push_back (std::move (record)); + } + processor_context.accumulator_states["test"] = std::move (pending); + AccumulatorState unrelated; + unrelated.n_signals = 4096; + for (int index = 0; index < 4096; ++index) + { + SignalRecord record; + record.payload.assign (8, 0xA5); + unrelated.signals.push_back (std::move (record)); + } + processor_context.accumulator_states["unrelated/large"] + = std::move (unrelated); + unrelated_first_payload + = processor_context.accumulator_states.at ("unrelated/large") + .signals.front () + .payload.data (); + ProcessorContext::WMSlot unrelated_slot; + unrelated_slot.memory_id = 404; + for (int index = 0; index < 4096; ++index) + { + SignalRecord record; + record.payload.assign (8, 0x5A); + unrelated_slot.signal_records.push_back (std::move (record)); + } + processor_context.wm_slots.push_back (std::move (unrelated_slot)); + unrelated_wm_first_payload + = processor_context.wm_slots.front () + .signal_records.front ().payload.data (); + return; + } + if (call_count == 2) + { + operations::signal_record_rollback_internal::EnsureBackedUp ( + processor_context); + auto &records = processor_context.accumulator_states.at ( + "test").signals; + records.front ().payload.assign (4, 0xFF); + records.front ().blob_id.assign (32, 0xEE); + records.clear (); + throw std::runtime_error ("force failing flush rollback"); + } + + const auto &records = processor_context.accumulator_states.at ( + "test").signals; + if (restored) + { + *restored = records.size () == 3 + && records.front ().payload + == std::vector (16, 10) + && records.front ().blob_id.empty () + && records.back ().payload + == std::vector (16, 12) + && processor_context.accumulator_states + .at ("unrelated/large") + .signals.front () + .payload.data () + == unrelated_first_payload; + *restored + = *restored && processor_context.wm_slots.front () + .signal_records.front ().payload.data () + == unrelated_wm_first_payload; + } + } + + bool *restored = nullptr; + mutable int call_count = 0; + mutable const unsigned char *unrelated_first_payload = nullptr; + mutable const unsigned char *unrelated_wm_first_payload = nullptr; +}; + +struct ExerciseSnapshotSetupExceptionSafetyOp : IOperation +{ + explicit ExerciseSnapshotSetupExceptionSafetyOp (bool *restored) + : restored (restored) + { + } + + void + Execute (OperationContext &ctx, Transaction & /*tx*/) const override + { + auto &processor_context = ctx.GetProcessorContext (); + ++call_count; + if (call_count == 1) + { + AccumulatorState active; + active.n_signals = 1; + SignalRecord record; + record.payload.assign (32, 0x2A); + active.signals.push_back (std::move (record)); + processor_context.accumulator_states["test"] = std::move (active); + ProcessorContext::WMSlot slot; + slot.memory_id = 17; + slot.signal_records + = processor_context.accumulator_states.at ("test").signals; + processor_context.wm_slots.push_back (std::move (slot)); + accumulator_payload = processor_context.accumulator_states.at ("test") + .signals.front ().payload.data (); + working_memory_payload = processor_context.wm_slots.front () + .signal_records.front ().payload.data (); + return; + } + *restored = processor_context.accumulator_states.at ("test") + .signals.front ().payload.data () + == accumulator_payload + && processor_context.wm_slots.front () + .signal_records.front ().payload.data () + == working_memory_payload; + } + + bool *restored = nullptr; + mutable int call_count = 0; + mutable const unsigned char *accumulator_payload = nullptr; + mutable const unsigned char *working_memory_payload = nullptr; +}; + +struct ExerciseWorkingMemoryEraseOwnershipOp : IOperation +{ + explicit ExerciseWorkingMemoryEraseOwnershipOp (bool *restored) + : restored (restored) + { + } + + void + Execute (OperationContext &ctx, Transaction & /*tx*/) const override + { + auto &processor_context = ctx.GetProcessorContext (); + ++call_count; + if (call_count == 1) + { + ProcessorContext::WMSlot small; + small.memory_id = 1; + SignalRecord small_record; + small_record.payload.assign (8, 0x11); + small.signal_records.push_back (std::move (small_record)); + ProcessorContext::WMSlot large; + large.memory_id = 2; + for (int index = 0; index < 4096; ++index) + { + SignalRecord record; + record.payload.assign (8, 0x22); + large.signal_records.push_back (std::move (record)); + } + processor_context.wm_slots.push_back (std::move (small)); + processor_context.wm_slots.push_back (std::move (large)); + small_payload = processor_context.wm_slots[0] + .signal_records.front ().payload.data (); + large_payload = processor_context.wm_slots[1] + .signal_records.front ().payload.data (); + return; + } + if (call_count == 2) + { + operations::signal_record_rollback_internal:: + PreserveWorkingMemorySlotBeforeErase (processor_context, 0); + processor_context.wm_slots.erase (processor_context.wm_slots.begin ()); + throw std::runtime_error ("force working-memory erase rollback"); + } + *restored = processor_context.wm_slots.size () == 2 + && processor_context.wm_slots[0] + .signal_records.front ().payload.data () + == small_payload + && processor_context.wm_slots[1] + .signal_records.front ().payload.data () + == large_payload; + } + + bool *restored = nullptr; + mutable int call_count = 0; + mutable const unsigned char *small_payload = nullptr; + mutable const unsigned char *large_payload = nullptr; +}; + +struct ExerciseWorkingMemoryAppendOwnershipOp : IOperation +{ + explicit ExerciseWorkingMemoryAppendOwnershipOp (bool *restored) + : restored (restored) + { + } + + void + Execute (OperationContext &ctx, Transaction & /*tx*/) const override + { + auto &processor_context = ctx.GetProcessorContext (); + ++call_count; + if (call_count == 1) + { + ProcessorContext::WMSlot slot; + slot.memory_id = 81; + for (int index = 0; index < 4096; ++index) + { + SignalRecord record; + record.payload.assign (8, 0x31); + slot.signal_records.push_back (std::move (record)); + } + processor_context.wm_slots.push_back (std::move (slot)); + first_payload = processor_context.wm_slots.front () + .signal_records.front ().payload.data (); + return; + } + if (call_count == 2) + { + SignalRecord appended; + appended.payload.assign (8, 0x42); + processor_context.wm_slots.front ().signal_records.push_back ( + std::move (appended)); + throw std::runtime_error ("force working-memory append rollback"); + } + *restored = processor_context.wm_slots.front ().signal_records.size () + == 4096 + && processor_context.wm_slots.front () + .signal_records.front ().payload.data () + == first_payload; + } + + bool *restored = nullptr; + mutable int call_count = 0; + mutable const unsigned char *first_payload = nullptr; +}; + +struct ExerciseActiveToFullBackupUpgradeOp : IOperation +{ + explicit ExerciseActiveToFullBackupUpgradeOp (bool *restored) + : restored (restored) + { + } + + void + Execute (OperationContext &ctx, Transaction & /*tx*/) const override + { + auto &processor_context = ctx.GetProcessorContext (); + ++call_count; + if (call_count == 1) + { + AccumulatorState active; + active.n_signals = 1; + SignalRecord active_record; + active_record.payload.assign (8, 0x19); + active.signals.push_back (std::move (active_record)); + processor_context.accumulator_states["test"] = std::move (active); + AccumulatorState foreign; + foreign.n_signals = 7; + processor_context.accumulator_states["foreign/source"] + = std::move (foreign); + return; + } + if (call_count == 2) + { + operations::signal_record_rollback_internal::EnsureBackedUp ( + processor_context); + processor_context.accumulator_states.at ("test") + .signals.front ().payload.assign (8, 0xFF); + operations::signal_record_rollback_internal::EnsureAllBackedUp ( + processor_context); + processor_context.accumulator_states.erase ("foreign/source"); + throw std::runtime_error ("force full-backup upgrade rollback"); + } + *restored = processor_context.accumulator_states.at ("test") + .signals.front ().payload + == std::vector (8, 0x19) + && processor_context.accumulator_states + .at ("foreign/source").n_signals + == 7; + } + + bool *restored = nullptr; + mutable int call_count = 0; +}; + +struct ExerciseNestedDifferentSourceRollbackOp : IOperation +{ + explicit ExerciseNestedDifferentSourceRollbackOp (bool *restored) + : restored (restored) + { + } + + void + Execute (OperationContext &ctx, Transaction & /*tx*/) const override + { + auto &processor_context = ctx.GetProcessorContext (); + const auto &signal = ctx.GetSignal (); + if (signal.source_id == "inner/source") + { + AccumulatorState inner; + inner.n_signals = 1; + SignalRecord record; + record.payload.assign (8, 0x77); + inner.signals.push_back (std::move (record)); + processor_context.accumulator_states[signal.source_id] + = std::move (inner); + return; + } + + ++outer_call_count; + if (outer_call_count == 1) + { + AccumulatorState outer; + outer.n_signals = 1; + SignalRecord record; + record.payload.assign (8, 0x55); + outer.signals.push_back (std::move (record)); + processor_context.accumulator_states[signal.source_id] + = std::move (outer); + return; + } + if (outer_call_count == 2) + { + Signal nested; + nested.embedding = Eigen::VectorXf::Zero (256); + nested.source_id = "inner/source"; + nested.timestamp = signal.timestamp + 1; + processor->Process (nested); + throw std::runtime_error ("force outer rollback after nested process"); + } + *restored = !processor_context.accumulator_states.contains ("inner/source") + && processor_context.accumulator_states.at (signal.source_id) + .signals.front ().payload + == std::vector (8, 0x55); + } + + SignalProcessor *processor = nullptr; + bool *restored = nullptr; + mutable int outer_call_count = 0; +}; + struct ExerciseThroughputRollbackOp : IOperation { explicit ExerciseThroughputRollbackOp (bool *restored_in) @@ -425,6 +879,233 @@ TEST_CASE ("SignalProcessor restores exact durable and cache-only state after " REQUIRE (volatile_restored); } +TEST_CASE ("SignalProcessor rollback preserves pending Natural record storage", + "[processor][rollback][accumulator][scaling]") +{ + const auto backup_count_before + = cortext::testing::SignalRecordRollbackBackupCountForTest (); + const auto copied_count_before + = cortext::testing::SignalRecordRollbackCopiedRecordCountForTest (); + for (const std::size_t record_count : { 32U, 512U, 4096U }) + { + auto uniq = SQLiteStore::Create (":memory:"); + std::shared_ptr store (std::move (uniq)); + SignalProcessor::Config cfg; + cortext::testing::RequireEncoder (cfg); + bool restored_without_copy = false; + auto pipeline = std::make_unique ( + std::make_unique ( + record_count, &restored_without_copy)); + SignalProcessor processor ( + cfg, store, + operations::signal_record_rollback_internal::MarkJournalAware ( + std::move (pipeline))); + + Signal signal; + signal.embedding = Eigen::VectorXf::Zero (256); + signal.source_id = "test"; + signal.timestamp = 1000; + processor.Process (signal); + signal.timestamp = 2000; + REQUIRE_THROWS (processor.Process (signal)); + signal.timestamp = 3000; + processor.Process (signal); + + REQUIRE (restored_without_copy); + } + REQUIRE (cortext::testing::SignalRecordRollbackBackupCountForTest () + == backup_count_before); + REQUIRE (cortext::testing::SignalRecordRollbackCopiedRecordCountForTest () + == copied_count_before); +} + +TEST_CASE ("SignalProcessor lazily backs up records for a failing flush", + "[processor][rollback][accumulator][flush]") +{ + auto uniq = SQLiteStore::Create (":memory:"); + std::shared_ptr store (std::move (uniq)); + SignalProcessor::Config cfg; + cortext::testing::RequireEncoder (cfg); + bool restored = false; + const auto backup_count_before + = cortext::testing::SignalRecordRollbackBackupCountForTest (); + const auto copied_count_before + = cortext::testing::SignalRecordRollbackCopiedRecordCountForTest (); + auto pipeline = std::make_unique ( + std::make_unique (&restored)); + SignalProcessor processor ( + cfg, store, + operations::signal_record_rollback_internal::MarkJournalAware ( + std::move (pipeline))); + + Signal signal; + signal.embedding = Eigen::VectorXf::Zero (256); + signal.source_id = "test"; + signal.timestamp = 1000; + processor.Process (signal); + signal.timestamp = 2000; + REQUIRE_THROWS (processor.Process (signal)); + signal.timestamp = 3000; + processor.Process (signal); + + REQUIRE (restored); + REQUIRE (cortext::testing::SignalRecordRollbackBackupCountForTest () + == backup_count_before + 1); + REQUIRE (cortext::testing::SignalRecordRollbackCopiedRecordCountForTest () + == copied_count_before + 3); +} + +TEST_CASE ("SignalProcessor snapshot setup restores moved ownership on failure", + "[processor][rollback][accumulator][snapshot_setup]") +{ + for (const int throw_stage : { 1, 2, 3 }) + { + auto uniq = SQLiteStore::Create (":memory:"); + std::shared_ptr store (std::move (uniq)); + SignalProcessor::Config cfg; + cortext::testing::RequireEncoder (cfg); + bool restored = false; + auto pipeline = std::make_unique ( + std::make_unique (&restored)); + SignalProcessor processor ( + cfg, store, + operations::signal_record_rollback_internal::MarkJournalAware ( + std::move (pipeline))); + + Signal signal; + signal.embedding = Eigen::VectorXf::Zero (256); + signal.source_id = "test"; + signal.timestamp = 1000; + processor.Process (signal); + cortext::testing::SetSignalRecordSnapshotSetupThrowStageForTest ( + throw_stage); + signal.timestamp = 2000; + REQUIRE_THROWS (processor.Process (signal)); + signal.timestamp = 3000; + processor.Process (signal); + REQUIRE (restored); + } +} + +TEST_CASE ("SignalProcessor journals one erased working-memory slot by ownership", + "[processor][rollback][working_memory][scaling]") +{ + auto uniq = SQLiteStore::Create (":memory:"); + std::shared_ptr store (std::move (uniq)); + SignalProcessor::Config cfg; + cortext::testing::RequireEncoder (cfg); + bool restored = false; + const auto copied_count_before + = cortext::testing::SignalRecordRollbackCopiedRecordCountForTest (); + auto pipeline = std::make_unique ( + std::make_unique (&restored)); + SignalProcessor processor ( + cfg, store, + operations::signal_record_rollback_internal::MarkJournalAware ( + std::move (pipeline))); + + Signal signal; + signal.embedding = Eigen::VectorXf::Zero (256); + signal.source_id = "test"; + signal.timestamp = 1000; + processor.Process (signal); + signal.timestamp = 2000; + REQUIRE_THROWS (processor.Process (signal)); + signal.timestamp = 3000; + processor.Process (signal); + + REQUIRE (restored); + REQUIRE (cortext::testing::SignalRecordRollbackCopiedRecordCountForTest () + == copied_count_before); +} + +TEST_CASE ("SignalProcessor trims working-memory appends without copying history", + "[processor][rollback][working_memory][scaling]") +{ + auto uniq = SQLiteStore::Create (":memory:"); + std::shared_ptr store (std::move (uniq)); + SignalProcessor::Config cfg; + cortext::testing::RequireEncoder (cfg); + bool restored = false; + const auto copied_count_before + = cortext::testing::SignalRecordRollbackCopiedRecordCountForTest (); + auto pipeline = std::make_unique ( + std::make_unique (&restored)); + SignalProcessor processor ( + cfg, store, + operations::signal_record_rollback_internal::MarkJournalAware ( + std::move (pipeline))); + + Signal signal; + signal.embedding = Eigen::VectorXf::Zero (256); + signal.source_id = "test"; + signal.timestamp = 1000; + processor.Process (signal); + signal.timestamp = 2000; + REQUIRE_THROWS (processor.Process (signal)); + signal.timestamp = 3000; + processor.Process (signal); + + REQUIRE (restored); + REQUIRE (cortext::testing::SignalRecordRollbackCopiedRecordCountForTest () + == copied_count_before); +} + +TEST_CASE ("SignalProcessor full backup upgrade preserves exact active records", + "[processor][rollback][accumulator][full_backup]") +{ + auto uniq = SQLiteStore::Create (":memory:"); + std::shared_ptr store (std::move (uniq)); + SignalProcessor::Config cfg; + cortext::testing::RequireEncoder (cfg); + bool restored = false; + auto pipeline = std::make_unique ( + std::make_unique (&restored)); + SignalProcessor processor ( + cfg, store, + operations::signal_record_rollback_internal::MarkJournalAware ( + std::move (pipeline))); + + Signal signal; + signal.embedding = Eigen::VectorXf::Zero (256); + signal.source_id = "test"; + signal.timestamp = 1000; + processor.Process (signal); + signal.timestamp = 2000; + REQUIRE_THROWS (processor.Process (signal)); + signal.timestamp = 3000; + processor.Process (signal); + REQUIRE (restored); +} + +TEST_CASE ("SignalProcessor custom nested source changes roll back automatically", + "[processor][rollback][nested][custom]") +{ + auto uniq = SQLiteStore::Create (":memory:"); + std::shared_ptr store (std::move (uniq)); + SignalProcessor::Config cfg; + cortext::testing::RequireEncoder (cfg); + bool restored = false; + auto operation + = std::make_unique (&restored); + auto *operation_ptr = operation.get (); + auto pipeline + = std::make_unique (std::move (operation)); + SignalProcessor processor (cfg, store, std::move (pipeline)); + operation_ptr->processor = &processor; + + Signal signal; + signal.embedding = Eigen::VectorXf::Zero (256); + signal.source_id = "outer/source"; + signal.timestamp = 1000; + processor.Process (signal); + signal.timestamp = 2000; + REQUIRE_THROWS (processor.Process (signal)); + signal.timestamp = 3000; + processor.Process (signal); + REQUIRE (restored); +} + TEST_CASE ("SignalProcessor restores consolidation throughput after rollback", "[processor][rollback][consolidation]") { From 8c2385a8d4655acb5121ac859a256c043b14865a Mon Sep 17 00:00:00 2001 From: gabewillen Date: Sat, 18 Jul 2026 12:06:50 -0500 Subject: [PATCH 03/18] Bound natural-retention active work --- docs/paper/_manuscript/index.md | 513 ++++- docs/paper/sections/10_implementation.qmd | 175 +- docs/paper/sections/11_optimization.qmd | 153 +- docs/paper/sections/7_consolidation.qmd | 14 +- examples/benchmark/chat_replay_live_run.cpp | 1080 ++++++++- src/cortext.cpp | 18 +- src/cortext_pipeline_internal.hpp | 13 + .../association_fanout_cache_internal.hpp | 105 +- .../bounded_activation_shadow_internal.hpp | 1625 +++++++++++++ src/operations/competition.cpp | 290 +-- src/operations/consolidation.cpp | 3 +- .../consolidation_epoch_profile_internal.hpp | 290 +++ src/operations/consolidation_shallow.cpp | 6 + src/operations/detect_memory_usage.cpp | 4 + src/operations/emotion.cpp | 4 + src/operations/emotion_cascade.cpp | 637 +++++- .../emotional_metadata_cache_internal.hpp | 252 +++ src/operations/eviction_policy.hpp | 8 +- .../execution_cache_sidecar_internal.hpp | 171 ++ .../family_embedding_features_internal.hpp | 111 + src/operations/graph_retrieval.cpp | 583 +++-- ...storical_surface_search_cache_internal.hpp | 354 ++- src/operations/memory_storage.cpp | 450 +++- src/operations/memory_strength.cpp | 42 +- src/operations/predictive.cpp | 1 + .../rif_active_epoch_cache_internal.hpp | 474 ++++ src/operations/rif_state_internal.hpp | 489 ++++ .../signal_record_rollback_internal.hpp | 95 +- src/operations/stability.cpp | 14 +- src/signal_processor.cpp | 1043 ++++++++- src/store.cpp | 568 ++++- src/store/mutation_audit_internal.hpp | 43 + src/store/schema.cpp | 68 + tests/cortext.test.cpp | 301 +++ tests/migration_core.test.cpp | 129 ++ tests/operations_competition.test.cpp | 446 +++- tests/operations_emotion_cascade.test.cpp | 569 +++++ tests/operations_graph_retrieval.test.cpp | 245 +- tests/operations_memory_storage.test.cpp | 288 ++- tests/signal_processor.test.cpp | 2005 ++++++++++++++++- tests/state_persistence.test.cpp | 13 + tests/store.test.cpp | 244 ++ third_party/sqlite/CMakeLists.txt | 6 + tools/audit_storage_cost_profile.py | 1190 +++++++++- tools/audit_storage_cost_profile_test.py | 862 +++++++ tools/extract_claude_session_packets.py | 146 ++ 46 files changed, 15378 insertions(+), 762 deletions(-) create mode 100644 src/cortext_pipeline_internal.hpp create mode 100644 src/operations/bounded_activation_shadow_internal.hpp create mode 100644 src/operations/consolidation_epoch_profile_internal.hpp create mode 100644 src/operations/emotional_metadata_cache_internal.hpp create mode 100644 src/operations/execution_cache_sidecar_internal.hpp create mode 100644 src/operations/family_embedding_features_internal.hpp create mode 100644 src/operations/rif_active_epoch_cache_internal.hpp create mode 100644 src/operations/rif_state_internal.hpp create mode 100644 src/store/mutation_audit_internal.hpp create mode 100644 tools/audit_storage_cost_profile_test.py create mode 100644 tools/extract_claude_session_packets.py diff --git a/docs/paper/_manuscript/index.md b/docs/paper/_manuscript/index.md index e222af65..ee5787d1 100644 --- a/docs/paper/_manuscript/index.md +++ b/docs/paper/_manuscript/index.md @@ -2906,7 +2906,11 @@ therefore does not create an episode, signal, working-memory row, long-term memory, blob, or searchable embedding, and it does not update normal throughput observations. The single `consolidation_state` output is an ordered hint for the caller; it does not schedule maintenance work -by itself. +by itself. In addition to the throughput classifier below, the private +active-epoch store raises `Required` when its event, mutation, or +allocated-byte safety ceiling is reached. That boundary is source- and +modality-independent, remains asserted if ignored, and is cleared only +after a successful forced-maintenance commit publishes a fresh epoch. A caller can use the engine hints as the external scheduling rule. Since the last committed forced request, including a coherent no-op with no @@ -2947,7 +2951,7 @@ p_rearm(F,S,T) = p(F,S,T) + (1 - p(F,S,T)) * T p_drift(F,S,T) = 1 - p(F,S,T) -consolidation_state = +throughput_state = None, if armed = false OR memories_since_consolidation <= 0 OR range <= numeric_epsilon @@ -2959,16 +2963,19 @@ consolidation_state = The required branch is evaluated first. Since `consolidation_escalation(T)` is always greater than one, the required boundary is strictly below the recommendation boundary after every floor -or peak update. Elapsed wall or event time and arbitrary memory counts -do not enter the state decision; backlog is only a positive-work guard. -An explicit force request starts consolidation independently and its -output state is `None`. A committed forced request acknowledges the -active excursion by persisting `armed=false`, even when no coherent -cluster exists. The acknowledgment resets the next event-derived range -to the current rate: both floor and peak become that rate. This prevents -a historical spike from suppressing recommendations after a throughput -regime shift. Ordinary throughput observations establish a new peak and -rearm the classifier only after the observed relative range is material: +or peak update. Elapsed wall or event time and arbitrary durable memory +counts do not enter the throughput decision; backlog is only a +positive-work guard. The caller-facing state is `Required` whenever the +bounded active epoch has reached a safety ceiling, and otherwise equals +`throughput_state`. An explicit force request starts consolidation +independently and its output state is `None`. A committed forced request +acknowledges the active excursion by persisting `armed=false`, even when +no coherent cluster exists. The acknowledgment resets the next +event-derived range to the current rate: both floor and peak become that +rate. This prevents a historical spike from suppressing recommendations +after a throughput regime shift. Ordinary throughput observations +establish a new peak and rearm the classifier only after the observed +relative range is material: (*r**p**e**a**k* − *r**f**l**o**o**r*)/max (*r**p**e**a**k*, *ϵ*) ≥ *p**d**r**i**f**t*. Because *p* is clamped to \[0.20, 0.70\], the material drawdown remains between 0.30 and 0.80 across the complete knob domain, including @@ -5495,6 +5502,86 @@ it does not construct a second single-signal memory alongside the accumulated unit. The Durable packet is the last signal in the flushed unit exactly once. +### Lazy retrieval-inhibition state and the active epoch + +Migration 28 keeps the existing `memories` columns but adds a private +SQLite recovery clock, generation resets, per-memory anchored inhibition +state, an expiry index, and a connection-local temporary effective-value +view. The persistent migration inventory is exactly the three state +tables plus the expiry index; it does not install durable views or +triggers. Retrieval competition advances one global log-recovery clock +per event, materializes only rows whose exact suppression has crossed +the existing 10−9 active threshold, and updates only newly +suppressed losers. A full-recovery interval advances a generation; older +rows are materialized in bounded batches and reset markers are pruned +after their generation has no remaining active rows. Internal reads that +depend on strength, suppression, or the suppression timestamp use the +temporary effective view. Compatibility handling conservatively +materializes and rebuilds the private representation around every +caller-supplied SQL statement because aliases, wildcards, views, +subqueries, and triggers cannot be classified safely from SQL text. A +caller mutation also invalidates every database-derived processor cache +before the statement executes. + +The authoritative signal mutation still commits once to persistent +SQLite. After that commit, a separate connection-local in-memory SQLite +database publishes only the current recovery clock and active-generation +inhibition rows. It never mirrors durable memory, signal, embedding, +association, or payload history. A failed persistent commit restores the +pre-signal processor snapshot; a failed post-commit epoch publication +discards and rebuilds the disposable database from persistent authority +without replaying the committed signal. Natural returns after +publication. Durable follows the identical path and then executes only +the named WAL checkpoint barrier. + +The active epoch records event, changed-row, and allocated-byte measures +with harness safety ceilings of 512 events, 32,768 mutations, and 64 +MiB. Reaching a ceiling raises the existing `Required` consolidation +hint before an honoring caller can enter another event. Ignoring the +hint neither starts another epoch nor drops mutations. A successful +explicit consolidation rebuilds the disposable epoch and resets its +mutable measures; a failed consolidation leaves the old epoch intact. +These are harness-scoped ceilings, not a claim that every production +workload is globally bounded. + +### Bounded activation observation shadow + +A separate private experiment observes whether long-lived retrieval can +use a fixed-size sparse activation graph. It is disabled unless the +internal `CORTEXT_BOUNDED_ACTIVATION_SHADOW` flag is set, cannot select +candidates or scores, and never writes canonical tables. +`SignalProcessor` prepares a lookup against the last published shadow +generation, commits the ordinary persistent SQLite transaction, and only +then publishes the immutable observation once. Nested processing +journals its prepared observations while SQLite uses savepoints; +releasing a nested savepoint never publishes. The outermost root commit +publishes the journal in event order, while an outer rollback discards +the complete journal. Rollback, cancellation, or commit failure +therefore leaves the published generation unchanged. Natural and Durable +share this publication edge; Durable’s later checkpoint cannot replay or +reverse it. A duplicate, generation gap or regression, digest mismatch, +or shadow-local failure disables and discards the disposable graph +without changing the canonical result. + +The graph contains *R* = 8 + round (24*S*) roots and at most +*K* = 128 + round (512*F* + 512*T*) leaves. Root and leaf beams, +representatives, neighbor degree, activated consolidation leaves, and +cadence are likewise fixed functions of F/S/T. Storage is initialized +once to *R* + *K* + *K**E* embedding slots and *K**D* neighbor slots. +Normal mutation, recall, and internal consolidation each have +closed-form comparison ceilings derived from those capacities; no source +identifier or modality participates in routing or capacity. +Consolidation rebalances leaves, updates root centroids, and refreshes +only a fixed number of activated leaf neighborhoods. + +The disposable graph is unavailable after restart until an explicit +measured rebuild from authoritative SQLite completes. That rebuild +currently visits retained history linearly, so it remains a named +production-cutover blocker. The experiment therefore establishes +implementation and measurement seams for fixed sparse activation; it +does not replace exact retrieval, make the shadow authoritative, or +claim bounded startup or live behavior. + Rollback snapshots move the private accumulator map, working-memory records, and their blob-reference vectors out of the generic context copy and restore their ownership immediately afterward. The active @@ -5556,6 +5643,34 @@ clusterer, shallow consolidation, and graph builder. The normal core, storage, retrieval, feedback, episode, object-store, working-memory, signal-counter, and rate-observation paths are not maintenance steps. +Emotional cascade metadata is hydrated into a private, rebuildable +processor cache keyed by memory id and base embedding id. The cache +preserves the SQL contract for shared embeddings by retaining every +member row, deriving current intensity and half-life bonus with the same +per-embedding minima, and retaining only flashbulb rows in recency order +for source discovery. Emotional consolidation overwrites the affected +embedding family, cascade propagation applies the existing maxima, +storage and shallow consolidation append rows, and eviction removes +them. Journal-aware rollback discards and rehydrates this +database-derived cache, while arbitrary custom pipelines retain the +complete snapshot path. This changes execution ownership only; source +thresholds, tie order, traversal, decay, updates, and persisted rows are +unchanged. When multiple emotional sources require traversal, the +implementation batches them in source-order groups of at most 64 and +propagates a bit per source through the same breadth-first levels. Each +bit retains its source-specific radius, and reached embeddings are +emitted at the first depth observed for that source. Batches are +processed in original source order, so the existing first-source-wins +update rule is unchanged. This shares edge visits without using source +identity or modality as an optimization key. The cache also records the +memory nodes from which each source could still expand within its +radius. An incrementally inserted association can therefore advance the +fixed point without another traversal when neither endpoint lies in any +source’s expansion footprint. A topology rebuild invalidates the +footprint conservatively. Ordinary unconnected non-source inserts and +monotone increases to target emotional values likewise preserve the +fixed point; source changes and target-value decreases still re-arm it. + Shallow consolidation is embedding-only. It clusters eligible long-term memories, writes an `ASSOCIATION` centroid node for each cluster, assigns source memories to the cluster, and emits `derived_from` edges. @@ -5574,47 +5689,100 @@ edges, not a batch semantic extraction job. Production retrieval discovers a broad but bounded vector seed set from durable memory embeddings. Before the seed cap, it removes directed `supersedes` targets and collapses near-duplicate embedding families to -one representative. The family index uses complementary 32-block -Cauchy–Schwarz upper bounds in the stored coordinate system and a -normalized Walsh–Hadamard basis, followed by exact cosine checks. Each -upper bound is sound, so taking their minimum cannot exclude a pair -meeting the cosine threshold. The complementary bases avoid broad exact -pairwise work for both sparse coordinate-aligned vectors and dense +one representative. The family index accumulates exact squared +coordinate differences in 16-coordinate vectorized blocks and rejects a +pair as soon as a completed block exceeds the complete squared-distance +limit implied by the cosine threshold. Surviving pairs use complementary +32-block Cauchy–Schwarz upper bounds in the stored coordinate system and +a normalized Walsh–Hadamard basis, followed by exact cosine checks. The +partial distance condition remains sound because every omitted term is +nonnegative; both upper bounds are also sound, so none can exclude a +pair meeting the cosine threshold. The complementary bases avoid broad +exact pairwise work for both sparse coordinate-aligned vectors and dense Hadamard-aligned vectors; arbitrary adversarial surfaces may still reach -the exact fallback. If the private vector cache is unavailable, durable +the exact fallback. The normalized vector and both block-norm summaries +are immutable functions of an embedding, so the private surface computes +them on first family use and retains them with that entry. Replacing a +current surface entry replaces its summaries as part of the same cache +mutation. This removes repeated normalization and Walsh–Hadamard +construction without changing family order, comparison arithmetic, or +fallback behavior. If the private vector cache is unavailable, durable processing rebuilds it once from the complete persisted surface and immediately applies the same family and supersession filters before truncation. A failed rebuild installs a failure sentinel rather than repeating the two complete surface scans on every request. A unique cached vector retains every long-term memory metadata alternative that shares its base embedding, and query-time eligibility chooses a -nonsuperseded sibling without duplicating vector storage. The fallback -executes a demand-driven sequence of ordered SQL pages over the current -and historical vector surfaces. Each page joins memory metadata and -applies kind, timestamp, and supersession eligibility before distance -ordering, excludes a historical row when that memory already has a -current reconstruction, collapses byte-identical historical vectors, and -uses a second application of the existing F/S/T-derived seed-search -breadth as its row bound. One in-memory cosine-family index spans every -page; paging stops when the ordinary semantic-family seed budget is full -or the eligible surface is exhausted. Processor hydration tracks -persisted-current-surface currency and processor-surface completeness -independently. The private current-vector search cache is built and -incrementally updated from the processor’s latest reconstruction -surface, even when a test or storage policy intentionally omits the -corresponding persisted-current write. A valid cache therefore performs -distance ordering and cosine-family accounting on latest vectors. If -that cache is unavailable while the processor surface is complete, -durable retrieval rebuilds a current-only cache from the processor -surface and ephemeral retrieval scans that surface directly without -mutating the registry. Only an incomplete processor surface falls back -to SQL; in that recovery case the query substitutes each latest -reconstruction before cross-page family accounting. Base families that -converge after reconstruction therefore consume one current-family slot -and cannot stop selection early. Current per-memory reconstructions -remain distinct rows and the corresponding base row for that same memory -is excluded. When constructive recall is disabled, both restart -hydration and cache-loss rebuild select the base embedding and ignore +nonsuperseded sibling without duplicating vector storage. The cache +separately indexes entries that have at least one long-term metadata +alternative. Retrieval applies the existing timestamp, current-surface, +and supersession predicates to that subset before evaluating vector +distance, so signal-only historical embeddings do not enter the distance +kernel. This is an execution-only index: it does not change the eligible +set, distance expression, tie order, family collapse, or source and +modality semantics. Alongside the shared association fanout cache, an +internal execution sidecar maintains, for each supersession target, the +earliest start timestamp of an eligible replacement. Retrieval tests +that timestamp directly instead of rebuilding a target set by scanning +every incoming edge. Memory storage publishes its already-committed +supersession decisions into the fanout cache and rebuilds the sidecar +index; missing target metadata invalidates the cache and returns to +authoritative SQLite rehydration. Neither structure is part of the +public processor layout. The strict replacement-before-query predicate +and base embedding identity remain unchanged. The emotional-metadata +portion of the sidecar is trusted only by the engine-owned operation +root that maintains it. A caller-supplied root’s transaction view +invalidates that sidecar before forwarding its first SQL statement, so a +custom transaction that updates emotional columns directly cannot leave +a valid-looking stale fixed point for a later operation in the same +transaction. Cache-only custom roots retain their exact rollback +snapshot. The fallback executes a demand-driven sequence of ordered SQL +pages over the current and historical vector surfaces. Each page joins +memory metadata and applies kind, timestamp, and supersession +eligibility before distance ordering, excludes a historical row when +that memory already has a current reconstruction, collapses +byte-identical historical vectors, and uses a second application of the +existing F/S/T-derived seed-search breadth as its row bound. One +in-memory cosine-family index spans every page; paging stops when the +ordinary semantic-family seed budget is full or the eligible surface is +exhausted. Processor hydration tracks persisted-current-surface currency +and processor-surface completeness independently. The private +current-vector search cache is built and incrementally updated from the +processor’s latest reconstruction surface, even when a test or storage +policy intentionally omits the corresponding persisted-current write. A +valid cache therefore performs distance ordering and cosine-family +accounting on latest vectors. If that cache is unavailable while the +processor surface is complete and original-base lineage remains +available, durable retrieval rebuilds a current-only cache from the +processor surface and ephemeral retrieval scans that surface directly +without mutating the registry. Missing base lineage or an incomplete +processor surface falls back to SQL; in that recovery case the query +substitutes each latest reconstruction before cross-page family +accounting. Base families that converge after reconstruction therefore +consume one current-family slot and cannot stop selection early. Current +per-memory reconstructions remain distinct rows and the corresponding +base row for that same memory is excluded. The same registry keeps an +exact index of supersession-eligible historical memory rows and the base +lineage of each current row. Memory storage first ranks the current +surface and records its exact cutoff. When current and historical +populations are identical except for explicitly tracked changed +memories, deterministic embedding-id and memory-id tie orders agree, and +every changed historical row is outside that cutoff, the current result +proves that the historical top-k contributes no unseen candidate. The +historical scan is then skipped; any ambiguous lineage, reversed tie +order, or failed cutoff proof falls back to the complete eligible +historical scan. A historical embedding referenced by more than one +eligible memory also disables both current-population shortcuts: the +historical query ranks embeddings before expanding every memory sibling, +whereas the current surface ranks per-memory rows. The complete +embedding-level pass therefore preserves sibling fanout even when the +per-memory candidate limit is saturated. This proof changes neither the +candidate population nor the chosen supersession edges, but the current +surface distance pass remains proportional to that surface. Rollback and +flush recovery also rehydrate each current entry’s original base ID from +`memories.embedding_id`; they never infer it from the reconstructed +surface. When constructive recall is disabled, both restart hydration +and cache-loss rebuild select the base embedding and ignore reconstruction/current surfaces. This recovery path preserves an eligible target behind 900 closer ineligible rows and preserves an eligible sibling of a superseded shared embedding. A separate 600-member @@ -5856,6 +6024,20 @@ The current branch includes the following implementation-level changes: same SQL semantics, lower repeated parse overhead +retrieval-induced inhibition +replace per-event recovery of every active row with a persistent +global log clock, indexed exact-threshold expiry, generation resets, and +a bounded connection-local SQLite active-epoch projection; publish the +projection only after the shared persistent commit +effective strength, suppression, timestamp, 10−9 freeze, restart, rollback, +caller SQL, eviction, and deterministic ranking remain exact; +publication failure rebuilds from persistent authority without replay; +Natural and Durable use the same transaction and Durable adds only its +checkpoint barrier; no source-id or modality branch and no full-history +projection + + vector ranking bounded top-k selection and architecture SIMD kernels in the vector path @@ -5863,16 +6045,18 @@ path retrieval seed surface -current-memory embedding lookup with pre-cap supersession filtering -and complementary sound 32-block Cauchy–Schwarz bounds in the stored and -Walsh–Hadamard bases followed by exact cosine family checks; shared -vectors retain all long-term metadata alternatives; the private search -cache follows the processor’s latest reconstruction surface -independently of persisted-current materialization; cache loss uses the -complete processor surface directly or, only when that surface is -incomplete, metadata-eligible, distance-ordered, F/S/T-bounded SQL pages -feeding one cross-page cosine-family index that substitutes latest -reconstructions before accounting +current-memory embedding lookup with pre-cap supersession filtering; +immutable normalized and stored/Hadamard block summaries cached per +private surface entry; exact partial squared-distance rejection plus +complementary sound 32-block Cauchy–Schwarz bounds in the stored and +Walsh–Hadamard bases before exact cosine family checks; shared vectors +retain all long-term metadata alternatives; the private search cache +follows the processor’s latest reconstruction surface independently of +persisted-current materialization; cache loss uses the complete +processor surface directly or, only when that surface is incomplete, +metadata-eligible, distance-ordered, F/S/T-bounded SQL pages feeding one +cross-page cosine-family index that substitutes latest reconstructions +before accounting latest reconstruction and eligible shared-embedding siblings remain visible, byte-distinct near-duplicate boilerplate and stale base families that converge after reconstruction cannot consume the @@ -5898,6 +6082,16 @@ directional supersedes relations define families but are not activation edges +supersession eligibility +derive target-to-earliest-replacement timestamps in an internal +execution sidecar beside the shared association fanout cache and +incrementally publish committed MemoryStorage supersession edges instead +of invalidating and rebuilding all fanout rows +exact edge direction, base embedding ids, strict timestamp boundary, +source/modality independence, SQLite fallback, rollback rehydration, and +the public processor layout are retained + + reconstruction knob-bounded retrieval-time reconstruction append constructive recall remains non-decoder and can be disabled @@ -5914,12 +6108,15 @@ payloads maintain private current/base embedding surfaces in a process-wide lifecycle registry, including signal-only rows that affect the sqlite-vec population; rank into typed borrowed/owned candidates; reuse -the query norm across exact cosine checks +the query norm across exact cosine checks; track the exact historical +supersession population and current/base mismatches so a current top-k +cutoff can prove when no unseen historical row can enter the result the registry follows processor teardown across sequential thread migration and mirrors authoritative SQL write decisions; the same candidate population, K, filters, tie order, cosine results, thresholds, -and supersession edges are retained; SQL remains the fallback and no -public header or API layout changes +and supersession edges are retained; ambiguous lineage or tie order +falls back to the complete eligible scan; SQL remains the final fallback +and no public header or API layout changes graph retrieval @@ -5931,14 +6128,16 @@ semantic seed surface rollback snapshots -detach rebuildable durable caches, move the private accumulator map, -and detach working-memory signal-record and blob-reference vectors -before copying remaining processor state; journal active-source vector -lengths for ordinary appends and lazily deep-back up only the active -source before accepted storage, flush reset, or interrupt reset can -mutate prior records; trim working-memory appends and move an evicted -slot’s record ownership into the journal; reserve a full-map hook for -explicit foreign-source accumulator-topology mutation +detach rebuildable durable caches, deep-copy the internal +execution-sidecar state only for full snapshots, move the private +accumulator map, and detach working-memory signal-record and +blob-reference vectors before copying remaining processor state; journal +active-source vector lengths for ordinary appends and lazily deep-back +up only the active source before accepted storage, flush reset, or +interrupt reset can mutate prior records; trim working-memory appends +and move an evicted slot’s record ownership into the journal; reserve a +full-map hook for explicit foreign-source accumulator-topology +mutation non-boundary Natural ingestion does not recopy the growing pending unit or source map; a one-source flush does not copy unrelated open-source or working-memory history; failed writes and public no-store @@ -5946,6 +6145,29 @@ queries restore durable and volatile state exactly; public state layout and retention semantics are unchanged +emotional cascade metadata +maintain a private rebuildable cache of per-memory emotional rows, +per-embedding shared-member minima, recency-ordered flashbulb sources, +and the expandable topology footprint of the last fixed point; update it +at the same successful storage, consolidation, cascade, association, and +eviction decisions and rehydrate it after journal-aware rollback; +caller-supplied roots invalidate the sidecar before forwarding their +first transaction statement, while cache-only roots retain their exact +snapshot; share breadth-first edge visits across source-order 64-bit +batches while retaining a distinct visited bit and radius for every +source +source eligibility and stable tie order, shared-embedding +MIN/MAX semantics, shortest depth per source, +first-source-wins ordering, custom raw-SQL updates within the current +transaction, update decisions, and durable database state match the +scalar path; an inserted edge outside every source’s remaining-radius +footprint advances the fixed point without a graph walk, topology +rebuilds invalidate conservatively, batches continue for arbitrary +source counts, and neither path keys behavior by source id or modality; +ordinary engine-owned snapshot work still copies zero store-sized cache +entries + + synaptic tagging use indexed temporal candidate supersets with boundary ties before applying the original exact score and order @@ -6010,6 +6232,61 @@ These are source-health and work-count proofs. They do not reproduce the full 15,500-packet observation and do not turn the exact durable candidate scan into an asymptotically flat store search. +The later active-epoch cutover targets the remaining +store-size-dependent retrieval-inhibition recovery directly. A complete +15,695-packet Natural replay kept the active epoch within its harness +ceilings: the observed high-water marks were 512 events, 1,859 distinct +mutations, and 180,224 allocated bytes, with no over-limit event. The +caller honored 127 consolidations. Across the audit’s first and last +five eligible windows, `Competition.rif_recovery_active_sql` changed +from 0.008629 to 0.009038 ms, a 1.047 ratio. The whole write path did +not plateau: mean process time rose from 2.265 to 5.507 ms and +throughput fell from 36.27 to 9.14 packets/s. This run therefore +verifies the lazy-RIF hotspot and the scoped epoch ceilings, while +leaving graph retrieval, memory storage, and emotional propagation as +measured contributors. It is not a long-horizon or production-wide +boundedness claim. + +The observation-only bounded activation graph was then implemented +behind a default-off private flag and evaluated directly in compiled C++ +over 35,496 256-dimensional embeddings with 512 age-stratified queries. +At F=S=T=0.5 it held 20 roots, 640 leaves, 24 diverse representatives +per leaf, and eight neighbors per leaf. Normal update work reached 163 +comparisons against a fixed 196 ceiling; internal consolidation reached +28,462 against 29,360; and recall reached 996 against 1,196. Mean exact +top-16 identifier recall was 0.0562, duplicate-equivalent recall 0.1190, +best cosine 0.9445, and exact-neighbor semantic coverage 0.9545. These +results closely reproduce the separate prototype observation while +measuring the code that is actually wired to the processor lifecycle. +Deterministic common-pipeline tests produce identical candidate order, +state digest, and work for two versus four sources, text/audio/image +labels, and Natural versus Durable retention. The graph still loses +exact identifier recall and requires an O(N) restart rebuild, so it +remains diagnostic evidence rather than a retrieval cutover. + +After the nested-transaction lifecycle repair, the fixed allocation was +19,180,880 bytes at F=S=T=0.5, including a journal sized by the existing +consolidation interval. An immediate RAII scope owns each prepared +journal entry, so exceptions during object-store or rollback-snapshot +setup clear the root journal even before the main processing guard is +active. A repaired 15,695-packet Natural replay published all 15,695 +events without a bound or generation failure and preserved the current +flag-off behavior and logical-database digests. Its mean process cost +was 2.1077 ms versus 1.9115 ms in the paired flag-off artifact, a 10.26% +increase; end-to-end mean and wall time were 0.65% lower within run +noise. The repaired 2,016-message Durable replay likewise preserved +current flag-off behavior and database digests, with mean process cost +up 6.16% and end-to-end mean up 5.49%. These are observation costs, not +evidence that the present graph satisfies the retrieval-shape objective. + +For subsequent candidates, the optimization objective ranks a bounded, +repeatable retrieval envelope ahead of maximum write throughput. A +modest measured write regression is acceptable when consolidation +produces stable peaks and troughs, a material reset, and a more +cycle-symmetric retrieval sawtooth. Write cost remains a reported +tradeoff, and this preference does not substitute for replay evidence or +authorize a semantic cutover. + On 2026-06-30, a full Meta MSC replay rerun verified the retrieval-cache optimization on the same 9,130-turn slice used for the hosted frontier-judge artifact. The run preserved native probe behavior @@ -6125,6 +6402,35 @@ current-source run also failed the ratio gates: 1.633813 for latency, and 0.844665 for messages/s. This confirms that the non-flat conclusion is not an artifact of the realtime SQLite benchmark profile. +A later shared-path audit used the owner-authorized 15,695-packet +Natural corpus and its 2,016-message Durable form. The retained exact +historical coverage proof and batched emotional traversal produced a +Natural mean process time of 2.197 ms and wall time of 746,302 ms. Its +audited tail still failed: process final-five/first-five was 1.575951 +and throughput was 0.331728. Graph retrieval contributed 0.473572 ms +(43.7% of the process delta), emotional cascade 0.146594 ms, and memory +storage 0.124507 ms. The corresponding Durable run used the identical +ingestion algorithm plus its checkpoint edge, averaged 10.148 ms process +time, and completed in 75,684 ms. It also remained non-flat: process +ratio 1.839862 and throughput failure, with graph retrieval contributing +3.289430 ms, commit 1.144678 ms, and the checkpoint edge 0.699095 ms of +the positive delta. The Natural behavior/logical-database digests are +`e4f843e017902bb04f10e6b57bafeb9e850d663f8dc3719970fa94ffd189f3de` and +`76ee7281189b3b4446361a125a6f64090599049d6c6f2d6a257da916eff10adf`; the +Durable digests are +`25762284607b1851ea89189e073332b78d3d8fa8126e6c038e3b396c174ff463` and +`1c067e1dde67e5d288656bc137b4206bcbd2c1a76c1c0e95a9391318b7ec5267`. +These are exact harness results, not production-wide boundedness +evidence. + +The storage-cost audit contract was subsequently tightened to count +`rif_recovery_clock`, `rif_generation_resets`, and `rif_active_state` at +every store checkpoint, and to reject any Durable event reporting a +failed WAL checkpoint. The saved shared-path profiles above predate +those added fields, so their timings and digests remain historical +measurements but do not satisfy the current audit schema. A current-gate +replay is required before using them as cutover evidence. + Explicit consolidation required a separate lifecycle proof because force persistence broadly prunes and rewrites embedding rows. Candidate 34 now rebuilds the historical search registry from authoritative SQL only @@ -6169,6 +6475,79 @@ consolidation/tiering/eviction semantics, storage/index backend, public processor-state ownership, or fixed proof gate requires separate approval. +A later 15,695-packet natural-retention profile separated this retained +scan into static surface eligibility and dynamic retrieval work. In its +fixed late 200-packet window, the reference path evaluated a mean 38,074 +embedding rows per retrieval although only 1,345 survived the existing +eligibility predicate. An incrementally maintained long-term-reference +index moved the unchanged timestamp, current-surface, and supersession +predicate ahead of distance evaluation. It reduced evaluated distance +rows to 3,211 (-91.6%), distance time from 4.459 ms to 0.376 ms +(-91.6%), and cached seed search from 13.561 ms to 9.575 ms (-29.4%). A +fixed-timestamp paired replay produced identical ordered behavior and +SQL-dump digests. The remaining family-comparison cost still grew with +the eligible surface. A subsequent exact rejection uses the identity +‖*a* − *b*‖2 = ‖*a*‖2 + ‖*b*‖2 − 2*a* ⋅ *b*: +while accumulating squared coordinate differences, a partial sum already +above the maximum distance compatible with the duplicate threshold +soundly rejects that pair. Near-threshold pairs continue through the +existing Cauchy–Schwarz bounds and exact cosine check. In a corrected +fixed-clock, `--reuse-db` late-store pair, it reduced mean family +comparison from 1.757 to 0.798 ms, exact checks from 7,654 to 3.81 per +event, graph time from 2.321 to 1.349 ms, and process time from 4.974 to +4.417 ms. Event behavior and canonical logical-database digests matched +exactly. Total latency was unchanged because hydration dominated the +slice. A fresh 200-packet pair also matched behavior and logical +database state and showed no process or total-latency regression. This +is an exact constant-factor reduction, not proof of bounded retrieval +latency. + +The retained partial-distance loop was subsequently evaluated in fixed +16-coordinate vectorized blocks. Computing through the end of a block +cannot invalidate rejection: squared coordinate contributions are +nonnegative, so a completed block above the threshold proves the +complete distance is also above it. On a fixed-clock copied-late +200-packet pair, the block form preserved the event behavior oracle +exactly while reducing mean family-bound comparison from 0.736 to 0.424 +ms (-42.4%), cached graph seed work from 1.195 to 0.887 ms (-25.8%), and +process time from 6.912 to 6.741 ms (-2.5%). The fresh pair also +preserved the behavior oracle and improved process time. Total late +latency changed by about +1.1%, within the 10% regression gate. This +remains an exact constant-factor contributor repair; it does not +establish a flat tail or sublinear exact nearest-neighbor search. + +The subsequent immutable-feature cache removes repeated construction of +the same normalized vector and the same stored/Hadamard block summaries. +In a fixed-clock copied-late 200-packet pair, it preserved both the +behavior and logical-database digests, reduced family-feature +construction from 0.216 to 0.049 ms per packet (-77.3%), and reduced +mean process time from 2.494 to 2.275 ms (-8.8%). The cache changes no +candidate population or rank and is replaced whenever its embedding +entry is replaced. + +The emotional topology footprint was evaluated over all 15,695 packets. +It preserved the full behavior and logical-database digests, reduced +cascade traversal executions from 3,244 to 1,664, and lowered the late +five-window cascade mean from 0.235 to 0.144 ms. Mean process time +changed from 2.056 to 2.039 ms. The overall plateau gate still failed: +exact supersession selection and graph seed work remained store-size +dependent. These results support the two exact contributor repairs, not +a bounded-tail claim. + +The final current-tree replay enabled both repairs by default and again +processed all 15,695 packets. It preserved the event-behavior digest +`1b5b29f3cd342b94b7438b90940c2da1e896f869777aba02cb2ce4790109e452` and +canonical logical-database digest +`551f5aabf8c9cf1cdddaaf4adbc2b83119474d46553610380f8001d1c51005e1`. Mean +process time was 2.116 ms and mean end-to-end time was 48.739 ms. The +current plateau audit still rejected the tail: final-five/first-five +ratios were 1.699 for `MemoryStorage`, 2.059 for supersession-edge work, +1.380 for process time, and 0.344 for throughput. The final artifact +therefore proves semantic equivalence for this replay and preserves the +measured exact constant-factor improvements, but it does not prove +bounded Natural writes or authorize a production-wide flat-storage +claim. + ## Standard Eviction-Frontier Estimate The standard file-backed pressure gate is 500,000,000 bytes. Exact diff --git a/docs/paper/sections/10_implementation.qmd b/docs/paper/sections/10_implementation.qmd index a64452e5..9db4b003 100644 --- a/docs/paper/sections/10_implementation.qmd +++ b/docs/paper/sections/10_implementation.qmd @@ -81,6 +81,79 @@ accepted flush of that same pending unit; it does not construct a second single-signal memory alongside the accumulated unit. The Durable packet is the last signal in the flushed unit exactly once. +### Lazy retrieval-inhibition state and the active epoch + +Migration 28 keeps the existing `memories` columns but adds a private SQLite +recovery clock, generation resets, per-memory anchored inhibition state, an +expiry index, and a connection-local temporary effective-value view. The +persistent migration inventory is exactly the three state tables plus the +expiry index; it does not install durable views or triggers. Retrieval +competition advances one global log-recovery clock per event, materializes only rows whose exact +suppression has crossed the existing $10^{-9}$ active threshold, and updates +only newly suppressed losers. A full-recovery interval advances a generation; +older rows are materialized in bounded batches and reset markers are pruned +after their generation has no remaining active rows. Internal reads that +depend on strength, suppression, or the suppression timestamp use the +temporary effective view. Compatibility handling conservatively materializes +and rebuilds the private representation around every caller-supplied SQL +statement because aliases, wildcards, views, subqueries, and triggers cannot be +classified safely from SQL text. A caller mutation also invalidates every +database-derived processor cache before the statement executes. + +The authoritative signal mutation still commits once to persistent SQLite. +After that commit, a separate connection-local in-memory SQLite database +publishes only the current recovery clock and active-generation inhibition +rows. It never mirrors durable memory, signal, embedding, association, or +payload history. A failed persistent commit restores the pre-signal processor +snapshot; a failed post-commit epoch publication discards and rebuilds the +disposable database from persistent authority without replaying the committed +signal. Natural returns after publication. Durable follows the identical path +and then executes only the named WAL checkpoint barrier. + +The active epoch records event, changed-row, and allocated-byte measures with +harness safety ceilings of 512 events, 32,768 mutations, and 64 MiB. Reaching a +ceiling raises the existing `Required` consolidation hint before an honoring +caller can enter another event. Ignoring the hint neither starts another epoch +nor drops mutations. A successful explicit consolidation rebuilds the +disposable epoch and resets its mutable measures; a failed consolidation leaves +the old epoch intact. These are harness-scoped ceilings, not a claim that every +production workload is globally bounded. + +### Bounded activation observation shadow + +A separate private experiment observes whether long-lived retrieval can use a +fixed-size sparse activation graph. It is disabled unless the internal +`CORTEXT_BOUNDED_ACTIVATION_SHADOW` flag is set, cannot select candidates or +scores, and never writes canonical tables. `SignalProcessor` prepares a lookup +against the last published shadow generation, commits the ordinary persistent +SQLite transaction, and only then publishes the immutable observation once. +Nested processing journals its prepared observations while SQLite uses +savepoints; releasing a nested savepoint never publishes. The outermost root +commit publishes the journal in event order, while an outer rollback discards +the complete journal. Rollback, cancellation, or commit failure therefore +leaves the published generation unchanged. Natural and Durable share this +publication edge; Durable's later checkpoint cannot replay or reverse it. A +duplicate, generation gap or regression, digest mismatch, or shadow-local +failure disables and discards the disposable graph without changing the +canonical result. + +The graph contains $R=8+\operatorname{round}(24S)$ roots and at most +$K=128+\operatorname{round}(512F+512T)$ leaves. Root and leaf beams, +representatives, neighbor degree, activated consolidation leaves, and cadence +are likewise fixed functions of F/S/T. Storage is initialized once to +$R+K+KE$ embedding slots and $KD$ neighbor slots. Normal mutation, recall, and +internal consolidation each have closed-form comparison ceilings derived from +those capacities; no source identifier or modality participates in routing or +capacity. Consolidation rebalances leaves, updates root centroids, and refreshes +only a fixed number of activated leaf neighborhoods. + +The disposable graph is unavailable after restart until an explicit measured +rebuild from authoritative SQLite completes. That rebuild currently visits +retained history linearly, so it remains a named production-cutover blocker. +The experiment therefore establishes implementation and measurement seams for +fixed sparse activation; it does not replace exact retrieval, make the shadow +authoritative, or claim bounded startup or live behavior. + Rollback snapshots move the private accumulator map, working-memory records, and their blob-reference vectors out of the generic context copy and restore their ownership immediately afterward. The active source's bounded scalar @@ -141,6 +214,32 @@ builder. The normal core, storage, retrieval, feedback, episode, object-store, working-memory, signal-counter, and rate-observation paths are not maintenance steps. +Emotional cascade metadata is hydrated into a private, rebuildable processor +cache keyed by memory id and base embedding id. The cache preserves the SQL +contract for shared embeddings by retaining every member row, deriving current +intensity and half-life bonus with the same per-embedding minima, and retaining +only flashbulb rows in recency order for source discovery. Emotional +consolidation overwrites the affected embedding family, cascade propagation +applies the existing maxima, storage and shallow consolidation append rows, and +eviction removes them. Journal-aware rollback discards and rehydrates this +database-derived cache, while arbitrary custom pipelines retain the complete +snapshot path. This changes execution ownership only; source thresholds, +tie order, traversal, decay, updates, and persisted rows are unchanged. +When multiple emotional sources require traversal, the implementation batches +them in source-order groups of at most 64 and propagates a bit per source +through the same breadth-first levels. Each bit retains its source-specific +radius, and reached embeddings are emitted at the first depth observed for +that source. Batches are processed in original source order, so the existing +first-source-wins update rule is unchanged. This shares edge visits without +using source identity or modality as an optimization key. +The cache also records the memory nodes from which each source could still +expand within its radius. An incrementally inserted association can therefore +advance the fixed point without another traversal when neither endpoint lies +in any source's expansion footprint. A topology rebuild invalidates the +footprint conservatively. Ordinary unconnected non-source inserts and +monotone increases to target emotional values likewise preserve the fixed +point; source changes and target-value decreases still re-arm it. + Shallow consolidation is embedding-only. It clusters eligible long-term memories, writes an `ASSOCIATION` centroid node for each cluster, assigns source memories to the cluster, and emits `derived_from` edges. If durable `LABEL` @@ -158,19 +257,51 @@ batch semantic extraction job. Production retrieval discovers a broad but bounded vector seed set from durable memory embeddings. Before the seed cap, it removes directed `supersedes` targets and collapses near-duplicate embedding families to one representative. -The family index uses complementary 32-block Cauchy--Schwarz upper bounds in -the stored coordinate system and a normalized Walsh--Hadamard basis, followed -by exact cosine checks. Each upper bound is sound, so taking their minimum -cannot exclude a pair meeting the cosine threshold. The complementary bases -avoid broad exact pairwise work for both sparse coordinate-aligned vectors and -dense Hadamard-aligned vectors; arbitrary adversarial surfaces may still reach -the exact fallback. If the private vector cache is unavailable, durable +The family index accumulates exact squared coordinate differences in +16-coordinate vectorized blocks and rejects a pair as soon as a completed +block exceeds the complete squared-distance limit implied by the cosine +threshold. Surviving pairs use complementary +32-block Cauchy--Schwarz upper bounds in the stored coordinate system and a +normalized Walsh--Hadamard basis, followed by exact cosine checks. The partial +distance condition remains sound because every omitted term is nonnegative; +both upper bounds are also sound, so none can exclude a pair meeting the cosine +threshold. The complementary bases avoid broad exact +pairwise work for both sparse coordinate-aligned vectors and dense +Hadamard-aligned vectors; arbitrary adversarial surfaces may still reach the +exact fallback. The normalized vector and both block-norm summaries are +immutable functions of an embedding, so the private surface computes them on +first family use and retains them with that entry. Replacing a current surface +entry replaces its summaries as part of the same cache mutation. This removes +repeated normalization and Walsh--Hadamard construction without changing +family order, comparison arithmetic, or fallback behavior. If the private +vector cache is unavailable, durable processing rebuilds it once from the complete persisted surface and immediately applies the same family and supersession filters before truncation. A failed rebuild installs a failure sentinel rather than repeating the two complete surface scans on every request. A unique cached vector retains every long-term memory metadata alternative that shares its base embedding, and query-time eligibility chooses a nonsuperseded sibling without duplicating vector storage. +The cache separately indexes entries that have at least one long-term metadata +alternative. Retrieval applies the existing timestamp, current-surface, and +supersession predicates to that subset before evaluating vector distance, so +signal-only historical embeddings do not enter the distance kernel. This is an +execution-only index: it does not change the eligible set, distance expression, +tie order, family collapse, or source and modality semantics. +Alongside the shared association fanout cache, an internal execution sidecar +maintains, for each supersession target, the earliest start timestamp of an +eligible replacement. Retrieval tests that timestamp directly instead of +rebuilding a target set by scanning every incoming edge. Memory storage +publishes its already-committed supersession decisions into the fanout cache +and rebuilds the sidecar index; missing target metadata invalidates the cache +and returns to authoritative SQLite rehydration. Neither structure is part of +the public processor layout. The strict replacement-before-query predicate and +base embedding identity remain unchanged. +The emotional-metadata portion of the sidecar is trusted only by the +engine-owned operation root that maintains it. A caller-supplied root's +transaction view invalidates that sidecar before forwarding its first SQL +statement, so a custom transaction that updates emotional columns directly +cannot leave a valid-looking stale fixed point for a later operation in the +same transaction. Cache-only custom roots retain their exact rollback snapshot. The fallback executes a demand-driven sequence of ordered SQL pages over the current and historical vector surfaces. Each page joins memory metadata and applies kind, timestamp, and supersession eligibility before @@ -185,14 +316,34 @@ cache is built and incrementally updated from the processor's latest reconstruction surface, even when a test or storage policy intentionally omits the corresponding persisted-current write. A valid cache therefore performs distance ordering and cosine-family accounting on latest vectors. If that cache -is unavailable while the processor surface is complete, durable retrieval -rebuilds a current-only cache from the processor surface and ephemeral retrieval -scans that surface directly without mutating the registry. Only an incomplete -processor surface falls back to SQL; in that recovery case the query substitutes -each latest reconstruction before cross-page family accounting. Base families +is unavailable while the processor surface is complete and original-base +lineage remains available, durable retrieval rebuilds a current-only cache from +the processor surface and ephemeral retrieval scans that surface directly +without mutating the registry. Missing base lineage or an incomplete processor +surface falls back to SQL; in that recovery case the query substitutes each +latest reconstruction before cross-page family accounting. Base families that converge after reconstruction therefore consume one current-family slot and cannot stop selection early. Current per-memory reconstructions remain distinct rows and the corresponding base row for that same memory is excluded. +The same registry keeps an exact index of supersession-eligible historical +memory rows and the base lineage of each current row. Memory storage first +ranks the current surface and records its exact cutoff. When current and +historical populations are identical except for explicitly tracked changed +memories, deterministic embedding-id and memory-id tie orders agree, and every +changed historical row is outside that cutoff, the current result proves that +the historical top-k contributes no unseen candidate. The historical scan is +then skipped; any ambiguous lineage, reversed tie order, or failed cutoff proof +falls back to the complete eligible historical scan. A historical embedding +referenced by more than one eligible memory also disables both +current-population shortcuts: the historical query ranks embeddings before +expanding every memory sibling, whereas the current surface ranks per-memory +rows. The complete embedding-level pass therefore preserves sibling fanout even +when the per-memory candidate limit is saturated. This proof changes neither +the candidate population nor the chosen supersession edges, but the current +surface distance pass remains proportional to that surface. +Rollback and flush recovery also rehydrate each current entry's original base +ID from `memories.embedding_id`; they never infer it from the reconstructed +surface. When constructive recall is disabled, both restart hydration and cache-loss rebuild select the base embedding and ignore reconstruction/current surfaces. This recovery path diff --git a/docs/paper/sections/11_optimization.qmd b/docs/paper/sections/11_optimization.qmd index e539b454..8507dc0a 100644 --- a/docs/paper/sections/11_optimization.qmd +++ b/docs/paper/sections/11_optimization.qmd @@ -59,14 +59,17 @@ The current branch includes the following implementation-level changes: | Area | Optimization | Behavior contract | |---|---|---| | SQLite execution | prepared-statement reuse in the store layer | same SQL semantics, lower repeated parse overhead | +| retrieval-induced inhibition | replace per-event recovery of every active row with a persistent global log clock, indexed exact-threshold expiry, generation resets, and a bounded connection-local SQLite active-epoch projection; publish the projection only after the shared persistent commit | effective strength, suppression, timestamp, $10^{-9}$ freeze, restart, rollback, caller SQL, eviction, and deterministic ranking remain exact; publication failure rebuilds from persistent authority without replay; Natural and Durable use the same transaction and Durable adds only its checkpoint barrier; no source-id or modality branch and no full-history projection | | vector ranking | bounded top-k selection and architecture SIMD kernels in the vector path | same candidate contract; SIMD accepted after output checks | -| retrieval seed surface | current-memory embedding lookup with pre-cap supersession filtering and complementary sound 32-block Cauchy--Schwarz bounds in the stored and Walsh--Hadamard bases followed by exact cosine family checks; shared vectors retain all long-term metadata alternatives; the private search cache follows the processor's latest reconstruction surface independently of persisted-current materialization; cache loss uses the complete processor surface directly or, only when that surface is incomplete, metadata-eligible, distance-ordered, F/S/T-bounded SQL pages feeding one cross-page cosine-family index that substitutes latest reconstructions before accounting | latest reconstruction and eligible shared-embedding siblings remain visible, byte-distinct near-duplicate boilerplate and stale base families that converge after reconstruction cannot consume the semantic-family candidate budget, sparse and dense orthogonal vector families avoid broad exact cosine work, recovery does not return the complete result at once, ephemeral recovery does not mutate the registry, and source/modality metadata cannot influence rank; sqlite-vec still scans linearly for every requested SQL page, the historical window partition may internally sort and materialize the full eligible history, and the knob-derived top-k bounds only rows returned to C++ and decoded downstream rather than claiming sublinear search or bounded internal sorter memory | +| retrieval seed surface | current-memory embedding lookup with pre-cap supersession filtering; immutable normalized and stored/Hadamard block summaries cached per private surface entry; exact partial squared-distance rejection plus complementary sound 32-block Cauchy--Schwarz bounds in the stored and Walsh--Hadamard bases before exact cosine family checks; shared vectors retain all long-term metadata alternatives; the private search cache follows the processor's latest reconstruction surface independently of persisted-current materialization; cache loss uses the complete processor surface directly or, only when that surface is incomplete, metadata-eligible, distance-ordered, F/S/T-bounded SQL pages feeding one cross-page cosine-family index that substitutes latest reconstructions before accounting | latest reconstruction and eligible shared-embedding siblings remain visible, byte-distinct near-duplicate boilerplate and stale base families that converge after reconstruction cannot consume the semantic-family candidate budget, sparse and dense orthogonal vector families avoid broad exact cosine work, recovery does not return the complete result at once, ephemeral recovery does not mutate the registry, and source/modality metadata cannot influence rank; sqlite-vec still scans linearly for every requested SQL page, the historical window partition may internally sort and materialize the full eligible history, and the knob-derived top-k bounds only rows returned to C++ and decoded downstream rather than claiming sublinear search or bounded internal sorter memory | | graph expansion | retained traversal types: `co_occurs`, `similar_to`, `reinforces`, `causes`, `derived_from`, `next_in_episode`, `prev_in_episode`, and `within_same_event`; `reinforces` is degree-normalized | graph activation is bounded and high-degree hubs cannot dominate; directional `supersedes` relations define families but are not activation edges | +| supersession eligibility | derive target-to-earliest-replacement timestamps in an internal execution sidecar beside the shared association fanout cache and incrementally publish committed MemoryStorage supersession edges instead of invalidating and rebuilding all fanout rows | exact edge direction, base embedding ids, strict timestamp boundary, source/modality independence, SQLite fallback, rollback rehydration, and the public processor layout are retained | | reconstruction | knob-bounded retrieval-time reconstruction append | constructive recall remains non-decoder and can be disabled cleanly | | memory storage | avoid redundant object-store writes for single-signal memory payloads | durable payload identity is preserved | -| exact durable-neighbor ranking | maintain private current/base embedding surfaces in a process-wide lifecycle registry, including signal-only rows that affect the sqlite-vec population; rank into typed borrowed/owned candidates; reuse the query norm across exact cosine checks | the registry follows processor teardown across sequential thread migration and mirrors authoritative SQL write decisions; the same candidate population, K, filters, tie order, cosine results, thresholds, and supersession edges are retained; SQL remains the fallback and no public header or API layout changes | +| exact durable-neighbor ranking | maintain private current/base embedding surfaces in a process-wide lifecycle registry, including signal-only rows that affect the sqlite-vec population; rank into typed borrowed/owned candidates; reuse the query norm across exact cosine checks; track the exact historical supersession population and current/base mismatches so a current top-k cutoff can prove when no unseen historical row can enter the result | the registry follows processor teardown across sequential thread migration and mirrors authoritative SQL write decisions; the same candidate population, K, filters, tie order, cosine results, thresholds, and supersession edges are retained; ambiguous lineage or tie order falls back to the complete eligible scan; SQL remains the final fallback and no public header or API layout changes | | graph retrieval | score vector similarity first, restrict recency to a tie-break, cap graph bonus, and reserve final occupancy for direct semantic anchors | recent unrelated rows and noisy graph neighbors cannot displace the semantic seed surface | -| rollback snapshots | detach rebuildable durable caches, move the private accumulator map, and detach working-memory signal-record and blob-reference vectors before copying remaining processor state; journal active-source vector lengths for ordinary appends and lazily deep-back up only the active source before accepted storage, flush reset, or interrupt reset can mutate prior records; trim working-memory appends and move an evicted slot's record ownership into the journal; reserve a full-map hook for explicit foreign-source accumulator-topology mutation | non-boundary Natural ingestion does not recopy the growing pending unit or source map; a one-source flush does not copy unrelated open-source or working-memory history; failed writes and public no-store queries restore durable and volatile state exactly; public state layout and retention semantics are unchanged | +| rollback snapshots | detach rebuildable durable caches, deep-copy the internal execution-sidecar state only for full snapshots, move the private accumulator map, and detach working-memory signal-record and blob-reference vectors before copying remaining processor state; journal active-source vector lengths for ordinary appends and lazily deep-back up only the active source before accepted storage, flush reset, or interrupt reset can mutate prior records; trim working-memory appends and move an evicted slot's record ownership into the journal; reserve a full-map hook for explicit foreign-source accumulator-topology mutation | non-boundary Natural ingestion does not recopy the growing pending unit or source map; a one-source flush does not copy unrelated open-source or working-memory history; failed writes and public no-store queries restore durable and volatile state exactly; public state layout and retention semantics are unchanged | +| emotional cascade metadata | maintain a private rebuildable cache of per-memory emotional rows, per-embedding shared-member minima, recency-ordered flashbulb sources, and the expandable topology footprint of the last fixed point; update it at the same successful storage, consolidation, cascade, association, and eviction decisions and rehydrate it after journal-aware rollback; caller-supplied roots invalidate the sidecar before forwarding their first transaction statement, while cache-only roots retain their exact snapshot; share breadth-first edge visits across source-order 64-bit batches while retaining a distinct visited bit and radius for every source | source eligibility and stable tie order, shared-embedding `MIN`/`MAX` semantics, shortest depth per source, first-source-wins ordering, custom raw-SQL updates within the current transaction, update decisions, and durable database state match the scalar path; an inserted edge outside every source's remaining-radius footprint advances the fixed point without a graph walk, topology rebuilds invalidate conservatively, batches continue for arbitrary source counts, and neither path keys behavior by source id or modality; ordinary engine-owned snapshot work still copies zero store-sized cache entries | | synaptic tagging | use indexed temporal candidate supersets with boundary ties before applying the original exact score and order | the same nearest source-backed memories are tagged without a whole-source group scan | | live replay ingress | internal replay path can skip per-event hydration when no probe needs it | public processing APIs still hydrate normally | @@ -114,6 +117,57 @@ These are source-health and work-count proofs. They do not reproduce the full 15,500-packet observation and do not turn the exact durable candidate scan into an asymptotically flat store search. +The later active-epoch cutover targets the remaining store-size-dependent +retrieval-inhibition recovery directly. A complete 15,695-packet Natural replay +kept the active epoch within its harness ceilings: the observed high-water +marks were 512 events, 1,859 distinct mutations, and 180,224 allocated bytes, +with no over-limit event. The caller honored 127 consolidations. Across the +audit's first and last five eligible windows, +`Competition.rif_recovery_active_sql` changed from 0.008629 to 0.009038 ms, a +1.047 ratio. The whole write path did not plateau: mean process time rose from +2.265 to 5.507 ms and throughput fell from 36.27 to 9.14 packets/s. This run +therefore verifies the lazy-RIF hotspot and the scoped epoch ceilings, while +leaving graph retrieval, memory storage, and emotional propagation as measured +contributors. It is not a long-horizon or production-wide boundedness claim. + +The observation-only bounded activation graph was then implemented behind a +default-off private flag and evaluated directly in compiled C++ over 35,496 +256-dimensional embeddings with 512 age-stratified queries. At F=S=T=0.5 it +held 20 roots, 640 leaves, 24 diverse representatives per leaf, and eight +neighbors per leaf. Normal update work reached 163 comparisons against a fixed +196 ceiling; internal consolidation reached 28,462 against 29,360; and recall +reached 996 against 1,196. Mean exact top-16 identifier recall was 0.0562, +duplicate-equivalent recall 0.1190, best cosine 0.9445, and exact-neighbor +semantic coverage 0.9545. These results closely reproduce the separate +prototype observation while measuring the code that is actually wired to the +processor lifecycle. Deterministic common-pipeline tests produce identical +candidate order, state digest, and work for two versus four sources, +text/audio/image labels, and Natural versus Durable retention. The graph still +loses exact identifier recall and requires an O(N) restart rebuild, so it +remains diagnostic evidence rather than a retrieval cutover. + +After the nested-transaction lifecycle repair, the fixed allocation was +19,180,880 bytes at F=S=T=0.5, including a journal sized by the existing +consolidation interval. An immediate RAII scope owns each prepared journal +entry, so exceptions during object-store or rollback-snapshot setup clear the +root journal even before the main processing guard is active. A repaired +15,695-packet Natural replay published all +15,695 events without a bound or generation failure and preserved the current +flag-off behavior and logical-database digests. Its mean process cost was +2.1077 ms versus 1.9115 ms in the paired flag-off artifact, a 10.26% increase; +end-to-end mean and wall time were 0.65% lower within run noise. The repaired +2,016-message Durable replay likewise preserved current flag-off behavior and +database digests, with mean process cost up 6.16% and end-to-end mean up 5.49%. +These are observation costs, not evidence that the present graph satisfies the +retrieval-shape objective. + +For subsequent candidates, the optimization objective ranks a bounded, +repeatable retrieval envelope ahead of maximum write throughput. A modest +measured write regression is acceptable when consolidation produces stable +peaks and troughs, a material reset, and a more cycle-symmetric retrieval +sawtooth. Write cost remains a reported tradeoff, and this preference does not +substitute for replay evidence or authorize a semantic cutover. + On 2026-06-30, a full Meta MSC replay rerun verified the retrieval-cache optimization on the same 9,130-turn slice used for the hosted frontier-judge artifact. The run preserved native probe behavior exactly: all non-timing probe @@ -185,6 +239,33 @@ and 1,021 signals. The final current-source run also failed the ratio gates: latency, and 0.844665 for messages/s. This confirms that the non-flat conclusion is not an artifact of the realtime SQLite benchmark profile. +A later shared-path audit used the owner-authorized 15,695-packet Natural +corpus and its 2,016-message Durable form. The retained exact historical +coverage proof and batched emotional traversal produced a Natural mean process +time of 2.197 ms and wall time of 746,302 ms. Its audited tail still failed: +process final-five/first-five was 1.575951 and throughput was 0.331728. Graph +retrieval contributed 0.473572 ms (43.7% of the process delta), emotional +cascade 0.146594 ms, and memory storage 0.124507 ms. The corresponding Durable +run used the identical ingestion algorithm plus its checkpoint edge, averaged +10.148 ms process time, and completed in 75,684 ms. It also remained non-flat: +process ratio 1.839862 and throughput failure, with graph retrieval contributing +3.289430 ms, commit 1.144678 ms, and the checkpoint edge 0.699095 ms of the +positive delta. The Natural behavior/logical-database digests are +`e4f843e017902bb04f10e6b57bafeb9e850d663f8dc3719970fa94ffd189f3de` +and `76ee7281189b3b4446361a125a6f64090599049d6c6f2d6a257da916eff10adf`; +the Durable digests are +`25762284607b1851ea89189e073332b78d3d8fa8126e6c038e3b396c174ff463` +and `1c067e1dde67e5d288656bc137b4206bcbd2c1a76c1c0e95a9391318b7ec5267`. +These are exact harness results, not production-wide boundedness evidence. + +The storage-cost audit contract was subsequently tightened to count +`rif_recovery_clock`, `rif_generation_resets`, and `rif_active_state` at every +store checkpoint, and to reject any Durable event reporting a failed WAL +checkpoint. The saved shared-path profiles above predate those added fields, so +their timings and digests remain historical measurements but do not satisfy the +current audit schema. A current-gate replay is required before using them as +cutover evidence. + Explicit consolidation required a separate lifecycle proof because force persistence broadly prunes and rewrites embedding rows. Candidate 34 now rebuilds the historical search registry from authoritative SQL only after a @@ -225,6 +306,72 @@ candidate contract, consolidation/tiering/eviction semantics, storage/index backend, public processor-state ownership, or fixed proof gate requires separate approval. +A later 15,695-packet natural-retention profile separated this retained scan +into static surface eligibility and dynamic retrieval work. In its fixed late +200-packet window, the reference path evaluated a mean 38,074 embedding rows +per retrieval although only 1,345 survived the existing eligibility predicate. +An incrementally maintained long-term-reference index moved the unchanged +timestamp, current-surface, and supersession predicate ahead of distance +evaluation. It reduced evaluated distance rows to 3,211 (-91.6%), distance time +from 4.459 ms to 0.376 ms (-91.6%), and cached seed search from 13.561 ms to +9.575 ms (-29.4%). A fixed-timestamp paired replay produced identical ordered +behavior and SQL-dump digests. The remaining family-comparison cost still grew +with the eligible surface. A subsequent exact rejection uses the identity +$\lVert a-b\rVert^2=\lVert a\rVert^2+\lVert b\rVert^2-2a\cdot b$: while +accumulating squared coordinate differences, a partial sum already above the +maximum distance compatible with the duplicate threshold soundly rejects that +pair. Near-threshold pairs continue through the existing Cauchy--Schwarz bounds +and exact cosine check. In a corrected fixed-clock, `--reuse-db` late-store +pair, it reduced mean family comparison from 1.757 to 0.798 ms, exact checks +from 7,654 to 3.81 per event, graph time from 2.321 to 1.349 ms, and process +time from 4.974 to 4.417 ms. Event behavior and canonical logical-database +digests matched exactly. Total latency was unchanged because hydration +dominated the slice. A fresh 200-packet pair also matched behavior and logical +database state and showed no process or total-latency regression. This is an +exact constant-factor reduction, not proof of bounded retrieval latency. + +The retained partial-distance loop was subsequently evaluated in fixed +16-coordinate vectorized blocks. Computing through the end of a block cannot +invalidate rejection: squared coordinate contributions are nonnegative, so a +completed block above the threshold proves the complete distance is also +above it. On a fixed-clock copied-late 200-packet pair, the block form preserved +the event behavior oracle exactly while reducing mean family-bound comparison +from 0.736 to 0.424 ms (-42.4%), cached graph seed work from 1.195 to +0.887 ms (-25.8%), and process time from 6.912 to 6.741 ms (-2.5%). The fresh +pair also preserved the behavior oracle and improved process time. Total late +latency changed by about +1.1%, within the 10% regression gate. This remains an +exact constant-factor contributor repair; it does not establish a flat tail or +sublinear exact nearest-neighbor search. + +The subsequent immutable-feature cache removes repeated construction of the +same normalized vector and the same stored/Hadamard block summaries. In a +fixed-clock copied-late 200-packet pair, it preserved both the behavior and +logical-database digests, reduced family-feature construction from 0.216 to +0.049 ms per packet (-77.3%), and reduced mean process time from 2.494 to +2.275 ms (-8.8%). The cache changes no candidate population or rank and is +replaced whenever its embedding entry is replaced. + +The emotional topology footprint was evaluated over all 15,695 packets. It +preserved the full behavior and logical-database digests, reduced cascade +traversal executions from 3,244 to 1,664, and lowered the late five-window +cascade mean from 0.235 to 0.144 ms. Mean process time changed from 2.056 to +2.039 ms. The overall plateau gate still failed: exact supersession selection +and graph seed work remained store-size dependent. These results support the +two exact contributor repairs, not a bounded-tail claim. + +The final current-tree replay enabled both repairs by default and again +processed all 15,695 packets. It preserved the event-behavior digest +`1b5b29f3cd342b94b7438b90940c2da1e896f869777aba02cb2ce4790109e452` +and canonical logical-database digest +`551f5aabf8c9cf1cdddaaf4adbc2b83119474d46553610380f8001d1c51005e1`. +Mean process time was 2.116 ms and mean end-to-end time was 48.739 ms. The +current plateau audit still rejected the tail: final-five/first-five ratios +were 1.699 for `MemoryStorage`, 2.059 for supersession-edge work, 1.380 for +process time, and 0.344 for throughput. The final artifact therefore proves +semantic equivalence for this replay and preserves the measured exact +constant-factor improvements, but it does not prove bounded Natural writes or +authorize a production-wide flat-storage claim. + ## Standard Eviction-Frontier Estimate The standard file-backed pressure gate is 500,000,000 bytes. Exact databases diff --git a/docs/paper/sections/7_consolidation.qmd b/docs/paper/sections/7_consolidation.qmd index fd20cb77..b818e98d 100644 --- a/docs/paper/sections/7_consolidation.qmd +++ b/docs/paper/sections/7_consolidation.qmd @@ -35,7 +35,11 @@ clusterer, shallow replay, and graph construction. Maintenance therefore does not create an episode, signal, working-memory row, long-term memory, blob, or searchable embedding, and it does not update normal throughput observations. The single `consolidation_state` output is an ordered hint for the caller; it -does not schedule maintenance work by itself. +does not schedule maintenance work by itself. In addition to the throughput +classifier below, the private active-epoch store raises `Required` when its +event, mutation, or allocated-byte safety ceiling is reached. That boundary is +source- and modality-independent, remains asserted if ignored, and is cleared +only after a successful forced-maintenance commit publishes a fresh epoch. A caller can use the engine hints as the external scheduling rule. Since the last committed forced request, including a coherent no-op with no persisted @@ -75,7 +79,7 @@ p_rearm(F,S,T) = p(F,S,T) + (1 - p(F,S,T)) * T p_drift(F,S,T) = 1 - p(F,S,T) -consolidation_state = +throughput_state = None, if armed = false OR memories_since_consolidation <= 0 OR range <= numeric_epsilon @@ -87,8 +91,10 @@ consolidation_state = The required branch is evaluated first. Since `consolidation_escalation(T)` is always greater than one, the required boundary is strictly below the recommendation boundary after every floor or peak -update. Elapsed wall or event time and arbitrary memory counts do not enter the -state decision; backlog is only a positive-work guard. An explicit force +update. Elapsed wall or event time and arbitrary durable memory counts do not +enter the throughput decision; backlog is only a positive-work guard. The +caller-facing state is `Required` whenever the bounded active epoch has reached +a safety ceiling, and otherwise equals `throughput_state`. An explicit force request starts consolidation independently and its output state is `None`. A committed forced request acknowledges the active excursion by persisting `armed=false`, even when no coherent cluster exists. The acknowledgment resets diff --git a/examples/benchmark/chat_replay_live_run.cpp b/examples/benchmark/chat_replay_live_run.cpp index 107865d4..d0361128 100644 --- a/examples/benchmark/chat_replay_live_run.cpp +++ b/examples/benchmark/chat_replay_live_run.cpp @@ -7,6 +7,7 @@ #include #include "../../src/encoder/text_encoder_factory.hpp" +#include "../../src/operations/bounded_activation_shadow_internal.hpp" #include "../../src/operations/retrieval_trace_state.hpp" #include @@ -15,6 +16,7 @@ #include #include +#include #include #include #include @@ -27,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -69,10 +72,17 @@ struct Config { fs::path input_dir; fs::path transcript; + fs::path packet_corpus; + fs::path message_corpus; + fs::path shadow_embedding_corpus; fs::path db_path = "build/chat_replay_live_run.sqlite"; fs::path output_path = "build/chat_replay_live_run_summary.json"; int skip_messages = 0; int max_messages = 1000; + int max_packets = -1; + int shadow_queries = 512; + int shadow_result_k = 16; + int skip_packets = 0; int media_limit = 0; int consolidate_every = 0; int warmup_events = 0; @@ -91,6 +101,8 @@ struct Config bool profile_probes_only = false; bool checkpoint_eval_only = false; int progress_stride = 1000; + std::uint64_t fixed_timestamp_base_ms = 0; + std::uint64_t fixed_timestamp_step_ms = 0; std::uint64_t checkpoint_after_timestamp = 0; int checkpoint_query_count = 8; int checkpoint_query_stride = 1; @@ -98,6 +110,10 @@ struct Config int checkpoint_queries_per_day = 0; bool full_operation_ms = false; bool behavior_oracle = false; + bool honor_required_consolidation = false; + bool no_profile_rows = false; + bool reuse_db = false; + cortext::Retention retention = cortext::Retention::Durable; std::string sqlite_profile = "realtime"; }; @@ -619,7 +635,8 @@ PublicMemoryBehaviorJson ( } nlohmann::json -PublicBehaviorJson (const cortext::Cortext::Context &ctx) +PublicBehaviorJson (const cortext::Cortext::Context &ctx, + bool bounded_working_memory = false) { nlohmann::json metrics = nlohmann::json::object (); for (const auto &[metric, value] : ctx.output.metrics) @@ -633,8 +650,23 @@ PublicBehaviorJson (const cortext::Cortext::Context &ctx) std::memcpy (embedding_bytes.data (), ctx.embedding.data (), embedding_bytes.size ()); } + nlohmann::json working_memory; + if (bounded_working_memory) + { + working_memory = { + { "count", ctx.working_memory.size () }, + { "first_id", + ctx.working_memory.empty () ? 0 : ctx.working_memory.front ().id }, + { "last_id", + ctx.working_memory.empty () ? 0 : ctx.working_memory.back ().id }, + }; + } + else + { + working_memory = PublicMemoryBehaviorJson (ctx.working_memory); + } return { - { "working_memory", PublicMemoryBehaviorJson (ctx.working_memory) }, + { "working_memory", std::move (working_memory) }, { "retrieved_memory", PublicMemoryBehaviorJson (ctx.retrieved_memory) }, { "embedding_size", ctx.embedding.size () }, { "embedding_blake3", PrivateValueDigest (embedding_bytes) }, @@ -930,14 +962,112 @@ RetrievalTraceJson () }; } +nlohmann::json +WorkCountersJson (const cortext::Cortext::Context &ctx) +{ + const auto value = [&ctx] (const char *name) { + const auto it = ctx.output.operation_ms.find (name); + return it == ctx.output.operation_ms.end () ? 0.0 : it->second; + }; + const double supersession_current + = value ("MemoryStorage.supersession_current_candidate_count"); + const double supersession_historical + = value ("MemoryStorage.supersession_historical_candidate_count"); + const double supersession_current_rows + = value ("MemoryStorage.supersession_current_rows_visited"); + const double supersession_historical_rows + = value ("MemoryStorage.supersession_historical_rows_visited"); + return { + { "retrieval_suppression_id_count", + value ("SignalProcessor.retrieval_suppression_id_count") }, + { "predictive_id_count", value ("SignalProcessor.predictive_id_count") }, + { "rollback_full_cache_copy_count", + value ("SignalProcessor.snapshot_full_cache_copy_count") }, + { "rollback_cache_entry_copy_count", + value ("SignalProcessor.snapshot_cache_entry_copy_count") }, + { "graph_candidate_count", value ("GraphRetrieve.candidate_count") }, + { "graph_exact_comparison_count", + value ("GraphRetrieve.family_exact_comparison_count") }, + { "graph_cache_rebuild_count", + value ("GraphRetrieve.cache_rebuild_count") }, + { "graph_rows_visited", value ("GraphRetrieve.rows_visited") }, + { "competition_candidate_count", + value ("Competition.candidate_count") }, + { "competition_rows_visited", value ("Competition.rows_visited") }, + { "competition_rows_touched", value ("Competition.rows_touched") }, + { "supersession_current_candidate_count", supersession_current }, + { "supersession_historical_candidate_count", supersession_historical }, + { "supersession_rows_visited", + supersession_current_rows + supersession_historical_rows }, + { "emotional_source_count", value ("EmotionalCascade.source_count") }, + { "emotional_neighbor_count", value ("EmotionalCascade.neighbor_count") }, + { "emotional_update_count", value ("EmotionalCascade.update_count") }, + }; +} + +std::uint64_t +RequiredOperationCounter (const cortext::Cortext::Context &ctx, + const std::string &name) +{ + const auto value = ctx.output.operation_ms.find (name); + if (value == ctx.output.operation_ms.end () + || !std::isfinite (value->second) || value->second < 0.0 + || std::floor (value->second) != value->second) + throw std::runtime_error ("missing or invalid operation counter: " + name); + return static_cast (value->second); +} + +nlohmann::json +ConsolidationEpochCountersJson (const cortext::Cortext::Context &ctx, + const std::string &prefix) +{ + const auto counter = [&ctx, &prefix] (const char *name) { + return RequiredOperationCounter (ctx, prefix + "." + name); + }; + return { + { "accumulator_signal_count", counter ("accumulator_signal_count") }, + { "working_memory_pending_signal_count", + counter ("working_memory_pending_signal_count") }, + { "consolidation_dirty_memory_count", + counter ("consolidation_dirty_memory_count") }, + { "consolidation_dirty_association_count", + counter ("consolidation_dirty_association_count") }, + { "consolidation_dirty_index_count", + counter ("consolidation_dirty_index_count") }, + }; +} + +nlohmann::json +ActiveEpochCountersJson (const cortext::Cortext::Context &ctx) +{ + return { + { "event_count", + RequiredOperationCounter ( + ctx, "SignalProcessor.rif_active_epoch_event_count") }, + { "mutation_count", + RequiredOperationCounter ( + ctx, "SignalProcessor.rif_active_epoch_mutation_count") }, + { "allocated_bytes", + RequiredOperationCounter ( + ctx, "SignalProcessor.rif_active_epoch_allocated_bytes") }, + { "required", + RequiredOperationCounter ( + ctx, "SignalProcessor.rif_active_epoch_required") == 1.0 }, + }; +} + nlohmann::json WorkingSetCurveRow (int event_index, const EventDoc &doc, const cortext::Cortext::Context &ctx, - bool full_operation_ms = false) + bool full_operation_ms = false, + bool bounded_behavior = false) { const int retrieved_tokens = EstimateMemoryPacketTokens (ctx.retrieved_memory); - const int working_tokens = EstimateMemoryPacketTokens (ctx.working_memory); + const int working_tokens = bounded_behavior + ? 0 + : EstimateMemoryPacketTokens ( + ctx.working_memory); std::vector > sorted_ops ( ctx.output.operation_ms.begin (), ctx.output.operation_ms.end ()); std::sort (sorted_ops.begin (), sorted_ops.end (), @@ -961,16 +1091,23 @@ WorkingSetCurveRow (int event_index, { "modality", doc.modality }, { "working_items", ctx.working_memory.size () }, { "retrieved_items", ctx.retrieved_memory.size () }, - { "working_tokens", working_tokens }, + { "working_tokens", + bounded_behavior ? nlohmann::json (nullptr) + : nlohmann::json (working_tokens) }, { "retrieved_tokens", retrieved_tokens }, - { "active_context_tokens", working_tokens + retrieved_tokens }, + { "active_context_tokens", + bounded_behavior ? nlohmann::json (nullptr) + : nlohmann::json (working_tokens + retrieved_tokens) }, + { "working_tokens_observed", !bounded_behavior }, { "latency_ms", ctx.total_ms }, { "encode_ms", ctx.encode_ms }, { "process_ms", ctx.process_ms }, { "hydrate_ms", ctx.hydrate_ms }, { "top_operation_ms", std::move (top_ops) }, - { "behavior", PublicBehaviorJson (ctx) }, + { "behavior", PublicBehaviorJson (ctx, bounded_behavior) }, }; + if (HasEnvValue ("CORTEXT_PROFILE_WORK_COUNTERS")) + row["work_counters"] = WorkCountersJson (ctx); if (full_operation_ms) { nlohmann::json operation_ms = nlohmann::json::object (); @@ -1591,6 +1728,38 @@ SqlCount (const fs::path &db_path, const std::string &sql) return value; } +nlohmann::json +StoreCheckpoint (const fs::path &db_path, std::size_t event_end) +{ + return { + { "event_end", event_end }, + { "counts", + { + { "memories", SqlCount (db_path, "SELECT COUNT(*) FROM memories") }, + { "signals", SqlCount (db_path, "SELECT COUNT(*) FROM signals") }, + { "associations", + SqlCount (db_path, "SELECT COUNT(*) FROM associations") }, + // Read vec0's ordinary shadow tables so this separate read-only + // connection does not need to load the extension outside the timed + // engine connection. + { "embeddings", + SqlCount (db_path, "SELECT COUNT(*) FROM embeddings_rowids") }, + { "current_memory_embeddings", + SqlCount (db_path, + "SELECT COUNT(*) FROM " + "current_memory_embeddings_rowids") }, + { "memory_reconstructions", + SqlCount (db_path, "SELECT COUNT(*) FROM memory_reconstructions") }, + { "rif_recovery_clock", + SqlCount (db_path, "SELECT COUNT(*) FROM rif_recovery_clock") }, + { "rif_generation_resets", + SqlCount (db_path, "SELECT COUNT(*) FROM rif_generation_resets") }, + { "rif_active_state", + SqlCount (db_path, "SELECT COUNT(*) FROM rif_active_state") }, + } }, + }; +} + int ProbeStreamRows (const fs::path &path) { @@ -1640,12 +1809,26 @@ ParseArgs (int argc, char **argv) cfg.input_dir = require_value (); else if (arg == "--transcript") cfg.transcript = require_value (); + else if (arg == "--packet-corpus") + cfg.packet_corpus = require_value (); + else if (arg == "--message-corpus") + cfg.message_corpus = require_value (); + else if (arg == "--shadow-embedding-corpus") + cfg.shadow_embedding_corpus = require_value (); else if (arg == "--db") cfg.db_path = require_value (); else if (arg == "--out") cfg.output_path = require_value (); else if (arg == "--max-messages") cfg.max_messages = std::stoi (require_value ()); + else if (arg == "--max-packets") + cfg.max_packets = std::stoi (require_value ()); + else if (arg == "--shadow-queries") + cfg.shadow_queries = std::stoi (require_value ()); + else if (arg == "--shadow-result-k") + cfg.shadow_result_k = std::stoi (require_value ()); + else if (arg == "--skip-packets") + cfg.skip_packets = std::stoi (require_value ()); else if (arg == "--skip-messages") cfg.skip_messages = std::stoi (require_value ()); else if (arg == "--media-limit") @@ -1713,10 +1896,33 @@ ParseArgs (int argc, char **argv) cfg.checkpoint_queries_per_day = std::stoi (require_value ()); else if (arg == "--progress-stride") cfg.progress_stride = std::stoi (require_value ()); + else if (arg == "--fixed-timestamp-base-ms") + cfg.fixed_timestamp_base_ms + = static_cast (std::stoull (require_value ())); + else if (arg == "--fixed-timestamp-step-ms") + cfg.fixed_timestamp_step_ms + = static_cast (std::stoull (require_value ())); else if (arg == "--full-operation-ms") cfg.full_operation_ms = true; else if (arg == "--behavior-oracle") cfg.behavior_oracle = true; + else if (arg == "--honor-required-consolidation") + cfg.honor_required_consolidation = true; + else if (arg == "--no-profile-rows") + cfg.no_profile_rows = true; + else if (arg == "--reuse-db") + cfg.reuse_db = true; + else if (arg == "--retention") + { + const std::string value = Lower (require_value ()); + if (value == "natural") + cfg.retention = cortext::Retention::Natural; + else if (value == "durable") + cfg.retention = cortext::Retention::Durable; + else + throw std::runtime_error ( + "--retention must be natural or durable"); + } else if (arg == "--sqlite-profile") cfg.sqlite_profile = require_value (); else @@ -1725,6 +1931,862 @@ ParseArgs (int argc, char **argv) return cfg; } +std::vector +ReadPacketCorpus (const fs::path &path, int skip_packets, int max_packets) +{ + std::ifstream stream (path); + if (!stream) + throw std::runtime_error ("failed to open packet corpus: " + + path.string ()); + std::vector packets; + std::string line; + int observed = 0; + while (std::getline (stream, line)) + { + line = Trim (line); + if (line.empty ()) + continue; + if (observed++ < skip_packets) + continue; + packets.push_back (std::move (line)); + if (max_packets >= 0 + && static_cast (packets.size ()) >= max_packets) + break; + } + return packets; +} + +std::vector +ReadMessageCorpus (const fs::path &path, int skip_messages, + int max_messages) +{ + std::ifstream stream (path); + if (!stream) + throw std::runtime_error ("failed to open message corpus: " + + path.string ()); + std::vector messages; + std::string line; + int observed = 0; + while (std::getline (stream, line)) + { + line = Trim (line); + if (line.empty ()) + continue; + const auto value = nlohmann::json::parse (line); + if (!value.is_string ()) + throw std::runtime_error ( + "message corpus rows must be JSON strings"); + if (observed++ < skip_messages) + continue; + messages.push_back (value.get ()); + if (max_messages >= 0 + && static_cast (messages.size ()) >= max_messages) + break; + } + return messages; +} + +struct ShadowEmbeddingCorpus +{ + std::vector ids; + std::vector + embeddings; +}; + +ShadowEmbeddingCorpus +ReadShadowEmbeddingCorpus (const fs::path &path) +{ + namespace shadow + = cortext::operations::bounded_activation_shadow_internal; + std::ifstream stream (path, std::ios::binary); + if (!stream) + throw std::runtime_error ("failed to open shadow embedding corpus: " + + path.string ()); + std::uint64_t count = 0; + std::uint32_t dimension = 0; + stream.read (reinterpret_cast (&count), sizeof (count)); + stream.read (reinterpret_cast (&dimension), sizeof (dimension)); + if (!stream || count == 0 || dimension == 0 + || dimension > shadow::kMaximumEmbeddingDimension) + throw std::runtime_error ("invalid shadow embedding corpus header"); + ShadowEmbeddingCorpus corpus; + corpus.ids.resize (static_cast (count)); + corpus.embeddings.resize (static_cast (count)); + std::vector values (dimension, 0.0F); + for (std::size_t index = 0; index < corpus.embeddings.size (); ++index) + { + stream.read (reinterpret_cast (&corpus.ids[index]), + sizeof (long long)); + stream.read (reinterpret_cast (values.data ()), + static_cast (values.size () + * sizeof (float))); + if (!stream) + throw std::runtime_error ( + "truncated shadow embedding corpus at record " + + std::to_string (index)); + Eigen::Map mapped ( + values.data (), static_cast (values.size ())); + if (!shadow::Normalize (mapped, corpus.embeddings[index])) + throw std::runtime_error ( + "invalid embedding in shadow corpus at record " + + std::to_string (index)); + } + char trailing = 0; + if (stream.read (&trailing, 1)) + throw std::runtime_error ("shadow embedding corpus has trailing bytes"); + return corpus; +} + +struct ShadowQualityAccumulator +{ + std::uint64_t count = 0; + double exact_id_recall = 0.0; + double duplicate_equivalent_recall = 0.0; + double top1_exact_id = 0.0; + double top1_duplicate_equivalent = 0.0; + double best_cosine_similarity = 0.0; + double best_cosine_regret = 0.0; + double semantic_coverage = 0.0; + double hit_similarity_0_99 = 0.0; + double hit_similarity_0_95 = 0.0; + double comparisons = 0.0; + double candidate_count = 0.0; + std::uint64_t max_comparisons = 0; + std::array retrieved_age_counts {}; +}; + +nlohmann::json +FinalShadowQuality (const ShadowQualityAccumulator &value) +{ + const double denominator = std::max (1, value.count); + const auto age_total = std::accumulate ( + value.retrieved_age_counts.begin (), value.retrieved_age_counts.end (), + std::uint64_t { 0 }); + nlohmann::json age = nlohmann::json::array (); + for (const auto count : value.retrieved_age_counts) + age.push_back (static_cast (count) + / std::max (1, age_total)); + return { + { "count", value.count }, + { "mean_exact_id_recall_at_k", value.exact_id_recall / denominator }, + { "mean_duplicate_equivalent_recall_at_k", + value.duplicate_equivalent_recall / denominator }, + { "mean_top1_exact_id", value.top1_exact_id / denominator }, + { "mean_top1_duplicate_equivalent", + value.top1_duplicate_equivalent / denominator }, + { "mean_best_cosine_similarity", + value.best_cosine_similarity / denominator }, + { "mean_best_cosine_regret", value.best_cosine_regret / denominator }, + { "mean_exact_neighbor_semantic_coverage", + value.semantic_coverage / denominator }, + { "mean_hit_similarity_0_99", + value.hit_similarity_0_99 / denominator }, + { "mean_hit_similarity_0_95", + value.hit_similarity_0_95 / denominator }, + { "mean_comparisons", value.comparisons / denominator }, + { "max_comparisons", value.max_comparisons }, + { "mean_candidate_count", value.candidate_count / denominator }, + { "retrieved_age_quartile_fraction", std::move (age) }, + }; +} + +nlohmann::json +ShadowWorkQuartiles (const std::vector &values) +{ + nlohmann::json result = nlohmann::json::array (); + for (std::size_t quartile = 0; quartile < 4; ++quartile) + { + const std::size_t begin = values.size () * quartile / 4; + const std::size_t end = values.size () * (quartile + 1) / 4; + std::uint64_t maximum = 0; + long double sum = 0.0; + for (std::size_t index = begin; index < end; ++index) + { + maximum = std::max (maximum, values[index]); + sum += values[index]; + } + result.push_back ( + { { "count", end - begin }, + { "mean", end > begin + ? static_cast (sum / (end - begin)) + : 0.0 }, + { "max", maximum } }); + } + return result; +} + +int +RunShadowEmbeddingQuality (const Config &cfg) +{ + namespace shadow + = cortext::operations::bounded_activation_shadow_internal; + if (cfg.shadow_queries <= 0 || cfg.shadow_result_k <= 0) + throw std::runtime_error ( + "shadow query count and result k must be positive"); + const auto corpus = ReadShadowEmbeddingCorpus ( + cfg.shadow_embedding_corpus); + const auto parameters + = shadow::DeriveParameters (cfg.focus, cfg.sensitivity, cfg.stability); + shadow::State state (parameters); + state.available = true; + std::vector normal_work; + std::vector consolidation_work; + normal_work.reserve (corpus.embeddings.size ()); + consolidation_work.reserve ( + corpus.embeddings.size () / parameters.consolidation_interval + 1); + const auto build_started = std::chrono::steady_clock::now (); + for (std::size_t index = 0; index < corpus.embeddings.size (); ++index) + { + const auto comparisons = shadow::Ingest ( + state, corpus.embeddings[index], index, index + 1); + normal_work.push_back (comparisons); + if ((index + 1) % parameters.consolidation_interval == 0) + consolidation_work.push_back (shadow::Consolidate (state)); + if (state.disabled) + throw std::runtime_error ( + std::string ("shadow disabled while building corpus: ") + + shadow::FailureName (state.failure)); + } + consolidation_work.push_back (shadow::Consolidate (state)); + const double build_seconds + = std::chrono::duration ( + std::chrono::steady_clock::now () - build_started) + .count (); + + struct RankedCandidate + { + float distance = 0.0F; + std::size_t index = 0; + }; + const auto rank_less = [&] (const RankedCandidate &left, + const RankedCandidate &right) { + return left.distance < right.distance + || (left.distance == right.distance + && corpus.ids[left.index] < corpus.ids[right.index]); + }; + const auto take_best = [&] (std::vector &ranked, + std::size_t count) { + count = std::min (count, ranked.size ()); + if (count < ranked.size ()) + std::nth_element (ranked.begin (), ranked.begin () + count, + ranked.end (), rank_less); + ranked.resize (count); + std::sort (ranked.begin (), ranked.end (), rank_less); + }; + + ShadowQualityAccumulator all; + ShadowQualityAccumulator duplicates; + ShadowQualityAccumulator nonduplicates; + std::array query_age; + const auto evaluation_started = std::chrono::steady_clock::now (); + for (int query_number = 0; query_number < cfg.shadow_queries; + ++query_number) + { + const std::size_t query_index + = cfg.shadow_queries == 1 + ? 0 + : static_cast ( + static_cast (query_number) + * (corpus.embeddings.size () - 1) + / (cfg.shadow_queries - 1)); + std::vector exact; + exact.reserve (corpus.embeddings.size () - 1); + for (std::size_t index = 0; index < corpus.embeddings.size (); ++index) + if (index != query_index) + exact.push_back ( + { shadow::SquaredDistance (corpus.embeddings[query_index], + corpus.embeddings[index]), + index }); + take_best (exact, static_cast (cfg.shadow_result_k)); + + shadow::PreparedObservation prepared; + const auto route_comparisons + = shadow::Route (state, corpus.embeddings[query_index], prepared); + std::vector candidates; + candidates.reserve (prepared.candidate_count); + for (std::size_t candidate = 0; + candidate < prepared.candidate_count; ++candidate) + { + const auto index = static_cast ( + prepared.candidate_identities[candidate]); + if (index >= corpus.embeddings.size () || index == query_index) + continue; + candidates.push_back ( + { shadow::SquaredDistance (corpus.embeddings[query_index], + corpus.embeddings[index]), + index }); + } + const std::size_t candidate_count = candidates.size (); + take_best (candidates, + static_cast (cfg.shadow_result_k)); + if (exact.empty () || candidates.empty ()) + throw std::runtime_error ("shadow quality query returned no result"); + + double exact_hits = 0.0; + for (const auto &expected : exact) + if (std::any_of ( + candidates.begin (), candidates.end (), + [&] (const RankedCandidate &candidate) { + return candidate.index == expected.index; + })) + exact_hits += 1.0; + double equivalent_hits = 0.0; + double semantic_coverage = 0.0; + for (const auto &expected : exact) + { + float nearest = std::numeric_limits::infinity (); + for (const auto &candidate : candidates) + nearest = std::min ( + nearest, + shadow::SquaredDistance (corpus.embeddings[expected.index], + corpus.embeddings[candidate.index])); + equivalent_hits += nearest <= 1.0e-6F ? 1.0 : 0.0; + semantic_coverage += 1.0 - nearest / 2.0; + } + const double exact_best_similarity = 1.0 - exact.front ().distance / 2.0; + const double best_similarity = 1.0 - candidates.front ().distance / 2.0; + const bool duplicate_query = exact.front ().distance <= 1.0e-6F; + + auto add = [&] (ShadowQualityAccumulator &accumulator) { + ++accumulator.count; + accumulator.exact_id_recall + += exact_hits / static_cast (cfg.shadow_result_k); + accumulator.duplicate_equivalent_recall + += equivalent_hits / exact.size (); + accumulator.top1_exact_id + += candidates.front ().index == exact.front ().index ? 1.0 : 0.0; + accumulator.top1_duplicate_equivalent + += candidates.front ().distance + <= exact.front ().distance + 1.0e-6F + ? 1.0 + : 0.0; + accumulator.best_cosine_similarity += best_similarity; + accumulator.best_cosine_regret + += std::max (0.0, exact_best_similarity - best_similarity); + accumulator.semantic_coverage + += semantic_coverage / exact.size (); + accumulator.hit_similarity_0_99 + += best_similarity >= 0.99 ? 1.0 : 0.0; + accumulator.hit_similarity_0_95 + += best_similarity >= 0.95 ? 1.0 : 0.0; + accumulator.comparisons += route_comparisons; + accumulator.max_comparisons + = std::max (accumulator.max_comparisons, route_comparisons); + accumulator.candidate_count += candidate_count; + for (const auto &candidate : candidates) + { + const auto quartile = std::min ( + 3, candidate.index * 4 / corpus.embeddings.size ()); + ++accumulator.retrieved_age_counts[quartile]; + } + }; + add (all); + add (duplicate_query ? duplicates : nonduplicates); + add (query_age[std::min ( + 3, query_index * 4 / corpus.embeddings.size ())]); + } + const double evaluation_seconds + = std::chrono::duration ( + std::chrono::steady_clock::now () - evaluation_started) + .count (); + + nlohmann::json age_quality = nlohmann::json::array (); + for (const auto &quartile : query_age) + age_quality.push_back (FinalShadowQuality (quartile)); + const auto normal_max + = *std::max_element (normal_work.begin (), normal_work.end ()); + const auto consolidation_max = *std::max_element ( + consolidation_work.begin (), consolidation_work.end ()); + const auto normal_sum = std::accumulate ( + normal_work.begin (), normal_work.end (), static_cast (0)); + const auto consolidation_sum = std::accumulate ( + consolidation_work.begin (), consolidation_work.end (), + static_cast (0)); + nlohmann::json restart_measurements = nlohmann::json::array (); + for (const double fraction : { 0.25, 0.5, 1.0 }) + { + const std::size_t row_count = std::max ( + 1, static_cast ( + corpus.embeddings.size () * fraction)); + auto restart_store = std::shared_ptr ( + cortext::SQLiteStore::Create (":memory:")); + restart_store->Execute ( + "CREATE TABLE embeddings(embedding_id INTEGER PRIMARY KEY, " + "embedding BLOB NOT NULL)"); + restart_store->Execute ( + "CREATE TABLE signals(signal_id INTEGER PRIMARY KEY, " + "embedding_id INTEGER NOT NULL, timestamp INTEGER NOT NULL)"); + auto seed = restart_store->Begin (); + std::vector embedding ( + corpus.embeddings.front ().dimension, 0.0F); + for (std::size_t index = 0; index < row_count; ++index) + { + std::copy_n (corpus.embeddings[index].values.begin (), + embedding.size (), embedding.begin ()); + const auto id = static_cast (index + 1); + seed->Execute ( + "INSERT INTO embeddings(embedding_id, embedding) VALUES(?, ?)", + { id, embedding }); + seed->Execute ( + "INSERT INTO signals(signal_id, embedding_id, timestamp) " + "VALUES(?, ?, ?)", + { id, id, id }); + } + seed->Commit (); + shadow::State rebuilt (parameters); + shadow::RebuildFromPersistentAuthority (rebuilt, *restart_store); + if (rebuilt.disabled || rebuilt.metrics.restart_rows_visited != row_count) + throw std::runtime_error ( + "shadow SQLite restart measurement failed at fraction " + + std::to_string (fraction)); + restart_measurements.push_back ( + { { "fraction", fraction }, + { "retained_rows", row_count }, + { "rows_visited", rebuilt.metrics.restart_rows_visited }, + { "rebuild_ms", rebuilt.metrics.restart_rebuild_ms }, + { "linear_history", + rebuilt.metrics.restart_rebuild_linear_history }, + { "restart_production_gate", + rebuilt.metrics.restart_production_gate } }); + } + nlohmann::json out { + { "schema", "cortext_bounded_activation_shadow_quality_v1" }, + { "observation_only", true }, + { "corpus", cfg.shadow_embedding_corpus.string () }, + { "embedding_count", corpus.embeddings.size () }, + { "embedding_dimension", corpus.embeddings.front ().dimension }, + { "query_count", cfg.shadow_queries }, + { "result_k", cfg.shadow_result_k }, + { "focus", cfg.focus }, + { "sensitivity", cfg.sensitivity }, + { "stability", cfg.stability }, + { "build_seconds", build_seconds }, + { "evaluation_seconds", evaluation_seconds }, + { "root_count", state.root_count }, + { "leaf_count", state.leaf_count }, + { "allocated_bytes", state.allocated_bytes }, + { "state_digest", shadow::StateDigest (state) }, + { "fixed_embedding_slots", parameters.fixed_embedding_slots }, + { "fixed_neighbor_slots", parameters.fixed_neighbor_slots }, + { "normal_comparison_bound", parameters.normal_comparison_bound }, + { "normal_comparison_mean", + static_cast (normal_sum / normal_work.size ()) }, + { "normal_comparison_max", normal_max }, + { "normal_comparison_quartiles", ShadowWorkQuartiles (normal_work) }, + { "recall_comparison_bound", parameters.recall_comparison_bound }, + { "consolidation_comparison_bound", + parameters.consolidation_comparison_bound }, + { "consolidation_comparison_mean", + static_cast (consolidation_sum / consolidation_work.size ()) }, + { "consolidation_comparison_max", consolidation_max }, + { "consolidation_comparison_quartiles", + ShadowWorkQuartiles (consolidation_work) }, + { "amortized_consolidation_comparisons_per_observation", + static_cast (consolidation_sum / normal_work.size ()) }, + { "quality", + { { "all", FinalShadowQuality (all) }, + { "duplicate_queries", FinalShadowQuality (duplicates) }, + { "nonduplicate_queries", FinalShadowQuality (nonduplicates) } } }, + { "query_age_quartiles", std::move (age_quality) }, + { "sqlite_restart_measurements", std::move (restart_measurements) }, + }; + WriteJsonArtifact (cfg.output_path, out); + std::cout << DumpJsonArtifact (out) << "\n"; + return 0; +} + +int +RunPacketCorpusProfile (const Config &cfg, + const nlohmann::json &sqlite_profile) +{ + if (!cfg.packet_corpus.empty () && !cfg.message_corpus.empty ()) + throw std::runtime_error ( + "--packet-corpus and --message-corpus are mutually exclusive"); + if ((cfg.fixed_timestamp_base_ms == 0) + != (cfg.fixed_timestamp_step_ms == 0)) + throw std::runtime_error ( + "fixed timestamp base and step must be provided together"); + if (!cfg.db_path.parent_path ().empty ()) + fs::create_directories (cfg.db_path.parent_path ()); + if (!cfg.output_path.parent_path ().empty ()) + fs::create_directories (cfg.output_path.parent_path ()); + if (!cfg.reuse_db) + { + fs::remove (cfg.db_path); + fs::remove (cfg.db_path.string () + "-wal"); + fs::remove (cfg.db_path.string () + "-shm"); + } + + const bool message_mode = !cfg.message_corpus.empty (); + const fs::path corpus_path + = message_mode ? cfg.message_corpus : cfg.packet_corpus; + const auto packets = message_mode + ? ReadMessageCorpus ( + corpus_path, cfg.skip_messages, + cfg.max_messages) + : ReadPacketCorpus ( + corpus_path, cfg.skip_packets, + cfg.max_packets); + if (packets.empty ()) + throw std::runtime_error ("corpus contains no events"); + + SetEnvValue ("CORTEXT_PROFILE_WORK_COUNTERS", "1", true); + SetEnvValue ("CORTEXT_PROFILE_CONSOLIDATION_EPOCH", "1", true); + SetEnvValue ("CORTEXT_PROFILE_EMOTIONAL_CASCADE", "1", true); + SetEnvValue ("CORTEXT_PROFILE_GRAPH_RETRIEVAL", "1", false); + + cortext::Cortext::Config cortext_cfg; + cortext_cfg.focus = cfg.focus; + cortext_cfg.sensitivity = cfg.sensitivity; + cortext_cfg.stability = cfg.stability; + std::shared_ptr replay_clock; + if (cfg.fixed_timestamp_base_ms > 0) + replay_clock = std::make_shared ( + cfg.fixed_timestamp_base_ms); + auto engine = cortext::Cortext::Create ( + cortext_cfg, cfg.db_path.string (), std::move (replay_clock)); + + constexpr std::array kSelectedOperations { + "cortext::operations::GraphAugmentedRetrieveCandidates", + "GraphRetrieve.total", + "GraphRetrieve.family_index", + "GraphRetrieve.seed_cache_family_compare", + "GraphRetrieve.seed_cache_distance", + "GraphRetrieve.seed_knn_cache", + "GraphRetrieve.seed_processor_surface", + "GraphRetrieve.seed_knn_cache_rebuild", + "GraphRetrieve.seed_knn_sql", + "GraphRetrieve.seed_rank", + "GraphRetrieve.association_expansion", + "GraphRetrieve.rank_candidates", + "GraphRetrieve.reconstruction_versions", + "cortext::operations::ApplyRetrievalCompetition", + "Competition.rif_recovery_active_sql", + "Competition.score_candidates", + "Predictive.decay_active_sql", + "cortext::operations::MemoryStorage", + "MemoryStorage.supersession_edges", + "MemoryStorage.supersession_candidate_load", + "MemoryStorage.supersession_current_candidate_execution_count", + "MemoryStorage.supersession_historical_candidate_execution_count", + "MemoryStorage.supersession_current_rows_visited", + "MemoryStorage.supersession_historical_rows_visited", + "MemoryStorage.supersession_sql_fallback_count", + "cortext::operations::PropagateEmotionalCascade", + "EmotionalCascade.source_execution_count", + "EmotionalCascade.neighbor_execution_count", + "EmotionalCascade.update_execution_count", + "SignalProcessor.snapshot_context", + "SignalProcessor.snapshot_full_cache_copy", + "SignalProcessor.snapshot_cache_entry_copy", + "SignalProcessor.commit_transaction", + "SignalProcessor.retrieval_suppression_id_count", + "SignalProcessor.predictive_id_count", + "SignalProcessor.snapshot_full_cache_copy_count", + "SignalProcessor.snapshot_cache_entry_copy_count", + "GraphRetrieve.candidate_count", + "GraphRetrieve.family_exact_comparison_count", + "GraphRetrieve.cache_rebuild_count", + "GraphRetrieve.rows_visited", + "Competition.candidate_count", + "Competition.rows_visited", + "Competition.rows_touched", + "MemoryStorage.supersession_current_candidate_count", + "MemoryStorage.supersession_historical_candidate_count", + "EmotionalCascade.source_count", + "EmotionalCascade.neighbor_count", + "EmotionalCascade.update_count", + }; + + nlohmann::json rows = nlohmann::json::array (); + nlohmann::json consolidation_events = nlohmann::json::array (); + nlohmann::json store_checkpoints = nlohmann::json::array (); + const std::size_t checkpoint_stride = message_mode ? 100U : 500U; + const std::size_t leading_checkpoint + = packets.size () % checkpoint_stride; + if (leading_checkpoint == 0) + store_checkpoints.push_back (StoreCheckpoint (cfg.db_path, 0)); + double process_ms_total = 0.0; + double total_ms_total = 0.0; + double consolidation_ms_total = 0.0; + int consolidation_runs = 0; + const auto wall_start = std::chrono::steady_clock::now (); + for (std::size_t index = 0; index < packets.size (); ++index) + { + const auto event_started = std::chrono::steady_clock::now (); + const std::uint64_t timestamp + = cfg.fixed_timestamp_base_ms > 0 + ? cfg.fixed_timestamp_base_ms + + static_cast (cfg.skip_packets) + * cfg.fixed_timestamp_step_ms + + index * cfg.fixed_timestamp_step_ms + : static_cast ( + std::chrono::duration_cast ( + std::chrono::system_clock::now ().time_since_epoch ()) + .count ()); + EventDoc doc { + static_cast (index), timestamp, "profile/corpus", "text", + packets[index], + }; + auto ctx = cfg.fixed_timestamp_base_ms > 0 + ? engine->ProcessTextAt (packets[index], doc.source_id, + timestamp, cfg.retention) + : engine->ProcessText (packets[index], doc.source_id, + cfg.retention); + process_ms_total += ctx.process_ms; + total_ms_total += ctx.total_ms; + double event_consolidation_ms = 0.0; + std::optional consolidation_event; + + if (cfg.honor_required_consolidation + && ctx.consolidation_state == cortext::ConsolidationState::Required) + { + const auto consolidation_start = std::chrono::steady_clock::now (); + auto consolidation_ctx = engine->Consolidate (); + const double consolidation_ms = std::chrono::duration< + double, std::milli> ( + std::chrono::steady_clock::now () - consolidation_start) + .count (); + consolidation_ms_total += consolidation_ms; + event_consolidation_ms = consolidation_ms; + ++consolidation_runs; + consolidation_event = { + { "event_index", index }, + { "closing_event_index", index }, + { "consolidation_epoch_id", + RequiredOperationCounter ( + consolidation_ctx, + "ConsolidationEpoch.closed_epoch_id") }, + { "sealed_epoch_event_count", + RequiredOperationCounter ( + consolidation_ctx, + "ConsolidationEpoch.sealed_epoch_event_count") }, + { "sealed_epoch_mutation_count", + RequiredOperationCounter ( + consolidation_ctx, + "ConsolidationEpoch.sealed_epoch_mutation_count") }, + { "sealed_mutation_identity_verified", + RequiredOperationCounter ( + consolidation_ctx, + "ConsolidationEpoch.sealed_mutation_identity_verified") + == 1 }, + { "sealed_mutation_identity_count", + RequiredOperationCounter ( + consolidation_ctx, + "ConsolidationEpoch.sealed_mutation_identity_count") }, + { "duration_ms", consolidation_ms }, + { "pre_reset_counters", + ConsolidationEpochCountersJson ( + consolidation_ctx, "ConsolidationEpoch.pre") }, + { "post_reset_counters", + ConsolidationEpochCountersJson ( + consolidation_ctx, "ConsolidationEpoch.post") }, + { "post_reset_active_epoch", + ActiveEpochCountersJson (consolidation_ctx) }, + { "state_after", + ConsolidationStateName ( + consolidation_ctx.consolidation_state) }, + }; + consolidation_events.push_back (*consolidation_event); + } + const auto event_ended = std::chrono::steady_clock::now (); + if (!cfg.no_profile_rows) + { + auto row = WorkingSetCurveRow ( + static_cast (index), doc, ctx, true, true); + row["retention"] = cfg.retention == cortext::Retention::Natural + ? "natural" + : "durable"; + row["consolidation_ms"] = event_consolidation_ms; + row["consolidation_epoch_id"] = RequiredOperationCounter ( + ctx, "ConsolidationEpoch.epoch_id"); + row["events_since_epoch_start"] = RequiredOperationCounter ( + ctx, "ConsolidationEpoch.events_since_epoch_start"); + row["consolidation_after_event"] + = consolidation_event.has_value (); + row["consolidation_epoch_counters"] + = ConsolidationEpochCountersJson ( + ctx, "ConsolidationEpoch"); + row["active_epoch"] = ActiveEpochCountersJson (ctx); + const auto shadow_work + = cortext::operations::bounded_activation_shadow_internal:: + SingleWorkSnapshot (); + if (shadow_work) + row["bounded_activation_shadow_work"] = { + { "available", shadow_work->available }, + { "disabled", shadow_work->disabled }, + { "failure", + cortext::operations::bounded_activation_shadow_internal:: + FailureName (shadow_work->failure) }, + { "generation", shadow_work->generation }, + { "event_index", shadow_work->event_index }, + { "root_count", shadow_work->root_count }, + { "leaf_count", shadow_work->leaf_count }, + { "normal_comparisons", + shadow_work->metrics.normal_comparisons }, + { "recall_comparisons", + shadow_work->metrics.recall_comparisons }, + { "consolidation_comparisons", + shadow_work->metrics.consolidation_comparisons }, + { "consolidation_count", + shadow_work->metrics.consolidation_count }, + { "allocation_after_initialization_count", + shadow_work->metrics.allocation_after_initialization_count }, + }; + row["durable_barrier_ms"] + = ctx.output.operation_ms.count ( + "SignalProcessor.sqlite_wal_checkpoint") + ? ctx.output.operation_ms.at ( + "SignalProcessor.sqlite_wal_checkpoint") + : 0.0; + row["end_to_end_ms"] = std::chrono::duration ( + event_ended - event_started) + .count (); + for (const char *operation : kSelectedOperations) + { + if (!row["operation_ms"].contains (operation)) + row["operation_ms"][operation] = 0.0; + } + rows.push_back (std::move (row)); + const std::size_t event_end = index + 1; + if (event_end >= leading_checkpoint + && (event_end - leading_checkpoint) % checkpoint_stride == 0) + store_checkpoints.push_back ( + StoreCheckpoint (cfg.db_path, event_end)); + } + if (cfg.progress_stride > 0 + && (index + 1) % static_cast (cfg.progress_stride) == 0) + std::cerr << "packet profile " << (index + 1) << "/" + << packets.size () << "\n"; + } + const auto wall_end = std::chrono::steady_clock::now (); + const auto wall_ms = std::chrono::duration_cast ( + wall_end - wall_start).count (); + + nlohmann::json out; + out["schema"] = "cortext_packet_storage_profile_v2"; + out["consolidation_epoch_schema"] + = "post-process-pre-consolidation rows with adjacent successful close records"; + out["consolidation_epoch_relational_contract_sha256"] + = "13806d20db179c8cf2dd0c7990f6355b6513c255bdf53df3b2c1082c636f0e4b"; + out["corpus"] = corpus_path.string (); + out["corpus_unit"] = message_mode ? "whole_message" : "sentence_packet"; + out["retention"] = cfg.retention == cortext::Retention::Natural + ? "natural" + : "durable"; + out["processed_events"] = packets.size (); + out["focus"] = cfg.focus; + out["sensitivity"] = cfg.sensitivity; + out["stability"] = cfg.stability; + out["sqlite_profile"] = sqlite_profile; + out["full_operation_ms"] = true; + out["behavior_oracle"] = true; + out["profile_rows_enabled"] = !cfg.no_profile_rows; + out["honor_required_consolidation"] + = cfg.honor_required_consolidation; + out["active_epoch_limits"] = { + { "event_count", 512 }, + { "mutation_count", 32768 }, + { "allocated_bytes", 64ULL * 1024ULL * 1024ULL }, + }; + out["fixed_timestamp_base_ms"] = cfg.fixed_timestamp_base_ms; + out["fixed_timestamp_step_ms"] = cfg.fixed_timestamp_step_ms; + out["mean_process_ms"] = process_ms_total / packets.size (); + out["mean_total_ms"] = total_ms_total / packets.size (); + out["wall_ms"] = wall_ms; + out["consolidation_runs"] = consolidation_runs; + out["consolidation_ms"] = consolidation_ms_total; + out["consolidation_events"] = std::move (consolidation_events); + out["profile_window_size"] = checkpoint_stride; + out["store_checkpoint_policy"] + = "end-anchored complete-window boundaries captured outside per-event timing"; + out["store_checkpoints"] = std::move (store_checkpoints); + out["peak_rss_mb"] = PeakRssMb (); + const auto shadow_snapshots + = cortext::operations::bounded_activation_shadow_internal::Snapshots (); + if (!shadow_snapshots.empty ()) + { + const auto &shadow = shadow_snapshots.back (); + const auto ¶meters = shadow.parameters; + const auto &metrics = shadow.metrics; + out["bounded_activation_shadow"] = { + { "schema", "cortext_bounded_activation_shadow_runtime_v1" }, + { "observation_only", true }, + { "canonical_sqlite_authoritative", true }, + { "available", shadow.available }, + { "disabled", shadow.disabled }, + { "failure", + cortext::operations::bounded_activation_shadow_internal::FailureName ( + shadow.failure) }, + { "restart_rebuild_required", shadow.restart_rebuild_required }, + { "generation", shadow.generation }, + { "event_index", shadow.event_index }, + { "root_count", shadow.root_count }, + { "leaf_count", shadow.leaf_count }, + { "allocated_bytes", shadow.allocated_bytes }, + { "state_digest", shadow.state_digest }, + { "parameters", + { { "roots", parameters.roots }, + { "leaf_capacity", parameters.leaf_capacity }, + { "children_per_root", parameters.children_per_root }, + { "root_beam", parameters.root_beam }, + { "leaf_beam", parameters.leaf_beam }, + { "representatives_per_leaf", + parameters.representatives_per_leaf }, + { "neighbor_degree", parameters.neighbor_degree }, + { "activated_leaves_per_consolidation", + parameters.activated_leaves_per_consolidation }, + { "consolidation_interval", + parameters.consolidation_interval }, + { "centroid_alpha", parameters.centroid_alpha }, + { "root_creation_squared_distance", + parameters.root_creation_squared_distance }, + { "leaf_creation_squared_distance", + parameters.leaf_creation_squared_distance }, + { "fixed_embedding_slots", parameters.fixed_embedding_slots }, + { "fixed_neighbor_slots", parameters.fixed_neighbor_slots }, + { "normal_comparison_bound", + parameters.normal_comparison_bound }, + { "recall_comparison_bound", + parameters.recall_comparison_bound }, + { "consolidation_comparison_bound", + parameters.consolidation_comparison_bound } } }, + { "metrics", + { { "normal_comparisons", metrics.normal_comparisons }, + { "normal_comparisons_max", metrics.normal_comparisons_max }, + { "recall_comparisons", metrics.recall_comparisons }, + { "recall_comparisons_max", metrics.recall_comparisons_max }, + { "consolidation_comparisons", + metrics.consolidation_comparisons }, + { "consolidation_comparisons_max", + metrics.consolidation_comparisons_max }, + { "consolidation_count", metrics.consolidation_count }, + { "representative_replacements", + metrics.representative_replacements }, + { "allocation_after_initialization_count", + metrics.allocation_after_initialization_count }, + { "restart_rows_visited", metrics.restart_rows_visited }, + { "restart_rebuild_ms", metrics.restart_rebuild_ms }, + { "restart_rebuild_linear_history", + metrics.restart_rebuild_linear_history }, + { "restart_production_gate", + metrics.restart_production_gate } } }, + }; + } + out["working_set_curve"] = std::move (rows); + WriteJsonArtifact (cfg.output_path, out); + std::cout << DumpJsonArtifact ( + { { "processed_events", packets.size () }, + { "retention", out["retention"] }, + { "wall_ms", wall_ms }, + { "consolidation_runs", consolidation_runs }, + { "output", cfg.output_path.string () }, + { "db", cfg.db_path.string () } }) + << "\n"; + return 0; +} + } // namespace int @@ -1734,8 +2796,12 @@ main (int argc, char **argv) { Config cfg = ParseArgs (argc, argv); ApplyReplayTimezone (cfg.replay_timezone); + if (!cfg.shadow_embedding_corpus.empty ()) + return RunShadowEmbeddingQuality (cfg); const nlohmann::json sqlite_profile = ApplySQLiteProfile (cfg.sqlite_profile); + if (!cfg.packet_corpus.empty () || !cfg.message_corpus.empty ()) + return RunPacketCorpusProfile (cfg, sqlite_profile); const fs::path transcript = chat_replay::DiscoverTranscript (cfg.input_dir, cfg.transcript); auto messages = ParseMessages (transcript); diff --git a/src/cortext.cpp b/src/cortext.cpp index a7f32271..79b834d7 100644 --- a/src/cortext.cpp +++ b/src/cortext.cpp @@ -1,4 +1,5 @@ #include "cortext/cortext.hpp" +#include "cortext_pipeline_internal.hpp" #include "cortext/clock.hpp" #include "cortext/core/algorithms.hpp" #include "cortext/core/knobs.hpp" @@ -983,7 +984,7 @@ HydrateWorkingMemoryFromDB (Store *store, ObjectStore *object_store, // Content blobs are loaded separately via LoadSignalBlobs auto rows = store->Execute ( "SELECT m.memory_id, m.source_id, m.modality, m.start_ts, " - " m.strength, m.last_access, m.n_signals, " + " rif.strength, m.last_access, m.n_signals, " " m.s_max, m.s_avg, m.s_arousal_avg, " " m.retrieved_count, m.used_count, m.blob_id, " " (SELECT mr.blob_id FROM memory_reconstructions mr " @@ -998,6 +999,7 @@ HydrateWorkingMemoryFromDB (Store *store, ObjectStore *object_store, " ORDER BY s.serial_position LIMIT 1)" " ) AS signal_mime " "FROM memories m " + "JOIN rif_effective_memories rif ON rif.memory_id = m.memory_id " "WHERE m.kind = 'WORKING' AND m.end_ts IS NULL " "ORDER BY m.start_ts ASC"); @@ -1248,13 +1250,15 @@ BuildRootOperationSet (bool probe_mode) if (probe_mode) { - return operations::signal_record_rollback_internal::MarkJournalAware ( - std::make_unique ()); + return operations::signal_record_rollback_internal:: + MarkEngineOwnedJournalAware ( + std::make_unique ()); } - return operations::signal_record_rollback_internal::MarkJournalAware ( - std::make_unique ( - std::make_unique (), - std::make_unique ())); + return operations::signal_record_rollback_internal:: + MarkEngineOwnedJournalAware ( + std::make_unique ( + std::make_unique (), + std::make_unique ())); } namespace diff --git a/src/cortext_pipeline_internal.hpp b/src/cortext_pipeline_internal.hpp new file mode 100644 index 00000000..2e7d8340 --- /dev/null +++ b/src/cortext_pipeline_internal.hpp @@ -0,0 +1,13 @@ +#pragma once + +#include "cortext/processor/operation.hpp" + +#include + +namespace cortext +{ + +/// @brief Build the private production operation graph. +std::unique_ptr BuildRootOperationSet (bool probe_mode); + +} // namespace cortext diff --git a/src/operations/association_fanout_cache_internal.hpp b/src/operations/association_fanout_cache_internal.hpp index ef18a8c1..2b2e22a3 100644 --- a/src/operations/association_fanout_cache_internal.hpp +++ b/src/operations/association_fanout_cache_internal.hpp @@ -3,6 +3,7 @@ #include "cortext/processor/processor_context.hpp" #include "cortext/store/store.hpp" #include "cortext/store/utils.hpp" +#include "execution_cache_sidecar_internal.hpp" #include #include #include @@ -110,7 +111,7 @@ UpsertFanoutEdge ( std::vector &edges, long long memory_id, long long embedding_id, const std::string &edge_type, double weight, long long last_reinforced, double *old_weight, - long long *old_last_reinforced) + long long *old_last_reinforced, long long *old_embedding_id) { for (auto &edge : edges) { @@ -124,6 +125,10 @@ UpsertFanoutEdge ( { *old_last_reinforced = edge.last_reinforced; } + if (old_embedding_id) + { + *old_embedding_id = edge.embedding_id; + } edge.embedding_id = embedding_id; edge.weight = weight; edge.last_reinforced = last_reinforced; @@ -138,7 +143,8 @@ UpsertFanoutEdge ( } inline void -UpsertAssociation (ProcessorContext::AssociationFanoutCache &cache, +UpsertAssociation (ProcessorContext &p_ctx, + ProcessorContext::AssociationFanoutCache &cache, long long source_memory_id, long long target_memory_id, long long source_embedding_id, long long target_embedding_id, const std::string &edge_type, double weight, @@ -149,17 +155,29 @@ UpsertAssociation (ProcessorContext::AssociationFanoutCache &cache, { return; } + if (edge_type == "supersedes") + execution_cache_sidecar_internal::Ensure (p_ctx) + ->supersession_eligibility.valid = false; double old_weight = 0.0; long long old_last_reinforced = 0; + long long old_target_embedding_id = 0; auto &out_edges = cache.out_by_source[source_memory_id]; const bool inserted = UpsertFanoutEdge ( out_edges, target_memory_id, target_embedding_id, edge_type, weight, - last_reinforced, &old_weight, &old_last_reinforced); + last_reinforced, &old_weight, &old_last_reinforced, + &old_target_embedding_id); auto &in_edges = cache.in_by_target[target_memory_id]; (void)UpsertFanoutEdge (in_edges, source_memory_id, source_embedding_id, edge_type, weight, last_reinforced, nullptr, - nullptr); + nullptr, nullptr); + + if (inserted || old_target_embedding_id != target_embedding_id) + { + auto state = execution_cache_sidecar_internal::Ensure (p_ctx); + state->association_topology_changes.inserted_edges.emplace_back ( + source_memory_id, target_memory_id); + } if (inserted) { @@ -181,6 +199,70 @@ UpsertAssociation (ProcessorContext::AssociationFanoutCache &cache, } } +inline void +BuildSupersessionEligibility ( + ProcessorContext::AssociationFanoutCache &cache, + const ProcessorContext &p_ctx) +{ + auto &eligibility = execution_cache_sidecar_internal::Ensure (p_ctx) + ->supersession_eligibility; + eligibility.activation_ts_by_target.clear (); + eligibility.activation_ts_by_target.reserve ( + cache.in_by_target.size ()); + for (const auto &[target_memory_id, edges] : cache.in_by_target) + { + std::optional activation_ts; + for (const auto &edge : edges) + { + if (edge.edge_type != "supersedes") + continue; + const auto surface_it + = p_ctx.retrieval_surface_index.find (edge.memory_id); + if (surface_it == p_ctx.retrieval_surface_index.end () + || surface_it->second >= p_ctx.retrieval_surface_cache.size ()) + continue; + const auto &replacement + = p_ctx.retrieval_surface_cache[surface_it->second]; + if (replacement.memory_id <= 0 || replacement.embedding_id <= 0 + || replacement.start_ts < 0 + || (replacement.kind != "LONG_TERM" + && replacement.kind != "ASSOCIATION")) + continue; + activation_ts = activation_ts + ? std::min (*activation_ts, + replacement.start_ts) + : replacement.start_ts; + } + if (activation_ts) + eligibility.activation_ts_by_target.emplace ( + target_memory_id, *activation_ts); + } + eligibility.valid = true; +} + +inline void +InvalidateSupersessionEligibility (const ProcessorContext &p_ctx) +{ + const auto state = execution_cache_sidecar_internal::Find (p_ctx); + if (state) + state->supersession_eligibility.valid = false; +} + +inline void +NotifyRetrievalSurfaceChanged (const ProcessorContext &p_ctx, + long long memory_id) +{ + const auto edges = p_ctx.association_fanout_cache.out_by_source.find ( + memory_id); + if (edges == p_ctx.association_fanout_cache.out_by_source.end ()) + return; + if (std::any_of (edges->second.begin (), edges->second.end (), + [] (const auto &edge) { + return edge.edge_type == "supersedes"; + })) + InvalidateSupersessionEligibility (p_ctx); +} + inline ProcessorContext::AssociationFanoutCache * Ensure (Store *store, ProcessorContext &p_ctx) { @@ -189,13 +271,19 @@ Ensure (Store *store, ProcessorContext &p_ctx) return nullptr; } auto &cache = p_ctx.association_fanout_cache; + const auto sidecar = execution_cache_sidecar_internal::Ensure (p_ctx); + auto &eligibility = sidecar->supersession_eligibility; if (cache.valid && cache.last_fingerprint_check_signal == p_ctx.signals_processed) { + if (!eligibility.valid) + BuildSupersessionEligibility (cache, p_ctx); return &cache; } if (cache.valid && cache.consolidation_count == p_ctx.consolidation_count) { + if (!eligibility.valid) + BuildSupersessionEligibility (cache, p_ctx); return &cache; } @@ -204,6 +292,8 @@ Ensure (Store *store, ProcessorContext &p_ctx) { cache.last_fingerprint_check_signal = p_ctx.signals_processed; cache.consolidation_count = p_ctx.consolidation_count; + if (!eligibility.valid) + BuildSupersessionEligibility (cache, p_ctx); return &cache; } @@ -212,6 +302,12 @@ Ensure (Store *store, ProcessorContext &p_ctx) cache.consolidation_count = p_ctx.consolidation_count; cache.out_by_source.clear (); cache.in_by_target.clear (); + eligibility.valid = false; + eligibility.activation_ts_by_target.clear (); + auto &topology_changes = sidecar->association_topology_changes; + topology_changes.reset = true; + topology_changes.inserted_edges.clear (); + sidecar->emotional_cascade_topology_footprint.valid = false; auto rows = store->Execute ( "SELECT a.source_memory_id, a.target_memory_id, a.edge_type, " @@ -267,6 +363,7 @@ Ensure (Store *store, ProcessorContext &p_ctx) cache.weight_sum_micros = fingerprint.weight_sum_micros; cache.last_reinforced_sum = fingerprint.last_reinforced_sum; cache.valid = true; + BuildSupersessionEligibility (cache, p_ctx); return &cache; } diff --git a/src/operations/bounded_activation_shadow_internal.hpp b/src/operations/bounded_activation_shadow_internal.hpp new file mode 100644 index 00000000..045856ac --- /dev/null +++ b/src/operations/bounded_activation_shadow_internal.hpp @@ -0,0 +1,1625 @@ +#pragma once + +#include "cortext/signal.hpp" +#include "cortext/processor/processor_context.hpp" +#include "cortext/store/store.hpp" +#include "cortext/store/utils.hpp" +#include "../experimental_env.hpp" + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace cortext::operations::bounded_activation_shadow_internal +{ + +constexpr std::size_t kMaximumEmbeddingDimension = 256; +constexpr std::size_t kMaximumRoots = 32; +constexpr std::size_t kMaximumLeafBeam = 8; +constexpr std::size_t kMaximumCandidateIdentities = 8 * (1 + 12) * 40; + +enum class Failure +{ + None, + EmbeddingDimension, + NonfiniteEmbedding, + PrepareInjected, + PublishInjected, + DuplicateGeneration, + GenerationGap, + GenerationRegression, + DigestMismatch, + CapacityInvariant, + WorkBound, + RebuildFailure +}; + +#if defined(CORTEXT_TESTING) +inline std::atomic g_failure_stage { 0 }; + +inline bool +ConsumeFailureStage (int stage) +{ + int expected = stage; + return g_failure_stage.compare_exchange_strong ( + expected, 0, std::memory_order_relaxed); +} +#endif + +inline const char * +FailureName (Failure failure) +{ + switch (failure) + { + case Failure::None: + return "none"; + case Failure::EmbeddingDimension: + return "embedding-dimension"; + case Failure::NonfiniteEmbedding: + return "nonfinite-embedding"; + case Failure::PrepareInjected: + return "prepare-injected"; + case Failure::PublishInjected: + return "publish-injected"; + case Failure::DuplicateGeneration: + return "duplicate-generation"; + case Failure::GenerationGap: + return "generation-gap"; + case Failure::GenerationRegression: + return "generation-regression"; + case Failure::DigestMismatch: + return "digest-mismatch"; + case Failure::CapacityInvariant: + return "capacity-invariant"; + case Failure::WorkBound: + return "work-bound"; + case Failure::RebuildFailure: + return "rebuild-failure"; + } + return "unknown"; +} + +struct Parameters +{ + std::size_t roots = 0; + std::size_t leaf_capacity = 0; + std::size_t children_per_root = 0; + std::size_t root_beam = 0; + std::size_t leaf_beam = 0; + std::size_t representatives_per_leaf = 0; + std::size_t neighbor_degree = 0; + std::size_t activated_leaves_per_consolidation = 0; + std::size_t consolidation_interval = 0; + float centroid_alpha = 0.0F; + float root_creation_squared_distance = 0.0F; + float leaf_creation_squared_distance = 0.0F; + std::size_t fixed_embedding_slots = 0; + std::size_t fixed_neighbor_slots = 0; + std::size_t normal_comparison_bound = 0; + std::size_t recall_comparison_bound = 0; + std::size_t consolidation_comparison_bound = 0; +}; + +inline double +ClampKnob (double value) +{ + return std::max (0.0, std::min (1.0, value)); +} + +inline std::size_t +Rounded (double value) +{ + return static_cast (std::lround (value)); +} + +inline Parameters +DeriveParameters (double focus, double sensitivity, double stability) +{ + const double F = ClampKnob (focus); + const double S = ClampKnob (sensitivity); + const double T = ClampKnob (stability); + Parameters result; + result.roots = 8 + Rounded (24 * S); + result.leaf_capacity = 128 + Rounded (512 * F + 512 * T); + result.children_per_root + = (result.leaf_capacity + result.roots - 1) / result.roots; + result.root_beam = 1 + Rounded (3 * S); + result.leaf_beam = 2 + Rounded (6 * F); + result.representatives_per_leaf = 8 + Rounded (32 * F); + result.neighbor_degree = 4 + Rounded (8 * S); + result.activated_leaves_per_consolidation = 8 + Rounded (24 * F); + result.consolidation_interval = 256 + Rounded (512 * T); + result.centroid_alpha = static_cast (0.01 + 0.09 * (1.0 - T)); + result.root_creation_squared_distance + = static_cast (0.01 + 0.02 * (1.0 - S)); + result.leaf_creation_squared_distance + = static_cast (0.001 + 0.008 * (1.0 - S)); + result.fixed_embedding_slots + = result.roots + result.leaf_capacity + + result.leaf_capacity * result.representatives_per_leaf; + result.fixed_neighbor_slots + = result.leaf_capacity * result.neighbor_degree; + result.normal_comparison_bound + = result.roots + result.root_beam * result.children_per_root + + 2 * result.representatives_per_leaf + + result.children_per_root; + result.recall_comparison_bound + = result.roots + result.root_beam * result.children_per_root + + result.leaf_beam * (1 + result.neighbor_degree) + * result.representatives_per_leaf; + result.consolidation_comparison_bound + = 2 * result.leaf_capacity * result.roots + + result.activated_leaves_per_consolidation + * (result.roots + + result.root_beam * result.children_per_root + + result.neighbor_degree + + result.neighbor_degree * result.neighbor_degree); + return result; +} + +struct FixedEmbedding +{ + std::array values {}; + std::uint16_t dimension = 0; +}; + +inline bool +Normalize (const Eigen::VectorXf &source, FixedEmbedding &target) +{ + if (source.size () <= 0 + || static_cast (source.size ()) + > kMaximumEmbeddingDimension) + return false; + double norm_squared = 0.0; + for (Eigen::Index index = 0; index < source.size (); ++index) + { + const float value = source[index]; + if (!std::isfinite (value)) + return false; + norm_squared += static_cast (value) * value; + } + const double inverse_norm + = 1.0 / std::max (std::sqrt (norm_squared), 1.0e-12); + target.dimension = static_cast (source.size ()); + std::fill (target.values.begin (), target.values.end (), 0.0F); + for (Eigen::Index index = 0; index < source.size (); ++index) + target.values[static_cast (index)] + = static_cast (source[index] * inverse_norm); + return true; +} + +inline bool +Normalize (FixedEmbedding &embedding) +{ + double norm_squared = 0.0; + for (std::size_t index = 0; index < embedding.dimension; ++index) + norm_squared += static_cast (embedding.values[index]) + * embedding.values[index]; + if (!std::isfinite (norm_squared)) + return false; + const double inverse_norm + = 1.0 / std::max (std::sqrt (norm_squared), 1.0e-12); + for (std::size_t index = 0; index < embedding.dimension; ++index) + embedding.values[index] + = static_cast (embedding.values[index] * inverse_norm); + return true; +} + +inline float +SquaredDistance (const FixedEmbedding &left, const FixedEmbedding &right) +{ + if (left.dimension == 0 || left.dimension != right.dimension) + return 2.0F; + double dot = 0.0; + for (std::size_t index = 0; index < left.dimension; ++index) + dot += static_cast (left.values[index]) * right.values[index]; + return static_cast (std::max (0.0, 2.0 - 2.0 * dot)); +} + +inline std::uint64_t +FnvAppend (std::uint64_t hash, const void *bytes, std::size_t size) +{ + const auto *data = static_cast (bytes); + for (std::size_t index = 0; index < size; ++index) + { + hash ^= static_cast (data[index]); + hash *= 1099511628211ULL; + } + return hash; +} + +template +inline std::uint64_t +FnvValue (std::uint64_t hash, const Value &value) +{ + return FnvAppend (hash, &value, sizeof (value)); +} + +inline std::uint64_t +EmbeddingIdentity (const FixedEmbedding &embedding) +{ + std::uint64_t hash = 1469598103934665603ULL; + hash = FnvValue (hash, embedding.dimension); + return FnvAppend (hash, embedding.values.data (), + embedding.dimension * sizeof (float)); +} + +struct Root +{ + FixedEmbedding centroid; + std::uint64_t count = 0; +}; + +struct Leaf +{ + FixedEmbedding centroid; + std::uint64_t count = 0; + std::uint64_t last_active = 0; + std::uint64_t epoch_activity = 0; + std::uint16_t root = 0; + std::uint16_t representative_count = 0; + std::uint16_t neighbor_count = 0; +}; + +struct Representative +{ + FixedEmbedding embedding; + std::uint64_t identity = 0; + std::uint64_t event_index = 0; + std::uint64_t last_active = 0; + bool occupied = false; +}; + +struct JournalEvent +{ + FixedEmbedding embedding; + std::uint64_t generation = 0; + std::uint64_t event_index = 0; + std::uint64_t embedding_identity = 0; + std::uint64_t timestamp = 0; + std::uint64_t digest = 0; + std::uint64_t recall_comparisons = 0; +}; + +struct Metrics +{ + std::uint64_t normal_comparisons = 0; + std::uint64_t normal_comparisons_max = 0; + std::uint64_t recall_comparisons = 0; + std::uint64_t recall_comparisons_max = 0; + std::uint64_t consolidation_comparisons = 0; + std::uint64_t consolidation_comparisons_max = 0; + std::uint64_t consolidation_count = 0; + std::uint64_t representative_replacements = 0; + std::uint64_t allocation_after_initialization_count = 0; + std::uint64_t restart_rows_visited = 0; + double restart_rebuild_ms = 0.0; + bool restart_rebuild_linear_history = false; + bool restart_production_gate = false; +}; + +struct State +{ + explicit State (Parameters derived) : parameters (derived) + { + roots.resize (parameters.roots); + leaves.resize (parameters.leaf_capacity); + representatives.resize (parameters.leaf_capacity + * parameters.representatives_per_leaf); + representative_pair_distances.resize ( + parameters.leaf_capacity * parameters.representatives_per_leaf + * parameters.representatives_per_leaf, + std::numeric_limits::infinity ()); + neighbors.resize (parameters.leaf_capacity * parameters.neighbor_degree, + 0); + root_distances.resize (parameters.roots, 0.0F); + root_accumulator.resize ( + parameters.roots * kMaximumEmbeddingDimension, 0.0); + root_accumulator_counts.resize (parameters.roots, 0); + root_child_counts.resize (parameters.roots, 0); + assignment_distances.resize (parameters.leaf_capacity * parameters.roots, + 0.0F); + assignment_margins.resize (parameters.leaf_capacity, 0.0F); + assignment_order.resize (parameters.leaf_capacity, 0); + candidate_seen.resize (parameters.leaf_capacity, 0); + candidate_indices.resize (parameters.leaf_capacity, 0); + transaction_journal.resize (parameters.consolidation_interval); + initialized = true; + const auto vector_bytes + = roots.capacity () * sizeof (Root) + + leaves.capacity () * sizeof (Leaf) + + representatives.capacity () * sizeof (Representative) + + representative_pair_distances.capacity () * sizeof (float) + + neighbors.capacity () * sizeof (std::uint16_t) + + root_distances.capacity () * sizeof (float) + + root_accumulator.capacity () * sizeof (double) + + root_accumulator_counts.capacity () * sizeof (std::uint64_t) + + root_child_counts.capacity () * sizeof (std::size_t) + + assignment_distances.capacity () * sizeof (float) + + assignment_margins.capacity () * sizeof (float) + + assignment_order.capacity () * sizeof (std::uint16_t) + + candidate_seen.capacity () * sizeof (unsigned char) + + candidate_indices.capacity () * sizeof (std::uint16_t) + + transaction_journal.capacity () * sizeof (JournalEvent); + allocated_bytes = vector_bytes; + } + + Parameters parameters; + bool initialized = false; + bool available = false; + bool disabled = false; + bool restart_rebuild_required = false; + Failure failure = Failure::None; + std::uint64_t last_published_generation = 0; + std::uint64_t last_event_index = 0; + std::uint64_t last_event_digest = 0; + std::size_t root_count = 0; + std::size_t leaf_count = 0; + std::size_t allocated_bytes = 0; + Metrics metrics; + std::vector roots; + std::vector leaves; + std::vector representatives; + std::vector representative_pair_distances; + std::vector neighbors; + std::vector root_distances; + std::vector root_accumulator; + std::vector root_accumulator_counts; + std::vector root_child_counts; + std::vector assignment_distances; + std::vector assignment_margins; + std::vector assignment_order; + std::vector candidate_seen; + std::vector candidate_indices; + std::vector transaction_journal; + std::size_t transaction_journal_count = 0; + std::size_t transaction_depth = 0; +}; + +struct PreparedObservation +{ + std::shared_ptr state; + FixedEmbedding embedding; + std::uint64_t generation = 0; + std::uint64_t event_index = 0; + std::uint64_t embedding_identity = 0; + std::uint64_t timestamp = 0; + std::uint64_t digest = 0; + std::size_t candidate_count = 0; + std::uint64_t recall_comparisons = 0; + std::array + candidate_identities {}; + std::size_t transaction_journal_start = 0; + bool transaction_root = false; + bool transaction_scope_active = false; + bool valid = false; +}; + +struct PublishResult +{ + bool published = false; + bool disabled = false; + Failure failure = Failure::None; + std::uint64_t generation = 0; + std::uint64_t normal_comparisons = 0; + std::uint64_t consolidation_comparisons = 0; +}; + +struct Snapshot +{ + Parameters parameters; + bool available = false; + bool disabled = false; + bool restart_rebuild_required = false; + Failure failure = Failure::None; + std::uint64_t generation = 0; + std::uint64_t event_index = 0; + std::size_t root_count = 0; + std::size_t leaf_count = 0; + std::size_t allocated_bytes = 0; + Metrics metrics; + std::uint64_t state_digest = 0; +}; + +struct WorkSnapshot +{ + bool available = false; + bool disabled = false; + Failure failure = Failure::None; + std::uint64_t generation = 0; + std::uint64_t event_index = 0; + std::size_t root_count = 0; + std::size_t leaf_count = 0; + Metrics metrics; +}; + +struct RankedIndex +{ + float distance = std::numeric_limits::infinity (); + std::uint16_t index = 0; +}; + +template +inline void +InsertRanked (std::array &ranked, + std::size_t &ranked_count, std::size_t limit, + RankedIndex candidate) +{ + limit = std::min (limit, Capacity); + std::size_t insertion = 0; + while (insertion < ranked_count + && (ranked[insertion].distance < candidate.distance + || (ranked[insertion].distance == candidate.distance + && ranked[insertion].index < candidate.index))) + ++insertion; + if (insertion >= limit) + return; + const std::size_t new_count = std::min (limit, ranked_count + 1); + for (std::size_t index = new_count; index > insertion + 1; --index) + ranked[index - 1] = ranked[index - 2]; + ranked[insertion] = candidate; + ranked_count = new_count; +} + +inline Representative & +RepresentativeAt (State &state, std::size_t leaf, std::size_t slot) +{ + return state.representatives[ + leaf * state.parameters.representatives_per_leaf + slot]; +} + +inline const Representative & +RepresentativeAt (const State &state, std::size_t leaf, std::size_t slot) +{ + return state.representatives[ + leaf * state.parameters.representatives_per_leaf + slot]; +} + +inline float & +PairDistanceAt (State &state, std::size_t leaf, std::size_t left, + std::size_t right) +{ + const auto E = state.parameters.representatives_per_leaf; + return state.representative_pair_distances[(leaf * E + left) * E + right]; +} + +inline std::uint16_t & +NeighborAt (State &state, std::size_t leaf, std::size_t slot) +{ + return state.neighbors[leaf * state.parameters.neighbor_degree + slot]; +} + +inline std::uint16_t +NeighborAt (const State &state, std::size_t leaf, std::size_t slot) +{ + return state.neighbors[leaf * state.parameters.neighbor_degree + slot]; +} + +inline void +Disable (State &state, Failure failure) +{ + state.available = false; + state.disabled = true; + state.failure = failure; + state.root_count = 0; + state.leaf_count = 0; +} + +inline std::uint64_t +EventDigest (const State &state, std::uint64_t generation, + std::uint64_t event_index, std::uint64_t embedding_identity, + std::uint64_t timestamp) +{ + std::uint64_t hash = 1469598103934665603ULL; + hash = FnvValue (hash, generation); + hash = FnvValue (hash, event_index); + hash = FnvValue (hash, embedding_identity); + hash = FnvValue (hash, timestamp); + hash = FnvValue (hash, state.parameters.roots); + hash = FnvValue (hash, state.parameters.leaf_capacity); + hash = FnvValue (hash, state.parameters.root_beam); + hash = FnvValue (hash, state.parameters.leaf_beam); + hash = FnvValue (hash, state.parameters.representatives_per_leaf); + hash = FnvValue (hash, state.parameters.neighbor_degree); + return hash; +} + +inline bool +RootSelected (std::uint16_t root, + const std::array &ranked, + std::size_t count) +{ + for (std::size_t index = 0; index < count; ++index) + if (ranked[index].index == root) + return true; + return false; +} + +inline std::uint64_t +Route (State &state, const FixedEmbedding &query, + PreparedObservation &prepared) +{ + if (state.root_count == 0 || state.leaf_count == 0) + return 0; + std::array selected_roots {}; + std::size_t selected_root_count = 0; + for (std::size_t root = 0; root < state.root_count; ++root) + InsertRanked (selected_roots, selected_root_count, + state.parameters.root_beam, + { SquaredDistance (query, state.roots[root].centroid), + static_cast (root) }); + + std::array selected_leaves {}; + std::size_t selected_leaf_count = 0; + std::size_t compared_leaves = 0; + for (std::size_t leaf = 0; leaf < state.leaf_count; ++leaf) + { + if (!RootSelected (state.leaves[leaf].root, selected_roots, + selected_root_count)) + continue; + ++compared_leaves; + InsertRanked (selected_leaves, selected_leaf_count, + state.parameters.leaf_beam, + { SquaredDistance (query, state.leaves[leaf].centroid), + static_cast (leaf) }); + } + + std::fill (state.candidate_seen.begin (), + state.candidate_seen.begin () + + static_cast (state.leaf_count), + 0); + std::size_t expanded_count = 0; + for (std::size_t index = 0; index < selected_leaf_count; ++index) + { + const auto leaf = selected_leaves[index].index; + if (!state.candidate_seen[leaf]) + { + state.candidate_seen[leaf] = 1; + state.candidate_indices[expanded_count++] = leaf; + } + for (std::size_t slot = 0; + slot < state.leaves[leaf].neighbor_count; ++slot) + { + const auto neighbor = NeighborAt (state, leaf, slot); + if (neighbor < state.leaf_count && !state.candidate_seen[neighbor]) + { + state.candidate_seen[neighbor] = 1; + state.candidate_indices[expanded_count++] = neighbor; + } + } + } + + std::size_t representative_comparisons = 0; + for (std::size_t expanded = 0; expanded < expanded_count; ++expanded) + { + const auto leaf = state.candidate_indices[expanded]; + for (std::size_t slot = 0; + slot < state.leaves[leaf].representative_count; ++slot) + { + const auto &representative = RepresentativeAt (state, leaf, slot); + ++representative_comparisons; + bool duplicate = false; + for (std::size_t prior = 0; prior < prepared.candidate_count; ++prior) + if (prepared.candidate_identities[prior] + == representative.identity) + { + duplicate = true; + break; + } + if (!duplicate + && prepared.candidate_count + < prepared.candidate_identities.size ()) + prepared.candidate_identities[prepared.candidate_count++] + = representative.identity; + } + } + return state.root_count + compared_leaves + representative_comparisons; +} + +inline std::uint64_t +AddLeaf (State &state, const FixedEmbedding &embedding, + std::uint64_t identity, std::uint64_t event_index, + std::size_t root) +{ + if (state.leaf_count >= state.parameters.leaf_capacity) + return 0; + const std::size_t leaf_index = state.leaf_count++; + auto &leaf = state.leaves[leaf_index]; + leaf = {}; + leaf.centroid = embedding; + leaf.count = 1; + leaf.last_active = event_index; + leaf.epoch_activity = 1; + leaf.root = static_cast (root); + leaf.representative_count = 1; + auto &representative = RepresentativeAt (state, leaf_index, 0); + representative = { embedding, identity, event_index, event_index, true }; + std::array selected {}; + std::size_t selected_count = 0; + std::uint64_t comparisons = 0; + for (std::size_t other = 0; other + 1 < state.leaf_count; ++other) + { + if (state.leaves[other].root != root) + continue; + ++comparisons; + InsertRanked (selected, selected_count, state.parameters.neighbor_degree, + { SquaredDistance (embedding, + state.leaves[other].centroid), + static_cast (other) }); + } + leaf.neighbor_count = static_cast (selected_count); + for (std::size_t slot = 0; slot < selected_count; ++slot) + NeighborAt (state, leaf_index, slot) = selected[slot].index; + return comparisons; +} + +inline std::uint64_t +UpdateRepresentatives (State &state, std::size_t leaf_index, + const FixedEmbedding &embedding, + std::uint64_t identity, std::uint64_t event_index) +{ + auto &leaf = state.leaves[leaf_index]; + const auto E = state.parameters.representatives_per_leaf; + std::array distances {}; + std::uint64_t comparisons = leaf.representative_count; + std::size_t nearest = 0; + float nearest_distance = std::numeric_limits::infinity (); + for (std::size_t slot = 0; slot < leaf.representative_count; ++slot) + { + distances[slot] = SquaredDistance ( + embedding, RepresentativeAt (state, leaf_index, slot).embedding); + if (distances[slot] < nearest_distance) + { + nearest_distance = distances[slot]; + nearest = slot; + } + } + if (leaf.representative_count > 0) + RepresentativeAt (state, leaf_index, nearest).last_active = event_index; + if (leaf.representative_count < E) + { + const std::size_t slot = leaf.representative_count++; + RepresentativeAt (state, leaf_index, slot) + = { embedding, identity, event_index, event_index, true }; + for (std::size_t other = 0; other < slot; ++other) + { + PairDistanceAt (state, leaf_index, slot, other) = distances[other]; + PairDistanceAt (state, leaf_index, other, slot) = distances[other]; + } + return comparisons; + } + + float redundant_distance = std::numeric_limits::infinity (); + std::size_t redundant_left = 0; + std::size_t redundant_right = 0; + for (std::size_t left = 0; left < E; ++left) + for (std::size_t right = left + 1; right < E; ++right) + if (PairDistanceAt (state, leaf_index, left, right) + < redundant_distance) + { + redundant_distance + = PairDistanceAt (state, leaf_index, left, right); + redundant_left = left; + redundant_right = right; + } + if (nearest_distance <= redundant_distance) + return comparisons; + const std::size_t replacement + = RepresentativeAt (state, leaf_index, redundant_left).last_active + <= RepresentativeAt (state, leaf_index, redundant_right) + .last_active + ? redundant_left + : redundant_right; + RepresentativeAt (state, leaf_index, replacement) + = { embedding, identity, event_index, event_index, true }; + for (std::size_t other = 0; other < E; ++other) + { + const float distance + = other == replacement + ? std::numeric_limits::infinity () + : SquaredDistance ( + embedding, + RepresentativeAt (state, leaf_index, other).embedding); + if (other != replacement) + ++comparisons; + PairDistanceAt (state, leaf_index, replacement, other) = distance; + PairDistanceAt (state, leaf_index, other, replacement) = distance; + } + ++state.metrics.representative_replacements; + return comparisons; +} + +inline void +UpdateCentroid (FixedEmbedding ¢roid, const FixedEmbedding &embedding, + float alpha) +{ + for (std::size_t index = 0; index < centroid.dimension; ++index) + centroid.values[index] + = (1.0F - alpha) * centroid.values[index] + + alpha * embedding.values[index]; + Normalize (centroid); +} + +inline std::uint64_t +Ingest (State &state, const FixedEmbedding &embedding, + std::uint64_t identity, std::uint64_t event_index) +{ + std::uint64_t comparisons = 0; + if (state.root_count == 0) + { + state.roots[0].centroid = embedding; + state.roots[0].count = 1; + state.root_count = 1; + comparisons += AddLeaf (state, embedding, identity, event_index, 0); + return comparisons; + } + + std::array selected_roots {}; + std::size_t selected_root_count = 0; + float nearest_root_distance = std::numeric_limits::infinity (); + std::size_t nearest_root = 0; + for (std::size_t root = 0; root < state.root_count; ++root) + { + const float distance + = SquaredDistance (embedding, state.roots[root].centroid); + state.root_distances[root] = distance; + ++comparisons; + if (distance < nearest_root_distance) + { + nearest_root_distance = distance; + nearest_root = root; + } + InsertRanked (selected_roots, selected_root_count, + state.parameters.root_beam, + { distance, static_cast (root) }); + } + if (state.root_count < state.parameters.roots + && nearest_root_distance + > state.parameters.root_creation_squared_distance) + { + const std::size_t root = state.root_count++; + state.roots[root].centroid = embedding; + state.roots[root].count = 1; + comparisons += AddLeaf (state, embedding, identity, event_index, root); + return comparisons; + } + + std::size_t nearest_leaf = state.leaf_count; + float nearest_leaf_distance = std::numeric_limits::infinity (); + for (std::size_t leaf = 0; leaf < state.leaf_count; ++leaf) + { + if (!RootSelected (state.leaves[leaf].root, selected_roots, + selected_root_count)) + continue; + const float distance + = SquaredDistance (embedding, state.leaves[leaf].centroid); + ++comparisons; + if (distance < nearest_leaf_distance) + { + nearest_leaf_distance = distance; + nearest_leaf = leaf; + } + } + if (nearest_leaf == state.leaf_count) + { + comparisons += AddLeaf (state, embedding, identity, event_index, + nearest_root); + return comparisons; + } + + if (state.leaf_count < state.parameters.leaf_capacity + && nearest_leaf_distance + > state.parameters.leaf_creation_squared_distance) + { + std::fill (state.root_child_counts.begin (), + state.root_child_counts.end (), 0); + for (std::size_t leaf = 0; leaf < state.leaf_count; ++leaf) + ++state.root_child_counts[state.leaves[leaf].root]; + std::array ordered_roots {}; + std::size_t ordered_count = 0; + for (std::size_t root = 0; root < state.root_count; ++root) + InsertRanked (ordered_roots, ordered_count, state.root_count, + { state.root_distances[root], + static_cast (root) }); + for (std::size_t index = 0; index < ordered_count; ++index) + { + const auto root = ordered_roots[index].index; + if (state.root_child_counts[root] + < state.parameters.children_per_root) + { + comparisons += AddLeaf (state, embedding, identity, event_index, + root); + return comparisons; + } + } + } + + comparisons += UpdateRepresentatives (state, nearest_leaf, embedding, + identity, event_index); + auto &leaf = state.leaves[nearest_leaf]; + UpdateCentroid (leaf.centroid, embedding, state.parameters.centroid_alpha); + ++leaf.count; + leaf.last_active = event_index; + ++leaf.epoch_activity; + return comparisons; +} + +inline std::uint64_t +BalancedAssignmentPass (State &state) +{ + std::fill (state.root_child_counts.begin (), + state.root_child_counts.end (), 0); + std::fill (state.root_accumulator.begin (), + state.root_accumulator.end (), 0.0); + std::fill (state.root_accumulator_counts.begin (), + state.root_accumulator_counts.end (), 0); + std::uint64_t comparisons = 0; + for (std::size_t leaf = 0; leaf < state.leaf_count; ++leaf) + { + float nearest = std::numeric_limits::infinity (); + float second_nearest = std::numeric_limits::infinity (); + for (std::size_t root = 0; root < state.root_count; ++root) + { + const float distance + = SquaredDistance (state.leaves[leaf].centroid, + state.roots[root].centroid); + state.assignment_distances[leaf * state.parameters.roots + root] + = distance; + if (distance < nearest) + { + second_nearest = nearest; + nearest = distance; + } + else if (distance < second_nearest) + second_nearest = distance; + ++comparisons; + } + state.assignment_margins[leaf] + = state.root_count > 1 ? second_nearest - nearest : 1.0F; + state.assignment_order[leaf] = static_cast (leaf); + } + std::sort ( + state.assignment_order.begin (), + state.assignment_order.begin () + + static_cast (state.leaf_count), + [&] (std::uint16_t left, std::uint16_t right) { + const float left_margin = state.assignment_margins[left]; + const float right_margin = state.assignment_margins[right]; + return left_margin > right_margin + || (left_margin == right_margin && left < right); + }); + + for (std::size_t order = 0; order < state.leaf_count; ++order) + { + const auto leaf = state.assignment_order[order]; + std::array ranked {}; + std::size_t ranked_count = 0; + for (std::size_t root = 0; root < state.root_count; ++root) + InsertRanked ( + ranked, ranked_count, state.root_count, + { state.assignment_distances[ + static_cast (leaf) * state.parameters.roots + + root], + static_cast (root) }); + std::size_t destination = state.root_count; + for (std::size_t index = 0; index < ranked_count; ++index) + if (state.root_child_counts[ranked[index].index] + < state.parameters.children_per_root) + { + destination = ranked[index].index; + break; + } + if (destination == state.root_count) + { + Disable (state, Failure::CapacityInvariant); + return comparisons; + } + state.leaves[leaf].root = static_cast (destination); + ++state.root_child_counts[destination]; + const auto weight = state.leaves[leaf].count; + state.root_accumulator_counts[destination] += weight; + for (std::size_t dimension = 0; + dimension < state.leaves[leaf].centroid.dimension; ++dimension) + state.root_accumulator[ + destination * kMaximumEmbeddingDimension + dimension] + += static_cast (state.leaves[leaf].centroid.values[dimension]) + * weight; + } + for (std::size_t root = 0; root < state.root_count; ++root) + { + if (state.root_accumulator_counts[root] == 0) + continue; + auto ¢roid = state.roots[root].centroid; + for (std::size_t dimension = 0; dimension < centroid.dimension; + ++dimension) + centroid.values[dimension] = static_cast ( + state.root_accumulator[root * kMaximumEmbeddingDimension + + dimension] + / state.root_accumulator_counts[root]); + Normalize (centroid); + state.roots[root].count = state.root_accumulator_counts[root]; + } + return comparisons; +} + +inline std::uint64_t +RefreshNeighbors (State &state, std::size_t leaf_index) +{ + std::array selected_roots {}; + std::size_t selected_root_count = 0; + for (std::size_t root = 0; root < state.root_count; ++root) + InsertRanked (selected_roots, selected_root_count, + state.parameters.root_beam, + { SquaredDistance (state.leaves[leaf_index].centroid, + state.roots[root].centroid), + static_cast (root) }); + std::fill (state.candidate_seen.begin (), + state.candidate_seen.begin () + + static_cast (state.leaf_count), + 0); + state.candidate_seen[leaf_index] = 1; + std::size_t candidate_count = 0; + for (std::size_t leaf = 0; leaf < state.leaf_count; ++leaf) + if (!state.candidate_seen[leaf] + && RootSelected (state.leaves[leaf].root, selected_roots, + selected_root_count)) + { + state.candidate_seen[leaf] = 1; + state.candidate_indices[candidate_count++] + = static_cast (leaf); + } + const auto add_candidate = [&] (std::size_t candidate) { + if (candidate < state.leaf_count && !state.candidate_seen[candidate]) + { + state.candidate_seen[candidate] = 1; + state.candidate_indices[candidate_count++] + = static_cast (candidate); + } + }; + const auto old_neighbor_count = state.leaves[leaf_index].neighbor_count; + for (std::size_t slot = 0; slot < old_neighbor_count; ++slot) + { + const auto neighbor = NeighborAt (state, leaf_index, slot); + add_candidate (neighbor); + if (neighbor >= state.leaf_count) + continue; + for (std::size_t nested = 0; + nested < state.leaves[neighbor].neighbor_count; ++nested) + add_candidate (NeighborAt (state, neighbor, nested)); + } + std::array selected {}; + std::size_t selected_count = 0; + for (std::size_t index = 0; index < candidate_count; ++index) + { + const auto candidate = state.candidate_indices[index]; + InsertRanked (selected, selected_count, state.parameters.neighbor_degree, + { SquaredDistance (state.leaves[leaf_index].centroid, + state.leaves[candidate].centroid), + candidate }); + } + state.leaves[leaf_index].neighbor_count + = static_cast (selected_count); + for (std::size_t slot = 0; slot < selected_count; ++slot) + NeighborAt (state, leaf_index, slot) = selected[slot].index; + return state.root_count + candidate_count; +} + +inline std::uint64_t +Consolidate (State &state) +{ + std::uint64_t comparisons = BalancedAssignmentPass (state); + if (state.disabled) + return comparisons; + comparisons += BalancedAssignmentPass (state); + if (state.disabled) + return comparisons; + std::array active {}; + std::size_t active_count = 0; + for (std::size_t leaf = 0; leaf < state.leaf_count; ++leaf) + { + if (state.leaves[leaf].epoch_activity == 0) + continue; + const float rank + = -static_cast (state.leaves[leaf].epoch_activity); + InsertRanked (active, active_count, + state.parameters.activated_leaves_per_consolidation, + { rank, static_cast (leaf) }); + } + for (std::size_t index = 0; index < active_count; ++index) + comparisons += RefreshNeighbors (state, active[index].index); + for (std::size_t leaf = 0; leaf < state.leaf_count; ++leaf) + state.leaves[leaf].epoch_activity = 0; + ++state.metrics.consolidation_count; + state.metrics.consolidation_comparisons = comparisons; + state.metrics.consolidation_comparisons_max + = std::max (state.metrics.consolidation_comparisons_max, comparisons); + if (comparisons > state.parameters.consolidation_comparison_bound) + Disable (state, Failure::WorkBound); + return comparisons; +} + +inline std::uint64_t +StateDigest (const State &state) +{ + std::uint64_t hash = 1469598103934665603ULL; + hash = FnvValue (hash, state.last_published_generation); + hash = FnvValue (hash, state.last_event_index); + hash = FnvValue (hash, state.root_count); + hash = FnvValue (hash, state.leaf_count); + for (std::size_t root = 0; root < state.root_count; ++root) + { + hash = FnvValue (hash, state.roots[root].centroid.dimension); + hash = FnvAppend ( + hash, state.roots[root].centroid.values.data (), + state.roots[root].centroid.dimension * sizeof (float)); + hash = FnvValue (hash, state.roots[root].count); + } + for (std::size_t leaf = 0; leaf < state.leaf_count; ++leaf) + { + const auto ¤t = state.leaves[leaf]; + hash = FnvValue (hash, current.centroid.dimension); + hash = FnvAppend (hash, current.centroid.values.data (), + current.centroid.dimension * sizeof (float)); + hash = FnvValue (hash, current.count); + hash = FnvValue (hash, current.last_active); + hash = FnvValue (hash, current.epoch_activity); + hash = FnvValue (hash, current.root); + hash = FnvValue (hash, current.representative_count); + hash = FnvValue (hash, current.neighbor_count); + for (std::size_t slot = 0; + slot < state.leaves[leaf].representative_count; ++slot) + { + const auto &representative + = RepresentativeAt (state, leaf, slot); + hash = FnvValue (hash, representative.embedding.dimension); + hash = FnvAppend ( + hash, representative.embedding.values.data (), + representative.embedding.dimension * sizeof (float)); + hash = FnvValue (hash, representative.identity); + hash = FnvValue (hash, representative.event_index); + hash = FnvValue (hash, representative.last_active); + hash = FnvValue (hash, representative.occupied); + } + for (std::size_t slot = 0; + slot < state.leaves[leaf].neighbor_count; ++slot) + { + const auto neighbor = NeighborAt (state, leaf, slot); + hash = FnvValue (hash, neighbor); + } + } + return hash; +} + +inline PreparedObservation +PrepareWithGenerationOffset (const std::shared_ptr &state, + const Signal &signal, + std::size_t generation_offset) +{ + PreparedObservation prepared; + prepared.state = state; + if (!state || !state->available || state->disabled + || signal.retention == Retention::Ephemeral + || signal.force_consolidation) + return prepared; +#if defined(CORTEXT_TESTING) + if (ConsumeFailureStage (1)) + { + Disable (*state, Failure::PrepareInjected); + return prepared; + } +#endif + if (!Normalize (signal.embedding, prepared.embedding)) + { + Disable (*state, + signal.embedding.size () <= 0 + || static_cast (signal.embedding.size ()) + > kMaximumEmbeddingDimension + ? Failure::EmbeddingDimension + : Failure::NonfiniteEmbedding); + return prepared; + } + prepared.generation + = state->last_published_generation + generation_offset + 1; + prepared.event_index = state->last_event_index + generation_offset + 1; + prepared.embedding_identity = EmbeddingIdentity (prepared.embedding); + prepared.timestamp = signal.timestamp; + prepared.digest = EventDigest (*state, prepared.generation, + prepared.event_index, + prepared.embedding_identity, + prepared.timestamp); + prepared.recall_comparisons = Route (*state, prepared.embedding, prepared); + if (prepared.recall_comparisons > state->parameters.recall_comparison_bound) + { + Disable (*state, Failure::WorkBound); + return prepared; + } + prepared.valid = true; + return prepared; +} + +inline PreparedObservation +Prepare (const std::shared_ptr &state, const Signal &signal) +{ + return PrepareWithGenerationOffset (state, signal, 0); +} + +inline PreparedObservation +PrepareForCanonicalTransaction (const std::shared_ptr &state, + const Signal &signal, + bool root_transaction) +{ + PreparedObservation prepared; + prepared.state = state; + if (!state || !state->available || state->disabled + || signal.retention == Retention::Ephemeral + || signal.force_consolidation) + return prepared; + if ((root_transaction && state->transaction_depth != 0) + || (!root_transaction && state->transaction_depth == 0) + || state->transaction_journal_count + >= state->transaction_journal.size ()) + { + Disable (*state, Failure::CapacityInvariant); + return prepared; + } + if (root_transaction) + state->transaction_journal_count = 0; + const auto journal_start = state->transaction_journal_count; + prepared = PrepareWithGenerationOffset (state, signal, journal_start); + if (!prepared.valid) + return prepared; + auto &journal = state->transaction_journal[state->transaction_journal_count]; + journal = { prepared.embedding, + prepared.generation, + prepared.event_index, + prepared.embedding_identity, + prepared.timestamp, + prepared.digest, + prepared.recall_comparisons }; + ++state->transaction_journal_count; + ++state->transaction_depth; + prepared.transaction_journal_start = journal_start; + prepared.transaction_root = root_transaction; + prepared.transaction_scope_active = true; + return prepared; +} + +inline PublishResult +PublishAfterPersistentCommit (PreparedObservation &prepared) +{ + PublishResult result; + if (!prepared.valid || !prepared.state) + return result; + auto &state = *prepared.state; + result.generation = prepared.generation; + if (!state.available || state.disabled) + { + result.disabled = state.disabled; + result.failure = state.failure; + return result; + } + const auto expected = state.last_published_generation + 1; + if (prepared.generation < expected) + { + Disable (state, prepared.generation == state.last_published_generation + ? Failure::DuplicateGeneration + : Failure::GenerationRegression); + } + else if (prepared.generation > expected) + Disable (state, Failure::GenerationGap); + else if (prepared.digest + != EventDigest (state, prepared.generation, prepared.event_index, + prepared.embedding_identity, + prepared.timestamp)) + Disable (state, Failure::DigestMismatch); +#if defined(CORTEXT_TESTING) + if (!state.disabled && ConsumeFailureStage (2)) + Disable (state, Failure::PublishInjected); +#endif + if (state.disabled) + { + result.disabled = true; + result.failure = state.failure; + prepared.valid = false; + return result; + } + try + { + result.normal_comparisons + = Ingest (state, prepared.embedding, prepared.embedding_identity, + prepared.event_index); + state.metrics.normal_comparisons = result.normal_comparisons; + state.metrics.normal_comparisons_max + = std::max (state.metrics.normal_comparisons_max, + result.normal_comparisons); + state.metrics.recall_comparisons = prepared.recall_comparisons; + state.metrics.recall_comparisons_max + = std::max (state.metrics.recall_comparisons_max, + prepared.recall_comparisons); + if (result.normal_comparisons + > state.parameters.normal_comparison_bound) + Disable (state, Failure::WorkBound); + if (!state.disabled) + { + state.last_published_generation = prepared.generation; + state.last_event_index = prepared.event_index; + state.last_event_digest = prepared.digest; + if (state.last_event_index % state.parameters.consolidation_interval + == 0) + result.consolidation_comparisons = Consolidate (state); + } + } + catch (...) + { + Disable (state, Failure::PublishInjected); + } + result.published = !state.disabled; + result.disabled = state.disabled; + result.failure = state.failure; + prepared.valid = false; + return result; +} + +inline void +DiscardCanonicalTransaction (PreparedObservation &prepared) +{ + if (!prepared.transaction_scope_active || !prepared.state) + return; + auto &state = *prepared.state; + state.transaction_journal_count + = std::min (state.transaction_journal_count, + prepared.transaction_journal_start); + if (state.transaction_depth > 0) + --state.transaction_depth; + if (prepared.transaction_root) + { + state.transaction_depth = 0; + state.transaction_journal_count = 0; + } + prepared.transaction_scope_active = false; + prepared.valid = false; +} + +/// Clears a prepared journal entry when control leaves Process before the +/// canonical transaction reaches its explicit commit or rollback path. +class CanonicalTransactionJournalScope final +{ +public: + explicit CanonicalTransactionJournalScope (PreparedObservation &prepared) + : prepared_ (prepared) + { + } + + ~CanonicalTransactionJournalScope () noexcept + { + DiscardCanonicalTransaction (prepared_); + } + + CanonicalTransactionJournalScope (const CanonicalTransactionJournalScope &) + = delete; + CanonicalTransactionJournalScope & + operator= (const CanonicalTransactionJournalScope &) = delete; + +private: + PreparedObservation &prepared_; +}; + +inline PublishResult +PublishAfterCanonicalTransactionCommit (PreparedObservation &prepared) +{ + PublishResult result; + if (!prepared.transaction_scope_active || !prepared.state) + return result; + auto state = prepared.state; + if (!prepared.transaction_root) + { + if (state->transaction_depth == 0) + Disable (*state, Failure::CapacityInvariant); + else + --state->transaction_depth; + prepared.transaction_scope_active = false; + prepared.valid = false; + result.disabled = state->disabled; + result.failure = state->failure; + return result; + } + if (state->transaction_depth != 1) + { + Disable (*state, Failure::CapacityInvariant); + state->transaction_depth = 0; + state->transaction_journal_count = 0; + prepared.transaction_scope_active = false; + prepared.valid = false; + result.disabled = true; + result.failure = state->failure; + return result; + } + const auto event_count = state->transaction_journal_count; + for (std::size_t index = 0; index < event_count && !state->disabled; + ++index) + { + const auto &journal = state->transaction_journal[index]; + PreparedObservation event; + event.state = state; + event.embedding = journal.embedding; + event.generation = journal.generation; + event.event_index = journal.event_index; + event.embedding_identity = journal.embedding_identity; + event.timestamp = journal.timestamp; + event.digest = journal.digest; + event.recall_comparisons = journal.recall_comparisons; + event.valid = true; + result = PublishAfterPersistentCommit (event); + } + state->transaction_depth = 0; + state->transaction_journal_count = 0; + prepared.transaction_scope_active = false; + prepared.valid = false; + return result; +} + +struct RegistryState +{ + std::atomic enabled_count { 0 }; + std::mutex mutex; + std::unordered_map> states; +}; + +inline RegistryState & +Registry () +{ + static auto *registry = new RegistryState (); + return *registry; +} + +inline std::shared_ptr +Find (const ProcessorContext &context) +{ + auto ®istry = Registry (); + if (registry.enabled_count.load (std::memory_order_relaxed) == 0) + return nullptr; + std::lock_guard lock (registry.mutex); + const auto found = registry.states.find (&context); + return found == registry.states.end () ? nullptr : found->second; +} + +inline long long +ExtractCount (const std::vector> &rows) +{ + if (rows.empty ()) + return 0; + const auto found = rows.front ().find ("n"); + if (found == rows.front ().end ()) + return 0; + if (found->second.type () == typeid (long long)) + return std::any_cast (found->second); + if (found->second.type () == typeid (int64_t)) + return std::any_cast (found->second); + if (found->second.type () == typeid (int)) + return std::any_cast (found->second); + return 0; +} + +inline void +RebuildFromPersistentAuthority (State &state, Store &store) +{ + const auto started = std::chrono::steady_clock::now (); + try + { + const auto rows = store.Execute ( + "SELECT s.signal_id, s.timestamp, e.embedding " + "FROM signals s JOIN embeddings e " + "ON e.embedding_id = s.embedding_id " + "ORDER BY s.signal_id"); + const auto authoritative_signal_count + = ExtractCount ( + store.Execute ("SELECT COUNT(*) AS n FROM signals")); + if (authoritative_signal_count < 0 + || static_cast (authoritative_signal_count) + != rows.size ()) + { + Disable (state, Failure::RebuildFailure); + return; + } + state.available = true; + state.restart_rebuild_required = false; + std::uint64_t event_index = 0; + for (const auto &row : rows) + { + const auto embedding_it = row.find ("embedding"); + if (embedding_it == row.end () || !embedding_it->second.has_value ()) + { + Disable (state, Failure::RebuildFailure); + return; + } + const auto bytes = store::BlobFromAny (embedding_it->second); + if (bytes.empty () || bytes.size () % sizeof (float) != 0) + { + Disable (state, Failure::RebuildFailure); + return; + } + const auto dimension = bytes.size () / sizeof (float); + if (dimension == 0 || dimension > kMaximumEmbeddingDimension) + { + Disable (state, Failure::EmbeddingDimension); + return; + } + Eigen::VectorXf embedding (static_cast (dimension)); + std::memcpy (embedding.data (), bytes.data (), bytes.size ()); + FixedEmbedding normalized; + if (!Normalize (embedding, normalized)) + { + Disable (state, Failure::NonfiniteEmbedding); + return; + } + ++event_index; + const auto identity = EmbeddingIdentity (normalized); + const auto comparisons + = Ingest (state, normalized, identity, event_index); + state.metrics.normal_comparisons = comparisons; + state.metrics.normal_comparisons_max + = std::max (state.metrics.normal_comparisons_max, comparisons); + if (comparisons > state.parameters.normal_comparison_bound) + { + Disable (state, Failure::WorkBound); + return; + } + if (event_index % state.parameters.consolidation_interval == 0) + Consolidate (state); + if (state.disabled) + return; + } + state.last_published_generation = event_index; + state.last_event_index = event_index; + state.metrics.restart_rows_visited = rows.size (); + state.metrics.restart_rebuild_linear_history = !rows.empty (); + state.metrics.restart_production_gate = rows.empty (); + state.metrics.restart_rebuild_ms + = std::chrono::duration_cast< + std::chrono::duration> ( + std::chrono::steady_clock::now () - started) + .count (); + } + catch (...) + { + Disable (state, Failure::RebuildFailure); + } +} + +inline std::shared_ptr +Initialize (const ProcessorContext &context, Store *store, double focus, + double sensitivity, double stability) +{ + if (!internal::experimental_env::Flag ( + "CORTEXT_BOUNDED_ACTIVATION_SHADOW")) + return nullptr; + auto ®istry = Registry (); + std::lock_guard lock (registry.mutex); + auto &state = registry.states[&context]; + if (state) + return state; + state = std::make_shared ( + DeriveParameters (focus, sensitivity, stability)); + registry.enabled_count.fetch_add (1, std::memory_order_relaxed); + if (!store) + { + state->available = true; + return state; + } + try + { + const long long row_count + = ExtractCount (store->Execute ("SELECT COUNT(*) AS n FROM signals")); + if (row_count == 0) + state->available = true; + else + { + state->restart_rebuild_required = true; + if (internal::experimental_env::Flag ( + "CORTEXT_BOUNDED_ACTIVATION_SHADOW_REBUILD")) + RebuildFromPersistentAuthority (*state, *store); + } + } + catch (...) + { + Disable (*state, Failure::RebuildFailure); + } + return state; +} + +inline void +Erase (const ProcessorContext &context) +{ + auto ®istry = Registry (); + std::lock_guard lock (registry.mutex); + if (registry.states.erase (&context) > 0) + registry.enabled_count.fetch_sub (1, std::memory_order_relaxed); +} + +inline Snapshot +ReadSnapshot (const State &state) +{ + return { state.parameters, + state.available, + state.disabled, + state.restart_rebuild_required, + state.failure, + state.last_published_generation, + state.last_event_index, + state.root_count, + state.leaf_count, + state.allocated_bytes, + state.metrics, + StateDigest (state) }; +} + +inline std::vector +Snapshots () +{ + auto ®istry = Registry (); + std::lock_guard lock (registry.mutex); + std::vector snapshots; + snapshots.reserve (registry.states.size ()); + for (const auto &[_, state] : registry.states) + snapshots.push_back (ReadSnapshot (*state)); + return snapshots; +} + +inline std::optional +SingleWorkSnapshot () +{ + auto ®istry = Registry (); + if (registry.enabled_count.load (std::memory_order_relaxed) == 0) + return std::nullopt; + std::lock_guard lock (registry.mutex); + if (registry.states.size () != 1 || !registry.states.begin ()->second) + return std::nullopt; + const auto &state = *registry.states.begin ()->second; + return WorkSnapshot { state.available, + state.disabled, + state.failure, + state.last_published_generation, + state.last_event_index, + state.root_count, + state.leaf_count, + state.metrics }; +} + +#if defined(CORTEXT_TESTING) +inline void +SetFailureStageForTest (int stage) +{ + g_failure_stage.store (stage, std::memory_order_relaxed); +} + +inline std::vector +SnapshotsForTest () +{ + return Snapshots (); +} + +inline std::size_t +RegistrySizeForTest () +{ + auto ®istry = Registry (); + std::lock_guard lock (registry.mutex); + return registry.states.size (); +} +#endif + +} // namespace cortext::operations::bounded_activation_shadow_internal diff --git a/src/operations/competition.cpp b/src/operations/competition.cpp index 8cbbc0a5..dc7b444c 100644 --- a/src/operations/competition.cpp +++ b/src/operations/competition.cpp @@ -1,6 +1,9 @@ #include "cortext/operations/competition.hpp" +#include "../experimental_env.hpp" #include "neuromodulator_internal.hpp" +#include "execution_cache_sidecar_internal.hpp" +#include "rif_state_internal.hpp" #include "cortext/store/store.hpp" #include "cortext/store/utils.hpp" #include "cortext/core/algorithms.hpp" @@ -14,7 +17,6 @@ #include #include #include -#include #include #include @@ -24,7 +26,12 @@ namespace cortext::operations namespace { using SteadyClock = std::chrono::steady_clock; -constexpr std::size_t kCompetitionSqlChunkSize = 400; + +bool +ProfileWorkCountersEnabled () +{ + return internal::experimental_env::Flag ("CORTEXT_PROFILE_WORK_COUNTERS"); +} double ElapsedMillis (SteadyClock::time_point start) @@ -33,35 +40,6 @@ ElapsedMillis (SteadyClock::time_point start) .count (); } -std::string -Placeholders (std::size_t count) -{ - std::string text; - text.reserve (count * 2); - for (std::size_t i = 0; i < count; ++i) - { - if (i > 0) - { - text += ","; - } - text += "?"; - } - return text; -} - -std::vector -ChunkParams (const std::vector &ids, std::size_t begin, - std::size_t end) -{ - std::vector params; - params.reserve (end - begin); - for (std::size_t i = begin; i < end; ++i) - { - params.push_back (ids[i]); - } - return params; -} - /// @brief Computes suppression per retrieval based on Stability. inline double SuppressionPerRetrieval (double F, double S, double T, @@ -88,165 +66,50 @@ void ApplyRIFRecovery (OperationContext &context, Transaction &tx, long long now_ts, double recovery_time) { - auto &active_ids - = context.GetProcessorContext ().retrieval_suppression_embedding_ids; - auto &active_memory_ids - = context.GetProcessorContext ().retrieval_suppression_memory_ids; - if (active_ids.empty () && active_memory_ids.empty ()) - { - return; - } - const auto start = SteadyClock::now (); - std::vector memory_ids (active_memory_ids.begin (), - active_memory_ids.end ()); - std::unordered_set still_active_memory_ids; - still_active_memory_ids.reserve (memory_ids.size ()); - - for (std::size_t begin = 0; begin < memory_ids.size (); - begin += kCompetitionSqlChunkSize) + auto sidecar = execution_cache_sidecar_internal::Ensure ( + context.GetProcessorContext ()); + if (!sidecar->rif_active_epoch.valid) { - const std::size_t end - = std::min (memory_ids.size (), begin + kCompetitionSqlChunkSize); - const std::string placeholders = Placeholders (end - begin); - - std::vector update_params; - update_params.reserve ((end - begin) + 12); - update_params.push_back (now_ts); - update_params.push_back (now_ts); - update_params.push_back (recovery_time); - update_params.push_back (now_ts); - update_params.push_back (recovery_time); - update_params.push_back (now_ts); - update_params.push_back (now_ts); - update_params.push_back (recovery_time); - update_params.push_back (now_ts); - update_params.push_back (recovery_time); - update_params.push_back (now_ts); - for (std::size_t i = begin; i < end; ++i) - { - update_params.push_back (memory_ids[i]); - } - - tx.Execute ( - "UPDATE memories " - "SET strength = MAX(0.0, strength + (" - " suppression * (" - " CASE " - " WHEN (? - COALESCE(suppression_ts, 0)) <= 0 THEN 0.0 " - " WHEN (? - COALESCE(suppression_ts, 0)) >= ? THEN 1.0 " - " ELSE ((? - COALESCE(suppression_ts, 0)) * 1.0 / ?) " - " END" - " )" - ")), " - "suppression = MAX(0.0, suppression - (suppression * (" - " CASE " - " WHEN (? - COALESCE(suppression_ts, 0)) <= 0 THEN 0.0 " - " WHEN (? - COALESCE(suppression_ts, 0)) >= ? THEN 1.0 " - " ELSE ((? - COALESCE(suppression_ts, 0)) * 1.0 / ?) " - " END" - " ))), " - "suppression_ts = ? " - "WHERE memory_id IN (" + placeholders + ") " - " AND COALESCE(suppression, 0.0) > 0.0", - update_params); - - auto rows = tx.Execute ( - "SELECT memory_id FROM memories " - "WHERE memory_id IN (" + placeholders + ") " - " AND COALESCE(suppression, 0.0) > 1e-9", - ChunkParams (memory_ids, begin, end)); - for (const auto &row : rows) - { - auto it = row.find ("memory_id"); - if (it == row.end ()) - { - continue; - } - const auto id = store::AnyToLongLong (it->second); - if (id.has_value () && *id > 0) - { - still_active_memory_ids.insert (*id); - } - } - } - active_memory_ids.swap (still_active_memory_ids); - - std::vector ids (active_ids.begin (), active_ids.end ()); - std::unordered_set still_active; - still_active.reserve (ids.size ()); - - for (std::size_t begin = 0; begin < ids.size (); - begin += kCompetitionSqlChunkSize) - { - const std::size_t end - = std::min (ids.size (), begin + kCompetitionSqlChunkSize); - const std::string placeholders = Placeholders (end - begin); - - std::vector update_params; - update_params.reserve ((end - begin) + 12); - update_params.push_back (now_ts); - update_params.push_back (now_ts); - update_params.push_back (recovery_time); - update_params.push_back (now_ts); - update_params.push_back (recovery_time); - update_params.push_back (now_ts); - update_params.push_back (now_ts); - update_params.push_back (recovery_time); - update_params.push_back (now_ts); - update_params.push_back (recovery_time); - update_params.push_back (now_ts); - for (std::size_t i = begin; i < end; ++i) - { - update_params.push_back (ids[i]); - } - - tx.Execute ( - "UPDATE memories " - "SET strength = MAX(0.0, strength + (" - " suppression * (" - " CASE " - " WHEN (? - COALESCE(suppression_ts, 0)) <= 0 THEN 0.0 " - " WHEN (? - COALESCE(suppression_ts, 0)) >= ? THEN 1.0 " - " ELSE ((? - COALESCE(suppression_ts, 0)) * 1.0 / ?) " - " END" - " )" - ")), " - "suppression = MAX(0.0, suppression - (suppression * (" - " CASE " - " WHEN (? - COALESCE(suppression_ts, 0)) <= 0 THEN 0.0 " - " WHEN (? - COALESCE(suppression_ts, 0)) >= ? THEN 1.0 " - " ELSE ((? - COALESCE(suppression_ts, 0)) * 1.0 / ?) " - " END" - " ))), " - "suppression_ts = ? " - "WHERE embedding_id IN (" + placeholders + ") " - " AND COALESCE(suppression, 0.0) > 0.0", - update_params); - - auto rows = tx.Execute ( - "SELECT embedding_id FROM memories " - "WHERE embedding_id IN (" + placeholders + ") " - " AND COALESCE(suppression, 0.0) > 1e-9", - ChunkParams (ids, begin, end)); - for (const auto &row : rows) - { - auto it = row.find ("embedding_id"); - if (it == row.end ()) - { - continue; - } - const auto id = store::AnyToLongLong (it->second); - if (id.has_value () && *id > 0) - { - still_active.insert (*id); - } - } + sidecar->rif_active_epoch.active_rows = rif_state_internal::CountRows ( + tx, + "SELECT COUNT(*) AS row_count FROM rif_active_state a " + "JOIN rif_recovery_clock c ON c.generation = a.generation " + "WHERE c.singleton = 1"); + sidecar->rif_active_epoch.pending_rebuild = true; } - - active_ids.swap (still_active); + const auto calibration_memory_ids + = sidecar->rif_active_epoch.calibration_memory_ids; + const auto result = rif_state_internal::AdvanceRecovery ( + tx, now_ts, recovery_time, calibration_memory_ids); + sidecar->rif_active_epoch.calibration_memory_ids.clear (); + rif_active_epoch_cache_internal::StageClock ( + sidecar->rif_active_epoch, result.clock.generation, + result.clock.log_factor, result.clock.last_ts); + rif_active_epoch_cache_internal::StageMemories ( + sidecar->rif_active_epoch, result.changed_memory_ids); + if (result.generation_reset) + sidecar->rif_active_epoch.active_rows = 0; + else + sidecar->rif_active_epoch.active_rows + -= std::min (sidecar->rif_active_epoch.active_rows, + result.expired_rows); + auto &p_ctx = context.GetProcessorContext (); + p_ctx.retrieval_suppression_embedding_ids.clear (); + p_ctx.retrieval_suppression_memory_ids.clear (); context.AddOperationTiming ("Competition.rif_recovery_active_sql", ElapsedMillis (start)); + if (ProfileWorkCountersEnabled ()) + { + const double touched + = static_cast (result.expired_rows + result.retired_rows + 1); + context.AddOperationTiming ("Competition.rows_visited", touched); + context.AddOperationTiming ("Competition.rows_touched", touched); + context.AddOperationTiming ("Competition.rows_visited_activity", + touched > 0.0 ? 1.0 : 0.0); + context.AddOperationTiming ("Competition.rows_touched_activity", + touched > 0.0 ? 1.0 : 0.0); + } } struct Candidate @@ -289,8 +152,8 @@ ApplyLateralInhibition (const std::vector &winners, double focus, double sensitivity, double stability, double competition_scale, long long now_ts, Transaction &tx, - std::unordered_set &active_ids, - std::unordered_set &active_memory_ids, + rif_active_epoch_cache_internal::State &epoch, + std::size_t &active_rows, int &suppressed_count) { for (const auto &loser : losers) @@ -312,26 +175,15 @@ ApplyLateralInhibition (const std::vector &winners, { continue; } - // v2: RIF state merged into memories table (suppression, suppression_ts) - tx.Execute ("UPDATE memories " - "SET suppression = suppression + ?, " - " suppression_ts = ?, " - " suppression_count = suppression_count + 1, " - " strength = MAX(0.0, strength - ?) " - + std::string (loser.memory_id > 0 - ? "WHERE memory_id = ?;" - : "WHERE embedding_id = ?;"), - { total_supp, now_ts, total_supp, - loser.memory_id > 0 ? loser.memory_id - : loser.embedding_id }); - if (loser.memory_id > 0) - { - active_memory_ids.insert (loser.memory_id); - } - else if (loser.embedding_id > 0) - { - active_ids.insert (loser.embedding_id); - } + const auto memory_id = rif_state_internal::ResolveMemoryId ( + tx, loser.memory_id, loser.embedding_id); + if (!memory_id.has_value ()) + continue; + if (rif_state_internal::SuppressMemory ( + tx, *memory_id, total_supp, now_ts)) + ++active_rows; + rif_active_epoch_cache_internal::StageMemory ( + epoch, *memory_id); ++suppressed_count; } } @@ -378,8 +230,21 @@ ApplyRetrievalCompetition::Execute (OperationContext &context, } if (retrieval_candidates.empty ()) { + context.AddOperationTiming ("Competition.score_candidates", 0.0); + if (ProfileWorkCountersEnabled ()) + { + context.AddOperationTiming ("Competition.candidate_count", 0.0); + context.AddOperationTiming ("Competition.candidate_activity", 0.0); + } return; } + if (ProfileWorkCountersEnabled ()) + { + context.AddOperationTiming ( + "Competition.candidate_count", + static_cast (retrieval_candidates.size ())); + context.AddOperationTiming ("Competition.candidate_activity", 1.0); + } const long long now_ts = static_cast (context.GetSignal ().timestamp); const double recovery_time = core::RetrievalCompetitionRecoverySeconds ( @@ -389,7 +254,10 @@ ApplyRetrievalCompetition::Execute (OperationContext &context, const double competition_scale = neuromodulation::RetrievalCompetitionScale (p_ctx.neuromod_ne); + const auto score_start = SteadyClock::now (); std::vector cands = ScoreCandidates (retrieval_candidates, x_ctx); + context.AddOperationTiming ("Competition.score_candidates", + ElapsedMillis (score_start)); if (cands.empty ()) { return; @@ -404,12 +272,12 @@ ApplyRetrievalCompetition::Execute (OperationContext &context, return; } int suppressed_count = 0; - auto &active_suppression_ids = p_ctx.retrieval_suppression_embedding_ids; - auto &active_suppression_memory_ids = p_ctx.retrieval_suppression_memory_ids; + auto sidecar = execution_cache_sidecar_internal::Ensure (p_ctx); ApplyLateralInhibition (winners, losers, radius, cfg.focus, cfg.sensitivity, cfg.stability, competition_scale, now_ts, tx, - active_suppression_ids, - active_suppression_memory_ids, suppressed_count); + sidecar->rif_active_epoch, + sidecar->rif_active_epoch.active_rows, + suppressed_count); // Debug logging telemetry::LogDebug ("cortext.competition", { diff --git a/src/operations/consolidation.cpp b/src/operations/consolidation.cpp index 77c74f37..6636db82 100644 --- a/src/operations/consolidation.cpp +++ b/src/operations/consolidation.cpp @@ -63,7 +63,7 @@ ScoreConsolidation::Execute (OperationContext &context, Transaction &tx) const "), scored AS (" " SELECT m.memory_id, " " COALESCE(cme.embedding_id, m.embedding_id) AS embedding_id, " - " ((?1 * COALESCE(m.strength, 1.0)) " + " ((?1 * COALESCE(rif.strength, 1.0)) " " - (?2 * COALESCE(m.redundancy, 0.0)) " " + (?3 * CASE WHEN max_cnt.maximum > 0 " " THEN CAST(ec.cnt AS REAL) / max_cnt.maximum " @@ -75,6 +75,7 @@ ScoreConsolidation::Execute (OperationContext &context, Transaction &tx) const " COALESCE(cme.embedding, e.embedding) AS embedding, " " m.created_at " " FROM memories m " + " JOIN rif_effective_memories rif ON rif.memory_id = m.memory_id " " JOIN embeddings e ON m.embedding_id = e.embedding_id " " LEFT JOIN current_memory_embeddings cme " " ON cme.memory_id = m.memory_id " diff --git a/src/operations/consolidation_epoch_profile_internal.hpp b/src/operations/consolidation_epoch_profile_internal.hpp new file mode 100644 index 00000000..433800c5 --- /dev/null +++ b/src/operations/consolidation_epoch_profile_internal.hpp @@ -0,0 +1,290 @@ +#pragma once + +#include "cortext/processor/processor_context.hpp" +#include "../store/mutation_audit_internal.hpp" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace cortext::operations::consolidation_epoch_profile_internal +{ + +struct Counters +{ + std::uint64_t accumulator_signal_count = 0; + std::uint64_t working_memory_pending_signal_count = 0; + std::uint64_t consolidation_dirty_memory_count = 0; + std::uint64_t consolidation_dirty_association_count = 0; + std::uint64_t consolidation_dirty_index_count = 0; +}; + +struct EventSnapshot +{ + std::uint64_t epoch_id = 0; + std::uint64_t events_since_epoch_start = 0; + Counters counters; +}; + +struct SealSnapshot +{ + std::uint64_t closed_epoch_id = 0; + std::uint64_t sealed_epoch_event_count = 0; + std::uint64_t sealed_epoch_mutation_count = 0; + std::uint64_t sealed_mutation_identity_count = 0; + bool sealed_mutation_identity_verified = false; + Counters pre; + Counters post; +}; + +struct TypedIdentitySets +{ + std::unordered_set dirty_memories; + std::unordered_set dirty_associations; + std::unordered_set dirty_indexes; +}; + +struct State +{ + std::uint64_t epoch_id = 0; + std::uint64_t events_since_epoch_start = 0; + TypedIdentitySets trigger_identities; + TypedIdentitySets hook_identities; + bool trigger_journal_ready = true; + std::unordered_map working_memory_baseline; +}; + +struct RegistryState +{ + std::mutex mutex; + std::unordered_map states; +}; + +inline RegistryState & +Registry () +{ + static auto *registry = new RegistryState (); + return *registry; +} + +inline bool +Enabled () +{ + const char *value = std::getenv ("CORTEXT_PROFILE_CONSOLIDATION_EPOCH"); + return value != nullptr && value[0] != '\0' && std::string_view (value) != "0" + && std::string_view (value) != "false"; +} + +inline std::string +IdentityKey (const internal::SQLiteMutationIdentity &identity) +{ + return std::to_string (static_cast (identity.kind)) + ":" + + identity.logical_identity; +} + +inline void +AddMutations (TypedIdentitySets &sets, + const std::vector &mutations) +{ + for (const auto &mutation : mutations) + { + const std::string key = IdentityKey (mutation); + if (mutation.kind == internal::SQLiteMutationKind::Memory) + sets.dirty_memories.insert (key); + else if (mutation.kind == internal::SQLiteMutationKind::Association) + sets.dirty_associations.insert (key); + else if (mutation.kind == internal::SQLiteMutationKind::Index) + sets.dirty_indexes.insert (key); + } +} + +inline bool +EqualIdentitySets (const TypedIdentitySets &lhs, + const TypedIdentitySets &rhs) +{ + return lhs.dirty_memories == rhs.dirty_memories + && lhs.dirty_associations == rhs.dirty_associations + && lhs.dirty_indexes == rhs.dirty_indexes; +} + +inline std::uint64_t +IdentitySetCount (const TypedIdentitySets &sets) +{ + return static_cast (sets.dirty_memories.size ()) + + static_cast (sets.dirty_associations.size ()) + + static_cast (sets.dirty_indexes.size ()); +} + +inline std::uint64_t +DistinctTypedMutationCount ( + const std::vector &mutations) +{ + std::unordered_set identities; + identities.reserve (mutations.size ()); + for (const auto &mutation : mutations) + identities.insert (IdentityKey (mutation)); + return static_cast (identities.size ()); +} + +inline std::uint64_t +AccumulatorSignalCount (const ProcessorContext &ctx) +{ + std::uint64_t count = 0; + for (const auto &[source_id, accumulator] : ctx.accumulator_states) + { + (void)source_id; + count += static_cast (accumulator.signals.size ()); + } + return count; +} + +inline long long +WorkingMemoryKey (const ProcessorContext::WMSlot &slot, std::size_t index) +{ + if (slot.memory_id > 0) + return slot.memory_id; + return std::numeric_limits::min () + + static_cast (index); +} + +inline std::uint64_t +WorkingMemoryPendingSignalCount (const ProcessorContext &ctx, + const State &state) +{ + std::uint64_t count = 0; + for (std::size_t index = 0; index < ctx.wm_slots.size (); ++index) + { + const auto &slot = ctx.wm_slots[index]; + const auto baseline = state.working_memory_baseline.find ( + WorkingMemoryKey (slot, index)); + const std::size_t baseline_count + = baseline == state.working_memory_baseline.end () + ? 0 + : baseline->second; + if (slot.signal_records.size () > baseline_count) + count += static_cast ( + slot.signal_records.size () - baseline_count); + } + return count; +} + +inline void +CaptureWorkingMemoryBaseline (const ProcessorContext &ctx, State &state) +{ + state.working_memory_baseline.clear (); + state.working_memory_baseline.reserve (ctx.wm_slots.size ()); + for (std::size_t index = 0; index < ctx.wm_slots.size (); ++index) + { + const auto &slot = ctx.wm_slots[index]; + state.working_memory_baseline.emplace ( + WorkingMemoryKey (slot, index), slot.signal_records.size ()); + } +} + +inline Counters +CurrentCounters (const ProcessorContext &ctx, const State &state) +{ + return { + AccumulatorSignalCount (ctx), + WorkingMemoryPendingSignalCount (ctx, state), + static_cast ( + state.trigger_identities.dirty_memories.size ()), + static_cast ( + state.trigger_identities.dirty_associations.size ()), + static_cast ( + state.trigger_identities.dirty_indexes.size ()), + }; +} + +inline void +Reset (const ProcessorContext &ctx) +{ + if (!Enabled ()) + return; + auto ®istry = Registry (); + std::lock_guard lock (registry.mutex); + State state; + CaptureWorkingMemoryBaseline (ctx, state); + registry.states[&ctx] = std::move (state); +} + +inline EventSnapshot +ObserveEvent (const ProcessorContext &ctx, + const internal::SQLiteMutationAuditBatch &mutations) +{ + auto ®istry = Registry (); + std::lock_guard lock (registry.mutex); + auto &state = registry.states[&ctx]; + AddMutations (state.trigger_identities, + mutations.committed_trigger_identities); + AddMutations (state.hook_identities, mutations.committed_hook_identities); + state.trigger_journal_ready + = state.trigger_journal_ready && mutations.trigger_journal_ready; + ++state.events_since_epoch_start; + return { state.epoch_id, state.events_since_epoch_start, + CurrentCounters (ctx, state) }; +} + +inline EventSnapshot +Current (const ProcessorContext &ctx) +{ + auto ®istry = Registry (); + std::lock_guard lock (registry.mutex); + const auto it = registry.states.find (&ctx); + if (it == registry.states.end ()) + return {}; + return { it->second.epoch_id, it->second.events_since_epoch_start, + CurrentCounters (ctx, it->second) }; +} + +inline SealSnapshot +Seal (const ProcessorContext &ctx, + const internal::SQLiteMutationAuditBatch &mutations) +{ + auto ®istry = Registry (); + std::lock_guard lock (registry.mutex); + auto &state = registry.states[&ctx]; + const Counters pre = CurrentCounters (ctx, state); + State sealed = state; + AddMutations (sealed.trigger_identities, + mutations.committed_trigger_identities); + AddMutations (sealed.hook_identities, mutations.committed_hook_identities); + sealed.trigger_journal_ready + = sealed.trigger_journal_ready && mutations.trigger_journal_ready; + const std::uint64_t mutation_count + = IdentitySetCount (sealed.trigger_identities); + const std::uint64_t identity_count + = IdentitySetCount (sealed.hook_identities); + const bool identities_verified + = sealed.trigger_journal_ready + && EqualIdentitySets (sealed.trigger_identities, + sealed.hook_identities); + const std::uint64_t closed_epoch_id = state.epoch_id; + const std::uint64_t event_count = state.events_since_epoch_start; + state.trigger_identities = {}; + state.hook_identities = {}; + state.trigger_journal_ready = true; + CaptureWorkingMemoryBaseline (ctx, state); + ++state.epoch_id; + state.events_since_epoch_start = 0; + return { closed_epoch_id, event_count, mutation_count, identity_count, + identities_verified, pre, CurrentCounters (ctx, state) }; +} + +inline void +Erase (const ProcessorContext &ctx) +{ + auto ®istry = Registry (); + std::lock_guard lock (registry.mutex); + registry.states.erase (&ctx); +} + +} // namespace cortext::operations::consolidation_epoch_profile_internal diff --git a/src/operations/consolidation_shallow.cpp b/src/operations/consolidation_shallow.cpp index 653f3d98..bbe98605 100644 --- a/src/operations/consolidation_shallow.cpp +++ b/src/operations/consolidation_shallow.cpp @@ -1,6 +1,7 @@ #include "cortext/internal/cancellation.hpp" #include "cortext/operations/consolidation_shallow.hpp" #include "historical_surface_search_cache_internal.hpp" +#include "emotional_metadata_cache_internal.hpp" #include "cortext/core/algorithms.hpp" #include "cortext/core/knobs.hpp" @@ -218,6 +219,11 @@ ConsolidationShallow::Execute (OperationContext &context, Transaction &tx) const static_cast (now_ts) }); auto &p_ctx = context.GetProcessorContext (); + emotional_metadata_cache_internal::Upsert ( + p_ctx, + { centroid_memory_id, centroid_embedding_id, + static_cast (now_ts), false, 0.0, 0.0, 0.0, 0, + 0.0 }); p_ctx.UpsertAssociationCache ( centroid_memory_id, centroid_embedding_id, centroid_vec, true); ProcessorContext::RetrievalSurfaceEntry surface_entry; diff --git a/src/operations/detect_memory_usage.cpp b/src/operations/detect_memory_usage.cpp index f69f2d80..a9c787f6 100644 --- a/src/operations/detect_memory_usage.cpp +++ b/src/operations/detect_memory_usage.cpp @@ -1,6 +1,7 @@ #include "cortext/operations/detect_memory_usage.hpp" #include "neuromodulator_internal.hpp" +#include "signal_record_rollback_internal.hpp" #include "cortext/core/algorithms.hpp" #include "cortext/core/knobs.hpp" #include "cortext/processor/operation_context.hpp" @@ -191,6 +192,9 @@ DetectMemoryUsage::Execute (OperationContext &context, Transaction &tx) const const double gain = neuromodulation::ValueUpdateGain (p_ctx.neuromod_da); + signal_record_rollback_internal:: + PreserveProceduralValueBeforeUpdate ( + p_ctx, key, event.memory_id); double &q = p_ctx.procedural_store[key][event.memory_id]; q = core::Clamp (q + gain * std::max (0.0, p_ctx.delta_reward), 0.0, 1.0); diff --git a/src/operations/emotion.cpp b/src/operations/emotion.cpp index 35eec1c5..828ef365 100644 --- a/src/operations/emotion.cpp +++ b/src/operations/emotion.cpp @@ -4,6 +4,7 @@ #include "cortext/core/algorithms.hpp" #include "cortext/core/knobs.hpp" #include "cortext/processor/operation_context.hpp" +#include "emotional_metadata_cache_internal.hpp" #include "../experimental_env.hpp" #include @@ -133,6 +134,9 @@ ApplyEmotionalConsolidation::Execute (OperationContext &context, Transaction &tx "WHERE embedding_id = ?;", { flashbulb, mem_emotion, half_life_bonus, detail_suppression, gist_components, cascade_radius, cascade_decay, id }); + emotional_metadata_cache_internal::OverwriteEmbedding ( + p_ctx, id, flashbulb != 0, mem_emotion, half_life_bonus, + cascade_radius, cascade_decay); } } // namespace cortext::operations diff --git a/src/operations/emotion_cascade.cpp b/src/operations/emotion_cascade.cpp index 9f729b8f..0b17cc82 100644 --- a/src/operations/emotion_cascade.cpp +++ b/src/operations/emotion_cascade.cpp @@ -5,10 +5,18 @@ #include "cortext/processor/operation_context.hpp" #include "cortext/store/store.hpp" #include "cortext/telemetry/telemetry.hpp" +#include "association_fanout_cache_internal.hpp" +#include "emotional_metadata_cache_internal.hpp" +#include "../experimental_env.hpp" #include #include +#include +#include #include +#include #include +#include +#include #include #include @@ -38,6 +46,7 @@ Add (Transaction &tx, const std::string &q, /// @brief Structure for emotional source memories. struct EmotionalSource { + long long memory_id; long long embedding_id; double intensity; double arousal; @@ -52,20 +61,25 @@ struct EmotionalSource std::vector LoadEmotionalSources (Store *store, long long recent_window_ts, double theta_intensity, double theta_arousal, - const EmotionCascadeParams &fallback) + const EmotionCascadeParams &fallback, + std::size_t *accepted_count) { std::vector sources; // v2: Query memories for high-intensity flashbulb memories // Only process recently tagged ones (within consolidation window) auto rows = store->Execute ( - "SELECT embedding_id, emotional_intensity, half_life_bonus, " - " cascade_radius, cascade_decay " - "FROM memories " + "SELECT source.embedding_id, source.emotional_intensity, " + " source.half_life_bonus, source.cascade_radius, " + " source.cascade_decay, " + " (SELECT resolved.memory_id FROM memories resolved " + " WHERE resolved.embedding_id = source.embedding_id LIMIT 1) " + " AS traversal_memory_id " + "FROM memories source " "WHERE flashbulb = 1 AND emotional_intensity >= ?1 " "AND s_arousal_avg >= ?2 " "AND created_at >= ?3 " - "ORDER BY emotional_intensity DESC", + "ORDER BY emotional_intensity DESC, source.memory_id ASC", { theta_intensity, theta_arousal, recent_window_ts }); for (const auto &row : rows) @@ -84,6 +98,13 @@ LoadEmotionalSources (Store *store, long long recent_window_ts, } EmotionalSource s; + const auto it_memory_id = row.find ("traversal_memory_id"); + if (it_memory_id == row.end () + || it_memory_id->second.type () != typeid (long long)) + { + continue; + } + s.memory_id = std::any_cast (it_memory_id->second); s.embedding_id = std::any_cast (it_id->second); if (it_intensity->second.type () == typeid (double)) @@ -131,11 +152,58 @@ LoadEmotionalSources (Store *store, long long recent_window_ts, } sources.push_back (s); + if (accepted_count) + ++*accepted_count; } return sources; } +std::vector +LoadEmotionalSourcesFromCache (const ProcessorContext &p_ctx, + long long recent_window_ts, + double theta_intensity, + double theta_arousal, + const EmotionCascadeParams &fallback, + std::size_t *accepted_count) +{ + const auto state + = emotional_metadata_cache_internal::FindState (p_ctx); + std::vector sources; + if (!state || !state->emotional_metadata.valid) + return sources; + const auto &cache = state->emotional_metadata; + for (const long long memory_id : cache.source_query_order) + { + const auto row_it = cache.rows_by_memory.find (memory_id); + if (row_it == cache.rows_by_memory.end ()) + continue; + const auto &row = row_it->second; + if (!row.flashbulb || row.intensity < theta_intensity + || row.arousal < theta_arousal + || row.created_at < recent_window_ts) + continue; + const auto members = cache.memory_ids_by_embedding.find (row.embedding_id); + if (members == cache.memory_ids_by_embedding.end () + || members->second.empty ()) + continue; + sources.push_back ( + { members->second.front (), row.embedding_id, row.intensity, 0.5, + 0.5, row.half_life_bonus, + row.cascade_radius > 0 ? row.cascade_radius + : fallback.cascade_radius, + row.cascade_decay > 0.0 ? row.cascade_decay + : fallback.cascade_decay }); + if (accepted_count) + ++*accepted_count; + } + std::stable_sort (sources.begin (), sources.end (), + [] (const auto &left, const auto &right) { + return left.intensity > right.intensity; + }); + return sources; +} + /// @brief Structure for cascade neighbor. struct CascadeNeighbor { @@ -143,94 +211,271 @@ struct CascadeNeighbor int depth; }; -/// @brief Find neighbor embedding IDs via graph traversal. -/// V2: Traverses ASSOCIATIONS table using memory_ids, returns embedding_ids. -std::vector -FindCascadeNeighbors (Store *store, long long source_embedding_id, int max_depth) -{ - std::vector neighbors; +using CurrentEmotionalValues + = execution_cache_sidecar_internal::EmotionalEmbeddingValues; - // V2: First find the memory_id for this embedding_id - auto mem_rows = store->Execute ( - "SELECT memory_id FROM memories WHERE embedding_id = ?", - { source_embedding_id }); +using AssociationFanoutCache = ProcessorContext::AssociationFanoutCache; - if (mem_rows.empty ()) - { - return neighbors; - } +bool +MatchesCascadeFixedPointInputs (const ProcessorContext &p_ctx, + long long recent_window_ts, + double theta_intensity, double theta_arousal, + double intensity_floor, + const EmotionCascadeParams ¶ms) +{ + const auto state + = emotional_metadata_cache_internal::FindState (p_ctx); + if (!state) + return false; + const auto &fixed = state->emotional_fixed_point; + const auto &metadata = state->emotional_metadata; + return fixed.valid && metadata.valid + && fixed.emotional_input_generation + == metadata.cascade_input_generation + && recent_window_ts >= fixed.recent_window_ts + && theta_intensity == fixed.theta_intensity + && theta_arousal == fixed.theta_arousal + && intensity_floor == fixed.intensity_floor + && params.cascade_radius == fixed.cascade_radius + && params.cascade_decay == fixed.cascade_decay; +} - long long source_memory_id = 0; - auto it_mem = mem_rows[0].find ("memory_id"); - if (it_mem != mem_rows[0].end () && it_mem->second.type () == typeid (long long)) - { - source_memory_id = std::any_cast (it_mem->second); - } - else - { - return neighbors; - } +bool +MatchesCascadeFixedPoint (const ProcessorContext &p_ctx, + const AssociationFanoutCache &fanout, + long long recent_window_ts, + double theta_intensity, double theta_arousal, + double intensity_floor, + const EmotionCascadeParams ¶ms) +{ + const auto state + = emotional_metadata_cache_internal::FindState (p_ctx); + if (!state + || !MatchesCascadeFixedPointInputs ( + p_ctx, recent_window_ts, theta_intensity, theta_arousal, + intensity_floor, params)) + return false; + const auto &fixed = state->emotional_fixed_point; + return fixed.association_edge_count == fanout.edge_count + && fixed.association_source_sum == fanout.source_sum + && fixed.association_target_sum == fanout.target_sum + && fixed.association_source_max == fanout.source_max + && fixed.association_target_max == fanout.target_max + && fixed.association_weight_sum_micros == fanout.weight_sum_micros + && fixed.association_last_reinforced_sum + == fanout.last_reinforced_sum; +} - // V2: Traverse ASSOCIATIONS via recursive CTE using memory_ids - auto rows = store->Execute ( - "WITH RECURSIVE cascade(memory_id, depth) AS ( " - " SELECT ?1, 0 " - " UNION " - " SELECT a.target_memory_id, cascade.depth + 1 " - " FROM associations a " - " JOIN cascade ON a.source_memory_id = cascade.memory_id " - " WHERE cascade.depth < ?2 " - " UNION " - " SELECT a.source_memory_id, cascade.depth + 1 " - " FROM associations a " - " JOIN cascade ON a.target_memory_id = cascade.memory_id " - " WHERE cascade.depth < ?2 " - ") " - "SELECT DISTINCT m.embedding_id, MIN(c.depth) AS min_depth " - "FROM cascade c " - "JOIN memories m ON c.memory_id = m.memory_id " - "WHERE c.depth > 0 AND m.embedding_id IS NOT NULL " - "GROUP BY m.embedding_id", - { source_memory_id, static_cast (max_depth) }); +bool +AssociationChangesCanReachCascade ( + const execution_cache_sidecar_internal::State &state) +{ + const auto &changes = state.association_topology_changes; + const auto &footprint = state.emotional_cascade_topology_footprint; + if (changes.reset || !footprint.valid) + return true; + for (const auto &[source_memory_id, target_memory_id] : + changes.inserted_edges) + for (const auto &expandable : footprint.expandable_by_source) + if (expandable.contains (source_memory_id) + || expandable.contains (target_memory_id)) + return true; + return false; +} - for (const auto &row : rows) - { - auto it_id = row.find ("embedding_id"); - auto it_depth = row.find ("min_depth"); +void +ConsumeAssociationTopologyChanges ( + execution_cache_sidecar_internal::State &state) +{ + state.association_topology_changes.reset = false; + state.association_topology_changes.inserted_edges.clear (); +} - if (it_id == row.end () || it_depth == row.end ()) - { - continue; - } +void +RecordCascadeFixedPoint (ProcessorContext &p_ctx, + const AssociationFanoutCache &fanout, + std::uint64_t emotional_input_generation, + long long recent_window_ts, + double theta_intensity, double theta_arousal, + double intensity_floor, + const EmotionCascadeParams ¶ms) +{ + const auto state + = emotional_metadata_cache_internal::EnsureState (p_ctx); + auto &fixed = state->emotional_fixed_point; + fixed.valid = true; + fixed.emotional_input_generation = emotional_input_generation; + fixed.association_edge_count = fanout.edge_count; + fixed.association_source_sum = fanout.source_sum; + fixed.association_target_sum = fanout.target_sum; + fixed.association_source_max = fanout.source_max; + fixed.association_target_max = fanout.target_max; + fixed.association_weight_sum_micros = fanout.weight_sum_micros; + fixed.association_last_reinforced_sum = fanout.last_reinforced_sum; + fixed.recent_window_ts = recent_window_ts; + fixed.theta_intensity = theta_intensity; + fixed.theta_arousal = theta_arousal; + fixed.intensity_floor = intensity_floor; + fixed.cascade_radius = params.cascade_radius; + fixed.cascade_decay = params.cascade_decay; +} - if (it_id->second.type () != typeid (long long)) +/// @brief Find each source's shortest positive-depth neighbors while sharing +/// graph traversal across source-order batches. +std::vector> +FindCascadeNeighbors (const AssociationFanoutCache &cache, + const std::vector &sources, + const EmotionCascadeParams &fallback, + std::vector> + *expandable_by_source) +{ + std::vector> neighbors (sources.size ()); + if (expandable_by_source) + expandable_by_source->assign (sources.size (), {}); + constexpr std::size_t kSourcesPerBatch = 64; + for (std::size_t batch_begin = 0; batch_begin < sources.size (); + batch_begin += kSourcesPerBatch) + { + const std::size_t batch_size = std::min ( + kSourcesPerBatch, sources.size () - batch_begin); + std::vector active_by_depth (1, 0); + int batch_max_depth = 0; + std::unordered_map visited; + std::unordered_map frontier; + for (std::size_t local = 0; local < batch_size; ++local) { - continue; + const auto &source = sources[batch_begin + local]; + const int radius = source.cascade_radius > 0 + ? source.cascade_radius + : fallback.cascade_radius; + if (source.memory_id <= 0 || radius < 1) + continue; + batch_max_depth = std::max (batch_max_depth, radius); + active_by_depth.resize ( + static_cast (batch_max_depth + 1), 0); + const std::uint64_t bit = std::uint64_t { 1 } << local; + for (int depth = 1; depth <= radius; ++depth) + active_by_depth[static_cast (depth)] |= bit; + visited[source.memory_id] |= bit; + frontier[source.memory_id] |= bit; + if (expandable_by_source) + (*expandable_by_source)[batch_begin + local].insert ( + source.memory_id); } - CascadeNeighbor n; - n.embedding_id = std::any_cast (it_id->second); - - if (it_depth->second.type () == typeid (long long)) + std::unordered_map seen_embeddings; + for (int depth = 1; + depth <= batch_max_depth && !frontier.empty (); ++depth) { - n.depth = static_cast (std::any_cast (it_depth->second)); - } - else - { - n.depth = 1; + std::unordered_map next_frontier; + std::unordered_map reached_embeddings; + const std::uint64_t active + = active_by_depth[static_cast (depth)]; + auto visit_edges = [&] (const auto &fanout, long long memory_id, + std::uint64_t source_mask) { + const auto edge_it = fanout.find (memory_id); + if (edge_it == fanout.end ()) + return; + for (const auto &edge : edge_it->second) + { + if (edge.memory_id <= 0) + continue; + if (edge.embedding_id > 0) + reached_embeddings[edge.embedding_id] |= source_mask; + const std::uint64_t newly_visited + = source_mask & ~visited[edge.memory_id]; + if (newly_visited != 0) + { + visited[edge.memory_id] |= newly_visited; + next_frontier[edge.memory_id] |= newly_visited; + if (expandable_by_source + && depth < batch_max_depth) + { + std::uint64_t expandable + = newly_visited + & active_by_depth[static_cast ( + depth + 1)]; + while (expandable != 0) + { + const unsigned local + = std::countr_zero (expandable); + (*expandable_by_source)[batch_begin + local] + .insert (edge.memory_id); + expandable &= expandable - 1; + } + } + } + } + }; + for (const auto &[memory_id, frontier_mask] : frontier) + { + const std::uint64_t source_mask = frontier_mask & active; + if (source_mask == 0) + continue; + visit_edges (cache.out_by_source, memory_id, source_mask); + visit_edges (cache.in_by_target, memory_id, source_mask); + } + for (const auto &[embedding_id, reached] : reached_embeddings) + { + std::uint64_t unseen = reached & ~seen_embeddings[embedding_id]; + seen_embeddings[embedding_id] |= unseen; + while (unseen != 0) + { + const unsigned local = std::countr_zero (unseen); + neighbors[batch_begin + local].push_back ( + { embedding_id, depth }); + unseen &= unseen - 1; + } + } + frontier = std::move (next_frontier); } - - neighbors.push_back (n); } - return neighbors; } +std::unordered_map +LoadCurrentEmotionalValues (Store *store) +{ + std::unordered_map current; + auto rows = store->Execute ( + "SELECT embedding_id, MIN(emotional_intensity) AS current_intensity, " + " MIN(half_life_bonus) AS current_bonus " + "FROM memories WHERE embedding_id IS NOT NULL GROUP BY embedding_id"); + current.reserve (rows.size ()); + for (const auto &row : rows) + { + const auto id = store::AnyToLongLong (row.at ("embedding_id")); + if (!id) + continue; + current.emplace ( + *id, + CurrentEmotionalValues { + store::AnyToDouble (row.at ("current_intensity"), 0.0), + store::AnyToDouble (row.at ("current_bonus"), 0.0) }); + } + return current; +} + } // namespace void PropagateEmotionalCascade::Execute (OperationContext &context, Transaction &tx) const { + const bool profile_cascade = internal::experimental_env::Flag ( + "CORTEXT_PROFILE_EMOTIONAL_CASCADE"); + const auto total_start = std::chrono::steady_clock::now (); + auto record_timing = [&context, profile_cascade] ( + std::string_view name, + std::chrono::steady_clock::time_point start) { + if (profile_cascade) + { + context.AddOperationTiming ( + name, + std::chrono::duration ( + std::chrono::steady_clock::now () - start) + .count ()); + } + }; Store *store = context.GetStore (); if (!store) { @@ -252,80 +497,286 @@ PropagateEmotionalCascade::Execute (OperationContext &context, Transaction &tx) const long long recent_window_ts = std::max (0LL, now_ts - recent_window_ms); const double theta_intensity = core::ThetaIntensity (cfg.sensitivity); const double theta_arousal = core::ThetaArousal (cfg.sensitivity); - - // Load high-intensity emotional sources - auto sources - = LoadEmotionalSources (store, recent_window_ts, theta_intensity, - theta_arousal, params); const double intensity_floor = core::CascadeIntensityFloor ( cfg.focus, cfg.sensitivity, cfg.stability); + auto &p_ctx = context.GetProcessorContext (); + const auto emotional_state + = emotional_metadata_cache_internal::FindState (p_ctx); + const bool use_metadata_cache + = emotional_state && emotional_state->emotional_metadata.valid + && !internal::experimental_env::Flag ( + "CORTEXT_PROFILE_EMOTIONAL_METADATA_SQL"); + const std::uint64_t emotional_input_generation + = use_metadata_cache + ? emotional_state->emotional_metadata.cascade_input_generation + : 0; + + const auto cache_ensure_start = std::chrono::steady_clock::now (); + auto *fanout_cache = association_fanout_cache::Ensure (store, p_ctx); + const double cache_ensure_ms + = std::chrono::duration ( + std::chrono::steady_clock::now () - cache_ensure_start) + .count (); + + if (use_metadata_cache && fanout_cache && fanout_cache->valid + && !internal::experimental_env::Flag ( + "CORTEXT_DISABLE_EMOTIONAL_CASCADE_FIXED_POINT") + && (MatchesCascadeFixedPoint ( + p_ctx, *fanout_cache, recent_window_ts, theta_intensity, + theta_arousal, intensity_floor, params) + || (MatchesCascadeFixedPointInputs ( + p_ctx, recent_window_ts, theta_intensity, theta_arousal, + intensity_floor, params) + && emotional_state + && !AssociationChangesCanReachCascade (*emotional_state)))) + { + RecordCascadeFixedPoint ( + p_ctx, *fanout_cache, emotional_input_generation, + recent_window_ts, theta_intensity, theta_arousal, + intensity_floor, params); + ConsumeAssociationTopologyChanges (*emotional_state); + const auto telemetry_start = std::chrono::steady_clock::now (); + telemetry::LogDebug("cortext.emotion_cascade", { + telemetry::Attribute::Int64("cascade_sources", 0), + telemetry::Attribute::Int64("max_hops", 0) + }); + record_timing ("EmotionalCascade.telemetry", telemetry_start); + if (profile_cascade) + { + context.AddOperationTiming ("EmotionalCascade.source_query", 0.0); + context.AddOperationTiming ("EmotionalCascade.source_count", 0.0); + context.AddOperationTiming ( + "EmotionalCascade.source_execution_count", 0.0); + context.AddOperationTiming ("EmotionalCascade.source_activity", 0.0); + context.AddOperationTiming ("EmotionalCascade.neighbor_lookup", + cache_ensure_ms); + context.AddOperationTiming ("EmotionalCascade.cache_ensure", + cache_ensure_ms); + context.AddOperationTiming ("EmotionalCascade.cache_bfs", 0.0); + context.AddOperationTiming ("EmotionalCascade.current_values", 0.0); + context.AddOperationTiming ("EmotionalCascade.neighbor_count", 0.0); + context.AddOperationTiming ( + "EmotionalCascade.neighbor_execution_count", 0.0); + context.AddOperationTiming ("EmotionalCascade.neighbor_activity", 0.0); + context.AddOperationTiming ("EmotionalCascade.update_enqueue", 0.0); + context.AddOperationTiming ("EmotionalCascade.update_count", 0.0); + context.AddOperationTiming ( + "EmotionalCascade.update_execution_count", 0.0); + context.AddOperationTiming ("EmotionalCascade.update_activity", 0.0); + record_timing ("EmotionalCascade.total", total_start); + } + return; + } + + // Load high-intensity emotional sources only when the fixed input changed. + const auto source_query_start = std::chrono::steady_clock::now (); + std::size_t source_execution_count = 0; + auto sources = use_metadata_cache + ? LoadEmotionalSourcesFromCache ( + p_ctx, recent_window_ts, + theta_intensity, theta_arousal, params, + &source_execution_count) + : LoadEmotionalSources (store, recent_window_ts, + theta_intensity, theta_arousal, + params, &source_execution_count); + record_timing ("EmotionalCascade.source_query", source_query_start); + if (profile_cascade) + { + context.AddOperationTiming ( + "EmotionalCascade.source_count", + static_cast (sources.size ())); // Experimental count, not ms. + context.AddOperationTiming ("EmotionalCascade.source_activity", + sources.empty () ? 0.0 : 1.0); + context.AddOperationTiming ( + "EmotionalCascade.source_execution_count", + static_cast (source_execution_count)); + } + if (sources.empty ()) { + if (use_metadata_cache && fanout_cache && fanout_cache->valid) + { + RecordCascadeFixedPoint ( + p_ctx, *fanout_cache, emotional_input_generation, + recent_window_ts, theta_intensity, theta_arousal, + intensity_floor, params); + emotional_state->emotional_cascade_topology_footprint + = { true, {} }; + ConsumeAssociationTopologyChanges (*emotional_state); + } + const auto telemetry_start = std::chrono::steady_clock::now (); telemetry::LogDebug("cortext.emotion_cascade", { telemetry::Attribute::Int64("cascade_sources", 0), telemetry::Attribute::Int64("max_hops", 0) }); + record_timing ("EmotionalCascade.telemetry", telemetry_start); + if (profile_cascade) + { + context.AddOperationTiming ("EmotionalCascade.neighbor_lookup", 0.0); + context.AddOperationTiming ("EmotionalCascade.cache_ensure", + cache_ensure_ms); + context.AddOperationTiming ("EmotionalCascade.cache_bfs", 0.0); + context.AddOperationTiming ("EmotionalCascade.current_values", 0.0); + context.AddOperationTiming ("EmotionalCascade.neighbor_count", 0.0); + context.AddOperationTiming ( + "EmotionalCascade.neighbor_execution_count", 0.0); + context.AddOperationTiming ("EmotionalCascade.neighbor_activity", 0.0); + context.AddOperationTiming ("EmotionalCascade.update_enqueue", 0.0); + context.AddOperationTiming ("EmotionalCascade.update_count", 0.0); + context.AddOperationTiming ( + "EmotionalCascade.update_execution_count", 0.0); + context.AddOperationTiming ("EmotionalCascade.update_activity", 0.0); + record_timing ("EmotionalCascade.total", total_start); + } return; } // Track which embeddings we've already processed to avoid duplicates std::unordered_set processed; int max_hops = 0; - - for (const auto &src : sources) + std::size_t neighbor_count = 0; + std::size_t neighbor_execution_count = 0; + std::size_t update_count = 0; + std::size_t update_execution_count = 0; + double neighbor_lookup_ms = 0.0; + double cache_bfs_ms = 0.0; + double current_values_ms = 0.0; + double update_enqueue_ms = 0.0; + + const auto neighbor_start = std::chrono::steady_clock::now (); + const auto cache_bfs_start = std::chrono::steady_clock::now (); + std::vector> source_neighbors; + if (fanout_cache && fanout_cache->valid) { - // Use the source's own cascade parameters if available, - // otherwise fall back to knob-derived + std::vector> expandable_by_source; + source_neighbors = FindCascadeNeighbors (*fanout_cache, sources, + params, + &expandable_by_source); + if (use_metadata_cache && emotional_state) + { + emotional_state->emotional_cascade_topology_footprint + = { true, std::move (expandable_by_source) }; + ConsumeAssociationTopologyChanges (*emotional_state); + } + for (const auto &neighbors : source_neighbors) + neighbor_count += neighbors.size (); + } + else + source_neighbors.resize (sources.size ()); + cache_bfs_ms = std::chrono::duration ( + std::chrono::steady_clock::now () - cache_bfs_start).count (); + const auto current_values_start = std::chrono::steady_clock::now (); + const auto fallback_current_values + = use_metadata_cache ? std::unordered_map{} + : LoadCurrentEmotionalValues (store); + const auto ¤t_values + = use_metadata_cache + ? emotional_state->emotional_metadata.values_by_embedding + : fallback_current_values; + current_values_ms = std::chrono::duration ( + std::chrono::steady_clock::now () - current_values_start).count (); + neighbor_lookup_ms = std::chrono::duration ( + std::chrono::steady_clock::now () - neighbor_start).count (); + + for (std::size_t source_index = 0; source_index < sources.size (); + ++source_index) + { + const auto &src = sources[source_index]; const int radius = (src.cascade_radius > 0) ? src.cascade_radius : params.cascade_radius; const double decay = (src.cascade_decay > 0.0) ? src.cascade_decay : params.cascade_decay; - if (radius > max_hops) max_hops = radius; - // Find neighbors via graph traversal - auto neighbors = FindCascadeNeighbors (store, src.embedding_id, radius); - - for (const auto &neighbor : neighbors) + for (const auto &neighbor : source_neighbors[source_index]) { - // Skip if already processed from another source + ++neighbor_execution_count; + + // Preserve source ordering and the existing first-source-wins rule. if (processed.count (neighbor.embedding_id) > 0) { continue; } processed.insert (neighbor.embedding_id); - // Compute decayed intensity based on hop distance const double decayed_intensity = src.intensity * std::pow (decay, neighbor.depth); - - // Compute decayed half_life_bonus const double decayed_bonus = src.half_life_bonus * std::pow (decay, neighbor.depth); - // Skip if intensity has decayed too much if (decayed_intensity < intensity_floor) { continue; } + const auto current_it + = current_values.find (neighbor.embedding_id); + if (current_it != current_values.end () + && decayed_intensity <= current_it->second.intensity + && decayed_bonus <= current_it->second.half_life_bonus) + { + continue; + } - // v2: Update emotional cascade fields in memories table - // Preserve max intensity and half_life_bonus if already higher + const auto update_start = std::chrono::steady_clock::now (); Add (tx, "UPDATE memories " "SET emotional_intensity = MAX(emotional_intensity, ?1), " " half_life_bonus = MAX(half_life_bonus, ?2) " "WHERE embedding_id = ?3", { decayed_intensity, decayed_bonus, neighbor.embedding_id }); + emotional_metadata_cache_internal::MaxEmbedding ( + context.GetProcessorContext (), neighbor.embedding_id, + decayed_intensity, decayed_bonus); + update_enqueue_ms += std::chrono::duration ( + std::chrono::steady_clock::now () - update_start).count (); + ++update_count; + ++update_execution_count; } } + if (use_metadata_cache && fanout_cache && fanout_cache->valid) + RecordCascadeFixedPoint ( + p_ctx, *fanout_cache, emotional_input_generation, recent_window_ts, + theta_intensity, theta_arousal, intensity_floor, params); + + const auto telemetry_start = std::chrono::steady_clock::now (); telemetry::LogDebug("cortext.emotion_cascade", { telemetry::Attribute::Int64("cascade_sources", static_cast(sources.size())), telemetry::Attribute::Int64("max_hops", max_hops) }); + record_timing ("EmotionalCascade.telemetry", telemetry_start); + if (profile_cascade) + { + context.AddOperationTiming ( + "EmotionalCascade.neighbor_lookup", neighbor_lookup_ms); + context.AddOperationTiming ( + "EmotionalCascade.cache_ensure", cache_ensure_ms); + context.AddOperationTiming ("EmotionalCascade.cache_bfs", cache_bfs_ms); + context.AddOperationTiming ( + "EmotionalCascade.current_values", current_values_ms); + context.AddOperationTiming ( + "EmotionalCascade.neighbor_count", + static_cast (neighbor_count)); // Experimental count, not ms. + context.AddOperationTiming ("EmotionalCascade.neighbor_activity", + neighbor_count > 0 ? 1.0 : 0.0); + context.AddOperationTiming ( + "EmotionalCascade.neighbor_execution_count", + static_cast (neighbor_execution_count)); + context.AddOperationTiming ( + "EmotionalCascade.update_enqueue", update_enqueue_ms); + context.AddOperationTiming ( + "EmotionalCascade.update_count", + static_cast (update_count)); // Experimental count, not ms. + context.AddOperationTiming ("EmotionalCascade.update_activity", + update_count > 0 ? 1.0 : 0.0); + context.AddOperationTiming ( + "EmotionalCascade.update_execution_count", + static_cast (update_execution_count)); + record_timing ("EmotionalCascade.total", total_start); + } } } // namespace cortext::operations diff --git a/src/operations/emotional_metadata_cache_internal.hpp b/src/operations/emotional_metadata_cache_internal.hpp new file mode 100644 index 00000000..58edda10 --- /dev/null +++ b/src/operations/emotional_metadata_cache_internal.hpp @@ -0,0 +1,252 @@ +#pragma once + +#include "cortext/processor/processor_context.hpp" +#include "execution_cache_sidecar_internal.hpp" + +#include +#include +#include + +namespace cortext::operations::emotional_metadata_cache_internal +{ + +using Row = execution_cache_sidecar_internal::EmotionalMemoryMetadata; +using Cache = execution_cache_sidecar_internal::EmotionalMetadataCache; +using State = execution_cache_sidecar_internal::State; + +inline std::shared_ptr +EnsureState (const ProcessorContext &p_ctx) +{ + return execution_cache_sidecar_internal::Ensure (p_ctx); +} + +inline std::shared_ptr +FindState (const ProcessorContext &p_ctx) +{ + return execution_cache_sidecar_internal::Find (p_ctx); +} + +inline Cache & +Ensure (const ProcessorContext &p_ctx) +{ + return EnsureState (p_ctx)->emotional_metadata; +} + +inline void +BumpCascadeInputGeneration ( + Cache &cache) +{ + ++cache.cascade_input_generation; +} + +inline void +RecomputeEmbedding (Cache &cache, + long long embedding_id) +{ + const auto members = cache.memory_ids_by_embedding.find (embedding_id); + if (members == cache.memory_ids_by_embedding.end () + || members->second.empty ()) + { + cache.values_by_embedding.erase (embedding_id); + return; + } + double intensity = std::numeric_limits::infinity (); + double bonus = std::numeric_limits::infinity (); + for (const long long memory_id : members->second) + { + const auto row = cache.rows_by_memory.find (memory_id); + if (row == cache.rows_by_memory.end ()) + { + cache.valid = false; + return; + } + intensity = std::min (intensity, row->second.intensity); + bonus = std::min (bonus, row->second.half_life_bonus); + } + cache.values_by_embedding[embedding_id] = { intensity, bonus }; +} + +inline void +Remove (ProcessorContext &p_ctx, long long memory_id) +{ + const auto state = FindState (p_ctx); + if (!state) + return; + auto &cache = state->emotional_metadata; + if (!cache.valid) + return; + const auto row = cache.rows_by_memory.find (memory_id); + if (row == cache.rows_by_memory.end ()) + return; + const long long embedding_id = row->second.embedding_id; + cache.rows_by_memory.erase (row); + auto members = cache.memory_ids_by_embedding.find (embedding_id); + if (members != cache.memory_ids_by_embedding.end ()) + { + std::erase (members->second, memory_id); + if (members->second.empty ()) + cache.memory_ids_by_embedding.erase (members); + } + std::erase (cache.source_query_order, memory_id); + RecomputeEmbedding (cache, embedding_id); + BumpCascadeInputGeneration (cache); +} + +inline bool +BeforeSourceQuery (const Row &left, const Row &right) +{ + return left.memory_id < right.memory_id; +} + +inline void +Upsert (ProcessorContext &p_ctx, Row row) +{ + const auto state = FindState (p_ctx); + if (!state) + return; + auto &cache = state->emotional_metadata; + if (!cache.valid || row.memory_id <= 0 || row.embedding_id <= 0) + return; + const bool inserts_unshared_non_source + = !row.flashbulb + && cache.rows_by_memory.find (row.memory_id) + == cache.rows_by_memory.end () + && cache.memory_ids_by_embedding.find (row.embedding_id) + == cache.memory_ids_by_embedding.end (); + Remove (p_ctx, row.memory_id); + auto &members = cache.memory_ids_by_embedding[row.embedding_id]; + members.insert (std::lower_bound (members.begin (), members.end (), + row.memory_id), + row.memory_id); + const long long memory_id = row.memory_id; + const long long embedding_id = row.embedding_id; + cache.rows_by_memory.emplace (memory_id, std::move (row)); + const Row &stored = cache.rows_by_memory.at (memory_id); + if (stored.flashbulb) + { + const auto position = std::lower_bound ( + cache.source_query_order.begin (), cache.source_query_order.end (), + stored, + [&cache] (long long existing_memory_id, const Row &candidate) { + return BeforeSourceQuery ( + cache.rows_by_memory.at (existing_memory_id), candidate); + }); + cache.source_query_order.insert (position, memory_id); + } + RecomputeEmbedding (cache, embedding_id); + // A newly persisted, unconnected non-source cannot change a completed + // cascade. If an association is subsequently added, the fanout fingerprint + // independently invalidates the fixed point. Shared embeddings remain + // conservative because a new member can lower the aggregate target value. + if (!inserts_unshared_non_source) + BumpCascadeInputGeneration (cache); +} + +inline void +Reset (ProcessorContext &p_ctx, std::vector rows) +{ + const std::uint64_t next_generation + = Ensure (p_ctx).cascade_input_generation + 1; + auto &cache = Ensure (p_ctx); + cache = {}; + cache.valid = true; + cache.cascade_input_generation = next_generation; + cache.rows_by_memory.reserve (rows.size ()); + cache.source_query_order.reserve (rows.size ()); + for (auto &row : rows) + Upsert (p_ctx, std::move (row)); +} + +inline void +OverwriteEmbedding (ProcessorContext &p_ctx, long long embedding_id, + bool flashbulb, double intensity, double bonus, int radius, + double decay) +{ + const auto state = FindState (p_ctx); + if (!state) + return; + auto &cache = state->emotional_metadata; + if (!cache.valid) + return; + const auto members = cache.memory_ids_by_embedding.find (embedding_id); + if (members == cache.memory_ids_by_embedding.end ()) + return; + const auto previous_values = cache.values_by_embedding.find (embedding_id); + const double previous_intensity + = previous_values == cache.values_by_embedding.end () + ? std::numeric_limits::infinity () + : previous_values->second.intensity; + const double previous_bonus + = previous_values == cache.values_by_embedding.end () + ? std::numeric_limits::infinity () + : previous_values->second.half_life_bonus; + bool source_input_changed = false; + for (const long long memory_id : members->second) + { + auto &row = cache.rows_by_memory.at (memory_id); + const bool became_source = !row.flashbulb && flashbulb; + source_input_changed + = source_input_changed || became_source + || (row.flashbulb + && (row.intensity != intensity + || row.half_life_bonus != bonus + || row.cascade_radius != radius + || row.cascade_decay != decay)); + row.flashbulb = row.flashbulb || flashbulb; + row.intensity = intensity; + row.half_life_bonus = bonus; + row.cascade_radius = radius; + row.cascade_decay = decay; + if (became_source) + { + const auto position = std::lower_bound ( + cache.source_query_order.begin (), + cache.source_query_order.end (), row, + [&cache] (long long existing_memory_id, const Row &candidate) { + return BeforeSourceQuery ( + cache.rows_by_memory.at (existing_memory_id), candidate); + }); + cache.source_query_order.insert (position, memory_id); + } + } + RecomputeEmbedding (cache, embedding_id); + const auto current_values = cache.values_by_embedding.find (embedding_id); + const bool target_value_decreased + = current_values != cache.values_by_embedding.end () + && (current_values->second.intensity < previous_intensity + || current_values->second.half_life_bonus < previous_bonus); + if (source_input_changed || target_value_decreased) + BumpCascadeInputGeneration (cache); +} + +inline void +MaxEmbedding (ProcessorContext &p_ctx, long long embedding_id, + double intensity, double bonus) +{ + const auto state = FindState (p_ctx); + if (!state) + return; + auto &cache = state->emotional_metadata; + if (!cache.valid) + return; + const auto members = cache.memory_ids_by_embedding.find (embedding_id); + if (members == cache.memory_ids_by_embedding.end ()) + return; + bool source_input_changed = false; + for (const long long memory_id : members->second) + { + auto &row = cache.rows_by_memory.at (memory_id); + source_input_changed + = source_input_changed + || (row.flashbulb + && (intensity > row.intensity + || bonus > row.half_life_bonus)); + row.intensity = std::max (row.intensity, intensity); + row.half_life_bonus = std::max (row.half_life_bonus, bonus); + } + RecomputeEmbedding (cache, embedding_id); + if (source_input_changed) + BumpCascadeInputGeneration (cache); +} + +} // namespace cortext::operations::emotional_metadata_cache_internal diff --git a/src/operations/eviction_policy.hpp b/src/operations/eviction_policy.hpp index ff65dd9f..49b9509d 100644 --- a/src/operations/eviction_policy.hpp +++ b/src/operations/eviction_policy.hpp @@ -27,7 +27,7 @@ struct EvictionFrontier inline std::string EvictionWhereClause (const EvictionFrontier &frontier) { - std::string where = "WHERE m.strength < ? AND m.kind = 'LONG_TERM'"; + std::string where = "WHERE rif.strength < ? AND m.kind = 'LONG_TERM'"; if (frontier.consolidation_gate_active) { where += " AND m.created_at < ?"; @@ -142,14 +142,16 @@ LoadEvictableMemoryIds (Transaction &tx, const EvictionFrontier &frontier, std::string where = "WHERE m.memory_id IN (" + MakePlaceholders (memory_ids.size ()) - + ") AND m.strength < ? AND m.kind = 'LONG_TERM'"; + + ") AND rif.strength < ? AND m.kind = 'LONG_TERM'"; if (frontier.consolidation_gate_active) { where += " AND m.created_at < ?"; } auto rows = tx.Execute ( - "SELECT m.memory_id FROM memories m " + where, + "SELECT m.memory_id FROM memories m " + "JOIN rif_effective_memories rif ON rif.memory_id = m.memory_id " + + where, params); for (const auto &row : rows) { diff --git a/src/operations/execution_cache_sidecar_internal.hpp b/src/operations/execution_cache_sidecar_internal.hpp new file mode 100644 index 00000000..7ca71433 --- /dev/null +++ b/src/operations/execution_cache_sidecar_internal.hpp @@ -0,0 +1,171 @@ +#pragma once + +#include "cortext/processor/processor_context.hpp" +#include "rif_active_epoch_cache_internal.hpp" + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace cortext::operations::execution_cache_sidecar_internal +{ + +struct EmotionalMemoryMetadata +{ + long long memory_id = 0; + long long embedding_id = 0; + long long created_at = 0; + bool flashbulb = false; + double intensity = 0.0; + double arousal = 0.0; + double half_life_bonus = 0.0; + int cascade_radius = 0; + double cascade_decay = 0.0; +}; + +struct EmotionalEmbeddingValues +{ + double intensity = 0.0; + double half_life_bonus = 0.0; +}; + +struct EmotionalMetadataCache +{ + bool valid = false; + std::uint64_t cascade_input_generation = 0; + std::unordered_map rows_by_memory; + std::unordered_map> + memory_ids_by_embedding; + std::unordered_map + values_by_embedding; + std::vector source_query_order; +}; + +struct EmotionalCascadeFixedPoint +{ + bool valid = false; + std::uint64_t emotional_input_generation = 0; + long long association_edge_count = 0; + long long association_source_sum = 0; + long long association_target_sum = 0; + long long association_source_max = 0; + long long association_target_max = 0; + long long association_weight_sum_micros = 0; + long long association_last_reinforced_sum = 0; + long long recent_window_ts = 0; + double theta_intensity = 0.0; + double theta_arousal = 0.0; + double intensity_floor = 0.0; + int cascade_radius = 0; + double cascade_decay = 0.0; +}; + +struct AssociationTopologyChanges +{ + bool reset = true; + std::vector> inserted_edges; +}; + +struct EmotionalCascadeTopologyFootprint +{ + bool valid = false; + std::vector> expandable_by_source; +}; + +struct SupersessionEligibility +{ + bool valid = false; + std::unordered_map activation_ts_by_target; +}; + +struct State +{ + EmotionalMetadataCache emotional_metadata; + EmotionalCascadeFixedPoint emotional_fixed_point; + AssociationTopologyChanges association_topology_changes; + EmotionalCascadeTopologyFootprint emotional_cascade_topology_footprint; + SupersessionEligibility supersession_eligibility; + rif_active_epoch_cache_internal::State rif_active_epoch; +}; + +struct RegistryState +{ + std::mutex mutex; + std::unordered_map> states; +}; + +inline RegistryState & +Registry () +{ + static auto *registry = new RegistryState (); + return *registry; +} + +inline std::shared_ptr +Ensure (const ProcessorContext &ctx) +{ + auto ®istry = Registry (); + std::lock_guard lock (registry.mutex); + auto &state = registry.states[&ctx]; + if (!state) + state = std::make_shared (); + return state; +} + +inline std::shared_ptr +Find (const ProcessorContext &ctx) +{ + auto ®istry = Registry (); + std::lock_guard lock (registry.mutex); + const auto it = registry.states.find (&ctx); + return it == registry.states.end () ? nullptr : it->second; +} + +inline std::shared_ptr +Detach (const ProcessorContext &ctx) +{ + auto ®istry = Registry (); + std::lock_guard lock (registry.mutex); + const auto it = registry.states.find (&ctx); + if (it == registry.states.end ()) + return nullptr; + auto state = std::move (it->second); + registry.states.erase (it); + return state; +} + +inline void +Restore (const ProcessorContext &ctx, std::shared_ptr state) +{ + auto ®istry = Registry (); + std::lock_guard lock (registry.mutex); + if (state) + registry.states[&ctx] = std::move (state); + else + registry.states.erase (&ctx); +} + +inline void +Erase (const ProcessorContext &ctx) +{ + auto ®istry = Registry (); + std::lock_guard lock (registry.mutex); + registry.states.erase (&ctx); +} + +#if defined(CORTEXT_TESTING) +inline std::size_t +RegistrySizeForTest () +{ + auto ®istry = Registry (); + std::lock_guard lock (registry.mutex); + return registry.states.size (); +} +#endif + +} // namespace cortext::operations::execution_cache_sidecar_internal diff --git a/src/operations/family_embedding_features_internal.hpp b/src/operations/family_embedding_features_internal.hpp new file mode 100644 index 00000000..c2471e06 --- /dev/null +++ b/src/operations/family_embedding_features_internal.hpp @@ -0,0 +1,111 @@ +#pragma once + +#include + +#include +#include +#include +#include +#include + +namespace cortext::operations::family_embedding_features_internal +{ + +constexpr std::size_t kNormBlockCount = 32; + +struct Features +{ + Eigen::VectorXf normalized; + double normalized_squared_norm = 0.0; + std::array block_norms {}; + std::array hadamard_block_norms {}; + bool has_hadamard_features = false; +}; + +template +void +BuildBlockNorms (Eigen::Index dimension_count, ValueAccessor value_at, + std::array &block_norms) +{ + for (Eigen::Index dimension = 0; dimension < dimension_count; ++dimension) + { + const double value = value_at (dimension); + const auto block = std::min ( + kNormBlockCount - 1, + static_cast (dimension) * kNormBlockCount + / static_cast (dimension_count)); + block_norms[block] += value * value; + } + for (double &block_norm : block_norms) + block_norm = std::sqrt (block_norm); +} + +inline Features +Build (const Eigen::VectorXf &embedding) +{ + Features features; + if (embedding.size () <= 0) + return features; + + double squared_norm = 0.0; + for (Eigen::Index dimension = 0; dimension < embedding.size (); ++dimension) + { + const double value = static_cast (embedding[dimension]); + squared_norm += value * value; + } + if (squared_norm <= 1e-24) + return features; + + const double inverse_norm = 1.0 / std::sqrt (squared_norm); + features.normalized.resize (embedding.size ()); + for (Eigen::Index dimension = 0; dimension < embedding.size (); ++dimension) + { + features.normalized[dimension] = static_cast ( + static_cast (embedding[dimension]) * inverse_norm); + const double normalized_value + = static_cast (features.normalized[dimension]); + features.normalized_squared_norm + += normalized_value * normalized_value; + } + BuildBlockNorms ( + features.normalized.size (), + [&features] (Eigen::Index dimension) { + return static_cast (features.normalized[dimension]); + }, + features.block_norms); + + const std::size_t dimension_count + = static_cast (features.normalized.size ()); + if (dimension_count > 0 + && (dimension_count & (dimension_count - 1)) == 0) + { + std::vector transformed (dimension_count); + for (std::size_t dimension = 0; dimension < dimension_count; + ++dimension) + transformed[dimension] + = static_cast (features.normalized[dimension]); + for (std::size_t span = 1; span < dimension_count; span *= 2) + for (std::size_t begin = 0; begin < dimension_count; + begin += span * 2) + for (std::size_t offset = 0; offset < span; ++offset) + { + const double left = transformed[begin + offset]; + const double right = transformed[begin + span + offset]; + transformed[begin + offset] = left + right; + transformed[begin + span + offset] = left - right; + } + const double inverse_transform_norm + = 1.0 / std::sqrt (static_cast (dimension_count)); + BuildBlockNorms ( + features.normalized.size (), + [&transformed, inverse_transform_norm] (Eigen::Index dimension) { + return transformed[static_cast (dimension)] + * inverse_transform_norm; + }, + features.hadamard_block_norms); + features.has_hadamard_features = true; + } + return features; +} + +} // namespace cortext::operations::family_embedding_features_internal diff --git a/src/operations/graph_retrieval.cpp b/src/operations/graph_retrieval.cpp index 9c10abe1..1563ff07 100644 --- a/src/operations/graph_retrieval.cpp +++ b/src/operations/graph_retrieval.cpp @@ -3,6 +3,7 @@ #include "constructive_recall_internal.hpp" #include "association_fanout_cache_internal.hpp" #include "historical_surface_search_cache_internal.hpp" +#include "family_embedding_features_internal.hpp" #include "retrieval_trace_state.hpp" #include "cortext/core/knobs.hpp" #include "cortext/core/utils.hpp" @@ -23,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -40,6 +42,7 @@ struct Candidate long long start_ts = 0; Eigen::VectorXf embedding; double seed_score = 0.0; + double source_confidence = 0.0; double graph_score = 0.0; double temporal_score = 0.0; double superseded_penalty = 0.0; @@ -47,6 +50,54 @@ struct Candidate bool direct_seed = false; }; +struct SeedCacheProfile +{ + double distance_ms = 0.0; + double eligibility_ms = 0.0; + double sort_ms = 0.0; + double family_ms = 0.0; + double family_build_ms = 0.0; + double family_compare_ms = 0.0; + double rows_ms = 0.0; + std::size_t distance_rows = 0; + std::size_t eligibility_rows = 0; + std::size_t ranked_rows = 0; + std::size_t selected_rows = 0; +}; + +thread_local std::size_t *g_family_exact_comparison_counter = nullptr; + +class ScopedFamilyExactComparisonCounter +{ +public: + explicit ScopedFamilyExactComparisonCounter (std::size_t *counter) + : previous_ (g_family_exact_comparison_counter) + { + g_family_exact_comparison_counter = counter; + } + + ~ScopedFamilyExactComparisonCounter () + { + g_family_exact_comparison_counter = previous_; + } + +private: + std::size_t *previous_ = nullptr; +}; + +void +AddSeedCachePhaseTime (SeedCacheProfile *profile, + double SeedCacheProfile::*field, + std::chrono::steady_clock::time_point started) +{ + if (profile) + { + profile->*field += std::chrono::duration ( + std::chrono::steady_clock::now () - started) + .count (); + } +} + constexpr double kTemporalRankDaySeconds = 24.0 * 60.0 * 60.0; double @@ -182,6 +233,33 @@ RefreshCandidateFromProcessorSurface (const ProcessorContext &p_ctx, return true; } +std::optional +OriginalEvidenceConfidence (const ProcessorContext &p_ctx, + long long memory_id, + const Eigen::VectorXf &query_embedding) +{ + const auto surface_it = p_ctx.retrieval_surface_index.find (memory_id); + if (surface_it == p_ctx.retrieval_surface_index.end () + || surface_it->second >= p_ctx.retrieval_surface_cache.size ()) + return std::nullopt; + const auto &surface = p_ctx.retrieval_surface_cache[surface_it->second]; + const long long base_embedding_id + = historical_surface_search_cache_internal::BaseEmbeddingIdForMemory ( + p_ctx, memory_id, surface.embedding_id); + const auto state + = historical_surface_search_cache_internal::Find (p_ctx); + if (!state || base_embedding_id <= 0) + return std::nullopt; + const auto embedding_it = state->embedding_index.find (base_embedding_id); + if (embedding_it == state->embedding_index.end () + || embedding_it->second >= state->entries.size ()) + return std::nullopt; + const auto &base_embedding = state->entries[embedding_it->second].embedding; + if (base_embedding.size () != query_embedding.size ()) + return std::nullopt; + return core::Map01 (Cosine (query_embedding, base_embedding)); +} + void RefreshProcessorSurfaces (Transaction &tx, ProcessorContext &p_ctx, long long memory_id, long long old_embedding_id, @@ -202,6 +280,7 @@ RefreshProcessorSurfaces (Transaction &tx, ProcessorContext &p_ctx, p_ctx.retrieval_surface_embedding_index[new_embedding_id] = cache_it->second; } + association_fanout_cache::NotifyRetrievalSurfaceChanged (p_ctx, memory_id); if (old_embedding_id > 0 && old_embedding_id != new_embedding_id && p_ctx.retrieval_surface_embedding_index.find (old_embedding_id) @@ -266,109 +345,14 @@ AppendUniqueRows ( } } -constexpr std::size_t kFamilyNormBlockCount = 32; - -struct FamilyEmbeddingFeatures -{ - Eigen::VectorXf normalized; - std::array block_norms {}; - std::array hadamard_block_norms {}; - bool has_hadamard_features = false; -}; - -template -void -BuildFamilyBlockNorms ( - Eigen::Index dimension_count, ValueAccessor value_at, - std::array &block_norms) -{ - for (Eigen::Index dimension = 0; dimension < dimension_count; ++dimension) - { - const double value = value_at (dimension); - const auto block = std::min ( - kFamilyNormBlockCount - 1, - static_cast (dimension) * kFamilyNormBlockCount - / static_cast (dimension_count)); - block_norms[block] += value * value; - } - for (double &block_norm : block_norms) - { - block_norm = std::sqrt (block_norm); - } -} +using FamilyEmbeddingFeatures = family_embedding_features_internal::Features; +constexpr std::size_t kFamilyNormBlockCount + = family_embedding_features_internal::kNormBlockCount; FamilyEmbeddingFeatures BuildFamilyEmbeddingFeatures (const Eigen::VectorXf &embedding) { - FamilyEmbeddingFeatures features; - if (embedding.size () <= 0) - { - return features; - } - - double squared_norm = 0.0; - for (Eigen::Index dimension = 0; dimension < embedding.size (); ++dimension) - { - const double value = static_cast (embedding[dimension]); - squared_norm += value * value; - } - if (squared_norm <= 1e-24) - { - return features; - } - - const double inverse_norm = 1.0 / std::sqrt (squared_norm); - features.normalized.resize (embedding.size ()); - for (Eigen::Index dimension = 0; dimension < embedding.size (); ++dimension) - { - features.normalized[dimension] = static_cast ( - static_cast (embedding[dimension]) * inverse_norm); - } - BuildFamilyBlockNorms ( - features.normalized.size (), - [&features] (Eigen::Index dimension) { - return static_cast (features.normalized[dimension]); - }, - features.block_norms); - - const std::size_t dimension_count - = static_cast (features.normalized.size ()); - if (dimension_count > 0 - && (dimension_count & (dimension_count - 1)) == 0) - { - std::vector transformed (dimension_count); - for (std::size_t dimension = 0; dimension < dimension_count; - ++dimension) - { - transformed[dimension] - = static_cast (features.normalized[dimension]); - } - for (std::size_t span = 1; span < dimension_count; span *= 2) - { - for (std::size_t begin = 0; begin < dimension_count; - begin += span * 2) - { - for (std::size_t offset = 0; offset < span; ++offset) - { - const double left = transformed[begin + offset]; - const double right = transformed[begin + span + offset]; - transformed[begin + offset] = left + right; - transformed[begin + span + offset] = left - right; - } - } - } - const double inverse_transform_norm - = 1.0 / std::sqrt (static_cast (dimension_count)); - BuildFamilyBlockNorms ( - features.normalized.size (), - [&transformed, inverse_transform_norm] (Eigen::Index dimension) { - return transformed[static_cast (dimension)] - * inverse_transform_norm; - }, - features.hadamard_block_norms); - features.has_hadamard_features = true; - } - return features; + return family_embedding_features_internal::Build (embedding); } class FamilyRepresentativeIndex @@ -393,6 +377,36 @@ class FamilyRepresentativeIndex { continue; } + const double max_squared_distance + = candidate.normalized_squared_norm + + representative.normalized_squared_norm + - 2.0 * duplicate_threshold_; + double partial_squared_distance = 0.0; + bool exceeds_distance_bound = false; + constexpr double kBoundRoundoff = 1e-7; + constexpr Eigen::Index kBlockSize = 16; + for (Eigen::Index begin = 0; + begin < candidate.normalized.size (); begin += kBlockSize) + { + const Eigen::Index count = std::min ( + kBlockSize, candidate.normalized.size () - begin); + partial_squared_distance + += (candidate.normalized.segment (begin, count) + .cast () + - representative.normalized.segment (begin, count) + .cast ()) + .squaredNorm (); + if (partial_squared_distance + > max_squared_distance + kBoundRoundoff) + { + exceeds_distance_bound = true; + break; + } + } + if (exceeds_distance_bound) + { + continue; + } double cosine_upper_bound = 0.0; for (std::size_t block = 0; block < kFamilyNormBlockCount; ++block) { @@ -411,9 +425,8 @@ class FamilyRepresentativeIndex * representative.hadamard_block_norms[block]; } cosine_upper_bound - = std::min (cosine_upper_bound, hadamard_upper_bound); + = std::min (cosine_upper_bound, hadamard_upper_bound); } - constexpr double kBoundRoundoff = 1e-7; if (cosine_upper_bound + kBoundRoundoff < duplicate_threshold_) { continue; @@ -422,6 +435,8 @@ class FamilyRepresentativeIndex #ifdef CORTEXT_TESTING retrieval_trace::IncrementLastFamilyExactComparisonCount (); #endif + if (g_family_exact_comparison_counter) + ++*g_family_exact_comparison_counter; double cosine = 0.0; for (Eigen::Index dimension = 0; dimension < candidate.normalized.size (); ++dimension) @@ -453,7 +468,8 @@ template void CollapseRankedFamilies ( std::vector &ranked, - double duplicate_threshold, int candidate_limit, EntryAccessor entry_at) + double duplicate_threshold, int candidate_limit, EntryAccessor entry_at, + SeedCacheProfile *profile = nullptr) { std::vector selected; selected.reserve (std::min ( @@ -467,8 +483,22 @@ CollapseRankedFamilies ( break; } const auto &entry = entry_at (candidate.index); - auto features = BuildFamilyEmbeddingFeatures (entry.embedding); - if (families.IsDuplicate (features)) + const auto build_started = std::chrono::steady_clock::now (); + auto features = [&] { + if constexpr (std::is_same_v< + std::remove_cvref_t, + historical_surface_search_cache_internal::Entry>) + return historical_surface_search_cache_internal::FamilyFeatures ( + entry); + return BuildFamilyEmbeddingFeatures (entry.embedding); + } (); + AddSeedCachePhaseTime (profile, &SeedCacheProfile::family_build_ms, + build_started); + const auto compare_started = std::chrono::steady_clock::now (); + const bool duplicate = families.IsDuplicate (features); + AddSeedCachePhaseTime (profile, &SeedCacheProfile::family_compare_ms, + compare_started); + if (duplicate) { continue; } @@ -482,8 +512,8 @@ std::optional>> LoadHistoricalSeedRowsFromCache ( const ProcessorContext &p_ctx, const Eigen::VectorXf &query_embedding, long long exclusion_ts, int candidate_limit, - const std::unordered_set &superseded_memory_ids, - double duplicate_threshold) + const auto &superseded_memory_ids, + double duplicate_threshold, SeedCacheProfile *profile) { const auto state = historical_surface_search_cache_internal::Find (p_ctx); @@ -503,18 +533,41 @@ LoadHistoricalSeedRowsFromCache ( const Eigen::Map matrix ( state->search.data (), static_cast (embedding_count), embedding_dim); + const bool reference_full_distance_scan + = profile && cortext::internal::experimental_env::Flag ( + "CORTEXT_PROFILE_GRAPH_FULL_DISTANCE_SCAN"); auto &distance_scratch = state->distance_scratch; - distance_scratch.resize (embedding_count); - Eigen::Map distances ( - distance_scratch.data (), static_cast (embedding_count)); - distances = (matrix.rowwise () - query_embedding.transpose ()) - .rowwise () - .squaredNorm (); + if (reference_full_distance_scan) + { + const auto distance_started = std::chrono::steady_clock::now (); + distance_scratch.resize (embedding_count); + Eigen::Map distances ( + distance_scratch.data (), static_cast (embedding_count)); + distances = (matrix.rowwise () - query_embedding.transpose ()) + .rowwise () + .squaredNorm (); + profile->distance_rows += embedding_count; + AddSeedCachePhaseTime (profile, &SeedCacheProfile::distance_ms, + distance_started); + } + const auto eligibility_started = std::chrono::steady_clock::now (); auto &ranked = state->ranked_scratch; ranked.clear (); - ranked.reserve (embedding_count); - for (std::size_t index = 0; index < embedding_count; ++index) - { + ranked.reserve (state->long_term_entry_indices.size ()); + const std::size_t eligibility_count + = reference_full_distance_scan ? embedding_count + : state->long_term_entry_indices.size (); + for (std::size_t candidate_index = 0; candidate_index < eligibility_count; + ++candidate_index) + { + const std::size_t index + = reference_full_distance_scan + ? candidate_index + : state->long_term_entry_indices[candidate_index]; + if (index >= embedding_count) + { + return std::nullopt; + } const auto &entry = state->entries[index]; if (entry.embedding_id <= 0 || entry.embedding.size () != embedding_dim) { @@ -529,14 +582,37 @@ LoadHistoricalSeedRowsFromCache ( && state->current_memory_index.count ( reference.memory_id) == 0 - && superseded_memory_ids.count (reference.memory_id) == 0; + && !superseded_memory_ids.Contains (reference.memory_id); }); if (eligible_reference == entry.memory_references.end ()) { continue; } ranked.push_back ( - { index, distances[static_cast (index)] }); + { index, reference_full_distance_scan ? distance_scratch[index] + : 0.0f }); + } + if (profile) + { + profile->eligibility_rows += eligibility_count; + profile->ranked_rows += ranked.size (); + } + AddSeedCachePhaseTime (profile, &SeedCacheProfile::eligibility_ms, + eligibility_started); + if (!reference_full_distance_scan) + { + const auto distance_started = std::chrono::steady_clock::now (); + for (auto &candidate : ranked) + { + candidate.distance + = (matrix.row (static_cast (candidate.index)) + - query_embedding.transpose ()) + .squaredNorm (); + } + if (profile) + profile->distance_rows += ranked.size (); + AddSeedCachePhaseTime (profile, &SeedCacheProfile::distance_ms, + distance_started); } auto by_distance = [&state] ( const historical_surface_search_cache_internal::RankedEntry &a, @@ -548,13 +624,22 @@ LoadHistoricalSeedRowsFromCache ( return state->entries[a.index].embedding_id < state->entries[b.index].embedding_id; }; + const auto sort_started = std::chrono::steady_clock::now (); std::sort (ranked.begin (), ranked.end (), by_distance); + AddSeedCachePhaseTime (profile, &SeedCacheProfile::sort_ms, sort_started); + const auto family_started = std::chrono::steady_clock::now (); CollapseRankedFamilies ( ranked, duplicate_threshold, candidate_limit, [&state] (std::size_t candidate_index) -> const auto & { return state->entries[candidate_index]; - }); + }, + profile); + if (profile) + profile->selected_rows += ranked.size (); + AddSeedCachePhaseTime (profile, &SeedCacheProfile::family_ms, + family_started); + const auto rows_started = std::chrono::steady_clock::now (); std::vector> rows; rows.reserve (ranked.size ()); for (const auto &candidate : ranked) @@ -569,7 +654,7 @@ LoadHistoricalSeedRowsFromCache ( && state->current_memory_index.count ( reference.memory_id) == 0 - && superseded_memory_ids.count (reference.memory_id) == 0; + && !superseded_memory_ids.Contains (reference.memory_id); }); if (eligible_reference == entry.memory_references.end ()) { @@ -581,6 +666,7 @@ LoadHistoricalSeedRowsFromCache ( { "start_ts", eligible_reference->start_ts }, { "embedding", ToFloatVector (entry.embedding) } }); } + AddSeedCachePhaseTime (profile, &SeedCacheProfile::rows_ms, rows_started); return rows; } @@ -588,8 +674,8 @@ std::optional>> LoadCurrentSeedRowsFromCache ( const ProcessorContext &p_ctx, const Eigen::VectorXf &query_embedding, long long exclusion_ts, int candidate_limit, - const std::unordered_set &superseded_memory_ids, - double duplicate_threshold) + const auto &superseded_memory_ids, + double duplicate_threshold, SeedCacheProfile *profile) { const auto state = historical_surface_search_cache_internal::Find (p_ctx); @@ -608,6 +694,7 @@ LoadCurrentSeedRowsFromCache ( return std::vector>{}; } + const auto distance_started = std::chrono::steady_clock::now (); using RowMajorMatrix = Eigen::Matrix; const Eigen::Map matrix ( @@ -620,6 +707,11 @@ LoadCurrentSeedRowsFromCache ( distances = (matrix.rowwise () - query_embedding.transpose ()) .rowwise () .squaredNorm (); + if (profile) + profile->distance_rows += entry_count; + AddSeedCachePhaseTime (profile, &SeedCacheProfile::distance_ms, + distance_started); + const auto eligibility_started = std::chrono::steady_clock::now (); auto &ranked = state->ranked_scratch; ranked.clear (); ranked.reserve (entry_count); @@ -628,26 +720,27 @@ LoadCurrentSeedRowsFromCache ( const auto &entry = state->current_entries[index]; if (entry.memory_id <= 0 || entry.embedding_id <= 0 || entry.embedding.size () != embedding_dim) - { - return std::nullopt; - } + return std::nullopt; const auto surface_it = p_ctx.retrieval_surface_index.find ( entry.memory_id); if (surface_it == p_ctx.retrieval_surface_index.end () || surface_it->second >= p_ctx.retrieval_surface_cache.size ()) - { - return std::nullopt; - } + return std::nullopt; const auto &surface = p_ctx.retrieval_surface_cache[surface_it->second]; if (surface.kind != "LONG_TERM" || !surface.vector_seed_eligible || surface.start_ts >= exclusion_ts - || superseded_memory_ids.count (entry.memory_id) != 0) - { - continue; - } + || superseded_memory_ids.Contains (entry.memory_id)) + continue; ranked.push_back ( { index, distances[static_cast (index)] }); } + if (profile) + { + profile->eligibility_rows += entry_count; + profile->ranked_rows += ranked.size (); + } + AddSeedCachePhaseTime (profile, &SeedCacheProfile::eligibility_ms, + eligibility_started); auto by_distance = [&state] ( const historical_surface_search_cache_internal::RankedEntry &a, const historical_surface_search_cache_internal::RankedEntry &b) { @@ -658,13 +751,22 @@ LoadCurrentSeedRowsFromCache ( return state->current_entries[a.index].memory_id < state->current_entries[b.index].memory_id; }; + const auto sort_started = std::chrono::steady_clock::now (); std::sort (ranked.begin (), ranked.end (), by_distance); + AddSeedCachePhaseTime (profile, &SeedCacheProfile::sort_ms, sort_started); + const auto family_started = std::chrono::steady_clock::now (); CollapseRankedFamilies ( ranked, duplicate_threshold, candidate_limit, [&state] (std::size_t candidate_index) -> const auto & { return state->current_entries[candidate_index]; - }); + }, + profile); + if (profile) + profile->selected_rows += ranked.size (); + AddSeedCachePhaseTime (profile, &SeedCacheProfile::family_ms, + family_started); + const auto rows_started = std::chrono::steady_clock::now (); std::vector> rows; rows.reserve (ranked.size ()); for (const auto &candidate : ranked) @@ -684,6 +786,7 @@ LoadCurrentSeedRowsFromCache ( { "start_ts", surface.start_ts }, { "embedding", ToFloatVector (entry.embedding) } }); } + AddSeedCachePhaseTime (profile, &SeedCacheProfile::rows_ms, rows_started); return rows; } @@ -691,7 +794,7 @@ std::optional>> LoadCurrentSeedRowsFromProcessorSurface ( const ProcessorContext &p_ctx, const Eigen::VectorXf &query_embedding, long long exclusion_ts, int candidate_limit, - const std::unordered_set &superseded_memory_ids, + const auto &superseded_memory_ids, double duplicate_threshold) { const int embedding_dim = static_cast (query_embedding.size ()); @@ -708,7 +811,7 @@ LoadCurrentSeedRowsFromProcessorSurface ( const auto &surface = p_ctx.retrieval_surface_cache[index]; if (surface.kind != "LONG_TERM" || !surface.vector_seed_eligible || surface.start_ts >= exclusion_ts - || superseded_memory_ids.count (surface.memory_id) != 0) + || superseded_memory_ids.Contains (surface.memory_id)) { continue; } @@ -766,7 +869,9 @@ RebuildCurrentSearchCacheFromProcessorSurface (ProcessorContext &p_ctx) current_entries.reserve (p_ctx.retrieval_surface_cache.size ()); for (const auto &surface : p_ctx.retrieval_surface_cache) { - if (surface.kind != "LONG_TERM" || !surface.vector_seed_eligible) + if ((surface.kind != "LONG_TERM" && surface.kind != "ASSOCIATION") + || (surface.kind == "LONG_TERM" + && !surface.vector_seed_eligible)) { continue; } @@ -775,9 +880,14 @@ RebuildCurrentSearchCacheFromProcessorSurface (ProcessorContext &p_ctx) { return false; } + const long long base_embedding_id + = historical_surface_search_cache_internal::BaseEmbeddingIdForMemory ( + p_ctx, surface.memory_id, 0); + if (base_embedding_id <= 0) + return false; current_entries.push_back ( { surface.embedding_id, surface.memory_id, 0, std::string (), - std::string (), surface.embedding }); + std::string (), surface.embedding, base_embedding_id }); } if (!historical_surface_search_cache_internal::Reset ( p_ctx, {}, std::move (current_entries))) @@ -805,7 +915,7 @@ RebuildSurfaceSearchCache (Transaction &tx, ProcessorContext &p_ctx, " COALESCE(m.source_id, '') AS source_id " "FROM embeddings e " "LEFT JOIN memories m ON m.embedding_id = e.embedding_id " - " AND m.kind = 'LONG_TERM' " + " AND m.kind IN ('LONG_TERM', 'ASSOCIATION') " "ORDER BY e.embedding_id, COALESCE(m.start_ts, 0), m.memory_id"); std::vector historical_entries; @@ -834,7 +944,8 @@ RebuildSurfaceSearchCache (Transaction &tx, ProcessorContext &p_ctx, } auto current_rows = tx.Execute ( - "SELECT m.memory_id, " + "SELECT m.memory_id, m.embedding_id AS base_embedding_id, " + " m.start_ts, m.kind, m.source_id, " " CASE WHEN ?1 != 0 " " THEN COALESCE(latest_r.embedding_id, " " cme.embedding_id, m.embedding_id) " @@ -855,7 +966,7 @@ RebuildSurfaceSearchCache (Transaction &tx, ProcessorContext &p_ctx, "LEFT JOIN current_memory_embeddings cme " " ON cme.memory_id = m.memory_id " "JOIN embeddings base_e ON base_e.embedding_id = m.embedding_id " - "WHERE m.kind = 'LONG_TERM' " + "WHERE m.kind IN ('LONG_TERM', 'ASSOCIATION') " "ORDER BY m.memory_id", { constructive_recall::Disabled () ? 0 : 1 }); std::vector @@ -873,8 +984,12 @@ RebuildSurfaceSearchCache (Transaction &tx, ProcessorContext &p_ctx, } current_entries.push_back ( { AnyLongLong (row, "embedding_id"), - AnyLongLong (row, "memory_id"), 0, std::string (), - std::string (), std::move (embedding) }); + AnyLongLong (row, "memory_id"), + AnyLongLong (row, "start_ts"), + std::any_cast (row.at ("kind")), + std::any_cast (row.at ("source_id")), + std::move (embedding), + AnyLongLong (row, "base_embedding_id") }); } bool current_surface_database_current = true; if (!constructive_recall::Disabled ()) @@ -920,7 +1035,7 @@ std::vector> LoadEligibleSeedRowsFromSqlFallback ( Transaction &tx, const Eigen::VectorXf &query_embedding, long long exclusion_ts, int candidate_limit, int materialization_limit, - const std::unordered_set &superseded_memory_ids, + const auto &superseded_memory_ids, double duplicate_threshold, bool constructive_recall_enabled, bool current_surface_database_current) { @@ -932,8 +1047,8 @@ LoadEligibleSeedRowsFromSqlFallback ( return selected; } - std::vector ordered_superseded_ids ( - superseded_memory_ids.begin (), superseded_memory_ids.end ()); + std::vector ordered_superseded_ids + = superseded_memory_ids.ActiveIds (); std::sort (ordered_superseded_ids.begin (), ordered_superseded_ids.end ()); std::string superseded_membership = ","; for (const long long memory_id : ordered_superseded_ids) @@ -1096,7 +1211,7 @@ LoadEligibleSeedRowsFromSqlFallback ( const long long memory_id = AnyLongLong (row, "memory_id"); const auto embedding_it = row.find ("embedding"); Eigen::VectorXf embedding; - if (memory_id <= 0 || superseded_memory_ids.count (memory_id) != 0 + if (memory_id <= 0 || superseded_memory_ids.Contains (memory_id) || !seen_memory_ids.insert (memory_id).second || embedding_it == row.end () || !AnyToEmbedding (embedding_it->second, @@ -1166,6 +1281,9 @@ InsertOrBoost (std::unordered_map &candidates, { it->second.seed_score = std::max (it->second.seed_score, candidate.seed_score); + it->second.source_confidence + = std::max (it->second.source_confidence, + candidate.source_confidence); it->second.graph_score = std::max (it->second.graph_score, candidate.graph_score); it->second.temporal_score = std::max (it->second.temporal_score, @@ -1206,54 +1324,54 @@ RetrievalEdgeType (const std::string &edge_type) || edge_type == "within_same_event"; } -std::unordered_set +struct SupersessionEligibility +{ + std::shared_ptr cache_owner; + const std::unordered_map *activation_ts_by_target + = nullptr; + std::uint64_t exclusion_ts = 0; + + bool + Contains (long long memory_id) const + { + if (!activation_ts_by_target) + return false; + const auto activation = activation_ts_by_target->find (memory_id); + return activation != activation_ts_by_target->end () + && activation->second >= 0 + && static_cast (activation->second) < exclusion_ts; + } + + std::vector + ActiveIds () const + { + std::vector active; + if (!activation_ts_by_target) + return active; + active.reserve (activation_ts_by_target->size ()); + for (const auto &[memory_id, activation_ts] : *activation_ts_by_target) + if (activation_ts >= 0 + && static_cast (activation_ts) < exclusion_ts) + active.push_back (memory_id); + return active; + } +}; + +SupersessionEligibility SupersededMemoryIds ( const ProcessorContext::AssociationFanoutCache *fanout_cache, const ProcessorContext &p_ctx, std::uint64_t exclusion_ts) { - std::unordered_set superseded; + SupersessionEligibility out; + out.exclusion_ts = exclusion_ts; if (!fanout_cache) - { - return superseded; - } - superseded.reserve (fanout_cache->in_by_target.size ()); - for (const auto &[target_memory_id, edges] : fanout_cache->in_by_target) - { - if (std::any_of (edges.begin (), edges.end (), [] (const auto &edge) { - return edge.edge_type == "supersedes"; - })) - { - const bool has_eligible_replacement = std::any_of ( - edges.begin (), edges.end (), [&] (const auto &edge) { - if (edge.edge_type != "supersedes") - { - return false; - } - const auto surface_it = p_ctx.retrieval_surface_index.find ( - edge.memory_id); - if (surface_it == p_ctx.retrieval_surface_index.end () - || surface_it->second - >= p_ctx.retrieval_surface_cache.size ()) - { - return false; - } - const auto &replacement - = p_ctx.retrieval_surface_cache[surface_it->second]; - return replacement.memory_id > 0 - && replacement.embedding_id > 0 - && replacement.start_ts >= 0 - && static_cast (replacement.start_ts) - < exclusion_ts - && (replacement.kind == "LONG_TERM" - || replacement.kind == "ASSOCIATION"); - }); - if (has_eligible_replacement) - { - superseded.insert (target_memory_id); - } - } - } - return superseded; + return out; + out.cache_owner = execution_cache_sidecar_internal::Find (p_ctx); + if (out.cache_owner + && out.cache_owner->supersession_eligibility.valid) + out.activation_ts_by_target + = &out.cache_owner->supersession_eligibility.activation_ts_by_target; + return out; } std::vector @@ -1368,6 +1486,10 @@ GraphAugmentedRetrieveCandidates::Execute (OperationContext &context, = !constructive_recall::Disabled (); const bool profile_graph_retrieval = internal::experimental_env::Flag ( "CORTEXT_PROFILE_GRAPH_RETRIEVAL"); + std::size_t family_exact_comparison_count = 0; + ScopedFamilyExactComparisonCounter family_counter_scope ( + profile_graph_retrieval ? &family_exact_comparison_count : nullptr); + std::size_t cache_rebuild_count = 0; auto profile_timing = [&context, profile_graph_retrieval] ( std::string_view name, @@ -1404,6 +1526,9 @@ GraphAugmentedRetrieveCandidates::Execute (OperationContext &context, bool cache_search_available = false; auto surface_search_state = historical_surface_search_cache_internal::Find (p_ctx); + SeedCacheProfile seed_cache_profile; + SeedCacheProfile *seed_cache_profile_ptr + = profile_graph_retrieval ? &seed_cache_profile : nullptr; const auto cache_surface_usable = [] (const auto &state) { return state && state->current_surface_search_current; }; @@ -1412,10 +1537,12 @@ GraphAugmentedRetrieveCandidates::Execute (OperationContext &context, { auto current_knn_rows = LoadCurrentSeedRowsFromCache ( p_ctx, signal.embedding, static_cast (exclusion_ts), - seed_search_limit, superseded_memory_ids, duplicate_threshold); + seed_search_limit, superseded_memory_ids, duplicate_threshold, + seed_cache_profile_ptr); auto historical_knn_rows = LoadHistoricalSeedRowsFromCache ( p_ctx, signal.embedding, static_cast (exclusion_ts), - seed_search_limit, superseded_memory_ids, duplicate_threshold); + seed_search_limit, superseded_memory_ids, duplicate_threshold, + seed_cache_profile_ptr); if (current_knn_rows && historical_knn_rows) { cache_search_available = true; @@ -1426,6 +1553,35 @@ GraphAugmentedRetrieveCandidates::Execute (OperationContext &context, } } profile_timing ("GraphRetrieve.seed_knn_cache", section_start); + if (profile_graph_retrieval) + { + context.AddOperationTiming ("GraphRetrieve.seed_cache_distance", + seed_cache_profile.distance_ms); + context.AddOperationTiming ("GraphRetrieve.seed_cache_eligibility", + seed_cache_profile.eligibility_ms); + context.AddOperationTiming ("GraphRetrieve.seed_cache_sort", + seed_cache_profile.sort_ms); + context.AddOperationTiming ("GraphRetrieve.seed_cache_family", + seed_cache_profile.family_ms); + context.AddOperationTiming ("GraphRetrieve.seed_cache_family_build", + seed_cache_profile.family_build_ms); + context.AddOperationTiming ("GraphRetrieve.seed_cache_family_compare", + seed_cache_profile.family_compare_ms); + context.AddOperationTiming ("GraphRetrieve.seed_cache_rows", + seed_cache_profile.rows_ms); + context.AddOperationTiming ( + "GraphRetrieve.seed_cache_distance_rows", + static_cast (seed_cache_profile.distance_rows)); + context.AddOperationTiming ( + "GraphRetrieve.seed_cache_eligibility_rows", + static_cast (seed_cache_profile.eligibility_rows)); + context.AddOperationTiming ( + "GraphRetrieve.seed_cache_ranked_rows", + static_cast (seed_cache_profile.ranked_rows)); + context.AddOperationTiming ( + "GraphRetrieve.seed_cache_selected_rows", + static_cast (seed_cache_profile.selected_rows)); + } if (!cache_search_available && surface_search_state && surface_search_state->processor_surface_complete) @@ -1434,12 +1590,13 @@ GraphAugmentedRetrieveCandidates::Execute (OperationContext &context, if (signal.retention != Retention::Ephemeral && RebuildCurrentSearchCacheFromProcessorSurface (p_ctx)) { + ++cache_rebuild_count; surface_search_state = historical_surface_search_cache_internal::Find (p_ctx); if (auto current_knn_rows = LoadCurrentSeedRowsFromCache ( p_ctx, signal.embedding, static_cast (exclusion_ts), seed_search_limit, - superseded_memory_ids, duplicate_threshold)) + superseded_memory_ids, duplicate_threshold, nullptr)) { cache_search_available = true; AppendUniqueRows (rows, std::move (*current_knn_rows), @@ -1466,6 +1623,7 @@ GraphAugmentedRetrieveCandidates::Execute (OperationContext &context, start_profile_timing (); if (RebuildSurfaceSearchCache (tx, p_ctx, embedding_dim)) { + ++cache_rebuild_count; surface_search_state = historical_surface_search_cache_internal::Find (p_ctx); if (cache_surface_usable (surface_search_state)) @@ -1473,11 +1631,11 @@ GraphAugmentedRetrieveCandidates::Execute (OperationContext &context, auto current_knn_rows = LoadCurrentSeedRowsFromCache ( p_ctx, signal.embedding, static_cast (exclusion_ts), seed_search_limit, - superseded_memory_ids, duplicate_threshold); + superseded_memory_ids, duplicate_threshold, nullptr); auto historical_knn_rows = LoadHistoricalSeedRowsFromCache ( p_ctx, signal.embedding, static_cast (exclusion_ts), seed_search_limit, - superseded_memory_ids, duplicate_threshold); + superseded_memory_ids, duplicate_threshold, nullptr); if (current_knn_rows && historical_knn_rows) { cache_search_available = true; @@ -1491,7 +1649,7 @@ GraphAugmentedRetrieveCandidates::Execute (OperationContext &context, else { historical_surface_search_cache_internal::MarkRecoveryFailed ( - p_ctx); + p_ctx, true); } profile_timing ("GraphRetrieve.seed_knn_cache_rebuild", section_start); } @@ -1532,7 +1690,7 @@ GraphAugmentedRetrieveCandidates::Execute (OperationContext &context, candidate.start_ts = AnyLongLong (row, "start_ts"); auto it_embedding = row.find ("embedding"); if (candidate.memory_id <= 0 || candidate.embedding_id <= 0 - || superseded_memory_ids.count (candidate.memory_id) != 0 + || superseded_memory_ids.Contains (candidate.memory_id) || it_embedding == row.end () || !AnyToEmbedding (it_embedding->second, embedding_dim, candidate.embedding)) @@ -1551,6 +1709,10 @@ GraphAugmentedRetrieveCandidates::Execute (OperationContext &context, } candidate.seed_score = core::Map01 ( Cosine (signal.embedding, candidate.embedding)); + candidate.source_confidence = OriginalEvidenceConfidence ( + p_ctx, candidate.memory_id, + signal.embedding) + .value_or (candidate.seed_score); candidate.temporal_score = TemporalScore ( signal.timestamp, candidate.start_ts, F, S, T); candidate.score = SemanticFirstScore ( @@ -1606,7 +1768,7 @@ GraphAugmentedRetrieveCandidates::Execute (OperationContext &context, int &expanded) { if (expanded >= fanout || !RetrievalEdgeType (edge.edge_type) || edge.memory_id <= 0 || edge.memory_id == seed.memory_id - || superseded_memory_ids.count (edge.memory_id) != 0) + || superseded_memory_ids.Contains (edge.memory_id)) { return; } @@ -1633,6 +1795,7 @@ GraphAugmentedRetrieveCandidates::Execute (OperationContext &context, candidate.embedding = surface.embedding; candidate.seed_score = core::Map01 ( Cosine (signal.embedding, candidate.embedding)); + candidate.source_confidence = candidate.seed_score; candidate.temporal_score = TemporalScore ( signal.timestamp, candidate.start_ts, F, S, T); candidate.graph_score = core::Clamp (edge.weight, 0.0, 1.0); @@ -1860,7 +2023,7 @@ GraphAugmentedRetrieveCandidates::Execute (OperationContext &context, } const double source_confidence - = core::Clamp (candidate.seed_score, 0.0, 1.0); + = core::Clamp (candidate.source_confidence, 0.0, 1.0); const double candidate_score = core::Clamp (candidate.score, 0.0, 1.0); const double context_score @@ -1966,6 +2129,32 @@ GraphAugmentedRetrieveCandidates::Execute (OperationContext &context, retrieval_trace::SetLastRetrievalSummary ({}); context.SetRetrievedMemoryEmbeddings (std::move (out)); context.SetRetrievedMemoryCandidates (std::move (retrieved_candidates)); + if (profile_graph_retrieval) + { + context.AddOperationTiming ( + "GraphRetrieve.candidate_count", + static_cast (ranked_all.size ())); + context.AddOperationTiming ("GraphRetrieve.candidate_activity", + ranked_all.empty () ? 0.0 : 1.0); + context.AddOperationTiming ( + "GraphRetrieve.family_exact_comparison_count", + static_cast (family_exact_comparison_count)); + context.AddOperationTiming ( + "GraphRetrieve.family_exact_comparison_activity", + family_exact_comparison_count > 0 ? 1.0 : 0.0); + context.AddOperationTiming ( + "GraphRetrieve.cache_rebuild_count", + static_cast (cache_rebuild_count)); + context.AddOperationTiming ("GraphRetrieve.cache_rebuild_activity", + cache_rebuild_count > 0 ? 1.0 : 0.0); + const std::size_t rows_visited = std::max ( + seed_cache_profile.distance_rows, rows.size ()); + context.AddOperationTiming ( + "GraphRetrieve.rows_visited", + static_cast (rows_visited)); + context.AddOperationTiming ("GraphRetrieve.rows_visited_activity", + rows_visited > 0 ? 1.0 : 0.0); + } context.AddOperationTiming ( "GraphRetrieve.total", std::chrono::duration ( diff --git a/src/operations/historical_surface_search_cache_internal.hpp b/src/operations/historical_surface_search_cache_internal.hpp index ea1a902a..b602cc7c 100644 --- a/src/operations/historical_surface_search_cache_internal.hpp +++ b/src/operations/historical_surface_search_cache_internal.hpp @@ -1,6 +1,7 @@ #pragma once #include "cortext/processor/processor_context.hpp" +#include "family_embedding_features_internal.hpp" #include @@ -12,6 +13,7 @@ #include #include #include +#include #include #include @@ -29,19 +31,25 @@ struct Entry }; long long embedding_id = 0; + long long base_embedding_id = 0; long long memory_id = 0; long long start_ts = 0; std::string kind; std::string source_id; Eigen::VectorXf embedding; std::vector memory_references; + mutable std::optional + family_features; Entry () = default; Entry (long long embedding_id_value, long long memory_id_value, long long start_ts_value, std::string kind_value, - std::string source_id_value, Eigen::VectorXf embedding_value) - : embedding_id (embedding_id_value), memory_id (memory_id_value), + std::string source_id_value, Eigen::VectorXf embedding_value, + long long base_embedding_id_value = 0) + : embedding_id (embedding_id_value), + base_embedding_id (base_embedding_id_value), + memory_id (memory_id_value), start_ts (start_ts_value), kind (std::move (kind_value)), source_id (std::move (source_id_value)), embedding (std::move (embedding_value)) @@ -49,12 +57,69 @@ struct Entry } }; +inline const family_embedding_features_internal::Features & +FamilyFeatures (const Entry &entry) +{ + if (!entry.family_features) + entry.family_features + = family_embedding_features_internal::Build (entry.embedding); + return *entry.family_features; +} + struct RankedEntry { std::size_t index = 0; float distance = 0.0f; }; +inline bool +HasLongTermReference (const Entry &entry) +{ + return std::any_of (entry.memory_references.begin (), + entry.memory_references.end (), [] (const auto &reference) { + return reference.memory_id > 0 + && reference.kind == "LONG_TERM"; + }); +} + +inline bool +IsSupersessionCandidateEntry (const Entry &entry) +{ + return std::any_of ( + entry.memory_references.begin (), entry.memory_references.end (), + [] (const auto &reference) { + return reference.memory_id > 0 + && (reference.kind == "LONG_TERM" + || reference.kind == "ASSOCIATION"); + }); +} + +inline std::size_t +SupersessionReferenceCount (const Entry &entry) +{ + return static_cast (std::count_if ( + entry.memory_references.begin (), entry.memory_references.end (), + [] (const auto &reference) { + return reference.memory_id > 0 + && (reference.kind == "LONG_TERM" + || reference.kind == "ASSOCIATION"); + })); +} + +inline const Entry::MemoryReference * +FindSupersessionMemoryReference (const Entry &entry, long long memory_id) +{ + const auto reference = std::find_if ( + entry.memory_references.begin (), entry.memory_references.end (), + [memory_id] (const auto &candidate) { + return candidate.memory_id == memory_id + && (candidate.kind == "LONG_TERM" + || candidate.kind == "ASSOCIATION"); + }); + return reference == entry.memory_references.end () ? nullptr + : &*reference; +} + struct State { bool recovery_failed = false; @@ -65,6 +130,19 @@ struct State std::vector entries; std::vector search; std::unordered_map embedding_index; + std::vector long_term_entry_indices; + std::unordered_map long_term_index_positions; + std::vector supersession_entry_indices; + std::unordered_map + supersession_index_positions; + std::unordered_map + supersession_entry_by_memory; + std::unordered_set supersession_population_mismatches; + bool supersession_population_ambiguous = false; + bool supersession_tie_order_equivalent = true; + bool supersession_embedding_fanout = false; + long long supersession_max_embedding_id = 0; + long long supersession_max_memory_id = 0; std::vector current_entries; std::vector current_search; std::unordered_map current_memory_index; @@ -72,6 +150,56 @@ struct State mutable std::vector ranked_scratch; }; +inline bool +CurrentMatchesSupersessionEntry (const State &state, long long memory_id) +{ + const auto historical = state.supersession_entry_by_memory.find (memory_id); + const auto current = state.current_memory_index.find (memory_id); + if (historical == state.supersession_entry_by_memory.end () + || current == state.current_memory_index.end () + || historical->second >= state.entries.size () + || current->second >= state.current_entries.size ()) + return false; + const auto &base = state.entries[historical->second]; + const auto &surface = state.current_entries[current->second]; + return surface.base_embedding_id == base.embedding_id + && surface.embedding.size () == base.embedding.size () + && surface.embedding.isApprox (base.embedding, 0.0f); +} + +inline void +RefreshSupersessionPopulationMismatch (State &state, long long memory_id) +{ + const bool has_historical + = state.supersession_entry_by_memory.count (memory_id) != 0; + const bool has_current = state.current_memory_index.count (memory_id) != 0; + if (!has_historical && !has_current) + { + state.supersession_population_mismatches.erase (memory_id); + return; + } + if (CurrentMatchesSupersessionEntry (state, memory_id)) + state.supersession_population_mismatches.erase (memory_id); + else + state.supersession_population_mismatches.insert (memory_id); +} + +inline bool +CurrentPopulationCoversHistorical (const State &state, + long long excluded_memory_id) +{ + if (state.supersession_population_ambiguous + || state.supersession_embedding_fanout + || !state.supersession_tie_order_equivalent) + return false; + if (state.supersession_population_mismatches.empty ()) + return true; + return state.supersession_population_mismatches.size () == 1 + && state.supersession_population_mismatches.count ( + excluded_memory_id) + == 1; +} + struct SupersessionCandidate { long long memory_id = 0; @@ -190,19 +318,26 @@ SetProcessorSurfaceComplete (const ProcessorContext &ctx, bool complete) } inline void -MarkRecoveryFailed (const ProcessorContext &ctx) +MarkRecoveryFailed (const ProcessorContext &ctx, + bool preserve_surface_state = false) { auto state = std::make_shared (); state->recovery_failed = true; auto ®istry = Registry (); std::lock_guard lock (registry.mutex); const auto existing = registry.states.find (&ctx); - if (existing != registry.states.end () && existing->second) + if (preserve_surface_state && existing != registry.states.end () + && existing->second) { state->current_surface_database_current = existing->second->current_surface_database_current; state->processor_surface_complete = existing->second->processor_surface_complete; + // Preserve only the current-to-base lineage needed to reconstruct the + // search surface. The searchable vector buffer is intentionally not + // copied, and recovery_failed keeps every cache reader fail-closed. + state->current_entries = existing->second->current_entries; + state->current_memory_index = existing->second->current_memory_index; } registry.states[&ctx] = std::move (state); } @@ -300,6 +435,57 @@ Reset (const ProcessorContext &ctx, std::vector entries, } state->search.insert (state->search.end (), entry.embedding.data (), entry.embedding.data () + entry.embedding.size ()); + if (HasLongTermReference (entry)) + { + state->long_term_index_positions.emplace ( + index, state->long_term_entry_indices.size ()); + state->long_term_entry_indices.push_back (index); + } + if (IsSupersessionCandidateEntry (entry)) + { + state->supersession_embedding_fanout + = state->supersession_embedding_fanout + || SupersessionReferenceCount (entry) > 1; + state->supersession_index_positions.emplace ( + index, state->supersession_entry_indices.size ()); + state->supersession_entry_indices.push_back (index); + for (const auto &reference : entry.memory_references) + { + if (reference.memory_id <= 0 + || (reference.kind != "LONG_TERM" + && reference.kind != "ASSOCIATION")) + continue; + if (!state->supersession_entry_by_memory.emplace ( + reference.memory_id, index) + .second) + state->supersession_population_ambiguous = true; + } + } + } + std::vector> supersession_order; + supersession_order.reserve (state->supersession_entry_by_memory.size ()); + for (const auto &[memory_id, index] : + state->supersession_entry_by_memory) + { + if (index >= state->entries.size ()) + { + Erase (ctx); + return false; + } + supersession_order.emplace_back (state->entries[index].embedding_id, + memory_id); + } + std::sort (supersession_order.begin (), supersession_order.end ()); + for (std::size_t index = 0; index < supersession_order.size (); ++index) + { + const auto &[embedding_id, memory_id] = supersession_order[index]; + if (index > 0 + && memory_id <= supersession_order[index - 1].second) + state->supersession_tie_order_equivalent = false; + state->supersession_max_embedding_id + = std::max (state->supersession_max_embedding_id, embedding_id); + state->supersession_max_memory_id + = std::max (state->supersession_max_memory_id, memory_id); } state->current_entries = std::move (current_entries); state->current_memory_index.reserve (state->current_entries.size ()); @@ -308,7 +494,9 @@ Reset (const ProcessorContext &ctx, std::vector entries, * static_cast (state->embedding_dim)); for (std::size_t index = 0; index < state->current_entries.size (); ++index) { - const auto &entry = state->current_entries[index]; + auto &entry = state->current_entries[index]; + if (entry.base_embedding_id <= 0) + entry.base_embedding_id = entry.embedding_id; if (entry.memory_id <= 0 || entry.embedding_id <= 0 || entry.embedding.size () != state->embedding_dim || !state->current_memory_index.emplace (entry.memory_id, index) @@ -322,6 +510,14 @@ Reset (const ProcessorContext &ctx, std::vector entries, entry.embedding.data () + entry.embedding.size ()); } + for (const auto &[memory_id, index] : + state->supersession_entry_by_memory) + { + (void)index; + state->supersession_population_mismatches.insert (memory_id); + } + for (const auto &entry : state->current_entries) + RefreshSupersessionPopulationMismatch (*state, entry.memory_id); auto ®istry = Registry (); state->current_surface_search_current = true; std::lock_guard lock (registry.mutex); @@ -352,6 +548,9 @@ UpsertCurrent (const ProcessorContext &ctx, Entry entry) if (existing != state.current_memory_index.end ()) { const std::size_t index = existing->second; + if (entry.base_embedding_id <= 0) + entry.base_embedding_id + = state.current_entries[index].base_embedding_id; state.current_entries[index] = std::move (entry); const std::size_t offset = index * static_cast (state.embedding_dim); @@ -360,14 +559,36 @@ UpsertCurrent (const ProcessorContext &ctx, Entry entry) + state.embedding_dim, state.current_search.begin () + static_cast (offset)); + RefreshSupersessionPopulationMismatch ( + state, state.current_entries[index].memory_id); return; } + if (entry.base_embedding_id <= 0) + entry.base_embedding_id = entry.embedding_id; state.current_memory_index.emplace (entry.memory_id, state.current_entries.size ()); state.current_search.insert (state.current_search.end (), entry.embedding.data (), entry.embedding.data () + entry.embedding.size ()); state.current_entries.push_back (std::move (entry)); + RefreshSupersessionPopulationMismatch ( + state, state.current_entries.back ().memory_id); +} + +inline long long +BaseEmbeddingIdForMemory (const ProcessorContext &ctx, long long memory_id, + long long fallback_embedding_id) +{ + const auto state = Find (ctx); + if (!state) + return fallback_embedding_id; + const auto index = state->current_memory_index.find (memory_id); + if (index == state->current_memory_index.end () + || index->second >= state->current_entries.size ()) + return fallback_embedding_id; + const long long base_embedding_id + = state->current_entries[index->second].base_embedding_id; + return base_embedding_id > 0 ? base_embedding_id : fallback_embedding_id; } inline void @@ -408,6 +629,7 @@ RemoveCurrent (const ProcessorContext &ctx, long long memory_id) state.current_search.resize ( state.current_entries.size () * static_cast (state.embedding_dim)); + RefreshSupersessionPopulationMismatch (state, memory_id); } inline void @@ -441,9 +663,50 @@ Append (const ProcessorContext &ctx, Entry entry) { entry.memory_id, entry.start_ts, entry.kind, entry.source_id }); } state.embedding_index.emplace (entry.embedding_id, state.entries.size ()); + const std::size_t index = state.entries.size (); state.search.insert (state.search.end (), entry.embedding.data (), entry.embedding.data () + entry.embedding.size ()); state.entries.push_back (std::move (entry)); + if (HasLongTermReference (state.entries.back ())) + { + state.long_term_index_positions.emplace ( + index, state.long_term_entry_indices.size ()); + state.long_term_entry_indices.push_back (index); + } + if (IsSupersessionCandidateEntry (state.entries.back ())) + { + const auto &candidate = state.entries.back (); + state.supersession_embedding_fanout + = state.supersession_embedding_fanout + || SupersessionReferenceCount (candidate) > 1; + state.supersession_index_positions.emplace ( + index, state.supersession_entry_indices.size ()); + state.supersession_entry_indices.push_back (index); + long long candidate_max_memory_id = 0; + for (const auto &reference : candidate.memory_references) + { + if (reference.memory_id <= 0 + || (reference.kind != "LONG_TERM" + && reference.kind != "ASSOCIATION")) + continue; + if (!state.supersession_entry_by_memory.emplace ( + reference.memory_id, index) + .second) + state.supersession_population_ambiguous = true; + if (reference.memory_id <= state.supersession_max_memory_id) + state.supersession_tie_order_equivalent = false; + candidate_max_memory_id + = std::max (candidate_max_memory_id, reference.memory_id); + RefreshSupersessionPopulationMismatch (state, + reference.memory_id); + } + if (candidate.embedding_id <= state.supersession_max_embedding_id) + state.supersession_tie_order_equivalent = false; + state.supersession_max_embedding_id = std::max ( + state.supersession_max_embedding_id, candidate.embedding_id); + state.supersession_max_memory_id = std::max ( + state.supersession_max_memory_id, candidate_max_memory_id); + } } inline void @@ -471,10 +734,82 @@ RemoveEmbedding (const ProcessorContext &ctx, long long embedding_id) return; } const std::size_t last = state.entries.size () - 1; + std::vector removed_supersession_memory_ids; + if (IsSupersessionCandidateEntry (state.entries[index])) + for (const auto &reference : state.entries[index].memory_references) + if (reference.memory_id > 0 + && (reference.kind == "LONG_TERM" + || reference.kind == "ASSOCIATION")) + removed_supersession_memory_ids.push_back (reference.memory_id); + const auto long_term_position = state.long_term_index_positions.find (index); + if (long_term_position != state.long_term_index_positions.end ()) + { + const std::size_t position = long_term_position->second; + const std::size_t last_position + = state.long_term_entry_indices.size () - 1; + if (position != last_position) + { + const std::size_t moved_index + = state.long_term_entry_indices[last_position]; + state.long_term_entry_indices[position] = moved_index; + state.long_term_index_positions[moved_index] = position; + } + state.long_term_entry_indices.pop_back (); + state.long_term_index_positions.erase (long_term_position); + } + const auto supersession_position + = state.supersession_index_positions.find (index); + if (supersession_position != state.supersession_index_positions.end ()) + { + const std::size_t position = supersession_position->second; + const std::size_t last_position + = state.supersession_entry_indices.size () - 1; + if (position != last_position) + { + const std::size_t moved_index + = state.supersession_entry_indices[last_position]; + state.supersession_entry_indices[position] = moved_index; + state.supersession_index_positions[moved_index] = position; + } + state.supersession_entry_indices.pop_back (); + state.supersession_index_positions.erase (supersession_position); + for (const long long memory_id : removed_supersession_memory_ids) + state.supersession_entry_by_memory.erase (memory_id); + } if (index != last) { state.entries[index] = std::move (state.entries[last]); state.embedding_index[state.entries[index].embedding_id] = index; + const auto moved_long_term_position + = state.long_term_index_positions.find (last); + if (moved_long_term_position != state.long_term_index_positions.end ()) + { + state.long_term_entry_indices[moved_long_term_position->second] + = index; + state.long_term_index_positions.emplace ( + index, moved_long_term_position->second); + state.long_term_index_positions.erase (moved_long_term_position); + } + const auto moved_supersession_position + = state.supersession_index_positions.find (last); + if (moved_supersession_position + != state.supersession_index_positions.end ()) + { + state.supersession_entry_indices[ + moved_supersession_position->second] = index; + state.supersession_index_positions.emplace ( + index, moved_supersession_position->second); + state.supersession_index_positions.erase ( + moved_supersession_position); + if (IsSupersessionCandidateEntry (state.entries[index])) + for (const auto &reference : + state.entries[index].memory_references) + if (reference.memory_id > 0 + && (reference.kind == "LONG_TERM" + || reference.kind == "ASSOCIATION")) + state.supersession_entry_by_memory[reference.memory_id] + = index; + } const std::size_t dst = index * static_cast (state.embedding_dim); const std::size_t src @@ -486,7 +821,14 @@ RemoveEmbedding (const ProcessorContext &ctx, long long embedding_id) state.embedding_index.erase (embedding_id); state.entries.pop_back (); state.search.resize (state.entries.size () - * static_cast (state.embedding_dim)); + * static_cast (state.embedding_dim)); + state.supersession_embedding_fanout = std::any_of ( + state.entries.begin (), state.entries.end (), [] (const auto &entry) { + return SupersessionReferenceCount (entry) > 1; + }); + for (const long long memory_id : removed_supersession_memory_ids) + RefreshSupersessionPopulationMismatch ( + state, memory_id); } #ifdef CORTEXT_TESTING diff --git a/src/operations/memory_storage.cpp b/src/operations/memory_storage.cpp index 46c77836..2658f667 100644 --- a/src/operations/memory_storage.cpp +++ b/src/operations/memory_storage.cpp @@ -1,6 +1,8 @@ #include "cortext/operations/memory_storage.hpp" #include "constructive_recall_internal.hpp" #include "historical_surface_search_cache_internal.hpp" +#include "association_fanout_cache_internal.hpp" +#include "emotional_metadata_cache_internal.hpp" #include "signal_record_rollback_internal.hpp" #include "cortext/core/algorithms.hpp" #include "cortext/core/knobs.hpp" @@ -137,6 +139,14 @@ struct BorrowedSupersessionCandidate const Eigen::VectorXf *embedding = nullptr; }; +struct CurrentSupersessionSearchProof +{ + bool valid = false; + std::vector ranked_memory_ids; + float cutoff_distance = 0.0f; + long long cutoff_memory_id = 0; +}; + using historical_surface_search_cache_internal::SupersessionCandidate; using historical_surface_search_cache_internal::SupersessionCandidateRows; @@ -144,7 +154,8 @@ void AppendUniqueBorrowedSupersessionRows ( std::vector &rows, std::vector extra_rows, - std::unordered_set &seen_memory_ids) + std::unordered_set &seen_memory_ids, + std::size_t *accepted_count = nullptr) { for (const auto &row : extra_rows) { @@ -154,6 +165,8 @@ AppendUniqueBorrowedSupersessionRows ( continue; } rows.push_back ({ row.memory_id, row.embedding, std::nullopt }); + if (accepted_count) + ++*accepted_count; } } @@ -161,7 +174,8 @@ void AppendUniqueOwnedSupersessionRows ( std::vector &rows, std::vector> extra_rows, - std::unordered_set &seen_memory_ids, int embedding_dim) + std::unordered_set &seen_memory_ids, int embedding_dim, + std::size_t *accepted_count = nullptr) { for (auto &row : extra_rows) { @@ -189,7 +203,170 @@ AppendUniqueOwnedSupersessionRows ( } } rows.push_back (std::move (candidate)); + if (accepted_count) + ++*accepted_count; + } +} + +std::optional +HistoricalCandidatePopulationCovered ( + const historical_surface_search_cache_internal::State &state, + const Eigen::VectorXf &query_embedding, long long memory_id, + long long end_ts, int candidate_limit, + const std::unordered_set &seen_memory_ids, + std::size_t *rows_visited) +{ + if (rows_visited) + *rows_visited += state.supersession_entry_indices.size (); + auto &ranked = state.ranked_scratch; + ranked.clear (); + ranked.reserve (state.supersession_entry_indices.size ()); + for (const std::size_t index : state.supersession_entry_indices) + { + if (index >= state.entries.size ()) + return std::nullopt; + const auto &entry = state.entries[index]; + if (!historical_surface_search_cache_internal:: + IsSupersessionCandidateEntry (entry) + || entry.embedding.size () != query_embedding.size ()) + return std::nullopt; + ranked.push_back ( + { index, (entry.embedding - query_embedding).squaredNorm () }); + } + auto by_distance = [&state] ( + const historical_surface_search_cache_internal::RankedEntry &a, + const historical_surface_search_cache_internal::RankedEntry &b) { + if (a.distance != b.distance) + return a.distance < b.distance; + return state.entries[a.index].embedding_id + < state.entries[b.index].embedding_id; + }; + if (static_cast (ranked.size ()) > candidate_limit) + { + std::nth_element (ranked.begin (), ranked.begin () + candidate_limit, + ranked.end (), by_distance); + ranked.resize (static_cast (candidate_limit)); } + std::sort (ranked.begin (), ranked.end (), by_distance); + return std::all_of ( + ranked.begin (), ranked.end (), [&] (const auto &candidate) { + const auto &entry = state.entries[candidate.index]; + return std::all_of ( + entry.memory_references.begin (), + entry.memory_references.end (), [&] (const auto &reference) { + if (reference.kind != "LONG_TERM" + && reference.kind != "ASSOCIATION") + return true; + return reference.memory_id == memory_id + || reference.start_ts >= end_ts + || seen_memory_ids.count (reference.memory_id) != 0; + }); + }); +} + +bool +HistoricalCandidatePopulationCoveredByCurrentProof ( + const historical_surface_search_cache_internal::State &state, + const Eigen::VectorXf &query_embedding, long long excluded_memory_id, + long long end_ts, int candidate_limit, + const std::unordered_set &seen_memory_ids, + const CurrentSupersessionSearchProof &proof) +{ + if (!proof.valid || state.supersession_population_ambiguous + || state.supersession_embedding_fanout + || !state.supersession_tie_order_equivalent) + return false; + std::unordered_set ranked_current ( + proof.ranked_memory_ids.begin (), proof.ranked_memory_ids.end ()); + auto base_order_less = [&] (float left_distance, long long left_memory_id, + float right_distance, + long long right_memory_id) { + return left_distance < right_distance + || (left_distance == right_distance + && left_memory_id < right_memory_id); + }; + const bool current_population_exhausted + = static_cast (proof.ranked_memory_ids.size ()) < candidate_limit; + + for (const long long memory_id : + state.supersession_population_mismatches) + { + const auto base_it + = state.supersession_entry_by_memory.find (memory_id); + const auto current_it = state.current_memory_index.find (memory_id); + const bool in_current_top_k + = ranked_current.count (memory_id) != 0; + if (base_it == state.supersession_entry_by_memory.end ()) + { + if (!current_population_exhausted && in_current_top_k) + return false; + continue; + } + if (base_it->second >= state.entries.size ()) + return false; + const auto &base = state.entries[base_it->second]; + const auto *reference + = historical_surface_search_cache_internal:: + FindSupersessionMemoryReference (base, memory_id); + if (!reference) + return false; + if (reference->memory_id == excluded_memory_id + || reference->start_ts >= end_ts) + continue; + if (current_population_exhausted) + { + if (seen_memory_ids.count (reference->memory_id) == 0) + return false; + continue; + } + if (base.embedding.size () != query_embedding.size ()) + return false; + const float base_distance + = (base.embedding - query_embedding).squaredNorm (); + const bool base_before_cutoff = base_order_less ( + base_distance, reference->memory_id, proof.cutoff_distance, + proof.cutoff_memory_id); + const bool cutoff_before_base = base_order_less ( + proof.cutoff_distance, proof.cutoff_memory_id, base_distance, + reference->memory_id); + if (current_it == state.current_memory_index.end ()) + { + if (base_before_cutoff) + return false; + continue; + } + if (in_current_top_k) + { + if (cutoff_before_base + || seen_memory_ids.count (reference->memory_id) == 0) + return false; + } + else if (base_before_cutoff) + { + return false; + } + } + + for (const long long memory_id : proof.ranked_memory_ids) + { + const auto base_it + = state.supersession_entry_by_memory.find (memory_id); + if (base_it == state.supersession_entry_by_memory.end ()) + continue; + if (base_it->second >= state.entries.size ()) + return false; + const auto &base = state.entries[base_it->second]; + const auto *reference + = historical_surface_search_cache_internal:: + FindSupersessionMemoryReference (base, memory_id); + if (!reference) + return false; + if (reference->memory_id != excluded_memory_id + && reference->start_ts < end_ts + && seen_memory_ids.count (reference->memory_id) == 0) + return false; + } + return true; } std::optional> @@ -197,8 +374,15 @@ LoadHistoricalSupersessionRowsFromCache ( const std::shared_ptr< const historical_surface_search_cache_internal::State> &state, const Eigen::VectorXf &query_embedding, - long long memory_id, long long end_ts, int candidate_limit) + long long memory_id, long long end_ts, int candidate_limit, + const std::unordered_set &seen_memory_ids, + const CurrentSupersessionSearchProof ¤t_search_proof, + bool *coverage_proven, std::size_t *rows_visited) { + if (coverage_proven) + *coverage_proven = false; + if (rows_visited) + *rows_visited = 0; const std::size_t embedding_count = state ? state->entries.size () : 0; const int embedding_dim = static_cast (query_embedding.size ()); if (!state || embedding_dim <= 0 || candidate_limit <= 0 @@ -209,11 +393,43 @@ LoadHistoricalSupersessionRowsFromCache ( return std::nullopt; } + if (historical_surface_search_cache_internal:: + CurrentPopulationCoversHistorical (*state, memory_id)) + { + if (coverage_proven) + *coverage_proven = true; + return std::vector{}; + } + + if (HistoricalCandidatePopulationCoveredByCurrentProof ( + *state, query_embedding, memory_id, end_ts, candidate_limit, + seen_memory_ids, current_search_proof)) + { + if (coverage_proven) + *coverage_proven = true; + return std::vector{}; + } + + const auto candidate_population_covered + = HistoricalCandidatePopulationCovered ( + *state, query_embedding, memory_id, end_ts, candidate_limit, + seen_memory_ids, rows_visited); + if (!candidate_population_covered) + return std::nullopt; + if (*candidate_population_covered) + { + if (coverage_proven) + *coverage_proven = true; + return std::vector{}; + } + using RowMajorMatrix = Eigen::Matrix; const Eigen::Map matrix ( state->search.data (), static_cast (embedding_count), embedding_dim); + if (rows_visited) + *rows_visited += embedding_count; auto &distance_scratch = state->distance_scratch; distance_scratch.resize (embedding_count); Eigen::Map distances ( @@ -257,13 +473,16 @@ LoadHistoricalSupersessionRowsFromCache ( for (const auto &candidate : ranked) { const auto &entry = state->entries[candidate.index]; - if (entry.memory_id <= 0 || entry.memory_id == memory_id - || (entry.kind != "LONG_TERM" && entry.kind != "ASSOCIATION") - || entry.start_ts >= end_ts) + for (const auto &reference : entry.memory_references) { - continue; + if (reference.memory_id <= 0 || reference.memory_id == memory_id + || (reference.kind != "LONG_TERM" + && reference.kind != "ASSOCIATION") + || reference.start_ts >= end_ts + || seen_memory_ids.count (reference.memory_id) != 0) + continue; + rows.push_back ({ reference.memory_id, &entry.embedding }); } - rows.push_back ({ entry.memory_id, &entry.embedding }); } return rows; } @@ -273,8 +492,13 @@ LoadCurrentSupersessionRowsFromCache ( const std::shared_ptr< const historical_surface_search_cache_internal::State> &state, const ProcessorContext &p_ctx, const Eigen::VectorXf &query_embedding, - long long memory_id, long long end_ts, int candidate_limit) + long long memory_id, long long end_ts, int candidate_limit, + CurrentSupersessionSearchProof *proof, std::size_t *rows_visited) { + if (proof) + *proof = {}; + if (rows_visited) + *rows_visited = 0; const std::size_t entry_count = state ? state->current_entries.size () : 0; const int embedding_dim = static_cast (query_embedding.size ()); if (!state || embedding_dim <= 0 || candidate_limit <= 0 @@ -286,14 +510,17 @@ LoadCurrentSupersessionRowsFromCache ( } if (entry_count == 0) { + if (proof) + proof->valid = true; return std::vector{}; } - using RowMajorMatrix = Eigen::Matrix; const Eigen::Map matrix ( state->current_search.data (), static_cast (entry_count), embedding_dim); + if (rows_visited) + *rows_visited = entry_count; auto &distance_scratch = state->distance_scratch; distance_scratch.resize (entry_count); Eigen::Map distances ( @@ -309,9 +536,7 @@ LoadCurrentSupersessionRowsFromCache ( const auto &entry = state->current_entries[index]; if (entry.memory_id <= 0 || entry.embedding_id <= 0 || entry.embedding.size () != embedding_dim) - { - return std::nullopt; - } + return std::nullopt; ranked.push_back ( { index, distances[static_cast (index)] }); } @@ -319,9 +544,7 @@ LoadCurrentSupersessionRowsFromCache ( const historical_surface_search_cache_internal::RankedEntry &a, const historical_surface_search_cache_internal::RankedEntry &b) { if (a.distance != b.distance) - { - return a.distance < b.distance; - } + return a.distance < b.distance; return state->current_entries[a.index].memory_id < state->current_entries[b.index].memory_id; }; @@ -333,6 +556,21 @@ LoadCurrentSupersessionRowsFromCache ( } std::sort (ranked.begin (), ranked.end (), by_distance); + if (proof) + { + proof->valid = true; + proof->ranked_memory_ids.reserve (ranked.size ()); + for (const auto &candidate : ranked) + proof->ranked_memory_ids.push_back ( + state->current_entries[candidate.index].memory_id); + if (!ranked.empty ()) + { + proof->cutoff_distance = ranked.back ().distance; + proof->cutoff_memory_id + = state->current_entries[ranked.back ().index].memory_id; + } + } + std::vector rows; rows.reserve (ranked.size ()); for (const auto &candidate : ranked) @@ -358,7 +596,7 @@ LoadCurrentSupersessionRowsFromCache ( } SupersessionCandidateRows -LoadSupersessionCandidateRows (Transaction &tx, +LoadSupersessionCandidateRows (OperationContext &context, Transaction &tx, const ProcessorContext &p_ctx, const Eigen::VectorXf &embedding_to_store, long long memory_id, long long end_ts, @@ -368,17 +606,27 @@ LoadSupersessionCandidateRows (Transaction &tx, result.cache_owner = historical_surface_search_cache_internal::Find (p_ctx); std::unordered_set seen_memory_ids; + std::size_t current_execution_count = 0; + std::size_t historical_execution_count = 0; + std::size_t current_rows_visited = 0; + std::size_t historical_rows_visited = 0; + std::size_t sql_fallback_count = 0; + CurrentSupersessionSearchProof current_search_proof; const std::vector query_embedding = ToFloatVector ( embedding_to_store); - if (auto current_rows = LoadCurrentSupersessionRowsFromCache ( - result.cache_owner, p_ctx, embedding_to_store, memory_id, end_ts, - candidate_limit)) + const auto current_start = SteadyClock::now (); + auto current_cache_rows = LoadCurrentSupersessionRowsFromCache ( + result.cache_owner, p_ctx, embedding_to_store, memory_id, end_ts, + candidate_limit, ¤t_search_proof, ¤t_rows_visited); + if (current_cache_rows) { AppendUniqueBorrowedSupersessionRows ( - result.rows, std::move (*current_rows), seen_memory_ids); + result.rows, std::move (*current_cache_rows), seen_memory_ids, + ¤t_execution_count); } else { + ++sql_fallback_count; try { auto current_rows = tx.Execute ( @@ -397,7 +645,8 @@ LoadSupersessionCandidateRows (Transaction &tx, memory_id, end_ts }); AppendUniqueOwnedSupersessionRows ( result.rows, std::move (current_rows), seen_memory_ids, - static_cast (embedding_to_store.size ())); + static_cast (embedding_to_store.size ()), + ¤t_execution_count); } catch (const std::exception &e) { @@ -406,16 +655,25 @@ LoadSupersessionCandidateRows (Transaction &tx, { telemetry::Attribute::String ("error", e.what ()) }); } } - - if (auto historical_rows = LoadHistoricalSupersessionRowsFromCache ( - result.cache_owner, embedding_to_store, memory_id, end_ts, - candidate_limit)) + context.AddOperationTiming ("MemoryStorage.supersession_current_load", + ElapsedMillis (current_start)); + const auto current_count = result.rows.size (); + + const auto historical_start = SteadyClock::now (); + bool historical_coverage_proven = false; + auto historical_cache_rows = LoadHistoricalSupersessionRowsFromCache ( + result.cache_owner, embedding_to_store, memory_id, end_ts, + candidate_limit, seen_memory_ids, current_search_proof, + &historical_coverage_proven, &historical_rows_visited); + if (historical_cache_rows) { AppendUniqueBorrowedSupersessionRows ( - result.rows, std::move (*historical_rows), seen_memory_ids); + result.rows, std::move (*historical_cache_rows), seen_memory_ids, + &historical_execution_count); } else { + ++sql_fallback_count; try { auto historical_rows = tx.Execute ( @@ -432,7 +690,8 @@ LoadSupersessionCandidateRows (Transaction &tx, memory_id, end_ts }); AppendUniqueOwnedSupersessionRows ( result.rows, std::move (historical_rows), seen_memory_ids, - static_cast (embedding_to_store.size ())); + static_cast (embedding_to_store.size ()), + &historical_execution_count); } catch (const std::exception &e) { @@ -441,9 +700,58 @@ LoadSupersessionCandidateRows (Transaction &tx, { telemetry::Attribute::String ("error", e.what ()) }); } } - - if (result.rows.empty ()) + context.AddOperationTiming ("MemoryStorage.supersession_historical_load", + ElapsedMillis (historical_start)); + context.AddOperationTiming ( + "MemoryStorage.supersession_historical_coverage_proven", + historical_coverage_proven ? 1.0 : 0.0); + if (result.cache_owner) + { + context.AddOperationTiming ( + "MemoryStorage.supersession_population_mismatch_count", + static_cast ( + result.cache_owner->supersession_population_mismatches.size ())); + context.AddOperationTiming ( + "MemoryStorage.supersession_population_ambiguous", + result.cache_owner->supersession_population_ambiguous ? 1.0 : 0.0); + context.AddOperationTiming ( + "MemoryStorage.supersession_tie_order_equivalent", + result.cache_owner->supersession_tie_order_equivalent ? 1.0 : 0.0); + } + context.AddOperationTiming ( + "MemoryStorage.supersession_current_candidate_count", + static_cast (current_count)); + context.AddOperationTiming ( + "MemoryStorage.supersession_current_candidate_activity", + current_count > 0 ? 1.0 : 0.0); + context.AddOperationTiming ( + "MemoryStorage.supersession_historical_candidate_count", + static_cast (result.rows.size () - current_count)); + context.AddOperationTiming ( + "MemoryStorage.supersession_historical_candidate_activity", + result.rows.size () > current_count ? 1.0 : 0.0); + context.AddOperationTiming ( + "MemoryStorage.supersession_current_candidate_execution_count", + static_cast (current_execution_count)); + context.AddOperationTiming ( + "MemoryStorage.supersession_historical_candidate_execution_count", + static_cast (historical_execution_count)); + context.AddOperationTiming ( + "MemoryStorage.supersession_current_rows_visited", + static_cast (current_rows_visited)); + context.AddOperationTiming ( + "MemoryStorage.supersession_historical_rows_visited", + static_cast (historical_rows_visited)); + + // When both cache searches completed and historical coverage was proven, + // an empty result is exact even when the just-inserted memory is the sole + // cached entry and is excluded from its own candidate set. + const bool certified_empty_population + = current_cache_rows.has_value () + && historical_cache_rows.has_value () && historical_coverage_proven; + if (result.rows.empty () && !certified_empty_population) { + ++sql_fallback_count; auto recent_rows = tx.Execute ( "SELECT m.memory_id, " " CASE WHEN cme.memory_id IS NOT NULL " @@ -465,6 +773,10 @@ LoadSupersessionCandidateRows (Transaction &tx, static_cast (embedding_to_store.size ())); } + context.AddOperationTiming ( + "MemoryStorage.supersession_sql_fallback_count", + static_cast (sql_fallback_count)); + return result; } @@ -475,7 +787,7 @@ struct SupersessionEdge double weight = 0.0; }; -void +std::vector WriteSupersessionEdges (OperationContext &context, Transaction &tx, long long memory_id, const Eigen::VectorXf &embedding_to_store, @@ -483,7 +795,7 @@ WriteSupersessionEdges (OperationContext &context, Transaction &tx, { if (memory_id <= 0 || embedding_to_store.size () <= 0) { - return; + return {}; } const auto &cfg = context.GetConfig (); @@ -493,9 +805,12 @@ WriteSupersessionEdges (OperationContext &context, Transaction &tx, cfg.stability)); const int max_edges = core::SupersessionMaxEdges ( cfg.focus, cfg.sensitivity, cfg.stability); + const auto candidate_load_start = SteadyClock::now (); const auto candidate_rows = LoadSupersessionCandidateRows ( - tx, context.GetProcessorContext (), embedding_to_store, memory_id, end_ts, - candidate_limit); + context, tx, context.GetProcessorContext (), embedding_to_store, + memory_id, end_ts, candidate_limit); + context.AddOperationTiming ("MemoryStorage.supersession_candidate_load", + ElapsedMillis (candidate_load_start)); const double similarity_threshold = core::SupersessionSimilarityThreshold ( cfg.focus, cfg.sensitivity, cfg.stability); @@ -510,6 +825,7 @@ WriteSupersessionEdges (OperationContext &context, Transaction &tx, edges.reserve (static_cast (max_edges)); int edge_count = 0; const double query_norm = embedding_to_store.norm (); + const auto score_start = SteadyClock::now (); for (const auto &row : candidate_rows.rows) { ++scanned_count; @@ -556,7 +872,10 @@ WriteSupersessionEdges (OperationContext &context, Transaction &tx, { edges.resize (static_cast (max_edges)); } + context.AddOperationTiming ("MemoryStorage.supersession_score", + ElapsedMillis (score_start)); + const auto write_start = SteadyClock::now (); for (const auto &edge : edges) { tx.Execute ( @@ -572,11 +891,8 @@ WriteSupersessionEdges (OperationContext &context, Transaction &tx, { edge.target_memory_id }); ++edge_count; } - - if (edge_count > 0) - { - context.GetProcessorContext ().association_fanout_cache.valid = false; - } + context.AddOperationTiming ("MemoryStorage.supersession_write", + ElapsedMillis (write_start)); telemetry::LogDebug ( "cortext.memory_storage.supersession_scan", @@ -592,6 +908,7 @@ WriteSupersessionEdges (OperationContext &context, Transaction &tx, similarity_threshold), telemetry::Attribute::Double ("duplicate_threshold", duplicate_threshold) }); + return edges; } } // namespace @@ -919,6 +1236,10 @@ MemoryStorage::Execute (OperationContext &context, Transaction &tx) const = mem_id_rows.empty () ? 0 : AnyToLongLong (mem_id_rows[0].at ("id")).value_or (0); + emotional_metadata_cache_internal::Upsert ( + p_ctx, + { memory_id, embedding_id, static_cast (end_ts), false, + 0.0, s_arousal_avg, 0.0, 0, 0.0 }); std::vector inserted_search_entries; inserted_search_entries.push_back ( @@ -1021,9 +1342,9 @@ MemoryStorage::Execute (OperationContext &context, Transaction &tx) const // 10. Leave signal tracking until accumulator resets (used by WM gating) const auto supersession_start = SteadyClock::now (); - WriteSupersessionEdges (context, *savepoint, memory_id, - embedding_to_store, - static_cast (end_ts)); + const auto supersession_edges = WriteSupersessionEdges ( + context, *savepoint, memory_id, embedding_to_store, + static_cast (end_ts)); context.AddOperationTiming ("MemoryStorage.supersession_edges", ElapsedMillis (supersession_start)); @@ -1096,7 +1417,46 @@ MemoryStorage::Execute (OperationContext &context, Transaction &tx) const } surface_entry.embedding = embedding_to_store; p_ctx.UpsertRetrievalSurface (std::move (surface_entry)); - if (!constructive_recall::Disabled ()) + auto &fanout_cache = p_ctx.association_fanout_cache; + if (fanout_cache.valid && !supersession_edges.empty ()) + { + bool incrementally_maintained = true; + for (const auto &edge : supersession_edges) + { + const auto target_it = p_ctx.retrieval_surface_index.find ( + edge.target_memory_id); + if (target_it == p_ctx.retrieval_surface_index.end () + || target_it->second + >= p_ctx.retrieval_surface_cache.size ()) + { + incrementally_maintained = false; + break; + } + const auto &target + = p_ctx.retrieval_surface_cache[target_it->second]; + const long long target_embedding_id + = historical_surface_search_cache_internal:: + BaseEmbeddingIdForMemory ( + p_ctx, edge.target_memory_id, + target.embedding_id); + if (target_embedding_id <= 0) + { + incrementally_maintained = false; + break; + } + association_fanout_cache::UpsertAssociation ( + p_ctx, fanout_cache, memory_id, edge.target_memory_id, + embedding_id, target_embedding_id, "supersedes", + edge.weight, static_cast (end_ts)); + } + if (incrementally_maintained) + association_fanout_cache::BuildSupersessionEligibility ( + fanout_cache, p_ctx); + else + fanout_cache.valid = false; + } + if (!constructive_recall::Disabled () + && !constructive_recall::CurrentSurfaceWritesDisabled ()) { historical_surface_search_cache_internal::UpsertCurrent ( p_ctx, @@ -1109,13 +1469,15 @@ MemoryStorage::Execute (OperationContext &context, Transaction &tx) const historical_surface_search_cache_internal:: SetCurrentSurfaceDatabaseCurrent (p_ctx, false); } - const int k_key = core::SparseKeySize ( context.GetConfig ().focus, context.GetConfig ().sensitivity, context.GetConfig ().stability); const std::string key = core::SparseKey (embedding_to_store, k_key); if (!key.empty ()) { + signal_record_rollback_internal:: + PreserveSparseIndexBeforeInsert ( + p_ctx, key, memory_id); p_ctx.index_store[key].push_back (memory_id); p_ctx.index_reverse[memory_id] = key; } diff --git a/src/operations/memory_strength.cpp b/src/operations/memory_strength.cpp index 5cf3d41b..fa9e7cb5 100644 --- a/src/operations/memory_strength.cpp +++ b/src/operations/memory_strength.cpp @@ -1,5 +1,8 @@ #include "cortext/operations/memory_strength.hpp" #include "historical_surface_search_cache_internal.hpp" +#include "emotional_metadata_cache_internal.hpp" +#include "execution_cache_sidecar_internal.hpp" +#include "association_fanout_cache_internal.hpp" #include #include #include @@ -14,6 +17,7 @@ #include "cortext/telemetry/telemetry.hpp" #include "eviction_policy_override.hpp" #include "eviction_policy.hpp" +#include "rif_state_internal.hpp" #include #include #include @@ -287,12 +291,15 @@ UpdateMemoryStrength::Execute (OperationContext &context, Transaction &tx) const const std::string select_sql = std::string ( - "SELECT memory_id, strength, use_frequency, contextual_gain, " - "retrieved_count, " - " used_count, last_access, created_at, flashbulb, " - " half_life_bonus, trace_fast, trace_med, trace_slow, " - "trace_ultra " - "FROM memories WHERE ") + "SELECT m.memory_id, rif.strength AS strength, " + " m.use_frequency, m.contextual_gain, " + " m.retrieved_count, m.used_count, m.last_access, " + " m.created_at, m.flashbulb, m.half_life_bonus, " + " m.trace_fast, m.trace_med, m.trace_slow, " + " m.trace_ultra " + "FROM memories m " + "JOIN rif_effective_memories rif " + " ON rif.memory_id = m.memory_id WHERE m.") + lookup_column + " = ?"; const auto select_start = SteadyClock::now (); auto rows = tx.Execute (select_sql, { lookup_id }); @@ -499,6 +506,11 @@ UpdateMemoryStrength::Execute (OperationContext &context, Transaction &tx) const { retrieved_new, used_new, used_flag, ts, contextual_gain, influence_factor, use_frequency, strength, traces[0], traces[1], traces[2], traces[3], ts, lookup_id }); + rif_state_internal::RefreshActiveStrengthWhere ( + tx, std::string (lookup_column) + " = ?", { lookup_id }); + rif_active_epoch_cache_internal::StageMemory ( + execution_cache_sidecar_internal::Ensure (p_ctx)->rif_active_epoch, + row_memory_id); if (row_memory_id > 0) { p_ctx.UpdateRetrievalSurfaceUsageByMemory (row_memory_id, @@ -607,8 +619,9 @@ UpdateMemoryStrength::Execute (OperationContext &context, Transaction &tx) const auto evictable_rows = tx.Execute ( "SELECT m.memory_id, m.embedding_id " "FROM memories m INDEXED BY idx_memories_ltm_strength_created" + " JOIN rif_effective_memories rif ON rif.memory_id = m.memory_id" " " + eviction_where - + " ORDER BY m.strength ASC, m.created_at ASC LIMIT ?", + + " ORDER BY rif.strength ASC, m.created_at ASC LIMIT ?", select_params); context.AddOperationTiming ("MemoryStrength.eviction_select_ids_sql", ElapsedMillis (eviction_select_start)); @@ -661,6 +674,8 @@ UpdateMemoryStrength::Execute (OperationContext &context, Transaction &tx) const for (const long long memory_id : evictable_memory_ids) { + association_fanout_cache::NotifyRetrievalSurfaceChanged (p_ctx, + memory_id); p_ctx.RemoveRetrievalSurface (memory_id); } // The embedding deletion phase can preserve rows still referenced by other @@ -734,11 +749,13 @@ UpdateMemoryStrength::Execute (OperationContext &context, Transaction &tx) const "SELECT m.memory_id, m.embedding_id, m.source_id, " " m.kind, COALESCE(m.label, ''), m.start_ts, " " m.end_ts, m.created_at, m.last_access, " - " m.strength, m.use_frequency, " + " rif.strength, m.use_frequency, " " m.contextual_gain, m.retrieved_count, " " m.used_count, m.n_signals, m.modality, " " 'periphery_cutoff', ? " "FROM memories m " + "JOIN rif_effective_memories rif " + " ON rif.memory_id = m.memory_id " "WHERE m.memory_id IN (" + placeholders + ")", params); }); @@ -812,6 +829,15 @@ UpdateMemoryStrength::Execute (OperationContext &context, Transaction &tx) const }); context.AddOperationTiming ("MemoryStrength.eviction_delete_memories_sql", ElapsedMillis (memory_delete_start)); + for (const long long memory_id : evictable_memory_ids) + { + emotional_metadata_cache_internal::Remove ( + context.GetProcessorContext (), memory_id); + } + rif_active_epoch_cache_internal::StageMemories ( + execution_cache_sidecar_internal::Ensure ( + context.GetProcessorContext ())->rif_active_epoch, + evictable_memory_ids); const auto objstore_delete_start = SteadyClock::now (); const long long evicted_blob_count diff --git a/src/operations/predictive.cpp b/src/operations/predictive.cpp index e591b905..9afaed08 100644 --- a/src/operations/predictive.cpp +++ b/src/operations/predictive.cpp @@ -101,6 +101,7 @@ DecayActivePreActivation (OperationContext &context, Transaction &tx, .predictive_pre_activation_memory_ids; if (active_ids.empty () && active_memory_ids.empty ()) { + context.AddOperationTiming ("Predictive.decay_active_sql", 0.0); return; } diff --git a/src/operations/rif_active_epoch_cache_internal.hpp b/src/operations/rif_active_epoch_cache_internal.hpp new file mode 100644 index 00000000..190e46e4 --- /dev/null +++ b/src/operations/rif_active_epoch_cache_internal.hpp @@ -0,0 +1,474 @@ +#pragma once + +#include "cortext/store/sqlite_store.hpp" +#include "cortext/store/store.hpp" +#include "cortext/store/utils.hpp" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace cortext::operations::rif_active_epoch_cache_internal +{ + +inline constexpr std::size_t kEventLimit = 512; +inline constexpr std::size_t kMutationLimit = 32768; +inline constexpr std::size_t kAllocatedByteLimit = 64ULL * 1024ULL * 1024ULL; + +struct State +{ + // The database is intentionally shared when processor rollback state is + // snapshotted. It is read-only until the authoritative transaction commits; + // pending publication metadata below is copied by value. + std::shared_ptr database; + bool valid = false; + long long generation = 0; + double log_factor = 0.0; + long long last_ts = 0; + std::size_t active_rows = 0; + std::size_t event_count = 0; + std::size_t mutation_count = 0; + std::size_t allocated_bytes = 0; + std::vector calibration_memory_ids; + std::vector pending_memory_ids; + bool pending_clock = false; + long long pending_generation = 0; + double pending_log_factor = 0.0; + long long pending_last_ts = 0; + bool pending_rebuild = false; + bool pending_rebuild_resets_counters = false; + bool invalid_rebuild_resets_counters = true; +}; + +struct PublishResult +{ + bool published = false; + bool rebuilt = false; + bool recovered_from_failure = false; + std::size_t changed_rows = 0; +}; + +inline bool +RequiresConsolidation (const State &state) +{ + return state.event_count >= kEventLimit + || state.mutation_count >= kMutationLimit + || state.allocated_bytes >= kAllocatedByteLimit; +} + +inline long long +GetInt64 (const std::map &row, + const std::string &key, long long fallback = 0) +{ + const auto it = row.find (key); + if (it == row.end ()) + return fallback; + return store::AnyToLongLong (it->second).value_or (fallback); +} + +inline std::size_t +DatabaseBytes (SQLiteStore &database) +{ + const auto page_count = database.Execute ("PRAGMA page_count"); + const auto page_size = database.Execute ("PRAGMA page_size"); + if (page_count.empty () || page_size.empty ()) + return 0; + const long long count = GetInt64 (page_count.front (), "page_count", 0); + const long long size = GetInt64 (page_size.front (), "page_size", 0); + if (count <= 0 || size <= 0) + return 0; + return static_cast (count) + * static_cast (size); +} + +inline std::shared_ptr +CreateDatabase () +{ + auto owned = SQLiteStore::Create (":memory:"); + auto database = std::shared_ptr (owned.release ()); + database->Execute ( + "CREATE TABLE epoch_clock(" + "singleton INTEGER PRIMARY KEY CHECK(singleton = 1), " + "generation INTEGER NOT NULL, log_factor REAL NOT NULL, " + "last_ts INTEGER NOT NULL)"); + database->Execute ( + "CREATE TABLE active_state(" + "memory_id INTEGER PRIMARY KEY, generation INTEGER NOT NULL, " + "anchor_suppression REAL NOT NULL, recovery_total REAL NOT NULL, " + "anchor_log_factor REAL NOT NULL, expires_log_factor REAL NOT NULL)"); + database->Execute ( + "CREATE INDEX active_state_due ON active_state(" + "generation, expires_log_factor, memory_id)"); + return database; +} + +inline std::string +Placeholders (std::size_t count) +{ + std::string out; + out.reserve (count * 2); + for (std::size_t index = 0; index < count; ++index) + { + if (index > 0) + out += ","; + out += "?"; + } + return out; +} + +inline std::vector> +LoadCurrentRows (Store &persistent, long long generation, + const std::vector *memory_ids = nullptr) +{ + if (memory_ids && memory_ids->empty ()) + return {}; + std::vector params { generation }; + std::string predicate; + if (memory_ids && !memory_ids->empty ()) + { + predicate = " AND memory_id IN (" + Placeholders (memory_ids->size ()) + + ")"; + params.reserve (memory_ids->size () + 1); + for (const long long memory_id : *memory_ids) + params.push_back (memory_id); + } + return persistent.Execute ( + "SELECT memory_id, generation, anchor_suppression, recovery_total, " + "anchor_log_factor, expires_log_factor FROM rif_active_state " + "WHERE generation = ?" + predicate + " ORDER BY memory_id", + params); +} + +inline std::map +LoadClock (Store &persistent) +{ + const auto rows = persistent.Execute ( + "SELECT generation, log_factor, last_ts FROM rif_recovery_clock " + "WHERE singleton = 1"); + if (rows.size () != 1) + throw StoreError ("lazy RIF recovery clock is missing"); + return rows.front (); +} + +inline void +InsertRow (Transaction &transaction, + const std::map &row) +{ + transaction.Execute ( + "INSERT OR REPLACE INTO active_state(" + "memory_id, generation, anchor_suppression, recovery_total, " + "anchor_log_factor, expires_log_factor) VALUES(?, ?, ?, ?, ?, ?)", + { row.at ("memory_id"), row.at ("generation"), + row.at ("anchor_suppression"), row.at ("recovery_total"), + row.at ("anchor_log_factor"), row.at ("expires_log_factor") }); +} + +inline void +Rebuild (State &state, Store &persistent, bool reset_counters = true) +{ + const std::size_t prior_event_count = state.event_count; + const std::size_t prior_mutation_count = state.mutation_count; + const auto clock = LoadClock (persistent); + const long long generation = GetInt64 (clock, "generation", 1); + const auto rows = LoadCurrentRows (persistent, generation); + const auto calibration_rows = persistent.Execute ( + "SELECT a.memory_id FROM rif_active_state a " + "JOIN rif_recovery_clock c ON c.singleton = 1 " + "JOIN memories m ON m.memory_id = a.memory_id " + "WHERE a.generation = c.generation " + " AND a.anchor_log_factor = c.log_factor " + " AND COALESCE(m.suppression_ts, 0) <> c.last_ts " + "ORDER BY a.memory_id"); + auto replacement = CreateDatabase (); + auto transaction = replacement->Begin (); + transaction->Execute ( + "INSERT INTO epoch_clock(singleton, generation, log_factor, last_ts) " + "VALUES(1, ?, ?, ?)", + { generation, clock.at ("log_factor"), clock.at ("last_ts") }); + for (const auto &row : rows) + InsertRow (*transaction, row); + transaction->Commit (); + + state.database = std::move (replacement); + state.valid = true; + state.generation = generation; + state.log_factor = store::AnyToDouble (clock.at ("log_factor"), 0.0); + state.last_ts = GetInt64 (clock, "last_ts", 0); + state.active_rows = rows.size (); + state.event_count = reset_counters ? 0 : prior_event_count; + state.mutation_count = reset_counters ? 0 : prior_mutation_count; + state.allocated_bytes = DatabaseBytes (*state.database); + state.calibration_memory_ids.clear (); + state.calibration_memory_ids.reserve (calibration_rows.size ()); + for (const auto &row : calibration_rows) + { + const long long memory_id = GetInt64 (row, "memory_id", 0); + if (memory_id > 0) + state.calibration_memory_ids.push_back (memory_id); + } + state.pending_memory_ids.clear (); + state.pending_clock = false; + state.pending_rebuild = false; + state.pending_rebuild_resets_counters = false; + state.invalid_rebuild_resets_counters = true; +} + +inline void +Ensure (State &state, Store &persistent) +{ + if (!state.valid || !state.database) + Rebuild (state, persistent, state.invalid_rebuild_resets_counters); +} + +inline void +StageMemory (State &state, long long memory_id) +{ + if (memory_id > 0) + state.pending_memory_ids.push_back (memory_id); +} + +inline void +StageMemories (State &state, const std::vector &memory_ids) +{ + for (const long long memory_id : memory_ids) + StageMemory (state, memory_id); +} + +inline void +StageRebuild (State &state, bool reset_counters = false) +{ + state.pending_rebuild = true; + state.pending_rebuild_resets_counters + = state.pending_rebuild_resets_counters || reset_counters; + state.pending_clock = true; +} + +inline void +StageClock (State &state, long long generation, double log_factor, + long long last_ts) +{ + state.pending_clock = true; + state.pending_generation = generation; + state.pending_log_factor = log_factor; + state.pending_last_ts = last_ts; +} + +#if defined(CORTEXT_TESTING) +inline std::atomic g_publish_failure_mask { 0 }; + +inline void +SetPublishFailureStageForTest (int stage) +{ + const unsigned int mask + = stage > 0 ? (1U << static_cast (stage)) : 0U; + g_publish_failure_mask.store (mask, std::memory_order_relaxed); +} + +inline void +SetPublishFailureMaskForTest (unsigned int mask) +{ + g_publish_failure_mask.store (mask, std::memory_order_relaxed); +} + +inline void +MaybeFailPublicationForTest (int stage) +{ + const unsigned int bit = 1U << static_cast (stage); + unsigned int observed + = g_publish_failure_mask.load (std::memory_order_relaxed); + while ((observed & bit) != 0U) + { + if (g_publish_failure_mask.compare_exchange_weak ( + observed, observed & ~bit, std::memory_order_relaxed)) + { + throw StoreError ( + "injected RIF active-epoch publication failure"); + } + } +} +#else +inline void +MaybeFailPublicationForTest (int) +{ +} +#endif + +inline PublishResult +PublishOnce (State &state, Store &persistent) +{ + if (!state.pending_clock && state.pending_memory_ids.empty () + && !state.pending_rebuild) + { + ++state.event_count; + return { true, false, false, 0 }; + } + if (state.pending_rebuild || !state.valid || !state.database) + { + const bool reset_counters + = state.pending_rebuild + ? state.pending_rebuild_resets_counters + : state.invalid_rebuild_resets_counters; + MaybeFailPublicationForTest (3); + Rebuild (state, persistent, reset_counters); + if (!reset_counters) + { + ++state.event_count; + state.mutation_count += state.active_rows; + } + return { true, true, false, state.active_rows }; + } + + const long long generation + = state.pending_clock ? state.pending_generation : state.generation; + const double log_factor + = state.pending_clock ? state.pending_log_factor : state.log_factor; + const long long last_ts + = state.pending_clock ? state.pending_last_ts : state.last_ts; + if (generation != state.generation) + { + Rebuild (state, persistent, false); + ++state.event_count; + state.mutation_count += state.active_rows; + return { true, true, false, state.active_rows }; + } + + std::sort (state.pending_memory_ids.begin (), + state.pending_memory_ids.end ()); + state.pending_memory_ids.erase ( + std::unique (state.pending_memory_ids.begin (), + state.pending_memory_ids.end ()), + state.pending_memory_ids.end ()); + const auto persistent_rows + = LoadCurrentRows (persistent, generation, &state.pending_memory_ids); + std::unordered_set present; + present.reserve (persistent_rows.size ()); + for (const auto &row : persistent_rows) + present.insert (GetInt64 (row, "memory_id", 0)); + + std::unordered_set cached; + cached.reserve (state.pending_memory_ids.size ()); + if (!state.pending_memory_ids.empty ()) + { + std::vector params; + params.reserve (state.pending_memory_ids.size ()); + for (const long long memory_id : state.pending_memory_ids) + params.push_back (memory_id); + const auto cached_rows = state.database->Execute ( + "SELECT memory_id FROM active_state WHERE memory_id IN (" + + Placeholders (state.pending_memory_ids.size ()) + ")", + params); + for (const auto &row : cached_rows) + cached.insert (GetInt64 (row, "memory_id", 0)); + } + + MaybeFailPublicationForTest (1); + auto transaction = state.database->Begin (); + transaction->Execute ( + "UPDATE epoch_clock SET log_factor = ?, last_ts = ? " + "WHERE singleton = 1", + { log_factor, last_ts }); + for (const auto &row : persistent_rows) + InsertRow (*transaction, row); + for (const long long memory_id : state.pending_memory_ids) + if (!present.contains (memory_id)) + transaction->Execute ("DELETE FROM active_state WHERE memory_id = ?", + { memory_id }); + MaybeFailPublicationForTest (2); + transaction->Commit (); + + for (const long long memory_id : state.pending_memory_ids) + { + const bool was_present = cached.contains (memory_id); + const bool is_present = present.contains (memory_id); + if (!was_present && is_present) + ++state.active_rows; + else if (was_present && !is_present && state.active_rows > 0) + --state.active_rows; + } + if (!state.calibration_memory_ids.empty () + && !state.pending_memory_ids.empty ()) + { + const std::unordered_set changed ( + state.pending_memory_ids.begin (), state.pending_memory_ids.end ()); + state.calibration_memory_ids.erase ( + std::remove_if (state.calibration_memory_ids.begin (), + state.calibration_memory_ids.end (), + [&changed] (long long memory_id) { + return changed.contains (memory_id); + }), + state.calibration_memory_ids.end ()); + } + const std::size_t changed_rows = state.pending_memory_ids.size (); + state.log_factor = log_factor; + state.last_ts = last_ts; + ++state.event_count; + state.mutation_count += changed_rows + (state.pending_clock ? 1 : 0); + if (changed_rows > 0) + state.allocated_bytes = DatabaseBytes (*state.database); + state.pending_memory_ids.clear (); + state.pending_clock = false; + state.pending_rebuild = false; + state.pending_rebuild_resets_counters = false; + return { true, false, false, changed_rows }; +} + +inline PublishResult +PublishAfterPersistentCommit (State &state, Store &persistent) +{ + try + { + return PublishOnce (state, persistent); + } + catch (...) + { + // Persistent SQLite has already committed. Never replay it: discard the + // disposable epoch and rebuild only its bounded current-generation state. + const bool reset_counters = state.pending_rebuild_resets_counters; + const std::size_t committed_rebuild_rows = state.active_rows; + state.database.reset (); + state.valid = false; + state.pending_memory_ids.clear (); + state.calibration_memory_ids.clear (); + state.pending_clock = false; + state.pending_rebuild = false; + state.pending_rebuild_resets_counters = false; + state.invalid_rebuild_resets_counters = reset_counters; + try + { + MaybeFailPublicationForTest (4); + Rebuild (state, persistent, reset_counters); + if (!reset_counters) + { + ++state.event_count; + state.mutation_count += state.active_rows; + } + return { true, true, true, state.active_rows }; + } + catch (...) + { + state.database.reset (); + state.valid = false; + state.invalid_rebuild_resets_counters = reset_counters; + if (reset_counters) + { + state.event_count = 0; + state.mutation_count = 0; + } + else + { + ++state.event_count; + state.mutation_count += committed_rebuild_rows; + } + return { false, false, true, 0 }; + } + } +} + +} // namespace cortext::operations::rif_active_epoch_cache_internal diff --git a/src/operations/rif_state_internal.hpp b/src/operations/rif_state_internal.hpp new file mode 100644 index 00000000..e7a89870 --- /dev/null +++ b/src/operations/rif_state_internal.hpp @@ -0,0 +1,489 @@ +#pragma once + +#include "cortext/store/store.hpp" +#include "cortext/store/utils.hpp" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace cortext::operations::rif_state_internal +{ + +constexpr double kActiveSuppressionFloor = 1e-9; + +struct Clock +{ + long long generation = 1; + double log_factor = 0.0; + long long last_ts = 0; +}; + +struct RecoveryResult +{ + std::size_t expired_rows = 0; + std::size_t retired_rows = 0; + bool generation_reset = false; + std::vector changed_memory_ids; + Clock clock; +}; + +inline std::string +Placeholders (std::size_t count) +{ + std::string out; + out.reserve (count * 2); + for (std::size_t index = 0; index < count; ++index) + { + if (index > 0) + out += ","; + out += "?"; + } + return out; +} + +inline long long +GetInt64 (const std::map &row, + const std::string &key, long long fallback = 0) +{ + const auto it = row.find (key); + if (it == row.end ()) + return fallback; + return store::AnyToLongLong (it->second).value_or (fallback); +} + +inline double +GetDouble (const std::map &row, + const std::string &key, double fallback = 0.0) +{ + const auto it = row.find (key); + if (it == row.end ()) + return fallback; + return store::AnyToDouble (it->second, fallback); +} + +template +Clock +LoadClock (Executor &executor) +{ + const auto rows = executor.Execute ( + "SELECT generation, log_factor, last_ts " + "FROM rif_recovery_clock WHERE singleton = 1"); + if (rows.size () != 1) + throw StoreError ("lazy RIF recovery clock is missing"); + return { + GetInt64 (rows[0], "generation", 1), + GetDouble (rows[0], "log_factor", 0.0), + GetInt64 (rows[0], "last_ts", 0), + }; +} + +template +std::size_t +CountRows (Executor &tx, const std::string &query, + const std::vector ¶ms = {}) +{ + const auto rows = tx.Execute (query, params); + if (rows.empty ()) + return 0; + const auto count = GetInt64 (rows[0], "row_count", 0); + return count > 0 ? static_cast (count) : 0; +} + +inline void +MaterializeWhere (Transaction &tx, const std::string &where_sql, + const std::vector ¶ms) +{ + tx.Execute ( + "UPDATE memories " + "SET strength = COALESCE((" + " SELECT e.strength FROM rif_effective_memories e " + " WHERE e.memory_id = memories.memory_id), strength), " + " suppression = COALESCE((" + " SELECT e.suppression FROM rif_effective_memories e " + " WHERE e.memory_id = memories.memory_id), suppression), " + " suppression_ts = COALESCE((" + " SELECT e.suppression_ts FROM rif_effective_memories e " + " WHERE e.memory_id = memories.memory_id), suppression_ts) " + "WHERE memory_id IN (SELECT memory_id FROM rif_active_state WHERE " + + where_sql + ")", + params); +} + +template +void +PruneRetiredGenerationResets (Executor &executor) +{ + executor.Execute ( + "DELETE FROM rif_generation_resets " + "WHERE generation < (" + " SELECT generation FROM rif_recovery_clock WHERE singleton = 1) " + " AND NOT EXISTS(SELECT 1 FROM rif_active_state a " + " WHERE a.generation = rif_generation_resets.generation)"); +} + +inline std::vector +MaterializeRetiredBatch (Transaction &tx, long long current_generation, + std::size_t limit = 64) +{ + const auto rows = tx.Execute ( + "SELECT memory_id FROM rif_active_state " + "WHERE generation < ? ORDER BY generation, memory_id LIMIT ?", + { current_generation, static_cast (limit) }); + std::vector memory_ids; + memory_ids.reserve (rows.size ()); + for (const auto &row : rows) + { + const long long memory_id = GetInt64 (row, "memory_id", 0); + if (memory_id > 0) + memory_ids.push_back (memory_id); + } + if (memory_ids.empty ()) + { + PruneRetiredGenerationResets (tx); + return {}; + } + std::vector ids; + ids.reserve (memory_ids.size ()); + for (const long long memory_id : memory_ids) + ids.push_back (memory_id); + const std::string placeholders = Placeholders (memory_ids.size ()); + tx.Execute ( + "UPDATE memories " + "SET strength = (SELECT e.strength FROM rif_effective_memories e " + " WHERE e.memory_id = memories.memory_id), " + " suppression = (SELECT e.suppression " + " FROM rif_effective_memories e " + " WHERE e.memory_id = memories.memory_id), " + " suppression_ts = (SELECT e.suppression_ts " + " FROM rif_effective_memories e " + " WHERE e.memory_id = memories.memory_id) " + "WHERE memory_id IN (" + placeholders + ")", + ids); + tx.Execute ("DELETE FROM rif_active_state WHERE memory_id IN (" + + placeholders + ")", + ids); + PruneRetiredGenerationResets (tx); + return memory_ids; +} + +inline std::vector +LoadMemoryIdsWhere (Transaction &tx, const std::string &where_sql, + const std::vector ¶ms) +{ + const auto rows = tx.Execute ( + "SELECT memory_id FROM rif_active_state WHERE " + where_sql + + " ORDER BY memory_id", + params); + std::vector memory_ids; + memory_ids.reserve (rows.size ()); + for (const auto &row : rows) + { + const long long memory_id = GetInt64 (row, "memory_id", 0); + if (memory_id > 0) + memory_ids.push_back (memory_id); + } + return memory_ids; +} + +inline std::vector +RecoverMemoryIds (Transaction &tx, const std::vector &memory_ids, + long long now_ts, double recovery_time) +{ + constexpr std::size_t kChunkSize = 400; + for (std::size_t begin = 0; begin < memory_ids.size (); + begin += kChunkSize) + { + const std::size_t end + = std::min (memory_ids.size (), begin + kChunkSize); + std::vector params; + params.reserve (11 + end - begin); + params.insert (params.end (), { + now_ts, now_ts, recovery_time, now_ts, recovery_time, + now_ts, now_ts, recovery_time, now_ts, recovery_time, now_ts + }); + for (std::size_t index = begin; index < end; ++index) + params.push_back (memory_ids[index]); + tx.Execute ( + "UPDATE memories SET " + "strength = MAX(0.0, strength + suppression * (CASE " + " WHEN (? - COALESCE(suppression_ts, 0)) <= 0 THEN 0.0 " + " WHEN (? - COALESCE(suppression_ts, 0)) >= ? THEN 1.0 " + " ELSE ((? - COALESCE(suppression_ts, 0)) * 1.0 / ?) END)), " + "suppression = MAX(0.0, suppression - suppression * (CASE " + " WHEN (? - COALESCE(suppression_ts, 0)) <= 0 THEN 0.0 " + " WHEN (? - COALESCE(suppression_ts, 0)) >= ? THEN 1.0 " + " ELSE ((? - COALESCE(suppression_ts, 0)) * 1.0 / ?) END)), " + "suppression_ts = ? WHERE memory_id IN (" + + Placeholders (end - begin) + ")", + params); + } + return memory_ids; +} + +inline void +UpsertActiveMemoryIdsAtClock (Transaction &tx, + const std::vector &memory_ids) +{ + if (memory_ids.empty ()) + return; + std::vector ids; + ids.reserve (memory_ids.size ()); + for (const long long memory_id : memory_ids) + ids.push_back (memory_id); + tx.Execute ( + "INSERT OR REPLACE INTO rif_active_state(" + "memory_id, generation, anchor_suppression, recovery_total, " + "anchor_log_factor, expires_log_factor) " + "SELECT m.memory_id, c.generation, m.suppression, " + " m.strength + m.suppression, c.log_factor, " + " c.log_factor + ln(1e-9 / m.suppression) " + "FROM memories m CROSS JOIN rif_recovery_clock c " + "WHERE c.singleton = 1 AND m.memory_id IN (" + + Placeholders (memory_ids.size ()) + ") " + " AND m.suppression > 1e-9", + ids); +} + +inline std::vector +CalibrateMemoryIdsAtClock (Transaction &tx, + const std::vector &memory_ids, + double recovery_time) +{ + if (memory_ids.empty ()) + return {}; + const Clock clock = LoadClock (tx); + std::vector ids; + ids.reserve (memory_ids.size ()); + for (const long long memory_id : memory_ids) + ids.push_back (memory_id); + const std::string placeholders = Placeholders (memory_ids.size ()); + tx.Execute ("DELETE FROM rif_active_state WHERE memory_id IN (" + + placeholders + ")", + ids); + RecoverMemoryIds (tx, memory_ids, clock.last_ts, recovery_time); + UpsertActiveMemoryIdsAtClock (tx, memory_ids); + return memory_ids; +} + +inline RecoveryResult +AdvanceRecovery (Transaction &tx, long long now_ts, double recovery_time) +{ + const Clock before = LoadClock (tx); + const double elapsed + = static_cast (now_ts - before.last_ts); + const bool has_current_active = CountRows ( + tx, + "SELECT COUNT(*) AS row_count FROM (" + "SELECT 1 FROM rif_active_state WHERE generation = ? LIMIT 1)", + { before.generation }) + > 0; + const bool full_recovery = has_current_active + && (recovery_time <= 0.0 + || elapsed >= recovery_time); + + if (!has_current_active) + { + tx.Execute ( + "UPDATE rif_recovery_clock SET log_factor = 0.0, last_ts = ? " + "WHERE singleton = 1", + { now_ts }); + auto retired = MaterializeRetiredBatch (tx, before.generation); + return { 0, retired.size (), false, std::move (retired), + { before.generation, 0.0, now_ts } }; + } + + if (full_recovery) + { + tx.Execute ( + "INSERT INTO rif_generation_resets(generation, reset_ts) " + "VALUES(?, ?) " + "ON CONFLICT(generation) DO UPDATE SET reset_ts = excluded.reset_ts", + { before.generation, now_ts }); + tx.Execute ( + "UPDATE rif_recovery_clock " + "SET generation = generation + 1, log_factor = 0.0, last_ts = ? " + "WHERE singleton = 1", + { now_ts }); + auto retired = MaterializeRetiredBatch (tx, before.generation + 1); + return { 0, retired.size (), true, std::move (retired), + { before.generation + 1, 0.0, now_ts } }; + } + + double next_log_factor = before.log_factor; + if (elapsed > 0.0) + { + const double fraction = std::clamp ( + elapsed / recovery_time, 0.0, + std::nextafter (1.0, 0.0)); + next_log_factor += std::log1p (-fraction); + } + tx.Execute ( + "UPDATE rif_recovery_clock SET log_factor = ?, last_ts = ? " + "WHERE singleton = 1", + { next_log_factor, now_ts }); + + const std::vector due_params { + before.generation, next_log_factor + }; + auto expired = LoadMemoryIdsWhere ( + tx, "generation = ? AND expires_log_factor >= ?", due_params); + if (!expired.empty ()) + { + MaterializeWhere (tx, + "generation = ? AND expires_log_factor >= ?", + due_params); + tx.Execute ( + "DELETE FROM rif_active_state " + "WHERE generation = ? AND expires_log_factor >= ?", + due_params); + } + auto retired = MaterializeRetiredBatch (tx, before.generation); + const std::size_t retired_count = retired.size (); + std::vector changed = expired; + changed.insert (changed.end (), retired.begin (), retired.end ()); + return { expired.size (), retired_count, false, std::move (changed), + { before.generation, next_log_factor, now_ts } }; +} + +inline RecoveryResult +AdvanceRecovery (Transaction &tx, long long now_ts, double recovery_time, + const std::vector &calibration_memory_ids) +{ + if (calibration_memory_ids.empty ()) + return AdvanceRecovery (tx, now_ts, recovery_time); + std::vector calibration_params; + calibration_params.reserve (calibration_memory_ids.size ()); + for (const long long memory_id : calibration_memory_ids) + calibration_params.push_back (memory_id); + tx.Execute ("DELETE FROM rif_active_state WHERE memory_id IN (" + + Placeholders (calibration_memory_ids.size ()) + ")", + calibration_params); + auto result = AdvanceRecovery (tx, now_ts, recovery_time); + const auto calibrated = RecoverMemoryIds ( + tx, calibration_memory_ids, now_ts, recovery_time); + UpsertActiveMemoryIdsAtClock (tx, calibrated); + result.changed_memory_ids.insert (result.changed_memory_ids.end (), + calibrated.begin (), calibrated.end ()); + return result; +} + +inline std::optional +ResolveMemoryId (Transaction &tx, long long memory_id, long long embedding_id) +{ + if (memory_id > 0) + return memory_id; + if (embedding_id <= 0) + return std::nullopt; + const auto rows = tx.Execute ( + "SELECT memory_id FROM memories WHERE embedding_id = ? LIMIT 1", + { embedding_id }); + if (rows.empty ()) + return std::nullopt; + const long long resolved = GetInt64 (rows[0], "memory_id", 0); + return resolved > 0 ? std::optional (resolved) : std::nullopt; +} + +inline bool +SuppressMemory (Transaction &tx, long long memory_id, double amount, + long long now_ts) +{ + if (memory_id <= 0 || amount <= std::numeric_limits::epsilon ()) + return false; + const bool already_active = !tx.Execute ( + "SELECT 1 FROM rif_active_state a " + "JOIN rif_recovery_clock c ON c.generation = a.generation " + "WHERE c.singleton = 1 AND a.memory_id = ? LIMIT 1", + { memory_id }).empty (); + tx.Execute ( + "UPDATE memories " + "SET strength = MAX(0.0, COALESCE((" + " SELECT e.strength FROM rif_effective_memories e " + " WHERE e.memory_id = memories.memory_id), strength) - ?), " + " suppression = COALESCE((" + " SELECT e.suppression FROM rif_effective_memories e " + " WHERE e.memory_id = memories.memory_id), suppression) + ?, " + " suppression_ts = ?, " + " suppression_count = suppression_count + 1 " + "WHERE memory_id = ?", + { amount, amount, now_ts, memory_id }); + tx.Execute ( + "INSERT OR REPLACE INTO rif_active_state(" + "memory_id, generation, anchor_suppression, recovery_total, " + "anchor_log_factor, expires_log_factor) " + "SELECT m.memory_id, c.generation, m.suppression, " + " m.strength + m.suppression, c.log_factor, " + " c.log_factor + ln(1e-9 / m.suppression) " + "FROM memories m CROSS JOIN rif_recovery_clock c " + "WHERE c.singleton = 1 AND m.memory_id = ? " + " AND m.suppression > 1e-9", + { memory_id }); + return !already_active; +} + +inline void +RefreshActiveStrengthWhere (Transaction &tx, const std::string &where_sql, + const std::vector ¶ms) +{ + tx.Execute ( + "UPDATE rif_active_state " + "SET recovery_total = (" + " SELECT m.strength + rif_active_state.anchor_suppression * exp(" + " c.log_factor - rif_active_state.anchor_log_factor) " + " FROM memories m CROSS JOIN rif_recovery_clock c " + " WHERE c.singleton = 1 " + " AND m.memory_id = rif_active_state.memory_id) " + "WHERE memory_id IN (SELECT memory_id FROM memories WHERE " + + where_sql + ")", + params); +} + +template +void +MaterializeAllAndClear (Executor &executor) +{ + executor.Execute ( + "UPDATE memories " + "SET strength = COALESCE((" + " SELECT e.strength FROM rif_effective_memories e " + " WHERE e.memory_id = memories.memory_id), strength), " + " suppression = COALESCE((" + " SELECT e.suppression FROM rif_effective_memories e " + " WHERE e.memory_id = memories.memory_id), suppression), " + " suppression_ts = COALESCE((" + " SELECT e.suppression_ts FROM rif_effective_memories e " + " WHERE e.memory_id = memories.memory_id), suppression_ts) " + "WHERE memory_id IN (SELECT memory_id FROM rif_active_state)"); + executor.Execute ("DELETE FROM rif_active_state"); + PruneRetiredGenerationResets (executor); +} + +template +void +RebuildFromMaterialized (Executor &executor) +{ + executor.Execute ("DELETE FROM rif_active_state"); + executor.Execute ( + "UPDATE rif_recovery_clock SET log_factor = 0.0, " + "last_ts = COALESCE((SELECT MAX(suppression_ts) FROM memories " + " WHERE suppression > 1e-9), last_ts) " + "WHERE singleton = 1"); + executor.Execute ( + "INSERT OR REPLACE INTO rif_active_state(" + "memory_id, generation, anchor_suppression, recovery_total, " + "anchor_log_factor, expires_log_factor) " + "SELECT m.memory_id, c.generation, m.suppression, " + " m.strength + m.suppression, c.log_factor, " + " c.log_factor + ln(1e-9 / m.suppression) " + "FROM memories m CROSS JOIN rif_recovery_clock c " + "WHERE m.suppression > 1e-9"); + PruneRetiredGenerationResets (executor); +} + +} // namespace cortext::operations::rif_state_internal diff --git a/src/operations/signal_record_rollback_internal.hpp b/src/operations/signal_record_rollback_internal.hpp index e1a0f2c7..d167a6c0 100644 --- a/src/operations/signal_record_rollback_internal.hpp +++ b/src/operations/signal_record_rollback_internal.hpp @@ -4,6 +4,7 @@ #include "cortext/processor/operation.hpp" #include +#include namespace cortext::operations::signal_record_rollback_internal { @@ -14,6 +15,12 @@ class JournalAwareOperation virtual ~JournalAwareOperation () = default; }; +class EngineOwnedOperation +{ +public: + virtual ~EngineOwnedOperation () = default; +}; + class JournalAwareOperationAdapter final : public IOperation, public JournalAwareOperation { @@ -40,6 +47,35 @@ MarkJournalAware (std::unique_ptr operation) std::move (operation)); } +class EngineOwnedJournalAwareOperationAdapter final + : public IOperation, + public JournalAwareOperation, + public EngineOwnedOperation +{ +public: + explicit EngineOwnedJournalAwareOperationAdapter ( + std::unique_ptr operation) + : operation_ (std::move (operation)) + { + } + + void + Execute (OperationContext &context, Transaction &tx) const override + { + operation_->Execute (context, tx); + } + +private: + std::unique_ptr operation_; +}; + +inline std::unique_ptr +MarkEngineOwnedJournalAware (std::unique_ptr operation) +{ + return std::make_unique ( + std::move (operation)); +} + // Internal operations must call EnsureBackedUp before destructively changing // the active source's accumulator records or working-memory record/blob-id // vectors. Append-only active-source changes are journaled by retained @@ -51,11 +87,19 @@ class Scope public: using BackupFn = void (*) (void *owner); using PreserveSlotFn = void (*) (void *owner, std::size_t slot_index); + using PreserveSparseIndexFn = void (*) ( + void *owner, const std::string &key, long long memory_id); + using PreserveProceduralFn = void (*) ( + void *owner, const std::string &key, long long memory_id); Scope (ProcessorContext &context, void *owner, BackupFn backup, - BackupFn backup_all, PreserveSlotFn preserve_slot) + BackupFn backup_all, PreserveSlotFn preserve_slot, + PreserveSparseIndexFn preserve_sparse_index, + PreserveProceduralFn preserve_procedural) : context_ (&context), owner_ (owner), backup_ (backup), backup_all_ (backup_all), preserve_slot_ (preserve_slot), + preserve_sparse_index_ (preserve_sparse_index), + preserve_procedural_ (preserve_procedural), previous_ (active_) { active_ = this; @@ -109,12 +153,45 @@ class Scope } } + static void + PreserveSparseIndexBeforeInsert (ProcessorContext &context, + const std::string &key, + long long memory_id) + { + for (auto *scope = active_; scope; scope = scope->previous_) + { + if (scope->context_ == &context) + { + scope->preserve_sparse_index_ ( + scope->owner_, key, memory_id); + return; + } + } + } + + static void + PreserveProceduralValueBeforeUpdate (ProcessorContext &context, + const std::string &key, + long long memory_id) + { + for (auto *scope = active_; scope; scope = scope->previous_) + { + if (scope->context_ == &context) + { + scope->preserve_procedural_ (scope->owner_, key, memory_id); + return; + } + } + } + private: ProcessorContext *context_ = nullptr; void *owner_ = nullptr; BackupFn backup_ = nullptr; BackupFn backup_all_ = nullptr; PreserveSlotFn preserve_slot_ = nullptr; + PreserveSparseIndexFn preserve_sparse_index_ = nullptr; + PreserveProceduralFn preserve_procedural_ = nullptr; Scope *previous_ = nullptr; static inline thread_local Scope *active_ = nullptr; }; @@ -138,4 +215,20 @@ PreserveWorkingMemorySlotBeforeErase (ProcessorContext &context, Scope::PreserveWorkingMemorySlotBeforeErase (context, slot_index); } +inline void +PreserveSparseIndexBeforeInsert (ProcessorContext &context, + const std::string &key, + long long memory_id) +{ + Scope::PreserveSparseIndexBeforeInsert (context, key, memory_id); +} + +inline void +PreserveProceduralValueBeforeUpdate (ProcessorContext &context, + const std::string &key, + long long memory_id) +{ + Scope::PreserveProceduralValueBeforeUpdate (context, key, memory_id); +} + } // namespace cortext::operations::signal_record_rollback_internal diff --git a/src/operations/stability.cpp b/src/operations/stability.cpp index adcea6b5..136630c6 100644 --- a/src/operations/stability.cpp +++ b/src/operations/stability.cpp @@ -136,12 +136,14 @@ UpdateStability::Execute (OperationContext &context, Transaction &tx) const const auto retention_start = SteadyClock::now (); auto rows = tx.Execute ( "WITH active_sample AS (" - " SELECT created_at, start_ts " - " FROM memories INDEXED BY idx_memories_ltm_created_strength " - " WHERE kind = 'LONG_TERM' " - " AND strength >= ?2 " - " AND (created_at > 0 OR start_ts > 0) " - " ORDER BY created_at DESC, start_ts DESC " + " SELECT m.created_at, m.start_ts " + " FROM memories m INDEXED BY idx_memories_ltm_created_strength " + " JOIN rif_effective_memories rif " + " ON rif.memory_id = m.memory_id " + " WHERE m.kind = 'LONG_TERM' " + " AND rif.strength >= ?2 " + " AND (m.created_at > 0 OR m.start_ts > 0) " + " ORDER BY m.created_at DESC, m.start_ts DESC " " LIMIT ?3" ") " "SELECT COUNT(*) AS count, " diff --git a/src/signal_processor.cpp b/src/signal_processor.cpp index 847b1f21..cc59311a 100644 --- a/src/signal_processor.cpp +++ b/src/signal_processor.cpp @@ -11,14 +11,23 @@ #include "cortext/store/schema.hpp" #include "cortext/store/utils.hpp" #include "operations/constructive_recall_internal.hpp" +#include "operations/bounded_activation_shadow_internal.hpp" +#include "operations/consolidation_epoch_profile_internal.hpp" #include "operations/consolidation_throughput_state_internal.hpp" +#include "operations/emotional_metadata_cache_internal.hpp" +#include "operations/execution_cache_sidecar_internal.hpp" #include "operations/historical_surface_search_cache_internal.hpp" +#include "operations/rif_state_internal.hpp" #include "operations/signal_record_rollback_internal.hpp" +#include "experimental_env.hpp" #include "working_memory_time_internal.hpp" +#include "store/mutation_audit_internal.hpp" #include +#include #include #include #include +#include #include #include #include @@ -27,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -45,6 +55,59 @@ constexpr uint64_t kWalPassiveCheckpointIntervalSignals = 256; constexpr std::uintmax_t kWalPassiveCheckpointMinBytes = 256ULL * 1024ULL * 1024ULL; +#if defined(CORTEXT_TESTING) +std::atomic g_sqlite_checkpoint_failure_once { false }; +#endif + +bool +ProfileWorkCountersEnabled () +{ + return internal::experimental_env::Flag ("CORTEXT_PROFILE_WORK_COUNTERS"); +} + +void +AddConsolidationEpochCounters ( + OperationContext &op_context, const std::string &prefix, + const operations::consolidation_epoch_profile_internal::Counters &counters) +{ + op_context.AddOperationTiming ( + prefix + ".accumulator_signal_count", + static_cast (counters.accumulator_signal_count)); + op_context.AddOperationTiming ( + prefix + ".working_memory_pending_signal_count", + static_cast (counters.working_memory_pending_signal_count)); + op_context.AddOperationTiming ( + prefix + ".consolidation_dirty_memory_count", + static_cast (counters.consolidation_dirty_memory_count)); + op_context.AddOperationTiming ( + prefix + ".consolidation_dirty_association_count", + static_cast (counters.consolidation_dirty_association_count)); + op_context.AddOperationTiming ( + prefix + ".consolidation_dirty_index_count", + static_cast (counters.consolidation_dirty_index_count)); +} + +void +EnsureRifActiveEpochCache (Store *store, ProcessorContext &context) +{ + if (!store) + return; + auto sidecar + = operations::execution_cache_sidecar_internal::Ensure (context); + try + { + operations::rif_active_epoch_cache_internal::Ensure ( + sidecar->rif_active_epoch, *store); + } + catch (...) + { + // The persistent representation remains authoritative. A later signal + // can retry the bounded current-epoch rebuild. + sidecar->rif_active_epoch.database.reset (); + sidecar->rif_active_epoch.valid = false; + } +} + double ElapsedMillis (std::chrono::steady_clock::time_point start, std::chrono::steady_clock::time_point end) @@ -119,6 +182,8 @@ struct DetachedProcessorCaches retrieval_surface_source_index; std::unordered_set retrieval_surface_source_index_dirty; ProcessorContext::AssociationFanoutCache association_fanout_cache; + std::shared_ptr + execution_cache_sidecar; std::unordered_set predictive_pre_activation_embedding_ids; std::unordered_set predictive_pre_activation_memory_ids; std::unordered_set retrieval_suppression_embedding_ids; @@ -129,8 +194,78 @@ struct DetachedProcessorCaches procedural_store; }; +DetachedProcessorCaches +SnapshotProcessorCaches (const DetachedProcessorCaches &caches) +{ + DetachedProcessorCaches snapshot = caches; + if (caches.execution_cache_sidecar) + snapshot.execution_cache_sidecar + = std::make_shared ( + *caches.execution_cache_sidecar); + return snapshot; +} + +std::size_t +DetachedProcessorCacheEntryCount (const DetachedProcessorCaches &caches) +{ + std::size_t count + = caches.association_cache.size () + + caches.association_cache_index.size () + + caches.retrieval_surface_cache.size () + + caches.retrieval_surface_index.size () + + caches.retrieval_surface_embedding_index.size () + + caches.retrieval_surface_source_index.size () + + caches.retrieval_surface_source_index_dirty.size () + + caches.association_fanout_cache.out_by_source.size () + + caches.association_fanout_cache.in_by_target.size () + + caches.predictive_pre_activation_embedding_ids.size () + + caches.predictive_pre_activation_memory_ids.size () + + caches.retrieval_suppression_embedding_ids.size () + + caches.retrieval_suppression_memory_ids.size (); + if (caches.execution_cache_sidecar) + { + const auto &sidecar = *caches.execution_cache_sidecar; + count += sidecar.emotional_metadata.rows_by_memory.size () + + sidecar.emotional_metadata.memory_ids_by_embedding.size () + + sidecar.emotional_metadata.values_by_embedding.size () + + sidecar.emotional_metadata.source_query_order.size () + + sidecar.supersession_eligibility + .activation_ts_by_target.size (); + } + for (const auto &[source_id, entries] : caches.retrieval_surface_source_index) + { + (void)source_id; + count += entries.size (); + } + for (const auto &[memory_id, edges] : + caches.association_fanout_cache.out_by_source) + { + (void)memory_id; + count += edges.size (); + } + for (const auto &[memory_id, edges] : + caches.association_fanout_cache.in_by_target) + { + (void)memory_id; + count += edges.size (); + } + count += caches.index_store.size () + caches.index_reverse.size () + + caches.procedural_store.size (); + for (const auto &[key, ids] : caches.index_store) + { + (void)key; + count += ids.size (); + } + for (const auto &[key, entries] : caches.procedural_store) + { + (void)key; + count += entries.size (); + } + return count; +} + void -ClearRebuildableProcessorCaches (ProcessorContext &ctx) +ClearDbDerivedProcessorCaches (ProcessorContext &ctx) { ctx.association_cache = {}; ctx.association_cache_index = {}; @@ -140,10 +275,17 @@ ClearRebuildableProcessorCaches (ProcessorContext &ctx) ctx.retrieval_surface_source_index = {}; ctx.retrieval_surface_source_index_dirty = {}; ctx.association_fanout_cache = {}; + operations::execution_cache_sidecar_internal::Erase (ctx); ctx.predictive_pre_activation_embedding_ids = {}; ctx.predictive_pre_activation_memory_ids = {}; ctx.retrieval_suppression_embedding_ids = {}; ctx.retrieval_suppression_memory_ids = {}; +} + +void +ClearRebuildableProcessorCaches (ProcessorContext &ctx) +{ + ClearDbDerivedProcessorCaches (ctx); ctx.index_store = {}; ctx.index_reverse = {}; ctx.procedural_store = {}; @@ -165,6 +307,8 @@ DetachRebuildableProcessorCaches (ProcessorContext &ctx) = std::move (ctx.retrieval_surface_source_index_dirty); caches.association_fanout_cache = std::move (ctx.association_fanout_cache); + caches.execution_cache_sidecar + = operations::execution_cache_sidecar_internal::Detach (ctx); caches.predictive_pre_activation_embedding_ids = std::move (ctx.predictive_pre_activation_embedding_ids); caches.predictive_pre_activation_memory_ids @@ -195,6 +339,8 @@ RestoreRebuildableProcessorCaches (ProcessorContext &ctx, ctx.retrieval_surface_source_index_dirty = std::move (caches.retrieval_surface_source_index_dirty); ctx.association_fanout_cache = std::move (caches.association_fanout_cache); + operations::execution_cache_sidecar_internal::Restore ( + ctx, std::move (caches.execution_cache_sidecar)); ctx.predictive_pre_activation_embedding_ids = std::move (caches.predictive_pre_activation_embedding_ids); ctx.predictive_pre_activation_memory_ids @@ -239,6 +385,7 @@ struct ProcessorRollbackSnapshot DetachedProcessorCaches caches; operations::consolidation_throughput_state_internal::State consolidation_throughput; + bool full_cache_snapshot = true; bool initialized = false; }; @@ -298,6 +445,12 @@ std::atomic_int g_signal_record_snapshot_setup_throw_stage { 0 }; class SignalRecordRollbackJournal { public: + struct SparseIndexBackup + { + bool existed = false; + std::size_t size = 0; + }; + SignalRecordRollbackJournal (ProcessorContext &context, std::string source_id, bool journal_aware) : context_ (context), source_id_ (std::move (source_id)), @@ -421,6 +574,7 @@ class SignalRecordRollbackJournal snapshot.accumulator_states = std::move (context_.accumulator_states); } RestoreWorkingMemoryRecordsInto (snapshot); + RestoreVolatileCachesInto (snapshot); } void @@ -515,6 +669,73 @@ class SignalRecordRollbackJournal ->PreserveWorkingMemorySlotBeforeErase (slot_index); } + void + PreserveSparseIndexBeforeInsert (const std::string &key, + long long memory_id) + { + if (!journal_aware_) + return; + if (!sparse_index_backups_.contains (key)) + { + const auto index_it = context_.index_store.find (key); + sparse_index_backups_.emplace ( + key, SparseIndexBackup { + index_it != context_.index_store.end (), + index_it != context_.index_store.end () + ? index_it->second.size () + : 0 }); + } + if (!index_reverse_backups_.contains (memory_id)) + { + const auto reverse_it = context_.index_reverse.find (memory_id); + index_reverse_backups_.emplace ( + memory_id, + reverse_it != context_.index_reverse.end () + ? std::optional (reverse_it->second) + : std::nullopt); + } + } + + static void + PreserveSparseIndexBeforeInsertThunk (void *owner, const std::string &key, + long long memory_id) + { + static_cast (owner) + ->PreserveSparseIndexBeforeInsert (key, memory_id); + } + + void + PreserveProceduralValueBeforeUpdate (const std::string &key, + long long memory_id) + { + if (!journal_aware_) + return; + auto &key_backups = procedural_backups_[key]; + if (key_backups.contains (memory_id)) + return; + const auto outer_it = context_.procedural_store.find (key); + if (outer_it == context_.procedural_store.end ()) + { + key_backups.emplace (memory_id, std::nullopt); + return; + } + const auto value_it = outer_it->second.find (memory_id); + key_backups.emplace ( + memory_id, + value_it != outer_it->second.end () + ? std::optional (value_it->second) + : std::nullopt); + } + + static void + PreserveProceduralValueBeforeUpdateThunk (void *owner, + const std::string &key, + long long memory_id) + { + static_cast (owner) + ->PreserveProceduralValueBeforeUpdate (key, memory_id); + } + private: static void MaybeThrowDuringSnapshotSetup (int stage) @@ -619,6 +840,55 @@ class SignalRecordRollbackJournal AttachWorkingMemoryRecords (snapshot, restored); } + void + RestoreVolatileCachesInto (ProcessorContext &snapshot) + { + for (const auto &[key, backup] : sparse_index_backups_) + { + if (!backup.existed) + { + context_.index_store.erase (key); + continue; + } + auto index_it = context_.index_store.find (key); + if (index_it != context_.index_store.end ()) + index_it->second.resize ( + std::min (index_it->second.size (), backup.size)); + } + for (const auto &[memory_id, old_value] : index_reverse_backups_) + { + if (old_value) + context_.index_reverse.insert_or_assign (memory_id, *old_value); + else + context_.index_reverse.erase (memory_id); + } + for (const auto &[key, entries] : procedural_backups_) + { + for (const auto &[memory_id, old_value] : entries) + { + if (old_value) + context_.procedural_store[key].insert_or_assign ( + memory_id, *old_value); + else + { + auto outer_it = context_.procedural_store.find (key); + if (outer_it != context_.procedural_store.end ()) + { + outer_it->second.erase (memory_id); + if (outer_it->second.empty ()) + context_.procedural_store.erase (outer_it); + } + } + } + } + snapshot.index_store = std::move (context_.index_store); + snapshot.index_reverse = std::move (context_.index_reverse); + snapshot.procedural_store = std::move (context_.procedural_store); + sparse_index_backups_.clear (); + index_reverse_backups_.clear (); + procedural_backups_.clear (); + } + ProcessorContext &context_; std::string source_id_; bool current_existed_ = false; @@ -633,6 +903,13 @@ class SignalRecordRollbackJournal std::optional current_accumulator_backup_; std::optional> full_accumulator_backup_; + std::unordered_map sparse_index_backups_; + std::unordered_map> + index_reverse_backups_; + std::unordered_map< + std::string, + std::unordered_map>> + procedural_backups_; }; /// Owns the caller-provided operation and the rollback storage for its @@ -686,6 +963,10 @@ class SnapshotOwningOperation final : public IOperation dynamic_cast (operation.get ()) != nullptr), + engine_owned_ ( + dynamic_cast (operation.get ()) + != nullptr), operation_ (std::move (operation)) { #if defined(CORTEXT_TESTING) @@ -727,6 +1008,12 @@ class SnapshotOwningOperation final : public IOperation return journal_aware_; } + bool + IsEngineOwned () const + { + return engine_owned_; + } + void Execute (OperationContext &ctx, Transaction &tx) const override { @@ -741,11 +1028,301 @@ class SnapshotOwningOperation final : public IOperation } bool journal_aware_ = false; + bool engine_owned_ = false; std::unique_ptr operation_; std::vector> snapshots_; std::size_t active_depth_ = 0; }; +void +InvalidateCustomOperationCaches (ProcessorContext &context) +{ + auto sidecar + = operations::execution_cache_sidecar_internal::Find (context); + std::optional rif_epoch; + if (sidecar) + rif_epoch = std::move (sidecar->rif_active_epoch); + operations::historical_surface_search_cache_internal::Erase (context); + ClearDbDerivedProcessorCaches (context); + // Caller SQL invalidates every database-derived lookup cache, but the + // bounded RIF epoch counters belong to the processor event lifecycle. Keep + // them across the compatibility rebuild so custom SQL cannot repeatedly + // re-zero the consolidation safety envelope. + if (rif_epoch) + operations::execution_cache_sidecar_internal::Ensure (context) + ->rif_active_epoch = std::move (*rif_epoch); +} + +bool +CustomQueryMayMutate (std::string_view query) +{ + constexpr std::array kMutationTokens { + "INSERT", "UPDATE", "DELETE", "REPLACE", + "CREATE", "DROP", "ALTER", "VACUUM" + }; + std::string token; + bool in_single_quote = false; + bool in_double_quote = false; + bool in_line_comment = false; + bool in_block_comment = false; + const auto token_mutates = [&] { + if (token.empty ()) + return false; + const bool mutates + = std::find (kMutationTokens.begin (), kMutationTokens.end (), token) + != kMutationTokens.end (); + token.clear (); + return mutates; + }; + for (std::size_t index = 0; index < query.size (); ++index) + { + const char current = query[index]; + const char next = index + 1 < query.size () ? query[index + 1] : '\0'; + if (in_line_comment) + { + in_line_comment = current != '\n'; + continue; + } + if (in_block_comment) + { + if (current == '*' && next == '/') + { + in_block_comment = false; + ++index; + } + continue; + } + if (in_single_quote) + { + if (current == '\'' && next == '\'') + ++index; + else if (current == '\'') + in_single_quote = false; + continue; + } + if (in_double_quote) + { + if (current == '"' && next == '"') + ++index; + else if (current == '"') + in_double_quote = false; + continue; + } + if (current == '-' && next == '-') + { + if (token_mutates ()) + return true; + in_line_comment = true; + ++index; + continue; + } + if (current == '/' && next == '*') + { + if (token_mutates ()) + return true; + in_block_comment = true; + ++index; + continue; + } + if (current == '\'' || current == '"') + { + if (token_mutates ()) + return true; + in_single_quote = current == '\''; + in_double_quote = current == '"'; + continue; + } + const auto byte = static_cast (current); + if (std::isalnum (byte) || current == '_') + { + token.push_back (static_cast (std::toupper (byte))); + continue; + } + if (token_mutates ()) + return true; + } + return token_mutates (); +} + +template +std::vector> +ExecuteCustomRifCompatible (Executor &executor, const std::string &query, + const std::vector ¶ms, + ProcessorContext &context) +{ + // A caller-supplied statement may reach memories through a wildcard, alias, + // view, trigger, or subquery that cannot be classified from SQL text alone. + // Materialize conservatively at this compatibility boundary. + auto sidecar + = operations::execution_cache_sidecar_internal::Ensure (context); + operations::rif_active_epoch_cache_internal::StageRebuild ( + sidecar->rif_active_epoch); + operations::rif_state_internal::MaterializeAllAndClear (executor); + try + { + auto rows = executor.Execute (query, params); + operations::rif_state_internal::RebuildFromMaterialized (executor); + return rows; + } + catch (...) + { + try + { + operations::rif_state_internal::RebuildFromMaterialized (executor); + } + catch (...) + { + } + throw; + } +} + +class CustomOperationTransaction final : public Transaction +{ +public: + CustomOperationTransaction (Transaction &transaction, + ProcessorContext &context, + double rif_recovery_time) + : transaction_ (&transaction), context_ (&context), + rif_recovery_time_ (rif_recovery_time) + { + } + + CustomOperationTransaction (std::unique_ptr transaction, + ProcessorContext &context, + double rif_recovery_time) + : owned_transaction_ (std::move (transaction)), + transaction_ (owned_transaction_.get ()), context_ (&context), + rif_recovery_time_ (rif_recovery_time) + { + } + + std::unique_ptr + Begin () override + { + return std::make_unique ( + transaction_->Begin (), *context_, rif_recovery_time_); + } + + std::vector> + Execute (const std::string &query, + const std::vector ¶ms = {}) override + { + CalibrateRifIfNeeded (); + // Caller-supplied roots can issue SQL that bypasses the engine's + // incremental cache-maintenance helpers. Fail closed before the first + // statement can make the sidecar stale, including when a later operation + // in the same transaction consumes emotional metadata. + if (CustomQueryMayMutate (query)) + InvalidateCustomOperationCaches (*context_); + return ExecuteCustomRifCompatible (*transaction_, query, params, + *context_); + } + + void + Commit () override + { + transaction_->Commit (); + } + + void + Rollback () override + { + transaction_->Rollback (); + } + +private: + void + CalibrateRifIfNeeded () + { + auto sidecar + = operations::execution_cache_sidecar_internal::Ensure (*context_); + const auto memory_ids = sidecar->rif_active_epoch.calibration_memory_ids; + if (memory_ids.empty ()) + return; + const auto changed + = operations::rif_state_internal::CalibrateMemoryIdsAtClock ( + *transaction_, memory_ids, rif_recovery_time_); + sidecar->rif_active_epoch.calibration_memory_ids.clear (); + operations::rif_active_epoch_cache_internal::StageMemories ( + sidecar->rif_active_epoch, changed); + } + + std::unique_ptr owned_transaction_; + Transaction *transaction_ = nullptr; + ProcessorContext *context_ = nullptr; + double rif_recovery_time_ = 0.0; +}; + +class CustomOperationStore final : public Store +{ +public: + CustomOperationStore (Store &store, ProcessorContext &context, + double rif_recovery_time) + : store_ (&store), context_ (&context), + rif_recovery_time_ (rif_recovery_time) + { + CalibrateRifIfNeeded (); + } + + std::vector> + Execute (const std::string &query, + const std::vector ¶ms = {}) override + { + if (CustomQueryMayMutate (query)) + InvalidateCustomOperationCaches (*context_); + return ExecuteCustomRifCompatible (*store_, query, params, *context_); + } + + std::unique_ptr + Begin () override + { + return std::make_unique ( + store_->Begin (), *context_, rif_recovery_time_); + } + + void + Commit () override + { + store_->Commit (); + } + + void + Rollback () override + { + store_->Rollback (); + } + + void + Close () override + { + store_->Close (); + } + +private: + void + CalibrateRifIfNeeded () + { + auto sidecar + = operations::execution_cache_sidecar_internal::Ensure (*context_); + const auto memory_ids = sidecar->rif_active_epoch.calibration_memory_ids; + if (memory_ids.empty ()) + return; + auto transaction = store_->Begin (); + const auto changed + = operations::rif_state_internal::CalibrateMemoryIdsAtClock ( + *transaction, memory_ids, rif_recovery_time_); + transaction->Commit (); + sidecar->rif_active_epoch.calibration_memory_ids.clear (); + operations::rif_active_epoch_cache_internal::StageMemories ( + sidecar->rif_active_epoch, changed); + } + + Store *store_ = nullptr; + ProcessorContext *context_ = nullptr; + double rif_recovery_time_ = 0.0; +}; + void DeleteStaleWorkingMemoryRows (Transaction &tx, const std::vector &memory_ids, @@ -947,12 +1524,19 @@ CheckpointSQLiteStore (Store *store, bool full, OperationContext *op_context, return; } const auto start = std::chrono::steady_clock::now (); + bool failed = false; try { +#if defined(CORTEXT_TESTING) + if (g_sqlite_checkpoint_failure_once.exchange ( + false, std::memory_order_relaxed)) + throw StoreError ("injected SQLite checkpoint failure"); +#endif sqlite_store->Checkpoint (full); } catch (const std::exception &e) { + failed = true; telemetry::LogWarn ( "cortext.sqlite_checkpoint_failed", { telemetry::Attribute::String ("component", "signal_processor"), @@ -962,6 +1546,8 @@ CheckpointSQLiteStore (Store *store, bool full, OperationContext *op_context, { op_context->AddOperationTiming ( timing_name, ElapsedMillis (start, std::chrono::steady_clock::now ())); + op_context->AddOperationTiming ( + std::string (timing_name) + "_failure_count", failed ? 1.0 : 0.0); } } @@ -1084,6 +1670,15 @@ ApplyConsolidationHint (const Signal &signal, const SignalProcessor::Config &cfg out.consolidation_state = ConsolidationState::None; return; } + const auto sidecar + = operations::execution_cache_sidecar_internal::Find (ctx); + if (sidecar + && operations::rif_active_epoch_cache_internal::RequiresConsolidation ( + sidecar->rif_active_epoch)) + { + out.consolidation_state = ConsolidationState::Required; + return; + } const auto rate_state = operations::consolidation_throughput_state_internal::Find (ctx); out.consolidation_state @@ -1821,37 +2416,39 @@ LoadPredictivePreActivationIds (Store &store, ProcessorContext &ctx) void LoadRetrievalSuppressionIds (Store &store, ProcessorContext &ctx) { - try - { - ctx.retrieval_suppression_embedding_ids.clear (); - ctx.retrieval_suppression_memory_ids.clear (); - auto rows = store.Execute ( - "SELECT memory_id FROM memories " - "WHERE COALESCE(suppression, 0.0) > 1e-9"); - ctx.retrieval_suppression_memory_ids.reserve (rows.size ()); - for (const auto &row : rows) - { - const long long memory_id = ExtractInt64 (row, "memory_id", 0); - if (memory_id > 0) - { - ctx.retrieval_suppression_memory_ids.insert (memory_id); - } - } - } - catch (const std::exception &e) - { - telemetry::LogWarn ( - "Failed to load retrieval suppression ids", - { telemetry::Attribute::String ("component", "signal_processor"), - telemetry::Attribute::String ("error", e.what ()) }); - } + (void)store; + // Lazy RIF state is persisted and indexed in SQLite. Do not mirror the + // active history into ProcessorContext during initialization or rollback. + ctx.retrieval_suppression_embedding_ids.clear (); + ctx.retrieval_suppression_memory_ids.clear (); } void -LoadHistoricalSurfaceSearchCache (Store &store, ProcessorContext &ctx) +LoadHistoricalSurfaceSearchCache ( + Store &store, ProcessorContext &ctx, + const std::unordered_map *base_embedding_ids + = nullptr) { try { + std::unordered_map authoritative_base_ids; + if (!base_embedding_ids) + { + auto base_rows = store.Execute ( + "SELECT memory_id, embedding_id FROM memories " + "WHERE embedding_id IS NOT NULL"); + authoritative_base_ids.reserve (base_rows.size ()); + for (const auto &row : base_rows) + { + const long long memory_id + = ExtractInt64 (row, "memory_id", 0); + const long long embedding_id + = ExtractInt64 (row, "embedding_id", 0); + if (memory_id > 0 && embedding_id > 0) + authoritative_base_ids[memory_id] = embedding_id; + } + base_embedding_ids = &authoritative_base_ids; + } auto embedding_rows = store.Execute ( "SELECT e.embedding_id, e.embedding, " " COALESCE(m.memory_id, 0) AS memory_id, " @@ -1860,7 +2457,7 @@ LoadHistoricalSurfaceSearchCache (Store &store, ProcessorContext &ctx) " COALESCE(m.source_id, '') AS source_id " "FROM embeddings e " "LEFT JOIN memories m ON m.embedding_id = e.embedding_id " - " AND m.kind = 'LONG_TERM' " + " AND m.kind IN ('LONG_TERM', 'ASSOCIATION') " "ORDER BY e.embedding_id, COALESCE(m.start_ts, 0), m.memory_id"); std::vector< operations::historical_surface_search_cache_internal::Entry> @@ -1886,15 +2483,20 @@ LoadHistoricalSurfaceSearchCache (Store &store, ProcessorContext &ctx) current_entries.reserve (ctx.retrieval_surface_cache.size ()); for (const auto &surface : ctx.retrieval_surface_cache) { - if (surface.kind != "LONG_TERM" || !surface.vector_seed_eligible + if ((surface.kind != "LONG_TERM" + && surface.kind != "ASSOCIATION") || surface.memory_id <= 0 || surface.embedding_id <= 0 || surface.embedding.size () <= 0) { continue; } current_entries.push_back ( - { surface.embedding_id, surface.memory_id, 0, std::string (), - std::string (), surface.embedding }); + { surface.embedding_id, surface.memory_id, surface.start_ts, + surface.kind, surface.source_id, surface.embedding, + base_embedding_ids + && base_embedding_ids->count (surface.memory_id) != 0 + ? base_embedding_ids->at (surface.memory_id) + : surface.embedding_id }); } if (search_entries.size () != embedding_rows.size () || !operations::historical_surface_search_cache_internal::Reset ( @@ -1913,12 +2515,47 @@ LoadHistoricalSurfaceSearchCache (Store &store, ProcessorContext &ctx) } } +void +LoadEmotionalMetadataCache (Store &store, ProcessorContext &ctx) +{ + auto rows = store.Execute ( + "SELECT memory_id, embedding_id, created_at, flashbulb, " + " emotional_intensity, s_arousal_avg, half_life_bonus, " + " cascade_radius, cascade_decay " + "FROM memories WHERE embedding_id IS NOT NULL AND kind != 'WORKING' " + "ORDER BY created_at DESC, memory_id ASC"); + std::vector + metadata; + metadata.reserve (rows.size ()); + for (const auto &row : rows) + { + const long long memory_id = ExtractInt64 (row, "memory_id", 0); + const long long embedding_id = ExtractInt64 (row, "embedding_id", 0); + if (memory_id <= 0 || embedding_id <= 0) + continue; + metadata.push_back ( + { memory_id, + embedding_id, + ExtractInt64 (row, "created_at", 0), + ExtractInt64 (row, "flashbulb", 0) != 0, + ExtractDouble (row, "emotional_intensity", 0.0), + ExtractDouble (row, "s_arousal_avg", 0.0), + ExtractDouble (row, "half_life_bonus", 0.0), + static_cast (ExtractInt64 (row, "cascade_radius", 0)), + ExtractDouble (row, "cascade_decay", 0.0) }); + } + operations::emotional_metadata_cache_internal::Reset ( + ctx, std::move (metadata)); +} + void LoadRetrievalSurfaceCache (Store &store, ProcessorContext &ctx) { try { operations::historical_surface_search_cache_internal::Erase (ctx); + operations::execution_cache_sidecar_internal::Erase (ctx); ctx.retrieval_surface_cache.clear (); ctx.retrieval_surface_index.clear (); ctx.retrieval_surface_embedding_index.clear (); @@ -1927,6 +2564,7 @@ LoadRetrievalSurfaceCache (Store &store, ProcessorContext &ctx) ctx.association_cache.clear (); ctx.association_cache_index.clear (); ctx.association_fanout_cache = {}; + std::unordered_map base_embedding_ids; const long long constructive_recall_enabled = operations::constructive_recall::Disabled () ? 0LL : 1LL; @@ -1995,6 +2633,7 @@ LoadRetrievalSurfaceCache (Store &store, ProcessorContext &ctx) ctx.retrieval_surface_cache.reserve (rows.size ()); ctx.retrieval_surface_index.reserve (rows.size ()); ctx.retrieval_surface_embedding_index.reserve (rows.size ()); + base_embedding_ids.reserve (rows.size ()); for (const auto &row : rows) { if (ExtractInt64 (row, "current_surface_database_current", 0) == 0) @@ -2010,6 +2649,8 @@ LoadRetrievalSurfaceCache (Store &store, ProcessorContext &ctx) ProcessorContext::RetrievalSurfaceEntry entry; entry.memory_id = ExtractInt64 (row, "memory_id", 0); entry.embedding_id = ExtractInt64 (row, "embedding_id", 0); + base_embedding_ids[entry.memory_id] + = ExtractInt64 (row, "base_embedding_id", entry.embedding_id); entry.created_at = ExtractInt64 (row, "created_at", 0); entry.start_ts = ExtractInt64 (row, "start_ts", 0); entry.last_access = ExtractInt64 (row, "last_access", 0); @@ -2045,7 +2686,8 @@ LoadRetrievalSurfaceCache (Store &store, ProcessorContext &ctx) association_embedding, association_is_association); } - LoadHistoricalSurfaceSearchCache (store, ctx); + LoadHistoricalSurfaceSearchCache (store, ctx, &base_embedding_ids); + LoadEmotionalMetadataCache (store, ctx); operations::historical_surface_search_cache_internal:: SetCurrentSurfaceDatabaseCurrent ( ctx, current_surface_database_current); @@ -2061,6 +2703,7 @@ LoadRetrievalSurfaceCache (Store &store, ProcessorContext &ctx) catch (const std::exception &e) { operations::historical_surface_search_cache_internal::Erase (ctx); + operations::execution_cache_sidecar_internal::Erase (ctx); operations::historical_surface_search_cache_internal:: SetCurrentSurfaceDatabaseCurrent (ctx, false); operations::historical_surface_search_cache_internal:: @@ -2124,13 +2767,14 @@ LoadWorkingMemory (Store &store, ProcessorContext &ctx, // Load from MEMORIES table with kind='WORKING' and end_ts IS NULL (active) auto rows = store.Execute ( - "SELECT memory_id, embedding_id, source_id, strength, last_access, " - " strength_updated_at, " - " n_signals, s_max, s_avg, s_emotion_max, s_arousal_avg, " - " drift_mag, modality, start_ts " - "FROM memories " - "WHERE kind = 'WORKING' AND end_ts IS NULL " - "ORDER BY start_ts ASC"); + "SELECT m.memory_id, m.embedding_id, m.source_id, " + " rif.strength, m.last_access, m.strength_updated_at, " + " m.n_signals, m.s_max, m.s_avg, m.s_emotion_max, " + " m.s_arousal_avg, m.drift_mag, m.modality, m.start_ts " + "FROM memories m " + "JOIN rif_effective_memories rif ON rif.memory_id = m.memory_id " + "WHERE m.kind = 'WORKING' AND m.end_ts IS NULL " + "ORDER BY m.start_ts ASC"); int pos = 0; for (const auto &row : rows) @@ -2442,6 +3086,26 @@ SetSignalRecordSnapshotSetupThrowStageForTest (int stage) g_signal_record_snapshot_setup_throw_stage.store ( stage, std::memory_order_relaxed); } + +void +SetRifActiveEpochPublishFailureStageForTest (int stage) +{ + operations::rif_active_epoch_cache_internal:: + SetPublishFailureStageForTest (stage); +} + +void +SetRifActiveEpochPublishFailureMaskForTest (unsigned int mask) +{ + operations::rif_active_epoch_cache_internal:: + SetPublishFailureMaskForTest (mask); +} + +void +SetSQLiteCheckpointFailureOnceForTest () +{ + g_sqlite_checkpoint_failure_once.store (true, std::memory_order_relaxed); +} } // namespace testing #endif @@ -2499,10 +3163,18 @@ SignalProcessor::SignalProcessor (const Config &config, LoadWorkingMemory (*store_, *context_, config_, now_ms); // From MEMORIES LoadSoftAnchors (*store_, *context_); + EnsureRifActiveEpochCache (store_.get (), *context_); + operations::bounded_activation_shadow_internal::Initialize ( + *context_, store_.get (), config_.focus, config_.sensitivity, + config_.stability); // Accumulators are volatile staging state. Durable memories and working // memory are restored, but unfinished accumulator windows are discarded. } + internal::ResetSQLiteMutationAudit (store_.get ()); + if (context_) + operations::consolidation_epoch_profile_internal::Reset (*context_); + if (!loaded_state && context_) { SeedKnobDerivedStateDefaults (*context_, config_); @@ -2520,7 +3192,10 @@ SignalProcessor::~SignalProcessor () // Erasing it prevents a later allocation at the same address from // inheriting state from this processor or store. operations::historical_surface_search_cache_internal::Erase (*context_); + operations::bounded_activation_shadow_internal::Erase (*context_); + operations::execution_cache_sidecar_internal::Erase (*context_); operations::consolidation_throughput_state_internal::Erase (*context_); + operations::consolidation_epoch_profile_internal::Erase (*context_); } } @@ -2531,10 +3206,34 @@ SignalProcessor::Process (const Signal &signal) telemetry::ScopedSpan span ("cortext.process"); const bool read_only = signal.retention == Retention::Ephemeral; const bool maintenance = signal.force_consolidation && !read_only; + std::optional + consolidation_epoch_pre; + if (maintenance + && operations::consolidation_epoch_profile_internal::Enabled ()) + consolidation_epoch_pre + = operations::consolidation_epoch_profile_internal::Current ( + *context_); + + // The disposable SQLite epoch is rebuilt only from committed authority and + // never after the signal transaction has begun. + EnsureRifActiveEpochCache (store_.get (), *context_); // Create transaction for this signal processing const auto tx_begin_start = std::chrono::steady_clock::now (); auto tx = store_ ? store_->Begin () : nullptr; + const auto *sqlite_tx + = dynamic_cast (tx.get ()); + const bool root_canonical_transaction + = tx && (!sqlite_tx || sqlite_tx->GetSavepointName ().empty ()); + auto bounded_shadow_observation + = operations::bounded_activation_shadow_internal:: + PrepareForCanonicalTransaction ( + operations::bounded_activation_shadow_internal::Find ( + *context_), + signal, root_canonical_transaction); + operations::bounded_activation_shadow_internal:: + CanonicalTransactionJournalScope bounded_shadow_journal_scope ( + bounded_shadow_observation); std::unique_ptr object_tx; if (object_store_ && tx && !maintenance) { @@ -2551,13 +3250,35 @@ SignalProcessor::Process (const Signal &signal) auto &rollback_snapshot = snapshot_lease.Get (); SignalRecordRollbackJournal signal_record_journal ( *context_, signal.source_id, snapshot_owner.IsJournalAware ()); + std::size_t snapshot_cache_entry_copy_count = 0; + bool full_cache_snapshot = true; + double snapshot_full_cache_copy_ms = 0.0; + double snapshot_cache_entry_copy_ms = 0.0; { auto detached_caches = DetachRebuildableProcessorCaches (*context_); try { signal_record_journal.CopyScalarSnapshotTo ( rollback_snapshot.context); - rollback_snapshot.caches = detached_caches; + full_cache_snapshot = !snapshot_owner.IsJournalAware (); + rollback_snapshot.full_cache_snapshot = full_cache_snapshot; + if (full_cache_snapshot) + { + const auto cache_copy_start = std::chrono::steady_clock::now (); + rollback_snapshot.caches + = SnapshotProcessorCaches (detached_caches); + snapshot_cache_entry_copy_count + = DetachedProcessorCacheEntryCount (detached_caches); + snapshot_full_cache_copy_ms = ElapsedMillis ( + cache_copy_start, std::chrono::steady_clock::now ()); + if (snapshot_cache_entry_copy_count > 0) + snapshot_cache_entry_copy_ms = snapshot_full_cache_copy_ms; + } + else + { + rollback_snapshot.caches = {}; + snapshot_cache_entry_copy_count = 0; + } rollback_snapshot.consolidation_throughput = operations::consolidation_throughput_state_internal::Find ( *context_); @@ -2573,14 +3294,26 @@ SignalProcessor::Process (const Signal &signal) } const auto snapshot_end = std::chrono::steady_clock::now (); - OperationContext op_context (signal, *context_, config_, store_.get (), + std::unique_ptr custom_operation_store; + Store *operation_store = store_.get (); + if (operation_store && !snapshot_owner.IsEngineOwned ()) + { + custom_operation_store = std::make_unique ( + *operation_store, *context_, + core::RetrievalCompetitionRecoverySeconds (config_.stability) + * 1000.0); + operation_store = custom_operation_store.get (); + } + OperationContext op_context (signal, *context_, config_, operation_store, object_tx.get ()); operations::signal_record_rollback_internal::Scope signal_record_rollback_scope ( *context_, &signal_record_journal, &SignalRecordRollbackJournal::EnsureBackedUpThunk, &SignalRecordRollbackJournal::EnsureAllBackedUpThunk, - &SignalRecordRollbackJournal::PreserveWorkingMemorySlotBeforeEraseThunk); + &SignalRecordRollbackJournal::PreserveWorkingMemorySlotBeforeEraseThunk, + &SignalRecordRollbackJournal::PreserveSparseIndexBeforeInsertThunk, + &SignalRecordRollbackJournal::PreserveProceduralValueBeforeUpdateThunk); if (tx) { op_context.AddOperationTiming ("SignalProcessor.begin_transaction", @@ -2590,6 +3323,22 @@ SignalProcessor::Process (const Signal &signal) op_context.AddOperationTiming ("SignalProcessor.snapshot_context", ElapsedMillis (snapshot_start, snapshot_end)); + op_context.AddOperationTiming ( + "SignalProcessor.snapshot_full_cache_copy_count", + full_cache_snapshot ? 1.0 : 0.0); + op_context.AddOperationTiming ( + "SignalProcessor.snapshot_full_cache_copy_activity", + full_cache_snapshot ? 1.0 : 0.0); + op_context.AddOperationTiming ( + "SignalProcessor.snapshot_cache_entry_copy_count", + static_cast (snapshot_cache_entry_copy_count)); + op_context.AddOperationTiming ( + "SignalProcessor.snapshot_cache_entry_copy_activity", + snapshot_cache_entry_copy_count > 0 ? 1.0 : 0.0); + op_context.AddOperationTiming ("SignalProcessor.snapshot_full_cache_copy", + snapshot_full_cache_copy_ms); + op_context.AddOperationTiming ("SignalProcessor.snapshot_cache_entry_copy", + snapshot_cache_entry_copy_ms); auto rollback_object_tx = [&object_tx] { if (object_tx) { @@ -2608,13 +3357,29 @@ SignalProcessor::Process (const Signal &signal) *context_ = std::move (rollback_snapshot.context); operations::consolidation_throughput_state_internal::Reset ( *context_, rollback_snapshot.consolidation_throughput); - RestoreRebuildableProcessorCaches (*context_, rollback_snapshot.caches); + if (rollback_snapshot.full_cache_snapshot) + { + RestoreRebuildableProcessorCaches (*context_, rollback_snapshot.caches); + } + else + { + ClearDbDerivedProcessorCaches (*context_); + } rollback_snapshot.initialized = false; if (store_) { - LoadPredictivePreActivationIds (*store_, *context_); - LoadRetrievalSuppressionIds (*store_, *context_); - LoadHistoricalSurfaceSearchCache (*store_, *context_); + if (rollback_snapshot.full_cache_snapshot) + { + LoadPredictivePreActivationIds (*store_, *context_); + LoadRetrievalSuppressionIds (*store_, *context_); + LoadHistoricalSurfaceSearchCache (*store_, *context_); + } + else + { + LoadRetrievalSurfaceCache (*store_, *context_); + LoadPredictivePreActivationIds (*store_, *context_); + LoadRetrievalSuppressionIds (*store_, *context_); + } } }; auto restore_read_only_context_snapshot = [&] { @@ -2622,13 +3387,31 @@ SignalProcessor::Process (const Signal &signal) *context_ = std::move (rollback_snapshot.context); operations::consolidation_throughput_state_internal::Reset ( *context_, rollback_snapshot.consolidation_throughput); - RestoreRebuildableProcessorCaches (*context_, rollback_snapshot.caches); + if (rollback_snapshot.full_cache_snapshot) + { + RestoreRebuildableProcessorCaches (*context_, rollback_snapshot.caches); + } + else + { + ClearDbDerivedProcessorCaches (*context_); + if (store_) + { + LoadRetrievalSurfaceCache (*store_, *context_); + LoadPredictivePreActivationIds (*store_, *context_); + LoadRetrievalSuppressionIds (*store_, *context_); + } + } rollback_snapshot.initialized = false; }; std::optional read_only_output; try { + if (maintenance) + operations::rif_active_epoch_cache_internal::StageRebuild ( + operations::execution_cache_sidecar_internal::Ensure (*context_) + ->rif_active_epoch, + true); auto op_start = std::chrono::steady_clock::now (); if (!maintenance) { @@ -2640,7 +3423,19 @@ SignalProcessor::Process (const Signal &signal) } if (tx) { - root_operation_->Execute (op_context, *tx); + if (snapshot_owner.IsEngineOwned ()) + { + root_operation_->Execute (op_context, *tx); + } + else + { + CustomOperationTransaction custom_transaction ( + *tx, *context_, + core::RetrievalCompetitionRecoverySeconds ( + config_.stability) + * 1000.0); + root_operation_->Execute (op_context, custom_transaction); + } } if (read_only) @@ -2735,6 +3530,68 @@ SignalProcessor::Process (const Signal &signal) op_context.AddOperationTiming ( "SignalProcessor.commit_transaction", ElapsedMillis (op_start, std::chrono::steady_clock::now ())); + const auto bounded_shadow_publish + = operations::bounded_activation_shadow_internal:: + PublishAfterCanonicalTransactionCommit ( + bounded_shadow_observation); + if (bounded_shadow_observation.state) + { + telemetry::RecordHistogram ( + "cortext.bounded_activation_shadow.recall_comparisons", + static_cast ( + bounded_shadow_observation.recall_comparisons)); + telemetry::RecordHistogram ( + "cortext.bounded_activation_shadow.normal_comparisons", + static_cast ( + bounded_shadow_publish.normal_comparisons)); + telemetry::RecordHistogram ( + "cortext.bounded_activation_shadow.consolidation_comparisons", + static_cast ( + bounded_shadow_publish.consolidation_comparisons)); + telemetry::RecordHistogram ( + "cortext.bounded_activation_shadow.candidate_count", + static_cast ( + bounded_shadow_observation.candidate_count)); + if (bounded_shadow_publish.disabled) + telemetry::AddCounter ( + "cortext.bounded_activation_shadow.disabled_total", 1); + } + op_context.SetCurrentOperationType ("PublishRifActiveEpoch"); + op_start = std::chrono::steady_clock::now (); + const auto rif_publish + = operations::rif_active_epoch_cache_internal:: + PublishAfterPersistentCommit ( + operations::execution_cache_sidecar_internal::Ensure ( + *context_)->rif_active_epoch, + *store_); + op_context.AddOperationTiming ( + "SignalProcessor.publish_rif_active_epoch", + ElapsedMillis (op_start, std::chrono::steady_clock::now ())); + op_context.AddOperationTiming ( + "SignalProcessor.rif_epoch_publication_rebuild_count", + rif_publish.rebuilt ? 1.0 : 0.0); + op_context.AddOperationTiming ( + "SignalProcessor.rif_epoch_publication_recovery_count", + rif_publish.recovered_from_failure ? 1.0 : 0.0); + const auto &rif_epoch + = operations::execution_cache_sidecar_internal::Ensure ( + *context_) + ->rif_active_epoch; + op_context.AddOperationTiming ( + "SignalProcessor.rif_active_epoch_event_count", + static_cast (rif_epoch.event_count)); + op_context.AddOperationTiming ( + "SignalProcessor.rif_active_epoch_mutation_count", + static_cast (rif_epoch.mutation_count)); + op_context.AddOperationTiming ( + "SignalProcessor.rif_active_epoch_allocated_bytes", + static_cast (rif_epoch.allocated_bytes)); + op_context.AddOperationTiming ( + "SignalProcessor.rif_active_epoch_required", + operations::rif_active_epoch_cache_internal:: + RequiresConsolidation (rif_epoch) + ? 1.0 + : 0.0); if (signal.force_consolidation) { // Force persistence can prune or rewrite broad embedding sets, @@ -2742,6 +3599,13 @@ SignalProcessor::Process (const Signal &signal) // Rebuild only after the authoritative commit succeeds; a failed // commit restores the exact pre-signal snapshot in the catch path. LoadRetrievalSurfaceCache (*store_, *context_); + } + if (signal.force_consolidation + || signal.retention == Retention::Durable) + { + // Durable is the shared ingestion transaction plus this explicit + // post-commit SQLite edge. It does not select a second write + // pipeline or replay the committed mutation. CheckpointSQLiteStore ( store_.get (), true, &op_context, "SignalProcessor.sqlite_wal_checkpoint"); @@ -2755,6 +3619,8 @@ SignalProcessor::Process (const Signal &signal) } catch (const internal::CancellationError &) { + operations::bounded_activation_shadow_internal:: + DiscardCanonicalTransaction (bounded_shadow_observation); if (tx) { rollback_object_tx (); @@ -2765,6 +3631,8 @@ SignalProcessor::Process (const Signal &signal) } catch (const std::exception &e) { + operations::bounded_activation_shadow_internal:: + DiscardCanonicalTransaction (bounded_shadow_observation); if (tx) { rollback_object_tx (); @@ -2784,6 +3652,8 @@ SignalProcessor::Process (const Signal &signal) } catch (...) { + operations::bounded_activation_shadow_internal:: + DiscardCanonicalTransaction (bounded_shadow_observation); if (tx) { rollback_object_tx (); @@ -2803,6 +3673,77 @@ SignalProcessor::Process (const Signal &signal) } Output out; + if (operations::consolidation_epoch_profile_internal::Enabled ()) + { + const auto mutations + = internal::ConsumeSQLiteCommittedMutations (store_.get ()); + if (maintenance) + { + auto seal = operations::consolidation_epoch_profile_internal::Seal ( + *context_, mutations); + if (consolidation_epoch_pre) + seal.pre = consolidation_epoch_pre->counters; + op_context.AddOperationTiming ( + "ConsolidationEpoch.closed_epoch_id", + static_cast (seal.closed_epoch_id)); + op_context.AddOperationTiming ( + "ConsolidationEpoch.sealed_epoch_event_count", + static_cast (seal.sealed_epoch_event_count)); + op_context.AddOperationTiming ( + "ConsolidationEpoch.sealed_epoch_mutation_count", + static_cast (seal.sealed_epoch_mutation_count)); + op_context.AddOperationTiming ( + "ConsolidationEpoch.sealed_mutation_identity_count", + static_cast (seal.sealed_mutation_identity_count)); + op_context.AddOperationTiming ( + "ConsolidationEpoch.sealed_mutation_identity_verified", + seal.sealed_mutation_identity_verified ? 1.0 : 0.0); + op_context.AddOperationTiming ( + "ConsolidationEpoch.close_succeeded", 1.0); + AddConsolidationEpochCounters (op_context, + "ConsolidationEpoch.pre", seal.pre); + AddConsolidationEpochCounters (op_context, + "ConsolidationEpoch.post", seal.post); + } + else if (!read_only) + { + const auto event + = operations::consolidation_epoch_profile_internal::ObserveEvent ( + *context_, mutations); + op_context.AddOperationTiming ( + "ConsolidationEpoch.epoch_id", + static_cast (event.epoch_id)); + op_context.AddOperationTiming ( + "ConsolidationEpoch.events_since_epoch_start", + static_cast (event.events_since_epoch_start)); + AddConsolidationEpochCounters (op_context, "ConsolidationEpoch", + event.counters); + } + } + if (ProfileWorkCountersEnabled ()) + { + op_context.AddOperationTiming ( + "SignalProcessor.predictive_id_count", + static_cast ( + context_->predictive_pre_activation_embedding_ids.size () + + context_->predictive_pre_activation_memory_ids.size ())); + op_context.AddOperationTiming ( + "SignalProcessor.predictive_id_activity", + context_->predictive_pre_activation_embedding_ids.empty () + && context_->predictive_pre_activation_memory_ids.empty () + ? 0.0 + : 1.0); + op_context.AddOperationTiming ( + "SignalProcessor.retrieval_suppression_id_count", + static_cast ( + operations::execution_cache_sidecar_internal::Ensure (*context_) + ->rif_active_epoch.active_rows)); + op_context.AddOperationTiming ( + "SignalProcessor.retrieval_suppression_id_activity", + operations::execution_cache_sidecar_internal::Ensure (*context_) + ->rif_active_epoch.active_rows == 0 + ? 0.0 : 1.0); + } if (read_only_output.has_value ()) { out = std::move (*read_only_output); @@ -2845,7 +3786,7 @@ SignalProcessor::Flush () { auto detached_caches = DetachRebuildableProcessorCaches (*context_); context_snapshot = *context_; - context_cache_snapshot = detached_caches; + context_cache_snapshot = SnapshotProcessorCaches (detached_caches); RestoreRebuildableProcessorCaches (*context_, detached_caches); } auto restore_context_snapshot = [&] { @@ -3419,6 +4360,12 @@ SignalProcessor::PersistWorkingMemory (Transaction &tx, bool force, slot.s_arousal_avg, slot.drift_acc, slot.strength, working_source_reliability, working_stability, ts_ms, strength_ts_ms, memory_id }); + operations::rif_state_internal::RefreshActiveStrengthWhere ( + tx, "memory_id = ?", { memory_id }); + operations::rif_active_epoch_cache_internal::StageMemory ( + operations::execution_cache_sidecar_internal::Ensure ( + *context_)->rif_active_epoch, + memory_id); add_timing ("SignalProcessor.wm_update_slot_memory", t_sql_start); } diff --git a/src/store.cpp b/src/store.cpp index d55cc2e3..c7348dd9 100644 --- a/src/store.cpp +++ b/src/store.cpp @@ -1,4 +1,5 @@ #include "cortext/store/sqlite_store.hpp" +#include "store/mutation_audit_internal.hpp" #include #include @@ -7,10 +8,13 @@ #include #include #include +#include #include #include #include #include +#include +#include #include "cortext/store/extension_loader.hpp" #include "cortext/telemetry/telemetry.hpp" @@ -39,6 +43,332 @@ namespace constexpr int kDefaultWalAutoCheckpointPages = 1000; +struct SQLiteMutationAuditState +{ + struct Mark + { + std::size_t logical = 0; + std::size_t physical = 0; + }; + + struct PhysicalVecMutation + { + std::string surface; + std::int64_t row_id = 0; + int operation = SQLITE_UPDATE; + }; + + bool root_active = false; + std::vector pending; + std::vector pending_physical; + std::vector committed; + std::unordered_map vec_logical_ids; + std::unordered_map marks; + bool trigger_journal_ready = false; +}; + +struct SQLiteMutationAuditRegistry +{ + std::mutex mutex; + std::unordered_map stores; +}; + +SQLiteMutationAuditRegistry & +MutationAuditRegistry () +{ + static auto *registry = new SQLiteMutationAuditRegistry (); + return *registry; +} + +bool +MutationAuditEnabled () +{ + const char *value = std::getenv ("CORTEXT_PROFILE_CONSOLIDATION_EPOCH"); + return value != nullptr && value[0] != '\0' && std::string_view (value) != "0" + && std::string_view (value) != "false"; +} + +std::optional +MutationAuditValue (sqlite3 *db, int operation, int column, bool old_value) +{ + sqlite3_value *value = nullptr; + const int rc = old_value ? sqlite3_preupdate_old (db, column, &value) + : sqlite3_preupdate_new (db, column, &value); + if (rc != SQLITE_OK || value == nullptr || sqlite3_value_type (value) == SQLITE_NULL) + return std::nullopt; + if (sqlite3_value_type (value) == SQLITE_INTEGER) + return std::to_string (sqlite3_value_int64 (value)); + const auto *text = sqlite3_value_text (value); + if (!text) + return std::nullopt; + (void)operation; + return std::string (reinterpret_cast (text)); +} + +std::string +MutationAuditComponent (const std::string &value) +{ + return std::to_string (value.size ()) + ":" + value; +} + +std::optional +MutationAuditLogicalIdentity (sqlite3 *db, int operation, + std::string_view table, bool old_value) +{ + const bool value_available + = old_value ? operation != SQLITE_INSERT : operation != SQLITE_DELETE; + if (!value_available) + return std::nullopt; + if (table == "memories") + { + auto memory_id = MutationAuditValue (db, operation, 0, old_value); + if (memory_id) + return internal::SQLiteMutationIdentity { + internal::SQLiteMutationKind::Memory, std::string (table), + "memory:" + MutationAuditComponent (*memory_id) + }; + return std::nullopt; + } + if (table == "associations") + { + auto source = MutationAuditValue (db, operation, 0, old_value); + auto target = MutationAuditValue (db, operation, 1, old_value); + auto edge_type = MutationAuditValue (db, operation, 2, old_value); + if (source && target && edge_type) + return internal::SQLiteMutationIdentity { + internal::SQLiteMutationKind::Association, std::string (table), + "association:" + MutationAuditComponent (*source) + + MutationAuditComponent (*target) + + MutationAuditComponent (*edge_type) + }; + return std::nullopt; + } + if (table == "memory_reconstructions") + { + auto reconstruction_id = MutationAuditValue (db, operation, 0, old_value); + if (reconstruction_id) + return internal::SQLiteMutationIdentity { + internal::SQLiteMutationKind::Index, std::string (table), + "reconstruction:" + MutationAuditComponent (*reconstruction_id) + }; + return std::nullopt; + } + constexpr std::string_view rowids_suffix = "_rowids"; + if (table.ends_with (rowids_suffix)) + { + const std::string_view surface + = table.substr (0, table.size () - rowids_suffix.size ()); + if (surface != "embeddings" && surface != "current_memory_embeddings") + return std::nullopt; + auto entry_id = MutationAuditValue (db, operation, 1, old_value); + if (entry_id) + return internal::SQLiteMutationIdentity { + internal::SQLiteMutationKind::Index, std::string (surface), + std::string (surface) + ":" + MutationAuditComponent (*entry_id) + }; + } + return std::nullopt; +} + +void +MutationAuditPreupdateHook (void *opaque, sqlite3 *db, int operation, + const char *, const char *table, sqlite3_int64, + sqlite3_int64) +{ + if (!opaque || !db || !table) + return; + auto *store = static_cast (opaque); + std::vector identities; + if (auto before = MutationAuditLogicalIdentity (db, operation, table, true)) + identities.push_back (std::move (*before)); + if (auto after = MutationAuditLogicalIdentity (db, operation, table, false)) + { + if (identities.empty () + || identities.front ().logical_identity != after->logical_identity + || identities.front ().kind != after->kind) + identities.push_back (std::move (*after)); + } + if (identities.empty ()) + return; + auto ®istry = MutationAuditRegistry (); + std::lock_guard lock (registry.mutex); + auto it = registry.stores.find (store); + if (it == registry.stores.end () || !it->second.root_active) + return; + for (auto &identity : identities) + it->second.pending.push_back (std::move (identity)); +} + +void +MutationAuditVirtualTableUpdateHook (void *opaque, int operation, const char *, + const char *table, sqlite3_int64 row_id) +{ + if (!opaque || !table) + return; + const std::string_view changed_table (table); + constexpr std::string_view suffix = "_rowids"; + if (!changed_table.ends_with (suffix)) + return; + const std::string_view surface + = changed_table.substr (0, changed_table.size () - suffix.size ()); + if (surface != "embeddings" && surface != "current_memory_embeddings") + return; + auto *store = static_cast (opaque); + auto ®istry = MutationAuditRegistry (); + std::lock_guard lock (registry.mutex); + auto it = registry.stores.find (store); + if (it == registry.stores.end () || !it->second.root_active) + return; + it->second.pending_physical.push_back ( + { std::string (surface), static_cast (row_id), + operation }); +} + +std::string +MutationAuditVecPhysicalKey (std::string_view surface, std::int64_t row_id) +{ + return std::string (surface) + ":" + std::to_string (row_id); +} + +std::optional +MutationAuditResolveVecId (sqlite3 *db, std::string_view surface, + std::int64_t row_id) +{ + const std::string sql = "SELECT id FROM \"" + std::string (surface) + + "_rowids\" WHERE rowid = ?"; + sqlite3_stmt *statement = nullptr; + if (sqlite3_prepare_v2 (db, sql.c_str (), -1, &statement, nullptr) + != SQLITE_OK) + return std::nullopt; + sqlite3_bind_int64 (statement, 1, static_cast (row_id)); + std::optional result; + if (sqlite3_step (statement) == SQLITE_ROW) + { + if (sqlite3_column_type (statement, 0) == SQLITE_INTEGER) + result = std::to_string (sqlite3_column_int64 (statement, 0)); + else if (const auto *text = sqlite3_column_text (statement, 0)) + result = std::string (reinterpret_cast (text)); + else + result = std::to_string (row_id); + } + sqlite3_finalize (statement); + return result; +} + +void +ResolveMutationAuditVecMutations (SQLiteMutationAuditState &state, sqlite3 *db) +{ + for (const auto &mutation : state.pending_physical) + { + const std::string physical_key + = MutationAuditVecPhysicalKey (mutation.surface, mutation.row_id); + std::optional logical_id; + if (mutation.operation == SQLITE_DELETE) + { + const auto existing = state.vec_logical_ids.find (physical_key); + if (existing != state.vec_logical_ids.end ()) + logical_id = existing->second; + state.vec_logical_ids.erase (physical_key); + } + else + { + logical_id = MutationAuditResolveVecId ( + db, mutation.surface, mutation.row_id); + if (logical_id) + state.vec_logical_ids[physical_key] = *logical_id; + } + if (logical_id) + state.pending.push_back ({ + internal::SQLiteMutationKind::Index, mutation.surface, + mutation.surface + ":" + MutationAuditComponent (*logical_id) + }); + } + state.pending_physical.clear (); +} + +void +RegisterMutationAuditTransaction (SQLiteStore *store, + const SQLiteTransaction *transaction, + bool root) +{ + auto ®istry = MutationAuditRegistry (); + std::lock_guard lock (registry.mutex); + auto it = registry.stores.find (store); + if (it == registry.stores.end ()) + return; + if (root) + { + it->second.root_active = true; + it->second.pending.clear (); + it->second.pending_physical.clear (); + it->second.marks.clear (); + } + it->second.marks[transaction] + = { it->second.pending.size (), it->second.pending_physical.size () }; +} + +void +CommitMutationAuditTransaction (SQLiteStore *store, + const SQLiteTransaction *transaction, + bool root, sqlite3 *db = nullptr) +{ + auto ®istry = MutationAuditRegistry (); + std::lock_guard lock (registry.mutex); + auto it = registry.stores.find (store); + if (it == registry.stores.end ()) + return; + it->second.marks.erase (transaction); + if (!root) + return; + if (db) + ResolveMutationAuditVecMutations (it->second, db); + it->second.committed.insert (it->second.committed.end (), + it->second.pending.begin (), + it->second.pending.end ()); + it->second.pending.clear (); + it->second.pending_physical.clear (); + it->second.marks.clear (); + it->second.root_active = false; +} + +void +RollbackMutationAuditTransaction (SQLiteStore *store, + const SQLiteTransaction *transaction, + bool root) +{ + auto ®istry = MutationAuditRegistry (); + std::lock_guard lock (registry.mutex); + auto it = registry.stores.find (store); + if (it == registry.stores.end ()) + return; + if (root) + { + it->second.pending.clear (); + it->second.pending_physical.clear (); + it->second.marks.clear (); + it->second.root_active = false; + return; + } + const auto mark = it->second.marks.find (transaction); + if (mark != it->second.marks.end ()) + { + it->second.pending.resize ( + std::min (mark->second.logical, it->second.pending.size ())); + it->second.pending_physical.resize ( + std::min (mark->second.physical, + it->second.pending_physical.size ())); + it->second.marks.erase (mark); + } +} + +void +EraseMutationAuditStore (SQLiteStore *store) +{ + auto ®istry = MutationAuditRegistry (); + std::lock_guard lock (registry.mutex); + registry.stores.erase (store); +} + std::string_view ParseDbOperation (const std::string &q) { @@ -448,6 +778,206 @@ FetchResultRow (sqlite3_stmt *stmt, std::map &row) } // namespace +namespace internal +{ + +void +ResetSQLiteMutationAudit (Store *store) +{ + auto *sqlite_store = dynamic_cast (store); + if (!sqlite_store) + return; + auto ®istry = MutationAuditRegistry (); + { + std::lock_guard lock (registry.mutex); + if (registry.stores.find (sqlite_store) == registry.stores.end ()) + return; + } + std::unordered_map vec_logical_ids; + bool trigger_journal_ready = false; + for (const std::string surface : { "embeddings", + "current_memory_embeddings" }) + { + try + { + const auto rows = sqlite_store->Execute ( + "SELECT rowid, id FROM \"" + surface + "_rowids\""); + for (const auto &row : rows) + { + const auto row_id_it = row.find ("rowid"); + const auto id_it = row.find ("id"); + if (row_id_it == row.end () || id_it == row.end () + || row_id_it->second.type () != typeid (long long)) + continue; + const auto row_id = std::any_cast (row_id_it->second); + std::optional logical_id; + if (id_it->second.type () == typeid (long long)) + logical_id = std::to_string ( + std::any_cast (id_it->second)); + else if (id_it->second.type () == typeid (std::string)) + logical_id = std::any_cast (id_it->second); + else if (!id_it->second.has_value () + || id_it->second.type () == typeid (std::nullptr_t)) + logical_id = std::to_string (row_id); + if (logical_id) + vec_logical_ids[MutationAuditVecPhysicalKey (surface, row_id)] + = *logical_id; + } + } + catch (const std::exception &) + { + // The profiling hook can be reset before migrations create a surface. + } + } + try + { + const std::vector trigger_slugs { + "memories", "associations", "memory_reconstructions", + "embeddings_rowids", "current_memory_embeddings_rowids" + }; + for (const auto &slug : trigger_slugs) + for (const std::string operation : { "insert", "update", "delete" }) + sqlite_store->Execute ( + "DROP TRIGGER IF EXISTS temp.cortext_mutation_audit_" + slug + + "_" + operation); + sqlite_store->Execute ( + "DROP TABLE IF EXISTS temp.cortext_mutation_trigger_journal"); + sqlite_store->Execute ( + "CREATE TEMP TABLE cortext_mutation_trigger_journal(" + "kind INTEGER NOT NULL, table_name TEXT NOT NULL, " + "logical_identity TEXT NOT NULL, " + "PRIMARY KEY(kind, logical_identity)) WITHOUT ROWID"); + const auto create_triggers = [sqlite_store] ( + const std::string &slug, + const std::string &table, + int kind, + const std::string &old_identity, + const std::string &new_identity) { + const std::string prefix = "cortext_mutation_audit_" + slug; + const std::string insert_prefix + = "INSERT OR IGNORE INTO cortext_mutation_trigger_journal " + "VALUES(" + std::to_string (kind) + ", '" + table + "', "; + sqlite_store->Execute ( + "CREATE TEMP TRIGGER " + prefix + "_insert AFTER INSERT ON main." + + slug + " BEGIN " + insert_prefix + new_identity + "); END"); + sqlite_store->Execute ( + "CREATE TEMP TRIGGER " + prefix + "_update AFTER UPDATE ON main." + + slug + " BEGIN " + insert_prefix + old_identity + "); " + + insert_prefix + new_identity + "); END"); + sqlite_store->Execute ( + "CREATE TEMP TRIGGER " + prefix + "_delete AFTER DELETE ON main." + + slug + " BEGIN " + insert_prefix + old_identity + "); END"); + }; + create_triggers ( + "memories", "memories", + static_cast (SQLiteMutationKind::Memory), + "printf('memory:%d:%s', length(CAST(OLD.memory_id AS TEXT)), " + "OLD.memory_id)", + "printf('memory:%d:%s', length(CAST(NEW.memory_id AS TEXT)), " + "NEW.memory_id)"); + create_triggers ( + "associations", "associations", + static_cast (SQLiteMutationKind::Association), + "printf('association:%d:%s%d:%s%d:%s', " + "length(CAST(OLD.source_memory_id AS TEXT)), OLD.source_memory_id, " + "length(CAST(OLD.target_memory_id AS TEXT)), OLD.target_memory_id, " + "length(OLD.edge_type), OLD.edge_type)", + "printf('association:%d:%s%d:%s%d:%s', " + "length(CAST(NEW.source_memory_id AS TEXT)), NEW.source_memory_id, " + "length(CAST(NEW.target_memory_id AS TEXT)), NEW.target_memory_id, " + "length(NEW.edge_type), NEW.edge_type)"); + create_triggers ( + "memory_reconstructions", "memory_reconstructions", + static_cast (SQLiteMutationKind::Index), + "printf('reconstruction:%d:%s', " + "length(CAST(OLD.reconstruction_id AS TEXT)), " + "OLD.reconstruction_id)", + "printf('reconstruction:%d:%s', " + "length(CAST(NEW.reconstruction_id AS TEXT)), " + "NEW.reconstruction_id)"); + create_triggers ( + "embeddings_rowids", "embeddings", + static_cast (SQLiteMutationKind::Index), + "printf('embeddings:%d:%s', " + "length(CAST(COALESCE(OLD.id, OLD.rowid) AS TEXT)), " + "COALESCE(OLD.id, OLD.rowid))", + "printf('embeddings:%d:%s', " + "length(CAST(COALESCE(NEW.id, NEW.rowid) AS TEXT)), " + "COALESCE(NEW.id, NEW.rowid))"); + create_triggers ( + "current_memory_embeddings_rowids", "current_memory_embeddings", + static_cast (SQLiteMutationKind::Index), + "printf('current_memory_embeddings:%d:%s', " + "length(CAST(COALESCE(OLD.id, OLD.rowid) AS TEXT)), " + "COALESCE(OLD.id, OLD.rowid))", + "printf('current_memory_embeddings:%d:%s', " + "length(CAST(COALESCE(NEW.id, NEW.rowid) AS TEXT)), " + "COALESCE(NEW.id, NEW.rowid))"); + trigger_journal_ready = true; + } + catch (const std::exception &) + { + trigger_journal_ready = false; + } + std::lock_guard lock (registry.mutex); + auto it = registry.stores.find (sqlite_store); + if (it == registry.stores.end ()) + return; + it->second.pending.clear (); + it->second.pending_physical.clear (); + it->second.committed.clear (); + it->second.vec_logical_ids = std::move (vec_logical_ids); + it->second.marks.clear (); + it->second.root_active = false; + it->second.trigger_journal_ready = trigger_journal_ready; +} + +SQLiteMutationAuditBatch +ConsumeSQLiteCommittedMutations (Store *store) +{ + auto *sqlite_store = dynamic_cast (store); + if (!sqlite_store) + return {}; + SQLiteMutationAuditBatch result; + auto ®istry = MutationAuditRegistry (); + { + std::lock_guard lock (registry.mutex); + auto it = registry.stores.find (sqlite_store); + if (it == registry.stores.end ()) + return {}; + result.committed_hook_identities.swap (it->second.committed); + result.trigger_journal_ready = it->second.trigger_journal_ready; + } + if (!result.trigger_journal_ready) + return result; + try + { + const auto rows = sqlite_store->Execute ( + "SELECT kind, table_name, logical_identity " + "FROM temp.cortext_mutation_trigger_journal " + "ORDER BY kind, logical_identity"); + for (const auto &row : rows) + { + const auto kind = std::any_cast (row.at ("kind")); + result.committed_trigger_identities.push_back ({ + static_cast (kind), + std::any_cast (row.at ("table_name")), + std::any_cast (row.at ("logical_identity")) + }); + } + sqlite_store->Execute ( + "DELETE FROM temp.cortext_mutation_trigger_journal"); + } + catch (const std::exception &) + { + result.trigger_journal_ready = false; + result.committed_trigger_identities.clear (); + } + return result; +} + +} // namespace internal + // SQLiteConnection implementation SQLiteConnection::SQLiteConnection (const std::string &database_path, const SQLiteConfig &config) @@ -648,6 +1178,8 @@ SQLiteTransaction::~SQLiteTransaction () { // Ignore errors during cleanup - we're in a destructor } + RollbackMutationAuditTransaction (store_, this, + savepoint_name_.empty ()); } // Unregister from store to prevent dangling pointer in transaction_stack_ @@ -691,6 +1223,7 @@ SQLiteTransaction::Begin () "Transaction is not the current transaction"); } auto transaction = std::make_unique (store_, this); + RegisterMutationAuditTransaction (store_, transaction.get (), false); store_->transaction_stack_.push_back (transaction.get ()); return transaction; } @@ -739,6 +1272,7 @@ SQLiteTransaction::Commit () std::string query = "RELEASE SAVEPOINT " + savepoint_name_; store_->ExecuteDirect (query); store_->transaction_stack_.pop_back (); + CommitMutationAuditTransaction (store_, this, false); } is_committed_ = true; @@ -770,6 +1304,7 @@ SQLiteTransaction::Rollback () store_->ExecuteDirect ("ROLLBACK TO SAVEPOINT " + savepoint_name_); store_->ExecuteDirect ("RELEASE SAVEPOINT " + savepoint_name_); store_->transaction_stack_.pop_back (); + RollbackMutationAuditTransaction (store_, this, false); } is_rolled_back_ = true; @@ -786,6 +1321,13 @@ SQLiteStore::Create (const std::string &database_path, SQLiteStore::~SQLiteStore () { + if (connection_ && connection_->IsValid ()) + { + sqlite3_preupdate_hook (connection_->GetConnection (), nullptr, + nullptr); + sqlite3_update_hook (connection_->GetConnection (), nullptr, nullptr); + } + EraseMutationAuditStore (this); ClearStatementCache (); } @@ -863,6 +1405,18 @@ SQLiteStore::SQLiteStore (std::unique_ptr connection) #if defined(CORTEXT_ENABLE_DYNAMIC_EXTENSIONS) && !defined(__EMSCRIPTEN__) TryLoadDynamicExtensions (connection_->GetConnection ()); #endif + if (MutationAuditEnabled ()) + { + auto ®istry = MutationAuditRegistry (); + { + std::lock_guard lock (registry.mutex); + registry.stores.try_emplace (this); + } + sqlite3_preupdate_hook (connection_->GetConnection (), + MutationAuditPreupdateHook, this); + sqlite3_update_hook (connection_->GetConnection (), + MutationAuditVirtualTableUpdateHook, this); + } } bool @@ -909,6 +1463,7 @@ SQLiteStore::Begin () auto transaction = std::make_unique (this, parent); SQLiteTransaction *transaction_ptr = transaction.get (); + RegisterMutationAuditTransaction (this, transaction_ptr, parent == nullptr); transaction_stack_.push_back (transaction_ptr); return transaction; } @@ -922,8 +1477,9 @@ SQLiteStore::Commit () } auto current_tx = transaction_stack_.back (); + const bool root = current_tx->parent_transaction_ == nullptr; - if (current_tx->parent_transaction_ == nullptr) + if (root) { if (in_transaction_) { @@ -941,6 +1497,9 @@ SQLiteStore::Commit () current_tx->is_committed_ = true; transaction_stack_.pop_back (); + CommitMutationAuditTransaction ( + this, current_tx, root, + root ? connection_->GetConnection () : nullptr); } void @@ -952,8 +1511,9 @@ SQLiteStore::Rollback () } auto current_tx = transaction_stack_.back (); + const bool root = current_tx->parent_transaction_ == nullptr; - if (current_tx->parent_transaction_ == nullptr) + if (root) { if (in_transaction_) { @@ -972,6 +1532,7 @@ SQLiteStore::Rollback () current_tx->is_rolled_back_ = true; transaction_stack_.pop_back (); + RollbackMutationAuditTransaction (this, current_tx, root); } void @@ -1004,6 +1565,8 @@ SQLiteStore::CommitRootTransaction (SQLiteTransaction *transaction) // Remove from stack transaction_stack_.pop_back (); + CommitMutationAuditTransaction (this, transaction, true, + connection_->GetConnection ()); } void @@ -1036,6 +1599,7 @@ SQLiteStore::RollbackRootTransaction (SQLiteTransaction *transaction) // Remove from stack transaction_stack_.pop_back (); + RollbackMutationAuditTransaction (this, transaction, true); } std::vector > diff --git a/src/store/mutation_audit_internal.hpp b/src/store/mutation_audit_internal.hpp new file mode 100644 index 00000000..ed4264f9 --- /dev/null +++ b/src/store/mutation_audit_internal.hpp @@ -0,0 +1,43 @@ +#pragma once + +#include "cortext/store/store.hpp" + +#include +#include +#include + +namespace cortext::internal +{ + +enum class SQLiteMutationKind +{ + Memory, + Association, + Index, +}; + +/// @brief One connection-local logical mutation observed after a successful +/// root transaction commit. This private profiling surface is enabled only by +/// CORTEXT_PROFILE_CONSOLIDATION_EPOCH. +struct SQLiteMutationIdentity +{ + SQLiteMutationKind kind = SQLiteMutationKind::Memory; + std::string table; + std::string logical_identity; +}; + +struct SQLiteMutationAuditBatch +{ + std::vector committed_hook_identities; + std::vector committed_trigger_identities; + bool trigger_journal_ready = false; +}; + +/// @brief Drop schema/setup mutations and begin a fresh profiling stream. +void ResetSQLiteMutationAudit (Store *store); + +/// @brief Consume mutations committed since the previous call. +SQLiteMutationAuditBatch +ConsumeSQLiteCommittedMutations (Store *store); + +} // namespace cortext::internal diff --git a/src/store/schema.cpp b/src/store/schema.cpp index b720c30c..bfba559c 100644 --- a/src/store/schema.cpp +++ b/src/store/schema.cpp @@ -830,6 +830,41 @@ GetCoreMigrations () "ALTER TABLE state ADD COLUMN consolidation_rate_armed INTEGER NOT NULL DEFAULT 1", }, }, + { + 28, + "Persist lazy retrieval suppression recovery state", + { + "CREATE TABLE IF NOT EXISTS rif_recovery_clock(" + "singleton INTEGER PRIMARY KEY CHECK(singleton = 1), " + "generation INTEGER NOT NULL CHECK(generation > 0), " + "log_factor REAL NOT NULL, last_ts INTEGER NOT NULL)", + "CREATE TABLE IF NOT EXISTS rif_generation_resets(" + "generation INTEGER PRIMARY KEY CHECK(generation > 0), " + "reset_ts INTEGER NOT NULL)", + "CREATE TABLE IF NOT EXISTS rif_active_state(" + "memory_id INTEGER PRIMARY KEY, " + "generation INTEGER NOT NULL CHECK(generation > 0), " + "anchor_suppression REAL NOT NULL " + "CHECK(anchor_suppression > 1e-9), " + "recovery_total REAL NOT NULL, " + "anchor_log_factor REAL NOT NULL, " + "expires_log_factor REAL NOT NULL, " + "FOREIGN KEY(memory_id) REFERENCES memories(memory_id) " + "ON DELETE CASCADE)", + "CREATE INDEX IF NOT EXISTS idx_rif_active_due ON rif_active_state(" + "generation, expires_log_factor, memory_id)", + "INSERT OR IGNORE INTO rif_recovery_clock(" + "singleton, generation, log_factor, last_ts) " + "SELECT 1, 1, 0.0, COALESCE(MAX(suppression_ts), 0) " + "FROM memories WHERE suppression > 1e-9", + "INSERT OR REPLACE INTO rif_active_state(" + "memory_id, generation, anchor_suppression, recovery_total, " + "anchor_log_factor, expires_log_factor) " + "SELECT memory_id, 1, suppression, strength + suppression, " + "0.0, ln(1e-9 / suppression) " + "FROM memories WHERE suppression > 1e-9", + }, + }, }; } @@ -868,6 +903,39 @@ ApplyMigrationsThrough (Store &store, int64_t maximum_id) ApplySingleMigrationInTransaction (store, m); } + const auto rif_tables = store.Execute ( + "SELECT 1 FROM sqlite_master " + "WHERE type = 'table' AND name = 'rif_active_state' LIMIT 1"); + if (!rif_tables.empty ()) + { + // The approved migration contains only the three persistent tables + // and one index. Keep the derived-value seam connection-local. + store.Execute ("DROP VIEW IF EXISTS temp.rif_effective_memories"); + store.Execute ( + "CREATE TEMP VIEW rif_effective_memories AS " + "SELECT m.memory_id, " + "CASE WHEN a.memory_id IS NULL THEN m.strength " + " WHEN a.generation = c.generation THEN " + " MAX(0.0, a.recovery_total - " + " a.anchor_suppression * " + " exp(c.log_factor - a.anchor_log_factor)) " + " ELSE a.recovery_total END AS strength, " + "CASE WHEN a.memory_id IS NULL THEN m.suppression " + " WHEN a.generation = c.generation THEN " + " a.anchor_suppression * " + " exp(c.log_factor - a.anchor_log_factor) " + " ELSE 0.0 END AS suppression, " + "CASE WHEN a.memory_id IS NULL THEN m.suppression_ts " + " WHEN a.generation = c.generation THEN c.last_ts " + " ELSE COALESCE(r.reset_ts, c.last_ts) " + "END AS suppression_ts " + "FROM memories m " + "CROSS JOIN rif_recovery_clock c " + "LEFT JOIN rif_active_state a ON a.memory_id = m.memory_id " + "LEFT JOIN rif_generation_resets r " + " ON r.generation = a.generation"); + } + store.Execute ("COMMIT"); committed = true; } diff --git a/tests/cortext.test.cpp b/tests/cortext.test.cpp index 6389fe6c..b0ad7a69 100644 --- a/tests/cortext.test.cpp +++ b/tests/cortext.test.cpp @@ -1,6 +1,9 @@ #include "test_helpers.hpp" #include "../src/capi_internal.hpp" +#include "../src/cortext_pipeline_internal.hpp" #include "../src/operations/retrieval_trace_state.hpp" +#include "../src/operations/bounded_activation_shadow_internal.hpp" +#include #include #include #include @@ -13,6 +16,7 @@ #include #include #include +#include #include #include @@ -20,6 +24,7 @@ #include #include #include +#include #include namespace @@ -751,6 +756,302 @@ TEST_CASE ("Cortext media ingress validates processing inputs before use", } } +TEST_CASE ("encoded modalities and source cardinalities share bounded work", + "[cortext][performance][modality][source_id]" + "[bounded_activation_shadow]") +{ + cortext::testing::ScopedEnvVar profile_work ( + "CORTEXT_PROFILE_WORK_COUNTERS", "1"); + cortext::testing::ScopedEnvVar profile_graph ( + "CORTEXT_PROFILE_GRAPH_RETRIEVAL", "1"); + cortext::testing::ScopedEnvVar profile_emotion ( + "CORTEXT_PROFILE_EMOTIONAL_CASCADE", "1"); + cortext::testing::ScopedEnvVar shadow_enabled ( + "CORTEXT_BOUNDED_ACTIVATION_SHADOW", "1"); + + namespace shadow + = cortext::operations::bounded_activation_shadow_internal; + + struct CounterSpec + { + const char *name; + const char *primary; + const char *secondary; + double fixed_bound; + }; + constexpr std::array kCounters { { + { "retrieval_suppression_id_count", + "SignalProcessor.retrieval_suppression_id_count", nullptr, 4096.0 }, + { "predictive_id_count", "SignalProcessor.predictive_id_count", nullptr, + 4096.0 }, + { "rollback_full_cache_copy_count", + "SignalProcessor.snapshot_full_cache_copy_count", nullptr, 0.0 }, + { "rollback_cache_entry_copy_count", + "SignalProcessor.snapshot_cache_entry_copy_count", nullptr, 0.0 }, + { "graph_candidate_count", "GraphRetrieve.candidate_count", nullptr, + 4096.0 }, + { "graph_exact_comparison_count", + "GraphRetrieve.family_exact_comparison_count", nullptr, 131072.0 }, + { "graph_cache_rebuild_count", "GraphRetrieve.cache_rebuild_count", + nullptr, 1.0 }, + { "graph_rows_visited", "GraphRetrieve.rows_visited", nullptr, 4096.0 }, + { "competition_candidate_count", "Competition.candidate_count", nullptr, + 4096.0 }, + { "competition_rows_visited", "Competition.rows_visited", nullptr, + 4096.0 }, + { "competition_rows_touched", "Competition.rows_touched", nullptr, + 4096.0 }, + { "supersession_current_candidate_count", + "MemoryStorage.supersession_current_candidate_count", nullptr, + 4096.0 }, + { "supersession_historical_candidate_count", + "MemoryStorage.supersession_historical_candidate_count", nullptr, + 4096.0 }, + { "supersession_rows_visited", + "MemoryStorage.supersession_current_rows_visited", + "MemoryStorage.supersession_historical_rows_visited", 4096.0 }, + { "emotional_source_count", "EmotionalCascade.source_count", nullptr, + 4096.0 }, + { "emotional_neighbor_count", "EmotionalCascade.neighbor_count", nullptr, + 4096.0 }, + { "emotional_update_count", "EmotionalCascade.update_count", nullptr, + 4096.0 }, + } }; + constexpr std::array kSharedOperations { + "cortext::operations::GraphAugmentedRetrieveCandidates", + "cortext::operations::ApplyRetrievalCompetition", + "cortext::operations::MemoryStorage", + "cortext::operations::PropagateEmotionalCascade", + }; + + struct RunResult + { + std::map maxima; + std::vector shadow_sequence; + }; + + auto run_cardinality = [&] (int source_count, + cortext::Retention retention) { + auto store = std::shared_ptr ( + cortext::SQLiteStore::Create (":memory:")); + cortext::testing::InitializeCoreSchema (*store); + cortext::SignalProcessor::Config cfg; + cfg.focus = 0.45; + cfg.sensitivity = 0.5; + cfg.stability = 0.5; + cortext::testing::RequireEncoder (cfg); + const int supersession_candidate_limit + = cortext::core::SupersessionCandidateLimit ( + cfg.focus, cfg.sensitivity, cfg.stability); + for (int index = 0; index <= supersession_candidate_limit; ++index) + { + std::vector embedding (256, 0.0f); + embedding[static_cast (index) % embedding.size ()] + = 1.0f; + const long long id = 100000LL + index; + cortext::testing::SeedEmbeddingV2 (*store, id, embedding, 1000); + cortext::testing::SeedMemoryV2 ( + *store, id, id, "mixed/seed", "LONG_TERM", 1.0, 1000); + } + cortext::SignalProcessor processor ( + cfg, store, cortext::BuildRootOperationSet (false)); + + RunResult result; + bool active_counter_seen = false; + for (int event = 0; event < 12; ++event) + { + const auto source + = "mixed/source/" + std::to_string (event % source_count); + const auto timestamp + = 1700000000000ULL + static_cast (event) * 1000ULL; + cortext::Signal signal; + signal.embedding = Eigen::VectorXf::Zero (256); + signal.embedding[event % 256] = 1.0f; + signal.soft_anchor_embedding = signal.embedding; + signal.source_id = source; + signal.timestamp = timestamp; + signal.retention = retention; + signal.payload = std::vector ( + 16, static_cast (event + 1)); + switch (event % 3) + { + case 0: + signal.modality = "text"; + signal.mimetype = "text/plain"; + break; + case 1: + signal.modality = "audio"; + signal.mimetype = "audio/pcm;format=f32"; + signal.sample_rate = 16000; + signal.num_samples = 4; + break; + default: + signal.modality = "image"; + signal.mimetype = "image/raw;width=1;height=1;channels=3"; + signal.width = 1; + signal.height = 1; + signal.channels = 3; + break; + } + const auto output = processor.Process (signal); + const auto snapshots = shadow::SnapshotsForTest (); + REQUIRE (snapshots.size () == 1); + const auto &snapshot = snapshots.front (); + REQUIRE (snapshot.available); + REQUIRE_FALSE (snapshot.disabled); + REQUIRE_FALSE (snapshot.restart_rebuild_required); + REQUIRE (snapshot.generation + == static_cast (event + 1)); + REQUIRE (snapshot.event_index + == static_cast (event + 1)); + REQUIRE (snapshot.root_count <= snapshot.parameters.roots); + REQUIRE (snapshot.leaf_count + <= snapshot.parameters.leaf_capacity); + REQUIRE (snapshot.metrics.normal_comparisons + <= snapshot.parameters.normal_comparison_bound); + REQUIRE (snapshot.metrics.normal_comparisons_max + <= snapshot.parameters.normal_comparison_bound); + REQUIRE (snapshot.metrics.recall_comparisons + <= snapshot.parameters.recall_comparison_bound); + REQUIRE (snapshot.metrics.recall_comparisons_max + <= snapshot.parameters.recall_comparison_bound); + REQUIRE (snapshot.metrics.consolidation_comparisons_max + <= snapshot.parameters.consolidation_comparison_bound); + REQUIRE (snapshot.metrics.allocation_after_initialization_count == 0); + result.shadow_sequence.push_back (snapshot); + + REQUIRE (output.operation_ms.at ( + "SignalProcessor.rif_active_epoch_event_count") + <= 512.0); + REQUIRE (output.operation_ms.at ( + "SignalProcessor.rif_active_epoch_mutation_count") + <= 32768.0); + REQUIRE (output.operation_ms.at ( + "SignalProcessor.rif_active_epoch_allocated_bytes") + <= 64.0 * 1024.0 * 1024.0); + + for (const auto *operation : kSharedOperations) + REQUIRE (output.operation_ms.contains (operation)); + if (retention == cortext::Retention::Durable) + REQUIRE (output.operation_ms.contains ( + "SignalProcessor.sqlite_wal_checkpoint")); + else + REQUIRE_FALSE (output.operation_ms.contains ( + "SignalProcessor.sqlite_wal_checkpoint")); + for (std::size_t index = 0; index < kCounters.size (); ++index) + { + const auto &spec = kCounters[index]; + auto value = [&] (const char *key) { + if (!key) + return 0.0; + const auto it = output.operation_ms.find (key); + return it == output.operation_ms.end () ? 0.0 : it->second; + }; + const double observed = value (spec.primary) + value (spec.secondary); + INFO ("counter=" << spec.name << " source_count=" << source_count + << " event=" << event); + REQUIRE (std::isfinite (observed)); + REQUIRE (observed >= 0.0); + REQUIRE (observed <= spec.fixed_bound); + result.maxima[spec.name] + = std::max (result.maxima[spec.name], observed); + active_counter_seen = active_counter_seen || observed > 0.0; + } + } + + REQUIRE (result.maxima["supersession_rows_visited"] + > result.maxima["supersession_current_candidate_count"] + + result.maxima["supersession_historical_candidate_count"]); + + const auto before_maintenance = result.shadow_sequence.back (); + + cortext::Signal maintenance; + maintenance.embedding = Eigen::VectorXf::Zero (256); + maintenance.source_id = "mixed/maintenance"; + maintenance.timestamp = 1700000013000ULL; + maintenance.retention = retention; + maintenance.force_consolidation = true; + const auto reset = processor.Process (maintenance); + REQUIRE (reset.operation_ms.at ( + "SignalProcessor.rif_active_epoch_event_count") + == 0.0); + REQUIRE (reset.operation_ms.at ( + "SignalProcessor.rif_active_epoch_mutation_count") + == 0.0); + REQUIRE (reset.operation_ms.at ( + "SignalProcessor.rif_active_epoch_allocated_bytes") + < 64.0 * 1024.0 * 1024.0); + const auto after_maintenance = shadow::SnapshotsForTest (); + REQUIRE (after_maintenance.size () == 1); + REQUIRE (after_maintenance.front ().generation + == before_maintenance.generation); + REQUIRE (after_maintenance.front ().event_index + == before_maintenance.event_index); + REQUIRE (after_maintenance.front ().state_digest + == before_maintenance.state_digest); + + const auto source_rows = store->Execute ( + "SELECT COUNT(DISTINCT source_id) AS n FROM signals"); + REQUIRE (AnyToLongLong (source_rows[0].at ("n")) == source_count); + const auto modality_rows = store->Execute ( + "SELECT DISTINCT modality FROM signals ORDER BY modality"); + std::unordered_set modalities; + for (const auto &row : modality_rows) + modalities.insert (std::any_cast (row.at ("modality"))); + REQUIRE (modalities + == std::unordered_set { "audio", "image", "text" }); + REQUIRE (active_counter_seen); + return result; + }; + + std::optional> natural_two_source_sequence; + for (const auto retention : { cortext::Retention::Natural, + cortext::Retention::Durable }) + { + const auto two_sources = run_cardinality (2, retention); + const auto four_sources = run_cardinality (4, retention); + REQUIRE (two_sources.shadow_sequence.size () + == four_sources.shadow_sequence.size ()); + for (std::size_t event = 0; event < two_sources.shadow_sequence.size (); + ++event) + { + const auto &two = two_sources.shadow_sequence[event]; + const auto &four = four_sources.shadow_sequence[event]; + REQUIRE (two.generation == four.generation); + REQUIRE (two.event_index == four.event_index); + REQUIRE (two.state_digest == four.state_digest); + REQUIRE (two.metrics.normal_comparisons + == four.metrics.normal_comparisons); + REQUIRE (two.metrics.recall_comparisons + == four.metrics.recall_comparisons); + REQUIRE (two.metrics.consolidation_comparisons + == four.metrics.consolidation_comparisons); + } + if (retention == cortext::Retention::Natural) + natural_two_source_sequence = two_sources.shadow_sequence; + else + { + REQUIRE (natural_two_source_sequence.has_value ()); + REQUIRE (natural_two_source_sequence->size () + == two_sources.shadow_sequence.size ()); + for (std::size_t event = 0; + event < two_sources.shadow_sequence.size (); ++event) + REQUIRE (natural_two_source_sequence->at (event).state_digest + == two_sources.shadow_sequence[event].state_digest); + } + for (std::size_t index = 0; index < kCounters.size (); ++index) + { + INFO ("counter=" << kCounters[index].name + << " retention=" + << static_cast (retention)); + REQUIRE (two_sources.maxima.at (kCounters[index].name) + <= kCounters[index].fixed_bound); + REQUIRE (four_sources.maxima.at (kCounters[index].name) + <= kCounters[index].fixed_bound); + } + } +} + TEST_CASE ("timestamped replay persists working memory source timestamps", "[cortext][replay][working_memory][aist]") { diff --git a/tests/migration_core.test.cpp b/tests/migration_core.test.cpp index d1a6c271..d6bfbbac 100644 --- a/tests/migration_core.test.cpp +++ b/tests/migration_core.test.cpp @@ -1,5 +1,6 @@ // tests/migration_core.test.cpp #include +#include #include "../src/operations/consolidation_throughput_state_internal.hpp" #include "test_helpers.hpp" #include @@ -253,6 +254,134 @@ TEST_CASE("Migration 27 adds an armed consolidation throughput latch", == 1); } +TEST_CASE("Migration 28 seeds exact lazy RIF recovery state", + "[schema][migration][rif]") { + auto store = SQLiteStore::Create(":memory:"); + cortext::store::DebugApplyCoreMigrationsThroughForTest(*store, 27); + store->Execute( + "INSERT INTO memories(memory_id, source_id, kind, start_ts, " + "n_signals, modality, strength, suppression, suppression_ts, " + "created_at) VALUES(1, 'source-a', 'LONG_TERM', 100, 1, " + "'text', 0.6, 0.4, 100, 100)"); + + cortext::store::ApplyMigrations(*store); + + const auto ids = cortext::store::DebugGetAppliedMigrationIdsForTest(*store); + REQUIRE(ids.count(28) == 1); + auto objects = store->Execute( + "SELECT type, name FROM sqlite_master WHERE name IN (" + "'rif_recovery_clock', 'rif_generation_resets', " + "'rif_active_state', 'rif_effective_memories', " + "'idx_rif_active_due', 'rif_memories_insert_active', " + "'rif_memories_update_active', 'rif_memories_update_inactive', " + "'rif_memories_update_strength')"); + REQUIRE(objects.size() == 4); + REQUIRE(store->Execute( + "SELECT name FROM sqlite_temp_master " + "WHERE type = 'view' AND name = 'rif_effective_memories'").size() + == 1); + + auto clock = store->Execute( + "SELECT generation, log_factor, last_ts FROM rif_recovery_clock"); + REQUIRE(clock.size() == 1); + REQUIRE(std::any_cast(clock[0].at("generation")) == 1); + REQUIRE(std::any_cast(clock[0].at("log_factor")) == 0.0); + REQUIRE(std::any_cast(clock[0].at("last_ts")) == 100); + + auto active = store->Execute( + "SELECT generation, anchor_suppression, recovery_total, " + "anchor_log_factor, expires_log_factor " + "FROM rif_active_state WHERE memory_id = 1"); + REQUIRE(active.size() == 1); + REQUIRE(std::any_cast(active[0].at("generation")) == 1); + REQUIRE(std::any_cast(active[0].at("anchor_suppression")) + == Catch::Approx(0.4)); + REQUIRE(std::any_cast(active[0].at("recovery_total")) + == Catch::Approx(1.0)); + REQUIRE(std::any_cast(active[0].at("anchor_log_factor")) + == 0.0); + REQUIRE(std::any_cast(active[0].at("expires_log_factor")) < 0.0); + + auto effective = store->Execute( + "SELECT strength, suppression, suppression_ts " + "FROM rif_effective_memories WHERE memory_id = 1"); + REQUIRE(effective.size() == 1); + REQUIRE(std::any_cast(effective[0].at("strength")) + == Catch::Approx(0.6)); + REQUIRE(std::any_cast(effective[0].at("suppression")) + == Catch::Approx(0.4)); + REQUIRE(std::any_cast(effective[0].at("suppression_ts")) + == 100); + + const auto persistent_extras = store->Execute( + "SELECT name FROM sqlite_master " + "WHERE name LIKE 'rif_%' " + " AND name NOT IN ('rif_recovery_clock', 'rif_generation_resets', " + " 'rif_active_state', 'idx_rif_active_due')"); + REQUIRE(persistent_extras.empty()); +} + +TEST_CASE("Migration 28 resumes an exact partial schema and is idempotent", + "[schema][migration][rif][partial]") { + auto store = SQLiteStore::Create(":memory:"); + cortext::store::DebugApplyCoreMigrationsThroughForTest(*store, 27); + store->Execute( + "CREATE TABLE rif_recovery_clock(" + "singleton INTEGER PRIMARY KEY CHECK(singleton = 1), " + "generation INTEGER NOT NULL CHECK(generation > 0), " + "log_factor REAL NOT NULL, last_ts INTEGER NOT NULL)"); + store->Execute( + "INSERT INTO memories(memory_id, source_id, kind, start_ts, " + "n_signals, modality, strength, suppression, suppression_ts, " + "created_at) VALUES(1, 'partial', 'LONG_TERM', 100, 1, " + "'image', 0.75, 0.25, 100, 100)"); + + cortext::store::ApplyMigrations(*store); + const auto first_ids + = cortext::store::DebugGetAppliedMigrationIdsForTest(*store); + REQUIRE(first_ids.count(28) == 1); + const auto first = store->Execute( + "SELECT generation, log_factor, last_ts FROM rif_recovery_clock"); + REQUIRE(first.size() == 1); + const auto first_active = store->Execute( + "SELECT memory_id FROM rif_active_state ORDER BY memory_id"); + REQUIRE(first_active.size() == 1); + + cortext::store::ApplyMigrations(*store); + const auto second = store->Execute( + "SELECT generation, log_factor, last_ts FROM rif_recovery_clock"); + const auto second_active = store->Execute( + "SELECT memory_id FROM rif_active_state ORDER BY memory_id"); + REQUIRE(second.size() == 1); + REQUIRE(second_active.size() == 1); + REQUIRE(std::any_cast(second[0].at("generation")) + == std::any_cast(first[0].at("generation"))); + REQUIRE(std::any_cast(second[0].at("log_factor")) + == std::any_cast(first[0].at("log_factor"))); + REQUIRE(std::any_cast(second[0].at("last_ts")) + == std::any_cast(first[0].at("last_ts"))); + REQUIRE(std::any_cast(second_active[0].at("memory_id")) + == std::any_cast(first_active[0].at("memory_id"))); +} + +TEST_CASE("Migration 28 fails atomically on an incompatible partial schema", + "[schema][migration][rif][partial][rollback]") { + auto store = SQLiteStore::Create(":memory:"); + cortext::store::DebugApplyCoreMigrationsThroughForTest(*store, 27); + store->Execute("CREATE TABLE rif_recovery_clock(singleton INTEGER)"); + + REQUIRE_THROWS(cortext::store::ApplyMigrations(*store)); + const auto ids + = cortext::store::DebugGetAppliedMigrationIdsForTest(*store); + REQUIRE(ids.count(28) == 0); + REQUIRE(store->Execute( + "SELECT name FROM sqlite_master WHERE name = 'rif_active_state'") + .empty()); + REQUIRE(store->Execute( + "SELECT name FROM sqlite_master WHERE name = 'rif_effective_memories'") + .empty()); +} + TEST_CASE("Migrations preserve 64-bit applied migration ids", "[schema][migration]") { auto store = SQLiteStore::Create(":memory:"); diff --git a/tests/operations_competition.test.cpp b/tests/operations_competition.test.cpp index 72992312..fe5aea1d 100644 --- a/tests/operations_competition.test.cpp +++ b/tests/operations_competition.test.cpp @@ -1,5 +1,8 @@ // tests/operations_competition.test.cpp #include "test_helpers.hpp" +#include "../src/operations/rif_active_epoch_cache_internal.hpp" +#include "../src/operations/rif_state_internal.hpp" +#include "../src/operations/signal_record_rollback_internal.hpp" #include #include #include @@ -12,6 +15,12 @@ #include #include +namespace cortext::store +{ +void DebugApplyCoreMigrationsThroughForTest (Store &store, + std::int64_t maximum_id); +} + using namespace cortext; using cortext::operations::ApplyRetrievalCompetition; @@ -280,6 +289,7 @@ TEST_CASE ("Alg21 memory-scoped RIF recovery survives embedding fork", "UPDATE memories SET suppression = ?, suppression_ts = ?, " "strength = ? WHERE memory_id = ?", { 0.5, 1LL, 0.5, 100LL }); + cortext::operations::rif_state_internal::RebuildFromMaterialized (*store); ProcessorContext pctx; pctx.recent_context_embeddings.push_back (ctx_vec); @@ -298,7 +308,8 @@ TEST_CASE ("Alg21 memory-scoped RIF recovery survives embedding fork", tx->Commit (); auto rows = store->Execute ( - "SELECT suppression, strength FROM memories WHERE memory_id = ?", + "SELECT suppression, strength FROM rif_effective_memories " + "WHERE memory_id = ?", { 100LL }); REQUIRE (rows.size () == 1); REQUIRE (std::any_cast (rows[0].at ("suppression")) @@ -379,7 +390,7 @@ TEST_CASE ("Alg21 recovery restores strength over time", auto unique_store = cortext::SQLiteStore::Create (":memory:"); auto store = std::shared_ptr (std::move (unique_store)); - // Higher stability -> longer recovery_time (600s). + // Higher stability -> the longest knob-derived recovery time (1800s). SignalProcessor::Config cfg; cortext::testing::RequireEncoder (cfg); cfg.focus = 1.0; @@ -404,7 +415,10 @@ TEST_CASE ("Alg21 recovery restores strength over time", auto apply = std::make_unique (); auto pipeline = std::make_unique ( std::move (seed), std::move (setup), std::move (apply)); - SignalProcessor processor (cfg, store, std::move (pipeline)); + SignalProcessor processor ( + cfg, store, + operations::signal_record_rollback_internal:: + MarkEngineOwnedJournalAware (std::move (pipeline))); processor.Process (MakeSignal (ctx, /*ts=*/1000)); processor.Flush (); } @@ -428,14 +442,18 @@ TEST_CASE ("Alg21 recovery restores strength over time", auto apply = std::make_unique (); auto pipeline = std::make_unique (std::move (setup), std::move (apply)); - SignalProcessor processor (cfg, store, std::move (pipeline)); + SignalProcessor processor ( + cfg, store, + operations::signal_record_rollback_internal:: + MarkEngineOwnedJournalAware (std::move (pipeline))); processor.Process (MakeSignal (ctx, /*ts=*/2000)); processor.Flush (); } { auto rows = store->Execute ( - "SELECT strength, suppression FROM memories WHERE memory_id = ?", + "SELECT strength, suppression FROM rif_effective_memories " + "WHERE memory_id = ?", { 2LL }); REQUIRE (rows.size () == 1); strength_after_partial_recovery @@ -446,20 +464,24 @@ TEST_CASE ("Alg21 recovery restores strength over time", REQUIRE (suppression_after_partial > 0.0); } - // Advance beyond 600 seconds to complete recovery. + // Advance beyond 1800 seconds to complete recovery. { auto setup = std::make_unique (ctx, retrieved); auto apply = std::make_unique (); auto pipeline = std::make_unique (std::move (setup), std::move (apply)); - SignalProcessor processor (cfg, store, std::move (pipeline)); - processor.Process (MakeSignal (ctx, /*ts=*/602000)); + SignalProcessor processor ( + cfg, store, + operations::signal_record_rollback_internal:: + MarkEngineOwnedJournalAware (std::move (pipeline))); + processor.Process (MakeSignal (ctx, /*ts=*/1802000)); processor.Flush (); } { auto rows = store->Execute ( - "SELECT strength, suppression FROM memories WHERE memory_id = ?", + "SELECT strength, suppression FROM rif_effective_memories " + "WHERE memory_id = ?", { 2LL }); REQUIRE (rows.size () == 1); const double strength_after_full_recovery @@ -473,6 +495,412 @@ TEST_CASE ("Alg21 recovery restores strength over time", } } +TEST_CASE ("Lazy RIF clock preserves eager recurrence without active scans", + "[operations][competition][rif_state][lazy]") +{ + auto store = cortext::SQLiteStore::Create (":memory:"); + cortext::testing::InitializeCoreSchema (*store); + store->Execute ( + "INSERT INTO memories(memory_id, source_id, kind, start_ts, n_signals, " + "modality, strength, suppression, suppression_ts, created_at) " + "VALUES(1, 'source-a', 'LONG_TERM', 1000, 1, 'audio', " + "0.5, 0.5, 1000, 1000)"); + cortext::operations::rif_state_internal::RebuildFromMaterialized (*store); + + { + auto tx = store->Begin (); + const auto result + = cortext::operations::rif_state_internal::AdvanceRecovery ( + *tx, 2000, 10000.0); + REQUIRE_FALSE (result.generation_reset); + REQUIRE (result.expired_rows == 0); + tx->Commit (); + } + auto effective = store->Execute ( + "SELECT strength, suppression, suppression_ts " + "FROM rif_effective_memories WHERE memory_id = 1"); + REQUIRE (std::any_cast (effective[0].at ("strength")) + == Catch::Approx (0.55)); + REQUIRE (std::any_cast (effective[0].at ("suppression")) + == Catch::Approx (0.45)); + REQUIRE (std::any_cast (effective[0].at ("suppression_ts")) + == 2000); + auto physical = store->Execute ( + "SELECT strength, suppression, suppression_ts FROM memories " + "WHERE memory_id = 1"); + REQUIRE (std::any_cast (physical[0].at ("strength")) == 0.5); + REQUIRE (std::any_cast (physical[0].at ("suppression")) == 0.5); + REQUIRE (std::any_cast (physical[0].at ("suppression_ts")) + == 1000); + + { + auto tx = store->Begin (); + cortext::operations::rif_state_internal::AdvanceRecovery ( + *tx, 3000, 10000.0); + cortext::operations::rif_state_internal::SuppressMemory ( + *tx, 1, 0.1, 3000); + tx->Commit (); + } + effective = store->Execute ( + "SELECT strength, suppression, suppression_ts " + "FROM rif_effective_memories WHERE memory_id = 1"); + REQUIRE (std::any_cast (effective[0].at ("strength")) + == Catch::Approx (0.495)); + REQUIRE (std::any_cast (effective[0].at ("suppression")) + == Catch::Approx (0.505)); + REQUIRE (std::any_cast (effective[0].at ("suppression_ts")) + == 3000); + + { + auto tx = store->Begin (); + const auto result + = cortext::operations::rif_state_internal::AdvanceRecovery ( + *tx, 13000, 10000.0); + REQUIRE (result.generation_reset); + tx->Commit (); + } + effective = store->Execute ( + "SELECT strength, suppression, suppression_ts " + "FROM rif_effective_memories WHERE memory_id = 1"); + REQUIRE (std::any_cast (effective[0].at ("strength")) + == Catch::Approx (1.0)); + REQUIRE (std::any_cast (effective[0].at ("suppression")) == 0.0); + REQUIRE (std::any_cast (effective[0].at ("suppression_ts")) + == 13000); +} + +TEST_CASE ("Lazy RIF recovery work is independent of the active row count", + "[operations][competition][rif_state][lazy][bounded]") +{ + auto store = cortext::SQLiteStore::Create (":memory:"); + cortext::testing::InitializeCoreSchema (*store); + auto tx = store->Begin (); + for (long long memory_id = 1; memory_id <= 2088; ++memory_id) + { + tx->Execute ( + "INSERT INTO memories(memory_id, source_id, kind, start_ts, " + "n_signals, modality, strength, suppression, suppression_ts, " + "created_at) VALUES(?, ?, 'LONG_TERM', 1000, 1, ?, " + "0.5, 0.5, 1000, 1000)", + { memory_id, std::string ("source-") + std::to_string (memory_id % 4), + memory_id % 3 == 0 ? std::string ("image") + : memory_id % 3 == 1 ? std::string ("text") + : std::string ("audio") }); + } + tx->Commit (); + cortext::operations::rif_state_internal::RebuildFromMaterialized (*store); + + tx = store->Begin (); + const auto result + = cortext::operations::rif_state_internal::AdvanceRecovery ( + *tx, 1001, 600000.0); + tx->Commit (); + REQUIRE_FALSE (result.generation_reset); + REQUIRE (result.expired_rows == 0); + REQUIRE (result.retired_rows == 0); + auto active = store->Execute ( + "SELECT COUNT(*) AS count FROM rif_active_state"); + REQUIRE (std::any_cast (active[0].at ("count")) == 2088); + auto physical = store->Execute ( + "SELECT COUNT(*) AS count FROM memories " + "WHERE strength = 0.5 AND suppression = 0.5 " + "AND suppression_ts = 1000"); + REQUIRE (std::any_cast (physical[0].at ("count")) == 2088); +} + +TEST_CASE ("Lazy RIF freezes the exact eager value at the active threshold", + "[operations][competition][rif_state][lazy][threshold]") +{ + auto store = cortext::SQLiteStore::Create (":memory:"); + cortext::testing::InitializeCoreSchema (*store); + store->Execute ( + "INSERT INTO memories(memory_id, source_id, kind, start_ts, n_signals, " + "modality, strength, suppression, suppression_ts, created_at) " + "VALUES(1, 'source-a', 'LONG_TERM', 1000, 1, 'image', " + "0.8, 1.1e-9, 1000, 1000)"); + cortext::operations::rif_state_internal::RebuildFromMaterialized (*store); + + auto tx = store->Begin (); + auto result = cortext::operations::rif_state_internal::AdvanceRecovery ( + *tx, 2000, 10000.0); + tx->Commit (); + cortext::operations::rif_state_internal::RebuildFromMaterialized (*store); + REQUIRE (result.expired_rows == 1); + + auto row = store->Execute ( + "SELECT strength, suppression, suppression_ts FROM memories " + "WHERE memory_id = 1"); + REQUIRE (std::any_cast (row[0].at ("suppression")) + == Catch::Approx (0.99e-9)); + REQUIRE (std::any_cast (row[0].at ("strength")) + == Catch::Approx (0.80000000011)); + REQUIRE (std::any_cast (row[0].at ("suppression_ts")) == 2000); + REQUIRE (store->Execute ( + "SELECT memory_id FROM rif_active_state WHERE memory_id = 1") + .empty ()); + + tx = store->Begin (); + result = cortext::operations::rif_state_internal::AdvanceRecovery ( + *tx, 3000, 10000.0); + tx->Commit (); + REQUIRE (result.expired_rows == 0); + const auto frozen = store->Execute ( + "SELECT strength, suppression, suppression_ts FROM memories " + "WHERE memory_id = 1"); + REQUIRE (std::any_cast (frozen[0].at ("suppression")) + == std::any_cast (row[0].at ("suppression"))); + REQUIRE (std::any_cast (frozen[0].at ("strength")) + == std::any_cast (row[0].at ("strength"))); + REQUIRE (std::any_cast (frozen[0].at ("suppression_ts")) + == 2000); +} + +TEST_CASE ("Lazy RIF retires full-recovery generations in bounded batches", + "[operations][competition][rif_state][lazy][generation]") +{ + auto store = cortext::SQLiteStore::Create (":memory:"); + cortext::testing::InitializeCoreSchema (*store); + auto tx = store->Begin (); + for (long long memory_id = 1; memory_id <= 130; ++memory_id) + tx->Execute ( + "INSERT INTO memories(memory_id, source_id, kind, start_ts, " + "n_signals, modality, strength, suppression, suppression_ts, " + "created_at) VALUES(?, 'source', 'LONG_TERM', 1000, 1, 'text', " + "0.5, 0.5, 1000, 1000)", + { memory_id }); + tx->Commit (); + + cortext::operations::rif_state_internal::RebuildFromMaterialized (*store); + tx = store->Begin (); + const auto first + = cortext::operations::rif_state_internal::AdvanceRecovery ( + *tx, 12000, 10000.0); + tx->Commit (); + REQUIRE (first.generation_reset); + REQUIRE (first.retired_rows == 64); + + tx = store->Begin (); + const auto second + = cortext::operations::rif_state_internal::AdvanceRecovery ( + *tx, 13000, 10000.0); + tx->Commit (); + REQUIRE_FALSE (second.generation_reset); + REQUIRE (second.retired_rows == 64); + + tx = store->Begin (); + const auto third + = cortext::operations::rif_state_internal::AdvanceRecovery ( + *tx, 14000, 10000.0); + tx->Commit (); + REQUIRE (third.retired_rows == 2); + REQUIRE (store->Execute ("SELECT 1 FROM rif_active_state LIMIT 1").empty ()); + REQUIRE (store->Execute ( + "SELECT 1 FROM rif_generation_resets LIMIT 1").empty ()); + const auto values = store->Execute ( + "SELECT COUNT(*) AS n FROM memories WHERE strength = 1.0 " + "AND suppression = 0.0 AND suppression_ts = 12000"); + REQUIRE (std::any_cast (values[0].at ("n")) == 130); +} + +TEST_CASE ("Lazy RIF reanchors absolute strength writes", + "[operations][competition][rif_state][lazy][write]") +{ + auto store = cortext::SQLiteStore::Create (":memory:"); + cortext::testing::InitializeCoreSchema (*store); + store->Execute ( + "INSERT INTO memories(memory_id, source_id, kind, start_ts, n_signals, " + "modality, strength, suppression, suppression_ts, created_at) " + "VALUES(1, 'source-a', 'LONG_TERM', 1000, 1, 'text', " + "0.5, 0.5, 1000, 1000)"); + cortext::operations::rif_state_internal::RebuildFromMaterialized (*store); + auto tx = store->Begin (); + cortext::operations::rif_state_internal::AdvanceRecovery ( + *tx, 2000, 10000.0); + tx->Execute ("UPDATE memories SET strength = 0.2 WHERE memory_id = 1"); + cortext::operations::rif_state_internal::RefreshActiveStrengthWhere ( + *tx, "memory_id = ?", { 1LL }); + tx->Commit (); + + auto effective = store->Execute ( + "SELECT strength, suppression FROM rif_effective_memories " + "WHERE memory_id = 1"); + REQUIRE (std::any_cast (effective[0].at ("strength")) + == Catch::Approx (0.2)); + REQUIRE (std::any_cast (effective[0].at ("suppression")) + == Catch::Approx (0.45)); + + tx = store->Begin (); + cortext::operations::rif_state_internal::AdvanceRecovery ( + *tx, 3000, 10000.0); + tx->Commit (); + effective = store->Execute ( + "SELECT strength, suppression FROM rif_effective_memories " + "WHERE memory_id = 1"); + REQUIRE (std::any_cast (effective[0].at ("suppression")) + == Catch::Approx (0.405)); + REQUIRE (std::any_cast (effective[0].at ("strength")) + == Catch::Approx (0.245)); +} + +TEST_CASE ("RIF active epoch publishes only after persistent commit and " + "recovers from publication failure", + "[operations][competition][rif_state][active_epoch]") +{ + namespace cache + = cortext::operations::rif_active_epoch_cache_internal; + namespace rif = cortext::operations::rif_state_internal; + auto store = cortext::SQLiteStore::Create (":memory:"); + cortext::testing::InitializeCoreSchema (*store); + store->Execute ( + "INSERT INTO memories(memory_id, source_id, kind, start_ts, n_signals, " + "modality, strength, suppression, suppression_ts, created_at) " + "VALUES(1, 'source-a', 'LONG_TERM', 1000, 1, 'text', " + "0.5, 0.5, 1000, 1000)"); + cortext::operations::rif_state_internal::RebuildFromMaterialized (*store); + + cache::State epoch; + cache::Ensure (epoch, *store); + REQUIRE (epoch.valid); + REQUIRE (epoch.active_rows == 1); + REQUIRE (epoch.database); + auto cached = epoch.database->Execute ( + "SELECT anchor_suppression FROM active_state WHERE memory_id = 1"); + REQUIRE (cached.size () == 1); + REQUIRE (std::any_cast (cached[0].at ("anchor_suppression")) + == Catch::Approx (0.5)); + + auto tx = store->Begin (); + const auto recovered = rif::AdvanceRecovery (*tx, 2000, 10000.0); + cache::StageClock (epoch, recovered.clock.generation, + recovered.clock.log_factor, recovered.clock.last_ts); + cache::StageMemories (epoch, recovered.changed_memory_ids); + // The shadow remains at the previously committed value while the durable + // transaction is open. + cached = epoch.database->Execute ( + "SELECT anchor_suppression FROM active_state WHERE memory_id = 1"); + REQUIRE (std::any_cast (cached[0].at ("anchor_suppression")) + == Catch::Approx (0.5)); + tx->Commit (); + + cache::SetPublishFailureStageForTest (2); + const auto publication + = cache::PublishAfterPersistentCommit (epoch, *store); + REQUIRE (publication.published); + REQUIRE (publication.rebuilt); + REQUIRE (publication.recovered_from_failure); + REQUIRE (epoch.valid); + const auto effective = store->Execute ( + "SELECT strength, suppression FROM rif_effective_memories " + "WHERE memory_id = 1"); + cached = epoch.database->Execute ( + "SELECT anchor_suppression, recovery_total FROM active_state " + "WHERE memory_id = 1"); + REQUIRE (std::any_cast (effective[0].at ("suppression")) + == Catch::Approx (0.45)); + REQUIRE (std::any_cast (cached[0].at ("anchor_suppression")) + == Catch::Approx (0.5)); + REQUIRE (std::any_cast (cached[0].at ("recovery_total")) + == Catch::Approx (1.0)); + + cache::State restarted; + cache::Ensure (restarted, *store); + REQUIRE (restarted.active_rows == epoch.active_rows); + REQUIRE (restarted.generation == epoch.generation); + REQUIRE (restarted.allocated_bytes <= 64ULL * 1024ULL * 1024ULL); +} + +TEST_CASE ("Lazy RIF migration preserves divergent historical timestamps", + "[operations][competition][rif_state][migration_fallback]") +{ + auto store = cortext::SQLiteStore::Create (":memory:"); + cortext::store::DebugApplyCoreMigrationsThroughForTest (*store, 27); + store->Execute ( + "INSERT INTO memories(memory_id, source_id, kind, start_ts, n_signals, " + "modality, strength, suppression, suppression_ts, created_at) VALUES" + "(1, 'source-a', 'LONG_TERM', 1000, 1, 'text', 0.5, 0.5, 1000, 1000)," + "(2, 'source-b', 'LONG_TERM', 1500, 1, 'audio', 0.5, 0.5, 1500, 1500)"); + cortext::store::ApplyMigrations (*store); + REQUIRE (cortext::operations::rif_state_internal::CountRows ( + *store, + "SELECT COUNT(*) AS row_count FROM rif_active_state") == 2); + cortext::operations::rif_active_epoch_cache_internal::State epoch; + cortext::operations::rif_active_epoch_cache_internal::Ensure ( + epoch, *store); + REQUIRE (epoch.calibration_memory_ids == std::vector { 1 }); + + auto tx = store->Begin (); + const auto result + = cortext::operations::rif_state_internal::AdvanceRecovery ( + *tx, 2000, 10000.0, epoch.calibration_memory_ids); + tx->Commit (); + REQUIRE (result.changed_memory_ids.size () == 1); + const auto rows = store->Execute ( + "SELECT memory_id, strength, suppression FROM rif_effective_memories " + "ORDER BY memory_id"); + REQUIRE (rows.size () == 2); + REQUIRE (std::any_cast (rows[0].at ("strength")) + == Catch::Approx (0.55)); + REQUIRE (std::any_cast (rows[0].at ("suppression")) + == Catch::Approx (0.45)); + REQUIRE (std::any_cast (rows[1].at ("strength")) + == Catch::Approx (0.525)); + REQUIRE (std::any_cast (rows[1].at ("suppression")) + == Catch::Approx (0.475)); + + tx = store->Begin (); + const auto continued + = cortext::operations::rif_state_internal::AdvanceRecovery ( + *tx, 3000, 10000.0); + tx->Commit (); + REQUIRE (continued.changed_memory_ids.empty ()); + const auto continued_rows = store->Execute ( + "SELECT memory_id, strength, suppression FROM rif_effective_memories " + "ORDER BY memory_id"); + REQUIRE (std::any_cast (continued_rows[0].at ("strength")) + == Catch::Approx (0.595)); + REQUIRE (std::any_cast (continued_rows[0].at ("suppression")) + == Catch::Approx (0.405)); + REQUIRE (std::any_cast (continued_rows[1].at ("strength")) + == Catch::Approx (0.5725)); + REQUIRE (std::any_cast (continued_rows[1].at ("suppression")) + == Catch::Approx (0.4275)); +} + +TEST_CASE ("Lazy RIF compatibility rebuilds prune retired reset markers", + "[operations][competition][rif_state][compatibility][pruning]") +{ + auto store = cortext::SQLiteStore::Create (":memory:"); + cortext::testing::InitializeCoreSchema (*store); + store->Execute ( + "INSERT INTO memories(memory_id, source_id, kind, start_ts, n_signals, " + "modality, strength, suppression, suppression_ts, created_at) " + "VALUES(1, 'source-a', 'LONG_TERM', 1000, 1, 'text', " + "0.5, 0.5, 1000, 1000)"); + cortext::operations::rif_state_internal::RebuildFromMaterialized (*store); + + auto tx = store->Begin (); + tx->Execute ( + "INSERT INTO rif_generation_resets(generation, reset_ts) " + "VALUES(1, 2000)"); + tx->Execute ( + "UPDATE rif_recovery_clock SET generation = 2, last_ts = 2000 " + "WHERE singleton = 1"); + cortext::operations::rif_state_internal::MaterializeAllAndClear (*tx); + tx->Commit (); + REQUIRE (store->Execute ( + "SELECT 1 FROM rif_generation_resets LIMIT 1").empty ()); + + store->Execute ( + "INSERT INTO rif_generation_resets(generation, reset_ts) " + "VALUES(2, 3000)"); + store->Execute ( + "UPDATE rif_recovery_clock SET generation = 3, last_ts = 3000 " + "WHERE singleton = 1"); + cortext::operations::rif_state_internal::RebuildFromMaterialized (*store); + REQUIRE (store->Execute ( + "SELECT 1 FROM rif_generation_resets LIMIT 1").empty ()); +} + TEST_CASE ("High NE increases retrieval competition suppression", "[operations][competition][neuromod]") { diff --git a/tests/operations_emotion_cascade.test.cpp b/tests/operations_emotion_cascade.test.cpp index e72a0d12..c9e61e71 100644 --- a/tests/operations_emotion_cascade.test.cpp +++ b/tests/operations_emotion_cascade.test.cpp @@ -1,10 +1,13 @@ // tests/operations_emotion_cascade.test.cpp #include "test_helpers.hpp" +#include "../src/operations/association_fanout_cache_internal.hpp" +#include "../src/operations/emotional_metadata_cache_internal.hpp" #include #include #include #include #include +#include #include #include @@ -30,6 +33,164 @@ MakeSignal (uint64_t ts) s.source_id = "test"; return s; } + +static void +SeedCascadeMemory (Store &store, long long memory_id, long long embedding_id, + long long created_at = 1'000'000) +{ + std::vector embedding (kEmbeddingDim, 0.0f); + embedding[0] = 1.0f; + if (store.Execute ("SELECT 1 FROM embeddings WHERE embedding_id = ?", + { embedding_id }).empty ()) + cortext::testing::SeedEmbeddingV2 ( + store, embedding_id, embedding, created_at); + cortext::testing::SeedMemoryV2 ( + store, memory_id, embedding_id, "cascade/test", "LONG_TERM", 1.0, + created_at); +} + +static void +SetCascadeSource (Store &store, long long memory_id, double intensity, + int radius, double decay) +{ + store.Execute ( + "UPDATE memories SET flashbulb = 1, emotional_intensity = ?, " + "half_life_bonus = 2.0, cascade_radius = ?, cascade_decay = ?, " + "s_arousal_avg = 0.9 WHERE memory_id = ?", + { intensity, static_cast (radius), decay, memory_id }); +} + +static void +AddCascadeEdge (Store &store, long long source, long long target) +{ + store.Execute ( + "INSERT INTO associations(source_memory_id, target_memory_id, " + "edge_type, weight) VALUES(?, ?, 'co_occurs', 1.0)", + { source, target }); +} + +static double +MemoryIntensity (Store &store, long long memory_id) +{ + const auto rows = store.Execute ( + "SELECT emotional_intensity FROM memories WHERE memory_id = ?", + { memory_id }); + REQUIRE (rows.size () == 1); + return std::any_cast (rows[0].at ("emotional_intensity")); +} + +static long long +TotalChanges (Store &store) +{ + const auto rows = store.Execute ("SELECT total_changes() AS total_changes"); + REQUIRE (rows.size () == 1); + return std::any_cast (rows[0].at ("total_changes")); +} + +class RawEmotionalMutationThenCascade final : public IOperation +{ +public: + explicit RawEmotionalMutationThenCascade (bool cascade_on_next_call, + bool use_store = false) + : cascade_on_next_call_ (cascade_on_next_call), use_store_ (use_store) + { + } + + void + Execute (OperationContext &context, Transaction &tx) const override + { + ++call_count_; + if (call_count_ == 1) + { + const std::string update + = "UPDATE memories SET flashbulb = 1, " + "emotional_intensity = 0.8, half_life_bonus = 2.0, " + "cascade_radius = 1, cascade_decay = 0.5, " + "s_arousal_avg = 0.8 WHERE memory_id = 10"; + if (use_store_) + context.GetStore ()->Execute (update); + else + tx.Execute (update); + } + if (!cascade_on_next_call_ || call_count_ > 1) + { + PropagateEmotionalCascade cascade; + cascade.Execute (context, tx); + } + } + +private: + bool cascade_on_next_call_ = false; + bool use_store_ = false; + mutable int call_count_ = 0; +}; + +static double +RunCustomRawEmotionalMutation (bool cascade_on_next_call, + bool use_store = false) +{ + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + cortext::testing::InitializeCoreSchema (*store); + SeedCascadeMemory (*store, 10, 100); + SeedCascadeMemory (*store, 20, 200); + AddCascadeEdge (*store, 10, 20); + + SignalProcessor::Config cfg; + cortext::testing::RequireEncoder (cfg); + cfg.stability = 0.5; + auto root = std::make_unique ( + std::make_unique ( + cascade_on_next_call, use_store)); + SignalProcessor processor (cfg, store, std::move (root)); + processor.Process (MakeSignal (1'000'000)); + if (cascade_on_next_call) + processor.Process (MakeSignal (1'000'001)); + return MemoryIntensity (*store, 20); +} + +static std::unordered_map +ExecuteCascade (const std::shared_ptr &store, bool commit = true) +{ + SignalProcessor::Config cfg; + cortext::testing::RequireEncoder (cfg); + cfg.focus = 0.5; + cfg.sensitivity = 0.5; + cfg.stability = 0.5; + ProcessorContext processor_context; + OperationContext context ( + MakeSignal (1'000'000), processor_context, cfg, store.get ()); + auto transaction = store->Begin (); + PropagateEmotionalCascade operation; + operation.Execute (context, *transaction); + if (commit) + transaction->Commit (); + else + transaction->Rollback (); + return context.GetOperationTimings (); +} + +static void +ExecuteCascadeWithMetadataCache ( + const std::shared_ptr &store, + std::vector + metadata) +{ + SignalProcessor::Config cfg; + cortext::testing::RequireEncoder (cfg); + cfg.focus = 0.5; + cfg.sensitivity = 0.5; + cfg.stability = 0.5; + ProcessorContext processor_context; + operations::emotional_metadata_cache_internal::Reset ( + processor_context, std::move (metadata)); + OperationContext context ( + MakeSignal (1'000'000), processor_context, cfg, store.get ()); + auto transaction = store->Begin (); + PropagateEmotionalCascade operation; + operation.Execute (context, *transaction); + transaction->Commit (); +} } // namespace TEST_CASE ("EmotionCascadeParams derives from knobs correctly", @@ -44,6 +205,61 @@ TEST_CASE ("EmotionCascadeParams derives from knobs correctly", REQUIRE (params2.cascade_decay == Catch::Approx (0.3).margin (1e-6)); // lerp(0.7, 0.3, 1) } +TEST_CASE ("Emotional metadata cache preserves shared embedding minima", + "[operations][emotion_cascade][metadata_cache][shared_embedding]") +{ + ProcessorContext pctx; + operations::emotional_metadata_cache_internal::Reset ( + pctx, + { { 10, 100, 2000, true, 0.9, 0.8, 3.0, 1, 0.5 }, + { 11, 100, 1000, false, 0.2, 0.1, 0.5, 0, 0.0 }, + { 20, 200, 1500, true, 0.4, 0.3, 1.0, 0, 0.0 } }); + + const auto state + = operations::emotional_metadata_cache_internal::FindState (pctx); + REQUIRE (state); + const auto &cache = state->emotional_metadata; + REQUIRE (cache.valid); + REQUIRE (cache.memory_ids_by_embedding.at (100) + == std::vector{ 10, 11 }); + REQUIRE (cache.values_by_embedding.at (100).intensity + == Catch::Approx (0.2)); + REQUIRE (cache.values_by_embedding.at (100).half_life_bonus + == Catch::Approx (0.5)); + REQUIRE (cache.source_query_order + == std::vector{ 10, 20 }); + + operations::emotional_metadata_cache_internal::MaxEmbedding ( + pctx, 100, 0.7, 2.0); + REQUIRE (cache.values_by_embedding.at (100).intensity + == Catch::Approx (0.7)); + REQUIRE (cache.values_by_embedding.at (100).half_life_bonus + == Catch::Approx (2.0)); + + operations::emotional_metadata_cache_internal::OverwriteEmbedding ( + pctx, 100, true, 0.6, 1.5, 4, 0.4); + REQUIRE (cache.rows_by_memory.at (10).cascade_radius == 4); + REQUIRE (cache.rows_by_memory.at (11).cascade_decay + == Catch::Approx (0.4)); + REQUIRE (cache.values_by_embedding.at (100).intensity + == Catch::Approx (0.6)); + REQUIRE (cache.values_by_embedding.at (100).half_life_bonus + == Catch::Approx (1.5)); + REQUIRE (cache.source_query_order + == std::vector{ 10, 11, 20 }); + + operations::emotional_metadata_cache_internal::Remove (pctx, 10); + REQUIRE (cache.memory_ids_by_embedding.at (100) + == std::vector{ 11 }); + REQUIRE (cache.source_query_order + == std::vector{ 11, 20 }); + operations::emotional_metadata_cache_internal::Remove (pctx, 11); + REQUIRE_FALSE (cache.memory_ids_by_embedding.contains (100)); + REQUIRE_FALSE (cache.values_by_embedding.contains (100)); + REQUIRE (cache.source_query_order + == std::vector{ 20 }); +} + TEST_CASE ("CascadeRadius and CascadeDecay knob values", "[operations][emotion_cascade][knobs]") { @@ -119,6 +335,24 @@ TEST_CASE ("PropagateEmotionalCascade propagates through graph edges", // Note: Results depend on consolidation interval and timing } +TEST_CASE ("Custom raw emotional mutation uses SQL cascade in one transaction", + "[operations][emotion_cascade][custom][cache][regression]") +{ + REQUIRE (RunCustomRawEmotionalMutation (false) > 0.0); +} + +TEST_CASE ("Custom committed emotional mutation uses SQL cascade next call", + "[operations][emotion_cascade][custom][cache][regression]") +{ + REQUIRE (RunCustomRawEmotionalMutation (true) > 0.0); +} + +TEST_CASE ("Custom Store mutation uses SQL cascade in one transaction", + "[operations][emotion_cascade][custom][cache][regression]") +{ + REQUIRE (RunCustomRawEmotionalMutation (false, true) > 0.0); +} + TEST_CASE ("PropagateEmotionalCascade decays intensity per hop", "[operations][emotion_cascade][decay]") { @@ -166,6 +400,10 @@ TEST_CASE ("PropagateEmotionalCascade uses a millisecond consolidation window", cortext::testing::RequireEncoder (cfg); cfg.stability = 0.0; // Five-minute source window. ProcessorContext pctx; + // This white-box operation test bypasses SignalProcessor, whose lifecycle + // normally owns and clears the private execution sidecar. Ensure a reused + // stack address cannot inherit cache state from an earlier direct test. + operations::execution_cache_sidecar_internal::Erase (pctx); Signal signal = MakeSignal (now_ms); OperationContext ctx (signal, pctx, cfg, store.get ()); auto tx = store->Begin (); @@ -177,4 +415,335 @@ TEST_CASE ("PropagateEmotionalCascade uses a millisecond consolidation window", "SELECT emotional_intensity FROM memories WHERE memory_id = 20"); REQUIRE (rows.size () == 1); REQUIRE (std::any_cast (rows[0].at ("emotional_intensity")) > 0.0); + operations::execution_cache_sidecar_internal::Erase (pctx); +} + +TEST_CASE ("PropagateEmotionalCascade preserves ordered sources across cycles", + "[operations][emotion_cascade][cache][regression]") +{ + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + cortext::testing::InitializeCoreSchema (*store); + for (long long id = 1; id <= 4; ++id) + SeedCascadeMemory (*store, id, id); + SetCascadeSource (*store, 1, 0.9, 1, 0.5); + SetCascadeSource (*store, 2, 0.8, 3, 0.8); + AddCascadeEdge (*store, 1, 3); + AddCascadeEdge (*store, 2, 3); + AddCascadeEdge (*store, 3, 4); + AddCascadeEdge (*store, 4, 1); // Cycle must remain radius-bounded. + + ExecuteCascade (store); + + // Higher-intensity source 1 is visited first and owns shared target 3. + REQUIRE (MemoryIntensity (*store, 3) + == Catch::Approx (0.45).margin (1e-9)); + REQUIRE (MemoryIntensity (*store, 4) + == Catch::Approx (0.45).margin (1e-9)); +} + +TEST_CASE ("PropagateEmotionalCascade preserves tied source order", + "[operations][emotion_cascade][cache][order][regression]") +{ + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + cortext::testing::InitializeCoreSchema (*store); + SeedCascadeMemory (*store, 10, 10); + SeedCascadeMemory (*store, 20, 20); + SeedCascadeMemory (*store, 30, 30); + SetCascadeSource (*store, 10, 0.9, 1, 0.5); + SetCascadeSource (*store, 20, 0.9, 1, 0.8); + AddCascadeEdge (*store, 10, 30); + AddCascadeEdge (*store, 20, 30); + ExecuteCascade (store); + + REQUIRE (MemoryIntensity (*store, 30) + == Catch::Approx (0.45).margin (1e-9)); +} + +TEST_CASE ("PropagateEmotionalCascade cache preserves tied source order", + "[operations][emotion_cascade][metadata_cache][order][regression]") +{ + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + cortext::testing::InitializeCoreSchema (*store); + SeedCascadeMemory (*store, 10, 10, 800'000); + SeedCascadeMemory (*store, 20, 20, 900'000); + SeedCascadeMemory (*store, 30, 30, 700'000); + SetCascadeSource (*store, 10, 0.9, 1, 0.5); + SetCascadeSource (*store, 20, 0.9, 1, 0.8); + AddCascadeEdge (*store, 10, 30); + AddCascadeEdge (*store, 20, 30); + + ExecuteCascadeWithMetadataCache ( + store, + { { 10, 10, 800'000, true, 0.9, 0.9, 2.0, 1, 0.5 }, + { 20, 20, 900'000, true, 0.9, 0.9, 2.0, 1, 0.8 }, + { 30, 30, 700'000, false, 0.0, 0.0, 0.0, 0, 0.0 } }); + + REQUIRE (MemoryIntensity (*store, 30) + == Catch::Approx (0.45).margin (1e-9)); +} + +TEST_CASE ("PropagateEmotionalCascade preserves duplicate embedding semantics", + "[operations][emotion_cascade][cache][duplicate][regression]") +{ + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + cortext::testing::InitializeCoreSchema (*store); + SeedCascadeMemory (*store, 10, 100); + SeedCascadeMemory (*store, 11, 100); + SeedCascadeMemory (*store, 20, 200); + SeedCascadeMemory (*store, 21, 200); + SetCascadeSource (*store, 11, 0.9, 1, 0.8); + AddCascadeEdge (*store, 10, 20); // Legacy lookup selects first source row. + store->Execute ( + "UPDATE memories SET emotional_intensity = 0.9, half_life_bonus = 3.0 " + "WHERE memory_id = 20"); + store->Execute ( + "UPDATE memories SET emotional_intensity = 0.0, half_life_bonus = 0.0 " + "WHERE memory_id = 21"); + + ExecuteCascade (store); + + REQUIRE (MemoryIntensity (*store, 20) + == Catch::Approx (0.9).margin (1e-9)); + REQUIRE (MemoryIntensity (*store, 21) + == Catch::Approx (0.72).margin (1e-9)); +} + +TEST_CASE ("PropagateEmotionalCascade keeps a detached first duplicate seed", + "[operations][emotion_cascade][cache][duplicate][regression]") +{ + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + cortext::testing::InitializeCoreSchema (*store); + SeedCascadeMemory (*store, 10, 100); + SeedCascadeMemory (*store, 11, 100); + SeedCascadeMemory (*store, 20, 200); + SetCascadeSource (*store, 11, 0.9, 1, 0.8); + AddCascadeEdge (*store, 11, 20); + + ExecuteCascade (store); + + // The legacy lookup selects detached memory 10, not later duplicate 11. + REQUIRE (MemoryIntensity (*store, 20) + == Catch::Approx (0.0).margin (1e-9)); +} + +TEST_CASE ("PropagateEmotionalCascade traverses a null-embedding bridge", + "[operations][emotion_cascade][cache][null_embedding][regression]") +{ + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + cortext::testing::InitializeCoreSchema (*store); + SeedCascadeMemory (*store, 1, 1); + SeedCascadeMemory (*store, 2, 2); + SeedCascadeMemory (*store, 3, 3); + SetCascadeSource (*store, 1, 0.9, 2, 0.5); + store->Execute ("UPDATE memories SET embedding_id = NULL WHERE memory_id = 2"); + AddCascadeEdge (*store, 1, 2); + AddCascadeEdge (*store, 2, 3); + + ExecuteCascade (store); + + REQUIRE (MemoryIntensity (*store, 3) + == Catch::Approx (0.225).margin (1e-9)); +} + +TEST_CASE ("PropagateEmotionalCascade skips exact no-op updates and rolls back", + "[operations][emotion_cascade][cache][noop][rollback]") +{ + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + cortext::testing::InitializeCoreSchema (*store); + SeedCascadeMemory (*store, 1, 1); + SeedCascadeMemory (*store, 2, 2); + SetCascadeSource (*store, 1, 0.9, 1, 0.5); + AddCascadeEdge (*store, 1, 2); + store->Execute ( + "UPDATE memories SET emotional_intensity = 0.8, half_life_bonus = 3.0 " + "WHERE memory_id = 2"); + const long long changes_before = TotalChanges (*store); + ExecuteCascade (store); + REQUIRE (TotalChanges (*store) == changes_before); + REQUIRE (MemoryIntensity (*store, 2) + == Catch::Approx (0.8).margin (1e-9)); + + store->Execute ( + "UPDATE memories SET emotional_intensity = 0.0, half_life_bonus = 0.0 " + "WHERE memory_id = 2"); + ExecuteCascade (store, false); + REQUIRE (MemoryIntensity (*store, 2) + == Catch::Approx (0.0).margin (1e-9)); +} + +TEST_CASE ("PropagateEmotionalCascade skips a stable fixed-point traversal", + "[operations][emotion_cascade][cache][fixed_point][regression]") +{ + cortext::testing::ScopedEnvVar profile ( + "CORTEXT_PROFILE_EMOTIONAL_CASCADE", "1"); + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + cortext::testing::InitializeCoreSchema (*store); + SeedCascadeMemory (*store, 1, 1, 3'000'000); + SeedCascadeMemory (*store, 2, 2, 3'000'000); + SeedCascadeMemory (*store, 3, 3, 3'000'000); + SetCascadeSource (*store, 1, 0.9, 2, 0.5); + AddCascadeEdge (*store, 1, 2); + REQUIRE (MemoryIntensity (*store, 3) + == Catch::Approx (0.0).margin (1e-9)); + + SignalProcessor::Config cfg; + cortext::testing::RequireEncoder (cfg); + cfg.focus = 0.5; + cfg.sensitivity = 0.5; + cfg.stability = 0.5; + ProcessorContext processor_context; + operations::emotional_metadata_cache_internal::Reset ( + processor_context, + { { 1, 1, 3'000'000, true, 0.9, 0.9, 2.0, 2, 0.5 }, + { 2, 2, 3'000'000, false, 0.0, 0.0, 0.0, 0, 0.0 }, + { 3, 3, 3'000'000, false, 0.0, 0.0, 0.0, 0, 0.0 } }); + + auto execute = [&] (uint64_t timestamp) { + OperationContext context ( + MakeSignal (timestamp), processor_context, cfg, store.get ()); + auto transaction = store->Begin (); + PropagateEmotionalCascade operation; + operation.Execute (context, *transaction); + transaction->Commit (); + return context.GetOperationTimings (); + }; + + const auto first = execute (3'000'000); + REQUIRE (first.at ("EmotionalCascade.source_count") == 1.0); + REQUIRE (first.at ("EmotionalCascade.neighbor_count") == 2.0); + const long long changes_at_fixed_point = TotalChanges (*store); + + const auto second = execute (3'000'001); + REQUIRE (TotalChanges (*store) == changes_at_fixed_point); + REQUIRE (second.at ("EmotionalCascade.source_count") == 0.0); + REQUIRE (second.at ("EmotionalCascade.neighbor_count") == 0.0); + + SeedCascadeMemory (*store, 4, 4, 3'000'001); + SeedCascadeMemory (*store, 5, 5, 3'000'001); + operations::emotional_metadata_cache_internal::Upsert ( + processor_context, + { 4, 4, 3'000'001, false, 0.0, 0.0, 0.0, 0, 0.0 }); + operations::emotional_metadata_cache_internal::Upsert ( + processor_context, + { 5, 5, 3'000'001, false, 0.0, 0.0, 0.0, 0, 0.0 }); + AddCascadeEdge (*store, 4, 5); + operations::association_fanout_cache::UpsertAssociation ( + processor_context, processor_context.association_fanout_cache, + 4, 5, 4, 5, "related", 1.0, 3'000'001); + const auto unrelated_topology = execute (3'000'002); + REQUIRE (unrelated_topology.at ("EmotionalCascade.source_count") == 0.0); + REQUIRE (unrelated_topology.at ("EmotionalCascade.neighbor_count") == 0.0); + + const auto reversed_time = execute (2'999'999); + REQUIRE (reversed_time.at ("EmotionalCascade.source_count") == 1.0); + REQUIRE (reversed_time.at ("EmotionalCascade.neighbor_count") == 2.0); + + AddCascadeEdge (*store, 2, 3); + REQUIRE (MemoryIntensity (*store, 3) + == Catch::Approx (0.0).margin (1e-9)); + processor_context.association_fanout_cache.valid = false; + const auto topology_changed = execute (3'000'002); + REQUIRE (topology_changed.at ("EmotionalCascade.source_count") == 1.0); + REQUIRE (topology_changed.at ("EmotionalCascade.neighbor_count") == 3.0); + REQUIRE (MemoryIntensity (*store, 3) + == Catch::Approx (0.225).margin (1e-9)); + + store->Execute ( + "UPDATE memories SET emotional_intensity = 1.0 WHERE memory_id = 1"); + operations::emotional_metadata_cache_internal::OverwriteEmbedding ( + processor_context, 1, true, 1.0, 2.0, 2, 0.5); + const auto source_changed = execute (3'000'003); + REQUIRE (source_changed.at ("EmotionalCascade.source_count") == 1.0); + REQUIRE (source_changed.at ("EmotionalCascade.neighbor_count") == 3.0); + REQUIRE (MemoryIntensity (*store, 2) + == Catch::Approx (0.5).margin (1e-9)); + + store->Execute ( + "UPDATE memories SET emotional_intensity = 0.0, half_life_bonus = 0.0 " + "WHERE memory_id = 2"); + operations::emotional_metadata_cache_internal::OverwriteEmbedding ( + processor_context, 2, false, 0.0, 0.0, 0, 0.0); + const auto target_decreased = execute (3'000'004); + REQUIRE (target_decreased.at ("EmotionalCascade.source_count") == 1.0); + REQUIRE (target_decreased.at ("EmotionalCascade.neighbor_count") == 3.0); + REQUIRE (MemoryIntensity (*store, 2) + == Catch::Approx (0.5).margin (1e-9)); +} + +TEST_CASE ("Ordinary unconnected storage preserves the emotional fixed point", + "[operations][emotion_cascade][cache][fixed_point][regression]") +{ + cortext::testing::ScopedEnvVar profile ( + "CORTEXT_PROFILE_EMOTIONAL_CASCADE", "1"); + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + cortext::testing::InitializeCoreSchema (*store); + SeedCascadeMemory (*store, 1, 1, 3'000'000); + SeedCascadeMemory (*store, 2, 2, 3'000'000); + SetCascadeSource (*store, 1, 0.9, 1, 0.5); + AddCascadeEdge (*store, 1, 2); + + SignalProcessor::Config cfg; + cortext::testing::RequireEncoder (cfg); + cfg.focus = 0.5; + cfg.sensitivity = 0.5; + cfg.stability = 0.5; + ProcessorContext processor_context; + operations::emotional_metadata_cache_internal::Reset ( + processor_context, + { { 1, 1, 3'000'000, true, 0.9, 0.9, 2.0, 1, 0.5 }, + { 2, 2, 3'000'000, false, 0.0, 0.0, 0.0, 0, 0.0 } }); + + auto execute = [&] (uint64_t timestamp) { + OperationContext context ( + MakeSignal (timestamp), processor_context, cfg, store.get ()); + auto transaction = store->Begin (); + PropagateEmotionalCascade operation; + operation.Execute (context, *transaction); + transaction->Commit (); + return context.GetOperationTimings (); + }; + + const auto initial = execute (3'000'000); + REQUIRE (initial.at ("EmotionalCascade.source_count") == 1.0); + REQUIRE (initial.at ("EmotionalCascade.neighbor_count") == 1.0); + + SeedCascadeMemory (*store, 3, 3, 3'000'001); + operations::emotional_metadata_cache_internal::Upsert ( + processor_context, + { 3, 3, 3'000'001, false, 0.0, 0.4, 0.0, 0, 0.0 }); + operations::emotional_metadata_cache_internal::OverwriteEmbedding ( + processor_context, 3, false, 0.4, 0.0, 1, 0.5); + + const auto after_ordinary_storage = execute (3'000'001); + REQUIRE (after_ordinary_storage.at ("EmotionalCascade.source_count") + == 0.0); + REQUIRE (after_ordinary_storage.at ("EmotionalCascade.neighbor_count") + == 0.0); + REQUIRE (MemoryIntensity (*store, 2) + == Catch::Approx (0.45).margin (1e-9)); +} + +TEST_CASE ("PropagateEmotionalCascade batches more than 64 sources exactly", + "[operations][emotion_cascade][cache][source_batch][regression]") +{ + cortext::testing::ScopedEnvVar profile ( + "CORTEXT_PROFILE_EMOTIONAL_CASCADE", "1"); + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + cortext::testing::InitializeCoreSchema (*store); + constexpr long long kTargetMemoryId = 1000; + SeedCascadeMemory (*store, kTargetMemoryId, kTargetMemoryId); + for (long long source = 1; source <= 70; ++source) + { + SeedCascadeMemory (*store, source, source); + SetCascadeSource (*store, source, 0.9 - 0.001 * (source - 1), 1, + 0.5); + AddCascadeEdge (*store, source, kTargetMemoryId); + } + + const auto timings = ExecuteCascade (store); + REQUIRE (timings.at ("EmotionalCascade.source_count") == 70.0); + REQUIRE (timings.at ("EmotionalCascade.neighbor_count") == 70.0); + REQUIRE (timings.at ("EmotionalCascade.update_count") == 1.0); + REQUIRE (MemoryIntensity (*store, kTargetMemoryId) + == Catch::Approx (0.45).margin (1e-9)); } diff --git a/tests/operations_graph_retrieval.test.cpp b/tests/operations_graph_retrieval.test.cpp index 5273ad01..e8147296 100644 --- a/tests/operations_graph_retrieval.test.cpp +++ b/tests/operations_graph_retrieval.test.cpp @@ -1,8 +1,10 @@ #include "test_helpers.hpp" +#include "../src/operations/association_fanout_cache_internal.hpp" #include "../src/operations/constructive_recall_internal.hpp" #include "../src/operations/historical_surface_search_cache_internal.hpp" #include "../src/operations/retrieval_trace_state.hpp" +#include #include #include @@ -17,9 +19,11 @@ #include #include #include +#include #include #include #include +#include #include #include #include @@ -450,6 +454,90 @@ TEST_CASE ("Graph retrieval keeps historical memory before its replacement time" const auto out = processor.Process (MakeSignal (UnitVec (0), 3000)); REQUIRE_FALSE (out.candidate_memory_ids.empty ()); REQUIRE (out.candidate_memory_ids.front () == 10LL); + + const auto at_replacement + = processor.Process (MakeSignal (UnitVec (0), 5000)); + REQUIRE (std::find (at_replacement.candidate_memory_ids.begin (), + at_replacement.candidate_memory_ids.end (), 10LL) + != at_replacement.candidate_memory_ids.end ()); + + const auto after_replacement + = processor.Process (MakeSignal (UnitVec (0), 5001)); + REQUIRE (std::find (after_replacement.candidate_memory_ids.begin (), + after_replacement.candidate_memory_ids.end (), 10LL) + == after_replacement.candidate_memory_ids.end ()); +} + +TEST_CASE ("Family features are cached and replaced with their embedding", + "[operations][graph][retrieval][cache][family]") +{ + namespace surface_cache + = operations::historical_surface_search_cache_internal; + ProcessorContext pctx; + REQUIRE (surface_cache::Reset ( + pctx, {}, { surface_cache::Entry { 100, 10, 1000, "LONG_TERM", + "source-a", UnitVec (0), 100 } })); + + auto state = surface_cache::Find (pctx); + REQUIRE (state); + REQUIRE_FALSE (state->current_entries[0].family_features.has_value ()); + const auto &first + = surface_cache::FamilyFeatures (state->current_entries[0]); + REQUIRE (first.normalized[0] == Catch::Approx (1.0f)); + REQUIRE (state->current_entries[0].family_features.has_value ()); + const auto *cached = &*state->current_entries[0].family_features; + REQUIRE (&surface_cache::FamilyFeatures (state->current_entries[0]) + == cached); + + surface_cache::UpsertCurrent ( + pctx, { 200, 10, 1001, "LONG_TERM", "source-b", UnitVec (1), 100 }); + state = surface_cache::Find (pctx); + REQUIRE (state); + REQUIRE_FALSE (state->current_entries[0].family_features.has_value ()); + const auto &replacement + = surface_cache::FamilyFeatures (state->current_entries[0]); + REQUIRE (replacement.normalized[0] == Catch::Approx (0.0f)); + REQUIRE (replacement.normalized[1] == Catch::Approx (1.0f)); + surface_cache::Erase (pctx); +} + +TEST_CASE ("Supersession eligibility index invalidates only for indexed " + "source changes", + "[operations][graph][retrieval][supersession][cache][scaling]") +{ + ProcessorContext pctx; + pctx.UpsertRetrievalSurface ( + { 20, 200, 5000, 5000, 0, 0, 0, 0, "LONG_TERM", "replacement", + "text", -1.0, 0, 0.0, 0.0, 0.0, false, true, UnitVec (0) }); + auto &cache = pctx.association_fanout_cache; + cache.valid = true; + cache.out_by_source[20].push_back ( + { 10, 100, "supersedes", 1.0, 5000 }); + cache.in_by_target[10].push_back ( + { 20, 200, "supersedes", 1.0, 5000 }); + operations::association_fanout_cache::BuildSupersessionEligibility ( + cache, pctx); + auto sidecar = operations::execution_cache_sidecar_internal::Find (pctx); + REQUIRE (sidecar); + REQUIRE (sidecar->supersession_eligibility.valid); + REQUIRE (sidecar->supersession_eligibility.activation_ts_by_target.at (10) + == 5000); + + pctx.UpsertRetrievalSurface ( + { 30, 300, 6000, 6000, 0, 0, 0, 0, "LONG_TERM", "unrelated", + "audio", -1.0, 0, 0.0, 0.0, 0.0, false, true, UnitVec (1) }); + REQUIRE (sidecar->supersession_eligibility.valid); + + pctx.UpsertRetrievalSurface ( + { 20, 200, 7000, 7000, 0, 0, 0, 0, "LONG_TERM", "replacement", + "image", -1.0, 0, 0.0, 0.0, 0.0, false, true, UnitVec (0) }); + operations::association_fanout_cache::NotifyRetrievalSurfaceChanged ( + pctx, 20); + REQUIRE_FALSE (sidecar->supersession_eligibility.valid); + operations::association_fanout_cache::BuildSupersessionEligibility ( + cache, pctx); + REQUIRE (sidecar->supersession_eligibility.activation_ts_by_target.at (10) + == 7000); } TEST_CASE ("Graph retrieval temporal score decays across multi-month ages", @@ -799,9 +887,34 @@ TEST_CASE ("Graph retrieval cache rebuild uses base embedding when constructive REQUIRE (target != ranked.end ()); REQUIRE (target->embedding_id == 100LL); REQUIRE (target->score > 0.99); + REQUIRE (operations::historical_surface_search_cache_internal:: + BaseEmbeddingIdForMemory (pctx, 10LL, 0) + == 100LL); operations::historical_surface_search_cache_internal::Erase (pctx); } +TEST_CASE ("Current surface upsert preserves original base embedding lineage", + "[operations][graph][retrieval][constructive_recall][cache]") +{ + namespace cache + = operations::historical_surface_search_cache_internal; + ProcessorContext pctx; + const Eigen::VectorXf base = UnitVec (0); + const Eigen::VectorXf reconstructed = UnitVec (1); + REQUIRE (cache::Reset ( + pctx, { { 100LL, 10LL, 1000LL, "LONG_TERM", "source", base } }, + { { 100LL, 10LL, 0, std::string (), std::string (), base, 100LL } })); + cache::UpsertCurrent ( + pctx, { 101LL, 10LL, 0, std::string (), std::string (), reconstructed }); + REQUIRE (cache::BaseEmbeddingIdForMemory (pctx, 10LL, 0) == 100LL); + const auto state = cache::Find (pctx); + REQUIRE (state); + REQUIRE (state->current_entries.at ( + state->current_memory_index.at (10LL)).embedding_id + == 101LL); + cache::Erase (pctx); +} + TEST_CASE ("Graph retrieval returns refreshed output after reconstruction", "[operations][graph][retrieval]") { @@ -1016,6 +1129,8 @@ TEST_CASE ("Graph retrieval soundly collapses cosine-near families before KNN ca REQUIRE (std::find (out.candidate_memory_ids.begin (), out.candidate_memory_ids.end (), kTargetMemoryId) != out.candidate_memory_ids.end ()); + REQUIRE ( + operations::retrieval_trace::GetLastFamilyExactComparisonCount () > 0); } TEST_CASE ("Graph retrieval bounds exact family checks on diverse embeddings", @@ -1048,7 +1163,7 @@ TEST_CASE ("Graph retrieval bounds exact family checks on diverse embeddings", constexpr std::size_t kAllPairs = static_cast (kEmbeddingDim) * static_cast (kEmbeddingDim - 1) / 2; - REQUIRE (exact_comparisons > 0); + REQUIRE (exact_comparisons == 0); REQUIRE (exact_comparisons < kAllPairs / 4); } @@ -1083,7 +1198,7 @@ TEST_CASE ("Graph retrieval bounds exact family checks on dense orthogonal " constexpr std::size_t kAllPairs = static_cast (kEmbeddingDim) * static_cast (kEmbeddingDim - 1) / 2; - REQUIRE (exact_comparisons > 0); + REQUIRE (exact_comparisons == 0); REQUIRE (exact_comparisons < kAllPairs / 4); } @@ -1304,7 +1419,7 @@ TEST_CASE ("Graph retrieval SQL fallback performance probe", operations::historical_surface_search_cache_internal:: SetProcessorSurfaceComplete (pctx, processor_surface_complete); operations::historical_surface_search_cache_internal::MarkRecoveryFailed ( - pctx); + pctx, true); auto signal = MakeSignal (UnitVec (0), 1000000000); signal.retention = Retention::Ephemeral; std::vector elapsed_ms; @@ -1417,6 +1532,64 @@ TEST_CASE ("Graph retrieval cache rebuild accepts shared base embeddings", operations::historical_surface_search_cache_internal::Erase (pctx); } +TEST_CASE ("Graph retrieval cache rebuild covers association supersession " + "candidates", + "[operations][graph][retrieval][cache][supersession]" + "[association]") +{ + auto unique_store = SQLiteStore::Create (":memory:"); + auto store = std::shared_ptr (std::move (unique_store)); + cortext::testing::InitializeCoreSchema (*store); + SeedMemory (*store, 10, 100, UnitVec (0), 1000); + store->Execute ( + "UPDATE memories SET kind = 'ASSOCIATION' WHERE memory_id = 10"); + + SignalProcessor::Config cfg; + cortext::testing::RequireEncoder (cfg); + ProcessorContext pctx; + ProcessorContext::RetrievalSurfaceEntry association_surface; + association_surface.memory_id = 10; + association_surface.embedding_id = 100; + association_surface.start_ts = 1000; + association_surface.kind = "ASSOCIATION"; + association_surface.vector_seed_eligible = false; + association_surface.embedding = UnitVec (0); + pctx.UpsertRetrievalSurface (std::move (association_surface)); + auto signal = MakeSignal (UnitVec (0), 2000); + OperationContext ctx (signal, pctx, cfg, store.get ()); + ctx.SetShouldCheckRetrieval (true); + ctx.SetWriteExclusionTs (signal.timestamp); + + GraphAugmentedRetrieveCandidates operation; + auto tx = store->Begin (); + operation.Execute (ctx, *tx); + tx->Rollback (); + + const auto state + = operations::historical_surface_search_cache_internal::Find (pctx); + REQUIRE (state); + REQUIRE (state->supersession_entry_by_memory.contains (10)); + REQUIRE (state->current_memory_index.contains (10)); + REQUIRE (operations::historical_surface_search_cache_internal:: + CurrentPopulationCoversHistorical (*state, -1)); + + operations::historical_surface_search_cache_internal:: + SetProcessorSurfaceComplete (pctx, true); + operations::historical_surface_search_cache_internal::MarkRecoveryFailed ( + pctx, true); + OperationContext recovery_ctx (signal, pctx, cfg, store.get ()); + recovery_ctx.SetShouldCheckRetrieval (true); + recovery_ctx.SetWriteExclusionTs (signal.timestamp); + auto recovery_tx = store->Begin (); + operation.Execute (recovery_ctx, *recovery_tx); + recovery_tx->Rollback (); + const auto recovered + = operations::historical_surface_search_cache_internal::Find (pctx); + REQUIRE (recovered); + REQUIRE (recovered->current_memory_index.contains (10)); + operations::historical_surface_search_cache_internal::Erase (pctx); +} + TEST_CASE ("Graph retrieval bounded fallback keeps eligible shared sibling", "[operations][graph][retrieval][sql][shared-embedding][supersession]") { @@ -1663,6 +1836,34 @@ TEST_CASE ("Graph retrieval fallback preserves overfetch after database reconstr operations::historical_surface_search_cache_internal::Erase (pctx); } +TEST_CASE ("Historical search recovery rejects recycled context state", + "[operations][graph][retrieval][cache][regression]") +{ + alignas (ProcessorContext) std::byte storage[sizeof (ProcessorContext)]; + auto *prior = std::construct_at ( + reinterpret_cast (storage)); + operations::historical_surface_search_cache_internal:: + SetCurrentSurfaceDatabaseCurrent (*prior, true); + operations::historical_surface_search_cache_internal:: + SetProcessorSurfaceComplete (*prior, true); + std::destroy_at (prior); + + auto *current = std::construct_at ( + reinterpret_cast (storage)); + operations::historical_surface_search_cache_internal::MarkRecoveryFailed ( + *current); + REQUIRE (operations::historical_surface_search_cache_internal:: + RecoveryFailed (*current)); + REQUIRE_FALSE (operations::historical_surface_search_cache_internal:: + CurrentSurfaceDatabaseCurrent (*current)); + const auto state + = operations::historical_surface_search_cache_internal::Find (*current); + REQUIRE (state != nullptr); + REQUIRE_FALSE (state->processor_surface_complete); + operations::historical_surface_search_cache_internal::Erase (*current); + std::destroy_at (current); +} + TEST_CASE ("Graph retrieval bypasses stale valid cache for latest reconstructions", "[operations][graph][retrieval][cache][sql][reconstruction]") { @@ -1774,7 +1975,7 @@ TEST_CASE ("Graph retrieval bypasses stale valid cache for latest reconstruction operations::historical_surface_search_cache_internal:: SetProcessorSurfaceComplete (pctx, true); operations::historical_surface_search_cache_internal::MarkRecoveryFailed ( - pctx); + pctx, true); OperationContext recovery_ctx (signal, pctx, cfg, store.get ()); recovery_ctx.SetShouldCheckRetrieval (true); recovery_ctx.SetWriteExclusionTs (signal.timestamp); @@ -1841,5 +2042,41 @@ TEST_CASE ("Historical search cache append retains memory alternative", REQUIRE (state->entries.size () == 1); REQUIRE (state->entries.front ().memory_references.size () == 1); REQUIRE (state->entries.front ().memory_references.front ().memory_id == 10); + REQUIRE (state->long_term_entry_indices + == std::vector{ 0 }); + REQUIRE (state->long_term_index_positions.at (0) == 0); + operations::historical_surface_search_cache_internal::Erase (pctx); +} + +TEST_CASE ("Historical search cache tracks only long-term distance rows", + "[operations][graph][retrieval][cache][eligibility]") +{ + using operations::historical_surface_search_cache_internal::Entry; + ProcessorContext pctx; + REQUIRE (operations::historical_surface_search_cache_internal::Reset ( + pctx, + { Entry{ 100, 10, 1000, "LONG_TERM", "a", UnitVec (0) }, + Entry{ 101, 11, 1001, "SIGNAL", "b", UnitVec (1) }, + Entry{ 102, 12, 1002, "LONG_TERM", "c", UnitVec (2) } })); + + auto state + = operations::historical_surface_search_cache_internal::Find (pctx); + REQUIRE (state != nullptr); + REQUIRE (state->long_term_entry_indices + == std::vector{ 0, 2 }); + + operations::historical_surface_search_cache_internal::RemoveEmbedding ( + pctx, 100); + state = operations::historical_surface_search_cache_internal::Find (pctx); + REQUIRE (state->entries.size () == 2); + REQUIRE (state->entries[0].embedding_id == 102); + REQUIRE (state->long_term_entry_indices + == std::vector{ 0 }); + REQUIRE (state->long_term_index_positions.at (0) == 0); + + operations::historical_surface_search_cache_internal::Append ( + pctx, { 103, 13, 1003, "SIGNAL", "d", UnitVec (3) }); + REQUIRE (state->long_term_entry_indices + == std::vector{ 0 }); operations::historical_surface_search_cache_internal::Erase (pctx); } diff --git a/tests/operations_memory_storage.test.cpp b/tests/operations_memory_storage.test.cpp index dbd2c353..7e65b271 100644 --- a/tests/operations_memory_storage.test.cpp +++ b/tests/operations_memory_storage.test.cpp @@ -11,6 +11,7 @@ #include #include #include "../src/operations/constructive_recall_internal.hpp" +#include "../src/operations/execution_cache_sidecar_internal.hpp" #include "../src/operations/historical_surface_search_cache_internal.hpp" #include #include @@ -210,6 +211,15 @@ TEST_CASE ("MemoryStorage uses default SqlObjectStore inside processor " const auto out = processor.Process (s); REQUIRE (out.stored_memory_id.has_value ()); REQUIRE (out.stored_signal_id.has_value ()); + REQUIRE (out.operation_ms.at ( + "MemoryStorage.supersession_current_rows_visited") + == 0.0); + REQUIRE (out.operation_ms.at ( + "MemoryStorage.supersession_historical_rows_visited") + == 0.0); + REQUIRE (out.operation_ms.at ( + "MemoryStorage.supersession_sql_fallback_count") + == 3.0); auto memory_rows = store->Execute ( "SELECT blob_id FROM memories WHERE memory_id = ?", @@ -515,7 +525,7 @@ TEST_CASE ("MemoryStorage stores memory even when no payload", } TEST_CASE ("MemoryStorage writes modality-agnostic supersedes edges", - "[operations][memory_storage][supersession]") + "[operations][memory_storage][supersession][fanout_cache]") { ScopedTempDb db; Store *store = db.get (); @@ -535,6 +545,10 @@ TEST_CASE ("MemoryStorage writes modality-agnostic supersedes edges", s.mimetype = "image/custom-test"; ProcessorContext pctx; + pctx.UpsertRetrievalSurface ( + { 10, 100, 1000, 1000, 0, 0, 0, 0, "LONG_TERM", "belief/source", + "text", -1.0, 0, 0.0, 0.0, 0.0, false, true, + stale_embedding }); SignalProcessor::Config cfg; cortext::testing::RequireEncoder (cfg); @@ -576,7 +590,17 @@ TEST_CASE ("MemoryStorage writes modality-agnostic supersedes edges", { correction_memory_id, 10LL }); REQUIRE (edge_rows.size () == 1); REQUIRE (std::any_cast (edge_rows[0].at ("weight")) > 0.0); - REQUIRE_FALSE (pctx.association_fanout_cache.valid); + REQUIRE (pctx.association_fanout_cache.valid); + REQUIRE (pctx.association_fanout_cache.out_by_source + .at (correction_memory_id) + .front ().memory_id + == 10LL); + const auto sidecar + = operations::execution_cache_sidecar_internal::Find (pctx); + REQUIRE (sidecar); + REQUIRE (sidecar->supersession_eligibility.valid); + REQUIRE (sidecar->supersession_eligibility.activation_ts_by_target.at (10LL) + == 2000LL); auto stale_rows = store->Execute ( "SELECT source_contradiction_count FROM memories WHERE memory_id = ?", @@ -622,6 +646,263 @@ TEST_CASE ("Typed supersession candidates retain borrowed cache vectors", REQUIRE (invalid.Embedding () == nullptr); } +TEST_CASE ("Historical cache tracks only supersession-eligible embeddings", + "[operations][memory_storage][supersession][coverage]") +{ + namespace cache + = operations::historical_surface_search_cache_internal; + ProcessorContext pctx; + REQUIRE (cache::Reset ( + pctx, + { { 100, 10, 1000, "LONG_TERM", "source/a", UnitVec (0) }, + { 101, 11, 1001, "ASSOCIATION", "source/b", UnitVec (1) }, + { 102, 0, 0, std::string (), std::string (), UnitVec (2) } })); + auto state = cache::Find (pctx); + REQUIRE (state != nullptr); + REQUIRE (state->supersession_entry_indices.size () == 2); + + cache::Append ( + pctx, { 103, 12, 1002, "ASSOCIATION", "source/c", UnitVec (3) }); + cache::Append ( + pctx, { 104, 0, 0, std::string (), std::string (), UnitVec (4) }); + cache::RemoveEmbedding (pctx, 100); + state = cache::Find (pctx); + REQUIRE (state != nullptr); + REQUIRE (state->supersession_entry_indices.size () == 2); + for (const std::size_t index : state->supersession_entry_indices) + { + REQUIRE (index < state->entries.size ()); + REQUIRE (cache::IsSupersessionCandidateEntry (state->entries[index])); + REQUIRE (state->supersession_index_positions.at (index) + < state->supersession_entry_indices.size ()); + } + cache::Erase (pctx); +} + +TEST_CASE ("Shared embeddings retain every supersession memory sibling", + "[operations][memory_storage][supersession][coverage]" + "[shared-embedding]") +{ + namespace cache + = operations::historical_surface_search_cache_internal; + ScopedTempDb db; + Store *store = db.get (); + REQUIRE (store != nullptr); + + SignalProcessor::Config cfg; + cortext::testing::RequireEncoder (cfg); + const Eigen::VectorXf stale_embedding = UnitVec (0); + const Eigen::VectorXf correction_embedding = VectorWithCosineToDim0 (0.94f); + const int candidate_limit = std::max ( + 1, core::SupersessionCandidateLimit (cfg.focus, cfg.sensitivity, + cfg.stability)); + const int max_edges = core::SupersessionMaxEdges ( + cfg.focus, cfg.sensitivity, cfg.stability); + const int sibling_count = candidate_limit + 1; + cortext::testing::SeedEmbeddingV2 (*store, 100, stale_embedding, 1000); + + ProcessorContext pctx; + std::vector historical_entries; + std::vector current_entries; + historical_entries.reserve (static_cast (sibling_count)); + current_entries.reserve (static_cast (sibling_count)); + for (int index = 0; index < sibling_count; ++index) + { + const long long sibling_id = 10LL + index; + const long long start_ts = 1000LL + index; + const std::string source_id + = "belief/sibling/" + std::to_string (index); + cortext::testing::SeedMemoryV2 (*store, sibling_id, 100, source_id, + "LONG_TERM", 1.0, start_ts); + ProcessorContext::RetrievalSurfaceEntry current; + current.memory_id = sibling_id; + current.embedding_id = 100; + current.start_ts = start_ts; + current.kind = "LONG_TERM"; + current.embedding = stale_embedding; + pctx.UpsertRetrievalSurface (std::move (current)); + historical_entries.push_back ( + { 100, sibling_id, start_ts, "LONG_TERM", source_id, + stale_embedding }); + current_entries.push_back ( + { 100, sibling_id, start_ts, "LONG_TERM", source_id, + stale_embedding, 100 }); + } + REQUIRE (cache::Reset (pctx, std::move (historical_entries), + std::move (current_entries))); + const auto cache_state = cache::Find (pctx); + REQUIRE (cache_state); + REQUIRE (cache_state->supersession_entry_by_memory.contains (10)); + REQUIRE (cache_state->supersession_entry_by_memory.contains ( + 9LL + sibling_count)); + REQUIRE (cache_state->supersession_embedding_fanout); + REQUIRE_FALSE (cache::CurrentPopulationCoversHistorical ( + *cache_state, -1)); + + Signal signal; + signal.embedding = correction_embedding; + signal.timestamp = 2000; + signal.source_id = "belief/correction"; + signal.modality = "text"; + signal.mimetype = "text/plain"; + AccumulatorState acc; + acc.mu_acc = signal.embedding; + acc.n_signals = 1; + acc.s_sum = 0.8; + acc.s_max = 0.8; + acc.t_start = signal.timestamp; + SignalRecord record; + record.embedding = signal.embedding; + record.timestamp = signal.timestamp; + record.modality = signal.modality; + record.mime = signal.mimetype; + record.score = 0.8; + acc.signals.push_back (std::move (record)); + pctx.accumulator_states[signal.source_id] = std::move (acc); + + OperationContext ctx (signal, pctx, cfg, store); + ctx.SetAccumulatorWriteDecision (true); + ctx.SetRepresentativeEmbedding (signal.embedding); + MemoryStorage operation; + auto tx = store->Begin (); + operation.Execute (ctx, *tx); + tx->Commit (); + REQUIRE (ctx.GetStoredMemoryId ()); + REQUIRE (ctx.GetOperationTimings ().at ( + "MemoryStorage.supersession_current_rows_visited") + == static_cast (sibling_count)); + REQUIRE (ctx.GetOperationTimings ().at ( + "MemoryStorage.supersession_historical_coverage_proven") + == 0.0); + REQUIRE (ctx.GetOperationTimings ().at ( + "MemoryStorage.supersession_sql_fallback_count") + == 0.0); + const auto edges = store->Execute ( + "SELECT target_memory_id FROM associations " + "WHERE source_memory_id = ? AND edge_type = 'supersedes' " + "ORDER BY target_memory_id", + { *ctx.GetStoredMemoryId () }); + REQUIRE (edges.size () == static_cast (max_edges)); + for (int index = 0; index < max_edges; ++index) + REQUIRE (AnyToLongLong (edges[static_cast (index)].at ( + "target_memory_id")) + == 10LL + sibling_count - max_edges + index); + cache::Erase (pctx); +} + +TEST_CASE ("Exact empty supersession coverage skips the recent SQL fallback", + "[operations][memory_storage][supersession][coverage]") +{ + namespace cache + = operations::historical_surface_search_cache_internal; + ScopedTempDb db; + Store *store = db.get (); + REQUIRE (store != nullptr); + + SignalProcessor::Config cfg; + cortext::testing::RequireEncoder (cfg); + Signal signal; + signal.embedding = UnitVec (0); + signal.timestamp = 2000; + signal.source_id = "fresh/source"; + signal.modality = "text"; + signal.mimetype = "text/plain"; + + ProcessorContext pctx; + REQUIRE (cache::Reset (pctx, {})); + AccumulatorState acc; + acc.mu_acc = signal.embedding; + acc.n_signals = 1; + acc.s_sum = 0.8; + acc.s_max = 0.8; + acc.t_start = signal.timestamp; + SignalRecord record; + record.embedding = signal.embedding; + record.timestamp = signal.timestamp; + record.modality = signal.modality; + record.mime = signal.mimetype; + record.score = 0.8; + acc.signals.push_back (std::move (record)); + pctx.accumulator_states[signal.source_id] = std::move (acc); + + OperationContext ctx (signal, pctx, cfg, store); + ctx.SetAccumulatorWriteDecision (true); + ctx.SetRepresentativeEmbedding (signal.embedding); + MemoryStorage operation; + auto tx = store->Begin (); + operation.Execute (ctx, *tx); + tx->Commit (); + + REQUIRE (ctx.GetStoredMemoryId ()); + REQUIRE (ctx.GetOperationTimings ().at ( + "MemoryStorage.supersession_current_rows_visited") + == 0.0); + REQUIRE (ctx.GetOperationTimings ().at ( + "MemoryStorage.supersession_historical_rows_visited") + == 0.0); + REQUIRE (ctx.GetOperationTimings ().at ( + "MemoryStorage.supersession_historical_coverage_proven") + == 1.0); + REQUIRE (ctx.GetOperationTimings ().at ( + "MemoryStorage.supersession_sql_fallback_count") + == 0.0); + cache::Erase (pctx); +} + +TEST_CASE ("Equivalent current population proves historical coverage in O1", + "[operations][memory_storage][supersession][coverage]") +{ + namespace cache + = operations::historical_surface_search_cache_internal; + ProcessorContext pctx; + REQUIRE (cache::Reset ( + pctx, + { { 100, 10, 1000, "LONG_TERM", "source/a", UnitVec (0) }, + { 101, 11, 1001, "LONG_TERM", "source/b", UnitVec (1) } }, + { { 100, 10, 0, std::string (), std::string (), UnitVec (0), 100 }, + { 101, 11, 0, std::string (), std::string (), UnitVec (1), 101 } })); + auto state = cache::Find (pctx); + REQUIRE (state != nullptr); + REQUIRE (cache::CurrentPopulationCoversHistorical (*state, -1)); + + cache::Append ( + pctx, { 102, 12, 1002, "LONG_TERM", "source/c", UnitVec (2) }); + state = cache::Find (pctx); + REQUIRE (state != nullptr); + REQUIRE (cache::CurrentPopulationCoversHistorical (*state, 12)); + REQUIRE_FALSE (cache::CurrentPopulationCoversHistorical (*state, 10)); + + cache::UpsertCurrent ( + pctx, + { 102, 12, 0, std::string (), std::string (), UnitVec (2), 102 }); + state = cache::Find (pctx); + REQUIRE (cache::CurrentPopulationCoversHistorical (*state, -1)); + + cache::UpsertCurrent ( + pctx, + { 200, 10, 0, std::string (), std::string (), UnitVec (3), 100 }); + state = cache::Find (pctx); + REQUIRE_FALSE (cache::CurrentPopulationCoversHistorical (*state, -1)); + cache::UpsertCurrent ( + pctx, + { 100, 10, 0, std::string (), std::string (), UnitVec (0), 100 }); + state = cache::Find (pctx); + REQUIRE (cache::CurrentPopulationCoversHistorical (*state, -1)); + cache::Erase (pctx); + + ProcessorContext reversed; + REQUIRE (cache::Reset ( + reversed, + { { 100, 11, 1000, "LONG_TERM", "source/a", UnitVec (0) }, + { 101, 10, 1001, "LONG_TERM", "source/b", UnitVec (1) } }, + { { 100, 11, 0, std::string (), std::string (), UnitVec (0), 100 }, + { 101, 10, 0, std::string (), std::string (), UnitVec (1), 101 } })); + state = cache::Find (reversed); + REQUIRE (state != nullptr); + REQUIRE_FALSE (cache::CurrentPopulationCoversHistorical (*state, -1)); + cache::Erase (reversed); +} + TEST_CASE ("Historical surface cache survives sequential thread migration and " "erases across threads", "[operations][memory_storage][cache][lifecycle]") @@ -829,6 +1110,9 @@ TEST_CASE ("MemoryStorage preserves SQL KNN behavior with signal-only decoys", tx->Commit (); REQUIRE (ctx.GetStoredMemoryId ().has_value ()); + REQUIRE (ctx.GetOperationTimings ().at ( + "MemoryStorage.supersession_historical_coverage_proven") + == 1.0); const auto edge_rows = store->Execute ( "SELECT 1 FROM associations " "WHERE source_memory_id = ? AND target_memory_id = ? " diff --git a/tests/signal_processor.test.cpp b/tests/signal_processor.test.cpp index 1edff013..eb31764b 100644 --- a/tests/signal_processor.test.cpp +++ b/tests/signal_processor.test.cpp @@ -1,11 +1,17 @@ #include #include "test_helpers.hpp" +#include #include +#include #include #include #include #include +#include "../src/operations/association_fanout_cache_internal.hpp" +#include "../src/operations/bounded_activation_shadow_internal.hpp" +#include "../src/operations/emotional_metadata_cache_internal.hpp" #include "../src/operations/historical_surface_search_cache_internal.hpp" +#include "../src/operations/rif_state_internal.hpp" #include "../src/operations/consolidation_throughput_state_internal.hpp" #include "../src/operations/signal_record_rollback_internal.hpp" #include @@ -19,6 +25,21 @@ std::size_t ProcessorRollbackSnapshotReuseCountForTest (); std::size_t SignalRecordRollbackBackupCountForTest (); std::size_t SignalRecordRollbackCopiedRecordCountForTest (); void SetSignalRecordSnapshotSetupThrowStageForTest (int stage); +void SetRifActiveEpochPublishFailureStageForTest (int stage); +void SetRifActiveEpochPublishFailureMaskForTest (unsigned int mask); +void SetSQLiteCheckpointFailureOnceForTest (); +} + +namespace cortext::store +{ +void DebugApplyCoreMigrationsThroughForTest (Store &store, + int64_t maximum_id); +} + +static std::shared_ptr +ExecutionCacheState (const ProcessorContext &ctx) +{ + return operations::execution_cache_sidecar_internal::Find (ctx); } struct InsertOp : IOperation @@ -39,6 +60,291 @@ struct InsertDeferredViolationOp : IOperation } }; +struct BoundedShadowNoOp : IOperation +{ + void + Execute (OperationContext &, Transaction &) const override + { + } +}; + +struct BoundedShadowThrowOnceOp : IOperation +{ + void + Execute (OperationContext &, Transaction &) const override + { + if (fail_once) + { + fail_once = false; + throw std::runtime_error ("bounded shadow precommit failure"); + } + } + + mutable bool fail_once = true; +}; + +struct BoundedShadowCancelOp : IOperation +{ + void + Execute (OperationContext &, Transaction &) const override + { + internal::ThrowCancellation (); + } +}; + +Signal +MakeBoundedShadowSignal (std::uint64_t event_index, + std::string source_id = "source-a", + std::string modality = "text") +{ + Signal signal; + signal.embedding = Eigen::VectorXf::Zero (16); + for (Eigen::Index dimension = 0; dimension < signal.embedding.size (); + ++dimension) + signal.embedding[dimension] = static_cast ( + std::sin ((event_index + 1) * (dimension + 1) * 0.017) + + std::cos ((event_index + 3) * (dimension + 2) * 0.011)); + signal.timestamp = 1000 + event_index; + signal.source_id = std::move (source_id); + signal.modality = std::move (modality); + signal.mimetype = signal.modality == "audio" ? "audio/pcm;format=f32" + : signal.modality == "image" ? "image/png" + : "text/plain"; + return signal; +} + +struct AdvanceRifEpochOp : IOperation +{ + void + Execute (OperationContext &ctx, Transaction &tx) const override + { + auto sidecar = operations::execution_cache_sidecar_internal::Ensure ( + ctx.GetProcessorContext ()); + const auto result = operations::rif_state_internal::AdvanceRecovery ( + tx, static_cast (ctx.GetSignal ().timestamp), 10000.0, + sidecar->rif_active_epoch.calibration_memory_ids); + sidecar->rif_active_epoch.calibration_memory_ids.clear (); + operations::rif_active_epoch_cache_internal::StageClock ( + sidecar->rif_active_epoch, result.clock.generation, + result.clock.log_factor, result.clock.last_ts); + operations::rif_active_epoch_cache_internal::StageMemories ( + sidecar->rif_active_epoch, result.changed_memory_ids); + } +}; + +struct AdvanceRifAndFailCommitOnceOp : IOperation +{ + void + Execute (OperationContext &ctx, Transaction &tx) const override + { + AdvanceRifEpochOp {}.Execute (ctx, tx); + if (fail_once) + { + fail_once = false; + tx.Execute ("INSERT INTO deferred_child(parent_id) VALUES(999)"); + } + } + + mutable bool fail_once = true; +}; + +struct PrimeRifEpochBoundaryOp : IOperation +{ + void + Execute (OperationContext &ctx, Transaction &) const override + { + if (ctx.GetSignal ().force_consolidation || primed) + return; + auto sidecar = operations::execution_cache_sidecar_internal::Ensure ( + ctx.GetProcessorContext ()); + sidecar->rif_active_epoch.event_count + = operations::rif_active_epoch_cache_internal::kEventLimit - 1; + primed = true; + } + + mutable bool primed = false; +}; + +struct ConsolidationInsertAndFailCommitOnceOp : IOperation +{ + void + Execute (OperationContext &ctx, Transaction &tx) const override + { + captured = &ctx.GetProcessorContext (); + if (!ctx.GetSignal ().force_consolidation) + return; + tx.Execute ("INSERT INTO consolidation_derived(id) VALUES(1)"); + if (fail_once) + { + fail_once = false; + tx.Execute ("INSERT INTO deferred_child(parent_id) VALUES(999)"); + } + } + + mutable bool fail_once = true; + mutable ProcessorContext *captured = nullptr; +}; + +struct ConsolidationInsertOp : IOperation +{ + void + Execute (OperationContext &ctx, Transaction &tx) const override + { + if (ctx.GetSignal ().force_consolidation) + tx.Execute ("INSERT OR IGNORE INTO consolidation_derived(id) VALUES(1)"); + } +}; + +struct CustomRifReadWriteOp : IOperation +{ + explicit CustomRifReadWriteOp (double *observed_strength, + double *observed_suppression) + : observed_strength (observed_strength), + observed_suppression (observed_suppression) + { + } + + void + Execute (OperationContext &, Transaction &tx) const override + { + const auto rows = tx.Execute ( + "SELECT * FROM memories WHERE memory_id = 1"); + if (observed_strength) + *observed_strength + = std::any_cast (rows[0].at ("strength")); + if (observed_suppression) + *observed_suppression + = std::any_cast (rows[0].at ("suppression")); + tx.Execute ( + "UPDATE memories SET strength = strength + 0.1 WHERE memory_id = 1"); + } + + double *observed_strength = nullptr; + double *observed_suppression = nullptr; +}; + +struct CustomIndirectRifReadOp : IOperation +{ + explicit CustomIndirectRifReadOp (double *observed_strength) + : observed_strength (observed_strength) + { + } + + void + Execute (OperationContext &, Transaction &tx) const override + { + tx.Execute ( + "CREATE TEMP VIEW custom_memory_view AS SELECT * FROM memories"); + const auto rows = tx.Execute ( + "SELECT v.* FROM custom_memory_view v WHERE memory_id = 1"); + if (observed_strength) + *observed_strength + = std::any_cast (rows[0].at ("strength")); + } + + double *observed_strength = nullptr; +}; + +struct CustomMutationCacheProbeOp : IOperation +{ + CustomMutationCacheProbeOp (bool *fanout_current, bool *search_invalidated, + bool *supersession_invalidated) + : fanout_current (fanout_current), + search_invalidated (search_invalidated), + supersession_invalidated (supersession_invalidated) + { + } + + void + Execute (OperationContext &ctx, Transaction &tx) const override + { + auto &p_ctx = ctx.GetProcessorContext (); + const auto prior_sidecar = ExecutionCacheState (p_ctx); + REQUIRE (prior_sidecar); + prior_sidecar->supersession_eligibility.valid = true; + prior_sidecar->supersession_eligibility.activation_ts_by_target[999] + = 999; + tx.Execute ( + "INSERT INTO associations(source_memory_id, target_memory_id, " + "edge_type, weight, last_reinforced) " + "VALUES(1, 2, 'similar_to', 0.75, 2000)"); + const auto &fanout = operations::association_fanout_cache::Ensure ( + ctx.GetStore (), p_ctx); + if (fanout_current) + { + const auto it = fanout->out_by_source.find (1); + *fanout_current + = it != fanout->out_by_source.end () && !it->second.empty () + && it->second.front ().memory_id == 2; + } + if (search_invalidated) + *search_invalidated + = !operations::historical_surface_search_cache_internal::Find (p_ctx); + if (supersession_invalidated) + { + const auto sidecar = ExecutionCacheState (p_ctx); + *supersession_invalidated + = sidecar && sidecar.get () != prior_sidecar.get () + && !sidecar->supersession_eligibility + .activation_ts_by_target.contains (999); + } + } + + bool *fanout_current = nullptr; + bool *search_invalidated = nullptr; + bool *supersession_invalidated = nullptr; +}; + +struct CaptureAssociationSupersessionCoverageOp : IOperation +{ + explicit CaptureAssociationSupersessionCoverageOp (bool *covered) + : covered (covered) + { + } + + void + Execute (OperationContext &ctx, Transaction &) const override + { + const auto state + = operations::historical_surface_search_cache_internal::Find ( + ctx.GetProcessorContext ()); + if (covered) + *covered = state && state->supersession_entry_by_memory.contains (2) + && state->current_memory_index.contains (2); + } + + bool *covered = nullptr; +}; + +struct UpdateFirstWorkingSlotStrengthOp : IOperation +{ + explicit UpdateFirstWorkingSlotStrengthOp (double strength, + bool *updated, + ProcessorContext **captured) + : strength (strength), updated (updated), captured (captured) + { + } + + void + Execute (OperationContext &ctx, Transaction &) const override + { + auto &p_ctx = ctx.GetProcessorContext (); + if (captured) + *captured = &p_ctx; + if (p_ctx.wm_slots.empty ()) + return; + p_ctx.wm_slots.front ().strength = strength; + p_ctx.wm_slots.front ().metadata_dirty = true; + p_ctx.wm_slots_dirty = true; + if (updated) + *updated = true; + } + + double strength = 0.0; + bool *updated = nullptr; + ProcessorContext **captured = nullptr; +}; + struct RecordOrderOp : IOperation { explicit RecordOrderOp (std::vector *order, int id) @@ -59,6 +365,169 @@ struct RecordOrderOp : IOperation int id = 0; }; +struct CaptureCacheIdentityOp : IOperation +{ + explicit CaptureCacheIdentityOp (bool *retained) : retained (retained) {} + + void + Execute (OperationContext &ctx, Transaction & /*tx*/) const override + { + const auto &surface = ctx.GetProcessorContext ().retrieval_surface_cache; + ++call_count; + if (call_count == 1) + { + first_data = surface.data (); + first_size = surface.size (); + auto &processor_context = ctx.GetProcessorContext (); + auto &ids = processor_context.index_store["large/stable"]; + ids.reserve (4096); + for (long long id = 1; id <= 4096; ++id) + { + ids.push_back (id); + processor_context.index_reverse[id] = "large/stable"; + processor_context.procedural_store["large/stable"][id] = 0.5; + } + } + else if (retained) + { + *retained = first_data == surface.data () && first_size == surface.size (); + } + } + + bool *retained = nullptr; + mutable int call_count = 0; + mutable const ProcessorContext::RetrievalSurfaceEntry *first_data = nullptr; + mutable std::size_t first_size = 0; +}; + +struct ExerciseJournalAwareCommitFailureOp : IOperation +{ + explicit ExerciseJournalAwareCommitFailureOp (bool *restored) + : restored (restored) + { + } + + void + Execute (OperationContext &ctx, Transaction &tx) const override + { + auto &processor_context = ctx.GetProcessorContext (); + ++call_count; + if (call_count == 1) + { + processor_context.index_store["stable"] = { 11LL, 12LL }; + processor_context.index_reverse[11LL] = "stable"; + processor_context.procedural_store["stable"][11LL] = 0.75; + return; + } + if (call_count == 2) + { + processor_context.retrieval_surface_cache.clear (); + processor_context.retrieval_surface_index.clear (); + processor_context.retrieval_surface_embedding_index.clear (); + processor_context.association_fanout_cache = {}; + operations::execution_cache_sidecar_internal::Erase ( + processor_context); + operations::signal_record_rollback_internal:: + PreserveSparseIndexBeforeInsert ( + processor_context, "stable", 99LL); + operations::signal_record_rollback_internal:: + PreserveProceduralValueBeforeUpdate ( + processor_context, "stable", 11LL); + processor_context.index_store["stable"].push_back (99LL); + processor_context.index_reverse[99LL] = "stable"; + processor_context.procedural_store["stable"][11LL] = 0.0; + tx.Execute ("INSERT INTO deferred_child(parent_id) VALUES(?)", + { 999LL }); + return; + } + if (restored) + { + (void)operations::association_fanout_cache::Ensure ( + ctx.GetStore (), processor_context); + const auto sidecar = ExecutionCacheState (processor_context); + *restored + = processor_context.retrieval_surface_index.contains (41LL) + && processor_context.retrieval_surface_embedding_index.contains ( + 51LL) + && sidecar && sidecar->emotional_metadata.valid + && sidecar->emotional_metadata.rows_by_memory + .contains (41LL) + && sidecar->emotional_metadata + .memory_ids_by_embedding.at (51LL) + == std::vector { 41LL } + && processor_context.association_fanout_cache.valid + && processor_context.association_fanout_cache.in_by_target + .at (41LL).front ().memory_id + == 42LL + && sidecar->supersession_eligibility.valid + && sidecar->supersession_eligibility.activation_ts_by_target.at ( + 41LL) + == 1100LL + && processor_context.index_store.at ("stable") + == std::vector { 11LL, 12LL } + && processor_context.index_reverse.at (11LL) == "stable" + && processor_context.procedural_store.at ("stable").at (11LL) + == 0.75; + } + } + + bool *restored = nullptr; + mutable int call_count = 0; +}; + +struct ExerciseJournalAwareReadOnlyRollbackOp : IOperation +{ + explicit ExerciseJournalAwareReadOnlyRollbackOp (bool *restored) + : restored (restored) + { + } + + void + Execute (OperationContext &ctx, Transaction & /*tx*/) const override + { + auto &processor_context = ctx.GetProcessorContext (); + ++call_count; + if (call_count == 1) + { + processor_context.index_store["stable"] = { 7LL, 8LL }; + return; + } + if (call_count == 2) + { + processor_context.retrieval_surface_cache.clear (); + processor_context.retrieval_surface_index.clear (); + processor_context.retrieval_surface_embedding_index.clear (); + operations::execution_cache_sidecar_internal::Erase ( + processor_context); + operations::signal_record_rollback_internal:: + PreserveSparseIndexBeforeInsert ( + processor_context, "stable", 99LL); + processor_context.index_store["stable"].push_back (99LL); + processor_context.index_reverse[99LL] = "stable"; + return; + } + if (restored) + { + const auto sidecar = ExecutionCacheState (processor_context); + *restored + = processor_context.retrieval_surface_index.contains (41LL) + && processor_context.retrieval_surface_embedding_index.contains ( + 51LL) + && sidecar && sidecar->emotional_metadata.valid + && sidecar->emotional_metadata.rows_by_memory + .contains (41LL) + && sidecar->emotional_metadata + .memory_ids_by_embedding.at (51LL) + == std::vector { 41LL } + && processor_context.index_store.at ("stable") + == std::vector { 7LL, 8LL }; + } + } + + bool *restored = nullptr; + mutable int call_count = 0; +}; + struct CaptureAccumulatorCountOp : IOperation { explicit CaptureAccumulatorCountOp (std::size_t *count) : count (count) {} @@ -75,6 +544,30 @@ struct CaptureAccumulatorCountOp : IOperation std::size_t *count; }; +struct CaptureBaseLineageAcrossFailureOp : IOperation +{ + explicit CaptureBaseLineageAcrossFailureOp (long long *base_embedding_id) + : base_embedding_id (base_embedding_id) + { + } + + void + Execute (OperationContext &ctx, Transaction & /*tx*/) const override + { + ++call_count; + if (call_count == 2) + throw std::runtime_error ("force lineage rollback"); + if (base_embedding_id) + *base_embedding_id + = operations::historical_surface_search_cache_internal:: + BaseEmbeddingIdForMemory ( + ctx.GetProcessorContext (), 10LL, 0); + } + + long long *base_embedding_id = nullptr; + mutable int call_count = 0; +}; + struct ExerciseRollbackCacheRestoreOp : IOperation { ExerciseRollbackCacheRestoreOp (bool *retrieval_restored, @@ -102,6 +595,19 @@ struct ExerciseRollbackCacheRestoreOp : IOperation cache_only_entry.embedding = Eigen::VectorXf::Constant (256, 0.25f); processor_context.UpsertRetrievalSurface ( std::move (cache_only_entry)); + operations::emotional_metadata_cache_internal::Upsert ( + processor_context, + { 77LL, 88LL, 1500LL, true, 0.8, 0.7, 2.0, 3, 0.5 }); + const auto sidecar + = operations::execution_cache_sidecar_internal::Ensure ( + processor_context); + sidecar->emotional_fixed_point.valid = true; + sidecar->emotional_fixed_point.emotional_input_generation + = sidecar->emotional_metadata.cascade_input_generation; + sidecar->emotional_fixed_point.recent_window_ts = 1234LL; + sidecar->supersession_eligibility.valid = true; + sidecar->supersession_eligibility.activation_ts_by_target[41LL] + = 1100LL; processor_context.index_store["stable"] = { 11LL, 12LL }; processor_context.index_reverse[11LL] = "stable"; processor_context.procedural_store["stable"][11LL] = 0.75; @@ -112,6 +618,16 @@ struct ExerciseRollbackCacheRestoreOp : IOperation processor_context.retrieval_surface_cache.clear (); processor_context.retrieval_surface_index.clear (); processor_context.retrieval_surface_embedding_index.clear (); + const auto sidecar + = operations::execution_cache_sidecar_internal::Ensure ( + processor_context); + sidecar->emotional_metadata.rows_by_memory.clear (); + sidecar->emotional_metadata.source_query_order.clear (); + sidecar->emotional_fixed_point.valid = false; + sidecar->emotional_fixed_point.recent_window_ts = 9999LL; + sidecar->supersession_eligibility.valid = false; + sidecar->supersession_eligibility.activation_ts_by_target[41LL] + = 9999LL; processor_context.index_store["stable"] = { 99LL }; processor_context.index_reverse[11LL] = "mutated"; processor_context.procedural_store["stable"][11LL] = 0.0; @@ -120,6 +636,7 @@ struct ExerciseRollbackCacheRestoreOp : IOperation if (retrieval_restored) { + const auto sidecar = ExecutionCacheState (processor_context); *retrieval_restored = processor_context.retrieval_surface_index.contains (41LL) && processor_context.retrieval_surface_index.contains (77LL) @@ -129,7 +646,26 @@ struct ExerciseRollbackCacheRestoreOp : IOperation 88LL) && processor_context.retrieval_surface_cache.size () == 2 && processor_context.retrieval_surface_cache[0].memory_id == 41LL - && processor_context.retrieval_surface_cache[1].memory_id == 77LL; + && processor_context.retrieval_surface_cache[1].memory_id == 77LL + && sidecar && sidecar->emotional_metadata.valid + && sidecar->emotional_metadata.rows_by_memory + .contains (41LL) + && sidecar->emotional_metadata.rows_by_memory + .contains (77LL) + && sidecar->emotional_metadata + .source_query_order + == std::vector { 77LL } + && sidecar->emotional_fixed_point.valid + && sidecar->emotional_fixed_point + .emotional_input_generation + == sidecar->emotional_metadata.cascade_input_generation + && sidecar->emotional_fixed_point + .recent_window_ts + == 1234LL + && sidecar->supersession_eligibility.valid + && sidecar->supersession_eligibility.activation_ts_by_target.at ( + 41LL) + == 1100LL; } if (volatile_restored) { @@ -659,6 +1195,33 @@ struct ExerciseNestedDifferentSourceRollbackOp : IOperation mutable int outer_call_count = 0; }; +struct ExerciseNestedShadowTransactionOp : IOperation +{ + explicit ExerciseNestedShadowTransactionOp (bool throw_after_nested) + : throw_after_nested (throw_after_nested) + { + } + + void + Execute (OperationContext &ctx, Transaction &tx) const override + { + const auto &signal = ctx.GetSignal (); + tx.Execute ("INSERT INTO nested_shadow_markers(source_id) VALUES(?)", + { signal.source_id }); + if (signal.source_id == "inner-shadow") + return; + Signal nested = MakeBoundedShadowSignal ( + static_cast (signal.timestamp + 1), "inner-shadow", + "audio"); + processor->Process (nested); + if (throw_after_nested) + throw std::runtime_error ("force root rollback after nested commit"); + } + + SignalProcessor *processor = nullptr; + bool throw_after_nested = false; +}; + struct ExerciseThroughputRollbackOp : IOperation { explicit ExerciseThroughputRollbackOp (bool *restored_in) @@ -788,12 +1351,1259 @@ TEST_CASE ("SignalProcessor processes and flushes to SQLite", "[processor]") REQUIRE (std::any_cast (rows[0].at ("c")) == 1LL); } -TEST_CASE ("SignalProcessor executes pipeline in order", "[processor][order]") +TEST_CASE ("Bounded activation shadow is default-off and publishes Natural and " + "Durable at the shared post-commit edge", + "[processor][bounded_activation_shadow][lifecycle]") { - auto uniq = SQLiteStore::Create (":memory:"); - std::shared_ptr store (std::move (uniq)); + namespace shadow + = operations::bounded_activation_shadow_internal; + const auto baseline_registry = shadow::RegistrySizeForTest (); + { + cortext::testing::ScopedEnvVar disabled ( + "CORTEXT_BOUNDED_ACTIVATION_SHADOW"); + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + SignalProcessor::Config cfg; + cortext::testing::RequireEncoder (cfg); + auto root = std::make_unique ( + std::make_unique ()); + SignalProcessor processor (cfg, store, std::move (root)); + processor.Process (MakeBoundedShadowSignal (0)); + REQUIRE (shadow::RegistrySizeForTest () == baseline_registry); + } - SignalProcessor::Config cfg; + { + cortext::testing::ScopedEnvVar enabled ( + "CORTEXT_BOUNDED_ACTIVATION_SHADOW", "1"); + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + SignalProcessor::Config cfg; + cortext::testing::RequireEncoder (cfg); + auto root = std::make_unique ( + std::make_unique ()); + SignalProcessor processor (cfg, store, std::move (root)); + + auto natural = MakeBoundedShadowSignal (0, "source-a", "text"); + natural.retention = Retention::Natural; + const auto natural_output = processor.Process (natural); + REQUIRE (std::none_of ( + natural_output.operation_ms.begin (), natural_output.operation_ms.end (), + [] (const auto &entry) { + return entry.first.find ("bounded_activation_shadow") + != std::string::npos; + })); + auto snapshots = shadow::SnapshotsForTest (); + REQUIRE (snapshots.size () == baseline_registry + 1); + const auto first = snapshots.back (); + REQUIRE (first.available); + REQUIRE_FALSE (first.disabled); + REQUIRE (first.generation == 1); + REQUIRE (first.event_index == 1); + + auto durable = MakeBoundedShadowSignal (1, "source-b", "audio"); + durable.retention = Retention::Durable; + cortext::testing::SetSQLiteCheckpointFailureOnceForTest (); + processor.Process (durable); + snapshots = shadow::SnapshotsForTest (); + const auto second = snapshots.back (); + REQUIRE (second.generation == 2); + REQUIRE (second.event_index == 2); + REQUIRE_FALSE (second.disabled); + } + REQUIRE (shadow::RegistrySizeForTest () == baseline_registry); +} + +TEST_CASE ("Bounded activation shadow journals nested events until the root " + "canonical commit", + "[processor][bounded_activation_shadow][lifecycle][nested]") +{ + namespace shadow + = operations::bounded_activation_shadow_internal; + cortext::testing::ScopedEnvVar enabled ( + "CORTEXT_BOUNDED_ACTIVATION_SHADOW", "1"); + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + store->Execute ( + "CREATE TABLE nested_shadow_markers(" + "id INTEGER PRIMARY KEY, source_id TEXT NOT NULL)"); + SignalProcessor::Config cfg; + cortext::testing::RequireEncoder (cfg); + auto operation + = std::make_unique (false); + auto *operation_ptr = operation.get (); + auto root = std::make_unique (std::move (operation)); + SignalProcessor processor (cfg, store, std::move (root)); + operation_ptr->processor = &processor; + + processor.Process (MakeBoundedShadowSignal (0, "outer-shadow", "text")); + const auto rows = store->Execute ( + "SELECT COUNT(*) AS n FROM nested_shadow_markers"); + REQUIRE (std::any_cast (rows.front ().at ("n")) == 2); + const auto snapshots = shadow::SnapshotsForTest (); + REQUIRE (snapshots.size () == 1); + REQUIRE_FALSE (snapshots.front ().disabled); + REQUIRE (snapshots.front ().generation == 2); + REQUIRE (snapshots.front ().event_index == 2); +} + +TEST_CASE ("Bounded activation shadow discards nested events when the root " + "canonical transaction rolls back", + "[processor][bounded_activation_shadow][lifecycle][nested]") +{ + namespace shadow + = operations::bounded_activation_shadow_internal; + cortext::testing::ScopedEnvVar enabled ( + "CORTEXT_BOUNDED_ACTIVATION_SHADOW", "1"); + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + store->Execute ( + "CREATE TABLE nested_shadow_markers(" + "id INTEGER PRIMARY KEY, source_id TEXT NOT NULL)"); + SignalProcessor::Config cfg; + cortext::testing::RequireEncoder (cfg); + auto operation + = std::make_unique (true); + auto *operation_ptr = operation.get (); + auto root = std::make_unique (std::move (operation)); + SignalProcessor processor (cfg, store, std::move (root)); + operation_ptr->processor = &processor; + + REQUIRE_THROWS (processor.Process ( + MakeBoundedShadowSignal (0, "outer-shadow", "image"))); + const auto rows = store->Execute ( + "SELECT COUNT(*) AS n FROM nested_shadow_markers"); + REQUIRE (std::any_cast (rows.front ().at ("n")) == 0); + const auto snapshots = shadow::SnapshotsForTest (); + REQUIRE (snapshots.size () == 1); + REQUIRE_FALSE (snapshots.front ().disabled); + REQUIRE (snapshots.front ().generation == 0); + REQUIRE (snapshots.front ().event_index == 0); +} + +TEST_CASE ("Bounded activation shadow discards a root journal when snapshot " + "setup throws before execution", + "[processor][bounded_activation_shadow][lifecycle][failure]") +{ + namespace shadow + = operations::bounded_activation_shadow_internal; + cortext::testing::ScopedEnvVar enabled ( + "CORTEXT_BOUNDED_ACTIVATION_SHADOW", "1"); + const auto baseline_registry = shadow::RegistrySizeForTest (); + { + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + SignalProcessor::Config cfg; + cortext::testing::RequireEncoder (cfg); + bool restored = false; + auto pipeline = std::make_unique ( + std::make_unique (&restored)); + SignalProcessor processor ( + cfg, store, + operations::signal_record_rollback_internal::MarkJournalAware ( + std::move (pipeline))); + + processor.Process (MakeBoundedShadowSignal (0, "test")); + cortext::testing::SetSignalRecordSnapshotSetupThrowStageForTest (1); + REQUIRE_THROWS (processor.Process (MakeBoundedShadowSignal (1, "test"))); + auto snapshots = shadow::SnapshotsForTest (); + REQUIRE (snapshots.size () == baseline_registry + 1); + REQUIRE_FALSE (snapshots.back ().disabled); + REQUIRE (snapshots.back ().generation == 1); + REQUIRE (snapshots.back ().event_index == 1); + + processor.Process (MakeBoundedShadowSignal (2, "test")); + snapshots = shadow::SnapshotsForTest (); + REQUIRE_FALSE (snapshots.back ().disabled); + REQUIRE (snapshots.back ().generation == 2); + REQUIRE (snapshots.back ().event_index == 2); + REQUIRE (restored); + } + REQUIRE (shadow::RegistrySizeForTest () == baseline_registry); +} + +TEST_CASE ("Bounded activation shadow discards rollback and fails closed after " + "a post-commit publication fault", + "[processor][bounded_activation_shadow][rollback][failure]") +{ + namespace shadow + = operations::bounded_activation_shadow_internal; + cortext::testing::ScopedEnvVar enabled ( + "CORTEXT_BOUNDED_ACTIVATION_SHADOW", "1"); + const auto baseline_registry = shadow::RegistrySizeForTest (); + { + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + SignalProcessor::Config cfg; + cortext::testing::RequireEncoder (cfg); + auto root = std::make_unique ( + std::make_unique ()); + SignalProcessor processor (cfg, store, std::move (root)); + REQUIRE_THROWS (processor.Process (MakeBoundedShadowSignal (0))); + auto snapshots = shadow::SnapshotsForTest (); + REQUIRE (snapshots.size () == baseline_registry + 1); + REQUIRE (snapshots.back ().generation == 0); + REQUIRE (snapshots.back ().event_index == 0); + processor.Process (MakeBoundedShadowSignal (1)); + snapshots = shadow::SnapshotsForTest (); + REQUIRE (snapshots.back ().generation == 1); + REQUIRE (snapshots.back ().event_index == 1); + } + REQUIRE (shadow::RegistrySizeForTest () == baseline_registry); + + { + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + store->Execute ( + "CREATE TABLE shadow_commit_probe(id INTEGER PRIMARY KEY, v INTEGER)"); + SignalProcessor::Config cfg; + cortext::testing::RequireEncoder (cfg); + struct InsertProbe final : IOperation + { + void + Execute (OperationContext &, Transaction &tx) const override + { + tx.Execute ("INSERT INTO shadow_commit_probe(v) VALUES(1)"); + } + }; + auto root = std::make_unique ( + std::make_unique ()); + SignalProcessor processor (cfg, store, std::move (root)); + shadow::SetFailureStageForTest (2); + REQUIRE_NOTHROW (processor.Process (MakeBoundedShadowSignal (0))); + const auto rows + = store->Execute ("SELECT COUNT(*) AS n FROM shadow_commit_probe"); + REQUIRE (std::any_cast (rows[0].at ("n")) == 1); + const auto snapshots = shadow::SnapshotsForTest (); + REQUIRE (snapshots.size () == baseline_registry + 1); + REQUIRE (snapshots.back ().disabled); + REQUIRE (snapshots.back ().failure == shadow::Failure::PublishInjected); + REQUIRE (snapshots.back ().generation == 0); + } + REQUIRE (shadow::RegistrySizeForTest () == baseline_registry); +} + +TEST_CASE ("Bounded activation shadow isolates preparation cancellation and " + "persistent commit failures", + "[processor][bounded_activation_shadow][lifecycle][failure]") +{ + namespace shadow + = operations::bounded_activation_shadow_internal; + cortext::testing::ScopedEnvVar enabled ( + "CORTEXT_BOUNDED_ACTIVATION_SHADOW", "1"); + const auto baseline_registry = shadow::RegistrySizeForTest (); + + { + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + store->Execute ( + "CREATE TABLE shadow_prepare_probe(id INTEGER PRIMARY KEY, v INTEGER)"); + struct InsertPrepareProbe final : IOperation + { + void + Execute (OperationContext &, Transaction &tx) const override + { + tx.Execute ("INSERT INTO shadow_prepare_probe(v) VALUES(1)"); + } + }; + SignalProcessor::Config cfg; + cortext::testing::RequireEncoder (cfg); + auto root = std::make_unique ( + std::make_unique ()); + SignalProcessor processor (cfg, store, std::move (root)); + shadow::SetFailureStageForTest (1); + REQUIRE_NOTHROW (processor.Process (MakeBoundedShadowSignal (0))); + const auto rows + = store->Execute ("SELECT COUNT(*) AS n FROM shadow_prepare_probe"); + REQUIRE (std::any_cast (rows[0].at ("n")) == 1); + const auto snapshots = shadow::SnapshotsForTest (); + REQUIRE (snapshots.size () == baseline_registry + 1); + REQUIRE (snapshots.back ().disabled); + REQUIRE (snapshots.back ().failure == shadow::Failure::PrepareInjected); + REQUIRE (snapshots.back ().generation == 0); + } + REQUIRE (shadow::RegistrySizeForTest () == baseline_registry); + + { + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + SignalProcessor::Config cfg; + cortext::testing::RequireEncoder (cfg); + auto root = std::make_unique ( + std::make_unique ()); + SignalProcessor processor (cfg, store, std::move (root)); + REQUIRE_THROWS_AS (processor.Process (MakeBoundedShadowSignal (0)), + internal::CancellationError); + const auto snapshots = shadow::SnapshotsForTest (); + REQUIRE (snapshots.size () == baseline_registry + 1); + REQUIRE_FALSE (snapshots.back ().disabled); + REQUIRE (snapshots.back ().generation == 0); + REQUIRE (snapshots.back ().event_index == 0); + } + REQUIRE (shadow::RegistrySizeForTest () == baseline_registry); + + { + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + store->Execute ("PRAGMA foreign_keys = ON"); + store->Execute ("CREATE TABLE deferred_parent(id INTEGER PRIMARY KEY)"); + store->Execute ( + "CREATE TABLE deferred_child(" + "parent_id INTEGER REFERENCES deferred_parent(id) " + "DEFERRABLE INITIALLY DEFERRED)"); + SignalProcessor::Config cfg; + cortext::testing::RequireEncoder (cfg); + auto root = std::make_unique ( + std::make_unique ()); + SignalProcessor processor (cfg, store, std::move (root)); + REQUIRE_THROWS (processor.Process (MakeBoundedShadowSignal (0))); + const auto rows = store->Execute ( + "SELECT COUNT(*) AS n FROM deferred_child"); + REQUIRE (std::any_cast (rows[0].at ("n")) == 0); + const auto snapshots = shadow::SnapshotsForTest (); + REQUIRE (snapshots.size () == baseline_registry + 1); + REQUIRE_FALSE (snapshots.back ().disabled); + REQUIRE (snapshots.back ().generation == 0); + REQUIRE (snapshots.back ().event_index == 0); + } + REQUIRE (shadow::RegistrySizeForTest () == baseline_registry); +} + +TEST_CASE ("Bounded activation shadow rejects duplicate gap regression and " + "digest mismatch publication", + "[processor][bounded_activation_shadow][generation]") +{ + namespace shadow + = operations::bounded_activation_shadow_internal; + const auto make_state = [] { + auto state = std::make_shared ( + shadow::DeriveParameters (0.0, 0.0, 0.0)); + state->available = true; + return state; + }; + const auto signal = MakeBoundedShadowSignal (0); + + auto duplicate_state = make_state (); + auto first = shadow::Prepare (duplicate_state, signal); + REQUIRE (shadow::PublishAfterPersistentCommit (first).published); + auto duplicate = shadow::Prepare (duplicate_state, signal); + duplicate.generation = 1; + const auto duplicate_result + = shadow::PublishAfterPersistentCommit (duplicate); + REQUIRE (duplicate_result.disabled); + REQUIRE (duplicate_result.failure == shadow::Failure::DuplicateGeneration); + + auto gap_state = make_state (); + auto gap = shadow::Prepare (gap_state, signal); + gap.generation = 2; + const auto gap_result = shadow::PublishAfterPersistentCommit (gap); + REQUIRE (gap_result.disabled); + REQUIRE (gap_result.failure == shadow::Failure::GenerationGap); + + auto regression_state = make_state (); + regression_state->last_published_generation = 2; + auto regression = shadow::Prepare (regression_state, signal); + regression.generation = 1; + const auto regression_result + = shadow::PublishAfterPersistentCommit (regression); + REQUIRE (regression_result.disabled); + REQUIRE (regression_result.failure == shadow::Failure::GenerationRegression); + + auto digest_state = make_state (); + auto digest = shadow::Prepare (digest_state, signal); + digest.digest ^= 1; + const auto digest_result = shadow::PublishAfterPersistentCommit (digest); + REQUIRE (digest_result.disabled); + REQUIRE (digest_result.failure == shadow::Failure::DigestMismatch); +} + +TEST_CASE ("Bounded activation shadow mechanics and digest ignore source and " + "modality labels", + "[processor][bounded_activation_shadow][modality][source]") +{ + namespace shadow + = operations::bounded_activation_shadow_internal; + auto first = std::make_shared ( + shadow::DeriveParameters (0.0, 0.0, 0.0)); + auto second = std::make_shared ( + shadow::DeriveParameters (0.0, 0.0, 0.0)); + first->available = true; + second->available = true; + const std::array sources { + "source-a", "source-b", "source-c", "source-d" + }; + const std::array modalities { "text", "audio", "image" }; + for (std::uint64_t event = 0; event < 192; ++event) + { + auto control = MakeBoundedShadowSignal (event, "one-source", "text"); + auto mixed = MakeBoundedShadowSignal ( + event, sources[event % sources.size ()], + modalities[event % modalities.size ()]); + auto control_prepared = shadow::Prepare (first, control); + auto mixed_prepared = shadow::Prepare (second, mixed); + REQUIRE (control_prepared.recall_comparisons + == mixed_prepared.recall_comparisons); + REQUIRE (control_prepared.candidate_count + == mixed_prepared.candidate_count); + for (std::size_t candidate = 0; + candidate < control_prepared.candidate_count; ++candidate) + REQUIRE (control_prepared.candidate_identities[candidate] + == mixed_prepared.candidate_identities[candidate]); + const auto control_result + = shadow::PublishAfterPersistentCommit (control_prepared); + const auto mixed_result + = shadow::PublishAfterPersistentCommit (mixed_prepared); + REQUIRE (control_result.normal_comparisons + == mixed_result.normal_comparisons); + REQUIRE (control_result.consolidation_comparisons + == mixed_result.consolidation_comparisons); + REQUIRE (shadow::StateDigest (*first) == shadow::StateDigest (*second)); + } +} + +TEST_CASE ("Bounded activation shadow respects every FST-derived storage and " + "work envelope after capacity initialization", + "[processor][bounded_activation_shadow][bounds]") +{ + namespace shadow + = operations::bounded_activation_shadow_internal; + auto state = std::make_shared ( + shadow::DeriveParameters (0.5, 0.5, 0.5)); + state->available = true; + const auto initial_allocated_bytes = state->allocated_bytes; + for (std::uint64_t event = 0; event < 2048; ++event) + { + auto prepared + = shadow::Prepare (state, MakeBoundedShadowSignal (event)); + REQUIRE (prepared.valid); + REQUIRE (prepared.recall_comparisons + <= state->parameters.recall_comparison_bound); + const auto result = shadow::PublishAfterPersistentCommit (prepared); + REQUIRE (result.published); + REQUIRE (result.normal_comparisons + <= state->parameters.normal_comparison_bound); + REQUIRE (result.consolidation_comparisons + <= state->parameters.consolidation_comparison_bound); + REQUIRE_FALSE (state->disabled); + REQUIRE (state->allocated_bytes == initial_allocated_bytes); + REQUIRE (state->root_count <= state->parameters.roots); + REQUIRE (state->leaf_count <= state->parameters.leaf_capacity); + } + const auto snapshot = shadow::ReadSnapshot (*state); + REQUIRE (snapshot.generation == 2048); + REQUIRE (snapshot.metrics.normal_comparisons_max + <= snapshot.parameters.normal_comparison_bound); + REQUIRE (snapshot.metrics.recall_comparisons_max + <= snapshot.parameters.recall_comparison_bound); + REQUIRE (snapshot.metrics.consolidation_comparisons_max + <= snapshot.parameters.consolidation_comparison_bound); + REQUIRE (snapshot.metrics.allocation_after_initialization_count == 0); + REQUIRE (snapshot.parameters.fixed_embedding_slots + == snapshot.parameters.roots + snapshot.parameters.leaf_capacity + + snapshot.parameters.leaf_capacity + * snapshot.parameters.representatives_per_leaf); + REQUIRE (snapshot.parameters.fixed_neighbor_slots + == snapshot.parameters.leaf_capacity + * snapshot.parameters.neighbor_degree); +} + +TEST_CASE ("Bounded activation shadow FST formulas are fixed across all corner " + "and midpoint combinations", + "[processor][bounded_activation_shadow][bounds][fst]") +{ + namespace shadow + = operations::bounded_activation_shadow_internal; + for (const double focus : { 0.0, 0.5, 1.0 }) + for (const double sensitivity : { 0.0, 0.5, 1.0 }) + for (const double stability : { 0.0, 0.5, 1.0 }) + { + const auto parameters + = shadow::DeriveParameters (focus, sensitivity, stability); + REQUIRE (parameters.roots + == 8 + static_cast ( + std::lround (24 * sensitivity))); + REQUIRE (parameters.leaf_capacity + == 128 + static_cast ( + std::lround (512 * focus + 512 * stability))); + REQUIRE (parameters.children_per_root + == (parameters.leaf_capacity + parameters.roots - 1) + / parameters.roots); + REQUIRE (parameters.root_beam + == 1 + static_cast ( + std::lround (3 * sensitivity))); + REQUIRE (parameters.leaf_beam + == 2 + static_cast ( + std::lround (6 * focus))); + REQUIRE (parameters.representatives_per_leaf + == 8 + static_cast ( + std::lround (32 * focus))); + REQUIRE (parameters.neighbor_degree + == 4 + static_cast ( + std::lround (8 * sensitivity))); + REQUIRE (parameters.activated_leaves_per_consolidation + == 8 + static_cast ( + std::lround (24 * focus))); + REQUIRE (parameters.consolidation_interval + == 256 + static_cast ( + std::lround (512 * stability))); + REQUIRE (parameters.fixed_embedding_slots + == parameters.roots + parameters.leaf_capacity + + parameters.leaf_capacity + * parameters.representatives_per_leaf); + REQUIRE (parameters.fixed_neighbor_slots + == parameters.leaf_capacity + * parameters.neighbor_degree); + } +} + +TEST_CASE ("Bounded activation shadow restart is unavailable until explicit " + "linear-history rebuild and keeps that rebuild as a production " + "blocker", + "[processor][bounded_activation_shadow][restart]") +{ + namespace shadow + = operations::bounded_activation_shadow_internal; + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + cortext::testing::InitializeCoreSchema (*store); + for (long long index = 1; index <= 4; ++index) + { + std::vector embedding (256, 0.0F); + embedding[static_cast (index)] = 1.0F; + store->Execute ( + "INSERT INTO embeddings(embedding_id, embedding, created_at) " + "VALUES(?, ?, ?)", + { index, embedding, index }); + store->Execute ( + "INSERT INTO signals(signal_id, source_id, embedding_id, timestamp, " + "modality, created_at) VALUES(?, ?, ?, ?, ?, ?)", + { index, std::string ("source-a"), index, index, + std::string ("text"), index }); + } + + cortext::testing::ScopedEnvVar enabled ( + "CORTEXT_BOUNDED_ACTIVATION_SHADOW", "1"); + cortext::testing::ScopedEnvVar rebuild_disabled ( + "CORTEXT_BOUNDED_ACTIVATION_SHADOW_REBUILD"); + ProcessorContext first_context; + auto unavailable = shadow::Initialize (first_context, store.get (), + 0.5, 0.5, 0.5); + REQUIRE (unavailable); + REQUIRE_FALSE (unavailable->available); + REQUIRE (unavailable->restart_rebuild_required); + REQUIRE_FALSE ( + shadow::Prepare (unavailable, MakeBoundedShadowSignal (4)).valid); + shadow::Erase (first_context); + + { + cortext::testing::ScopedEnvVar rebuild_enabled ( + "CORTEXT_BOUNDED_ACTIVATION_SHADOW_REBUILD", "1"); + ProcessorContext rebuilt_context; + auto rebuilt = shadow::Initialize (rebuilt_context, store.get (), + 0.5, 0.5, 0.5); + REQUIRE (rebuilt); + REQUIRE (rebuilt->available); + REQUIRE_FALSE (rebuilt->restart_rebuild_required); + REQUIRE (rebuilt->last_published_generation == 4); + REQUIRE (rebuilt->metrics.restart_rows_visited == 4); + REQUIRE (rebuilt->metrics.restart_rebuild_linear_history); + REQUIRE_FALSE (rebuilt->metrics.restart_production_gate); + shadow::Erase (rebuilt_context); + } + + store->Execute ( + "INSERT INTO signals(signal_id, source_id, embedding_id, timestamp, " + "modality, created_at) VALUES(5, 'source-a', 999, 5, 'text', 5)"); + { + cortext::testing::ScopedEnvVar rebuild_enabled ( + "CORTEXT_BOUNDED_ACTIVATION_SHADOW_REBUILD", "1"); + ProcessorContext incomplete_context; + auto incomplete = shadow::Initialize (incomplete_context, store.get (), + 0.5, 0.5, 0.5); + REQUIRE (incomplete); + REQUIRE_FALSE (incomplete->available); + REQUIRE (incomplete->disabled); + REQUIRE (incomplete->failure == shadow::Failure::RebuildFailure); + shadow::Erase (incomplete_context); + } +} + +TEST_CASE ("SignalProcessor rebuilds the SQLite active epoch after a " + "post-commit publication failure without replay", + "[processor][rif][active_epoch][durable][failure]") +{ + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + cortext::testing::InitializeCoreSchema (*store); + store->Execute ( + "INSERT INTO memories(memory_id, source_id, kind, start_ts, n_signals, " + "modality, strength, suppression, suppression_ts, created_at) " + "VALUES(1, 'source-a', 'LONG_TERM', 1000, 1, 'text', " + "0.5, 0.5, 1000, 1000)"); + cortext::operations::rif_state_internal::RebuildFromMaterialized (*store); + + SignalProcessor::Config cfg; + cortext::testing::RequireEncoder (cfg); + auto root = std::make_unique ( + std::make_unique ()); + SignalProcessor processor ( + cfg, store, + operations::signal_record_rollback_internal:: + MarkEngineOwnedJournalAware (std::move (root))); + + Signal signal; + signal.embedding = Eigen::VectorXf::Zero (256); + signal.source_id = "source-a"; + signal.retention = Retention::Durable; + signal.timestamp = 2000; + cortext::testing::SetRifActiveEpochPublishFailureStageForTest (2); + const auto first = processor.Process (signal); + REQUIRE (first.operation_ms.at ( + "SignalProcessor.rif_epoch_publication_recovery_count") + == 1.0); + REQUIRE (first.operation_ms.contains ( + "SignalProcessor.sqlite_wal_checkpoint")); + + signal.timestamp = 3000; + const auto second = processor.Process (signal); + REQUIRE (second.operation_ms.at ( + "SignalProcessor.rif_epoch_publication_recovery_count") + == 0.0); + const auto rows = store->Execute ( + "SELECT strength, suppression, suppression_ts " + "FROM rif_effective_memories WHERE memory_id = 1"); + REQUIRE (rows.size () == 1); + REQUIRE (std::any_cast (rows[0].at ("strength")) + == Catch::Approx (0.595)); + REQUIRE (std::any_cast (rows[0].at ("suppression")) + == Catch::Approx (0.405)); + REQUIRE (std::any_cast (rows[0].at ("suppression_ts")) + == 3000); +} + +TEST_CASE ("SignalProcessor discards an unpublished RIF epoch on persistent " + "commit failure", + "[processor][rif][active_epoch][rollback][commit]") +{ + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + cortext::testing::InitializeCoreSchema (*store); + store->Execute ( + "INSERT INTO memories(memory_id, source_id, kind, start_ts, n_signals, " + "modality, strength, suppression, suppression_ts, created_at) " + "VALUES(1, 'source-a', 'LONG_TERM', 1000, 1, 'text', " + "0.5, 0.5, 1000, 1000)"); + cortext::operations::rif_state_internal::RebuildFromMaterialized (*store); + store->Execute ("CREATE TABLE deferred_parent(id INTEGER PRIMARY KEY)"); + store->Execute ( + "CREATE TABLE deferred_child(" + "parent_id INTEGER REFERENCES deferred_parent(id) " + "DEFERRABLE INITIALLY DEFERRED)"); + + SignalProcessor::Config cfg; + cortext::testing::RequireEncoder (cfg); + auto root = std::make_unique ( + std::make_unique ()); + SignalProcessor processor ( + cfg, store, + operations::signal_record_rollback_internal:: + MarkEngineOwnedJournalAware (std::move (root))); + Signal signal; + signal.embedding = Eigen::VectorXf::Zero (256); + signal.source_id = "source-a"; + signal.retention = Retention::Natural; + signal.timestamp = 2000; + REQUIRE_THROWS (processor.Process (signal)); + + auto rows = store->Execute ( + "SELECT strength, suppression, suppression_ts " + "FROM rif_effective_memories WHERE memory_id = 1"); + REQUIRE (std::any_cast (rows[0].at ("strength")) + == Catch::Approx (0.5)); + REQUIRE (std::any_cast (rows[0].at ("suppression")) + == Catch::Approx (0.5)); + REQUIRE (std::any_cast (rows[0].at ("suppression_ts")) + == 1000); + + const auto success = processor.Process (signal); + REQUIRE (success.operation_ms.at ( + "SignalProcessor.rif_epoch_publication_recovery_count") + == 0.0); + rows = store->Execute ( + "SELECT strength, suppression, suppression_ts " + "FROM rif_effective_memories WHERE memory_id = 1"); + REQUIRE (std::any_cast (rows[0].at ("strength")) + == Catch::Approx (0.55)); + REQUIRE (std::any_cast (rows[0].at ("suppression")) + == Catch::Approx (0.45)); + REQUIRE (std::any_cast (rows[0].at ("suppression_ts")) + == 2000); +} + +TEST_CASE ("RIF epoch retry preserves an ordinary committed event after " + "publication and recovery both fail", + "[processor][rif][active_epoch][durable][failure][retry]") +{ + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + cortext::testing::InitializeCoreSchema (*store); + store->Execute ( + "INSERT INTO memories(memory_id, source_id, kind, start_ts, n_signals, " + "modality, strength, suppression, suppression_ts, created_at) " + "VALUES(1, 'source-a', 'LONG_TERM', 1000, 1, 'text', " + "0.5, 0.5, 1000, 1000)"); + cortext::operations::rif_state_internal::RebuildFromMaterialized (*store); + + SignalProcessor::Config cfg; + cortext::testing::RequireEncoder (cfg); + auto root = std::make_unique ( + std::make_unique ()); + SignalProcessor processor ( + cfg, store, + operations::signal_record_rollback_internal:: + MarkEngineOwnedJournalAware (std::move (root))); + + Signal signal; + signal.embedding = Eigen::VectorXf::Zero (256); + signal.source_id = "source-a"; + signal.retention = Retention::Durable; + signal.timestamp = 2000; + cortext::testing::SetRifActiveEpochPublishFailureMaskForTest ( + (1U << 2U) | (1U << 4U)); + const auto failed_publication = processor.Process (signal); + REQUIRE (failed_publication.operation_ms.at ( + "SignalProcessor.rif_epoch_publication_recovery_count") + == 1.0); + REQUIRE (failed_publication.operation_ms.at ( + "SignalProcessor.rif_active_epoch_event_count") + == 1.0); + + signal.timestamp = 3000; + const auto retried = processor.Process (signal); + REQUIRE (retried.operation_ms.at ( + "SignalProcessor.rif_epoch_publication_recovery_count") + == 0.0); + REQUIRE (retried.operation_ms.at ( + "SignalProcessor.rif_active_epoch_event_count") + == 2.0); +} + +TEST_CASE ("Custom operation SQL observes and preserves effective lazy RIF " + "values", + "[processor][rif][active_epoch][custom_operation]") +{ + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + cortext::testing::InitializeCoreSchema (*store); + store->Execute ( + "INSERT INTO memories(memory_id, source_id, kind, start_ts, n_signals, " + "modality, strength, suppression, suppression_ts, created_at) " + "VALUES(1, 'source-a', 'LONG_TERM', 1000, 1, 'text', " + "0.5, 0.5, 1000, 1000)"); + cortext::operations::rif_state_internal::RebuildFromMaterialized (*store); + auto recovery_tx = store->Begin (); + cortext::operations::rif_state_internal::AdvanceRecovery ( + *recovery_tx, 2000, 10000.0); + recovery_tx->Commit (); + + double observed_strength = 0.0; + double observed_suppression = 0.0; + SignalProcessor::Config cfg; + cortext::testing::RequireEncoder (cfg); + auto root = std::make_unique ( + std::make_unique ( + &observed_strength, &observed_suppression)); + SignalProcessor processor (cfg, store, std::move (root)); + Signal signal; + signal.embedding = Eigen::VectorXf::Zero (256); + signal.source_id = "source-a"; + signal.retention = Retention::Natural; + signal.timestamp = 2000; + const auto first = processor.Process (signal); + REQUIRE (first.operation_ms.at ( + "SignalProcessor.rif_active_epoch_event_count") + == 1.0); + + REQUIRE (observed_strength == Catch::Approx (0.55)); + REQUIRE (observed_suppression == Catch::Approx (0.45)); + const auto rows = store->Execute ( + "SELECT strength, suppression FROM rif_effective_memories " + "WHERE memory_id = 1"); + REQUIRE (std::any_cast (rows[0].at ("strength")) + == Catch::Approx (0.65)); + REQUIRE (std::any_cast (rows[0].at ("suppression")) + == Catch::Approx (0.45)); + + signal.timestamp = 3000; + const auto second = processor.Process (signal); + REQUIRE (second.operation_ms.at ( + "SignalProcessor.rif_active_epoch_event_count") + == 2.0); +} + +TEST_CASE ("Custom operation indirect views observe effective lazy RIF values", + "[processor][rif][custom_operation][indirect]") +{ + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + cortext::testing::InitializeCoreSchema (*store); + store->Execute ( + "INSERT INTO memories(memory_id, source_id, kind, start_ts, n_signals, " + "modality, strength, suppression, suppression_ts, created_at) " + "VALUES(1, 'source-a', 'LONG_TERM', 1000, 1, 'text', " + "0.5, 0.5, 1000, 1000)"); + cortext::operations::rif_state_internal::RebuildFromMaterialized (*store); + auto recovery_tx = store->Begin (); + cortext::operations::rif_state_internal::AdvanceRecovery ( + *recovery_tx, 2000, 10000.0); + recovery_tx->Commit (); + + double observed_strength = 0.0; + SignalProcessor::Config cfg; + cortext::testing::RequireEncoder (cfg); + auto root = std::make_unique ( + std::make_unique (&observed_strength)); + SignalProcessor processor (cfg, store, std::move (root)); + Signal signal; + signal.embedding = Eigen::VectorXf::Zero (256); + signal.source_id = "source-a"; + signal.retention = Retention::Natural; + signal.timestamp = 2000; + processor.Process (signal); + REQUIRE (observed_strength == Catch::Approx (0.55)); +} + +TEST_CASE ("Custom mutations invalidate and rebuild every database cache", + "[processor][cache][custom_operation][mutation]") +{ + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + cortext::testing::InitializeCoreSchema (*store); + cortext::testing::SeedEmbeddingV2 ( + *store, 11, std::vector (256, 0.1f), 1000); + cortext::testing::SeedEmbeddingV2 ( + *store, 12, std::vector (256, 0.2f), 1000); + cortext::testing::SeedMemoryV2 ( + *store, 1, 11, "source-a", "LONG_TERM", 1.0, 1000); + cortext::testing::SeedMemoryV2 ( + *store, 2, 12, "source-b", "ASSOCIATION", 1.0, 1000); + + bool fanout_current = false; + bool search_invalidated = false; + bool supersession_invalidated = false; + SignalProcessor::Config cfg; + cortext::testing::RequireEncoder (cfg); + auto root = std::make_unique ( + std::make_unique ( + &fanout_current, &search_invalidated, &supersession_invalidated)); + SignalProcessor processor (cfg, store, std::move (root)); + Signal signal; + signal.embedding = Eigen::VectorXf::Zero (256); + signal.source_id = "source-c"; + signal.retention = Retention::Natural; + signal.timestamp = 2000; + processor.Process (signal); + + REQUIRE (fanout_current); + REQUIRE (search_invalidated); + REQUIRE (supersession_invalidated); +} + +TEST_CASE ("Processor supersession cache covers association-only SQL rows", + "[processor][cache][supersession][association]") +{ + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + cortext::testing::InitializeCoreSchema (*store); + cortext::testing::SeedEmbeddingV2 ( + *store, 12, std::vector (256, 0.2f), 1000); + cortext::testing::SeedMemoryV2 ( + *store, 2, 12, "source-b", "ASSOCIATION", 1.0, 1000); + const auto sql_rows = store->Execute ( + "SELECT m.memory_id FROM embeddings e " + "JOIN memories m ON m.embedding_id = e.embedding_id " + "WHERE m.kind IN ('LONG_TERM', 'ASSOCIATION')"); + REQUIRE (sql_rows.size () == 1); + + bool covered = false; + SignalProcessor::Config cfg; + cortext::testing::RequireEncoder (cfg); + auto root = std::make_unique ( + std::make_unique (&covered)); + SignalProcessor processor (cfg, store, std::move (root)); + Signal signal; + signal.embedding = Eigen::VectorXf::Zero (256); + signal.source_id = "source-c"; + signal.retention = Retention::Natural; + signal.timestamp = 2000; + processor.Process (signal); + REQUIRE (covered); +} + +TEST_CASE ("Processor calibrates staggered lazy RIF migration timestamps", + "[processor][rif][migration][equivalence]") +{ + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + cortext::store::DebugApplyCoreMigrationsThroughForTest (*store, 27); + store->Execute ( + "INSERT INTO memories(memory_id, source_id, kind, start_ts, n_signals, " + "modality, strength, suppression, suppression_ts, created_at) VALUES" + "(1, 'source-a', 'LONG_TERM', 1000, 1, 'text', 0.5, 0.5, 1000, 1000)," + "(2, 'source-b', 'ASSOCIATION', 1500, 1, 'image', 0.5, 0.5, 1500, 1500)"); + cortext::store::ApplyMigrations (*store); + + SignalProcessor::Config cfg; + cortext::testing::RequireEncoder (cfg); + auto root = std::make_unique ( + std::make_unique ()); + SignalProcessor processor ( + cfg, store, + operations::signal_record_rollback_internal:: + MarkEngineOwnedJournalAware (std::move (root))); + Signal signal; + signal.embedding = Eigen::VectorXf::Zero (256); + signal.source_id = "source-c"; + signal.retention = Retention::Natural; + signal.timestamp = 2000; + processor.Process (signal); + + const auto rows = store->Execute ( + "SELECT memory_id, strength, suppression FROM rif_effective_memories " + "ORDER BY memory_id"); + REQUIRE (rows.size () == 2); + REQUIRE (std::any_cast (rows[0].at ("strength")) + == Catch::Approx (0.55)); + REQUIRE (std::any_cast (rows[0].at ("suppression")) + == Catch::Approx (0.45)); + REQUIRE (std::any_cast (rows[1].at ("strength")) + == Catch::Approx (0.525)); + REQUIRE (std::any_cast (rows[1].at ("suppression")) + == Catch::Approx (0.475)); + + signal.timestamp = 3000; + processor.Process (signal); + const auto continued_rows = store->Execute ( + "SELECT memory_id, strength, suppression FROM rif_effective_memories " + "ORDER BY memory_id"); + REQUIRE (continued_rows.size () == 2); + REQUIRE (std::any_cast (continued_rows[0].at ("strength")) + == Catch::Approx (0.595)); + REQUIRE (std::any_cast (continued_rows[0].at ("suppression")) + == Catch::Approx (0.405)); + REQUIRE (std::any_cast (continued_rows[1].at ("strength")) + == Catch::Approx (0.5725)); + REQUIRE (std::any_cast (continued_rows[1].at ("suppression")) + == Catch::Approx (0.4275)); +} + +TEST_CASE ("Migrated active working slots reanchor persisted strength", + "[processor][rif][migration][working_memory][restart]") +{ + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + cortext::store::DebugApplyCoreMigrationsThroughForTest (*store, 27); + cortext::testing::SeedEmbeddingV2 ( + *store, 100, std::vector (256, 0.125f), 1000); + store->Execute ( + "INSERT INTO memories(memory_id, embedding_id, source_id, kind, " + "modality, start_ts, n_signals, strength, last_access, " + "suppression, suppression_ts, created_at) " + "VALUES(1, 100, 'working/source', 'WORKING', 'text', 1000, 1, " + "0.5, 1000, 0.5, 1000, 1000)"); + cortext::store::ApplyMigrations (*store); + + bool updated = false; + ProcessorContext *captured = nullptr; + SignalProcessor::Config cfg; + cortext::testing::RequireEncoder (cfg); + cfg.clock = std::make_shared (1000); + Signal signal; + signal.embedding = Eigen::VectorXf::Zero (256); + signal.source_id = "working/source"; + signal.timestamp = 1000; + { + auto root = std::make_unique ( + std::make_unique ( + 0.2, &updated, &captured)); + SignalProcessor processor (cfg, store, std::move (root)); + processor.Process (signal); + REQUIRE (updated); + REQUIRE (captured); + const auto sidecar = ExecutionCacheState (*captured); + REQUIRE (sidecar); + REQUIRE (sidecar->rif_active_epoch.database); + const auto epoch_rows = sidecar->rif_active_epoch.database->Execute ( + "SELECT recovery_total FROM active_state WHERE memory_id = 1"); + REQUIRE (epoch_rows.size () == 1); + REQUIRE (std::any_cast (epoch_rows[0].at ("recovery_total")) + == Catch::Approx (0.7)); + } + + auto effective = store->Execute ( + "SELECT strength, suppression FROM rif_effective_memories " + "WHERE memory_id = 1"); + REQUIRE (effective.size () == 1); + REQUIRE (std::any_cast (effective[0].at ("strength")) + == Catch::Approx (0.2)); + REQUIRE (std::any_cast (effective[0].at ("suppression")) + == Catch::Approx (0.5)); + + ProcessorContext *restarted_context = nullptr; + { + auto capture = std::make_unique (); + capture->context_address = &restarted_context; + auto root = std::make_unique ( + std::move (capture)); + SignalProcessor restarted (cfg, store, std::move (root)); + restarted.Process (signal); + REQUIRE (restarted_context); + const auto restarted_sidecar = ExecutionCacheState (*restarted_context); + REQUIRE (restarted_sidecar); + REQUIRE (restarted_sidecar->rif_active_epoch.database); + const auto restarted_rows + = restarted_sidecar->rif_active_epoch.database->Execute ( + "SELECT recovery_total FROM active_state WHERE memory_id = 1"); + REQUIRE (restarted_rows.size () == 1); + REQUIRE (std::any_cast ( + restarted_rows[0].at ("recovery_total")) + == Catch::Approx (0.7)); + } + + auto recovery_tx = store->Begin (); + cortext::operations::rif_state_internal::AdvanceRecovery ( + *recovery_tx, 2000, 10000.0); + recovery_tx->Commit (); + effective = store->Execute ( + "SELECT strength, suppression FROM rif_effective_memories " + "WHERE memory_id = 1"); + REQUIRE (std::any_cast (effective[0].at ("strength")) + == Catch::Approx (0.25)); + REQUIRE (std::any_cast (effective[0].at ("suppression")) + == Catch::Approx (0.45)); +} + +TEST_CASE ("RIF active epoch requires consolidation at its bound and resets " + "only after a successful maintenance commit", + "[processor][rif][active_epoch][bound]") +{ + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + SignalProcessor::Config cfg; + cortext::testing::RequireEncoder (cfg); + auto root = std::make_unique ( + std::make_unique ()); + SignalProcessor processor (cfg, store, std::move (root)); + + Signal signal; + signal.embedding = Eigen::VectorXf::Zero (256); + signal.source_id = "source-a"; + signal.retention = Retention::Natural; + signal.timestamp = 1000; + const auto at_limit = processor.Process (signal); + REQUIRE (at_limit.consolidation_state == ConsolidationState::Required); + REQUIRE (at_limit.operation_ms.at ( + "SignalProcessor.rif_active_epoch_event_count") + == 512.0); + + signal.timestamp = 2000; + const auto ignored = processor.Process (signal); + REQUIRE (ignored.consolidation_state == ConsolidationState::Required); + REQUIRE (ignored.operation_ms.at ( + "SignalProcessor.rif_active_epoch_event_count") + == 513.0); + + signal.force_consolidation = true; + signal.timestamp = 3000; + const auto reset = processor.Process (signal); + REQUIRE (reset.consolidation_state == ConsolidationState::None); + REQUIRE (reset.operation_ms.at ( + "SignalProcessor.rif_active_epoch_event_count") + == 0.0); + REQUIRE (reset.operation_ms.at ( + "SignalProcessor.rif_active_epoch_mutation_count") + == 0.0); + REQUIRE (reset.operation_ms.at ( + "SignalProcessor.rif_active_epoch_allocated_bytes") + < static_cast ( + operations::rif_active_epoch_cache_internal:: + kAllocatedByteLimit)); +} + +TEST_CASE ("Failed consolidation keeps the prior RIF epoch and a later " + "successful commit resets it exactly once", + "[processor][rif][active_epoch][consolidation][rollback]") +{ + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + store->Execute ("PRAGMA foreign_keys = ON"); + store->Execute ("CREATE TABLE consolidation_derived(id INTEGER PRIMARY KEY)"); + store->Execute ("CREATE TABLE deferred_parent(id INTEGER PRIMARY KEY)"); + store->Execute ( + "CREATE TABLE deferred_child(" + "parent_id INTEGER REFERENCES deferred_parent(id) " + "DEFERRABLE INITIALLY DEFERRED)"); + SignalProcessor::Config cfg; + cortext::testing::RequireEncoder (cfg); + auto operation = std::make_unique (); + auto *capturing_operation = operation.get (); + auto root = std::make_unique (std::move (operation)); + SignalProcessor processor (cfg, store, std::move (root)); + + Signal signal; + signal.embedding = Eigen::VectorXf::Zero (256); + signal.source_id = "source-a"; + signal.retention = Retention::Natural; + signal.timestamp = 1000; + const auto ordinary = processor.Process (signal); + REQUIRE (ordinary.operation_ms.at ( + "SignalProcessor.rif_active_epoch_event_count") + == 1.0); + + signal.force_consolidation = true; + signal.timestamp = 2000; + REQUIRE_THROWS (processor.Process (signal)); + REQUIRE (store->Execute ( + "SELECT COUNT(*) AS n FROM consolidation_derived")[0] + .at ("n") + .type () + == typeid (long long)); + REQUIRE (std::any_cast ( + store->Execute ( + "SELECT COUNT(*) AS n FROM consolidation_derived")[0] + .at ("n")) + == 0LL); + REQUIRE (capturing_operation->captured != nullptr); + const auto after_failure + = ExecutionCacheState (*capturing_operation->captured); + REQUIRE (after_failure); + REQUIRE (after_failure->rif_active_epoch.event_count == 1); + REQUIRE_FALSE (after_failure->rif_active_epoch.pending_rebuild); + + signal.timestamp = 3000; + const auto success = processor.Process (signal); + REQUIRE (success.operation_ms.at ( + "SignalProcessor.rif_active_epoch_event_count") + == 0.0); + REQUIRE (store->Execute ( + "SELECT COUNT(*) AS n FROM consolidation_derived")[0] + .at ("n") + .type () + == typeid (long long)); + REQUIRE (std::any_cast ( + store->Execute ( + "SELECT COUNT(*) AS n FROM consolidation_derived")[0] + .at ("n")) + == 1LL); +} + +TEST_CASE ("Post-commit consolidation epoch reset failure rebuilds without " + "replaying derived mutations", + "[processor][rif][active_epoch][consolidation][publication]") +{ + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + store->Execute ("CREATE TABLE consolidation_derived(id INTEGER PRIMARY KEY)"); + SignalProcessor::Config cfg; + cortext::testing::RequireEncoder (cfg); + auto root = std::make_unique ( + std::make_unique ()); + SignalProcessor processor (cfg, store, std::move (root)); + + Signal signal; + signal.embedding = Eigen::VectorXf::Zero (256); + signal.source_id = "source-a"; + signal.retention = Retention::Natural; + signal.force_consolidation = true; + signal.timestamp = 1000; + cortext::testing::SetRifActiveEpochPublishFailureStageForTest (3); + const auto output = processor.Process (signal); + REQUIRE (output.operation_ms.at ( + "SignalProcessor.rif_epoch_publication_recovery_count") + == 1.0); + REQUIRE (output.operation_ms.at ( + "SignalProcessor.rif_active_epoch_event_count") + == 0.0); + REQUIRE (store->Execute ( + "SELECT COUNT(*) AS n FROM consolidation_derived")[0] + .at ("n") + .type () + == typeid (long long)); + REQUIRE (std::any_cast ( + store->Execute ( + "SELECT COUNT(*) AS n FROM consolidation_derived")[0] + .at ("n")) + == 1LL); +} + +TEST_CASE ("RIF epoch retry preserves a committed consolidation reset after " + "publication and recovery both fail", + "[processor][rif][active_epoch][consolidation][failure][retry]") +{ + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + store->Execute ("CREATE TABLE consolidation_derived(id INTEGER PRIMARY KEY)"); + SignalProcessor::Config cfg; + cortext::testing::RequireEncoder (cfg); + auto root = std::make_unique ( + std::make_unique ()); + SignalProcessor processor (cfg, store, std::move (root)); + + Signal signal; + signal.embedding = Eigen::VectorXf::Zero (256); + signal.source_id = "source-a"; + signal.retention = Retention::Natural; + signal.timestamp = 1000; + const auto ordinary = processor.Process (signal); + REQUIRE (ordinary.operation_ms.at ( + "SignalProcessor.rif_active_epoch_event_count") + == 1.0); + + signal.force_consolidation = true; + signal.timestamp = 2000; + cortext::testing::SetRifActiveEpochPublishFailureMaskForTest ( + (1U << 3U) | (1U << 4U)); + const auto failed_publication = processor.Process (signal); + REQUIRE (failed_publication.operation_ms.at ( + "SignalProcessor.rif_epoch_publication_recovery_count") + == 1.0); + REQUIRE (failed_publication.operation_ms.at ( + "SignalProcessor.rif_active_epoch_event_count") + == 0.0); + + signal.force_consolidation = false; + signal.timestamp = 3000; + const auto retried = processor.Process (signal); + REQUIRE (retried.operation_ms.at ( + "SignalProcessor.rif_epoch_publication_recovery_count") + == 0.0); + REQUIRE (retried.operation_ms.at ( + "SignalProcessor.rif_active_epoch_event_count") + == 1.0); + REQUIRE (std::any_cast ( + store->Execute ( + "SELECT COUNT(*) AS n FROM consolidation_derived")[0] + .at ("n")) + == 1LL); +} + +TEST_CASE ("Durable checkpoint failure cannot replay the committed signal", + "[processor][rif][active_epoch][durable][barrier]") +{ + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + store->Execute ( + "CREATE TABLE t(id INTEGER PRIMARY KEY AUTOINCREMENT, v TEXT)"); + SignalProcessor::Config cfg; + cortext::testing::RequireEncoder (cfg); + auto root + = std::make_unique (std::make_unique ()); + SignalProcessor processor (cfg, store, std::move (root)); + + Signal signal; + signal.embedding = Eigen::VectorXf::Zero (256); + signal.source_id = "source-a"; + signal.retention = Retention::Durable; + signal.timestamp = 1000; + cortext::testing::SetSQLiteCheckpointFailureOnceForTest (); + const auto first = processor.Process (signal); + REQUIRE (first.operation_ms.at ( + "SignalProcessor.sqlite_wal_checkpoint_failure_count") + == 1.0); + REQUIRE (std::any_cast ( + store->Execute ("SELECT COUNT(*) AS n FROM t")[0].at ("n")) + == 1LL); + + signal.timestamp = 2000; + const auto second = processor.Process (signal); + REQUIRE (second.operation_ms.at ( + "SignalProcessor.sqlite_wal_checkpoint_failure_count") + == 0.0); + REQUIRE (std::any_cast ( + store->Execute ("SELECT COUNT(*) AS n FROM t")[0].at ("n")) + == 2LL); +} + +TEST_CASE ("SignalProcessor executes pipeline in order", "[processor][order]") +{ + auto uniq = SQLiteStore::Create (":memory:"); + std::shared_ptr store (std::move (uniq)); + + SignalProcessor::Config cfg; cortext::testing::RequireEncoder (cfg); std::vector order; @@ -854,7 +2664,6 @@ TEST_CASE ("SignalProcessor restores exact durable and cache-only state after " *store, 51LL, std::vector (256, 0.125f), 1000LL); cortext::testing::SeedMemoryV2 (*store, 41LL, 51LL, "seed/source", "LONG_TERM", 1.0, 1000LL); - SignalProcessor::Config cfg; cortext::testing::RequireEncoder (cfg); bool retrieval_restored = false; @@ -868,7 +2677,10 @@ TEST_CASE ("SignalProcessor restores exact durable and cache-only state after " signal.embedding = Eigen::VectorXf::Zero (256); signal.source_id = "test"; signal.timestamp = 2000; - proc.Process (signal); + const auto initial_output = proc.Process (signal); + REQUIRE (initial_output.operation_ms.at ( + "SignalProcessor.snapshot_full_cache_copy_count") + == 1.0); signal.timestamp = 3000; REQUIRE_THROWS (proc.Process (signal)); @@ -879,6 +2691,175 @@ TEST_CASE ("SignalProcessor restores exact durable and cache-only state after " REQUIRE (volatile_restored); } +TEST_CASE ("SignalProcessor rollback rebuild preserves original base lineage", + "[processor][rollback][cache][reconstruction][regression]") +{ + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + cortext::testing::InitializeCoreSchema (*store); + cortext::testing::SeedEmbeddingV2 ( + *store, 100LL, std::vector (256, 0.125f), 1000LL); + cortext::testing::SeedEmbeddingV2 ( + *store, 101LL, std::vector (256, 0.25f), 1100LL); + cortext::testing::SeedMemoryV2 (*store, 10LL, 100LL, "lineage/source", + "LONG_TERM", 1.0, 1000LL); + store->Execute ( + "INSERT INTO memory_reconstructions(" + "reconstruction_id, memory_id, embedding_id, created_at) " + "VALUES(1, 10, 101, 1100)"); + cortext::testing::SeedCurrentMemoryEmbeddingV2 (*store, 10LL, 101LL); + + long long observed_base = 0; + SignalProcessor::Config cfg; + cortext::testing::RequireEncoder (cfg); + auto root = std::make_unique ( + std::make_unique (&observed_base)); + SignalProcessor processor (cfg, store, std::move (root)); + Signal signal; + signal.embedding = Eigen::VectorXf::Zero (256); + signal.source_id = "test"; + signal.timestamp = 2000; + processor.Process (signal); + REQUIRE (observed_base == 100LL); + signal.timestamp = 3000; + REQUIRE_THROWS (processor.Process (signal)); + signal.timestamp = 4000; + processor.Process (signal); + REQUIRE (observed_base == 100LL); +} + +TEST_CASE ("SignalProcessor journal-aware writes retain DB cache ownership " + "without deep snapshots", + "[processor][rollback][cache][journal][scaling]") +{ + for (const auto retention : { Retention::Natural, Retention::Durable }) + { + auto uniq = SQLiteStore::Create (":memory:"); + std::shared_ptr store (std::move (uniq)); + cortext::testing::InitializeCoreSchema (*store); + for (long long id = 1; id <= 32; ++id) + { + cortext::testing::SeedEmbeddingV2 ( + *store, id, std::vector (256, 0.125f), 1000LL + id); + cortext::testing::SeedMemoryV2 ( + *store, id, id, "seed/source", "LONG_TERM", 1.0, + 1000LL + id); + } + + SignalProcessor::Config cfg; + cortext::testing::RequireEncoder (cfg); + bool retained = false; + auto pipeline = std::make_unique ( + std::make_unique (&retained)); + SignalProcessor processor ( + cfg, store, + operations::signal_record_rollback_internal::MarkJournalAware ( + std::move (pipeline))); + + Signal signal; + signal.embedding = Eigen::VectorXf::Zero (256); + signal.source_id = "test"; + signal.retention = retention; + signal.timestamp = 2000; + const auto first = processor.Process (signal); + REQUIRE (first.operation_ms.at ( + "SignalProcessor.snapshot_full_cache_copy_count") + == 0.0); + REQUIRE (first.operation_ms.at ( + "SignalProcessor.snapshot_cache_entry_copy_count") + == 0.0); + signal.timestamp = 3000; + const auto second = processor.Process (signal); + REQUIRE (second.operation_ms.at ( + "SignalProcessor.snapshot_cache_entry_copy_count") + == 0.0); + REQUIRE (retained); + } +} + +TEST_CASE ("SignalProcessor journal-aware commit failure rebuilds DB caches " + "and restores volatile stores", + "[processor][rollback][cache][journal][commit]") +{ + auto uniq = SQLiteStore::Create (":memory:"); + std::shared_ptr store (std::move (uniq)); + cortext::testing::InitializeCoreSchema (*store); + cortext::testing::SeedEmbeddingV2 ( + *store, 51LL, std::vector (256, 0.125f), 1000LL); + cortext::testing::SeedMemoryV2 (*store, 41LL, 51LL, "seed/source", + "LONG_TERM", 1.0, 1000LL); + cortext::testing::SeedEmbeddingV2 ( + *store, 52LL, std::vector (256, 0.25f), 1100LL); + cortext::testing::SeedMemoryV2 (*store, 42LL, 52LL, "seed/replacement", + "LONG_TERM", 1.0, 1100LL); + store->Execute ( + "INSERT INTO associations(source_memory_id, target_memory_id, " + "edge_type, weight, last_reinforced) " + "VALUES(42, 41, 'supersedes', 1.0, 1100)", {}); + store->Execute ("CREATE TABLE deferred_parent(id INTEGER PRIMARY KEY)", {}); + store->Execute ( + "CREATE TABLE deferred_child(" + "parent_id INTEGER REFERENCES deferred_parent(id) " + "DEFERRABLE INITIALLY DEFERRED)", + {}); + + SignalProcessor::Config cfg; + cortext::testing::RequireEncoder (cfg); + bool restored = false; + auto pipeline = std::make_unique ( + std::make_unique (&restored)); + SignalProcessor processor ( + cfg, store, + operations::signal_record_rollback_internal::MarkJournalAware ( + std::move (pipeline))); + + Signal signal; + signal.embedding = Eigen::VectorXf::Zero (256); + signal.source_id = "test"; + signal.timestamp = 2000; + processor.Process (signal); + signal.timestamp = 3000; + REQUIRE_THROWS (processor.Process (signal)); + signal.timestamp = 4000; + processor.Process (signal); + REQUIRE (restored); +} + +TEST_CASE ("SignalProcessor journal-aware read-only rollback rebuilds DB " + "caches and restores volatile stores", + "[processor][rollback][cache][journal][read_only]") +{ + auto uniq = SQLiteStore::Create (":memory:"); + std::shared_ptr store (std::move (uniq)); + cortext::testing::InitializeCoreSchema (*store); + cortext::testing::SeedEmbeddingV2 ( + *store, 51LL, std::vector (256, 0.125f), 1000LL); + cortext::testing::SeedMemoryV2 (*store, 41LL, 51LL, "seed/source", + "LONG_TERM", 1.0, 1000LL); + + SignalProcessor::Config cfg; + cortext::testing::RequireEncoder (cfg); + bool restored = false; + auto pipeline = std::make_unique ( + std::make_unique (&restored)); + SignalProcessor processor ( + cfg, store, + operations::signal_record_rollback_internal::MarkJournalAware ( + std::move (pipeline))); + + Signal signal; + signal.embedding = Eigen::VectorXf::Zero (256); + signal.source_id = "test"; + signal.timestamp = 2000; + processor.Process (signal); + signal.retention = Retention::Ephemeral; + signal.timestamp = 3000; + processor.Process (signal); + signal.retention = Retention::Natural; + signal.timestamp = 4000; + processor.Process (signal); + REQUIRE (restored); +} + TEST_CASE ("SignalProcessor rollback preserves pending Natural record storage", "[processor][rollback][accumulator][scaling]") { @@ -1261,13 +3242,17 @@ TEST_CASE ("SignalProcessor reuses lifecycle-owned exact rollback storage", == baseline_owner_count); } -TEST_CASE ("SignalProcessor erases historical cache when destroyed on another " +TEST_CASE ("SignalProcessor erases internal caches when destroyed on another " "thread", "[processor][cache][lifecycle]") { namespace cache = operations::historical_surface_search_cache_internal; + namespace execution_cache + = operations::execution_cache_sidecar_internal; const std::size_t baseline_size = cache::RegistrySizeForTest (); + const std::size_t baseline_execution_size + = execution_cache::RegistrySizeForTest (); auto uniq = SQLiteStore::Create (":memory:"); std::shared_ptr store (std::move (uniq)); cortext::testing::InitializeCoreSchema (*store); @@ -1283,11 +3268,15 @@ TEST_CASE ("SignalProcessor erases historical cache when destroyed on another " auto processor = std::make_unique ( cfg, store, std::move (pipeline)); REQUIRE (cache::RegistrySizeForTest () == baseline_size + 1); + REQUIRE (execution_cache::RegistrySizeForTest () + == baseline_execution_size + 1); std::thread teardown ( [owner = std::move (processor)] () mutable { owner.reset (); }); teardown.join (); REQUIRE (cache::RegistrySizeForTest () == baseline_size); + REQUIRE (execution_cache::RegistrySizeForTest () + == baseline_execution_size); } TEST_CASE ("SignalProcessor rebuilds historical cache after force commit", diff --git a/tests/state_persistence.test.cpp b/tests/state_persistence.test.cpp index 30341209..4a886b9f 100644 --- a/tests/state_persistence.test.cpp +++ b/tests/state_persistence.test.cpp @@ -1707,6 +1707,17 @@ TEST_CASE ("Flush restores working-memory persistence state after commit failure const std::size_t baseline_cache_count = cache::RegistrySizeForTest (); auto sqlite = std::shared_ptr (SQLiteStore::Create (":memory:")); cortext::testing::InitializeCoreSchema (*sqlite); + cortext::testing::SeedEmbeddingV2 ( + *sqlite, 100LL, std::vector (256, 0.125f), 900LL); + cortext::testing::SeedEmbeddingV2 ( + *sqlite, 101LL, std::vector (256, 0.25f), 950LL); + cortext::testing::SeedMemoryV2 (*sqlite, 10LL, 100LL, "lineage/source", + "LONG_TERM", 1.0, 900LL); + sqlite->Execute ( + "INSERT INTO memory_reconstructions(" + "reconstruction_id, memory_id, embedding_id, created_at) " + "VALUES(1, 10, 101, 950)"); + cortext::testing::SeedCurrentMemoryEmbeddingV2 (*sqlite, 10LL, 101LL); auto store = std::make_shared (sqlite); ProcessorContext *captured = nullptr; @@ -1723,6 +1734,7 @@ TEST_CASE ("Flush restores working-memory persistence state after commit failure REQUIRE (captured != nullptr); REQUIRE (cache::RegistrySizeForTest () == baseline_cache_count + 1); REQUIRE (cache::Find (*captured) != nullptr); + REQUIRE (cache::BaseEmbeddingIdForMemory (*captured, 10LL, 0) == 100LL); ProcessorContext::WMSlot slot; slot.embedding = signal.embedding; @@ -1748,6 +1760,7 @@ TEST_CASE ("Flush restores working-memory persistence state after commit failure REQUIRE (captured->wm_slots_dirty); REQUIRE (cache::RegistrySizeForTest () == baseline_cache_count + 1); REQUIRE (cache::Find (*captured) != nullptr); + REQUIRE (cache::BaseEmbeddingIdForMemory (*captured, 10LL, 0) == 100LL); signal.timestamp = 2000; REQUIRE_NOTHROW (processor.Process (signal)); diff --git a/tests/store.test.cpp b/tests/store.test.cpp index bbdc9fa4..33da67a1 100644 --- a/tests/store.test.cpp +++ b/tests/store.test.cpp @@ -6,10 +6,13 @@ #include #include #include +#include "../src/operations/consolidation_epoch_profile_internal.hpp" +#include "../src/store/mutation_audit_internal.hpp" #include #include #include #include +#include #include #include @@ -20,6 +23,16 @@ class UnsupportedBindParam { }; +std::set +MutationKeys (const std::vector &items) +{ + std::set keys; + for (const auto &item : items) + keys.insert (std::to_string (static_cast (item.kind)) + ":" + + item.table + ":" + item.logical_identity); + return keys; +} + // Helper function to create a temporary database file std::string create_temp_db () @@ -39,6 +52,237 @@ TEST_CASE ("SQLiteStore rejects bind parameter count mismatches", Catch::Matchers::ContainsSubstring ("parameter count mismatch")); } +TEST_CASE ("SQLite mutation audit publishes committed logical identities", + "[store][profiling][transaction]") +{ + cortext::testing::ScopedEnvVar profile_epoch ( + "CORTEXT_PROFILE_CONSOLIDATION_EPOCH", "1"); + auto store = cortext::SQLiteStore::Create (":memory:"); + store->Execute ("CREATE TABLE memories(memory_id INTEGER PRIMARY KEY, value TEXT)"); + store->Execute ( + "CREATE TABLE associations(source_memory_id INTEGER NOT NULL, " + "target_memory_id INTEGER NOT NULL, edge_type TEXT NOT NULL, " + "weight REAL NOT NULL, PRIMARY KEY(source_memory_id, target_memory_id, edge_type))"); + store->Execute ( + "CREATE VIRTUAL TABLE embeddings USING vec0(" + "embedding_id INTEGER PRIMARY KEY, embedding float[256], +created_at integer)"); + store->Execute ( + "CREATE VIRTUAL TABLE current_memory_embeddings USING vec0(" + "memory_id INTEGER PRIMARY KEY, embedding_id INTEGER, " + "embedding float[256])"); + store->Execute ( + "CREATE TABLE memory_reconstructions(" + "reconstruction_id INTEGER PRIMARY KEY, value TEXT)"); + cortext::internal::ResetSQLiteMutationAudit (store.get ()); + + { + auto transaction = store->Begin (); + transaction->Execute ("INSERT INTO memories VALUES(1, 'committed')"); + transaction->Execute ( + "INSERT INTO associations VALUES(1, 2, 'related', 0.5)"); + transaction->Execute ( + "INSERT INTO embeddings(embedding_id, embedding, created_at) " + "VALUES(7, ?, 100)", { std::vector (256, 0.25F) }); + transaction->Commit (); + } + auto committed_batch + = cortext::internal::ConsumeSQLiteCommittedMutations (store.get ()); + REQUIRE (committed_batch.trigger_journal_ready); + auto committed = committed_batch.committed_hook_identities; + std::set logical_identities; + for (const auto &mutation : committed) + logical_identities.insert (mutation.logical_identity); + CAPTURE (logical_identities); + REQUIRE (logical_identities.size () == 3); + REQUIRE (logical_identities.contains ("memory:1:1")); + REQUIRE (logical_identities.contains ("association:1:11:27:related")); + REQUIRE (logical_identities.contains ("embeddings:1:7")); + REQUIRE ( + cortext::operations::consolidation_epoch_profile_internal:: + DistinctTypedMutationCount (committed) + == 3); + REQUIRE ( + cortext::operations::consolidation_epoch_profile_internal:: + DistinctTypedMutationCount ( + committed_batch.committed_trigger_identities) + == 3); + REQUIRE (MutationKeys (committed_batch.committed_hook_identities) + == MutationKeys (committed_batch.committed_trigger_identities)); + + { + auto transaction = store->Begin (); + transaction->Execute ( + "INSERT OR REPLACE INTO associations VALUES(1, 2, 'related', 0.75)"); + transaction->Commit (); + } + committed_batch + = cortext::internal::ConsumeSQLiteCommittedMutations (store.get ()); + committed = committed_batch.committed_hook_identities; + logical_identities.clear (); + for (const auto &mutation : committed) + logical_identities.insert (mutation.logical_identity); + REQUIRE (logical_identities.size () == 1); + REQUIRE (logical_identities.contains ("association:1:11:27:related")); + REQUIRE ( + cortext::operations::consolidation_epoch_profile_internal:: + DistinctTypedMutationCount (committed) + == 1); + REQUIRE ( + cortext::operations::consolidation_epoch_profile_internal:: + DistinctTypedMutationCount ( + committed_batch.committed_trigger_identities) + == 1); + REQUIRE (MutationKeys (committed_batch.committed_hook_identities) + == MutationKeys (committed_batch.committed_trigger_identities)); + + { + auto transaction = store->Begin (); + transaction->Execute ("DELETE FROM embeddings WHERE embedding_id = 7"); + transaction->Commit (); + } + committed_batch + = cortext::internal::ConsumeSQLiteCommittedMutations (store.get ()); + REQUIRE (committed_batch.trigger_journal_ready); + REQUIRE (MutationKeys (committed_batch.committed_hook_identities) + == MutationKeys (committed_batch.committed_trigger_identities)); + REQUIRE (committed_batch.committed_hook_identities.size () == 1); + REQUIRE (committed_batch.committed_hook_identities[0].logical_identity + == "embeddings:1:7"); + + { + auto transaction = store->Begin (); + transaction->Execute ( + "INSERT INTO embeddings(embedding_id, embedding, created_at) " + "VALUES(7, ?, 102)", { std::vector (256, 0.75F) }); + transaction->Commit (); + } + committed_batch + = cortext::internal::ConsumeSQLiteCommittedMutations (store.get ()); + REQUIRE (committed_batch.trigger_journal_ready); + REQUIRE ( + cortext::operations::consolidation_epoch_profile_internal:: + DistinctTypedMutationCount ( + committed_batch.committed_hook_identities) + == 1); + REQUIRE ( + cortext::operations::consolidation_epoch_profile_internal:: + DistinctTypedMutationCount ( + committed_batch.committed_trigger_identities) + == 1); + REQUIRE (committed_batch.committed_hook_identities[0].logical_identity + == "embeddings:1:7"); + REQUIRE (MutationKeys (committed_batch.committed_hook_identities) + == MutationKeys (committed_batch.committed_trigger_identities)); + + { + auto transaction = store->Begin (); + transaction->Execute ("INSERT INTO memories VALUES(2, 'rolled back')"); + transaction->Execute ( + "INSERT INTO embeddings(embedding_id, embedding, created_at) " + "VALUES(8, ?, 101)", { std::vector (256, 0.5F) }); + transaction->Rollback (); + } + committed_batch + = cortext::internal::ConsumeSQLiteCommittedMutations (store.get ()); + REQUIRE (committed_batch.committed_hook_identities.empty ()); + REQUIRE (committed_batch.committed_trigger_identities.empty ()); + + { + auto outer = store->Begin (); + outer->Execute ("INSERT INTO memories VALUES(2, 'outer')"); + auto inner = outer->Begin (); + inner->Execute ("INSERT INTO memories VALUES(3, 'inner')"); + inner->Rollback (); + outer->Commit (); + } + committed_batch + = cortext::internal::ConsumeSQLiteCommittedMutations (store.get ()); + committed = committed_batch.committed_hook_identities; + REQUIRE (committed.size () == 1); + REQUIRE (committed[0].logical_identity == "memory:1:2"); + REQUIRE (MutationKeys (committed_batch.committed_hook_identities) + == MutationKeys (committed_batch.committed_trigger_identities)); +} + +TEST_CASE ("SQLite mutation audit stays absent when profiling is disabled", + "[store][profiling][default]") +{ + auto store = cortext::SQLiteStore::Create (":memory:"); + cortext::internal::ResetSQLiteMutationAudit (store.get ()); + const auto objects = store->Execute ( + "SELECT name FROM sqlite_temp_master " + "WHERE name LIKE 'cortext_mutation_%'"); + REQUIRE (objects.empty ()); + const auto batch + = cortext::internal::ConsumeSQLiteCommittedMutations (store.get ()); + REQUIRE_FALSE (batch.trigger_journal_ready); + REQUIRE (batch.committed_hook_identities.empty ()); + REQUIRE (batch.committed_trigger_identities.empty ()); +} + +TEST_CASE ("Consolidation epoch independently verifies its typed mutation union", + "[store][profiling][consolidation]") +{ + cortext::testing::ScopedEnvVar profile_epoch ( + "CORTEXT_PROFILE_CONSOLIDATION_EPOCH", "1"); + cortext::ProcessorContext context; + using cortext::internal::SQLiteMutationIdentity; + using cortext::internal::SQLiteMutationAuditBatch; + using cortext::internal::SQLiteMutationKind; + namespace epoch + = cortext::operations::consolidation_epoch_profile_internal; + const std::vector initial { + SQLiteMutationIdentity { SQLiteMutationKind::Memory, "memories", + "memory:1:1" }, + SQLiteMutationIdentity { SQLiteMutationKind::Association, "associations", + "association:1:11:27:related" }, + SQLiteMutationIdentity { SQLiteMutationKind::Index, "embeddings", + "embeddings:1:7" }, + }; + const std::vector closing { + SQLiteMutationIdentity { SQLiteMutationKind::Association, "associations", + "association:1:11:27:related" }, + SQLiteMutationIdentity { SQLiteMutationKind::Index, + "current_memory_embeddings", + "current_memory_embeddings:1:1" }, + }; + epoch::Reset (context); + epoch::ObserveEvent ( + context, SQLiteMutationAuditBatch { initial, initial, true }); + const auto seal = epoch::Seal ( + context, SQLiteMutationAuditBatch { closing, closing, true }); + REQUIRE (seal.sealed_epoch_mutation_count == 4); + REQUIRE (seal.sealed_mutation_identity_count == 4); + REQUIRE (seal.sealed_mutation_identity_verified); + REQUIRE (seal.post.consolidation_dirty_memory_count == 0); + REQUIRE (seal.post.consolidation_dirty_association_count == 0); + REQUIRE (seal.post.consolidation_dirty_index_count == 0); + epoch::Erase (context); + + cortext::ProcessorContext omitted_context; + epoch::Reset (omitted_context); + const auto omitted = epoch::Seal ( + omitted_context, SQLiteMutationAuditBatch { {}, { initial[0] }, true }); + REQUIRE_FALSE (omitted.sealed_mutation_identity_verified); + REQUIRE (omitted.sealed_epoch_mutation_count == 1); + REQUIRE (omitted.sealed_mutation_identity_count == 0); + epoch::Erase (omitted_context); + + cortext::ProcessorContext substituted_context; + epoch::Reset (substituted_context); + const std::vector substituted_hook { + SQLiteMutationIdentity { SQLiteMutationKind::Memory, "memories", + "memory:1:2" }, + }; + const auto substituted = epoch::Seal ( + substituted_context, + SQLiteMutationAuditBatch { substituted_hook, { initial[0] }, true }); + REQUIRE_FALSE (substituted.sealed_mutation_identity_verified); + REQUIRE (substituted.sealed_epoch_mutation_count + == substituted.sealed_mutation_identity_count); + epoch::Erase (substituted_context); +} + // Helper function to clean up temporary database file void cleanup_temp_db (const std::string &db_path) diff --git a/third_party/sqlite/CMakeLists.txt b/third_party/sqlite/CMakeLists.txt index 17d436c6..17a5963e 100644 --- a/third_party/sqlite/CMakeLists.txt +++ b/third_party/sqlite/CMakeLists.txt @@ -173,7 +173,13 @@ target_include_directories(sqlite3 target_compile_definitions(sqlite3 PRIVATE SQLITE_THREADSAFE=1 SQLITE_ENABLE_JSON1 + SQLITE_ENABLE_MATH_FUNCTIONS + SQLITE_ENABLE_PREUPDATE_HOOK=1 ) +target_compile_definitions(sqlite3 PUBLIC SQLITE_ENABLE_PREUPDATE_HOOK=1) +if(UNIX AND NOT APPLE AND NOT EMSCRIPTEN) + target_link_libraries(sqlite3 PUBLIC m) +endif() # Suppress warnings for third-party code if(MSVC) diff --git a/tools/audit_storage_cost_profile.py b/tools/audit_storage_cost_profile.py index 41f543a4..f2c24a41 100755 --- a/tools/audit_storage_cost_profile.py +++ b/tools/audit_storage_cost_profile.py @@ -18,11 +18,203 @@ "cortext::operations::MemoryStorage", "MemoryStorage.supersession_edges", ) +ATTRIBUTION_PREFIXES = ( + "cortext::operations::", + "SignalProcessor.", +) +DETAILED_PREFIXES = ( + "GraphRetrieve.", + "Competition.", + "MemoryStorage.", + "EmotionalCascade.", +) LOGICAL_TABLES = { "memories": "memory_id", "associations": "source_memory_id, target_memory_id, edge_type", "signals": "signal_id", } +REQUIRED_WORK_COUNTERS = ( + "retrieval_suppression_id_count", + "predictive_id_count", + "rollback_full_cache_copy_count", + "rollback_cache_entry_copy_count", + "graph_candidate_count", + "graph_exact_comparison_count", + "graph_cache_rebuild_count", + "graph_rows_visited", + "competition_candidate_count", + "competition_rows_visited", + "competition_rows_touched", + "supersession_current_candidate_count", + "supersession_historical_candidate_count", + "supersession_rows_visited", + "emotional_source_count", + "emotional_neighbor_count", + "emotional_update_count", +) +REQUIRED_CONSOLIDATION_EPOCH_COUNTERS = ( + "accumulator_signal_count", + "working_memory_pending_signal_count", + "consolidation_dirty_memory_count", + "consolidation_dirty_association_count", + "consolidation_dirty_index_count", +) +ACTIVE_EPOCH_LIMITS = { + "event_count": 512, + "mutation_count": 32768, + "allocated_bytes": 64 * 1024 * 1024, +} +COUNTER_ACTIVITY_OPERATIONS = { + "retrieval_suppression_id_count": ( + "Competition.rif_recovery_active_sql", + ), + "predictive_id_count": ("Predictive.decay_active_sql",), + "rollback_full_cache_copy_count": ( + "SignalProcessor.snapshot_full_cache_copy", + ), + "rollback_cache_entry_copy_count": ( + "SignalProcessor.snapshot_cache_entry_copy", + ), + "graph_candidate_count": ("GraphRetrieve.total",), + "graph_exact_comparison_count": ( + "GraphRetrieve.seed_cache_family_compare", + ), + "graph_cache_rebuild_count": ("GraphRetrieve.seed_knn_cache_rebuild",), + "graph_rows_visited": ("GraphRetrieve.seed_cache_distance",), + "competition_candidate_count": ("Competition.score_candidates",), + "competition_rows_visited": ("Competition.rif_recovery_active_sql",), + "competition_rows_touched": ("Competition.rif_recovery_active_sql",), + "supersession_current_candidate_count": ( + "MemoryStorage.supersession_current_candidate_execution_count", + ), + "supersession_historical_candidate_count": ( + "MemoryStorage.supersession_historical_candidate_execution_count", + ), + "supersession_rows_visited": ( + "MemoryStorage.supersession_candidate_load", + ), + "emotional_source_count": ("EmotionalCascade.source_execution_count",), + "emotional_neighbor_count": ( + "EmotionalCascade.neighbor_execution_count", + ), + "emotional_update_count": ("EmotionalCascade.update_execution_count",), +} +COUNTER_SOURCE_OPERATIONS = { + "retrieval_suppression_id_count": ( + "SignalProcessor.retrieval_suppression_id_count", + ), + "predictive_id_count": ("SignalProcessor.predictive_id_count",), + "rollback_full_cache_copy_count": ( + "SignalProcessor.snapshot_full_cache_copy_count", + ), + "rollback_cache_entry_copy_count": ( + "SignalProcessor.snapshot_cache_entry_copy_count", + ), + "graph_candidate_count": ("GraphRetrieve.candidate_count",), + "graph_exact_comparison_count": ( + "GraphRetrieve.family_exact_comparison_count", + ), + "graph_cache_rebuild_count": ("GraphRetrieve.cache_rebuild_count",), + "graph_rows_visited": ("GraphRetrieve.rows_visited",), + "competition_candidate_count": ("Competition.candidate_count",), + "competition_rows_visited": ("Competition.rows_visited",), + "competition_rows_touched": ("Competition.rows_touched",), + "supersession_current_candidate_count": ( + "MemoryStorage.supersession_current_candidate_count", + ), + "supersession_historical_candidate_count": ( + "MemoryStorage.supersession_historical_candidate_count", + ), + "supersession_rows_visited": ( + "MemoryStorage.supersession_current_rows_visited", + "MemoryStorage.supersession_historical_rows_visited", + ), + "emotional_source_count": ("EmotionalCascade.source_count",), + "emotional_neighbor_count": ("EmotionalCascade.neighbor_count",), + "emotional_update_count": ("EmotionalCascade.update_count",), +} +OTHER_DIAGNOSTIC_OPERATION_KEYS = { + "GraphRetrieve.seed_cache_distance_rows", + "GraphRetrieve.seed_cache_eligibility_rows", + "GraphRetrieve.seed_cache_ranked_rows", + "GraphRetrieve.seed_cache_selected_rows", + "GraphRetrieve.seed_cache_rows", + "SignalProcessor.rif_active_epoch_event_count", + "SignalProcessor.rif_active_epoch_mutation_count", + "SignalProcessor.rif_active_epoch_allocated_bytes", + "SignalProcessor.rif_active_epoch_required", + "SignalProcessor.rif_epoch_publication_rebuild_count", + "SignalProcessor.rif_epoch_publication_recovery_count", + "SignalProcessor.sqlite_wal_checkpoint_failure_count", + "MemoryStorage.supersession_current_rows_visited", + "MemoryStorage.supersession_historical_rows_visited", + "MemoryStorage.supersession_sql_fallback_count", +} + + +def diagnostic_operation_keys() -> set[str]: + return ( + {name for names in COUNTER_SOURCE_OPERATIONS.values() for name in names} + | { + name + for names in COUNTER_ACTIVITY_OPERATIONS.values() + for name in names + if name.endswith("_count") or name.endswith("_activity") + } + | OTHER_DIAGNOSTIC_OPERATION_KEYS + ) + + +def is_duration_operation(name: str) -> bool: + return ( + name not in diagnostic_operation_keys() + and not name.startswith("ConsolidationEpoch.") + ) +MINIMUM_POST_WARMUP_WINDOWS = 10 +PLATEAU_MINIMUM_WINDOWS = 6 +PROCESS_HALF_RATIO_RANGE = (0.90, 1.10) +THROUGHPUT_HALF_RATIO_RANGE = (0.90, 1.10) +RELATIVE_THEIL_SEN_MAX = 0.02 +RELATIVE_BOOTSTRAP_UPPER_MAX = 0.05 +OPERATION_HALF_RATIO_MAX = 1.05 +OPERATION_MINIMUM_MEAN_MS = 0.05 +WORK_COUNTER_HALF_RATIO_MAX = 1.10 +AUTHORITATIVE_ROW_GROWTH_RATIO_MIN = 1.05 +BOOTSTRAP_REPETITIONS = 2000 +PLATEAU_HEIGHT_REFERENCES = { + "natural": { + "tail_process_mean_ms": 10.0757183124, + "ceiling_multiplier": 1.10, + "source_profile_sha256": ( + "55ed3de1d59c307610de1fd8a7e30821f46a87b3f0a2bddbbe06e7eb12836f09" + ), + "source_audit_sha256": ( + "528c8dc167b11fab7f8a30a9b55946e58fa89f96c5c001eb21c6d7f39bea464d" + ), + }, + "durable": { + "tail_process_mean_ms": 24.317203052, + "ceiling_multiplier": 1.10, + "source_profile_sha256": ( + "28f8410ad21384ac642567627d2b31bbef16976426ddc783d2dd47f3c5ed0768" + ), + "source_audit_sha256": ( + "fb015cd5f4b3194c318f3266c32fa180c63ac7efede44df6f6c7ebb3d4404793" + ), + }, +} +CONSOLIDATION_EPOCH_PRE_POST_EVENTS = 50 +CONSOLIDATION_EPOCH_MINIMUM_MATERIAL_RESETS = 4 +CONSOLIDATION_EPOCH_MATERIAL_RAMP_RATIO_MIN = 1.10 +CONSOLIDATION_EPOCH_POST_PRE_PROCESS_RATIO_MAX = 0.90 +CONSOLIDATION_EPOCH_RESET_COUNTER_RATIO_MAX = 0.90 +CONSOLIDATION_EPOCH_PEAK_HALF_RATIO_MAX = 1.10 +CONSOLIDATION_EPOCH_TROUGH_HALF_RATIO_MAX = 1.10 +CONSOLIDATION_EPOCH_NORMALIZED_COST_HALF_RATIO_MAX = 1.10 +CONSOLIDATION_EPOCH_FREQUENCY_HALF_RATIO_MAX = 1.10 +CONSOLIDATION_EPOCH_RELATIONAL_CONTRACT_SHA256 = ( + "13806d20db179c8cf2dd0c7990f6355b6513c255bdf53df3b2c1082c636f0e4b" +) def canonical_json(value: Any) -> bytes: @@ -46,7 +238,11 @@ def normalized_sql_value(value: Any) -> Any: def logical_database_digest(db_path: Path) -> tuple[str, dict[str, int]]: - connection = sqlite3.connect(f"file:{db_path}?mode=ro", uri=True) + # The benchmark leaves SQLite in WAL mode. A read-only connection cannot + # initialize missing -shm state for a freshly closed artifact, so use an + # ordinary writable handle for the read-only queries below. This may + # create WAL sidecars but does not execute mutating SQL. + connection = sqlite3.connect(f"file:{db_path}?mode=rw", uri=True) try: tables: dict[str, Any] = {} counts: dict[str, int] = {} @@ -64,7 +260,17 @@ def logical_database_digest(db_path: Path) -> tuple[str, dict[str, int]]: connection.close() -def behavior_digest(rows: Sequence[dict[str, Any]]) -> str: +def behavior_digest( + rows: Sequence[dict[str, Any]], content_address: str | None = None +) -> str: + if content_address is not None: + if len(content_address) != 64 or any( + char not in "0123456789abcdef" for char in content_address + ): + raise ValueError("profile behavior_sha256 is invalid") + if any("behavior_sha256" not in row for row in rows): + raise ValueError("compact profile lacks per-row behavior digests") + return content_address behavior = [] for row in rows: if "behavior" not in row: @@ -104,11 +310,11 @@ def bootstrap_upper_slope( ) -> float: fitted_slope = theil_sen(xs, ys) intercept = statistics.median( - y - fitted_slope * x for x, y in zip(xs, ys, strict=True) + y - fitted_slope * x for x, y in zip(xs, ys) ) residuals = [ y - (intercept + fitted_slope * x) - for x, y in zip(xs, ys, strict=True) + for x, y in zip(xs, ys) ] rng = random.Random(0) slopes = [] @@ -116,7 +322,7 @@ def bootstrap_upper_slope( sampled = [rng.choice(residuals) for _ in residuals] synthetic = [ intercept + fitted_slope * x + residual - for x, residual in zip(xs, sampled, strict=True) + for x, residual in zip(xs, sampled) ] slopes.append(theil_sen(xs, synthetic)) slopes.sort() @@ -136,12 +342,950 @@ def operation_values( values = [] for row in rows: operation_ms = row.get("operation_ms") - if not isinstance(operation_ms, dict) or operation not in operation_ms: - raise ValueError(f"profile lacks full timing for {operation}") - values.append(float(operation_ms[operation])) + if not isinstance(operation_ms, dict): + raise ValueError("profile lacks full operation timing") + values.append(float(operation_ms.get(operation, 0.0))) return values +def comparison(means: Sequence[float]) -> dict[str, float]: + early = statistics.mean(means[:5]) + late = statistics.mean(means[-5:]) + return { + "first_five_mean_ms": early, + "final_five_mean_ms": late, + "delta_ms": late - early, + "final_five_over_first_five": late / early if early > 0.0 else math.inf, + } + + +def counter_comparison(means: Sequence[float]) -> dict[str, float]: + early = statistics.mean(means[:5]) + late = statistics.mean(means[-5:]) + return { + "first_five_mean": early, + "final_five_mean": late, + "delta": late - early, + "final_five_over_first_five": late / early if early > 0.0 else math.inf, + } + + +def finite_nonnegative(value: Any, field: str) -> float: + if isinstance(value, bool) or not isinstance(value, (int, float)): + raise ValueError(f"{field} must be numeric") + result = float(value) + if not math.isfinite(result) or result < 0.0: + raise ValueError(f"{field} must be finite and nonnegative") + return result + + +def plateau_height_reference(retention: str) -> dict[str, Any]: + reference = PLATEAU_HEIGHT_REFERENCES.get(retention) + if not isinstance(reference, dict): + raise ValueError("missing digest-bound plateau height reference") + tail = finite_nonnegative( + reference.get("tail_process_mean_ms"), + "plateau height reference tail_process_mean_ms", + ) + multiplier = finite_nonnegative( + reference.get("ceiling_multiplier"), + "plateau height reference ceiling_multiplier", + ) + if tail <= 0.0 or multiplier <= 0.0: + raise ValueError("plateau height reference values must be positive") + for field in ("source_profile_sha256", "source_audit_sha256"): + value = reference.get(field) + if not isinstance(value, str) or len(value) != 64 or any( + char not in "0123456789abcdef" for char in value + ): + raise ValueError(f"plateau height reference {field} is invalid") + return { + **reference, + "plateau_process_ceiling_ms": tail * multiplier, + } + + +def nonnegative_integer(value: Any, field: str, *, positive: bool = False) -> int: + if isinstance(value, bool) or not isinstance(value, int): + raise ValueError(f"{field} must be an integer") + if value < (1 if positive else 0): + qualifier = "positive" if positive else "nonnegative" + raise ValueError(f"{field} must be {qualifier}") + return value + + +def consolidation_epoch_counters(value: Any, field: str) -> dict[str, int]: + if not isinstance(value, dict) or set(value) != set( + REQUIRED_CONSOLIDATION_EPOCH_COUNTERS + ): + raise ValueError(f"{field} schema mismatch") + return { + name: nonnegative_integer(value[name], f"{field}.{name}") + for name in REQUIRED_CONSOLIDATION_EPOCH_COUNTERS + } + + +def validate_consolidation_epoch_relations( + profile: dict[str, Any], rows: Sequence[dict[str, Any]] +) -> list[dict[str, Any]]: + if profile.get("schema") != "cortext_packet_storage_profile_v2": + raise ValueError("profile lacks consolidation epoch schema v2") + if ( + profile.get("consolidation_epoch_relational_contract_sha256") + != CONSOLIDATION_EPOCH_RELATIONAL_CONTRACT_SHA256 + ): + raise ValueError("profile consolidation epoch relational contract mismatch") + events = profile.get("consolidation_events") + if not isinstance(events, list): + raise ValueError("profile lacks consolidation_events") + event_by_index: dict[int, dict[str, Any]] = {} + for event in events: + if not isinstance(event, dict): + raise ValueError("consolidation event must be an object") + event_index = nonnegative_integer( + event.get("event_index"), "consolidation event_index" + ) + if event_index in event_by_index: + raise ValueError("duplicate consolidation close record") + closing_event_index = nonnegative_integer( + event.get("closing_event_index"), + "consolidation closing_event_index", + ) + if closing_event_index != event_index: + raise ValueError("consolidation closing event identity mismatch") + if event.get("sealed_mutation_identity_verified") is not True: + raise ValueError("sealed mutation identity was not verified") + nonnegative_integer( + event.get("consolidation_epoch_id"), + "consolidation event epoch id", + ) + nonnegative_integer( + event.get("sealed_epoch_event_count"), + "sealed_epoch_event_count", + positive=True, + ) + nonnegative_integer( + event.get("sealed_epoch_mutation_count"), + "sealed_epoch_mutation_count", + ) + identity_count = nonnegative_integer( + event.get("sealed_mutation_identity_count"), + "sealed_mutation_identity_count", + ) + if identity_count != event["sealed_epoch_mutation_count"]: + raise ValueError("sealed epoch mutation identity count mismatch") + finite_nonnegative(event.get("duration_ms"), "consolidation duration_ms") + consolidation_epoch_counters( + event.get("pre_reset_counters"), "pre_reset_counters" + ) + consolidation_epoch_counters( + event.get("post_reset_counters"), "post_reset_counters" + ) + event_by_index[event_index] = event + + expected_epoch = 0 + expected_since = 1 + observed_close_indices: list[int] = [] + for index, row in enumerate(rows): + if row.get("event_index") != index: + raise ValueError("profile event_index values must be unique and contiguous") + epoch_id = nonnegative_integer( + row.get("consolidation_epoch_id"), + "consolidation_epoch_id", + ) + events_since = nonnegative_integer( + row.get("events_since_epoch_start"), + "events_since_epoch_start", + positive=True, + ) + if epoch_id != expected_epoch or events_since != expected_since: + raise ValueError("consolidation epoch sequence mismatch") + counters = consolidation_epoch_counters( + row.get("consolidation_epoch_counters"), + "consolidation_epoch_counters", + ) + closes = row.get("consolidation_after_event") + if not isinstance(closes, bool): + raise ValueError("consolidation_after_event must be boolean") + event = event_by_index.get(index) + if closes != (event is not None): + raise ValueError("orphan consolidation row or close record") + if closes: + assert event is not None + if event["consolidation_epoch_id"] != epoch_id: + raise ValueError("consolidation close epoch mismatch") + if event["sealed_epoch_event_count"] != events_since: + raise ValueError("sealed epoch event count mismatch") + if event["pre_reset_counters"] != counters: + raise ValueError("pre-reset counters are not adjacent to close row") + if not math.isclose( + float(row.get("consolidation_ms", -1.0)), + float(event["duration_ms"]), + rel_tol=1e-9, + abs_tol=1e-6, + ): + raise ValueError("consolidation row duration mismatch") + observed_close_indices.append(index) + expected_epoch += 1 + expected_since = 1 + else: + if finite_nonnegative( + row.get("consolidation_ms"), "consolidation_ms" + ) != 0.0: + raise ValueError("consolidation duration lacks close record") + expected_since += 1 + if observed_close_indices != sorted(event_by_index): + raise ValueError("consolidation close ordering mismatch") + return [event_by_index[index] for index in observed_close_indices] + + +def ratio(numerator: float, denominator: float) -> float: + if denominator == 0.0: + return 1.0 if numerator == 0.0 else math.inf + return numerator / denominator + + +def half_comparison(values: Sequence[float]) -> dict[str, float]: + half = len(values) // 2 + if half == 0: + raise ValueError("at least two windows are required for half comparison") + first = statistics.mean(values[:half]) + second = statistics.mean(values[-half:]) + return { + "first_half_mean": first, + "second_half_mean": second, + "second_over_first": ratio(second, first), + "omitted_center_windows": len(values) - 2 * half, + } + + +def end_anchored_ranges(event_count: int, window_size: int) -> list[tuple[int, int]]: + if window_size <= 0: + raise ValueError("window size must be positive") + complete = event_count // window_size + leading_remainder = event_count - complete * window_size + return [ + (leading_remainder + index * window_size, + leading_remainder + (index + 1) * window_size) + for index in range(complete) + ] + + +def validate_profile_rows( + profile: dict[str, Any], rows: Sequence[dict[str, Any]] +) -> None: + processed_events = nonnegative_integer( + profile.get("processed_events"), "profile processed_events", positive=True + ) + if processed_events != len(rows): + raise ValueError("profile processed_events does not match row count") + retention = profile.get("retention") + if retention not in {"natural", "durable"}: + raise ValueError("profile retention must be natural or durable") + if profile.get("active_epoch_limits") != ACTIVE_EPOCH_LIMITS: + raise ValueError("profile active-epoch limits do not match the contract") + honors_required = profile.get("honor_required_consolidation") + if not isinstance(honors_required, bool): + raise ValueError("profile honor_required_consolidation must be boolean") + counter_activity = {name: 0.0 for name in REQUIRED_WORK_COUNTERS} + operation_activity = {name: 0.0 for name in COUNTER_ACTIVITY_OPERATIONS} + row_consolidation_total = 0.0 + row_consolidation_events: list[int] = [] + for expected_index, row in enumerate(rows): + if row.get("event_index") != expected_index: + raise ValueError("profile event_index values must be unique and contiguous") + if row.get("retention") != retention: + raise ValueError("profile row retention mismatch") + process_ms = finite_nonnegative(row.get("process_ms"), "process_ms") + end_to_end_ms = finite_nonnegative( + row.get("end_to_end_ms"), "end_to_end_ms" + ) + consolidation_ms = finite_nonnegative( + row.get("consolidation_ms"), "consolidation_ms" + ) + durable_barrier_ms = finite_nonnegative( + row.get("durable_barrier_ms"), "durable_barrier_ms" + ) + if end_to_end_ms + 1e-9 < process_ms + consolidation_ms: + raise ValueError("end_to_end_ms excludes required event work") + closes = row.get("consolidation_after_event") + if not isinstance(closes, bool): + raise ValueError("consolidation_after_event must be boolean") + if closes: + row_consolidation_events.append(expected_index) + row_consolidation_total += consolidation_ms + active_epoch = row.get("active_epoch") + if not isinstance(active_epoch, dict): + raise ValueError("profile row lacks active_epoch counters") + if set(active_epoch) != {*ACTIVE_EPOCH_LIMITS, "required"}: + raise ValueError("profile active_epoch counter schema mismatch") + active_values = { + name: nonnegative_integer( + active_epoch.get(name), f"active_epoch.{name}" + ) + for name in ACTIVE_EPOCH_LIMITS + } + active_required = active_epoch.get("required") + if not isinstance(active_required, bool): + raise ValueError("active_epoch.required must be boolean") + at_or_above_limit = any( + active_values[name] >= limit + for name, limit in ACTIVE_EPOCH_LIMITS.items() + ) + if at_or_above_limit and not active_required: + raise ValueError("active-epoch boundary was not preserved") + if honors_required and any( + active_values[name] > limit + for name, limit in ACTIVE_EPOCH_LIMITS.items() + ): + raise ValueError("honored active epoch crossed a safety ceiling") + counters = row.get("work_counters") + if not isinstance(counters, dict): + raise ValueError("profile row lacks work_counters") + if set(counters) != set(REQUIRED_WORK_COUNTERS): + missing = sorted(set(REQUIRED_WORK_COUNTERS) - set(counters)) + extra = sorted(set(counters) - set(REQUIRED_WORK_COUNTERS)) + raise ValueError( + f"work counter schema mismatch; missing={missing}, extra={extra}" + ) + operations = row.get("operation_ms") + if not isinstance(operations, dict): + raise ValueError("profile lacks full operation timing") + if ( + retention == "durable" + and "SignalProcessor.sqlite_wal_checkpoint" not in operations + ): + raise ValueError("durable row lacks post-commit barrier attribution") + if ( + retention == "durable" + and "SignalProcessor.sqlite_wal_checkpoint_failure_count" + not in operations + ): + raise ValueError("durable row lacks barrier failure diagnostic") + checkpoint_failures = finite_nonnegative( + operations.get( + "SignalProcessor.sqlite_wal_checkpoint_failure_count", 0.0 + ), + "operation_ms.SignalProcessor.sqlite_wal_checkpoint_failure_count", + ) + if retention == "durable" and checkpoint_failures != 0.0: + raise ValueError("durable row reports a failed post-commit barrier") + if "MemoryStorage.supersession_sql_fallback_count" not in operations: + raise ValueError("profile row lacks supersession fallback diagnostic") + supersession_fallbacks = finite_nonnegative( + operations["MemoryStorage.supersession_sql_fallback_count"], + "operation_ms.MemoryStorage.supersession_sql_fallback_count", + ) + if supersession_fallbacks != 0.0: + raise ValueError( + "supersession SQL fallback prevents exact visited-row accounting" + ) + operation_barrier_ms = finite_nonnegative( + operations.get("SignalProcessor.sqlite_wal_checkpoint", 0.0), + "operation_ms.SignalProcessor.sqlite_wal_checkpoint", + ) + if not math.isclose( + durable_barrier_ms, operation_barrier_ms, rel_tol=1e-9, abs_tol=1e-9 + ): + raise ValueError("durable barrier attribution mismatch") + for name in REQUIRED_WORK_COUNTERS: + counter_activity[name] += finite_nonnegative( + counters[name], f"work_counters.{name}" + ) + source_names = COUNTER_SOURCE_OPERATIONS[name] + missing_sources = [ + source for source in source_names if source not in operations + ] + if missing_sources: + raise ValueError( + f"work counter {name} lacks producer counters: {missing_sources}" + ) + source_value = sum( + finite_nonnegative( + operations[source], f"operation_ms.{source}" + ) + for source in source_names + ) + if not math.isclose( + float(counters[name]), source_value, rel_tol=1e-9, abs_tol=1e-9 + ): + raise ValueError( + f"work counter {name} does not match producer counters" + ) + for counter, activity_names in COUNTER_ACTIVITY_OPERATIONS.items(): + missing_activity = [ + name for name in activity_names if name not in operations + ] + if missing_activity: + raise ValueError( + f"work counter {counter} lacks independent activity markers: " + f"{missing_activity}" + ) + operation_activity[counter] += sum( + finite_nonnegative( + operations[name], f"operation_ms.{name}" + ) + for name in activity_names + ) + for counter, operation_total in operation_activity.items(): + if operation_total > 0.0 and counter_activity[counter] == 0.0: + raise ValueError( + f"work counter {counter} is all zero beside positive operation work" + ) + consolidation_runs = profile.get("consolidation_runs") + if isinstance(consolidation_runs, bool) or not isinstance( + consolidation_runs, int + ) or consolidation_runs < 0: + raise ValueError("profile consolidation_runs must be nonnegative integer") + consolidation_total = finite_nonnegative( + profile.get("consolidation_ms"), "profile.consolidation_ms" + ) + if consolidation_runs != len(row_consolidation_events) or not math.isclose( + consolidation_total, row_consolidation_total, rel_tol=1e-9, abs_tol=1e-6 + ): + raise ValueError("consolidation row attribution mismatch") + consolidation_events = profile.get("consolidation_events") + if not isinstance(consolidation_events, list): + raise ValueError("profile lacks consolidation_events") + event_indices = [] + for event in consolidation_events: + if not isinstance(event, dict): + raise ValueError("consolidation event must be an object") + event_index = event.get("event_index") + if isinstance(event_index, bool) or not isinstance(event_index, int): + raise ValueError("consolidation event index must be an integer") + finite_nonnegative(event.get("duration_ms"), "consolidation duration_ms") + post_epoch = event.get("post_reset_active_epoch") + if not isinstance(post_epoch, dict): + raise ValueError("consolidation event lacks post-reset active epoch") + if set(post_epoch) != {*ACTIVE_EPOCH_LIMITS, "required"}: + raise ValueError("post-reset active epoch schema mismatch") + if post_epoch.get("required") is not False: + raise ValueError("successful consolidation did not clear epoch boundary") + for name, limit in ACTIVE_EPOCH_LIMITS.items(): + value = nonnegative_integer( + post_epoch.get(name), f"post_reset_active_epoch.{name}" + ) + if value >= limit: + raise ValueError("successful consolidation did not reset active epoch") + event_indices.append(event_index) + if event_indices != row_consolidation_events: + raise ValueError("consolidation event indices do not match rows") + validate_consolidation_epoch_relations(profile, rows) + + +def sequence_trend(values: Sequence[float]) -> dict[str, Any]: + if len(values) < 2: + raise ValueError("at least two values are required for sequence trend") + mean_value = statistics.mean(values) + xs = [float(index) for index in range(len(values))] + slope = theil_sen(xs, values) + upper = bootstrap_upper_slope(xs, values, BOOTSTRAP_REPETITIONS) + if mean_value == 0.0: + if any(value != 0.0 for value in values): + raise ValueError("nonzero sequence has zero mean") + relative_slope = 0.0 + relative_upper = 0.0 + else: + relative_slope = slope / mean_value + relative_upper = upper / mean_value + return { + "half": half_comparison(values), + "relative_theil_sen_per_epoch": relative_slope, + "relative_bootstrap_95_upper_per_epoch": relative_upper, + } + + +def consolidation_epoch_result( + profile: dict[str, Any], rows: Sequence[dict[str, Any]], + suffix_start: int, suffix_end: int, +) -> dict[str, Any]: + events = validate_consolidation_epoch_relations(profile, rows) + events = [ + event for event in events + if suffix_start <= event["event_index"] < suffix_end + ] + complete_epochs = [] + k = CONSOLIDATION_EPOCH_PRE_POST_EVENTS + for event_index, event in enumerate(events): + close = event["event_index"] + sealed_count = event["sealed_epoch_event_count"] + start = close - sealed_count + 1 + next_close = ( + events[event_index + 1]["event_index"] + if event_index + 1 < len(events) + else suffix_end + ) + if ( + start < suffix_start + or sealed_count < 2 * k + or close + k >= suffix_end + or next_close - close < k + ): + continue + epoch_rows = rows[start : close + 1] + post_rows = rows[close + 1 : close + 1 + k] + leading = statistics.mean( + float(row["process_ms"]) for row in epoch_rows[:k] + ) + trailing = statistics.mean( + float(row["process_ms"]) for row in epoch_rows[-k:] + ) + post = statistics.mean(float(row["process_ms"]) for row in post_rows) + ramp_ratio = ratio(trailing, leading) + post_pre_ratio = ratio(post, trailing) + reset_ratios = { + name: ratio( + float(event["post_reset_counters"][name]), + float(event["pre_reset_counters"][name]), + ) + for name in REQUIRED_CONSOLIDATION_EPOCH_COUNTERS + } + material = ramp_ratio >= CONSOLIDATION_EPOCH_MATERIAL_RAMP_RATIO_MIN + reset_failures = { + name: value for name, value in reset_ratios.items() + if value > CONSOLIDATION_EPOCH_RESET_COUNTER_RATIO_MAX + and not ( + float(event["pre_reset_counters"][name]) == 0.0 + and float(event["post_reset_counters"][name]) == 0.0 + ) + } + complete_epochs.append({ + "consolidation_epoch_id": event["consolidation_epoch_id"], + "start_event": start, + "closing_event": close, + "sealed_epoch_event_count": sealed_count, + "sealed_epoch_mutation_count": event["sealed_epoch_mutation_count"], + "leading_mean_process_ms": leading, + "trailing_peak_mean_process_ms": trailing, + "following_trough_mean_process_ms": post, + "trailing_over_leading": ramp_ratio, + "post_over_trailing": post_pre_ratio, + "material": material, + "reset_counter_ratios": reset_ratios, + "reset_counter_failures": reset_failures, + "consolidation_ms_per_event": ratio( + float(event["duration_ms"]), float(max(1, sealed_count)) + ), + "consolidation_ms_per_mutation": ratio( + float(event["duration_ms"]), + float(max(1, event["sealed_epoch_mutation_count"])), + ), + }) + + material_epochs = [epoch for epoch in complete_epochs if epoch["material"]] + failures = [] + mode = "invalid" + peak_trend = None + trough_trend = None + normalized_event_cost = None + normalized_mutation_cost = None + frequency_trend = None + frequency_epochs = [ + event for event in events + if event["event_index"] - event["sealed_epoch_event_count"] + 1 + >= suffix_start + ] + if any(epoch["reset_counter_failures"] for epoch in complete_epochs): + failures.append("consolidation reset counter does not fall") + if len(material_epochs) >= CONSOLIDATION_EPOCH_MINIMUM_MATERIAL_RESETS: + mode = "sawtooth" + for epoch in material_epochs: + if epoch["post_over_trailing"] > CONSOLIDATION_EPOCH_POST_PRE_PROCESS_RATIO_MAX: + failures.append("material epoch does not lower following process time") + peak_trend = sequence_trend( + [epoch["trailing_peak_mean_process_ms"] for epoch in material_epochs] + ) + trough_trend = sequence_trend( + [epoch["following_trough_mean_process_ms"] for epoch in material_epochs] + ) + if peak_trend["half"]["second_over_first"] > CONSOLIDATION_EPOCH_PEAK_HALF_RATIO_MAX: + failures.append("sawtooth peaks rise") + if trough_trend["half"]["second_over_first"] > CONSOLIDATION_EPOCH_TROUGH_HALF_RATIO_MAX: + failures.append("sawtooth troughs rise") + for trend, name in ((peak_trend, "peak"), (trough_trend, "trough")): + if trend["relative_theil_sen_per_epoch"] > RELATIVE_THEIL_SEN_MAX: + failures.append(f"{name} relative slope rises") + if trend["relative_bootstrap_95_upper_per_epoch"] > RELATIVE_BOOTSTRAP_UPPER_MAX: + failures.append(f"{name} bootstrap upper rises") + elif len(material_epochs) > 0: + failures.append("one to three material epochs are insufficient") + elif not events: + mode = "flat-envelope" + elif len(complete_epochs) >= CONSOLIDATION_EPOCH_MINIMUM_MATERIAL_RESETS: + mode = "flat-envelope" + else: + failures.append("successful consolidations lack four complete epochs") + + if len(frequency_epochs) >= CONSOLIDATION_EPOCH_MINIMUM_MATERIAL_RESETS: + frequency_trend = sequence_trend([ + ratio(1.0, float(event["sealed_epoch_event_count"])) + for event in frequency_epochs + ]) + frequency_trend["observed_epoch_count"] = len(frequency_epochs) + frequency_trend["left_censored_close_count"] = ( + len(events) - len(frequency_epochs) + ) + if ( + frequency_trend["half"]["second_over_first"] + > CONSOLIDATION_EPOCH_FREQUENCY_HALF_RATIO_MAX + ): + failures.append("consolidation frequency rises") + if len(complete_epochs) >= CONSOLIDATION_EPOCH_MINIMUM_MATERIAL_RESETS: + normalized_event_cost = sequence_trend( + [epoch["consolidation_ms_per_event"] for epoch in complete_epochs] + ) + normalized_mutation_cost = sequence_trend( + [epoch["consolidation_ms_per_mutation"] for epoch in complete_epochs] + ) + if normalized_event_cost["half"]["second_over_first"] > CONSOLIDATION_EPOCH_NORMALIZED_COST_HALF_RATIO_MAX: + failures.append("consolidation cost per sealed event rises") + if normalized_mutation_cost["half"]["second_over_first"] > CONSOLIDATION_EPOCH_NORMALIZED_COST_HALF_RATIO_MAX: + failures.append("consolidation cost per sealed mutation rises") + + return { + "passed": mode != "invalid" and not failures, + "mode": mode, + "successful_consolidation_count": len(events), + "complete_epoch_count": len(complete_epochs), + "material_epoch_count": len(material_epochs), + "complete_epochs": complete_epochs, + "peak_trend": peak_trend, + "trough_trend": trough_trend, + "normalized_event_cost_trend": normalized_event_cost, + "normalized_mutation_cost_trend": normalized_mutation_cost, + "frequency_trend": frequency_trend, + "failures": sorted(set(failures)), + } + + +def checkpoint_map( + profile: dict[str, Any], required_boundaries: set[int] +) -> dict[int, dict[str, float]]: + checkpoints = profile.get("store_checkpoints") + if not isinstance(checkpoints, list): + raise ValueError("profile lacks store_checkpoints") + mapped: dict[int, dict[str, float]] = {} + required_counts = { + "memories", "signals", "associations", "embeddings", + "current_memory_embeddings", "memory_reconstructions", + "rif_recovery_clock", "rif_generation_resets", "rif_active_state", + } + for checkpoint in checkpoints: + if not isinstance(checkpoint, dict): + raise ValueError("store checkpoint must be an object") + event_end = checkpoint.get("event_end") + if isinstance(event_end, bool) or not isinstance(event_end, int): + raise ValueError("store checkpoint event_end must be an integer") + if event_end in mapped: + raise ValueError("duplicate store checkpoint boundary") + counts = checkpoint.get("counts") + if not isinstance(counts, dict) or set(counts) != required_counts: + raise ValueError("store checkpoint count schema mismatch") + mapped[event_end] = { + name: finite_nonnegative(value, f"store_checkpoints.{name}") + for name, value in counts.items() + } + missing = sorted(required_boundaries - set(mapped)) + if missing: + raise ValueError(f"store checkpoints missing window boundaries: {missing}") + return mapped + + +def total_authoritative_rows(counts: dict[str, float]) -> float: + return sum(counts.values()) + + +def suffix_plateau_result( + profile: dict[str, Any], rows: Sequence[dict[str, Any]], window_size: int +) -> dict[str, Any]: + validate_profile_rows(profile, rows) + event_count = len(rows) + all_ranges = end_anchored_ranges(event_count, window_size) + warmup_events = math.ceil(0.20 * event_count) + ranges = [item for item in all_ranges if item[0] >= warmup_events] + boundaries = {boundary for item in all_ranges for boundary in item} + checkpoints = checkpoint_map(profile, boundaries) + if len(ranges) < MINIMUM_POST_WARMUP_WINDOWS: + return { + "passed": False, + "reason": "at least ten post-warmup end-anchored windows are required", + "window_count": len(ranges), + "warmup_events": warmup_events, + } + operation_names = sorted( + name + for name in set().union(*(row["operation_ms"] for row in rows)) + if is_duration_operation(name) + ) + process_windows: list[float] = [] + throughput_windows: list[float] = [] + operation_windows = {name: [] for name in operation_names} + counter_windows = {name: [] for name in REQUIRED_WORK_COUNTERS} + window_table = [] + for start, end in ranges: + window_rows = rows[start:end] + process_mean = statistics.mean(float(row["process_ms"]) for row in window_rows) + elapsed = sum(float(row["end_to_end_ms"]) for row in window_rows) + throughput = 1000.0 * len(window_rows) / elapsed if elapsed > 0.0 else math.inf + process_windows.append(process_mean) + throughput_windows.append(throughput) + for name in operation_names: + operation_windows[name].append( + statistics.mean(float(row["operation_ms"].get(name, 0.0)) for row in window_rows) + ) + for name in REQUIRED_WORK_COUNTERS: + counter_windows[name].append( + statistics.mean(float(row["work_counters"][name]) for row in window_rows) + ) + window_table.append({ + "start_event": start, + "end_event": end, + "mean_process_ms": process_mean, + "messages_per_second": throughput, + "end_to_end_ms": elapsed, + "authoritative_rows_end": total_authoritative_rows(checkpoints[end]), + }) + + retention = profile.get("retention") + height_reference = plateau_height_reference(retention) + height_ceiling = height_reference["plateau_process_ceiling_ms"] + + candidate_failures = [] + accepted = None + for suffix_start in range(0, len(ranges) - PLATEAU_MINIMUM_WINDOWS + 1): + suffix_ranges = ranges[suffix_start:] + suffix_process = process_windows[suffix_start:] + suffix_throughput = throughput_windows[suffix_start:] + process_half = half_comparison(suffix_process) + throughput_half = half_comparison(suffix_throughput) + suffix_mean = statistics.mean(suffix_process) + xs = [float(index) for index in range(len(suffix_process))] + slope = theil_sen(xs, suffix_process) + upper = bootstrap_upper_slope(xs, suffix_process, BOOTSTRAP_REPETITIONS) + relative_slope = slope / suffix_mean if suffix_mean > 0.0 else math.inf + relative_upper = upper / suffix_mean if suffix_mean > 0.0 else math.inf + operation_failures = {} + operation_results = {} + for name, values in operation_windows.items(): + suffix_values = values[suffix_start:] + mean_value = statistics.mean(suffix_values) + if mean_value < OPERATION_MINIMUM_MEAN_MS: + continue + result = half_comparison(suffix_values) + operation_results[name] = {"mean_ms": mean_value, **result} + if result["second_over_first"] > OPERATION_HALF_RATIO_MAX: + operation_failures[name] = result["second_over_first"] + counter_results = { + name: half_comparison(values[suffix_start:]) + for name, values in counter_windows.items() + } + counter_failures = { + name: result["second_over_first"] + for name, result in counter_results.items() + if result["second_over_first"] > WORK_COUNTER_HALF_RATIO_MAX + } + start_event = suffix_ranges[0][0] + end_event = suffix_ranges[-1][1] + half = len(suffix_ranges) // 2 + middle_event = suffix_ranges[half][0] + start_rows = total_authoritative_rows(checkpoints[start_event]) + middle_rows = total_authoritative_rows(checkpoints[middle_event]) + end_rows = total_authoritative_rows(checkpoints[end_event]) + store_growth_ratio = ratio(end_rows, start_rows) + store_growth_passed = ( + store_growth_ratio >= AUTHORITATIVE_ROW_GROWTH_RATIO_MIN + and middle_rows > start_rows + and end_rows > middle_rows + ) + epoch_result = consolidation_epoch_result( + profile, rows, start_event, end_event + ) + passed = ( + PROCESS_HALF_RATIO_RANGE[0] <= process_half["second_over_first"] <= PROCESS_HALF_RATIO_RANGE[1] + and THROUGHPUT_HALF_RATIO_RANGE[0] <= throughput_half["second_over_first"] <= THROUGHPUT_HALF_RATIO_RANGE[1] + and relative_slope <= RELATIVE_THEIL_SEN_MAX + and relative_upper <= RELATIVE_BOOTSTRAP_UPPER_MAX + and not operation_failures + and not counter_failures + and store_growth_passed + and suffix_mean <= height_ceiling + and end_event == event_count + and epoch_result["passed"] + ) + result = { + "passed": passed, + "plateau_start_event": start_event, + "plateau_end_event": end_event, + "plateau_window_count": len(suffix_ranges), + "ramp_duration_events": start_event, + "ramp_complete_window_count": len(all_ranges) - len(suffix_ranges), + "plateau_mean_process_ms": suffix_mean, + "height_ceiling_ms": height_ceiling, + "height_reference": height_reference, + "process_half": process_half, + "throughput_half": throughput_half, + "relative_theil_sen_per_window": relative_slope, + "relative_bootstrap_95_upper_per_window": relative_upper, + "operation_results": operation_results, + "operation_failures": operation_failures, + "work_counter_results": counter_results, + "work_counter_failures": counter_failures, + "authoritative_rows_start": start_rows, + "authoritative_rows_middle": middle_rows, + "authoritative_rows_end": end_rows, + "authoritative_row_growth_ratio": store_growth_ratio, + "authoritative_store_growth_passed": store_growth_passed, + "consolidation_epoch": epoch_result, + } + if passed: + accepted = result + break + candidate_failures.append({ + "plateau_start_event": start_event, + "plateau_window_count": len(suffix_ranges), + "process_ratio": process_half["second_over_first"], + "throughput_ratio": throughput_half["second_over_first"], + "relative_slope": relative_slope, + "relative_upper": relative_upper, + "operation_failure_count": len(operation_failures), + "counter_failure_count": len(counter_failures), + "store_growth_passed": store_growth_passed, + "height_passed": suffix_mean <= height_ceiling, + "consolidation_epoch_passed": epoch_result["passed"], + "consolidation_mode": epoch_result["mode"], + }) + return { + "passed": accepted is not None, + "warmup_events": warmup_events, + "window_size": window_size, + "height_reference": height_reference, + "eligible_window_count": len(ranges), + "leading_remainder_events": event_count % window_size, + "final_event_covered": bool(ranges and ranges[-1][1] == event_count), + "accepted_suffix": accepted, + "candidate_failures": candidate_failures, + "window_table": window_table, + } + + +def attribution_result( + rows: Sequence[dict[str, Any]], window_size: int +) -> dict[str, Any]: + warmup = math.ceil(0.20 * len(rows)) + process_means = windows( + [float(row["process_ms"]) for row in rows], warmup, window_size + ) + latency_means = windows( + [float(row["latency_ms"]) for row in rows], warmup, window_size + ) + if len(process_means) < 10: + return { + "passed": False, + "reason": "at least ten post-warmup windows are required", + "window_count": len(process_means), + } + + all_operation_names = set().union( + *(row.get("operation_ms", {}) for row in rows) + ) + operation_names = sorted( + name for name in all_operation_names + if name.startswith(ATTRIBUTION_PREFIXES) and is_duration_operation(name) + ) + detailed_names = sorted( + name for name in all_operation_names + if name.startswith(DETAILED_PREFIXES) and is_duration_operation(name) + ) + counter_names = sorted( + name for name in all_operation_names + if not is_duration_operation(name) + ) + operation_windows = { + name: windows(operation_values(rows, name), warmup, window_size) + for name in operation_names + } + detailed_windows = { + name: windows(operation_values(rows, name), warmup, window_size) + for name in detailed_names + } + operation_comparisons = { + name: comparison(means) for name, means in operation_windows.items() + } + detailed_comparisons = { + name: comparison(means) for name, means in detailed_windows.items() + } + counter_comparisons = { + name: counter_comparison( + windows(operation_values(rows, name), warmup, window_size) + ) + for name in counter_names + } + process_comparison = comparison(process_means) + positive_process_delta = max(0.0, process_comparison["delta_ms"]) + positive_named_delta = sum( + max(0.0, values["delta_ms"]) + for values in operation_comparisons.values() + ) + signed_named_delta = sum( + values["delta_ms"] for values in operation_comparisons.values() + ) + ranked = sorted( + ( + { + "operation": name, + **values, + "fraction_of_process_delta": ( + max(0.0, values["delta_ms"]) / positive_process_delta + if positive_process_delta > 0.0 + else 0.0 + ), + } + for name, values in operation_comparisons.items() + if values["delta_ms"] > 0.0 + ), + key=lambda item: item["delta_ms"], + reverse=True, + ) + window_table = [] + for index, process_mean in enumerate(process_means): + start = warmup + index * window_size + window_table.append( + { + "start_event": start, + "end_event_exclusive": start + window_size, + "mean_process_ms": process_mean, + "mean_latency_ms": latency_means[index], + "operation_ms": { + name: means[index] + for name, means in operation_windows.items() + }, + } + ) + raw_explained_fraction = ( + signed_named_delta / positive_process_delta + if positive_process_delta > 0.0 + else 1.0 + ) + explained_fraction = min(1.0, max(0.0, raw_explained_fraction)) + return { + "passed": explained_fraction >= 0.80, + "warmup_events": warmup, + "window_size": window_size, + "window_count": len(process_means), + "process": process_comparison, + "named_positive_delta_ms": positive_named_delta, + "named_signed_delta_ms": signed_named_delta, + "residual_delta_ms": process_comparison["delta_ms"] - signed_named_delta, + "raw_explained_fraction": raw_explained_fraction, + "explained_fraction": explained_fraction, + "ranked_positive_contributors": ranked, + "detailed_subsections": detailed_comparisons, + "diagnostic_counters": counter_comparisons, + "window_table": window_table, + } + + def flatness_result( rows: Sequence[dict[str, Any]], operation: str, window_size: int ) -> dict[str, Any]: @@ -210,7 +1354,10 @@ def throughput_result( } -def profile_summary(profile_path: Path, db_path: Path, window_size: int) -> dict[str, Any]: +def profile_summary( + profile_path: Path, db_path: Path, window_size: int, + include_plateau: bool = True, +) -> dict[str, Any]: profile = json.loads(profile_path.read_text(encoding="utf-8")) rows = profile.get("working_set_curve") if not isinstance(rows, list) or not rows: @@ -218,10 +1365,12 @@ def profile_summary(profile_path: Path, db_path: Path, window_size: int) -> dict db_hash, counts = logical_database_digest(db_path) flatness = [flatness_result(rows, name, window_size) for name in STORAGE_OPERATIONS] throughput = throughput_result(rows, window_size) + attribution = attribution_result(rows, window_size) + plateau = suffix_plateau_result(profile, rows, window_size) if include_plateau else None return { - "schema": "cortext_storage_cost_profile_audit_v2", + "schema": "cortext_storage_cost_profile_audit_v3", "processed_events": len(rows), - "behavior_sha256": behavior_digest(rows), + "behavior_sha256": behavior_digest(rows, profile.get("behavior_sha256")), "logical_database_sha256": db_hash, "logical_table_counts": counts, "mean_process_ms": float(profile["mean_process_ms"]), @@ -229,8 +1378,12 @@ def profile_summary(profile_path: Path, db_path: Path, window_size: int) -> dict "wall_ms": int(profile["wall_ms"]), "flatness": flatness, "flatness_passed": all(result["passed"] for result in flatness), - "throughput": throughput, - "throughput_passed": throughput["passed"], + "legacy_latency_throughput": throughput, + "legacy_latency_throughput_passed": throughput["passed"], + "attribution": attribution, + "attribution_passed": attribution["passed"], + "plateau": plateau, + "plateau_passed": bool(plateau and plateau["passed"]), } @@ -241,6 +1394,7 @@ def parse_args() -> argparse.Namespace: parser.add_argument("--out", type=Path) parser.add_argument("--window-size", type=int, default=100) parser.add_argument("--report-only", action="store_true") + parser.add_argument("--require-attribution", action="store_true") return parser.parse_args() @@ -248,12 +1402,18 @@ def main() -> int: args = parse_args() if args.window_size <= 0: raise ValueError("--window-size must be positive") - result = profile_summary(args.profile, args.db, args.window_size) + result = profile_summary( + args.profile, args.db, args.window_size, + include_plateau=not args.require_attribution, + ) rendered = json.dumps(result, indent=2, sort_keys=True) + "\n" if args.out: args.out.write_text(rendered, encoding="utf-8") print(rendered, end="") - passed = result["flatness_passed"] and result["throughput_passed"] + if args.require_attribution: + passed = result["attribution_passed"] + else: + passed = result["plateau_passed"] return 0 if args.report_only or passed else 1 diff --git a/tools/audit_storage_cost_profile_test.py b/tools/audit_storage_cost_profile_test.py new file mode 100644 index 00000000..5ef0cee8 --- /dev/null +++ b/tools/audit_storage_cost_profile_test.py @@ -0,0 +1,862 @@ +#!/usr/bin/env python3 +"""Focused contract tests for storage-cost profile attribution and CLI gates.""" + +from __future__ import annotations + +import json +import sqlite3 +import subprocess +import sys +import tempfile +import unittest +import copy +from pathlib import Path + +try: + import audit_storage_cost_profile as audit +except ModuleNotFoundError: + from tools import audit_storage_cost_profile as audit + + +def fixture_rows() -> list[dict[str, object]]: + rows: list[dict[str, object]] = [] + for index in range(130): + process_ms = 1.0 + 0.01 * index + operation_ms = { + "cortext::operations::GraphAugmentedRetrieveCandidates": process_ms, + "cortext::operations::MemoryStorage": 0.1, + "MemoryStorage.supersession_edges": 0.01, + } + if index >= 65: + operation_ms["cortext::operations::LateMaintenance"] = 0.2 + 0.005 * ( + index - 65 + ) + operation_ms["EmotionalCascade.source_count"] = float(index) + operation_ms["SignalProcessor.snapshot_cache_entry_copy_count"] = float( + index * 100 + ) + rows.append( + { + "event_index": index, + "modality": "fixture", + "process_ms": process_ms, + "latency_ms": process_ms, + "operation_ms": operation_ms, + "active_epoch": { + "event_count": index + 1, + "mutation_count": index + 1, + "allocated_bytes": 16384, + "required": False, + }, + "behavior": {}, + } + ) + return rows + + +def fixture_operation_ms(counters: dict[str, float]) -> dict[str, float]: + operations = { + "cortext::operations::GraphAugmentedRetrieveCandidates": 0.2, + "GraphRetrieve.total": 0.2, + "GraphRetrieve.seed_knn_cache": 0.1, + "GraphRetrieve.seed_knn_cache_rebuild": 0.1, + "GraphRetrieve.seed_cache_family_compare": 0.1, + "GraphRetrieve.seed_cache_distance": 0.1, + "cortext::operations::ApplyRetrievalCompetition": 0.1, + "Competition.rif_recovery_active_sql": 0.1, + "Competition.score_candidates": 0.1, + "Predictive.decay_active_sql": 0.1, + "cortext::operations::MemoryStorage": 0.1, + "MemoryStorage.supersession_edges": 0.1, + "MemoryStorage.supersession_candidate_load": 0.1, + "MemoryStorage.supersession_current_candidate_execution_count": 0.1, + "MemoryStorage.supersession_historical_candidate_execution_count": 0.1, + "MemoryStorage.supersession_current_rows_visited": 0.1, + "MemoryStorage.supersession_historical_rows_visited": 0.1, + "MemoryStorage.supersession_sql_fallback_count": 0.0, + "cortext::operations::PropagateEmotionalCascade": 0.1, + "EmotionalCascade.source_query": 0.1, + "EmotionalCascade.source_execution_count": 0.1, + "EmotionalCascade.neighbor_execution_count": 0.1, + "EmotionalCascade.update_execution_count": 0.1, + "SignalProcessor.snapshot_full_cache_copy": 0.1, + "SignalProcessor.snapshot_cache_entry_copy": 0.1, + } + for counter, sources in audit.COUNTER_SOURCE_OPERATIONS.items(): + if len(sources) == 1: + operations[sources[0]] = float(counters[counter]) + operations["MemoryStorage.supersession_current_rows_visited"] = float( + counters["supersession_current_candidate_count"] + ) + operations["MemoryStorage.supersession_historical_rows_visited"] = float( + counters["supersession_historical_candidate_count"] + ) + for counter, markers in audit.COUNTER_ACTIVITY_OPERATIONS.items(): + for marker in markers: + operations[marker] = 1.0 if counters[counter] > 0.0 else 0.0 + return operations + + +def plateau_fixture( + *, + process_windows: list[float] | None = None, + elapsed_windows: list[float] | None = None, + stop_store_growth_at: int | None = None, + growing_counter: str | None = None, +) -> tuple[dict[str, object], list[dict[str, object]]]: + event_count = 126 + window_size = 10 + ranges = audit.end_anchored_ranges(event_count, window_size) + if process_windows is None: + process_windows = [2.0, 4.0, 6.0, 8.0] + [10.0] * 8 + if elapsed_windows is None: + elapsed_windows = process_windows + rows: list[dict[str, object]] = [] + for event_index in range(event_count): + window_index = max( + 0, + min( + len(ranges) - 1, + next( + ( + index + for index, (start, end) in enumerate(ranges) + if start <= event_index < end + ), + 0, + ), + ), + ) + counters = {name: 10.0 for name in audit.REQUIRED_WORK_COUNTERS} + counters["rollback_full_cache_copy_count"] = 0.0 + counters["rollback_cache_entry_copy_count"] = 0.0 + counters["graph_cache_rebuild_count"] = 1.0 + if growing_counter: + counters[growing_counter] = float(2**window_index) + counters["supersession_rows_visited"] = ( + counters["supersession_current_candidate_count"] + + counters["supersession_historical_candidate_count"] + ) + rows.append( + { + "event_index": event_index, + "modality": "fixture", + "retention": "natural", + "process_ms": process_windows[window_index], + "latency_ms": process_windows[window_index], + "end_to_end_ms": elapsed_windows[window_index], + "consolidation_ms": 0.0, + "consolidation_epoch_id": 0, + "events_since_epoch_start": event_index + 1, + "consolidation_after_event": False, + "consolidation_epoch_counters": { + name: 0 for name in audit.REQUIRED_CONSOLIDATION_EPOCH_COUNTERS + }, + "active_epoch": { + "event_count": event_index + 1, + "mutation_count": event_index + 1, + "allocated_bytes": 16384, + "required": False, + }, + "durable_barrier_ms": 0.0, + "work_counters": counters, + "operation_ms": fixture_operation_ms(counters), + "behavior": {}, + } + ) + checkpoints = [] + for event_end in sorted({boundary for item in ranges for boundary in item}): + effective = ( + min(event_end, stop_store_growth_at) + if stop_store_growth_at is not None + else event_end + ) + checkpoints.append( + { + "event_end": event_end, + "counts": { + "memories": 1000 + effective * 5, + "signals": 1000 + effective * 5, + "associations": 1000 + effective * 5, + "embeddings": 1000 + effective * 5, + "current_memory_embeddings": 1000 + effective * 5, + "memory_reconstructions": 1000 + effective * 5, + "rif_recovery_clock": 1, + "rif_generation_resets": 0, + "rif_active_state": effective, + }, + } + ) + profile: dict[str, object] = { + "schema": "cortext_packet_storage_profile_v2", + "processed_events": event_count, + "consolidation_epoch_relational_contract_sha256": ( + audit.CONSOLIDATION_EPOCH_RELATIONAL_CONTRACT_SHA256 + ), + "retention": "natural", + "consolidation_runs": 0, + "consolidation_ms": 0.0, + "consolidation_events": [], + "honor_required_consolidation": True, + "active_epoch_limits": audit.ACTIVE_EPOCH_LIMITS, + "store_checkpoints": checkpoints, + } + return profile, rows + + +def epoch_fixture( + *, + epoch_count: int = 9, + epoch_length: int = 120, + material: bool = True, + peak_growth: float = 1.0, + trough_growth: float = 1.0, + post_drop: bool = True, + reset_counters: bool = True, + consolidation_cost_growth: float = 1.0, + epoch_lengths: list[int] | None = None, +) -> tuple[dict[str, object], list[dict[str, object]]]: + lengths = epoch_lengths or [epoch_length] * epoch_count + event_count = sum(lengths) + rows: list[dict[str, object]] = [] + events: list[dict[str, object]] = [] + consolidation_total = 0.0 + event_index = 0 + for epoch_id, current_epoch_length in enumerate(lengths): + for events_since in range(1, current_epoch_length + 1): + trough = (1.0 if post_drop else 1.2) * trough_growth**epoch_id + peak = (1.2 if material else trough) * peak_growth**epoch_id + process_ms = trough if events_since <= current_epoch_length - 50 else peak + closes = events_since == current_epoch_length + duration = consolidation_cost_growth**epoch_id if closes else 0.0 + counters = { + name: events_since + for name in audit.REQUIRED_CONSOLIDATION_EPOCH_COUNTERS + } + work_counters = { + name: (0.0 if name.startswith("rollback_") else 10.0) + for name in audit.REQUIRED_WORK_COUNTERS + } + work_counters["supersession_rows_visited"] = ( + work_counters["supersession_current_candidate_count"] + + work_counters["supersession_historical_candidate_count"] + ) + operation_ms = fixture_operation_ms(work_counters) + operation_ms.update( + { + "ConsolidationEpoch.epoch_id": float(epoch_id), + "ConsolidationEpoch.events_since_epoch_start": float(events_since), + **{ + f"ConsolidationEpoch.{name}": float(value) + for name, value in counters.items() + }, + } + ) + rows.append( + { + "event_index": event_index, + "modality": "fixture", + "retention": "natural", + "process_ms": process_ms, + "latency_ms": process_ms, + "end_to_end_ms": process_ms + duration, + "consolidation_ms": duration, + "durable_barrier_ms": 0.0, + "consolidation_epoch_id": epoch_id, + "events_since_epoch_start": events_since, + "consolidation_after_event": closes, + "consolidation_epoch_counters": counters, + "active_epoch": { + "event_count": events_since, + "mutation_count": events_since * 3, + "allocated_bytes": 16384, + "required": False, + }, + "work_counters": work_counters, + "operation_ms": operation_ms, + "behavior": {}, + } + ) + if closes: + post_counters = { + name: (0 if reset_counters else events_since) + for name in audit.REQUIRED_CONSOLIDATION_EPOCH_COUNTERS + } + event = { + "event_index": event_index, + "closing_event_index": event_index, + "consolidation_epoch_id": epoch_id, + "sealed_epoch_event_count": events_since, + "sealed_epoch_mutation_count": events_since * 3, + "sealed_mutation_identity_verified": True, + "sealed_mutation_identity_count": events_since * 3, + "duration_ms": duration, + "pre_reset_counters": counters, + "post_reset_counters": post_counters, + "post_reset_active_epoch": { + "event_count": 0, + "mutation_count": 0, + "allocated_bytes": 16384, + "required": False, + }, + "state_after": "none", + } + events.append(event) + consolidation_total += duration + event_index += 1 + ranges = audit.end_anchored_ranges(event_count, 50) + checkpoints = [] + for event_end in sorted({boundary for item in ranges for boundary in item}): + checkpoints.append( + { + "event_end": event_end, + "counts": { + "memories": 1000 + event_end * 5, + "signals": 1000 + event_end * 5, + "associations": 1000 + event_end * 5, + "embeddings": 1000 + event_end * 5, + "current_memory_embeddings": 1000 + event_end * 5, + "memory_reconstructions": 1000 + event_end * 5, + "rif_recovery_clock": 1, + "rif_generation_resets": 0, + "rif_active_state": event_end, + }, + } + ) + return { + "schema": "cortext_packet_storage_profile_v2", + "processed_events": event_count, + "consolidation_epoch_relational_contract_sha256": ( + audit.CONSOLIDATION_EPOCH_RELATIONAL_CONTRACT_SHA256 + ), + "retention": "natural", + "consolidation_runs": len(events), + "consolidation_ms": consolidation_total, + "consolidation_events": events, + "honor_required_consolidation": True, + "active_epoch_limits": audit.ACTIVE_EPOCH_LIMITS, + "store_checkpoints": checkpoints, + }, rows + + +class AttributionContractTest(unittest.TestCase): + def test_late_operation_is_attributed_with_zero_for_absent_rows(self) -> None: + result = audit.attribution_result(fixture_rows(), 10) + contributors = { + item["operation"] for item in result["ranked_positive_contributors"] + } + self.assertIn("cortext::operations::LateMaintenance", contributors) + self.assertGreaterEqual(result["explained_fraction"], 0.80) + self.assertIn("named_signed_delta_ms", result) + self.assertIn("residual_delta_ms", result) + self.assertNotIn( + "EmotionalCascade.source_count", result["detailed_subsections"] + ) + self.assertIn("EmotionalCascade.source_count", result["diagnostic_counters"]) + self.assertNotIn( + "SignalProcessor.snapshot_cache_entry_copy_count", contributors + ) + self.assertIn( + "SignalProcessor.snapshot_cache_entry_copy_count", + result["diagnostic_counters"], + ) + + def test_attribution_cli_does_not_require_prefix_flatness(self) -> None: + with tempfile.TemporaryDirectory() as directory: + root = Path(directory) + profile = root / "profile.json" + database = root / "profile.sqlite" + output = root / "audit.json" + rows = fixture_rows() + profile.write_text( + json.dumps( + { + "working_set_curve": rows, + "mean_process_ms": 1.0, + "mean_total_ms": 1.0, + "wall_ms": 1, + } + ), + encoding="utf-8", + ) + connection = sqlite3.connect(database) + try: + connection.executescript( + """ + CREATE TABLE memories(memory_id INTEGER PRIMARY KEY); + CREATE TABLE associations( + source_memory_id INTEGER, + target_memory_id INTEGER, + edge_type TEXT + ); + CREATE TABLE signals(signal_id INTEGER PRIMARY KEY); + """ + ) + finally: + connection.close() + + command = [ + sys.executable, + str(Path(__file__).with_name("audit_storage_cost_profile.py")), + "--profile", + str(profile), + "--db", + str(database), + "--window-size", + "10", + ] + attribution = subprocess.run( + [*command, "--out", str(output), "--require-attribution"], + check=False, + capture_output=True, + text=True, + ) + full_gate = subprocess.run( + command, check=False, capture_output=True, text=True + ) + self.assertEqual(attribution.returncode, 0, attribution.stderr) + self.assertEqual(full_gate.returncode, 1, full_gate.stderr) + self.assertTrue(json.loads(output.read_text())["attribution_passed"]) + + +class PlateauContractTest(unittest.TestCase): + def test_accepts_bounded_consolidation_sawtooth(self) -> None: + profile, rows = epoch_fixture() + result = audit.consolidation_epoch_result(profile, rows, 0, len(rows)) + self.assertTrue(result["passed"], result["failures"]) + self.assertEqual(result["mode"], "sawtooth") + self.assertGreaterEqual(result["material_epoch_count"], 4) + full_result = audit.suffix_plateau_result(profile, rows, 50) + self.assertTrue(full_result["passed"], full_result["candidate_failures"]) + + def test_accepts_flat_envelope_without_consolidation(self) -> None: + profile, rows = plateau_fixture() + result = audit.consolidation_epoch_result(profile, rows, 0, len(rows)) + self.assertTrue(result["passed"], result["failures"]) + self.assertEqual(result["mode"], "flat-envelope") + + def test_accepts_flat_envelope_with_complete_nonmaterial_epochs(self) -> None: + profile, rows = epoch_fixture(material=False) + result = audit.consolidation_epoch_result(profile, rows, 0, len(rows)) + self.assertTrue(result["passed"], result["failures"]) + self.assertEqual(result["mode"], "flat-envelope") + self.assertGreaterEqual(result["complete_epoch_count"], 4) + self.assertEqual(result["material_epoch_count"], 0) + + def test_rejects_successful_consolidations_without_complete_epochs(self) -> None: + profile, rows = epoch_fixture(epoch_length=60, material=False) + result = audit.consolidation_epoch_result(profile, rows, 0, len(rows)) + self.assertFalse(result["passed"]) + self.assertIn( + "successful consolidations lack four complete epochs", + result["failures"], + ) + + def test_rejects_one_to_three_material_resets(self) -> None: + profile, rows = epoch_fixture(epoch_count=4) + result = audit.consolidation_epoch_result(profile, rows, 0, len(rows)) + self.assertFalse(result["passed"]) + self.assertIn( + "one to three material epochs are insufficient", + result["failures"], + ) + + def test_rejects_rising_sawtooth_peaks(self) -> None: + profile, rows = epoch_fixture(peak_growth=1.2) + result = audit.consolidation_epoch_result(profile, rows, 0, len(rows)) + self.assertFalse(result["passed"]) + self.assertIn("sawtooth peaks rise", result["failures"]) + + def test_rejects_rising_sawtooth_troughs(self) -> None: + profile, rows = epoch_fixture(peak_growth=1.2, trough_growth=1.2) + result = audit.consolidation_epoch_result(profile, rows, 0, len(rows)) + self.assertFalse(result["passed"]) + self.assertIn("sawtooth troughs rise", result["failures"]) + + def test_rejects_material_reset_without_process_drop(self) -> None: + profile, rows = epoch_fixture(peak_growth=1.2, trough_growth=1.2) + result = audit.consolidation_epoch_result(profile, rows, 0, len(rows)) + self.assertFalse(result["passed"]) + self.assertIn( + "material epoch does not lower following process time", + result["failures"], + ) + + def test_rejects_consolidation_reset_counter_that_does_not_fall(self) -> None: + profile, rows = epoch_fixture(reset_counters=False) + result = audit.consolidation_epoch_result(profile, rows, 0, len(rows)) + self.assertFalse(result["passed"]) + self.assertIn("consolidation reset counter does not fall", result["failures"]) + + def test_zero_reset_counter_must_remain_zero(self) -> None: + profile, rows = epoch_fixture() + counter = "accumulator_signal_count" + for event in profile["consolidation_events"]: + close = event["event_index"] + rows[close]["consolidation_epoch_counters"][counter] = 0 + rows[close]["operation_ms"][f"ConsolidationEpoch.{counter}"] = 0.0 + event["pre_reset_counters"][counter] = 0 + event["post_reset_counters"][counter] = 0 + accepted = audit.consolidation_epoch_result(profile, rows, 0, len(rows)) + self.assertTrue(accepted["passed"], accepted["failures"]) + self.assertTrue( + all( + epoch["reset_counter_ratios"][counter] == 1.0 + for epoch in accepted["complete_epochs"] + ) + ) + + profile["consolidation_events"][4]["post_reset_counters"][counter] = 1 + rejected = audit.consolidation_epoch_result(profile, rows, 0, len(rows)) + self.assertFalse(rejected["passed"]) + self.assertIn("consolidation reset counter does not fall", rejected["failures"]) + self.assertEqual( + rejected["complete_epochs"][4]["reset_counter_ratios"][counter], + float("inf"), + ) + + suffix = audit.suffix_plateau_result(profile, rows, 50) + self.assertFalse(suffix["passed"]) + + def test_nonmaterial_zero_reset_counter_must_remain_zero(self) -> None: + profile, rows = epoch_fixture(material=False) + counter = "accumulator_signal_count" + for event in profile["consolidation_events"]: + close = event["event_index"] + rows[close]["consolidation_epoch_counters"][counter] = 0 + rows[close]["operation_ms"][f"ConsolidationEpoch.{counter}"] = 0.0 + event["pre_reset_counters"][counter] = 0 + event["post_reset_counters"][counter] = 0 + accepted = audit.consolidation_epoch_result(profile, rows, 0, len(rows)) + self.assertTrue(accepted["passed"], accepted["failures"]) + self.assertEqual(accepted["mode"], "flat-envelope") + + profile["consolidation_events"][4]["post_reset_counters"][counter] = 1 + rejected = audit.consolidation_epoch_result(profile, rows, 0, len(rows)) + self.assertFalse(rejected["passed"]) + self.assertIn("consolidation reset counter does not fall", rejected["failures"]) + self.assertEqual( + rejected["complete_epochs"][4]["reset_counter_ratios"][counter], + float("inf"), + ) + self.assertFalse(audit.suffix_plateau_result(profile, rows, 50)["passed"]) + + def test_rejects_growing_normalized_consolidation_cost(self) -> None: + profile, rows = epoch_fixture(consolidation_cost_growth=1.3) + result = audit.consolidation_epoch_result(profile, rows, 0, len(rows)) + self.assertFalse(result["passed"]) + self.assertIn("consolidation cost per sealed event rises", result["failures"]) + self.assertIn( + "consolidation cost per sealed mutation rises", result["failures"] + ) + + def test_rejects_increasing_consolidation_frequency(self) -> None: + profile, rows = epoch_fixture( + material=False, + epoch_lengths=[160, 150, 140, 130, 120, 110, 100], + ) + total = 0.0 + for event in profile["consolidation_events"]: + row = rows[event["event_index"]] + duration = event["sealed_epoch_event_count"] / 120.0 + row["end_to_end_ms"] += duration - row["consolidation_ms"] + row["consolidation_ms"] = duration + event["duration_ms"] = duration + total += duration + profile["consolidation_ms"] = total + result = audit.consolidation_epoch_result(profile, rows, 0, len(rows)) + self.assertFalse(result["passed"]) + self.assertIn("consolidation frequency rises", result["failures"]) + + def test_rejects_frequency_hidden_in_short_epochs(self) -> None: + profile, rows = epoch_fixture( + material=False, + epoch_lengths=[120] * 5 + [20] * 20, + ) + result = audit.consolidation_epoch_result(profile, rows, 0, len(rows)) + self.assertFalse(result["passed"]) + self.assertIn("consolidation frequency rises", result["failures"]) + + def test_rejects_corrupt_consolidation_epoch_relations(self) -> None: + profile, rows = epoch_fixture() + + corruptions = [] + + duplicate_event_index = copy.deepcopy(rows) + duplicate_event_index[1]["event_index"] = 0 + corruptions.append(("unique and contiguous", profile, duplicate_event_index)) + + skipped_event_index = copy.deepcopy(rows) + skipped_event_index[1]["event_index"] = 2 + corruptions.append(("unique and contiguous", profile, skipped_event_index)) + + nonmonotonic_epoch = copy.deepcopy(rows) + nonmonotonic_epoch[1]["consolidation_epoch_id"] = 2 + corruptions.append(("epoch sequence", profile, nonmonotonic_epoch)) + + bad_events_since = copy.deepcopy(rows) + bad_events_since[1]["events_since_epoch_start"] = 4 + corruptions.append(("epoch sequence", profile, bad_events_since)) + + orphan_profile = copy.deepcopy(profile) + del orphan_profile["consolidation_events"][0] + corruptions.append(("event indices do not match", orphan_profile, rows)) + + duplicate_close_profile = copy.deepcopy(profile) + duplicate_close_profile["consolidation_events"].append( + copy.deepcopy(duplicate_close_profile["consolidation_events"][0]) + ) + corruptions.append( + ("event indices do not match", duplicate_close_profile, rows) + ) + + bad_sealed_event_profile = copy.deepcopy(profile) + bad_sealed_event_profile["consolidation_events"][0][ + "sealed_epoch_event_count" + ] -= 1 + corruptions.append(("sealed epoch event count", bad_sealed_event_profile, rows)) + + bad_sealed_mutation_profile = copy.deepcopy(profile) + bad_sealed_mutation_profile["consolidation_events"][0][ + "sealed_mutation_identity_count" + ] -= 1 + corruptions.append( + ("mutation identity count", bad_sealed_mutation_profile, rows) + ) + + nonadjacent_profile = copy.deepcopy(profile) + nonadjacent_profile["consolidation_events"][0]["pre_reset_counters"][ + "accumulator_signal_count" + ] -= 1 + corruptions.append(("not adjacent", nonadjacent_profile, rows)) + + reset_without_close = copy.deepcopy(rows) + reset_without_close[1]["consolidation_epoch_id"] = 1 + reset_without_close[1]["events_since_epoch_start"] = 1 + corruptions.append(("epoch sequence", profile, reset_without_close)) + + for expected, corrupt_profile, corrupt_rows in corruptions: + with self.subTest(expected=expected): + with self.assertRaisesRegex(ValueError, expected): + audit.validate_profile_rows(corrupt_profile, corrupt_rows) + + def test_zero_duration_consolidation_keeps_its_close_identity(self) -> None: + profile, rows = epoch_fixture() + event = profile["consolidation_events"][0] + closing_row = rows[event["event_index"]] + profile["consolidation_ms"] -= event["duration_ms"] + closing_row["end_to_end_ms"] -= closing_row["consolidation_ms"] + closing_row["consolidation_ms"] = 0.0 + event["duration_ms"] = 0.0 + audit.validate_profile_rows(profile, rows) + + def test_rejects_end_to_end_time_that_excludes_consolidation(self) -> None: + profile, rows = epoch_fixture() + closing_row = rows[profile["consolidation_events"][0]["event_index"]] + closing_row["end_to_end_ms"] = max( + closing_row["process_ms"], closing_row["consolidation_ms"] + ) + with self.assertRaisesRegex(ValueError, "excludes required event work"): + audit.validate_profile_rows(profile, rows) + + def test_rejects_processed_event_count_mismatch(self) -> None: + profile, rows = plateau_fixture() + profile["processed_events"] += 100 + with self.assertRaisesRegex(ValueError, "does not match row count"): + audit.suffix_plateau_result(profile, rows, 10) + + def test_accepts_end_anchored_ramp_then_plateau(self) -> None: + profile, rows = plateau_fixture() + result = audit.suffix_plateau_result(profile, rows, 10) + self.assertTrue(result["passed"]) + self.assertEqual(result["accepted_suffix"]["plateau_end_event"], 126) + self.assertGreaterEqual(result["accepted_suffix"]["plateau_window_count"], 6) + self.assertEqual( + result["accepted_suffix"]["ramp_duration_events"], + result["accepted_suffix"]["plateau_start_event"], + ) + self.assertEqual(len(result["height_reference"]["source_profile_sha256"]), 64) + + def test_rejects_missing_digest_bound_height_reference(self) -> None: + profile, rows = plateau_fixture() + reference = audit.PLATEAU_HEIGHT_REFERENCES.pop("natural") + try: + with self.assertRaisesRegex(ValueError, "digest-bound"): + audit.suffix_plateau_result(profile, rows, 10) + finally: + audit.PLATEAU_HEIGHT_REFERENCES["natural"] = reference + + def test_rejects_never_ending_ramp(self) -> None: + profile, rows = plateau_fixture( + process_windows=[2.0 + index for index in range(12)] + ) + self.assertFalse(audit.suffix_plateau_result(profile, rows, 10)["passed"]) + + def test_rejects_acceleration_only_in_final_remainder(self) -> None: + for retention in ("natural", "durable"): + with self.subTest(retention=retention): + profile, rows = plateau_fixture() + profile["retention"] = retention + for row in rows: + row["retention"] = retention + if retention == "durable": + row["durable_barrier_ms"] = 0.25 + row["operation_ms"][ + "SignalProcessor.sqlite_wal_checkpoint" + ] = 0.25 + row["operation_ms"][ + "SignalProcessor.sqlite_wal_checkpoint_failure_count" + ] = 0.0 + for row in rows[-6:]: + row["process_ms"] = 30.0 + row["end_to_end_ms"] = 30.0 + result = audit.suffix_plateau_result(profile, rows, 10) + self.assertFalse(result["passed"]) + self.assertTrue(result["final_event_covered"]) + + def test_durable_barrier_requires_attribution_key_not_positive_clock_tick( + self, + ) -> None: + profile, rows = plateau_fixture() + profile["retention"] = "durable" + for row in rows: + row["retention"] = "durable" + row["durable_barrier_ms"] = 0.0 + row["operation_ms"]["SignalProcessor.sqlite_wal_checkpoint"] = 0.0 + row["operation_ms"][ + "SignalProcessor.sqlite_wal_checkpoint_failure_count" + ] = 0.0 + audit.validate_profile_rows(profile, rows) + del rows[0]["operation_ms"]["SignalProcessor.sqlite_wal_checkpoint"] + with self.assertRaisesRegex(ValueError, "barrier attribution"): + audit.validate_profile_rows(profile, rows) + + def test_rejects_failed_durable_barrier(self) -> None: + profile, rows = plateau_fixture() + profile["retention"] = "durable" + for row in rows: + row["retention"] = "durable" + row["durable_barrier_ms"] = 0.0 + row["operation_ms"]["SignalProcessor.sqlite_wal_checkpoint"] = 0.0 + row["operation_ms"][ + "SignalProcessor.sqlite_wal_checkpoint_failure_count" + ] = 0.0 + rows[-1]["operation_ms"][ + "SignalProcessor.sqlite_wal_checkpoint_failure_count" + ] = 1.0 + with self.assertRaisesRegex(ValueError, "failed post-commit barrier"): + audit.validate_profile_rows(profile, rows) + + def test_rejects_supersession_fallback_without_exact_visit_count(self) -> None: + profile, rows = plateau_fixture() + rows[0]["operation_ms"][ + "MemoryStorage.supersession_sql_fallback_count" + ] = 1.0 + with self.assertRaisesRegex(ValueError, "fallback"): + audit.validate_profile_rows(profile, rows) + + def test_rejects_flat_plateau_above_height_ceiling(self) -> None: + profile, rows = plateau_fixture( + process_windows=[2.0, 4.0, 6.0, 8.0] + [12.0] * 8 + ) + self.assertFalse(audit.suffix_plateau_result(profile, rows, 10)["passed"]) + + def test_rejects_flat_work_when_store_stops_growing(self) -> None: + profile, rows = plateau_fixture(stop_store_growth_at=66) + self.assertFalse(audit.suffix_plateau_result(profile, rows, 10)["passed"]) + + def test_rejects_missing_and_vacuous_work_counters(self) -> None: + profile, rows = plateau_fixture() + missing = copy.deepcopy(rows) + del missing[0]["work_counters"]["graph_rows_visited"] + with self.assertRaisesRegex(ValueError, "schema mismatch"): + audit.suffix_plateau_result(profile, missing, 10) + vacuous = copy.deepcopy(rows) + for row in vacuous: + row["work_counters"]["graph_exact_comparison_count"] = 0.0 + row["operation_ms"]["GraphRetrieve.family_exact_comparison_count"] = 0.0 + with self.assertRaisesRegex(ValueError, "all zero"): + audit.suffix_plateau_result(profile, vacuous, 10) + + def test_rejects_emotional_neighbor_producer_mismatch(self) -> None: + profile, rows = plateau_fixture() + for row in rows: + row["work_counters"]["emotional_neighbor_count"] = 0.0 + row["operation_ms"]["EmotionalCascade.neighbor_count"] = 1.0 + with self.assertRaisesRegex(ValueError, "does not match producer"): + audit.suffix_plateau_result(profile, rows, 10) + + def test_all_work_counters_reject_correlated_zero_placeholders(self) -> None: + profile, original_rows = plateau_fixture() + for target in audit.REQUIRED_WORK_COUNTERS: + with self.subTest(counter=target): + rows = copy.deepcopy(original_rows) + for row in rows: + counters = row["work_counters"] + operations = row["operation_ms"] + zeroed = {target} + if target == "supersession_rows_visited": + zeroed.update( + { + "supersession_current_candidate_count", + "supersession_historical_candidate_count", + } + ) + for counter in zeroed: + counters[counter] = 0.0 + for source in audit.COUNTER_SOURCE_OPERATIONS[counter]: + operations[source] = 0.0 + for marker in audit.COUNTER_ACTIVITY_OPERATIONS[counter]: + operations[marker] = 0.1 + with self.assertRaisesRegex(ValueError, "all zero"): + audit.suffix_plateau_result(profile, rows, 10) + + def test_diagnostic_row_counts_are_not_timing_operations(self) -> None: + profile, rows = plateau_fixture() + ranges = audit.end_anchored_ranges(len(rows), 10) + for row in rows: + window_index = next( + ( + index + for index, (start, end) in enumerate(ranges) + if start <= row["event_index"] < end + ), + 0, + ) + row["operation_ms"]["GraphRetrieve.seed_cache_distance_rows"] = ( + 1.08**window_index + ) + row["operation_ms"]["GraphRetrieve.seed_cache_rows"] = ( + 1.09**window_index + ) + result = audit.suffix_plateau_result(profile, rows, 10) + self.assertTrue(result["passed"], result.get("candidate_failures")) + self.assertNotIn( + "GraphRetrieve.seed_cache_distance_rows", + result["accepted_suffix"]["operation_results"], + ) + self.assertNotIn( + "GraphRetrieve.seed_cache_rows", + result["accepted_suffix"]["operation_results"], + ) + + def test_rejects_one_growing_active_counter(self) -> None: + profile, rows = plateau_fixture(growing_counter="graph_rows_visited") + self.assertFalse(audit.suffix_plateau_result(profile, rows, 10)["passed"]) + + def test_rejects_growing_consolidation_cost_with_flat_process(self) -> None: + profile, rows = plateau_fixture( + elapsed_windows=[2.0, 4.0, 6.0, 8.0] + + [10.0, 10.0, 10.0, 10.0, 20.0, 20.0, 20.0, 20.0] + ) + self.assertFalse(audit.suffix_plateau_result(profile, rows, 10)["passed"]) + + def test_rejects_plateau_shorter_than_six_windows(self) -> None: + profile, rows = plateau_fixture( + process_windows=[2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 2.0] + [10.0] * 5 + ) + self.assertFalse(audit.suffix_plateau_result(profile, rows, 10)["passed"]) + + +if __name__ == "__main__": + unittest.main() diff --git a/tools/extract_claude_session_packets.py b/tools/extract_claude_session_packets.py new file mode 100644 index 00000000..02101389 --- /dev/null +++ b/tools/extract_claude_session_packets.py @@ -0,0 +1,146 @@ +#!/usr/bin/env python3 +"""Extract content-private sentence/tool packets from Claude session JSONL.""" + +from __future__ import annotations + +import argparse +import hashlib +import json +import re +from pathlib import Path +from typing import Any, Iterable + + +SENTENCE_BREAK = re.compile(r"(?<=[.!?])\s+|\n+") + + +def compact_json(value: Any) -> str: + # Match JavaScript JSON.stringify used by the original replay transform: + # preserve insertion order, omit formatting whitespace, retain Unicode. + return json.dumps(value, separators=(",", ":"), ensure_ascii=False) + + +def javascript_slice(text: str, code_units: int) -> str: + encoded = text.encode("utf-16-le", errors="surrogatepass") + return encoded[: code_units * 2].decode("utf-16-le", errors="ignore") + + +def block_text(block: dict[str, Any]) -> str | None: + kind = block.get("type") + if kind == "text": + value = block.get("text") + return value if isinstance(value, str) else None + if kind == "tool_use": + return javascript_slice(compact_json(block.get("input")), 2000) + if kind == "tool_result": + content = block.get("content") + if isinstance(content, str): + return content + if isinstance(content, list): + parts = [ + item.get("text", "") + for item in content + if isinstance(item, dict) and isinstance(item.get("text"), str) + ] + if parts: + return "\n".join(parts) + return compact_json(content) + return None + + +def message_texts(record: dict[str, Any]) -> Iterable[str]: + if record.get("type") not in {"user", "assistant"}: + return + message = record.get("message") + if not isinstance(message, dict): + return + content = message.get("content") + if isinstance(content, str): + yield content + elif isinstance(content, list): + for block in content: + if isinstance(block, dict): + text = block_text(block) + if text: + yield text + + +def packets_from_text(text: str) -> Iterable[str]: + for sentence in SENTENCE_BREAK.split(text): + sentence = sentence.strip() + while sentence: + if len(sentence) <= 400: + yield sentence + break + split = sentence.rfind(" ", 10, 401) + if split < 10: + split = 400 + yield sentence[:split] + sentence = sentence[split:].lstrip() + + +def extract_records(paths: list[Path]) -> list[str]: + records: list[str] = [] + for path in paths: + with path.open(encoding="utf-8", errors="replace") as stream: + for line in stream: + try: + record = json.loads(line) + except json.JSONDecodeError: + continue + if not isinstance(record, dict): + continue + text = "\n".join(message_texts(record)).strip() + if text: + records.append(text) + return records + + +def extract(paths: list[Path]) -> tuple[list[str], list[str]]: + records = extract_records(paths) + packets: list[str] = [] + for text in records: + packets.extend(packets_from_text(text)) + return records, packets + + +def main() -> int: + parser = argparse.ArgumentParser() + parser.add_argument("inputs", nargs="+", type=Path) + parser.add_argument("--out", type=Path) + parser.add_argument("--durable-out", type=Path) + parser.add_argument("--max-packets", type=int) + parser.add_argument("--dry-run", action="store_true") + args = parser.parse_args() + records, packets = extract(args.inputs) + if args.max_packets is not None: + packets = packets[: args.max_packets] + payload = ("\n".join(packets) + "\n").encode("utf-8") + durable_payload = ("\n".join(compact_json(record) for record in records) + "\n").encode( + "utf-8" + ) + path_set = "\n".join(str(path.resolve()) for path in args.inputs).encode() + summary = { + "input_count": len(args.inputs), + "path_set_sha256": hashlib.sha256(path_set).hexdigest(), + "logical_record_count": len(records), + "packet_count": len(packets), + "corpus_sha256": hashlib.sha256(payload).hexdigest(), + "corpus_bytes": len(payload), + "durable_corpus_sha256": hashlib.sha256(durable_payload).hexdigest(), + "durable_corpus_bytes": len(durable_payload), + } + if not args.dry_run: + if args.out is None: + raise ValueError("--out is required unless --dry-run is used") + args.out.parent.mkdir(parents=True, exist_ok=True) + args.out.write_bytes(payload) + if args.durable_out is not None: + args.durable_out.parent.mkdir(parents=True, exist_ok=True) + args.durable_out.write_bytes(durable_payload) + print(json.dumps(summary, sort_keys=True)) + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) From eaa366f914892b70525e37ad68d7bed32fe7de07 Mon Sep 17 00:00:00 2001 From: gabewillen Date: Sat, 18 Jul 2026 12:22:02 -0500 Subject: [PATCH 04/18] Align Zig SQLite feature flags --- build.zig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build.zig b/build.zig index ccaa5da7..ae801f1b 100644 --- a/build.zig +++ b/build.zig @@ -412,6 +412,8 @@ pub fn build(b: *std.Build) void { mod.addCMacro("SQLITE_CORE", "1"); mod.addCMacro("SQLITE_THREADSAFE", "1"); mod.addCMacro("SQLITE_ENABLE_JSON1", "1"); + mod.addCMacro("SQLITE_ENABLE_MATH_FUNCTIONS", "1"); + mod.addCMacro("SQLITE_ENABLE_PREUPDATE_HOOK", "1"); mod.addCMacro("CORTEXT_EMBED_VEC", "1"); mod.addCMacro("SQLITE_VEC_OMIT_FS", "1"); mod.addCMacro("CORTEXT_EMBED_OBJSTORE", "1"); From d91adf56a18ac7222c7c6ae8addcfca27db94b6e Mon Sep 17 00:00:00 2001 From: gabewillen Date: Sat, 18 Jul 2026 12:44:59 -0500 Subject: [PATCH 05/18] Repair native CI test configuration --- .github/workflows/build.yml | 8 ++++---- CMakeLists.txt | 5 +---- tests/operations_emotion_cascade.test.cpp | 16 ++++++++-------- 3 files changed, 13 insertions(+), 16 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1bbf3fd0..8fb23d8e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,7 +19,7 @@ jobs: sudo apt-get install -y cmake build-essential pkg-config libsqlite3-dev - name: Configure CMake - run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DCORTEXT_FETCH_AIST_MODEL=OFF -DCORTEXT_DISABLE_OPENTELEMETRY=ON + run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DCORTEXT_FETCH_AIST_MODEL=OFF -DCORTEXT_DISABLE_OPENTELEMETRY=ON -DCORTEXT_EXPERIMENT_HOOKS=ON - name: Build run: cmake --build build -j8 @@ -38,7 +38,7 @@ jobs: docker run --rm -v "$PWD:/workspace" -w /workspace archlinux:base-devel bash -lc ' pacman -Syu --noconfirm cmake make gcc pkgconf sqlite git git config --global --add safe.directory /workspace - cmake -S . -B build-arch -DCMAKE_BUILD_TYPE=Release -DCORTEXT_FETCH_AIST_MODEL=OFF -DCORTEXT_DISABLE_OPENTELEMETRY=ON + cmake -S . -B build-arch -DCMAKE_BUILD_TYPE=Release -DCORTEXT_FETCH_AIST_MODEL=OFF -DCORTEXT_DISABLE_OPENTELEMETRY=ON -DCORTEXT_EXPERIMENT_HOOKS=ON cmake --build build-arch -j"$(nproc)" ./build-arch/tests/cortext_tests "~[aist]" --reporter compact ' @@ -66,7 +66,7 @@ jobs: run: python3 scripts/download_aist_model.py --output-dir models --quant q8_0 - name: Configure CMake - run: cmake -S . -B build-aist -DCMAKE_BUILD_TYPE=Release -DCORTEXT_FETCH_AIST_MODEL=OFF -DCORTEXT_DISABLE_OPENTELEMETRY=ON + run: cmake -S . -B build-aist -DCMAKE_BUILD_TYPE=Release -DCORTEXT_FETCH_AIST_MODEL=OFF -DCORTEXT_DISABLE_OPENTELEMETRY=ON -DCORTEXT_EXPERIMENT_HOOKS=ON - name: Build run: cmake --build build-aist -j8 @@ -86,7 +86,7 @@ jobs: sudo apt-get install -y cmake build-essential pkg-config libsqlite3-dev - name: Configure CMake - run: cmake -S . -B build-sanitizers -DCMAKE_BUILD_TYPE=Debug -DCORTEXT_FETCH_AIST_MODEL=OFF -DCORTEXT_DISABLE_OPENTELEMETRY=ON -DCORTEXT_ENABLE_ASAN=ON -DCORTEXT_ENABLE_UBSAN=ON + run: cmake -S . -B build-sanitizers -DCMAKE_BUILD_TYPE=Debug -DCORTEXT_FETCH_AIST_MODEL=OFF -DCORTEXT_DISABLE_OPENTELEMETRY=ON -DCORTEXT_EXPERIMENT_HOOKS=ON -DCORTEXT_ENABLE_ASAN=ON -DCORTEXT_ENABLE_UBSAN=ON - name: Build run: cmake --build build-sanitizers -j8 diff --git a/CMakeLists.txt b/CMakeLists.txt index 8f3947e5..2cbb56ca 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -671,10 +671,6 @@ if(CORTEXT_ENABLE_MSAN AND NOT EMSCRIPTEN) message(STATUS "MemorySanitizer enabled for cortext") endif() -if(BUILD_TESTING) - target_compile_definitions(cortext PRIVATE CORTEXT_TESTING=1) -endif() - if(EMSCRIPTEN) target_compile_options(cortext PRIVATE -O3 @@ -831,6 +827,7 @@ endif() include(CTest) if(BUILD_TESTING) + target_compile_definitions(cortext PRIVATE CORTEXT_TESTING=1) add_subdirectory(tests) endif() diff --git a/tests/operations_emotion_cascade.test.cpp b/tests/operations_emotion_cascade.test.cpp index c9e61e71..bea6970e 100644 --- a/tests/operations_emotion_cascade.test.cpp +++ b/tests/operations_emotion_cascade.test.cpp @@ -157,8 +157,8 @@ ExecuteCascade (const std::shared_ptr &store, bool commit = true) cfg.sensitivity = 0.5; cfg.stability = 0.5; ProcessorContext processor_context; - OperationContext context ( - MakeSignal (1'000'000), processor_context, cfg, store.get ()); + const Signal signal = MakeSignal (1'000'000); + OperationContext context (signal, processor_context, cfg, store.get ()); auto transaction = store->Begin (); PropagateEmotionalCascade operation; operation.Execute (context, *transaction); @@ -184,8 +184,8 @@ ExecuteCascadeWithMetadataCache ( ProcessorContext processor_context; operations::emotional_metadata_cache_internal::Reset ( processor_context, std::move (metadata)); - OperationContext context ( - MakeSignal (1'000'000), processor_context, cfg, store.get ()); + const Signal signal = MakeSignal (1'000'000); + OperationContext context (signal, processor_context, cfg, store.get ()); auto transaction = store->Begin (); PropagateEmotionalCascade operation; operation.Execute (context, *transaction); @@ -599,8 +599,8 @@ TEST_CASE ("PropagateEmotionalCascade skips a stable fixed-point traversal", { 3, 3, 3'000'000, false, 0.0, 0.0, 0.0, 0, 0.0 } }); auto execute = [&] (uint64_t timestamp) { - OperationContext context ( - MakeSignal (timestamp), processor_context, cfg, store.get ()); + const Signal signal = MakeSignal (timestamp); + OperationContext context (signal, processor_context, cfg, store.get ()); auto transaction = store->Begin (); PropagateEmotionalCascade operation; operation.Execute (context, *transaction); @@ -694,8 +694,8 @@ TEST_CASE ("Ordinary unconnected storage preserves the emotional fixed point", { 2, 2, 3'000'000, false, 0.0, 0.0, 0.0, 0, 0.0 } }); auto execute = [&] (uint64_t timestamp) { - OperationContext context ( - MakeSignal (timestamp), processor_context, cfg, store.get ()); + const Signal signal = MakeSignal (timestamp); + OperationContext context (signal, processor_context, cfg, store.get ()); auto transaction = store->Begin (); PropagateEmotionalCascade operation; operation.Execute (context, *transaction); From 16f6b950d0d33599e93aa398a01cbdeee32ee4c1 Mon Sep 17 00:00:00 2001 From: gabewillen Date: Sat, 18 Jul 2026 13:15:59 -0500 Subject: [PATCH 06/18] Isolate emotional cascade test caches --- src/operations/emotion_cascade.cpp | 3 ++- tests/operations_emotion_cascade.test.cpp | 28 +++++++++++++++++++---- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/src/operations/emotion_cascade.cpp b/src/operations/emotion_cascade.cpp index 0b17cc82..29cfe7f4 100644 --- a/src/operations/emotion_cascade.cpp +++ b/src/operations/emotion_cascade.cpp @@ -73,7 +73,8 @@ LoadEmotionalSources (Store *store, long long recent_window_ts, " source.half_life_bonus, source.cascade_radius, " " source.cascade_decay, " " (SELECT resolved.memory_id FROM memories resolved " - " WHERE resolved.embedding_id = source.embedding_id LIMIT 1) " + " WHERE resolved.embedding_id = source.embedding_id " + " ORDER BY resolved.memory_id ASC LIMIT 1) " " AS traversal_memory_id " "FROM memories source " "WHERE flashbulb = 1 AND emotional_intensity >= ?1 " diff --git a/tests/operations_emotion_cascade.test.cpp b/tests/operations_emotion_cascade.test.cpp index bea6970e..a6b4373a 100644 --- a/tests/operations_emotion_cascade.test.cpp +++ b/tests/operations_emotion_cascade.test.cpp @@ -87,6 +87,24 @@ TotalChanges (Store &store) return std::any_cast (rows[0].at ("total_changes")); } +class ScopedExecutionCacheSidecar +{ +public: + explicit ScopedExecutionCacheSidecar (ProcessorContext &context) + : context_ (context) + { + operations::execution_cache_sidecar_internal::Erase (context_); + } + + ~ScopedExecutionCacheSidecar () + { + operations::execution_cache_sidecar_internal::Erase (context_); + } + +private: + ProcessorContext &context_; +}; + class RawEmotionalMutationThenCascade final : public IOperation { public: @@ -157,6 +175,7 @@ ExecuteCascade (const std::shared_ptr &store, bool commit = true) cfg.sensitivity = 0.5; cfg.stability = 0.5; ProcessorContext processor_context; + ScopedExecutionCacheSidecar sidecar_scope (processor_context); const Signal signal = MakeSignal (1'000'000); OperationContext context (signal, processor_context, cfg, store.get ()); auto transaction = store->Begin (); @@ -182,6 +201,7 @@ ExecuteCascadeWithMetadataCache ( cfg.sensitivity = 0.5; cfg.stability = 0.5; ProcessorContext processor_context; + ScopedExecutionCacheSidecar sidecar_scope (processor_context); operations::emotional_metadata_cache_internal::Reset ( processor_context, std::move (metadata)); const Signal signal = MakeSignal (1'000'000); @@ -209,6 +229,7 @@ TEST_CASE ("Emotional metadata cache preserves shared embedding minima", "[operations][emotion_cascade][metadata_cache][shared_embedding]") { ProcessorContext pctx; + ScopedExecutionCacheSidecar sidecar_scope (pctx); operations::emotional_metadata_cache_internal::Reset ( pctx, { { 10, 100, 2000, true, 0.9, 0.8, 3.0, 1, 0.5 }, @@ -400,10 +421,7 @@ TEST_CASE ("PropagateEmotionalCascade uses a millisecond consolidation window", cortext::testing::RequireEncoder (cfg); cfg.stability = 0.0; // Five-minute source window. ProcessorContext pctx; - // This white-box operation test bypasses SignalProcessor, whose lifecycle - // normally owns and clears the private execution sidecar. Ensure a reused - // stack address cannot inherit cache state from an earlier direct test. - operations::execution_cache_sidecar_internal::Erase (pctx); + ScopedExecutionCacheSidecar sidecar_scope (pctx); Signal signal = MakeSignal (now_ms); OperationContext ctx (signal, pctx, cfg, store.get ()); auto tx = store->Begin (); @@ -592,6 +610,7 @@ TEST_CASE ("PropagateEmotionalCascade skips a stable fixed-point traversal", cfg.sensitivity = 0.5; cfg.stability = 0.5; ProcessorContext processor_context; + ScopedExecutionCacheSidecar sidecar_scope (processor_context); operations::emotional_metadata_cache_internal::Reset ( processor_context, { { 1, 1, 3'000'000, true, 0.9, 0.9, 2.0, 2, 0.5 }, @@ -688,6 +707,7 @@ TEST_CASE ("Ordinary unconnected storage preserves the emotional fixed point", cfg.sensitivity = 0.5; cfg.stability = 0.5; ProcessorContext processor_context; + ScopedExecutionCacheSidecar sidecar_scope (processor_context); operations::emotional_metadata_cache_internal::Reset ( processor_context, { { 1, 1, 3'000'000, true, 0.9, 0.9, 2.0, 1, 0.5 }, From d3df85e3b12cfd38af2fe70e1237d208e321c85a Mon Sep 17 00:00:00 2001 From: Gabriel Willen <91307534+gabewillen@users.noreply.github.com> Date: Sat, 18 Jul 2026 16:26:46 -0500 Subject: [PATCH 07/18] Make retrieval cutover gates fail closed --- docs/paper/_manuscript/index.md | 55 ++ docs/paper/sections/11_optimization.qmd | 51 ++ examples/benchmark/chat_replay_live_run.cpp | 190 +++++- tools/audit_storage_cost_profile.py | 683 +++++++++++++++++++- tools/audit_storage_cost_profile_test.py | 610 ++++++++++++++++- 5 files changed, 1576 insertions(+), 13 deletions(-) mode change 100755 => 100644 tools/audit_storage_cost_profile.py diff --git a/docs/paper/_manuscript/index.md b/docs/paper/_manuscript/index.md index ee5787d1..6bb221b9 100644 --- a/docs/paper/_manuscript/index.md +++ b/docs/paper/_manuscript/index.md @@ -6287,6 +6287,61 @@ cycle-symmetric retrieval sawtooth. Write cost remains a reported tradeoff, and this preference does not substitute for replay evidence or authorize a semantic cutover. +The cutover audit makes that objective decidable. It measures retrieval +work as candidate plus exact-comparison counts rather than wall time, +divides the Natural replay at successful public-consolidation +boundaries, resamples each complete material cycle to 50 equal-progress +bins, and normalizes each cycle by the difference between its +first-50-event post-consolidation mean and its last-50-event +pre-consolidation mean. A cycle whose latter mean is lower is an inverse +ramp and fails; a zero range is represented by an all-zero profile and +also fails because every accepted cycle must exhibit the same material +positive ramp required of the process-time envelope. Retrieval-work +peaks and following troughs are independently subject to the same +non-rising half, Theil–Sen, and bootstrap trend bounds as the process +envelope, preventing geometrically declining flat cycles from +masquerading as consolidation resets. Each cycle also limits accumulated +negative variation to 0.25 of its anchored ramp and its maximum event +work to 1.25 times the trailing mean, while every event must stay within +the normal-comparison ceiling derived from F/S/T. These independent +shape and amplitude constraints prevent a candidate-derived median +template from accepting repeatable spikes. At least ten material cycles +are required; at least 80% must reset to no more than 90% of their +trailing pre-consolidation work; the nearest-rank 95th-percentile +cycle-to-median-template mean absolute error must be at most 0.20; and +the final-five versus prior-five template error must be at most 0.10. +Natural cutover cannot use flat-envelope mode to bypass these cycle +gates; the already-flat Durable control remains eligible for its +separate flat-envelope contract. The separate 512-query, top-16 corpus +gate preserves exact identifier recall and exact top-1 at 1.0 and +requires the complete ordered top-16 identity list to match, including +seven fixed identity-and-rank probes. The summary is recomputed from all +512 per-query records rather than trusted as a label. The candidate must +match a separate control artifact whose exact content digest was +approved before the audit; deterministic query indices, embedding +identities, ranked controls, and the seven fixed probe positions are +bound across those artifacts. The approved control must identify the +current public retrieval path, and the candidate must also preserve the +independently recorded digest of the pre-existing seven public +identity-and-rank probes; the pre- and post-restart probe digests at +every retained-history fraction must equal the candidate/control +fixed-probe digest, so a restart cannot preserve a consistent but +incorrect ranking; the benchmark’s exhaustive embedding-neighbor mode +can propose a control artifact but cannot label itself approved. Hashed +source provenance, modality, and history position come from the queried +embedding’s authoritative SQLite signal rows; together they must cover +early, middle, and late history, text, audio, image, and at least four +opaque sources. Restart acceptance likewise derives the fixed row-visit +ceiling from F/S/T and checks measured retained-row and visited-row +series from a production-shaped persistent restart rather than trusting +pass/fail labels. The three retained counts are fixed at 25%, 50%, and +100% of the bound corpus, visited-row counts must be nonzero and within +the F/S/T capacity, and a ranked probe digest before restart must match +the restored probe with at least top-16 candidate state. The current +synthetic full-history fallback measurement is explicitly ineligible. +These are candidate-selection thresholds, not evidence that the current +observation-only graph passes them. + On 2026-06-30, a full Meta MSC replay rerun verified the retrieval-cache optimization on the same 9,130-turn slice used for the hosted frontier-judge artifact. The run preserved native probe behavior diff --git a/docs/paper/sections/11_optimization.qmd b/docs/paper/sections/11_optimization.qmd index 8507dc0a..abc80e1a 100644 --- a/docs/paper/sections/11_optimization.qmd +++ b/docs/paper/sections/11_optimization.qmd @@ -168,6 +168,57 @@ peaks and troughs, a material reset, and a more cycle-symmetric retrieval sawtooth. Write cost remains a reported tradeoff, and this preference does not substitute for replay evidence or authorize a semantic cutover. +The cutover audit makes that objective decidable. It measures retrieval work as +candidate plus exact-comparison counts rather than wall time, divides the +Natural replay at successful public-consolidation boundaries, resamples each +complete material cycle to 50 equal-progress bins, and normalizes each cycle by +the difference between its first-50-event post-consolidation mean and its +last-50-event pre-consolidation mean. A cycle whose latter mean is lower is an +inverse ramp and fails; a zero range is represented by an all-zero profile and +also fails because every accepted cycle must exhibit the same material positive +ramp required of the process-time envelope. Retrieval-work peaks and following +troughs are independently subject to the same non-rising half, Theil--Sen, and +bootstrap trend bounds as the process envelope, preventing geometrically +declining flat cycles from masquerading as consolidation resets. Each cycle +also limits accumulated negative variation to 0.25 of its anchored ramp and its +maximum event work to 1.25 times the trailing mean, while every event must stay +within the normal-comparison ceiling derived from F/S/T. These independent +shape and amplitude constraints prevent a candidate-derived median template +from accepting repeatable spikes. At least ten material cycles are required; +at least 80% must reset to no more than 90% of their trailing +pre-consolidation work; the nearest-rank 95th-percentile +cycle-to-median-template mean absolute +error must be at most 0.20; and the final-five versus prior-five template error +must be at most 0.10. Natural cutover cannot use flat-envelope mode to bypass +these cycle gates; the already-flat Durable control remains eligible for its +separate flat-envelope contract. The separate 512-query, top-16 corpus gate +preserves exact +identifier recall and exact top-1 at 1.0 and requires the complete ordered +top-16 identity list to match, including seven fixed identity-and-rank probes. +The summary is recomputed from all 512 per-query records rather than trusted as +a label. The candidate must match a separate control artifact whose exact +content digest was approved before the audit; deterministic query indices, +embedding identities, ranked controls, and the seven fixed probe positions are +bound across those artifacts. The approved control must identify the current +public retrieval path, and the candidate must also preserve the independently +recorded digest of the pre-existing seven public identity-and-rank probes; the +pre- and post-restart probe digests at every retained-history fraction must +equal the candidate/control fixed-probe digest, so a restart cannot preserve a +consistent but incorrect ranking; the +benchmark's exhaustive embedding-neighbor mode can propose a control artifact +but cannot label itself approved. Hashed source provenance, modality, and history +position come from the queried embedding's authoritative SQLite signal rows; +together they must cover early, middle, and late history, text, audio, image, +and at least four opaque sources. Restart acceptance likewise derives the fixed +row-visit ceiling from F/S/T and checks measured retained-row and visited-row +series from a production-shaped persistent restart rather than trusting +pass/fail labels. The three retained counts are fixed at 25%, 50%, and 100% of +the bound corpus, visited-row counts must be nonzero and within the F/S/T +capacity, and a ranked probe digest before restart must match the restored +probe with at least top-16 candidate state. The current synthetic full-history +fallback measurement is explicitly ineligible. These are candidate-selection +thresholds, not evidence that the current observation-only graph passes them. + On 2026-06-30, a full Meta MSC replay rerun verified the retrieval-cache optimization on the same 9,130-turn slice used for the hosted frontier-judge artifact. The run preserved native probe behavior exactly: all non-timing probe diff --git a/examples/benchmark/chat_replay_live_run.cpp b/examples/benchmark/chat_replay_live_run.cpp index d0361128..8428e90e 100644 --- a/examples/benchmark/chat_replay_live_run.cpp +++ b/examples/benchmark/chat_replay_live_run.cpp @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -99,6 +100,7 @@ struct Config bool append = false; bool resume_from_existing = false; bool profile_probes_only = false; + bool shadow_quality_control = false; bool checkpoint_eval_only = false; int progress_stride = 1000; std::uint64_t fixed_timestamp_base_ms = 0; @@ -117,6 +119,35 @@ struct Config std::string sqlite_profile = "realtime"; }; +struct ShadowQualityModeMetadata +{ + const char *role; + const char *control_kind; +}; + +constexpr ShadowQualityModeMetadata +ShadowQualityMode (bool exact_control) +{ + return exact_control + ? ShadowQualityModeMetadata { + "control-candidate", + "exhaustive-embedding-neighbor-candidate", + } + : ShadowQualityModeMetadata { + "candidate", + "bounded-activation-router-candidate", + }; +} + +static_assert (std::string_view (ShadowQualityMode (false).role) + == "candidate"); +static_assert (std::string_view (ShadowQualityMode (false).control_kind) + == "bounded-activation-router-candidate"); +static_assert (std::string_view (ShadowQualityMode (true).role) + == "control-candidate"); +static_assert (std::string_view (ShadowQualityMode (true).control_kind) + == "exhaustive-embedding-neighbor-candidate"); + struct ResumeCheckpoint { bool enabled = false; @@ -1815,6 +1846,8 @@ ParseArgs (int argc, char **argv) cfg.message_corpus = require_value (); else if (arg == "--shadow-embedding-corpus") cfg.shadow_embedding_corpus = require_value (); + else if (arg == "--shadow-quality-control") + cfg.shadow_quality_control = true; else if (arg == "--db") cfg.db_path = require_value (); else if (arg == "--out") @@ -1994,6 +2027,14 @@ struct ShadowEmbeddingCorpus embeddings; }; +struct ShadowQueryProvenance +{ + std::vector source_id_digests; + std::vector modalities; + std::size_t history_ordinal = std::numeric_limits::max (); + std::size_t history_count = 0; +}; + ShadowEmbeddingCorpus ReadShadowEmbeddingCorpus (const fs::path &path) { @@ -2013,6 +2054,8 @@ ReadShadowEmbeddingCorpus (const fs::path &path) ShadowEmbeddingCorpus corpus; corpus.ids.resize (static_cast (count)); corpus.embeddings.resize (static_cast (count)); + std::unordered_set seen_ids; + seen_ids.reserve (static_cast (count)); std::vector values (dimension, 0.0F); for (std::size_t index = 0; index < corpus.embeddings.size (); ++index) { @@ -2025,6 +2068,10 @@ ReadShadowEmbeddingCorpus (const fs::path &path) throw std::runtime_error ( "truncated shadow embedding corpus at record " + std::to_string (index)); + if (!seen_ids.insert (corpus.ids[index]).second) + throw std::runtime_error ( + "duplicate identity in shadow embedding corpus: " + + std::to_string (corpus.ids[index])); Eigen::Map mapped ( values.data (), static_cast (values.size ())); if (!shadow::Normalize (mapped, corpus.embeddings[index])) @@ -2038,6 +2085,86 @@ ReadShadowEmbeddingCorpus (const fs::path &path) return corpus; } +std::vector +ReadShadowQueryProvenance (const fs::path &database_path, + const ShadowEmbeddingCorpus &corpus) +{ + if (database_path.empty () || !fs::exists (database_path)) + throw std::runtime_error ( + "shadow quality requires the authoritative --db for query provenance"); + sqlite3 *raw_database = nullptr; + if (sqlite3_open_v2 (database_path.string ().c_str (), &raw_database, + SQLITE_OPEN_READONLY, nullptr) + != SQLITE_OK) + { + const std::string message + = raw_database != nullptr ? sqlite3_errmsg (raw_database) + : "failed to allocate SQLite handle"; + if (raw_database != nullptr) + sqlite3_close (raw_database); + throw std::runtime_error ("failed to open shadow provenance database: " + + message); + } + std::unique_ptr database ( + raw_database, sqlite3_close); + sqlite3_stmt *raw_statement = nullptr; + constexpr const char *query + = "SELECT embedding_id, source_id, modality FROM signals " + "WHERE embedding_id IS NOT NULL ORDER BY timestamp, signal_id"; + if (sqlite3_prepare_v2 (database.get (), query, -1, &raw_statement, nullptr) + != SQLITE_OK) + throw std::runtime_error ("failed to query shadow provenance database: " + + std::string (sqlite3_errmsg (database.get ()))); + std::unique_ptr statement ( + raw_statement, sqlite3_finalize); + + std::unordered_map by_embedding; + int step = SQLITE_ROW; + std::size_t history_ordinal = 0; + while ((step = sqlite3_step (statement.get ())) == SQLITE_ROW) + { + const auto embedding_id = sqlite3_column_int64 (statement.get (), 0); + const auto *source = reinterpret_cast ( + sqlite3_column_text (statement.get (), 1)); + const auto *modality = reinterpret_cast ( + sqlite3_column_text (statement.get (), 2)); + if (source == nullptr || modality == nullptr) + throw std::runtime_error ( + "shadow provenance contains a null source or modality"); + auto &entry = by_embedding[embedding_id]; + entry.history_ordinal + = std::min (entry.history_ordinal, history_ordinal); + entry.source_id_digests.push_back (PrivateValueDigest (source)); + entry.modalities.emplace_back (modality); + ++history_ordinal; + } + if (step != SQLITE_DONE) + throw std::runtime_error ("failed while reading shadow provenance: " + + std::string (sqlite3_errmsg (database.get ()))); + + std::vector result; + result.reserve (corpus.ids.size ()); + for (const auto embedding_id : corpus.ids) + { + auto found = by_embedding.find (embedding_id); + if (found == by_embedding.end ()) + throw std::runtime_error ( + "shadow embedding lacks authoritative signal provenance: " + + std::to_string (embedding_id)); + auto provenance = found->second; + provenance.history_count = history_ordinal; + for (auto *values : { &provenance.source_id_digests, + &provenance.modalities }) + { + std::sort (values->begin (), values->end ()); + values->erase (std::unique (values->begin (), values->end ()), + values->end ()); + } + result.push_back (std::move (provenance)); + } + return result; +} + struct ShadowQualityAccumulator { std::uint64_t count = 0; @@ -2126,6 +2253,8 @@ RunShadowEmbeddingQuality (const Config &cfg) "shadow query count and result k must be positive"); const auto corpus = ReadShadowEmbeddingCorpus ( cfg.shadow_embedding_corpus); + const auto query_provenance + = ReadShadowQueryProvenance (cfg.db_path, corpus); const auto parameters = shadow::DeriveParameters (cfg.focus, cfg.sensitivity, cfg.stability); shadow::State state (parameters); @@ -2179,6 +2308,7 @@ RunShadowEmbeddingQuality (const Config &cfg) ShadowQualityAccumulator duplicates; ShadowQualityAccumulator nonduplicates; std::array query_age; + nlohmann::json query_evidence = nlohmann::json::array (); const auto evaluation_started = std::chrono::steady_clock::now (); for (int query_number = 0; query_number < cfg.shadow_queries; ++query_number) @@ -2217,9 +2347,15 @@ RunShadowEmbeddingQuality (const Config &cfg) corpus.embeddings[index]), index }); } - const std::size_t candidate_count = candidates.size (); - take_best (candidates, - static_cast (cfg.shadow_result_k)); + std::size_t candidate_count = candidates.size (); + if (cfg.shadow_quality_control) + { + candidates = exact; + candidate_count = candidates.size (); + } + else + take_best (candidates, + static_cast (cfg.shadow_result_k)); if (exact.empty () || candidates.empty ()) throw std::runtime_error ("shadow quality query returned no result"); @@ -2247,6 +2383,32 @@ RunShadowEmbeddingQuality (const Config &cfg) const double exact_best_similarity = 1.0 - exact.front ().distance / 2.0; const double best_similarity = 1.0 - candidates.front ().distance / 2.0; const bool duplicate_query = exact.front ().distance <= 1.0e-6F; + nlohmann::json exact_ranked_ids = nlohmann::json::array (); + nlohmann::json candidate_ranked_ids = nlohmann::json::array (); + for (const auto &item : exact) + exact_ranked_ids.push_back (corpus.ids[item.index]); + for (const auto &item : candidates) + candidate_ranked_ids.push_back (corpus.ids[item.index]); + const auto &provenance = query_provenance[query_index]; + const std::size_t history_segment = std::min ( + 2, provenance.history_ordinal * 3 / provenance.history_count); + constexpr std::array history_segment_names { + "early", "middle", "late" + }; + query_evidence.push_back ( + { { "query_number", query_number }, + { "query_index", query_index }, + { "query_embedding_id", corpus.ids[query_index] }, + { "exact_ranked_ids", std::move (exact_ranked_ids) }, + { "candidate_ranked_ids", std::move (candidate_ranked_ids) }, + { "exact_neighbor_semantic_coverage", + semantic_coverage / exact.size () }, + { "source_ids", + provenance.source_id_digests }, + { "modalities", provenance.modalities }, + { "history_ordinal", provenance.history_ordinal }, + { "history_count", provenance.history_count }, + { "history_segment", history_segment_names[history_segment] } }); auto add = [&] (ShadowQualityAccumulator &accumulator) { ++accumulator.count; @@ -2336,12 +2498,14 @@ RunShadowEmbeddingQuality (const Config &cfg) seed->Commit (); shadow::State rebuilt (parameters); shadow::RebuildFromPersistentAuthority (rebuilt, *restart_store); - if (rebuilt.disabled || rebuilt.metrics.restart_rows_visited != row_count) + if (rebuilt.disabled) throw std::runtime_error ( "shadow SQLite restart measurement failed at fraction " + std::to_string (fraction)); restart_measurements.push_back ( { { "fraction", fraction }, + { "measurement_authority", + "synthetic-full-history-fallback" }, { "retained_rows", row_count }, { "rows_visited", rebuilt.metrics.restart_rows_visited }, { "rebuild_ms", rebuilt.metrics.restart_rebuild_ms }, @@ -2350,8 +2514,23 @@ RunShadowEmbeddingQuality (const Config &cfg) { "restart_production_gate", rebuilt.metrics.restart_production_gate } }); } + nlohmann::json fixed_identity_rank_probes = nlohmann::json::array (); + for (int probe = 0; probe < 7; ++probe) + { + const auto query_number = static_cast ( + static_cast (probe) * (cfg.shadow_queries - 1) / 6); + fixed_identity_rank_probes.push_back ( + { { "query_number", query_number }, + { "exact_ranked_ids", + query_evidence[query_number]["exact_ranked_ids"] }, + { "candidate_ranked_ids", + query_evidence[query_number]["candidate_ranked_ids"] } }); + } + const auto quality_mode = ShadowQualityMode (cfg.shadow_quality_control); nlohmann::json out { { "schema", "cortext_bounded_activation_shadow_quality_v1" }, + { "quality_role", quality_mode.role }, + { "control_kind", quality_mode.control_kind }, { "observation_only", true }, { "corpus", cfg.shadow_embedding_corpus.string () }, { "embedding_count", corpus.embeddings.size () }, @@ -2389,6 +2568,9 @@ RunShadowEmbeddingQuality (const Config &cfg) { "duplicate_queries", FinalShadowQuality (duplicates) }, { "nonduplicate_queries", FinalShadowQuality (nonduplicates) } } }, { "query_age_quartiles", std::move (age_quality) }, + { "query_evidence", std::move (query_evidence) }, + { "fixed_identity_rank_probes", + std::move (fixed_identity_rank_probes) }, { "sqlite_restart_measurements", std::move (restart_measurements) }, }; WriteJsonArtifact (cfg.output_path, out); diff --git a/tools/audit_storage_cost_profile.py b/tools/audit_storage_cost_profile.py old mode 100755 new mode 100644 index f2c24a41..10e45a79 --- a/tools/audit_storage_cost_profile.py +++ b/tools/audit_storage_cost_profile.py @@ -205,6 +205,18 @@ def is_duration_operation(name: str) -> bool: } CONSOLIDATION_EPOCH_PRE_POST_EVENTS = 50 CONSOLIDATION_EPOCH_MINIMUM_MATERIAL_RESETS = 4 +RETRIEVAL_CYCLE_MINIMUM_MATERIAL_CYCLES = 10 +RETRIEVAL_CYCLE_MATERIAL_RESET_FRACTION_MIN = 0.80 +RETRIEVAL_CYCLE_RESAMPLE_BINS = 50 +RETRIEVAL_CYCLE_SHAPE_P95_NORMALIZED_MAE_MAX = 0.20 +RETRIEVAL_CYCLE_LATE_TEMPLATE_MAE_MAX = 0.10 +RETRIEVAL_CYCLE_NEGATIVE_VARIATION_OVER_RAMP_MAX = 0.25 +RETRIEVAL_CYCLE_MAX_OVER_TRAILING_MEAN_MAX = 1.25 +RETRIEVAL_QUALITY_QUERY_COUNT = 512 +RETRIEVAL_QUALITY_K = 16 +RETRIEVAL_EXACT_ID_RECALL_MIN = 1.0 +RETRIEVAL_EXACT_TOP1_MIN = 1.0 +RETRIEVAL_SEMANTIC_COVERAGE_MIN = 0.95 CONSOLIDATION_EPOCH_MATERIAL_RAMP_RATIO_MIN = 1.10 CONSOLIDATION_EPOCH_POST_PRE_PROCESS_RATIO_MAX = 0.90 CONSOLIDATION_EPOCH_RESET_COUNTER_RATIO_MAX = 0.90 @@ -379,6 +391,13 @@ def finite_nonnegative(value: Any, field: str) -> float: return result +def finite_fraction(value: Any, field: str) -> float: + result = finite_nonnegative(value, field) + if result > 1.0: + raise ValueError(f"{field} must not exceed one") + return result + + def plateau_height_reference(retention: str) -> dict[str, Any]: reference = PLATEAU_HEIGHT_REFERENCES.get(retention) if not isinstance(reference, dict): @@ -796,6 +815,589 @@ def sequence_trend(values: Sequence[float]) -> dict[str, Any]: } +def retrieval_work(row: dict[str, Any]) -> float: + counters = row.get("work_counters") + if not isinstance(counters, dict): + raise ValueError("row lacks work_counters") + return finite_nonnegative( + counters.get("graph_candidate_count"), + "work_counters.graph_candidate_count", + ) + finite_nonnegative( + counters.get("graph_exact_comparison_count"), + "work_counters.graph_exact_comparison_count", + ) + + +def resample_equal_progress(values: Sequence[float], bins: int) -> list[float]: + if bins <= 0 or len(values) < bins: + raise ValueError("retrieval cycle cannot be resampled to required bins") + result = [] + for index in range(bins): + begin = index * len(values) // bins + end = (index + 1) * len(values) // bins + if end <= begin: + raise ValueError("retrieval cycle resample produced an empty bin") + result.append(statistics.mean(values[begin:end])) + return result + + +def normalized_cycle( + values: Sequence[float], trough: float, peak: float, +) -> list[float]: + span = peak - trough + if span == 0.0: + return [0.0 for _ in values] + return [(value - trough) / span for value in values] + + +def mean_profile(profiles: Sequence[Sequence[float]]) -> list[float]: + if not profiles: + raise ValueError("retrieval cycle profile set is empty") + width = len(profiles[0]) + if width == 0 or any(len(profile) != width for profile in profiles): + raise ValueError("retrieval cycle profile widths differ") + return [ + statistics.mean(profile[index] for profile in profiles) + for index in range(width) + ] + + +def profile_mae(left: Sequence[float], right: Sequence[float]) -> float: + if not left or len(left) != len(right): + raise ValueError("retrieval cycle profile comparison is invalid") + return statistics.mean(abs(a - b) for a, b in zip(left, right)) + + +def nearest_rank_percentile(values: Sequence[float], fraction: float) -> float: + if not values or not 0.0 < fraction <= 1.0: + raise ValueError("invalid nearest-rank percentile input") + ordered = sorted(values) + return ordered[max(0, math.ceil(fraction * len(ordered)) - 1)] + + +def knob_fixed_embedding_slots(artifact: dict[str, Any]) -> int: + focus = finite_fraction(artifact.get("focus"), "focus") + sensitivity = finite_fraction(artifact.get("sensitivity"), "sensitivity") + stability = finite_fraction(artifact.get("stability"), "stability") + rounded = lambda value: math.floor(value + 0.5) + roots = 8 + rounded(24 * sensitivity) + leaves = 128 + rounded(512 * focus + 512 * stability) + representatives = 8 + rounded(32 * focus) + return roots + leaves + leaves * representatives + + +def knob_normal_comparison_bound(artifact: dict[str, Any]) -> int: + focus = finite_fraction(artifact.get("focus"), "focus") + sensitivity = finite_fraction(artifact.get("sensitivity"), "sensitivity") + stability = finite_fraction(artifact.get("stability"), "stability") + rounded = lambda value: math.floor(value + 0.5) + roots = 8 + rounded(24 * sensitivity) + leaves = 128 + rounded(512 * focus + 512 * stability) + representatives = 8 + rounded(32 * focus) + children_per_root = math.ceil(leaves / roots) + root_beam = 1 + rounded(3 * sensitivity) + return ( + roots + + root_beam * children_per_root + + 2 * representatives + + children_per_root + ) + + +def ranked_query_evidence_result( + artifact: dict[str, Any], result_k: int, +) -> dict[str, Any]: + evidence = artifact.get("query_evidence") + if not isinstance(evidence, list) or len(evidence) != RETRIEVAL_QUALITY_QUERY_COUNT: + raise ValueError("query evidence must contain exactly 512 rows") + embedding_count = nonnegative_integer( + artifact.get("embedding_count"), "embedding_count" + ) + if embedding_count <= RETRIEVAL_QUALITY_QUERY_COUNT: + raise ValueError("embedding corpus is too small for held-out queries") + exact_recall_total = 0.0 + exact_top1_total = 0.0 + semantic_total = 0.0 + source_ids: set[str] = set() + modalities: set[str] = set() + history_segments: set[str] = set() + by_number: dict[int, dict[str, Any]] = {} + query_embedding_ids: set[int] = set() + exact_rank_match = True + for expected_number, item in enumerate(evidence): + if not isinstance(item, dict): + raise ValueError("query evidence row must be an object") + query_number = nonnegative_integer( + item.get("query_number"), "query_evidence.query_number" + ) + if query_number != expected_number or query_number in by_number: + raise ValueError("query evidence numbers must be unique and contiguous") + query_index = nonnegative_integer( + item.get("query_index"), "query_evidence.query_index" + ) + expected_index = math.floor( + query_number * (embedding_count - 1) + / (RETRIEVAL_QUALITY_QUERY_COUNT - 1) + ) + query_embedding_id = item.get("query_embedding_id") + if ( + query_index != expected_index + or isinstance(query_embedding_id, bool) + or not isinstance(query_embedding_id, int) + or query_embedding_id in query_embedding_ids + ): + raise ValueError("query identity is not bound to deterministic sampling") + query_embedding_ids.add(query_embedding_id) + exact_ids = item.get("exact_ranked_ids") + candidate_ids = item.get("candidate_ranked_ids") + if ( + not isinstance(exact_ids, list) + or not isinstance(candidate_ids, list) + or len(exact_ids) != result_k + or len(candidate_ids) != result_k + or any(isinstance(value, bool) or not isinstance(value, int) for value in exact_ids) + or any(isinstance(value, bool) or not isinstance(value, int) for value in candidate_ids) + or len(set(exact_ids)) != result_k + or len(set(candidate_ids)) != result_k + ): + raise ValueError("query ranked identities are invalid") + hits = len(set(exact_ids).intersection(candidate_ids)) + exact_recall_total += hits / result_k + exact_top1_total += candidate_ids[0] == exact_ids[0] + exact_rank_match = exact_rank_match and candidate_ids == exact_ids + semantic_total += finite_fraction( + item.get("exact_neighbor_semantic_coverage"), + "query_evidence.exact_neighbor_semantic_coverage", + ) + item_sources = item.get("source_ids") + item_modalities = item.get("modalities") + history_segment = item.get("history_segment") + history_ordinal = nonnegative_integer( + item.get("history_ordinal"), "query_evidence.history_ordinal" + ) + history_count = nonnegative_integer( + item.get("history_count"), "query_evidence.history_count" + ) + if history_count == 0 or history_ordinal >= history_count: + raise ValueError("query SQLite history position is invalid") + expected_history_segment = ("early", "middle", "late")[ + min(2, history_ordinal * 3 // history_count) + ] + if ( + not isinstance(item_sources, list) + or not item_sources + or any(not isinstance(value, str) or not value for value in item_sources) + or not isinstance(item_modalities, list) + or not item_modalities + or any(not isinstance(value, str) or not value for value in item_modalities) + or history_segment != expected_history_segment + ): + raise ValueError("query provenance evidence is invalid") + source_ids.update(item_sources) + modalities.update(item_modalities) + history_segments.add(history_segment) + by_number[query_number] = item + + probes = artifact.get("fixed_identity_rank_probes") + if not isinstance(probes, list) or len(probes) != 7: + raise ValueError("exactly seven fixed identity-rank probes are required") + fixed_probe_numbers = [ + math.floor(probe * (RETRIEVAL_QUALITY_QUERY_COUNT - 1) / 6) + for probe in range(7) + ] + probe_payload = [] + probe_numbers: set[int] = set() + fixed_probes_match = True + for probe in probes: + if not isinstance(probe, dict): + raise ValueError("fixed identity-rank probe must be an object") + query_number = nonnegative_integer( + probe.get("query_number"), "fixed probe query_number" + ) + if ( + query_number in probe_numbers + or query_number not in by_number + or query_number != fixed_probe_numbers[len(probe_numbers)] + ): + raise ValueError("fixed identity-rank probe query is invalid") + exact_ids = probe.get("exact_ranked_ids") + candidate_ids = probe.get("candidate_ranked_ids") + if ( + exact_ids != by_number[query_number]["exact_ranked_ids"] + or candidate_ids != by_number[query_number]["candidate_ranked_ids"] + ): + raise ValueError("fixed identity-rank probe is not bound to query evidence") + fixed_probes_match = fixed_probes_match and exact_ids == candidate_ids + probe_numbers.add(query_number) + probe_payload.append({"query_number": query_number, "ranked_ids": exact_ids}) + + count = len(evidence) + return { + "count": count, + "mean_exact_id_recall_at_k": exact_recall_total / count, + "mean_top1_exact_id": exact_top1_total / count, + "mean_exact_neighbor_semantic_coverage": semantic_total / count, + "exact_rank_match": exact_rank_match, + "source_count": len(source_ids), + "modalities": sorted(modalities), + "history_segments": sorted(history_segments), + "by_number": by_number, + "fixed_probes_match": fixed_probes_match, + "fixed_probe_identity_rank_sha256": hashlib.sha256( + canonical_json(probe_payload) + ).hexdigest(), + } + + +def retrieval_cycle_symmetry_result( + material_epochs: Sequence[dict[str, Any]], retrieval_work_bound: int, + accepted_suffix_retrieval_work: Sequence[float], +) -> dict[str, Any]: + failures = [] + profiles = [epoch["_retrieval_cycle_profile"] for epoch in material_epochs] + inverse_ramp_count = sum( + epoch["trailing_peak_mean_retrieval_work"] + < epoch["leading_mean_retrieval_work"] + for epoch in material_epochs + ) + if inverse_ramp_count: + failures.append("retrieval work falls before consolidation") + nonmaterial_ramp_count = sum( + epoch["retrieval_trailing_over_leading"] + < CONSOLIDATION_EPOCH_MATERIAL_RAMP_RATIO_MIN + for epoch in material_epochs + ) + if nonmaterial_ramp_count: + failures.append("retrieval cycle lacks material ramp") + excessive_negative_variation_count = sum( + epoch["retrieval_negative_variation_over_ramp"] + > RETRIEVAL_CYCLE_NEGATIVE_VARIATION_OVER_RAMP_MAX + for epoch in material_epochs + ) + if excessive_negative_variation_count: + failures.append("retrieval cycle contains excessive negative variation") + excessive_spike_count = sum( + epoch["retrieval_max_over_trailing_mean"] + > RETRIEVAL_CYCLE_MAX_OVER_TRAILING_MEAN_MAX + for epoch in material_epochs + ) + if excessive_spike_count: + failures.append("retrieval cycle contains excessive spike") + work_bound_exceeded_count = sum( + work > retrieval_work_bound + for work in accepted_suffix_retrieval_work + ) + if work_bound_exceeded_count: + failures.append("retrieval work exceeds F/S/T bound") + reset_count = sum( + epoch["retrieval_post_over_trailing"] + <= CONSOLIDATION_EPOCH_POST_PRE_PROCESS_RATIO_MAX + for epoch in material_epochs + ) + reset_fraction = ratio(float(reset_count), float(len(material_epochs))) + template = None + errors: list[float] = [] + p95 = None + late_template_error = None + retrieval_peak_trend = None + retrieval_trough_trend = None + if len(material_epochs) < RETRIEVAL_CYCLE_MINIMUM_MATERIAL_CYCLES: + failures.append("fewer than ten material retrieval cycles") + else: + template = [ + statistics.median(profile[index] for profile in profiles) + for index in range(RETRIEVAL_CYCLE_RESAMPLE_BINS) + ] + errors = [profile_mae(profile, template) for profile in profiles] + p95 = nearest_rank_percentile(errors, 0.95) + prior_template = mean_profile(profiles[-10:-5]) + final_template = mean_profile(profiles[-5:]) + late_template_error = profile_mae(prior_template, final_template) + if p95 > RETRIEVAL_CYCLE_SHAPE_P95_NORMALIZED_MAE_MAX: + failures.append("retrieval cycle shape p95 exceeds limit") + if late_template_error > RETRIEVAL_CYCLE_LATE_TEMPLATE_MAE_MAX: + failures.append("late retrieval cycle template drifts") + retrieval_peak_trend = sequence_trend( + [ + epoch["trailing_peak_mean_retrieval_work"] + for epoch in material_epochs + ] + ) + retrieval_trough_trend = sequence_trend( + [ + epoch["following_trough_mean_retrieval_work"] + for epoch in material_epochs + ] + ) + for trend, name, half_ratio_limit in ( + ( + retrieval_peak_trend, + "retrieval peak", + CONSOLIDATION_EPOCH_PEAK_HALF_RATIO_MAX, + ), + ( + retrieval_trough_trend, + "retrieval trough", + CONSOLIDATION_EPOCH_TROUGH_HALF_RATIO_MAX, + ), + ): + if trend["half"]["second_over_first"] > half_ratio_limit: + failures.append(f"{name} rises") + if trend["relative_theil_sen_per_epoch"] > RELATIVE_THEIL_SEN_MAX: + failures.append(f"{name} relative slope rises") + if trend["relative_bootstrap_95_upper_per_epoch"] > RELATIVE_BOOTSTRAP_UPPER_MAX: + failures.append(f"{name} bootstrap upper rises") + if reset_fraction < RETRIEVAL_CYCLE_MATERIAL_RESET_FRACTION_MIN: + failures.append("too few material retrieval resets") + return { + "passed": not failures, + "material_cycle_count": len(material_epochs), + "inverse_ramp_count": inverse_ramp_count, + "nonmaterial_ramp_count": nonmaterial_ramp_count, + "excessive_negative_variation_count": ( + excessive_negative_variation_count + ), + "excessive_spike_count": excessive_spike_count, + "work_bound_exceeded_count": work_bound_exceeded_count, + "retrieval_work_bound": retrieval_work_bound, + "accepted_suffix_maximum_retrieval_work": max( + accepted_suffix_retrieval_work, default=0.0 + ), + "material_reset_count": reset_count, + "material_reset_fraction": reset_fraction, + "resample_bins": RETRIEVAL_CYCLE_RESAMPLE_BINS, + "shape_p95_normalized_mae": p95, + "late_template_normalized_mae": late_template_error, + "retrieval_peak_trend": retrieval_peak_trend, + "retrieval_trough_trend": retrieval_trough_trend, + "cycle_error_min": min(errors) if errors else None, + "cycle_error_max": max(errors) if errors else None, + "failures": sorted(set(failures)), + } + + +def bounded_activation_quality_result( + artifact: dict[str, Any], control_artifact: dict[str, Any], + approved_control_sha256: str, +) -> dict[str, Any]: + if artifact.get("schema") != "cortext_bounded_activation_shadow_quality_v1": + raise ValueError("bounded activation quality schema mismatch") + if control_artifact.get("schema") != artifact.get("schema"): + raise ValueError("bounded activation quality control schema mismatch") + if artifact.get("quality_role") != "candidate": + raise ValueError("bounded activation candidate role is missing") + if control_artifact.get("quality_role") != "approved-control": + raise ValueError("approved bounded activation control is missing") + if control_artifact.get("control_kind") != "current-public-retrieval": + raise ValueError("approved control is not the current public retrieval path") + existing_probe_digest = artifact.get("existing_fixed_probe_identity_rank_sha256") + control_existing_probe_digest = control_artifact.get( + "existing_fixed_probe_identity_rank_sha256" + ) + if ( + not isinstance(existing_probe_digest, str) + or len(existing_probe_digest) != 64 + or any(char not in "0123456789abcdef" for char in existing_probe_digest) + or existing_probe_digest != control_existing_probe_digest + ): + raise ValueError("existing seven-probe digest is not control-bound") + control_sha256 = hashlib.sha256(canonical_json(control_artifact)).hexdigest() + if approved_control_sha256 != control_sha256: + raise ValueError("bounded activation control digest is not approved") + query_count = nonnegative_integer(artifact.get("query_count"), "query_count") + result_k = nonnegative_integer(artifact.get("result_k"), "result_k") + quality = artifact.get("quality") + if not isinstance(quality, dict) or not isinstance(quality.get("all"), dict): + raise ValueError("bounded activation quality summary is missing") + all_quality = quality["all"] + evidence = ranked_query_evidence_result(artifact, result_k) + control_result_k = nonnegative_integer( + control_artifact.get("result_k"), "control result_k" + ) + control_evidence = ranked_query_evidence_result( + control_artifact, control_result_k + ) + baseline_binding_passed = ( + control_result_k == result_k + and control_artifact.get("query_count") == artifact.get("query_count") + and control_artifact.get("embedding_count") == artifact.get("embedding_count") + ) + for query_number in range(RETRIEVAL_QUALITY_QUERY_COUNT): + candidate_row = evidence["by_number"][query_number] + control_row = control_evidence["by_number"][query_number] + baseline_binding_passed = baseline_binding_passed and all( + candidate_row.get(field) == control_row.get(field) + for field in ( + "query_index", + "query_embedding_id", + "exact_ranked_ids", + "candidate_ranked_ids", + "source_ids", + "modalities", + "history_ordinal", + "history_count", + "history_segment", + ) + ) + summary_count = nonnegative_integer( + all_quality.get("count"), "quality.all.count" + ) + exact_recall = finite_fraction( + all_quality.get("mean_exact_id_recall_at_k"), + "quality.all.mean_exact_id_recall_at_k", + ) + exact_top1 = finite_fraction( + all_quality.get("mean_top1_exact_id"), + "quality.all.mean_top1_exact_id", + ) + semantic_coverage = finite_fraction( + all_quality.get("mean_exact_neighbor_semantic_coverage"), + "quality.all.mean_exact_neighbor_semantic_coverage", + ) + for name, reported, measured in ( + ("mean_exact_id_recall_at_k", exact_recall, + evidence["mean_exact_id_recall_at_k"]), + ("mean_top1_exact_id", exact_top1, evidence["mean_top1_exact_id"]), + ("mean_exact_neighbor_semantic_coverage", semantic_coverage, + evidence["mean_exact_neighbor_semantic_coverage"]), + ): + if not math.isclose(reported, measured, rel_tol=0.0, abs_tol=1.0e-12): + raise ValueError(f"quality.all.{name} is not bound to query evidence") + coverage_passed = ( + evidence["source_count"] >= 4 + and {"text", "audio", "image"}.issubset(evidence["modalities"]) + and {"early", "middle", "late"}.issubset( + evidence["history_segments"] + ) + ) + restart = artifact.get("sqlite_restart_measurements") + if not isinstance(restart, list) or len(restart) != 3: + raise ValueError("exactly three bounded activation restart measurements are required") + derived_slot_bound = knob_fixed_embedding_slots(artifact) + reported_slot_bound = nonnegative_integer( + artifact.get("fixed_embedding_slots"), "fixed_embedding_slots" + ) + if reported_slot_bound != derived_slot_bound: + raise ValueError("fixed embedding slot bound does not match F/S/T") + restart_rows = [] + restart_probe_digest = evidence["fixed_probe_identity_rank_sha256"] + for item in restart: + if not isinstance(item, dict): + raise ValueError("restart measurement must be an object") + restart_rows.append( + { + "fraction": finite_fraction(item.get("fraction"), "restart fraction"), + "retained_rows": nonnegative_integer( + item.get("retained_rows"), "restart retained_rows" + ), + "rows_visited": nonnegative_integer( + item.get("rows_visited"), "restart rows_visited" + ), + "measurement_authority": item.get("measurement_authority"), + "restored_candidate_count": nonnegative_integer( + item.get("restored_candidate_count"), + "restart restored_candidate_count", + ), + "pre_restart_probe_identity_rank_sha256": item.get( + "pre_restart_probe_identity_rank_sha256" + ), + "post_restart_probe_identity_rank_sha256": item.get( + "post_restart_probe_identity_rank_sha256" + ), + "claimed_linear_history": item.get("linear_history"), + "claimed_production_gate": item.get("restart_production_gate"), + } + ) + expected_fractions = (0.25, 0.5, 1.0) + for item, expected_fraction in zip(restart_rows, expected_fractions): + expected_retained = max( + 1, math.floor(artifact["embedding_count"] * expected_fraction) + ) + pre_digest = item["pre_restart_probe_identity_rank_sha256"] + post_digest = item["post_restart_probe_identity_rank_sha256"] + if ( + item["fraction"] != expected_fraction + or item["retained_rows"] != expected_retained + or item["rows_visited"] == 0 + or item["restored_candidate_count"] < result_k + or not isinstance(pre_digest, str) + or len(pre_digest) != 64 + or any(char not in "0123456789abcdef" for char in pre_digest) + or pre_digest != restart_probe_digest + or post_digest != restart_probe_digest + ): + raise ValueError( + "restart measurement is not bound to restored corpus state" + ) + maximum_retained = restart_rows[-1]["retained_rows"] + maximum_rows_visited = max(item["rows_visited"] for item in restart_rows) + measured_restart_bounded = ( + maximum_retained > derived_slot_bound + and maximum_rows_visited <= derived_slot_bound + ) + claims_consistent = all( + item["measurement_authority"] + == "production-shaped-persistent-restart" + and item["claimed_linear_history"] is False + and item["claimed_production_gate"] is True + for item in restart_rows + ) + restart_passed = measured_restart_bounded and claims_consistent + failures = [] + if query_count != RETRIEVAL_QUALITY_QUERY_COUNT: + failures.append("quality query count mismatch") + if summary_count != query_count or evidence["count"] != query_count: + failures.append("quality query evidence count mismatch") + if result_k != RETRIEVAL_QUALITY_K: + failures.append("quality result k mismatch") + if exact_recall < RETRIEVAL_EXACT_ID_RECALL_MIN: + failures.append("exact identity recall below invariant") + if exact_top1 < RETRIEVAL_EXACT_TOP1_MIN: + failures.append("exact top-1 below invariant") + if not evidence["exact_rank_match"]: + failures.append("deterministic exact rank order differs") + if semantic_coverage < RETRIEVAL_SEMANTIC_COVERAGE_MIN: + failures.append("semantic coverage below threshold") + if not coverage_passed: + failures.append("mixed source modality and history coverage missing") + if not evidence["fixed_probes_match"]: + failures.append("fixed identity-rank probe differs") + if ( + not baseline_binding_passed + or evidence["fixed_probe_identity_rank_sha256"] + != control_evidence["fixed_probe_identity_rank_sha256"] + ): + failures.append("candidate evidence differs from approved control corpus") + if not restart_passed: + failures.append("restart remains proportional to history") + return { + "schema": "cortext_bounded_activation_quality_audit_v1", + "passed": not failures, + "query_count": query_count, + "result_k": result_k, + "mean_exact_id_recall_at_k": exact_recall, + "mean_top1_exact_id": exact_top1, + "mean_exact_neighbor_semantic_coverage": semantic_coverage, + "deterministic_exact_rank_order_passed": evidence["exact_rank_match"], + "query_input_coverage_passed": coverage_passed, + "query_source_count": evidence["source_count"], + "query_modalities": evidence["modalities"], + "query_history_segments": evidence["history_segments"], + "fixed_identity_rank_probes_passed": evidence["fixed_probes_match"], + "fixed_probe_identity_rank_sha256": evidence[ + "fixed_probe_identity_rank_sha256" + ], + "existing_fixed_probe_identity_rank_sha256": existing_probe_digest, + "approved_control_artifact_sha256": control_sha256, + "approved_control_binding_passed": baseline_binding_passed, + "bounded_restart_passed": restart_passed, + "derived_restart_row_visit_bound": derived_slot_bound, + "maximum_restart_retained_rows": maximum_retained, + "maximum_restart_rows_visited": maximum_rows_visited, + "failures": sorted(set(failures)), + } + + def consolidation_epoch_result( profile: dict[str, Any], rows: Sequence[dict[str, Any]], suffix_start: int, suffix_end: int, @@ -832,6 +1434,17 @@ def consolidation_epoch_result( float(row["process_ms"]) for row in epoch_rows[-k:] ) post = statistics.mean(float(row["process_ms"]) for row in post_rows) + retrieval_values = [retrieval_work(row) for row in epoch_rows] + retrieval_leading = statistics.mean(retrieval_values[:k]) + retrieval_trailing = statistics.mean(retrieval_values[-k:]) + retrieval_post = statistics.mean(retrieval_work(row) for row in post_rows) + retrieval_ramp = retrieval_trailing - retrieval_leading + retrieval_negative_variation = sum( + max(0.0, previous - current) + for previous, current in zip( + retrieval_values, retrieval_values[1:] + ) + ) ramp_ratio = ratio(trailing, leading) post_pre_ratio = ratio(post, trailing) reset_ratios = { @@ -861,6 +1474,29 @@ def consolidation_epoch_result( "following_trough_mean_process_ms": post, "trailing_over_leading": ramp_ratio, "post_over_trailing": post_pre_ratio, + "leading_mean_retrieval_work": retrieval_leading, + "trailing_peak_mean_retrieval_work": retrieval_trailing, + "following_trough_mean_retrieval_work": retrieval_post, + "retrieval_post_over_trailing": ratio( + retrieval_post, retrieval_trailing + ), + "retrieval_trailing_over_leading": ratio( + retrieval_trailing, retrieval_leading + ), + "maximum_retrieval_work": max(retrieval_values), + "retrieval_negative_variation_over_ramp": ratio( + retrieval_negative_variation, max(0.0, retrieval_ramp) + ), + "retrieval_max_over_trailing_mean": ratio( + max(retrieval_values), retrieval_trailing + ), + "_retrieval_cycle_profile": normalized_cycle( + resample_equal_progress( + retrieval_values, RETRIEVAL_CYCLE_RESAMPLE_BINS + ), + retrieval_leading, + retrieval_trailing, + ), "material": material, "reset_counter_ratios": reset_ratios, "reset_counter_failures": reset_failures, @@ -943,6 +1579,25 @@ def consolidation_epoch_result( if normalized_mutation_cost["half"]["second_over_first"] > CONSOLIDATION_EPOCH_NORMALIZED_COST_HALF_RATIO_MAX: failures.append("consolidation cost per sealed mutation rises") + retrieval_cycle_symmetry = None + if mode == "sawtooth": + retrieval_cycle_symmetry = retrieval_cycle_symmetry_result( + material_epochs, + knob_normal_comparison_bound(profile), + [ + retrieval_work(row) + for row in rows + if suffix_start + <= nonnegative_integer(row.get("event_index"), "event_index") + < suffix_end + ], + ) + failures.extend(retrieval_cycle_symmetry["failures"]) + elif mode == "flat-envelope" and profile.get("retention") == "natural": + failures.append("natural cutover requires retrieval cycle symmetry") + for epoch in complete_epochs: + epoch.pop("_retrieval_cycle_profile", None) + return { "passed": mode != "invalid" and not failures, "mode": mode, @@ -955,6 +1610,7 @@ def consolidation_epoch_result( "normalized_event_cost_trend": normalized_event_cost, "normalized_mutation_cost_trend": normalized_mutation_cost, "frequency_trend": frequency_trend, + "retrieval_cycle_symmetry": retrieval_cycle_symmetry, "failures": sorted(set(failures)), } @@ -1389,8 +2045,12 @@ def profile_summary( def parse_args() -> argparse.Namespace: parser = argparse.ArgumentParser() - parser.add_argument("--profile", type=Path, required=True) - parser.add_argument("--db", type=Path, required=True) + source = parser.add_mutually_exclusive_group(required=True) + source.add_argument("--profile", type=Path) + source.add_argument("--shadow-quality", type=Path) + parser.add_argument("--quality-control", type=Path) + parser.add_argument("--approved-control-sha256") + parser.add_argument("--db", type=Path) parser.add_argument("--out", type=Path) parser.add_argument("--window-size", type=int, default=100) parser.add_argument("--report-only", action="store_true") @@ -1400,6 +2060,25 @@ def parse_args() -> argparse.Namespace: def main() -> int: args = parse_args() + if args.shadow_quality: + if args.quality_control is None: + raise ValueError("--quality-control is required with --shadow-quality") + artifact = json.loads(args.shadow_quality.read_text(encoding="utf-8")) + if args.approved_control_sha256 is None: + raise ValueError( + "--approved-control-sha256 is required with --shadow-quality" + ) + control_artifact = json.loads(args.quality_control.read_text(encoding="utf-8")) + result = bounded_activation_quality_result( + artifact, control_artifact, args.approved_control_sha256 + ) + rendered = json.dumps(result, indent=2, sort_keys=True) + "\n" + if args.out: + args.out.write_text(rendered, encoding="utf-8") + print(rendered, end="") + return 0 if args.report_only or result["passed"] else 1 + if args.db is None: + raise ValueError("--db is required with --profile") if args.window_size <= 0: raise ValueError("--window-size must be positive") result = profile_summary( diff --git a/tools/audit_storage_cost_profile_test.py b/tools/audit_storage_cost_profile_test.py index 5ef0cee8..8b11d074 100644 --- a/tools/audit_storage_cost_profile_test.py +++ b/tools/audit_storage_cost_profile_test.py @@ -206,7 +206,7 @@ def plateau_fixture( def epoch_fixture( *, - epoch_count: int = 9, + epoch_count: int = 16, epoch_length: int = 120, material: bool = True, peak_growth: float = 1.0, @@ -237,6 +237,8 @@ def epoch_fixture( name: (0.0 if name.startswith("rollback_") else 10.0) for name in audit.REQUIRED_WORK_COUNTERS } + work_counters["graph_candidate_count"] = process_ms * 5.0 + work_counters["graph_exact_comparison_count"] = process_ms * 5.0 work_counters["supersession_rows_visited"] = ( work_counters["supersession_current_candidate_count"] + work_counters["supersession_historical_candidate_count"] @@ -326,6 +328,9 @@ def epoch_fixture( return { "schema": "cortext_packet_storage_profile_v2", "processed_events": event_count, + "focus": 0.5, + "sensitivity": 0.5, + "stability": 0.5, "consolidation_epoch_relational_contract_sha256": ( audit.CONSOLIDATION_EPOCH_RELATIONAL_CONTRACT_SHA256 ), @@ -339,6 +344,19 @@ def epoch_fixture( }, rows +def set_fixture_retention( + profile: dict[str, object], rows: list[dict[str, object]], retention: str, +) -> None: + profile["retention"] = retention + for row in rows: + row["retention"] = retention + if retention == "durable": + row["operation_ms"]["SignalProcessor.sqlite_wal_checkpoint"] = 0.0 + row["operation_ms"][ + "SignalProcessor.sqlite_wal_checkpoint_failure_count" + ] = 0.0 + + class AttributionContractTest(unittest.TestCase): def test_late_operation_is_attributed_with_zero_for_absent_rows(self) -> None: result = audit.attribution_result(fixture_rows(), 10) @@ -426,23 +444,35 @@ def test_accepts_bounded_consolidation_sawtooth(self) -> None: self.assertTrue(result["passed"], result["failures"]) self.assertEqual(result["mode"], "sawtooth") self.assertGreaterEqual(result["material_epoch_count"], 4) + self.assertTrue(result["retrieval_cycle_symmetry"]["passed"]) full_result = audit.suffix_plateau_result(profile, rows, 50) self.assertTrue(full_result["passed"], full_result["candidate_failures"]) - def test_accepts_flat_envelope_without_consolidation(self) -> None: + def test_accepts_durable_flat_envelope_without_consolidation(self) -> None: profile, rows = plateau_fixture() + set_fixture_retention(profile, rows, "durable") result = audit.consolidation_epoch_result(profile, rows, 0, len(rows)) self.assertTrue(result["passed"], result["failures"]) self.assertEqual(result["mode"], "flat-envelope") - def test_accepts_flat_envelope_with_complete_nonmaterial_epochs(self) -> None: + def test_accepts_durable_flat_envelope_with_complete_nonmaterial_epochs(self) -> None: profile, rows = epoch_fixture(material=False) + set_fixture_retention(profile, rows, "durable") result = audit.consolidation_epoch_result(profile, rows, 0, len(rows)) self.assertTrue(result["passed"], result["failures"]) self.assertEqual(result["mode"], "flat-envelope") self.assertGreaterEqual(result["complete_epoch_count"], 4) self.assertEqual(result["material_epoch_count"], 0) + def test_rejects_natural_flat_envelope_without_retrieval_cycles(self) -> None: + profile, rows = epoch_fixture(material=False) + result = audit.consolidation_epoch_result(profile, rows, 0, len(rows)) + self.assertFalse(result["passed"]) + self.assertIn( + "natural cutover requires retrieval cycle symmetry", + result["failures"], + ) + def test_rejects_successful_consolidations_without_complete_epochs(self) -> None: profile, rows = epoch_fixture(epoch_length=60, material=False) result = audit.consolidation_epoch_result(profile, rows, 0, len(rows)) @@ -482,6 +512,230 @@ def test_rejects_material_reset_without_process_drop(self) -> None: result["failures"], ) + def test_rejects_material_cycles_without_retrieval_work_reset(self) -> None: + profile, rows = epoch_fixture() + for row in rows: + row["work_counters"]["graph_candidate_count"] = 10.0 + row["work_counters"]["graph_exact_comparison_count"] = 10.0 + row["operation_ms"] = fixture_operation_ms(row["work_counters"]) + row["operation_ms"].update( + { + "ConsolidationEpoch.epoch_id": float( + row["consolidation_epoch_id"] + ), + "ConsolidationEpoch.events_since_epoch_start": float( + row["events_since_epoch_start"] + ), + **{ + f"ConsolidationEpoch.{name}": float(value) + for name, value in row[ + "consolidation_epoch_counters" + ].items() + }, + } + ) + result = audit.consolidation_epoch_result(profile, rows, 0, len(rows)) + self.assertFalse(result["passed"]) + self.assertIn("too few material retrieval resets", result["failures"]) + + def test_rejects_one_dissimilar_retrieval_cycle(self) -> None: + profile, rows = epoch_fixture() + target_epoch = 10 + target = [ + row for row in rows + if row["consolidation_epoch_id"] == target_epoch + ] + for index, row in enumerate(target): + value = 100.0 if index % 2 == 0 else 0.0 + row["work_counters"]["graph_candidate_count"] = value + row["work_counters"]["graph_exact_comparison_count"] = value + row["operation_ms"] = fixture_operation_ms(row["work_counters"]) + row["operation_ms"].update( + { + "ConsolidationEpoch.epoch_id": float(target_epoch), + "ConsolidationEpoch.events_since_epoch_start": float( + row["events_since_epoch_start"] + ), + **{ + f"ConsolidationEpoch.{name}": float(value) + for name, value in row[ + "consolidation_epoch_counters" + ].items() + }, + } + ) + result = audit.consolidation_epoch_result(profile, rows, 0, len(rows)) + self.assertFalse(result["passed"]) + self.assertIn( + "retrieval cycle shape p95 exceeds limit", result["failures"] + ) + + def test_rejects_late_retrieval_cycle_template_drift(self) -> None: + profile, rows = epoch_fixture() + baseline = audit.consolidation_epoch_result(profile, rows, 0, len(rows)) + late_epoch_ids = { + epoch["consolidation_epoch_id"] + for epoch in baseline["complete_epochs"][-5:] + } + for epoch_id in late_epoch_ids: + target = [ + row for row in rows + if row["consolidation_epoch_id"] == epoch_id + ] + for index, row in enumerate(target): + progress = index / (len(target) - 1) + value = (10.0 + 90.0 * progress * progress) / 2.0 + row["work_counters"]["graph_candidate_count"] = value + row["work_counters"]["graph_exact_comparison_count"] = value + row["operation_ms"] = fixture_operation_ms(row["work_counters"]) + row["operation_ms"].update( + { + "ConsolidationEpoch.epoch_id": float(epoch_id), + "ConsolidationEpoch.events_since_epoch_start": float( + row["events_since_epoch_start"] + ), + **{ + f"ConsolidationEpoch.{name}": float(counter) + for name, counter in row[ + "consolidation_epoch_counters" + ].items() + }, + } + ) + result = audit.consolidation_epoch_result(profile, rows, 0, len(rows)) + self.assertFalse(result["passed"]) + self.assertIn( + "late retrieval cycle template drifts", result["failures"] + ) + + def test_rejects_inverse_retrieval_sawtooth(self) -> None: + profile, rows = epoch_fixture() + for row in rows: + progress = (row["events_since_epoch_start"] - 1) / 119.0 + value = (100.0 - 90.0 * progress) / 2.0 + row["work_counters"]["graph_candidate_count"] = value + row["work_counters"]["graph_exact_comparison_count"] = value + row["operation_ms"] = fixture_operation_ms(row["work_counters"]) + row["operation_ms"].update( + { + "ConsolidationEpoch.epoch_id": float( + row["consolidation_epoch_id"] + ), + "ConsolidationEpoch.events_since_epoch_start": float( + row["events_since_epoch_start"] + ), + **{ + f"ConsolidationEpoch.{name}": float(counter) + for name, counter in row[ + "consolidation_epoch_counters" + ].items() + }, + } + ) + result = audit.consolidation_epoch_result(profile, rows, 0, len(rows)) + self.assertFalse(result["passed"]) + self.assertIn( + "retrieval work falls before consolidation", result["failures"] + ) + + def test_rejects_flat_retrieval_cycles_with_geometric_epoch_decay(self) -> None: + profile, rows = epoch_fixture() + for row in rows: + epoch_id = row["consolidation_epoch_id"] + value = 100.0 * 0.9**epoch_id / 2.0 + row["work_counters"]["graph_candidate_count"] = value + row["work_counters"]["graph_exact_comparison_count"] = value + row["operation_ms"] = fixture_operation_ms(row["work_counters"]) + row["operation_ms"].update( + { + "ConsolidationEpoch.epoch_id": float(epoch_id), + "ConsolidationEpoch.events_since_epoch_start": float( + row["events_since_epoch_start"] + ), + **{ + f"ConsolidationEpoch.{name}": float(counter) + for name, counter in row[ + "consolidation_epoch_counters" + ].items() + }, + } + ) + result = audit.consolidation_epoch_result(profile, rows, 0, len(rows)) + self.assertFalse(result["passed"]) + self.assertIn( + "retrieval cycle lacks material ramp", result["failures"] + ) + + def test_rejects_repeatable_spiky_retrieval_cycles(self) -> None: + profile, rows = epoch_fixture() + for row in rows: + events_since = row["events_since_epoch_start"] + if events_since <= 50: + retrieval_work = 10.0 + elif events_since <= 70: + retrieval_work = 1000.0 if events_since % 2 == 0 else 0.0 + else: + retrieval_work = 200.0 if events_since % 2 == 0 else 0.0 + value = retrieval_work / 2.0 + row["work_counters"]["graph_candidate_count"] = value + row["work_counters"]["graph_exact_comparison_count"] = value + row["operation_ms"] = fixture_operation_ms(row["work_counters"]) + row["operation_ms"].update( + { + "ConsolidationEpoch.epoch_id": float( + row["consolidation_epoch_id"] + ), + "ConsolidationEpoch.events_since_epoch_start": float( + events_since + ), + **{ + f"ConsolidationEpoch.{name}": float(counter) + for name, counter in row[ + "consolidation_epoch_counters" + ].items() + }, + } + ) + result = audit.consolidation_epoch_result(profile, rows, 0, len(rows)) + self.assertFalse(result["passed"]) + self.assertIn( + "retrieval cycle contains excessive negative variation", + result["failures"], + ) + self.assertIn("retrieval work exceeds F/S/T bound", result["failures"]) + + def test_rejects_work_bound_violation_in_final_partial_cycle(self) -> None: + profile, rows = epoch_fixture() + row = rows[-1] + row["work_counters"]["graph_candidate_count"] = 100.0 + row["work_counters"]["graph_exact_comparison_count"] = 100.0 + row["operation_ms"] = fixture_operation_ms(row["work_counters"]) + row["operation_ms"].update( + { + "ConsolidationEpoch.epoch_id": float( + row["consolidation_epoch_id"] + ), + "ConsolidationEpoch.events_since_epoch_start": float( + row["events_since_epoch_start"] + ), + **{ + f"ConsolidationEpoch.{name}": float(counter) + for name, counter in row[ + "consolidation_epoch_counters" + ].items() + }, + } + ) + result = audit.consolidation_epoch_result(profile, rows, 0, len(rows)) + self.assertFalse(result["passed"]) + self.assertIn("retrieval work exceeds F/S/T bound", result["failures"]) + self.assertEqual( + result["retrieval_cycle_symmetry"][ + "accepted_suffix_maximum_retrieval_work" + ], + 200.0, + ) + def test_rejects_consolidation_reset_counter_that_does_not_fall(self) -> None: profile, rows = epoch_fixture(reset_counters=False) result = audit.consolidation_epoch_result(profile, rows, 0, len(rows)) @@ -506,12 +760,12 @@ def test_zero_reset_counter_must_remain_zero(self) -> None: ) ) - profile["consolidation_events"][4]["post_reset_counters"][counter] = 1 + profile["consolidation_events"][-2]["post_reset_counters"][counter] = 1 rejected = audit.consolidation_epoch_result(profile, rows, 0, len(rows)) self.assertFalse(rejected["passed"]) self.assertIn("consolidation reset counter does not fall", rejected["failures"]) self.assertEqual( - rejected["complete_epochs"][4]["reset_counter_ratios"][counter], + rejected["complete_epochs"][-1]["reset_counter_ratios"][counter], float("inf"), ) @@ -520,6 +774,7 @@ def test_zero_reset_counter_must_remain_zero(self) -> None: def test_nonmaterial_zero_reset_counter_must_remain_zero(self) -> None: profile, rows = epoch_fixture(material=False) + set_fixture_retention(profile, rows, "durable") counter = "accumulator_signal_count" for event in profile["consolidation_events"]: close = event["event_index"] @@ -531,12 +786,12 @@ def test_nonmaterial_zero_reset_counter_must_remain_zero(self) -> None: self.assertTrue(accepted["passed"], accepted["failures"]) self.assertEqual(accepted["mode"], "flat-envelope") - profile["consolidation_events"][4]["post_reset_counters"][counter] = 1 + profile["consolidation_events"][-2]["post_reset_counters"][counter] = 1 rejected = audit.consolidation_epoch_result(profile, rows, 0, len(rows)) self.assertFalse(rejected["passed"]) self.assertIn("consolidation reset counter does not fall", rejected["failures"]) self.assertEqual( - rejected["complete_epochs"][4]["reset_counter_ratios"][counter], + rejected["complete_epochs"][-1]["reset_counter_ratios"][counter], float("inf"), ) self.assertFalse(audit.suffix_plateau_result(profile, rows, 50)["passed"]) @@ -667,6 +922,7 @@ def test_rejects_processed_event_count_mismatch(self) -> None: def test_accepts_end_anchored_ramp_then_plateau(self) -> None: profile, rows = plateau_fixture() + set_fixture_retention(profile, rows, "durable") result = audit.suffix_plateau_result(profile, rows, 10) self.assertTrue(result["passed"]) self.assertEqual(result["accepted_suffix"]["plateau_end_event"], 126) @@ -813,6 +1069,7 @@ def test_all_work_counters_reject_correlated_zero_placeholders(self) -> None: def test_diagnostic_row_counts_are_not_timing_operations(self) -> None: profile, rows = plateau_fixture() + set_fixture_retention(profile, rows, "durable") ranges = audit.end_anchored_ranges(len(rows), 10) for row in rows: window_index = next( @@ -858,5 +1115,344 @@ def test_rejects_plateau_shorter_than_six_windows(self) -> None: self.assertFalse(audit.suffix_plateau_result(profile, rows, 10)["passed"]) +class BoundedActivationQualityContractTest(unittest.TestCase): + def quality_fixture(self, role: str = "candidate") -> dict[str, object]: + evidence = [] + modalities = ["text", "audio", "image"] + embedding_count = 40000 + for query_number in range(512): + query_index = query_number * (embedding_count - 1) // 511 + ranked_ids = [query_number * 100 + rank for rank in range(16)] + evidence.append( + { + "query_number": query_number, + "query_index": query_index, + "query_embedding_id": 1000000 + query_index, + "exact_ranked_ids": ranked_ids, + "candidate_ranked_ids": ranked_ids.copy(), + "exact_neighbor_semantic_coverage": 1.0, + "source_ids": [f"opaque-{query_number % 4}"], + "modalities": [modalities[query_number % 3]], + "history_ordinal": query_index, + "history_count": embedding_count, + "history_segment": ("early", "middle", "late")[ + min(2, query_index * 3 // embedding_count) + ], + } + ) + fixed_probe_numbers = [0, 85, 170, 255, 340, 425, 511] + artifact = { + "schema": "cortext_bounded_activation_shadow_quality_v1", + "quality_role": role, + "control_kind": ( + "current-public-retrieval" + if role == "approved-control" + else "candidate-router" + ), + "existing_fixed_probe_identity_rank_sha256": "1" * 64, + "embedding_count": embedding_count, + "query_count": 512, + "result_k": 16, + "focus": 0.5, + "sensitivity": 0.5, + "stability": 0.5, + "fixed_embedding_slots": 16020, + "quality": { + "all": { + "count": 512, + "mean_exact_id_recall_at_k": 1.0, + "mean_top1_exact_id": 1.0, + "mean_exact_neighbor_semantic_coverage": 1.0, + } + }, + "query_evidence": evidence, + "fixed_identity_rank_probes": [ + { + "query_number": query_number, + "exact_ranked_ids": evidence[query_number][ + "exact_ranked_ids" + ], + "candidate_ranked_ids": evidence[query_number][ + "candidate_ranked_ids" + ], + } + for query_number in fixed_probe_numbers + ], + "sqlite_restart_measurements": [ + { + "fraction": 0.25, + "retained_rows": 10000, + "rows_visited": 8000, + "measurement_authority": "production-shaped-persistent-restart", + "restored_candidate_count": 16, + "pre_restart_probe_identity_rank_sha256": "0" * 64, + "post_restart_probe_identity_rank_sha256": "0" * 64, + "restart_production_gate": True, + "linear_history": False, + }, + { + "fraction": 0.5, + "retained_rows": 20000, + "rows_visited": 12000, + "measurement_authority": "production-shaped-persistent-restart", + "restored_candidate_count": 16, + "pre_restart_probe_identity_rank_sha256": "0" * 64, + "post_restart_probe_identity_rank_sha256": "0" * 64, + "restart_production_gate": True, + "linear_history": False, + }, + { + "fraction": 1.0, + "retained_rows": 40000, + "rows_visited": 16020, + "measurement_authority": "production-shaped-persistent-restart", + "restored_candidate_count": 16, + "pre_restart_probe_identity_rank_sha256": "0" * 64, + "post_restart_probe_identity_rank_sha256": "0" * 64, + "restart_production_gate": True, + "linear_history": False, + } + ], + } + restart_probe_digest = audit.ranked_query_evidence_result( + artifact, 16 + )["fixed_probe_identity_rank_sha256"] + for item in artifact["sqlite_restart_measurements"]: + item["pre_restart_probe_identity_rank_sha256"] = restart_probe_digest + item["post_restart_probe_identity_rank_sha256"] = restart_probe_digest + return artifact + + def control_fixture(self) -> dict[str, object]: + return self.quality_fixture("approved-control") + + def audit_result( + self, candidate: dict[str, object], + control: dict[str, object] | None = None, + ) -> dict[str, object]: + control = control or self.control_fixture() + control_sha256 = audit.hashlib.sha256( + audit.canonical_json(control) + ).hexdigest() + return audit.bounded_activation_quality_result( + candidate, control, control_sha256 + ) + + def test_accepts_exact_quality_and_bounded_restart(self) -> None: + result = self.audit_result(self.quality_fixture()) + self.assertTrue(result["passed"], result["failures"]) + + def test_rejects_unapproved_control_digest(self) -> None: + with self.assertRaisesRegex(ValueError, "control digest is not approved"): + audit.bounded_activation_quality_result( + self.quality_fixture(), self.control_fixture(), "0" * 64 + ) + + def test_rejects_nonpublic_control_kind(self) -> None: + control = self.control_fixture() + control["control_kind"] = "exhaustive-embedding-neighbor-candidate" + with self.assertRaisesRegex(ValueError, "not the current public retrieval"): + self.audit_result(self.quality_fixture(), control) + + def test_rejects_unbound_existing_public_probe_digest(self) -> None: + fixture = self.quality_fixture() + fixture["existing_fixed_probe_identity_rank_sha256"] = "2" * 64 + with self.assertRaisesRegex(ValueError, "seven-probe digest"): + self.audit_result(fixture) + + def test_rejects_candidate_that_differs_from_approved_control_rank(self) -> None: + control = self.control_fixture() + control["query_evidence"][37]["candidate_ranked_ids"][1:3] = reversed( + control["query_evidence"][37]["candidate_ranked_ids"][1:3] + ) + result = self.audit_result(self.quality_fixture(), control) + self.assertFalse(result["passed"]) + self.assertIn( + "candidate evidence differs from approved control corpus", + result["failures"], + ) + + def test_rejects_missing_deterministic_query_identity(self) -> None: + fixture = self.quality_fixture() + fixture["query_evidence"][0].pop("query_embedding_id") + with self.assertRaisesRegex( + ValueError, "query identity is not bound to deterministic sampling" + ): + self.audit_result(fixture) + + def test_rejects_arbitrary_fixed_probe_positions(self) -> None: + fixture = self.quality_fixture() + fixture["fixed_identity_rank_probes"] = [ + { + "query_number": query_number, + "exact_ranked_ids": fixture["query_evidence"][query_number][ + "exact_ranked_ids" + ], + "candidate_ranked_ids": fixture["query_evidence"][query_number][ + "candidate_ranked_ids" + ], + } + for query_number in range(7) + ] + with self.assertRaisesRegex( + ValueError, "fixed identity-rank probe query is invalid" + ): + self.audit_result(fixture) + + def test_rejects_current_observation_residuals(self) -> None: + fixture = self.quality_fixture() + control = self.control_fixture() + for item in fixture["query_evidence"]: + item["candidate_ranked_ids"] = [ + value + 100000000 for value in item["exact_ranked_ids"] + ] + for probe in fixture["fixed_identity_rank_probes"]: + query_number = probe["query_number"] + probe["candidate_ranked_ids"] = fixture["query_evidence"][ + query_number + ]["candidate_ranked_ids"] + fixture["quality"]["all"]["mean_exact_id_recall_at_k"] = 0.0 + fixture["quality"]["all"]["mean_top1_exact_id"] = 0.0 + for item in fixture["sqlite_restart_measurements"]: + item["rows_visited"] = item["retained_rows"] + item["restart_production_gate"] = False + item["linear_history"] = True + result = self.audit_result(fixture, control) + self.assertFalse(result["passed"]) + self.assertIn("exact identity recall below invariant", result["failures"]) + self.assertIn("exact top-1 below invariant", result["failures"]) + self.assertIn("restart remains proportional to history", result["failures"]) + + def test_rejects_missing_mixed_input_coverage(self) -> None: + fixture = self.quality_fixture() + control = self.control_fixture() + for item in fixture["query_evidence"]: + item["source_ids"] = ["one-source"] + item["modalities"] = ["text"] + item["history_ordinal"] = 0 + item["history_segment"] = "early" + result = self.audit_result(fixture, control) + self.assertFalse(result["passed"]) + self.assertIn( + "mixed source modality and history coverage missing", + result["failures"], + ) + + def test_rejects_out_of_range_quality_fraction(self) -> None: + fixture = self.quality_fixture() + fixture["quality"]["all"]["mean_top1_exact_id"] = 1.01 + with self.assertRaisesRegex(ValueError, "must not exceed one"): + self.audit_result(fixture) + + def test_rejects_reordered_exact_neighbors(self) -> None: + fixture = self.quality_fixture() + control = self.control_fixture() + for item in fixture["query_evidence"]: + item["candidate_ranked_ids"][1:3] = reversed( + item["candidate_ranked_ids"][1:3] + ) + for probe in fixture["fixed_identity_rank_probes"]: + query_number = probe["query_number"] + probe["candidate_ranked_ids"] = fixture["query_evidence"][ + query_number + ]["candidate_ranked_ids"] + result = self.audit_result(fixture, control) + self.assertFalse(result["passed"]) + self.assertIn( + "deterministic exact rank order differs", result["failures"] + ) + self.assertIn("fixed identity-rank probe differs", result["failures"]) + + def test_rejects_unbound_query_count(self) -> None: + fixture = self.quality_fixture() + fixture["quality"]["all"]["count"] = 0 + result = self.audit_result(fixture) + self.assertFalse(result["passed"]) + self.assertIn("quality query evidence count mismatch", result["failures"]) + + def test_rejects_linear_restart_despite_passing_labels(self) -> None: + fixture = self.quality_fixture() + for item in fixture["sqlite_restart_measurements"]: + item["rows_visited"] = item["retained_rows"] + result = self.audit_result(fixture) + self.assertFalse(result["passed"]) + self.assertIn( + "restart remains proportional to history", result["failures"] + ) + + def test_rejects_vacuous_restart_series(self) -> None: + fixture = self.quality_fixture() + for index, item in enumerate(fixture["sqlite_restart_measurements"]): + item["retained_rows"] = 16021 + index + item["rows_visited"] = 0 + item["restored_candidate_count"] = 0 + with self.assertRaisesRegex( + ValueError, "not bound to restored corpus state" + ): + self.audit_result(fixture) + + def test_rejects_restart_probe_digest_mismatch(self) -> None: + fixture = self.quality_fixture() + fixture["sqlite_restart_measurements"][1][ + "post_restart_probe_identity_rank_sha256" + ] = "6" * 64 + with self.assertRaisesRegex( + ValueError, "not bound to restored corpus state" + ): + self.audit_result(fixture) + + def test_rejects_restart_probe_digest_that_is_consistent_but_wrong(self) -> None: + fixture = self.quality_fixture() + for item in fixture["sqlite_restart_measurements"]: + item["pre_restart_probe_identity_rank_sha256"] = "6" * 64 + item["post_restart_probe_identity_rank_sha256"] = "6" * 64 + with self.assertRaisesRegex( + ValueError, "not bound to restored corpus state" + ): + self.audit_result(fixture) + + def test_quality_cli_enforces_contract_and_report_only_mode(self) -> None: + with tempfile.TemporaryDirectory() as directory: + root = Path(directory) + artifact = root / "quality.json" + control = root / "control.json" + output = root / "audit.json" + fixture = self.quality_fixture() + fixture["query_evidence"][1]["candidate_ranked_ids"][1:3] = reversed( + fixture["query_evidence"][1]["candidate_ranked_ids"][1:3] + ) + artifact.write_text(json.dumps(fixture), encoding="utf-8") + control.write_text( + json.dumps(self.control_fixture()), + encoding="utf-8", + ) + approved_control_sha256 = audit.hashlib.sha256( + audit.canonical_json(self.control_fixture()) + ).hexdigest() + command = [ + sys.executable, + str(Path(__file__).with_name("audit_storage_cost_profile.py")), + "--shadow-quality", + str(artifact), + "--quality-control", + str(control), + "--approved-control-sha256", + approved_control_sha256, + "--out", + str(output), + ] + enforced = subprocess.run( + command, check=False, capture_output=True, text=True + ) + report_only = subprocess.run( + [*command, "--report-only"], + check=False, + capture_output=True, + text=True, + ) + self.assertEqual(enforced.returncode, 1, enforced.stderr) + self.assertEqual(report_only.returncode, 0, report_only.stderr) + self.assertFalse(json.loads(output.read_text())["passed"]) + + if __name__ == "__main__": unittest.main() From 6ac1e3121e4be9aa456c7ac93fdb4b09ea34023d Mon Sep 17 00:00:00 2001 From: gabewillen Date: Tue, 21 Jul 2026 00:09:23 -0500 Subject: [PATCH 08/18] Cut over bounded SQLite retrieval sawtooth --- CMakeLists.txt | 13 + ...ynamic-retrieval-sawtooth-maturity-v1.json | 203 + .../paper-traceability-audit-v2.json | 14 + .../paper-traceability-current-state-v2.json | 114 + .../paper-traceability-manifest-v1.json | 1322 +++ ...ter-centroid-natural-13000-v1-overlap.json | 64 + ...roid-natural-13000-v1-retrieval-audit.json | 7717 +++++++++++++++++ ...nter-centroid-natural-full-v1-overlap.json | 64 + ...troid-natural-full-v1-retrieval-audit.json | 7717 +++++++++++++++++ ...entroid-natural-full-v1-storage-audit.json | 4083 +++++++++ ...-activation-snapshot-knob-ablation-v1.json | 1171 +++ ...-production-sawtooth-knob-ablation-v2.json | 1146 +++ build.zig | 4 + build.zig.zon | 4 + ...trator-goal-mdscript-converted.mdscript.md | 51 + docs/paper/_manuscript/index.md | 4167 ++++++++- docs/paper/sections/10_implementation.qmd | 507 +- docs/paper/sections/11_optimization.qmd | 2041 ++++- examples/benchmark/chat_replay_live_run.cpp | 841 +- src/cortext.cpp | 58 +- src/experimental_env.hpp | 13 + .../active_signal_embedding_ring_internal.hpp | 100 + .../association_fanout_cache_internal.hpp | 60 +- .../bounded_activation_shadow_internal.hpp | 8 +- src/operations/competition.cpp | 6 +- src/operations/consolidation.cpp | 68 +- ...onsolidation_throughput_state_internal.hpp | 30 +- src/operations/emotion_cascade.cpp | 230 +- .../emotional_metadata_cache_internal.hpp | 33 +- .../execution_cache_sidecar_internal.hpp | 3 + src/operations/graph_retrieval.cpp | 452 +- ...storical_surface_search_cache_internal.hpp | 450 + src/operations/memory_storage.cpp | 178 +- src/operations/memory_strength.cpp | 15 +- src/operations/reconsolidation.cpp | 6 +- src/operations/retrieval_trace_state.cpp | 88 + src/operations/retrieval_trace_state.hpp | 28 + .../rif_active_epoch_cache_internal.hpp | 311 +- src/operations/rif_state_internal.hpp | 188 +- .../sparse_retrieval_knobs_internal.hpp | 170 + .../sparse_retrieval_route_internal.cpp | 504 ++ .../sparse_retrieval_route_internal.hpp | 108 + ...sparse_retrieval_route_sqlite_internal.cpp | 2012 +++++ ...sparse_retrieval_route_sqlite_internal.hpp | 342 + src/operations/write_gate.cpp | 80 + src/signal_processor.cpp | 867 +- src/store.cpp | 276 +- src/store/commit_profile_internal.hpp | 27 + src/store/mutation_audit_internal.hpp | 3 + src/store/schema.cpp | 78 + tests/core_knobs.test.cpp | 1 - tests/cortext.test.cpp | 127 +- tests/migration_core.test.cpp | 152 + tests/operations_competition.test.cpp | 253 +- tests/operations_consolidation.test.cpp | 217 +- tests/operations_emotion_cascade.test.cpp | 259 +- tests/operations_graph_retrieval.test.cpp | 1669 +++- tests/operations_memory_storage.test.cpp | 336 +- tests/operations_write_gate.test.cpp | 159 + tests/signal_processor.test.cpp | 803 +- tests/store.test.cpp | 23 + tools/audit_paper_traceability.py | 413 + tools/audit_paper_traceability_test.py | 134 + tools/audit_public_retrieval_control.py | 367 + tools/audit_public_retrieval_control_test.py | 149 + tools/audit_storage_cost_profile.py | 1688 +++- tools/audit_storage_cost_profile_test.py | 1368 ++- tools/benchmark_row_addressed_route_sqlite.py | 417 + ...nchmark_row_addressed_route_sqlite_test.py | 52 + tools/build_paper_traceability_manifest.py | 413 + tools/build_recenter_activation_overlap.py | 300 + .../build_recenter_activation_overlap_test.py | 113 + tools/build_signal_centroid_ring_ablation.py | 248 + ...uild_signal_centroid_ring_ablation_test.py | 150 + tools/build_sqlite_hnsw_knob_ablation.py | 845 ++ tools/build_sqlite_hnsw_knob_ablation_test.py | 254 + .../build_write_gate_incidence_attribution.py | 372 + ...d_write_gate_incidence_attribution_test.py | 180 + tools/extract_consolidation_schedule.py | 43 + 79 files changed, 48633 insertions(+), 907 deletions(-) create mode 100644 artifacts/flat_storage_cost/dynamic-retrieval-sawtooth-maturity-v1.json create mode 100644 artifacts/flat_storage_cost/paper-traceability-audit-v2.json create mode 100644 artifacts/flat_storage_cost/paper-traceability-current-state-v2.json create mode 100644 artifacts/flat_storage_cost/paper-traceability-manifest-v1.json create mode 100644 artifacts/flat_storage_cost/recenter-centroid-natural-13000-v1-overlap.json create mode 100644 artifacts/flat_storage_cost/recenter-centroid-natural-13000-v1-retrieval-audit.json create mode 100644 artifacts/flat_storage_cost/recenter-centroid-natural-full-v1-overlap.json create mode 100644 artifacts/flat_storage_cost/recenter-centroid-natural-full-v1-retrieval-audit.json create mode 100644 artifacts/flat_storage_cost/recenter-centroid-natural-full-v1-storage-audit.json create mode 100644 artifacts/flat_storage_cost/sqlite-hnsw-activation-snapshot-knob-ablation-v1.json create mode 100644 artifacts/flat_storage_cost/sqlite-hnsw-production-sawtooth-knob-ablation-v2.json create mode 100644 comments/consolidation-drift-retrigger/20260716T205900Z-orchestrator-goal-mdscript-converted.mdscript.md create mode 100644 src/operations/active_signal_embedding_ring_internal.hpp create mode 100644 src/operations/sparse_retrieval_knobs_internal.hpp create mode 100644 src/operations/sparse_retrieval_route_internal.cpp create mode 100644 src/operations/sparse_retrieval_route_internal.hpp create mode 100644 src/operations/sparse_retrieval_route_sqlite_internal.cpp create mode 100644 src/operations/sparse_retrieval_route_sqlite_internal.hpp create mode 100644 src/store/commit_profile_internal.hpp create mode 100644 tools/audit_paper_traceability.py create mode 100644 tools/audit_paper_traceability_test.py create mode 100644 tools/audit_public_retrieval_control.py create mode 100644 tools/audit_public_retrieval_control_test.py mode change 100644 => 100755 tools/audit_storage_cost_profile.py create mode 100644 tools/benchmark_row_addressed_route_sqlite.py create mode 100644 tools/benchmark_row_addressed_route_sqlite_test.py create mode 100644 tools/build_paper_traceability_manifest.py create mode 100644 tools/build_recenter_activation_overlap.py create mode 100644 tools/build_recenter_activation_overlap_test.py create mode 100644 tools/build_signal_centroid_ring_ablation.py create mode 100644 tools/build_signal_centroid_ring_ablation_test.py create mode 100644 tools/build_sqlite_hnsw_knob_ablation.py create mode 100644 tools/build_sqlite_hnsw_knob_ablation_test.py create mode 100644 tools/build_write_gate_incidence_attribution.py create mode 100644 tools/build_write_gate_incidence_attribution_test.py create mode 100644 tools/extract_consolidation_schedule.py diff --git a/CMakeLists.txt b/CMakeLists.txt index 2cbb56ca..ebd8de63 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -159,6 +159,16 @@ FetchContent_Declare( GIT_TAG v3.12.0 ) FetchContent_MakeAvailable(nlohmann_json) + +# hnswlib provides the private sparse candidate route used by graph retrieval. +# Keep the exact commit pinned: SQLite and Cortext remain authoritative for +# eligibility and final ranking; this dependency only proposes bounded IDs. +FetchContent_Declare( + hnswlib + GIT_REPOSITORY https://github.com/nmslib/hnswlib.git + GIT_TAG d9b3608c83d83b46c96e25088cb1d729b29dcfe9 +) +FetchContent_MakeAvailable(hnswlib) set(BUILD_TESTING "${_cortext_saved_dependency_build_testing}") # @@ -256,6 +266,8 @@ add_library(cortext src/operations/meta_learning_internal.cpp src/operations/graph_build.cpp src/operations/graph_retrieval.cpp + src/operations/sparse_retrieval_route_internal.cpp + src/operations/sparse_retrieval_route_sqlite_internal.cpp src/operations/eviction_policy_override.cpp src/operations/storage_pressure.cpp src/operations/retrieval_trace_state.cpp @@ -599,6 +611,7 @@ target_compile_definitions(cortext PRIVATE SQLITE_CORE=1) # Link dependencies (SQLite handling differs per target) target_link_libraries(cortext PUBLIC Eigen3::Eigen) target_link_libraries(cortext PRIVATE nlohmann_json::nlohmann_json) +target_include_directories(cortext SYSTEM PRIVATE ${hnswlib_SOURCE_DIR}) get_target_property(CORTEXT_NLOHMANN_INCLUDE_DIRS nlohmann_json::nlohmann_json INTERFACE_INCLUDE_DIRECTORIES) if(CORTEXT_NLOHMANN_INCLUDE_DIRS) target_include_directories(cortext BEFORE PRIVATE ${CORTEXT_NLOHMANN_INCLUDE_DIRS}) diff --git a/artifacts/flat_storage_cost/dynamic-retrieval-sawtooth-maturity-v1.json b/artifacts/flat_storage_cost/dynamic-retrieval-sawtooth-maturity-v1.json new file mode 100644 index 00000000..edce0400 --- /dev/null +++ b/artifacts/flat_storage_cost/dynamic-retrieval-sawtooth-maturity-v1.json @@ -0,0 +1,203 @@ +{ + "schema": "cortext_dynamic_retrieval_sawtooth_maturity_v1", + "production_cutover": true, + "decision": "8C-to-9C-by-B/16 passed extended maturity and canonical quality gates and was subsequently cut over as the production default; the canonical run did not reach the 8C floor, so the extended owner-authorized history remains the mature-cycle proof and whole-engine boundedness remains unclaimed", + "corpus": { + "kind": "owner-authorized-real-claude-append-history-diagnostic", + "canonical_packet_count": 15695, + "canonical_sha256": "17a447f237ff7dd1b732eca1a0f31e908b89b2ffdd20ae8b32df2e719a0271a2", + "append_record_count": 379, + "append_packet_count": 14685, + "append_raw_sha256": "3fc622ed5564d4a3bc8fc92a3a8e26cd44848776797521b50c4402afd9861ff0", + "append_packet_sha256": "6a3ad46de304eacc09daa1af2e6a01bba78a12f77bf44a0f364ecc917c2d0dc1", + "total_packet_count": 30380, + "combined_sha256": "d6dff35235f67a5b0b9cc169195cb225933fd8afd5dcd8f9259e481253909281", + "transform": "canonical UTF-16 tool-input cap, uncapped recorded tool-result text, sentence/newline split, and 400-character word-boundary chunks; no trimming, cycling, padding, or synthesis", + "acceptance_role": "maturity diagnostic only; does not replace the canonical acceptance corpus" + }, + "quality_contract": { + "query_count": 512, + "top1_minimum": 0.998046875, + "top1_maximum_misses": 1, + "nine_run_aggregate_top1_minimum": 0.999, + "recall_at_16_minimum": 0.998, + "semantic_coverage_minimum": 0.95, + "deterministic_tie_order_required": true, + "miss_clustering_forbidden": [ + "modality", + "opaque source id", + "memory age", + "knob setting" + ] + }, + "candidates": [ + { + "id": "4C+B/16-to-5C", + "status": "rejected", + "profile_sha256": "9388bd95d1285566844da11bd80a17004a7c9e52e6a25cedfafffb0d098c25e7", + "retrieval_audit_sha256": "356a025910bf0fd48c2f9e2827a68e27ca49b839d346334054785d072154cb51", + "storage_audit_sha256": "e912782ec7e3b58139dcde1a31253e1adb73c6bbdf517222ed3ddaaa3df4b141", + "wall_ms": 438059, + "mean_process_ms": 6.02358290908497, + "mean_total_ms": 14.080722651612865, + "consolidation_runs": 72, + "top1_hits": 507, + "top1": 0.990234375, + "recall_at_16": 0.9772254193706379, + "semantic_coverage": 0.9710842225609768, + "deterministic_tie_order": true, + "late_history_top1_miss_count": 5, + "mature_cycle_count": 30, + "mature_reset_count": 30, + "mature_peak_half_ratio": 0.9972300155867291, + "mature_trough_half_ratio": 1.0003084175974268, + "mature_shape_p95_normalized_mae": 0.3074492430209277, + "work_bound_violation_count": 0, + "rejection_reasons": [ + "top-1 below 0.998046875", + "recall at 16 below 0.998", + "all top-1 misses cluster in the late-history query quartile", + "mature cycle p95 shape error exceeds the preregistered limit" + ] + }, + { + "id": "5C-to-6C-by-B/16", + "status": "rejected", + "profile_sha256": "3a2b590a0f06709bdcdfdc66b500dc6c83ca4362120659b336cc70beca1a84be", + "retrieval_audit_sha256": "db6636ae5d4fdc50c57334aacaaa894577830dda8005678c8676956bf5ee0450", + "storage_audit_sha256": "ea993adb8640b3bfaf3fd13ede09e043900b78e2760ed1d5d6510eb85372e669", + "wall_ms": 388336, + "mean_process_ms": 5.678885334529304, + "mean_total_ms": 12.47329932465449, + "consolidation_runs": 65, + "top1_hits": 512, + "top1": 1.0, + "recall_at_16": 0.9926506614404703, + "semantic_coverage": 0.9892339939024407, + "deterministic_tie_order": true, + "mature_cycle_count": 24, + "mature_reset_count": 24, + "mature_peak_half_ratio": 1.0, + "mature_trough_half_ratio": 0.998530029399412, + "mature_shape_p95_normalized_mae": 0.1308710691877862, + "mature_late_template_normalized_mae": 0.01371548006503459, + "work_bound_violation_count": 0, + "rejection_reasons": [ + "recall at 16 below 0.998", + "whole-engine plateau false" + ], + "timing_nonclaim": "the lower wall time is not an isolated retrieval-throughput win because the live detector requested seven fewer consolidations" + }, + { + "id": "6C-to-7C-by-B/16", + "status": "rejected", + "profile_sha256": "e3a71789973ab0d93c9e707d2254c4cff4fe07b5a73b25fa20c8245c60b7241d", + "retrieval_audit_sha256": "322f72cdfdfa92d8a433634612c387c7575b392dca8e390640f0c3d69c9f1ab9", + "storage_audit_sha256": "a0d613e410b8381109344b98d1c54da82d2a9e9d0ad03a0e1f8814f98706f5eb", + "wall_ms": 423535, + "mean_process_ms": 6.458757645523376, + "mean_total_ms": 13.62130139789354, + "consolidation_runs": 62, + "top1_hits": 511, + "top1": 0.998046875, + "recall_at_16": 0.9958333333333333, + "semantic_coverage": 0.9935689786585379, + "deterministic_tie_order": true, + "mature_cycle_count": 23, + "mature_reset_count": 23, + "mature_shape_p95_normalized_mae": 0.022170007268700928, + "work_bound_violation_count": 0, + "rejection_reasons": [ + "recall at 16 below 0.998", + "whole-engine plateau false" + ] + }, + { + "id": "7C-to-8C-by-B/16", + "status": "rejected", + "profile_sha256": "45bc03d61cbc4951612d3917f7deac85ced27971ebe18a956f411895e8d778da", + "retrieval_audit_sha256": "17f38b69c98de631bbeb9d9fe6b678b0abb2b15cd0628a04c76fbc831e4811cf", + "storage_audit_sha256": "2f188b097b46f3c7627d613c6cdf24116c1f670780dd173c1b76f1fcab0af1f8", + "wall_ms": 390079, + "mean_process_ms": 5.874491052929559, + "mean_total_ms": 12.544524463067726, + "consolidation_runs": 62, + "top1_hits": 511, + "top1": 0.998046875, + "recall_at_16": 0.9976724243537914, + "semantic_coverage": 0.996855945121953, + "deterministic_tie_order": true, + "mature_cycle_count": 22, + "mature_reset_count": 22, + "mature_shape_p95_normalized_mae": 0.0229932759954844, + "work_bound_violation_count": 0, + "rejection_reasons": [ + "recall at 16 below 0.998", + "whole-engine plateau false" + ] + }, + { + "id": "8C-to-9C-by-B/16", + "status": "retrieval-quality-and-extended-maturity-passed-cutover-pending", + "profile_sha256": "765872cb6923908f715d74baf150a1bd19495db0901c7c094928cd0f55675069", + "retrieval_audit_sha256": "baabdc89cded1fa68ba5452dd779d960ab333e818cac15b722a91857df8e33e5", + "storage_audit_sha256": "5cbd16947f0f6f39bdeafb65a859ed77ec938a5b2006c114ca38d1865de287d0", + "wall_ms": 435573, + "mean_process_ms": 6.55384486231078, + "mean_total_ms": 14.003883617149528, + "consolidation_runs": 68, + "top1_hits": 511, + "top1": 0.998046875, + "recall_at_16": 0.9992650661440471, + "semantic_coverage": 0.9985708841463422, + "deterministic_tie_order": true, + "mature_cycle_count": 20, + "mature_reset_count": 19, + "mature_peak_half_ratio": 0.9990641224662602, + "mature_trough_half_ratio": 0.9993599281789541, + "mature_shape_p95_normalized_mae": 0.1908168371510824, + "mature_late_template_normalized_mae": 0.07952840625801823, + "work_bound_violation_count": 0, + "canonical": { + "packet_count": 15695, + "profile_sha256": "a8bc2599f1a4c7e372421c679e340024ce9a9cc81b7039419acb6461bee88484", + "retrieval_audit_sha256": "a24309a967f128f5fd7f17ce04829481964d547a3be6fe7f98f1589ee182d5e4", + "storage_audit_sha256": "9538aafc1730fd64aa1e23ffc49637b0047f721f0f18cd4aa4c0b251d1a1f502", + "wall_ms": 214263, + "mean_process_ms": 5.233227, + "mean_total_ms": 13.333855, + "consolidation_runs": 34, + "top1_hits": 512, + "top1": 1.0, + "recall_at_16": 1.0, + "semantic_coverage": 1.0, + "deterministic_tie_order": true, + "opaque_source_count": 4, + "maximum_actual_retrieval_work_rows": 3064, + "derived_floor_rows": 3992, + "mature_cycle_count": 0, + "whole_engine_plateau": false, + "proof_boundary": "canonical quality passed, but the finite corpus ended before the 8C floor and therefore cannot independently prove mature sawtooth shape" + }, + "unresolved": [ + "whole-engine plateau" + ] + } + ], + "historical_experiment_binary_sha256": null, + "historical_experiment_binary_identity_note": "The previous digest identified an unrelated Apple-toolchain build and was removed. The original release experiment binary had already been rebuilt before its full digest was copied into this sanitized record; profile and audit digests remain preserved, and current production-default evidence is independently content-addressed by sqlite-hnsw-production-sawtooth-knob-ablation-v2.json.", + "focused_test": { + "name": "Quality-preserving experimental retrieval sawtooth keeps the canonical floor", + "assertions": 16, + "passed": true + }, + "audit_fixture_tests": { + "count": 116, + "passed": true + }, + "unresolved": [ + "whole-engine Natural plateau", + "Durable plateau", + "production-wide boundedness" + ] +} diff --git a/artifacts/flat_storage_cost/paper-traceability-audit-v2.json b/artifacts/flat_storage_cost/paper-traceability-audit-v2.json new file mode 100644 index 00000000..e6041775 --- /dev/null +++ b/artifacts/flat_storage_cost/paper-traceability-audit-v2.json @@ -0,0 +1,14 @@ +{ + "generated_claim_mismatches": [], + "inventory_count": 69, + "manifest_sha256": "222e2525511e61c12cc870dcb6d3e41dc4475ea7414163f8442be689fdf9df7d", + "manuscript_sha256": "f7ed5d59cadeb0cc3194da92ea4f574e20f0a030e5aa28e6ff54cefdd44a43de", + "missing_source_claims": [], + "ownership_violations": [], + "passed": true, + "proof_level_violations": [], + "record_count": 69, + "schema": "cortext_paper_traceability_audit_v1", + "state_sha256": "bb2c335ab974d05ae26aaf75f18ab4f1d3beab519a31b1d3ca3c0e0b6c6234fb", + "uncovered_inventory": [] +} diff --git a/artifacts/flat_storage_cost/paper-traceability-current-state-v2.json b/artifacts/flat_storage_cost/paper-traceability-current-state-v2.json new file mode 100644 index 00000000..faf771fa --- /dev/null +++ b/artifacts/flat_storage_cost/paper-traceability-current-state-v2.json @@ -0,0 +1,114 @@ +{ + "schema": "cortext_paper_traceability_state_overlay_v2", + "supersedes_state_sha256": "f0605f910ed3c10fa7838c2e175c5d0babbe352f7e4fe4e2f92fdf3c70cd1f2d", + "phase": "production-cutover-review", + "completion": false, + "resume_phase": "repair-review-findings", + "sqlite_hnsw_schema_authority": { + "status": "approved-current-user-through-migration-31", + "approver_identity": "current-user", + "provenance": "direct user authorization in this task", + "schema_migration_numbers": [29, 30, 31], + "authority_scope": "private internal SQLite sparse route, exact signal-vector ring, and knob-bounded activation-centroid persistence", + "public_api_change": false, + "no_release_or_deployment_grant": true + }, + "sqlite_hnsw_knob_ablation": { + "status": "passed-production-default-8c-to-9c-quality-matrix", + "decision": "retained-production-default", + "artifact": "artifacts/flat_storage_cost/sqlite-hnsw-production-sawtooth-knob-ablation-v2.json", + "artifact_sha256": "08e9270ce750d5247cb52bd985f7126bb570109f8246a74f12bae99617002be9", + "structural_configurations": 27, + "corpus_configurations": 9, + "system_quality_query_count": 4608, + "exact_top1_hits": 4608, + "exact_top1_queries": 4608, + "exact_identity_recall_at_16_min": 1.0, + "semantic_coverage_min": 1.0, + "production_cutover": true, + "whole_engine_restart_bounded": false + }, + "retrieval_sparse_knob_ablation": { + "status": "passed-production-default-8c-to-9c-quality-matrix", + "artifact": "artifacts/flat_storage_cost/sqlite-hnsw-production-sawtooth-knob-ablation-v2.json", + "artifact_sha256": "08e9270ce750d5247cb52bd985f7126bb570109f8246a74f12bae99617002be9", + "route_lifecycle_evaluated_run_count": 0, + "sparse_route_traversed_recenter_unproven_run_count": 9, + "exact_top1_per_run_max_misses": 1, + "exact_top1_nine_run_aggregate_min": 0.999, + "exact_identity_recall_at_16_min": 0.998, + "semantic_coverage_min": 0.95, + "production_cutover": true, + "unresolved": [ + "mature lifecycle proof is supplied by the separate 30,380-packet experiment", + "whole-engine Natural and Durable plateaus remain unproven" + ] + }, + "sqlite_hnsw_production_cutover": { + "decision": "retained-production-default", + "production_cutover": true, + "schema_authority": { + "migrations": { + "29": "internal SQLite HNSW route, metadata, build, node, and dirty-journal tables", + "31": "knob-bounded activation entry, generation, centroid, and identity snapshot columns" + }, + "public_api_change": false, + "authority": "current user explicitly approved the SQLite shadow-memory schema design and authorized the implementation changes" + }, + "retrieval_contract": { + "queries_per_run": 512, + "exact_top1_per_run_min": 0.998046875, + "exact_top1_per_run_max_misses": 1, + "exact_top1_nine_run_aggregate_min": 0.999, + "exact_identity_recall_at_16_min": 0.998, + "semantic_coverage_min": 0.95, + "deterministic_tie_order_required": true, + "miss_clustering_forbidden": [ + "modality", + "opaque source id", + "memory-age quartile", + "knob point" + ] + }, + "formulas": { + "C": "lround(256+256F+128S+128T)", + "B": "lround(64+64F+32S+32T)", + "A": "2C+2B", + "R": "max(2,B/16)", + "post_consolidation_floor": "8C", + "retrieval_peak": "9C", + "total_query_row_ceiling": "9C+A" + }, + "quality_result": { + "run_count": 9, + "exact_top1_hits": 4608, + "exact_top1_queries": 4608, + "minimum_exact_identity_recall_at_16": 1.0, + "minimum_semantic_coverage": 1.0, + "clustered_misses": 0, + "modality_source_label_invariance": true + }, + "evidence": { + "production_ablation": "artifacts/flat_storage_cost/sqlite-hnsw-production-sawtooth-knob-ablation-v2.json", + "production_ablation_sha256": "08e9270ce750d5247cb52bd985f7126bb570109f8246a74f12bae99617002be9", + "benchmark_binary_sha256": "5e884ca9f7749f57b3ba2817b7525a378a261d8fd1ce501a3f215c5e551884cd", + "test_binary_sha256": "942f429a28562454563b599d08e8afac4c34feef4908d163a1bd6770de24d8a3", + "natural_packets": 15695, + "durable_messages": 2016, + "mature_extension_packets": 30380 + }, + "operation_ownership": { + "natural_durable_shared_algorithm": true, + "durable_addition": "post-commit flush/checkpoint barrier only", + "source_id_branch": false, + "modality_branch": false + }, + "unresolved_limits": [ + "whole-engine raw process reset is not proven", + "bounded whole-engine restart is not proven", + "Durable plateau is not proven", + "production-wide boundedness is not claimed", + "merge, release, deployment, and publication are not authorized" + ] + } +} diff --git a/artifacts/flat_storage_cost/paper-traceability-manifest-v1.json b/artifacts/flat_storage_cost/paper-traceability-manifest-v1.json new file mode 100644 index 00000000..02c22e3a --- /dev/null +++ b/artifacts/flat_storage_cost/paper-traceability-manifest-v1.json @@ -0,0 +1,1322 @@ +{ + "algorithm_groups": [ + { + "id": "consolidation-envelope-and-detector", + "paths": [ + "src/operations/accumulator_reset.cpp", + "src/operations/consolidation.cpp", + "src/operations/consolidation_shallow.cpp", + "src/operations/consolidation_throughput_state_internal.hpp" + ] + }, + { + "id": "shared-retention-and-rollback", + "paths": [ + "src/operations/accumulator.cpp", + "src/operations/signal_record_rollback_internal.hpp", + "src/operations/write_gate.cpp", + "src/operations/working_memory.cpp", + "src/signal_processor.cpp" + ] + }, + { + "id": "lazy-rif-active-epoch", + "paths": [ + "src/operations/competition.cpp", + "src/operations/execution_cache_sidecar_internal.hpp", + "src/operations/memory_strength.cpp", + "src/operations/rif_active_epoch_cache_internal.hpp", + "src/operations/rif_state_internal.hpp", + "src/store.cpp", + "src/store/schema.cpp" + ] + }, + { + "id": "bounded-graph-retrieval", + "paths": [ + "src/operations/sparse_retrieval_knobs_internal.hpp", + "src/operations/bounded_activation_shadow_internal.hpp", + "src/operations/family_embedding_features_internal.hpp", + "src/operations/graph_retrieval.cpp", + "src/operations/historical_surface_search_cache_internal.hpp", + "src/operations/retrieval_trace_state.cpp", + "src/operations/retrieval_trace_state.hpp", + "src/operations/sparse_retrieval_route_internal.cpp", + "src/operations/sparse_retrieval_route_internal.hpp", + "src/operations/sparse_retrieval_route_sqlite_internal.cpp", + "src/operations/sparse_retrieval_route_sqlite_internal.hpp" + ] + }, + { + "id": "emotional-propagation-cache", + "paths": [ + "src/experimental_env.hpp", + "src/operations/emotion.cpp", + "src/operations/emotion_cascade.cpp", + "src/operations/emotional_metadata_cache_internal.hpp" + ] + }, + { + "id": "memory-storage-and-graph-maintenance", + "paths": [ + "src/operations/active_signal_embedding_ring_internal.hpp", + "src/operations/association_fanout_cache_internal.hpp", + "src/operations/detect_memory_usage.cpp", + "src/operations/eviction_policy.hpp", + "src/operations/memory_storage.cpp", + "src/operations/predictive.cpp", + "src/operations/reconsolidation.cpp", + "src/operations/stability.cpp" + ] + }, + { + "id": "runtime-composition", + "paths": [ + "src/cortext.cpp", + "src/cortext_pipeline_internal.hpp" + ] + }, + { + "id": "bounded-work-instrumentation", + "paths": [ + "src/operations/consolidation_epoch_profile_internal.hpp", + "src/store/commit_profile_internal.hpp", + "src/store/mutation_audit_internal.hpp" + ] + }, + { + "id": "experiment-harness-and-audit", + "paths": [ + "examples/benchmark/chat_replay_live_run.cpp", + "tools/audit_public_retrieval_control.py", + "tools/audit_storage_cost_profile.py", + "tools/benchmark_row_addressed_route_sqlite.py", + "tools/build_sqlite_hnsw_knob_ablation.py", + "tools/build_signal_centroid_ring_ablation.py", + "tools/extract_claude_session_packets.py", + "tools/extract_consolidation_schedule.py", + "tools/build_recenter_activation_overlap.py", + "tools/build_write_gate_incidence_attribution.py" + ] + } + ], + "base_commit": "1bf3f1c5f6470bb8c4d458a0389c19c5123f9b81", + "evaluated_bounded_route_variants": [ + "reciprocal-route-only", + "three-sparse-graphs", + "construction-budget-4096", + "construction-budget-8192-reciprocal-64", + "two-graphs-construction-16384-retrieval-1280-reciprocal-64" + ], + "ownership_model": { + "durable_only_flush_barrier": true, + "manuscript_claim_fingerprints": [ + "Natural and Durable use one ingestion algorithm", + "post-commit flush/checkpoint barrier" + ], + "natural_durable_shared_algorithm": true, + "source_claim_fingerprints": [ + "Natural and Durable use one ingestion algorithm", + "post-commit flush/checkpoint barrier" + ] + }, + "record_defaults": { + "source_section": { + "heading": "Experiment and algorithm traceability inventory", + "path": "docs/paper/sections/11_optimization.qmd" + } + }, + "records": [ + { + "corpus_parameter_scope": "focused fresh/copied-late candidate window under the recorded 15,695-packet Natural profile contract", + "decision": "rejected", + "evidence_fingerprints": [ + "b56ea0786ff5b4a0347d0e7a6de9aa3c22223c53b478b47bdcee30fe163550be" + ], + "evidence_kind": "measured", + "inventory_id": "rejected:Competition.rif_recovery_active_sql.suppression-cache", + "proof_level": "source-health", + "source_section": { + "heading": "Experiment and algorithm traceability inventory", + "path": "docs/paper/sections/11_optimization.qmd" + }, + "unresolved_limits": [ + "candidate was removed after its failed gate" + ] + }, + { + "corpus_parameter_scope": "focused fresh/copied-late candidate window under the recorded 15,695-packet Natural profile contract", + "decision": "rejected", + "evidence_fingerprints": [ + "088e84fc0f75908911e1c731e1c831075f96e529956ad6d5f9383e812219ed00" + ], + "evidence_kind": "measured", + "inventory_id": "rejected:Competition.rif_recovery_active_sql.update-returning", + "proof_level": "source-health", + "source_section": { + "heading": "Experiment and algorithm traceability inventory", + "path": "docs/paper/sections/11_optimization.qmd" + }, + "unresolved_limits": [ + "candidate was removed after its failed gate" + ] + }, + { + "corpus_parameter_scope": "focused fresh/copied-late candidate window under the recorded 15,695-packet Natural profile contract", + "decision": "rejected", + "evidence_fingerprints": [ + "54ac53f37f4187a01147177e8927d12a602de6c0ee93270302a8e4fd4790b33a" + ], + "evidence_kind": "measured", + "inventory_id": "rejected:EmotionalCascade.knob-derived-bounded-priority-prefix", + "proof_level": "source-health", + "source_section": { + "heading": "Experiment and algorithm traceability inventory", + "path": "docs/paper/sections/11_optimization.qmd" + }, + "unresolved_limits": [ + "candidate was removed after its failed gate" + ] + }, + { + "corpus_parameter_scope": "focused fresh/copied-late candidate window under the recorded 15,695-packet Natural profile contract", + "decision": "rejected", + "evidence_fingerprints": [ + "0a32e2a73b19103495708ca5423d63368db7146f100bf8c6715a63e797b8b725" + ], + "evidence_kind": "measured", + "inventory_id": "rejected:GraphRetrieve.seed_cache_family_compare.coordinate-block", + "proof_level": "source-health", + "source_section": { + "heading": "Experiment and algorithm traceability inventory", + "path": "docs/paper/sections/11_optimization.qmd" + }, + "unresolved_limits": [ + "candidate was removed after its failed gate" + ] + }, + { + "corpus_parameter_scope": "focused fresh/copied-late candidate window under the recorded 15,695-packet Natural profile contract", + "decision": "rejected", + "evidence_fingerprints": [ + "e64d8c7babf291c29f516e1d6576b1542b4f13679b5225f0750718bfda15471d" + ], + "evidence_kind": "measured", + "inventory_id": "rejected:GraphRetrieve.seed_cache_family_compare.precomputed-features", + "proof_level": "source-health", + "source_section": { + "heading": "Experiment and algorithm traceability inventory", + "path": "docs/paper/sections/11_optimization.qmd" + }, + "unresolved_limits": [ + "candidate was removed after its failed gate" + ] + }, + { + "corpus_parameter_scope": "focused fresh/copied-late candidate window under the recorded 15,695-packet Natural profile contract", + "decision": "rejected", + "evidence_fingerprints": [ + "b6a379c294f4a0d05a9b35491e38d9b668b192bba899dc3bd9a71281c0686fef" + ], + "evidence_kind": "measured", + "inventory_id": "rejected:GraphRetrieve.seed_cache_family_compare.projection-bound", + "proof_level": "source-health", + "source_section": { + "heading": "Experiment and algorithm traceability inventory", + "path": "docs/paper/sections/11_optimization.qmd" + }, + "unresolved_limits": [ + "candidate was removed after its failed gate" + ] + }, + { + "corpus_parameter_scope": "focused fresh/copied-late candidate window under the recorded 15,695-packet Natural profile contract", + "decision": "rejected", + "evidence_fingerprints": [ + "4e7f10f89b8b41af9c92b540711855d97659c785483fef309cf694fb43f0f359" + ], + "evidence_kind": "measured", + "inventory_id": "rejected:MemoryStorage.supersession_metric_index", + "proof_level": "source-health", + "source_section": { + "heading": "Experiment and algorithm traceability inventory", + "path": "docs/paper/sections/11_optimization.qmd" + }, + "unresolved_limits": [ + "candidate was removed after its failed gate" + ] + }, + { + "corpus_parameter_scope": "focused fresh/copied-late candidate window under the recorded 15,695-packet Natural profile contract", + "decision": "rejected", + "evidence_fingerprints": [ + "12b0d68b0d013529b4c9eb1fda6c42a867741aed5cdcb4f469a9076b381b9fdd" + ], + "evidence_kind": "measured", + "inventory_id": "rejected:RifActiveEpoch.row-batch-only-performance-cure", + "proof_level": "source-health", + "source_section": { + "heading": "Experiment and algorithm traceability inventory", + "path": "docs/paper/sections/11_optimization.qmd" + }, + "unresolved_limits": [ + "candidate was removed after its failed gate" + ] + }, + { + "corpus_parameter_scope": "focused fresh/copied-late candidate window under the recorded 15,695-packet Natural profile contract", + "decision": "rejected", + "evidence_fingerprints": [ + "4d4a50e2718a00072f815ffab657fa8975b3d314cc65d7218f1ce4aab74fd973" + ], + "evidence_kind": "measured", + "inventory_id": "rejected:shared-shadow-sqlite-operation-view", + "proof_level": "source-health", + "source_section": { + "heading": "Experiment and algorithm traceability inventory", + "path": "docs/paper/sections/11_optimization.qmd" + }, + "unresolved_limits": [ + "candidate was removed after its failed gate" + ] + }, + { + "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", + "decision": "failed-end-anchored-plateau-reranked-to-next-independent-exact-candidate", + "evidence_fingerprints": [ + "9b091c86c6ecfc37241a26465f06c427ecbbf9866036d90285072fae31c1e54f" + ], + "evidence_kind": "measured", + "inventory_id": "state:accepted_tree_natural_plateau_rerank", + "proof_level": "source-health", + "source_section": { + "heading": "Experiment and algorithm traceability inventory", + "path": "docs/paper/sections/11_optimization.qmd" + }, + "unresolved_limits": [ + "the paper claim is limited to the recorded proof scope" + ] + }, + { + "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", + "decision": "recorded-measurement", + "evidence_fingerprints": [ + "a090d13389c441447b71c4633f705e85e8f07e834b76d5b6887a6a644402acb7" + ], + "evidence_kind": "measured", + "inventory_id": "state:active_epoch_sqlite_evaluation", + "proof_level": "source-health", + "source_section": { + "heading": "Experiment and algorithm traceability inventory", + "path": "docs/paper/sections/11_optimization.qmd" + }, + "unresolved_limits": [ + "production cutover is not proven" + ] + }, + { + "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", + "decision": "reject-anchor-only-candidate-set-retain-anchors-only-as-bounded-sparse-graph-restart-entry", + "evidence_fingerprints": [ + "5db8b893b7b26688ccb67e820f1a40485b8420c7f3d9b91d69d27448579794a7" + ], + "evidence_kind": "measured", + "inventory_id": "state:anchor_only_route_feasibility", + "proof_level": "source-health", + "source_section": { + "heading": "Experiment and algorithm traceability inventory", + "path": "docs/paper/sections/11_optimization.qmd" + }, + "unresolved_limits": [ + "production cutover is not proven" + ] + }, + { + "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", + "decision": "recorded-measurement", + "evidence_fingerprints": [ + "c4f44d388da1b64b70384618ef5d09b4b3d256613e825abe394f3f249d2b6c4c" + ], + "evidence_kind": "measured", + "inventory_id": "state:baseline_results", + "proof_level": "source-health", + "source_section": { + "heading": "Experiment and algorithm traceability inventory", + "path": "docs/paper/sections/11_optimization.qmd" + }, + "unresolved_limits": [ + "the paper claim is limited to the recorded proof scope" + ] + }, + { + "corpus_parameter_scope": "34,456 normalized 256-dimensional embeddings; 512 deterministic top-16 queries; four opaque sources; text, audio, and image post-encoding labels; two graphs; 16,384 construction and 1,280 retrieval comparisons per graph; 64 reciprocal proposals", + "decision": "design-direction-approved-production-proof-pending", + "evidence_fingerprints": [ + "d80d794e27b6979b354692bd7a530e4eff6baf61d9023e85ac37ff8940c0364c" + ], + "evidence_kind": "modeled", + "inventory_id": "state:bounded_route_hybrid_observation", + "proof_level": "benchmark-only", + "source_section": { + "heading": "Experiment and algorithm traceability inventory", + "path": "docs/paper/sections/11_optimization.qmd" + }, + "unresolved_limits": [ + "production cutover is not proven" + ] + }, + { + "corpus_parameter_scope": "35,496 normalized 256-dimensional embeddings; 512 age-stratified top-16 queries; F=S=T=0.5; observation-only private switch", + "decision": "complete-promising-shadow-candidate-not-ready-for-cutover", + "evidence_fingerprints": [ + "fa4230d33022df68ed23c43b290a489d0c55bb086b0ce08c1955da7c33eca152" + ], + "evidence_kind": "observation-only", + "inventory_id": "state:bounded_sparse_routing_observation", + "proof_level": "benchmark-only", + "source_section": { + "heading": "Experiment and algorithm traceability inventory", + "path": "docs/paper/sections/11_optimization.qmd" + }, + "unresolved_limits": [ + "production cutover is not proven" + ] + }, + { + "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", + "decision": "rejected-fresh-process-and-rif-regression", + "evidence_fingerprints": [ + "6caf42f13c23367491ddf85f40eb5db175a58bf55000b9291a3e64ee93edb637" + ], + "evidence_kind": "measured", + "inventory_id": "state:competition_rif_returning_candidate", + "proof_level": "source-health", + "source_section": { + "heading": "Experiment and algorithm traceability inventory", + "path": "docs/paper/sections/11_optimization.qmd" + }, + "unresolved_limits": [ + "the paper claim is limited to the recorded proof scope" + ] + }, + { + "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", + "decision": "rejected-fresh-process-wall-and-rif-hard-gate", + "evidence_fingerprints": [ + "12723ea9a4a77d7b4ba45313b2be47b48be68bf9b659282eb0ce3a8817b3bb2e" + ], + "evidence_kind": "measured", + "inventory_id": "state:competition_suppression_state_cache_candidate", + "proof_level": "source-health", + "source_section": { + "heading": "Experiment and algorithm traceability inventory", + "path": "docs/paper/sections/11_optimization.qmd" + }, + "unresolved_limits": [ + "the paper claim is limited to the recorded proof scope" + ] + }, + { + "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", + "decision": "retained-hotspot-improved-plateau-still-failed-reranked", + "evidence_fingerprints": [ + "bfcebb61906d51cf52925e1a008bed02859685b1093a9eaa62fc49d3a46a3ef5" + ], + "evidence_kind": "measured", + "inventory_id": "state:emotional_cascade_fixed_point_full_natural", + "proof_level": "source-health", + "source_section": { + "heading": "Experiment and algorithm traceability inventory", + "path": "docs/paper/sections/11_optimization.qmd" + }, + "unresolved_limits": [ + "the paper claim is limited to the recorded proof scope" + ] + }, + { + "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", + "decision": "retained-local-gates-passed-full-natural-verification-next", + "evidence_fingerprints": [ + "cfc22af065c3660f609c10dfb10a31a7a4d93e6ef0d43381d845500db53bfa5e" + ], + "evidence_kind": "measured", + "inventory_id": "state:emotional_cascade_fixed_point_repair", + "proof_level": "source-health", + "source_section": { + "heading": "Experiment and algorithm traceability inventory", + "path": "docs/paper/sections/11_optimization.qmd" + }, + "unresolved_limits": [ + "the paper claim is limited to the recorded proof scope" + ] + }, + { + "corpus_parameter_scope": "rejected knob-derived priority-prefix candidate; 27 F/S/T structural points; exact B and logical B+1 shared-member seams; 15,695-packet fixed-time Natural midpoint against a same-binary control and identical 118-event consolidation schedule; 512 public top-16 queries over four opaque sources; nine-point production matrix intentionally not run after midpoint fail-fast", + "decision": "reject-before-nine-point-ablation-for-p99-and-public-retrieval-quality", + "evidence_fingerprints": [ + "b8e4c4dc7243a094fad16ec82418ff7d3ab0fe022b3b2ed4901747c00225f3ab" + ], + "evidence_kind": "measured", + "inventory_id": "state:emotional_cascade_fixed_work_candidate", + "proof_level": "benchmark-only", + "source_section": { + "heading": "Experiment and algorithm traceability inventory", + "path": "docs/paper/sections/11_optimization.qmd" + }, + "unresolved_limits": [ + "midpoint p99 and public identity-quality gates failed", + "nine-point knob ablation was not run after the fail-fast rejection", + "Durable full-horizon behavior is not proven for this rejected candidate", + "production cutover is not proven" + ] + }, + { + "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", + "decision": "retained-full-natural-improvement-flatness-failed-reranked", + "evidence_fingerprints": [ + "c437d2be35f93e92524f0108695cc90d09ed11c6ef422bb12a60cdfa75e4ffae" + ], + "evidence_kind": "measured", + "inventory_id": "state:emotional_metadata_cache_repair", + "proof_level": "source-health", + "source_section": { + "heading": "Experiment and algorithm traceability inventory", + "path": "docs/paper/sections/11_optimization.qmd" + }, + "unresolved_limits": [ + "the paper claim is limited to the recorded proof scope" + ] + }, + { + "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", + "decision": "reject-all-five-single-hierarchy-bounded-link-repairs", + "evidence_fingerprints": [ + "ecaa356bb3c43b5af6db667804652f864113fdfe9f9432768923ad6fccd8c726" + ], + "evidence_kind": "measured", + "inventory_id": "state:fixed5c_moved_centroid_reachability", + "proof_level": "source-health", + "source_section": { + "heading": "Experiment and algorithm traceability inventory", + "path": "docs/paper/sections/11_optimization.qmd" + }, + "unresolved_limits": [ + "production cutover is not proven" + ] + }, + { + "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", + "decision": "recorded-measurement", + "evidence_fingerprints": [ + "e180d8cf1c390e364d00164d795b1dd4151a8fd18e70e9ab1e463cacdaebad8b" + ], + "evidence_kind": "measured", + "inventory_id": "state:graph_eligibility_db_proof", + "proof_level": "source-health", + "source_section": { + "heading": "Experiment and algorithm traceability inventory", + "path": "docs/paper/sections/11_optimization.qmd" + }, + "unresolved_limits": [ + "the paper claim is limited to the recorded proof scope" + ] + }, + { + "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", + "decision": "retained-local-improvement-full-natural-flatness-gate-failed", + "evidence_fingerprints": [ + "65305ad83c3ff1cc3ef273f8ee48c80eef178d405ad96520df57a98f62d4526c" + ], + "evidence_kind": "measured", + "inventory_id": "state:graph_eligibility_repair", + "proof_level": "source-health", + "source_section": { + "heading": "Experiment and algorithm traceability inventory", + "path": "docs/paper/sections/11_optimization.qmd" + }, + "unresolved_limits": [ + "the paper claim is limited to the recorded proof scope" + ] + }, + { + "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", + "decision": "rejected-fresh-and-late-total-process-wall-regression", + "evidence_fingerprints": [ + "79861dbdce7c0ced9e148ceddaa784c7c329dc044c4d3b5b02847de4294d2b59" + ], + "evidence_kind": "measured", + "inventory_id": "state:graph_family_precomputed_features_candidate", + "proof_level": "source-health", + "source_section": { + "heading": "Experiment and algorithm traceability inventory", + "path": "docs/paper/sections/11_optimization.qmd" + }, + "unresolved_limits": [ + "the paper claim is limited to the recorded proof scope" + ] + }, + { + "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", + "decision": "rejected-late-process-graph-and-comparison-regression", + "evidence_fingerprints": [ + "e8f2e5e6c8dd1e8de539404e7b531b186e79a4878eebb54692472b23a1594b56" + ], + "evidence_kind": "measured", + "inventory_id": "state:graph_family_projection_bound_candidate", + "proof_level": "source-health", + "source_section": { + "heading": "Experiment and algorithm traceability inventory", + "path": "docs/paper/sections/11_optimization.qmd" + }, + "unresolved_limits": [ + "the paper claim is limited to the recorded proof scope" + ] + }, + { + "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", + "decision": "rejected-fresh-process-and-graph-regression", + "evidence_fingerprints": [ + "683631b85f811294446d98f2e66ec93151c593897d7707f4bff10fa7431a97a0" + ], + "evidence_kind": "measured", + "inventory_id": "state:graph_family_vector_bound_candidate", + "proof_level": "source-health", + "source_section": { + "heading": "Experiment and algorithm traceability inventory", + "path": "docs/paper/sections/11_optimization.qmd" + }, + "unresolved_limits": [ + "the paper claim is limited to the recorded proof scope" + ] + }, + { + "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", + "decision": "retained-local-improvement-full-natural-flatness-gate-failed", + "evidence_fingerprints": [ + "54f9c5e9235181e534d48fc68a3828f691ba62015c722bdde8db5f6852750d7f" + ], + "evidence_kind": "measured", + "inventory_id": "state:graph_partial_distance_evaluation", + "proof_level": "source-health", + "source_section": { + "heading": "Experiment and algorithm traceability inventory", + "path": "docs/paper/sections/11_optimization.qmd" + }, + "unresolved_limits": [ + "the paper claim is limited to the recorded proof scope" + ] + }, + { + "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", + "decision": "retained-local-gates-passed-family-compare-next", + "evidence_fingerprints": [ + "0c28a16305eaf9a2af815274e767863ee883f097e85d9635f17135b704452582" + ], + "evidence_kind": "measured", + "inventory_id": "state:graph_supersession_eligibility_repair", + "proof_level": "source-health", + "source_section": { + "heading": "Experiment and algorithm traceability inventory", + "path": "docs/paper/sections/11_optimization.qmd" + }, + "unresolved_limits": [ + "the paper claim is limited to the recorded proof scope" + ] + }, + { + "corpus_parameter_scope": "rejected private fixed-6C envelope; 27 structural F/S/T points and 931 assertions; one additional 15,695-packet Natural production-default pre-screen at F=0.45, S=T=0.5 with 512 public top-16 queries; exact nine-point corpus matrix not started after fail-fast rejection", + "decision": "rejected-after-production-default-prescreen-hard-gates", + "evidence_fingerprints": [ + "4bcece2ce0d609b506e13ce283c069bcb4d5881e67ddb11b8a18a6ef59a69049" + ], + "evidence_kind": "measured", + "inventory_id": "state:hnsw_fixed_6c_experiment", + "proof_level": "benchmark-only", + "source_section": { + "heading": "Experiment and algorithm traceability inventory", + "path": "docs/paper/sections/11_optimization.qmd" + }, + "unresolved_limits": [ + "the additional production-default pre-screen failed the hard gates", + "zero of nine exact corpus-matrix points were run after fail-fast rejection", + "the production fixed-5C default was not changed", + "whole-engine boundedness and production cutover are not proven", + "production cutover is not proven" + ] + }, + { + "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", + "decision": "retain-incremental-consolidation-seal-within-current-latency-tradeoff-do-not-cut-over-before-bounded-restart-and-full-horizon-close", + "evidence_fingerprints": [ + "f18054ed033325c0aea69e2bc189ebaf7c9f783c05dddb77cd2058d8fe282976" + ], + "evidence_kind": "measured", + "inventory_id": "state:integrated_hnsw_consolidation_seal_experiment", + "proof_level": "source-health", + "source_section": { + "heading": "Experiment and algorithm traceability inventory", + "path": "docs/paper/sections/11_optimization.qmd" + }, + "unresolved_limits": [ + "production cutover is not proven" + ] + }, + { + "corpus_parameter_scope": "2,500 deterministic Natural packets; four opaque source ids; text, audio, and image post-encoding labels; 128 public top-16 queries; two HNSW graphs; 512-candidate sealed-plus-delta route", + "decision": "retain-sealed-two-hnsw-plus-exact-delta-reseal-at-512-reject-live-update-and-every-consolidation-rebuild", + "evidence_fingerprints": [ + "eceaf32b550a4d511981379db3f7656bab55b44cd4400b2f7b3feded9be10aea" + ], + "evidence_kind": "measured", + "inventory_id": "state:integrated_hnsw_sparse_route_experiment", + "proof_level": "source-health", + "source_section": { + "heading": "Experiment and algorithm traceability inventory", + "path": "docs/paper/sections/11_optimization.qmd" + }, + "unresolved_limits": [ + "production cutover is not proven" + ] + }, + { + "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", + "decision": "retain-live-two-graph-route-for-cross-modality-restart-cycle-latency-and-engine-integration-proof", + "evidence_fingerprints": [ + "197c570cb0209b0b7d63935e1a4a6ebea2f2ca65003a6581a6f079acf82b6d7c" + ], + "evidence_kind": "measured", + "inventory_id": "state:live_surface_mutation_capture_experiment", + "proof_level": "source-health", + "source_section": { + "heading": "Experiment and algorithm traceability inventory", + "path": "docs/paper/sections/11_optimization.qmd" + }, + "unresolved_limits": [ + "production cutover is not proven" + ] + }, + { + "corpus_parameter_scope": "34,456 normalized 256-dimensional embeddings; four SQLite blobs; 1,024 anchors; 512 deterministic top-16 route queries; separate 1,024-embedding fresh-prefix restart", + "decision": "retain-row-addressed-query-seam-reject-whole-snapshot-rewrite", + "evidence_fingerprints": [ + "828851ddb716b6d27a28089951550dbf2d0e51e9d7061fc5f6c62fcc620509f3" + ], + "evidence_kind": "benchmark-only", + "inventory_id": "state:packed_route_sqlite_representation_experiment", + "proof_level": "benchmark-only", + "source_section": { + "heading": "Experiment and algorithm traceability inventory", + "path": "docs/paper/sections/11_optimization.qmd" + }, + "unresolved_limits": [ + "production cutover is not proven" + ] + }, + { + "corpus_parameter_scope": "100- and 200-event Natural and Durable instrumentation smoke profiles", + "decision": "complete", + "evidence_fingerprints": [ + "b0f4f9f49236829c7d8dc831675cabe82e04428afccfef8f72983818211c39f6" + ], + "evidence_kind": "measured", + "inventory_id": "state:plateau_profiler_smoke_proof", + "proof_level": "source-health", + "source_section": { + "heading": "Experiment and algorithm traceability inventory", + "path": "docs/paper/sections/11_optimization.qmd" + }, + "unresolved_limits": [ + "the paper claim is limited to the recorded proof scope" + ] + }, + { + "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", + "decision": "select-SignalProcessor.publish_rif_active_epoch", + "evidence_fingerprints": [ + "35e402a8536dbbea2e5e94991807623901fba097b9cea233da5ea78c319f4f80" + ], + "evidence_kind": "measured", + "inventory_id": "state:post_emotional_priority_rejection_rerank", + "proof_level": "source-health", + "source_section": { + "heading": "Experiment and algorithm traceability inventory", + "path": "docs/paper/sections/11_optimization.qmd" + }, + "unresolved_limits": [ + "production cutover is not proven" + ] + }, + { + "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", + "decision": "select-shared-sqlite-activation-query-distance-materialization", + "evidence_fingerprints": [ + "6af1c9dfe8a1550fcaff4e574fec14d0ac74b23a2929206b71c9eb5581309ff6" + ], + "evidence_kind": "measured", + "inventory_id": "state:post_hnsw_cost_attribution", + "proof_level": "source-health", + "source_section": { + "heading": "Experiment and algorithm traceability inventory", + "path": "docs/paper/sections/11_optimization.qmd" + }, + "unresolved_limits": [ + "production cutover is not proven" + ] + }, + { + "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", + "decision": "retain-query-local-persisted-distance-reuse", + "evidence_fingerprints": [ + "9ef6ad6179fc870657b2bd043ff2000743263255ed90e1320e0152e2f625c61f" + ], + "evidence_kind": "measured", + "inventory_id": "state:post_hnsw_query_distance_reuse", + "proof_level": "source-health", + "source_section": { + "heading": "Experiment and algorithm traceability inventory", + "path": "docs/paper/sections/11_optimization.qmd" + }, + "unresolved_limits": [ + "production cutover is not proven" + ] + }, + { + "corpus_parameter_scope": "paired fresh and copied-late 200-event Natural and Durable windows", + "decision": "recorded-measurement", + "evidence_fingerprints": [ + "331c3e8a352a974bd3c5247cb28ca2ab2b17681c79e5fc4e8dc8537f0004e73c" + ], + "evidence_kind": "measured", + "inventory_id": "state:post_shadow_rerank", + "proof_level": "source-health", + "source_section": { + "heading": "Experiment and algorithm traceability inventory", + "path": "docs/paper/sections/11_optimization.qmd" + }, + "unresolved_limits": [ + "the paper claim is limited to the recorded proof scope" + ] + }, + { + "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", + "decision": "retain-feasibility-only-require-live-surface-mutation-capture-before-candidate-decision", + "evidence_fingerprints": [ + "47fa93e666957958f4cec485b4a6afb8fd92f0a1ea28c936dfea9e1f3592f588" + ], + "evidence_kind": "measured", + "inventory_id": "state:public_hnsw_route_prototype_experiment", + "proof_level": "source-health", + "source_section": { + "heading": "Experiment and algorithm traceability inventory", + "path": "docs/paper/sections/11_optimization.qmd" + }, + "unresolved_limits": [ + "production cutover is not proven" + ] + }, + { + "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", + "decision": "retain-real-GraphRetrieve-control-capture-live-surface-candidate-proof-recorded-separately", + "evidence_fingerprints": [ + "79e04b1b383acef5611d76d6128a17f0ed8283ca7317f1728b7309bba431d027" + ], + "evidence_kind": "measured", + "inventory_id": "state:public_retrieval_control_capture_experiment", + "proof_level": "source-health", + "source_section": { + "heading": "Experiment and algorithm traceability inventory", + "path": "docs/paper/sections/11_optimization.qmd" + }, + "unresolved_limits": [ + "production cutover is not proven" + ] + }, + { + "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", + "decision": "reject-current-recenter-as-retrieval-centroid-reset", + "evidence_fingerprints": [ + "29a6a51e91f6e663f59cbacf675465b4c01b0376a0df49657b5f012fa2adcb65" + ], + "evidence_kind": "measured", + "inventory_id": "state:recenter_activation_overlap_natural_13000_v2", + "proof_level": "source-health", + "source_section": { + "heading": "Experiment and algorithm traceability inventory", + "path": "docs/paper/sections/11_optimization.qmd" + }, + "unresolved_limits": [ + "the paper claim is limited to the recorded proof scope" + ] + }, + { + "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", + "decision": "recorded-measurement", + "evidence_fingerprints": [ + "f6e20cca3c59ff1f1144496e5e3ca747df4bd31fe0026301845f6a043cad8487" + ], + "evidence_kind": "measured", + "inventory_id": "state:repair_results", + "proof_level": "source-health", + "source_section": { + "heading": "Experiment and algorithm traceability inventory", + "path": "docs/paper/sections/11_optimization.qmd" + }, + "unresolved_limits": [ + "the paper claim is limited to the recorded proof scope" + ] + }, + { + "corpus_parameter_scope": "correction from 34,456 complete embedding ids to 3,172 current long-term memory identities; 512 top-16 queries; ten 128-memory-node incremental feasibility epochs; 25/50/100-percent restart probes", + "decision": "retain-router-feasibility-require-exact-public-control-rerun", + "evidence_fingerprints": [ + "e5c2c164b8e3a329ec89d05169cf550233e57d48ad7ab858ed596f8a94d31ea8" + ], + "evidence_kind": "measured", + "inventory_id": "state:retrieval_quality_control_correction", + "proof_level": "benchmark-only", + "source_section": { + "heading": "Experiment and algorithm traceability inventory", + "path": "docs/paper/sections/11_optimization.qmd" + }, + "unresolved_limits": [ + "production cutover is not proven" + ] + }, + { + "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", + "decision": "retain-for-source-health-and-continue-full-horizon-verification", + "evidence_fingerprints": [ + "ba8d896958f51050d2ca578c4aa354af9370bb33f4746b2f705e6fb086baa6e1" + ], + "evidence_kind": "measured", + "inventory_id": "state:rif_active_identity_ledger", + "proof_level": "source-health", + "source_section": { + "heading": "Experiment and algorithm traceability inventory", + "path": "docs/paper/sections/11_optimization.qmd" + }, + "unresolved_limits": [ + "production cutover is not proven" + ] + }, + { + "corpus_parameter_scope": "15,695-packet Natural replay at F=0.45, S=T=0.5; 27 structural F/S/T points; nine production-shaped reset points; B=round(64+64F+32S+32T), with neutral B=128 and 129 used only as the logical B+1 population boundary; text/audio/image labels and two opaque source ids", + "decision": "local-hotspot-flat-full-natural-overall-gates-failed", + "evidence_fingerprints": [ + "6d2ab8e49b315093b8ce0023dae6e07b8b159ed707a89c1e9b40ff30c339d26b" + ], + "evidence_kind": "measured", + "inventory_id": "state:rif_epoch_consolidation_reset_candidate", + "proof_level": "source-health", + "source_section": { + "heading": "Experiment and algorithm traceability inventory", + "path": "docs/paper/sections/11_optimization.qmd" + }, + "unresolved_limits": [ + "the named RIF publication hotspot is flat but the whole-engine Natural plateau failed", + "mandatory Natural retrieval quality failed", + "Durable verification and bounded restart remain open", + "production cutover is not proven" + ] + }, + { + "corpus_parameter_scope": "200-event fresh and 34,256-row copied-late SQLite seals; 3,544 reciprocal route-row updates; 1,024 anchors; 512 fixed-route queries", + "decision": "retain-row-addressed-snapshot-for-production-shaped-engine-evaluation", + "evidence_fingerprints": [ + "49561d775e1c06ba04fcf28c2f237d14c2a2d38c21beb3d446247bc9b7f015d5" + ], + "evidence_kind": "benchmark-only", + "inventory_id": "state:row_addressed_route_sqlite_experiment", + "proof_level": "benchmark-only", + "source_section": { + "heading": "Experiment and algorithm traceability inventory", + "path": "docs/paper/sections/11_optimization.qmd" + }, + "unresolved_limits": [ + "production cutover is not proven" + ] + }, + { + "corpus_parameter_scope": "paired fresh and copied-late 200-event Natural and Durable windows", + "decision": "rejected-numeric-acceptance-gates-failed", + "evidence_fingerprints": [ + "8bf7c3b51be906c312d8a00913970547e4f4c9deb33068cd1edfd5598e263f51" + ], + "evidence_kind": "measured", + "inventory_id": "state:shadow_sqlite_scoped_evaluation", + "proof_level": "source-health", + "source_section": { + "heading": "Experiment and algorithm traceability inventory", + "path": "docs/paper/sections/11_optimization.qmd" + }, + "unresolved_limits": [ + "production cutover is not proven" + ] + }, + { + "corpus_parameter_scope": "paired fresh and copied-late 200-event Natural and Durable windows", + "decision": "recorded-measurement", + "evidence_fingerprints": [ + "c4a5811f138462e381bbad56bb4b577307ef0b84797dfbcbbdcaf237813f25bd" + ], + "evidence_kind": "measured", + "inventory_id": "state:shadow_sqlite_seam_proof", + "proof_level": "source-health", + "source_section": { + "heading": "Experiment and algorithm traceability inventory", + "path": "docs/paper/sections/11_optimization.qmd" + }, + "unresolved_limits": [ + "the paper claim is limited to the recorded proof scope" + ] + }, + { + "corpus_parameter_scope": "migration 30; 15,695-packet Natural and 2,016-message Durable replays at F=0.45, S=T=0.5; 27 structural F/S/T points; nine 2,000-packet same-knob runs with 512 public queries and four opaque source ids per run; separate text/audio/image label proof", + "decision": "retain-local-write-surface-repair-whole-goal-continues", + "evidence_fingerprints": [ + "19cc8ea4ce28c90b828697bef4a03e70af519be85a95f6d6f75f33b0ac972986" + ], + "evidence_kind": "measured", + "inventory_id": "state:signal_centroid_ring_cutover", + "proof_level": "source-health", + "source_section": { + "heading": "Experiment and algorithm traceability inventory", + "path": "docs/paper/sections/11_optimization.qmd" + }, + "unresolved_limits": [ + "whole-engine Natural and Durable plateaus are not proven", + "emotional traversal and whole-engine restart remain unbounded", + "production cutover is not proven" + ] + }, + { + "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", + "decision": "retained-production-default", + "evidence_fingerprints": [ + "c0333a61318ec06b2739c3d1535698a91e9bb71322d49f34946d5c6250f75a00" + ], + "evidence_kind": "measured", + "inventory_id": "state:sqlite_hnsw_knob_ablation", + "proof_level": "source-health", + "source_section": { + "heading": "Experiment and algorithm traceability inventory", + "path": "docs/paper/sections/11_optimization.qmd" + }, + "unresolved_limits": [ + "the paper claim is limited to the recorded proof scope" + ] + }, + { + "corpus_parameter_scope": "production-default 8C-to-9C SQLite HNSW route; 15,695-packet Natural replay, 2,016-message Durable replay, 30,380-packet maturity extension, 27 structural F/S/T points, and nine 4,000-packet quality points with 512 controls each", + "decision": "retained-production-default", + "evidence_fingerprints": [ + "0f9f67d4aa7eea6a7ae9a1b64e0ce89aee29a15ea8f5c2c229e00e371ec7b53f" + ], + "evidence_kind": "measured", + "inventory_id": "state:sqlite_hnsw_production_cutover", + "proof_level": "production-path", + "source_section": { + "heading": "Experiment and algorithm traceability inventory", + "path": "docs/paper/sections/11_optimization.qmd" + }, + "unresolved_limits": [ + "the paper claim is limited to the recorded proof scope" + ] + }, + { + "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", + "decision": "retain-real-hnsw-adjacency-walk-reject-anchor-neighborhood-approximation", + "evidence_fingerprints": [ + "9a7b782479af069c49b9b6a805693468651653afe0ec3006e9c2f2d7a02160f6" + ], + "evidence_kind": "measured", + "inventory_id": "state:sqlite_hnsw_sparse_route_integration", + "proof_level": "source-health", + "source_section": { + "heading": "Experiment and algorithm traceability inventory", + "path": "docs/paper/sections/11_optimization.qmd" + }, + "unresolved_limits": [ + "production cutover is not proven" + ] + }, + { + "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", + "decision": "rejected-fresh-process-and-wall-hard-gate", + "evidence_fingerprints": [ + "bdefb3bf6651ce390f3b536ae336fd436db4c37e47f7931c70392942369cf3fc" + ], + "evidence_kind": "measured", + "inventory_id": "state:supersession_metric_index_candidate", + "proof_level": "source-health", + "source_section": { + "heading": "Experiment and algorithm traceability inventory", + "path": "docs/paper/sections/11_optimization.qmd" + }, + "unresolved_limits": [ + "the paper claim is limited to the recorded proof scope" + ] + }, + { + "corpus_parameter_scope": "100- and 200-event Natural and Durable instrumentation smoke profiles", + "decision": "use explicit result activity markers instead of inclusive operation duration for vacuous-zero detection", + "evidence_fingerprints": [ + "93bf3719b58b031954d3e1e8d8bb58b422f1d988f0a43083406cd529b98dfd10" + ], + "evidence_kind": "measured", + "inventory_id": "state:work_counter_activity_repair", + "proof_level": "source-health", + "source_section": { + "heading": "Experiment and algorithm traceability inventory", + "path": "docs/paper/sections/11_optimization.qmd" + }, + "unresolved_limits": [ + "the paper claim is limited to the recorded proof scope" + ] + }, + { + "corpus_parameter_scope": "34,456 normalized 256-dimensional embeddings and 512 deterministic top-16 queries", + "decision": "rejected-recall-at-16-0.979858", + "evidence_fingerprints": [ + "d80d794e27b6979b354692bd7a530e4eff6baf61d9023e85ac37ff8940c0364c", + "d30bfc49a82969a56834a87efddd827f5c4eda4987b0dc4084415dde84facf81" + ], + "evidence_kind": "modeled", + "inventory_id": "bounded-route-variant:reciprocal-route-only", + "proof_level": "benchmark-only", + "source_section": { + "heading": "Experiment and algorithm traceability inventory", + "path": "docs/paper/sections/11_optimization.qmd" + }, + "unresolved_limits": [ + "benchmark routing evidence is not production-path latency proof" + ] + }, + { + "corpus_parameter_scope": "34,456 normalized 256-dimensional embeddings and 512 deterministic top-16 queries", + "decision": "rejected-no-recall-gain-at-equal-per-graph-work", + "evidence_fingerprints": [ + "d80d794e27b6979b354692bd7a530e4eff6baf61d9023e85ac37ff8940c0364c", + "31008972639ea1a20a7bdc7ec76d8284a5a943db5b18a702fc5261f9c136f10e" + ], + "evidence_kind": "modeled", + "inventory_id": "bounded-route-variant:three-sparse-graphs", + "proof_level": "benchmark-only", + "source_section": { + "heading": "Experiment and algorithm traceability inventory", + "path": "docs/paper/sections/11_optimization.qmd" + }, + "unresolved_limits": [ + "benchmark routing evidence is not production-path latency proof" + ] + }, + { + "corpus_parameter_scope": "34,456 normalized 256-dimensional embeddings and 512 deterministic top-16 queries", + "decision": "rejected-recall-at-16-0.995972", + "evidence_fingerprints": [ + "d80d794e27b6979b354692bd7a530e4eff6baf61d9023e85ac37ff8940c0364c", + "68ff8dacf45e677f4c8781c1a6a1fe6ccb16af107a424016f72c32954e7694f2" + ], + "evidence_kind": "modeled", + "inventory_id": "bounded-route-variant:construction-budget-4096", + "proof_level": "benchmark-only", + "source_section": { + "heading": "Experiment and algorithm traceability inventory", + "path": "docs/paper/sections/11_optimization.qmd" + }, + "unresolved_limits": [ + "benchmark routing evidence is not production-path latency proof" + ] + }, + { + "corpus_parameter_scope": "34,456 normalized 256-dimensional embeddings and 512 deterministic top-16 queries", + "decision": "rejected-recall-at-16-0.997803", + "evidence_fingerprints": [ + "d80d794e27b6979b354692bd7a530e4eff6baf61d9023e85ac37ff8940c0364c", + "49a8e8870573f66e98eb48ba0aafa1a1a6f1a5827ee6ada2ac7e6ae1dee45b1b" + ], + "evidence_kind": "modeled", + "inventory_id": "bounded-route-variant:construction-budget-8192-reciprocal-64", + "proof_level": "benchmark-only", + "source_section": { + "heading": "Experiment and algorithm traceability inventory", + "path": "docs/paper/sections/11_optimization.qmd" + }, + "unresolved_limits": [ + "benchmark routing evidence is not production-path latency proof" + ] + }, + { + "corpus_parameter_scope": "34,456 normalized 256-dimensional embeddings and 512 deterministic top-16 queries", + "decision": "selected-benchmark-design-production-proof-pending", + "evidence_fingerprints": [ + "d80d794e27b6979b354692bd7a530e4eff6baf61d9023e85ac37ff8940c0364c", + "c6d0a84a168058264ebdfdc489c94852c9d1918be430a8b661d2947d03ceb0a0" + ], + "evidence_kind": "modeled", + "inventory_id": "bounded-route-variant:two-graphs-construction-16384-retrieval-1280-reciprocal-64", + "proof_level": "benchmark-only", + "source_section": { + "heading": "Experiment and algorithm traceability inventory", + "path": "docs/paper/sections/11_optimization.qmd" + }, + "unresolved_limits": [ + "benchmark routing evidence is not production-path latency proof" + ] + }, + { + "corpus_parameter_scope": "branch diff from the content-addressed base; experiment scope is recorded by the associated state and candidate entries", + "decision": "task-owned-source-change-recorded", + "evidence_fingerprints": [ + "28fe044a1fdf75d8dae19c596aec7dad6b77a3d65475c98cc2d218d79aaed431" + ], + "evidence_kind": "measured", + "inventory_id": "algorithm:consolidation-envelope-and-detector", + "proof_level": "source-health", + "source_section": { + "heading": "Experiment and algorithm traceability inventory", + "path": "docs/paper/sections/11_optimization.qmd" + }, + "unresolved_limits": [ + "production-wide boundedness is not inferred from source health" + ] + }, + { + "corpus_parameter_scope": "branch diff from the content-addressed base; experiment scope is recorded by the associated state and candidate entries", + "decision": "task-owned-source-change-recorded", + "evidence_fingerprints": [ + "1462aaf9cd47f738806bd9414848492f8a589235aef341bf8f46de1acd5dc45e" + ], + "evidence_kind": "measured", + "inventory_id": "algorithm:shared-retention-and-rollback", + "proof_level": "source-health", + "source_section": { + "heading": "Experiment and algorithm traceability inventory", + "path": "docs/paper/sections/11_optimization.qmd" + }, + "unresolved_limits": [ + "production-wide boundedness is not inferred from source health" + ] + }, + { + "corpus_parameter_scope": "branch diff from the content-addressed base; experiment scope is recorded by the associated state and candidate entries", + "decision": "task-owned-source-change-recorded", + "evidence_fingerprints": [ + "b087da4df6416d4cff2a3e26c8d45b6a329d103761355cb0d9a5048725c5b125" + ], + "evidence_kind": "measured", + "inventory_id": "algorithm:lazy-rif-active-epoch", + "proof_level": "source-health", + "source_section": { + "heading": "Experiment and algorithm traceability inventory", + "path": "docs/paper/sections/11_optimization.qmd" + }, + "unresolved_limits": [ + "production-wide boundedness is not inferred from source health" + ] + }, + { + "corpus_parameter_scope": "branch diff from the content-addressed base; experiment scope is recorded by the associated state and candidate entries", + "decision": "task-owned-source-change-recorded", + "evidence_fingerprints": [ + "2985ed022f9435c7ab8229b081a212252a2f67e11bed5dbceb86e8a9400391b7" + ], + "evidence_kind": "measured", + "inventory_id": "algorithm:bounded-graph-retrieval", + "proof_level": "source-health", + "source_section": { + "heading": "Experiment and algorithm traceability inventory", + "path": "docs/paper/sections/11_optimization.qmd" + }, + "unresolved_limits": [ + "production-wide boundedness is not inferred from source health" + ] + }, + { + "corpus_parameter_scope": "branch diff from the content-addressed base; experiment scope is recorded by the associated state and candidate entries", + "decision": "task-owned-source-change-recorded", + "evidence_fingerprints": [ + "1683a5a43aa29d5ad0e6428c310f8a6f00f8c2ca15ec2421c2a9b196ebc456f6" + ], + "evidence_kind": "measured", + "inventory_id": "algorithm:emotional-propagation-cache", + "proof_level": "source-health", + "source_section": { + "heading": "Experiment and algorithm traceability inventory", + "path": "docs/paper/sections/11_optimization.qmd" + }, + "unresolved_limits": [ + "production-wide boundedness is not inferred from source health" + ] + }, + { + "corpus_parameter_scope": "branch diff from the content-addressed base; experiment scope is recorded by the associated state and candidate entries", + "decision": "task-owned-source-change-recorded", + "evidence_fingerprints": [ + "b33dc5cacb2e538cc3a59d2d0c09872ef7b2a55731ef5eaa09b6157d88d1a586" + ], + "evidence_kind": "measured", + "inventory_id": "algorithm:memory-storage-and-graph-maintenance", + "proof_level": "source-health", + "source_section": { + "heading": "Experiment and algorithm traceability inventory", + "path": "docs/paper/sections/11_optimization.qmd" + }, + "unresolved_limits": [ + "production-wide boundedness is not inferred from source health" + ] + }, + { + "corpus_parameter_scope": "branch diff from the content-addressed base; experiment scope is recorded by the associated state and candidate entries", + "decision": "task-owned-source-change-recorded", + "evidence_fingerprints": [ + "b2302f5b6b23fb544b2807d1e5477a7175d782d891c1880e6f6c3e19be2c0214" + ], + "evidence_kind": "measured", + "inventory_id": "algorithm:runtime-composition", + "proof_level": "source-health", + "source_section": { + "heading": "Experiment and algorithm traceability inventory", + "path": "docs/paper/sections/11_optimization.qmd" + }, + "unresolved_limits": [ + "production-wide boundedness is not inferred from source health" + ] + }, + { + "corpus_parameter_scope": "branch diff from the content-addressed base; experiment scope is recorded by the associated state and candidate entries", + "decision": "task-owned-source-change-recorded", + "evidence_fingerprints": [ + "ea53b56ffeb96c27c5d86ecde2234cb38b88f8e8993f1af8da4ce963acb4d48f" + ], + "evidence_kind": "measured", + "inventory_id": "algorithm:bounded-work-instrumentation", + "proof_level": "source-health", + "source_section": { + "heading": "Experiment and algorithm traceability inventory", + "path": "docs/paper/sections/11_optimization.qmd" + }, + "unresolved_limits": [ + "production-wide boundedness is not inferred from source health" + ] + }, + { + "corpus_parameter_scope": "branch diff from the content-addressed base; experiment scope is recorded by the associated state and candidate entries", + "decision": "task-owned-source-change-recorded", + "evidence_fingerprints": [ + "b58c82f02ed95d695e042c1ffc91767a1da997c65c25b1fa1f34af508bd2b70d" + ], + "evidence_kind": "measured", + "inventory_id": "algorithm:experiment-harness-and-audit", + "proof_level": "source-health", + "source_section": { + "heading": "Experiment and algorithm traceability inventory", + "path": "docs/paper/sections/11_optimization.qmd" + }, + "unresolved_limits": [ + "production-wide boundedness is not inferred from source health" + ] + } + ], + "schema": "cortext_paper_traceability_v1" +} diff --git a/artifacts/flat_storage_cost/recenter-centroid-natural-13000-v1-overlap.json b/artifacts/flat_storage_cost/recenter-centroid-natural-13000-v1-overlap.json new file mode 100644 index 00000000..6add3375 --- /dev/null +++ b/artifacts/flat_storage_cost/recenter-centroid-natural-13000-v1-overlap.json @@ -0,0 +1,64 @@ +{ + "schema": "cortext_recenter_activation_overlap_v3", + "status": "measured-recenter-changes-activated-identity-set", + "decision": "recenter-materiality-requires-quality-and-cycle-evaluation", + "processed_events": 13000, + "consolidation_runs": 98, + "profiled_successful_recenters": 83, + "invalid_profiled_pairs": 0, + "first_profiled_recenter_event_index": 2408, + "last_profiled_recenter_event_index": 12879, + "full_activation_target_recenters": 54, + "changed_activated_set_count": 54, + "unchanged_activated_set_count": 29, + "minimum_pre_post_overlap_fraction": 0.5352564102564102, + "maximum_pre_activated_identities": 1248, + "maximum_post_activated_identities": 1248, + "maximum_pre_node_rows": 1425, + "maximum_post_node_rows": 1425, + "minimum_centroid_cluster_count": 0, + "minimum_centroid_member_count": 125, + "cluster_centroid_recenter_count": 0, + "active_signal_ring_centroid_recenter_count": 83, + "focus": 0.45, + "sensitivity": 0.5, + "stability": 0.5, + "derived_parameters": { + "C": 499, + "B": 125, + "A": 1248, + "public_query_node_budget": 2495, + "construction_node_budget": 624, + "construction_queue_effort": 250, + "logical_B_plus_one_only": 126, + "neutral_C": 512, + "neutral_B": 128, + "neutral_A": 1280, + "neutral_logical_B_plus_one_only": 129 + }, + "corpus_sha256": "17a447f237ff7dd1b732eca1a0f31e908b89b2ffdd20ae8b32df2e719a0271a2", + "raw_profile_sha256": "a6c0fcccb8499ee89cf91918114c9a7cce9204c9387cf226aa19de781a4482df", + "database_sha256": "38ed492ae8e72ab055afbe19d2fb0b067ef1bee6ac0c0ccb52ebceffb978b824", + "benchmark_binary_sha256": "e547c12db7912b9a0dc0f1788c5b234c44a0323ba95097c86cfe90e6df60cd83", + "required_follow_on": { + "algorithm_target": "consolidation-driven-sparse-activation-centroid-reset", + "fixed_activation_target": "A=2C+2B", + "fixed_query_work": "5C", + "structural_knob_points": 27, + "production_shaped_knob_points": 9, + "modality_and_source_id_agnostic": true, + "raw_process_reset_gate_remains_independent": true + }, + "nonclaims": [ + "accepted retrieval cycle", + "raw consolidation reset pass or waiver", + "bounded restart", + "Natural or Durable plateau", + "whole-goal completion", + "PR readiness", + "merge", + "release", + "deployment", + "publication" + ] +} diff --git a/artifacts/flat_storage_cost/recenter-centroid-natural-13000-v1-retrieval-audit.json b/artifacts/flat_storage_cost/recenter-centroid-natural-13000-v1-retrieval-audit.json new file mode 100644 index 00000000..299cb865 --- /dev/null +++ b/artifacts/flat_storage_cost/recenter-centroid-natural-13000-v1-retrieval-audit.json @@ -0,0 +1,7717 @@ +{ + "candidate_complete": true, + "candidate_quality_passed": true, + "control_population_passed": true, + "coverage_contract": { + "minimum_opaque_source_ids": 1, + "modality_agnostic_proof": "separate active-SQLite-route source/modality label-invariance regression", + "required_modalities": [ + "text" + ] + }, + "deterministic_tie_order": true, + "event_index_first": 6, + "event_index_last": 12996, + "exact_identity_recall_at_k": 1.0, + "exact_top1": 1.0, + "exact_top1_hits": 512, + "exact_top1_minimum": 0.998046875, + "exact_top1_miss_count": 0, + "modalities": [ + "text" + ], + "passed": true, + "private_profile_sha256": "a6c0fcccb8499ee89cf91918114c9a7cce9204c9387cf226aa19de781a4482df", + "production_cutover": false, + "query_count": 512, + "query_fingerprints": [ + { + "candidate_seed_rank_sha256": "080a9ed428559ef602668b4c00f114f1a11c3f6b02a435f0bdc154578e4d7f22", + "control_graph_rank_sha256": "56f84850716cfbffa9d81c7aec8c0a03f77ed03c09e3b25ca424cb2fe13c0d58", + "control_public_rank_sha256": "6f2dedf3556d025f563cd51d3f2d29968da7d371329619963c48627952fd6769", + "control_seed_rank_sha256": "080a9ed428559ef602668b4c00f114f1a11c3f6b02a435f0bdc154578e4d7f22", + "control_top1_age_events": 4, + "control_top1_age_ms": 4000, + "event_index": 6, + "modality": "text", + "query_embedding_sha256": "84587433177852a5b67ac983f87d37932dbd638df0918b13e53b61ec551aa556", + "query_ordinal": 0, + "query_timestamp": 1700000006000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "e1688f53944f439f94f6edaf115ab3070044de71a2b90d1ebea44659b858a64c", + "control_graph_rank_sha256": "22a454a632a2efd084279ff0ec99504c468414d013f3c74ea57b5bcfb0464d3c", + "control_public_rank_sha256": "f1318148c053f21c3210a089d7b7f139fc9c534944ad214997fae7c6228ed540", + "control_seed_rank_sha256": "e1688f53944f439f94f6edaf115ab3070044de71a2b90d1ebea44659b858a64c", + "control_top1_age_events": 12, + "control_top1_age_ms": 12000, + "event_index": 35, + "modality": "text", + "query_embedding_sha256": "2c636fb1f456ae86e29bb487e77098a6ad7b79ffee4b443a43b0acb0d7bcb015", + "query_ordinal": 1, + "query_timestamp": 1700000035000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "2e55329a5b8da30262e4907cf9dc379364d196c8c368b2250f51a51e479e5ad0", + "control_graph_rank_sha256": "24edbdee0859b29bd98e4e477e7defead1a7f42f44c86a1bca65bf0c93ea2377", + "control_public_rank_sha256": "0945cb0b2c3eacb698e469810764f81745ee22420fc850fcda5dc6c3a1c0eebd", + "control_seed_rank_sha256": "2e55329a5b8da30262e4907cf9dc379364d196c8c368b2250f51a51e479e5ad0", + "control_top1_age_events": 11, + "control_top1_age_ms": 11000, + "event_index": 61, + "modality": "text", + "query_embedding_sha256": "4af8ba58fc8c0240acccd9ed0d3d7ae9b953fa10829778b3eaa1d8c9cfecae6f", + "query_ordinal": 2, + "query_timestamp": 1700000061000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "79e79a6f3a9499940199a1e6cff5bdb7705c4b4a6e51af95acb7dd4060af8f1a", + "control_graph_rank_sha256": "7a8174812553068d0041fe7a64763fbdf1bc25d7a36d489421374edf658a6fe6", + "control_public_rank_sha256": "17a38a1adb7de4402939e0332d1c1a15135e3a988a7509a46f80a995560b768c", + "control_seed_rank_sha256": "79e79a6f3a9499940199a1e6cff5bdb7705c4b4a6e51af95acb7dd4060af8f1a", + "control_top1_age_events": 16, + "control_top1_age_ms": 16000, + "event_index": 86, + "modality": "text", + "query_embedding_sha256": "b2f634b4ff0b165d96e7d3ca3fdfd82020ff7f94f658dc75503df1247c84fc57", + "query_ordinal": 3, + "query_timestamp": 1700000086000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "5be0a7e1e83ddf33025cb786c399f3df92766cf0a6ef0d32ba06ab359febe157", + "control_graph_rank_sha256": "2aa27d528305e4db1605c64a44e0178ac451c69cb3903a230610c0977a761d40", + "control_public_rank_sha256": "4db37a1d8d6c94187100fd49985c2d5dff2eb5f7d40aeff2af87e2700fa2628e", + "control_seed_rank_sha256": "5be0a7e1e83ddf33025cb786c399f3df92766cf0a6ef0d32ba06ab359febe157", + "control_top1_age_events": 4, + "control_top1_age_ms": 4000, + "event_index": 116, + "modality": "text", + "query_embedding_sha256": "21f990c8e973b01c58bd7bcb3859fa87c8ae25f195627b77174bd50beadc91b8", + "query_ordinal": 4, + "query_timestamp": 1700000116000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "18942738196ffbb31ef6bf3ac420f8686089e975b22af302e3ce697f8b85957f", + "control_graph_rank_sha256": "d4301c7844e516f191a9399761cc1a5f51bc95635787a8ba102ffd92fc5f831a", + "control_public_rank_sha256": "8bb876358e90885e1f5ef3b05465c2a15406e8aa9a9b83f2e91bf980b7b0db88", + "control_seed_rank_sha256": "18942738196ffbb31ef6bf3ac420f8686089e975b22af302e3ce697f8b85957f", + "control_top1_age_events": 18, + "control_top1_age_ms": 18000, + "event_index": 138, + "modality": "text", + "query_embedding_sha256": "d5da25e067a5fe118a873ab3e3be49409577f4d55e5b2609bc06c4b20ee18e68", + "query_ordinal": 5, + "query_timestamp": 1700000138000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "d7830717b55f717f455ee6d8dbf9ed612df6ad744a1b897650902879eb12043b", + "control_graph_rank_sha256": "f890ef1b801c295ecedc6d743be6aa02a8cfbb26dfd6a30eb01c348804050975", + "control_public_rank_sha256": "07914dcfcd0e4a7ec60d065743233a3ed5775aa86294abdf517e509aef650069", + "control_seed_rank_sha256": "d7830717b55f717f455ee6d8dbf9ed612df6ad744a1b897650902879eb12043b", + "control_top1_age_events": 17, + "control_top1_age_ms": 17000, + "event_index": 161, + "modality": "text", + "query_embedding_sha256": "3205afe6f28b5ebffeecd8fa56f2edc6d441f5b2d0c242ad08d8a9b3ea700497", + "query_ordinal": 6, + "query_timestamp": 1700000161000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "a13fc75b641b2fbef333bf4287822ffbe3a237495cddcfde0da879bb93217064", + "control_graph_rank_sha256": "0c58d6e9416a4abdbb30e475f32a6657ab123d4576ed7e76b0024873ca80fe05", + "control_public_rank_sha256": "5bfec3fe786d6beed686996b95e572d4720b42db6aa1e688dc7e7f6734a53ebb", + "control_seed_rank_sha256": "a13fc75b641b2fbef333bf4287822ffbe3a237495cddcfde0da879bb93217064", + "control_top1_age_events": 105, + "control_top1_age_ms": 105000, + "event_index": 188, + "modality": "text", + "query_embedding_sha256": "2087d02c68ce4c88ab2971acb72fef1c09483aa03ee3a5714214ba91ed50bac8", + "query_ordinal": 7, + "query_timestamp": 1700000188000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "614747f7a6392489069adcc80b0621b40d732d55650da3c15e246d4565841811", + "control_graph_rank_sha256": "1f036dff02c28a973544cef1977d9d19185b1d7f73e5ca8cdbfc3a3b4a303cde", + "control_public_rank_sha256": "851a3581b400eebb9f1831d79ea42175798c8547aeaef7b12a7bea831b3696c7", + "control_seed_rank_sha256": "614747f7a6392489069adcc80b0621b40d732d55650da3c15e246d4565841811", + "control_top1_age_events": 38, + "control_top1_age_ms": 38000, + "event_index": 217, + "modality": "text", + "query_embedding_sha256": "d0b87e1969c66c5a6921ff45de1c11a8ebeedf0c2d116e83fc959d1ae3c98258", + "query_ordinal": 8, + "query_timestamp": 1700000217000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "8033a9e57641a94ece5a9eb1c078c61608ce4d018859c76e4c9b2eb94b07970a", + "control_graph_rank_sha256": "02cb45bca0a3a707c1285db4fde99317d50d736954a72cc1464ca3e66632ec6e", + "control_public_rank_sha256": "41893e4c1165c6bbe5d1ee9042e11242ccfbd0f98a49932cc626b3925a8bbaf3", + "control_seed_rank_sha256": "8033a9e57641a94ece5a9eb1c078c61608ce4d018859c76e4c9b2eb94b07970a", + "control_top1_age_events": 68, + "control_top1_age_ms": 68000, + "event_index": 239, + "modality": "text", + "query_embedding_sha256": "444a5048bb1a4a40f61dbca7362b464980fe4442cbf858ca10ede56faf6d4bb1", + "query_ordinal": 9, + "query_timestamp": 1700000239000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "14c3c06bbf7a6ee91de13abf0286804d361bdbf55030133547fd08eacde6c82f", + "control_graph_rank_sha256": "a15eba24e611c12911fc3b6053a571dc79d35c47f6ebf74a875d9f4a775363a9", + "control_public_rank_sha256": "795f898ed2dd11030a20d327686c71076a69c7d6e92d5e8d0fa12a29f14c6fd9", + "control_seed_rank_sha256": "14c3c06bbf7a6ee91de13abf0286804d361bdbf55030133547fd08eacde6c82f", + "control_top1_age_events": 85, + "control_top1_age_ms": 85000, + "event_index": 264, + "modality": "text", + "query_embedding_sha256": "d84cf90dd633d76c8a82cb2e2a32777386d608230ee605149ccffd5c492a919f", + "query_ordinal": 10, + "query_timestamp": 1700000264000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "216f68f5bc295dfcbfb5272330ac04e11f6140bc60f912bea30baefb179cfdd5", + "control_graph_rank_sha256": "fda806fece32966c62ea5efbad6534b14a22f9ded9ea9203ce2536188510750e", + "control_public_rank_sha256": "2c66aca79a5f0eddde1f1e9686743934dc5c442fa70808e3a7717faea0b0049d", + "control_seed_rank_sha256": "216f68f5bc295dfcbfb5272330ac04e11f6140bc60f912bea30baefb179cfdd5", + "control_top1_age_events": 114, + "control_top1_age_ms": 114000, + "event_index": 293, + "modality": "text", + "query_embedding_sha256": "5f21110017c0eb287c498e5cd5c3bc84071fa7cfd8b10545284cbdee0a039f6a", + "query_ordinal": 11, + "query_timestamp": 1700000293000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "be4cf0c7839f29d35865f07b5099c4f81d399830f4f4d6b32d4ec81cefda73ba", + "control_graph_rank_sha256": "51ff885d3576f00b1a96b0e17b797b6358244e2f0af7e395bb7a7166f9eddd82", + "control_public_rank_sha256": "743bb04344f6f7b56a7f7ada5f4ad871e25efb5f66b18dfc7fb6232287481db6", + "control_seed_rank_sha256": "be4cf0c7839f29d35865f07b5099c4f81d399830f4f4d6b32d4ec81cefda73ba", + "control_top1_age_events": 124, + "control_top1_age_ms": 124000, + "event_index": 314, + "modality": "text", + "query_embedding_sha256": "62fdd11bec34a929b64c50ffac7e78be3ebb4d87d2f73e40dd118144e03f7765", + "query_ordinal": 12, + "query_timestamp": 1700000314000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "0adc38362afa4e5e5f6ed92a06970f1521c17def111654cda17f71bc36217b80", + "control_graph_rank_sha256": "ab2b4067e94082b069795206a4bf369389a8759db4a4330b09a5c56c0b9ebc9e", + "control_public_rank_sha256": "513c6c06cf0e21831348c76e716169904df824000cf899e51d930198c9ce49f4", + "control_seed_rank_sha256": "0adc38362afa4e5e5f6ed92a06970f1521c17def111654cda17f71bc36217b80", + "control_top1_age_events": 14, + "control_top1_age_ms": 14000, + "event_index": 336, + "modality": "text", + "query_embedding_sha256": "e6ede2b19638f699b5315d66da1509757896667b56d6364234843c99f9ed6feb", + "query_ordinal": 13, + "query_timestamp": 1700000336000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "650ae651dd6fc46f2c86fc48eefcd18b6f37d022204cdf28ab64f48285862b66", + "control_graph_rank_sha256": "fe78a4d27448cac8e7828c24a3413b4c05504fd32d07443051ed83e155670821", + "control_public_rank_sha256": "769ab75ba19af843125c546929771f0f83b82b5005c1a2426540b09dc5f393cc", + "control_seed_rank_sha256": "650ae651dd6fc46f2c86fc48eefcd18b6f37d022204cdf28ab64f48285862b66", + "control_top1_age_events": 218, + "control_top1_age_ms": 218000, + "event_index": 367, + "modality": "text", + "query_embedding_sha256": "ceb4adf2b93ab4d03b33759f6e866a01950728d1f27ddf3c5f47d026b5507b6b", + "query_ordinal": 14, + "query_timestamp": 1700000367000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "86ab7256c6bf731efef7d5df0fc62ff9de8db9b3855f4d057a8b01d60b4007ec", + "control_graph_rank_sha256": "df043865f232e48105d85b9bfd1f07ead607aafc96a041aa56a9557fc3f1ccd2", + "control_public_rank_sha256": "079db7e01580e93f225ab29d631c57b5735bfaf94d0c268caf3048a9a3b36bb2", + "control_seed_rank_sha256": "86ab7256c6bf731efef7d5df0fc62ff9de8db9b3855f4d057a8b01d60b4007ec", + "control_top1_age_events": 33, + "control_top1_age_ms": 33000, + "event_index": 388, + "modality": "text", + "query_embedding_sha256": "9c446e1dea3cf531811cea3b85f09378dea1b034ab465aa03217629ac058a64e", + "query_ordinal": 15, + "query_timestamp": 1700000388000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "fa224997bbb505166976ec4554b67d2db8d8cf57dd8cade4edd8355f852d573d", + "control_graph_rank_sha256": "8f20214d8d8445f21a3f3187a163a0675577a2d4a10414eab27e93a5be21dd59", + "control_public_rank_sha256": "9ef4cb7865f62b927601926a56c30dc482f93819a36575e3d4d84bfafc273a67", + "control_seed_rank_sha256": "fa224997bbb505166976ec4554b67d2db8d8cf57dd8cade4edd8355f852d573d", + "control_top1_age_events": 190, + "control_top1_age_ms": 190000, + "event_index": 416, + "modality": "text", + "query_embedding_sha256": "b10de1496abcd38fa3610c986953941ca7528d9e85bb5bbdcab062f34af0a977", + "query_ordinal": 16, + "query_timestamp": 1700000416000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "f972375c5e6a64800336587867133011ef41369c4d6270b6c5c30c64aa6febe9", + "control_graph_rank_sha256": "b77efe7556b8d84171131dc0ee386eac9e874d76bc7ca4775af82c902a4d190c", + "control_public_rank_sha256": "1680636be72ca91cdb327461c619865eb78e7b4bf14d1972320f2cee22c8a020", + "control_seed_rank_sha256": "f972375c5e6a64800336587867133011ef41369c4d6270b6c5c30c64aa6febe9", + "control_top1_age_events": 339, + "control_top1_age_ms": 339000, + "event_index": 438, + "modality": "text", + "query_embedding_sha256": "288a7d30c5c601b64864b58d13a621fe4eab91aae21b293760d0ab563943d3b5", + "query_ordinal": 17, + "query_timestamp": 1700000438000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "878678b29983d37f7a9fa9c8f2e43906bbaea4126f5ce296b55c2c5d3aaaf642", + "control_graph_rank_sha256": "f1ed6b05e7dd4b9276da7c906157c58625c6a59d0a3b0d05d11b9ea67cfac3e4", + "control_public_rank_sha256": "80fa642f78dda8a6f8109806323e01d0b9fba819455690707411045269fa52c4", + "control_seed_rank_sha256": "878678b29983d37f7a9fa9c8f2e43906bbaea4126f5ce296b55c2c5d3aaaf642", + "control_top1_age_events": 17, + "control_top1_age_ms": 17000, + "event_index": 464, + "modality": "text", + "query_embedding_sha256": "eb5cd3210e8ec25e2023bdd10ff1eb40201508533fa2034a52d5a7f886831c15", + "query_ordinal": 18, + "query_timestamp": 1700000464000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "0b45452aeb4a536220fa8d7098f3dfc6ea39c1cfc937256ad3798027762fdbdb", + "control_graph_rank_sha256": "0e9ad947a2fc07a300108249723d6a5976a82f6af8f7c6efad2221981622dd12", + "control_public_rank_sha256": "db2d40d2eef8001938c0942550159acd7e5bc2048a9315807f9de5d3f8222810", + "control_seed_rank_sha256": "0b45452aeb4a536220fa8d7098f3dfc6ea39c1cfc937256ad3798027762fdbdb", + "control_top1_age_events": 107, + "control_top1_age_ms": 107000, + "event_index": 490, + "modality": "text", + "query_embedding_sha256": "c0bbbea6e82d5ca968707bf25bfe6db763d7dac5099fda1107a8e91fabd631d3", + "query_ordinal": 19, + "query_timestamp": 1700000490000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "5c5db215700ffc78436c8118d061a59b57160a8ae8c460ef7391c0d67877d475", + "control_graph_rank_sha256": "5db1bdf0c9a41a50593cc716312e45e51b68d1b674eaad2bb88588a48d107d8f", + "control_public_rank_sha256": "4e95c7f9cac411a789d880afe695f5c00ed8bdfb389c0b95b0a98050610bc156", + "control_seed_rank_sha256": "5c5db215700ffc78436c8118d061a59b57160a8ae8c460ef7391c0d67877d475", + "control_top1_age_events": 17, + "control_top1_age_ms": 17000, + "event_index": 520, + "modality": "text", + "query_embedding_sha256": "0afb889dfeb6908366e4a5a4a80bab4e08ecfc8f1d16bcbcbff75d1926fc5f1c", + "query_ordinal": 20, + "query_timestamp": 1700000520000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "7c5f7e39d9e86da65f47af1b3e79856881fd039e7d584789a82c4038e3b3160c", + "control_graph_rank_sha256": "570cd8393ec8f41dbca06cd9e10902e184b98af20bc6d25dd257ae0289ef786e", + "control_public_rank_sha256": "dd9eaffce53ee50d1c80654f003246a9ed353995e908d1ef366fd91f33676cb9", + "control_seed_rank_sha256": "7c5f7e39d9e86da65f47af1b3e79856881fd039e7d584789a82c4038e3b3160c", + "control_top1_age_events": 4, + "control_top1_age_ms": 4000, + "event_index": 543, + "modality": "text", + "query_embedding_sha256": "f4a3fdbe7b959acb70d8e0955f8e714ed5bd46a94206f03712bb326d5d8f11c4", + "query_ordinal": 21, + "query_timestamp": 1700000543000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "798c72c92610d3bf8c44f15c62e34fce2ea3457f1c5e493365fba3b28601115b", + "control_graph_rank_sha256": "24a6c7ecdee594a24c6857b5b37261578d1e75eb8d2d1f37a5af860ac8339620", + "control_public_rank_sha256": "5a87996e726efc242cd49ee2ba4ac94dd9713bc1b33dfdf4beff6e8dea66e113", + "control_seed_rank_sha256": "798c72c92610d3bf8c44f15c62e34fce2ea3457f1c5e493365fba3b28601115b", + "control_top1_age_events": 47, + "control_top1_age_ms": 47000, + "event_index": 568, + "modality": "text", + "query_embedding_sha256": "f952aaa869313f1a99637ab15f2571177a6e54aa9b44e483af3ac4cb64c70fea", + "query_ordinal": 22, + "query_timestamp": 1700000568000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "69d6ce87372e132f4d5387293050ef67694f338f7ee5a488d346bf1e07ca6db2", + "control_graph_rank_sha256": "812ec6973e1b295da2bdb3f0bc61f9690981425020dcbabed91962fb1a439a3b", + "control_public_rank_sha256": "c1390829bc3451a1cc2d9a3b9f0645b28599a5a33ca1f49f2e44e37ab7e80151", + "control_seed_rank_sha256": "69d6ce87372e132f4d5387293050ef67694f338f7ee5a488d346bf1e07ca6db2", + "control_top1_age_events": 15, + "control_top1_age_ms": 15000, + "event_index": 591, + "modality": "text", + "query_embedding_sha256": "03d9bd8e08e4397f2cbb6a0e2bbc47af6e3449e78338f9f1ec7aa109d8d40bce", + "query_ordinal": 23, + "query_timestamp": 1700000591000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "c32cf3b53f99e5e61df5fa36e673776a33314b8dc4ebf1ffbdac5afe043d4fd3", + "control_graph_rank_sha256": "8183ec53fce18e47723c0496b02888646c08b9eb6e1c1d0cba1cd275b299e304", + "control_public_rank_sha256": "1e85f8faea25f12ac497bc4922e6905a3b28fa4ba69f5bb06037d048b5883fc3", + "control_seed_rank_sha256": "c32cf3b53f99e5e61df5fa36e673776a33314b8dc4ebf1ffbdac5afe043d4fd3", + "control_top1_age_events": 126, + "control_top1_age_ms": 126000, + "event_index": 617, + "modality": "text", + "query_embedding_sha256": "53ed8c0ca85b90d7e57adc1edbb349ab29037f87536559c0a43404adf0499e37", + "query_ordinal": 24, + "query_timestamp": 1700000617000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "e9f191425109eba9e37f07f87f218cccda93469fecd0f6bb3a1050e9e51798f9", + "control_graph_rank_sha256": "3ceffc0b33ca916e7ff543a2f669b868795ecf9eabb57d76737819fceb85135f", + "control_public_rank_sha256": "540ee5c1b452f3eb24c47836d446455cb8dd8d9d07e6c9ef5cfde1a6e19c0109", + "control_seed_rank_sha256": "e9f191425109eba9e37f07f87f218cccda93469fecd0f6bb3a1050e9e51798f9", + "control_top1_age_events": 53, + "control_top1_age_ms": 53000, + "event_index": 639, + "modality": "text", + "query_embedding_sha256": "c0bbbea6e82d5ca968707bf25bfe6db763d7dac5099fda1107a8e91fabd631d3", + "query_ordinal": 25, + "query_timestamp": 1700000639000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "4bb0578b9528313affdc7d7375c645f944fc870be0c3f8e4baefb40081bb263c", + "control_graph_rank_sha256": "594ff0647b0ef177d9cbfe43b62066e73300f55986d7b568f724c10d25cc6044", + "control_public_rank_sha256": "5174e84d24320e7c3ac4d6fc8382cdd5b49b34b2c34f6216d356f23c23137689", + "control_seed_rank_sha256": "4bb0578b9528313affdc7d7375c645f944fc870be0c3f8e4baefb40081bb263c", + "control_top1_age_events": 142, + "control_top1_age_ms": 142000, + "event_index": 663, + "modality": "text", + "query_embedding_sha256": "9f744a5103a3d76ad567f8a6eb5174b6a54bb88d83ec345fb0c5295f56882a9d", + "query_ordinal": 26, + "query_timestamp": 1700000663000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "1d7839d9707aaddd48baf8c2886620b3dfef040cea91227fdddf1e15fee052b5", + "control_graph_rank_sha256": "e3f1f2ffc045d782365edbb55b4a899df8a15906c87bb1be548c78b2d378b343", + "control_public_rank_sha256": "9ffe52deb92d112ef0c216981776ee628c40e3c7d58f08e4a63ffee114af4053", + "control_seed_rank_sha256": "1d7839d9707aaddd48baf8c2886620b3dfef040cea91227fdddf1e15fee052b5", + "control_top1_age_events": 154, + "control_top1_age_ms": 154000, + "event_index": 690, + "modality": "text", + "query_embedding_sha256": "456bc8dffe41741820c6690494d7bb8575627232eaf541fc37cf09690fcab953", + "query_ordinal": 27, + "query_timestamp": 1700000690000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "cfa35c2167e08dad323abe4c4ee86a74a8958895660ac3df4c359091b3f868c7", + "control_graph_rank_sha256": "70dc0f598eebf0cd0a32eda01e30fb9997b4010991e4d23fbb5b6e73890274a0", + "control_public_rank_sha256": "770cb7aabba27d8acbdca9def9f0cbc9901e9f801628656dae81cc442294454f", + "control_seed_rank_sha256": "cfa35c2167e08dad323abe4c4ee86a74a8958895660ac3df4c359091b3f868c7", + "control_top1_age_events": 179, + "control_top1_age_ms": 179000, + "event_index": 715, + "modality": "text", + "query_embedding_sha256": "0d58158e54b1264a63fe2926d1f8dd57b3f962d8a1a02b3159640de892d2c3b0", + "query_ordinal": 28, + "query_timestamp": 1700000715000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "000dce49cb9a2036d899aa4998b8f9574f4689b1b438e196f0634294c30c0671", + "control_graph_rank_sha256": "3086877ead2a6e3aea31ef530dd73a3aae78a2ff521d190c6b32d0be5ef33c4b", + "control_public_rank_sha256": "f5e33d545b78a3042979909d4767d935e3c1fe06585b15a3a37c46776e3df453", + "control_seed_rank_sha256": "000dce49cb9a2036d899aa4998b8f9574f4689b1b438e196f0634294c30c0671", + "control_top1_age_events": 209, + "control_top1_age_ms": 209000, + "event_index": 739, + "modality": "text", + "query_embedding_sha256": "3f24dc92638cb805d86e6aac9240cea4d3afc95848dd157148123f09a334b226", + "query_ordinal": 29, + "query_timestamp": 1700000739000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "c723c59d432da2bdc41b6b662a20441a356efb1bc5f964da73274ed223969b77", + "control_graph_rank_sha256": "d0444b80e4c452e5b883b1cea8151f230a80d5789c411b6bad3a3e6a395d7423", + "control_public_rank_sha256": "25bd4d43e4b5b525ff94992b9566cf9024677180d6aa1123987e9bf96c1451e0", + "control_seed_rank_sha256": "c723c59d432da2bdc41b6b662a20441a356efb1bc5f964da73274ed223969b77", + "control_top1_age_events": 539, + "control_top1_age_ms": 539000, + "event_index": 765, + "modality": "text", + "query_embedding_sha256": "f6a020079e462462889a6a35c1819917e77d86d3824228c4fb06aabf5d591f59", + "query_ordinal": 30, + "query_timestamp": 1700000765000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "46ab9418108452d0a4b1ab2524ab779f543e201b12d2a1dfa995bd6a38a02fcb", + "control_graph_rank_sha256": "b61a994108145b4526d0d8e911176ec4db2e5b8bda8fb6f31beed6fb4ed064f8", + "control_public_rank_sha256": "55f51823ccd4cd022548cfbed9f38c4b9c1f380ff6ac805d1be0e9e53b18165a", + "control_seed_rank_sha256": "46ab9418108452d0a4b1ab2524ab779f543e201b12d2a1dfa995bd6a38a02fcb", + "control_top1_age_events": 62, + "control_top1_age_ms": 62000, + "event_index": 789, + "modality": "text", + "query_embedding_sha256": "149af8eddf258a252e08701d6836db1369b4f187824f3f670ceb097920999b18", + "query_ordinal": 31, + "query_timestamp": 1700000789000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "bd36a9fe8d3d50e9953a1c6a848a7b494f02280e10b92d8500d633d213797db4", + "control_graph_rank_sha256": "2317349f881f9dc7c45ef411da9e8f1cd4bb4d786b03588ef532cb14c9407194", + "control_public_rank_sha256": "381f8d3912e48de582a3cfbc6dd42577b52843a1b1ac3c4538739d213f372993", + "control_seed_rank_sha256": "bd36a9fe8d3d50e9953a1c6a848a7b494f02280e10b92d8500d633d213797db4", + "control_top1_age_events": 632, + "control_top1_age_ms": 632000, + "event_index": 816, + "modality": "text", + "query_embedding_sha256": "c02a55139bf4a0c1f204c039dd310f90867ddcfa3200b864786c6cb79dd600ec", + "query_ordinal": 32, + "query_timestamp": 1700000816000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "0399f3d97fdcbe69ffc49ce2863abcd59d4ece0b7e9f864d04b97fb0b6621a82", + "control_graph_rank_sha256": "b6b50a5b6b4ac177d864c9f997ab7863a0f0c939d5ecd1c4c108db539f2cea31", + "control_public_rank_sha256": "a02ab37b97975f5a4f7c1b2282f5ad5bc13a1bd8de7c58df2839fd1a434beeb6", + "control_seed_rank_sha256": "0399f3d97fdcbe69ffc49ce2863abcd59d4ece0b7e9f864d04b97fb0b6621a82", + "control_top1_age_events": 21, + "control_top1_age_ms": 21000, + "event_index": 838, + "modality": "text", + "query_embedding_sha256": "b8c464378ead29c1dc3bdc3b06ead078f9424e5dc548f80fc085da7a3d157f82", + "query_ordinal": 33, + "query_timestamp": 1700000838000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "01bf1235ce48e01986df87518224a06620be8d7355bb2d827261fe1b9fbacedc", + "control_graph_rank_sha256": "331438ed4cbef5158183430f19338f25774564e69d0b75701031a1a0200abb5a", + "control_public_rank_sha256": "b7f7195a6320e60d982f45cfea4cf0370a2e96aa1e90c22b735cfeb873834986", + "control_seed_rank_sha256": "01bf1235ce48e01986df87518224a06620be8d7355bb2d827261fe1b9fbacedc", + "control_top1_age_events": 398, + "control_top1_age_ms": 398000, + "event_index": 863, + "modality": "text", + "query_embedding_sha256": "ce4302b471993d55ae870395911167861650ad064d23d437df4e169e8759831c", + "query_ordinal": 34, + "query_timestamp": 1700000863000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "98d8652844e4faba5d70901923cd35e0c5d0c45971dcb7cdc78d45956c1e71da", + "control_graph_rank_sha256": "029d1f33cb2b155be06ec604ec76b0ee252db7cd17cc161eebeb227da6e33ca5", + "control_public_rank_sha256": "76ed03db901c144bf6bb716130dcd5ee3dfe5a9d98862dc1f674535a73cf9e2a", + "control_seed_rank_sha256": "98d8652844e4faba5d70901923cd35e0c5d0c45971dcb7cdc78d45956c1e71da", + "control_top1_age_events": 11, + "control_top1_age_ms": 11000, + "event_index": 890, + "modality": "text", + "query_embedding_sha256": "f26826fddc637edfb9f4b3a4d4d1fd3f606ac0ae0ac6e25a7deff7a2bcf37435", + "query_ordinal": 35, + "query_timestamp": 1700000890000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "ae2009d23aaec3f9a57f51bed95c2c6db2a80a95f90f74cc63b1336dbff315b2", + "control_graph_rank_sha256": "46b6bff0c9d6a6c990320320a76210e58a838251794352b1fc700007782c6628", + "control_public_rank_sha256": "6ab1111550efdd2fdf124d62d6d3adf07331a574b1ce129546b5c0a3053f5c6f", + "control_seed_rank_sha256": "ae2009d23aaec3f9a57f51bed95c2c6db2a80a95f90f74cc63b1336dbff315b2", + "control_top1_age_events": 187, + "control_top1_age_ms": 187000, + "event_index": 914, + "modality": "text", + "query_embedding_sha256": "0c08624e3fb003ff1389b0f2773b923609c431d6e9f7a529ad18778b7d8b92a1", + "query_ordinal": 36, + "query_timestamp": 1700000914000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "7125a332646402fa52935aa0e79a1601b64e64fe326ab641018af44cf83c166d", + "control_graph_rank_sha256": "4615e437eaa15a2feaad2e89027d0507f384df29ff71e7dab3726f0e7f27f3ab", + "control_public_rank_sha256": "e677b1aea6c577d1e407df0f01eaf7f207ea4632a12633e2deb5d7b71ee2e9ab", + "control_seed_rank_sha256": "7125a332646402fa52935aa0e79a1601b64e64fe326ab641018af44cf83c166d", + "control_top1_age_events": 303, + "control_top1_age_ms": 303000, + "event_index": 938, + "modality": "text", + "query_embedding_sha256": "dab8da4807b9b96663b117f0c5b4f92927eecfa47815c7844fd56212a0ec8ea5", + "query_ordinal": 37, + "query_timestamp": 1700000938000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "762d6cf3f0977b470fb0d38d6ee73de124f3f7b3f22685a186b948a275d607e9", + "control_graph_rank_sha256": "a25244522ab1f8769205d9e5b8c644332ecac6ac89ecd9b86aea339990666f43", + "control_public_rank_sha256": "2c5eab3ec9c9b4fa479a52b0256b45df26ed3512ca1240cd53f353334da99b6c", + "control_seed_rank_sha256": "762d6cf3f0977b470fb0d38d6ee73de124f3f7b3f22685a186b948a275d607e9", + "control_top1_age_events": 5, + "control_top1_age_ms": 5000, + "event_index": 960, + "modality": "text", + "query_embedding_sha256": "c9bc9e7c1b9a413a775df365e9e97dc969250b6357d149fdcc038a9b910769dd", + "query_ordinal": 38, + "query_timestamp": 1700000960000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "6e9406b38ff7385c08af463d13b465fdb5c9eae70b4a81bd2aa02dbcde98d4be", + "control_graph_rank_sha256": "61e5a88e6c8dc7222aa730ee6827b04886fc8f3841888a82b21d65044d5c25c1", + "control_public_rank_sha256": "73191e47dbae97c69e6b964d4a202eafd8cd35dd8e1c96b763ad3faa5acb0a08", + "control_seed_rank_sha256": "6e9406b38ff7385c08af463d13b465fdb5c9eae70b4a81bd2aa02dbcde98d4be", + "control_top1_age_events": 42, + "control_top1_age_ms": 42000, + "event_index": 988, + "modality": "text", + "query_embedding_sha256": "72abfa64bee396f4d91216717431b1dc75808e323abf221db304e42433b8e062", + "query_ordinal": 39, + "query_timestamp": 1700000988000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "56732da4dd840e7aaaaa7609dea6f88af79fb23f21c0c9a5c17d24d5ce5cf7ea", + "control_graph_rank_sha256": "fd0569638ad5eec9b6b5041fcc4edc7e2a328b984532191533d690f20c045800", + "control_public_rank_sha256": "750c6a915d2858d5ede47dc3b2d91bf3489cc86b02f8f14618e0ede33c9e9b79", + "control_seed_rank_sha256": "56732da4dd840e7aaaaa7609dea6f88af79fb23f21c0c9a5c17d24d5ce5cf7ea", + "control_top1_age_events": 13, + "control_top1_age_ms": 13000, + "event_index": 1013, + "modality": "text", + "query_embedding_sha256": "70f1fcec73e95d9290bbfdb0245783e9469b599a2ca37497ec10459047cf42b0", + "query_ordinal": 40, + "query_timestamp": 1700001013000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "911e2917d8e71f5121f1606b0920242e3cc1f44545ab14ee47eee82dd06640f8", + "control_graph_rank_sha256": "7d425af611b3bab48ac193f51a9c4c06da8c0415b389eb085c9143eefb48a37b", + "control_public_rank_sha256": "68cdc1d6bd15c571244dcf2d672f6755d346985a1692d9f848300c2644acf3ed", + "control_seed_rank_sha256": "911e2917d8e71f5121f1606b0920242e3cc1f44545ab14ee47eee82dd06640f8", + "control_top1_age_events": 690, + "control_top1_age_ms": 690000, + "event_index": 1038, + "modality": "text", + "query_embedding_sha256": "a393c50095b24cc5a5da48c444dfe947ef3ec663d52af755724198fb1c56d9c7", + "query_ordinal": 41, + "query_timestamp": 1700001038000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "6f7a92eb0bbfeaa55d76f8d2f149c02e93fd07df9c596b8695b376a855e2f12d", + "control_graph_rank_sha256": "7d04126aff446f6546c655ec9da0cf3b3818c6f0c9641799f19e27948d4d2042", + "control_public_rank_sha256": "705b61634c0bdfd43859971a7d08aa213a4f5e7315420fdfae0805e6080427eb", + "control_seed_rank_sha256": "6f7a92eb0bbfeaa55d76f8d2f149c02e93fd07df9c596b8695b376a855e2f12d", + "control_top1_age_events": 83, + "control_top1_age_ms": 83000, + "event_index": 1060, + "modality": "text", + "query_embedding_sha256": "ce4302b471993d55ae870395911167861650ad064d23d437df4e169e8759831c", + "query_ordinal": 42, + "query_timestamp": 1700001060000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "065cdddca971dcf75229ce28c84fe25151f32cd160d0e35b5075a764c7478cc3", + "control_graph_rank_sha256": "4a69143ba22b2cb4c614101469fc6bb9de9e96616205b7e1446ece08a171a0d1", + "control_public_rank_sha256": "efcf95dd24d91fecba77ba8e3ddf52cb2867a7806d24cf4cdead356e14036dbe", + "control_seed_rank_sha256": "065cdddca971dcf75229ce28c84fe25151f32cd160d0e35b5075a764c7478cc3", + "control_top1_age_events": 19, + "control_top1_age_ms": 19000, + "event_index": 1088, + "modality": "text", + "query_embedding_sha256": "266a24cb437d36cca1555f75eac6634c66f51375f65e3050050ef10bc497da11", + "query_ordinal": 43, + "query_timestamp": 1700001088000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "6182811967ac8869407c9d80ccd700b9161b019e3caa8e5f91c381cd14941543", + "control_graph_rank_sha256": "26351293a87a27098d4b73bb5c64a1f1be88e6f9ea9985654f52907734a165e7", + "control_public_rank_sha256": "4c4fb0c7b630e9e88e0a5bdb96d810ba9148fe23e82e377159cf1d48f7afdf2a", + "control_seed_rank_sha256": "6182811967ac8869407c9d80ccd700b9161b019e3caa8e5f91c381cd14941543", + "control_top1_age_events": 14, + "control_top1_age_ms": 14000, + "event_index": 1114, + "modality": "text", + "query_embedding_sha256": "464495acda4e7034ce8a94734de02a1421d280af649cbaf1e4c368a31aae07d1", + "query_ordinal": 44, + "query_timestamp": 1700001114000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "7bbd98463c7134888b7530b99989564a1145cac691b667f6733ae912de7f3932", + "control_graph_rank_sha256": "e0292eb2b8fec9911b6e361a3071e6cf59b6af274387d488457fa5f26e6365a2", + "control_public_rank_sha256": "e2134b260e39b4bf603c8d1a0083fc8d9647c79f7950a27623bc70dd12c0e1d7", + "control_seed_rank_sha256": "7bbd98463c7134888b7530b99989564a1145cac691b667f6733ae912de7f3932", + "control_top1_age_events": 8, + "control_top1_age_ms": 8000, + "event_index": 1140, + "modality": "text", + "query_embedding_sha256": "012548d5e204be447697a99d3bb8402216a11faca5a0496970ffbc9342ba7a72", + "query_ordinal": 45, + "query_timestamp": 1700001140000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "3843f82e331365b3e88a99bc24cd17c382a99012a60fdc4eda7e4d4d198fa90c", + "control_graph_rank_sha256": "a0b27749ffb67ab34bb7ff8345fefe43824568978296fb453abb2b1555c6ffab", + "control_public_rank_sha256": "7486e019cd8d25c68dfa09caec7c66382188f1df4b00f1a71252803d549f50ab", + "control_seed_rank_sha256": "3843f82e331365b3e88a99bc24cd17c382a99012a60fdc4eda7e4d4d198fa90c", + "control_top1_age_events": 453, + "control_top1_age_ms": 453000, + "event_index": 1160, + "modality": "text", + "query_embedding_sha256": "d85298873fc656f2289672d2872fe3038d8dd989d0dc3cfefb28dd33b7f0ca5b", + "query_ordinal": 46, + "query_timestamp": 1700001160000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "6b4f69908d0ecbbc1dfa2bcad21807a11008a8c5dfc8c9c639f842f0c8769421", + "control_graph_rank_sha256": "84ac4c3a2b219bed9c6dd0c5750777076c9283ee198c58442f59f5110cabd032", + "control_public_rank_sha256": "9566821f1cfe3f2858922e13033f3b97dab929f6550c48cde69ad984c105fb62", + "control_seed_rank_sha256": "6b4f69908d0ecbbc1dfa2bcad21807a11008a8c5dfc8c9c639f842f0c8769421", + "control_top1_age_events": 119, + "control_top1_age_ms": 119000, + "event_index": 1188, + "modality": "text", + "query_embedding_sha256": "2752b29a35a09804ee4a0838dae24f4b421c08b638b2343323a195c70435b8a0", + "query_ordinal": 47, + "query_timestamp": 1700001188000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "ed4a524207fffc11a5fe4d703b8551e60733aeff55131a9e6580a6fe4401bac7", + "control_graph_rank_sha256": "263e6bf354057c39ce9e396b66b72ead1499bcf16c47ff4bf7106465985e3b66", + "control_public_rank_sha256": "32634839e516e05da9bcc970a9d1298975711ef5d2c9975d981ea08d671ec142", + "control_seed_rank_sha256": "ed4a524207fffc11a5fe4d703b8551e60733aeff55131a9e6580a6fe4401bac7", + "control_top1_age_events": 695, + "control_top1_age_ms": 695000, + "event_index": 1216, + "modality": "text", + "query_embedding_sha256": "8c127674d51450e22aaaa8d3a040a26e7ed2ef2b174d1d1ef38443a85e9e86a7", + "query_ordinal": 48, + "query_timestamp": 1700001216000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "d06f11afa0e50bd55db46daf52add40fde1a7fd890bef3e8ba51444d4ef4b73e", + "control_graph_rank_sha256": "8ff257f4bec66c8d3ed6492619d62aef2e08453b2c85d70942a95c3a4a401524", + "control_public_rank_sha256": "7df15a6c052592c18c267de688c8abe99a559fae9f20f1c3e8485c2a6bc6811d", + "control_seed_rank_sha256": "d06f11afa0e50bd55db46daf52add40fde1a7fd890bef3e8ba51444d4ef4b73e", + "control_top1_age_events": 378, + "control_top1_age_ms": 378000, + "event_index": 1241, + "modality": "text", + "query_embedding_sha256": "1964649e7579130f9f03037390124922b3484a6a06bd4cdc6e70e56b4eb1053d", + "query_ordinal": 49, + "query_timestamp": 1700001241000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "030e53bee7ac2653acd59df17e3b340c50b299d009cfca389466863cbc3817bf", + "control_graph_rank_sha256": "0804bbd4149622517514d1fd502408af508f2bc16f88dd9e51535859ebf82533", + "control_public_rank_sha256": "022474ebdee80e9d10c3c256028460f9acd39c91a7b3dac02fa98e366cb5fa7a", + "control_seed_rank_sha256": "030e53bee7ac2653acd59df17e3b340c50b299d009cfca389466863cbc3817bf", + "control_top1_age_events": 165, + "control_top1_age_ms": 165000, + "event_index": 1261, + "modality": "text", + "query_embedding_sha256": "41c4add6e212e341d9de6b2f2edaa62654fe7ccd32d7bbe2ff6a5eecc6488c6c", + "query_ordinal": 50, + "query_timestamp": 1700001261000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "8d0364b7d39753b3128fcac7c47890ca57dfa1d8dc4304b440389945ac308305", + "control_graph_rank_sha256": "1e4e5f47e533295e9509333ce26175f13bb1fd87300d65ae61d29071b9628882", + "control_public_rank_sha256": "505dc10219818fa77410d0bae71437e86e138be10b5386530a71b366e809ef55", + "control_seed_rank_sha256": "8d0364b7d39753b3128fcac7c47890ca57dfa1d8dc4304b440389945ac308305", + "control_top1_age_events": 7, + "control_top1_age_ms": 7000, + "event_index": 1287, + "modality": "text", + "query_embedding_sha256": "e0f78ff57939e1e03c6052810d89cca55911ec5856b80e4d735bf1635ee8db0c", + "query_ordinal": 51, + "query_timestamp": 1700001287000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "50bb5aee59a3662129b161686348742e54452013620794df0542a756788c7c48", + "control_graph_rank_sha256": "bb21d1a6ace739528c3e9fed767ad2a1d2d329cd57f46519b2b949e63b1a0039", + "control_public_rank_sha256": "40ae241a2f4abd5a923227d323e8a3463afbff7fa3ece33208f785371c20d307", + "control_seed_rank_sha256": "50bb5aee59a3662129b161686348742e54452013620794df0542a756788c7c48", + "control_top1_age_events": 143, + "control_top1_age_ms": 143000, + "event_index": 1316, + "modality": "text", + "query_embedding_sha256": "d268e5887114009a6eb25d85f13d1376ff402a1566c1fdb87bc8ee21e0724076", + "query_ordinal": 52, + "query_timestamp": 1700001316000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "6aeafea6f54dd3a99ae8d795c0a31183857b5ba8e9d065d25ce692662f1680b2", + "control_graph_rank_sha256": "2573033f1e640f0bab4740866c8537a29b17afea1fea63dd2087290db3120603", + "control_public_rank_sha256": "da9b910ccb70397151fda2090fdafce288e19c654244d31f903ccf714ae2faf5", + "control_seed_rank_sha256": "6aeafea6f54dd3a99ae8d795c0a31183857b5ba8e9d065d25ce692662f1680b2", + "control_top1_age_events": 530, + "control_top1_age_ms": 530000, + "event_index": 1342, + "modality": "text", + "query_embedding_sha256": "cc89e720ea21c7bc2cf8fdc04bbdda9efa8b8a590252b6dcf28a300ddda3910e", + "query_ordinal": 53, + "query_timestamp": 1700001342000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "c9575dd8cc300de4f5c12375302fa6f0f316937e54cd11610e2cdf2ca8ac34bd", + "control_graph_rank_sha256": "4e2ad70c43ba1dd6677b9e5e0876e5bf46ace866ba1880fcc4f309ec6aca6304", + "control_public_rank_sha256": "6a5947ad1b2fab970f8c9fae01fb12e984457739226c0434cd4a9fa2067413f3", + "control_seed_rank_sha256": "c9575dd8cc300de4f5c12375302fa6f0f316937e54cd11610e2cdf2ca8ac34bd", + "control_top1_age_events": 661, + "control_top1_age_ms": 661000, + "event_index": 1368, + "modality": "text", + "query_embedding_sha256": "fa168f726f4f96ed27ecf777f72848213f9da43fdff9e1f841cc001c2b70ccfb", + "query_ordinal": 54, + "query_timestamp": 1700001368000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "eb586c09fa52c29d01635742367b394fd3c468f787e4a374e009e51ff96a84b4", + "control_graph_rank_sha256": "375206831e372e2880c263f996242ef561dc2c2693e07a10de07c4875b77ec39", + "control_public_rank_sha256": "bc7b1134c5c8d6968e3d2db678142eafc1eb1f3b429b64812daefe21b8eca536", + "control_seed_rank_sha256": "eb586c09fa52c29d01635742367b394fd3c468f787e4a374e009e51ff96a84b4", + "control_top1_age_events": 567, + "control_top1_age_ms": 567000, + "event_index": 1395, + "modality": "text", + "query_embedding_sha256": "5cac7b2862f7544f77987a92963cf591145300953efbc192116f9cee8bdf3b1f", + "query_ordinal": 55, + "query_timestamp": 1700001395000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "6537b2dcc0071a42adca5806d880a462528ce607fd4c08dad5d443acc2879468", + "control_graph_rank_sha256": "ddd4fbe972e89bb5980ad57c479d93dab6b56121b0cc30efbd25d97b47bfdb96", + "control_public_rank_sha256": "a8bda8f7c636c6fbd9d5d17e02b0082af6e9883225ce1ef219434643aad8da61", + "control_seed_rank_sha256": "6537b2dcc0071a42adca5806d880a462528ce607fd4c08dad5d443acc2879468", + "control_top1_age_events": 34, + "control_top1_age_ms": 34000, + "event_index": 1420, + "modality": "text", + "query_embedding_sha256": "0e3779c63bb962b049877742e47e13665711638cd35c7bc72c68de34b642d68b", + "query_ordinal": 56, + "query_timestamp": 1700001420000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "9a98f28d5ad4da4fd9aa646386acded3ea64c2102c82a84bdfd44494c88d7c6c", + "control_graph_rank_sha256": "00ae9bcbf117ab173e383b6377a7a98c730e15f40e5eeaddb2ac28649146950c", + "control_public_rank_sha256": "77c1c22552ba3c5ab9fb8e9db5ff12d7c12fb37e062ea0b986765343a5683b2b", + "control_seed_rank_sha256": "9a98f28d5ad4da4fd9aa646386acded3ea64c2102c82a84bdfd44494c88d7c6c", + "control_top1_age_events": 466, + "control_top1_age_ms": 466000, + "event_index": 1443, + "modality": "text", + "query_embedding_sha256": "ce4302b471993d55ae870395911167861650ad064d23d437df4e169e8759831c", + "query_ordinal": 57, + "query_timestamp": 1700001443000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "d86ccd29fd50f574413326004fe3a1237aba06be07a61bef64bdc4f26cc5ffb9", + "control_graph_rank_sha256": "57afd64dc6f7a8c29d119365dc09f525ba191b9495364adde1678c553a554ad1", + "control_public_rank_sha256": "c473295b32332a793026e7872c3e0a47c28155a97c42d06bdfa94ab09375d4d0", + "control_seed_rank_sha256": "d86ccd29fd50f574413326004fe3a1237aba06be07a61bef64bdc4f26cc5ffb9", + "control_top1_age_events": 5, + "control_top1_age_ms": 5000, + "event_index": 1466, + "modality": "text", + "query_embedding_sha256": "9be981e0263406eee243c78c2655277af838770969afca791a64ac12e2fa5360", + "query_ordinal": 58, + "query_timestamp": 1700001466000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "aa9b7078d671afdc80fe54c9c0224e9001c6fc598e0e20b7540f27add042bd43", + "control_graph_rank_sha256": "c76ab99e59ef3bf2ef947049bbf663a3ef6be65dd00ec3b869d8517bb1a72c2d", + "control_public_rank_sha256": "a6b49ad3980a30efa79d81a374233f83b21d783b2c14d87d56b91dda36eab7f9", + "control_seed_rank_sha256": "aa9b7078d671afdc80fe54c9c0224e9001c6fc598e0e20b7540f27add042bd43", + "control_top1_age_events": 175, + "control_top1_age_ms": 175000, + "event_index": 1491, + "modality": "text", + "query_embedding_sha256": "276cf43598270919e18991ef0dc569014835e40d5401d6f1d2030777bc63bf8d", + "query_ordinal": 59, + "query_timestamp": 1700001491000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "e30277d5891741bcfae5e1883f062a6a322234c772920185543ed66b325fed01", + "control_graph_rank_sha256": "fbee4d8b823ba1935948a06b39e3138f4e69c50b395e195b1b51454f7aeaeb16", + "control_public_rank_sha256": "6521986401dbf4b757f754bdb045041300133fdf34b195bcf3ed94b315728032", + "control_seed_rank_sha256": "e30277d5891741bcfae5e1883f062a6a322234c772920185543ed66b325fed01", + "control_top1_age_events": 14, + "control_top1_age_ms": 14000, + "event_index": 1514, + "modality": "text", + "query_embedding_sha256": "649ea523210ca909df398357643817230435425c47d77acfb847466a8b290aab", + "query_ordinal": 60, + "query_timestamp": 1700001514000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "59f0064363efb6ef98887ae2bda7f3a062249826c2a5287a7551a8009f03fc8e", + "control_graph_rank_sha256": "7b52e5da928f2a29adf40c3af0c7a320f74d54a0b22b8522f51da264252313ab", + "control_public_rank_sha256": "c9b0e006a6fc47be317840faaf4baf5976edc913f657fc8416a526c95d24e33d", + "control_seed_rank_sha256": "59f0064363efb6ef98887ae2bda7f3a062249826c2a5287a7551a8009f03fc8e", + "control_top1_age_events": 728, + "control_top1_age_ms": 728000, + "event_index": 1540, + "modality": "text", + "query_embedding_sha256": "b78288f7542ec81f94e7e28c73d7fe57b4690275fe393213727dc63daaa68986", + "query_ordinal": 61, + "query_timestamp": 1700001540000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "2e95b7ae61266fbe779d261fd7866f47b01f8918141651809083c5006a3875f3", + "control_graph_rank_sha256": "91016e69cfe9c9acfb8548fa954e78038a549dee4ef33c03fd235ad355f464ee", + "control_public_rank_sha256": "66e24ca05b5c0cce44a0b0ee1171f4680392a9636f18c05bf2daed461321301a", + "control_seed_rank_sha256": "2e95b7ae61266fbe779d261fd7866f47b01f8918141651809083c5006a3875f3", + "control_top1_age_events": 117, + "control_top1_age_ms": 117000, + "event_index": 1563, + "modality": "text", + "query_embedding_sha256": "0f5690bebf056b37ffda20883e058c63d52b8bc59a20f1eb9d358383ea1082ff", + "query_ordinal": 62, + "query_timestamp": 1700001563000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "58121d2f19249e2eab444d69b671bc4f55ce5d304b492a893751a3ec7ddf067c", + "control_graph_rank_sha256": "24c9cd714ec34021fadd22362607661ca62836e1b42850758c28a871e9db5468", + "control_public_rank_sha256": "036ae868a1d119c4d6fc2984a570b64ec3ec1bbcbec10cec148f26d406102289", + "control_seed_rank_sha256": "58121d2f19249e2eab444d69b671bc4f55ce5d304b492a893751a3ec7ddf067c", + "control_top1_age_events": 25, + "control_top1_age_ms": 25000, + "event_index": 1589, + "modality": "text", + "query_embedding_sha256": "c25292c732099d7660da8bcfd624a3d83bae8ef91da81fabd6d2be56523c3b32", + "query_ordinal": 63, + "query_timestamp": 1700001589000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "12e13d3646fdbd5cdda858045b2721a1428a57259eac5fab5a68fdc13e7ef50c", + "control_graph_rank_sha256": "ccec025e4f90260eb0f032d5516b44f2b08f3108c1c597fd1cad42ec51312e92", + "control_public_rank_sha256": "b725818b3870ed9e4f79da5f0de4cdbec53018c3b191550fcee67e4b8b8d70e0", + "control_seed_rank_sha256": "12e13d3646fdbd5cdda858045b2721a1428a57259eac5fab5a68fdc13e7ef50c", + "control_top1_age_events": 452, + "control_top1_age_ms": 452000, + "event_index": 1615, + "modality": "text", + "query_embedding_sha256": "41cc2d291c6b901f03b76631c3a027db9be7da0ced85d352521a88388437645f", + "query_ordinal": 64, + "query_timestamp": 1700001615000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "225a80423af6679dae3419c124ebaa2400a67e54661d0dc87e31e05977483273", + "control_graph_rank_sha256": "34fb71232750eb38123229d012b6e878f5e3327fc62c686ecff800a50564ca56", + "control_public_rank_sha256": "6792c157eb73f1e9e6f4348d648a1f83656f6eac04595a479695f76632071642", + "control_seed_rank_sha256": "225a80423af6679dae3419c124ebaa2400a67e54661d0dc87e31e05977483273", + "control_top1_age_events": 943, + "control_top1_age_ms": 943000, + "event_index": 1642, + "modality": "text", + "query_embedding_sha256": "63f612c8a4dddbff4b265ee3b36dac0ff7159fba56ef56cecdba781b180a4df5", + "query_ordinal": 65, + "query_timestamp": 1700001642000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "e3dbc4408e5d79efa60d72c2df640a71782b962dc8b8d258077adaa6a9cf33b3", + "control_graph_rank_sha256": "4e0a5ae01d1ac198156134cf447de47e9661963721fe352398854917320f131e", + "control_public_rank_sha256": "8f922dc476369de53c6c43409c338bfd9d12076de3f4481e3f1db518362ff654", + "control_seed_rank_sha256": "e3dbc4408e5d79efa60d72c2df640a71782b962dc8b8d258077adaa6a9cf33b3", + "control_top1_age_events": 593, + "control_top1_age_ms": 593000, + "event_index": 1662, + "modality": "text", + "query_embedding_sha256": "a8151ede6bc15dd0cf972d2ace018339f86d57dad8bb3ea0ded3c1e3999a70f8", + "query_ordinal": 66, + "query_timestamp": 1700001662000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "01b43787596de710b58f446df9eec3f124096566fdb8841c7536185f43b947f8", + "control_graph_rank_sha256": "4cf3668c58b57e0a39474bc4f3620fb88f9478fb7f88470940662d6927bf8c26", + "control_public_rank_sha256": "577ef959f6252114af47d5d6133e8ffcd7a147e7cf7cb48547300dcc2929745e", + "control_seed_rank_sha256": "01b43787596de710b58f446df9eec3f124096566fdb8841c7536185f43b947f8", + "control_top1_age_events": 211, + "control_top1_age_ms": 211000, + "event_index": 1685, + "modality": "text", + "query_embedding_sha256": "9a46bda78067df434f0e77b03a9616b8efb31d7cd3eda14ef5acca638750a1d9", + "query_ordinal": 67, + "query_timestamp": 1700001685000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "e2671bfb7893c539352ce5a16daf2b72643d5333859d0ec8a3ae9f79647b2e15", + "control_graph_rank_sha256": "5b288198208f218c7f8feb1044119400e0b88cfe0f9444acdbf0b4b1794e35c9", + "control_public_rank_sha256": "cfc3e3bbb71c392f5b1ee904928acf159932aa6bdc6ece7df918643240394f28", + "control_seed_rank_sha256": "e2671bfb7893c539352ce5a16daf2b72643d5333859d0ec8a3ae9f79647b2e15", + "control_top1_age_events": 195, + "control_top1_age_ms": 195000, + "event_index": 1709, + "modality": "text", + "query_embedding_sha256": "60fdf6d9957e918329b9de87299164270dcd20eb9cda26ce76d6f48b9f2e812d", + "query_ordinal": 68, + "query_timestamp": 1700001709000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "c0169e8659cc8043e66e27e14a95c7a8aaf160ffb93c2342e870058b477daa75", + "control_graph_rank_sha256": "5c54daf6345aebdac4324472f865d800ddf2d81e0eac5fbab3a83744552a5994", + "control_public_rank_sha256": "0d66fc3cc3a2dbe25d94a8011642aaafbd473bb31051c60fade20426948cda1e", + "control_seed_rank_sha256": "c0169e8659cc8043e66e27e14a95c7a8aaf160ffb93c2342e870058b477daa75", + "control_top1_age_events": 30, + "control_top1_age_ms": 30000, + "event_index": 1735, + "modality": "text", + "query_embedding_sha256": "16cdc5323a50dc0a0d249a5835766782aa12d7c7f9ed48000727fb5e4721927f", + "query_ordinal": 69, + "query_timestamp": 1700001735000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "9a829e2377db373a192baa36f780eec20e671cf34ed7982d5b14978cefad720f", + "control_graph_rank_sha256": "eddc03db798af9ea2063bfeb752a49e21fb9e8934464ab8b80ecb48f1a662c9a", + "control_public_rank_sha256": "40cd19b73ff5c32ff87c114f0c080ee7afcf3cc5e4e80e1864136a915db8a421", + "control_seed_rank_sha256": "9a829e2377db373a192baa36f780eec20e671cf34ed7982d5b14978cefad720f", + "control_top1_age_events": 948, + "control_top1_age_ms": 948000, + "event_index": 1760, + "modality": "text", + "query_embedding_sha256": "6c4832218b2fc8c02ba4fae7649d830076410ebdfd652bb88c11293a8b27d12c", + "query_ordinal": 70, + "query_timestamp": 1700001760000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "0721861630ef53700188a5d6ce336fbbd1ce84ae5df3c652ebd7cdb0d4a9cdd0", + "control_graph_rank_sha256": "827b11c82037edbc3f80f3b0168a1361f1c9fc2d84ae12d67a9513156d8e2d2e", + "control_public_rank_sha256": "564da5757f8c526d1e9dea4fc42a28d8dd6037f308016dd0c1932044f9119151", + "control_seed_rank_sha256": "0721861630ef53700188a5d6ce336fbbd1ce84ae5df3c652ebd7cdb0d4a9cdd0", + "control_top1_age_events": 456, + "control_top1_age_ms": 456000, + "event_index": 1784, + "modality": "text", + "query_embedding_sha256": "e968d9d074e0a5574c939ebb7c3af42b7286ec43a8be899a2a0410339db68bea", + "query_ordinal": 71, + "query_timestamp": 1700001784000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "571340a56aa0ce09b1c535a95adcdf75d47e861d4055b47a4624066540c83347", + "control_graph_rank_sha256": "0679179f5d84b4ea3785eff419c4b97f6b95f8d42aa71808ab0a59cdcb3bccd5", + "control_public_rank_sha256": "f923ccbaa8bd9731620e3711a17f48250198eb6218c376d55bdced4275bc31b5", + "control_seed_rank_sha256": "571340a56aa0ce09b1c535a95adcdf75d47e861d4055b47a4624066540c83347", + "control_top1_age_events": 274, + "control_top1_age_ms": 274000, + "event_index": 1809, + "modality": "text", + "query_embedding_sha256": "94355657643b626f6445c8115a45b47b6c7af15a7a61656f53ba5939998e57fb", + "query_ordinal": 72, + "query_timestamp": 1700001809000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "2d75e327859f789deb888c5885ad165925d01292ef306f6b00606d06afb04a0c", + "control_graph_rank_sha256": "2dd4c1a68e4e547ffcba22cafdae74e44dd1bd237fe5c87f83a43286be3e27c2", + "control_public_rank_sha256": "0f5217064ffa2e252e725be485ac147f879d9735a67181256fb02103eca72757", + "control_seed_rank_sha256": "2d75e327859f789deb888c5885ad165925d01292ef306f6b00606d06afb04a0c", + "control_top1_age_events": 9, + "control_top1_age_ms": 9000, + "event_index": 1836, + "modality": "text", + "query_embedding_sha256": "eecdc9b9313cac086f7fc5edd56d415944e7b873617fef8b34dcee0fa04e33c8", + "query_ordinal": 73, + "query_timestamp": 1700001836000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "62c12cdcff79e5bc8af3ed4cbf047bce7b702378d1eaeed3aa52958b57824119", + "control_graph_rank_sha256": "eaffeb0e60f8ac4833675f18423fa214cb6848df0da837c9b77bc4f199925dca", + "control_public_rank_sha256": "ee269c20258aeb4d705a97381f8824ad5b3b6a666985bfd5cba2f600bc85c1b7", + "control_seed_rank_sha256": "62c12cdcff79e5bc8af3ed4cbf047bce7b702378d1eaeed3aa52958b57824119", + "control_top1_age_events": 1162, + "control_top1_age_ms": 1162000, + "event_index": 1861, + "modality": "text", + "query_embedding_sha256": "80031e4d2fa964ea0cb479c30f867034010419c6f11f3c8434295f1d146bb2b3", + "query_ordinal": 74, + "query_timestamp": 1700001861000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "d3f27d0eb4bf1cc238d4c80cf6f2a416478ce30c1b0e8c4e936d461dfedba388", + "control_graph_rank_sha256": "4cca6d2b9f85e4025704109272594e55fce2a299698d4ea20131ad00b203dd9e", + "control_public_rank_sha256": "a70a5fad6249e598dbd751e5589560a5cbe7b7cc9b23316d4057954ffc7748b7", + "control_seed_rank_sha256": "d3f27d0eb4bf1cc238d4c80cf6f2a416478ce30c1b0e8c4e936d461dfedba388", + "control_top1_age_events": 1546, + "control_top1_age_ms": 1546000, + "event_index": 1883, + "modality": "text", + "query_embedding_sha256": "80bff21cbebc7cbc7c055b9edc0e58941b5905bf8bc043c85d686495875c8c4b", + "query_ordinal": 75, + "query_timestamp": 1700001883000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "ff0510ad7b36f079265f19d136985f799133e34ba50f87c2167cdfddac86db99", + "control_graph_rank_sha256": "fdae22d50d84e26f4df35a0a4a00ae16927f0edc336679b8c23b5c4c9f8a422a", + "control_public_rank_sha256": "b4381fcac76be810c7f25e46b09eab89660c9f65e123bf707031433cb92f08d2", + "control_seed_rank_sha256": "ff0510ad7b36f079265f19d136985f799133e34ba50f87c2167cdfddac86db99", + "control_top1_age_events": 3, + "control_top1_age_ms": 3000, + "event_index": 1910, + "modality": "text", + "query_embedding_sha256": "f8e62a2d63403e4f1a4ca7fb23ebacb5e6c04887dc24f00cd3c8e0b32cecd639", + "query_ordinal": 76, + "query_timestamp": 1700001910000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "0b1976f439204a91a53cb6a3e2619004f49ad76fea47af4dc65fc5ce24c1f882", + "control_graph_rank_sha256": "9befaeae4472bb3bde18ca56f57324745e1df3f61903e7d6566e29754dcfbab9", + "control_public_rank_sha256": "cc28cd833279c4c751203bacb757a7ef0f9687564835e969ac81fed38f7647f1", + "control_seed_rank_sha256": "0b1976f439204a91a53cb6a3e2619004f49ad76fea47af4dc65fc5ce24c1f882", + "control_top1_age_events": 919, + "control_top1_age_ms": 919000, + "event_index": 1935, + "modality": "text", + "query_embedding_sha256": "683ad013465f301923eb5e8d25086f74f9ff98b2e057da913196351b63cef492", + "query_ordinal": 77, + "query_timestamp": 1700001935000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "5210493662cb34851a5acf527f536ad0ffce1935eb06e19a1a6f6026c319a88a", + "control_graph_rank_sha256": "6f18408131643c0df0ca9550cd908c96a5c32b4e92d533baf341cb4d940f56bb", + "control_public_rank_sha256": "ccf78a598b97715001a324a70dfa3ce84984ef347fe93d15545951bcc76b53e7", + "control_seed_rank_sha256": "5210493662cb34851a5acf527f536ad0ffce1935eb06e19a1a6f6026c319a88a", + "control_top1_age_events": 1237, + "control_top1_age_ms": 1237000, + "event_index": 1964, + "modality": "text", + "query_embedding_sha256": "833fe3bf81996fe660c841b0260de25ad68ab9137a84123d7ac7bde699a074b2", + "query_ordinal": 78, + "query_timestamp": 1700001964000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "7b775e0e36ca6eb41fc06b4d8e46bbfb8b4b47ed1c13c0f7748d302a0fe0ce76", + "control_graph_rank_sha256": "daa598ac0208f2c8a228b7c897d958140452ecef780c1489853ff912092be3d5", + "control_public_rank_sha256": "d76094f8cdae9d1839429fb43db9f6f17c476b1ee301b9cbc8663a9fbf543be6", + "control_seed_rank_sha256": "7b775e0e36ca6eb41fc06b4d8e46bbfb8b4b47ed1c13c0f7748d302a0fe0ce76", + "control_top1_age_events": 1201, + "control_top1_age_ms": 1201000, + "event_index": 1986, + "modality": "text", + "query_embedding_sha256": "bb5f2e70689bd2332c1c102467ce9a06461900ad67626e58d4fd8c0a7453d46d", + "query_ordinal": 79, + "query_timestamp": 1700001986000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "42a93d6130df682e1a7e6b0ebcf12eb3c9cd2e7032150dd2e4c3fb59fd5ffd84", + "control_graph_rank_sha256": "e27a5398423b7b6dd3fa30c902371f9f84bbefd9e1dfac06fb9fc102ef78700e", + "control_public_rank_sha256": "bdeb7e64039d2034f5abebd871be71162909a80912500366686a6487049f676b", + "control_seed_rank_sha256": "42a93d6130df682e1a7e6b0ebcf12eb3c9cd2e7032150dd2e4c3fb59fd5ffd84", + "control_top1_age_events": 566, + "control_top1_age_ms": 566000, + "event_index": 2009, + "modality": "text", + "query_embedding_sha256": "e55b2fd708e8ac28d13c7a05b129885c87b48c98294e99ad49cbcbfc3c56d0e2", + "query_ordinal": 80, + "query_timestamp": 1700002009000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "40823b36c6cd3434ef08182e01c40441646a2b7662e676bf922986add499514b", + "control_graph_rank_sha256": "24a915da4f5149095b6cc93ebaad154791c8211a0156d2b24b8e70808691c242", + "control_public_rank_sha256": "4c290f4a3f05cb188ebc107a6271ddb055e35d97c057f2a1d09e28a8085ac4d3", + "control_seed_rank_sha256": "40823b36c6cd3434ef08182e01c40441646a2b7662e676bf922986add499514b", + "control_top1_age_events": 406, + "control_top1_age_ms": 406000, + "event_index": 2035, + "modality": "text", + "query_embedding_sha256": "2282a1f1c5dc5327c8335e3ff7827a4ae77ba4118ca3592b07603d23712f05f1", + "query_ordinal": 81, + "query_timestamp": 1700002035000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "abead9a97c586251338eb6f23a93d53e2e1a361f1e7da5828125b1dd7f7b0cff", + "control_graph_rank_sha256": "828e31666bab6cf3a999b58a50cdbda0ae8babf9e31fb9e927f02ef53e52a8c7", + "control_public_rank_sha256": "dad332d7a350203f1a7aece5ef4f714ee8b4ca35b4c144175a927d30cc1a04c4", + "control_seed_rank_sha256": "abead9a97c586251338eb6f23a93d53e2e1a361f1e7da5828125b1dd7f7b0cff", + "control_top1_age_events": 955, + "control_top1_age_ms": 955000, + "event_index": 2061, + "modality": "text", + "query_embedding_sha256": "d8d35cafa233f17ca21e8b86e616406ee3d1d591354aee346810bd21f354a9dc", + "query_ordinal": 82, + "query_timestamp": 1700002061000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "30482b737c2c385ee56ada16e6be1738ca5cb19a6e34fae6e3bae57696b76c78", + "control_graph_rank_sha256": "e351f917df077e04fbf5bf9de8f28571e0ebd8c75225249f0c9f19325e96573d", + "control_public_rank_sha256": "94539c29295fb7a9569f7f38e1575ad40dbda77a1dfe9b8a5575a7006ad422f8", + "control_seed_rank_sha256": "30482b737c2c385ee56ada16e6be1738ca5cb19a6e34fae6e3bae57696b76c78", + "control_top1_age_events": 16, + "control_top1_age_ms": 16000, + "event_index": 2082, + "modality": "text", + "query_embedding_sha256": "75a9c5c106707596850dabdab712dbe9960da4732e3edb860609b8a378020403", + "query_ordinal": 83, + "query_timestamp": 1700002082000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "d881613ed485df0af1139f726933b28d39a38833a49121e51e903eafe10f3594", + "control_graph_rank_sha256": "d905b41bde52427fc790f5e77b8a7408bb345ba29cab1e1e8cfc841f301e53fa", + "control_public_rank_sha256": "e8f8b5f13a8e112bc454ab382c11dc193644dc723ca338ba37d34d9cb10f7c15", + "control_seed_rank_sha256": "d881613ed485df0af1139f726933b28d39a38833a49121e51e903eafe10f3594", + "control_top1_age_events": 595, + "control_top1_age_ms": 595000, + "event_index": 2109, + "modality": "text", + "query_embedding_sha256": "591c825e4bbe9475ebbe7f2737f24705551c18e33aff2fb3a4be377a20ed2420", + "query_ordinal": 84, + "query_timestamp": 1700002109000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "23118f0c00bcd7f322802b2942758ffe8b9ac8ab98d0a19294fe12e4635275e4", + "control_graph_rank_sha256": "fd3b40eb1b3a01b552a6afe129cc35b359c1b21a42f9ce59e07a2b7c966f613b", + "control_public_rank_sha256": "29da6cb011c26c0dd5368a6dc97a3ce4f2f82871e91a7e45a662262930d0361c", + "control_seed_rank_sha256": "23118f0c00bcd7f322802b2942758ffe8b9ac8ab98d0a19294fe12e4635275e4", + "control_top1_age_events": 324, + "control_top1_age_ms": 324000, + "event_index": 2133, + "modality": "text", + "query_embedding_sha256": "bf86bb0c88770d1494a5eb66818e007d8f82e23f19659201f6017996d306892c", + "query_ordinal": 85, + "query_timestamp": 1700002133000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "f5fbb8aacdfef9c9d48c3bccb07b1b72cba11f8749d7d4aa23d87d21e7d46032", + "control_graph_rank_sha256": "c0829a1d019ec439901aa79b02141c6758f8a29d032ee80cfc40c50260da2fea", + "control_public_rank_sha256": "27dc6f6a4c1edbe64596ba7b85d41a48bc40472a42ce2fd382c53c9c9a2ec1e7", + "control_seed_rank_sha256": "f5fbb8aacdfef9c9d48c3bccb07b1b72cba11f8749d7d4aa23d87d21e7d46032", + "control_top1_age_events": 24, + "control_top1_age_ms": 24000, + "event_index": 2157, + "modality": "text", + "query_embedding_sha256": "a75ef194b4ea303be461b578f224db98499d3b915ef15f1de6ce0b237ae31b52", + "query_ordinal": 86, + "query_timestamp": 1700002157000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "4ae85a64ed30c2fabf93bb6c2cd608679e68fc92db0a802b599113795fb829e1", + "control_graph_rank_sha256": "37e1d2957a00018d912b4bf3da0cce09e8826144e10160c80169e2194eadee3a", + "control_public_rank_sha256": "1326532f1cd0548f888f0fa168cf9243a5437e9469a95617ee3cec27c7b3e2fb", + "control_seed_rank_sha256": "4ae85a64ed30c2fabf93bb6c2cd608679e68fc92db0a802b599113795fb829e1", + "control_top1_age_events": 419, + "control_top1_age_ms": 419000, + "event_index": 2179, + "modality": "text", + "query_embedding_sha256": "db033f19a4b4bf04fedec6825700f79b9ec1c522ded2e7c4ee739dc421ca5f93", + "query_ordinal": 87, + "query_timestamp": 1700002179000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "41a1e78d009781dbf314bc143bfc618e257853911a652a00a13953d737b663ca", + "control_graph_rank_sha256": "7850a785a9f0e365e7415621bfd6fd704f43a2dd465c4924ca830606f95a7358", + "control_public_rank_sha256": "b30dda86c9eb9680d573caf52b0ccc22b8fdc9d58875ffe4dddefb4f133f320f", + "control_seed_rank_sha256": "41a1e78d009781dbf314bc143bfc618e257853911a652a00a13953d737b663ca", + "control_top1_age_events": 77, + "control_top1_age_ms": 77000, + "event_index": 2205, + "modality": "text", + "query_embedding_sha256": "ed6192aa6cd94b0730b56bdd15e68ef15522b1485c0189e997945d6bde32ceff", + "query_ordinal": 88, + "query_timestamp": 1700002205000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "4f3315d5a71d00f97b09ca6cfd581b0e21c6d2995334c65a19bcb6c1d5e1d86b", + "control_graph_rank_sha256": "cafbdf4b8265a156ec613b38a23a9a9bb3318efc5dc4c70a16db20a6a4757f06", + "control_public_rank_sha256": "71e329ab198849d8757f1c876074da384c68b18eb0cb047e5cec39aa3a9e35c7", + "control_seed_rank_sha256": "4f3315d5a71d00f97b09ca6cfd581b0e21c6d2995334c65a19bcb6c1d5e1d86b", + "control_top1_age_events": 586, + "control_top1_age_ms": 586000, + "event_index": 2229, + "modality": "text", + "query_embedding_sha256": "7762ad7b5223e22333218469a169d6125565bf3177c0a8a244a020efc31c04c1", + "query_ordinal": 89, + "query_timestamp": 1700002229000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "ffe2b003e5b0e88466191ac7ecc10fbdec5118be2aab74522a455542a5fea447", + "control_graph_rank_sha256": "fa20498c88c8264a462b388c7b457bdb80b37796f2017697f80ae2788059a7b5", + "control_public_rank_sha256": "1da003bb88347ccc8de86ac5a597efbace33e8ae005697a725ef0e0eb2b3d57a", + "control_seed_rank_sha256": "ffe2b003e5b0e88466191ac7ecc10fbdec5118be2aab74522a455542a5fea447", + "control_top1_age_events": 18, + "control_top1_age_ms": 18000, + "event_index": 2255, + "modality": "text", + "query_embedding_sha256": "53f305df2cde05001146a63ea4d3b33b25f110cce0ab8ea88ea97980bb340943", + "query_ordinal": 90, + "query_timestamp": 1700002255000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "5fdd9c93c5a9a2ab8dd9bbe995cd989dcef1b9f4e67942f7ffd0a7a313a08fdb", + "control_graph_rank_sha256": "b25e2820bbeaa0fe8f687c6352593c2646f9b64ea0c38944853f81a8f31ad5c7", + "control_public_rank_sha256": "facddac33df48482ea054d10b74126777d1f1500a598ca54d7779cbd09f0b5fb", + "control_seed_rank_sha256": "5fdd9c93c5a9a2ab8dd9bbe995cd989dcef1b9f4e67942f7ffd0a7a313a08fdb", + "control_top1_age_events": 405, + "control_top1_age_ms": 405000, + "event_index": 2278, + "modality": "text", + "query_embedding_sha256": "649ea523210ca909df398357643817230435425c47d77acfb847466a8b290aab", + "query_ordinal": 91, + "query_timestamp": 1700002278000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "20ddac4d138e240336268aeabfd68069296b785c827be6ab39069894d44426b3", + "control_graph_rank_sha256": "b48458ff928826756dd15dbb8a0b04946968741ccfa9233c5053d65148fb883c", + "control_public_rank_sha256": "781d36867a18f44793382052931a918be8a0fafe9aad8de289cf32ca27d0a864", + "control_seed_rank_sha256": "20ddac4d138e240336268aeabfd68069296b785c827be6ab39069894d44426b3", + "control_top1_age_events": 496, + "control_top1_age_ms": 496000, + "event_index": 2305, + "modality": "text", + "query_embedding_sha256": "3492d6127c394d617e88a3d6b57f74253a953b67f68e84cec45abc6d45263219", + "query_ordinal": 92, + "query_timestamp": 1700002305000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "1b6f4852e87ab8e55d03c29ed32cf8841b2849b7e57f142c2498f020a05f9dce", + "control_graph_rank_sha256": "05e057781be7c379119598362739b5337f1bf5276f97f74aa0afbe8cb0f4e4d3", + "control_public_rank_sha256": "6ad206ab4382dd9067bfc8bce0744d5f01c8e9bff737a5b5f766e80e66c94d9e", + "control_seed_rank_sha256": "1b6f4852e87ab8e55d03c29ed32cf8841b2849b7e57f142c2498f020a05f9dce", + "control_top1_age_events": 4, + "control_top1_age_ms": 4000, + "event_index": 2332, + "modality": "text", + "query_embedding_sha256": "93c715c0e5b5ca6db140a8092e0768872c3a3d4e4a4815b6b417c94ca003c294", + "query_ordinal": 93, + "query_timestamp": 1700002332000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "ec55ef92c31660248186fb7c385f7913f5f2eca35bdb3d6278f229a895a3810d", + "control_graph_rank_sha256": "e94805683ce2d605415a136314b4ca46d04f793a1ca06a7a890d7ce8e2ec383e", + "control_public_rank_sha256": "560d8b0ede15838ec95717fad148785364d61e81b37b4a12d03476de5b290e7d", + "control_seed_rank_sha256": "ec55ef92c31660248186fb7c385f7913f5f2eca35bdb3d6278f229a895a3810d", + "control_top1_age_events": 224, + "control_top1_age_ms": 224000, + "event_index": 2357, + "modality": "text", + "query_embedding_sha256": "210cc268c894d4dd4ca2ceed77af657c5807d5b462a85a0e94111b8775e13c65", + "query_ordinal": 94, + "query_timestamp": 1700002357000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "3ce102606bc327505692fb0eaf270b6834354582b221fc3b14b766e2ee356158", + "control_graph_rank_sha256": "30c9b00d63605fd2b175b1ce7bb94893bcd4e2cc960a88443f22b8eb40def716", + "control_public_rank_sha256": "c257091da6a4ed2c0847d56b140684439e8065f29352bca7e58697875717142f", + "control_seed_rank_sha256": "3ce102606bc327505692fb0eaf270b6834354582b221fc3b14b766e2ee356158", + "control_top1_age_events": 214, + "control_top1_age_ms": 214000, + "event_index": 2380, + "modality": "text", + "query_embedding_sha256": "dc96897fd8fe223fd41810057da78fc679d094adb79bf2afbe1e8e94c05d5f84", + "query_ordinal": 95, + "query_timestamp": 1700002380000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "0032456691e6efc54f850254ec05c4d2db9d66da0ff7d3a7475d9d787d4f2ee3", + "control_graph_rank_sha256": "9e77a534e4b71d7cdfb0e3e5801dac5c7153c5fc94ab41bad4e1a56eb43a1eb3", + "control_public_rank_sha256": "1a4b378e040fc664553527bbf6818f5fb5b038ee2764a115662fa16aacf36500", + "control_seed_rank_sha256": "0032456691e6efc54f850254ec05c4d2db9d66da0ff7d3a7475d9d787d4f2ee3", + "control_top1_age_events": 48, + "control_top1_age_ms": 48000, + "event_index": 2405, + "modality": "text", + "query_embedding_sha256": "d66e3643ec1189a85f7ef9bd3c38bbd8e6db9af5cd1952fecf6c50e6afe20a9e", + "query_ordinal": 96, + "query_timestamp": 1700002405000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "60972bee154f87bb85467a5283c65758dd4ef3b6d3c5c9ee952c88d92a693a00", + "control_graph_rank_sha256": "9d5398b7638b67d29d00b5a178496a9d7e2d19ff5f2230ed66a31b330d7d5348", + "control_public_rank_sha256": "8bc4970ded6972775127a47370513bb9588378d3e7afb43d61f0f3e5c9331537", + "control_seed_rank_sha256": "60972bee154f87bb85467a5283c65758dd4ef3b6d3c5c9ee952c88d92a693a00", + "control_top1_age_events": 123, + "control_top1_age_ms": 123000, + "event_index": 2428, + "modality": "text", + "query_embedding_sha256": "649ea523210ca909df398357643817230435425c47d77acfb847466a8b290aab", + "query_ordinal": 97, + "query_timestamp": 1700002428000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "d75b0407dd4d44c009635768a681eab2a372d2ed749250c6be2230e1f7418cb7", + "control_graph_rank_sha256": "74235bbf8fa33f34d4285c3c9959a8ffbd834379980885d1589c320b1f08c897", + "control_public_rank_sha256": "e8f1fe4a6f21d838f01a2dee700ca328a277969cdb92b83e7d42c088634ba26f", + "control_seed_rank_sha256": "d75b0407dd4d44c009635768a681eab2a372d2ed749250c6be2230e1f7418cb7", + "control_top1_age_events": 456, + "control_top1_age_ms": 456000, + "event_index": 2453, + "modality": "text", + "query_embedding_sha256": "c0081d08962129d99bd8df58b138140bbcb6d52fc4d2a75f68c928ce1f2bc411", + "query_ordinal": 98, + "query_timestamp": 1700002453000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "9e97b8b54690a919ac8d8b8e6b88d2a8273dfda3d3c1dea1d2f5b0a209b0dd29", + "control_graph_rank_sha256": "380b8b36d5c5bca89c63a8c638d67bfc5f0bb30e8c825effa1c10b6aab9578c4", + "control_public_rank_sha256": "412c6bf8a033e2268d63ce31e2c8a2641080743da21e0cfe5cee0171649f5f2b", + "control_seed_rank_sha256": "9e97b8b54690a919ac8d8b8e6b88d2a8273dfda3d3c1dea1d2f5b0a209b0dd29", + "control_top1_age_events": 301, + "control_top1_age_ms": 301000, + "event_index": 2480, + "modality": "text", + "query_embedding_sha256": "857243adebdd91bdde6ef7ea6ef4e563188c0cfdf6ace91522abbcfd7a7d0b21", + "query_ordinal": 99, + "query_timestamp": 1700002480000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "4b5c2ebdb14eb723258caa67f743a08d59ff77f6df1782fa276b174cc5657e9b", + "control_graph_rank_sha256": "eecd9e45bbea7ea08a53224d5fbeda0620d8771bcf5b7a7287b7dcf2654cf534", + "control_public_rank_sha256": "85a1d84db45f383dd71b5e6bd06d9f230781e6b2d82428f3b8af120f70267fd3", + "control_seed_rank_sha256": "4b5c2ebdb14eb723258caa67f743a08d59ff77f6df1782fa276b174cc5657e9b", + "control_top1_age_events": 1779, + "control_top1_age_ms": 1779000, + "event_index": 2506, + "modality": "text", + "query_embedding_sha256": "ab6b0b863c45981b52a157ad9270bd07f30ef13460a169aae55acdee95bffd6d", + "query_ordinal": 100, + "query_timestamp": 1700002506000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "1be9c0926a42051ce8c21345c5d7015b8200a26b14322c0c731126e7ab3af695", + "control_graph_rank_sha256": "85743568941842217fe747f4ab36e6c3b63ef4256eebb17c66e5c154d625211e", + "control_public_rank_sha256": "25c517f2d6d537cc0861eccd5d0c6d7fe22f4e36ecdf80c7a2f0cc6493c51408", + "control_seed_rank_sha256": "1be9c0926a42051ce8c21345c5d7015b8200a26b14322c0c731126e7ab3af695", + "control_top1_age_events": 723, + "control_top1_age_ms": 723000, + "event_index": 2532, + "modality": "text", + "query_embedding_sha256": "cdaa405b371ee86da4aef01a9df7e9fe3b0940569f2ed668d354070df2c866be", + "query_ordinal": 101, + "query_timestamp": 1700002532000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "e7712364fc7746238ff4d4042e5df9c3a9ccf8db73bd706c6e8e545879170ffa", + "control_graph_rank_sha256": "72a30421c163dfb1931e61e224e82d72a2c24e739009f493bcb2840fbc40a9af", + "control_public_rank_sha256": "111c864bb7436b104d6fccfc06ff05a5ffc4c08f6431fa1c1cdafdcd07e458b2", + "control_seed_rank_sha256": "e7712364fc7746238ff4d4042e5df9c3a9ccf8db73bd706c6e8e545879170ffa", + "control_top1_age_events": 576, + "control_top1_age_ms": 576000, + "event_index": 2558, + "modality": "text", + "query_embedding_sha256": "202cad4c75583ced6fa5a16dc6824e105035387b291732de6b0abaaed49f10c3", + "query_ordinal": 102, + "query_timestamp": 1700002558000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "63eb8134faef4c1f91108cefd27118a502f8a1b998ff34b45fa6aa5702af4986", + "control_graph_rank_sha256": "50a386a1f766cd1a194a97b57cf22f2636d2111c8d21f60463e4e2c8e1a5f4df", + "control_public_rank_sha256": "8199677b0a417d590772bf761f9ab163db15259974d17801ab129d94eb591849", + "control_seed_rank_sha256": "63eb8134faef4c1f91108cefd27118a502f8a1b998ff34b45fa6aa5702af4986", + "control_top1_age_events": 1200, + "control_top1_age_ms": 1200000, + "event_index": 2586, + "modality": "text", + "query_embedding_sha256": "2725346b39e88f3c42a2db1274e79a3a088e000d44a85dc046e3d6e32919d46e", + "query_ordinal": 103, + "query_timestamp": 1700002586000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "2287d44e19514201e1bce730fa9468eb77770ad5026191942629b02e6ac18b21", + "control_graph_rank_sha256": "4eed18120b851d8d0f8900f56dfc07baeb89f06dc53ecc811dc0a02a3e02d723", + "control_public_rank_sha256": "e202ab4c279e8923c9e50d9c6c93ae3df677da1c32ab1a70aca2358900b61fde", + "control_seed_rank_sha256": "2287d44e19514201e1bce730fa9468eb77770ad5026191942629b02e6ac18b21", + "control_top1_age_events": 2156, + "control_top1_age_ms": 2156000, + "event_index": 2612, + "modality": "text", + "query_embedding_sha256": "297b8230d6032800f3697d7812ce998c50fcda6ed5a7100b4679023fc63f8b72", + "query_ordinal": 104, + "query_timestamp": 1700002612000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "ea3b5e38bb65650134770caf6054d095cf7991a67e582eb19ead7ced01d65557", + "control_graph_rank_sha256": "62c3b3df249c79b463eea3b0f3e66dc54b252b64699a2e80cadcf8819dfe333f", + "control_public_rank_sha256": "2d84566959c6b315805ac79a6253d813044a78c55be45daba753d5589807f3aa", + "control_seed_rank_sha256": "ea3b5e38bb65650134770caf6054d095cf7991a67e582eb19ead7ced01d65557", + "control_top1_age_events": 2080, + "control_top1_age_ms": 2080000, + "event_index": 2639, + "modality": "text", + "query_embedding_sha256": "21bdcf604b5dd31219642a34e1399be4dd19401629b8ce18528cb3f34661a38a", + "query_ordinal": 105, + "query_timestamp": 1700002639000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "58d81c9afab5a649957194af56eb1bc642332451e53f7c7ec6af90347625da66", + "control_graph_rank_sha256": "5355ca24b1c3de73792112600cd30625cbe399e0da455399c1bebe97ebd54ded", + "control_public_rank_sha256": "79118b5c3c39cd945d5e522bc4e31408eac17f33476fb6f97a5d1efefa40fe80", + "control_seed_rank_sha256": "58d81c9afab5a649957194af56eb1bc642332451e53f7c7ec6af90347625da66", + "control_top1_age_events": 175, + "control_top1_age_ms": 175000, + "event_index": 2668, + "modality": "text", + "query_embedding_sha256": "38703fe8bfa69b0de55aa212146448b4e7d17ec3e93b12d3f3cdabd0ae1d34a6", + "query_ordinal": 106, + "query_timestamp": 1700002668000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "83487dbb0f819711374c2fe34f136e896e8a08bc9ba49b824f3a60c2a8871694", + "control_graph_rank_sha256": "b1663a4a15711c99c9dce6f575d7ba5a8e8627625bcefcf1e426b4b99b52daba", + "control_public_rank_sha256": "79b389abd8db2ec1114a4f15712f2a5840fed6ff2e70d890c11b468c6692235e", + "control_seed_rank_sha256": "83487dbb0f819711374c2fe34f136e896e8a08bc9ba49b824f3a60c2a8871694", + "control_top1_age_events": 532, + "control_top1_age_ms": 532000, + "event_index": 2694, + "modality": "text", + "query_embedding_sha256": "b34b1ef8dbb4ef8536b17b3bac5ce86fda941a1cab449f8ba3b49853d03bfec3", + "query_ordinal": 107, + "query_timestamp": 1700002694000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "fa91e9c84119733e893e995952672130a83adbf1b1a19a612328c12e5cdced9d", + "control_graph_rank_sha256": "bf1dbba68f92f94ff70e64e24893d85740fbf2715795a417777e781146909f6e", + "control_public_rank_sha256": "18232b78b74e8f75a87d6718cae07babf2c30a4806ddb4744f035ea97cb9a321", + "control_seed_rank_sha256": "fa91e9c84119733e893e995952672130a83adbf1b1a19a612328c12e5cdced9d", + "control_top1_age_events": 78, + "control_top1_age_ms": 78000, + "event_index": 2717, + "modality": "text", + "query_embedding_sha256": "f50303449a8a4b0af7e262601dca18c6ea4ef6c8e68de16c6fcac8323cba7e9d", + "query_ordinal": 108, + "query_timestamp": 1700002717000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "6a1c34176d85a32ef5b1da8689549e569535d29a791a4c337aa09ebe909ef24a", + "control_graph_rank_sha256": "64183a2ede3928697f0e40cfc3dfb70f425451800b1416698a1416419ad5ceac", + "control_public_rank_sha256": "3388204a5ebc5cb39a434689acd476814d3a00cc6d4826391f649c850feeaead", + "control_seed_rank_sha256": "6a1c34176d85a32ef5b1da8689549e569535d29a791a4c337aa09ebe909ef24a", + "control_top1_age_events": 3, + "control_top1_age_ms": 3000, + "event_index": 2744, + "modality": "text", + "query_embedding_sha256": "354ea5e90830b02a292881ad58d908065a863b5e9dc3c2eb26f2049f7ea12bfa", + "query_ordinal": 109, + "query_timestamp": 1700002744000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "288d9eec9e9030c4427479bb543a97e9562a3c6e18ce3e1919f30ef7bc45fc4a", + "control_graph_rank_sha256": "5f044878d0cdb44dc4efcc407031e355b4ef5ffa9b65aff7af882258db7bd8dd", + "control_public_rank_sha256": "fa96c32d80b2d425d2e19365c697d04e2c836032c0fcfca3978c9fbdf1219fad", + "control_seed_rank_sha256": "288d9eec9e9030c4427479bb543a97e9562a3c6e18ce3e1919f30ef7bc45fc4a", + "control_top1_age_events": 921, + "control_top1_age_ms": 921000, + "event_index": 2770, + "modality": "text", + "query_embedding_sha256": "214924186830a6e7011e0fee2e71e0693daed7aa093608fc3f06fd346238e25f", + "query_ordinal": 110, + "query_timestamp": 1700002770000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "c8a0bd8dddc7a6453c59be32858a6f0d09476f0842d9d21b5df0372d08dcdcaa", + "control_graph_rank_sha256": "e327eb46d5e4f47f7bd641589b98f0ad9cd393863f446cec744ca526a1682922", + "control_public_rank_sha256": "86ac37a938a121411f53f5087008f51e748b1694707d3412d9ea865d8c455cd6", + "control_seed_rank_sha256": "c8a0bd8dddc7a6453c59be32858a6f0d09476f0842d9d21b5df0372d08dcdcaa", + "control_top1_age_events": 392, + "control_top1_age_ms": 392000, + "event_index": 2797, + "modality": "text", + "query_embedding_sha256": "0adf3c4bc361b478b70e0bbf2450c1649b1cab389f00a95df018dd42f72b8cc1", + "query_ordinal": 111, + "query_timestamp": 1700002797000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "e8f34963d5b5bff74d9ef5cf4cae98bde5a556b30522e1030731a07b92b74df5", + "control_graph_rank_sha256": "8b3f58cfac47f1994e042918f44503e305bff52201d833a09ac56d62fb2b68bf", + "control_public_rank_sha256": "1e3342c169535f939a8e2c1f1b479eeccaf89c55810d8e2be7a5c5477b10e96c", + "control_seed_rank_sha256": "e8f34963d5b5bff74d9ef5cf4cae98bde5a556b30522e1030731a07b92b74df5", + "control_top1_age_events": 1164, + "control_top1_age_ms": 1164000, + "event_index": 2817, + "modality": "text", + "query_embedding_sha256": "331b71f16f59ccf7ee133e886b5e3f62f50beb3d8ccec7bad232912ab7da5155", + "query_ordinal": 112, + "query_timestamp": 1700002817000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "ba92b25444ba976fc029cd8f1d03da18265a9d9763f1c007fa0c9e8fed792a7f", + "control_graph_rank_sha256": "8cc3efa238dc159a0e072913d8dd0997cdda496d523a651db71bc4d632c1fa17", + "control_public_rank_sha256": "778ed8922210796d02e0f04f469a9efa4a5ff5cadf7fe999123a437f3003a175", + "control_seed_rank_sha256": "ba92b25444ba976fc029cd8f1d03da18265a9d9763f1c007fa0c9e8fed792a7f", + "control_top1_age_events": 199, + "control_top1_age_ms": 199000, + "event_index": 2847, + "modality": "text", + "query_embedding_sha256": "5d712435c8279d984b4adcad85fb23920c3040c6a44f10755e15977116a4fad9", + "query_ordinal": 113, + "query_timestamp": 1700002847000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "9045bd94621d7cb3c56d166949d74aec3bc34f9dc28020c468765333e7fae906", + "control_graph_rank_sha256": "e6269636ba0de99250d32e0825e083141bc26717c917c75258124e26d60702d7", + "control_public_rank_sha256": "e829564e1cdc513dea7cf46adf72f1fde956884d3e8ff465b0210a3f3e36d4ad", + "control_seed_rank_sha256": "9045bd94621d7cb3c56d166949d74aec3bc34f9dc28020c468765333e7fae906", + "control_top1_age_events": 66, + "control_top1_age_ms": 66000, + "event_index": 2873, + "modality": "text", + "query_embedding_sha256": "8444a39c2eb9b540504b3be7b8ced02a591c59b6d6e9fe9cbc6e1002c840957d", + "query_ordinal": 114, + "query_timestamp": 1700002873000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "d36834cb2447d2de6e7b5c5c4bd1c0a505a15737bd98593189b9caa2234c881d", + "control_graph_rank_sha256": "ab55d253003924f5e951e18c4eb0b6aae64a3b6a4117ecdf7e69663bc96ae95f", + "control_public_rank_sha256": "a8b695dc440d4405dbcd4de9693140f3f7e00811da71c235bc281c098c95c44b", + "control_seed_rank_sha256": "d36834cb2447d2de6e7b5c5c4bd1c0a505a15737bd98593189b9caa2234c881d", + "control_top1_age_events": 1638, + "control_top1_age_ms": 1638000, + "event_index": 2899, + "modality": "text", + "query_embedding_sha256": "0dad1d07f2819498b54eb66547787ccf5968c7ab03c65dded27e2d0eba12143a", + "query_ordinal": 115, + "query_timestamp": 1700002899000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "0a46e7e92a5c61079d46b8c97eb10f58cc11fe3e28afda5ede602fd4d4fe379f", + "control_graph_rank_sha256": "6b81d5a5a4277ae8573cf5e75348afcf3d20eb311d290a1c0e540ef8acb42f45", + "control_public_rank_sha256": "7cc159945064c4b9ea84c88667c7f29505fc7b2b8d6d4b7bf45bb369a15e6898", + "control_seed_rank_sha256": "0a46e7e92a5c61079d46b8c97eb10f58cc11fe3e28afda5ede602fd4d4fe379f", + "control_top1_age_events": 883, + "control_top1_age_ms": 883000, + "event_index": 2927, + "modality": "text", + "query_embedding_sha256": "dfa4880d28f0f27f8d20029cd782d023432bd90dd4e4560f8f3db57ef4530c32", + "query_ordinal": 116, + "query_timestamp": 1700002927000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "bfb12e6ebec65660f2e76065fed1b7b76cbfeca3fdd2541b5f27f3907c940e69", + "control_graph_rank_sha256": "51a0b38e51665ef3afc47be539de455ef9786f0e75e42057e68fd93e2d6bae88", + "control_public_rank_sha256": "95524afb8c3e3e80af5d27157eb7ee749c8c5aa78f27438b3dbd5dc2ac5324de", + "control_seed_rank_sha256": "bfb12e6ebec65660f2e76065fed1b7b76cbfeca3fdd2541b5f27f3907c940e69", + "control_top1_age_events": 83, + "control_top1_age_ms": 83000, + "event_index": 2956, + "modality": "text", + "query_embedding_sha256": "8c6ecbbfefb33e4b0b6df86a7759479a582d10631cd1fab31642a5e743e6b5d3", + "query_ordinal": 117, + "query_timestamp": 1700002956000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "c1f3ac8e95f22a24ebb2d715a75d986fbad9e48cc83e95540db18405069b89d4", + "control_graph_rank_sha256": "638e19a16ae97e748d2424213d33d88c8cb2517b39efc051cbb60dcc7c01a3b4", + "control_public_rank_sha256": "0fe4b04b1de0f82794c8a31626fa945db60504965a6de7708c5390fc9f66d3be", + "control_seed_rank_sha256": "c1f3ac8e95f22a24ebb2d715a75d986fbad9e48cc83e95540db18405069b89d4", + "control_top1_age_events": 1218, + "control_top1_age_ms": 1218000, + "event_index": 2978, + "modality": "text", + "query_embedding_sha256": "d5182e091fbf0c312cd6bf3061dbcadecca16baafab230002ec5ee8e6eeda06e", + "query_ordinal": 118, + "query_timestamp": 1700002978000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "abf65324c6b546113234094a27803dec4d8a487074f7a0afa2dd79105c771c8c", + "control_graph_rank_sha256": "eba25f290526e94295c4ed450243033ca33f9b42d438a5de2ed676665df6bc29", + "control_public_rank_sha256": "87d7dcdc360d0db22024578f6fbb9b258cb1afc5fc83d326bd52d148bd186eb1", + "control_seed_rank_sha256": "abf65324c6b546113234094a27803dec4d8a487074f7a0afa2dd79105c771c8c", + "control_top1_age_events": 336, + "control_top1_age_ms": 336000, + "event_index": 3005, + "modality": "text", + "query_embedding_sha256": "c18496ec9ed93f28be492843c8e09e1cad7e0cfc60b766b0dd759006077000fa", + "query_ordinal": 119, + "query_timestamp": 1700003005000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "306c40b75f78a511d381b8029af67640bd8daa0e7dc0c9e7c39e0869d54547b1", + "control_graph_rank_sha256": "75c9b2e9f8e9f66a447478d75c729c08ea4bb712235ea9f6e3364e9cb87c7e5a", + "control_public_rank_sha256": "da99660c3184e784d61189f297fa14da7d5df96ffbf91a024bfd5277f679b04d", + "control_seed_rank_sha256": "306c40b75f78a511d381b8029af67640bd8daa0e7dc0c9e7c39e0869d54547b1", + "control_top1_age_events": 2678, + "control_top1_age_ms": 2678000, + "event_index": 3033, + "modality": "text", + "query_embedding_sha256": "34e20399c49c0d456adc03bf304acc42ab31140b79765ec008663353e04d15c1", + "query_ordinal": 120, + "query_timestamp": 1700003033000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "fb8913d53494bd16cceb3aa7f8ee917d6d6ac860b3ce2f9427c131e8eb63384b", + "control_graph_rank_sha256": "7244154effda172645b1f1a25cae7125d9dff43a4d0aaa51dbc7aa7501bef9fe", + "control_public_rank_sha256": "d31f3646e00b86d063e3025a14193cee8c0e762b395b431b53d2b49aafcc69e3", + "control_seed_rank_sha256": "fb8913d53494bd16cceb3aa7f8ee917d6d6ac860b3ce2f9427c131e8eb63384b", + "control_top1_age_events": 667, + "control_top1_age_ms": 667000, + "event_index": 3055, + "modality": "text", + "query_embedding_sha256": "d74b43a55d1f8a3f26ac75e6522622173124b62e47c8f44066f6f6f852ce5782", + "query_ordinal": 121, + "query_timestamp": 1700003055000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "b3476a10627c05718dde1ad387a5f7be3df962c33e1de75883bf20c945a8e669", + "control_graph_rank_sha256": "feb3cf908c2474b62707d1cf8880a2a533f4554d69af70a49892db49618760de", + "control_public_rank_sha256": "a1c04554e2cba036ebead0a21233568d305a70cb53143f92b3502117ea3a33c0", + "control_seed_rank_sha256": "b3476a10627c05718dde1ad387a5f7be3df962c33e1de75883bf20c945a8e669", + "control_top1_age_events": 683, + "control_top1_age_ms": 683000, + "event_index": 3085, + "modality": "text", + "query_embedding_sha256": "50fda6521a346b7c461d21ddfb782b723752675d8a491c8fb2c395b025348e63", + "query_ordinal": 122, + "query_timestamp": 1700003085000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "fa8ee7cfbc6c46b371c3ef98aa084034f4fb73b667d4f5afac306a00f49cc8c2", + "control_graph_rank_sha256": "30e74c40a744f1d82aedde86d6bdcdf08661d9cf87549c0b78a3c04d8cfb061f", + "control_public_rank_sha256": "b94e511cd0436d8518c6dbdf1a685a7f3c5a6b8fa71c449b2063fc5af1f86a60", + "control_seed_rank_sha256": "fa8ee7cfbc6c46b371c3ef98aa084034f4fb73b667d4f5afac306a00f49cc8c2", + "control_top1_age_events": 8, + "control_top1_age_ms": 8000, + "event_index": 3110, + "modality": "text", + "query_embedding_sha256": "72b920a093670c1d4c91ff235d4550f3df42cf6f33d7142ccfd850fd3776a80a", + "query_ordinal": 123, + "query_timestamp": 1700003110000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "3d59998a2669f4005a41b83d7e3656e88de660d9c0b70232fd37e838d2fc7d4b", + "control_graph_rank_sha256": "9e85634ffcd9b7d1ef11084841354532c76d4f4eab16f37e51304aa278d97245", + "control_public_rank_sha256": "4413b0c6e104f8c65196cc830bf2e29860c767e48556c423aaeaf0d5cb05234b", + "control_seed_rank_sha256": "3d59998a2669f4005a41b83d7e3656e88de660d9c0b70232fd37e838d2fc7d4b", + "control_top1_age_events": 5, + "control_top1_age_ms": 5000, + "event_index": 3132, + "modality": "text", + "query_embedding_sha256": "ed6123380bf7abc0b5d400db0ba30b022c7aaac8d6dfe713e18a8e78ddd31b29", + "query_ordinal": 124, + "query_timestamp": 1700003132000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "5b9c55b3e5fa68df291f10aac06f9203857c963f85ff5039f15ae691c98c47dc", + "control_graph_rank_sha256": "80a226d43b00af4766819d18948dbbbe40062542589cf449f5f05f8e92b66faa", + "control_public_rank_sha256": "72f54daff493d3ef49e30a356c43cd4b7ee611b260c79af66114b9aebe115fb0", + "control_seed_rank_sha256": "5b9c55b3e5fa68df291f10aac06f9203857c963f85ff5039f15ae691c98c47dc", + "control_top1_age_events": 1989, + "control_top1_age_ms": 1989000, + "event_index": 3158, + "modality": "text", + "query_embedding_sha256": "93291d5bd8da3bd273270fa96d8b6110160fa7992dac57441bce75ec5a29b2ad", + "query_ordinal": 125, + "query_timestamp": 1700003158000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "bc61415fe2cef017307c9dae74c1f32d0f84d30c86c0d833101b48476b086ba8", + "control_graph_rank_sha256": "a885e4592da40ae1aa0821bfb1dbd171b636dd2a4c38fecf453e12d2de566e49", + "control_public_rank_sha256": "b97954a3a0f09fd512627462d169f8a59c18f6b1bf2e996a32397e5be8bd24a5", + "control_seed_rank_sha256": "bc61415fe2cef017307c9dae74c1f32d0f84d30c86c0d833101b48476b086ba8", + "control_top1_age_events": 86, + "control_top1_age_ms": 86000, + "event_index": 3183, + "modality": "text", + "query_embedding_sha256": "8d1510e84fc7cdd3b04a3055ec4066d661e5ca0ccd3d7e2aa78a059fdc382255", + "query_ordinal": 126, + "query_timestamp": 1700003183000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "7f4088d4e0c647c6bf3a693c4814c844dc85699c117cd190dd1f6537ab9db70c", + "control_graph_rank_sha256": "833613f10884aad9487f60979174f6b7c36caff6f735e67c75e8051b387bb5d0", + "control_public_rank_sha256": "6671f8e48d55537875aa8d168e3908e6d94725cc1967972f76575b83e99b25f2", + "control_seed_rank_sha256": "7f4088d4e0c647c6bf3a693c4814c844dc85699c117cd190dd1f6537ab9db70c", + "control_top1_age_events": 17, + "control_top1_age_ms": 17000, + "event_index": 3209, + "modality": "text", + "query_embedding_sha256": "6dc40b636e93884207858148695742d95077d2bc2dedc0496db55f647026961d", + "query_ordinal": 127, + "query_timestamp": 1700003209000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "e389efafe0182c841f568f2250381f4ee84a4320e45b5eae275082b9df8090b7", + "control_graph_rank_sha256": "6951a10623d287d79c4fc696270baeda27499fe76cf1aa56112db05e925ee5e2", + "control_public_rank_sha256": "403d0b5b5ab13a996eba8e6dd8fc94ede20b46f3692be9b65c9c07c50ad0a88d", + "control_seed_rank_sha256": "e389efafe0182c841f568f2250381f4ee84a4320e45b5eae275082b9df8090b7", + "control_top1_age_events": 1040, + "control_top1_age_ms": 1040000, + "event_index": 3231, + "modality": "text", + "query_embedding_sha256": "ca59bc607dd2baf44584abc0d3a596233b185d5900332fc280c9ab53e055fa16", + "query_ordinal": 128, + "query_timestamp": 1700003231000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "9074ff27de973bf67605cf88a0ec63a6b808f5749ffd72b18a2620495fc8e826", + "control_graph_rank_sha256": "b5520319e6b3c5cca03f692401f83f284483cdbf226515d287e783af34ed19d7", + "control_public_rank_sha256": "0dfd92c304a9001bf30602ca7008f8eef0a4eb1a9a983eb905ac5a9c24f655b5", + "control_seed_rank_sha256": "9074ff27de973bf67605cf88a0ec63a6b808f5749ffd72b18a2620495fc8e826", + "control_top1_age_events": 1067, + "control_top1_age_ms": 1067000, + "event_index": 3258, + "modality": "text", + "query_embedding_sha256": "26de5750a74b0e39eb842846a8f96d77e991cbcff172d77ea327798998260dc9", + "query_ordinal": 129, + "query_timestamp": 1700003258000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "62203d328f25927d3c7fc05f2d39143541c376eca3eeced0c6425eedee49c15a", + "control_graph_rank_sha256": "60835e676e089dd5a290f96d274f3d9fb9c73b06113f8528dec721ae93c6e7fa", + "control_public_rank_sha256": "64a3aa1f77581ab04bcf49af387c88d70b064d4ee4bce87f33822e6f27539045", + "control_seed_rank_sha256": "62203d328f25927d3c7fc05f2d39143541c376eca3eeced0c6425eedee49c15a", + "control_top1_age_events": 2474, + "control_top1_age_ms": 2474000, + "event_index": 3286, + "modality": "text", + "query_embedding_sha256": "8241d0990adec64ba79d50471bd178a1e27c71010f398e992cb6c5d5585c6f66", + "query_ordinal": 130, + "query_timestamp": 1700003286000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "f856410ef9fd927943bd8be2feafd4f811087450249cb142944ab0435f4fd5c2", + "control_graph_rank_sha256": "44728376bbac48365323f7dae2c0a813bc7d64dc0b456686572ae0e9254bb711", + "control_public_rank_sha256": "d5b75e04fae72a6c05ef70dc9ec571e6acc372b618b3e6401ea499a8acbb672e", + "control_seed_rank_sha256": "f856410ef9fd927943bd8be2feafd4f811087450249cb142944ab0435f4fd5c2", + "control_top1_age_events": 785, + "control_top1_age_ms": 785000, + "event_index": 3312, + "modality": "text", + "query_embedding_sha256": "61dff3a8e8494a51937d9e9f665c58c22ba7d236a76910bb63266296b39bd836", + "query_ordinal": 131, + "query_timestamp": 1700003312000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "774b7b4b83244727b58c020f9e3fc1a548f12ba336388cd66f5ce134bc2a3ecb", + "control_graph_rank_sha256": "c2bfeee33c6e33aa4d35cc05f78603afc45bc71b81093406fbc08b2aa775717d", + "control_public_rank_sha256": "47636b60c40bb431dec1cb19823f41f54700c69eac249560d622407923a55b30", + "control_seed_rank_sha256": "774b7b4b83244727b58c020f9e3fc1a548f12ba336388cd66f5ce134bc2a3ecb", + "control_top1_age_events": 517, + "control_top1_age_ms": 517000, + "event_index": 3334, + "modality": "text", + "query_embedding_sha256": "59871c9af65b9a3f7fb1a994130d300db68ea7c14b25ce92059eb5568e3203d8", + "query_ordinal": 132, + "query_timestamp": 1700003334000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "f626cc5e2426acc713fc755c7a680666c17e84545086b06c2e231499a59d967c", + "control_graph_rank_sha256": "73ed14d5533832fd5ac5376c95b7bc62dfff6737b7fbe6ad612a54662811a706", + "control_public_rank_sha256": "fe66549fe4509b4759c33f76f0ff3c05f61b1ded48e0d4838ab01fc679ce0e5d", + "control_seed_rank_sha256": "f626cc5e2426acc713fc755c7a680666c17e84545086b06c2e231499a59d967c", + "control_top1_age_events": 264, + "control_top1_age_ms": 264000, + "event_index": 3361, + "modality": "text", + "query_embedding_sha256": "78a3a49b3517ac388b5aa817db5d83efea988027b6e5f91a7a4d6029bfbfcfa6", + "query_ordinal": 133, + "query_timestamp": 1700003361000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "217dda6f1c7ee9cd172dde4c30cdf221b843f56eae671feed7625f7a702637ad", + "control_graph_rank_sha256": "2d171c798ed6f3e22a77a1e685e3b840a1e42c7bdf1f4beb9023a7a726020ee3", + "control_public_rank_sha256": "93fb4aa7022f5b437629065a940e5a026ba803a1748bed36df0ee7cd8d81f432", + "control_seed_rank_sha256": "217dda6f1c7ee9cd172dde4c30cdf221b843f56eae671feed7625f7a702637ad", + "control_top1_age_events": 1219, + "control_top1_age_ms": 1219000, + "event_index": 3385, + "modality": "text", + "query_embedding_sha256": "dc96897fd8fe223fd41810057da78fc679d094adb79bf2afbe1e8e94c05d5f84", + "query_ordinal": 134, + "query_timestamp": 1700003385000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "cb432c31a5279cf6c229bc213941200806e0635b44d2c4785c1bc4e33241432d", + "control_graph_rank_sha256": "1bf032b8cab4c729261b5f7dc198057bf69115d4a886df46721887628863e33c", + "control_public_rank_sha256": "ffa848349aefde561471429f5b15f9af57d71ea6665117ff14ded9ba1b0c70bd", + "control_seed_rank_sha256": "cb432c31a5279cf6c229bc213941200806e0635b44d2c4785c1bc4e33241432d", + "control_top1_age_events": 1651, + "control_top1_age_ms": 1651000, + "event_index": 3411, + "modality": "text", + "query_embedding_sha256": "e14fb3eb48b4524dc18a0db202e0f1c4f6d3901631bff98e75659774e8638bb9", + "query_ordinal": 135, + "query_timestamp": 1700003411000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "884943966d05bc5af120890f878d88d828287ffd03850da13ca2909dc83a9bda", + "control_graph_rank_sha256": "0d3522efc878949fe44fd17ac2032114e3b9c4c02f20833b6196a2bf8a765b74", + "control_public_rank_sha256": "1fbad070e6262a1eb3ee85a596ec3122db3bee38b1ad3b6297c5aa5cd2c73896", + "control_seed_rank_sha256": "884943966d05bc5af120890f878d88d828287ffd03850da13ca2909dc83a9bda", + "control_top1_age_events": 1677, + "control_top1_age_ms": 1677000, + "event_index": 3437, + "modality": "text", + "query_embedding_sha256": "e7b18322cde75ba63765d4a6ccf297e5c1b057eb55fcff5ce31d40d684cb1641", + "query_ordinal": 136, + "query_timestamp": 1700003437000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "b373729cab1b2a733f2850576f235c19ea6add69bd33ce423450531f36e5d563", + "control_graph_rank_sha256": "bd4e738164ff3e35f1aab15476c4ac547e2f439dcc97a21c043e8c40a112ec3a", + "control_public_rank_sha256": "ce5f0190a173a1edd505c48afab7e3b46a049295f3c8a2246e8d0ba08557c3c3", + "control_seed_rank_sha256": "b373729cab1b2a733f2850576f235c19ea6add69bd33ce423450531f36e5d563", + "control_top1_age_events": 4, + "control_top1_age_ms": 4000, + "event_index": 3461, + "modality": "text", + "query_embedding_sha256": "d53855b84d3b1df2cd9f6b868acc7cbdd792c91d050262da2a9d599568e48342", + "query_ordinal": 137, + "query_timestamp": 1700003461000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "6774803dd01c5f15ff7e3a552eca0165aa2eedeb537a7e9d9c6400c8569189fd", + "control_graph_rank_sha256": "ee13b350f8daac6e2595629985690bac52a045dcbb0f31e3487a952790b25d5c", + "control_public_rank_sha256": "dbfc82c9d7f4f950284bca5389bb91b8d28a20c46cc34c04e7fd91841ce10c3b", + "control_seed_rank_sha256": "6774803dd01c5f15ff7e3a552eca0165aa2eedeb537a7e9d9c6400c8569189fd", + "control_top1_age_events": 2928, + "control_top1_age_ms": 2928000, + "event_index": 3487, + "modality": "text", + "query_embedding_sha256": "d53741d8a27bac6cc1b19dd6696f07cfe1bccedc6f6f0204ec7bb2d1afa0c0a9", + "query_ordinal": 138, + "query_timestamp": 1700003487000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "79b02dc58563a963e141175dda873a5157a37a1b4ec8da4abc60b992f6129321", + "control_graph_rank_sha256": "8ad90aedebcb38dee38197b9a0706cfd1867f0ef62e876be1a560492e841fb3d", + "control_public_rank_sha256": "42e402a8fe5eea3afd8ba8e0866970964d6e55f71294bff86c34d54cbc1955ea", + "control_seed_rank_sha256": "79b02dc58563a963e141175dda873a5157a37a1b4ec8da4abc60b992f6129321", + "control_top1_age_events": 1606, + "control_top1_age_ms": 1606000, + "event_index": 3513, + "modality": "text", + "query_embedding_sha256": "62ecf1adfb27b76eeaf53f680659641eb7151c8eaee37c93bc9dfdecdb70dc6c", + "query_ordinal": 139, + "query_timestamp": 1700003513000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "779a5e815e35a4011567252b2e07b2c3ac618b8c3b7a46f06be54a9e5600190f", + "control_graph_rank_sha256": "b2c6b40e6dbc98fc516320b4979c55f646971683ba61f17b2cded158efbe6af9", + "control_public_rank_sha256": "dfd50106af736ac2edcb4244ec053d6b1e2453c49062a167bebd2f9d619c6b41", + "control_seed_rank_sha256": "779a5e815e35a4011567252b2e07b2c3ac618b8c3b7a46f06be54a9e5600190f", + "control_top1_age_events": 763, + "control_top1_age_ms": 763000, + "event_index": 3539, + "modality": "text", + "query_embedding_sha256": "756fee8c4e96031d8145f68da4ca0eccd829753bfb7e4f8a864112a1b70a6a67", + "query_ordinal": 140, + "query_timestamp": 1700003539000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "19a956254d5049ef1d060ab936056866523c598b25ed7a649cba9b85181a65cc", + "control_graph_rank_sha256": "ae9a94dbd8f370cf71999077105648eb2b6213aca297e4be90dc27ec426b0093", + "control_public_rank_sha256": "98d7d96b5f0205beeb6cbab23c01ae2cac3c3d7051a7d7562256892f43514246", + "control_seed_rank_sha256": "19a956254d5049ef1d060ab936056866523c598b25ed7a649cba9b85181a65cc", + "control_top1_age_events": 185, + "control_top1_age_ms": 185000, + "event_index": 3565, + "modality": "text", + "query_embedding_sha256": "5713f5ce97acbf19708602015d2ba0608f2e0c517dc4628d6854caad918ce03b", + "query_ordinal": 141, + "query_timestamp": 1700003565000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "5df3067392344724689fcec0fb23c7fc307b5a4b15555e13f47c1a22b2c7141e", + "control_graph_rank_sha256": "18acc920caef79cb09318c9eab365863827e96c28e9ff09480ee0473ce3cc430", + "control_public_rank_sha256": "f99ccf559aeee9886a78fccf9f8bcdc40818284c2760158bdc777bea5ef44110", + "control_seed_rank_sha256": "5df3067392344724689fcec0fb23c7fc307b5a4b15555e13f47c1a22b2c7141e", + "control_top1_age_events": 11, + "control_top1_age_ms": 11000, + "event_index": 3593, + "modality": "text", + "query_embedding_sha256": "800ca780412da68f93fe5e2681ea09b3c67913de59ea9bcf9ad4fc3b90fae882", + "query_ordinal": 142, + "query_timestamp": 1700003593000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "66e0864825be2185c50a9495760799d4b87cb9640159ea85a3ccf1424f815f1d", + "control_graph_rank_sha256": "bf4483ff3b4a0f3b43f756366c1c15ba4feb002fd61e9918bc9e9f34fabb3dcf", + "control_public_rank_sha256": "5de167a832ac4d89a88e253487a552b3dd7fb0e47a14ca07147898dcce64f31b", + "control_seed_rank_sha256": "66e0864825be2185c50a9495760799d4b87cb9640159ea85a3ccf1424f815f1d", + "control_top1_age_events": 280, + "control_top1_age_ms": 280000, + "event_index": 3622, + "modality": "text", + "query_embedding_sha256": "364ea81118aeb6ea0a384d6ef6d16489047ce0ee36211a992f1cd40672e60206", + "query_ordinal": 143, + "query_timestamp": 1700003622000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "e63fae581c94358aeac2dee3a88b71262b73386547d945c25ae6f26251751b39", + "control_graph_rank_sha256": "eecd11c94eb062492e5f7e11e16110a6f217c3fa4aed847d0a55a9ae488e07b0", + "control_public_rank_sha256": "d445b3c4a18548e3cb5fa8c1d576e8d2a9c359dec626e94ca5e6a4243b7d4412", + "control_seed_rank_sha256": "e63fae581c94358aeac2dee3a88b71262b73386547d945c25ae6f26251751b39", + "control_top1_age_events": 1888, + "control_top1_age_ms": 1888000, + "event_index": 3648, + "modality": "text", + "query_embedding_sha256": "60fb97044f915ac7bde5cceb9f5b629e4ba87a27144c9240a145b88d9846fd38", + "query_ordinal": 144, + "query_timestamp": 1700003648000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "755202631e28900e16a4d82254b60c2e35749983d0daed1865cb85ffcc53afa0", + "control_graph_rank_sha256": "f345f1dd24946f7d2fa35dc99262a8aafcfdb6f62b8e36cd2428739ed4b028b2", + "control_public_rank_sha256": "83c0a4f59fe6988bdf9fc4ed416cf995ecd25590c1f2538754838378db492a12", + "control_seed_rank_sha256": "755202631e28900e16a4d82254b60c2e35749983d0daed1865cb85ffcc53afa0", + "control_top1_age_events": 49, + "control_top1_age_ms": 49000, + "event_index": 3672, + "modality": "text", + "query_embedding_sha256": "57335688b40c8840c74cfc3224f08a25e679e8d7e35050deda4f123076820cea", + "query_ordinal": 145, + "query_timestamp": 1700003672000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "2bc0b70d732f4f7f0704148e040e0b638f0387da758fa5967c231f76f18f06c1", + "control_graph_rank_sha256": "3037fbe532990d675f93b052b10fc4633a91bc7b88728db0236934cb33bdc0be", + "control_public_rank_sha256": "a860cf2bbbe3d8fa38a6d1590301fa9f6aab60077b7c61a6fd83a9ee1a1b3ef3", + "control_seed_rank_sha256": "2bc0b70d732f4f7f0704148e040e0b638f0387da758fa5967c231f76f18f06c1", + "control_top1_age_events": 1961, + "control_top1_age_ms": 1961000, + "event_index": 3696, + "modality": "text", + "query_embedding_sha256": "bfa185ab82ea70f613dd371f81c18c02931267f73a5e002792ad7d9f7cfcd286", + "query_ordinal": 146, + "query_timestamp": 1700003696000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "0320f718dd17cbea71626d977b50877deff184296bb18e06664c59cd95e2d91a", + "control_graph_rank_sha256": "134a02ca41e9a5f4e1ba76c39f0700f2a7608017c704c66954ad2cbfc19c99d3", + "control_public_rank_sha256": "ad67aa0c8849f7fa48756ccf02c9dbfeadc4b7827be8f4bec160ab96dcefa1b8", + "control_seed_rank_sha256": "0320f718dd17cbea71626d977b50877deff184296bb18e06664c59cd95e2d91a", + "control_top1_age_events": 1158, + "control_top1_age_ms": 1158000, + "event_index": 3724, + "modality": "text", + "query_embedding_sha256": "453ca295523069d34c2ed398941735f45011dc5c124e7599d838b10a5fafa51b", + "query_ordinal": 147, + "query_timestamp": 1700003724000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "353d1b44bc33168280f4ed38898fb648e9c2316c9b00fdd1f8de238fed4880a3", + "control_graph_rank_sha256": "731a8006f6b0707633107f0551b3cd9f2f5eec331096be34b8fde483f8152dfd", + "control_public_rank_sha256": "2d885aa41b2f0fd03a786becd82b5758dcbd91cc0d4a11f5ffb6f5fbdaad9f75", + "control_seed_rank_sha256": "353d1b44bc33168280f4ed38898fb648e9c2316c9b00fdd1f8de238fed4880a3", + "control_top1_age_events": 112, + "control_top1_age_ms": 112000, + "event_index": 3749, + "modality": "text", + "query_embedding_sha256": "df090a65a3dd283e65454a4814c3df92aa29e13000a014562fd705a282509e38", + "query_ordinal": 148, + "query_timestamp": 1700003749000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "d6425aeeb97c22f063d5b6f6bea57a56543dcda1f3964af6317dc719c84d4631", + "control_graph_rank_sha256": "b14de7d8328e2d7172c22df091c09cb62d2babab77e52c735758224a2fbff6ad", + "control_public_rank_sha256": "1ebb238a3efcae011f908ba3f62f2375d2ec54bcc384cad2fb3d8de601127aeb", + "control_seed_rank_sha256": "d6425aeeb97c22f063d5b6f6bea57a56543dcda1f3964af6317dc719c84d4631", + "control_top1_age_events": 438, + "control_top1_age_ms": 438000, + "event_index": 3772, + "modality": "text", + "query_embedding_sha256": "f5119cfb01bf34d35474978add7b371aef4c023382f951394c33408b47313b44", + "query_ordinal": 149, + "query_timestamp": 1700003772000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "b4a8b0a71b831ecd7d5a3c94d864be47972a83fc91c754517ba617371f68dc72", + "control_graph_rank_sha256": "5f8b6a7afea90df399dba38bb2f2d2af9dfed1abc1c934b964abcb141501352f", + "control_public_rank_sha256": "d0bfb139565683ec9d6490a48485f49475dbf0997f4aa419248ed680160a574f", + "control_seed_rank_sha256": "b4a8b0a71b831ecd7d5a3c94d864be47972a83fc91c754517ba617371f68dc72", + "control_top1_age_events": 158, + "control_top1_age_ms": 158000, + "event_index": 3795, + "modality": "text", + "query_embedding_sha256": "fc0950a8235be4a38c65c5b87e8a2eaa8224efcec24630facc8366674fa53b62", + "query_ordinal": 150, + "query_timestamp": 1700003795000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "d81529acbd23b73922bfed2a74ab5d6041fff67725f4fd50fc98566ee12f8298", + "control_graph_rank_sha256": "65e213af804d474b4de244515e26f81e19620d512a9df4581c21b0675f1015d1", + "control_public_rank_sha256": "fccdfba49c3bd8ef3c1d39307a5aff43f78ec9935a8e85b3ecff805eb2168f8c", + "control_seed_rank_sha256": "d81529acbd23b73922bfed2a74ab5d6041fff67725f4fd50fc98566ee12f8298", + "control_top1_age_events": 1440, + "control_top1_age_ms": 1440000, + "event_index": 3820, + "modality": "text", + "query_embedding_sha256": "5cb60a3cf71b41f6bb096c1380cd1289542c9a5498c5f4fa5fd11aba05224e0f", + "query_ordinal": 151, + "query_timestamp": 1700003820000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "a460641d3d1e6cae860607f11385fbf6d008f1c5d91641e222a693c748031ec8", + "control_graph_rank_sha256": "0d4a537321f7e5dd741a3e6ba7ce76db8580228d6d64973c7fcf88f11f29c87b", + "control_public_rank_sha256": "aba24f13eecbe6dce4c86cf1fc26b0dc220b9467371ec195c3f646da405f5dfa", + "control_seed_rank_sha256": "a460641d3d1e6cae860607f11385fbf6d008f1c5d91641e222a693c748031ec8", + "control_top1_age_events": 149, + "control_top1_age_ms": 149000, + "event_index": 3841, + "modality": "text", + "query_embedding_sha256": "953213f5b5fc7acf483853b6bbe02d073375103dbbcc14ff51ab7688b8f53be6", + "query_ordinal": 152, + "query_timestamp": 1700003841000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "12a4f01aa3070f172d3a3c8d7541584e1e73f76e354abcf422aed527a2f2aed9", + "control_graph_rank_sha256": "6bf630c72ad91b14d94103e3e9ffa9f21003901b2e32a94349b3d63713bb0554", + "control_public_rank_sha256": "007a5717c34582570d16151595d93c3c8a33dba7868230bd39556e8fdd8c2ab6", + "control_seed_rank_sha256": "12a4f01aa3070f172d3a3c8d7541584e1e73f76e354abcf422aed527a2f2aed9", + "control_top1_age_events": 1940, + "control_top1_age_ms": 1940000, + "event_index": 3867, + "modality": "text", + "query_embedding_sha256": "e797b7f828767d58fa10078b9e109e945c12d4271cbc6bbd824cb8fad6896360", + "query_ordinal": 153, + "query_timestamp": 1700003867000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "4faaaf8f0ff68fb12a6a560fa9daf6a236e458910607e88d8f1079b07bd38119", + "control_graph_rank_sha256": "1d3a3145f257aa05f33d4076125090e40092efca553cb021533962ac57fe2e86", + "control_public_rank_sha256": "1234d179e6f5869238c0e42af630aacf677480de892f18891fe1f1bd69e45109", + "control_seed_rank_sha256": "4faaaf8f0ff68fb12a6a560fa9daf6a236e458910607e88d8f1079b07bd38119", + "control_top1_age_events": 482, + "control_top1_age_ms": 482000, + "event_index": 3893, + "modality": "text", + "query_embedding_sha256": "256ab035a4d53968bae3a613d074210ca1f5db993e9be27891db1bb866fa1e07", + "query_ordinal": 154, + "query_timestamp": 1700003893000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "62f26177a639966d1e4d468ddcb1dd8fae7f7b57a6def18986abbe4559ed938e", + "control_graph_rank_sha256": "580cbc389414aec1aac3e111d9910b77f98595c582afa2c9a98fa88214b8991d", + "control_public_rank_sha256": "89031c95142df1b4b608f1959bcc6688242bfcd5c38a8e006d2c11392c37cd3f", + "control_seed_rank_sha256": "62f26177a639966d1e4d468ddcb1dd8fae7f7b57a6def18986abbe4559ed938e", + "control_top1_age_events": 508, + "control_top1_age_ms": 508000, + "event_index": 3919, + "modality": "text", + "query_embedding_sha256": "428175b69667a2d880a5a2f475afcc79c6d7fd02c8083cb0d9c12d7b7308bbcb", + "query_ordinal": 155, + "query_timestamp": 1700003919000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "5a36858762d0761978f13ca6dcd8978a106dc682b9adf30b3660144bd9e2809c", + "control_graph_rank_sha256": "12714e6b8af2f0a96191b58a3b3fee3d967272aaa222344466a132be7af157c3", + "control_public_rank_sha256": "478a3739effa592be8ddaf92549bdabe1176524b7afde08968aa9043512cff18", + "control_seed_rank_sha256": "5a36858762d0761978f13ca6dcd8978a106dc682b9adf30b3660144bd9e2809c", + "control_top1_age_events": 840, + "control_top1_age_ms": 840000, + "event_index": 3947, + "modality": "text", + "query_embedding_sha256": "feddb94125658b0a88c2a72565c2b089f5c33048f365c6276489a653be0cf9df", + "query_ordinal": 156, + "query_timestamp": 1700003947000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "2fb8ee640cd063e1c9f6f1e823ccf22f4481b5e7e6cb0389138e17583e6b6346", + "control_graph_rank_sha256": "a93a6e227f35c216465c1dee8102d97928f0f689cc074541813ae6cb364922af", + "control_public_rank_sha256": "1fd3d36cd9260070399f6d6fe2c33ddfab40268f67c0f50f333060dbe8e1fb8a", + "control_seed_rank_sha256": "2fb8ee640cd063e1c9f6f1e823ccf22f4481b5e7e6cb0389138e17583e6b6346", + "control_top1_age_events": 542, + "control_top1_age_ms": 542000, + "event_index": 3968, + "modality": "text", + "query_embedding_sha256": "fca7f01db3ace02a6c4feaedef58ee43f1120d1f49b0728f9258113baa7276af", + "query_ordinal": 157, + "query_timestamp": 1700003968000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "926d88eb3c23ad4f8f3f3320006b1c0f566b2bf28831dc0259647b9b4f16a78e", + "control_graph_rank_sha256": "b6c820889a29e1eb92aa58dc41ca3a8707e214f491525a11b53792d37aed68ea", + "control_public_rank_sha256": "8ff16510ad502ecc82e3326a548788611b6a662f09d3811cb05eef00047420cd", + "control_seed_rank_sha256": "926d88eb3c23ad4f8f3f3320006b1c0f566b2bf28831dc0259647b9b4f16a78e", + "control_top1_age_events": 8, + "control_top1_age_ms": 8000, + "event_index": 3991, + "modality": "text", + "query_embedding_sha256": "324f33e7b5cfdf16b71eb0fa8481c7b984f7f6f9d5aa6004ce1c2b120836685f", + "query_ordinal": 158, + "query_timestamp": 1700003991000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "7cb851faec8f5ac7fbb8c4211111ee495166a7cced3bb2ced74e12491c64b3e6", + "control_graph_rank_sha256": "b9ffefab4d5f32e78d2cbd6031974175f283a077131a11a24597b51c7dddd1b9", + "control_public_rank_sha256": "627f3141a93340f499472d27ebfcad32976d40e2c3ec390d3a1d9fa03ab94dab", + "control_seed_rank_sha256": "7cb851faec8f5ac7fbb8c4211111ee495166a7cced3bb2ced74e12491c64b3e6", + "control_top1_age_events": 239, + "control_top1_age_ms": 239000, + "event_index": 4020, + "modality": "text", + "query_embedding_sha256": "64289ae82e9f0db334d9c6b13448f7a57601fe1969fcad659580004a1412ccef", + "query_ordinal": 159, + "query_timestamp": 1700004020000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "a0bc2cd09a5eee71f7379d524189f4089cb0bd9209d7a91090895542e92fdf78", + "control_graph_rank_sha256": "0b73c7a5abb19abb1c43fed9a31b049bcb57eb45759064bc6e18d6bad26d5cab", + "control_public_rank_sha256": "b2c04b3698b31adb75df9a2da0c05613c43dbf5f667269da98ac99088d137552", + "control_seed_rank_sha256": "a0bc2cd09a5eee71f7379d524189f4089cb0bd9209d7a91090895542e92fdf78", + "control_top1_age_events": 1548, + "control_top1_age_ms": 1548000, + "event_index": 4041, + "modality": "text", + "query_embedding_sha256": "76cb4a57b36412f5439b4bd1dc7b4950cc2826807e061125c33ab56113f13094", + "query_ordinal": 160, + "query_timestamp": 1700004041000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "dc90950bbb3476ebb4cb84f1fa7c4fa415faf12f31759dcaae32535ff302f9c7", + "control_graph_rank_sha256": "da001111399230db1254faa045f25929a57bb1429394f5fddc8491d268bbb1f2", + "control_public_rank_sha256": "a9273a6c1ce3812a5dae161f6c1c9303e8624b091251155b1da8fa7a3ef51358", + "control_seed_rank_sha256": "dc90950bbb3476ebb4cb84f1fa7c4fa415faf12f31759dcaae32535ff302f9c7", + "control_top1_age_events": 1364, + "control_top1_age_ms": 1364000, + "event_index": 4063, + "modality": "text", + "query_embedding_sha256": "475b669b51dd43f9280f5f89e02bc365040364e2bdb4aa708be28a6951f7458b", + "query_ordinal": 161, + "query_timestamp": 1700004063000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "97cce3cf564e763a8496dca9bbb0304a75f1c1b10528a2ca84445d1fbe60813a", + "control_graph_rank_sha256": "a44ac3599907fd9737249e89ff583c4f9b93e9856a11ea6e76eb404b83a6937d", + "control_public_rank_sha256": "5a7a82c3ee8e10cbb35557705a01475a7d06c4de09bf49adb4f681d63eafa20d", + "control_seed_rank_sha256": "97cce3cf564e763a8496dca9bbb0304a75f1c1b10528a2ca84445d1fbe60813a", + "control_top1_age_events": 663, + "control_top1_age_ms": 663000, + "event_index": 4089, + "modality": "text", + "query_embedding_sha256": "a11defae2bef8bb8d002205bb92b5f1ff25ec839b0566e495247584435c0dda9", + "query_ordinal": 162, + "query_timestamp": 1700004089000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "7e518d310805d85e93e4c4e56bc769ba21bcb11c120c9697c9af303d79c4207f", + "control_graph_rank_sha256": "1fe57e86860af1e0cb5a5fc04fc49e590d85505c9ceae99d120dfc39ed7b75c6", + "control_public_rank_sha256": "3010de881e93e87057db6cc303a7582395c233e48c71c6ff354037656a575d2f", + "control_seed_rank_sha256": "7e518d310805d85e93e4c4e56bc769ba21bcb11c120c9697c9af303d79c4207f", + "control_top1_age_events": 2806, + "control_top1_age_ms": 2806000, + "event_index": 4115, + "modality": "text", + "query_embedding_sha256": "01c1981f750d616a8866cd5a40043f4faee86ecdbfbd4d13fdc96c3ef26ca10b", + "query_ordinal": 163, + "query_timestamp": 1700004115000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "5b7ccef94d6203b77c92b407ecfee0df687123cd4877c4d57da9bd860636e249", + "control_graph_rank_sha256": "1465dc6d202d584b3a922e9140105857865d44e2e56086f6ab4fbe90ea59b991", + "control_public_rank_sha256": "30fd60567a56c75a874d6161fd42b493839ff87f31f8620c21dad68d2950a43f", + "control_seed_rank_sha256": "5b7ccef94d6203b77c92b407ecfee0df687123cd4877c4d57da9bd860636e249", + "control_top1_age_events": 1268, + "control_top1_age_ms": 1268000, + "event_index": 4141, + "modality": "text", + "query_embedding_sha256": "e3df9a94474232ed612f8848c550a6c7257848d81d2313813960461c7da0dcc9", + "query_ordinal": 164, + "query_timestamp": 1700004141000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "6f0aee49896126098517a485c5ce78c96859f880917420033e181fac78337eb3", + "control_graph_rank_sha256": "9d90b9232b1f329b3616c34d9316c0e7e78f6cdc98c0ea15d0eb0de4d26910f5", + "control_public_rank_sha256": "018366767d12b1c3522600061d566039a27b599f4fc509e4daed5a4e63915f22", + "control_seed_rank_sha256": "6f0aee49896126098517a485c5ce78c96859f880917420033e181fac78337eb3", + "control_top1_age_events": 1311, + "control_top1_age_ms": 1311000, + "event_index": 4164, + "modality": "text", + "query_embedding_sha256": "f046241b993fe8405b596208697c29899b8362cc76d751a137150016f89b9080", + "query_ordinal": 165, + "query_timestamp": 1700004164000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "f228b5981b8354a14969e6c99a5cc7b7ff7b6e9a4582dfbb96e37ada0bc85e82", + "control_graph_rank_sha256": "899dcca689d1c7b9f7fb68501891cf795eb962f57c7a1c1d6470860cb862baaf", + "control_public_rank_sha256": "fbb77133e1f5311df6cc153f5592f078bc6e4af9b65fc9b591589d54345a4e4b", + "control_seed_rank_sha256": "f228b5981b8354a14969e6c99a5cc7b7ff7b6e9a4582dfbb96e37ada0bc85e82", + "control_top1_age_events": 324, + "control_top1_age_ms": 324000, + "event_index": 4191, + "modality": "text", + "query_embedding_sha256": "33ee9de91d74b858d5a7aeec054746aed0333a4d3a6efa86b6b297beb9d85902", + "query_ordinal": 166, + "query_timestamp": 1700004191000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "bfd2bae8eb87f26d8654bcd745f0a8b9feca7f462b2a4b55df974721b160e5f1", + "control_graph_rank_sha256": "bcdf0197ae1133e2c243880a91c19cb9d366460b87a65d7c0980ca516589df9f", + "control_public_rank_sha256": "20914465cb84aacdc85e3a6d10bc2c6bf89362ebb6ef6298dc7668c7b68c22b3", + "control_seed_rank_sha256": "bfd2bae8eb87f26d8654bcd745f0a8b9feca7f462b2a4b55df974721b160e5f1", + "control_top1_age_events": 3881, + "control_top1_age_ms": 3881000, + "event_index": 4218, + "modality": "text", + "query_embedding_sha256": "4f280542e69f06ef2afe991f275369bf4a98b141a07a256a82b1699ead4e1ce6", + "query_ordinal": 167, + "query_timestamp": 1700004218000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "8791322abb8ff660737283dc7bead587b82d6d2ad97802a3dbb21761724ccd3c", + "control_graph_rank_sha256": "08f4417910b2d259813ebdaabad1cddfebed70bb4c3e91b4cb6f8abdae3a74c4", + "control_public_rank_sha256": "ff01f3b4aa912e4123abe2cb5f057c2df6f21b7dd7fb8111d00ff7b4663108bd", + "control_seed_rank_sha256": "8791322abb8ff660737283dc7bead587b82d6d2ad97802a3dbb21761724ccd3c", + "control_top1_age_events": 218, + "control_top1_age_ms": 218000, + "event_index": 4244, + "modality": "text", + "query_embedding_sha256": "35a6a6dd1d7ac4c84884de6809db1cf22ce843eced64c70ed5dd1d29feda59e0", + "query_ordinal": 168, + "query_timestamp": 1700004244000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "264e96ec07c80ba2229719dd6381139b4ee65816ee44c549ec4428f5618f44e9", + "control_graph_rank_sha256": "0dcc2776e15f3373ed3d3933a2ac287099bc1cce5360b680102b1ffa2fd4af90", + "control_public_rank_sha256": "f717284fae2cf808490ad90fcd8099aaeccee739943ea7b830e652a4a27150f9", + "control_seed_rank_sha256": "264e96ec07c80ba2229719dd6381139b4ee65816ee44c549ec4428f5618f44e9", + "control_top1_age_events": 895, + "control_top1_age_ms": 895000, + "event_index": 4266, + "modality": "text", + "query_embedding_sha256": "b63c98b542568a0625332d313064ad47f4dbf8e800d5aa0502ee8999f1410c07", + "query_ordinal": 169, + "query_timestamp": 1700004266000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "8884594a2b848cffb15b0e7e278bd5587b5313c58be1242236a3e74d09d67cce", + "control_graph_rank_sha256": "1979d1fc6c5f94874c83a473dd19ce41706593614776d3e6228f995dccf512e4", + "control_public_rank_sha256": "94189420ace6a82ce8915267279621965c7278afff32e90a94fb28e1ed765120", + "control_seed_rank_sha256": "8884594a2b848cffb15b0e7e278bd5587b5313c58be1242236a3e74d09d67cce", + "control_top1_age_events": 2532, + "control_top1_age_ms": 2532000, + "event_index": 4292, + "modality": "text", + "query_embedding_sha256": "d41f373a6a94c6e71e3d2638684fe2fb56374fc0c407b3243ac99a16be3a7f1b", + "query_ordinal": 170, + "query_timestamp": 1700004292000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "a50b70c959dbe0108c4ecfaccd2faa893ec806d52fed72760affdd3ccf86cc16", + "control_graph_rank_sha256": "c97137acf08480e858cbbe5d3332b58c05d9076b2b7e5f0b505caace1bd65058", + "control_public_rank_sha256": "5bd43d53890f86f33758d9af17da455148b2c22dbedb25bed337a805f03e145d", + "control_seed_rank_sha256": "a50b70c959dbe0108c4ecfaccd2faa893ec806d52fed72760affdd3ccf86cc16", + "control_top1_age_events": 550, + "control_top1_age_ms": 550000, + "event_index": 4318, + "modality": "text", + "query_embedding_sha256": "9370e130bac3c65df1a32c5b9c9f131f3da6733f0ce0622a8961e0a91c547ad4", + "query_ordinal": 171, + "query_timestamp": 1700004318000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "c0b3067bc1d77ea492c9601a92adf2de5b39f3fa9cb0dfc10c7e199e568f33bf", + "control_graph_rank_sha256": "e2183b3c6bb5aa04283b664f554b0d87603b877d573173f2111bfdf96d69395a", + "control_public_rank_sha256": "c996197ade4f2e68c2a55dac39b81279838fa0e80b8e589b9b0e8583aa2b72bd", + "control_seed_rank_sha256": "c0b3067bc1d77ea492c9601a92adf2de5b39f3fa9cb0dfc10c7e199e568f33bf", + "control_top1_age_events": 2174, + "control_top1_age_ms": 2174000, + "event_index": 4340, + "modality": "text", + "query_embedding_sha256": "c5207e61b1937dc98b46b93ce516a051acb333418a41e68fa4f13e543e732b30", + "query_ordinal": 172, + "query_timestamp": 1700004340000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "0c908ea428e30697bfed6aa69763b31d08880d4f9e97ebafbb18a00b88e407e7", + "control_graph_rank_sha256": "241aeca90723d24e5cab73eca3f06258044c696ac9a05f01f84be56d587b1be6", + "control_public_rank_sha256": "f35cfb303512ead7be3fd6a2d56bf324a73759f49e69e5425de82282f1ef20bc", + "control_seed_rank_sha256": "0c908ea428e30697bfed6aa69763b31d08880d4f9e97ebafbb18a00b88e407e7", + "control_top1_age_events": 848, + "control_top1_age_ms": 848000, + "event_index": 4366, + "modality": "text", + "query_embedding_sha256": "05792fecd0707316a5ba70181fdbe8c594d6cc9b636e1ba31490a9a1ea7c07ca", + "query_ordinal": 173, + "query_timestamp": 1700004366000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "50b891a974223f96a31166b5d83cd8be5f674f32863b1242e402b18addf0ca53", + "control_graph_rank_sha256": "d76f84a4ebe8d8db9591ba72bb58de4638f3102e6f571cfe972a77d34d254573", + "control_public_rank_sha256": "7afd3e4010402217b41ea1e7fc5c928e6fd6f5b2db3d77665fa5fbcdc45bd8b5", + "control_seed_rank_sha256": "50b891a974223f96a31166b5d83cd8be5f674f32863b1242e402b18addf0ca53", + "control_top1_age_events": 3152, + "control_top1_age_ms": 3152000, + "event_index": 4389, + "modality": "text", + "query_embedding_sha256": "067933bb6c613b0d68e2d0bf26c1b8080f2f72ba2ac6e922f0190f764cd15287", + "query_ordinal": 174, + "query_timestamp": 1700004389000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "57467056bd2118db5eb4d04608ccb5ec949de60df9b06585af18a620517e9685", + "control_graph_rank_sha256": "eb8e25acbfd578dea4da8bd0781b9a017333852895cdc8591373af3e91ec1bb6", + "control_public_rank_sha256": "2a3360cbf3a4a81344f700d03300169b18c48aee0e6ca444c188f5480f396918", + "control_seed_rank_sha256": "57467056bd2118db5eb4d04608ccb5ec949de60df9b06585af18a620517e9685", + "control_top1_age_events": 1308, + "control_top1_age_ms": 1308000, + "event_index": 4415, + "modality": "text", + "query_embedding_sha256": "c16158966db52273cd08a44c22e0047de1ebf972b7b7bcacd9962d53695c10d4", + "query_ordinal": 175, + "query_timestamp": 1700004415000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "84fc4689e521e4a52a9dcaa2ca8f52ea3edc8f8952210de233fc9d564d7deb98", + "control_graph_rank_sha256": "d05a402274cdd285acb78327df96d3b9c3cbbe298ee483b10d41af7697aad37d", + "control_public_rank_sha256": "5e2a35ec15bac86816af636046ca8f489ab0588b7fba1d85229ade9c513db5be", + "control_seed_rank_sha256": "84fc4689e521e4a52a9dcaa2ca8f52ea3edc8f8952210de233fc9d564d7deb98", + "control_top1_age_events": 4128, + "control_top1_age_ms": 4128000, + "event_index": 4442, + "modality": "text", + "query_embedding_sha256": "b840d7b63f8393c69aba0fe1a9273224f6d02b5cb19ce39c60ce2677ec5713c1", + "query_ordinal": 176, + "query_timestamp": 1700004442000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "13743a081bef6c52bba889a7f3a9f1e429508596742d2acfa9d5eaba281ee618", + "control_graph_rank_sha256": "ffb77443862f4844d88ce345d8c16f212451a3248eb4548ea81442fa1bc52eb7", + "control_public_rank_sha256": "d0e99ca0e298a69b6441c3e8580368cf4a4d1ba808a19d387e35b1c0eb06121a", + "control_seed_rank_sha256": "13743a081bef6c52bba889a7f3a9f1e429508596742d2acfa9d5eaba281ee618", + "control_top1_age_events": 3264, + "control_top1_age_ms": 3264000, + "event_index": 4468, + "modality": "text", + "query_embedding_sha256": "5a633d06150ffeff9f52ff66f266773ab5c0777a06cc56b1b3167978d55d3468", + "query_ordinal": 177, + "query_timestamp": 1700004468000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "40738f9fe2632cec7515e392202d2019a2c68d84fd7988c0351ce417492e04c3", + "control_graph_rank_sha256": "cc5575d6f9c4924e172b8bb16f4f32adfe4ac7a5529d018042f9aece4cca25be", + "control_public_rank_sha256": "ac15bc48d408f768866fda03528fc0e9b8d6b1b9a9a8ff112a9062936622d27a", + "control_seed_rank_sha256": "40738f9fe2632cec7515e392202d2019a2c68d84fd7988c0351ce417492e04c3", + "control_top1_age_events": 15, + "control_top1_age_ms": 15000, + "event_index": 4490, + "modality": "text", + "query_embedding_sha256": "50b306453be259476d256972fe7392a42f399029f39b84a2b0bb78a2b8ff0196", + "query_ordinal": 178, + "query_timestamp": 1700004490000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "4e6e76b7b7c70083d9a1c7bdb04bca61dfc7ec262e085a541a840cd8453fdc9d", + "control_graph_rank_sha256": "fa875c5c9ad140ac4488a25b61422867d5911d7592041c56d2fce6b8979ff493", + "control_public_rank_sha256": "77792f69f060908a87f2022ec0dad7caede299a0696f4e22e3634120b39468b5", + "control_seed_rank_sha256": "4e6e76b7b7c70083d9a1c7bdb04bca61dfc7ec262e085a541a840cd8453fdc9d", + "control_top1_age_events": 2837, + "control_top1_age_ms": 2837000, + "event_index": 4517, + "modality": "text", + "query_embedding_sha256": "db94cfc0b295270464bed05046ee9e7d4b939b97abbcc9d985f9e4740c80593a", + "query_ordinal": 179, + "query_timestamp": 1700004517000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "6dd3dedd34de7221827b80a0b9332880ebb4ad8133eaeb709ff029930e608712", + "control_graph_rank_sha256": "64d7b9b4b3d3e02811f1e699a1df980f2b4d100cba4578e4487b9de940e8307f", + "control_public_rank_sha256": "371c03348decb9b1fc45ba9a833c89ce6375a8da61f024189ddb032b4042f234", + "control_seed_rank_sha256": "6dd3dedd34de7221827b80a0b9332880ebb4ad8133eaeb709ff029930e608712", + "control_top1_age_events": 51, + "control_top1_age_ms": 51000, + "event_index": 4546, + "modality": "text", + "query_embedding_sha256": "e15639775802240e9c2e5e37fcd2142d86048f6c9b14043c5c86e63495a99529", + "query_ordinal": 180, + "query_timestamp": 1700004546000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "7546b35631a125175ca661648774e0de5b23c6f1bdc03b9b32c7c36116cf1f5b", + "control_graph_rank_sha256": "c044966a1adbb577b486f915263707a6c2568851ec138f5d1bd432de8be64b3f", + "control_public_rank_sha256": "4a79851f37ac28b51e508c4a0b1b55212bfd977de8a5401b14eea66c6358d9bc", + "control_seed_rank_sha256": "7546b35631a125175ca661648774e0de5b23c6f1bdc03b9b32c7c36116cf1f5b", + "control_top1_age_events": 216, + "control_top1_age_ms": 216000, + "event_index": 4571, + "modality": "text", + "query_embedding_sha256": "c28a606e028f74e8cdbc558e9a6efc5918e4da729a67f97abdfb2cd9a39831f1", + "query_ordinal": 181, + "query_timestamp": 1700004571000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "9a1ffae65060acc15ae20ae89e712f60e6d86b1d04f797054f990fe0302c493d", + "control_graph_rank_sha256": "64f7e1e25d7d1b19ec69ba7a2ed8bac9a8d0f1da9f4f5d00a7010ef322a2dd6f", + "control_public_rank_sha256": "bf4019dc74edb85513e96d9f844c6f94f6baf2913418d4af3a2b3d3e222afc8d", + "control_seed_rank_sha256": "9a1ffae65060acc15ae20ae89e712f60e6d86b1d04f797054f990fe0302c493d", + "control_top1_age_events": 187, + "control_top1_age_ms": 187000, + "event_index": 4593, + "modality": "text", + "query_embedding_sha256": "a8abff31f8c9deff111540b859aecf1a13437f9f3980e53e955334a826875df1", + "query_ordinal": 182, + "query_timestamp": 1700004593000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "a696d4467076658e4470a0bccccaf1b0bb5f962c66457ae9d2ca3b96e622384c", + "control_graph_rank_sha256": "51f8c16a6ec5f8c025075d8e2f15a54c345feda3a76e01b5d08555ea4610912a", + "control_public_rank_sha256": "146c35781c4bbaf1df97c99214444b6cf6a928fe0ab9fcefd962fc5aa88030e1", + "control_seed_rank_sha256": "a696d4467076658e4470a0bccccaf1b0bb5f962c66457ae9d2ca3b96e622384c", + "control_top1_age_events": 9, + "control_top1_age_ms": 9000, + "event_index": 4618, + "modality": "text", + "query_embedding_sha256": "203683f27a0a087c62c990a437504d1d03deb2393961150432fdbec164af3795", + "query_ordinal": 183, + "query_timestamp": 1700004618000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "43714f9a7848eb9635fe25f2bf8a97008931526d4b0c6963c9a082b237d695ce", + "control_graph_rank_sha256": "e9f9d5778e130a10e32abff3644c8122ecfa87c6ce0847ebd4ff79996a43e2d4", + "control_public_rank_sha256": "265e15f137591ba6e86f3c384d4c289733c5a4887745257b815638e7ae1c11ab", + "control_seed_rank_sha256": "43714f9a7848eb9635fe25f2bf8a97008931526d4b0c6963c9a082b237d695ce", + "control_top1_age_events": 805, + "control_top1_age_ms": 805000, + "event_index": 4641, + "modality": "text", + "query_embedding_sha256": "119302fb115cbab716124bcec85265f8ca11a120b4cd0d179751f414c9d85a74", + "query_ordinal": 184, + "query_timestamp": 1700004641000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "90743684c8eaa4f977d1e7b908a03f580a69139023abd4aa76abf8970370d61a", + "control_graph_rank_sha256": "16f05bb157a2c8ab4eae9a6ea891e5b39a8c8577d8c21a51790b38ab8e24ccc8", + "control_public_rank_sha256": "4b7bd3d08116b11443c0c001fba02817bfff2082b00c41b6b2413c1cf93f164b", + "control_seed_rank_sha256": "90743684c8eaa4f977d1e7b908a03f580a69139023abd4aa76abf8970370d61a", + "control_top1_age_events": 638, + "control_top1_age_ms": 638000, + "event_index": 4664, + "modality": "text", + "query_embedding_sha256": "9108241a3eb7c9c70e4e1a212047908084d64d972293c53b445e7dc020f7af28", + "query_ordinal": 185, + "query_timestamp": 1700004664000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "3dda71395c59164e289737f17577e5febe00cf3ba5895f226025c930c7bcc1d9", + "control_graph_rank_sha256": "10175ac8e2f20206f245fe6038b77af2ad382f114e8976e5a95603fc0aff1ba5", + "control_public_rank_sha256": "44abf39ff82d07c16c987f8f649fb84832863b29bfb96306056f03e723530a7c", + "control_seed_rank_sha256": "3dda71395c59164e289737f17577e5febe00cf3ba5895f226025c930c7bcc1d9", + "control_top1_age_events": 821, + "control_top1_age_ms": 821000, + "event_index": 4688, + "modality": "text", + "query_embedding_sha256": "8ff582c5732ecfb39d4387b18eea606ccb8530d46bbf6c5714583a6cbef21efc", + "query_ordinal": 186, + "query_timestamp": 1700004688000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "bfb5e34d78c45e3dacab2aa497b93a70a7f770e775991230f4566a9d8ac00098", + "control_graph_rank_sha256": "eb22491100af0ed58ac4d9ac906eabd2ce84843eaca3d3e8b22d563b387e257b", + "control_public_rank_sha256": "34358b0aae4be705a0ded153e9f57b30944ab6c13c07568d548aab245641ab9f", + "control_seed_rank_sha256": "bfb5e34d78c45e3dacab2aa497b93a70a7f770e775991230f4566a9d8ac00098", + "control_top1_age_events": 1193, + "control_top1_age_ms": 1193000, + "event_index": 4711, + "modality": "text", + "query_embedding_sha256": "aea1a4a4407d31a214110dc2f3bffe32d420655020a08d61954c7f36104854e0", + "query_ordinal": 187, + "query_timestamp": 1700004711000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "436791b34ae361a7d47a0bd74b1d4756b4bf7efef8a1e9326a39558ca5364fd7", + "control_graph_rank_sha256": "366b0ae490008015a4bdc59746a2c06a65ce20e3bf732b10ea35e6caed5eae7a", + "control_public_rank_sha256": "c6eb2ec5f255a649315133fa80e0e7d01098d19c9bd157ea48a8f6c086d6defb", + "control_seed_rank_sha256": "436791b34ae361a7d47a0bd74b1d4756b4bf7efef8a1e9326a39558ca5364fd7", + "control_top1_age_events": 872, + "control_top1_age_ms": 872000, + "event_index": 4739, + "modality": "text", + "query_embedding_sha256": "7d7079f0fc7028d42aaa9c53c1f9c906fab9c5f2599e6ed62f763d78a1a6f0e3", + "query_ordinal": 188, + "query_timestamp": 1700004739000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "e344cd58b4f488dc4e0a27e2a63d591bca548956cf68571812a002358cfd8109", + "control_graph_rank_sha256": "0aa7830c84f5ae9b3265586508bc0075f1a4c50eca0fe6eb59be3c05401c2220", + "control_public_rank_sha256": "f469129741f7e25dacad5df3da37274874d0e7e02b2b4bb392d76ae705a5b468", + "control_seed_rank_sha256": "e344cd58b4f488dc4e0a27e2a63d591bca548956cf68571812a002358cfd8109", + "control_top1_age_events": 895, + "control_top1_age_ms": 895000, + "event_index": 4762, + "modality": "text", + "query_embedding_sha256": "046f66a5b39cb51663ccba54420338f23198300f6d6c40f304700a98835eb1ae", + "query_ordinal": 189, + "query_timestamp": 1700004762000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "f28b04b97ddfa303363c23c6053d793f44cf5be271ae77228818f82a4e8e3e81", + "control_graph_rank_sha256": "2327c8a27c937e1548e8c3dae6c54715fc9fd833aeddec7da4ce432ffa8f08f1", + "control_public_rank_sha256": "73a0727fe125f311365d19489220cb3d2ff00bb8873335399762344280f61cd1", + "control_seed_rank_sha256": "f28b04b97ddfa303363c23c6053d793f44cf5be271ae77228818f82a4e8e3e81", + "control_top1_age_events": 3347, + "control_top1_age_ms": 3347000, + "event_index": 4785, + "modality": "text", + "query_embedding_sha256": "b24cb3b5bbcedf30c15d5257e63eca62fd360a68dc05f3a73c610367ab148a5b", + "query_ordinal": 190, + "query_timestamp": 1700004785000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "bbbe8b02fcc89523ace95df2c957c7807ce5f7c560ceb60b6ad0f1197795d689", + "control_graph_rank_sha256": "6bc126d47262d0d0b76910eed8f8c37dfd81f0cf537e6e2bda986ae703743d5b", + "control_public_rank_sha256": "54aa8d4294578fae5d449fbfed1bddcbb07822c4aef566a8cd6b57802cc1b7c3", + "control_seed_rank_sha256": "bbbe8b02fcc89523ace95df2c957c7807ce5f7c560ceb60b6ad0f1197795d689", + "control_top1_age_events": 3759, + "control_top1_age_ms": 3759000, + "event_index": 4812, + "modality": "text", + "query_embedding_sha256": "70faae961939c9012b56b6d28409ba5b9088d3fd04948e98b8af73cf1dd34de8", + "query_ordinal": 191, + "query_timestamp": 1700004812000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "269d295cbc3d3384804fac3d9cbdfadcbb84115ed4b9790648c39d3ef79e8212", + "control_graph_rank_sha256": "ae6724d41aed48951301e40d1e816aa29d325005db98bf35c215bb4c068975ff", + "control_public_rank_sha256": "c1348b66b0d18813bd2eaddae26aaa0eafd5816cfa1ca07815950d79bd097bf6", + "control_seed_rank_sha256": "269d295cbc3d3384804fac3d9cbdfadcbb84115ed4b9790648c39d3ef79e8212", + "control_top1_age_events": 2484, + "control_top1_age_ms": 2484000, + "event_index": 4836, + "modality": "text", + "query_embedding_sha256": "d85a038830a3b5948df04e3a3c2525f62bfb564db9e67cf03c00e9a164e196dd", + "query_ordinal": 192, + "query_timestamp": 1700004836000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "cd52d54846a52ca0f18bf7f513a24b56772054229c6baa56b8009d1a08ea470e", + "control_graph_rank_sha256": "72d269f981ef9691984a6a76254dba597b90cc61b0a520203d13439b254bea2c", + "control_public_rank_sha256": "4a6369c608f7f286a6e2b0120952a31a30de8ba496283c0828c83a8218c7c5e4", + "control_seed_rank_sha256": "cd52d54846a52ca0f18bf7f513a24b56772054229c6baa56b8009d1a08ea470e", + "control_top1_age_events": 84, + "control_top1_age_ms": 84000, + "event_index": 4864, + "modality": "text", + "query_embedding_sha256": "946fb641859e18fe69906f66d28d5026661ad4998ec57d177535d5c04c9d4ff8", + "query_ordinal": 193, + "query_timestamp": 1700004864000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "1e58582abc72d6eb079027d95848a1b34acd53897138b1b4e72607cf9dc17014", + "control_graph_rank_sha256": "5994a6edc6b8fcc6c0328da714f053ca0b4b261cbe85c5547cb27cabac3b0870", + "control_public_rank_sha256": "a58bcbea35293a5a1bbba91113032bd3bcbd8ed8c3c4a2a379a180f97f6d3a97", + "control_seed_rank_sha256": "1e58582abc72d6eb079027d95848a1b34acd53897138b1b4e72607cf9dc17014", + "control_top1_age_events": 1944, + "control_top1_age_ms": 1944000, + "event_index": 4887, + "modality": "text", + "query_embedding_sha256": "b7791e9888fbc8dcf4054608b2f7e757b484644f58b58f38d7cd9611d925a8c3", + "query_ordinal": 194, + "query_timestamp": 1700004887000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "8f42caa289934533c7371a781d8f0176dde0986adc7e122dd9b6f89634606ff6", + "control_graph_rank_sha256": "ac512794655b3580cccf0852084562a3a31ee7fb541752d752911c60299b70cc", + "control_public_rank_sha256": "0aaf76d55ee7d784045800de0bf6962d344312c352998fbff40d4be3f115a9b9", + "control_seed_rank_sha256": "8f42caa289934533c7371a781d8f0176dde0986adc7e122dd9b6f89634606ff6", + "control_top1_age_events": 2346, + "control_top1_age_ms": 2346000, + "event_index": 4912, + "modality": "text", + "query_embedding_sha256": "36e353f799dda937b2de9877d43cf664e920ba518219d0ea775f68af7b4e5d6e", + "query_ordinal": 195, + "query_timestamp": 1700004912000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "1ef7fcd4f53e499598c343a8639e560edafb13ddf50d3b575dea5a1a9a2be437", + "control_graph_rank_sha256": "fefe6c183ec60aea4db16c8a7e465caff8319b8801d52246183feef62fb01205", + "control_public_rank_sha256": "f16d03b75d723df8f371677e5c9ad7e9fd575c1a38f8979f7c387925d04402fa", + "control_seed_rank_sha256": "1ef7fcd4f53e499598c343a8639e560edafb13ddf50d3b575dea5a1a9a2be437", + "control_top1_age_events": 14, + "control_top1_age_ms": 14000, + "event_index": 4937, + "modality": "text", + "query_embedding_sha256": "3a803bde984c7a6f0e66db8f145ad42716b27218117711bd30f7788c6dddd851", + "query_ordinal": 196, + "query_timestamp": 1700004937000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "8e33860ad92d281bbe17e0d373c1877e7b002ad80f9a4053759607eb32f35490", + "control_graph_rank_sha256": "0a57f73c78b3b2e16c3f9875ae7c13589e144d97e187827e9b2c42917741225f", + "control_public_rank_sha256": "4904c3099a2c795eab41911e23cbbcd168697bb73ba7c8e5a5663bc397bbc53e", + "control_seed_rank_sha256": "8e33860ad92d281bbe17e0d373c1877e7b002ad80f9a4053759607eb32f35490", + "control_top1_age_events": 122, + "control_top1_age_ms": 122000, + "event_index": 4965, + "modality": "text", + "query_embedding_sha256": "1210938c712e6b4af6316d258f2300fc89b105b6b309025fece0e2e57c847330", + "query_ordinal": 197, + "query_timestamp": 1700004965000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "8f89d685c82122df0de9c82d5044e58c1b48b08a5a83c1237fd95a4941d78236", + "control_graph_rank_sha256": "7a7aa88f56fd93e7f5eb7d4c176ddd4baaf1c51c463753e44eb48a095a666704", + "control_public_rank_sha256": "1ab532ad578ecbd2a7dd85d158cc91701b6c8d12015ed7f826bbbd86686c4bd0", + "control_seed_rank_sha256": "8f89d685c82122df0de9c82d5044e58c1b48b08a5a83c1237fd95a4941d78236", + "control_top1_age_events": 144, + "control_top1_age_ms": 144000, + "event_index": 4987, + "modality": "text", + "query_embedding_sha256": "1210938c712e6b4af6316d258f2300fc89b105b6b309025fece0e2e57c847330", + "query_ordinal": 198, + "query_timestamp": 1700004987000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "5fca8dcd5a96cac2d5af912abe25be116ee16a83f02eae941d979f6bff08498b", + "control_graph_rank_sha256": "710e3d715e9714e249ebfb9ff445746e0c46d5e61ab7660a2de297829af72704", + "control_public_rank_sha256": "1b83a13af71e70bab757c798dc8ae73d78672e8c302f04e28f332c0cc7177c58", + "control_seed_rank_sha256": "5fca8dcd5a96cac2d5af912abe25be116ee16a83f02eae941d979f6bff08498b", + "control_top1_age_events": 301, + "control_top1_age_ms": 301000, + "event_index": 5012, + "modality": "text", + "query_embedding_sha256": "12e65d5471b57be26c789d319d2120ab0cd3dbeaf8d330340e56c9975330ad2d", + "query_ordinal": 199, + "query_timestamp": 1700005012000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "7d0f710608423cb885e64ad5cb597fcabdea16af9e7636d137031b75c7df9fd9", + "control_graph_rank_sha256": "ce58035d036c34d38b0fc5a98f5d3898634bfb476bbc51162bafde7d54621bf0", + "control_public_rank_sha256": "8d3b0a112f87acdbb1559ac3795399f3f5210d1a6ee444fc9887076ac3b20788", + "control_seed_rank_sha256": "7d0f710608423cb885e64ad5cb597fcabdea16af9e7636d137031b75c7df9fd9", + "control_top1_age_events": 120, + "control_top1_age_ms": 120000, + "event_index": 5038, + "modality": "text", + "query_embedding_sha256": "f5c09a8381e6ada629203b98ba21e3a69859c678c6da895af37e86e386cc8c05", + "query_ordinal": 200, + "query_timestamp": 1700005038000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "061d0fe22ffd6a33c222d0f470e5f0891a27571ab7566b5bc8766694fed6e310", + "control_graph_rank_sha256": "f114b27e2f994e1ab8120973786dd52dac87fb5829b305256081b3200214cf98", + "control_public_rank_sha256": "ed53c11fdeb7bfee9c2bc24c356a116d6fe1a2d8d969cf43c80afb33cb78de30", + "control_seed_rank_sha256": "061d0fe22ffd6a33c222d0f470e5f0891a27571ab7566b5bc8766694fed6e310", + "control_top1_age_events": 2787, + "control_top1_age_ms": 2787000, + "event_index": 5070, + "modality": "text", + "query_embedding_sha256": "db06be69ddfacabf2f1434ef1b40efe9bf277b18ccc85aae85902251b42620f2", + "query_ordinal": 201, + "query_timestamp": 1700005070000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "4f8871a4e2a679e319f6dc86cd86d8e1e24a7eabbd4d5a54f3db4bf8b1a8209c", + "control_graph_rank_sha256": "87db842e00468879bd249dd306d57c32f6909abea77ed5bd9e777e12a68c7626", + "control_public_rank_sha256": "6180fe3b9d7b61e8d3a21aed58a24e9f698c60d12aa445894c1ced604f8c6519", + "control_seed_rank_sha256": "4f8871a4e2a679e319f6dc86cd86d8e1e24a7eabbd4d5a54f3db4bf8b1a8209c", + "control_top1_age_events": 655, + "control_top1_age_ms": 655000, + "event_index": 5093, + "modality": "text", + "query_embedding_sha256": "c5ebe63115925b49dc3020cf602bb69e7c016351bfeb080a37a2b473d95ad7fe", + "query_ordinal": 202, + "query_timestamp": 1700005093000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "942a0f4f95bbde782882d1f3b1a8a28905f4c4e39c953e453c74ceef9167a534", + "control_graph_rank_sha256": "a1accf6280de97f1d8c1db8cb906d98c0ec69480bc5919a04791c08a4766e3fc", + "control_public_rank_sha256": "b97212d91cdc111bfeb69818182ffaabac69febe367bec4eb8de19be832ca407", + "control_seed_rank_sha256": "942a0f4f95bbde782882d1f3b1a8a28905f4c4e39c953e453c74ceef9167a534", + "control_top1_age_events": 1400, + "control_top1_age_ms": 1400000, + "event_index": 5120, + "modality": "text", + "query_embedding_sha256": "e31b740bdcf6e199ba03670bacc5d8fd74239d0d9a366a48ced7011c3352866c", + "query_ordinal": 203, + "query_timestamp": 1700005120000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "26d8c967bde5c60b7f4a54b83ee19e7b140edb826db539de77dc3200e0a0c4de", + "control_graph_rank_sha256": "bf4b01573c33990f8523918606b4901a54b4436aa18143d7585f87ad0d809927", + "control_public_rank_sha256": "ab917a8fd682edd8cf11266ba19a53f9abc218a5f3a9be79c4bfd46909b34c89", + "control_seed_rank_sha256": "26d8c967bde5c60b7f4a54b83ee19e7b140edb826db539de77dc3200e0a0c4de", + "control_top1_age_events": 2000, + "control_top1_age_ms": 2000000, + "event_index": 5145, + "modality": "text", + "query_embedding_sha256": "9bb73dbb1b86a60066798c9a5bd90df0dd405f0da16e869db70893a54f102f39", + "query_ordinal": 204, + "query_timestamp": 1700005145000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "3e2e0d3a2838f22b9cc4aa47be2ac21d3b9e3b75a2699e2678110db5c8b48d18", + "control_graph_rank_sha256": "5ebae823ecdd6d4234e069864d9aa68df5cf1c8b733c27fb119b2b55c8ee0e7c", + "control_public_rank_sha256": "b25533f8f040ac886856b9ab3a8896a477346942fe6fd86911da1e8e90d1562a", + "control_seed_rank_sha256": "3e2e0d3a2838f22b9cc4aa47be2ac21d3b9e3b75a2699e2678110db5c8b48d18", + "control_top1_age_events": 658, + "control_top1_age_ms": 658000, + "event_index": 5168, + "modality": "text", + "query_embedding_sha256": "6fde9e7160296864d48eaa20f7fd83c66cbb2d009959ae30f6570db63a7afffc", + "query_ordinal": 205, + "query_timestamp": 1700005168000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "a889ce2017b43fa7436cad0b5dee8ccdd88dcb87e8e177acff2ba1a2c3d4136c", + "control_graph_rank_sha256": "9fc1c3d9dbe9f8b757a5ca519993e5b56b6f557cbec050da0c885c98b9f392df", + "control_public_rank_sha256": "c5e5bf117620bc425e5ebca77b5d8cc560ecd5051f933ca67aff310cdb25440f", + "control_seed_rank_sha256": "a889ce2017b43fa7436cad0b5dee8ccdd88dcb87e8e177acff2ba1a2c3d4136c", + "control_top1_age_events": 35, + "control_top1_age_ms": 35000, + "event_index": 5193, + "modality": "text", + "query_embedding_sha256": "4b377c73e4443523876ed4e853b0beb3792c646adb0f28f229e9e02232dd1f9f", + "query_ordinal": 206, + "query_timestamp": 1700005193000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "539a303f23c987f19d83e6a712b7cf9e77ca0afc241d55ea72cf06388b72979c", + "control_graph_rank_sha256": "0ec2d63ad430d08ae44d8e47086640770b3a73b421f7afb0bc165db9c67f7727", + "control_public_rank_sha256": "230f95cb43a4b544f5e24e5255717cd9a0db23b5e1104a03f84ac520a415e6f4", + "control_seed_rank_sha256": "539a303f23c987f19d83e6a712b7cf9e77ca0afc241d55ea72cf06388b72979c", + "control_top1_age_events": 2652, + "control_top1_age_ms": 2652000, + "event_index": 5218, + "modality": "text", + "query_embedding_sha256": "4682291710e9e01edc9818ef4685a6b4c243b27d3bf85d7b29f1f8ba7aad9733", + "query_ordinal": 207, + "query_timestamp": 1700005218000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "69d4f8537d0670dff58f77f33d39683185affc5dbe7d9a67bf5273bb886b7771", + "control_graph_rank_sha256": "211cbaf066bc170045230a7e69d43fd3c5baa77ef6fac393477e12951403c8f8", + "control_public_rank_sha256": "8db0f25a840b8ed0d4ecd1de9827b6df4c0059a6cee277783eb4832944019363", + "control_seed_rank_sha256": "69d4f8537d0670dff58f77f33d39683185affc5dbe7d9a67bf5273bb886b7771", + "control_top1_age_events": 815, + "control_top1_age_ms": 815000, + "event_index": 5243, + "modality": "text", + "query_embedding_sha256": "16c6f955d7c954e91d1f9e20b490c59b273ab2c2d0b4c01713df1614abb8106e", + "query_ordinal": 208, + "query_timestamp": 1700005243000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "86ac330efeba32ca97a02fc19f871f23f073e0de5da6ef26839fb62202c4968f", + "control_graph_rank_sha256": "fdcd3d7bbc0f974d78e82279a9e21b42e6cbdb906ffddaf1eadde930177cc463", + "control_public_rank_sha256": "b169feee7fd6a6b3862eb93ccfffadc19e382c92be78d5e5a9f4a09620a34be3", + "control_seed_rank_sha256": "86ac330efeba32ca97a02fc19f871f23f073e0de5da6ef26839fb62202c4968f", + "control_top1_age_events": 223, + "control_top1_age_ms": 223000, + "event_index": 5268, + "modality": "text", + "query_embedding_sha256": "0095d1ec553b5d2136865f2ddfc583ca168e6e2f0315a3be16bf7978abcb7ad3", + "query_ordinal": 209, + "query_timestamp": 1700005268000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "6c74d6f6cd9ef0cac302ac533ad397f4b453a1829f5419cb0955dc0edd3d5e84", + "control_graph_rank_sha256": "797a46b0ba88ad5be50ccdd4923b15edc9d8654e656cbe4ea08a7ac706d691bf", + "control_public_rank_sha256": "c1a85306bf5f21ca2d38d035dead1a5b27ddadcdbd5f64f5bd7a1f83b42bc2b9", + "control_seed_rank_sha256": "6c74d6f6cd9ef0cac302ac533ad397f4b453a1829f5419cb0955dc0edd3d5e84", + "control_top1_age_events": 6, + "control_top1_age_ms": 6000, + "event_index": 5293, + "modality": "text", + "query_embedding_sha256": "46e5b1299d96fbbcda3bff69cb4ba969023491c73a0ee9eb1b7f88f303eedba8", + "query_ordinal": 210, + "query_timestamp": 1700005293000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "c90fe725468749465a0f809f714d86ec5d9bd23e62fe36aa930b02107d7dfa82", + "control_graph_rank_sha256": "4da7cd928a1f1dade3a47430a19ce00952e3418d49dffbeab923d1f1cebf9a35", + "control_public_rank_sha256": "0e1085785eb0a8577e6e90f480873e3af7e5e755b26b62db5e149813742eb283", + "control_seed_rank_sha256": "c90fe725468749465a0f809f714d86ec5d9bd23e62fe36aa930b02107d7dfa82", + "control_top1_age_events": 483, + "control_top1_age_ms": 483000, + "event_index": 5316, + "modality": "text", + "query_embedding_sha256": "c33a7f6cd2e81898975bbb4b64ba2bf31e2a72c058f0b66ae756f5d5afa746d8", + "query_ordinal": 211, + "query_timestamp": 1700005316000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "baef33c5b2eda5f42f66d78342d4eecd985a8b5185de3e2632592f1c9466a1cb", + "control_graph_rank_sha256": "baab6478cdb980bb70693746a8fdfbc50272484248503522ed0fa3d41efcefbf", + "control_public_rank_sha256": "daaaf5f96b2e03c7021a112330007140c12df2ecae7da778cc3997543412c7a5", + "control_seed_rank_sha256": "baef33c5b2eda5f42f66d78342d4eecd985a8b5185de3e2632592f1c9466a1cb", + "control_top1_age_events": 240, + "control_top1_age_ms": 240000, + "event_index": 5343, + "modality": "text", + "query_embedding_sha256": "3d730353c332b61a181efc075601608fdefd473c2382a70808b01aeeba7fe33a", + "query_ordinal": 212, + "query_timestamp": 1700005343000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "3dfee9359c097dddb02311a8f9d5229d4fc54568d73ee7678dc7a08d742a5d56", + "control_graph_rank_sha256": "55455da911ac598138e0e480d7fd20b92eb2118077663ec4b3ba8f2a85f331b3", + "control_public_rank_sha256": "13a2fd6b04afa2dace9257b910b0bb053f49279617494e9fa72153f866fafafa", + "control_seed_rank_sha256": "3dfee9359c097dddb02311a8f9d5229d4fc54568d73ee7678dc7a08d742a5d56", + "control_top1_age_events": 4, + "control_top1_age_ms": 4000, + "event_index": 5373, + "modality": "text", + "query_embedding_sha256": "08c5df2a5905a12bea7e68a5ebcb756ed3e424dbbcfcbffaa1b402dcbe7c46e0", + "query_ordinal": 213, + "query_timestamp": 1700005373000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "eba72fd2b82c51c1a537d3217d8703d12703fc88204bf0252df5aad2298ab4d5", + "control_graph_rank_sha256": "8f8ec147e9781e6115ad1e0f363c7025642d90634fd301802ef083ed78a89bb7", + "control_public_rank_sha256": "c29d39378e07b3fc2edd25bc79679904d3b4a8cf5504898550699ea6696b1567", + "control_seed_rank_sha256": "eba72fd2b82c51c1a537d3217d8703d12703fc88204bf0252df5aad2298ab4d5", + "control_top1_age_events": 3966, + "control_top1_age_ms": 3966000, + "event_index": 5404, + "modality": "text", + "query_embedding_sha256": "7e354b47073788600daa3cf273d722367681b454dcf619c29037e0463a2730b5", + "query_ordinal": 214, + "query_timestamp": 1700005404000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "111b3b991005b7e46b95cb26db5c4f6584dd6ccc56ac262d70fb63abc5088f4c", + "control_graph_rank_sha256": "a8d8f2dfb9008a86ccbdb4be7a3425cb2c07d905a3aa673e0da68905eabcf64e", + "control_public_rank_sha256": "07e7780b83c0328a6813a2d6f0d7f936fe5618aa2c3a527f0c416b6118b4c706", + "control_seed_rank_sha256": "111b3b991005b7e46b95cb26db5c4f6584dd6ccc56ac262d70fb63abc5088f4c", + "control_top1_age_events": 2859, + "control_top1_age_ms": 2859000, + "event_index": 5425, + "modality": "text", + "query_embedding_sha256": "86897db10d50e960a6c0ee9748a0bb1b71dd9fd67e6273316522391ff3f8b7bc", + "query_ordinal": 215, + "query_timestamp": 1700005425000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "269f3687a62a1d283710d52ae7db8d6dcd36336ab9ebbfcf3878308a9b106105", + "control_graph_rank_sha256": "b22b7aadcb8b2bf86ac59a764097917af512378bc31c0fc60dcb69e04a2ef94b", + "control_public_rank_sha256": "07058df0346459128450dc6b96f1c13746b8840e95c7d8eb11ecea86f689ba8f", + "control_seed_rank_sha256": "269f3687a62a1d283710d52ae7db8d6dcd36336ab9ebbfcf3878308a9b106105", + "control_top1_age_events": 318, + "control_top1_age_ms": 318000, + "event_index": 5452, + "modality": "text", + "query_embedding_sha256": "2ca0d9203fb025636f183e800d6a5a200770797b4105702ee76c859f3f057082", + "query_ordinal": 216, + "query_timestamp": 1700005452000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "39d031de28bd9f21aab5ead1e38dc4b716abd90e12752bad55416b0b00e28122", + "control_graph_rank_sha256": "1d12c91704f3691fede14e27dd00c0b44d7eb7e94d6e85ec337806bee700c8d7", + "control_public_rank_sha256": "d4423f8ec8c3d2588a58233ba5b99b96c44f36f796e2f8754485a68b2e7d292d", + "control_seed_rank_sha256": "39d031de28bd9f21aab5ead1e38dc4b716abd90e12752bad55416b0b00e28122", + "control_top1_age_events": 5, + "control_top1_age_ms": 5000, + "event_index": 5480, + "modality": "text", + "query_embedding_sha256": "f35484c7dc75ab3b38659622924a766122f0cf252e1c56e1a5928c18f5f0f34f", + "query_ordinal": 217, + "query_timestamp": 1700005480000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "a95fddb811c1ef55abd37036df98e2de92daa969c8a57ad4176dfab672a324dc", + "control_graph_rank_sha256": "22c24c8290c3583f45bc8d208c0b4f08cec94087ef600e4f90541a70aed91f68", + "control_public_rank_sha256": "753778d7d63dd624e746cf1f59b1167529380d321df1b50e41d5a12c79295022", + "control_seed_rank_sha256": "a95fddb811c1ef55abd37036df98e2de92daa969c8a57ad4176dfab672a324dc", + "control_top1_age_events": 4, + "control_top1_age_ms": 4000, + "event_index": 5506, + "modality": "text", + "query_embedding_sha256": "efdbe171f36369c38ebe5e0c82908add41105fc0ad7c33d4ea4d687f73302386", + "query_ordinal": 218, + "query_timestamp": 1700005506000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "ae15017f81298ef55775df592811bdd9fcaf726c286115bd0dc176424979c8d4", + "control_graph_rank_sha256": "5115b4cea197073b4b9a3bf4284e2943912b2f31ca8277dbb2d3aa8e438ce21a", + "control_public_rank_sha256": "4ab4ad8eedd63ca42dc56e0d2c3fe6feec60043042efc9dc26d35cb05f6395df", + "control_seed_rank_sha256": "ae15017f81298ef55775df592811bdd9fcaf726c286115bd0dc176424979c8d4", + "control_top1_age_events": 281, + "control_top1_age_ms": 281000, + "event_index": 5530, + "modality": "text", + "query_embedding_sha256": "7111e0a76070f9707ecf74bb5b5c211cc4b847c8c14d56c44232c2b118b5682c", + "query_ordinal": 219, + "query_timestamp": 1700005530000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "ad4cb163ae5b8de556c1c24c9e1c2c871aa5ade1a28be9455497b206611b2fd1", + "control_graph_rank_sha256": "24707880ded607d194faf8860557e666933200b12b83ce85118f5c15f3860831", + "control_public_rank_sha256": "ac7ddd023f3b52be214fe0bc36337200ea5c31670cea42e2feae6abad44fac97", + "control_seed_rank_sha256": "ad4cb163ae5b8de556c1c24c9e1c2c871aa5ade1a28be9455497b206611b2fd1", + "control_top1_age_events": 82, + "control_top1_age_ms": 82000, + "event_index": 5557, + "modality": "text", + "query_embedding_sha256": "f35484c7dc75ab3b38659622924a766122f0cf252e1c56e1a5928c18f5f0f34f", + "query_ordinal": 220, + "query_timestamp": 1700005557000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "449c8284c60c03111d39dceac46948adcac6b06aa277054fab2246d566eff30b", + "control_graph_rank_sha256": "f024c467682f4eb914dcb57cbf833bfe7804510f62747c5186bb834dfa97b296", + "control_public_rank_sha256": "f4d255691a248ebfd8502927ae16b04cb2e8ec913c2cc55f1419243773c3d537", + "control_seed_rank_sha256": "449c8284c60c03111d39dceac46948adcac6b06aa277054fab2246d566eff30b", + "control_top1_age_events": 1111, + "control_top1_age_ms": 1111000, + "event_index": 5581, + "modality": "text", + "query_embedding_sha256": "8ef2834b29f20aebe1967275ca4cf5ce686f311486c6352f9e463bf7d72b12d4", + "query_ordinal": 221, + "query_timestamp": 1700005581000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "406438fb0ac7d28f87f76aadcde86a11c54d8dd7ee18fcd0bdc45292a10085af", + "control_graph_rank_sha256": "aad455ac7a7e034b57eb30c0241f0ea0ae8e29dd4b37e0e5160b6321f94974df", + "control_public_rank_sha256": "2d65eccec56440c652bff3e1d105c79e312c1b8de73f3ca2ef44d3325a69f3f8", + "control_seed_rank_sha256": "406438fb0ac7d28f87f76aadcde86a11c54d8dd7ee18fcd0bdc45292a10085af", + "control_top1_age_events": 18, + "control_top1_age_ms": 18000, + "event_index": 5608, + "modality": "text", + "query_embedding_sha256": "5a2ea689cda2f0de1651c43b064fe6b31136f76c1dad87c183ea4d709eb4d6ef", + "query_ordinal": 222, + "query_timestamp": 1700005608000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "d5b58da452625528bae4d32bd9b33ef7e3d6163ee8c0ef85242ecf5839eba7d8", + "control_graph_rank_sha256": "5dc40b3684aa1ec701e9a3203f5f143659a4d59e8ed18a85735d21b89feac2d4", + "control_public_rank_sha256": "55fe0c363ef4441e6a2049b60090310ebdd543d0d45266654c620ce6b7dbcc67", + "control_seed_rank_sha256": "d5b58da452625528bae4d32bd9b33ef7e3d6163ee8c0ef85242ecf5839eba7d8", + "control_top1_age_events": 89, + "control_top1_age_ms": 89000, + "event_index": 5629, + "modality": "text", + "query_embedding_sha256": "a96960e7e82364acdb47b5208e52b7eb63971a519c71eaaff48bcd8de9070cba", + "query_ordinal": 223, + "query_timestamp": 1700005629000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "a8ceb485109740f3b01effd2001a2aa46ee9ac29eafdccb9cae1d96586b76b09", + "control_graph_rank_sha256": "fa4abbe33e74a8dae34705c503bcb52a1b8f8ad627c6701bb29e04b3d7455300", + "control_public_rank_sha256": "eabf954d0806c19a164a09193f79f80883a59cea285b5c6a0628ba27750b60cd", + "control_seed_rank_sha256": "a8ceb485109740f3b01effd2001a2aa46ee9ac29eafdccb9cae1d96586b76b09", + "control_top1_age_events": 2135, + "control_top1_age_ms": 2135000, + "event_index": 5663, + "modality": "text", + "query_embedding_sha256": "274b3074cc87c61b5f5e6fbf71fbc4952a9b64ee11d0529c1148df883a5597cf", + "query_ordinal": 224, + "query_timestamp": 1700005663000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "ed5c952e882901d313fdacbbb26831cc4f4f07e5efca398e748a9cc172bcf9c4", + "control_graph_rank_sha256": "d9ed4eb0f3f4feee68cf1ed6f4abbd15db41f3c229405c76c31d57e2bc845872", + "control_public_rank_sha256": "65f0284a25aca22863fd4fe7597b6f5620b5cb8f88f3f1a3942e822759a3a828", + "control_seed_rank_sha256": "ed5c952e882901d313fdacbbb26831cc4f4f07e5efca398e748a9cc172bcf9c4", + "control_top1_age_events": 89, + "control_top1_age_ms": 89000, + "event_index": 5688, + "modality": "text", + "query_embedding_sha256": "5053af378913dbae0bb90a1d4da73c47bc44f691b1730bf9d0b19462368969ab", + "query_ordinal": 225, + "query_timestamp": 1700005688000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "2326ad59b604e99eaa963f5a8e008bbc8df884430a0da6a3a1fa14d3c7fbfc4b", + "control_graph_rank_sha256": "f71917906ef8d2e1178835374ea57345e342689c527b26cd3657054af7c38a4e", + "control_public_rank_sha256": "eb5c990ec6218014d6267bbc9bd75aac342dd2295aa37019612ce02618c335c1", + "control_seed_rank_sha256": "2326ad59b604e99eaa963f5a8e008bbc8df884430a0da6a3a1fa14d3c7fbfc4b", + "control_top1_age_events": 1991, + "control_top1_age_ms": 1991000, + "event_index": 5711, + "modality": "text", + "query_embedding_sha256": "97d13b7811d8f81c1dcc4e68833aa95e592de0f09804f1c15cf841ebab23a191", + "query_ordinal": 226, + "query_timestamp": 1700005711000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "32e19d90e44df7f05bf1d5c292d2f210341b2691cf3c755df35c9c1929dcd70c", + "control_graph_rank_sha256": "ea21ca047de41f1bf313fd61f6f6ee30ed0bd64fd1ac4c86a13197fc7c01ecf3", + "control_public_rank_sha256": "c878d1e2b19384b4de891b382dacef6cc49b43762c443d984433ed285091e71c", + "control_seed_rank_sha256": "32e19d90e44df7f05bf1d5c292d2f210341b2691cf3c755df35c9c1929dcd70c", + "control_top1_age_events": 167, + "control_top1_age_ms": 167000, + "event_index": 5738, + "modality": "text", + "query_embedding_sha256": "6af94503266d83f1b39dc886776126f47b3e40bedfb56fd7bd561b8e155e198b", + "query_ordinal": 227, + "query_timestamp": 1700005738000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "644262b45543424cd64504f758b6da1c0e22f39a270fb9874755cfe8b36eb591", + "control_graph_rank_sha256": "16b69cfdf1929b911aa1fa85741185e335e91a13c56e297c411096e0a58d0576", + "control_public_rank_sha256": "54e7b89838a7b5c582c648c4f7e16d510a2ed11e4d852804355a2f0c3749c9f2", + "control_seed_rank_sha256": "644262b45543424cd64504f758b6da1c0e22f39a270fb9874755cfe8b36eb591", + "control_top1_age_events": 4100, + "control_top1_age_ms": 4100000, + "event_index": 5762, + "modality": "text", + "query_embedding_sha256": "ac40d57caa78a4a526e5d1dc346c1a67f91e7a37e4b98d93f3ddff6edb4c0f39", + "query_ordinal": 228, + "query_timestamp": 1700005762000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "ac7ac802fab9ba9c87e65d613303cfb3d004a7b91bfe97d415ae83d5221c3b6b", + "control_graph_rank_sha256": "583341edb55afec79344225c270678c082ed12ea23ca4ca1db322bc555eca6da", + "control_public_rank_sha256": "a37f9b5f9e25dce3a418c8852b2331702da2766fdb3fb205c7291f3f93b820ac", + "control_seed_rank_sha256": "ac7ac802fab9ba9c87e65d613303cfb3d004a7b91bfe97d415ae83d5221c3b6b", + "control_top1_age_events": 7, + "control_top1_age_ms": 7000, + "event_index": 5785, + "modality": "text", + "query_embedding_sha256": "597e19f318599106891294d6048fbb388785582377b08b151a4d670921926857", + "query_ordinal": 229, + "query_timestamp": 1700005785000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "c0253b8e47fce98b5e194daaa0448bc7e040311a0481673d2a7371abcc9a687a", + "control_graph_rank_sha256": "e3dcc0a5d5feb71fee471df1e798473bd3eb33df957df581e9c7bfa5a4aacef6", + "control_public_rank_sha256": "89caf7a8e47b1bfbdce7c9c3cedf5433dd1fa706f47c7121fa163ff36a697465", + "control_seed_rank_sha256": "c0253b8e47fce98b5e194daaa0448bc7e040311a0481673d2a7371abcc9a687a", + "control_top1_age_events": 775, + "control_top1_age_ms": 775000, + "event_index": 5808, + "modality": "text", + "query_embedding_sha256": "fa4d840fb02078cf89fcbf43da0b2c6e552d04431d048cd6643a04a9bae21882", + "query_ordinal": 230, + "query_timestamp": 1700005808000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "11caf30b78a0b22a7ca96267e3e9c5b37b605b0388fa5dd0b4d217b2d4632c00", + "control_graph_rank_sha256": "28d00649f039f41c8c54bd7c18e4140ab1527bcc8ad5cdf19eaf987db59490d7", + "control_public_rank_sha256": "5998eaef4eb262a4ad23d833654ff21cfb2b40089f9e3430532a3a138c1f2ffc", + "control_seed_rank_sha256": "11caf30b78a0b22a7ca96267e3e9c5b37b605b0388fa5dd0b4d217b2d4632c00", + "control_top1_age_events": 3264, + "control_top1_age_ms": 3264000, + "event_index": 5830, + "modality": "text", + "query_embedding_sha256": "fa3b307e98dc7dd5cdd5875429dc14c0e938ad144dcd0117593cd2d823f53f86", + "query_ordinal": 231, + "query_timestamp": 1700005830000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "7cc76f65415160937907247cade59c776c2545aa16918ff26333ec9b239337a2", + "control_graph_rank_sha256": "1db69e69273b00e48f34054cc48eaf9bb69844961c913b84088f38edd8a2ecb3", + "control_public_rank_sha256": "9fb5abf85470ac413e1d42e1d5407e3dfd2c9ae2fdbdcb8c8119d0291d994b86", + "control_seed_rank_sha256": "7cc76f65415160937907247cade59c776c2545aa16918ff26333ec9b239337a2", + "control_top1_age_events": 3289, + "control_top1_age_ms": 3289000, + "event_index": 5855, + "modality": "text", + "query_embedding_sha256": "ef70134d404f3c70ea70ee89a71d055ffacaa4c7c2d2412311497e3c70ed25fc", + "query_ordinal": 232, + "query_timestamp": 1700005855000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "25bc4e0c2cb2983737994094275085a166a0ecd07651d13e77a5e8b9c2f4d8d0", + "control_graph_rank_sha256": "3f3674375740dc2c13840f4e35a0be62178f084168f5e1d94cef66ceedba9020", + "control_public_rank_sha256": "c45715643f2ae39ef819787d2aedd21b47731fb9fffaad818ca398df8723cd21", + "control_seed_rank_sha256": "25bc4e0c2cb2983737994094275085a166a0ecd07651d13e77a5e8b9c2f4d8d0", + "control_top1_age_events": 3595, + "control_top1_age_ms": 3595000, + "event_index": 5878, + "modality": "text", + "query_embedding_sha256": "db06be69ddfacabf2f1434ef1b40efe9bf277b18ccc85aae85902251b42620f2", + "query_ordinal": 233, + "query_timestamp": 1700005878000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "bf8b1a17e3501ff5f1ea730422ff3b0581a4cb24de472b30b86f6e1ff2db9181", + "control_graph_rank_sha256": "32585aceeecb5f9906001228b3efdf70c689563fbc73560705c7d21acfb5d184", + "control_public_rank_sha256": "341d2af826ef5c4c4c429007296c8a9b57a3c87d71fa2e78eb58989eb7fc3c81", + "control_seed_rank_sha256": "bf8b1a17e3501ff5f1ea730422ff3b0581a4cb24de472b30b86f6e1ff2db9181", + "control_top1_age_events": 4195, + "control_top1_age_ms": 4195000, + "event_index": 5900, + "modality": "text", + "query_embedding_sha256": "647718b91e311cfd1a7368187bc9b72a6e15dd780729f591ee49bb35021240e4", + "query_ordinal": 234, + "query_timestamp": 1700005900000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "deed0710ccd7cfcf0e02353ec9fc80de396484536d226abeae34b2553ae85271", + "control_graph_rank_sha256": "ad3e3a6b3ad351d3b45b44b8c154b86ea7d8ce469331c4c44b487c446b93a757", + "control_public_rank_sha256": "8f01aaf154d1736d9645543dc4682e5e176380829aac483d66f02e4deee9bd40", + "control_seed_rank_sha256": "deed0710ccd7cfcf0e02353ec9fc80de396484536d226abeae34b2553ae85271", + "control_top1_age_events": 3639, + "control_top1_age_ms": 3639000, + "event_index": 5922, + "modality": "text", + "query_embedding_sha256": "db06be69ddfacabf2f1434ef1b40efe9bf277b18ccc85aae85902251b42620f2", + "query_ordinal": 235, + "query_timestamp": 1700005922000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "99cee7522c8e0fbd3c6cf358236aa1627c8bf945a2264503ea92674961d1db7f", + "control_graph_rank_sha256": "92a742d686526ab479904778aab7c9334582e2ca39bfdaabf7ed247e6a35593b", + "control_public_rank_sha256": "03eb857b56578f33a41c34e2e1607908ce673177c0ce4a0c20ce36f8e6f5ea7b", + "control_seed_rank_sha256": "99cee7522c8e0fbd3c6cf358236aa1627c8bf945a2264503ea92674961d1db7f", + "control_top1_age_events": 3206, + "control_top1_age_ms": 3206000, + "event_index": 5947, + "modality": "text", + "query_embedding_sha256": "9b3ec34223d4b407540e940cd661fa5c764bbf75cdf5b35bd3a330fab77eab10", + "query_ordinal": 236, + "query_timestamp": 1700005947000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "9c0b63503f4793c52fa3572739df17af6c7857e16695cb9f6626bd577ceebf78", + "control_graph_rank_sha256": "fdb763732b28dbd6acf6612637ddaf8b196676a1b2f1fff00099512d759fc1f2", + "control_public_rank_sha256": "7751c1a8e713cce879c43e9f0dac0ab5c84e7dd57aca1204a25589b67957a09b", + "control_seed_rank_sha256": "9c0b63503f4793c52fa3572739df17af6c7857e16695cb9f6626bd577ceebf78", + "control_top1_age_events": 3412, + "control_top1_age_ms": 3412000, + "event_index": 5978, + "modality": "text", + "query_embedding_sha256": "9a0e28ba77dc4c7da89c994f20c84585679debc2c07a111a4a717352489d9ee0", + "query_ordinal": 237, + "query_timestamp": 1700005978000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "e2d3ecb620115a476bdd20ae8d2772b509c7f8b44f8fb6cf5f31acdad94ce2c3", + "control_graph_rank_sha256": "a7175b94eef0f5fe2e91eb4b9e69a85470fd6b667d9721b349cc8e759423c347", + "control_public_rank_sha256": "0ee61a83382350e5fe439310a81f35e65ae68216dec5a6dc30c07dec92d1bf74", + "control_seed_rank_sha256": "e2d3ecb620115a476bdd20ae8d2772b509c7f8b44f8fb6cf5f31acdad94ce2c3", + "control_top1_age_events": 969, + "control_top1_age_ms": 969000, + "event_index": 6002, + "modality": "text", + "query_embedding_sha256": "0a747904a542e4da1c1b7d6c75c84c365dbd6da93d69a24592eec528630a40b3", + "query_ordinal": 238, + "query_timestamp": 1700006002000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "f9a3ac12dce02b66122204531ff03cbb0e1bce5ef4ee2f444aa721beb62de11c", + "control_graph_rank_sha256": "8e6f6b4c9568b9c434ed513558bccab3c56c83c96c4346fc6c7628b8b1c9bc5b", + "control_public_rank_sha256": "73248b697eb935070b9ef664c6e273556d1d7f93094edb95deba509abba31a14", + "control_seed_rank_sha256": "f9a3ac12dce02b66122204531ff03cbb0e1bce5ef4ee2f444aa721beb62de11c", + "control_top1_age_events": 3907, + "control_top1_age_ms": 3907000, + "event_index": 6026, + "modality": "text", + "query_embedding_sha256": "e7f958af4ce82cc634def1f9f7169b1e014b128e3ffdeb6bb9aa437193d9568b", + "query_ordinal": 239, + "query_timestamp": 1700006026000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "8558c4ca3fcf5de2a10544a2d9e7e0f66aa22bd30d734a2acc053ffef8f807a3", + "control_graph_rank_sha256": "8f74880e732c8163b277a98f4d7d04a6bafa0b36cf230ba220fb64f29e63492c", + "control_public_rank_sha256": "72ee0bc72ee5081785ccb9a4eeab479084e5a7deb3409297159a415e52e57dbd", + "control_seed_rank_sha256": "8558c4ca3fcf5de2a10544a2d9e7e0f66aa22bd30d734a2acc053ffef8f807a3", + "control_top1_age_events": 3715, + "control_top1_age_ms": 3715000, + "event_index": 6051, + "modality": "text", + "query_embedding_sha256": "dd6e361deb026583c7c7b0e9c801f811a13f31b28b8f188b20b3dbf6ecfede73", + "query_ordinal": 240, + "query_timestamp": 1700006051000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "9cd9a2a92d6e5d5b2135f8ef157508f4a0363b5c4dceb08e5027c9e1ce088867", + "control_graph_rank_sha256": "3b984f8b4a9ffea6c0dd84b4ab70301460646e97e5798f49afc0d1cc598decc0", + "control_public_rank_sha256": "833597002deddb5c3fd401e0439a9cb6c53460c753c287b861c2662d1746de10", + "control_seed_rank_sha256": "9cd9a2a92d6e5d5b2135f8ef157508f4a0363b5c4dceb08e5027c9e1ce088867", + "control_top1_age_events": 3176, + "control_top1_age_ms": 3176000, + "event_index": 6075, + "modality": "text", + "query_embedding_sha256": "314972b5efc456dbccc9793e75d271582dd5791efa0ab1420201f75fb5674acd", + "query_ordinal": 241, + "query_timestamp": 1700006075000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "21f5f6987cfd7bd90595ea37e6df477ff34ed8bbebb0e373e98f9ec1171695f2", + "control_graph_rank_sha256": "12905490a01b186dfcf7507886a66631808dd3cce73a87579ecff29795c61213", + "control_public_rank_sha256": "55817881272ff6b01fb9404650ece2a648f7454b2be800a05a4e0a0fc0ca72b9", + "control_seed_rank_sha256": "21f5f6987cfd7bd90595ea37e6df477ff34ed8bbebb0e373e98f9ec1171695f2", + "control_top1_age_events": 1623, + "control_top1_age_ms": 1623000, + "event_index": 6103, + "modality": "text", + "query_embedding_sha256": "b2a9cf9ba9d3c9065049d49a794ac73770681a2015ee4043f6001c8663bade97", + "query_ordinal": 242, + "query_timestamp": 1700006103000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "fcdf90d4f9f138970014364bc904e1d97f14fe991e1ba3f356f0a8292f1eee70", + "control_graph_rank_sha256": "384df8da00a87401a9f02ae5c712519c8c72a15e7eb86136f986888f93c364b6", + "control_public_rank_sha256": "74ca9260038ced6e0ef8a54e7d40064def13376decbf5e87e0044d7042c2a688", + "control_seed_rank_sha256": "fcdf90d4f9f138970014364bc904e1d97f14fe991e1ba3f356f0a8292f1eee70", + "control_top1_age_events": 277, + "control_top1_age_ms": 277000, + "event_index": 6128, + "modality": "text", + "query_embedding_sha256": "0fe772c4118ab1eb90650520edd1b6f6828cf985f9066cb960453640e7a97260", + "query_ordinal": 243, + "query_timestamp": 1700006128000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "61c66331f3175ea625d5d010272445aa477a6f10001e2c0b75395469f14d1486", + "control_graph_rank_sha256": "bf767d6db98c741be355361d668d4db339e49942d79fd60e8607f45875038885", + "control_public_rank_sha256": "b5bcab105a649b0a3a7d7d84865e98dfa3cfd031210c98356d902e85122ecda2", + "control_seed_rank_sha256": "61c66331f3175ea625d5d010272445aa477a6f10001e2c0b75395469f14d1486", + "control_top1_age_events": 1323, + "control_top1_age_ms": 1323000, + "event_index": 6156, + "modality": "text", + "query_embedding_sha256": "9e804cc001c20d6115c73d2ee5095d14121925d27398006bd5f63bbee938cadc", + "query_ordinal": 244, + "query_timestamp": 1700006156000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "86f8b470a86472d46657330381a63312c1e1a9df9dadf60fb8982954a50ed5bb", + "control_graph_rank_sha256": "e85742c26b763fb24c0a0e3e263e0fc2535dc497f55e05edab86afa052dcb495", + "control_public_rank_sha256": "a0905f277d9b5f7f468d7d3a8fecdee5bf1b7e335b014b79bd59ce610edb5420", + "control_seed_rank_sha256": "86f8b470a86472d46657330381a63312c1e1a9df9dadf60fb8982954a50ed5bb", + "control_top1_age_events": 96, + "control_top1_age_ms": 96000, + "event_index": 6185, + "modality": "text", + "query_embedding_sha256": "bb6a2453229717e311952b07cb133f20af5905813197aae4a392b1ae628a5263", + "query_ordinal": 245, + "query_timestamp": 1700006185000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "eda80bc7d562dfd21ae17d3c05a6988fcf23314877a63320bd55c50689df8126", + "control_graph_rank_sha256": "25b421385d0cdedc5a047e17faf45d4cf4baebcaa0653faa9502c6e9014d0d7e", + "control_public_rank_sha256": "b4b38c84a2811db11157d9ea7332cf23fe2554faba86fcde2d11acaf3914fe3a", + "control_seed_rank_sha256": "eda80bc7d562dfd21ae17d3c05a6988fcf23314877a63320bd55c50689df8126", + "control_top1_age_events": 995, + "control_top1_age_ms": 995000, + "event_index": 6214, + "modality": "text", + "query_embedding_sha256": "c3d1e075c81d5707fc98a134576686e9d452762b24542ca610109cbd7b42e55b", + "query_ordinal": 246, + "query_timestamp": 1700006214000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "6859e8318aed891e377085c6f3cdfd8317373424a4c7060907fd46bca6d27615", + "control_graph_rank_sha256": "c91f428133d9e20b2386e35982bc674cdf13f726da0d2f44043382673278c7c6", + "control_public_rank_sha256": "a31a1b708fdb9d3c9369629feaa0014893cec63439bbd2841d66bbbfa6801874", + "control_seed_rank_sha256": "6859e8318aed891e377085c6f3cdfd8317373424a4c7060907fd46bca6d27615", + "control_top1_age_events": 14, + "control_top1_age_ms": 14000, + "event_index": 6238, + "modality": "text", + "query_embedding_sha256": "3f3249df19ac8a1d1863ef0c6aefbee9c75cf43e9c27c35299565b0513d2b9d0", + "query_ordinal": 247, + "query_timestamp": 1700006238000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "e27a743b945e02df45f87b44d03a7f81a70f38d8782d66f816e9deecf88f98a2", + "control_graph_rank_sha256": "54dc36f3b3d57db568973155a8ddcba30fbd48674287fd552d8c81d46d38c00f", + "control_public_rank_sha256": "19b9ff1a51fdd6bd8d65f72b9c425f67dbe1b159382479322590783a37297ed9", + "control_seed_rank_sha256": "e27a743b945e02df45f87b44d03a7f81a70f38d8782d66f816e9deecf88f98a2", + "control_top1_age_events": 30, + "control_top1_age_ms": 30000, + "event_index": 6263, + "modality": "text", + "query_embedding_sha256": "2e52bd9fc6c4f9f6b56a07e43b7ba550bc2816d13d689350bd48cfac933b731c", + "query_ordinal": 248, + "query_timestamp": 1700006263000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "057f0783044f49ceb26f48fba1656d036b5062c99e5c0a90c980dd6457f9a384", + "control_graph_rank_sha256": "08b9cd43b9c8c2248d1898a356c7c157502ef9246b1ced5bdc99c997390c6c15", + "control_public_rank_sha256": "f055bad8a642f1913d4e507e7ddb6debb7ea9a4038d27873789221d47f0d6330", + "control_seed_rank_sha256": "057f0783044f49ceb26f48fba1656d036b5062c99e5c0a90c980dd6457f9a384", + "control_top1_age_events": 130, + "control_top1_age_ms": 130000, + "event_index": 6286, + "modality": "text", + "query_embedding_sha256": "62a072187827bcb22e4aea81a19523a0ff8ab5bd4a1ec030a7fa6824cc0493f0", + "query_ordinal": 249, + "query_timestamp": 1700006286000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "2b53ed4ae17359cd973186be261651cb73b5f698f54bfc5490735751f149a437", + "control_graph_rank_sha256": "68db45eca7c197796a9b3c65730a060d1ab7af5966cf11acc9d4ebf9ead30cc2", + "control_public_rank_sha256": "a36de2ca1204435e08d841b195ff9f78ee0138af6841fc3a5c2fda6ab8051e72", + "control_seed_rank_sha256": "2b53ed4ae17359cd973186be261651cb73b5f698f54bfc5490735751f149a437", + "control_top1_age_events": 3373, + "control_top1_age_ms": 3373000, + "event_index": 6312, + "modality": "text", + "query_embedding_sha256": "913aa995acf8c16d66fce992be40b7c5e2b950a3bac3d8164e8ca0d8d09c05ab", + "query_ordinal": 250, + "query_timestamp": 1700006312000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "eb3ca3e5042ad28aba45351bdaaf1ea3da73a4e29c82c85467346fffe7741298", + "control_graph_rank_sha256": "ed25b10bf89791e4bce7d4efed699bbdff5a349e260e66b1e05df9882866918d", + "control_public_rank_sha256": "e283bd88b6bc7e7e49a33f4c763726af9c34ebecee54b1d4869f15fa90981cf9", + "control_seed_rank_sha256": "eb3ca3e5042ad28aba45351bdaaf1ea3da73a4e29c82c85467346fffe7741298", + "control_top1_age_events": 2061, + "control_top1_age_ms": 2061000, + "event_index": 6337, + "modality": "text", + "query_embedding_sha256": "47e91024b1067e491893dcd76483830300c7b76814f5754154627c9198845fe4", + "query_ordinal": 251, + "query_timestamp": 1700006337000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "2d18b7dc131920bb9a89d24703101848ec3b04c33916f9716927a883e01d0f36", + "control_graph_rank_sha256": "28f4328387d16945b555f9da2c5c1afa5ae6655b6688166a2137d584a2217bd4", + "control_public_rank_sha256": "6d01e94bae0ab18e3f139032c84b56b400ea500479bd0e622f16306856699f96", + "control_seed_rank_sha256": "2d18b7dc131920bb9a89d24703101848ec3b04c33916f9716927a883e01d0f36", + "control_top1_age_events": 2920, + "control_top1_age_ms": 2920000, + "event_index": 6358, + "modality": "text", + "query_embedding_sha256": "4d58a98968a474046fe9ed07211aac63a0bd876bc0a86f58cb986ab2d9aa7a12", + "query_ordinal": 252, + "query_timestamp": 1700006358000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "1bcb2e77902b2c4f7f8dadb35444dddbe66f3db5132d64451c442031e02c5e5b", + "control_graph_rank_sha256": "9e32982500f3beeec796d2461fd1d4aefbebc054f90bd55eef9f52b567a40a00", + "control_public_rank_sha256": "419afaefa75eb69895b78f422f2eba44e46bf2127ec3ad3bba6a245733fc8504", + "control_seed_rank_sha256": "1bcb2e77902b2c4f7f8dadb35444dddbe66f3db5132d64451c442031e02c5e5b", + "control_top1_age_events": 1598, + "control_top1_age_ms": 1598000, + "event_index": 6387, + "modality": "text", + "query_embedding_sha256": "3dac868d2a8e6e45a2e808adaccbd6dff72d5bf3d8ac35ee314c6a6ee91eaefc", + "query_ordinal": 253, + "query_timestamp": 1700006387000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "87277d5004dcfd37615dc0a58408cf5e37bf239ab07616011f86a0dc625f02c2", + "control_graph_rank_sha256": "fc58a92024d230d396df587a25f01549f9402301e6c2a4dbae3b3e98eacf43d6", + "control_public_rank_sha256": "3fb68bf241a6dcb4f35f718f1504431cbab72e60e4a671451419b8a5a436ab4d", + "control_seed_rank_sha256": "87277d5004dcfd37615dc0a58408cf5e37bf239ab07616011f86a0dc625f02c2", + "control_top1_age_events": 411, + "control_top1_age_ms": 411000, + "event_index": 6413, + "modality": "text", + "query_embedding_sha256": "ff412ff8c88a723043b8a542729e734ba17a9dd3c56504fdded22c2acbe4c5f8", + "query_ordinal": 254, + "query_timestamp": 1700006413000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "6fff5bb308bb8315940d325893ea623846ae2f9e79d24ccb697827963475b32a", + "control_graph_rank_sha256": "4a6cbbdd981122f057a5d068d313b936ca5084ca2fcce83996dc5b9764c93f68", + "control_public_rank_sha256": "b9a3605a7dfb25e6db2b519d27788064d5ca4c2f30bbf78287dabbfdf854f9e3", + "control_seed_rank_sha256": "6fff5bb308bb8315940d325893ea623846ae2f9e79d24ccb697827963475b32a", + "control_top1_age_events": 672, + "control_top1_age_ms": 672000, + "event_index": 6435, + "modality": "text", + "query_embedding_sha256": "b8f6816309c8d35e498b00f092b265d5aec45c79c0ec7efc6dd3de73af49b2d3", + "query_ordinal": 255, + "query_timestamp": 1700006435000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "1befa8bff947cd0c9ca056fb1e6553ba33acf93bdb632d651b61b4947e7b7623", + "control_graph_rank_sha256": "125eec939c429e0bd5d400d8b333a40733256bd8006f68bf32fe7df1d8143ef7", + "control_public_rank_sha256": "88c86657883812b0e67eb5aebb3feac035b690ba6596be7f92efa104120719a0", + "control_seed_rank_sha256": "1befa8bff947cd0c9ca056fb1e6553ba33acf93bdb632d651b61b4947e7b7623", + "control_top1_age_events": 4, + "control_top1_age_ms": 4000, + "event_index": 6458, + "modality": "text", + "query_embedding_sha256": "9cf5f4439050e5db7306ad15d551fd5d1850062eeaaeba7fdda8e1061be046b2", + "query_ordinal": 256, + "query_timestamp": 1700006458000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "8ed9210387fa425e64c824f2d7f1c73e2ffaac34ab162044f83815962b3f61aa", + "control_graph_rank_sha256": "5309f65a3f0f628f63b960fa26f78c52fd426b2df638a3f50abcd180bdf8dead", + "control_public_rank_sha256": "1fed29c89e03809b383dca7b10069123900ee1c384fece1454ab36057baae71b", + "control_seed_rank_sha256": "8ed9210387fa425e64c824f2d7f1c73e2ffaac34ab162044f83815962b3f61aa", + "control_top1_age_events": 733, + "control_top1_age_ms": 733000, + "event_index": 6483, + "modality": "text", + "query_embedding_sha256": "e0d050b15528b438f59c5d13e4474cdf3a2b76e717daef8267085cf24a637483", + "query_ordinal": 257, + "query_timestamp": 1700006483000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "677020bb4336082b49d960316cf84a056de909b64b79f1b3ed5cc22b11aacf9b", + "control_graph_rank_sha256": "27295063ec845c1217a42c7a15fbcbdb2ccf134f1e42a4f5ea5edb6d8b190bea", + "control_public_rank_sha256": "a51bf13d63295c50f16f5a9c4078eb8d3879147fbe300dd8b7bbe19e8c09835d", + "control_seed_rank_sha256": "677020bb4336082b49d960316cf84a056de909b64b79f1b3ed5cc22b11aacf9b", + "control_top1_age_events": 754, + "control_top1_age_ms": 754000, + "event_index": 6512, + "modality": "text", + "query_embedding_sha256": "47aa356b0bbc76bd7ee12fe8a267fa65fdfd6f6be9cbbe89ed03e59554d09035", + "query_ordinal": 258, + "query_timestamp": 1700006512000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "963462594fe23c27cef25660d8130177fd921c96f31d496ae2a06f2707b736a6", + "control_graph_rank_sha256": "f87341e54c12f2d2143dab105dbff8aaed8b2795cb850aa93c5d3749ff30b07d", + "control_public_rank_sha256": "222ae3f144c0aed545a009fcdb44fa57fb8daa5db140b6040cf1f6809c14906b", + "control_seed_rank_sha256": "963462594fe23c27cef25660d8130177fd921c96f31d496ae2a06f2707b736a6", + "control_top1_age_events": 3137, + "control_top1_age_ms": 3137000, + "event_index": 6538, + "modality": "text", + "query_embedding_sha256": "1af0e27bc638a4e150b5e85c42319d0b549268715eb6ffd8f96c8ff0646f8180", + "query_ordinal": 259, + "query_timestamp": 1700006538000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "f8039a5d2bd35656d02affb7d2d04f26d56562d8e56016d5e0bd7cd125c223a3", + "control_graph_rank_sha256": "47b1cc93779f3eee90b6d9193c2d69550e2f820f90b8a5f64350e985cc6e1fa7", + "control_public_rank_sha256": "8f6258381652593b8b307fc1d4f3ec92b24a6f54d09cb4c96b43b6abcc9ce9e6", + "control_seed_rank_sha256": "f8039a5d2bd35656d02affb7d2d04f26d56562d8e56016d5e0bd7cd125c223a3", + "control_top1_age_events": 3, + "control_top1_age_ms": 3000, + "event_index": 6562, + "modality": "text", + "query_embedding_sha256": "99aed04139eb3f8be1f83ab1f43e2df807262568a5454e58eec1aa24a86c360d", + "query_ordinal": 260, + "query_timestamp": 1700006562000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "a7ab2e8751e3d036468a636cea65ba2228e9c8aa41284a1eaf9802c3f0fbfd30", + "control_graph_rank_sha256": "d596ef98a4f4a8ca8c80eacffe95775cc9bc1072a9127c9aa13353e3f11df96f", + "control_public_rank_sha256": "f2042b5ecad2d1c9f53b146057ca29bbb0152fa246e33cbb15b98a03e2397b7b", + "control_seed_rank_sha256": "a7ab2e8751e3d036468a636cea65ba2228e9c8aa41284a1eaf9802c3f0fbfd30", + "control_top1_age_events": 572, + "control_top1_age_ms": 572000, + "event_index": 6587, + "modality": "text", + "query_embedding_sha256": "b843054883d12a51ebcfffd2d1d14c824c8d1f3281a3d02d76f66e253ff649f4", + "query_ordinal": 261, + "query_timestamp": 1700006587000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "5efc5b33b36bee5386f63b40799aafeffb05ed8eb5e04b5a15a14ed749deb620", + "control_graph_rank_sha256": "2f2545e1c122692de08ef15c2805dd1175c3b1e5cca9e8bdc56462cd1fefc627", + "control_public_rank_sha256": "043d64542d963ef98c349522ddcc8fb0ef1356f721bbb6c029eb84fb04b3a20f", + "control_seed_rank_sha256": "5efc5b33b36bee5386f63b40799aafeffb05ed8eb5e04b5a15a14ed749deb620", + "control_top1_age_events": 4851, + "control_top1_age_ms": 4851000, + "event_index": 6611, + "modality": "text", + "query_embedding_sha256": "d5396300545ef833a44a1dc2990c3d58ac90a4ded49e70331aa7693c1e381941", + "query_ordinal": 262, + "query_timestamp": 1700006611000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "f7e20150f11292a8ebad4ac385503e8902dbf6fb726dc41fa48f708f6c830a28", + "control_graph_rank_sha256": "521e817a38bdefda0879bbdeea3d6ea18fac58a9516dffcf7c0604019cbd749f", + "control_public_rank_sha256": "80c0ebc20f0e8d050742b0faa1df52d6fd04da46e4fabd63572936fd013e3ed2", + "control_seed_rank_sha256": "f7e20150f11292a8ebad4ac385503e8902dbf6fb726dc41fa48f708f6c830a28", + "control_top1_age_events": 4255, + "control_top1_age_ms": 4255000, + "event_index": 6635, + "modality": "text", + "query_embedding_sha256": "1f4256cc5f59aeeedb49af5b226e9cda52af48f2ae41bc151616f1aa1b9c1009", + "query_ordinal": 263, + "query_timestamp": 1700006635000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "55be49028c7e5e2387a2eb992b331eb8119771dad993b44b37f2dc6c8a923283", + "control_graph_rank_sha256": "4deb724cc27bf4a8215bc6d3e01aa730f7bd987c8e949831da9503f43e158803", + "control_public_rank_sha256": "f2700983b02e3fb7c7d750748fc41c9ceec61abd270e5d302f029287129f16c5", + "control_seed_rank_sha256": "55be49028c7e5e2387a2eb992b331eb8119771dad993b44b37f2dc6c8a923283", + "control_top1_age_events": 14, + "control_top1_age_ms": 14000, + "event_index": 6659, + "modality": "text", + "query_embedding_sha256": "ab43acdd2b1655f86c21a8c05f9538cb7c4a7e31652fc2418f0f5c3ee534f75b", + "query_ordinal": 264, + "query_timestamp": 1700006659000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "a1f7496bd1365865831c764ad44e3a5d7f4a34bdc69936904810b28f793201ce", + "control_graph_rank_sha256": "2e9db2fd0b9dc6f6bfdcec2c4b8bb01c828246be56ae35a49de2199b375d446a", + "control_public_rank_sha256": "7dd2e81742a9af3fc4fa3af634cccae5b164c9a58221a1aa4592d121b231201c", + "control_seed_rank_sha256": "a1f7496bd1365865831c764ad44e3a5d7f4a34bdc69936904810b28f793201ce", + "control_top1_age_events": 637, + "control_top1_age_ms": 637000, + "event_index": 6680, + "modality": "text", + "query_embedding_sha256": "7e1865575ab3ea623510cfce9dc70f725040fbde3e382b3e6e94e7f19ee3eca4", + "query_ordinal": 265, + "query_timestamp": 1700006680000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "393503194e5bc8eed0a34f013710e657d5b20f8fc57395104716e799b99de167", + "control_graph_rank_sha256": "a46b03439fa87b0ed168dc15fbe8fef8ce97c5409bf9da4b6c8e68cb919b9b6e", + "control_public_rank_sha256": "c5285c27e2267044b5ef9e8b3fcfdb9197985dadb4eb078587ac14b61b5e9c21", + "control_seed_rank_sha256": "393503194e5bc8eed0a34f013710e657d5b20f8fc57395104716e799b99de167", + "control_top1_age_events": 384, + "control_top1_age_ms": 384000, + "event_index": 6705, + "modality": "text", + "query_embedding_sha256": "21f44d844732d5e9bb28d612b2791390cb4753a32a9aa4d74f557ba0842caec5", + "query_ordinal": 266, + "query_timestamp": 1700006705000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "a42446da60925ff4732def23aa386947b89a3f6dcd84f18be9a1d00a14e5521d", + "control_graph_rank_sha256": "ea32b88cd09f2c1e0f0d4d3ade731c4ec7c592bd7ef1e4fc25ea21209ee4625b", + "control_public_rank_sha256": "af2e1c179e84cfc691f9098cc072567850a2e454a95373ffe144d86be98e3161", + "control_seed_rank_sha256": "a42446da60925ff4732def23aa386947b89a3f6dcd84f18be9a1d00a14e5521d", + "control_top1_age_events": 24, + "control_top1_age_ms": 24000, + "event_index": 6729, + "modality": "text", + "query_embedding_sha256": "a32165157596bc23f364f975e80de7b9137e95f31c51c06cda515945be4b66cc", + "query_ordinal": 267, + "query_timestamp": 1700006729000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "e52866a4f4814b3018c3adb424448368878551a4bdfcf58c76b328659e677a60", + "control_graph_rank_sha256": "45586b59d2b469312c610f77348ac4704f9c32b2441ef82b16f4f72110bd3bc8", + "control_public_rank_sha256": "9e7dd567e8ba693780c4476c389a3096ea9492bfd319e81d9658151554634130", + "control_seed_rank_sha256": "e52866a4f4814b3018c3adb424448368878551a4bdfcf58c76b328659e677a60", + "control_top1_age_events": 3852, + "control_top1_age_ms": 3852000, + "event_index": 6755, + "modality": "text", + "query_embedding_sha256": "065d6e7b7a75b9dcc5217e4d8e33c0429fbfac55f3489a71d360c46a93091725", + "query_ordinal": 268, + "query_timestamp": 1700006755000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "b2137456429ad1973c6d6eee9ba901dac82cb26d2b1fbbb895e8ac99a051aff5", + "control_graph_rank_sha256": "cdf48e3ec6f9a0583a87482b8df4df12e028820ef8909086d1103e1263b28786", + "control_public_rank_sha256": "bb1342ba8f5551bc1b9c488141352d04f008a7f13c782584faaa1f1a12e4d7f9", + "control_seed_rank_sha256": "b2137456429ad1973c6d6eee9ba901dac82cb26d2b1fbbb895e8ac99a051aff5", + "control_top1_age_events": 4064, + "control_top1_age_ms": 4064000, + "event_index": 6781, + "modality": "text", + "query_embedding_sha256": "fa7023ef88e4b8588c1d524f32f6397e658bbfe21b5bead2f0a5bb22cab42c96", + "query_ordinal": 269, + "query_timestamp": 1700006781000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "54ec5fbd0e0e40d0340abf9127de6cee528e98ca0a29dc03f3fce6c840744fc5", + "control_graph_rank_sha256": "e2528fc2ef4173c0ecf1afb5a874e70895c9af7cbe55cc9c338a45d994227c30", + "control_public_rank_sha256": "f3f78682ea2da5366101fb503784db01ec189d1f4295d528757b7f058bb9f7c2", + "control_seed_rank_sha256": "54ec5fbd0e0e40d0340abf9127de6cee528e98ca0a29dc03f3fce6c840744fc5", + "control_top1_age_events": 5992, + "control_top1_age_ms": 5992000, + "event_index": 6804, + "modality": "text", + "query_embedding_sha256": "42f5ae3095d17305a8d09fa6a90df58d1b049acc1ed06ddb40bca5d8bac649a9", + "query_ordinal": 270, + "query_timestamp": 1700006804000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "1a6d6c68f7a2a1411839686dd44e064fb3744a5521dfcdd24afe2287b884441d", + "control_graph_rank_sha256": "8c0c3f1deb68e651129aeb2b737a08725745e557a8a28d285733199134525c15", + "control_public_rank_sha256": "6e87e47d9874c3c4de69adbeea15d647c83453d0306a2e5e63c3e0635a9c9a95", + "control_seed_rank_sha256": "1a6d6c68f7a2a1411839686dd44e064fb3744a5521dfcdd24afe2287b884441d", + "control_top1_age_events": 2360, + "control_top1_age_ms": 2360000, + "event_index": 6830, + "modality": "text", + "query_embedding_sha256": "58d96054a387c724a1257a339b248d8b7ea09b2caa38483355fe1c23bbb4ee41", + "query_ordinal": 271, + "query_timestamp": 1700006830000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "fbf3b0ab5803e85290382010a35f9ef73d5a70b0b1a24af13e404b3b6fca6773", + "control_graph_rank_sha256": "5452719f897e3df1e61c4245224a0479cb0a8937f1686ae4be0728de0bfe22e4", + "control_public_rank_sha256": "021747a5cd9e2b5430263313a12c0bcaa633a4ed98398660e25f977b70b7f7fe", + "control_seed_rank_sha256": "fbf3b0ab5803e85290382010a35f9ef73d5a70b0b1a24af13e404b3b6fca6773", + "control_top1_age_events": 23, + "control_top1_age_ms": 23000, + "event_index": 6853, + "modality": "text", + "query_embedding_sha256": "4d58a98968a474046fe9ed07211aac63a0bd876bc0a86f58cb986ab2d9aa7a12", + "query_ordinal": 272, + "query_timestamp": 1700006853000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "1e87dc8b05360210b939c8d3093cd9c29882ae5194eb8f69d6ec6d432292e2b9", + "control_graph_rank_sha256": "6c7c00d39bf011288a4b9cddb7a86a706807b01e0663d140ce7d38f1fd2d1841", + "control_public_rank_sha256": "9539e9d035dc93a83f56a9d70f4cff1e47d2c76d2ffa2e3c09a24dce37846582", + "control_seed_rank_sha256": "1e87dc8b05360210b939c8d3093cd9c29882ae5194eb8f69d6ec6d432292e2b9", + "control_top1_age_events": 6004, + "control_top1_age_ms": 6004000, + "event_index": 6875, + "modality": "text", + "query_embedding_sha256": "723c96cef9fd4ab1f14a2d9c4482ea14f765b0898dfaca0ba85c78cdb2f8fe37", + "query_ordinal": 273, + "query_timestamp": 1700006875000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "54f424039de623f298ae930afe65de5a6aa04b9937084f44246b231c3219d140", + "control_graph_rank_sha256": "c34795e8fe7af2463204897cb2ba6993e152a6885b9d8f806e9bb5a2eb204f2e", + "control_public_rank_sha256": "5b2fe0e60c645193e4dd9061def555b700159d026b0f49eb7bd79c312420fae6", + "control_seed_rank_sha256": "54f424039de623f298ae930afe65de5a6aa04b9937084f44246b231c3219d140", + "control_top1_age_events": 3462, + "control_top1_age_ms": 3462000, + "event_index": 6905, + "modality": "text", + "query_embedding_sha256": "f80563496a41f48246ea18bce5a9531141b6c1c4ea9b20bd9b2ff2db2fa8ecc5", + "query_ordinal": 274, + "query_timestamp": 1700006905000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "4c9dab0ffb9a9f06945b6f14c8986f7e7596a07caa9948b108a63cdbe66d4a90", + "control_graph_rank_sha256": "9d2b9e2ef77ae1330ce961e1a1e1cb1ac6ca42c1fcf977b28e47a8f210e36b5e", + "control_public_rank_sha256": "38a18d3ce7454c9698213e726b41cb833e67203cba2897767ab2592d4a0ffac0", + "control_seed_rank_sha256": "4c9dab0ffb9a9f06945b6f14c8986f7e7596a07caa9948b108a63cdbe66d4a90", + "control_top1_age_events": 543, + "control_top1_age_ms": 543000, + "event_index": 6933, + "modality": "text", + "query_embedding_sha256": "391b8b4a72473179856d7b425f033c3d2c1c32c80ce07a09cc0129399a0e3824", + "query_ordinal": 275, + "query_timestamp": 1700006933000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "9a15c0de59d4bdf7092986ad75d47ac6a2692d70492845e6c544f25813b4ee56", + "control_graph_rank_sha256": "f4a9a81ddf28dd4d0874bdd4e4e0fb0a2eae326f10f2331578019fcd8550624f", + "control_public_rank_sha256": "a7bcd1f9484ee709e3d3fb06e3b4632aac2e9e872894245bcff77967c84f2bb6", + "control_seed_rank_sha256": "9a15c0de59d4bdf7092986ad75d47ac6a2692d70492845e6c544f25813b4ee56", + "control_top1_age_events": 4250, + "control_top1_age_ms": 4250000, + "event_index": 6959, + "modality": "text", + "query_embedding_sha256": "415790c0e4239d69232cf9e639f7a1b31243e260a87e5586315d467e073b00b1", + "query_ordinal": 276, + "query_timestamp": 1700006959000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "e72f09f5c16f1c7bb7dde7387c1b7a4ea17aad8c5b46db5003c8ed0f4c09190d", + "control_graph_rank_sha256": "e1b64d8338faa0685a5666283d8b6aef02f4794651e89b557184238e9b98504f", + "control_public_rank_sha256": "389a3479a0b20fcaa502878a24d49b0014ec20a8b227fcf990ed06e9704fffe3", + "control_seed_rank_sha256": "e72f09f5c16f1c7bb7dde7387c1b7a4ea17aad8c5b46db5003c8ed0f4c09190d", + "control_top1_age_events": 605, + "control_top1_age_ms": 605000, + "event_index": 6982, + "modality": "text", + "query_embedding_sha256": "5de2da7e12302c0adb710c19d936090667ec03a7e3a9cc0040c74c41e14a3419", + "query_ordinal": 277, + "query_timestamp": 1700006982000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "75acf58afc76cb5f0085e0c850671b81efdef92fbddd836bc4ddcc151f04a592", + "control_graph_rank_sha256": "a6a794e4c0803fb3b75d715d3fe953268ef633738c37816603d5d01259f1263e", + "control_public_rank_sha256": "a65d282d617f89e98f8f94dcb1dc0d52b840e4499440acfb66ba6d827e59878d", + "control_seed_rank_sha256": "75acf58afc76cb5f0085e0c850671b81efdef92fbddd836bc4ddcc151f04a592", + "control_top1_age_events": 973, + "control_top1_age_ms": 973000, + "event_index": 7007, + "modality": "text", + "query_embedding_sha256": "8f9a5b8cd4cd11e71afb9ebaa5dfe395196050949fd40357cc50f644d381ac2d", + "query_ordinal": 278, + "query_timestamp": 1700007007000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "abfef4369454954a31e6ebddf72774c2a784eec51f4cab84bf64adc9259b1685", + "control_graph_rank_sha256": "1484e1ad2900c05fb6c0f50319457b0c2e5f78ca24c96d379378dccdcef1f6f3", + "control_public_rank_sha256": "33d0cfa02ae5938b2d7083165c0c4f06257f455fa8871c890d91b93f567f22f5", + "control_seed_rank_sha256": "abfef4369454954a31e6ebddf72774c2a784eec51f4cab84bf64adc9259b1685", + "control_top1_age_events": 4347, + "control_top1_age_ms": 4347000, + "event_index": 7032, + "modality": "text", + "query_embedding_sha256": "c8637c50c751161daf4af6a696502edd37a162c58aedf5efd886112accebabcf", + "query_ordinal": 279, + "query_timestamp": 1700007032000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "a47ba86fd7e1156ed9e77afde590795848992271c794933b1688c844efd77c36", + "control_graph_rank_sha256": "d9b63a0dcb93798cfed7d4f3ae1005bf218c2624bd926c1e53f0387bf13d75af", + "control_public_rank_sha256": "cecc05f85b18ed8a673bb8f3cf21aa789601c0541715a42a0645790b414e6477", + "control_seed_rank_sha256": "a47ba86fd7e1156ed9e77afde590795848992271c794933b1688c844efd77c36", + "control_top1_age_events": 1065, + "control_top1_age_ms": 1065000, + "event_index": 7059, + "modality": "text", + "query_embedding_sha256": "cdea48fba4aa605c2dd06a634f5c1015a5f5cd3556c5c8c46c24a9c12a481c8f", + "query_ordinal": 280, + "query_timestamp": 1700007059000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "f27c71a5bb8933b12e14c23dd47d0c15fd621579d0527652cd3ed9f2232fab76", + "control_graph_rank_sha256": "b39414ec2cfc18de685bc291c0f37802efe6b202620a3e49ab30d583c550a1af", + "control_public_rank_sha256": "4fa7ba77059e299affa8e70f37784ca5049799123cc9683203400cf84e716341", + "control_seed_rank_sha256": "f27c71a5bb8933b12e14c23dd47d0c15fd621579d0527652cd3ed9f2232fab76", + "control_top1_age_events": 7, + "control_top1_age_ms": 7000, + "event_index": 7085, + "modality": "text", + "query_embedding_sha256": "a120972f4542ec948d493f59f1ca7a1ec1df0ee649147b8dcbe7c384d50a8468", + "query_ordinal": 281, + "query_timestamp": 1700007085000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "3e9bb11855c3028780d89cc222133376fa5c87b9ba2fef8aa26edf8efdf492b7", + "control_graph_rank_sha256": "33acb6ebba9f2b93c21019050903d4580d1479fad72cf914e52cc29b5155e214", + "control_public_rank_sha256": "e788c4082b769f994b6076ad3d5e26cbc68e1615c8c41c373280106f26cda510", + "control_seed_rank_sha256": "3e9bb11855c3028780d89cc222133376fa5c87b9ba2fef8aa26edf8efdf492b7", + "control_top1_age_events": 730, + "control_top1_age_ms": 730000, + "event_index": 7112, + "modality": "text", + "query_embedding_sha256": "c80cb47f3f950ccb1a8b615e02f407e95d155c045737d272ae3c5c7bcf67730e", + "query_ordinal": 282, + "query_timestamp": 1700007112000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "09d17a2e7f225abf0e0af8d01d46788f26b3eb3d2a5c3572576dae162607b424", + "control_graph_rank_sha256": "940d8fd915da45501f674dce332076599e833c7686e7316fd7f2ce8dddaa37e0", + "control_public_rank_sha256": "5f7a00d690c7daff1da2aa544e5e1d7eee53c97656074dcc25e2bcdcf2ce891b", + "control_seed_rank_sha256": "09d17a2e7f225abf0e0af8d01d46788f26b3eb3d2a5c3572576dae162607b424", + "control_top1_age_events": 2304, + "control_top1_age_ms": 2304000, + "event_index": 7137, + "modality": "text", + "query_embedding_sha256": "ac7af5ab3e0aa1e680e444c269bb5068c9d5a3a156a43e53898a385236588778", + "query_ordinal": 283, + "query_timestamp": 1700007137000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "66b5c48c234efcb4251bb728f3ceb7166fa709466810675820c6c512fa49d7b6", + "control_graph_rank_sha256": "b2a2bc46c7970ae8ed8a01427f636d252ae2979eb4ff7ad73c71caf49c0905b2", + "control_public_rank_sha256": "fb0f8deb5ecf6dafa4e4ff15d114983ad2dfaa1a5c0c861a88365c4a3b87ac1b", + "control_seed_rank_sha256": "66b5c48c234efcb4251bb728f3ceb7166fa709466810675820c6c512fa49d7b6", + "control_top1_age_events": 461, + "control_top1_age_ms": 461000, + "event_index": 7161, + "modality": "text", + "query_embedding_sha256": "e0d050b15528b438f59c5d13e4474cdf3a2b76e717daef8267085cf24a637483", + "query_ordinal": 284, + "query_timestamp": 1700007161000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "7113da5743780f4682de182d14335f4a7f0324dd89e0a9987829fd6956808502", + "control_graph_rank_sha256": "7fd7f632024fa7e3352125c6708fc4452d71f9d412f79cc4a38b229d28510b08", + "control_public_rank_sha256": "f6f165fb599abd0ca1e950b3edf6b3718d849f5c54d2f1549a8a7997ce222984", + "control_seed_rank_sha256": "7113da5743780f4682de182d14335f4a7f0324dd89e0a9987829fd6956808502", + "control_top1_age_events": 4282, + "control_top1_age_ms": 4282000, + "event_index": 7181, + "modality": "text", + "query_embedding_sha256": "25f1785ec70ecfc9236ddd2b56aedca3e1869d9ac501260375c5e84c69926e10", + "query_ordinal": 285, + "query_timestamp": 1700007181000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "379879833cb7bfeb86ab898735f5b21871298c80a214c9b90ad62b4fade38365", + "control_graph_rank_sha256": "edc35bf0902aaeeb294d87fbd30b712c12491aa71ce7e5a133c32932acf33d29", + "control_public_rank_sha256": "5ce92e7b59bc1f5969fa02ceaf3bbdfe92f0af911f7ffb85c63ebaf8ed0db99b", + "control_seed_rank_sha256": "379879833cb7bfeb86ab898735f5b21871298c80a214c9b90ad62b4fade38365", + "control_top1_age_events": 1898, + "control_top1_age_ms": 1898000, + "event_index": 7205, + "modality": "text", + "query_embedding_sha256": "12e34076f067fb4d124968954429fccd23676212d2a4b47359563571fa071cf3", + "query_ordinal": 286, + "query_timestamp": 1700007205000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "5f3b545e45c51be7d5d49a757f31b1b0742bff144cd96d3c62c1251fe568dd7f", + "control_graph_rank_sha256": "b9a7536d4efe7fca827da9e7e0cd6eb86f5287e5d56f790ef934fc311d87cd59", + "control_public_rank_sha256": "939c01f539834049b616cb07a764cfc9862314cfa2821be8b0ce8ff33eb1a2fd", + "control_seed_rank_sha256": "5f3b545e45c51be7d5d49a757f31b1b0742bff144cd96d3c62c1251fe568dd7f", + "control_top1_age_events": 42, + "control_top1_age_ms": 42000, + "event_index": 7233, + "modality": "text", + "query_embedding_sha256": "d7c3a3debc25e65ebb45f94855c32dfa9e63b6a6c9058c88ce198f1a0b574427", + "query_ordinal": 287, + "query_timestamp": 1700007233000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "a3f757560048b974ab73247b8fe30cee4d4904a9d5a42617c6693ee82f3dcfd5", + "control_graph_rank_sha256": "e9852bc1e332060d78953b6a14077ae1a7ab77c39a6617c16ecc404ff6d4af4a", + "control_public_rank_sha256": "791d0d4e5fe903945e6f40b959c7402d4f82ca4f521be1844387973753fa8502", + "control_seed_rank_sha256": "a3f757560048b974ab73247b8fe30cee4d4904a9d5a42617c6693ee82f3dcfd5", + "control_top1_age_events": 30, + "control_top1_age_ms": 30000, + "event_index": 7258, + "modality": "text", + "query_embedding_sha256": "594a998880426e776bb6f1f8b5725a3aa4fbdc95da7d78b0cdac922d46836a5f", + "query_ordinal": 288, + "query_timestamp": 1700007258000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "cd5893ced8990279e6c447a12229a739049641872162a845eef1f4498b26c9b5", + "control_graph_rank_sha256": "46557ed6d9b9a09867eea6121036ba1c25cafef8d91af6b2ca88a6f4d9c16f2d", + "control_public_rank_sha256": "d277685a8e47c27d2d23a18765447e087d2c8ae5e363a85842d9b51ecd8c6891", + "control_seed_rank_sha256": "cd5893ced8990279e6c447a12229a739049641872162a845eef1f4498b26c9b5", + "control_top1_age_events": 25, + "control_top1_age_ms": 25000, + "event_index": 7283, + "modality": "text", + "query_embedding_sha256": "0c8a72f8e09aac4f301754e6463d2788cdb85029d9fd8bddda528c95aa2628e3", + "query_ordinal": 289, + "query_timestamp": 1700007283000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "f22940b3fffb1cdd0fef1de40042f97a77a29fcc90ffc43b0b0cd56a561135a1", + "control_graph_rank_sha256": "018b80632c7091e8b6c27dca92223760231584e1c0dce639070019dd8ddf7088", + "control_public_rank_sha256": "ef32c994ee59a1a10cd19ddbba34c6ca01c7c632ff86a838e44b5b08d137c49e", + "control_seed_rank_sha256": "f22940b3fffb1cdd0fef1de40042f97a77a29fcc90ffc43b0b0cd56a561135a1", + "control_top1_age_events": 77, + "control_top1_age_ms": 77000, + "event_index": 7310, + "modality": "text", + "query_embedding_sha256": "360bffcdbe88e41a7ffbf144bf29f7582032ac00814a20c1989fe6c2d8ecf7c5", + "query_ordinal": 290, + "query_timestamp": 1700007310000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "4b7ea945f61f0a171b5c06d5f7d95cfa4962a39fc5a08777f5d6865e45dd4c01", + "control_graph_rank_sha256": "424c4e153cb441c3bcc4162f13e3e3df933decb83e423ff800812a562a58c4e7", + "control_public_rank_sha256": "8b467f8f732823711c111edda8b1de0e050fa620cd3c291c03029f10eed87868", + "control_seed_rank_sha256": "4b7ea945f61f0a171b5c06d5f7d95cfa4962a39fc5a08777f5d6865e45dd4c01", + "control_top1_age_events": 1422, + "control_top1_age_ms": 1422000, + "event_index": 7335, + "modality": "text", + "query_embedding_sha256": "09203907e2d6a29229801be867a1f8bc9e9f970e9a2537f79119b7ba51bdfd63", + "query_ordinal": 291, + "query_timestamp": 1700007335000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "5120a7df43c94d9f1b4d1533af467311ea6ae8a5444f5252650232a0bc088d5e", + "control_graph_rank_sha256": "9259e165392978230575aea246210b6a05682130a422e9bfd318400b8887009c", + "control_public_rank_sha256": "5d59875cedceae640be96d10d78ef79fdfc60a7fdaf751b216b23ba63de5d556", + "control_seed_rank_sha256": "5120a7df43c94d9f1b4d1533af467311ea6ae8a5444f5252650232a0bc088d5e", + "control_top1_age_events": 4545, + "control_top1_age_ms": 4545000, + "event_index": 7362, + "modality": "text", + "query_embedding_sha256": "a2b216e014bef9723821a71c4e879c96f8d005107a0b77442adf7ebf1d2352be", + "query_ordinal": 292, + "query_timestamp": 1700007362000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "663c59f49264aaa031fa4082b4cddfd49225c353f901b30ce1faa29016029947", + "control_graph_rank_sha256": "3f093aee839d872d941d23d460ff7d310f76c1813a5a3769f504645fef4ac890", + "control_public_rank_sha256": "31fbec262c29681d0cf8adaa5da4de804da9094d88fe17dff1dee5a5fc3bcbb4", + "control_seed_rank_sha256": "663c59f49264aaa031fa4082b4cddfd49225c353f901b30ce1faa29016029947", + "control_top1_age_events": 4286, + "control_top1_age_ms": 4286000, + "event_index": 7383, + "modality": "text", + "query_embedding_sha256": "8bce7d9daaf704f198639a1fc543749cdc08a4a3c8943bd84d181ab889d66cc3", + "query_ordinal": 293, + "query_timestamp": 1700007383000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "ed5f993b0109ae3653f47e69700c078200ab4ee67ce9aabf4b8be8b7b0d1787e", + "control_graph_rank_sha256": "8ccdf85d710022539f26b2353360cc50a2e275ac6b99cc1e1f55cdcf38f9bdff", + "control_public_rank_sha256": "af7b1350a373bd29197934c0105beeab258ad5a411ed27a572ddc878babcc932", + "control_seed_rank_sha256": "ed5f993b0109ae3653f47e69700c078200ab4ee67ce9aabf4b8be8b7b0d1787e", + "control_top1_age_events": 365, + "control_top1_age_ms": 365000, + "event_index": 7409, + "modality": "text", + "query_embedding_sha256": "5501da7c88c965b84d341971782ce00a0cfa3252fc4f5473fde8a78ae14df95e", + "query_ordinal": 294, + "query_timestamp": 1700007409000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "596ed5940cfa3dbb9417a664fad8231d5183fd0550635bb77b109d240888c285", + "control_graph_rank_sha256": "44a22e6c95b7773540c554234e8c0831d56dbec8b8cd7c1554d27fcbc679cc16", + "control_public_rank_sha256": "4ae3cf87737b288b9bbfb597adb88ed86609a7eee0bd86938f1feb8c551e1d1b", + "control_seed_rank_sha256": "596ed5940cfa3dbb9417a664fad8231d5183fd0550635bb77b109d240888c285", + "control_top1_age_events": 459, + "control_top1_age_ms": 459000, + "event_index": 7432, + "modality": "text", + "query_embedding_sha256": "c581ea2049260fd22280a023892e1ed048cf254ff3b15d113f838fed8a00eb74", + "query_ordinal": 295, + "query_timestamp": 1700007432000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "e27bbee8c48cdc2b628626795c0f571adb5f4097c20b8e1112c43b5f9750b044", + "control_graph_rank_sha256": "6cabb6cda8d8fabded02871edbf1239dbc7f7310ad104b2548cb19f8ab481674", + "control_public_rank_sha256": "009a107ce5404bb23a1dca267ee3aa085e846552344b8ee717d01f1d99b49ed2", + "control_seed_rank_sha256": "e27bbee8c48cdc2b628626795c0f571adb5f4097c20b8e1112c43b5f9750b044", + "control_top1_age_events": 745, + "control_top1_age_ms": 745000, + "event_index": 7458, + "modality": "text", + "query_embedding_sha256": "4f753d33ea0e7575cf20af7dbab23580fc57989c63da3375be3e79931d2a4008", + "query_ordinal": 296, + "query_timestamp": 1700007458000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "72bc2a56a4c21241cbb063d82e8b64f8d16f2bc565be2cae69a032b4c82cfee8", + "control_graph_rank_sha256": "e36420745091e3bf59608dfb77a925cbfc17d1681b723535e1b17f6905bf4909", + "control_public_rank_sha256": "902dcf882344353be4fb32b357932dd63a17c1fca1ae66c9b5465693b38fcae0", + "control_seed_rank_sha256": "72bc2a56a4c21241cbb063d82e8b64f8d16f2bc565be2cae69a032b4c82cfee8", + "control_top1_age_events": 391, + "control_top1_age_ms": 391000, + "event_index": 7481, + "modality": "text", + "query_embedding_sha256": "5ef7e5519e89e879ca52b56c87df3b5beb803a39993a9cc171af01d5578704c2", + "query_ordinal": 297, + "query_timestamp": 1700007481000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "bf03e876b8e8718a1875ba347efda002e4b7b4d27743a130eec3865958b5af32", + "control_graph_rank_sha256": "267c1cb4c0135650c6505024365645d629efbfc44421bf60741979e05f47d729", + "control_public_rank_sha256": "9f0d8f77ec6fe395505f4adf20fac61d6d8a1eab6e381227c4dc5244a3bf0e80", + "control_seed_rank_sha256": "bf03e876b8e8718a1875ba347efda002e4b7b4d27743a130eec3865958b5af32", + "control_top1_age_events": 559, + "control_top1_age_ms": 559000, + "event_index": 7509, + "modality": "text", + "query_embedding_sha256": "847269e877c1aa509bc22fa1ae088210ed8489b93764e6cb566285737b36f98f", + "query_ordinal": 298, + "query_timestamp": 1700007509000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "5f86816c2f324ddf0281a1e604a170ad60b0d2bde785010d2f08a59eae99856b", + "control_graph_rank_sha256": "36e80889059d8c0fec3538d6fb5e257ba80e991bde4d4c7b1a222b230de46a31", + "control_public_rank_sha256": "5327ea08a69a61e1f2e3f4c2901514cc76af4198acb8213f6861e896ba115c1e", + "control_seed_rank_sha256": "5f86816c2f324ddf0281a1e604a170ad60b0d2bde785010d2f08a59eae99856b", + "control_top1_age_events": 6794, + "control_top1_age_ms": 6794000, + "event_index": 7530, + "modality": "text", + "query_embedding_sha256": "dcd46be4deb323debe5133af6d159c54290529ba0eded0606a36b941a1fc8ecc", + "query_ordinal": 299, + "query_timestamp": 1700007530000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "763f97b5ba5c8d2bf0e9dc32e2c72a8c9dfd2c2b6d7842c969667d4f75349914", + "control_graph_rank_sha256": "c143401ac0c50144afeacd1372f7bc041d90c50a926f3c9b22ae11292b05aa12", + "control_public_rank_sha256": "883e9d511be62a83157c6ef6d92b6a85e15b0d0d2183272cd39289b00e82c78d", + "control_seed_rank_sha256": "763f97b5ba5c8d2bf0e9dc32e2c72a8c9dfd2c2b6d7842c969667d4f75349914", + "control_top1_age_events": 2768, + "control_top1_age_ms": 2768000, + "event_index": 7566, + "modality": "text", + "query_embedding_sha256": "db06be69ddfacabf2f1434ef1b40efe9bf277b18ccc85aae85902251b42620f2", + "query_ordinal": 300, + "query_timestamp": 1700007566000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "168a67fa6e205efdcde5173d860e856fb6152dc9d7857af2dc194ba0b5ccbf42", + "control_graph_rank_sha256": "bdf54a26d6b380eff5790b39f1c6e402eea5065df509c6096b9adef1e7b99683", + "control_public_rank_sha256": "cbffd66594fa86387148fb8349f7df066315d1ee6d0de3d0f65d98edc7af0537", + "control_seed_rank_sha256": "168a67fa6e205efdcde5173d860e856fb6152dc9d7857af2dc194ba0b5ccbf42", + "control_top1_age_events": 28, + "control_top1_age_ms": 28000, + "event_index": 7590, + "modality": "text", + "query_embedding_sha256": "52c557b7eac1cdceaae4c87e36c017dbafc30af1d2be8278f45646f668c1f848", + "query_ordinal": 301, + "query_timestamp": 1700007590000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "fa28510c8fa18558917446a6ccdd871085f1c67d410359748f68fc2ea639d97d", + "control_graph_rank_sha256": "10c5233dc4f81490361edc057961915b01fe3502bb92dd1513e25cda9ec99be6", + "control_public_rank_sha256": "df924cd921460a9981284e53d60e313d7a68b56488e4a11f11055d800a4679d6", + "control_seed_rank_sha256": "fa28510c8fa18558917446a6ccdd871085f1c67d410359748f68fc2ea639d97d", + "control_top1_age_events": 222, + "control_top1_age_ms": 222000, + "event_index": 7614, + "modality": "text", + "query_embedding_sha256": "d97e93e9e6f580267a5cc103d9ca64613dd0ec69233a1113feac0c9f1575e4db", + "query_ordinal": 302, + "query_timestamp": 1700007614000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "2e7150dc7859c583cb894f657ecd4743f15836b2f974e5914551be2321e3a3ed", + "control_graph_rank_sha256": "38d76037fe9b1755de4c1be421f210f9f9f677d345c643bc50e7a126adabca21", + "control_public_rank_sha256": "d38c24c25a4de4044a330d31f88ec38e3fb27647dd6521d619b2b662034b90b5", + "control_seed_rank_sha256": "2e7150dc7859c583cb894f657ecd4743f15836b2f974e5914551be2321e3a3ed", + "control_top1_age_events": 6085, + "control_top1_age_ms": 6085000, + "event_index": 7639, + "modality": "text", + "query_embedding_sha256": "9b94fefd268d270587cabc71842ecf92fd50e3bc51683925d6c1cc254653d2dc", + "query_ordinal": 303, + "query_timestamp": 1700007639000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "c4717f4c77ed6bdaeae7cd1648df323c1f158967ba3aa8b455fb279b4f823e6c", + "control_graph_rank_sha256": "900ab2089ead6c84683076f108b79f13a48e83609ac89eebe4564f51c172c277", + "control_public_rank_sha256": "d3f824107314ca2b73d7cca54a36b2897b73c7fdfb00310d1e6f432d745a1462", + "control_seed_rank_sha256": "c4717f4c77ed6bdaeae7cd1648df323c1f158967ba3aa8b455fb279b4f823e6c", + "control_top1_age_events": 4952, + "control_top1_age_ms": 4952000, + "event_index": 7669, + "modality": "text", + "query_embedding_sha256": "fa7023ef88e4b8588c1d524f32f6397e658bbfe21b5bead2f0a5bb22cab42c96", + "query_ordinal": 304, + "query_timestamp": 1700007669000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "b8bb164005072c5a2017bdde84c3438ab2a49d0672da3487465423de0125dc81", + "control_graph_rank_sha256": "b6dec2abdd2ac0ec7f869ae54ec460cae1442a0861d64b485e6bba34127368d1", + "control_public_rank_sha256": "9fa4aa9c2f7d8e9ef4806da159e66ae717f9478c073cfe6727996050ee5a46e4", + "control_seed_rank_sha256": "b8bb164005072c5a2017bdde84c3438ab2a49d0672da3487465423de0125dc81", + "control_top1_age_events": 2397, + "control_top1_age_ms": 2397000, + "event_index": 7690, + "modality": "text", + "query_embedding_sha256": "ef680eef651ebbafdbffa6eef901315fd4948a557bd9e3668db18220b5e1040e", + "query_ordinal": 305, + "query_timestamp": 1700007690000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "8fbeff73a4e60fe2682c87fb4f0025772e468896fa11ba1c814ab25d50c1a84e", + "control_graph_rank_sha256": "1d53d6e30f1621c9cdd01931def0b428d3997ec1a78bc75e83a4791a7be0a655", + "control_public_rank_sha256": "fe02ca28a449397318e5cfd70c84d9b15ca4fa4b11e10e3319ab8305db09b3b0", + "control_seed_rank_sha256": "8fbeff73a4e60fe2682c87fb4f0025772e468896fa11ba1c814ab25d50c1a84e", + "control_top1_age_events": 67, + "control_top1_age_ms": 67000, + "event_index": 7717, + "modality": "text", + "query_embedding_sha256": "c25292c732099d7660da8bcfd624a3d83bae8ef91da81fabd6d2be56523c3b32", + "query_ordinal": 306, + "query_timestamp": 1700007717000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "ded36b4261ad7b740c826c62f0ad6c6515b94ed62cc3db0aa46425f475a99a21", + "control_graph_rank_sha256": "811536d31f04f0266aa3194c673b0794e22d1368febe6b337e0b492a367fc185", + "control_public_rank_sha256": "8dd4152dd336a3213ad425935bfb98f8b4fea14577d7e77ef22e6228bc9a9ff1", + "control_seed_rank_sha256": "ded36b4261ad7b740c826c62f0ad6c6515b94ed62cc3db0aa46425f475a99a21", + "control_top1_age_events": 4427, + "control_top1_age_ms": 4427000, + "event_index": 7746, + "modality": "text", + "query_embedding_sha256": "61ecf336f046025b861fb0f51a05ea0fbcb73bc55e6c29c02f65a8cfffaea5e7", + "query_ordinal": 307, + "query_timestamp": 1700007746000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "5d75fb95cb5f07ddcdff7a735044b41d9ab4e741db2826affad84184db8704c6", + "control_graph_rank_sha256": "4ab0643f459149636d77dd6d3f211cbd3bf5f5bcb3a32f85fa0b51ec79bb5870", + "control_public_rank_sha256": "d7496d05f7adf6d0ee28a14602071260aed129a29d01580e53cce10cf2f73b3d", + "control_seed_rank_sha256": "5d75fb95cb5f07ddcdff7a735044b41d9ab4e741db2826affad84184db8704c6", + "control_top1_age_events": 4839, + "control_top1_age_ms": 4839000, + "event_index": 7774, + "modality": "text", + "query_embedding_sha256": "f859622c1d4245b4c6672d59b37369e07eeb746f0120e50b424dc567b190aed3", + "query_ordinal": 308, + "query_timestamp": 1700007774000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "abd585d2ef4aa25664967d9e03866cc80a339644d3110d75ee3fab0cdc872b5c", + "control_graph_rank_sha256": "6683d0d73a6db902ae42444e7744494f1e7eef0db5d6f7f6a50fde4c202d771a", + "control_public_rank_sha256": "15ab4d619f28494f73d6a5222c1461fcc2e64f4c03f8c3b15fcb6227f253e2fd", + "control_seed_rank_sha256": "abd585d2ef4aa25664967d9e03866cc80a339644d3110d75ee3fab0cdc872b5c", + "control_top1_age_events": 2578, + "control_top1_age_ms": 2578000, + "event_index": 7797, + "modality": "text", + "query_embedding_sha256": "b7117314dd82474e08d83aa3d17d9f23347fe7ab3f0b459efe19836b4ffdfc70", + "query_ordinal": 309, + "query_timestamp": 1700007797000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "e064cf685bdcc6a8385e3d68b0aaf0d63b2c314cbf182b48d2888a2130340827", + "control_graph_rank_sha256": "ed588c91e8c3fb52bd272c9faa9444d48724dbf13c236388e30ff6d3dbd1d756", + "control_public_rank_sha256": "765685d71df76c15aea220dd7ef478e6bd278a3bb20ddf6759d6fd8b3f46548b", + "control_seed_rank_sha256": "e064cf685bdcc6a8385e3d68b0aaf0d63b2c314cbf182b48d2888a2130340827", + "control_top1_age_events": 6163, + "control_top1_age_ms": 6163000, + "event_index": 7816, + "modality": "text", + "query_embedding_sha256": "3c0b5ca7faab83cd63cf5bef29f6139c47d52f75fb9ee74adfe7a70887006d90", + "query_ordinal": 310, + "query_timestamp": 1700007816000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "6b73d2a135053f41c30dad99014257ae4d6f06be0fb137c5bdf31b9b4a91f028", + "control_graph_rank_sha256": "b045a78b3821507435899499f84ee7e38344375a17cd5ba180af58300d2c64ce", + "control_public_rank_sha256": "a1c505a408a32176c2dd11b573b6b1f7adefe0ec445a195a7c82588ec930d4ed", + "control_seed_rank_sha256": "6b73d2a135053f41c30dad99014257ae4d6f06be0fb137c5bdf31b9b4a91f028", + "control_top1_age_events": 599, + "control_top1_age_ms": 599000, + "event_index": 7840, + "modality": "text", + "query_embedding_sha256": "d1c3576711f69a0d636f973de46ffa87bfac075d608af2c99684c1277f16d837", + "query_ordinal": 311, + "query_timestamp": 1700007840000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "81eb5b3992020a5af538afba3efe063367267b149e588788e3d86c4913046842", + "control_graph_rank_sha256": "ef01b2871eb1f4589ae1af33ca8c905c8834ddf28c6e694411169f0dc672f097", + "control_public_rank_sha256": "0f23f82e0c378c45bf6f28659a5a9a54a1c19723deaab012acf4e992d023fc69", + "control_seed_rank_sha256": "81eb5b3992020a5af538afba3efe063367267b149e588788e3d86c4913046842", + "control_top1_age_events": 5838, + "control_top1_age_ms": 5838000, + "event_index": 7865, + "modality": "text", + "query_embedding_sha256": "2752b29a35a09804ee4a0838dae24f4b421c08b638b2343323a195c70435b8a0", + "query_ordinal": 312, + "query_timestamp": 1700007865000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "76a43762ec3bef4de539c12224b4923bac0b9774374752be85cf945dcd48ab37", + "control_graph_rank_sha256": "12ff50394beb3e10f20343e4495c7738c1bda69c2984044e0ce7c4a60c6e2a48", + "control_public_rank_sha256": "9bfff577bffbe6216484dd05eadbaee9811d3cb4f632fc46172f05a68b6dee19", + "control_seed_rank_sha256": "76a43762ec3bef4de539c12224b4923bac0b9774374752be85cf945dcd48ab37", + "control_top1_age_events": 187, + "control_top1_age_ms": 187000, + "event_index": 7891, + "modality": "text", + "query_embedding_sha256": "dd74869d38aa7a83a1e5c0f78a5b49a6a0db4968de03e6f3f03cccf94467cfc4", + "query_ordinal": 313, + "query_timestamp": 1700007891000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "8426dfd2690f54fef3fccd99e7f0b48fbff524c28d77c63e2ee6a515b07a6f6b", + "control_graph_rank_sha256": "10ba420af35bd6951b4a3e6005e8bb9bdd063ae5b6e3c97cc45875bc3f02e105", + "control_public_rank_sha256": "21d2e9c4bb8cfe568a7cb47f80b04e87bee4e2ed817f300d1f6bbf48c4c0c0b5", + "control_seed_rank_sha256": "8426dfd2690f54fef3fccd99e7f0b48fbff524c28d77c63e2ee6a515b07a6f6b", + "control_top1_age_events": 5068, + "control_top1_age_ms": 5068000, + "event_index": 7911, + "modality": "text", + "query_embedding_sha256": "9959bdce90e042115d5a36d7555fe0dc0232b331f1457a1dfa9ddd1e2c5f58cf", + "query_ordinal": 314, + "query_timestamp": 1700007911000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "c282c0305f312f3461ca33c44f224ee6562d5276d6b4a961d7171f475a8f6ea4", + "control_graph_rank_sha256": "a86b3c17b6bb39fa2023a66623dd8cd6ba2dcb3b89ecced126fbe99d8fdcc854", + "control_public_rank_sha256": "8fd5c4492dea9bd93a5753021c2d814d7918467beee9683660470002c4237dbe", + "control_seed_rank_sha256": "c282c0305f312f3461ca33c44f224ee6562d5276d6b4a961d7171f475a8f6ea4", + "control_top1_age_events": 977, + "control_top1_age_ms": 977000, + "event_index": 7936, + "modality": "text", + "query_embedding_sha256": "3b2a781e14dbb982f6a52c882bc254429a3d5b2c3571e948ccb1c6fe6b1f3fa8", + "query_ordinal": 315, + "query_timestamp": 1700007936000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "fc891e247bd0772b7b99d2c36af3d0cc382871ff21cb7617af897daaa2e4bcc3", + "control_graph_rank_sha256": "c256f55448d1b54fef26bf4f6dfccf1a3435b3cf50be1720e5167773fdacbdc1", + "control_public_rank_sha256": "d8f28d2e1294b00350852bdebd3f73a9541c8f4f5bb9e592ae7faf689ef849c7", + "control_seed_rank_sha256": "fc891e247bd0772b7b99d2c36af3d0cc382871ff21cb7617af897daaa2e4bcc3", + "control_top1_age_events": 2829, + "control_top1_age_ms": 2829000, + "event_index": 7963, + "modality": "text", + "query_embedding_sha256": "d8370078176c158b8e64db2694077d1cc8e4e6daacfc11ca2dcd7cc15336be3e", + "query_ordinal": 316, + "query_timestamp": 1700007963000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "1b517e058f27936f15f605e295538587327479527ef7fde31be18fde358bba9e", + "control_graph_rank_sha256": "3df691a9497af64accd91dd2933a67567ab9891cd41d91f0ae19e493165ef0d2", + "control_public_rank_sha256": "1c6d22dfc528c7a2519308d824ef2f3bbf9cd36d7846b9c778f8c840e6ae32b1", + "control_seed_rank_sha256": "1b517e058f27936f15f605e295538587327479527ef7fde31be18fde358bba9e", + "control_top1_age_events": 2650, + "control_top1_age_ms": 2650000, + "event_index": 7989, + "modality": "text", + "query_embedding_sha256": "7fce1c6254ab412e5f98643c26c81209a5591cbb0406309026e78e0b2ac1371d", + "query_ordinal": 317, + "query_timestamp": 1700007989000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "699f7eaa3ade4018849fa14631b1fe6741eba3762c136a68f31bc3f06d3647e3", + "control_graph_rank_sha256": "1a1dfa61e61f1ad42ec2e252fbd8d7409a95d2d72f6d736ca6f953144ab24f7d", + "control_public_rank_sha256": "0b048c55bff985ac8cac0ece78d5cf203106ce664f8e7276870742104ae38d01", + "control_seed_rank_sha256": "699f7eaa3ade4018849fa14631b1fe6741eba3762c136a68f31bc3f06d3647e3", + "control_top1_age_events": 2338, + "control_top1_age_ms": 2338000, + "event_index": 8010, + "modality": "text", + "query_embedding_sha256": "09321369e2ce6f191a0d67948512cef6fd610f11a4aa628b37a6ea44d080f4de", + "query_ordinal": 318, + "query_timestamp": 1700008010000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "9520be78186cac27c17c7fd6b4db8eea85a6ed43a84ae97e03c71010244a8d70", + "control_graph_rank_sha256": "9258f71a825c2a7bbf2e42f7f08b7063fe300a7c44db8c22ae8dae61ad66a324", + "control_public_rank_sha256": "97a90a2f49b26bc669a1f4c0c0c6f33d76ebf02ab105638d9b702861c5e59db0", + "control_seed_rank_sha256": "9520be78186cac27c17c7fd6b4db8eea85a6ed43a84ae97e03c71010244a8d70", + "control_top1_age_events": 41, + "control_top1_age_ms": 41000, + "event_index": 8038, + "modality": "text", + "query_embedding_sha256": "0a0cf13da536acf9510f73d84845920e7cb6aef62d34aca37da8cbf598bbcdd3", + "query_ordinal": 319, + "query_timestamp": 1700008038000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "f337552772dd79508eecc1c8658a40994d3efa2e4e1caf8490a8f01833087e31", + "control_graph_rank_sha256": "b66b5586931bb89f68d1b98993c0590996719dd9e9fa44cf17a1e92c00760e3f", + "control_public_rank_sha256": "fd83d398efefd651d95aacbf6a5c963d47c3b17302fffdfe58f14aabc7abfe10", + "control_seed_rank_sha256": "f337552772dd79508eecc1c8658a40994d3efa2e4e1caf8490a8f01833087e31", + "control_top1_age_events": 18, + "control_top1_age_ms": 18000, + "event_index": 8060, + "modality": "text", + "query_embedding_sha256": "550132f07cdd79de505e6102cf455a08b22c6474b359a9001f6cf758433f4873", + "query_ordinal": 320, + "query_timestamp": 1700008060000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "c41ac18a947190f39fcfb091775acf7ee506e391881a17fe5b45db17f345dcca", + "control_graph_rank_sha256": "a71cf49952218d137321ebff58af562a562738d8c12d0ea064b1ff4fd5c9254b", + "control_public_rank_sha256": "4d1f5b0842f16ef506105c0c79042ecf1662174ff0fcecf18bedbd67be21693a", + "control_seed_rank_sha256": "c41ac18a947190f39fcfb091775acf7ee506e391881a17fe5b45db17f345dcca", + "control_top1_age_events": 83, + "control_top1_age_ms": 83000, + "event_index": 8085, + "modality": "text", + "query_embedding_sha256": "573a2f7f696dfea021b8ee5a66294a298a8f5bb14ed146fbb7f5c45f71043e1a", + "query_ordinal": 321, + "query_timestamp": 1700008085000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "3c48bcb00cba256754a17c08cd1defedbcc0f81203a2b27484b24bd52c0d20bb", + "control_graph_rank_sha256": "d3b165892d77a526d8fad5d79744a7ba6b7311a9502eacdbb588846855559ec2", + "control_public_rank_sha256": "30ab64c0503ce4367e86f74dfe8b61894e9704b6e541def2756a59c49fcb007b", + "control_seed_rank_sha256": "3c48bcb00cba256754a17c08cd1defedbcc0f81203a2b27484b24bd52c0d20bb", + "control_top1_age_events": 92, + "control_top1_age_ms": 92000, + "event_index": 8112, + "modality": "text", + "query_embedding_sha256": "c92214db7c55642d071a55427380f8f90a14bb2c812954cc20b879727136fbf2", + "query_ordinal": 322, + "query_timestamp": 1700008112000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "59494db315c4445f7a4bcf9f77568c495eb33ba000d99d89d963baa7f942ec64", + "control_graph_rank_sha256": "419e8a711fefceece1aaaf0f0e09594d84ceb4bb5c077e927e328fb74dd32fe6", + "control_public_rank_sha256": "8c1d565cab57ae7f4f8142d7413779b1017f20d5cc4677ba61e4d064da2a1ef8", + "control_seed_rank_sha256": "59494db315c4445f7a4bcf9f77568c495eb33ba000d99d89d963baa7f942ec64", + "control_top1_age_events": 6599, + "control_top1_age_ms": 6599000, + "event_index": 8139, + "modality": "text", + "query_embedding_sha256": "77bb356f6a179c5a928541a3bbdc2353d2d6782fd0f318a1864b0227c43be2da", + "query_ordinal": 323, + "query_timestamp": 1700008139000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "221309854b2a42e4e4af429407a7b1152e8203179060e16181316a43b719024d", + "control_graph_rank_sha256": "97dc2b31d39130a7602049ff3bbdc666d5c1ad87de24645174cc2642c671005a", + "control_public_rank_sha256": "035e3ced5f1700c83586657a69daa7aeed98faffe51afd604e363908ed7771f6", + "control_seed_rank_sha256": "221309854b2a42e4e4af429407a7b1152e8203179060e16181316a43b719024d", + "control_top1_age_events": 5090, + "control_top1_age_ms": 5090000, + "event_index": 8168, + "modality": "text", + "query_embedding_sha256": "8b2a6597ba3dd201e4c0cb42708eadc59c9b7a20885d6c5f9456568f60ad3ed3", + "query_ordinal": 324, + "query_timestamp": 1700008168000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "75a5ce06767daa448b89c9ff5b40323030ca285cfaa835574313dee7f14bace3", + "control_graph_rank_sha256": "d9aa9f2a6f59302447ac849692b9e11841b6c683c0938a66c003262da3ddd89a", + "control_public_rank_sha256": "1f9bc0823726df3a8fff5a6b4bca6ed1c25c94a43a2c1ed564f228cfd8f41d54", + "control_seed_rank_sha256": "75a5ce06767daa448b89c9ff5b40323030ca285cfaa835574313dee7f14bace3", + "control_top1_age_events": 4, + "control_top1_age_ms": 4000, + "event_index": 8195, + "modality": "text", + "query_embedding_sha256": "7388d007c56bb60de97a5c0c7ef9df0a53c7edf23752c08d08b0372d442af2d8", + "query_ordinal": 325, + "query_timestamp": 1700008195000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "ec998cd14cf42ad23ad7e1354163a51718a64a5425789fce977650cf4f0df7fc", + "control_graph_rank_sha256": "89d3789e13d8fe875d0d1eb404d7fef069c99024fc2d9c204a2e7f18fad9c33f", + "control_public_rank_sha256": "c40def0bdbc79a20e2934220462712abba724f7296c83a09859dfcabcb8be2de", + "control_seed_rank_sha256": "ec998cd14cf42ad23ad7e1354163a51718a64a5425789fce977650cf4f0df7fc", + "control_top1_age_events": 14, + "control_top1_age_ms": 14000, + "event_index": 8217, + "modality": "text", + "query_embedding_sha256": "79af1f6fcbc9ab97d307648dea21f10520fc079f029e048155552bfd53681f61", + "query_ordinal": 326, + "query_timestamp": 1700008217000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "3da1685a577812d45274a26f598cd55cf46fee9427646d6667e0bdf6e00e5c42", + "control_graph_rank_sha256": "007fae2aeb19db7e94113bb173bc9e106ea191a590b0ea5f140863bbbec61f03", + "control_public_rank_sha256": "aed4c050c2c3e2d689c4e00843a8e058f5e470a7199a5049dfda09a196b59e32", + "control_seed_rank_sha256": "3da1685a577812d45274a26f598cd55cf46fee9427646d6667e0bdf6e00e5c42", + "control_top1_age_events": 1825, + "control_top1_age_ms": 1825000, + "event_index": 8242, + "modality": "text", + "query_embedding_sha256": "53fc4ee8a8abb0fa6fb692a29a49502ca27ef6927d8069e8912a40eddae6ac61", + "query_ordinal": 327, + "query_timestamp": 1700008242000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "25af50e0a1945952ccb44caf41f9314ad0e42c5bb8258d426bcb4e02df18fab1", + "control_graph_rank_sha256": "9c21ea583589ef370e29df2d4e5a3cacc54aa79e19251337e136b054fba4d5c0", + "control_public_rank_sha256": "c6d385f8bed81d7367435a73d1f88affd6e1716db98c101bd776896cd8a9f28c", + "control_seed_rank_sha256": "25af50e0a1945952ccb44caf41f9314ad0e42c5bb8258d426bcb4e02df18fab1", + "control_top1_age_events": 8, + "control_top1_age_ms": 8000, + "event_index": 8265, + "modality": "text", + "query_embedding_sha256": "fadff4adcf3361e18f6aaf277382c55d25e8be552674dcf3c89dea6044eac41c", + "query_ordinal": 328, + "query_timestamp": 1700008265000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "d1bc8ca9dd9c228960543c22da21e87dc5f31130751e4f838460d802b92e9f12", + "control_graph_rank_sha256": "3a8864e812037fe5585b656b95888eba5283a594fc1086be28cfcf60bdcada44", + "control_public_rank_sha256": "0860cf8a0beba8e7d3dcb3fc893562b56b571aa6c727ad460346c3f8f573634a", + "control_seed_rank_sha256": "d1bc8ca9dd9c228960543c22da21e87dc5f31130751e4f838460d802b92e9f12", + "control_top1_age_events": 1407, + "control_top1_age_ms": 1407000, + "event_index": 8290, + "modality": "text", + "query_embedding_sha256": "46e1d250f87dbee54ba0ae8b54b5ede6b3651479d66a73fd20563223e1459dd0", + "query_ordinal": 329, + "query_timestamp": 1700008290000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "184e33338194ac71928cb730dccca3b0eaeba07aa7ef2f36fbf365c8573c4740", + "control_graph_rank_sha256": "a6423112ee31507a05347a317432ca95b2a0f24a779e6c9b57f3957f468fe95a", + "control_public_rank_sha256": "6cf211de663a4ee70ea2112c343ea37e317434afd4f7c2048585cbdcb5755990", + "control_seed_rank_sha256": "184e33338194ac71928cb730dccca3b0eaeba07aa7ef2f36fbf365c8573c4740", + "control_top1_age_events": 7503, + "control_top1_age_ms": 7503000, + "event_index": 8315, + "modality": "text", + "query_embedding_sha256": "dbf48262b9e2f705d9e8541ee41ce650e8925b40b955ccab11b3dc32590540eb", + "query_ordinal": 330, + "query_timestamp": 1700008315000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "4282c70cb0187ce287ddfca734b78a20f805411130d431f5072ecfea44d24c6f", + "control_graph_rank_sha256": "06bde8d8094f63226f2c1b5bcb05ad33cbe1136be789af656bd1347f30a8d7b0", + "control_public_rank_sha256": "4af7f4b1a86e178b42625a3ff0c54e1d2b005f2567835109369708f67dadcdfb", + "control_seed_rank_sha256": "4282c70cb0187ce287ddfca734b78a20f805411130d431f5072ecfea44d24c6f", + "control_top1_age_events": 6, + "control_top1_age_ms": 6000, + "event_index": 8346, + "modality": "text", + "query_embedding_sha256": "b3365c12bf3d3c49fd7876a645e9109e90c47817ca77b87349efa43184880352", + "query_ordinal": 331, + "query_timestamp": 1700008346000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "ff8b2d9c8209e399c78d1d9104b209c7c6322b59b8004d487ed1d8eba99cbc97", + "control_graph_rank_sha256": "ffa768c943745dabb27a0dd896d18186275404cbc1e352ccbddb1413ecf221f5", + "control_public_rank_sha256": "93aec3e447d8f1f484b3dfd4abacf082aef137e0e51d62c180bff8fe3aad07d5", + "control_seed_rank_sha256": "ff8b2d9c8209e399c78d1d9104b209c7c6322b59b8004d487ed1d8eba99cbc97", + "control_top1_age_events": 1494, + "control_top1_age_ms": 1494000, + "event_index": 8369, + "modality": "text", + "query_embedding_sha256": "af7c36f33aab2b97c1237d99dbb0231bd2dd8ab30ea638dd619ebbc7e218f660", + "query_ordinal": 332, + "query_timestamp": 1700008369000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "0f40498281c5506d54b76e5f4feeea430625dfb658173cdbda2ab1e8e3ab82eb", + "control_graph_rank_sha256": "510a421fd6756844cfe22e0ca9a07a3e7ef7fcddbe091ce01fe48dfd7659068a", + "control_public_rank_sha256": "1bf34f527e12a2dae4af1789db4f575acda09210a9994884df4a5d53fcb989b4", + "control_seed_rank_sha256": "0f40498281c5506d54b76e5f4feeea430625dfb658173cdbda2ab1e8e3ab82eb", + "control_top1_age_events": 2548, + "control_top1_age_ms": 2548000, + "event_index": 8399, + "modality": "text", + "query_embedding_sha256": "ee16a30a3ddf92b725d42b4895fb61031c50d8f77bb5a00204646c34f2b5d7cd", + "query_ordinal": 333, + "query_timestamp": 1700008399000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "74eb80c627eb4b5a876b42b9ddf38399bb9d3c97d91331f8804f5163fc39456a", + "control_graph_rank_sha256": "c702135824a213f88ac6f0ac0067a2f6314c2dc3c90f2d05bd64d58b9ebcb8d5", + "control_public_rank_sha256": "5929e0d6b9cfabbc8c8e79bd1a4919bd49d08a2fbea59aaf82652737694fa0a0", + "control_seed_rank_sha256": "74eb80c627eb4b5a876b42b9ddf38399bb9d3c97d91331f8804f5163fc39456a", + "control_top1_age_events": 3266, + "control_top1_age_ms": 3266000, + "event_index": 8424, + "modality": "text", + "query_embedding_sha256": "711e3a9dc3c12b1f97318133fbbd8a5ab55254ca6a3be50f87ec73929d013656", + "query_ordinal": 334, + "query_timestamp": 1700008424000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "2dfa6efab22e4df9eac622f62354d480c59178d8fea76880f79f3e0037ab3ce9", + "control_graph_rank_sha256": "705320ada5c329b95f1c701bfba782da219326d110471f134e4b5ea753322f2f", + "control_public_rank_sha256": "174d762b2c6948a73d1c06e46faab9e912c7e25ef077df615b9492ad1644cdd4", + "control_seed_rank_sha256": "2dfa6efab22e4df9eac622f62354d480c59178d8fea76880f79f3e0037ab3ce9", + "control_top1_age_events": 80, + "control_top1_age_ms": 80000, + "event_index": 8452, + "modality": "text", + "query_embedding_sha256": "caed3e8d844d8bb803fb48a73d07d8e94c64b4ac5e0374041cd29d46f23feadf", + "query_ordinal": 335, + "query_timestamp": 1700008452000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "4b4a2289ed566aecdd389f09d30e025277fbd7f483ba28ae810f354a7618eb2a", + "control_graph_rank_sha256": "f9336d8789a43d8e6c2265c908572333d403057d01fd6fa678bd5f84fe1be3f7", + "control_public_rank_sha256": "fafc2d33496e5daa6e36cffbbdcb3b27d0e0d3b6bb3b290dddb059c8f2233833", + "control_seed_rank_sha256": "4b4a2289ed566aecdd389f09d30e025277fbd7f483ba28ae810f354a7618eb2a", + "control_top1_age_events": 2650, + "control_top1_age_ms": 2650000, + "event_index": 8480, + "modality": "text", + "query_embedding_sha256": "1820fc28b5045f46af04127058b174d7099adaa50cd2bdfdd98ae4681b1c1cd8", + "query_ordinal": 336, + "query_timestamp": 1700008480000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "4a78c844f91213941b17e502795a16e0ff8355ed810bd250a2542e2d67252697", + "control_graph_rank_sha256": "7739376e2af8a04b68d9f1791f28283bdeb50daf4fa845c9afaa0c52e82262f7", + "control_public_rank_sha256": "7d1caa60606cffa6fa1126ede8a0fea0e8dfdeea50fbd9261626837801e692b8", + "control_seed_rank_sha256": "4a78c844f91213941b17e502795a16e0ff8355ed810bd250a2542e2d67252697", + "control_top1_age_events": 110, + "control_top1_age_ms": 110000, + "event_index": 8505, + "modality": "text", + "query_embedding_sha256": "3052cb75df4f9aa6989159edcf0d6d31968d7f77419a8f3fa3c91c5bac45b1fe", + "query_ordinal": 337, + "query_timestamp": 1700008505000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "9fc609e3cf258a1ae4f32b5b3993cc8b468efc61334dc410eccda64e42dd4ec7", + "control_graph_rank_sha256": "28c0796ddd8140e085efd5abdfa69f6c3309698c7a43b02513372ef63710c938", + "control_public_rank_sha256": "318b0e7a22ca2c678358328e7299d10e70f9191542f95413d27e244409643f70", + "control_seed_rank_sha256": "9fc609e3cf258a1ae4f32b5b3993cc8b468efc61334dc410eccda64e42dd4ec7", + "control_top1_age_events": 1700, + "control_top1_age_ms": 1700000, + "event_index": 8525, + "modality": "text", + "query_embedding_sha256": "db9d7fcb4f2a9a9f0b1b77e183291c6ff5003b04bffda384280f9d8b79f01032", + "query_ordinal": 338, + "query_timestamp": 1700008525000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "6d0e18e1a4a1b51c78ca55ce880acf7483de913ce73aab9346f41bc22930d96c", + "control_graph_rank_sha256": "3c18765a1a1d316faf4c14b83e1822bab7da7434c74c884aa10503cc98a3bb4d", + "control_public_rank_sha256": "166fb6735fb6bf4f73faf4b4c62dec1aa00de366968f6ee1eccbfe2bebb99f9b", + "control_seed_rank_sha256": "6d0e18e1a4a1b51c78ca55ce880acf7483de913ce73aab9346f41bc22930d96c", + "control_top1_age_events": 2624, + "control_top1_age_ms": 2624000, + "event_index": 8551, + "modality": "text", + "query_embedding_sha256": "ddc5a36c398e607ccd6c3feca050d39ba36fdf6b31efdc427a1ec04bda720db9", + "query_ordinal": 339, + "query_timestamp": 1700008551000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "0ec2f902ecf548a82f3caaa11980df803c5ca1b32e562f0eb63c11c5079d64a5", + "control_graph_rank_sha256": "117b41bb3056b6e2b054165fa733b2afa674340c1d28b5e2e3b8652adce61eb5", + "control_public_rank_sha256": "66cfe3287e584c3502d2d2bcac436f29bad5cfcc41169fd829b465a0343954d1", + "control_seed_rank_sha256": "0ec2f902ecf548a82f3caaa11980df803c5ca1b32e562f0eb63c11c5079d64a5", + "control_top1_age_events": 263, + "control_top1_age_ms": 263000, + "event_index": 8578, + "modality": "text", + "query_embedding_sha256": "3a03c4e501a7aafce7e69fe942e656c973020769f74f1dd18cc0620070b8843a", + "query_ordinal": 340, + "query_timestamp": 1700008578000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "201f1d5316aece51539834009ca2804cc75ee2e737e031d7a05f97df0ad46e4e", + "control_graph_rank_sha256": "2c55ee99ec1e2b0463e6d2a420a42590bc08303e36d6535fbbc309f6044bc85f", + "control_public_rank_sha256": "75ba296d0494a316f70f5a34341ba7f49e3eaccafffc033c82e488534ac1be54", + "control_seed_rank_sha256": "201f1d5316aece51539834009ca2804cc75ee2e737e031d7a05f97df0ad46e4e", + "control_top1_age_events": 3265, + "control_top1_age_ms": 3265000, + "event_index": 8604, + "modality": "text", + "query_embedding_sha256": "9f7cc4bc9886d3747425f2553e68879c5145ed21b5f80bbf601fe788ef81d2df", + "query_ordinal": 341, + "query_timestamp": 1700008604000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "1126382c60f39d8abbc282902e90e3bc1471ad8921589dbe0ba0524943364055", + "control_graph_rank_sha256": "12c5482e6f0d0a212190d619424f8581aa6251f3c223ee97a010984f7ade9d8d", + "control_public_rank_sha256": "f3ccf1f6b41fee5c7923310ef615548f69c9d9f612aea03397f12c7fb28462b8", + "control_seed_rank_sha256": "1126382c60f39d8abbc282902e90e3bc1471ad8921589dbe0ba0524943364055", + "control_top1_age_events": 773, + "control_top1_age_ms": 773000, + "event_index": 8630, + "modality": "text", + "query_embedding_sha256": "0d122134128bb515443854aa029b41a5fcad6266ce317fe87ef0bd0ae654b6d9", + "query_ordinal": 342, + "query_timestamp": 1700008630000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "ebd221e016d394cde7aff343d6032044668cc17a344f7db926633e6210515fce", + "control_graph_rank_sha256": "3f3f555511c9f25debb45187e457ceced236c360b5687deefbebbcc3c5842d22", + "control_public_rank_sha256": "0f28a24ac9e010d7b2552ce27661a90ee4a385ed5303d502e20bdeaf7ab2b0d4", + "control_seed_rank_sha256": "ebd221e016d394cde7aff343d6032044668cc17a344f7db926633e6210515fce", + "control_top1_age_events": 7840, + "control_top1_age_ms": 7840000, + "event_index": 8652, + "modality": "text", + "query_embedding_sha256": "2256c6a60fc96686a3eedc43f7e6dfef4e882f5c02316154c8d23d4e5bd11a0b", + "query_ordinal": 343, + "query_timestamp": 1700008652000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "76f7c0c3e065f57f9cf650c3539d7c6144fa150f3b56c9c4347aae9c1652773e", + "control_graph_rank_sha256": "6a1e180cebe8922322cea5dce77b6523b204b6fb8a853b77882149e9e3455d6e", + "control_public_rank_sha256": "16deb3274a1842445db1689e28d9c3265aaf72ee9a447198535f9074a9d02197", + "control_seed_rank_sha256": "76f7c0c3e065f57f9cf650c3539d7c6144fa150f3b56c9c4347aae9c1652773e", + "control_top1_age_events": 619, + "control_top1_age_ms": 619000, + "event_index": 8679, + "modality": "text", + "query_embedding_sha256": "94099825c1e670a815d8bd9a86437b6d505579b47d1ac21f113a52f841333a80", + "query_ordinal": 344, + "query_timestamp": 1700008679000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "2c97bf383380fe0d944bb0d640c71227fb63f4b027afdb7a4e13f17293febfd2", + "control_graph_rank_sha256": "cd80a42f0f9eee1149186bd2cd328235f1c2b584cf409f8628b22195c1edec04", + "control_public_rank_sha256": "3e21e1735d00c44f7002c3596a2b525b04d6d4440c5d30e0490d06dbd2e9741f", + "control_seed_rank_sha256": "2c97bf383380fe0d944bb0d640c71227fb63f4b027afdb7a4e13f17293febfd2", + "control_top1_age_events": 474, + "control_top1_age_ms": 474000, + "event_index": 8706, + "modality": "text", + "query_embedding_sha256": "a9f5ddd023c8299a10d534be74f437c12259a4074cb24def96812b7ea91d4823", + "query_ordinal": 345, + "query_timestamp": 1700008706000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "f51051b2be343a4b6de6913659209b6e02d5d9429f83e8587b25f3c044861964", + "control_graph_rank_sha256": "d5de41215265562ad5f98b9332046da4894e768a8cf42d78a890cc5fc7b695e2", + "control_public_rank_sha256": "d57a08f98a671b5f4ee54f6b86e52ae539d6bf5892f1aa413c185bf244a8bdee", + "control_seed_rank_sha256": "f51051b2be343a4b6de6913659209b6e02d5d9429f83e8587b25f3c044861964", + "control_top1_age_events": 1059, + "control_top1_age_ms": 1059000, + "event_index": 8729, + "modality": "text", + "query_embedding_sha256": "d52ffbc29f36ae005f2965f158024a54f4f11dcb8ab907e6144942a0a1f061d2", + "query_ordinal": 346, + "query_timestamp": 1700008729000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "c47be1bccfa022e62929f6a02258ab283ffda5319907f42fa65aa22f7bbe8749", + "control_graph_rank_sha256": "8f2b356692fd8bc370642f0068d1153009748ca24eb4cce530d400f09bea73a8", + "control_public_rank_sha256": "fbb8077f1b4ff2e0631101f2a28743725db757850d50f7ec6d7bc820c347a964", + "control_seed_rank_sha256": "c47be1bccfa022e62929f6a02258ab283ffda5319907f42fa65aa22f7bbe8749", + "control_top1_age_events": 20, + "control_top1_age_ms": 20000, + "event_index": 8749, + "modality": "text", + "query_embedding_sha256": "0aca22ae52e8e84d743c686486eaef75ea37a937f3d04c0d4a111d877012abe1", + "query_ordinal": 347, + "query_timestamp": 1700008749000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "889b9480d68e26e7a28e386ae02c561f98fe8f75437eb42ffcd8644b34858342", + "control_graph_rank_sha256": "bcdba822c63cd627ec45a3c9086a8b256d1d9dd06e6e212d02c49068ce9c9d83", + "control_public_rank_sha256": "5489db02922da02f4f0b6336d65bc98750a5346b906e9d16fe228da5b9c91acd", + "control_seed_rank_sha256": "889b9480d68e26e7a28e386ae02c561f98fe8f75437eb42ffcd8644b34858342", + "control_top1_age_events": 216, + "control_top1_age_ms": 216000, + "event_index": 8776, + "modality": "text", + "query_embedding_sha256": "b06d93c2b518ff07053c177d88086a0b304042e7f951defa014aaec2c3975dea", + "query_ordinal": 348, + "query_timestamp": 1700008776000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "ffc1fdd671b2d7371f0632afed26525913f79f9910b59f898b2aae965763cd6e", + "control_graph_rank_sha256": "a92d2660ee6f5ea640cb43be10df12d07f1621ef3e9a4226c2a034e196d11a7f", + "control_public_rank_sha256": "96e55c9450c773703f6a047d9ca59ef42da967ded01d812882f32964d40428cf", + "control_seed_rank_sha256": "ffc1fdd671b2d7371f0632afed26525913f79f9910b59f898b2aae965763cd6e", + "control_top1_age_events": 4325, + "control_top1_age_ms": 4325000, + "event_index": 8800, + "modality": "text", + "query_embedding_sha256": "75559ac9b9b98175f266b8aab6ac27bacd10f5f0eba0f7f6d298d32b1b6c7199", + "query_ordinal": 349, + "query_timestamp": 1700008800000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "bc975fac38c3a01ea740f29ccbb7bc455fccba404b6d5fc546aa840814640609", + "control_graph_rank_sha256": "6c987cd2fc8976922a09bfc4eb837f06ab68b4e6b8511aa9c54ffabf7117cc5d", + "control_public_rank_sha256": "ea4b104bcea13103967d2ab3ad4b90971261b03c25e2ae7c9eed06802b777c2f", + "control_seed_rank_sha256": "bc975fac38c3a01ea740f29ccbb7bc455fccba404b6d5fc546aa840814640609", + "control_top1_age_events": 12, + "control_top1_age_ms": 12000, + "event_index": 8827, + "modality": "text", + "query_embedding_sha256": "5f0c1636b7fcf3dced0b5e7fef5874e2f21e1a8a7dd8197a3fbb9ce3444b2895", + "query_ordinal": 350, + "query_timestamp": 1700008827000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "70d7ebfefec10b208f7845abbf2c6d908ed03a307d8f4cdabf3f47fc186983c9", + "control_graph_rank_sha256": "c85f8908ef2e2628c43d59a1160d25ad9fba7b32a0c56a8366e5c4dede1b4a52", + "control_public_rank_sha256": "f8dfc57dd2ed698bb5f3350ca527a21fd647d08d41f10a20786d4275efcd8065", + "control_seed_rank_sha256": "70d7ebfefec10b208f7845abbf2c6d908ed03a307d8f4cdabf3f47fc186983c9", + "control_top1_age_events": 6, + "control_top1_age_ms": 6000, + "event_index": 8847, + "modality": "text", + "query_embedding_sha256": "e56d140051856ad400a6272e36db3c6430b5fc0e9665a7f678ebf517372d52bc", + "query_ordinal": 351, + "query_timestamp": 1700008847000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "5dc63284dc1c802f02a6c7f07a4266d8d8d1ea9cbdeb7bc2cc899e68eea69b42", + "control_graph_rank_sha256": "b9a152b41dba5533bd265f840524ff9d7f5a9c1ae9498fa75a304f0cddc5b6c2", + "control_public_rank_sha256": "fed7c75290e1b1190ab2f43609442cd9cc16f1399e3479abe2582f102a3afea8", + "control_seed_rank_sha256": "5dc63284dc1c802f02a6c7f07a4266d8d8d1ea9cbdeb7bc2cc899e68eea69b42", + "control_top1_age_events": 4580, + "control_top1_age_ms": 4580000, + "event_index": 8873, + "modality": "text", + "query_embedding_sha256": "5bd8627508194bd96b7409d2801931f3a53e8f039f495b1fba3a67ab64414dec", + "query_ordinal": 352, + "query_timestamp": 1700008873000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "11e927ceda86a7a77a1b8bec1731b1b3ec9d58a63811ab3baaae00e807b3f663", + "control_graph_rank_sha256": "df84194f05e845652253717db017a6ad370f9a6270d1e1033813f436c0aea620", + "control_public_rank_sha256": "7932a6cd292a89b7cb122e06696289af80e3cdcc3eb74f50fa0c30ad3c950201", + "control_seed_rank_sha256": "11e927ceda86a7a77a1b8bec1731b1b3ec9d58a63811ab3baaae00e807b3f663", + "control_top1_age_events": 595, + "control_top1_age_ms": 595000, + "event_index": 8904, + "modality": "text", + "query_embedding_sha256": "1f7c8451edb1e0a03eda8391ee02856070954fc5864505663780b29e8640c025", + "query_ordinal": 353, + "query_timestamp": 1700008904000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "2684cda9551801c3be9831ecfe8266a52ff93fcabf942ab4f0593fe827a0cd60", + "control_graph_rank_sha256": "e2dffd49b93164c0678e4bb2570f9c4d1bd699cf8ac3d8b26687b2e8919e21e4", + "control_public_rank_sha256": "b94c51e1dbd7854206071f905512a582991e9c2b02e897e4074a2320c07fcf96", + "control_seed_rank_sha256": "2684cda9551801c3be9831ecfe8266a52ff93fcabf942ab4f0593fe827a0cd60", + "control_top1_age_events": 80, + "control_top1_age_ms": 80000, + "event_index": 8930, + "modality": "text", + "query_embedding_sha256": "fa2adacd0d712c98f78614ebe97d01fb4d879fbb9f31f6c311c3d8b2d71a9b46", + "query_ordinal": 354, + "query_timestamp": 1700008930000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "c57747104bf7cd5cc123ac1f4474b93c6e0a18f829dd8e4d942266a7bd581aab", + "control_graph_rank_sha256": "bf90418a054d33fddf7e4abecbddb2f3c8c863d568e9280e6265bd7130786aff", + "control_public_rank_sha256": "3e9d603248ddb00f88dcea2f66a151df6cdd353dc937f3bd6350c96d37db7df3", + "control_seed_rank_sha256": "c57747104bf7cd5cc123ac1f4474b93c6e0a18f829dd8e4d942266a7bd581aab", + "control_top1_age_events": 1213, + "control_top1_age_ms": 1213000, + "event_index": 8954, + "modality": "text", + "query_embedding_sha256": "a1537d635318483e91fbc95370ec6c07eafdd0eb8962b6f920c58555f3838720", + "query_ordinal": 355, + "query_timestamp": 1700008954000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "390387acd10d26b5210f43eb8124cfad0d912e28eef6cace638ada09293a56f5", + "control_graph_rank_sha256": "21172fb1cb584362132afc17919a47e18f6083fc1c8b503060834fbedb068322", + "control_public_rank_sha256": "aa93a855cb1ce203effb05c547162edf2bc8067cf3072515699e5a18bcf05bf4", + "control_seed_rank_sha256": "390387acd10d26b5210f43eb8124cfad0d912e28eef6cace638ada09293a56f5", + "control_top1_age_events": 1289, + "control_top1_age_ms": 1289000, + "event_index": 8984, + "modality": "text", + "query_embedding_sha256": "683831d6c6d88f0bdf9f697d6948e71334fa81b4428c1d429015a53d884869c7", + "query_ordinal": 356, + "query_timestamp": 1700008984000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "811891f6ac31773bb3361408ccd70ed339f42363899cfb87a7058be3f88ce4aa", + "control_graph_rank_sha256": "235c892a683d6654eae1bcd6748886cf597455d8dc1d879861fa9f39193fbefb", + "control_public_rank_sha256": "e5fe8f7cbbecac49cb21b6c9af98a050d429bc3dbed870f5ed0c699a4bdf370b", + "control_seed_rank_sha256": "811891f6ac31773bb3361408ccd70ed339f42363899cfb87a7058be3f88ce4aa", + "control_top1_age_events": 5, + "control_top1_age_ms": 5000, + "event_index": 9011, + "modality": "text", + "query_embedding_sha256": "a11336118b598b58282451441e1193bd72d21cc2b28de983b453b89178ce4a9e", + "query_ordinal": 357, + "query_timestamp": 1700009011000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "20212c98d23ff37f2f324d3aacd212e22cfcd14c47a18694e2b9ae8152a04e5d", + "control_graph_rank_sha256": "d8776549083c318b91d9b28490183054c470d709b04b309cb2f5277a921c5412", + "control_public_rank_sha256": "cc15928b9c039be9ad0cbb9973a66291e6d14ada6caa758682d99689e4001c38", + "control_seed_rank_sha256": "20212c98d23ff37f2f324d3aacd212e22cfcd14c47a18694e2b9ae8152a04e5d", + "control_top1_age_events": 3137, + "control_top1_age_ms": 3137000, + "event_index": 9050, + "modality": "text", + "query_embedding_sha256": "e7fea220c170c90fa5ed9f3f9682871e7f83d2d95dcb150aa841e5cb2190ea56", + "query_ordinal": 358, + "query_timestamp": 1700009050000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "93ed3058cf14d96fb7a94d5d292ca8ef3a608d95c9b45f78bd11d1f9ea28fc04", + "control_graph_rank_sha256": "a9435a9a264ffbe7baa5f5db91a01a00fff3d64f6f7dfac5b55b5807eb5a16f4", + "control_public_rank_sha256": "9054930baebc4f85a9a020a8bbdd74d99992b4cebacbc9b8c2e5d593b56b093d", + "control_seed_rank_sha256": "93ed3058cf14d96fb7a94d5d292ca8ef3a608d95c9b45f78bd11d1f9ea28fc04", + "control_top1_age_events": 3706, + "control_top1_age_ms": 3706000, + "event_index": 9075, + "modality": "text", + "query_embedding_sha256": "39cd6b0a8988a7aa84029cee6287977e303e61c5f3bb50693b0dbd1f06a3a2af", + "query_ordinal": 359, + "query_timestamp": 1700009075000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "2b4b892105d71028056e58c2cfe5d8bbb7af00c55b90165a2b97f034244d2dd7", + "control_graph_rank_sha256": "8cc49a077aace17d8ffae0b9bee6a2964a64285a0019c4f47a517c32390db021", + "control_public_rank_sha256": "838cd695f2f8f789d7aa91449ecb342e9613970b554c813ce307c22187145158", + "control_seed_rank_sha256": "2b4b892105d71028056e58c2cfe5d8bbb7af00c55b90165a2b97f034244d2dd7", + "control_top1_age_events": 23, + "control_top1_age_ms": 23000, + "event_index": 9108, + "modality": "text", + "query_embedding_sha256": "2b1ef2feb0c70351585564c53fb963611bca3dea314b24164ffe3a305e869352", + "query_ordinal": 360, + "query_timestamp": 1700009108000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "bf6060383713b80ef0f6974f6eefb6041330afb77766a1bf7e4a9dee8a33b08b", + "control_graph_rank_sha256": "d1921f692a66bc31dbd099b6ec17021b24406c2f32c448301c916942d9a0bd7b", + "control_public_rank_sha256": "5a8c34a0adab311a9ee7216b45dc5b9482ad70b6096e9202bdd119f0005e281e", + "control_seed_rank_sha256": "bf6060383713b80ef0f6974f6eefb6041330afb77766a1bf7e4a9dee8a33b08b", + "control_top1_age_events": 160, + "control_top1_age_ms": 160000, + "event_index": 9138, + "modality": "text", + "query_embedding_sha256": "343f76c67e55bb56be6ef203700e01140ed0c9863da2c62283e2916cc8c41c82", + "query_ordinal": 361, + "query_timestamp": 1700009138000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "a75ccd258b69e3a967c663e1272ca5524d09ae9f082e0275d7140f05eadc91d5", + "control_graph_rank_sha256": "8ca6c1feece765e53a1074f2bc8800ff136d306fd6f15973370b3aa2d58d785c", + "control_public_rank_sha256": "099af7e6a066256888da1a62c284d9cf4be0fde6cf465d882db150125447415d", + "control_seed_rank_sha256": "a75ccd258b69e3a967c663e1272ca5524d09ae9f082e0275d7140f05eadc91d5", + "control_top1_age_events": 62, + "control_top1_age_ms": 62000, + "event_index": 9160, + "modality": "text", + "query_embedding_sha256": "00e56f7ecbc1f555ce4655886f41ccfbf1ac357117dce6c2c154c8d9a34d589e", + "query_ordinal": 362, + "query_timestamp": 1700009160000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "ff7b94772e84a22810549f6fead10df1e6761f9bc26d344c5d6493901003acc0", + "control_graph_rank_sha256": "0f8d64e6488b8721f26bc5cae03426721c9243ecd7761fe62f3f32d6987d5e22", + "control_public_rank_sha256": "72a682d4c3996fc90cb18f3ec4a5bb0901a76bb9c73e6773ce8cd2e3ce8b304c", + "control_seed_rank_sha256": "ff7b94772e84a22810549f6fead10df1e6761f9bc26d344c5d6493901003acc0", + "control_top1_age_events": 14, + "control_top1_age_ms": 14000, + "event_index": 9187, + "modality": "text", + "query_embedding_sha256": "5e8cafb46d5ec508cafee52bf89e046fb37c995ee19d7bda82d3765504a4731d", + "query_ordinal": 363, + "query_timestamp": 1700009187000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "ac18aa60247fdb84503dc7ed48b6e6913044a742936fbc5cb587463eb49f2b7a", + "control_graph_rank_sha256": "2892cc4b4f1c8a0c2cb4d5deadcc57a184715066f3cdf2cd96adec78efb74fdf", + "control_public_rank_sha256": "67b8365e1371db0b98fab1a165765eed32dce31d383224c92aaf6f08bd7b9bd0", + "control_seed_rank_sha256": "ac18aa60247fdb84503dc7ed48b6e6913044a742936fbc5cb587463eb49f2b7a", + "control_top1_age_events": 4, + "control_top1_age_ms": 4000, + "event_index": 9210, + "modality": "text", + "query_embedding_sha256": "929ebb2bf89add7ca40168029818fd2fd99e833cd717f1fd18485117cd16c797", + "query_ordinal": 364, + "query_timestamp": 1700009210000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "cdcb229c5d8939dd3df45271a3b6604d17cc7e39f712976e22e80316c6a3086c", + "control_graph_rank_sha256": "5930a3d1f19d1a055427b98a52a5b12a8dd35e45413a3d4fb93f8981021fb08a", + "control_public_rank_sha256": "a6057eb2baff7b709667bb5981e281bcfb2532e7f3bb57e40b99cec60e7321e4", + "control_seed_rank_sha256": "cdcb229c5d8939dd3df45271a3b6604d17cc7e39f712976e22e80316c6a3086c", + "control_top1_age_events": 5460, + "control_top1_age_ms": 5460000, + "event_index": 9233, + "modality": "text", + "query_embedding_sha256": "49cbba390efef4d2396d9f85b00a7949d3bc30a813e83b849c1ea49ccdb7ef6b", + "query_ordinal": 365, + "query_timestamp": 1700009233000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "cd84ec48a37d7f816b8d88df19701c48b13be70a6460614df2e9059d36af8eae", + "control_graph_rank_sha256": "93c4e51e93e17127a8b782e470bf5bca702e192c57625f2362ff18be7b25ec4f", + "control_public_rank_sha256": "43136c03c21be39ed415e4315e7e6e0d68a7dce73c306bab77e7dc68ad9d9714", + "control_seed_rank_sha256": "cd84ec48a37d7f816b8d88df19701c48b13be70a6460614df2e9059d36af8eae", + "control_top1_age_events": 181, + "control_top1_age_ms": 181000, + "event_index": 9261, + "modality": "text", + "query_embedding_sha256": "aefc9b3f4c255203f3656c90f7776a16f8f5285541f5af20281ad799c158d918", + "query_ordinal": 366, + "query_timestamp": 1700009261000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "28ac568a65763c157954030f53b496447f72a6130ec6f2d9cfaa07938cb134c6", + "control_graph_rank_sha256": "54882fec3f5452fe85aa2b1976cfa866b8cb734e23705b7f9457216fc760ca96", + "control_public_rank_sha256": "84201cd39f883a3d3b84bbe51e1f3fffa568f012b306be2443de0c99fbb508f4", + "control_seed_rank_sha256": "28ac568a65763c157954030f53b496447f72a6130ec6f2d9cfaa07938cb134c6", + "control_top1_age_events": 3902, + "control_top1_age_ms": 3902000, + "event_index": 9294, + "modality": "text", + "query_embedding_sha256": "5847c41b826bd67adf57bbd4f4c53228ac8aa2799b5018d6308cc9559c18e6a9", + "query_ordinal": 367, + "query_timestamp": 1700009294000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "a90922a034c8b9f8c1b915e2908e80cd9e23aeb6b5b4fabf62ce844a7ca4548c", + "control_graph_rank_sha256": "258e070b8d7c37ec940dbe1615a172ef26f8133e9d3b5f01c1fa4ed57e4a7d45", + "control_public_rank_sha256": "9864dff29871ddd55401fb4d8a3c93474e3e1509ffd7592b87957b27584a1c52", + "control_seed_rank_sha256": "a90922a034c8b9f8c1b915e2908e80cd9e23aeb6b5b4fabf62ce844a7ca4548c", + "control_top1_age_events": 4895, + "control_top1_age_ms": 4895000, + "event_index": 9323, + "modality": "text", + "query_embedding_sha256": "80295234da5966f98a56f71e226ec785ca23c51ebc5a58deb20b5e773e9e7418", + "query_ordinal": 368, + "query_timestamp": 1700009323000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "a26e09f3766f199d07319e9330a4deafe687fb8706970e841e9c59257540e990", + "control_graph_rank_sha256": "b549d0ec98534e77e0cb0c9712903ea16386f7bda3218f172efe7221fc13bed7", + "control_public_rank_sha256": "0ee5cf17b8b2a325cb779cb61af84e1578d5fd4c0b115c03686a811344416379", + "control_seed_rank_sha256": "a26e09f3766f199d07319e9330a4deafe687fb8706970e841e9c59257540e990", + "control_top1_age_events": 147, + "control_top1_age_ms": 147000, + "event_index": 9345, + "modality": "text", + "query_embedding_sha256": "ed5307c6d01c706cdb2bb4341c1abdb4babdcba826020a613d72bf1b4569bc5b", + "query_ordinal": 369, + "query_timestamp": 1700009345000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "668f15f218bfcb0875f53ef49b523d9a88eb2ce146a2982fef14f9d1716d69a5", + "control_graph_rank_sha256": "b8412c1e5e332e42986ec6a75c4e3488f4d8611d31a496277d0b06781749514e", + "control_public_rank_sha256": "17eedf87c54fdbb721af46fb1d002c5f65d4be0740a8eb3d2cd1551b0fc08392", + "control_seed_rank_sha256": "668f15f218bfcb0875f53ef49b523d9a88eb2ce146a2982fef14f9d1716d69a5", + "control_top1_age_events": 1985, + "control_top1_age_ms": 1985000, + "event_index": 9372, + "modality": "text", + "query_embedding_sha256": "0a20b85bb261ecb735037d27686cb0c794c19846fc09b3e9a61c212b3a9570de", + "query_ordinal": 370, + "query_timestamp": 1700009372000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "622e2b869cbe2f2979b377da122a5cc41544fd940237d759559fd84a6173709d", + "control_graph_rank_sha256": "bd0d8788932b3d959a149299f03422fbd091686a86c10c1ac4d544a2be64bbbb", + "control_public_rank_sha256": "018f7b5a521a96bb68cf56084a62498191f9485ea75161daf326a29830327c40", + "control_seed_rank_sha256": "622e2b869cbe2f2979b377da122a5cc41544fd940237d759559fd84a6173709d", + "control_top1_age_events": 3861, + "control_top1_age_ms": 3861000, + "event_index": 9396, + "modality": "text", + "query_embedding_sha256": "161a14810776f0a7ee846b82672b78e2f6192246420d1a4d4edf7468a97f1233", + "query_ordinal": 371, + "query_timestamp": 1700009396000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "1e5dc02ce2471b1f30d4e811f8367be6fa60cec035d1b0ee901b88f3aa35e439", + "control_graph_rank_sha256": "e24ce11f78fe792a02a8fba1fc34b7ee471bba1bc5fd89ce0af962e6a84c1e8e", + "control_public_rank_sha256": "a69827920aeb49b302569bf229bbc981ebdc8817a465b7185c543099507c9d5b", + "control_seed_rank_sha256": "1e5dc02ce2471b1f30d4e811f8367be6fa60cec035d1b0ee901b88f3aa35e439", + "control_top1_age_events": 87, + "control_top1_age_ms": 87000, + "event_index": 9419, + "modality": "text", + "query_embedding_sha256": "51c5e3989ceed9e44a1eaad28f4d3d6d238e66b42aa836113f894b6e4779e3ad", + "query_ordinal": 372, + "query_timestamp": 1700009419000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "83e2be5e6ceca57990434beb905f7e56c6b651d4036e1d196762a014e3caa0f4", + "control_graph_rank_sha256": "da25a66c16e4fc12e743493ecb2928fee00baabe890dbfe4d4cd1b2cf735d08f", + "control_public_rank_sha256": "f216990728e81d8b2268eda07241e1c660b569849bfe2ad957f6b1060912ff72", + "control_seed_rank_sha256": "83e2be5e6ceca57990434beb905f7e56c6b651d4036e1d196762a014e3caa0f4", + "control_top1_age_events": 1996, + "control_top1_age_ms": 1996000, + "event_index": 9445, + "modality": "text", + "query_embedding_sha256": "b2056fc7033c65421580c4c336a742fb2c904442b82f4aeda1062d110a91c58e", + "query_ordinal": 373, + "query_timestamp": 1700009445000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "35c2c622927dafe7c122d812925aad97b36e363decf71adae004ef47b09c2fe3", + "control_graph_rank_sha256": "fa4c88e457f416d5a732056cf4881308b55b408a34abf05c6e265dd120f871b3", + "control_public_rank_sha256": "62edef5a904ab61e40680841b12a0380b7445f3fe32775acb4772dd5fcb65e66", + "control_seed_rank_sha256": "35c2c622927dafe7c122d812925aad97b36e363decf71adae004ef47b09c2fe3", + "control_top1_age_events": 2022, + "control_top1_age_ms": 2022000, + "event_index": 9471, + "modality": "text", + "query_embedding_sha256": "583574f8c409dbe799e99db962fbeaff58da4317a1cbc5bd117c4985a9fd742b", + "query_ordinal": 374, + "query_timestamp": 1700009471000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "5a155a8cf162d8783b583991259ac93ffe653cba98fa09bf2de57a644099feda", + "control_graph_rank_sha256": "c32bc71e9f2c85927c0fc606acc5b8fb3c6a53c808597653eaa63c195dc9d44f", + "control_public_rank_sha256": "9161d316b01312186f7b22490275592a47d5f6708e35997738f17b0997ef2e83", + "control_seed_rank_sha256": "5a155a8cf162d8783b583991259ac93ffe653cba98fa09bf2de57a644099feda", + "control_top1_age_events": 906, + "control_top1_age_ms": 906000, + "event_index": 9498, + "modality": "text", + "query_embedding_sha256": "fdd9194f6b727669becdde55ce6d36ad948c8b71bbc99befa6cb4f335413f03a", + "query_ordinal": 375, + "query_timestamp": 1700009498000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "d77029230226f4879cf389764e1b76e71e0766e2689507b7eb18e9dbe1b23403", + "control_graph_rank_sha256": "e9ec191b7930e1f727b586f79719f9c3d4a0dadb9e64a26581ba02152795670a", + "control_public_rank_sha256": "5e06cd088fbb9fa6043be1edf7aa749802648762ff4e71ff490785a4f437c911", + "control_seed_rank_sha256": "d77029230226f4879cf389764e1b76e71e0766e2689507b7eb18e9dbe1b23403", + "control_top1_age_events": 592, + "control_top1_age_ms": 592000, + "event_index": 9522, + "modality": "text", + "query_embedding_sha256": "554ae2d14929e5b037d9ba4ed952b277bf2323f7b39809da6b186e8493050102", + "query_ordinal": 376, + "query_timestamp": 1700009522000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "3fe99234abe00c8236f3cf7a50909e4956af8457ddc733543ec8d9d6ed47427e", + "control_graph_rank_sha256": "b0432b4f8d03b6b74457ff0288ace970ed0090c48841c48f08b4b7f0df3fabfd", + "control_public_rank_sha256": "7e5de44b9f79c21eb9b8876110a43f4edcb85c7b9890a685e185df22596ab23d", + "control_seed_rank_sha256": "3fe99234abe00c8236f3cf7a50909e4956af8457ddc733543ec8d9d6ed47427e", + "control_top1_age_events": 5986, + "control_top1_age_ms": 5986000, + "event_index": 9547, + "modality": "text", + "query_embedding_sha256": "b5bf2e117ddb76ccf2ecc9d8aafc7c502548b861903c12edb44ea73c7364f1f8", + "query_ordinal": 377, + "query_timestamp": 1700009547000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "38c4420bc715b02794ed145109ae2bcddba356e3e2f9d064d349287afed3b497", + "control_graph_rank_sha256": "c32bb4e0277cc87453e14c4e645f240512fb9446f06788a97cc554e4661fc85e", + "control_public_rank_sha256": "1f7fe46d1389a242aabe3b4d8bbc71bb4733074163d8b0cbdd04af312b7a370d", + "control_seed_rank_sha256": "38c4420bc715b02794ed145109ae2bcddba356e3e2f9d064d349287afed3b497", + "control_top1_age_events": 432, + "control_top1_age_ms": 432000, + "event_index": 9571, + "modality": "text", + "query_embedding_sha256": "4131de40ceb894b362ca6e54a211e01766d05889e34a7aa00ae5e96261f1d958", + "query_ordinal": 378, + "query_timestamp": 1700009571000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "d0d3929247d1eaef2768bcbe0047db73da58f333962f44b119a64d66f404d975", + "control_graph_rank_sha256": "3718e22e94f8f0a5eb94a255c0ebc3c6b8caab37078fdf633567b32ce25d0856", + "control_public_rank_sha256": "6719cf09f79495df32861ca1417d64102880456ebdff7c5ca52059de7088836c", + "control_seed_rank_sha256": "d0d3929247d1eaef2768bcbe0047db73da58f333962f44b119a64d66f404d975", + "control_top1_age_events": 7560, + "control_top1_age_ms": 7560000, + "event_index": 9599, + "modality": "text", + "query_embedding_sha256": "7f47204b67ed740de1a28a26ae58217bb32439e1246b7307b050746e801fe7b6", + "query_ordinal": 379, + "query_timestamp": 1700009599000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "38e7e1aaac75b645b3b8ff17a147dffae57efe9f1d7b787760bb2b5825feed81", + "control_graph_rank_sha256": "c01a1a7f53410f308e04d5320ab27ac100d4e573c8de03cc36cbfb7a3457495c", + "control_public_rank_sha256": "59008a4332c31f97513140d0b69ed27badd5bda41cfd62c6db16ed622f97afd0", + "control_seed_rank_sha256": "38e7e1aaac75b645b3b8ff17a147dffae57efe9f1d7b787760bb2b5825feed81", + "control_top1_age_events": 370, + "control_top1_age_ms": 370000, + "event_index": 9626, + "modality": "text", + "query_embedding_sha256": "9836d8f042d1a6f8568dbc0899e9d520c6fee7d9c12f8420eecc0fc45bdf200d", + "query_ordinal": 380, + "query_timestamp": 1700009626000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "60220be446e55fb15caf11c0e8346bd5629c98ac6715456490c83df7a7d4ade2", + "control_graph_rank_sha256": "bb75e270537bb18bd97f188efcaf80bcf976026124cbd9052fe414d638edefe9", + "control_public_rank_sha256": "cd5cc483fbc1c62e271d832cf0adcd9deda985b1d03ee38987063ce1b17538d5", + "control_seed_rank_sha256": "60220be446e55fb15caf11c0e8346bd5629c98ac6715456490c83df7a7d4ade2", + "control_top1_age_events": 9, + "control_top1_age_ms": 9000, + "event_index": 9660, + "modality": "text", + "query_embedding_sha256": "0786c0fc6d5bb74351c3d48b9215b3db465850bc759793d291be5eda0f780463", + "query_ordinal": 381, + "query_timestamp": 1700009660000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "52d3992282e6ce4d768c771a5f4b5cf838c4d1394a8442e8a5b611f811f41051", + "control_graph_rank_sha256": "e2fb04153c0aa051e15c6c25fed61fc16f171a92c29c27d24fce524ccada23ee", + "control_public_rank_sha256": "eaf6dae260df5d1129616c36bd46532a072788ca3940f58dbef6f8ba0f5ffd82", + "control_seed_rank_sha256": "52d3992282e6ce4d768c771a5f4b5cf838c4d1394a8442e8a5b611f811f41051", + "control_top1_age_events": 127, + "control_top1_age_ms": 127000, + "event_index": 9689, + "modality": "text", + "query_embedding_sha256": "54a6baa7ca1df71692ebe322c4b9f0582513bb981d9b709f817d4d8896c1a62b", + "query_ordinal": 382, + "query_timestamp": 1700009689000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "815e10dffa3e9de67002285df7188bd6d38cb97ef407feb1e2463b0b9cb8bf0f", + "control_graph_rank_sha256": "b6e6751d1d7aabc41b6eb443cc5b7964bdd3387d1590e55692f1bc1fe3bd4677", + "control_public_rank_sha256": "ba06c2dcd5c050fbbb06f117f17b2d49a5b7a01732feb0a830bb3b46ce072fcd", + "control_seed_rank_sha256": "815e10dffa3e9de67002285df7188bd6d38cb97ef407feb1e2463b0b9cb8bf0f", + "control_top1_age_events": 7680, + "control_top1_age_ms": 7680000, + "event_index": 9719, + "modality": "text", + "query_embedding_sha256": "725b65cf2f160b0a3afb51c56eb26f412993a39dae78983a0db86de78ff61996", + "query_ordinal": 383, + "query_timestamp": 1700009719000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "91c4e96a169a6d2af29fb34a03b66ae2511b127d2e844003d8fd6403124795d7", + "control_graph_rank_sha256": "fa49245f8ebf6b6fd3417e01defcbb936c29cd93b3fd55d2dee8682fedff0623", + "control_public_rank_sha256": "afdd13e5e984137e164d75bb68508c3155799669f0e2d53193fbdbc46ab2a786", + "control_seed_rank_sha256": "91c4e96a169a6d2af29fb34a03b66ae2511b127d2e844003d8fd6403124795d7", + "control_top1_age_events": 2949, + "control_top1_age_ms": 2949000, + "event_index": 9744, + "modality": "text", + "query_embedding_sha256": "25d15c46a765de175ccabe8420fcae14a687e40e2059a7dcf5d2081caf46907b", + "query_ordinal": 384, + "query_timestamp": 1700009744000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "d5a4f3cb583c82e504aabb6ab701454a095d40d66292038426bd53511dad169f", + "control_graph_rank_sha256": "b775b941a4c7058876f06d96d127c9f54367701f0185ff4b6eb59e0af7a0d2ea", + "control_public_rank_sha256": "2d935b158b699f983a15c90a733ba12953d46c9afaea2a4a7807045a85d5fce3", + "control_seed_rank_sha256": "d5a4f3cb583c82e504aabb6ab701454a095d40d66292038426bd53511dad169f", + "control_top1_age_events": 8960, + "control_top1_age_ms": 8960000, + "event_index": 9772, + "modality": "text", + "query_embedding_sha256": "b1b149fa2efed6316cf4e431c28a55c6529f66751fcfce2688958b7f4845773a", + "query_ordinal": 385, + "query_timestamp": 1700009772000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "f320a4b6a2852432f237942dd16da63b52d13a8102864025eb6d776ce781d9a7", + "control_graph_rank_sha256": "65d6967b59995ceaed8c481d2802f0a07326e1537858e131975b451dd172f037", + "control_public_rank_sha256": "78270fb59d9fbce4ae8cd0c555d803de739ffa4c17940b44f7a7d6a58b18c47c", + "control_seed_rank_sha256": "f320a4b6a2852432f237942dd16da63b52d13a8102864025eb6d776ce781d9a7", + "control_top1_age_events": 1072, + "control_top1_age_ms": 1072000, + "event_index": 9798, + "modality": "text", + "query_embedding_sha256": "4b1eca80f6856aaa8c474b204899e9e909afff769e750a4dd177e3beefce6cf3", + "query_ordinal": 386, + "query_timestamp": 1700009798000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "9c713051f1079f47a349c4cd88696bae1d34b7bd1de3b293685a6b245ee82b2c", + "control_graph_rank_sha256": "b02f12db27387bde1fbfce1b781ac893e1720c4a8ef8d561c56d3fcbf8be156f", + "control_public_rank_sha256": "7aaa315f3877b23b756ad1e969cdde8ff4d3a77c3799de9bcffb8aea35f8d272", + "control_seed_rank_sha256": "9c713051f1079f47a349c4cd88696bae1d34b7bd1de3b293685a6b245ee82b2c", + "control_top1_age_events": 891, + "control_top1_age_ms": 891000, + "event_index": 9826, + "modality": "text", + "query_embedding_sha256": "fe4dfca717b90b9906d8028c7427d6ecbc7fbf89c785d2b939ce18677a73b6de", + "query_ordinal": 387, + "query_timestamp": 1700009826000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "9bb86df7b26c0fae24b0d7247b45aa2fc25ee3475f145fa0a5854a90b4c20ffe", + "control_graph_rank_sha256": "019e376e2dba5031b72ce6cad2a90a1f52854af8f78119c59c087bb8b0c99491", + "control_public_rank_sha256": "6ab16b16b529f1fc446552f35defc7b528da38ced92c4a8d37b6fec609782286", + "control_seed_rank_sha256": "9bb86df7b26c0fae24b0d7247b45aa2fc25ee3475f145fa0a5854a90b4c20ffe", + "control_top1_age_events": 8001, + "control_top1_age_ms": 8001000, + "event_index": 9850, + "modality": "text", + "query_embedding_sha256": "2f8d23e5f4c855fce87b7fdf31192bf18cf00265c4733498cc0290184c5e957a", + "query_ordinal": 388, + "query_timestamp": 1700009850000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "a3c916f3bf66cb46fc30b4136267ed58ec43dfd5bc0d297108e28967167187f7", + "control_graph_rank_sha256": "672c6d3306a54eeb2f3439a14142695344e952547a176e384b10dc838e0b8781", + "control_public_rank_sha256": "1cf70839a7010a76e31f5d6b101fc4c602404fc69524c5e3bdf48ef615b75591", + "control_seed_rank_sha256": "a3c916f3bf66cb46fc30b4136267ed58ec43dfd5bc0d297108e28967167187f7", + "control_top1_age_events": 1166, + "control_top1_age_ms": 1166000, + "event_index": 9878, + "modality": "text", + "query_embedding_sha256": "6aeae06228bb95f1103c71093f41746801c41afd45436b8c4cde284b51d5fd9a", + "query_ordinal": 389, + "query_timestamp": 1700009878000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "49d3b00824c9004d6d5dca71bd8431c14dc35f1f7bd825221013ebbca1e9b21a", + "control_graph_rank_sha256": "ab7419b8c0b45954804a46429f1cd40d0d25cc7ca0629c8240f5209d8ba11777", + "control_public_rank_sha256": "f9feb59014346a4081dc306ad2131da0e6d3a9234ae6efa50990152cb0e871ef", + "control_seed_rank_sha256": "49d3b00824c9004d6d5dca71bd8431c14dc35f1f7bd825221013ebbca1e9b21a", + "control_top1_age_events": 1165, + "control_top1_age_ms": 1165000, + "event_index": 9904, + "modality": "text", + "query_embedding_sha256": "65923c6df9b9b88c2068a34cb484d4f0839782f9aa54025b0fd0b3eeddd90a94", + "query_ordinal": 390, + "query_timestamp": 1700009904000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "28f4db1490a505ffa2561a8e1493e0a0fc62f94ed422e315c8689afefcea633d", + "control_graph_rank_sha256": "03428e20f2ddd96bc48f26c3c356b8abfe5222deaaa2b2afec2ba0be41d8a07d", + "control_public_rank_sha256": "dd642c7706aa86ace1b7f061c97b3b87d8d9e46287b8bb75a8d95a9a7cfca03f", + "control_seed_rank_sha256": "28f4db1490a505ffa2561a8e1493e0a0fc62f94ed422e315c8689afefcea633d", + "control_top1_age_events": 4723, + "control_top1_age_ms": 4723000, + "event_index": 9932, + "modality": "text", + "query_embedding_sha256": "b8048a1e126408badbfd8141d6eaee104b7a7792220bad800c3deb9c96449303", + "query_ordinal": 391, + "query_timestamp": 1700009932000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "3d9bf5ff8c5b39b3c213261296fb3d10287c921d4f1bd78217daaf6fde4d7104", + "control_graph_rank_sha256": "8d8213a64fcc2c1aa38383d109b3514a0a2c644f2c7a3d3bba2aeb41ae7f4d54", + "control_public_rank_sha256": "9f70a021c9aad0769af1df12f755e71d46f878b081e11b3f9e8ba25d89ce3da5", + "control_seed_rank_sha256": "3d9bf5ff8c5b39b3c213261296fb3d10287c921d4f1bd78217daaf6fde4d7104", + "control_top1_age_events": 474, + "control_top1_age_ms": 474000, + "event_index": 9955, + "modality": "text", + "query_embedding_sha256": "28454c5084dac072812df955fe869f2f6365a954cba18701ba01656099306dd2", + "query_ordinal": 392, + "query_timestamp": 1700009955000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "03a362d9c1a6e462abbb752a661dd108bba9db2b8bd54a7e16f0a43e67664fca", + "control_graph_rank_sha256": "bfe6eb55929e65d602f6a41f1cd51992b072953a3f23b5ac8a9ea7bb8a9812d5", + "control_public_rank_sha256": "132781ca9dcb91267e2dcbb0c8cee776f4e0302ac8943e92c99710df2e6a33a7", + "control_seed_rank_sha256": "03a362d9c1a6e462abbb752a661dd108bba9db2b8bd54a7e16f0a43e67664fca", + "control_top1_age_events": 96, + "control_top1_age_ms": 96000, + "event_index": 9980, + "modality": "text", + "query_embedding_sha256": "e655458a7cec3ae3516511a93d3a97a568b2aff9ebaaea8ce6717ef2097220d9", + "query_ordinal": 393, + "query_timestamp": 1700009980000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "5bd6f22d879f04cf8d780a9ee43081487897ddb2050aef56133c8906e92d9722", + "control_graph_rank_sha256": "1e5b34645cd25b7db8be6f73d53349806f2cfd6faa3f9586b8c102fb797c7f92", + "control_public_rank_sha256": "29ebadc1d45020b88c3363f09af4baa901ca8f1dbea0dafa1ca92c923165db91", + "control_seed_rank_sha256": "5bd6f22d879f04cf8d780a9ee43081487897ddb2050aef56133c8906e92d9722", + "control_top1_age_events": 475, + "control_top1_age_ms": 475000, + "event_index": 10007, + "modality": "text", + "query_embedding_sha256": "9ee93598d38ebb9ac87bfb9a4228b2690910f4b9a36d4008799fe320b3ead41f", + "query_ordinal": 394, + "query_timestamp": 1700010007000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "d3b35074f85eea3be08c483c84dd3583aa115e53c4a251ddd936094da896ad55", + "control_graph_rank_sha256": "a075e398d45d3c3ffd4d2e297892c774dad69fb64f0995c25543fa46f84f334e", + "control_public_rank_sha256": "2cce324df8bc8bbcecaed4e509cfe15ea4298a4aded85ea6683ad1757f59dd53", + "control_seed_rank_sha256": "d3b35074f85eea3be08c483c84dd3583aa115e53c4a251ddd936094da896ad55", + "control_top1_age_events": 75, + "control_top1_age_ms": 75000, + "event_index": 10031, + "modality": "text", + "query_embedding_sha256": "aacd96bea14a182ee1db746f82faedab77b9858888250abcf24c293dda690385", + "query_ordinal": 395, + "query_timestamp": 1700010031000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "f5346e2e18f4d299ab3011cdc397aa9e4fc32c112504ff1d11556f090b53ba37", + "control_graph_rank_sha256": "8e48ef61f7a45f3e7602f713d941312bf5c6a4fe0609d535b644396935e3cc83", + "control_public_rank_sha256": "97185cd5b3cde7f4298beddd80b1a04c994f37ebf93cc9f29ef1df8162cda7fa", + "control_seed_rank_sha256": "f5346e2e18f4d299ab3011cdc397aa9e4fc32c112504ff1d11556f090b53ba37", + "control_top1_age_events": 4140, + "control_top1_age_ms": 4140000, + "event_index": 10053, + "modality": "text", + "query_embedding_sha256": "864fddc06eeedb4ca7f88d5fbd01cc365b3e41ff7be0f040fe31e5df6873288e", + "query_ordinal": 396, + "query_timestamp": 1700010053000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "f7afda22655a1605d5837cbbfb4358772ae284c9cbdd9d83c9de10b9167ba65f", + "control_graph_rank_sha256": "be2de74164fe026a436b901f9ab4f5567d95253267c4adb5e3ed906443298762", + "control_public_rank_sha256": "c28c24a0d51efde38b17a7106400c46bbe588f6812d9c893436e3eef5464ebb7", + "control_seed_rank_sha256": "f7afda22655a1605d5837cbbfb4358772ae284c9cbdd9d83c9de10b9167ba65f", + "control_top1_age_events": 184, + "control_top1_age_ms": 184000, + "event_index": 10079, + "modality": "text", + "query_embedding_sha256": "9a4506970160bc1a995fc82c605e4663c65177f70637a902ba8ecc2bc6aa74bb", + "query_ordinal": 397, + "query_timestamp": 1700010079000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "caef6c8080ad3e893500c94dd9a92429cd9f8c1c5b7f15ca1e6314e65d5c4448", + "control_graph_rank_sha256": "44782577e7775925fe3eafc945e04dd3676ba976601bbb3870ab7b844cb518f9", + "control_public_rank_sha256": "ab5a7e04ba82c727a0801dd9f0236b96f8cccb1d4320e494c5a7e3cc7ebd634a", + "control_seed_rank_sha256": "caef6c8080ad3e893500c94dd9a92429cd9f8c1c5b7f15ca1e6314e65d5c4448", + "control_top1_age_events": 1176, + "control_top1_age_ms": 1176000, + "event_index": 10106, + "modality": "text", + "query_embedding_sha256": "cad893a80d8f358cf8586134abbfb0d947b1be7663959d24797a39dd6f529d22", + "query_ordinal": 398, + "query_timestamp": 1700010106000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "6d2f080cfacba48a2d447b30f8d4f5c9d611ac32da949258e2f3f99e48716e15", + "control_graph_rank_sha256": "7888443ada34fd953facc5f74919d1f4fb7f32fb57b8e03fd83c2db9f171be6d", + "control_public_rank_sha256": "e25f30c77c6d4120204dc1118939d2dbef8f3c1bc636c985b0c0469df25047fe", + "control_seed_rank_sha256": "6d2f080cfacba48a2d447b30f8d4f5c9d611ac32da949258e2f3f99e48716e15", + "control_top1_age_events": 2881, + "control_top1_age_ms": 2881000, + "event_index": 10130, + "modality": "text", + "query_embedding_sha256": "810811757a1b3e8cba35c62bae8c043205859216cbd00b904e06b4710ba0a671", + "query_ordinal": 399, + "query_timestamp": 1700010130000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "78023571884cb061595f118fe52ae5b9cdf972a541efb6f8bfa30d1368c1007c", + "control_graph_rank_sha256": "8ca8ec4ba9c9ab0acb7e38608abe9a97af13dd8d42adff45ea231fdcb0c132b2", + "control_public_rank_sha256": "4c96834d736f07bfa4ad8eef84caf8ebf82b2f4120c4a64a51ea14124131c505", + "control_seed_rank_sha256": "78023571884cb061595f118fe52ae5b9cdf972a541efb6f8bfa30d1368c1007c", + "control_top1_age_events": 423, + "control_top1_age_ms": 423000, + "event_index": 10158, + "modality": "text", + "query_embedding_sha256": "029e340902a4623d8c21847a71f5160126ebace845d1a51a1809d8a7d6e418c3", + "query_ordinal": 400, + "query_timestamp": 1700010158000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "dced481cf50b9e175c6c300fed477447966b9ea3d0f9512439c144f973cb75be", + "control_graph_rank_sha256": "031f44322cd79c0a45cbf18ad0fb7d1e21438d23e0b779ec0979630201b08591", + "control_public_rank_sha256": "ff1f8612cb92c9f5283ef64bb31e4344c8e3ad4e238cd20dcaa64a73923c12d6", + "control_seed_rank_sha256": "dced481cf50b9e175c6c300fed477447966b9ea3d0f9512439c144f973cb75be", + "control_top1_age_events": 12, + "control_top1_age_ms": 12000, + "event_index": 10184, + "modality": "text", + "query_embedding_sha256": "e391b7adcdf769c8c08ba42cca1a4c8908c0cf16a3d61c64e32f986e735a513a", + "query_ordinal": 401, + "query_timestamp": 1700010184000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "069d89e5fa7bad087fbdb995b213726742d9047cf061c67e83a20c8f619d5f1e", + "control_graph_rank_sha256": "40a17a59d4d3945b69624476f20df6965732dac3392f69b03835b6d4043116e1", + "control_public_rank_sha256": "6fdd24d791b9c295077444f0606b421962829326b04e812ada7de222c4c151aa", + "control_seed_rank_sha256": "069d89e5fa7bad087fbdb995b213726742d9047cf061c67e83a20c8f619d5f1e", + "control_top1_age_events": 3608, + "control_top1_age_ms": 3608000, + "event_index": 10210, + "modality": "text", + "query_embedding_sha256": "9508f1e068aa3819792963592a3f03449eb3c3b117579c676b59c61ed9c01f82", + "query_ordinal": 402, + "query_timestamp": 1700010210000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "07bf6da26915af00f2854278804cb4e61bc63daa679b8d72f50002f0c8b531af", + "control_graph_rank_sha256": "b67ca85bc16d9459bce5fbd669e6eaa54f064cc635a0ba3b5af99546987bdf8a", + "control_public_rank_sha256": "0c55a01f7113f24d77b3defa42a737213922ce96f30c63d8e87b9e8344318953", + "control_seed_rank_sha256": "07bf6da26915af00f2854278804cb4e61bc63daa679b8d72f50002f0c8b531af", + "control_top1_age_events": 4207, + "control_top1_age_ms": 4207000, + "event_index": 10241, + "modality": "text", + "query_embedding_sha256": "5685e528a2a5054ce1b79b585450183ea2076990ce89a02908522cc65979966d", + "query_ordinal": 403, + "query_timestamp": 1700010241000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "51e831f0af3973893b11fa0694d1d8e9f112e4d969305ba157b9eb291d957b65", + "control_graph_rank_sha256": "50e09a008e9ab0197e1d315f24b83f9c8d17f0429fbcecf03d67efa41530fe45", + "control_public_rank_sha256": "be412f76768004db0a071333c9a0830399f912ed7caad1dc1128e3c1edf7779c", + "control_seed_rank_sha256": "51e831f0af3973893b11fa0694d1d8e9f112e4d969305ba157b9eb291d957b65", + "control_top1_age_events": 8485, + "control_top1_age_ms": 8485000, + "event_index": 10262, + "modality": "text", + "query_embedding_sha256": "fe203dfbc0ac65a9f129fa3a10e3d4cfccb37c419ae42dc5eb4263632cdb673b", + "query_ordinal": 404, + "query_timestamp": 1700010262000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "b2572b364a164ea3d2104c339f3433b05313fbac1efb745a10c2caf35f5a264f", + "control_graph_rank_sha256": "60d6b57df8fccc7bf33be89731cc367c7b0501af20620cc453dc69e4a93224d4", + "control_public_rank_sha256": "ef6e320c444e8b8d2a3e8fc4d5f2b11011932befad44d6db75640b9e834945f0", + "control_seed_rank_sha256": "b2572b364a164ea3d2104c339f3433b05313fbac1efb745a10c2caf35f5a264f", + "control_top1_age_events": 13, + "control_top1_age_ms": 13000, + "event_index": 10288, + "modality": "text", + "query_embedding_sha256": "eda1fea7c18b521df6b3079a840dd380cbb41a996ecb77d7fe627840baafbda4", + "query_ordinal": 405, + "query_timestamp": 1700010288000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "744ad58d0f0bf776793fc3007516814467b74c25495eb7bc1a4d199ba3045e93", + "control_graph_rank_sha256": "8f3871a2ddfdde60bfe7f3fd6d3ef6ff41c481a35616d115da0ab0dff20c9f08", + "control_public_rank_sha256": "b8ca4e2a0cacb8f6f06f7ea2f38a14c214407488dd19f51677dfaf55ca706b33", + "control_seed_rank_sha256": "744ad58d0f0bf776793fc3007516814467b74c25495eb7bc1a4d199ba3045e93", + "control_top1_age_events": 5434, + "control_top1_age_ms": 5434000, + "event_index": 10311, + "modality": "text", + "query_embedding_sha256": "dc90a33204253ed8ba3e579236b4246ee233c1ba8379d2b7a1d98b4c54ddaff3", + "query_ordinal": 406, + "query_timestamp": 1700010311000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "dc6358b85267f5607813dec746f97086241f3633bf2826529c428291cd1c8282", + "control_graph_rank_sha256": "db05dbd4f252d5d85081e9ccc9cb8cf0b87385bf43d1708b0a6ff51caf626e6c", + "control_public_rank_sha256": "8370677a9ef8ea4a327f02fd1dc2971310443a26a676f08cfaf997c69875ad9a", + "control_seed_rank_sha256": "dc6358b85267f5607813dec746f97086241f3633bf2826529c428291cd1c8282", + "control_top1_age_events": 23, + "control_top1_age_ms": 23000, + "event_index": 10339, + "modality": "text", + "query_embedding_sha256": "781193a371c7ba7e2d14799e70a42807b2a29929da4062d812042c00268d92b8", + "query_ordinal": 407, + "query_timestamp": 1700010339000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "a6b761e7584f630cf1b3f5f44f1b1eaeebe4e17056448016541b4f1e7913d7c9", + "control_graph_rank_sha256": "1e74571f19cba8522c629bd5b9ab6adea686cd26b245a6e3f4f01710ee76efc1", + "control_public_rank_sha256": "5297a18a405da0876d3b482d14f09f0d86745d744a34743e47a9a4fe0d9e1221", + "control_seed_rank_sha256": "a6b761e7584f630cf1b3f5f44f1b1eaeebe4e17056448016541b4f1e7913d7c9", + "control_top1_age_events": 2963, + "control_top1_age_ms": 2963000, + "event_index": 10363, + "modality": "text", + "query_embedding_sha256": "3b6e30a31c82c8391ccb2f3c65d9d2f3d1639f1ebcb8d785a84c0b8070214a6a", + "query_ordinal": 408, + "query_timestamp": 1700010363000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "ca56e4f69548d1c339ac7241b7d6e29b9b616d32f58f16c2fe3497c38acac056", + "control_graph_rank_sha256": "e414cdad9d74d0343386d9a6d6199ae57e8b6669cb02b2883eb592e3c0e5bcc9", + "control_public_rank_sha256": "3e66d60822e6c12be9c33325207e0ee42fa4ae5708614800cef0d1e95e57bc05", + "control_seed_rank_sha256": "ca56e4f69548d1c339ac7241b7d6e29b9b616d32f58f16c2fe3497c38acac056", + "control_top1_age_events": 8150, + "control_top1_age_ms": 8150000, + "event_index": 10387, + "modality": "text", + "query_embedding_sha256": "85d43d00012861bdf6c5a09858e24720e75a46f94a040cf6e022df876f229f68", + "query_ordinal": 409, + "query_timestamp": 1700010387000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "0f48eb3895b42c24a608e33468548189a78f3ef2698835ae7516e17a61ce1e36", + "control_graph_rank_sha256": "b0024ea2215d2e1e600e96b527d5941da4ca3e3022e634cf3ff2e8251a51f72c", + "control_public_rank_sha256": "ead514b926a35bf3c7cb4e59f4bd525834b0d23d63fa873a3e40894913f6b017", + "control_seed_rank_sha256": "0f48eb3895b42c24a608e33468548189a78f3ef2698835ae7516e17a61ce1e36", + "control_top1_age_events": 2347, + "control_top1_age_ms": 2347000, + "event_index": 10412, + "modality": "text", + "query_embedding_sha256": "9a08cda4db870470ec011af0b5a0211fdc11a28f0c5092992b079b6be2b71338", + "query_ordinal": 410, + "query_timestamp": 1700010412000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "9d4f5a08c47e8d0902465604bf30070ca7816fb4ca4bf460f961b6b5699939f5", + "control_graph_rank_sha256": "fb3c2ad3f2e98d8fa37a0728595a02401682ae6efdb4ec2b3f4eed85a0fe4a2f", + "control_public_rank_sha256": "992922dda9c4bb1d549c2692bf680979db36a3af2abc5dfca12ce31fe00c6eda", + "control_seed_rank_sha256": "9d4f5a08c47e8d0902465604bf30070ca7816fb4ca4bf460f961b6b5699939f5", + "control_top1_age_events": 2805, + "control_top1_age_ms": 2805000, + "event_index": 10439, + "modality": "text", + "query_embedding_sha256": "e12063fc0c5a83eb7f34fd529a288ca8e0150f3c51fb37305017f98657af0664", + "query_ordinal": 411, + "query_timestamp": 1700010439000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "0b478b4a1760ccb57a1933ada84a5864b6c86463c3cbccb27fc44c346b8860b0", + "control_graph_rank_sha256": "90dd0b05056fe40028201c9c33c43a4a66829b26e1f660bb60359b8f17a545aa", + "control_public_rank_sha256": "99e6fb2831a4cf714ffa08828dc4b26eb11f3661507bf255acddec5ca1494647", + "control_seed_rank_sha256": "0b478b4a1760ccb57a1933ada84a5864b6c86463c3cbccb27fc44c346b8860b0", + "control_top1_age_events": 5179, + "control_top1_age_ms": 5179000, + "event_index": 10466, + "modality": "text", + "query_embedding_sha256": "3c29b4989129f5bfe0ca16fce9bb1a9608b190cf79627b35215f96fab3f01096", + "query_ordinal": 412, + "query_timestamp": 1700010466000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "320d9b3151d5226ddd9d3258dbe796c1da7e32aeba1df5b7e120c9a986f03b7a", + "control_graph_rank_sha256": "143089fd9cfd3bc58bc3635491a285f3421fb06d6644bdd33fb2d7f1f0584642", + "control_public_rank_sha256": "e164c1e609fe77a97b7f338bace06a8460a764574009907a82b4441151aa19e8", + "control_seed_rank_sha256": "320d9b3151d5226ddd9d3258dbe796c1da7e32aeba1df5b7e120c9a986f03b7a", + "control_top1_age_events": 5, + "control_top1_age_ms": 5000, + "event_index": 10488, + "modality": "text", + "query_embedding_sha256": "318be79b5952674768b09a766d2648fa104d9e721527e2942205f27a38b8141d", + "query_ordinal": 413, + "query_timestamp": 1700010488000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "7e4e379ae2bfde3310ade9db142051aa36eaff7c0174870cde74b2bae69735c3", + "control_graph_rank_sha256": "7ecffc85fc8bb506ca1edb9f32a03755a563e49d2d99ca00b55710f79998e431", + "control_public_rank_sha256": "85046d363e02196e68498d2ef239d7c832d11167fd7f23bbc04b37efef7b300a", + "control_seed_rank_sha256": "7e4e379ae2bfde3310ade9db142051aa36eaff7c0174870cde74b2bae69735c3", + "control_top1_age_events": 651, + "control_top1_age_ms": 651000, + "event_index": 10517, + "modality": "text", + "query_embedding_sha256": "da1bdec33e1842db890473d10f527a8f1b065cf62ebe353dcbea2b2a010fd2a6", + "query_ordinal": 414, + "query_timestamp": 1700010517000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "ad65d7e565a5b4808187bc74ac0ae2bebce499fdef89d9d565cb614f94231d30", + "control_graph_rank_sha256": "9f7f91163b65d5e553c3d1db9bc44829acd52d7dce7835a4d89df505cfb15a15", + "control_public_rank_sha256": "3d3800357c454a98f2a37c06b6c07aaa41c9d2332bab5d905ea53e623dddf547", + "control_seed_rank_sha256": "ad65d7e565a5b4808187bc74ac0ae2bebce499fdef89d9d565cb614f94231d30", + "control_top1_age_events": 225, + "control_top1_age_ms": 225000, + "event_index": 10546, + "modality": "text", + "query_embedding_sha256": "1f5fa16016a189a6b317f09c6d4252ab163a9df1926cc7ca9a9cfb388303f0cc", + "query_ordinal": 415, + "query_timestamp": 1700010546000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "e44115e106ba34f269f3e4697f600e82612925c04007d89648978a6c06f08b90", + "control_graph_rank_sha256": "3728b6d8e7162f3dea4cd0083a9cf0a2d8989517600fd8a5adc76b64b7a34c4d", + "control_public_rank_sha256": "70483960d806d3f5f1c8141250a862009e98923713f1aa5a06512ddc537f6be2", + "control_seed_rank_sha256": "e44115e106ba34f269f3e4697f600e82612925c04007d89648978a6c06f08b90", + "control_top1_age_events": 706, + "control_top1_age_ms": 706000, + "event_index": 10572, + "modality": "text", + "query_embedding_sha256": "fa698f900733650bcfd8b3db03a199ad29c461465db0bd8d549c731055916f3f", + "query_ordinal": 416, + "query_timestamp": 1700010572000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "d7bed4882637d5e8b74fef1074e4098acd01c8baae065446c3e5a9450d868ea5", + "control_graph_rank_sha256": "548a02aca15e02e5af6507f95f43f0b500dfcfa9133740997900f14e46b2acd6", + "control_public_rank_sha256": "26be104b06de72b7f8dde599702a479bde7eecd334cf5ce6e24ab58c064bb531", + "control_seed_rank_sha256": "d7bed4882637d5e8b74fef1074e4098acd01c8baae065446c3e5a9450d868ea5", + "control_top1_age_events": 29, + "control_top1_age_ms": 29000, + "event_index": 10597, + "modality": "text", + "query_embedding_sha256": "f58fb99d27d6665d8b4c0ae8b1567d8a0d93a6544458e86f1afcdd497ba4303f", + "query_ordinal": 417, + "query_timestamp": 1700010597000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "bc68db14ab789503c2f2fbc52d5d074077d9009f90b629b06d5d8526ad448e26", + "control_graph_rank_sha256": "cfdde036da9eef6be944147e2c35825c0331d79b8d98a2330b7065c627df4237", + "control_public_rank_sha256": "88e31bd251eb43c12a961feae177ccce3734aca9a59a98a16fafa2dd072b9841", + "control_seed_rank_sha256": "bc68db14ab789503c2f2fbc52d5d074077d9009f90b629b06d5d8526ad448e26", + "control_top1_age_events": 5745, + "control_top1_age_ms": 5745000, + "event_index": 10622, + "modality": "text", + "query_embedding_sha256": "dc90a33204253ed8ba3e579236b4246ee233c1ba8379d2b7a1d98b4c54ddaff3", + "query_ordinal": 418, + "query_timestamp": 1700010622000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "c6682c1b6b73485916eadc4b19dcb3835a18889488b2c57db3da69d089b89b62", + "control_graph_rank_sha256": "60796c4cbf4c7d539058e7d8216dd9e901eae9364ca1f8cc15b1ea6e21b347c6", + "control_public_rank_sha256": "d4f743b1816571b1986da9ef119263e582d0a0a997286a7ef4b24729314b1dc9", + "control_seed_rank_sha256": "c6682c1b6b73485916eadc4b19dcb3835a18889488b2c57db3da69d089b89b62", + "control_top1_age_events": 3694, + "control_top1_age_ms": 3694000, + "event_index": 10649, + "modality": "text", + "query_embedding_sha256": "90ec212637bdf0a6b44cd8eba1a24488626e5cafdd1c144bc8ae179a12b211ed", + "query_ordinal": 419, + "query_timestamp": 1700010649000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "1410f8bef3260b0f95caaf4a7fb783b93927c78ead137ecc4ed54e373febc8ca", + "control_graph_rank_sha256": "561e820ec7d05d539c7d0527ff86e57abc186802bc0bdb4a4a6075a6168f2db5", + "control_public_rank_sha256": "641fce7d27eecb87375b08c90e1309d43d45252f85c081ffb5cd61621c8a57cb", + "control_seed_rank_sha256": "1410f8bef3260b0f95caaf4a7fb783b93927c78ead137ecc4ed54e373febc8ca", + "control_top1_age_events": 1151, + "control_top1_age_ms": 1151000, + "event_index": 10678, + "modality": "text", + "query_embedding_sha256": "5f2513a486c2312f1509bf375c441dfe7e74443c30bceb99570fc4b3c2cab9bf", + "query_ordinal": 420, + "query_timestamp": 1700010678000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "e2a05dcc5e6b8927e935972f0cfeea8659ecbeb302a8b40e548f5dd7eaa32591", + "control_graph_rank_sha256": "d2efb9d1daa7adc53e68913d79809c313397a55585483434b5eb8572895d47c0", + "control_public_rank_sha256": "cb665810da084d7b122511446b308bb300101b280f70f124313092ac0fcd8754", + "control_seed_rank_sha256": "e2a05dcc5e6b8927e935972f0cfeea8659ecbeb302a8b40e548f5dd7eaa32591", + "control_top1_age_events": 4988, + "control_top1_age_ms": 4988000, + "event_index": 10704, + "modality": "text", + "query_embedding_sha256": "cd156b2c1c8261b555f1dde8303c469d00082f416f187831a364e1dd56847661", + "query_ordinal": 421, + "query_timestamp": 1700010704000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "825fa282a2ff1cd05ac99d9addc3aa5ee39b7052961f49b30da1d16f708a42a5", + "control_graph_rank_sha256": "d473493da7cad7c415a8b45ca9880b80613771c96b3116f318038a5ee8ebcc61", + "control_public_rank_sha256": "8735bed5149c4c966804b902a60492ebb964d9140e929ac2bb80889963995891", + "control_seed_rank_sha256": "825fa282a2ff1cd05ac99d9addc3aa5ee39b7052961f49b30da1d16f708a42a5", + "control_top1_age_events": 6301, + "control_top1_age_ms": 6301000, + "event_index": 10729, + "modality": "text", + "query_embedding_sha256": "4aa7b40dbfa4700abeed3a7a35f5ce2b21220d903425800e9ae46e62f68335d3", + "query_ordinal": 422, + "query_timestamp": 1700010729000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "b2be3f35b0a457a2fcb7d07e852a13e94f371e68873126b2b9f2a1920847cbe9", + "control_graph_rank_sha256": "1f69c0225ded4f467e828e0cfd4e26cd6b33afdf5b79614e3af53303c0a7e0ce", + "control_public_rank_sha256": "e8a599dcd3d79ca1442bf996eaf1d6df3895095f668d4684674c1c0bc0720291", + "control_seed_rank_sha256": "b2be3f35b0a457a2fcb7d07e852a13e94f371e68873126b2b9f2a1920847cbe9", + "control_top1_age_events": 4760, + "control_top1_age_ms": 4760000, + "event_index": 10754, + "modality": "text", + "query_embedding_sha256": "61e96c08e7da29e090181446e775a25f08a874ab32554287e0edfe0f6742e86a", + "query_ordinal": 423, + "query_timestamp": 1700010754000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "0631c8bfad184bd5c53ebb7954c9128395aa074a64a10c4c9eef20a4916dd470", + "control_graph_rank_sha256": "0af30f60c0a989b23ff6e8051c9b4ce231db573f5a6a16bc8d30b38411526c0b", + "control_public_rank_sha256": "ddce550d587fe13632140460618312cdcc3b49888765851339d9968ed780559c", + "control_seed_rank_sha256": "0631c8bfad184bd5c53ebb7954c9128395aa074a64a10c4c9eef20a4916dd470", + "control_top1_age_events": 91, + "control_top1_age_ms": 91000, + "event_index": 10785, + "modality": "text", + "query_embedding_sha256": "81739bcd898040f21f6ac236c9b4d88f35fcd196682893377d38c18b2d8ed9e4", + "query_ordinal": 424, + "query_timestamp": 1700010785000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "a6b50c02ca938ef9583bd28d6f43b4c1889395d05b3d3256d1a608f92183b66f", + "control_graph_rank_sha256": "5068725a7d7b9d0cca10eca1ba665b021806118da74ac46e0f116b68c62ac5f6", + "control_public_rank_sha256": "8fb3c6c1b03714ff136a838ca6eebd62d88b82e3476084ccc676a179cda4545a", + "control_seed_rank_sha256": "a6b50c02ca938ef9583bd28d6f43b4c1889395d05b3d3256d1a608f92183b66f", + "control_top1_age_events": 1614, + "control_top1_age_ms": 1614000, + "event_index": 10807, + "modality": "text", + "query_embedding_sha256": "0832fb95d4ad88939cff5f1d48748123971513ced628fb954178bdd0d95c05d9", + "query_ordinal": 425, + "query_timestamp": 1700010807000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "96c497392773ea763c948c6ee79b5f70538194f5b9c4aa31567bcf6d97d2cf9b", + "control_graph_rank_sha256": "968a333ae599bae157528757a1841d36d98641984cb031584e28661f7ff50bd5", + "control_public_rank_sha256": "fd0c48727b8410141372c4ae2f3ffe3fb11c75005e17bc6d57ab5a3c3730aa34", + "control_seed_rank_sha256": "96c497392773ea763c948c6ee79b5f70538194f5b9c4aa31567bcf6d97d2cf9b", + "control_top1_age_events": 4, + "control_top1_age_ms": 4000, + "event_index": 10834, + "modality": "text", + "query_embedding_sha256": "21a620a8aa9f176e094473c1dbb72c5eb8a0ea4b05729d15e9e47e25537f6d4a", + "query_ordinal": 426, + "query_timestamp": 1700010834000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "e0664dc31b26cc33634d2b29114d51ea3f43ae602ef1eab04983d1b0418466c5", + "control_graph_rank_sha256": "99c324cea35848a37d2b26f97d195d146fdb32383d34e7d39a64c651c79757f0", + "control_public_rank_sha256": "5703487261b04e8064c39ba634aff4ab0a852c645829238b80fbdafa17afcd9e", + "control_seed_rank_sha256": "e0664dc31b26cc33634d2b29114d51ea3f43ae602ef1eab04983d1b0418466c5", + "control_top1_age_events": 7297, + "control_top1_age_ms": 7297000, + "event_index": 10858, + "modality": "text", + "query_embedding_sha256": "11f8e867e597c2ebd127f0bb30168ecb8752ad00ca4c03ca7de10b48e8af0d60", + "query_ordinal": 427, + "query_timestamp": 1700010858000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "707f3f593966646fbb3291043a907fb66d2034834579a919f8915658e2a3794c", + "control_graph_rank_sha256": "b9dda03b6fe358789f54d55c0bbd1cddfbab30d5dcedcfc3d157120245596ec3", + "control_public_rank_sha256": "c57074de4c1ba06218ced89933c08ef9aea83628187e8eddb3d41b7613187860", + "control_seed_rank_sha256": "707f3f593966646fbb3291043a907fb66d2034834579a919f8915658e2a3794c", + "control_top1_age_events": 3, + "control_top1_age_ms": 3000, + "event_index": 10889, + "modality": "text", + "query_embedding_sha256": "5f45a259b83b5ea04205a40d0c9971fe59490a06ffd069dc7fb8f7e086890715", + "query_ordinal": 428, + "query_timestamp": 1700010889000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "bc62aff8bd39b4e4ccc3d9a19a08f470b8996014d1f5d782f15ad7c7b17eeaf4", + "control_graph_rank_sha256": "d05f42a906106e40a9218c300298bbc38e5d533a2ba4cad4b258891d064a4332", + "control_public_rank_sha256": "9e176cda31cb59081d369e1ec52d253c54a51f8a20362a16271071f227b38bbc", + "control_seed_rank_sha256": "bc62aff8bd39b4e4ccc3d9a19a08f470b8996014d1f5d782f15ad7c7b17eeaf4", + "control_top1_age_events": 2914, + "control_top1_age_ms": 2914000, + "event_index": 10911, + "modality": "text", + "query_embedding_sha256": "a37aa28d8101b3ef7e24906cc5fc01d0c3c7b36fc8df6eadcc558e7837fac7dd", + "query_ordinal": 429, + "query_timestamp": 1700010911000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "91bb3bb90cb79e7847ede1c8ccd15307d41e8a8948de8261974f526a68df25c9", + "control_graph_rank_sha256": "92d8981c3e629d8740ebaa71d988b2d700cbcd95f8612c79b1e401480af887a0", + "control_public_rank_sha256": "5941462baa3426765044f661446bb36b975c6c9798eb77eb2b3d75712d7bbe75", + "control_seed_rank_sha256": "91bb3bb90cb79e7847ede1c8ccd15307d41e8a8948de8261974f526a68df25c9", + "control_top1_age_events": 1458, + "control_top1_age_ms": 1458000, + "event_index": 10939, + "modality": "text", + "query_embedding_sha256": "779e86c17a78d6bab5ae62452c3d83873638cfa9a9483f278899ac8826ca7bf1", + "query_ordinal": 430, + "query_timestamp": 1700010939000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "90e8635a0f0107126c2a27a761bd6eaf6dfce3f5e9c05cbc628de62737f6b047", + "control_graph_rank_sha256": "b32037c831d833f60311ba3059c37cc41ba212cf897b8f4c95aec840b9068ac8", + "control_public_rank_sha256": "50fd566400900ed30332c2f6036880095443ef2278fb5098ac73e2152e5b5722", + "control_seed_rank_sha256": "90e8635a0f0107126c2a27a761bd6eaf6dfce3f5e9c05cbc628de62737f6b047", + "control_top1_age_events": 8205, + "control_top1_age_ms": 8205000, + "event_index": 10965, + "modality": "text", + "query_embedding_sha256": "0f75262522620712b10fadd6de1b1c8cc441f7bd2d8db0975e5a6506e0f84bdc", + "query_ordinal": 431, + "query_timestamp": 1700010965000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "a4acdc3c79f133be3c09bfd5b6f9cdea48859d1e0632ca8b65045b2cdd857a10", + "control_graph_rank_sha256": "34e3f94e84dfc0031085a2f2d61634f87d0a4732c79ac0886b70482019c61179", + "control_public_rank_sha256": "1a461b19e8bdcfef51af1e195764b240f53b2de40ca08c23ae9158ecb5331f8e", + "control_seed_rank_sha256": "a4acdc3c79f133be3c09bfd5b6f9cdea48859d1e0632ca8b65045b2cdd857a10", + "control_top1_age_events": 1508, + "control_top1_age_ms": 1508000, + "event_index": 10989, + "modality": "text", + "query_embedding_sha256": "9e0f9a851298e701dc26bb25d896928a8ac7378c4deaa9179be6a63317ffc929", + "query_ordinal": 432, + "query_timestamp": 1700010989000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "2c7bef207388ac512c8a7102ca6642234480a86c86478d92cc2dd4e759694593", + "control_graph_rank_sha256": "256c7df2d2f246b26030119cdfb986fbf77b2869a6514ec7ab79b76c94f9ad45", + "control_public_rank_sha256": "8cefebd8d1f6f4cec04c0ce03011dce6802d24ff701de7af7a9e7baa9390ef62", + "control_seed_rank_sha256": "2c7bef207388ac512c8a7102ca6642234480a86c86478d92cc2dd4e759694593", + "control_top1_age_events": 10684, + "control_top1_age_ms": 10684000, + "event_index": 11011, + "modality": "text", + "query_embedding_sha256": "76d2b6993a917ecba2fabfbf98736301e0a0c021208a9b7e3d2e12fe9289785e", + "query_ordinal": 433, + "query_timestamp": 1700011011000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "8411a75bda9739f7e6234c924cc347fa4a4d34c3ed0c2cdc20332d7c0f15a26b", + "control_graph_rank_sha256": "efbc927f938267493bcac929ffd384111943a8de5a0ecec8a78ecaab40f0dd31", + "control_public_rank_sha256": "f7b444b008fdef9a7a49aca340d178e476cfc5def5126a423ddca6e304468df3", + "control_seed_rank_sha256": "8411a75bda9739f7e6234c924cc347fa4a4d34c3ed0c2cdc20332d7c0f15a26b", + "control_top1_age_events": 8544, + "control_top1_age_ms": 8544000, + "event_index": 11037, + "modality": "text", + "query_embedding_sha256": "4cbbf565fcefe3ad6df490f76ce37772c53bfa04459d11fa24632a56b004e461", + "query_ordinal": 434, + "query_timestamp": 1700011037000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "7388129cc083639ceba9f3d4b56eaf30c61e552250e7930230cabe3a5d44458e", + "control_graph_rank_sha256": "f211602189374f7e14b3c70b8048418776e05b3bfc0eafdb16570335d8e53bf9", + "control_public_rank_sha256": "a40b4cbb67750817ff6922fcdb6216d1cb916f631b0079e3e5056d8fa7c5d04a", + "control_seed_rank_sha256": "7388129cc083639ceba9f3d4b56eaf30c61e552250e7930230cabe3a5d44458e", + "control_top1_age_events": 8569, + "control_top1_age_ms": 8569000, + "event_index": 11062, + "modality": "text", + "query_embedding_sha256": "284d237012c16302869e9aa8db583f32cc5d9da33f5d2708849c06ad2f71abc7", + "query_ordinal": 435, + "query_timestamp": 1700011062000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "df4b801a08230790221bd5d28a465f8c8d1a806f7789fd0b8410b7e3f4be70ec", + "control_graph_rank_sha256": "9a7f70edd7949c6d6415d8fb89b038c68b1b118f844b9d0600bbf677fc6b0ace", + "control_public_rank_sha256": "63aa46487700702c95febbde1800f5b2d8f3ca488b7cc5ebfbe8d7c8ccdb2b55", + "control_seed_rank_sha256": "df4b801a08230790221bd5d28a465f8c8d1a806f7789fd0b8410b7e3f4be70ec", + "control_top1_age_events": 8455, + "control_top1_age_ms": 8455000, + "event_index": 11088, + "modality": "text", + "query_embedding_sha256": "fccbe6ef52602da661bde24fbf492ac6e5ad6d6a6f1655a954655c4c2d3f2326", + "query_ordinal": 436, + "query_timestamp": 1700011088000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "3c674d54cf26825efac63c2b4072fbc57cc1f564b7c7e1bbd4bff49ec5e93ac6", + "control_graph_rank_sha256": "15c19f94ca65119b1c37d5f329f1e21edbb70e9508c405c0fb2bd09dbef9fa46", + "control_public_rank_sha256": "e36f3222c7c2bd12f0eefc0f22089168eb2e2f8739edebe6fa5f0fcda3b4cd9a", + "control_seed_rank_sha256": "3c674d54cf26825efac63c2b4072fbc57cc1f564b7c7e1bbd4bff49ec5e93ac6", + "control_top1_age_events": 6837, + "control_top1_age_ms": 6837000, + "event_index": 11113, + "modality": "text", + "query_embedding_sha256": "ee820d3b1d9357fea3a08c9ea2e7b9c498ebb2b1bc4728ce0445fe3452648310", + "query_ordinal": 437, + "query_timestamp": 1700011113000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "05771fe1311af6730a8cc8c435e9b66de2d693f57e24a83555b77226210eec9e", + "control_graph_rank_sha256": "ac9b493251ae16f8541bc8343f295acbd62bd2c3be3e2b98588eba4cc7463260", + "control_public_rank_sha256": "89bf8cd4ed3cdfbae15aaad1d474288201adbbaf5f5e608b492c83c91f0c7778", + "control_seed_rank_sha256": "05771fe1311af6730a8cc8c435e9b66de2d693f57e24a83555b77226210eec9e", + "control_top1_age_events": 24, + "control_top1_age_ms": 24000, + "event_index": 11144, + "modality": "text", + "query_embedding_sha256": "a027f8317bcf084fd0ecebbc17bf3ff44b4040597d0402642e20d3ef5fdc996b", + "query_ordinal": 438, + "query_timestamp": 1700011144000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "b9d7262d2701e9cff93e5a36868c061e7bfa1fe41fdd2c9c9a4a29652d9cde9a", + "control_graph_rank_sha256": "4accbcd751525d99cfb20f1ad012ca91c25328db714f36688ce200df29455992", + "control_public_rank_sha256": "a16cc8489f0d6b9077860efdd571e8e0109743c8f56311549e08a8a5335ab762", + "control_seed_rank_sha256": "b9d7262d2701e9cff93e5a36868c061e7bfa1fe41fdd2c9c9a4a29652d9cde9a", + "control_top1_age_events": 1632, + "control_top1_age_ms": 1632000, + "event_index": 11169, + "modality": "text", + "query_embedding_sha256": "68f5bf67c20b1b40f19829f1da7c61b388178b314b09b435ce60ad5f4ce8d09b", + "query_ordinal": 439, + "query_timestamp": 1700011169000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "8c911873f9c2505c6159c208aebc7e8d05832572274b56028e2b9b9e19fd4213", + "control_graph_rank_sha256": "bc08284ca5cbbf6bdcef0a480760d3af6db0506d775cf4effafe01edf494768c", + "control_public_rank_sha256": "2c0da24b5928e268edb8d995406fb8b77b533d5965ab586610585cc14697fc8f", + "control_seed_rank_sha256": "8c911873f9c2505c6159c208aebc7e8d05832572274b56028e2b9b9e19fd4213", + "control_top1_age_events": 2958, + "control_top1_age_ms": 2958000, + "event_index": 11195, + "modality": "text", + "query_embedding_sha256": "478178f9080d39073bee24e58b46ef39d78e6c08ab805503fe07b7dd47bbcb62", + "query_ordinal": 440, + "query_timestamp": 1700011195000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "a703176aeea13223ee4c5c4593383a2fd27350cbb9a74ff38a4a94c31b9edfea", + "control_graph_rank_sha256": "a21298297aefe2349557315ffb1baac4ef3bb2030ff3366353d7978080b993c8", + "control_public_rank_sha256": "0ab3bdb7e3717c49d70373c78da8b730ea600b985e90b2b49d79e6d8fbde707a", + "control_seed_rank_sha256": "a703176aeea13223ee4c5c4593383a2fd27350cbb9a74ff38a4a94c31b9edfea", + "control_top1_age_events": 979, + "control_top1_age_ms": 979000, + "event_index": 11221, + "modality": "text", + "query_embedding_sha256": "649ea523210ca909df398357643817230435425c47d77acfb847466a8b290aab", + "query_ordinal": 441, + "query_timestamp": 1700011221000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "8c91a11b1489d33bf3138b1f797d4d46a7a9b2c1ca227c362cdac123d81f3578", + "control_graph_rank_sha256": "003b5dc15f67a37e278aa6288f91ec60b2a1828f1d417dd489d188c28b67b62f", + "control_public_rank_sha256": "8c7ea338c304335e86eb8d9b7b2e083b22b0d8890c5de4074082d1248250b672", + "control_seed_rank_sha256": "8c91a11b1489d33bf3138b1f797d4d46a7a9b2c1ca227c362cdac123d81f3578", + "control_top1_age_events": 902, + "control_top1_age_ms": 902000, + "event_index": 11246, + "modality": "text", + "query_embedding_sha256": "f33210975a8472a9989310713bb20bea669cbcecfc2ffaaecc730bfc227bac21", + "query_ordinal": 442, + "query_timestamp": 1700011246000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "5378eb2698ba0dc959f22427d9a45aad50768c053fd2f1dc12531df150ea85b2", + "control_graph_rank_sha256": "89eeacba964b70b37bb23293f57330776af151242a90bf80f3b9ef2ecca96ddf", + "control_public_rank_sha256": "5af3b6765cee4c054805b27b46d4fc1cda45979bbe5d1b39e535d31102d9380a", + "control_seed_rank_sha256": "5378eb2698ba0dc959f22427d9a45aad50768c053fd2f1dc12531df150ea85b2", + "control_top1_age_events": 30, + "control_top1_age_ms": 30000, + "event_index": 11272, + "modality": "text", + "query_embedding_sha256": "ecbe698d0783f7de577db0ba1dc46d88e99548c177e45b5b327cec38423fcfcd", + "query_ordinal": 443, + "query_timestamp": 1700011272000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "29be5be648e429a49e0149edd8e47159d7f2e6e5238b8e3875a8c80c7a237afa", + "control_graph_rank_sha256": "5109191ca5e9e2746f879f90255a8736b120d4440c8b8f817298e34478c61b0f", + "control_public_rank_sha256": "4683237cc6778931e7d70abb13faccc3ee0e912565be08c800756796e9634c75", + "control_seed_rank_sha256": "29be5be648e429a49e0149edd8e47159d7f2e6e5238b8e3875a8c80c7a237afa", + "control_top1_age_events": 4288, + "control_top1_age_ms": 4288000, + "event_index": 11300, + "modality": "text", + "query_embedding_sha256": "f17a948d928d4bf43230a81608c82665eb9a1618056439e8b69fcd65d9571340", + "query_ordinal": 444, + "query_timestamp": 1700011300000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "6e59fc8b43ff17dc4046e29521bba52c2a538c6f811e2f013c5f4a2a91faac5e", + "control_graph_rank_sha256": "d9520df625750ecc7d029dff523569cf14b08319e009376d597b81501c5a0775", + "control_public_rank_sha256": "5d9ee6775f8cc13271562c92f07a7513c3e965bbc9749dff2e903568ae057b4c", + "control_seed_rank_sha256": "6e59fc8b43ff17dc4046e29521bba52c2a538c6f811e2f013c5f4a2a91faac5e", + "control_top1_age_events": 8527, + "control_top1_age_ms": 8527000, + "event_index": 11329, + "modality": "text", + "query_embedding_sha256": "03a387ce83adb64cec4c31ead1747ce14f5cc9525f3c75c28e2f236908cc0da6", + "query_ordinal": 445, + "query_timestamp": 1700011329000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "fc0909b24954ab1a1672d0ef4993a547cb4a4fcfcd3a0d02cf573d7760876259", + "control_graph_rank_sha256": "b1e91164b04c2a3a87b98d6920fa64294fd1f9773c99bd9ab64d261367dbc993", + "control_public_rank_sha256": "348e0e9345c6787a3be05b7115b5f2200ca0186346d4ef2a7fa888198b1ee588", + "control_seed_rank_sha256": "fc0909b24954ab1a1672d0ef4993a547cb4a4fcfcd3a0d02cf573d7760876259", + "control_top1_age_events": 4, + "control_top1_age_ms": 4000, + "event_index": 11351, + "modality": "text", + "query_embedding_sha256": "03a387ce83adb64cec4c31ead1747ce14f5cc9525f3c75c28e2f236908cc0da6", + "query_ordinal": 446, + "query_timestamp": 1700011351000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "ec33224369aad64e11d976656083af91ba23556ed2a862c480ff33fc1c5c1d8e", + "control_graph_rank_sha256": "a84439d131ad0dd2d9ca0fec754d1fe16b0ceadf734bb217d7569577bd99b957", + "control_public_rank_sha256": "de37d6c985e6bc4a5e3e7b37ea7ee1c8ee5aaee3db61b9db512cb1a3fa60b497", + "control_seed_rank_sha256": "ec33224369aad64e11d976656083af91ba23556ed2a862c480ff33fc1c5c1d8e", + "control_top1_age_events": 6281, + "control_top1_age_ms": 6281000, + "event_index": 11379, + "modality": "text", + "query_embedding_sha256": "1431381f22d0ad2852baeb0633e6ce9794c7eb4ec84d862a0015dd40b410ea02", + "query_ordinal": 447, + "query_timestamp": 1700011379000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "645448c16ba2d680122b3a64d4cb77dfe84deb17a8e72c25955c5cc97b41c6fa", + "control_graph_rank_sha256": "d10170fbfaf9b1d92b55bc682b334c440d687ecdab6daf00cea1052b99f68a3e", + "control_public_rank_sha256": "fe8d12c5e5c19226ca510d87121216add88db143c19118c7a8322c24c2fb4f42", + "control_seed_rank_sha256": "645448c16ba2d680122b3a64d4cb77dfe84deb17a8e72c25955c5cc97b41c6fa", + "control_top1_age_events": 26, + "control_top1_age_ms": 26000, + "event_index": 11405, + "modality": "text", + "query_embedding_sha256": "bfdece0c4846665ba68329617be6fe0afbf88ca51bfaec540b4f7e1f4f7fca7c", + "query_ordinal": 448, + "query_timestamp": 1700011405000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "5bb4947729729b4d7ee6f29863fe6c24ba1c72eaf08c45c50d2c25a84fdcc3b5", + "control_graph_rank_sha256": "9307f7dfc5c0d07aad693de25c1d0139e76f5bdf6f5314354da5aeba82c55214", + "control_public_rank_sha256": "d22d8d56353b8763fa02ed1db260e1bb5bff08244ed6af4b17ab71213e0a89ed", + "control_seed_rank_sha256": "5bb4947729729b4d7ee6f29863fe6c24ba1c72eaf08c45c50d2c25a84fdcc3b5", + "control_top1_age_events": 3797, + "control_top1_age_ms": 3797000, + "event_index": 11431, + "modality": "text", + "query_embedding_sha256": "92a5a5adea8b0dd3511e370f86565d92087613aa7e1758cf04b35acadb133d34", + "query_ordinal": 449, + "query_timestamp": 1700011431000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "ed0ffcb65ede061768c78ad69dce146951045de834d91739b43ba997f14a2577", + "control_graph_rank_sha256": "5507d96085d4eb63ecaa8141619002d4ef64f346e4d1b1ed2534811d74c18fff", + "control_public_rank_sha256": "3fbeba5dcdc2cd60beeb9ab0f70b673a152d578215688f5f3ed9821734905715", + "control_seed_rank_sha256": "ed0ffcb65ede061768c78ad69dce146951045de834d91739b43ba997f14a2577", + "control_top1_age_events": 1177, + "control_top1_age_ms": 1177000, + "event_index": 11452, + "modality": "text", + "query_embedding_sha256": "0af2b1fe9adf70d37c7924364d2a3fcf41217f503873af020ba968ec11aab369", + "query_ordinal": 450, + "query_timestamp": 1700011452000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "ca9655964cb6cf041a631c3f5b608e1bb904ca88520b74f328393550f1ff0f3f", + "control_graph_rank_sha256": "cf3c9850ccaa1d0ec48834d4685a25c410c43ab8d46f54489cdb04ce8a4e5ae7", + "control_public_rank_sha256": "fa37f5337e4ba4d581ad24d54ed401fc5e5a6a7c3bd6af91911e7454b2b0c447", + "control_seed_rank_sha256": "ca9655964cb6cf041a631c3f5b608e1bb904ca88520b74f328393550f1ff0f3f", + "control_top1_age_events": 6678, + "control_top1_age_ms": 6678000, + "event_index": 11476, + "modality": "text", + "query_embedding_sha256": "db06be69ddfacabf2f1434ef1b40efe9bf277b18ccc85aae85902251b42620f2", + "query_ordinal": 451, + "query_timestamp": 1700011476000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "79ddaa6fc8bf61e9d9f620a8c092dcfcea9447c31221aad4d89d2ad634d3f7a0", + "control_graph_rank_sha256": "735f068077be0d1f64d8e3051d63a5951c6243daaca68101456dd3c5b402c477", + "control_public_rank_sha256": "efa5cc119524bc85bc00b27b3fb9b7ba1c7164bfe8f54321fe3a59a6365c1c4c", + "control_seed_rank_sha256": "79ddaa6fc8bf61e9d9f620a8c092dcfcea9447c31221aad4d89d2ad634d3f7a0", + "control_top1_age_events": 875, + "control_top1_age_ms": 875000, + "event_index": 11502, + "modality": "text", + "query_embedding_sha256": "580d9e132298051ad0b28c4752c41085ed0c27e52319b66f579c4d8ab368e724", + "query_ordinal": 452, + "query_timestamp": 1700011502000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "85b61e2cc29e992251c33ccd49d3efc5d47c50ee04eb5edde6d91f5748e3e8a6", + "control_graph_rank_sha256": "677b6fae574abf1cd76334f7d6c0e3bcc9af182c7bcc45a37d41d803dcc6639b", + "control_public_rank_sha256": "f4ee019d921a4f71d4dc7713e9e0fc78a2c330783246d20e88887bb73d3b8ab8", + "control_seed_rank_sha256": "85b61e2cc29e992251c33ccd49d3efc5d47c50ee04eb5edde6d91f5748e3e8a6", + "control_top1_age_events": 4, + "control_top1_age_ms": 4000, + "event_index": 11526, + "modality": "text", + "query_embedding_sha256": "388f47b854921d0c392eb6da9650a553312bd8c86d8371242c909aabd788ecf0", + "query_ordinal": 453, + "query_timestamp": 1700011526000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "8290da05f23b11b0cf5155b68a8eb4a6f089b3a9a7cc6363e087e3b626cf8955", + "control_graph_rank_sha256": "ae76576a9bbd02ba1c34bcdc426c2d0325742f90976509d69ce3e6961ede025d", + "control_public_rank_sha256": "345c150eba0f7f0ebab027e5cc7a25d07f66d94792bf2c0a8a52e0c0d947d9ce", + "control_seed_rank_sha256": "8290da05f23b11b0cf5155b68a8eb4a6f089b3a9a7cc6363e087e3b626cf8955", + "control_top1_age_events": 7478, + "control_top1_age_ms": 7478000, + "event_index": 11550, + "modality": "text", + "query_embedding_sha256": "6527c14f33c94e8e0b94e61cb324067b6b413208f8cb58f88567f3f546b91e78", + "query_ordinal": 454, + "query_timestamp": 1700011550000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "8277e8de351b437a124a7558d1d8939c05e0ca6db300f50bd4cd6a2337102c84", + "control_graph_rank_sha256": "794363a956425fc6613346db80db51c28978630f430de842890d1b39d57505aa", + "control_public_rank_sha256": "6d893960bf9bd7d2bd99ba297a368f75dede7d4a7eadd8df238b2cd7281b8824", + "control_seed_rank_sha256": "8277e8de351b437a124a7558d1d8939c05e0ca6db300f50bd4cd6a2337102c84", + "control_top1_age_events": 148, + "control_top1_age_ms": 148000, + "event_index": 11580, + "modality": "text", + "query_embedding_sha256": "9a38f96db6f898fb255fee38ee47f28b5ad2c7a5feed09f7c92e62026aecd626", + "query_ordinal": 455, + "query_timestamp": 1700011580000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "f1c21df117f4bccfc130787e9e0537c9fc0fa92647a04118307da97a4105efc4", + "control_graph_rank_sha256": "2575dc4142b6d9c4bae6d2d0d9a2980f02790077c1e7eeaf632462981e2bcf35", + "control_public_rank_sha256": "f1f587fa8f59f2cfb1496bac4d38c869e9916a396514226ddb90e215a2a517aa", + "control_seed_rank_sha256": "f1c21df117f4bccfc130787e9e0537c9fc0fa92647a04118307da97a4105efc4", + "control_top1_age_events": 2421, + "control_top1_age_ms": 2421000, + "event_index": 11609, + "modality": "text", + "query_embedding_sha256": "aedb845bbea09d46adf132bc43af14e24adbc2f8270013da575a853bdfc602c5", + "query_ordinal": 456, + "query_timestamp": 1700011609000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "5c1a1f60e208115b01139933ed57750562d0be4d07937ddef2c71e03bf861a6c", + "control_graph_rank_sha256": "68b52559514620984346bb8a72d674073ee44551a9d3a4da125769c73804658b", + "control_public_rank_sha256": "b16c64cb6d60ae6335c293ce658480c8bf4063d3628bcfe418b56c08f331b045", + "control_seed_rank_sha256": "5c1a1f60e208115b01139933ed57750562d0be4d07937ddef2c71e03bf861a6c", + "control_top1_age_events": 15, + "control_top1_age_ms": 15000, + "event_index": 11633, + "modality": "text", + "query_embedding_sha256": "0c97a7c842586b979718edce7a9de7162cb62d68ea0fd938f973c3f099b6ed11", + "query_ordinal": 457, + "query_timestamp": 1700011633000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "c86df3f4b13a1bf5b985a22feb02847bf4b9f417b45f6281ea20f2b8fdb607c4", + "control_graph_rank_sha256": "3d10b2e88053a955f9f10b2ea18f092c1836b769c96498c66c3c5fca6378f68b", + "control_public_rank_sha256": "a9426e4b0a796b727939860ee5a3fd77276302891b50ccde40409ecc8ff007c7", + "control_seed_rank_sha256": "c86df3f4b13a1bf5b985a22feb02847bf4b9f417b45f6281ea20f2b8fdb607c4", + "control_top1_age_events": 515, + "control_top1_age_ms": 515000, + "event_index": 11659, + "modality": "text", + "query_embedding_sha256": "a6769ea30fedb34632ff8cf29fe761eddfc4b70b65d3e19e8bbe426875589d84", + "query_ordinal": 458, + "query_timestamp": 1700011659000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "4cca1698c95312ec7aba225f7c533774fa2545da460e5d690569981333d91844", + "control_graph_rank_sha256": "dc953528a5d55bb403e0a20472d51c8af4760d90a51a8888b8592b61777dd871", + "control_public_rank_sha256": "a028500c15796aa33e7c9a3bdcbd6debcd49eb8d61c73d512638855c8e3c2a93", + "control_seed_rank_sha256": "4cca1698c95312ec7aba225f7c533774fa2545da460e5d690569981333d91844", + "control_top1_age_events": 2490, + "control_top1_age_ms": 2490000, + "event_index": 11683, + "modality": "text", + "query_embedding_sha256": "972c2bf438ae71bbfd448c219deffef691992ffb871e4ffb11c94f869c65b6a0", + "query_ordinal": 459, + "query_timestamp": 1700011683000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "140eae2318e18c28aca3e5e06028829f26bf34f1466c33ba9393265178b2b3b0", + "control_graph_rank_sha256": "cad9b4b4ba65e440521137948e20bd0e0397cafed13ec7261751e09b7edb6beb", + "control_public_rank_sha256": "4788d5833a742d7887b07d81572762664684245579f55f8820a1423a1825405b", + "control_seed_rank_sha256": "140eae2318e18c28aca3e5e06028829f26bf34f1466c33ba9393265178b2b3b0", + "control_top1_age_events": 9, + "control_top1_age_ms": 9000, + "event_index": 11713, + "modality": "text", + "query_embedding_sha256": "f4e0985d9c0c6982374d87f916ddd47c96a10080a4ad5fd53ac9a71f7fa0024e", + "query_ordinal": 460, + "query_timestamp": 1700011713000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "df26bf3b350d147ff41fc2edd324f5d259745df23792b1a928ff74809d2043d9", + "control_graph_rank_sha256": "b18d38f5b20243ac163860b75f72d4c85dd667be33cd2e01abb6ca75602ca0c3", + "control_public_rank_sha256": "940330b11b3a6dd0f64527406bd5385eeee8443e7e160194f333e9cc3f12e974", + "control_seed_rank_sha256": "df26bf3b350d147ff41fc2edd324f5d259745df23792b1a928ff74809d2043d9", + "control_top1_age_events": 763, + "control_top1_age_ms": 763000, + "event_index": 11741, + "modality": "text", + "query_embedding_sha256": "b85da8f378731cdd59dcba12010ed56bdd0e5d60b1819a50e86cc75e4ec0cbe1", + "query_ordinal": 461, + "query_timestamp": 1700011741000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "3447b896d001ce403f3dc9b977a45262292064cb5a9df27a8d3c1e3e1bc39b14", + "control_graph_rank_sha256": "39546040655db8aa157d53fbf12173f58707c3cac0ad7c52adbc9aff61c6f41d", + "control_public_rank_sha256": "dc8e021981dc423a38894783196d2ed53bbc48bdb0718b92f1cf83b780507e95", + "control_seed_rank_sha256": "3447b896d001ce403f3dc9b977a45262292064cb5a9df27a8d3c1e3e1bc39b14", + "control_top1_age_events": 691, + "control_top1_age_ms": 691000, + "event_index": 11766, + "modality": "text", + "query_embedding_sha256": "c781f2e2c90df42ccf42f3ac872d501380389e9fbd9df2243d2e1c490b3b8ef8", + "query_ordinal": 462, + "query_timestamp": 1700011766000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "c6ca94437eda57fdb71c6393ec4f253ad446184edc20d82effd964910bc6d9de", + "control_graph_rank_sha256": "17fafcea2f52227e37fe2a1d0cae869ec4c69e9493cb15ee3c4e5772cf9df8fb", + "control_public_rank_sha256": "4a5e1767f1b91c6592098bbb72458a70c573517dc808f75706f08d7a8adc6c38", + "control_seed_rank_sha256": "c6ca94437eda57fdb71c6393ec4f253ad446184edc20d82effd964910bc6d9de", + "control_top1_age_events": 12, + "control_top1_age_ms": 12000, + "event_index": 11794, + "modality": "text", + "query_embedding_sha256": "55c2e57614f332cfe212e7df62ff3c2cd469f3b31b1d9e5618579c1014080d06", + "query_ordinal": 463, + "query_timestamp": 1700011794000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "2eaa83afd4b79e9ee56849f4ad5735c7fcba1432f1f924d852dcd8df9cec252c", + "control_graph_rank_sha256": "b55fda0052ed579e211a194b0c749f08c9e57f8ac92cb0fc81d6c49c4eb9e3a3", + "control_public_rank_sha256": "c88760bc704026494b2005883725b83dbfb69ec814f4f32bd5ae1f3d0efc9633", + "control_seed_rank_sha256": "2eaa83afd4b79e9ee56849f4ad5735c7fcba1432f1f924d852dcd8df9cec252c", + "control_top1_age_events": 1097, + "control_top1_age_ms": 1097000, + "event_index": 11822, + "modality": "text", + "query_embedding_sha256": "5c97f280339590b977a5d80b35782a3abef4118e216bb04fadcefacc4d5dda84", + "query_ordinal": 464, + "query_timestamp": 1700011822000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "d7556e7aa0a46bdaf1ede5cffff7d05dfff848aeca4405db631759b44f5674ed", + "control_graph_rank_sha256": "df8bf395ee86bde0327a9c218d9aef9b43ad369a945062b550d07d60e5cb4c4f", + "control_public_rank_sha256": "fafc0918daa96298ea70161531bb101fecd30430c5a2c26dd59539b9d85e201d", + "control_seed_rank_sha256": "d7556e7aa0a46bdaf1ede5cffff7d05dfff848aeca4405db631759b44f5674ed", + "control_top1_age_events": 2722, + "control_top1_age_ms": 2722000, + "event_index": 11849, + "modality": "text", + "query_embedding_sha256": "f3af281b22cc0bdc485e80b786e920a49c17cc3203b1352745e349f325716167", + "query_ordinal": 465, + "query_timestamp": 1700011849000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "cb02e087df68e92059a2eef5f6345cafc373bcd3b44e175db3f40bd4e58b1bdb", + "control_graph_rank_sha256": "b0f2cafe9d08086f9380a864a5e1c216d53416085bae90934dfbdbc3139584ad", + "control_public_rank_sha256": "1f6983c284c9fad9f9604314293daa4ecc8a5493da00c74d7c971c7bc5e3b49e", + "control_seed_rank_sha256": "cb02e087df68e92059a2eef5f6345cafc373bcd3b44e175db3f40bd4e58b1bdb", + "control_top1_age_events": 18, + "control_top1_age_ms": 18000, + "event_index": 11871, + "modality": "text", + "query_embedding_sha256": "f340c624a591c7132a0d5a6e4aa0560f95466c396079f13971af9529ad085a8b", + "query_ordinal": 466, + "query_timestamp": 1700011871000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "dd59a53d0023c20eaf1ede061d07c98f983830539f83afc47c375ba13e285b22", + "control_graph_rank_sha256": "648b8777052f5fbd46cd384e77eb37c5becbeede01d3f21a6f6fa96ccad0c1c7", + "control_public_rank_sha256": "6baccf4ee9987c5161c54a2f8093416360b3c92f1d9b6a7f3654f61844b6712d", + "control_seed_rank_sha256": "dd59a53d0023c20eaf1ede061d07c98f983830539f83afc47c375ba13e285b22", + "control_top1_age_events": 2479, + "control_top1_age_ms": 2479000, + "event_index": 11895, + "modality": "text", + "query_embedding_sha256": "653c16231965ba6c511724fa0cc145a712159ff99ae262ef968f14f574de5c5a", + "query_ordinal": 467, + "query_timestamp": 1700011895000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "a3532b59093877d32181112d33b550a0847f80dce5dfee4f82bfebd1ab41a465", + "control_graph_rank_sha256": "69f2579fc58900be21babba34df9b2ed2c8d19754fb3416cae49117e98d39462", + "control_public_rank_sha256": "f5dc34c8f91e97ced567a648502571b4c07874a6222ae7b4b7e3724a736f7531", + "control_seed_rank_sha256": "a3532b59093877d32181112d33b550a0847f80dce5dfee4f82bfebd1ab41a465", + "control_top1_age_events": 2733, + "control_top1_age_ms": 2733000, + "event_index": 11921, + "modality": "text", + "query_embedding_sha256": "3517e66823b402b1543baef406df3d8a33a2410b37ce9e98a7425b4f3c18a4c2", + "query_ordinal": 468, + "query_timestamp": 1700011921000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "0ec583324db2b0aa681aac5810316117d8044699dc90ec3fea529b98513f985d", + "control_graph_rank_sha256": "c4c435a6d7eddde8f620f9aa68dc15746aa41e211ba2f50cbcd5b7ca076dcdae", + "control_public_rank_sha256": "d2c601cce1a6462ce31d7ebe6b2209f560fc2bfb7c9e5f91146e5e742da97e86", + "control_seed_rank_sha256": "0ec583324db2b0aa681aac5810316117d8044699dc90ec3fea529b98513f985d", + "control_top1_age_events": 107, + "control_top1_age_ms": 107000, + "event_index": 11947, + "modality": "text", + "query_embedding_sha256": "7f5d03eab1589b2f2f0d6906abbff984463c90c5b76da211bbafed037b877da0", + "query_ordinal": 469, + "query_timestamp": 1700011947000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "790504f5a941cf5afe959bb2e8bf4594137c7c4e69e6c9e07de4d31f957bff67", + "control_graph_rank_sha256": "895e57c7b4c1b3186b95d08e613555fde46ae21cbaa8271e9ad440c39f53f01d", + "control_public_rank_sha256": "c10fab2649fdf33e548825787956aba76fa58dfd4ffa2d316e5442405dc146f0", + "control_seed_rank_sha256": "790504f5a941cf5afe959bb2e8bf4594137c7c4e69e6c9e07de4d31f957bff67", + "control_top1_age_events": 538, + "control_top1_age_ms": 538000, + "event_index": 11970, + "modality": "text", + "query_embedding_sha256": "597e19f318599106891294d6048fbb388785582377b08b151a4d670921926857", + "query_ordinal": 470, + "query_timestamp": 1700011970000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "5d81e5fdd9362213b0c72165a39e6c6ecf1a67bd134f13559994b3c01751c7a8", + "control_graph_rank_sha256": "b0a40aebe80dce3d035b668356f9f83149387885a42007bae358a5bc99749198", + "control_public_rank_sha256": "3db7fda8d13b88594382ec585271ed4f9b7c060fbc7d545cc05cbd7a63731505", + "control_seed_rank_sha256": "5d81e5fdd9362213b0c72165a39e6c6ecf1a67bd134f13559994b3c01751c7a8", + "control_top1_age_events": 7199, + "control_top1_age_ms": 7199000, + "event_index": 11997, + "modality": "text", + "query_embedding_sha256": "db06be69ddfacabf2f1434ef1b40efe9bf277b18ccc85aae85902251b42620f2", + "query_ordinal": 471, + "query_timestamp": 1700011997000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "9ee331c967b6700d2abf8160ea819abfeac9b262783c3b794825cedc0a6c5ab1", + "control_graph_rank_sha256": "9a52db8f54e5a338e093bc7c64defa74b3cf8d8aceedf0d25b1f595535d32f37", + "control_public_rank_sha256": "430d37058c10e1aafa8a69aa19f23b83b80e09a8b67f6c9e047fa5b3271cc6d3", + "control_seed_rank_sha256": "9ee331c967b6700d2abf8160ea819abfeac9b262783c3b794825cedc0a6c5ab1", + "control_top1_age_events": 813, + "control_top1_age_ms": 813000, + "event_index": 12021, + "modality": "text", + "query_embedding_sha256": "cb898812a78be2be1c96fbce3d36eaa0e2aaf673c75bfbcf706f7bc727002899", + "query_ordinal": 472, + "query_timestamp": 1700012021000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "e59d0a7eab534f1e0805b73796a288f8dd514a520e47585be8c06c9a4177f0ae", + "control_graph_rank_sha256": "11a87b639b8fc4efa9304c6c839102368d179f59d315bbf61320e721df18e03b", + "control_public_rank_sha256": "6e8fa84e261198a4561e18dae040431fdeeffbf1afb82b12db47c420d8c9d7a1", + "control_seed_rank_sha256": "e59d0a7eab534f1e0805b73796a288f8dd514a520e47585be8c06c9a4177f0ae", + "control_top1_age_events": 4764, + "control_top1_age_ms": 4764000, + "event_index": 12048, + "modality": "text", + "query_embedding_sha256": "5d5d35b48f4de8374d2486ac89de12a466c43bfaa3826dea38cf19e8911cdf6e", + "query_ordinal": 473, + "query_timestamp": 1700012048000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "b6cd56709cf136feb0f99067c8bb344d5014d21c1d6efcdb79c7c0d07b6b595f", + "control_graph_rank_sha256": "51342f36b6dee1fe5cc6083e1a7f979f8be5f72c9ba2a588f404a404d069d393", + "control_public_rank_sha256": "97c8bb7669871ff150ad1a4dc6ddeda78c2e555b5b3f20a1f1d5a754c5e65cc5", + "control_seed_rank_sha256": "b6cd56709cf136feb0f99067c8bb344d5014d21c1d6efcdb79c7c0d07b6b595f", + "control_top1_age_events": 5300, + "control_top1_age_ms": 5300000, + "event_index": 12072, + "modality": "text", + "query_embedding_sha256": "3d301966d458a4c6b12344a54adb8646abfe358b6503b58f83e229479456e530", + "query_ordinal": 474, + "query_timestamp": 1700012072000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "2a0bb722fbc4e8de84997e37616214a4c5d91df8374347ced417527d201fe914", + "control_graph_rank_sha256": "c2463a2ad46dc0a8060e0d711d01ef5509cacca647114009c842acf16462f31f", + "control_public_rank_sha256": "658ea523636862b1a19664a1329a4c5fb68b362ffe1545d0a5476c16fa323ca9", + "control_seed_rank_sha256": "2a0bb722fbc4e8de84997e37616214a4c5d91df8374347ced417527d201fe914", + "control_top1_age_events": 646, + "control_top1_age_ms": 646000, + "event_index": 12094, + "modality": "text", + "query_embedding_sha256": "89d38c98b9f4cf7d44e8122ceea7cb471b751b3f020079701f9f05f499e2b660", + "query_ordinal": 475, + "query_timestamp": 1700012094000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "c2b70442e74c7001f16cb5e979e1530b02f3ac5b2dcfe8aff1ed402be454990d", + "control_graph_rank_sha256": "0071d2fbd27c272f08e5e29417e245862e519e535ae9e9b43c42bc77180b4667", + "control_public_rank_sha256": "2d1852ce4781dc24975a7a34325d9b593ebd7261b1899b605cea579aa759ce09", + "control_seed_rank_sha256": "c2b70442e74c7001f16cb5e979e1530b02f3ac5b2dcfe8aff1ed402be454990d", + "control_top1_age_events": 9554, + "control_top1_age_ms": 9554000, + "event_index": 12120, + "modality": "text", + "query_embedding_sha256": "385e775d52860dcf019a026aabd7feb0f3aef5be0bfd5f78f6bc888fc81d2e30", + "query_ordinal": 476, + "query_timestamp": 1700012120000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "6283eb60366cf36ddc6cacdb340e9ecb4da1ea34a1595c2185df0494c357fc52", + "control_graph_rank_sha256": "68802b118d1d1ba69b6c1ed0d1243893cdbeaeeedef16ea17a9ce0641b98d902", + "control_public_rank_sha256": "fe417d09916c247eb68027c52a0a9e0868baa63650748b0c7b9597fd6c733b64", + "control_seed_rank_sha256": "6283eb60366cf36ddc6cacdb340e9ecb4da1ea34a1595c2185df0494c357fc52", + "control_top1_age_events": 551, + "control_top1_age_ms": 551000, + "event_index": 12145, + "modality": "text", + "query_embedding_sha256": "f254696cd57ef659f31fcbb31e8b53c321f1179979d93e4d65dc75af931ec663", + "query_ordinal": 477, + "query_timestamp": 1700012145000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "61b2a92b0cface355f1d6a1e94a8f638d970dda1e3bc9aae48e95dd260483e28", + "control_graph_rank_sha256": "c28843198fe882b850b26a0a8eedc34104235c5d9b735f33fd9bf5c2bbb53627", + "control_public_rank_sha256": "e78b70f7306d9062045df44bf0c7d3208fad63bc78fbb017fd9ac49d7b72b7d6", + "control_seed_rank_sha256": "61b2a92b0cface355f1d6a1e94a8f638d970dda1e3bc9aae48e95dd260483e28", + "control_top1_age_events": 3582, + "control_top1_age_ms": 3582000, + "event_index": 12168, + "modality": "text", + "query_embedding_sha256": "b42c5c307cb8e104dc1629515c755d03137d871e8ff4f80eb8ca34db8b0fe947", + "query_ordinal": 478, + "query_timestamp": 1700012168000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "366c1778803629593c3c81ad176219e471ccd648364d420c73e24911cd374c7e", + "control_graph_rank_sha256": "90da7621ae9beeda90b7bc31f618cc996768fb1a259cb51e90aa76feea95b20c", + "control_public_rank_sha256": "5f6c4d9e6176d8d81804599d1459b652b6783e69cee3d6cd0f4e5a87e153712d", + "control_seed_rank_sha256": "366c1778803629593c3c81ad176219e471ccd648364d420c73e24911cd374c7e", + "control_top1_age_events": 5031, + "control_top1_age_ms": 5031000, + "event_index": 12188, + "modality": "text", + "query_embedding_sha256": "f5f58b007d9e7bea4b9fc4e213874b9deb6fcfbedf4880502eec3eba18f3955e", + "query_ordinal": 479, + "query_timestamp": 1700012188000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "648b73bd61c1b0de9d6d390bb9f4688bb2110ff6e9b9809b9ba08809da25180e", + "control_graph_rank_sha256": "b9fc0a918d00587c8f921ec5b4e6f38ddb704d925c3aacb34dd4a2926474ab2b", + "control_public_rank_sha256": "07163d98f534fa67aadaca9c0b7b3f841d62224ca4be663974c19c5a94638e01", + "control_seed_rank_sha256": "648b73bd61c1b0de9d6d390bb9f4688bb2110ff6e9b9809b9ba08809da25180e", + "control_top1_age_events": 832, + "control_top1_age_ms": 832000, + "event_index": 12211, + "modality": "text", + "query_embedding_sha256": "bb9f8f191e20b567875acb45461b68f5d38c3149ba13eb4a1db2467a221a17b3", + "query_ordinal": 480, + "query_timestamp": 1700012211000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "e0665ad4511bb71560fda7e5f0ca4201d96a5622afd8b06487bee66845c5d71c", + "control_graph_rank_sha256": "faa501c0bab6bd9de07f564bec7e5ceab4f2d5f812d63a5b2387616c024e190c", + "control_public_rank_sha256": "e60a29d993d779537e7a989f6e050c9470f7e02bd6821c4b9a4da8592577398e", + "control_seed_rank_sha256": "e0665ad4511bb71560fda7e5f0ca4201d96a5622afd8b06487bee66845c5d71c", + "control_top1_age_events": 805, + "control_top1_age_ms": 805000, + "event_index": 12237, + "modality": "text", + "query_embedding_sha256": "4a72658f6bc63264cf08906debdcd2f225a83b2ff2bca16d67554b0585930f99", + "query_ordinal": 481, + "query_timestamp": 1700012237000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "6c98cbea84d428ad0fade07d8f5c2b112f6da2154b48eb269742ac6c0deb6d48", + "control_graph_rank_sha256": "5e22302d0818fa905eddbba62db5854eb27d10e611da4eced862ba9493d111d0", + "control_public_rank_sha256": "83670c7dea29b1e65e172abecf0bb797bce3ba867c2ddd074b344969f556a107", + "control_seed_rank_sha256": "6c98cbea84d428ad0fade07d8f5c2b112f6da2154b48eb269742ac6c0deb6d48", + "control_top1_age_events": 7084, + "control_top1_age_ms": 7084000, + "event_index": 12265, + "modality": "text", + "query_embedding_sha256": "ecc48d1fee472d0e54856e06397f682e270df815ce29bbf6305e4a6ad17b58bf", + "query_ordinal": 482, + "query_timestamp": 1700012265000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "86e6174e627b790f805c005bd1e56a4df045c4b67145792673b9c5ff4ba49659", + "control_graph_rank_sha256": "4e218867b8ce8bc80b7e0072aa71bc6541c4b3e3868481210d93eccbc6b8e363", + "control_public_rank_sha256": "f7eac642f3b96507da220143487782aa5dcce2d85ddb3351daa6242f4aaa428f", + "control_seed_rank_sha256": "86e6174e627b790f805c005bd1e56a4df045c4b67145792673b9c5ff4ba49659", + "control_top1_age_events": 3033, + "control_top1_age_ms": 3033000, + "event_index": 12289, + "modality": "text", + "query_embedding_sha256": "7bd3e57ef786c739b4ff3dac36e3e34acfd619703ddbd22dd259e5c8aa956abf", + "query_ordinal": 483, + "query_timestamp": 1700012289000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "7e09835ec70a5c33de781bac13c6caa9e360900eb9a6969809da074f0965d6c6", + "control_graph_rank_sha256": "3b88a4e3da971b003130f5ee74c583d4ea64a260953fa61794e3a2796cf0953a", + "control_public_rank_sha256": "994f86f3bff8c719f0add4171c4730248eccd4cc4062dea2599af42e4dfdf99e", + "control_seed_rank_sha256": "7e09835ec70a5c33de781bac13c6caa9e360900eb9a6969809da074f0965d6c6", + "control_top1_age_events": 9752, + "control_top1_age_ms": 9752000, + "event_index": 12318, + "modality": "text", + "query_embedding_sha256": "4f661ba54e1efa465db25a1adc159d53bcb459672628fec06cca8eef046da052", + "query_ordinal": 484, + "query_timestamp": 1700012318000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "d3d981f0fa6aa493408f0ea0f0cee5d368cd4ea68e9b957130de55b6f519c10e", + "control_graph_rank_sha256": "b50dbfe83d47da09f8acffd6befec9b8848f31d9fa3ef9e3ba4b0a0b6d68dc51", + "control_public_rank_sha256": "ffaeed32cb590c625e8efa80c1eadff32f69010ec9528a3940017c9d6df038ce", + "control_seed_rank_sha256": "d3d981f0fa6aa493408f0ea0f0cee5d368cd4ea68e9b957130de55b6f519c10e", + "control_top1_age_events": 6328, + "control_top1_age_ms": 6328000, + "event_index": 12343, + "modality": "text", + "query_embedding_sha256": "2d60141d28ff38679e01e284d004c64a2c0ea5694955b1e758091010493fe26a", + "query_ordinal": 485, + "query_timestamp": 1700012343000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "d0d520bca206ed07626bb1779dd276939e1dba30fe7d769be260be10b0e25f96", + "control_graph_rank_sha256": "d46e97ec0371e075919b0c428064f405b41a84926f8dcbee5f5852f198617b05", + "control_public_rank_sha256": "33316677d1c3420e2cb8b0988edeac582b5c1a872f28beea622480a454aa47bd", + "control_seed_rank_sha256": "d0d520bca206ed07626bb1779dd276939e1dba30fe7d769be260be10b0e25f96", + "control_top1_age_events": 877, + "control_top1_age_ms": 877000, + "event_index": 12369, + "modality": "text", + "query_embedding_sha256": "df090a65a3dd283e65454a4814c3df92aa29e13000a014562fd705a282509e38", + "query_ordinal": 486, + "query_timestamp": 1700012369000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "4059c8773660dc467a9191e5682adf13b691758ed9df9efaff9f7c56e2717704", + "control_graph_rank_sha256": "4af770fbc75c9bca89a463247d171e81409b51d3c8d1fea62d71e76bfbe92446", + "control_public_rank_sha256": "514cdbf26b73052704ae8cfc769b812d52b78ce78532686cc5e4a8e47a90b98d", + "control_seed_rank_sha256": "4059c8773660dc467a9191e5682adf13b691758ed9df9efaff9f7c56e2717704", + "control_top1_age_events": 8109, + "control_top1_age_ms": 8109000, + "event_index": 12393, + "modality": "text", + "query_embedding_sha256": "e15639775802240e9c2e5e37fcd2142d86048f6c9b14043c5c86e63495a99529", + "query_ordinal": 487, + "query_timestamp": 1700012393000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "b70194132c88ad8edad8e306507f791da5363eb69734cf1776907e6ebcea8e4b", + "control_graph_rank_sha256": "ee3365fba11cb1bdba12be2dded75d4a961b0de413f962a782e74550233ebd66", + "control_public_rank_sha256": "6bbddad72e212c02058a6117866833b7c285d5b0b3af229f52f736f2189e22a5", + "control_seed_rank_sha256": "b70194132c88ad8edad8e306507f791da5363eb69734cf1776907e6ebcea8e4b", + "control_top1_age_events": 6544, + "control_top1_age_ms": 6544000, + "event_index": 12418, + "modality": "text", + "query_embedding_sha256": "192a3ff5897be53ff061464d83c2f0e2dcce0e30d43859835405883d6a253b6e", + "query_ordinal": 488, + "query_timestamp": 1700012418000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "4af179b82658268153ecc68f8513a414e7b8be7ac61fd9d13710915feaa14ae7", + "control_graph_rank_sha256": "e6346359a8cff31eb565f64448111a9ace3f30bb9b0a58277ac38bdf3271723f", + "control_public_rank_sha256": "b16c3eb38ec5aaa00e72edf2d19447dac1e4b434358db95d41abe3fd56df59e1", + "control_seed_rank_sha256": "4af179b82658268153ecc68f8513a414e7b8be7ac61fd9d13710915feaa14ae7", + "control_top1_age_events": 3260, + "control_top1_age_ms": 3260000, + "event_index": 12448, + "modality": "text", + "query_embedding_sha256": "4d3a58ae36d54fa2ce01bc14c956bb34b270ed99024fbdad1dec881f0a5102c5", + "query_ordinal": 489, + "query_timestamp": 1700012448000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "808c91ca8de119a1191ebc276dbfe6f296122cb3d03c45bc21cdfc0b2c0e5f13", + "control_graph_rank_sha256": "fdd8c3b53e5dfbcaa327a063dccab0430299c118a1d61420d87fa6d7b2aa5eb8", + "control_public_rank_sha256": "2196e033ffafbd7795128bd2b768d5e4ab6289d6dcaaf1e6a022ff5bae75e3be", + "control_seed_rank_sha256": "808c91ca8de119a1191ebc276dbfe6f296122cb3d03c45bc21cdfc0b2c0e5f13", + "control_top1_age_events": 6056, + "control_top1_age_ms": 6056000, + "event_index": 12470, + "modality": "text", + "query_embedding_sha256": "be6043dfaff58786f5304ed72e16a729107fd9e0176d781488459d9b19d7224c", + "query_ordinal": 490, + "query_timestamp": 1700012470000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "019e37d30973537898e75d846b0f8ade07eca08d1ba319c3e677a493f7448e70", + "control_graph_rank_sha256": "30ce4519832977debac07e1d8904bfe613026d152b241d09d76c72a672aaaa5b", + "control_public_rank_sha256": "f3f88713cbb99b522515946fbfd138c52df43922454f2fdaee7b4623c9959064", + "control_seed_rank_sha256": "019e37d30973537898e75d846b0f8ade07eca08d1ba319c3e677a493f7448e70", + "control_top1_age_events": 2926, + "control_top1_age_ms": 2926000, + "event_index": 12493, + "modality": "text", + "query_embedding_sha256": "8d70307e3c61037d92d9f368c307ed3c58189b3c8725f488dd5777da01016813", + "query_ordinal": 491, + "query_timestamp": 1700012493000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "9cf92cfbd692766103ad7cfff5c659117479f96a9615d694ba1be5c35e673aa4", + "control_graph_rank_sha256": "63b732d3d564398e5935f22ad059b1099cc3e8728c45692330155a915924a81b", + "control_public_rank_sha256": "ec98d280b7817e384ecd0bf82d051bfc5d93906f1397d6cd89b80a2736c7b8c5", + "control_seed_rank_sha256": "9cf92cfbd692766103ad7cfff5c659117479f96a9615d694ba1be5c35e673aa4", + "control_top1_age_events": 8242, + "control_top1_age_ms": 8242000, + "event_index": 12518, + "modality": "text", + "query_embedding_sha256": "f1718c5761a2e203b75a563da684c0a60eff4486364fca0d2f52117f06c23335", + "query_ordinal": 492, + "query_timestamp": 1700012518000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "cf1322da53bee05a0d0755b09802ce221e1bd50515e5924d73e9eca454f8f1b0", + "control_graph_rank_sha256": "3e58785c21c61410fb63a897281268b6061f36ca4bfb96aa924ebac3bb4eaf4c", + "control_public_rank_sha256": "5c5308e2ab0fb3ea9a2a9fa923827b7f85dc96b76b96f2fb9f00bb21c73cb35b", + "control_seed_rank_sha256": "cf1322da53bee05a0d0755b09802ce221e1bd50515e5924d73e9eca454f8f1b0", + "control_top1_age_events": 150, + "control_top1_age_ms": 150000, + "event_index": 12543, + "modality": "text", + "query_embedding_sha256": "99ec2dcff51a1408513462cdc91b4819a78338eb390191bfac7f65a223174b92", + "query_ordinal": 493, + "query_timestamp": 1700012543000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "8b768678d43dd08e3f9ae43a09ffaad8e14a1103829b64a18236202a0470fa02", + "control_graph_rank_sha256": "29eed547ca0811f983003b8e6cfb986ae29a68ff7c9da6ba9c6ab8f4d59611ab", + "control_public_rank_sha256": "f5b5d9a6480ca7c4cf5a56334a2e21e6933c3c8b2a604eda90d24baacda8409f", + "control_seed_rank_sha256": "8b768678d43dd08e3f9ae43a09ffaad8e14a1103829b64a18236202a0470fa02", + "control_top1_age_events": 10, + "control_top1_age_ms": 10000, + "event_index": 12565, + "modality": "text", + "query_embedding_sha256": "7b58939b4055fafaf0907d89ce7b0c7ca972e1c8c4243973d9c5e9eafa7e6f29", + "query_ordinal": 494, + "query_timestamp": 1700012565000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "ce6291d973ed683d9550f00e545fa92aaca02ca50d85f506090fbffec8e2a0a2", + "control_graph_rank_sha256": "7c185c058a8ba7935110a3b0e62fb683e43a95e2f28865953054a1c3e1906c06", + "control_public_rank_sha256": "b7e451f375a80f5c228041022f7bfe14f9e60a31a2795a732792725b2db56ce0", + "control_seed_rank_sha256": "ce6291d973ed683d9550f00e545fa92aaca02ca50d85f506090fbffec8e2a0a2", + "control_top1_age_events": 134, + "control_top1_age_ms": 134000, + "event_index": 12588, + "modality": "text", + "query_embedding_sha256": "cb4883544d6d8bc2fff51956b62ebc62d7f1701308f7ec10c336593b88ae8aad", + "query_ordinal": 495, + "query_timestamp": 1700012588000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "5d0994994bc0347caf82b46290f0f435a1a5b02ab555dbf8e6b8b8f7b584980f", + "control_graph_rank_sha256": "70b0dae74527b1b1024caa37941d19e8e7d7c26f8dc2fc618b47b1706e98d780", + "control_public_rank_sha256": "6f52a467037f4d2ea56a26010ab66db5dae1e8b6fe9338af340b14d793baa38a", + "control_seed_rank_sha256": "5d0994994bc0347caf82b46290f0f435a1a5b02ab555dbf8e6b8b8f7b584980f", + "control_top1_age_events": 5959, + "control_top1_age_ms": 5959000, + "event_index": 12614, + "modality": "text", + "query_embedding_sha256": "f6a717240b42240e0117d48cd494b8a53a44c810934ca00514649ea17f9e0a51", + "query_ordinal": 496, + "query_timestamp": 1700012614000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "561dc085b3c58d877238e9674994d1693e120f4f14530e78c0bfbbcf566103c9", + "control_graph_rank_sha256": "ed7b4cb292225aa75d3e66805622c85502b05e74d8a09a2059187e63ba05bef0", + "control_public_rank_sha256": "66f9980d7597f22be5d59ecb0d46c59614f56912aa7a7288f34d8c2ca7c7a0ea", + "control_seed_rank_sha256": "561dc085b3c58d877238e9674994d1693e120f4f14530e78c0bfbbcf566103c9", + "control_top1_age_events": 7359, + "control_top1_age_ms": 7359000, + "event_index": 12642, + "modality": "text", + "query_embedding_sha256": "dc1d742c4c5a3b0eec80f4dbcf5e3e3d9108b8afe7da5d7222a504bd4e740e9c", + "query_ordinal": 497, + "query_timestamp": 1700012642000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "1fc5c1b224717353f189653185f20c8aee26f54c47e51e90dbc0604b4dd3e6cf", + "control_graph_rank_sha256": "f432c7f133a32e6bf6909f4c724713466bcc6db18b2eb909564d155b4df5e834", + "control_public_rank_sha256": "13d8263edd21b4331459a8519d0d111a8dbdd2f67f5fe14c570fcb3f7011486d", + "control_seed_rank_sha256": "1fc5c1b224717353f189653185f20c8aee26f54c47e51e90dbc0604b4dd3e6cf", + "control_top1_age_events": 6460, + "control_top1_age_ms": 6460000, + "event_index": 12667, + "modality": "text", + "query_embedding_sha256": "ea1f4a496fb4106cf930155784a41e1c603c7bfdae9de941d3f609013817625c", + "query_ordinal": 498, + "query_timestamp": 1700012667000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "489e06e7ea3f07fcc4d3d74c0343463cb1b122845a7997cf1590586ff4cf5c52", + "control_graph_rank_sha256": "aa87af2a38523ccf03f3c1dbb0f1c19fb6e4df7e855d1e5cb1184366a51a2c86", + "control_public_rank_sha256": "09becfceff13eddf89dc11f955f73b4c803cf63ee2dcdc29d165560c7090a9bd", + "control_seed_rank_sha256": "489e06e7ea3f07fcc4d3d74c0343463cb1b122845a7997cf1590586ff4cf5c52", + "control_top1_age_events": 4778, + "control_top1_age_ms": 4778000, + "event_index": 12692, + "modality": "text", + "query_embedding_sha256": "c124103aaa4802afb0d9cb91a2698e7bebe4c20bcbf6bf4b12dc80c4ad5dc3fe", + "query_ordinal": 499, + "query_timestamp": 1700012692000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "5419d136a397d0589f1b4334c40f29d7f49fc349f1b70cb03b86abc37312aeed", + "control_graph_rank_sha256": "9178b78dd0f18ce0d16e3c302f61dca69cbda356555da86bbfdefdbf50fa3c00", + "control_public_rank_sha256": "a341d9f2530f969c20a58665f92c8d2595075d131563be8f21128104ca1b2507", + "control_seed_rank_sha256": "5419d136a397d0589f1b4334c40f29d7f49fc349f1b70cb03b86abc37312aeed", + "control_top1_age_events": 208, + "control_top1_age_ms": 208000, + "event_index": 12719, + "modality": "text", + "query_embedding_sha256": "149af8eddf258a252e08701d6836db1369b4f187824f3f670ceb097920999b18", + "query_ordinal": 500, + "query_timestamp": 1700012719000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "6101207a1282d3ddef3187ca56b89a35a853226034b31621e65906fdb6d2ae45", + "control_graph_rank_sha256": "96fb9d5b85ead56f6c16a44941dbcaf844a5adcd464a42d5ded1420918beef90", + "control_public_rank_sha256": "9a6f527dbc1c752ebf78e93cc50652d247a4abc9007c040d3a1b118e5080d256", + "control_seed_rank_sha256": "6101207a1282d3ddef3187ca56b89a35a853226034b31621e65906fdb6d2ae45", + "control_top1_age_events": 324, + "control_top1_age_ms": 324000, + "event_index": 12747, + "modality": "text", + "query_embedding_sha256": "1c182b939f2b757a81ba676c722e5b7a76240c229532bcd5bcb9ff973c7f3daa", + "query_ordinal": 501, + "query_timestamp": 1700012747000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "a6262a7d3306156f1ea7d3e924f6be2eaaa045d985b41fc939909a321f63fe20", + "control_graph_rank_sha256": "f8d056e04672e520536fdc54403dfaab30d995666894186f0936dc58261388cd", + "control_public_rank_sha256": "266f52fefa64749de9f56dafc4b6ff424626267c409735f1957068fb4c10a328", + "control_seed_rank_sha256": "a6262a7d3306156f1ea7d3e924f6be2eaaa045d985b41fc939909a321f63fe20", + "control_top1_age_events": 2119, + "control_top1_age_ms": 2119000, + "event_index": 12772, + "modality": "text", + "query_embedding_sha256": "4101329367c2bcb9ec2c62801a4c8959b5014fb778877b2aa51ee86f614d54a8", + "query_ordinal": 502, + "query_timestamp": 1700012772000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "d9f37f4e0c8b839ff102c78d09ccead8e1faf877aaafd7af722ca1dfcc2438c2", + "control_graph_rank_sha256": "d7fda1e0568157ffe26aaabd21613f0e88ead70d95c299079046a970c98626a5", + "control_public_rank_sha256": "4b7f3043e805bd8de41d67c0574bd7edb8594dca5baa29d49a15b2523ef26121", + "control_seed_rank_sha256": "d9f37f4e0c8b839ff102c78d09ccead8e1faf877aaafd7af722ca1dfcc2438c2", + "control_top1_age_events": 6760, + "control_top1_age_ms": 6760000, + "event_index": 12794, + "modality": "text", + "query_embedding_sha256": "5fa357e80e2b3df232ee9ae7162e8e98bc9f1d59507991beae4a43e1cadfc9ef", + "query_ordinal": 503, + "query_timestamp": 1700012794000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "7007ab48d3e22d869a49218fd4ee1a48b668e4a2ee469cdd4eb01fffe5977814", + "control_graph_rank_sha256": "f00a85276e137be1bec841f4a7eb6a9d72a0e342c8d09e055c040ac2adc74865", + "control_public_rank_sha256": "efdda8deb571b66627d8893e365dc632277c93586cb0506da346be1b4b835955", + "control_seed_rank_sha256": "7007ab48d3e22d869a49218fd4ee1a48b668e4a2ee469cdd4eb01fffe5977814", + "control_top1_age_events": 14, + "control_top1_age_ms": 14000, + "event_index": 12817, + "modality": "text", + "query_embedding_sha256": "01315e04baceddad891ff78fc920c4c6ea18dce8970ab29dfcef95a6a951bfb5", + "query_ordinal": 504, + "query_timestamp": 1700012817000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "e3f81604b315057633cbceffc94feedf820a02c9da0bf22d51390ddcf4553455", + "control_graph_rank_sha256": "3e3383e810f3a7223277da8ed364c17901e165a0a31063edf19e66fdc43bc6bd", + "control_public_rank_sha256": "60b773db951ce56558212144b63c2fa2feef5e37bea9de16291f352cb5a6fed1", + "control_seed_rank_sha256": "e3f81604b315057633cbceffc94feedf820a02c9da0bf22d51390ddcf4553455", + "control_top1_age_events": 712, + "control_top1_age_ms": 712000, + "event_index": 12840, + "modality": "text", + "query_embedding_sha256": "31fb8326cc8d71d4926d94fcc82b854e1653a4d383a223d1239e94daa45708ef", + "query_ordinal": 505, + "query_timestamp": 1700012840000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "e2e2065a23ec184a675d3142d27ee26df9d8e0dfa96af642a701e842e57a29a7", + "control_graph_rank_sha256": "9cce851f980280461ed028e67b86bed7d445ddb2b23e9dede368e2b907ffd52f", + "control_public_rank_sha256": "1af51fc376e67dab6c38c25debbfcf67bdc1909602b60e29123501023b8f542a", + "control_seed_rank_sha256": "e2e2065a23ec184a675d3142d27ee26df9d8e0dfa96af642a701e842e57a29a7", + "control_top1_age_events": 2235, + "control_top1_age_ms": 2235000, + "event_index": 12865, + "modality": "text", + "query_embedding_sha256": "1f5fa16016a189a6b317f09c6d4252ab163a9df1926cc7ca9a9cfb388303f0cc", + "query_ordinal": 506, + "query_timestamp": 1700012865000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "dc79afbc08cd769ca31d4b8c70c77fa665558e5ade71c324410867747ab0253b", + "control_graph_rank_sha256": "20750b4cdad5b47765950c7f968748b93d11ec07e0a47571c61f88155cb65287", + "control_public_rank_sha256": "4b1411515694104f76fb02cb04ec14ba2a1852aed8217e5546ed0a83de010400", + "control_seed_rank_sha256": "dc79afbc08cd769ca31d4b8c70c77fa665558e5ade71c324410867747ab0253b", + "control_top1_age_events": 5562, + "control_top1_age_ms": 5562000, + "event_index": 12889, + "modality": "text", + "query_embedding_sha256": "c2fd3b70ccfbb8358f5cc8546a9aaa1a2da150d38ac93eaea82561e4765751f5", + "query_ordinal": 507, + "query_timestamp": 1700012889000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "c320599a3776962e6964c1c9ad290cf96099d2edc3dec1985b4cf677ce73d0a9", + "control_graph_rank_sha256": "0e4668990148b503a361ce7ae682ed46c03bbd112259113ac4504eacfcb52bf1", + "control_public_rank_sha256": "37c23c7689a8a892909bb32205760ae5c9ed0acc84a9e2e2d0193fed916d6bfa", + "control_seed_rank_sha256": "c320599a3776962e6964c1c9ad290cf96099d2edc3dec1985b4cf677ce73d0a9", + "control_top1_age_events": 1411, + "control_top1_age_ms": 1411000, + "event_index": 12918, + "modality": "text", + "query_embedding_sha256": "405bda0646ad36459002da5a0ed3c33c504e5c057567f60a97c680da2540146e", + "query_ordinal": 508, + "query_timestamp": 1700012918000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "589e4f158bc1117a08a1828c823a011559e359296775ec0675ef6485d43adbc7", + "control_graph_rank_sha256": "f2c61e5c43a3bf0a2c306288a7792e682443f1da59a073586c93af56643a2057", + "control_public_rank_sha256": "a6829a3ff89387d09c7f04c0b4f15d8240b363acd6c214804ee2502fd2d2173d", + "control_seed_rank_sha256": "589e4f158bc1117a08a1828c823a011559e359296775ec0675ef6485d43adbc7", + "control_top1_age_events": 432, + "control_top1_age_ms": 432000, + "event_index": 12943, + "modality": "text", + "query_embedding_sha256": "456bc8dffe41741820c6690494d7bb8575627232eaf541fc37cf09690fcab953", + "query_ordinal": 509, + "query_timestamp": 1700012943000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "4551102333044f67b4f14d1546110b65f5d53024a768476bf19766d15fb73f38", + "control_graph_rank_sha256": "e3dd1abf4cf85bdb6c3fcc8acf3b61536f9379411f81115de96968154b51ed6d", + "control_public_rank_sha256": "d295401bdde9f62905ea103bcc2ca69c304d5b5310d68018c1a5be9e300866ae", + "control_seed_rank_sha256": "4551102333044f67b4f14d1546110b65f5d53024a768476bf19766d15fb73f38", + "control_top1_age_events": 3449, + "control_top1_age_ms": 3449000, + "event_index": 12971, + "modality": "text", + "query_embedding_sha256": "a384e56a6d8c4468847fe72b2755a3c342430c4b43fcf8e176b7c71a487b42d4", + "query_ordinal": 510, + "query_timestamp": 1700012971000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "8c516b58ba9afc8eb09d1a726a0ae9d5a2f8dda82d4a0cf2e5cea388effa1efe", + "control_graph_rank_sha256": "55bed0a044c1a394fbe50f94b492ce432fb18289fbf617736abbe353b264d9bd", + "control_public_rank_sha256": "8e04c40e7a4599d3cd337bc588f41b01db6d2887fd22a1fcfc467caedbe8c80a", + "control_seed_rank_sha256": "8c516b58ba9afc8eb09d1a726a0ae9d5a2f8dda82d4a0cf2e5cea388effa1efe", + "control_top1_age_events": 503, + "control_top1_age_ms": 503000, + "event_index": 12996, + "modality": "text", + "query_embedding_sha256": "1d5bfeaa565961f49b24fb1fd79979809cda0ec417e15b8e7c2c2f46c8083ee5", + "query_ordinal": 511, + "query_timestamp": 1700012996000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + } + ], + "result_k": 16, + "retrieval_active_event_count": 4476, + "schema": "cortext_current_public_retrieval_control_audit_v1", + "semantic_coverage": 1.0, + "source_digest_count": 1, + "status": "candidate-quality-passed", + "top1_miss_fingerprints": [], + "unresolved_limits": [] +} diff --git a/artifacts/flat_storage_cost/recenter-centroid-natural-full-v1-overlap.json b/artifacts/flat_storage_cost/recenter-centroid-natural-full-v1-overlap.json new file mode 100644 index 00000000..a0141e71 --- /dev/null +++ b/artifacts/flat_storage_cost/recenter-centroid-natural-full-v1-overlap.json @@ -0,0 +1,64 @@ +{ + "schema": "cortext_recenter_activation_overlap_v3", + "status": "measured-recenter-changes-activated-identity-set", + "decision": "recenter-materiality-requires-quality-and-cycle-evaluation", + "processed_events": 15695, + "consolidation_runs": 120, + "profiled_successful_recenters": 105, + "invalid_profiled_pairs": 0, + "first_profiled_recenter_event_index": 2408, + "last_profiled_recenter_event_index": 15678, + "full_activation_target_recenters": 76, + "changed_activated_set_count": 76, + "unchanged_activated_set_count": 29, + "minimum_pre_post_overlap_fraction": 0.47996794871794873, + "maximum_pre_activated_identities": 1248, + "maximum_post_activated_identities": 1248, + "maximum_pre_node_rows": 2008, + "maximum_post_node_rows": 2009, + "minimum_centroid_cluster_count": 0, + "minimum_centroid_member_count": 125, + "cluster_centroid_recenter_count": 0, + "active_signal_ring_centroid_recenter_count": 105, + "focus": 0.45, + "sensitivity": 0.5, + "stability": 0.5, + "derived_parameters": { + "C": 499, + "B": 125, + "A": 1248, + "public_query_node_budget": 2495, + "construction_node_budget": 624, + "construction_queue_effort": 250, + "logical_B_plus_one_only": 126, + "neutral_C": 512, + "neutral_B": 128, + "neutral_A": 1280, + "neutral_logical_B_plus_one_only": 129 + }, + "corpus_sha256": "17a447f237ff7dd1b732eca1a0f31e908b89b2ffdd20ae8b32df2e719a0271a2", + "raw_profile_sha256": "c90b76a3ebb8d8aaef64226427f47b7e958ea9b0e9b37e446eab7124addd1c40", + "database_sha256": "cb78fd322d51deb9057644c4739f56e836d264e6ed5c74d0b524e43ad8a15f70", + "benchmark_binary_sha256": "e547c12db7912b9a0dc0f1788c5b234c44a0323ba95097c86cfe90e6df60cd83", + "required_follow_on": { + "algorithm_target": "consolidation-driven-sparse-activation-centroid-reset", + "fixed_activation_target": "A=2C+2B", + "fixed_query_work": "5C", + "structural_knob_points": 27, + "production_shaped_knob_points": 9, + "modality_and_source_id_agnostic": true, + "raw_process_reset_gate_remains_independent": true + }, + "nonclaims": [ + "accepted retrieval cycle", + "raw consolidation reset pass or waiver", + "bounded restart", + "Natural or Durable plateau", + "whole-goal completion", + "PR readiness", + "merge", + "release", + "deployment", + "publication" + ] +} diff --git a/artifacts/flat_storage_cost/recenter-centroid-natural-full-v1-retrieval-audit.json b/artifacts/flat_storage_cost/recenter-centroid-natural-full-v1-retrieval-audit.json new file mode 100644 index 00000000..628afc82 --- /dev/null +++ b/artifacts/flat_storage_cost/recenter-centroid-natural-full-v1-retrieval-audit.json @@ -0,0 +1,7717 @@ +{ + "candidate_complete": true, + "candidate_quality_passed": true, + "control_population_passed": true, + "coverage_contract": { + "minimum_opaque_source_ids": 1, + "modality_agnostic_proof": "separate active-SQLite-route source/modality label-invariance regression", + "required_modalities": [ + "text" + ] + }, + "deterministic_tie_order": true, + "event_index_first": 6, + "event_index_last": 15691, + "exact_identity_recall_at_k": 1.0, + "exact_top1": 1.0, + "exact_top1_hits": 512, + "exact_top1_minimum": 0.998046875, + "exact_top1_miss_count": 0, + "modalities": [ + "text" + ], + "passed": true, + "private_profile_sha256": "c90b76a3ebb8d8aaef64226427f47b7e958ea9b0e9b37e446eab7124addd1c40", + "production_cutover": false, + "query_count": 512, + "query_fingerprints": [ + { + "candidate_seed_rank_sha256": "080a9ed428559ef602668b4c00f114f1a11c3f6b02a435f0bdc154578e4d7f22", + "control_graph_rank_sha256": "56f84850716cfbffa9d81c7aec8c0a03f77ed03c09e3b25ca424cb2fe13c0d58", + "control_public_rank_sha256": "6f2dedf3556d025f563cd51d3f2d29968da7d371329619963c48627952fd6769", + "control_seed_rank_sha256": "080a9ed428559ef602668b4c00f114f1a11c3f6b02a435f0bdc154578e4d7f22", + "control_top1_age_events": 4, + "control_top1_age_ms": 4000, + "event_index": 6, + "modality": "text", + "query_embedding_sha256": "84587433177852a5b67ac983f87d37932dbd638df0918b13e53b61ec551aa556", + "query_ordinal": 0, + "query_timestamp": 1700000006000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "5260b74496d2785d88525a9d467f6156b28c0954749b6574a291ecb1de9b0b18", + "control_graph_rank_sha256": "52b27102e57486766c8346b22de01b13b98c844fdb73adbff6cb6f29bb8cabe5", + "control_public_rank_sha256": "e5f31a7cf8f836f53e19e4fc8f9490ba6738298a5071b980464263c75ce7b244", + "control_seed_rank_sha256": "5260b74496d2785d88525a9d467f6156b28c0954749b6574a291ecb1de9b0b18", + "control_top1_age_events": 14, + "control_top1_age_ms": 14000, + "event_index": 41, + "modality": "text", + "query_embedding_sha256": "883030a78abacc46a4a588f026e3a83d498e851f239b5a9db03585d5c9f166c6", + "query_ordinal": 1, + "query_timestamp": 1700000041000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "ad99097220a556794638b5da358ff1acc7da36d47fcf6f7576bdae338d50360a", + "control_graph_rank_sha256": "c1eb377bd66db9ea40c3a5118fcf845de7df78d980adfe829b0fde2f919d4f10", + "control_public_rank_sha256": "a3806a9c3575692545d0627154405495d7aaf0c07e0fe6f7948ac3d830b4c570", + "control_seed_rank_sha256": "ad99097220a556794638b5da358ff1acc7da36d47fcf6f7576bdae338d50360a", + "control_top1_age_events": 10, + "control_top1_age_ms": 10000, + "event_index": 74, + "modality": "text", + "query_embedding_sha256": "e51b58dc4ccb5f48993db25934930c3159a82cb2bc07e69c711928ee9ebde218", + "query_ordinal": 2, + "query_timestamp": 1700000074000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "6c1700b8edd97d4ff054d1f6fb83019b74db96f04550090a87c51339f86b5f14", + "control_graph_rank_sha256": "b943a6d6156bd24ec00748d87e970fe8f11049bad9276d335037ad32a949dfcb", + "control_public_rank_sha256": "df18a9718ddefa967c22dad5d61861fd49ac726aed9f171d32cb39105fba1232", + "control_seed_rank_sha256": "6c1700b8edd97d4ff054d1f6fb83019b74db96f04550090a87c51339f86b5f14", + "control_top1_age_events": 27, + "control_top1_age_ms": 27000, + "event_index": 105, + "modality": "text", + "query_embedding_sha256": "21123992bdcbf6546eda074fcdaa3d660f49b9b3eb72bcb7113fdcc6379bf126", + "query_ordinal": 3, + "query_timestamp": 1700000105000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "0a287b0890cf2adb87c882c59a52148fc790a2f9fcd75bd77bef732236b8947e", + "control_graph_rank_sha256": "37381ffc6ec7f112b4d5c81061ff2f52c182f75ec9442215b842788bf08cba69", + "control_public_rank_sha256": "ef9ae29486be0235586bec12abc0a9dad5d0aeb4152a6e809f80331296990ba9", + "control_seed_rank_sha256": "0a287b0890cf2adb87c882c59a52148fc790a2f9fcd75bd77bef732236b8947e", + "control_top1_age_events": 6, + "control_top1_age_ms": 6000, + "event_index": 134, + "modality": "text", + "query_embedding_sha256": "63a08d10d6f38014def82998e2f29d15b776365adc89acabd73ce1ae554a29c8", + "query_ordinal": 4, + "query_timestamp": 1700000134000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "d7830717b55f717f455ee6d8dbf9ed612df6ad744a1b897650902879eb12043b", + "control_graph_rank_sha256": "f890ef1b801c295ecedc6d743be6aa02a8cfbb26dfd6a30eb01c348804050975", + "control_public_rank_sha256": "07914dcfcd0e4a7ec60d065743233a3ed5775aa86294abdf517e509aef650069", + "control_seed_rank_sha256": "d7830717b55f717f455ee6d8dbf9ed612df6ad744a1b897650902879eb12043b", + "control_top1_age_events": 17, + "control_top1_age_ms": 17000, + "event_index": 161, + "modality": "text", + "query_embedding_sha256": "3205afe6f28b5ebffeecd8fa56f2edc6d441f5b2d0c242ad08d8a9b3ea700497", + "query_ordinal": 5, + "query_timestamp": 1700000161000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "80ae712d74e1a8f0f42bc1258928f9cc4ab6eadf66bb93fb98f2bd933ae53479", + "control_graph_rank_sha256": "a0251674305e3352e654d8e5917cf0b2d1252644c61ab3c873075e43154e0d1d", + "control_public_rank_sha256": "4d38b5c80482c1ac28f484901a0cbdd93606c8e8c76e0a67e7a94c975218bb4e", + "control_seed_rank_sha256": "80ae712d74e1a8f0f42bc1258928f9cc4ab6eadf66bb93fb98f2bd933ae53479", + "control_top1_age_events": 4, + "control_top1_age_ms": 4000, + "event_index": 194, + "modality": "text", + "query_embedding_sha256": "d93c033ad61e3a0483261e5a2b7997b851c45f643c2cface1a410743e2a8854f", + "query_ordinal": 6, + "query_timestamp": 1700000194000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "28edbeb786c019ed911c51782ce4d03f6b74a3178662150abb54b97840a3134b", + "control_graph_rank_sha256": "8dea6e3bfbafeeea4294e655cfd0aeaca87c07b86db81dcd445d09bfd82c67ef", + "control_public_rank_sha256": "5a31d5a9d509b1521b358b8911c5b8944ccc75e5953de83f4057e6f64ee6b7fa", + "control_seed_rank_sha256": "28edbeb786c019ed911c51782ce4d03f6b74a3178662150abb54b97840a3134b", + "control_top1_age_events": 67, + "control_top1_age_ms": 67000, + "event_index": 229, + "modality": "text", + "query_embedding_sha256": "e13ba30e6eee27e47a38e6c4ea98f59255fe13b3a399e5e62fb719e51471a228", + "query_ordinal": 7, + "query_timestamp": 1700000229000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "749d8fbec40d8fb7bcbee915c15a7782f0409ef14c6900a66aa4074efb0693b5", + "control_graph_rank_sha256": "136eef6680b10a48ecda0f63f7cba9529a094860958093166600a730d888c8af", + "control_public_rank_sha256": "523bbd38dd27e873b972ef70f99d10dd9fe9676496ac1db310a58bfc102de07c", + "control_seed_rank_sha256": "749d8fbec40d8fb7bcbee915c15a7782f0409ef14c6900a66aa4074efb0693b5", + "control_top1_age_events": 72, + "control_top1_age_ms": 72000, + "event_index": 256, + "modality": "text", + "query_embedding_sha256": "161aa732d5f876855dde5d1346e5ffa5e94049aeed8b42cbc42ee1cc278fdb67", + "query_ordinal": 8, + "query_timestamp": 1700000256000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "d8e247af6bbbd459bb4eba58df65cf325ddf0dfeba939cef36c80cb3c4699ea3", + "control_graph_rank_sha256": "d51e0932d781ef28e67d1beac9852d6161dccc475fb1372e6711545686462bc3", + "control_public_rank_sha256": "26c31f59fbd88c89a6adb0dcac6c16ae3288beb048692637bf158dd76815a66d", + "control_seed_rank_sha256": "d8e247af6bbbd459bb4eba58df65cf325ddf0dfeba939cef36c80cb3c4699ea3", + "control_top1_age_events": 140, + "control_top1_age_ms": 140000, + "event_index": 289, + "modality": "text", + "query_embedding_sha256": "b46894fd876cf6649064625b1191e4bc0e9d81845db8cdc549116b8a18b6a873", + "query_ordinal": 9, + "query_timestamp": 1700000289000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "be4cf0c7839f29d35865f07b5099c4f81d399830f4f4d6b32d4ec81cefda73ba", + "control_graph_rank_sha256": "51ff885d3576f00b1a96b0e17b797b6358244e2f0af7e395bb7a7166f9eddd82", + "control_public_rank_sha256": "743bb04344f6f7b56a7f7ada5f4ad871e25efb5f66b18dfc7fb6232287481db6", + "control_seed_rank_sha256": "be4cf0c7839f29d35865f07b5099c4f81d399830f4f4d6b32d4ec81cefda73ba", + "control_top1_age_events": 124, + "control_top1_age_ms": 124000, + "event_index": 314, + "modality": "text", + "query_embedding_sha256": "62fdd11bec34a929b64c50ffac7e78be3ebb4d87d2f73e40dd118144e03f7765", + "query_ordinal": 10, + "query_timestamp": 1700000314000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "29cb906e60a8712dc617b91d4a57f2b0995a187c79100f8f1df698718b0ecc7c", + "control_graph_rank_sha256": "2f2333bd87aa7f4b811721f9f9eb17efd9c349fa1fa5f7ca0e8fb24d3d52e3f4", + "control_public_rank_sha256": "dc9708b866000f4845a980e842db7959331271c4dcd81648e3ad3f4ecc811fb7", + "control_seed_rank_sha256": "29cb906e60a8712dc617b91d4a57f2b0995a187c79100f8f1df698718b0ecc7c", + "control_top1_age_events": 8, + "control_top1_age_ms": 8000, + "event_index": 345, + "modality": "text", + "query_embedding_sha256": "e29d11dd9500ed0f434569e9bac799f5ad8c7a5110f286105c541c80ad171a48", + "query_ordinal": 11, + "query_timestamp": 1700000345000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "60487d06236d03f58f093bd8ce336a4b32ed1a1865de5c2817bab404f945a9bd", + "control_graph_rank_sha256": "a76522002bc060920b6aa67f1977a1c80b5f2e0d15970bb722ae11b1c6abf688", + "control_public_rank_sha256": "240ef206aed25c802940cc61059f22969ed49741892634469e3690db50a96261", + "control_seed_rank_sha256": "60487d06236d03f58f093bd8ce336a4b32ed1a1865de5c2817bab404f945a9bd", + "control_top1_age_events": 32, + "control_top1_age_ms": 32000, + "event_index": 377, + "modality": "text", + "query_embedding_sha256": "2a14cbc484adce4fdb352f6ce6d114871973c73bb92713436f9429c65245c722", + "query_ordinal": 12, + "query_timestamp": 1700000377000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "958328d8d6f74400ef11ea4684cfe086957519857e5a3292ee125534406c2dd4", + "control_graph_rank_sha256": "9ec1a00796e7936f217b73d061ab684ccef637916caea28c302f7a1271dda29c", + "control_public_rank_sha256": "625a24aab959673e21c8f92ff07b45b56af9954867eb56730f3dd6ceb5cfdd3f", + "control_seed_rank_sha256": "958328d8d6f74400ef11ea4684cfe086957519857e5a3292ee125534406c2dd4", + "control_top1_age_events": 37, + "control_top1_age_ms": 37000, + "event_index": 405, + "modality": "text", + "query_embedding_sha256": "76ef40d77122849e5e7ddb75ce425ad291e698ddd2fe85009420bf713e2a87f7", + "query_ordinal": 13, + "query_timestamp": 1700000405000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "f972375c5e6a64800336587867133011ef41369c4d6270b6c5c30c64aa6febe9", + "control_graph_rank_sha256": "b77efe7556b8d84171131dc0ee386eac9e874d76bc7ca4775af82c902a4d190c", + "control_public_rank_sha256": "1680636be72ca91cdb327461c619865eb78e7b4bf14d1972320f2cee22c8a020", + "control_seed_rank_sha256": "f972375c5e6a64800336587867133011ef41369c4d6270b6c5c30c64aa6febe9", + "control_top1_age_events": 339, + "control_top1_age_ms": 339000, + "event_index": 438, + "modality": "text", + "query_embedding_sha256": "288a7d30c5c601b64864b58d13a621fe4eab91aae21b293760d0ab563943d3b5", + "query_ordinal": 14, + "query_timestamp": 1700000438000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "d46e17b1c4de70ac391779398fca20469fa0d976d5d73fcb6b830485f66544db", + "control_graph_rank_sha256": "fc30f33cbcca4e278a745517a22827bae912577a0af7fffb36547ef06eee550a", + "control_public_rank_sha256": "eec101712de50dda13ff7cbce1e2241529c925ae40613349dc484ba6f65f7b30", + "control_seed_rank_sha256": "d46e17b1c4de70ac391779398fca20469fa0d976d5d73fcb6b830485f66544db", + "control_top1_age_events": 31, + "control_top1_age_ms": 31000, + "event_index": 465, + "modality": "text", + "query_embedding_sha256": "b9178eaa73c82da212154e0ba3cdb2d87e7e56c71f9afb131e55e0843e05b0b4", + "query_ordinal": 15, + "query_timestamp": 1700000465000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "3b5c8ce4c6733453907bcf7fb756a05636d9b5c6559aa5cf71edf1daae1ece2e", + "control_graph_rank_sha256": "a6db6a2e6a86680a6f09292d38d8d15e4592a50b6a17e1cab4e09f035f35f208", + "control_public_rank_sha256": "bed26f457fd0bcc49d3eb2d04faca9abc2a5ec10260c7bf859564ff9db28dab5", + "control_seed_rank_sha256": "3b5c8ce4c6733453907bcf7fb756a05636d9b5c6559aa5cf71edf1daae1ece2e", + "control_top1_age_events": 316, + "control_top1_age_ms": 316000, + "event_index": 500, + "modality": "text", + "query_embedding_sha256": "ffb2183439804bc47770e7200421e87019f5871e88c5382a361c06f60d9a185b", + "query_ordinal": 16, + "query_timestamp": 1700000500000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "d3a61c363096987e17c3f64ea3b145571559f0e5ff79819a1e10947d1cfc55b4", + "control_graph_rank_sha256": "e816ec1fab982baa77def0f282448f1fb0c89f9a036eab38f68eb18fa99226f4", + "control_public_rank_sha256": "02897c702c980e3cb5f0a1a080a93147eb30f9636412d1b73837899667991044", + "control_seed_rank_sha256": "d3a61c363096987e17c3f64ea3b145571559f0e5ff79819a1e10947d1cfc55b4", + "control_top1_age_events": 198, + "control_top1_age_ms": 198000, + "event_index": 530, + "modality": "text", + "query_embedding_sha256": "0a2d6f27d50011fd6fa0ac97d73af9995f5151ee572177555109b12ea489bd4d", + "query_ordinal": 17, + "query_timestamp": 1700000530000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "267b7710280e57639696a67a5a40b6acb1b86f0e577182da6ecd5730ae66d3d7", + "control_graph_rank_sha256": "b6779a2cb9dd8f01f8fe1ed0ffc8894cf490bd2935db6e1563347657e5d67655", + "control_public_rank_sha256": "2c60f54fe1a4321b90c67981d92e17e580cf43ecf90d0a41745092411937c031", + "control_seed_rank_sha256": "267b7710280e57639696a67a5a40b6acb1b86f0e577182da6ecd5730ae66d3d7", + "control_top1_age_events": 33, + "control_top1_age_ms": 33000, + "event_index": 563, + "modality": "text", + "query_embedding_sha256": "9a423ede9087ff6dbbf47be1dc4f3ec4b81adf2270acea6377a03b5982441bec", + "query_ordinal": 18, + "query_timestamp": 1700000563000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "75b60db0b5553203f5b1c74259604292e75b8c5dbe3a62964aa80d52db095ebc", + "control_graph_rank_sha256": "d833519520149576bc06d66ce1ed645dfb0fc66ff8c47cc422d0d48eb5ecbef9", + "control_public_rank_sha256": "cac60082113ba98760a6d5814708fb48cd58342ce443453a99474c2bce1931da", + "control_seed_rank_sha256": "75b60db0b5553203f5b1c74259604292e75b8c5dbe3a62964aa80d52db095ebc", + "control_top1_age_events": 4, + "control_top1_age_ms": 4000, + "event_index": 590, + "modality": "text", + "query_embedding_sha256": "097f26c7441f4d3d14b66d775a2dc1fbbb903644165e45ed4f99f09ba1a9ebc0", + "query_ordinal": 19, + "query_timestamp": 1700000590000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "2c69fb9452e20cc1a56b8473b0ac40c78beb70975c59e7854e27410f47501a2d", + "control_graph_rank_sha256": "81f7b3dbf7425045359328b2edb8d6f3bab66696f2d7eda5d7ed3a085af4f3e9", + "control_public_rank_sha256": "a56a2141d801b79bf52f32134dab702cef2b164c5782c334115c02386427122d", + "control_seed_rank_sha256": "2c69fb9452e20cc1a56b8473b0ac40c78beb70975c59e7854e27410f47501a2d", + "control_top1_age_events": 22, + "control_top1_age_ms": 22000, + "event_index": 618, + "modality": "text", + "query_embedding_sha256": "c20550620c1e4e3adb35f5d2029c20591ff1443c4503bcc0420e318635026fc4", + "query_ordinal": 20, + "query_timestamp": 1700000618000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "21609fe8cc54406448a84db3d2c718311f8c94053dcd2f3318840b6ed87cd47b", + "control_graph_rank_sha256": "0ec5194c73ba49f1c5b98afedb6928cd2cb6285464d79ba5cb1ab6ed59287a32", + "control_public_rank_sha256": "83499f350dd096aba49eec35ec1374734fe094525be89b486fdbf749725c0115", + "control_seed_rank_sha256": "21609fe8cc54406448a84db3d2c718311f8c94053dcd2f3318840b6ed87cd47b", + "control_top1_age_events": 114, + "control_top1_age_ms": 114000, + "event_index": 650, + "modality": "text", + "query_embedding_sha256": "31437bbe1fb90a9ec07c7afb7348ce90a755a03cb88449b47996ba41c477122b", + "query_ordinal": 21, + "query_timestamp": 1700000650000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "2c7dff58607fba859ae6320c3bc1ef0657ab10c2fe3d5fd379d6ea960113ccd8", + "control_graph_rank_sha256": "746fd50389b9923ae312eab799c87697e9355dc8e289ca118994ba28a1d6aa14", + "control_public_rank_sha256": "25ede92c8bbbe5a0275ae366284f085a702183c1fe1c961512fd61eb8703792c", + "control_seed_rank_sha256": "2c7dff58607fba859ae6320c3bc1ef0657ab10c2fe3d5fd379d6ea960113ccd8", + "control_top1_age_events": 14, + "control_top1_age_ms": 14000, + "event_index": 677, + "modality": "text", + "query_embedding_sha256": "d1c3576711f69a0d636f973de46ffa87bfac075d608af2c99684c1277f16d837", + "query_ordinal": 22, + "query_timestamp": 1700000677000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "70e1c2f97720d13663870ba74a0d1cb89a202350280f3b977bab159c19a85786", + "control_graph_rank_sha256": "b6f049018342271005a273931ef27ef9e6b2321ec671d6c5584282c07a52a021", + "control_public_rank_sha256": "70a5f75e02ffe21c496f23619723f9a1d6daf02b731e74b43c3483460acae01a", + "control_seed_rank_sha256": "70e1c2f97720d13663870ba74a0d1cb89a202350280f3b977bab159c19a85786", + "control_top1_age_events": 186, + "control_top1_age_ms": 186000, + "event_index": 707, + "modality": "text", + "query_embedding_sha256": "22c1a131e065fef8b09fafeb511240e257007542f31de59326c8ebe9289e248e", + "query_ordinal": 23, + "query_timestamp": 1700000707000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "000dce49cb9a2036d899aa4998b8f9574f4689b1b438e196f0634294c30c0671", + "control_graph_rank_sha256": "3086877ead2a6e3aea31ef530dd73a3aae78a2ff521d190c6b32d0be5ef33c4b", + "control_public_rank_sha256": "f5e33d545b78a3042979909d4767d935e3c1fe06585b15a3a37c46776e3df453", + "control_seed_rank_sha256": "000dce49cb9a2036d899aa4998b8f9574f4689b1b438e196f0634294c30c0671", + "control_top1_age_events": 209, + "control_top1_age_ms": 209000, + "event_index": 739, + "modality": "text", + "query_embedding_sha256": "3f24dc92638cb805d86e6aac9240cea4d3afc95848dd157148123f09a334b226", + "query_ordinal": 24, + "query_timestamp": 1700000739000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "8b5144a037210ec52e2211f64943922323077f7eb40284c963a5c569af60f94c", + "control_graph_rank_sha256": "d7a8db6c48d46e95a7454d0dbae8babb65d69edf14e07dfb1eadfc29addcbb0f", + "control_public_rank_sha256": "d38b892af7022e551b9fb7b5f02f897b68958883b467d5dd0b813a8739910ed0", + "control_seed_rank_sha256": "8b5144a037210ec52e2211f64943922323077f7eb40284c963a5c569af60f94c", + "control_top1_age_events": 5, + "control_top1_age_ms": 5000, + "event_index": 770, + "modality": "text", + "query_embedding_sha256": "4219e380ea345d436944ba1709cbdb4a638c504c51faa9174710feb0bb553fc8", + "query_ordinal": 25, + "query_timestamp": 1700000770000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "aac446048f1aaf167921561bbb567b1cf4bd759a667328d9c57a70942ff16f89", + "control_graph_rank_sha256": "e9cbb52903505db61a0fadcce518681e52de5b846a8ad363d6883417f95e222f", + "control_public_rank_sha256": "ab846e151d63a1fd58cc1dd6334596eac685efdde4fbbccf04c95b9e30b2317d", + "control_seed_rank_sha256": "aac446048f1aaf167921561bbb567b1cf4bd759a667328d9c57a70942ff16f89", + "control_top1_age_events": 714, + "control_top1_age_ms": 714000, + "event_index": 797, + "modality": "text", + "query_embedding_sha256": "10f2d61f96a1afaa0ecbfec73437e4268f4ed0e41cab9cbe5e8515cc5135d005", + "query_ordinal": 26, + "query_timestamp": 1700000797000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "da4851fe95890b5826755186602882b7e3bcf957035c69c024e5490edd961fa5", + "control_graph_rank_sha256": "5d744967cabc001c499192825bc43d9dce4090eaef8d8cbdfff80d8e2b26a0b5", + "control_public_rank_sha256": "e09bf06fa4452637025d357e45c1ea5a0c7eb20929b939f7d773fc77356147c8", + "control_seed_rank_sha256": "da4851fe95890b5826755186602882b7e3bcf957035c69c024e5490edd961fa5", + "control_top1_age_events": 606, + "control_top1_age_ms": 606000, + "event_index": 832, + "modality": "text", + "query_embedding_sha256": "0690f15caa7a77b00601446e029b8c4857f41a2fcd3afc62ec2bb9003a4c2929", + "query_ordinal": 27, + "query_timestamp": 1700000832000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "39bb0692d0f8a8fa194dc9708a9fb0845d9144809de49bb5283045ea70f77311", + "control_graph_rank_sha256": "7dd6f7ce38b9f0816218cffb34136bfe04216afc364cb69d16e71905042076b2", + "control_public_rank_sha256": "75214cd40656617bcbf270ac8fc2e24f2e4ba5b2e8decdaead853bab44b42e2d", + "control_seed_rank_sha256": "39bb0692d0f8a8fa194dc9708a9fb0845d9144809de49bb5283045ea70f77311", + "control_top1_age_events": 135, + "control_top1_age_ms": 135000, + "event_index": 862, + "modality": "text", + "query_embedding_sha256": "d1a7c8beddedc0f886d3b732d99b0b1e2c6c4dbce7bd4bdf32dca0249baba76f", + "query_ordinal": 28, + "query_timestamp": 1700000862000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "98d8652844e4faba5d70901923cd35e0c5d0c45971dcb7cdc78d45956c1e71da", + "control_graph_rank_sha256": "029d1f33cb2b155be06ec604ec76b0ee252db7cd17cc161eebeb227da6e33ca5", + "control_public_rank_sha256": "76ed03db901c144bf6bb716130dcd5ee3dfe5a9d98862dc1f674535a73cf9e2a", + "control_seed_rank_sha256": "98d8652844e4faba5d70901923cd35e0c5d0c45971dcb7cdc78d45956c1e71da", + "control_top1_age_events": 11, + "control_top1_age_ms": 11000, + "event_index": 890, + "modality": "text", + "query_embedding_sha256": "f26826fddc637edfb9f4b3a4d4d1fd3f606ac0ae0ac6e25a7deff7a2bcf37435", + "query_ordinal": 29, + "query_timestamp": 1700000890000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "6988726754fcaf844816d84fda1e110eb10618d4c7c2da9a06a01027bd8b0e1e", + "control_graph_rank_sha256": "00d4358966794253154cf530c6335c1d5fcdcb2015632338978288079200d5be", + "control_public_rank_sha256": "25d9cd4edbc9e6056151da388225e7d0e3e4743367d0f16542e6644cb8aa8287", + "control_seed_rank_sha256": "6988726754fcaf844816d84fda1e110eb10618d4c7c2da9a06a01027bd8b0e1e", + "control_top1_age_events": 21, + "control_top1_age_ms": 21000, + "event_index": 919, + "modality": "text", + "query_embedding_sha256": "99e1b874fb5e857e3db621b47a108ae14150d826b8bd6f44875538579e158440", + "query_ordinal": 30, + "query_timestamp": 1700000919000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "2880851e5114400242ec95df00acf94816abd3b69cadca8835aade26ec9c3d0c", + "control_graph_rank_sha256": "05b557a0f85db6ba67c82c014ce1c72b7ffd977245571b08c09393e08bfd9058", + "control_public_rank_sha256": "33f0c2e7678c870fe5778e904a4f79e5486a105a7a3c87afa4e9d6e3c9c31501", + "control_seed_rank_sha256": "2880851e5114400242ec95df00acf94816abd3b69cadca8835aade26ec9c3d0c", + "control_top1_age_events": 8, + "control_top1_age_ms": 8000, + "event_index": 946, + "modality": "text", + "query_embedding_sha256": "8e067aa94543c820efa31c91cc8cdae0057600ee12c41a3d5fd40292ecdc05a2", + "query_ordinal": 31, + "query_timestamp": 1700000946000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "c3ff1492332c3cd3202a796b636ee06de722ef8f1e5d456cce9655dda40b0ed8", + "control_graph_rank_sha256": "c800d6cfecee04327ab3741ef44cf724d272e3c6c13760a4ef6f1c891b054741", + "control_public_rank_sha256": "9c9f3b067087db92c32654a00d2a7680eb39525eab76ab419fb21ab509a80dc2", + "control_seed_rank_sha256": "c3ff1492332c3cd3202a796b636ee06de722ef8f1e5d456cce9655dda40b0ed8", + "control_top1_age_events": 354, + "control_top1_age_ms": 354000, + "event_index": 977, + "modality": "text", + "query_embedding_sha256": "f7e682e727608fdbce99bef530ce34284ee77cd5ceb807e20f5e270b3d938442", + "query_ordinal": 32, + "query_timestamp": 1700000977000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "6d908ca79f1fd7124e6bc9c813f7d01199921122a5c33278b769e5d5f73d7c10", + "control_graph_rank_sha256": "ad4ddd67b86a5495194091cc458c84ab5c13585285d7ee5a2bae86b7a2e60c10", + "control_public_rank_sha256": "825387910bb94d112f27700aade8b1569b31b35550f414e74d50c4cb3b92c0c6", + "control_seed_rank_sha256": "6d908ca79f1fd7124e6bc9c813f7d01199921122a5c33278b769e5d5f73d7c10", + "control_top1_age_events": 825, + "control_top1_age_ms": 825000, + "event_index": 1009, + "modality": "text", + "query_embedding_sha256": "c4b2811c7ca2959892f1d8ad5f563e84f59669fa1c83bb9eab3a534623f45a93", + "query_ordinal": 33, + "query_timestamp": 1700001009000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "911e2917d8e71f5121f1606b0920242e3cc1f44545ab14ee47eee82dd06640f8", + "control_graph_rank_sha256": "7d425af611b3bab48ac193f51a9c4c06da8c0415b389eb085c9143eefb48a37b", + "control_public_rank_sha256": "68cdc1d6bd15c571244dcf2d672f6755d346985a1692d9f848300c2644acf3ed", + "control_seed_rank_sha256": "911e2917d8e71f5121f1606b0920242e3cc1f44545ab14ee47eee82dd06640f8", + "control_top1_age_events": 690, + "control_top1_age_ms": 690000, + "event_index": 1038, + "modality": "text", + "query_embedding_sha256": "a393c50095b24cc5a5da48c444dfe947ef3ec663d52af755724198fb1c56d9c7", + "query_ordinal": 34, + "query_timestamp": 1700001038000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "d16f37c03dcd25d2dec509cd6e2899bdbc4b7508a8a2e2c6f4250f3d97700d63", + "control_graph_rank_sha256": "263c677676bcecb3d6ff5776d51ef68ee356bf55c00d4c046ba07e2772b818f2", + "control_public_rank_sha256": "6507d043f01103eabd2a81e41a4cf7194d508f54525f670c8e80f36b1632a742", + "control_seed_rank_sha256": "d16f37c03dcd25d2dec509cd6e2899bdbc4b7508a8a2e2c6f4250f3d97700d63", + "control_top1_age_events": 4, + "control_top1_age_ms": 4000, + "event_index": 1069, + "modality": "text", + "query_embedding_sha256": "ebebeada237c777363b916132591bc5c085777df87040217fd878c4fd929a364", + "query_ordinal": 35, + "query_timestamp": 1700001069000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "334b8a0e7eee10d496085cbedcc279620907478c675d96fa9d788cc6ce484ca9", + "control_graph_rank_sha256": "f90dc90e56f18806906c3ca3ea28041d698c0c9a89596869733b04c0238f8d8b", + "control_public_rank_sha256": "d215418de3bd416e4e8b9161ceb58ae5efb4984348e9ca5939a21ed8c363c667", + "control_seed_rank_sha256": "334b8a0e7eee10d496085cbedcc279620907478c675d96fa9d788cc6ce484ca9", + "control_top1_age_events": 205, + "control_top1_age_ms": 205000, + "event_index": 1100, + "modality": "text", + "query_embedding_sha256": "65ac4658ae90282135946b9408618c46274f15732a272e7ff1e1c50e2cd5b8a3", + "query_ordinal": 36, + "query_timestamp": 1700001100000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "42093352e7605ef5f1800cbe6ae3ffa53ce9f701cca911d3c5972791e3e122e7", + "control_graph_rank_sha256": "7d18ea9419294ec89460b35e6f974c5c5c74707860732ac007ddb311d1b65c84", + "control_public_rank_sha256": "4f81884cf2d9dd285d0fe361f1bf878094910dcd9659c3dd6835de1d2602a188", + "control_seed_rank_sha256": "42093352e7605ef5f1800cbe6ae3ffa53ce9f701cca911d3c5972791e3e122e7", + "control_top1_age_events": 17, + "control_top1_age_ms": 17000, + "event_index": 1131, + "modality": "text", + "query_embedding_sha256": "bd07e7dce7822e971aa0b7e3a0b8263a8b63be7094c12004d40316a8f517a422", + "query_ordinal": 37, + "query_timestamp": 1700001131000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "68c9a259a1a75df3cefc4469206fb807d6a5a86191371062f7177bc718b03667", + "control_graph_rank_sha256": "f8dcaea73eb8d5582647441b11d2b35cb9be4b7893d1e2e78062f350ca19305b", + "control_public_rank_sha256": "9191d2c7b670e55eac29833bab8c21b26adfd4ca01fa1b25c48e95646d65fa1e", + "control_seed_rank_sha256": "68c9a259a1a75df3cefc4469206fb807d6a5a86191371062f7177bc718b03667", + "control_top1_age_events": 175, + "control_top1_age_ms": 175000, + "event_index": 1156, + "modality": "text", + "query_embedding_sha256": "27fb48b60cfb36c93b75839b7ad3979b6f4be7a2a01315f4825505fb06c59977", + "query_ordinal": 38, + "query_timestamp": 1700001156000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "92d8239bfcdab4f75c061128ca1aeee6bcc670cc3edfddee4e826dc7498fe905", + "control_graph_rank_sha256": "c55b24b935ace2a7713001a29fc29469f5e5766cb560c2f9606da85aa613b528", + "control_public_rank_sha256": "8e831a59d81fff93dcc19f8e0956ddd3cbd7c1dbb8810979325a3080fa5d0cf4", + "control_seed_rank_sha256": "92d8239bfcdab4f75c061128ca1aeee6bcc670cc3edfddee4e826dc7498fe905", + "control_top1_age_events": 56, + "control_top1_age_ms": 56000, + "event_index": 1192, + "modality": "text", + "query_embedding_sha256": "d8b3c699d01a725b9f7d37cebac49d20b871b7a275768d4fcfb34fc43d5cd05f", + "query_ordinal": 39, + "query_timestamp": 1700001192000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "fa65c177878bfa85cdf093e8aad2b92f6854348cf1f1492de3d8eec380c02352", + "control_graph_rank_sha256": "10ddac19e7aae2e3b437d220de24d153db0d9a7638caae269e5a8f8566272ede", + "control_public_rank_sha256": "9d71306d5f7403e79c34ce56d7d2633b863278ace58a1c938aee6b4e1aa11f39", + "control_seed_rank_sha256": "fa65c177878bfa85cdf093e8aad2b92f6854348cf1f1492de3d8eec380c02352", + "control_top1_age_events": 4, + "control_top1_age_ms": 4000, + "event_index": 1221, + "modality": "text", + "query_embedding_sha256": "afd630d4834ba6baf8ed10b8e85afc49da2d86963b7cdf96c90605740c07c6da", + "query_ordinal": 40, + "query_timestamp": 1700001221000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "7037e14c9b34ee27bc565c8eac5c47e89608369f6bd4fed2292da35611ed26c1", + "control_graph_rank_sha256": "9688bd6ac848b74897348601c05df28f8d712cf2536852a7a24e2c5ac4f4ab3a", + "control_public_rank_sha256": "ea3cc8c69c2abd5ab8d00684733c196794f61d53cbb31ec6af8ab3eaf53204c3", + "control_seed_rank_sha256": "7037e14c9b34ee27bc565c8eac5c47e89608369f6bd4fed2292da35611ed26c1", + "control_top1_age_events": 512, + "control_top1_age_ms": 512000, + "event_index": 1251, + "modality": "text", + "query_embedding_sha256": "408bf9103f895f11c11c7fec638ef4702b18252f1499ff60e75671b34459bb03", + "query_ordinal": 41, + "query_timestamp": 1700001251000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "558ccdb0b9fa551ed8f1121a363311940afa9c0fa8ae77fceb8fc5715cd1aa3d", + "control_graph_rank_sha256": "a5e1144e649148ce6e30a86a9f58fa381ff8cb8434a62592943b80ec3b6180ed", + "control_public_rank_sha256": "d9725d37ec9960f2f864b21f86ce998bb8cc5b8b6c264e2d2e9fc13ce98c000c", + "control_seed_rank_sha256": "558ccdb0b9fa551ed8f1121a363311940afa9c0fa8ae77fceb8fc5715cd1aa3d", + "control_top1_age_events": 117, + "control_top1_age_ms": 117000, + "event_index": 1280, + "modality": "text", + "query_embedding_sha256": "db6d9170f272f9815a6b9bb4f95c2efbf5c09e7f1fd9397f291c9a348a92e509", + "query_ordinal": 42, + "query_timestamp": 1700001280000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "af56b452d1179db9a975dce609cd9b8d09e7c3a184cfb5c6a0071284c77dfe0b", + "control_graph_rank_sha256": "ea1c5fed896dff64f68f3ba4bafeb3def24a2e56182c27fbb1eb203e543133b2", + "control_public_rank_sha256": "220cdf29141f8049699e57f0e4a6c113d48589872310b47fb910a6eafcb4496b", + "control_seed_rank_sha256": "af56b452d1179db9a975dce609cd9b8d09e7c3a184cfb5c6a0071284c77dfe0b", + "control_top1_age_events": 7, + "control_top1_age_ms": 7000, + "event_index": 1312, + "modality": "text", + "query_embedding_sha256": "b204102472d1f3d812f5241778a5943c98ebd91fbabd0e00b3b52f5d241e04eb", + "query_ordinal": 43, + "query_timestamp": 1700001312000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "a567517d41283a35328764a6750c76b6ba888d738c57772a09fb799ef0f7e33e", + "control_graph_rank_sha256": "2c390a94963fedb82a3d918f7fa89169c6028b7893165684bf8a1e46b851c105", + "control_public_rank_sha256": "06d6c9e250dd4d492703d6f5747303211b60132e9017e07af698b866e7d2365f", + "control_seed_rank_sha256": "a567517d41283a35328764a6750c76b6ba888d738c57772a09fb799ef0f7e33e", + "control_top1_age_events": 607, + "control_top1_age_ms": 607000, + "event_index": 1346, + "modality": "text", + "query_embedding_sha256": "f4c19ec39c4d276c071a9d33a02d8816451e6e7106f4d5cad92b356e07a3d1df", + "query_ordinal": 44, + "query_timestamp": 1700001346000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "3a6ca607b3d686973bc43f7bffcb3c89d965cdab4ddf8a58723cb048f74925c0", + "control_graph_rank_sha256": "d825c28845c5b495ad9e34a2ae41cebec00f79c275932ba6629bd7176c49719f", + "control_public_rank_sha256": "1365df852d6282e9bf09dccd6a8713c0681fd19a3ab88c4b9aa2769029e3cd6f", + "control_seed_rank_sha256": "3a6ca607b3d686973bc43f7bffcb3c89d965cdab4ddf8a58723cb048f74925c0", + "control_top1_age_events": 548, + "control_top1_age_ms": 548000, + "event_index": 1376, + "modality": "text", + "query_embedding_sha256": "85be1a82ae9076a80e99fcac295074b7b43e7e8cfed52f4fee5d7831c08a92cf", + "query_ordinal": 45, + "query_timestamp": 1700001376000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "1684b58211db850456e53da4b443e832af3c2cdd9d77815762801b13dd933229", + "control_graph_rank_sha256": "b2436d84187b050bbce76284c54589aff0ad48d3cbd57f99d2c9097db3783def", + "control_public_rank_sha256": "e2401ee268c525a96f4eda9475f1e1f6499e9fe440523ae0761b39e74a4ec87d", + "control_seed_rank_sha256": "1684b58211db850456e53da4b443e832af3c2cdd9d77815762801b13dd933229", + "control_top1_age_events": 8, + "control_top1_age_ms": 8000, + "event_index": 1407, + "modality": "text", + "query_embedding_sha256": "29b62edc3c5d95b289955e72621552860b9c3589eef46f13ac88459db07d2f63", + "query_ordinal": 46, + "query_timestamp": 1700001407000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "0adc2690a1bcb947d6a2914f4a5a47fe98592d0b05c01e9a74713de0290d2584", + "control_graph_rank_sha256": "fe77e2dcde5c54bf7278d4c7fc9f696a97fe585e40fda6545cb86c8d3b831968", + "control_public_rank_sha256": "de77297f5bd080f275c3c43aab7c222fc11f64226b0fca2bbc0028206d726f53", + "control_seed_rank_sha256": "0adc2690a1bcb947d6a2914f4a5a47fe98592d0b05c01e9a74713de0290d2584", + "control_top1_age_events": 13, + "control_top1_age_ms": 13000, + "event_index": 1434, + "modality": "text", + "query_embedding_sha256": "26805100216fe1aaabf38e3a80c0623d48e71ad9d97a2cdb82a1b7d76298c0d5", + "query_ordinal": 47, + "query_timestamp": 1700001434000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "d86ccd29fd50f574413326004fe3a1237aba06be07a61bef64bdc4f26cc5ffb9", + "control_graph_rank_sha256": "57afd64dc6f7a8c29d119365dc09f525ba191b9495364adde1678c553a554ad1", + "control_public_rank_sha256": "c473295b32332a793026e7872c3e0a47c28155a97c42d06bdfa94ab09375d4d0", + "control_seed_rank_sha256": "d86ccd29fd50f574413326004fe3a1237aba06be07a61bef64bdc4f26cc5ffb9", + "control_top1_age_events": 5, + "control_top1_age_ms": 5000, + "event_index": 1466, + "modality": "text", + "query_embedding_sha256": "9be981e0263406eee243c78c2655277af838770969afca791a64ac12e2fa5360", + "query_ordinal": 48, + "query_timestamp": 1700001466000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "6adf5858afa949e5babb2d741188da22e380ed917f09511fde6577a39c73e771", + "control_graph_rank_sha256": "4463be62abbf2cc824f57abf33306c800915fd4ca482a32aa37b5a8e417ba508", + "control_public_rank_sha256": "48b41267fe80442790a3e053acde3a7792024a9293f8e80d96ec623aed401272", + "control_seed_rank_sha256": "6adf5858afa949e5babb2d741188da22e380ed917f09511fde6577a39c73e771", + "control_top1_age_events": 21, + "control_top1_age_ms": 21000, + "event_index": 1495, + "modality": "text", + "query_embedding_sha256": "93d8fee3d437884cacb944d707b61affef048e433541b0ba95bd4c1f2db62f1a", + "query_ordinal": 49, + "query_timestamp": 1700001495000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "c80c3e18fa74c148b7faafc4faf6d943f1ae8ba252c6f3c5c21b9f2a5b204989", + "control_graph_rank_sha256": "54e1bb2b8f319e27e51c7f731e75eade350a002751e273a1b355c35c8b8f7425", + "control_public_rank_sha256": "ad809e0d87a44da6d55ff8caacd1bd63c264643b94d482ba2d3a48cc3c515823", + "control_seed_rank_sha256": "c80c3e18fa74c148b7faafc4faf6d943f1ae8ba252c6f3c5c21b9f2a5b204989", + "control_top1_age_events": 826, + "control_top1_age_ms": 826000, + "event_index": 1525, + "modality": "text", + "query_embedding_sha256": "2e95e7720077e8b83804d6dd56f8b54bdf72998ef0fdfd9360b70cc1d5fccb4c", + "query_ordinal": 50, + "query_timestamp": 1700001525000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "4fadb026a1838ba1843b9a82361ac4e3c47100edbf903adda786defec6d94134", + "control_graph_rank_sha256": "8cce2bcdfb23339a54d37158ab5076bfdfd7a09591b2d8aefe15af31ee7c3e91", + "control_public_rank_sha256": "64a70209eec8a6667285c687cc0d5dd03b45ec6926b78f2064026edb0679a90d", + "control_seed_rank_sha256": "4fadb026a1838ba1843b9a82361ac4e3c47100edbf903adda786defec6d94134", + "control_top1_age_events": 1237, + "control_top1_age_ms": 1237000, + "event_index": 1554, + "modality": "text", + "query_embedding_sha256": "0f86b82f05d492ee18ee48fc1b1fc49c2972a29054dd8143787750cd8e7fd183", + "query_ordinal": 51, + "query_timestamp": 1700001554000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "91ebd19f9cfbd26277432d9579336558913fd48df5cbaf5634089d939f3b1ef9", + "control_graph_rank_sha256": "48be14ac8dfaf385e9851205a0947e1585f872c0fe09b832f878f0ae00d59c18", + "control_public_rank_sha256": "0bd147141eb2ab84df10b68d4a6de52b86180fd3d2bfc0adce0042c4c297c805", + "control_seed_rank_sha256": "91ebd19f9cfbd26277432d9579336558913fd48df5cbaf5634089d939f3b1ef9", + "control_top1_age_events": 900, + "control_top1_age_ms": 900000, + "event_index": 1580, + "modality": "text", + "query_embedding_sha256": "c2e9639e297f43df0672b51b563632b1d958a13fd0e84e88821e0e05e0476349", + "query_ordinal": 52, + "query_timestamp": 1700001580000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "12e13d3646fdbd5cdda858045b2721a1428a57259eac5fab5a68fdc13e7ef50c", + "control_graph_rank_sha256": "ccec025e4f90260eb0f032d5516b44f2b08f3108c1c597fd1cad42ec51312e92", + "control_public_rank_sha256": "b725818b3870ed9e4f79da5f0de4cdbec53018c3b191550fcee67e4b8b8d70e0", + "control_seed_rank_sha256": "12e13d3646fdbd5cdda858045b2721a1428a57259eac5fab5a68fdc13e7ef50c", + "control_top1_age_events": 452, + "control_top1_age_ms": 452000, + "event_index": 1615, + "modality": "text", + "query_embedding_sha256": "41cc2d291c6b901f03b76631c3a027db9be7da0ced85d352521a88388437645f", + "query_ordinal": 53, + "query_timestamp": 1700001615000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "4d28ce64b511a53ed53565ec6e4c2a7315ce1bbb337eab94d530178025e60b1f", + "control_graph_rank_sha256": "61d7727111c9b7257b31577ddf982cccd95e7a25c5eaa0b400ff419962b528f0", + "control_public_rank_sha256": "565dbd9b77c00cfa05bd13ea5142be37ea8866ff932191a00fd558ac23582165", + "control_seed_rank_sha256": "4d28ce64b511a53ed53565ec6e4c2a7315ce1bbb337eab94d530178025e60b1f", + "control_top1_age_events": 14, + "control_top1_age_ms": 14000, + "event_index": 1643, + "modality": "text", + "query_embedding_sha256": "bc42ef11d5cf69359f9d24f4598f1ffe98cd7122bde6efdf3e9ff4f6aee111e3", + "query_ordinal": 54, + "query_timestamp": 1700001643000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "84537cab22b3b9ca20f4338afc895ec9618aca72d8694d1e294891d809f080f4", + "control_graph_rank_sha256": "3aaf17e80bd01af62ed1555be6aeb5a60c20f757f9af3d56cfb68ba50551b9c3", + "control_public_rank_sha256": "bad9c81b9e97eb03aa796eea264d98a37ca3a3edacc10942c0c00aea88c696da", + "control_seed_rank_sha256": "84537cab22b3b9ca20f4338afc895ec9618aca72d8694d1e294891d809f080f4", + "control_top1_age_events": 353, + "control_top1_age_ms": 353000, + "event_index": 1674, + "modality": "text", + "query_embedding_sha256": "ae7b9f4a8a2518e21d2d5a3c1cb33fb8ba75114e57d117b184537bc04181af3b", + "query_ordinal": 55, + "query_timestamp": 1700001674000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "ce1bb8faa7bf62af6e2ee0f07b22befcf166e0dbc61ae50b4623c0a7f8441fd6", + "control_graph_rank_sha256": "5b5c2022245a6561d604c2ccb93196ace8853d107adbb929e74cd39fad382ce3", + "control_public_rank_sha256": "e4f4d5ab978c16acc8060ec85c464f28b8f3b122b28aaee71201c6ce43722add", + "control_seed_rank_sha256": "ce1bb8faa7bf62af6e2ee0f07b22befcf166e0dbc61ae50b4623c0a7f8441fd6", + "control_top1_age_events": 195, + "control_top1_age_ms": 195000, + "event_index": 1700, + "modality": "text", + "query_embedding_sha256": "339f74f83aa27f7d551dd1eb1ae4eacbcdc19851a0b3e0422bfd3c6f82d91902", + "query_ordinal": 56, + "query_timestamp": 1700001700000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "b210efc4ba1d039212f38f25fbb47d15cf2d69f64341a5f599877b4b2da676ba", + "control_graph_rank_sha256": "cfb0c535e41d236251d2d84760a21a46bf7b8833ae1e4afb5bbb06bdfecfcaea", + "control_public_rank_sha256": "de22d5411769b645960e7caeed4859624dcf97e4c16a557d05d19a6d693e9972", + "control_seed_rank_sha256": "b210efc4ba1d039212f38f25fbb47d15cf2d69f64341a5f599877b4b2da676ba", + "control_top1_age_events": 10, + "control_top1_age_ms": 10000, + "event_index": 1730, + "modality": "text", + "query_embedding_sha256": "9508f1e068aa3819792963592a3f03449eb3c3b117579c676b59c61ed9c01f82", + "query_ordinal": 57, + "query_timestamp": 1700001730000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "9a829e2377db373a192baa36f780eec20e671cf34ed7982d5b14978cefad720f", + "control_graph_rank_sha256": "eddc03db798af9ea2063bfeb752a49e21fb9e8934464ab8b80ecb48f1a662c9a", + "control_public_rank_sha256": "40cd19b73ff5c32ff87c114f0c080ee7afcf3cc5e4e80e1864136a915db8a421", + "control_seed_rank_sha256": "9a829e2377db373a192baa36f780eec20e671cf34ed7982d5b14978cefad720f", + "control_top1_age_events": 948, + "control_top1_age_ms": 948000, + "event_index": 1760, + "modality": "text", + "query_embedding_sha256": "6c4832218b2fc8c02ba4fae7649d830076410ebdfd652bb88c11293a8b27d12c", + "query_ordinal": 58, + "query_timestamp": 1700001760000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "95d530d4fb86703d4620a654c03395a0e85c3f19277d14a8aada7aa2100da18f", + "control_graph_rank_sha256": "35affc1ddc444c097871e42a0249dd473b7ec158c2898bec0a3c155ec1f26d88", + "control_public_rank_sha256": "7e57375fcf414813875d91f041667807e3a8eb256b4067193da0d7742276e120", + "control_seed_rank_sha256": "95d530d4fb86703d4620a654c03395a0e85c3f19277d14a8aada7aa2100da18f", + "control_top1_age_events": 254, + "control_top1_age_ms": 254000, + "event_index": 1789, + "modality": "text", + "query_embedding_sha256": "58f444c858ccf69585d80473e14802838d175b3a5a92e25fa4eecd3faaefbbe9", + "query_ordinal": 59, + "query_timestamp": 1700001789000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "d53eeaaae4a6561036d1240150fc23e4ec39a6820a8e168fbf0658481f5480b6", + "control_graph_rank_sha256": "2b92cbfd56a1ebceb39e9a9bdd5bf4522faf91631cfb6ad919ff06f9ecf109e6", + "control_public_rank_sha256": "9a107e92eb17bf42c4f7216f8763c7b15e1b2c32b320efab2331ff846458ace4", + "control_seed_rank_sha256": "d53eeaaae4a6561036d1240150fc23e4ec39a6820a8e168fbf0658481f5480b6", + "control_top1_age_events": 753, + "control_top1_age_ms": 753000, + "event_index": 1822, + "modality": "text", + "query_embedding_sha256": "2eb893f0db486117a251c2ea0f8fb1cb9fc319d74693b08a64fe7331dbc22fb3", + "query_ordinal": 60, + "query_timestamp": 1700001822000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "35a0e353cf517a0aa1224205fd5eebb27b9e31e430a4ef41f5deb171d5d4d3d6", + "control_graph_rank_sha256": "5ca85f15a0cab9afd23c65d9839bbe9ce3580c8b84808797728e735bb495742f", + "control_public_rank_sha256": "fd51086bcff727ae74c7de49f3f7b4ca5b606f0e6e495131a585e28453c8f873", + "control_seed_rank_sha256": "35a0e353cf517a0aa1224205fd5eebb27b9e31e430a4ef41f5deb171d5d4d3d6", + "control_top1_age_events": 27, + "control_top1_age_ms": 27000, + "event_index": 1849, + "modality": "text", + "query_embedding_sha256": "5f134ac3667381583ee1625dcdb5d448e0747491a5d3aa75faa40ca137af1671", + "query_ordinal": 61, + "query_timestamp": 1700001849000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "8e08edb613aa022d205594305c22fbc0b8da1ade265b22fc84b73866dd7af387", + "control_graph_rank_sha256": "07f473f19d63cb293d04024bccf07e1cb855a0e53b5627e29a557ebbfa5ad1fe", + "control_public_rank_sha256": "a7aefa958b96d7fd7107897e6bba438fdd034bc1e3eacd1aafe72b5e3c0cb6d9", + "control_seed_rank_sha256": "8e08edb613aa022d205594305c22fbc0b8da1ade265b22fc84b73866dd7af387", + "control_top1_age_events": 439, + "control_top1_age_ms": 439000, + "event_index": 1882, + "modality": "text", + "query_embedding_sha256": "d118a36d9056efc1ddc7f696b964b1a05a744b8fa9ece4ea2b0dd17078546304", + "query_ordinal": 62, + "query_timestamp": 1700001882000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "bcfaebc5c4ed08dcea8b938154590c3650388f74375737db012ad92063182f4f", + "control_graph_rank_sha256": "95b627cbae04f0af18e0b5744875a82600cd63a3a9ebee33ddf1429a88ad1fb1", + "control_public_rank_sha256": "35ee69f2ee8b4aa60b9fb385e7f0e9f8046336b217d211299b083cf1c589dbc4", + "control_seed_rank_sha256": "bcfaebc5c4ed08dcea8b938154590c3650388f74375737db012ad92063182f4f", + "control_top1_age_events": 6, + "control_top1_age_ms": 6000, + "event_index": 1913, + "modality": "text", + "query_embedding_sha256": "07e4d1e91207b8ff6dbb7bb11b832b3ef7cf31a2121262cdda8d296191b0e38e", + "query_ordinal": 63, + "query_timestamp": 1700001913000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "6adfbac6cc4795bc3ca29369ea050e4f6e55846315ae7135851ae2690931722e", + "control_graph_rank_sha256": "832754b99eb264450c3f1ab3757a7187c23349446c638702745fd75518c68e45", + "control_public_rank_sha256": "94061aaaf72970cf473d27fa28b3685260365be578cefb730f08304d519ccaef", + "control_seed_rank_sha256": "6adfbac6cc4795bc3ca29369ea050e4f6e55846315ae7135851ae2690931722e", + "control_top1_age_events": 474, + "control_top1_age_ms": 474000, + "event_index": 1940, + "modality": "text", + "query_embedding_sha256": "856691c334cc6f1150da7b7b190a5a6183ce86f22386b5e1c0804d88a34dd599", + "query_ordinal": 64, + "query_timestamp": 1700001940000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "f9ed6ca6f620e1383bbfa60c950d0e2743f9d0c8c1f13fecfb90c257c3922bf9", + "control_graph_rank_sha256": "9f3b1c34791bc99e4b09646dd9645411980f9f95a27532fdf1f9b55121f1b7e5", + "control_public_rank_sha256": "0c8b9dbc6042e2e59de1e3c496685445562d0c2683fe98869917bb7144efac5f", + "control_seed_rank_sha256": "f9ed6ca6f620e1383bbfa60c950d0e2743f9d0c8c1f13fecfb90c257c3922bf9", + "control_top1_age_events": 960, + "control_top1_age_ms": 960000, + "event_index": 1976, + "modality": "text", + "query_embedding_sha256": "97c56a58e552c9970af9683df5f24b447988450fbce37bd34cf18b7ca7f1f797", + "query_ordinal": 65, + "query_timestamp": 1700001976000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "9d6352afa6cce10e7954f0a9e7127464354b552a2ff31185c674578d046f872d", + "control_graph_rank_sha256": "540b2bf612b784453a2cc1c58103b08c8b92859fb5e07048dd55b9bcea14bbde", + "control_public_rank_sha256": "1e91c183092f7a1428a2bb3eaa77917918064e1dc9478b055ab8859ca65f008f", + "control_seed_rank_sha256": "9d6352afa6cce10e7954f0a9e7127464354b552a2ff31185c674578d046f872d", + "control_top1_age_events": 984, + "control_top1_age_ms": 984000, + "event_index": 2000, + "modality": "text", + "query_embedding_sha256": "9d02c4f3cb662405e3ad9de0df1eb74f7eaa9bb279f100b5407e6aa3f4353132", + "query_ordinal": 66, + "query_timestamp": 1700002000000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "39835f153868ba8bc12a11e77002caba5eb94af1fd54cad46dcb98d93123c122", + "control_graph_rank_sha256": "c8b603af3902a75c51d8b555f71d3e95285e9d1640a9b502e11f354bc06514cb", + "control_public_rank_sha256": "c501a769a3d79f2c36fa6e7523f4d15dac920793c7bcaed011d0bc04c5f3b46a", + "control_seed_rank_sha256": "39835f153868ba8bc12a11e77002caba5eb94af1fd54cad46dcb98d93123c122", + "control_top1_age_events": 34, + "control_top1_age_ms": 34000, + "event_index": 2031, + "modality": "text", + "query_embedding_sha256": "ae1c13ef0c93aa25d5c6490b5c32ec3b7c55b52fabe2a8218d503c370baf9d74", + "query_ordinal": 67, + "query_timestamp": 1700002031000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "abead9a97c586251338eb6f23a93d53e2e1a361f1e7da5828125b1dd7f7b0cff", + "control_graph_rank_sha256": "828e31666bab6cf3a999b58a50cdbda0ae8babf9e31fb9e927f02ef53e52a8c7", + "control_public_rank_sha256": "dad332d7a350203f1a7aece5ef4f714ee8b4ca35b4c144175a927d30cc1a04c4", + "control_seed_rank_sha256": "abead9a97c586251338eb6f23a93d53e2e1a361f1e7da5828125b1dd7f7b0cff", + "control_top1_age_events": 955, + "control_top1_age_ms": 955000, + "event_index": 2061, + "modality": "text", + "query_embedding_sha256": "d8d35cafa233f17ca21e8b86e616406ee3d1d591354aee346810bd21f354a9dc", + "query_ordinal": 68, + "query_timestamp": 1700002061000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "08d93606928e41ecb3a8527540c3f5d8ada12009fc04ceffab19fdd534821c40", + "control_graph_rank_sha256": "12b22ef4dad2f3d04c6517f302729671e45ee264be9c269a99e918e52cb574fb", + "control_public_rank_sha256": "e7cbca17b9edeb925602a6e3993fafe0dc5d435a8c6358727af6af52ef7c8d5c", + "control_seed_rank_sha256": "08d93606928e41ecb3a8527540c3f5d8ada12009fc04ceffab19fdd534821c40", + "control_top1_age_events": 791, + "control_top1_age_ms": 791000, + "event_index": 2091, + "modality": "text", + "query_embedding_sha256": "d9727ca797b36b4d603bfadb625688877996780d58c78b108e4782a3deec15a3", + "query_ordinal": 69, + "query_timestamp": 1700002091000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "9ebda8b9eacf5e3cde80302ffa066f7b90383982f21fc4dee58b997262d967eb", + "control_graph_rank_sha256": "07145fc8801e227c67879a3d68bf7045b8f0fce752efbf6f591efeae92a51b42", + "control_public_rank_sha256": "436512b529fca368839ce82ea73e0ed26c04cfbc76b640ad5b309fb25c31fc67", + "control_seed_rank_sha256": "9ebda8b9eacf5e3cde80302ffa066f7b90383982f21fc4dee58b997262d967eb", + "control_top1_age_events": 4, + "control_top1_age_ms": 4000, + "event_index": 2123, + "modality": "text", + "query_embedding_sha256": "88f76c637401dd497af2c5f8adc4766df7396eeb9bb0f954263546cd19dcdaca", + "query_ordinal": 70, + "query_timestamp": 1700002123000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "317874c7af84ffdf38df77b6927246f9bc1a75a8940d7d2b36d0fc5f83dd0470", + "control_graph_rank_sha256": "0718ad741df506163140be882e57a980f5fc4f157fc05318461e07e6a92ff245", + "control_public_rank_sha256": "9756f2e80b11e800efe91ab35ea3efb985fb19b4298aef1c6cc526085f03405f", + "control_seed_rank_sha256": "317874c7af84ffdf38df77b6927246f9bc1a75a8940d7d2b36d0fc5f83dd0470", + "control_top1_age_events": 46, + "control_top1_age_ms": 46000, + "event_index": 2151, + "modality": "text", + "query_embedding_sha256": "89506f44bf172d1240457413c169e2ce261bfcfaa00b3d0411dc689cac2ae273", + "query_ordinal": 71, + "query_timestamp": 1700002151000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "4ae85a64ed30c2fabf93bb6c2cd608679e68fc92db0a802b599113795fb829e1", + "control_graph_rank_sha256": "37e1d2957a00018d912b4bf3da0cce09e8826144e10160c80169e2194eadee3a", + "control_public_rank_sha256": "1326532f1cd0548f888f0fa168cf9243a5437e9469a95617ee3cec27c7b3e2fb", + "control_seed_rank_sha256": "4ae85a64ed30c2fabf93bb6c2cd608679e68fc92db0a802b599113795fb829e1", + "control_top1_age_events": 419, + "control_top1_age_ms": 419000, + "event_index": 2179, + "modality": "text", + "query_embedding_sha256": "db033f19a4b4bf04fedec6825700f79b9ec1c522ded2e7c4ee739dc421ca5f93", + "query_ordinal": 72, + "query_timestamp": 1700002179000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "878c29201b1bd1ad7333954fcd16ef1311f355b7a2a033d6482229c415d66109", + "control_graph_rank_sha256": "6afe458d3728d03a814ff9e50a1d33bf91fe8657d676ea2338197f5c64a09be4", + "control_public_rank_sha256": "796ded94cc6ffa10f885aefd3fd0c65fa802b0391e64092e51c9fbea25bd62d1", + "control_seed_rank_sha256": "878c29201b1bd1ad7333954fcd16ef1311f355b7a2a033d6482229c415d66109", + "control_top1_age_events": 241, + "control_top1_age_ms": 241000, + "event_index": 2206, + "modality": "text", + "query_embedding_sha256": "81571732101b53400cc443b23c2c8522c10a1f02b62a6edb5834b8dacaa7e0ce", + "query_ordinal": 73, + "query_timestamp": 1700002206000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "b72bba1824fb9599a8f835266f5da298c8402ab828f906d36284289d0018d947", + "control_graph_rank_sha256": "9b235a5961600878e85fd01bd7b77c470383c104489afb09c281f3c042669d2f", + "control_public_rank_sha256": "bb2aa8b6df3df9f20fc19fd140f248caea0868618253b428948bd83de7571f10", + "control_seed_rank_sha256": "b72bba1824fb9599a8f835266f5da298c8402ab828f906d36284289d0018d947", + "control_top1_age_events": 118, + "control_top1_age_ms": 118000, + "event_index": 2237, + "modality": "text", + "query_embedding_sha256": "d7ab4a26b0257f7cc4555e9ca0704be3637b24ebf3c6dceb3ef91f3ece5b348b", + "query_ordinal": 74, + "query_timestamp": 1700002237000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "6f96bfb5d944083789813e6b817df9a85b71496781f2558e84857f0136eb0be8", + "control_graph_rank_sha256": "0b143849543403b2161d96304cdecc18ba07081aaaea1d0b4c48def095da6bbc", + "control_public_rank_sha256": "7e6a2fa8d797feb557b25b5e3f7416d7e5de91c9689f91e61f3cf89148668479", + "control_seed_rank_sha256": "6f96bfb5d944083789813e6b817df9a85b71496781f2558e84857f0136eb0be8", + "control_top1_age_events": 138, + "control_top1_age_ms": 138000, + "event_index": 2266, + "modality": "text", + "query_embedding_sha256": "2b44aea53feaceb6f9f18f94db34ff200b70dc6f0a2a1e9e9ecdca42e1259bea", + "query_ordinal": 75, + "query_timestamp": 1700002266000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "cc1a3c73cd6f71495edf70a584ce54cfd314f15b4d570fa75af55c9e4a3a0d53", + "control_graph_rank_sha256": "5f26d9b5e83f0cf7f87120b875427e62ade2b4092f73d0fd982810c4253d78b7", + "control_public_rank_sha256": "c99fc788057762d5d632038181344d5149b7d85ee38479c667630592c696c055", + "control_seed_rank_sha256": "cc1a3c73cd6f71495edf70a584ce54cfd314f15b4d570fa75af55c9e4a3a0d53", + "control_top1_age_events": 181, + "control_top1_age_ms": 181000, + "event_index": 2300, + "modality": "text", + "query_embedding_sha256": "dd2b57310f272abb4f538e859e21af0997781beb47025cf76ff6ebe1da3c5ff4", + "query_ordinal": 76, + "query_timestamp": 1700002300000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "1b6f4852e87ab8e55d03c29ed32cf8841b2849b7e57f142c2498f020a05f9dce", + "control_graph_rank_sha256": "05e057781be7c379119598362739b5337f1bf5276f97f74aa0afbe8cb0f4e4d3", + "control_public_rank_sha256": "6ad206ab4382dd9067bfc8bce0744d5f01c8e9bff737a5b5f766e80e66c94d9e", + "control_seed_rank_sha256": "1b6f4852e87ab8e55d03c29ed32cf8841b2849b7e57f142c2498f020a05f9dce", + "control_top1_age_events": 4, + "control_top1_age_ms": 4000, + "event_index": 2332, + "modality": "text", + "query_embedding_sha256": "93c715c0e5b5ca6db140a8092e0768872c3a3d4e4a4815b6b417c94ca003c294", + "query_ordinal": 77, + "query_timestamp": 1700002332000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "a254d8ca931ac2d962d3b5e10f33909ab1ec480b1a7f8613e21c042babde631e", + "control_graph_rank_sha256": "4711a29ce25b73c72bac8912192762aac4498092a0c7de7d836f0c88984913a1", + "control_public_rank_sha256": "fbfdfee5ea4587dd72616f2acd22844dad41a4f4e16afd7305ce2a0318db4012", + "control_seed_rank_sha256": "a254d8ca931ac2d962d3b5e10f33909ab1ec480b1a7f8613e21c042babde631e", + "control_top1_age_events": 224, + "control_top1_age_ms": 224000, + "event_index": 2361, + "modality": "text", + "query_embedding_sha256": "cc303b8cc02c937c5f2ea4c0785fb116f3e9405d7a1a94c38026c57fe04a7658", + "query_ordinal": 78, + "query_timestamp": 1700002361000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "d29f11275e838e8899873ecfbbaf6a75736efdbfa7339f4f258168c273b9b95b", + "control_graph_rank_sha256": "01b46dedcce33f5a0679865517fe9f0b3d7281403d655f811d5416f68f418e54", + "control_public_rank_sha256": "18f827ab2e9003581bdd0002a6acd6ae77a5ca8338f4ddcd163883649844a69e", + "control_seed_rank_sha256": "d29f11275e838e8899873ecfbbaf6a75736efdbfa7339f4f258168c273b9b95b", + "control_top1_age_events": 2037, + "control_top1_age_ms": 2037000, + "event_index": 2392, + "modality": "text", + "query_embedding_sha256": "a993677b6bc6dbbd9e8a20e86cfc866e4b940f7d584dde94df96126a93702923", + "query_ordinal": 79, + "query_timestamp": 1700002392000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "9df7d800ebc7c65f28ad78cdb934a08c31b09d3569dfb9895f5eb7dfc91353f5", + "control_graph_rank_sha256": "71312ae39284dd75c8b7892e1aeea8f7757783d2a1a11b53603acd813599fe92", + "control_public_rank_sha256": "8743f829f04be81113c2bcfc0a6a2eb5d6aeb483f966723e6894c6bdfd39bd77", + "control_seed_rank_sha256": "9df7d800ebc7c65f28ad78cdb934a08c31b09d3569dfb9895f5eb7dfc91353f5", + "control_top1_age_events": 118, + "control_top1_age_ms": 118000, + "event_index": 2419, + "modality": "text", + "query_embedding_sha256": "e849e1df215bcc704ba8336f81eabe7e2718991d9904c4a0bb67ddf2fd825778", + "query_ordinal": 80, + "query_timestamp": 1700002419000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "2dcf2d151b1d233431681c4346e3888e98c4ca33baa1b440af653f102a6124c3", + "control_graph_rank_sha256": "2c5615ab410c9a6ae914cd0c5113dd471501f079fb1b4df3f95c28a7b0f945a2", + "control_public_rank_sha256": "70f7ff5fcd8c9eee1a19cdcd63f81e6d7dfa636b12456df32dc5e2bfaf6f31be", + "control_seed_rank_sha256": "2dcf2d151b1d233431681c4346e3888e98c4ca33baa1b440af653f102a6124c3", + "control_top1_age_events": 455, + "control_top1_age_ms": 455000, + "event_index": 2447, + "modality": "text", + "query_embedding_sha256": "c2e9639e297f43df0672b51b563632b1d958a13fd0e84e88821e0e05e0476349", + "query_ordinal": 81, + "query_timestamp": 1700002447000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "97e76aefb4909c6ddb985ae2700ade1ef152d0a7643593b8b895cff2cbde71f3", + "control_graph_rank_sha256": "f6f2b0aa4f2c841f3d2297288caea73fd3677a88b673580610076c8e1c829ca5", + "control_public_rank_sha256": "63fc560f354c432cb9c2dce891810ed54c9f1ac96226955b15dbc28f631d3056", + "control_seed_rank_sha256": "97e76aefb4909c6ddb985ae2700ade1ef152d0a7643593b8b895cff2cbde71f3", + "control_top1_age_events": 1991, + "control_top1_age_ms": 1991000, + "event_index": 2482, + "modality": "text", + "query_embedding_sha256": "c44f321dea0325fbd2e2e6d7386211cb2096a6fdcebc9949190566fcaec88b87", + "query_ordinal": 82, + "query_timestamp": 1700002482000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "aa2dbbbfa96a63c0061ec6217e3230f244103d79c3423d829bc81a8f2c65ee97", + "control_graph_rank_sha256": "7c21141d5a0ea21ed6b5186843d70b4bb9212f669b21c83da03536879b99ba5b", + "control_public_rank_sha256": "cf255c94c47b99b27869e0286fa373a999b191086d1a08b31c9af01bd4671701", + "control_seed_rank_sha256": "aa2dbbbfa96a63c0061ec6217e3230f244103d79c3423d829bc81a8f2c65ee97", + "control_top1_age_events": 4, + "control_top1_age_ms": 4000, + "event_index": 2511, + "modality": "text", + "query_embedding_sha256": "ebc9ca06b4c3e86f9b93c11157254b1c870ac231fcdee9bf3f86cf2e9e009d92", + "query_ordinal": 83, + "query_timestamp": 1700002511000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "99b2e61a9c33493c8d74281daa028d46cd3dde8e8d9b2a004b68190a3ce44635", + "control_graph_rank_sha256": "0b7c0edc48c9602c29c9d8e240c2870242a80ce333b855eb1cf88385bc07e156", + "control_public_rank_sha256": "507c21eb90953034242c548475c5471900d4968416ad48b413ab9baf996c302f", + "control_seed_rank_sha256": "99b2e61a9c33493c8d74281daa028d46cd3dde8e8d9b2a004b68190a3ce44635", + "control_top1_age_events": 2187, + "control_top1_age_ms": 2187000, + "event_index": 2542, + "modality": "text", + "query_embedding_sha256": "6a587db33574458aab2f04e87020b41312bc4153b49f8b1ef92a684e29578af9", + "query_ordinal": 84, + "query_timestamp": 1700002542000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "6ccf7c22955f9d575c3ee9f180929be4fd3d4c0d63c5e0793b3a4c0246ba4471", + "control_graph_rank_sha256": "15b59c7c64d3d5fe1523ff3580261e7af789d596a3ecca3e40a798b8836fa49f", + "control_public_rank_sha256": "e6ad38118062232798e048e07636a45ecb913cbc4b18a6de0bca2ac2c5922aa0", + "control_seed_rank_sha256": "6ccf7c22955f9d575c3ee9f180929be4fd3d4c0d63c5e0793b3a4c0246ba4471", + "control_top1_age_events": 1835, + "control_top1_age_ms": 1835000, + "event_index": 2571, + "modality": "text", + "query_embedding_sha256": "5083817553b3c2c92ee361dd21742352b131b6226cda63418eb23298be9ff08a", + "query_ordinal": 85, + "query_timestamp": 1700002571000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "ce50da7a0a549f7057c90e707fa8e42996e8953a9af4bc8d679ba620209847d3", + "control_graph_rank_sha256": "fe6e456454b7711518d37779d3923319dbea72ebc684a2bdcb0b9b765a513dc0", + "control_public_rank_sha256": "21c9c83ac696ad55887434bc957333a4dda5eabfb00df216c3b49747acd04d9f", + "control_seed_rank_sha256": "ce50da7a0a549f7057c90e707fa8e42996e8953a9af4bc8d679ba620209847d3", + "control_top1_age_events": 2437, + "control_top1_age_ms": 2437000, + "event_index": 2608, + "modality": "text", + "query_embedding_sha256": "6689b9d7481b3dec4fefda3108f728dfcd0218cd3ca367d2e56f03aa59b2e537", + "query_ordinal": 86, + "query_timestamp": 1700002608000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "ea3b5e38bb65650134770caf6054d095cf7991a67e582eb19ead7ced01d65557", + "control_graph_rank_sha256": "62c3b3df249c79b463eea3b0f3e66dc54b252b64699a2e80cadcf8819dfe333f", + "control_public_rank_sha256": "2d84566959c6b315805ac79a6253d813044a78c55be45daba753d5589807f3aa", + "control_seed_rank_sha256": "ea3b5e38bb65650134770caf6054d095cf7991a67e582eb19ead7ced01d65557", + "control_top1_age_events": 2080, + "control_top1_age_ms": 2080000, + "event_index": 2639, + "modality": "text", + "query_embedding_sha256": "21bdcf604b5dd31219642a34e1399be4dd19401629b8ce18528cb3f34661a38a", + "query_ordinal": 87, + "query_timestamp": 1700002639000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "5a3d0ee8c118b2540ff3cf203e99174e0a2f3bd23d4051b3c7d225ea7d6aaff0", + "control_graph_rank_sha256": "f249a75b7312118443f33c9280498c104d5f163bc2c7870c54e4af754e1835f8", + "control_public_rank_sha256": "a69e83889d1a1c80c7b5aef23a75ce6dab499003d2d5d78128234a9d87cd442a", + "control_seed_rank_sha256": "5a3d0ee8c118b2540ff3cf203e99174e0a2f3bd23d4051b3c7d225ea7d6aaff0", + "control_top1_age_events": 511, + "control_top1_age_ms": 511000, + "event_index": 2673, + "modality": "text", + "query_embedding_sha256": "8d4a51447192fa80fb5eb44f3ab8822b3f913cf035ea615c17f4aafd21464067", + "query_ordinal": 88, + "query_timestamp": 1700002673000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "6feeb46d2fdaa062d44fddc75d52e182f8953dc5cbcb08f8975ab292f8d9c5d6", + "control_graph_rank_sha256": "9c968bd01b0e237df3af269a45ab7a4da340b16c19b73ee339042b2097ea49fe", + "control_public_rank_sha256": "967a7babb4769eec081c8da56fb38cf6dcb0866c58639e15f78dc91be17bb00a", + "control_seed_rank_sha256": "6feeb46d2fdaa062d44fddc75d52e182f8953dc5cbcb08f8975ab292f8d9c5d6", + "control_top1_age_events": 92, + "control_top1_age_ms": 92000, + "event_index": 2705, + "modality": "text", + "query_embedding_sha256": "b1cac1bbc2b40f3f2523d6c9b9a098f7a1b6671ded9af8a673eb4104a9c2666f", + "query_ordinal": 89, + "query_timestamp": 1700002705000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "0bada88cfa9b119f6793be1bec977a2e0aeae827eb46ef49879b4e3a0bc2d810", + "control_graph_rank_sha256": "faa823c04f502ac7ba54c1f23211440e0216faf31df9078d87307c1fd5db0612", + "control_public_rank_sha256": "066e7b0ca7d955c246c128f0a99434775999f00a44e3570d96a57081ce56c4b0", + "control_seed_rank_sha256": "0bada88cfa9b119f6793be1bec977a2e0aeae827eb46ef49879b4e3a0bc2d810", + "control_top1_age_events": 1924, + "control_top1_age_ms": 1924000, + "event_index": 2736, + "modality": "text", + "query_embedding_sha256": "0370fc59ac58c2ab79d9360634d09fff6d051acf03fa330eda3df446a3d9717a", + "query_ordinal": 90, + "query_timestamp": 1700002736000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "1646743cdb04c146ddf0f05d81896acbb64179f41ff232259044f0c23ca43795", + "control_graph_rank_sha256": "6e72c3926732c0ec4c244b414756c155bf2754ba3b06b60ba5a022b38ead63e7", + "control_public_rank_sha256": "21df13d8a1c8c0b2a1034b7aca7a0c2a121fcd2c5d75e06a71edb18ac4c8e86a", + "control_seed_rank_sha256": "1646743cdb04c146ddf0f05d81896acbb64179f41ff232259044f0c23ca43795", + "control_top1_age_events": 1212, + "control_top1_age_ms": 1212000, + "event_index": 2766, + "modality": "text", + "query_embedding_sha256": "bf16a8f10073dd3ebf43eb4ddf6f824aa1c85ada6ea547135180001e1731d150", + "query_ordinal": 91, + "query_timestamp": 1700002766000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "c8a0bd8dddc7a6453c59be32858a6f0d09476f0842d9d21b5df0372d08dcdcaa", + "control_graph_rank_sha256": "e327eb46d5e4f47f7bd641589b98f0ad9cd393863f446cec744ca526a1682922", + "control_public_rank_sha256": "86ac37a938a121411f53f5087008f51e748b1694707d3412d9ea865d8c455cd6", + "control_seed_rank_sha256": "c8a0bd8dddc7a6453c59be32858a6f0d09476f0842d9d21b5df0372d08dcdcaa", + "control_top1_age_events": 392, + "control_top1_age_ms": 392000, + "event_index": 2797, + "modality": "text", + "query_embedding_sha256": "0adf3c4bc361b478b70e0bbf2450c1649b1cab389f00a95df018dd42f72b8cc1", + "query_ordinal": 92, + "query_timestamp": 1700002797000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "ee40d3161926fffe1143f4c816395da9f2c6a1bc4fd063a59136fa127819085d", + "control_graph_rank_sha256": "c8696040731eecf7e982fe5dadc5eb01cb3b1295a9aab3679ab69a8e1392a4d3", + "control_public_rank_sha256": "93e55fa0a778bdb4d29d7974cb69947396aae752a074315b586c5b0247562514", + "control_seed_rank_sha256": "ee40d3161926fffe1143f4c816395da9f2c6a1bc4fd063a59136fa127819085d", + "control_top1_age_events": 5, + "control_top1_age_ms": 5000, + "event_index": 2827, + "modality": "text", + "query_embedding_sha256": "a55783820110278b54fc6aa8c67f87beb5933b79a0e5febd5523e4e9a6370bbd", + "query_ordinal": 93, + "query_timestamp": 1700002827000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "d70192e684b38b1688939c1b605ce3b20c943a8fd1e926190f92999606e9592d", + "control_graph_rank_sha256": "1381164b877dee2d083e6ad992af7781ebb5422494339294be76b8908b4528b5", + "control_public_rank_sha256": "4b5499caa1edc5887cfd74b7109e4711adcd6eede71f245db3c8d45a9cf2031d", + "control_seed_rank_sha256": "d70192e684b38b1688939c1b605ce3b20c943a8fd1e926190f92999606e9592d", + "control_top1_age_events": 2179, + "control_top1_age_ms": 2179000, + "event_index": 2856, + "modality": "text", + "query_embedding_sha256": "d24b4ced504ab6e3b20f0976ef5e048447308ca2650e9ac3b81584945fcc70fb", + "query_ordinal": 94, + "query_timestamp": 1700002856000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "fce2f32e09d626860dc03d7bfae51a2a6e979d0bc29936886cbd22c134d2ee40", + "control_graph_rank_sha256": "e93fe58c158bdd1362338459d2d8a25bd1e3d3da510da771a7f7faee22d5eb44", + "control_public_rank_sha256": "24661002912fa7ba8f01be93da2982a7a1270d7e3d86a2c5feb0a3f7621bf58e", + "control_seed_rank_sha256": "fce2f32e09d626860dc03d7bfae51a2a6e979d0bc29936886cbd22c134d2ee40", + "control_top1_age_events": 206, + "control_top1_age_ms": 206000, + "event_index": 2891, + "modality": "text", + "query_embedding_sha256": "d9c9baad5c3e15b7c4024e7a923e5a68e80ee6203665dc026587b48be8594770", + "query_ordinal": 95, + "query_timestamp": 1700002891000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "0a46e7e92a5c61079d46b8c97eb10f58cc11fe3e28afda5ede602fd4d4fe379f", + "control_graph_rank_sha256": "6b81d5a5a4277ae8573cf5e75348afcf3d20eb311d290a1c0e540ef8acb42f45", + "control_public_rank_sha256": "7cc159945064c4b9ea84c88667c7f29505fc7b2b8d6d4b7bf45bb369a15e6898", + "control_seed_rank_sha256": "0a46e7e92a5c61079d46b8c97eb10f58cc11fe3e28afda5ede602fd4d4fe379f", + "control_top1_age_events": 883, + "control_top1_age_ms": 883000, + "event_index": 2927, + "modality": "text", + "query_embedding_sha256": "dfa4880d28f0f27f8d20029cd782d023432bd90dd4e4560f8f3db57ef4530c32", + "query_ordinal": 96, + "query_timestamp": 1700002927000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "3ef43d1e09c7d7e12581be13372466504d3fdd87aacbdba0c644abcee423b3ff", + "control_graph_rank_sha256": "fb0425b86600f4e05b78bc2fa8a23424cca2b21c15ccaf683d3ebd86870dc104", + "control_public_rank_sha256": "dca9f8538239038551258c451d6e9f658d2a6627076d0c04c34e826efc709e8f", + "control_seed_rank_sha256": "3ef43d1e09c7d7e12581be13372466504d3fdd87aacbdba0c644abcee423b3ff", + "control_top1_age_events": 58, + "control_top1_age_ms": 58000, + "event_index": 2957, + "modality": "text", + "query_embedding_sha256": "ba33b05363ffa665c6f4a5a578386c2c0aad4ce3047bd5e77a834a1559896c3b", + "query_ordinal": 97, + "query_timestamp": 1700002957000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "25d3fe11dd320c0a5b7a9731f79ba2332dc95d09a2ddd84cd97632529acb1948", + "control_graph_rank_sha256": "aa5e97b6e6f1921ab798fbd145bbba7bb94f646f58416d7b555ee05bef32d33c", + "control_public_rank_sha256": "92e951b174503cc3283625f71e019ffc5a98df55e4f43b8092d9bda71fda1d87", + "control_seed_rank_sha256": "25d3fe11dd320c0a5b7a9731f79ba2332dc95d09a2ddd84cd97632529acb1948", + "control_top1_age_events": 113, + "control_top1_age_ms": 113000, + "event_index": 2986, + "modality": "text", + "query_embedding_sha256": "8c6ecbbfefb33e4b0b6df86a7759479a582d10631cd1fab31642a5e743e6b5d3", + "query_ordinal": 98, + "query_timestamp": 1700002986000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "cfb91c8515ead56307996798f2891fbf8adcfe62b442a68b83031e1b0cfd0850", + "control_graph_rank_sha256": "b8c13de5c1d62ba87dbab74574abbc6d9130b2e0e79eaa568c01988bf5459913", + "control_public_rank_sha256": "d005f123e668230e85b40f860c70661b89dbe6906530b0d8ecae6c99849325c1", + "control_seed_rank_sha256": "cfb91c8515ead56307996798f2891fbf8adcfe62b442a68b83031e1b0cfd0850", + "control_top1_age_events": 5, + "control_top1_age_ms": 5000, + "event_index": 3021, + "modality": "text", + "query_embedding_sha256": "1f206486940af36f08d49397bc6e5c41a6074be5f4b9420ada6e3b44ad2ba127", + "query_ordinal": 99, + "query_timestamp": 1700003021000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "7ee835f9b99ed58713986b206f212178341d4e70c96cfa03db037fb9b3433e45", + "control_graph_rank_sha256": "2b7af1bf189190f228bc7f71aa5d790cf6e145c01829c9fe1ba6f96a13acd932", + "control_public_rank_sha256": "502735f43c56d45910194698cc9783b1c5014589349c92da6dfc7caf47eeee2c", + "control_seed_rank_sha256": "7ee835f9b99ed58713986b206f212178341d4e70c96cfa03db037fb9b3433e45", + "control_top1_age_events": 483, + "control_top1_age_ms": 483000, + "event_index": 3049, + "modality": "text", + "query_embedding_sha256": "149af8eddf258a252e08701d6836db1369b4f187824f3f670ceb097920999b18", + "query_ordinal": 100, + "query_timestamp": 1700003049000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "a3721e7bc8a9583687f4e1191bf7b2a1f4b65800f2f0e92623471fac13f01da6", + "control_graph_rank_sha256": "aee56209f06281fcbf61648100394b52c641ea7a750884e77bfe872c7ec30ce6", + "control_public_rank_sha256": "4ad361cc79755df13b91409a1d868b48c95049afe1869c714e5d2f3ce308fdcb", + "control_seed_rank_sha256": "a3721e7bc8a9583687f4e1191bf7b2a1f4b65800f2f0e92623471fac13f01da6", + "control_top1_age_events": 274, + "control_top1_age_ms": 274000, + "event_index": 3081, + "modality": "text", + "query_embedding_sha256": "ea37ff9fff1c444381dd74f420ab3147a0d4f7d9d9f7b6d6474e85b69ac9a255", + "query_ordinal": 101, + "query_timestamp": 1700003081000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "29c0618b00b7206150c20a20dc799033cf2c7fef6910a4b79b9568077353ba9a", + "control_graph_rank_sha256": "fd9949cb918528ad73e503ddbf9334012adf500a52ebdf2fb174659f25ffa479", + "control_public_rank_sha256": "d6ffdc8d334566bab1db54444156eb746b2a151a0218921e9a28b17df6ea4868", + "control_seed_rank_sha256": "29c0618b00b7206150c20a20dc799033cf2c7fef6910a4b79b9568077353ba9a", + "control_top1_age_events": 1676, + "control_top1_age_ms": 1676000, + "event_index": 3114, + "modality": "text", + "query_embedding_sha256": "ed6123380bf7abc0b5d400db0ba30b022c7aaac8d6dfe713e18a8e78ddd31b29", + "query_ordinal": 102, + "query_timestamp": 1700003114000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "63268ddff40a348af87ec2702081622e00cb5a849c7f9426af0790a94e1b4052", + "control_graph_rank_sha256": "e71da9da3321f44fe51f58eb896a14eab24ad456d8037576395eda1947d0af69", + "control_public_rank_sha256": "87d1e0004144e26580ef63e5959844c574a25b5f766aee965518c32bf2a2b6b0", + "control_seed_rank_sha256": "63268ddff40a348af87ec2702081622e00cb5a849c7f9426af0790a94e1b4052", + "control_top1_age_events": 711, + "control_top1_age_ms": 711000, + "event_index": 3144, + "modality": "text", + "query_embedding_sha256": "db06be69ddfacabf2f1434ef1b40efe9bf277b18ccc85aae85902251b42620f2", + "query_ordinal": 103, + "query_timestamp": 1700003144000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "89e0e590721126d60c25eddcdae046721daf559a511f67122d8ef9a7bb1d2c6a", + "control_graph_rank_sha256": "9f0fd670933431e0109171b282ac29f8ac6aa435887ba236b4eb3b1fc86508c1", + "control_public_rank_sha256": "acd4abba224c5cef5db8da02d84fedf0c61bfabc84a8dbd39dc64d828392ecb7", + "control_seed_rank_sha256": "89e0e590721126d60c25eddcdae046721daf559a511f67122d8ef9a7bb1d2c6a", + "control_top1_age_events": 28, + "control_top1_age_ms": 28000, + "event_index": 3173, + "modality": "text", + "query_embedding_sha256": "f81d74e4c31d3e86758e4b36662f200e8ec1fdbc36dfe3ac722635aac79c70b1", + "query_ordinal": 104, + "query_timestamp": 1700003173000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "6d6312f48da9d359cbd56206e4bb8bbd9d9c0ab743c68bdf6867dc97fdec1559", + "control_graph_rank_sha256": "0ea1a3524c4a045c39c51517b4f964fe44e7b9220e58512d168ef90749b9533e", + "control_public_rank_sha256": "88ef25f41990bd8bf30587c08baf695d9e94d6bb799b0a938953a10a82cc82a6", + "control_seed_rank_sha256": "6d6312f48da9d359cbd56206e4bb8bbd9d9c0ab743c68bdf6867dc97fdec1559", + "control_top1_age_events": 1489, + "control_top1_age_ms": 1489000, + "event_index": 3203, + "modality": "text", + "query_embedding_sha256": "edc0ce939b3c257601755966eda8ea4dd7e5df12286e638bd1a15e75bac194d7", + "query_ordinal": 105, + "query_timestamp": 1700003203000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "e389efafe0182c841f568f2250381f4ee84a4320e45b5eae275082b9df8090b7", + "control_graph_rank_sha256": "6951a10623d287d79c4fc696270baeda27499fe76cf1aa56112db05e925ee5e2", + "control_public_rank_sha256": "403d0b5b5ab13a996eba8e6dd8fc94ede20b46f3692be9b65c9c07c50ad0a88d", + "control_seed_rank_sha256": "e389efafe0182c841f568f2250381f4ee84a4320e45b5eae275082b9df8090b7", + "control_top1_age_events": 1040, + "control_top1_age_ms": 1040000, + "event_index": 3231, + "modality": "text", + "query_embedding_sha256": "ca59bc607dd2baf44584abc0d3a596233b185d5900332fc280c9ab53e055fa16", + "query_ordinal": 106, + "query_timestamp": 1700003231000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "af033d2f4bdf1633e2c35f3d3102193fed0a199393372040d3517b431926e59e", + "control_graph_rank_sha256": "9d7d8dbe3d62f91c3c70dde09f21c8605fa3362f48712413d456ce038a431c6f", + "control_public_rank_sha256": "81233d2b1abc209ee1a37a5e19c4066354fd4284b41f09bc48dfc8610a78ab87", + "control_seed_rank_sha256": "af033d2f4bdf1633e2c35f3d3102193fed0a199393372040d3517b431926e59e", + "control_top1_age_events": 17, + "control_top1_age_ms": 17000, + "event_index": 3265, + "modality": "text", + "query_embedding_sha256": "1001f6af025408a56deb41bc1e6ee3fb872caa507963f9fe0c839f3bf2adc345", + "query_ordinal": 107, + "query_timestamp": 1700003265000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "da499a601faeb55f841683812ea869093821ff4dc99af0ccf3b2f11eb9d79e96", + "control_graph_rank_sha256": "d35ebaa6ad9491e16f1e7a9cdfeba52201ff0d2c821ce0def3aae6e317666878", + "control_public_rank_sha256": "2a0975027bd418dcc1c0e11490a03a2fc3fbb4b554dc30db5fb034bb0f877c3b", + "control_seed_rank_sha256": "da499a601faeb55f841683812ea869093821ff4dc99af0ccf3b2f11eb9d79e96", + "control_top1_age_events": 917, + "control_top1_age_ms": 917000, + "event_index": 3297, + "modality": "text", + "query_embedding_sha256": "a6813331a2bb11719288033223691a06a7ff3106e338841b574ea343adc80d0d", + "query_ordinal": 108, + "query_timestamp": 1700003297000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "6dbf2137ce3031383dfd5719efd9e2b12d67374281450bb453a70d14e947221b", + "control_graph_rank_sha256": "191a9ecf3ce961d6a04ccbaa33dcf0d6b2b414488f1c353cbda5a5354415a1b4", + "control_public_rank_sha256": "9c5b51bf27f7ec5300ffc07f3c860fc5dcc335209b8c06dd5a283147880e7571", + "control_seed_rank_sha256": "6dbf2137ce3031383dfd5719efd9e2b12d67374281450bb453a70d14e947221b", + "control_top1_age_events": 9, + "control_top1_age_ms": 9000, + "event_index": 3328, + "modality": "text", + "query_embedding_sha256": "941eb2f218cff1ca9cc818135f442e4dfc692297723aff1eac024636d34b6748", + "query_ordinal": 109, + "query_timestamp": 1700003328000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "9a727c15087008f19302a41c8f165f12d6810df0b005cd46c35fbb6530ecdd0d", + "control_graph_rank_sha256": "92d8338874cea65e417c1c5f98135f91384cdb05c80e3294ae46767be16a649f", + "control_public_rank_sha256": "c7a9a16e558815c8482b151259bb9c56e1e652f7657fbad9778eda0f7e7c0a27", + "control_seed_rank_sha256": "9a727c15087008f19302a41c8f165f12d6810df0b005cd46c35fbb6530ecdd0d", + "control_top1_age_events": 1040, + "control_top1_age_ms": 1040000, + "event_index": 3358, + "modality": "text", + "query_embedding_sha256": "0fa3bf824f1029c150394a253e9da1e6aeed7c78b7f993295f96ef1865fea46e", + "query_ordinal": 110, + "query_timestamp": 1700003358000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "217dda6f1c7ee9cd172dde4c30cdf221b843f56eae671feed7625f7a702637ad", + "control_graph_rank_sha256": "2d171c798ed6f3e22a77a1e685e3b840a1e42c7bdf1f4beb9023a7a726020ee3", + "control_public_rank_sha256": "93fb4aa7022f5b437629065a940e5a026ba803a1748bed36df0ee7cd8d81f432", + "control_seed_rank_sha256": "217dda6f1c7ee9cd172dde4c30cdf221b843f56eae671feed7625f7a702637ad", + "control_top1_age_events": 1219, + "control_top1_age_ms": 1219000, + "event_index": 3385, + "modality": "text", + "query_embedding_sha256": "dc96897fd8fe223fd41810057da78fc679d094adb79bf2afbe1e8e94c05d5f84", + "query_ordinal": 111, + "query_timestamp": 1700003385000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "3bfc7a61502e673552d50588c62f0ec6e3295edfe6465f920e6e41555afd12ea", + "control_graph_rank_sha256": "124bab967a1516571b1c4129f419e76e79192f74298136dd01fcac67056e2d2a", + "control_public_rank_sha256": "f640c9d5faf1cab6c57683461716a9c85c4619c8b6fe56480f7742df7b9c292e", + "control_seed_rank_sha256": "3bfc7a61502e673552d50588c62f0ec6e3295edfe6465f920e6e41555afd12ea", + "control_top1_age_events": 321, + "control_top1_age_ms": 321000, + "event_index": 3418, + "modality": "text", + "query_embedding_sha256": "73b391374e85d967b4034b35536f0241cb3cec4198175c8024b2bfd62737696c", + "query_ordinal": 112, + "query_timestamp": 1700003418000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "ce103e1ab973e75cd75e5970f78801bd6883e2f6031c3a5ab3546a2dfaa522be", + "control_graph_rank_sha256": "93ef566585ae6fe29ea96de6ab9c64c0ab29a055d637c710231a6be8a55bebea", + "control_public_rank_sha256": "e757b5f04db7ca32a11dc4d9b7366605d83f7adc48f7481bf181714eb56200bb", + "control_seed_rank_sha256": "ce103e1ab973e75cd75e5970f78801bd6883e2f6031c3a5ab3546a2dfaa522be", + "control_top1_age_events": 285, + "control_top1_age_ms": 285000, + "event_index": 3446, + "modality": "text", + "query_embedding_sha256": "5be41db99351115f4890e36b3104c5fb6e4825396c54ae51563e48d86a7fb316", + "query_ordinal": 113, + "query_timestamp": 1700003446000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "15275b7d478a76510feb3c2f14aea6a95aa587247dc665563a906b0e6b6436ff", + "control_graph_rank_sha256": "addc172d4242e9a00b7509e105066314c97e0ccfbfa2c3af7605b6b1b3eff6dc", + "control_public_rank_sha256": "ad6eb33b28eebc3f3bab66d1efe9e9a3f77bcdc8122baac0a6fdb32a5cc2f9d3", + "control_seed_rank_sha256": "15275b7d478a76510feb3c2f14aea6a95aa587247dc665563a906b0e6b6436ff", + "control_top1_age_events": 4, + "control_top1_age_ms": 4000, + "event_index": 3479, + "modality": "text", + "query_embedding_sha256": "cf86938b211041b5bc6477d9886ec70303d9b3e8c65690003ec047caae614597", + "query_ordinal": 114, + "query_timestamp": 1700003479000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "1ab6e9be09fa030a71b95d563608a0140385da67093026161d940ee5e391eece", + "control_graph_rank_sha256": "28b9ad4e909df755e6cd4d9d2db0893aa39123b6cc8c818ba76d13b43ef13753", + "control_public_rank_sha256": "30ef566da62059ccca1d7221a1c2124a7d9527702207455332d4698676a0cdd4", + "control_seed_rank_sha256": "1ab6e9be09fa030a71b95d563608a0140385da67093026161d940ee5e391eece", + "control_top1_age_events": 1660, + "control_top1_age_ms": 1660000, + "event_index": 3509, + "modality": "text", + "query_embedding_sha256": "4ddb0fc362ae8352c0cbedfb477640dc506e7f799d8378e17ca5a7f7daa500a8", + "query_ordinal": 115, + "query_timestamp": 1700003509000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "779a5e815e35a4011567252b2e07b2c3ac618b8c3b7a46f06be54a9e5600190f", + "control_graph_rank_sha256": "b2c6b40e6dbc98fc516320b4979c55f646971683ba61f17b2cded158efbe6af9", + "control_public_rank_sha256": "dfd50106af736ac2edcb4244ec053d6b1e2453c49062a167bebd2f9d619c6b41", + "control_seed_rank_sha256": "779a5e815e35a4011567252b2e07b2c3ac618b8c3b7a46f06be54a9e5600190f", + "control_top1_age_events": 763, + "control_top1_age_ms": 763000, + "event_index": 3539, + "modality": "text", + "query_embedding_sha256": "756fee8c4e96031d8145f68da4ca0eccd829753bfb7e4f8a864112a1b70a6a67", + "query_ordinal": 116, + "query_timestamp": 1700003539000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "0aa6aaccc0fa0e48195b26c900e553558a3c2e8193e3efff36d80546d2717346", + "control_graph_rank_sha256": "a89f0f3cb2739bac4face930dececc106b19328047f53be184f5938d139c790c", + "control_public_rank_sha256": "a29a6c7e3a4c06341296b33fb98b1cb42284658d3620f43e3cdfe0adbb8b372c", + "control_seed_rank_sha256": "0aa6aaccc0fa0e48195b26c900e553558a3c2e8193e3efff36d80546d2717346", + "control_top1_age_events": 306, + "control_top1_age_ms": 306000, + "event_index": 3576, + "modality": "text", + "query_embedding_sha256": "e15639775802240e9c2e5e37fcd2142d86048f6c9b14043c5c86e63495a99529", + "query_ordinal": 117, + "query_timestamp": 1700003576000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "67120f123e49bfe93fd42fea0b7f2dedb585b9719b526e4d804e958b0388c769", + "control_graph_rank_sha256": "b5aab030da372c1975ae09ea28d471af851f0e5710325c133013c34052969974", + "control_public_rank_sha256": "427908441173b09b8ad923fe860b384ed29377f495bbb3bd92039a076fd7c102", + "control_seed_rank_sha256": "67120f123e49bfe93fd42fea0b7f2dedb585b9719b526e4d804e958b0388c769", + "control_top1_age_events": 554, + "control_top1_age_ms": 554000, + "event_index": 3606, + "modality": "text", + "query_embedding_sha256": "1f5fa16016a189a6b317f09c6d4252ab163a9df1926cc7ca9a9cfb388303f0cc", + "query_ordinal": 118, + "query_timestamp": 1700003606000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "42683f9b00ca9a61f49e1ea7f140405a692b9228e03e02bab48ae1011f2cf304", + "control_graph_rank_sha256": "2bb1c9eafca5a9c1246d466e4196fc2e39973d55927256748f26b192e50adbd3", + "control_public_rank_sha256": "eb59dfe6b771a2072cf6b041fba126f2c5f82438415408a440b54d2c4709ae19", + "control_seed_rank_sha256": "42683f9b00ca9a61f49e1ea7f140405a692b9228e03e02bab48ae1011f2cf304", + "control_top1_age_events": 367, + "control_top1_age_ms": 367000, + "event_index": 3637, + "modality": "text", + "query_embedding_sha256": "b0ab8052c7e86bf6116f53b5a9c68aaf4cf260f075ed2a56482f0d48d888dba7", + "query_ordinal": 119, + "query_timestamp": 1700003637000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "7d6c50c7e22b4cf5f87abecea3e72495e4285d048dcd4dd04478a3a0aeb05326", + "control_graph_rank_sha256": "4bad2053d89e22260cc062bbd8a8bcc8b40728ca431cc9b552b2a38e8c538d33", + "control_public_rank_sha256": "cf2f5a6bd1e6eda8f62d5e25ae2ce417925891547086141ec11d92412f8ccdcb", + "control_seed_rank_sha256": "7d6c50c7e22b4cf5f87abecea3e72495e4285d048dcd4dd04478a3a0aeb05326", + "control_top1_age_events": 332, + "control_top1_age_ms": 332000, + "event_index": 3671, + "modality": "text", + "query_embedding_sha256": "2867d1b0a32998c37df7eabb46f75881562bfefedbd6e9e5cb1e6ff6e638e822", + "query_ordinal": 120, + "query_timestamp": 1700003671000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "c6adc7bd19088a9cd607db542984e3b56fe7e864acb33085c1b851f30b0253a9", + "control_graph_rank_sha256": "1323e099a3d4a9aef406c2d6829d64d39d6abeafae5a8c7ac2c1451cfabe1987", + "control_public_rank_sha256": "2edaa65fe22a4504c790f8984e0c0c9b4877a2b3b78c136aef6691211ad0ebc9", + "control_seed_rank_sha256": "c6adc7bd19088a9cd607db542984e3b56fe7e864acb33085c1b851f30b0253a9", + "control_top1_age_events": 1832, + "control_top1_age_ms": 1832000, + "event_index": 3697, + "modality": "text", + "query_embedding_sha256": "54f9ba2bb6f957169baf3b8121250ac885ae8704a3d1d27c58dde986236c30ee", + "query_ordinal": 121, + "query_timestamp": 1700003697000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "5df6403ab71ff474f1ef18752fac2a8ce06aaa609b98c8e1d7d604e40fb39f59", + "control_graph_rank_sha256": "e61750a8dce76ab8394a2846692ba61bab8f9ed2dae86269421fc1492e5c06c9", + "control_public_rank_sha256": "b980710f46604d2171d4037e90a6c5a1df8784a76a4b7dce36d5c890cf58e934", + "control_seed_rank_sha256": "5df6403ab71ff474f1ef18752fac2a8ce06aaa609b98c8e1d7d604e40fb39f59", + "control_top1_age_events": 506, + "control_top1_age_ms": 506000, + "event_index": 3729, + "modality": "text", + "query_embedding_sha256": "1f56f7af2a9d522ef3dec37353009d624b65b786aa92a69477e8b63395742501", + "query_ordinal": 122, + "query_timestamp": 1700003729000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "32ae3eb6b00a9bf2d48b39a59692973713d3290b94a9a7afc3e3731112f3bb7e", + "control_graph_rank_sha256": "5dadb55dec72dfc15ec0d8e6ffdfd769b5a5f3b08c579fdc39f3c40e5c3baa06", + "control_public_rank_sha256": "13c878ac224390524b6ac9744e86823706f3dca91b368732637a9042b09024b7", + "control_seed_rank_sha256": "32ae3eb6b00a9bf2d48b39a59692973713d3290b94a9a7afc3e3731112f3bb7e", + "control_top1_age_events": 122, + "control_top1_age_ms": 122000, + "event_index": 3762, + "modality": "text", + "query_embedding_sha256": "9787b789d071df45cc86cb70134ceec5d9c8b43c8b2cf5694b6cb2062d1160f8", + "query_ordinal": 123, + "query_timestamp": 1700003762000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "ab5a5686031fafc6972df9b18a658dd947852ce73ddae400573679ca0e15a730", + "control_graph_rank_sha256": "dd3128fe57a75c2a866c23a3929a084d733a803f1d14d414cfe96bb8323c93ea", + "control_public_rank_sha256": "49bc24ee843446fcbb8809261f4bd46caefa5874878f219e55b7bf10043e3bd1", + "control_seed_rank_sha256": "ab5a5686031fafc6972df9b18a658dd947852ce73ddae400573679ca0e15a730", + "control_top1_age_events": 40, + "control_top1_age_ms": 40000, + "event_index": 3791, + "modality": "text", + "query_embedding_sha256": "2a42e051f6737b2850efc7ae56b0a44435fdc12c3782e19ffd1e489854314af4", + "query_ordinal": 124, + "query_timestamp": 1700003791000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "a8ac5dc9d4db79adc40e046d9348979089524095c9f8e1ceef971f9dba3eccc4", + "control_graph_rank_sha256": "86894157d9ec303581f0ca667321ce7501f2d3373deca7447847268b7f5d56ae", + "control_public_rank_sha256": "31a0dbae3ee4f5c12cd24e80b7738ad30128eb026096d415796338d35110665c", + "control_seed_rank_sha256": "a8ac5dc9d4db79adc40e046d9348979089524095c9f8e1ceef971f9dba3eccc4", + "control_top1_age_events": 629, + "control_top1_age_ms": 629000, + "event_index": 3816, + "modality": "text", + "query_embedding_sha256": "3953bb8127106203d1ce0e19d6c0e37b7434f44231fc67d9d5dccf65e6098d0d", + "query_ordinal": 125, + "query_timestamp": 1700003816000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "4723ed734d7465614f2c76c3448eedcb543f6a9308db43f4dad38cb4f167770a", + "control_graph_rank_sha256": "cbf095e3c6a81ff0b226d0204d29e6124c87954c02200336ff932c6f05e56a23", + "control_public_rank_sha256": "52039b99db544903b0626e3f45c84394432e87a0a356c2a39d0584674ba95acb", + "control_seed_rank_sha256": "4723ed734d7465614f2c76c3448eedcb543f6a9308db43f4dad38cb4f167770a", + "control_top1_age_events": 9, + "control_top1_age_ms": 9000, + "event_index": 3845, + "modality": "text", + "query_embedding_sha256": "ccfdb2bb40056c13d7a962ee7fefb05f98982f300e03cf278335c06ce640b2ff", + "query_ordinal": 126, + "query_timestamp": 1700003845000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "cbc31edadea7e9760ca39f110fb964b55ced55b176af823adb1d77e41a19c4b4", + "control_graph_rank_sha256": "0d57df98af516aca506292078be8668de0535937cb76e03ee7f22bfc44a3bdf3", + "control_public_rank_sha256": "72bf21996e1f41533268c4266177a269ed6d1e9bcf9742af061f96ebc2edb970", + "control_seed_rank_sha256": "cbc31edadea7e9760ca39f110fb964b55ced55b176af823adb1d77e41a19c4b4", + "control_top1_age_events": 85, + "control_top1_age_ms": 85000, + "event_index": 3877, + "modality": "text", + "query_embedding_sha256": "73728984f4243d4a06e4d9e6a770058e1574a7ceacfe11ccc9f593d0748a8af2", + "query_ordinal": 127, + "query_timestamp": 1700003877000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "4111d2a51be560b5565f88af4f6afdb7f99e7bb2fedf47e885ff546df1f65013", + "control_graph_rank_sha256": "2f2dec11b779eb5c7c252aee36971c321052a84930795dcde84438fa541d4d7c", + "control_public_rank_sha256": "8cbdd5d7be8ad98d1d2ef7327978a2b0f6980dbfd40dc021eea2efa635ab6990", + "control_seed_rank_sha256": "4111d2a51be560b5565f88af4f6afdb7f99e7bb2fedf47e885ff546df1f65013", + "control_top1_age_events": 8, + "control_top1_age_ms": 8000, + "event_index": 3906, + "modality": "text", + "query_embedding_sha256": "941eb8d7e54275754dc9644e1efcd6f9740f75f58fc7add74cc9b2329776546f", + "query_ordinal": 128, + "query_timestamp": 1700003906000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "791d5fe748dd4d6aab919f96a3f0a5881bb22720450c9a3072d47b77a803546b", + "control_graph_rank_sha256": "88357c43d10ae369a7f82b449aaa280d81d759df8d3635ecd652ac609f978457", + "control_public_rank_sha256": "afa86e4245f7ee39a36df1e996d6303d1d340b212f2642ffc8d4ff422b160958", + "control_seed_rank_sha256": "791d5fe748dd4d6aab919f96a3f0a5881bb22720450c9a3072d47b77a803546b", + "control_top1_age_events": 26, + "control_top1_age_ms": 26000, + "event_index": 3936, + "modality": "text", + "query_embedding_sha256": "d65ef1c30bace6afb7f180901466485a33604ed5600776bfab6099581c5e070f", + "query_ordinal": 129, + "query_timestamp": 1700003936000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "2fb8ee640cd063e1c9f6f1e823ccf22f4481b5e7e6cb0389138e17583e6b6346", + "control_graph_rank_sha256": "a93a6e227f35c216465c1dee8102d97928f0f689cc074541813ae6cb364922af", + "control_public_rank_sha256": "1fd3d36cd9260070399f6d6fe2c33ddfab40268f67c0f50f333060dbe8e1fb8a", + "control_seed_rank_sha256": "2fb8ee640cd063e1c9f6f1e823ccf22f4481b5e7e6cb0389138e17583e6b6346", + "control_top1_age_events": 542, + "control_top1_age_ms": 542000, + "event_index": 3968, + "modality": "text", + "query_embedding_sha256": "fca7f01db3ace02a6c4feaedef58ee43f1120d1f49b0728f9258113baa7276af", + "query_ordinal": 130, + "query_timestamp": 1700003968000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "20fe7276edcc1e8f34b28ea9af3f6d6d85782f051b5578ca060b6b9a0e3f4eef", + "control_graph_rank_sha256": "44af6ac0737727fcc2d1bd3c158724f654520da1d7f76f12a1bc4cecf27e8f1b", + "control_public_rank_sha256": "5c0ea5e407754475dd1d2088a7d6661b1d92ac6cd7b51af8d65d1dd1959eaa11", + "control_seed_rank_sha256": "20fe7276edcc1e8f34b28ea9af3f6d6d85782f051b5578ca060b6b9a0e3f4eef", + "control_top1_age_events": 2690, + "control_top1_age_ms": 2690000, + "event_index": 3999, + "modality": "text", + "query_embedding_sha256": "5f7949b6c15fef08feb004199a62f57d7b316517f8dfbe10e73bfd1b9a326c34", + "query_ordinal": 131, + "query_timestamp": 1700003999000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "2b980e6e21301e45ac126b3611695a92827c3ef84c6eb82ab3dc4332faa0693d", + "control_graph_rank_sha256": "06796407085e2fe8d5d805e90e2ed77cc38398626efff2d8f668160068d118c5", + "control_public_rank_sha256": "be83bf702196246113ed089966bae89e0239ee64af3914f0b68991d8e855ba8c", + "control_seed_rank_sha256": "2b980e6e21301e45ac126b3611695a92827c3ef84c6eb82ab3dc4332faa0693d", + "control_top1_age_events": 765, + "control_top1_age_ms": 765000, + "event_index": 4026, + "modality": "text", + "query_embedding_sha256": "797dac5213c9283f276fcb919368336b8a173377986bdfb49032743bc5489819", + "query_ordinal": 132, + "query_timestamp": 1700004026000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "74db675c538693acd20fa9e4ce855cd6c64b0b7db0a953338694bcb76c833b68", + "control_graph_rank_sha256": "ccc38cb20ce0dc81b604e556a3c1827e15b4cac1d03c4cc62f7ed18b992f41b5", + "control_public_rank_sha256": "b6f2a08290fe09aa996b0bdfb0bb96600d6f638a880015052e538290e883d461", + "control_seed_rank_sha256": "74db675c538693acd20fa9e4ce855cd6c64b0b7db0a953338694bcb76c833b68", + "control_top1_age_events": 1478, + "control_top1_age_ms": 1478000, + "event_index": 4057, + "modality": "text", + "query_embedding_sha256": "fe3f46d0d86e2e047c95641ef68e88226f6e2c2229dc44a6402345d4e62f825b", + "query_ordinal": 133, + "query_timestamp": 1700004057000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "878419c84a9c6481d431af6fd59292c0c9cd4c75b9c7f096db2322fdd9030db9", + "control_graph_rank_sha256": "1502c3b721bf0a707224e4f8607b972a5b5ab1200ba9d079856f49f0cae2d70e", + "control_public_rank_sha256": "382fed6fe7d23328f3d0bea6a6e2e4055f20f08f01a6f54d158894bd8c317eb9", + "control_seed_rank_sha256": "878419c84a9c6481d431af6fd59292c0c9cd4c75b9c7f096db2322fdd9030db9", + "control_top1_age_events": 656, + "control_top1_age_ms": 656000, + "event_index": 4082, + "modality": "text", + "query_embedding_sha256": "322a16984a6cb5f84930eba788d7f2fc77f5055e103b26c6b6a2dd2aa590b4a4", + "query_ordinal": 134, + "query_timestamp": 1700004082000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "7e518d310805d85e93e4c4e56bc769ba21bcb11c120c9697c9af303d79c4207f", + "control_graph_rank_sha256": "1fe57e86860af1e0cb5a5fc04fc49e590d85505c9ceae99d120dfc39ed7b75c6", + "control_public_rank_sha256": "3010de881e93e87057db6cc303a7582395c233e48c71c6ff354037656a575d2f", + "control_seed_rank_sha256": "7e518d310805d85e93e4c4e56bc769ba21bcb11c120c9697c9af303d79c4207f", + "control_top1_age_events": 2806, + "control_top1_age_ms": 2806000, + "event_index": 4115, + "modality": "text", + "query_embedding_sha256": "01c1981f750d616a8866cd5a40043f4faee86ecdbfbd4d13fdc96c3ef26ca10b", + "query_ordinal": 135, + "query_timestamp": 1700004115000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "884e7fd8024bfec7e98b4349010314eaff3cb9dfce7d5f38a8d2a02bff96e116", + "control_graph_rank_sha256": "5fe7309352179e96a2e5df0ba3a5755c8047befbe6c2194711b411e799c22a02", + "control_public_rank_sha256": "2113c73e53bc3e7a2ec21ba37933243cbed1730e746d0f8457cb83d47637fa20", + "control_seed_rank_sha256": "884e7fd8024bfec7e98b4349010314eaff3cb9dfce7d5f38a8d2a02bff96e116", + "control_top1_age_events": 372, + "control_top1_age_ms": 372000, + "event_index": 4145, + "modality": "text", + "query_embedding_sha256": "02f208c2f1980d645c00a9e3703e12cf551b6a743e6664d4525b502743573b61", + "query_ordinal": 136, + "query_timestamp": 1700004145000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "e88d3186409f598b9c721a748e5b5004be8cdaffbd7ca1fde434c3cafca7a28c", + "control_graph_rank_sha256": "952779b4f4706eb00400a91a8acec58a956d375e286fd8384ea0e0d41791e772", + "control_public_rank_sha256": "d598bb6e663088f98c02a27ed5781a1d544c909acfba0059c5ebf5e3179ef9ef", + "control_seed_rank_sha256": "e88d3186409f598b9c721a748e5b5004be8cdaffbd7ca1fde434c3cafca7a28c", + "control_top1_age_events": 3291, + "control_top1_age_ms": 3291000, + "event_index": 4175, + "modality": "text", + "query_embedding_sha256": "2bafda894d630f7bf76fb6949a3a8b1f803324aacd4a527f2200bb21c1fa4f03", + "query_ordinal": 137, + "query_timestamp": 1700004175000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "ada639137531fbb4958655b8308234bab24b1cf5e1328a4da99664fe1aba21f3", + "control_graph_rank_sha256": "8fe0a7d9e7fd08e3f5d1d62d3842e4775faf12c83b67fa125578278681c9c131", + "control_public_rank_sha256": "ac284d89e3815ebe6d9db61f1001819e868afd959efd7071e2f9c9fd74fe59e2", + "control_seed_rank_sha256": "ada639137531fbb4958655b8308234bab24b1cf5e1328a4da99664fe1aba21f3", + "control_top1_age_events": 902, + "control_top1_age_ms": 902000, + "event_index": 4209, + "modality": "text", + "query_embedding_sha256": "7ff51a1f48986f7e1b7a165734c420b2aa6674c4a774bd8c5c7a9a0444f19db5", + "query_ordinal": 138, + "query_timestamp": 1700004209000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "c28e50e9f147ba1cfcfcf624c7519b56ffc956f7c0c59525b26562e2ae3b1c15", + "control_graph_rank_sha256": "0fe7f545679db1755c8be8da875cf27715e37fc9c2d489cb9b3d077b497f827e", + "control_public_rank_sha256": "134d5ed8af97c44266bd38eafe01469c8e0cc984fc5f13f02e606ba30f44ff91", + "control_seed_rank_sha256": "c28e50e9f147ba1cfcfcf624c7519b56ffc956f7c0c59525b26562e2ae3b1c15", + "control_top1_age_events": 2312, + "control_top1_age_ms": 2312000, + "event_index": 4239, + "modality": "text", + "query_embedding_sha256": "50812abdff1c454ccbb455a536d251de139cdbb881f0db111b8010d73ce8d7f1", + "query_ordinal": 139, + "query_timestamp": 1700004239000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "c6c5ee4f5652b7786dfe328edf64953cd426c1aef3cdb5250c544f50803a5806", + "control_graph_rank_sha256": "e8a7fd0fe87e5aaea83da135285923d1fed2c8b56f45b7ed6ed56342c6afd023", + "control_public_rank_sha256": "6248100eb883f7614ca52eb1aad84b53032c8f7630e0774fd322be765be7c28d", + "control_seed_rank_sha256": "c6c5ee4f5652b7786dfe328edf64953cd426c1aef3cdb5250c544f50803a5806", + "control_top1_age_events": 1122, + "control_top1_age_ms": 1122000, + "event_index": 4267, + "modality": "text", + "query_embedding_sha256": "3a460c49d82e038c7fb5104bd7dbf18165a5c5bff1144373c38840b3dbc2dcea", + "query_ordinal": 140, + "query_timestamp": 1700004267000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "228ee22b358c6e0a925f3bdd9aa888ee3518eb129fbd408dcdb4421fa4295094", + "control_graph_rank_sha256": "154572a96a0d90d29fcb78127f8f588f7f9575015ee22c6bfb4afc735a01d99b", + "control_public_rank_sha256": "8fd29944bd4ddd39c86fce7c2d0095962e0e026bb98f05c095ffae10192a42ca", + "control_seed_rank_sha256": "228ee22b358c6e0a925f3bdd9aa888ee3518eb129fbd408dcdb4421fa4295094", + "control_top1_age_events": 1683, + "control_top1_age_ms": 1683000, + "event_index": 4296, + "modality": "text", + "query_embedding_sha256": "ad4c2d737310261d0df9cb8fe9a7e62be80cd8f526a53bed69af9ecffc256e42", + "query_ordinal": 141, + "query_timestamp": 1700004296000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "51b5c5b2ef5eecc9ae327b4f3d8a30e87cda248ef29a8cbdfdac2952b23b2e9e", + "control_graph_rank_sha256": "6c7d0abf6318df122bac68ec1009ce7a194e9b3552ef544fc632133c2632d808", + "control_public_rank_sha256": "47468ff4486e0591f276631c6ba4ea210eda4f389017062416faf370749e4510", + "control_seed_rank_sha256": "51b5c5b2ef5eecc9ae327b4f3d8a30e87cda248ef29a8cbdfdac2952b23b2e9e", + "control_top1_age_events": 517, + "control_top1_age_ms": 517000, + "event_index": 4328, + "modality": "text", + "query_embedding_sha256": "5a43faba6dc160a47b32a15cfa6108391d0fab197a7bc614ed77dd252474bb4a", + "query_ordinal": 142, + "query_timestamp": 1700004328000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "8ca8117e03a74087646fd890e0c701aebea626fdfe9226e6600c39f6dfec5d88", + "control_graph_rank_sha256": "595113bafd394c24e1fb1946cdca196d5ba1ded167c398393e7d811b73a0a3e3", + "control_public_rank_sha256": "7aaea26594c6d66ee9206638aa838a2af673410d9e565fa63a12969895a41267", + "control_seed_rank_sha256": "8ca8117e03a74087646fd890e0c701aebea626fdfe9226e6600c39f6dfec5d88", + "control_top1_age_events": 164, + "control_top1_age_ms": 164000, + "event_index": 4355, + "modality": "text", + "query_embedding_sha256": "c4e2c3d9fcef1c88d4aff46d70f5d9241d44b473d58c45b2255e39bb7666ea1b", + "query_ordinal": 143, + "query_timestamp": 1700004355000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "dc2c10577df11a4572644a13012a0ab97c92c4d751176ff63a718a083b78a071", + "control_graph_rank_sha256": "2e61ebe1c934fed964a70019a800732fb2fbad053a0a5e45701e9a9bcd9dc96c", + "control_public_rank_sha256": "eef2af7a110805d5765625bd20b8442d9d9b72c67a76d461ac2ff048b51a832a", + "control_seed_rank_sha256": "dc2c10577df11a4572644a13012a0ab97c92c4d751176ff63a718a083b78a071", + "control_top1_age_events": 1243, + "control_top1_age_ms": 1243000, + "event_index": 4388, + "modality": "text", + "query_embedding_sha256": "9572c8e315e57efee5396375bc854dd4bbfc9b7abe1ec7557005f207c375a74e", + "query_ordinal": 144, + "query_timestamp": 1700004388000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "5553b6caf95279e10b11cb5208dcc47067fea01a29df0afbf7020897b367ca98", + "control_graph_rank_sha256": "a7fc7930b4266cccc41b01540fe1eb4aaf2ce6930b4fc246e077f934d7657325", + "control_public_rank_sha256": "0480e43de2e349a1aa0f9b6fe8dc08fac31fcc31f1791b26d594c19fdcbfc148", + "control_seed_rank_sha256": "5553b6caf95279e10b11cb5208dcc47067fea01a29df0afbf7020897b367ca98", + "control_top1_age_events": 18, + "control_top1_age_ms": 18000, + "event_index": 4419, + "modality": "text", + "query_embedding_sha256": "22525b8e83ae838e2962faa11e6402545f306de87f204d3913837a9f9bf0f167", + "query_ordinal": 145, + "query_timestamp": 1700004419000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "13743a081bef6c52bba889a7f3a9f1e429508596742d2acfa9d5eaba281ee618", + "control_graph_rank_sha256": "0e3d6e36dbad312f010006a0bc69e17d77b13d5f88fbac939061f7889ad01f4a", + "control_public_rank_sha256": "7e49be222782378a796a87bdf2724b17c75d8f767cb7cf3ef99c6ca11cfb5e08", + "control_seed_rank_sha256": "13743a081bef6c52bba889a7f3a9f1e429508596742d2acfa9d5eaba281ee618", + "control_top1_age_events": 3243, + "control_top1_age_ms": 3243000, + "event_index": 4447, + "modality": "text", + "query_embedding_sha256": "5a633d06150ffeff9f52ff66f266773ab5c0777a06cc56b1b3167978d55d3468", + "query_ordinal": 146, + "query_timestamp": 1700004447000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "b5d9d8b33240a17861c67dc11ac31155d7e301d8665c59b8a54eb898e9fb2ae5", + "control_graph_rank_sha256": "edf4c0a7b50fa90a052a1337c180c8d83d1a0306cd18b5a58366c1ce9c1850cd", + "control_public_rank_sha256": "f58aa90fc2270d53f839c2a63b75af07261076f1de89d7d6e51663f63fa7037d", + "control_seed_rank_sha256": "b5d9d8b33240a17861c67dc11ac31155d7e301d8665c59b8a54eb898e9fb2ae5", + "control_top1_age_events": 2720, + "control_top1_age_ms": 2720000, + "event_index": 4480, + "modality": "text", + "query_embedding_sha256": "91da836bbb7bd9ef24193ab5bff73492dfd8115a1d6a6fb21247938833d0ce01", + "query_ordinal": 147, + "query_timestamp": 1700004480000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "5332a403f263dba811afe8be88d6e79484c6cd03bb06c2d15207eb400eb92e6e", + "control_graph_rank_sha256": "884a9e6a1c1fb7e18f119ad337eb0f1cbb24ad8f09aa836a8a9413b44c624efd", + "control_public_rank_sha256": "cbe2b4bb04f3418f2ee87b3945a40044202c3c4a486a51a17e3a67ddbfae0090", + "control_seed_rank_sha256": "5332a403f263dba811afe8be88d6e79484c6cd03bb06c2d15207eb400eb92e6e", + "control_top1_age_events": 1429, + "control_top1_age_ms": 1429000, + "event_index": 4507, + "modality": "text", + "query_embedding_sha256": "de9a18ba9b7ce65f84494acba3b57f4bec0815006c57941ee624e00956c731c6", + "query_ordinal": 148, + "query_timestamp": 1700004507000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "1f4e9565fc0a455865fa937eddcc1f560b8a238b9b41ad67f43572a4ab410542", + "control_graph_rank_sha256": "3e11ec878e1df1bdbf954c125164830f8872d731adf9671d77ef7948ca6bcfb4", + "control_public_rank_sha256": "ca459f15e234d2a9a949f138494a7b02c553df7015235452895516f1755264bb", + "control_seed_rank_sha256": "1f4e9565fc0a455865fa937eddcc1f560b8a238b9b41ad67f43572a4ab410542", + "control_top1_age_events": 21, + "control_top1_age_ms": 21000, + "event_index": 4542, + "modality": "text", + "query_embedding_sha256": "45a143348210fe1e366b132bf790c4f2bfd603eb23dbe6bf74e2c527eef55e84", + "query_ordinal": 149, + "query_timestamp": 1700004542000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "609178cad2636de47d715a2acb3fa8dbbd4e806d167e3b2af3b464be585adff7", + "control_graph_rank_sha256": "d21c73d96200333ec396d4f4e586bd71ddb362cca6e4900c05105b1343203937", + "control_public_rank_sha256": "8b8bee8f246d6326c4d062896e130af97033ee523d7158d566fc79c8eba91998", + "control_seed_rank_sha256": "609178cad2636de47d715a2acb3fa8dbbd4e806d167e3b2af3b464be585adff7", + "control_top1_age_events": 527, + "control_top1_age_ms": 527000, + "event_index": 4572, + "modality": "text", + "query_embedding_sha256": "81d4786ebc3f97f2ef7b856631698e9fc07056bdfa3c5ff97c22b6f075afd33e", + "query_ordinal": 150, + "query_timestamp": 1700004572000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "e5d69d0674bc820036ca7b042fbd083bae8702f8d564492ed94839a6166b18c1", + "control_graph_rank_sha256": "e28dae102dae02bd797f87d352baf418af6f3f3e5bce1da99f77f861fcdd1646", + "control_public_rank_sha256": "987e2c0fe858ca32a94115e6f38a483ac8a69276851c893d2fe0b1dd75e43f66", + "control_seed_rank_sha256": "e5d69d0674bc820036ca7b042fbd083bae8702f8d564492ed94839a6166b18c1", + "control_top1_age_events": 398, + "control_top1_age_ms": 398000, + "event_index": 4599, + "modality": "text", + "query_embedding_sha256": "da275543d3095131d55cf51a62fb1b6498a2fdbaa0bf4d5010a15c387c9b4f1d", + "query_ordinal": 151, + "query_timestamp": 1700004599000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "45e6a06957e69ece5768429a81866b236c3c1d464456b197588fcfb59f0f213c", + "control_graph_rank_sha256": "066e6b3e8f19c47e3786c056a754a410a917f680e58deccde7301908cd26d64f", + "control_public_rank_sha256": "8632e1db4b454b50cc142379977e73c680b6dcba92b511c60ab64324b86594b8", + "control_seed_rank_sha256": "45e6a06957e69ece5768429a81866b236c3c1d464456b197588fcfb59f0f213c", + "control_top1_age_events": 12, + "control_top1_age_ms": 12000, + "event_index": 4631, + "modality": "text", + "query_embedding_sha256": "3c0e809da141548821b5bd8a9b92353127cfcdfbf74930637da35cc1e5265487", + "query_ordinal": 152, + "query_timestamp": 1700004631000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "e08028390439679300c735ed176946a28283ebcc41432571444d5f733f21d1ee", + "control_graph_rank_sha256": "ee5123b17b19e46c97f16de6264ab65d300a5ebca99e7746eb0e759c0c509ec4", + "control_public_rank_sha256": "04d7f68e7f677272c0ce153c64622b64491b10de6e4887dae7a9cb57ddd3c9ed", + "control_seed_rank_sha256": "e08028390439679300c735ed176946a28283ebcc41432571444d5f733f21d1ee", + "control_top1_age_events": 730, + "control_top1_age_ms": 730000, + "event_index": 4656, + "modality": "text", + "query_embedding_sha256": "46b1d3ce492bc03f3ea6a7ff754cdc22af0386c0dc05a2ea338ca9fc8c0004fd", + "query_ordinal": 153, + "query_timestamp": 1700004656000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "3dda71395c59164e289737f17577e5febe00cf3ba5895f226025c930c7bcc1d9", + "control_graph_rank_sha256": "10175ac8e2f20206f245fe6038b77af2ad382f114e8976e5a95603fc0aff1ba5", + "control_public_rank_sha256": "44abf39ff82d07c16c987f8f649fb84832863b29bfb96306056f03e723530a7c", + "control_seed_rank_sha256": "3dda71395c59164e289737f17577e5febe00cf3ba5895f226025c930c7bcc1d9", + "control_top1_age_events": 821, + "control_top1_age_ms": 821000, + "event_index": 4688, + "modality": "text", + "query_embedding_sha256": "8ff582c5732ecfb39d4387b18eea606ccb8530d46bbf6c5714583a6cbef21efc", + "query_ordinal": 154, + "query_timestamp": 1700004688000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "72f05e508ebf419d831681e4d60ed67c183d32d0ed446b6332274d82b52c5048", + "control_graph_rank_sha256": "18397b51b627455b658941493fd6c28b4d8589632c261827727a7e561df5ad33", + "control_public_rank_sha256": "00ca02386e85b44c93509914f3ac6cb47141c6d54ec0fe77cce6f236295b4b88", + "control_seed_rank_sha256": "72f05e508ebf419d831681e4d60ed67c183d32d0ed446b6332274d82b52c5048", + "control_top1_age_events": 374, + "control_top1_age_ms": 374000, + "event_index": 4714, + "modality": "text", + "query_embedding_sha256": "7ee67a9b28867595b4a450ba954f5e50cd9b2acf2e741178e253710d7fa45618", + "query_ordinal": 155, + "query_timestamp": 1700004714000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "3131236560b994936383cf977bc57e774c3c2af79ec796c15307110b1f4e5ce4", + "control_graph_rank_sha256": "aca0105a00d9365e528cccc71f3e9608ad43a046dc86eabe1449cb67c85156e2", + "control_public_rank_sha256": "dc20cdb81667dff8ae1c913061743d8a21594aed8631d6cfb19b5de7550861ad", + "control_seed_rank_sha256": "3131236560b994936383cf977bc57e774c3c2af79ec796c15307110b1f4e5ce4", + "control_top1_age_events": 878, + "control_top1_age_ms": 878000, + "event_index": 4745, + "modality": "text", + "query_embedding_sha256": "4f6e08e13c409ac5dee59d5343f5fdb1d16c35aa363aad75af8f0c144de29577", + "query_ordinal": 156, + "query_timestamp": 1700004745000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "05838d3c2d1f5c166ed7681f82c6a1b5273f0f9558b4eaa46520c27ef904d915", + "control_graph_rank_sha256": "404d1c837187983ef14da6b392d185734131b783be320b50b85c42ef1b965ea7", + "control_public_rank_sha256": "4049c50e4adfea12fdf698de827031d4897621ea3a8b2f996680c308af4ea22f", + "control_seed_rank_sha256": "05838d3c2d1f5c166ed7681f82c6a1b5273f0f9558b4eaa46520c27ef904d915", + "control_top1_age_events": 8, + "control_top1_age_ms": 8000, + "event_index": 4779, + "modality": "text", + "query_embedding_sha256": "8f20152f85e283875113f147fd74813538c455769f7de1ce51e3b20936501e14", + "query_ordinal": 157, + "query_timestamp": 1700004779000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "6145fe85744c78eaa8e921fd20311b68942ecff10aa3d0557a7e327a120c8d0d", + "control_graph_rank_sha256": "9547380762a40ff7caf28bc99c81ba528733abd915cb9080f3454097e527a851", + "control_public_rank_sha256": "725772abe18079b7ba26be8901ef889315786ee2850d38c0aea00c6386a940a1", + "control_seed_rank_sha256": "6145fe85744c78eaa8e921fd20311b68942ecff10aa3d0557a7e327a120c8d0d", + "control_top1_age_events": 40, + "control_top1_age_ms": 40000, + "event_index": 4807, + "modality": "text", + "query_embedding_sha256": "126e37bfacba3e4a20a5f3f1186f721ae8b1f3a7630976c1ca92f8b6a0f00fb4", + "query_ordinal": 158, + "query_timestamp": 1700004807000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "269d295cbc3d3384804fac3d9cbdfadcbb84115ed4b9790648c39d3ef79e8212", + "control_graph_rank_sha256": "ae6724d41aed48951301e40d1e816aa29d325005db98bf35c215bb4c068975ff", + "control_public_rank_sha256": "c1348b66b0d18813bd2eaddae26aaa0eafd5816cfa1ca07815950d79bd097bf6", + "control_seed_rank_sha256": "269d295cbc3d3384804fac3d9cbdfadcbb84115ed4b9790648c39d3ef79e8212", + "control_top1_age_events": 2484, + "control_top1_age_ms": 2484000, + "event_index": 4836, + "modality": "text", + "query_embedding_sha256": "d85a038830a3b5948df04e3a3c2525f62bfb564db9e67cf03c00e9a164e196dd", + "query_ordinal": 159, + "query_timestamp": 1700004836000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "164b3ffbe03780cef28bc5bb6e32a413e41e197893e549d0ec7147d1c17f5fd8", + "control_graph_rank_sha256": "5bc8dfd2f6e0ae8a4878a959162714463e164246974a777c8aacbd7b0fb4ac23", + "control_public_rank_sha256": "7c818e6d4e18758c4f43fd91f28d9c6f8f3f1eb44cc50e0ea77032f617765578", + "control_seed_rank_sha256": "164b3ffbe03780cef28bc5bb6e32a413e41e197893e549d0ec7147d1c17f5fd8", + "control_top1_age_events": 25, + "control_top1_age_ms": 25000, + "event_index": 4868, + "modality": "text", + "query_embedding_sha256": "59cf5577135585de3b3f1746ccde59a74680e7caba770c9ad820560f7de1fc4d", + "query_ordinal": 160, + "query_timestamp": 1700004868000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "53ac7db6ddb30f14a5fb3ffe90068e2dbdd496901552818dc491d5c7e1bec1b1", + "control_graph_rank_sha256": "74eb968f1a2521fcf1f270a7cbb0a9f3dc8defc019cf5eec10bffc20af3081f9", + "control_public_rank_sha256": "142a19a8738f19b9ea4d99f4d51c983711d52d8c2422a37809ca0305769302a2", + "control_seed_rank_sha256": "53ac7db6ddb30f14a5fb3ffe90068e2dbdd496901552818dc491d5c7e1bec1b1", + "control_top1_age_events": 1058, + "control_top1_age_ms": 1058000, + "event_index": 4899, + "modality": "text", + "query_embedding_sha256": "3f35a8cf88f8830e22257bd6a2c976845f3a47a16c9ec09207a1751aadefba54", + "query_ordinal": 161, + "query_timestamp": 1700004899000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "16751177e747bbffe17278626980afd212246155645b1b925c529d6348970533", + "control_graph_rank_sha256": "a9d09528f30b3be77d00fcf8d21f0cdd3f2e51358300b317d4b5a8ddd7e4e4e3", + "control_public_rank_sha256": "6197168d3bb669a9e919da54024690142638f0e59b831c4682403a038ac9ce6f", + "control_seed_rank_sha256": "16751177e747bbffe17278626980afd212246155645b1b925c529d6348970533", + "control_top1_age_events": 1878, + "control_top1_age_ms": 1878000, + "event_index": 4927, + "modality": "text", + "query_embedding_sha256": "c4bfb198c2a47cdec350669ef0bd5cbc92a388912a02ca26741c30c08415f372", + "query_ordinal": 162, + "query_timestamp": 1700004927000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "f4b6b105d742d64263b7f7c2c3dc8b360168056d21ae168bf7bf498a9e731850", + "control_graph_rank_sha256": "9a747cdea134835729388c3495a7a0282f10544aa149584e81eca05a4625825b", + "control_public_rank_sha256": "8b565774faad62bca3e9bff485d28e97bc419f175abe31a753118b44f93a2ae2", + "control_seed_rank_sha256": "f4b6b105d742d64263b7f7c2c3dc8b360168056d21ae168bf7bf498a9e731850", + "control_top1_age_events": 2607, + "control_top1_age_ms": 2607000, + "event_index": 4959, + "modality": "text", + "query_embedding_sha256": "eac1142a3a53cc5f8bb5b6cd3d2bf818c1045be78875223569bf6efb4603ccaa", + "query_ordinal": 163, + "query_timestamp": 1700004959000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "fb1b4f9031730885f75f8148205e37a6762ea48f0833d744c65f1baa2aed0374", + "control_graph_rank_sha256": "31553e20b0e90ef2cba0d79ed8e65a6447e727d39e2372ee5dcec863709fe04a", + "control_public_rank_sha256": "de75d2530f5f57d7158ebdc31cc6c6c52ce703f3a691d1c64b0c2e9dfe7a7a41", + "control_seed_rank_sha256": "fb1b4f9031730885f75f8148205e37a6762ea48f0833d744c65f1baa2aed0374", + "control_top1_age_events": 145, + "control_top1_age_ms": 145000, + "event_index": 4988, + "modality": "text", + "query_embedding_sha256": "89e4ec0e4ffee48c0b2bc82cd0a6fabbec9d3cdb05a765ef88666ab8cc474441", + "query_ordinal": 164, + "query_timestamp": 1700004988000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "dd117126ae141a84b3bd7fc68448093b29ad9b4f03b7909dc2ad8b3b6f68f673", + "control_graph_rank_sha256": "bc77d3d503f62960c727e353caabb1a965691230e8c63668b12545be309705cf", + "control_public_rank_sha256": "9b2cb649cff886ca5f2fc49a152e9923a12bfb491e8ee7140d5104697caf7c7f", + "control_seed_rank_sha256": "dd117126ae141a84b3bd7fc68448093b29ad9b4f03b7909dc2ad8b3b6f68f673", + "control_top1_age_events": 24, + "control_top1_age_ms": 24000, + "event_index": 5017, + "modality": "text", + "query_embedding_sha256": "e99495e6171194585878970cf9b0aba7a75529e1f2c1f909ab91d34793b88c7e", + "query_ordinal": 165, + "query_timestamp": 1700005017000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "f70ad820046247372fadb5e203b5e1d7e507127eddc4f7d93870709cefa0e7dc", + "control_graph_rank_sha256": "991f05ca0da9bd77b314b88ebdc1f2ccf6af48427d2b5595f846b4e966cd7ce2", + "control_public_rank_sha256": "d2104727e53bbd675e96773d1b5c1c5d9fab1a3b6e075f76f58b7f245d60b6d5", + "control_seed_rank_sha256": "f70ad820046247372fadb5e203b5e1d7e507127eddc4f7d93870709cefa0e7dc", + "control_top1_age_events": 652, + "control_top1_age_ms": 652000, + "event_index": 5053, + "modality": "text", + "query_embedding_sha256": "e1406ba3e4effafa53425ebf9c225eccb5e0392e92a3e4676fcfff7e835a26e8", + "query_ordinal": 166, + "query_timestamp": 1700005053000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "d083783df5d4e62a093aa4f204fafbdd545f90544621b794ddd1ad7f551b4960", + "control_graph_rank_sha256": "2181e098ccc1f553ca00c2e0ef7b8c96a8e5b46ae9dc165ff5d0623a3d26450e", + "control_public_rank_sha256": "7163a063c0de0f72b21bcd91438c2043ce844aaad603af7dd565925e139f211a", + "control_seed_rank_sha256": "d083783df5d4e62a093aa4f204fafbdd545f90544621b794ddd1ad7f551b4960", + "control_top1_age_events": 681, + "control_top1_age_ms": 681000, + "event_index": 5082, + "modality": "text", + "query_embedding_sha256": "214cbc4e41a6d4ffb7aeb4ed288c430c85bc1d71113e90ebe74ea258f56af18b", + "query_ordinal": 167, + "query_timestamp": 1700005082000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "14c8b23d12111a0663d63351bb85ed54f156bc87ef0360af0bf2ff858800e2b2", + "control_graph_rank_sha256": "9188c8aba0383040a1a7f7d773749c6b4527f51be2f786487296e691310321ba", + "control_public_rank_sha256": "b5fe2f48149dcda5fff46c390e079291bd50ed2225486f606df3b52244e70d05", + "control_seed_rank_sha256": "14c8b23d12111a0663d63351bb85ed54f156bc87ef0360af0bf2ff858800e2b2", + "control_top1_age_events": 479, + "control_top1_age_ms": 479000, + "event_index": 5116, + "modality": "text", + "query_embedding_sha256": "43d72af3d473115c8b34901e183ec73e0174dcb8d9d80c73dbf82905ab6fbe21", + "query_ordinal": 168, + "query_timestamp": 1700005116000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "26d8c967bde5c60b7f4a54b83ee19e7b140edb826db539de77dc3200e0a0c4de", + "control_graph_rank_sha256": "bf4b01573c33990f8523918606b4901a54b4436aa18143d7585f87ad0d809927", + "control_public_rank_sha256": "ab917a8fd682edd8cf11266ba19a53f9abc218a5f3a9be79c4bfd46909b34c89", + "control_seed_rank_sha256": "26d8c967bde5c60b7f4a54b83ee19e7b140edb826db539de77dc3200e0a0c4de", + "control_top1_age_events": 2000, + "control_top1_age_ms": 2000000, + "event_index": 5145, + "modality": "text", + "query_embedding_sha256": "9bb73dbb1b86a60066798c9a5bd90df0dd405f0da16e869db70893a54f102f39", + "query_ordinal": 169, + "query_timestamp": 1700005145000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "9137efe54a78f8e4fa83e2fe676869ead40eb81b29bb49522362fd543aa4d046", + "control_graph_rank_sha256": "893be655c2884048b942b75547ab6019fc88140e52f4fe629a6ef7ad92c19470", + "control_public_rank_sha256": "0934cd59695d59bc6664b47397fce6d7ba4300a591db520b2aa3059d56e8d7af", + "control_seed_rank_sha256": "9137efe54a78f8e4fa83e2fe676869ead40eb81b29bb49522362fd543aa4d046", + "control_top1_age_events": 104, + "control_top1_age_ms": 104000, + "event_index": 5175, + "modality": "text", + "query_embedding_sha256": "8d8137d48a403a9b9a1dafba63ab29db82b0d189cc6badc68756ce360998f8dd", + "query_ordinal": 170, + "query_timestamp": 1700005175000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "f410ea8affa220d9d8ae5f75476a3fb55aab698c7ffc30585c51ffe813cfa6bf", + "control_graph_rank_sha256": "7fef3b632de3e1023bdeebcd6c63c295ac5964471fa904e3688b205a1a6dcad4", + "control_public_rank_sha256": "2d854523c1257798b1f3e54c94e7f595b6f9dc07b61edede2a4cbdfa592656fc", + "control_seed_rank_sha256": "f410ea8affa220d9d8ae5f75476a3fb55aab698c7ffc30585c51ffe813cfa6bf", + "control_top1_age_events": 1466, + "control_top1_age_ms": 1466000, + "event_index": 5206, + "modality": "text", + "query_embedding_sha256": "d711b2f8f4a4f0393248e063d67e2bd77ccb23647e6c9419684aa9a3491a9c38", + "query_ordinal": 171, + "query_timestamp": 1700005206000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "93d13596263865f40bc69e1ef323352531b0e430c828e01ba1687b9d30bbc125", + "control_graph_rank_sha256": "588b6feb0842217e9e44b711e08c9b60def2f37a76e6c54c1be55bbc2bfb3594", + "control_public_rank_sha256": "25ecdb6ef9ede63a2c4db90ddcdeee97d3df3e85cb73b5599c5bd7bb3385eaf1", + "control_seed_rank_sha256": "93d13596263865f40bc69e1ef323352531b0e430c828e01ba1687b9d30bbc125", + "control_top1_age_events": 2668, + "control_top1_age_ms": 2668000, + "event_index": 5234, + "modality": "text", + "query_embedding_sha256": "ed0586a34d272a6475ca8825e32fca39ddb1cf5dd1303ddd2d606cad86ed0752", + "query_ordinal": 172, + "query_timestamp": 1700005234000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "6dbd702cc734470ca5529dfc73ccd052303b4be56aad29140592011e5c154e44", + "control_graph_rank_sha256": "eb5c8e340e93a2ae078a7ffd2013831ca894af1d3d15cc9bb28f35f7d27fd77c", + "control_public_rank_sha256": "2ce47ddbf7e2a912b8f0f995e8ad7a8452a8f5f6a6a21ce3a6506ae05d1b0404", + "control_seed_rank_sha256": "6dbd702cc734470ca5529dfc73ccd052303b4be56aad29140592011e5c154e44", + "control_top1_age_events": 5142, + "control_top1_age_ms": 5142000, + "event_index": 5265, + "modality": "text", + "query_embedding_sha256": "5024d86b0f4b9652217152daf7125a5d77b5dc4f7f9ed83dfdb01da5e74c0087", + "query_ordinal": 173, + "query_timestamp": 1700005265000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "6c74d6f6cd9ef0cac302ac533ad397f4b453a1829f5419cb0955dc0edd3d5e84", + "control_graph_rank_sha256": "797a46b0ba88ad5be50ccdd4923b15edc9d8654e656cbe4ea08a7ac706d691bf", + "control_public_rank_sha256": "c1a85306bf5f21ca2d38d035dead1a5b27ddadcdbd5f64f5bd7a1f83b42bc2b9", + "control_seed_rank_sha256": "6c74d6f6cd9ef0cac302ac533ad397f4b453a1829f5419cb0955dc0edd3d5e84", + "control_top1_age_events": 6, + "control_top1_age_ms": 6000, + "event_index": 5293, + "modality": "text", + "query_embedding_sha256": "46e5b1299d96fbbcda3bff69cb4ba969023491c73a0ee9eb1b7f88f303eedba8", + "query_ordinal": 174, + "query_timestamp": 1700005293000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "87923fec2d553430078d80bcc24ca424c27db6827f13d62afecfae14846fbb90", + "control_graph_rank_sha256": "220c4a0380f3600fedced721124499815251b058b2368021ae59b9e572349236", + "control_public_rank_sha256": "d8eb0656076dfba5b0642b56748873bdf4d52842695cd6c62b05cd6021fd1953", + "control_seed_rank_sha256": "87923fec2d553430078d80bcc24ca424c27db6827f13d62afecfae14846fbb90", + "control_top1_age_events": 2140, + "control_top1_age_ms": 2140000, + "event_index": 5323, + "modality": "text", + "query_embedding_sha256": "1e4c673a465c342c259873efcd58bd3fe125c8fcd3cb093f21c161956cd34309", + "query_ordinal": 175, + "query_timestamp": 1700005323000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "0fb62e220b17e89e7ee821690f22c6e81921b02479fecbe2a018c6990f50b091", + "control_graph_rank_sha256": "b747aed0f76fcc6940fb3f08160124898c17b58156664d859ffc543994a73e47", + "control_public_rank_sha256": "6a6a594f423a7cdb51fd943b91a517830eaf6eaf0791b7187443ac27a9475417", + "control_seed_rank_sha256": "0fb62e220b17e89e7ee821690f22c6e81921b02479fecbe2a018c6990f50b091", + "control_top1_age_events": 873, + "control_top1_age_ms": 873000, + "event_index": 5353, + "modality": "text", + "query_embedding_sha256": "b95dad50fc4b6610cbfdf8a212e965510fcf0afc6a39accf8113334ce01d10c6", + "query_ordinal": 176, + "query_timestamp": 1700005353000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "112179154fe185dee0e2fbde3767840554ec480ad78e99624d792314583c114c", + "control_graph_rank_sha256": "2a94c6b78be25b4fd3a8ba0dadd356ab01c4cee935cd348c26ec712e3a161963", + "control_public_rank_sha256": "1855a9f67d650328b30f27b674f1159fc9eccceedeffe42cf164e401ba173fc2", + "control_seed_rank_sha256": "112179154fe185dee0e2fbde3767840554ec480ad78e99624d792314583c114c", + "control_top1_age_events": 23, + "control_top1_age_ms": 23000, + "event_index": 5392, + "modality": "text", + "query_embedding_sha256": "bdd54986909a4e19c916850980839ca8761c3282b448b3c6fb0eac8038e7adf8", + "query_ordinal": 177, + "query_timestamp": 1700005392000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "111b3b991005b7e46b95cb26db5c4f6584dd6ccc56ac262d70fb63abc5088f4c", + "control_graph_rank_sha256": "a8d8f2dfb9008a86ccbdb4be7a3425cb2c07d905a3aa673e0da68905eabcf64e", + "control_public_rank_sha256": "07e7780b83c0328a6813a2d6f0d7f936fe5618aa2c3a527f0c416b6118b4c706", + "control_seed_rank_sha256": "111b3b991005b7e46b95cb26db5c4f6584dd6ccc56ac262d70fb63abc5088f4c", + "control_top1_age_events": 2859, + "control_top1_age_ms": 2859000, + "event_index": 5425, + "modality": "text", + "query_embedding_sha256": "86897db10d50e960a6c0ee9748a0bb1b71dd9fd67e6273316522391ff3f8b7bc", + "query_ordinal": 178, + "query_timestamp": 1700005425000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "b3d642538afbaf7d2458c3c8a590f1feb228f975398e7bb58cccfc33afd4497c", + "control_graph_rank_sha256": "0be4eadb3f19b543b4e6425a7f096e75699b1aa482b5eb5571fce86e67131e47", + "control_public_rank_sha256": "be679b1894c4b915547706ca032e0ab39f4d941f5e2a11015e0eced3a52ff21b", + "control_seed_rank_sha256": "b3d642538afbaf7d2458c3c8a590f1feb228f975398e7bb58cccfc33afd4497c", + "control_top1_age_events": 533, + "control_top1_age_ms": 533000, + "event_index": 5456, + "modality": "text", + "query_embedding_sha256": "66eb1ffddeba04aa5dbdc1c9c1da05ac38577270c18e53e0d31a4ecddf18c5a7", + "query_ordinal": 179, + "query_timestamp": 1700005456000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "c17eb1ee60691eb33faecd29aecb1eff43cd2813700596afcd3ea28f0f981235", + "control_graph_rank_sha256": "d05c3ae76ec36c7c807cee2c6b536a6dea6e42be40b77cfb857d766d8efe6674", + "control_public_rank_sha256": "6e5f9315241af6b043774a36c1b0d60df006efbe8d5afff34583c1050550d8df", + "control_seed_rank_sha256": "c17eb1ee60691eb33faecd29aecb1eff43cd2813700596afcd3ea28f0f981235", + "control_top1_age_events": 16, + "control_top1_age_ms": 16000, + "event_index": 5488, + "modality": "text", + "query_embedding_sha256": "d809039c91f9e6b3abd29a0ef69ca327ac22a13cce7ab48a6287ba6af9fa334d", + "query_ordinal": 180, + "query_timestamp": 1700005488000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "1f661739fe4f93ded8a30cf7b3904388ae29f227443b878d59e2858adb91d7c1", + "control_graph_rank_sha256": "f299e3a0e396f578a20a732c539dccbb8cd67c0a2b5af9d979b9f2647a18bf57", + "control_public_rank_sha256": "eadca4a7cfcc07ebfec6e34c49884a190f4927a16a17361ff936238d41249eba", + "control_seed_rank_sha256": "1f661739fe4f93ded8a30cf7b3904388ae29f227443b878d59e2858adb91d7c1", + "control_top1_age_events": 2574, + "control_top1_age_ms": 2574000, + "event_index": 5517, + "modality": "text", + "query_embedding_sha256": "4dc0a9702f5128cdc979900d2f8b4b63cf2df832fb2f8648949e9ab60c78bb2d", + "query_ordinal": 181, + "query_timestamp": 1700005517000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "e1af86b7fb4d6357e01a570a194581ed62c91a6c9a8e466b87f3dd97c442ff55", + "control_graph_rank_sha256": "5d24f2c8336d61f3c9f7d861e8e476ae4dde8b712d93d94f6635cac10b7a4070", + "control_public_rank_sha256": "49d2bb704220d7f1fdeb6b8fccb5a35ca67597cf3b5b28b0268b69ba31d67e35", + "control_seed_rank_sha256": "e1af86b7fb4d6357e01a570a194581ed62c91a6c9a8e466b87f3dd97c442ff55", + "control_top1_age_events": 23, + "control_top1_age_ms": 23000, + "event_index": 5549, + "modality": "text", + "query_embedding_sha256": "7ab88489c28d88fd7998f28356ec2f01e2cebc5d09d37266e42f020278294a89", + "query_ordinal": 182, + "query_timestamp": 1700005549000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "e6ada32bc3c7ae2353ac96f908d4d718cbf9542ff1f8670cdbddde8d3bb95386", + "control_graph_rank_sha256": "1c1a83b173b5b36bc182c6fe2c1f415e0c4f05f18cb30a9a0d85473baa7c1a82", + "control_public_rank_sha256": "b48a36d9323d1d00c5a5973d2209742266d33034674a593ca174ebf42f2c80df", + "control_seed_rank_sha256": "e6ada32bc3c7ae2353ac96f908d4d718cbf9542ff1f8670cdbddde8d3bb95386", + "control_top1_age_events": 3294, + "control_top1_age_ms": 3294000, + "event_index": 5577, + "modality": "text", + "query_embedding_sha256": "a8b81e0ac887d6fafadedfb5e23bbd3fea78d5a8c3ffed919f8851e7adb3cdd7", + "query_ordinal": 183, + "query_timestamp": 1700005577000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "3348808a0587480443c2427cecc291dd1469c0bc8e32c1fdab8af0acce1162a3", + "control_graph_rank_sha256": "0e11ea57af846514e0d35599ff55ea466679680d222095b85ff265812c9a3815", + "control_public_rank_sha256": "bf7cdb940b8c096c8722717d834b3243219cc6ecb9840cc969311bb9cdef2666", + "control_seed_rank_sha256": "3348808a0587480443c2427cecc291dd1469c0bc8e32c1fdab8af0acce1162a3", + "control_top1_age_events": 59, + "control_top1_age_ms": 59000, + "event_index": 5612, + "modality": "text", + "query_embedding_sha256": "778dc527b7fd6598bc3f632298233277a85d672da11844b661f2bcb788613c90", + "query_ordinal": 184, + "query_timestamp": 1700005612000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "93a5836c74e09fe51dd8acd1b563682fe665d82eaa4f984c289c2fcd0a2369ea", + "control_graph_rank_sha256": "fa0fbc17c643127eaf29ce865eb50ae886f7c4e1f55a56e1571a77c80d18e2cf", + "control_public_rank_sha256": "f582bd98d0bfba24eb75eaf1b54618b2821665a5d407cd41b4a44213956650e6", + "control_seed_rank_sha256": "93a5836c74e09fe51dd8acd1b563682fe665d82eaa4f984c289c2fcd0a2369ea", + "control_top1_age_events": 719, + "control_top1_age_ms": 719000, + "event_index": 5642, + "modality": "text", + "query_embedding_sha256": "c9752a5774affa34cacd2e657a1e656b651c81ab2f1101026d1e1fe75619e35b", + "query_ordinal": 185, + "query_timestamp": 1700005642000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "37fca1e2f46244dac3c2550c33226f0065ac6078312ea9615ee9dac9a82c8f6f", + "control_graph_rank_sha256": "acbbc965e1fdee54d2d543b0e47f411bde730fa1d98ee4df6cac196db1adc30d", + "control_public_rank_sha256": "0410ddae5ad9969ee7e24d99763828a1dcc04393bbdfaadc16956b2cb1daffeb", + "control_seed_rank_sha256": "37fca1e2f46244dac3c2550c33226f0065ac6078312ea9615ee9dac9a82c8f6f", + "control_top1_age_events": 31, + "control_top1_age_ms": 31000, + "event_index": 5678, + "modality": "text", + "query_embedding_sha256": "cb7296befc25782f936bce76b42700b878517252c2de74e02aa4e36ebf3b953d", + "query_ordinal": 186, + "query_timestamp": 1700005678000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "dba9d3702b19c733086b308bf3dc957d67a81ed3303e525ed4218608310fb631", + "control_graph_rank_sha256": "5aad7976de2e93c93e5eaa6083935e91fbfcd098a7dbc9e4da49fe50ba0d6a39", + "control_public_rank_sha256": "dd2b3b1febecb31231ba94bd2565946e5f0d3d1ad0bec0f238f45e4c81ef07f7", + "control_seed_rank_sha256": "dba9d3702b19c733086b308bf3dc957d67a81ed3303e525ed4218608310fb631", + "control_top1_age_events": 111, + "control_top1_age_ms": 111000, + "event_index": 5706, + "modality": "text", + "query_embedding_sha256": "a74a4237f3c79407c95fde3607ab6e5ed7cac1133d3a016646f7d81b65cf7a95", + "query_ordinal": 187, + "query_timestamp": 1700005706000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "32e19d90e44df7f05bf1d5c292d2f210341b2691cf3c755df35c9c1929dcd70c", + "control_graph_rank_sha256": "ea21ca047de41f1bf313fd61f6f6ee30ed0bd64fd1ac4c86a13197fc7c01ecf3", + "control_public_rank_sha256": "c878d1e2b19384b4de891b382dacef6cc49b43762c443d984433ed285091e71c", + "control_seed_rank_sha256": "32e19d90e44df7f05bf1d5c292d2f210341b2691cf3c755df35c9c1929dcd70c", + "control_top1_age_events": 167, + "control_top1_age_ms": 167000, + "event_index": 5738, + "modality": "text", + "query_embedding_sha256": "6af94503266d83f1b39dc886776126f47b3e40bedfb56fd7bd561b8e155e198b", + "query_ordinal": 188, + "query_timestamp": 1700005738000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "aae7b9ff83bbd5fcfedd6a075e866f5a8965a27c7c75df290b4981439de91537", + "control_graph_rank_sha256": "ffb5207652fac16210e58694beb18ac1500c056d5071024413a41ca2ace115d9", + "control_public_rank_sha256": "05f65f00abd96c91a48db263efc6668868aea500071ca761e6c332e6f6da7a6e", + "control_seed_rank_sha256": "aae7b9ff83bbd5fcfedd6a075e866f5a8965a27c7c75df290b4981439de91537", + "control_top1_age_events": 2670, + "control_top1_age_ms": 2670000, + "event_index": 5767, + "modality": "text", + "query_embedding_sha256": "1fd12fe0e2e3d22b006d207a4cdeb761421bd015e21de73d4cf6acf4dfe484bc", + "query_ordinal": 189, + "query_timestamp": 1700005767000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "227a722aa5afba0af7163f5fa218bb06cce7b9c35244f9bc067c38b08502f1cc", + "control_graph_rank_sha256": "3dc6467c5ed824441b3f9bbeec9e850eb361cc4042742f7a39b50c46162c94a1", + "control_public_rank_sha256": "3c52a85cd9af6cd4c42c90dae1c42219799a3665822de5cdb6f9761c44c48089", + "control_seed_rank_sha256": "227a722aa5afba0af7163f5fa218bb06cce7b9c35244f9bc067c38b08502f1cc", + "control_top1_age_events": 5, + "control_top1_age_ms": 5000, + "event_index": 5793, + "modality": "text", + "query_embedding_sha256": "66517dccc659389fd43651a29adfcea4b3f3e477f6f9c8cdbac18e04399c1f41", + "query_ordinal": 190, + "query_timestamp": 1700005793000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "c4847cd17c600d5685d2ed09a1da60fe0385cf5c8787d79de6fea2cf0583111b", + "control_graph_rank_sha256": "f79d7dd929b5247111b21a2f2e491f63725fb59820e61cd562bce298ff1daf9e", + "control_public_rank_sha256": "879afb678ae11c34797f0d4c336875fc93d0a5e8da24adb944c3dff23e1201d1", + "control_seed_rank_sha256": "c4847cd17c600d5685d2ed09a1da60fe0385cf5c8787d79de6fea2cf0583111b", + "control_top1_age_events": 1053, + "control_top1_age_ms": 1053000, + "event_index": 5824, + "modality": "text", + "query_embedding_sha256": "0185fa14a89e68c97e7906a3b1a193aca2f90858aeadb110b49e382480e4e642", + "query_ordinal": 191, + "query_timestamp": 1700005824000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "1393eb5637ffcb3d0b1ee6dc785ad97911f08aac7d0fb115051f0ec0e38cbcd6", + "control_graph_rank_sha256": "2713ca3fbe003a01540dfdc0a132b7b42ce8116b95b9fdc37987175ee94364cd", + "control_public_rank_sha256": "15c1c3fcadd768870c54b9b651ec1bc3a7ebdead5706900a4fc91c531f91a915", + "control_seed_rank_sha256": "1393eb5637ffcb3d0b1ee6dc785ad97911f08aac7d0fb115051f0ec0e38cbcd6", + "control_top1_age_events": 8, + "control_top1_age_ms": 8000, + "event_index": 5851, + "modality": "text", + "query_embedding_sha256": "83c1ae32a8a2d737e955ec36155879ed3bb260bebb164a7580ce95708373771e", + "query_ordinal": 192, + "query_timestamp": 1700005851000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "25bc4e0c2cb2983737994094275085a166a0ecd07651d13e77a5e8b9c2f4d8d0", + "control_graph_rank_sha256": "3f3674375740dc2c13840f4e35a0be62178f084168f5e1d94cef66ceedba9020", + "control_public_rank_sha256": "c45715643f2ae39ef819787d2aedd21b47731fb9fffaad818ca398df8723cd21", + "control_seed_rank_sha256": "25bc4e0c2cb2983737994094275085a166a0ecd07651d13e77a5e8b9c2f4d8d0", + "control_top1_age_events": 3595, + "control_top1_age_ms": 3595000, + "event_index": 5878, + "modality": "text", + "query_embedding_sha256": "db06be69ddfacabf2f1434ef1b40efe9bf277b18ccc85aae85902251b42620f2", + "query_ordinal": 193, + "query_timestamp": 1700005878000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "1d0229efe201664415211099155665cf4fb9f4bcfb6d952ec797e664559b085a", + "control_graph_rank_sha256": "e025057cb31a643fdfb3b772aa29194327c43f6ad6fb18be67936f0b5949bf38", + "control_public_rank_sha256": "dab97ed1d527373d7a86aa414e7c2243580e4c695de0f634dd87be4d5695c740", + "control_seed_rank_sha256": "1d0229efe201664415211099155665cf4fb9f4bcfb6d952ec797e664559b085a", + "control_top1_age_events": 3487, + "control_top1_age_ms": 3487000, + "event_index": 5907, + "modality": "text", + "query_embedding_sha256": "0c21b6e96e779ce6efcc93491e28cb6ec5621407bf2d69d3d2df3d9d7c96982e", + "query_ordinal": 194, + "query_timestamp": 1700005907000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "99c37c40ff555713a16f02142aa26b478cd594fd9171efa9a64f0950e90154cb", + "control_graph_rank_sha256": "5a5259debb85b3a9bebb27483af69918d7e588748337152f54ff29fe85ed1e90", + "control_public_rank_sha256": "b78627e82ca26f1eb9ffd1572422e33a5dd1c59bcc927c2728e951ac9b5b7b8e", + "control_seed_rank_sha256": "99c37c40ff555713a16f02142aa26b478cd594fd9171efa9a64f0950e90154cb", + "control_top1_age_events": 4634, + "control_top1_age_ms": 4634000, + "event_index": 5934, + "modality": "text", + "query_embedding_sha256": "24c50cb9c260738a85963f43ca2d9e469b17e06c03b7dc388a80d4c0433e284b", + "query_ordinal": 195, + "query_timestamp": 1700005934000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "c19034b1a7e57eabd9526eeace6487f107575e46b2d74daeaef054d8f78fb487", + "control_graph_rank_sha256": "b5c0732a2979fe13a87a9ef7c7c53276e493120b51a59408765cb3c8cdb534a2", + "control_public_rank_sha256": "5618f940313b665edfd9fe6b63ee0d01c9f3bd27fb97a936923738e8a68b1218", + "control_seed_rank_sha256": "c19034b1a7e57eabd9526eeace6487f107575e46b2d74daeaef054d8f78fb487", + "control_top1_age_events": 5156, + "control_top1_age_ms": 5156000, + "event_index": 5968, + "modality": "text", + "query_embedding_sha256": "106cc600c95e36868f3652f38b3a8c720ad5a49c97c9242b37d2a195ff71ad23", + "query_ordinal": 196, + "query_timestamp": 1700005968000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "c999fd5d7a6260d79d0236a0caec75cfd55ba0aa97f1c1270aee0edd6d5687ad", + "control_graph_rank_sha256": "8ec8749ad6081a0a083217f3cfcef464902c01f548b594b26f35ed0e54e3a3e5", + "control_public_rank_sha256": "ec44b5d7184dd568888e7b0a13256bbdac63c5343301e6d834017090b65362bc", + "control_seed_rank_sha256": "c999fd5d7a6260d79d0236a0caec75cfd55ba0aa97f1c1270aee0edd6d5687ad", + "control_top1_age_events": 1226, + "control_top1_age_ms": 1226000, + "event_index": 5997, + "modality": "text", + "query_embedding_sha256": "e72e9e57b26fdc4b92d74374501621b8307b0de7d26c4bdc918631a50383bd26", + "query_ordinal": 197, + "query_timestamp": 1700005997000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "f9a3ac12dce02b66122204531ff03cbb0e1bce5ef4ee2f444aa721beb62de11c", + "control_graph_rank_sha256": "8e6f6b4c9568b9c434ed513558bccab3c56c83c96c4346fc6c7628b8b1c9bc5b", + "control_public_rank_sha256": "73248b697eb935070b9ef664c6e273556d1d7f93094edb95deba509abba31a14", + "control_seed_rank_sha256": "f9a3ac12dce02b66122204531ff03cbb0e1bce5ef4ee2f444aa721beb62de11c", + "control_top1_age_events": 3907, + "control_top1_age_ms": 3907000, + "event_index": 6026, + "modality": "text", + "query_embedding_sha256": "e7f958af4ce82cc634def1f9f7169b1e014b128e3ffdeb6bb9aa437193d9568b", + "query_ordinal": 198, + "query_timestamp": 1700006026000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "22191ff93f741860b00ad97b3f598e95e249912346c0eedc22647d9119dbd569", + "control_graph_rank_sha256": "01e05240d0fbd1a80b67de0d0408400f47b13944cfcd410be5e13bae20c771e9", + "control_public_rank_sha256": "5539d434b665b1b348b962dd3084628bae26a4af483593a77141e22433bef256", + "control_seed_rank_sha256": "22191ff93f741860b00ad97b3f598e95e249912346c0eedc22647d9119dbd569", + "control_top1_age_events": 3777, + "control_top1_age_ms": 3777000, + "event_index": 6060, + "modality": "text", + "query_embedding_sha256": "db06be69ddfacabf2f1434ef1b40efe9bf277b18ccc85aae85902251b42620f2", + "query_ordinal": 199, + "query_timestamp": 1700006060000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "8b8c3002b54444162b2c1efa239b1405df6afe53ea97ebe3b72ca6df140130fb", + "control_graph_rank_sha256": "bcd3bb999e24b7f7d4e19e8fb7a59edcd9dffa8395f340195d987769f8e439ac", + "control_public_rank_sha256": "521e29fd7e8336a09912f2752af92c734739b5ea714324072455426f41b394b0", + "control_seed_rank_sha256": "8b8c3002b54444162b2c1efa239b1405df6afe53ea97ebe3b72ca6df140130fb", + "control_top1_age_events": 2349, + "control_top1_age_ms": 2349000, + "event_index": 6089, + "modality": "text", + "query_embedding_sha256": "5f6b0cd07fb0bc610cd1adcb33ec99116418cc531ea9df87cf82c60b3c542848", + "query_ordinal": 200, + "query_timestamp": 1700006089000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "c3ad744d7abbae05ce910db45919375df2026292ae98321a07635ab5b345f5ec", + "control_graph_rank_sha256": "7023662d2eb0e8c1c36cfb66994642b4a5fa413957bc06a725ef095044b0ec3b", + "control_public_rank_sha256": "24d93fa238d1c4aba7f8ecb3e41f2f455f6f0ca88074ce6202b7e010e60172b8", + "control_seed_rank_sha256": "c3ad744d7abbae05ce910db45919375df2026292ae98321a07635ab5b345f5ec", + "control_top1_age_events": 2921, + "control_top1_age_ms": 2921000, + "event_index": 6119, + "modality": "text", + "query_embedding_sha256": "1968af6d01e2f259785a01df98790ff3ab7f4a9c3ab86add89cf4ad4dfba6dca", + "query_ordinal": 201, + "query_timestamp": 1700006119000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "a80d68d9762de84c32defa109381456df723b1caaa2ab110ac27ec626fe41f89", + "control_graph_rank_sha256": "59c6e2bfc823b978acb0ad93962b6536f9c97f7c147fc9d69d671d5710b480ca", + "control_public_rank_sha256": "7aedfa5736ecc4297c566bd575bc689bbc6c87abfa35fddc4a2505556ff63451", + "control_seed_rank_sha256": "a80d68d9762de84c32defa109381456df723b1caaa2ab110ac27ec626fe41f89", + "control_top1_age_events": 131, + "control_top1_age_ms": 131000, + "event_index": 6152, + "modality": "text", + "query_embedding_sha256": "022ff73a54ac936489a8f2fd8084c6a4cd76280ce4e8ee3c7853bd669057270c", + "query_ordinal": 202, + "query_timestamp": 1700006152000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "b8cbce0d18870e2c540a1a98d9ac0082d67e444cd32cedd900a9bdbea9ed598e", + "control_graph_rank_sha256": "37420b97b668e91f39fb06b15914bcbdba3aa14460ca4dfb1d24af48748e5faa", + "control_public_rank_sha256": "1fb2419e91b2c0be46d17ce3186bbd11a7b565fa1b4496dd17dab34cd3607ab0", + "control_seed_rank_sha256": "b8cbce0d18870e2c540a1a98d9ac0082d67e444cd32cedd900a9bdbea9ed598e", + "control_top1_age_events": 3, + "control_top1_age_ms": 3000, + "event_index": 6188, + "modality": "text", + "query_embedding_sha256": "368e6b7a4b33e9ef11aa05a1107a39b2c72b2614476034f3cf0c75936abd02e3", + "query_ordinal": 203, + "query_timestamp": 1700006188000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "79b67ab1d2950a07dcee093019ad4fb4764dc0025350aa1bfd9a3b8ccc7b9653", + "control_graph_rank_sha256": "a11495a3d4346528facb2da65cb5e84309c61203e2ca51a47ea368be6b95979b", + "control_public_rank_sha256": "33f4eb401a44a75ccd33ccefd6e9d8327bc6a736b82e6525f26c0bb6d62975c1", + "control_seed_rank_sha256": "79b67ab1d2950a07dcee093019ad4fb4764dc0025350aa1bfd9a3b8ccc7b9653", + "control_top1_age_events": 3122, + "control_top1_age_ms": 3122000, + "event_index": 6219, + "modality": "text", + "query_embedding_sha256": "8d1510e84fc7cdd3b04a3055ec4066d661e5ca0ccd3d7e2aa78a059fdc382255", + "query_ordinal": 204, + "query_timestamp": 1700006219000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "15fec818bcb466da846965414a64cb7f8df41935b56a56d8f5263db6ddc0a1e6", + "control_graph_rank_sha256": "b69b285c67c7d983ea3d4103d91a20d1d1fa33e3031c118dd0e633aebaa47179", + "control_public_rank_sha256": "ccb28048a9c4b187fa4696d1828c430f8b05962bcbfc406cab3b51aa985c68b9", + "control_seed_rank_sha256": "15fec818bcb466da846965414a64cb7f8df41935b56a56d8f5263db6ddc0a1e6", + "control_top1_age_events": 3056, + "control_top1_age_ms": 3056000, + "event_index": 6248, + "modality": "text", + "query_embedding_sha256": "e735a22268f61168faf93c7f22ae6475e8754538cd8dcc8c134375741cc98fc9", + "query_ordinal": 205, + "query_timestamp": 1700006248000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "54cf375fd1c8d56c29d43361651b7b03a7e634486de1ac4e8b9097c7b1a4af54", + "control_graph_rank_sha256": "1485aee8a50f2aea1de4c1d3e4b51bf49436d9c5583f1c16b332fe6061fda3fd", + "control_public_rank_sha256": "39f1e78eb9ca59eb4a21424342afb63d21be4550937294c839fbc4338a6601a1", + "control_seed_rank_sha256": "54cf375fd1c8d56c29d43361651b7b03a7e634486de1ac4e8b9097c7b1a4af54", + "control_top1_age_events": 22, + "control_top1_age_ms": 22000, + "event_index": 6281, + "modality": "text", + "query_embedding_sha256": "f022a18de0de05dcdc66a3d1d2a90133200c498b44d93881f0040c3c04163046", + "query_ordinal": 206, + "query_timestamp": 1700006281000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "8da2878657396858dfede5dd4e8c24d0988e65b9f265ed59d7f54e2fd212fdb9", + "control_graph_rank_sha256": "f8f5281623e1e5b9db83a8e78b7c6d59913f4d2139cc5473f14f01546cecab7a", + "control_public_rank_sha256": "62d031a54bfbf914bd501b0503db788bf12b246a878dd0b53005fdca3946394a", + "control_seed_rank_sha256": "8da2878657396858dfede5dd4e8c24d0988e65b9f265ed59d7f54e2fd212fdb9", + "control_top1_age_events": 50, + "control_top1_age_ms": 50000, + "event_index": 6309, + "modality": "text", + "query_embedding_sha256": "c38c80ae18dc74dba839fe70327690160676226015433775abc66cd0312a4a56", + "query_ordinal": 207, + "query_timestamp": 1700006309000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "e98b1c62feb688aa9f8234a7fe339a187dbb177e2c355fe7f900858caff584a6", + "control_graph_rank_sha256": "3a9f0c3375869d13ae17c5e34c3b1ecf93f77602b307cbaf855c32ffed8b66e1", + "control_public_rank_sha256": "80163b3c463af8ff6350ab374ecabdca0e29e306560d0a175ecc728bc5799117", + "control_seed_rank_sha256": "e98b1c62feb688aa9f8234a7fe339a187dbb177e2c355fe7f900858caff584a6", + "control_top1_age_events": 470, + "control_top1_age_ms": 470000, + "event_index": 6341, + "modality": "text", + "query_embedding_sha256": "27c4b37d1d0566084a856719f7c7d1c758722c35f492608e9002b84612dd0642", + "query_ordinal": 208, + "query_timestamp": 1700006341000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "93ee880cc6b64fb2f6cf3ceb845853bdf14869bf43c4607cd75ca14355bc6583", + "control_graph_rank_sha256": "575277e7fa25e4af5b91f607ebc885f10e5ffabf9a5bd7af5d2c9ddbe3efb08e", + "control_public_rank_sha256": "1e6a805b59bd8e6fa964bb80a66759bfe69dbdd88c407a85937b1d62fe3a32c5", + "control_seed_rank_sha256": "93ee880cc6b64fb2f6cf3ceb845853bdf14869bf43c4607cd75ca14355bc6583", + "control_top1_age_events": 4202, + "control_top1_age_ms": 4202000, + "event_index": 6368, + "modality": "text", + "query_embedding_sha256": "a9b10c8e062ca9e6ea2c852c9c543570b371504728e8697bdcf7fa74210c42fa", + "query_ordinal": 209, + "query_timestamp": 1700006368000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "89acb77936bd3c4a9d63b6aafabfe549c58756785443b0d9243093601c77c0f3", + "control_graph_rank_sha256": "fd07aaa6a3365f516831b60cb510d8dcfeb5f59e378e2671d3aa87029784cbb4", + "control_public_rank_sha256": "4628e6dd085f9d47b66e2fd98aff71aba9d071e4f890c0a7bf3365739561ed3e", + "control_seed_rank_sha256": "89acb77936bd3c4a9d63b6aafabfe549c58756785443b0d9243093601c77c0f3", + "control_top1_age_events": 4906, + "control_top1_age_ms": 4906000, + "event_index": 6401, + "modality": "text", + "query_embedding_sha256": "40fe75cf3fe7a21bd2c8c3c6e5c4162d8ea450488818ac1416b637e56c3bb7c9", + "query_ordinal": 210, + "query_timestamp": 1700006401000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "497b3109a3ce307e046f11784f570c7cee36ec3785c7954967f04db8b708d0f8", + "control_graph_rank_sha256": "2727a6619a0a53b0a0f57c2190bd771f55c3ebdc2aacec8cba018dbbb8c003f7", + "control_public_rank_sha256": "b98af2b8e17a9386ce5b9b6e2363d61c3d075285335a37653a8578b8e80d72fc", + "control_seed_rank_sha256": "497b3109a3ce307e046f11784f570c7cee36ec3785c7954967f04db8b708d0f8", + "control_top1_age_events": 4502, + "control_top1_age_ms": 4502000, + "event_index": 6429, + "modality": "text", + "query_embedding_sha256": "802539120b00b20bb2f6547c9c631a7667661dc48dd1a761a7eb18f2be891d06", + "query_ordinal": 211, + "query_timestamp": 1700006429000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "1befa8bff947cd0c9ca056fb1e6553ba33acf93bdb632d651b61b4947e7b7623", + "control_graph_rank_sha256": "125eec939c429e0bd5d400d8b333a40733256bd8006f68bf32fe7df1d8143ef7", + "control_public_rank_sha256": "88c86657883812b0e67eb5aebb3feac035b690ba6596be7f92efa104120719a0", + "control_seed_rank_sha256": "1befa8bff947cd0c9ca056fb1e6553ba33acf93bdb632d651b61b4947e7b7623", + "control_top1_age_events": 4, + "control_top1_age_ms": 4000, + "event_index": 6458, + "modality": "text", + "query_embedding_sha256": "9cf5f4439050e5db7306ad15d551fd5d1850062eeaaeba7fdda8e1061be046b2", + "query_ordinal": 212, + "query_timestamp": 1700006458000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "dd845d1be5b3b1dc2e9c65e4a9606df3226595ce57f9b60c58e908139230e2e2", + "control_graph_rank_sha256": "a8f77d66d001b391bccec0d474731ca1a24c896898b258de55ad572578c32b85", + "control_public_rank_sha256": "d5fa805b58095c34ed88a6bfc1e564bb5624d3357b5418f6b91abe812cf248f0", + "control_seed_rank_sha256": "dd845d1be5b3b1dc2e9c65e4a9606df3226595ce57f9b60c58e908139230e2e2", + "control_top1_age_events": 4936, + "control_top1_age_ms": 4936000, + "event_index": 6490, + "modality": "text", + "query_embedding_sha256": "df3b23e9823ea6e1de6c3116c1ecad87a1b8eaf9810d7115ebef3c73c0ca2d61", + "query_ordinal": 213, + "query_timestamp": 1700006490000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "905473ff40f7a13ec36785b12543dbb1ae3fad183376171e437a08f14fd88423", + "control_graph_rank_sha256": "aa3e05c6e67ab511b7853b85917adadc8a11185994a8ec25e76e77896f80e132", + "control_public_rank_sha256": "523d862573d102d964f557a687f3ceb5135e335a4daefa06e9c5d445169b7d45", + "control_seed_rank_sha256": "905473ff40f7a13ec36785b12543dbb1ae3fad183376171e437a08f14fd88423", + "control_top1_age_events": 8, + "control_top1_age_ms": 8000, + "event_index": 6521, + "modality": "text", + "query_embedding_sha256": "ec0ffcc72483f84d53d25044cf63e79f63d723e108672b248b7171be087734b7", + "query_ordinal": 214, + "query_timestamp": 1700006521000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "8137f6b52ef1582b1308db43d08ac585d6c85ef334f3567283b97c904128ce3d", + "control_graph_rank_sha256": "73e348f7111d713a972c07be67b5ab9f1cc01cf04f52e3f7b131ce15b038f6cf", + "control_public_rank_sha256": "962b0216a3e2e5c239fc38b37ca086a3b364ea98cb1acbc27d08da50219aba88", + "control_seed_rank_sha256": "8137f6b52ef1582b1308db43d08ac585d6c85ef334f3567283b97c904128ce3d", + "control_top1_age_events": 3655, + "control_top1_age_ms": 3655000, + "event_index": 6554, + "modality": "text", + "query_embedding_sha256": "be06e72ad55416f10430cc370ee264c47bc385cd0355f67612f063fdc2823bd5", + "query_ordinal": 215, + "query_timestamp": 1700006554000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "24406a64a040229815fccb96058d30769d0997934f749cdd2e04e4c10ab8f520", + "control_graph_rank_sha256": "da657f89fb46a29ea3c94d31c5d1ccba957e02f24f5f64ea88e0a1e3eb26ca06", + "control_public_rank_sha256": "311e49df429f617503916ae4319e2559e64c77417236e139126bc5128527a268", + "control_seed_rank_sha256": "24406a64a040229815fccb96058d30769d0997934f749cdd2e04e4c10ab8f520", + "control_top1_age_events": 567, + "control_top1_age_ms": 567000, + "event_index": 6582, + "modality": "text", + "query_embedding_sha256": "f060f80ef4801e4ad9157106c4dca64092027fb8bad3cd89b45476d7ff37fbdb", + "query_ordinal": 216, + "query_timestamp": 1700006582000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "5efc5b33b36bee5386f63b40799aafeffb05ed8eb5e04b5a15a14ed749deb620", + "control_graph_rank_sha256": "2f2545e1c122692de08ef15c2805dd1175c3b1e5cca9e8bdc56462cd1fefc627", + "control_public_rank_sha256": "043d64542d963ef98c349522ddcc8fb0ef1356f721bbb6c029eb84fb04b3a20f", + "control_seed_rank_sha256": "5efc5b33b36bee5386f63b40799aafeffb05ed8eb5e04b5a15a14ed749deb620", + "control_top1_age_events": 4851, + "control_top1_age_ms": 4851000, + "event_index": 6611, + "modality": "text", + "query_embedding_sha256": "d5396300545ef833a44a1dc2990c3d58ac90a4ded49e70331aa7693c1e381941", + "query_ordinal": 217, + "query_timestamp": 1700006611000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "3c30081c58474072643a1cd0e8898a97b329c158fea9c689ce9ebde5a9b4333c", + "control_graph_rank_sha256": "1a0c2dffc195e26ea4d0a0d5446d4cc2d5734ca6ede923d61dc0104f77280545", + "control_public_rank_sha256": "d4e9a5b413d621e13c7af4821273245aca4ed0dcddb381ca2260ed55ed79600e", + "control_seed_rank_sha256": "3c30081c58474072643a1cd0e8898a97b329c158fea9c689ce9ebde5a9b4333c", + "control_top1_age_events": 3930, + "control_top1_age_ms": 3930000, + "event_index": 6639, + "modality": "text", + "query_embedding_sha256": "0b696ab0a868040f540dabd36763eed1d0bebcbd0f50ac51f89981ce9ecd6f38", + "query_ordinal": 218, + "query_timestamp": 1700006639000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "253f1d4da08e1a9693274f9374e8f553f12a6acaed4d5dc14dcff01a2ba0a9c6", + "control_graph_rank_sha256": "461cdaca8f8faacdf1da5074c2b210dad066033a2c3529e1c726a148a8d5e699", + "control_public_rank_sha256": "6fe3628d52f13dff470ea94af5c70e3553fcabe2e99b11199849ded4c51962f5", + "control_seed_rank_sha256": "253f1d4da08e1a9693274f9374e8f553f12a6acaed4d5dc14dcff01a2ba0a9c6", + "control_top1_age_events": 4386, + "control_top1_age_ms": 4386000, + "event_index": 6669, + "modality": "text", + "query_embedding_sha256": "db06be69ddfacabf2f1434ef1b40efe9bf277b18ccc85aae85902251b42620f2", + "query_ordinal": 219, + "query_timestamp": 1700006669000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "1e287b54be04c15968dd51faf1fef7590b44dc99daecd95a6f94401ea1a704f2", + "control_graph_rank_sha256": "83646036183849af78e3348c09b5ad53e54efca4788fbe6970db00f28cf05789", + "control_public_rank_sha256": "7add26bcc4da83c2b43403b838e68ddd2d1258ac8f36d7fd299f2b580b251126", + "control_seed_rank_sha256": "1e287b54be04c15968dd51faf1fef7590b44dc99daecd95a6f94401ea1a704f2", + "control_top1_age_events": 49, + "control_top1_age_ms": 49000, + "event_index": 6697, + "modality": "text", + "query_embedding_sha256": "dc96897fd8fe223fd41810057da78fc679d094adb79bf2afbe1e8e94c05d5f84", + "query_ordinal": 220, + "query_timestamp": 1700006697000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "335b3a3aea40d5e762c239e1e4eb57a27bfd38bf12fea85a1a11dc85cfa8efa2", + "control_graph_rank_sha256": "824cd4d73c8ec6a33850240f4496b0148eabbb71597982dfad5ecc72dcd5fa73", + "control_public_rank_sha256": "382b15770d34fbb95cfd4dfe141c2ca9735a9f29dca7d8965439cb8360b7c270", + "control_seed_rank_sha256": "335b3a3aea40d5e762c239e1e4eb57a27bfd38bf12fea85a1a11dc85cfa8efa2", + "control_top1_age_events": 4747, + "control_top1_age_ms": 4747000, + "event_index": 6724, + "modality": "text", + "query_embedding_sha256": "50f908190926343133ec59a09cef078d32daff7c085681707fd9be6f2364271a", + "query_ordinal": 221, + "query_timestamp": 1700006724000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "73087c2a18d3e7cabc22f7c6c1ca72d49fecdef6a52e8ac5a78c5d63c60ee217", + "control_graph_rank_sha256": "f38f11c3cf54d31a77ef996356b3e992784857bde1ed8187c427c396aae04cce", + "control_public_rank_sha256": "0c416df93f75ea38c02cb6ba69c27145449722cd2d6bd2a8c40362f1b1158163", + "control_seed_rank_sha256": "73087c2a18d3e7cabc22f7c6c1ca72d49fecdef6a52e8ac5a78c5d63c60ee217", + "control_top1_age_events": 670, + "control_top1_age_ms": 670000, + "event_index": 6759, + "modality": "text", + "query_embedding_sha256": "631df16ee5d4213944302c8094b04879f8bac886cb4ee9e01b51cc959ad374e3", + "query_ordinal": 222, + "query_timestamp": 1700006759000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "ab530fbfca826b3a667160c9086353949b787afd107cb26895b2177c822ab6a0", + "control_graph_rank_sha256": "0d2b36cfbcb83ef873dfb75c46d7366001e2f21b8204b3d2d7febc2ad86568a5", + "control_public_rank_sha256": "2cc0387c9495b4893596e18303221151d83435a7af856708f72cf5d70fb3de11", + "control_seed_rank_sha256": "ab530fbfca826b3a667160c9086353949b787afd107cb26895b2177c822ab6a0", + "control_top1_age_events": 2884, + "control_top1_age_ms": 2884000, + "event_index": 6785, + "modality": "text", + "query_embedding_sha256": "207386609c3bd13501e8139055890e56a7ca8ab5d1b5fef234b8cb13e28cadee", + "query_ordinal": 223, + "query_timestamp": 1700006785000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "9766e06c3f51ef31a765032e1b64dc08279b1196c63f9c94e704b2b0493194ec", + "control_graph_rank_sha256": "1c6f4ebe276c258f8846bcb18f91ccb7d36aa82e2e6e56e0899b4361633c245a", + "control_public_rank_sha256": "d9fb2221346c723d080f2f29e0f4714762a23e0c6944772441399dbbe52ce60e", + "control_seed_rank_sha256": "9766e06c3f51ef31a765032e1b64dc08279b1196c63f9c94e704b2b0493194ec", + "control_top1_age_events": 6257, + "control_top1_age_ms": 6257000, + "event_index": 6816, + "modality": "text", + "query_embedding_sha256": "e91a855337209676884d0ff88baa7ed48a52ee55a370ddc4438f6b7c33b81166", + "query_ordinal": 224, + "query_timestamp": 1700006816000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "40b779c64a86c753de5b73fc56c0482c43a6ef266e16f96a3da16d6d2c5acd3a", + "control_graph_rank_sha256": "61e3eca9d75e245241647278a9b2ab0852d60ee840a8b8002c0d138e651e08f9", + "control_public_rank_sha256": "9f6df3311ab5fef1515445d9ea4faf0abfe94a78509260afe1ece2ad3963107f", + "control_seed_rank_sha256": "40b779c64a86c753de5b73fc56c0482c43a6ef266e16f96a3da16d6d2c5acd3a", + "control_top1_age_events": 455, + "control_top1_age_ms": 455000, + "event_index": 6845, + "modality": "text", + "query_embedding_sha256": "4f6e08e13c409ac5dee59d5343f5fdb1d16c35aa363aad75af8f0c144de29577", + "query_ordinal": 225, + "query_timestamp": 1700006845000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "3ad991554ab1e0dc17019a2ca236f9113b8bba02a839519e350a998982ce3e7a", + "control_graph_rank_sha256": "126c99fd441ea08b0a3333fb5287a9c512e04df444dbab77236a23f57d4e1302", + "control_public_rank_sha256": "5c8425ddc000883b2b2d99be872c2edd4abfa5fba08143af5d95bc66fd1236a6", + "control_seed_rank_sha256": "3ad991554ab1e0dc17019a2ca236f9113b8bba02a839519e350a998982ce3e7a", + "control_top1_age_events": 482, + "control_top1_age_ms": 482000, + "event_index": 6872, + "modality": "text", + "query_embedding_sha256": "fbaa1a2dbb28d8e0caa3c6c373491ee83bd018eeea5e01d6323c0e56ebbab961", + "query_ordinal": 226, + "query_timestamp": 1700006872000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "8a958c5b4bf6783a63456108d0ec00f959aa5850ee8351743e3ff3dbd8953574", + "control_graph_rank_sha256": "6f6a4b8150d74e02282e70ed6e6ee196625f2c8b3f15b593b5d6b7462cd07cf8", + "control_public_rank_sha256": "53236c29934734cf3b4a92c2a7d5fe0986207bd99c622c745e7ef5ac5d2671c8", + "control_seed_rank_sha256": "8a958c5b4bf6783a63456108d0ec00f959aa5850ee8351743e3ff3dbd8953574", + "control_top1_age_events": 158, + "control_top1_age_ms": 158000, + "event_index": 6906, + "modality": "text", + "query_embedding_sha256": "2e5838aa6975d85e572b18df146e9e48c5e4f24e753275cbc45de26d56ed3695", + "query_ordinal": 227, + "query_timestamp": 1700006906000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "be5f9d553a74bb99a46f81eae1f51e4ec73e699cb689ddc0b20d2d0de6ec4c0b", + "control_graph_rank_sha256": "1e5f16e61ca47ad5d3f39fe249cbb4d9ac1d876153282d5e0e701b1372fb6fc4", + "control_public_rank_sha256": "c0ca19917207e861a75e85e94c423a9cf8596c81c1e52693fb6ec765962e1323", + "control_seed_rank_sha256": "be5f9d553a74bb99a46f81eae1f51e4ec73e699cb689ddc0b20d2d0de6ec4c0b", + "control_top1_age_events": 3577, + "control_top1_age_ms": 3577000, + "event_index": 6938, + "modality": "text", + "query_embedding_sha256": "be25d3eb7a2feaf3e0b053a21c70a29be77106d8b01683748c51f1d996deadc6", + "query_ordinal": 228, + "query_timestamp": 1700006938000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "987a953f156775264bbe3ac91675a2d5c573c7421b661ac25cfc84c821900cb9", + "control_graph_rank_sha256": "0b9614d3883bcaf4cef876aac5f2a746c30a766e9135edd9298b40794b52ca86", + "control_public_rank_sha256": "c2216474ca207d1e9dc199c9c5825d84e32a4c26c45c9d98b92c081f3a6a57b9", + "control_seed_rank_sha256": "987a953f156775264bbe3ac91675a2d5c573c7421b661ac25cfc84c821900cb9", + "control_top1_age_events": 369, + "control_top1_age_ms": 369000, + "event_index": 6971, + "modality": "text", + "query_embedding_sha256": "cf21e6bcd469b8d9ff3a488121a07ce943066676a933179a92845e4d9dc91e04", + "query_ordinal": 229, + "query_timestamp": 1700006971000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "32c3a0ee12452314a8b4b8e108b80ae620cc3015f730490f4455f34e2aaae968", + "control_graph_rank_sha256": "546cd9b8a75e3e50943a228d153fd98496e0a750f7f76570d942a15a4f0838ff", + "control_public_rank_sha256": "074ac9357f0a59df6fa34ffb6b010112c7ff9e7903a1bfef0974b7760d758859", + "control_seed_rank_sha256": "32c3a0ee12452314a8b4b8e108b80ae620cc3015f730490f4455f34e2aaae968", + "control_top1_age_events": 16, + "control_top1_age_ms": 16000, + "event_index": 6998, + "modality": "text", + "query_embedding_sha256": "a86043eae7f6d4f0c186474b31a1b63524daf504135bcef38945c2415ff875af", + "query_ordinal": 230, + "query_timestamp": 1700006998000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "34bd380a119f2a3879ccb48c3fd37da3ff2e2beb2e5b27d703e6d3ced32b8148", + "control_graph_rank_sha256": "871f582012130cafd065246d79a1bca9080a92ffe9a0c0e2b46511e95e40c5e0", + "control_public_rank_sha256": "ad8b734b885e5760382c6eae731553d59e7804a2d7f2dbedbcac7087e7cb57db", + "control_seed_rank_sha256": "34bd380a119f2a3879ccb48c3fd37da3ff2e2beb2e5b27d703e6d3ced32b8148", + "control_top1_age_events": 381, + "control_top1_age_ms": 381000, + "event_index": 7029, + "modality": "text", + "query_embedding_sha256": "39e31b92605df4cf4327490573024122ff85725ed1005ba20b167bcaf55cc1ad", + "query_ordinal": 231, + "query_timestamp": 1700007029000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "7c52d2abf476b49667a094411e9bb9cbc70895a75449b7359a0c666a90ffd168", + "control_graph_rank_sha256": "d21863bf02fdf9a74e7eb9332abc8461536c7248186acaafbc535205891d146d", + "control_public_rank_sha256": "d0c81fb6daa1ebe05eedd9345f7b3d167074949cf3037db694f26d6402b9c94e", + "control_seed_rank_sha256": "7c52d2abf476b49667a094411e9bb9cbc70895a75449b7359a0c666a90ffd168", + "control_top1_age_events": 30, + "control_top1_age_ms": 30000, + "event_index": 7062, + "modality": "text", + "query_embedding_sha256": "6d60112b82c3fb13f5c7394d71c2a4ac42c641cdd1baaff1272cdf1be97494a1", + "query_ordinal": 232, + "query_timestamp": 1700007062000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "fa8d85eb53346ac5ffa57d797789d42950c0c61fb1fc6ca6541e10366581fd5a", + "control_graph_rank_sha256": "1bf9d96310529f2e87df8c0db656725bd97ea3f898674c9874f8a419c4bf3da6", + "control_public_rank_sha256": "ba57e4684b03a010a5004ca128af5d69e3303471667dc198ac206bb82389f69e", + "control_seed_rank_sha256": "fa8d85eb53346ac5ffa57d797789d42950c0c61fb1fc6ca6541e10366581fd5a", + "control_top1_age_events": 370, + "control_top1_age_ms": 370000, + "event_index": 7094, + "modality": "text", + "query_embedding_sha256": "50f908190926343133ec59a09cef078d32daff7c085681707fd9be6f2364271a", + "query_ordinal": 233, + "query_timestamp": 1700007094000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "dff6bae8307d33262bd46152e0ccfc4f559d12a8318ab62422609682daa34b74", + "control_graph_rank_sha256": "8e202bb0c42ecd9759def28239dcb4a56d6e7c509e23924a241f1735d139c24d", + "control_public_rank_sha256": "db9613bfbd81ced168f1ea9723a130cffb195595d99087fc2d78fa6d73ff99f1", + "control_seed_rank_sha256": "dff6bae8307d33262bd46152e0ccfc4f559d12a8318ab62422609682daa34b74", + "control_top1_age_events": 14, + "control_top1_age_ms": 14000, + "event_index": 7127, + "modality": "text", + "query_embedding_sha256": "88012763058542fff106a6a5ea2c9097f667ace7d82fe0dfbd6dec6fef81310a", + "query_ordinal": 234, + "query_timestamp": 1700007127000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "5904e853fdea42fbf01a775b98873030fd8c752baab9cb7c2188601a753944c2", + "control_graph_rank_sha256": "2a9512b615026eda9b4aeb76e4b06bb1aab6ae89449099964d04540f08cb0a2d", + "control_public_rank_sha256": "2a31413a492193ccceefb6b0391734b1d607c9d3a3a18cd7c20d969330c7434b", + "control_seed_rank_sha256": "5904e853fdea42fbf01a775b98873030fd8c752baab9cb7c2188601a753944c2", + "control_top1_age_events": 4248, + "control_top1_age_ms": 4248000, + "event_index": 7151, + "modality": "text", + "query_embedding_sha256": "6bcc98c530b9e12b6502c2728931af5d63204017b35e857b0696d966b6f59d62", + "query_ordinal": 235, + "query_timestamp": 1700007151000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "7113da5743780f4682de182d14335f4a7f0324dd89e0a9987829fd6956808502", + "control_graph_rank_sha256": "7fd7f632024fa7e3352125c6708fc4452d71f9d412f79cc4a38b229d28510b08", + "control_public_rank_sha256": "f6f165fb599abd0ca1e950b3edf6b3718d849f5c54d2f1549a8a7997ce222984", + "control_seed_rank_sha256": "7113da5743780f4682de182d14335f4a7f0324dd89e0a9987829fd6956808502", + "control_top1_age_events": 4282, + "control_top1_age_ms": 4282000, + "event_index": 7181, + "modality": "text", + "query_embedding_sha256": "25f1785ec70ecfc9236ddd2b56aedca3e1869d9ac501260375c5e84c69926e10", + "query_ordinal": 236, + "query_timestamp": 1700007181000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "5554daa1ed2cb654e80ab6f3e03c024b28adc8f838ec9598ec0989e2c7e66d25", + "control_graph_rank_sha256": "ae65524d19b7d4f7b1570e197bcdddb1a77be3702f0a712f85f640d41dc005b4", + "control_public_rank_sha256": "dc8356858bb8b5e5e779c922766dd0eccd88daff8c9fdeb646b952d527997998", + "control_seed_rank_sha256": "5554daa1ed2cb654e80ab6f3e03c024b28adc8f838ec9598ec0989e2c7e66d25", + "control_top1_age_events": 18, + "control_top1_age_ms": 18000, + "event_index": 7209, + "modality": "text", + "query_embedding_sha256": "3ba98cf2d7d226d22aaa628e606a74f533b0b4b3dba387821762d97f027004ae", + "query_ordinal": 237, + "query_timestamp": 1700007209000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "1623eb6f730834e63e6f5e7ccf6da34aa0c075be79099ba4bc7bb6c3bc63b31d", + "control_graph_rank_sha256": "cb78883048d9ac632b30374dfc6ad375c6296d2bee50f18de780730ab3fa5204", + "control_public_rank_sha256": "f9d2a8e20a13d29d1e0acd27205228a328a4a2fe6f588c12db1d399f4a2db192", + "control_seed_rank_sha256": "1623eb6f730834e63e6f5e7ccf6da34aa0c075be79099ba4bc7bb6c3bc63b31d", + "control_top1_age_events": 3, + "control_top1_age_ms": 3000, + "event_index": 7241, + "modality": "text", + "query_embedding_sha256": "a1e32cffc22ada360b41c45062543958a903a7e85cb8ddb9d31d1a98acc071de", + "query_ordinal": 238, + "query_timestamp": 1700007241000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "92e47687616125499181f5c9de90f2ab00555345cec3c49784054b8b5c857b74", + "control_graph_rank_sha256": "e19649680d2835d9670724fa213cf479aefc5dc7211b8d4762e1f43800a82b79", + "control_public_rank_sha256": "cdbe97ee6f034ebf4810e19bce7eebcc0149ff409f2251ce0f058d979a547209", + "control_seed_rank_sha256": "92e47687616125499181f5c9de90f2ab00555345cec3c49784054b8b5c857b74", + "control_top1_age_events": 4177, + "control_top1_age_ms": 4177000, + "event_index": 7274, + "modality": "text", + "query_embedding_sha256": "7a4655189426a4dfd6f95d52d4a40efda8817fd3ec8ff08e88bcb25b08d3c247", + "query_ordinal": 239, + "query_timestamp": 1700007274000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "f6a3f07e37a7041778eb077dd63a7613f92669c5bd8fce30d9288063573a36c3", + "control_graph_rank_sha256": "81a122d1d29f075c1142cdc4262d524adb4f4cd84cbaa9c303ba1b4a6c995728", + "control_public_rank_sha256": "f582834df1d204ef1e127c18a433be202b45c4a7851068653926405b61584c80", + "control_seed_rank_sha256": "f6a3f07e37a7041778eb077dd63a7613f92669c5bd8fce30d9288063573a36c3", + "control_top1_age_events": 21, + "control_top1_age_ms": 21000, + "event_index": 7305, + "modality": "text", + "query_embedding_sha256": "8eb17c7c26b07c3f5082dff579de56a06a4bcb420b7c672b84d0233130420113", + "query_ordinal": 240, + "query_timestamp": 1700007305000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "4b7ea945f61f0a171b5c06d5f7d95cfa4962a39fc5a08777f5d6865e45dd4c01", + "control_graph_rank_sha256": "424c4e153cb441c3bcc4162f13e3e3df933decb83e423ff800812a562a58c4e7", + "control_public_rank_sha256": "8b467f8f732823711c111edda8b1de0e050fa620cd3c291c03029f10eed87868", + "control_seed_rank_sha256": "4b7ea945f61f0a171b5c06d5f7d95cfa4962a39fc5a08777f5d6865e45dd4c01", + "control_top1_age_events": 1422, + "control_top1_age_ms": 1422000, + "event_index": 7335, + "modality": "text", + "query_embedding_sha256": "09203907e2d6a29229801be867a1f8bc9e9f970e9a2537f79119b7ba51bdfd63", + "query_ordinal": 241, + "query_timestamp": 1700007335000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "1adf17f9c95d40c27b92bac8a42e9c6043a85d2b2f94df17013e3409254d2da6", + "control_graph_rank_sha256": "3e46e62350563ee9cfd53216cb62a68886cfe0d6f6eea802a0d59c2ff3cfd86c", + "control_public_rank_sha256": "87b3009ba54b5aee352593d0d01ce6c126260593f37bcf2a18c910b0cca96688", + "control_seed_rank_sha256": "1adf17f9c95d40c27b92bac8a42e9c6043a85d2b2f94df17013e3409254d2da6", + "control_top1_age_events": 330, + "control_top1_age_ms": 330000, + "event_index": 7365, + "modality": "text", + "query_embedding_sha256": "f1d60bd977dbe87719b9ccf89f50652b32cdcf94704dbdfe7abdb0f79adddea7", + "query_ordinal": 242, + "query_timestamp": 1700007365000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "4babda64e32e01d87bc63e4b5c248f072ea9dc6d34b09ac3d16ca33197723d30", + "control_graph_rank_sha256": "2008e86ff25256d2e6943b426b4b02f054200c5c2031ca5497bcf4d8fa7e9035", + "control_public_rank_sha256": "4b8658c470aa53b348191972f2ce9d8556158e23a479902a8e3ab0d9301d68e3", + "control_seed_rank_sha256": "4babda64e32e01d87bc63e4b5c248f072ea9dc6d34b09ac3d16ca33197723d30", + "control_top1_age_events": 61, + "control_top1_age_ms": 61000, + "event_index": 7396, + "modality": "text", + "query_embedding_sha256": "eda1fea7c18b521df6b3079a840dd380cbb41a996ecb77d7fe627840baafbda4", + "query_ordinal": 243, + "query_timestamp": 1700007396000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "af374ae35525de8167a274ee4c444e5f476e216adc78d4829722bdd9df7e9858", + "control_graph_rank_sha256": "3845fa82931992d8d2a65d907da92417480c0cc9b46f348064fdf2621b1d5d39", + "control_public_rank_sha256": "8a0bad988c27b9f29ceb1abd7f0f582abe3f89889dd92599d82563f48c868857", + "control_seed_rank_sha256": "af374ae35525de8167a274ee4c444e5f476e216adc78d4829722bdd9df7e9858", + "control_top1_age_events": 174, + "control_top1_age_ms": 174000, + "event_index": 7423, + "modality": "text", + "query_embedding_sha256": "5242309107089a094c6b520babc93a1b1fa808754df3a73629d6080e117b2fde", + "query_ordinal": 244, + "query_timestamp": 1700007423000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "b6a2fb2ec9bc3391d81d8b2a1e352fb64782ac5e1bc03e3112667b2a403a6d11", + "control_graph_rank_sha256": "441e0ef59f37e84ca37ff2ad035598f5a6d5781ee2daec27ccee5231eb2df32e", + "control_public_rank_sha256": "a0d688aea3e90ffb5f1482078f91b00e15ddc60478654b43b337c1464e198453", + "control_seed_rank_sha256": "b6a2fb2ec9bc3391d81d8b2a1e352fb64782ac5e1bc03e3112667b2a403a6d11", + "control_top1_age_events": 4355, + "control_top1_age_ms": 4355000, + "event_index": 7452, + "modality": "text", + "query_embedding_sha256": "248d019ba29c638a67d017c370e2ef8a92747fcae328423fd7370e1c13383069", + "query_ordinal": 245, + "query_timestamp": 1700007452000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "5668d358a3e5ea702e390f5754b5f095891e7db3edf7799b1d41d7501e9460ec", + "control_graph_rank_sha256": "d2c4ed6ed53e918d8e4757bb03b1758d44a354584487bcc4f5cf3f774763a64e", + "control_public_rank_sha256": "d895d7fdf509710ff86e83ad87b4ea3a537de0dff5a49f9197f2fb9871c053fe", + "control_seed_rank_sha256": "5668d358a3e5ea702e390f5754b5f095891e7db3edf7799b1d41d7501e9460ec", + "control_top1_age_events": 243, + "control_top1_age_ms": 243000, + "event_index": 7484, + "modality": "text", + "query_embedding_sha256": "b6ff860bc9b42ded34ab387d0a57184fcd2199e7fff463c989b529741441602a", + "query_ordinal": 246, + "query_timestamp": 1700007484000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "5d2fee54bc574343d07e93522ffecb56f9cb0c28ce8257f8210107ab9be2c434", + "control_graph_rank_sha256": "851a225db91f16b020b710d2f0f3d924d07fa575d1be1be821872516d4fe26e5", + "control_public_rank_sha256": "617e82eea6f688a935efb8bf56c57f57f5d9d35a9fd5b7467d5bf54c07bc2a97", + "control_seed_rank_sha256": "5d2fee54bc574343d07e93522ffecb56f9cb0c28ce8257f8210107ab9be2c434", + "control_top1_age_events": 4533, + "control_top1_age_ms": 4533000, + "event_index": 7514, + "modality": "text", + "query_embedding_sha256": "547e6c64b65ec4747314c6d9fd7982db917b1085bc24bd58fbc8eb83da0692d0", + "query_ordinal": 247, + "query_timestamp": 1700007514000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "7383cfde647ee03afecf4d7129ef9a1aed763dc47bcde9267ae0a9ad482d1f06", + "control_graph_rank_sha256": "538c34f5666fdbf151bf82038659f5ac2b6430d6ae1960063397a15577ab3316", + "control_public_rank_sha256": "6139aabe394b8a851fe76f4bdf0b1e463bd1ff2a6018752ea17264f528f8914c", + "control_seed_rank_sha256": "7383cfde647ee03afecf4d7129ef9a1aed763dc47bcde9267ae0a9ad482d1f06", + "control_top1_age_events": 4978, + "control_top1_age_ms": 4978000, + "event_index": 7544, + "modality": "text", + "query_embedding_sha256": "a5d471753f5d0881978046ab2a14659cdcdef5e498851df769618079439551a4", + "query_ordinal": 248, + "query_timestamp": 1700007544000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "caa5ba981653dd469de99af59f65adf0d1767ca9676e1bb062d5934ef0b26b87", + "control_graph_rank_sha256": "6d0d9a03eda4e95f823805c6d0009776a024c31bf6b0ee6ac31f17ec8c913a84", + "control_public_rank_sha256": "d2e5adb1867740f699a2004b957bdacaeccc1d3085cc7138ee553574d34a4b89", + "control_seed_rank_sha256": "caa5ba981653dd469de99af59f65adf0d1767ca9676e1bb062d5934ef0b26b87", + "control_top1_age_events": 525, + "control_top1_age_ms": 525000, + "event_index": 7581, + "modality": "text", + "query_embedding_sha256": "6d1d6cff24692057497e636f386c7161e3b0abbbe457c6ce30e8dc2f879b7f6c", + "query_ordinal": 249, + "query_timestamp": 1700007581000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "0d7482bda80466757839b2857b708c98b0ac6b84db7b8ae5a012c7a0da523b44", + "control_graph_rank_sha256": "5313b85d15f14e03b720b6382f6e3b84a8d3b2e6f98b30ac44ad7276994eb64e", + "control_public_rank_sha256": "39ebd684f84a8bf52ee8de85740ebd2f40bf62f442e885dd45da5af300477820", + "control_seed_rank_sha256": "0d7482bda80466757839b2857b708c98b0ac6b84db7b8ae5a012c7a0da523b44", + "control_top1_age_events": 279, + "control_top1_age_ms": 279000, + "event_index": 7610, + "modality": "text", + "query_embedding_sha256": "ddc1e319b1ede4846554973383ffde578df8f73bbace152f50ab4a65bc57e9fb", + "query_ordinal": 250, + "query_timestamp": 1700007610000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "2e7150dc7859c583cb894f657ecd4743f15836b2f974e5914551be2321e3a3ed", + "control_graph_rank_sha256": "38d76037fe9b1755de4c1be421f210f9f9f677d345c643bc50e7a126adabca21", + "control_public_rank_sha256": "d38c24c25a4de4044a330d31f88ec38e3fb27647dd6521d619b2b662034b90b5", + "control_seed_rank_sha256": "2e7150dc7859c583cb894f657ecd4743f15836b2f974e5914551be2321e3a3ed", + "control_top1_age_events": 6085, + "control_top1_age_ms": 6085000, + "event_index": 7639, + "modality": "text", + "query_embedding_sha256": "9b94fefd268d270587cabc71842ecf92fd50e3bc51683925d6c1cc254653d2dc", + "query_ordinal": 251, + "query_timestamp": 1700007639000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "3e3e4da0a17a15af9c47141e9e0e9128ac20f6ac023eec1bf81dfc2abc96ba7c", + "control_graph_rank_sha256": "d8a57b8925e8714c45d1ed1588543282d5e71b8333cb8a39ae6c14b0e1b3833e", + "control_public_rank_sha256": "69e8a35530471d548376e9794234609d0b7f211e959ec4d979aa45538682bad6", + "control_seed_rank_sha256": "3e3e4da0a17a15af9c47141e9e0e9128ac20f6ac023eec1bf81dfc2abc96ba7c", + "control_top1_age_events": 425, + "control_top1_age_ms": 425000, + "event_index": 7674, + "modality": "text", + "query_embedding_sha256": "faf25f31f3b441c17b91ec2770029e856cc6c14b7012f09e45084756fc45f172", + "query_ordinal": 252, + "query_timestamp": 1700007674000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "fdfea1ed70e351f582382fe91b1bac0e4f4b020ade868350ee55026d6b4e4657", + "control_graph_rank_sha256": "ffbab5629ddc49c3580fe89ef50d2cade425115a8f11bc674af66230b09fb956", + "control_public_rank_sha256": "e61bdfd248f3e3b55a197873d8fb8a3c1773a92f4c935b85609fc28a09800085", + "control_seed_rank_sha256": "fdfea1ed70e351f582382fe91b1bac0e4f4b020ade868350ee55026d6b4e4657", + "control_top1_age_events": 51, + "control_top1_age_ms": 51000, + "event_index": 7704, + "modality": "text", + "query_embedding_sha256": "c2e9639e297f43df0672b51b563632b1d958a13fd0e84e88821e0e05e0476349", + "query_ordinal": 253, + "query_timestamp": 1700007704000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "763f97b5ba5c8d2bf0e9dc32e2c72a8c9dfd2c2b6d7842c969667d4f75349914", + "control_graph_rank_sha256": "592d080fe6a476c8635ae3624a9813105ef0f45bef5683a76f59ec02e8d2a6d0", + "control_public_rank_sha256": "5366e01dabc69669b2c3c482273a0874e81e0f5bf54624ff3827be7aa4ecc1a7", + "control_seed_rank_sha256": "763f97b5ba5c8d2bf0e9dc32e2c72a8c9dfd2c2b6d7842c969667d4f75349914", + "control_top1_age_events": 2938, + "control_top1_age_ms": 2938000, + "event_index": 7736, + "modality": "text", + "query_embedding_sha256": "db06be69ddfacabf2f1434ef1b40efe9bf277b18ccc85aae85902251b42620f2", + "query_ordinal": 254, + "query_timestamp": 1700007736000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "b07fe60905794bfbcc450ee6383713b4f30146964c881006f1fa345e0bdb63d1", + "control_graph_rank_sha256": "bf38e5c74edfd6f2ef1bdcda5d2e37e2173cc146bd99948716fc81db7f79ea85", + "control_public_rank_sha256": "3c4dc2222e81dc10fb3685143703fea6a03a436c088e3f26372250a9cf7f6f63", + "control_seed_rank_sha256": "b07fe60905794bfbcc450ee6383713b4f30146964c881006f1fa345e0bdb63d1", + "control_top1_age_events": 4327, + "control_top1_age_ms": 4327000, + "event_index": 7770, + "modality": "text", + "query_embedding_sha256": "6ea4a32d325a07f58ea0fe5170f9299a03d416af8d4f685b34d7829f9f8c07b2", + "query_ordinal": 255, + "query_timestamp": 1700007770000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "abd585d2ef4aa25664967d9e03866cc80a339644d3110d75ee3fab0cdc872b5c", + "control_graph_rank_sha256": "6683d0d73a6db902ae42444e7744494f1e7eef0db5d6f7f6a50fde4c202d771a", + "control_public_rank_sha256": "15ab4d619f28494f73d6a5222c1461fcc2e64f4c03f8c3b15fcb6227f253e2fd", + "control_seed_rank_sha256": "abd585d2ef4aa25664967d9e03866cc80a339644d3110d75ee3fab0cdc872b5c", + "control_top1_age_events": 2578, + "control_top1_age_ms": 2578000, + "event_index": 7797, + "modality": "text", + "query_embedding_sha256": "b7117314dd82474e08d83aa3d17d9f23347fe7ab3f0b459efe19836b4ffdfc70", + "query_ordinal": 256, + "query_timestamp": 1700007797000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "fda747a8992058da794d939489e6156427c082820e1edca075fa9121e7170a49", + "control_graph_rank_sha256": "318260c69e30dffe68de52204e090b26cd21964e291ac60550ad74f28989c9b1", + "control_public_rank_sha256": "7a6ae1bac48d1ccbe4e0e3224350dd4af079508d82eec5e76c19a2da40b4fcc9", + "control_seed_rank_sha256": "fda747a8992058da794d939489e6156427c082820e1edca075fa9121e7170a49", + "control_top1_age_events": 6172, + "control_top1_age_ms": 6172000, + "event_index": 7825, + "modality": "text", + "query_embedding_sha256": "34b3350a87c8d1838644f96068623d306f274a452f46a848143f89a4acee375e", + "query_ordinal": 257, + "query_timestamp": 1700007825000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "400de0dd162027778f1e765ff7fcea7e859446140311b8e82aab76c0e21bd191", + "control_graph_rank_sha256": "f45bbc23694da85866b0147f7bb5cc9139622eddb9529b056b2693384bdf7cb5", + "control_public_rank_sha256": "f6c47f4e7efac1a523e9a44be67d11f90fc9ea31e601cf322625693ffa464d18", + "control_seed_rank_sha256": "400de0dd162027778f1e765ff7fcea7e859446140311b8e82aab76c0e21bd191", + "control_top1_age_events": 6648, + "control_top1_age_ms": 6648000, + "event_index": 7852, + "modality": "text", + "query_embedding_sha256": "5ac61b77b5a0391d542118c1c2334a7be44ee3c771dbffb612c439adedf1c36e", + "query_ordinal": 258, + "query_timestamp": 1700007852000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "70b88a8b6be26a056407a6a17d79ceddcff5467062389708fe73908954915994", + "control_graph_rank_sha256": "1f1d869bb74d10ca7ea1168abb275f5f1108a4209f08f1062687e8c7fa85f546", + "control_public_rank_sha256": "a1b977652dd69d3bc8cfcd647c3fdb548b7b64733a7aa7fb3ebf41ae8543f882", + "control_seed_rank_sha256": "70b88a8b6be26a056407a6a17d79ceddcff5467062389708fe73908954915994", + "control_top1_age_events": 5409, + "control_top1_age_ms": 5409000, + "event_index": 7885, + "modality": "text", + "query_embedding_sha256": "9444baf2eb19bbb1e34cb5651b406082c96f5c765b55e6561b66d4b91f9f167d", + "query_ordinal": 259, + "query_timestamp": 1700007885000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "8426dfd2690f54fef3fccd99e7f0b48fbff524c28d77c63e2ee6a515b07a6f6b", + "control_graph_rank_sha256": "10ba420af35bd6951b4a3e6005e8bb9bdd063ae5b6e3c97cc45875bc3f02e105", + "control_public_rank_sha256": "21d2e9c4bb8cfe568a7cb47f80b04e87bee4e2ed817f300d1f6bbf48c4c0c0b5", + "control_seed_rank_sha256": "8426dfd2690f54fef3fccd99e7f0b48fbff524c28d77c63e2ee6a515b07a6f6b", + "control_top1_age_events": 5068, + "control_top1_age_ms": 5068000, + "event_index": 7911, + "modality": "text", + "query_embedding_sha256": "9959bdce90e042115d5a36d7555fe0dc0232b331f1457a1dfa9ddd1e2c5f58cf", + "query_ordinal": 260, + "query_timestamp": 1700007911000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "ee811a3a6c6fb763ab7cd060f85bb424ec664e78a0b479326292252570386531", + "control_graph_rank_sha256": "51b2849102ff6589641670d57ff3947099dc6a1c9cca4f458cd98f6db916ac15", + "control_public_rank_sha256": "21703828465e4f01d777c3221ebe8f12b05d6219e0e3c8803ae3114bb6db50c5", + "control_seed_rank_sha256": "ee811a3a6c6fb763ab7cd060f85bb424ec664e78a0b479326292252570386531", + "control_top1_age_events": 4, + "control_top1_age_ms": 4000, + "event_index": 7940, + "modality": "text", + "query_embedding_sha256": "88532c8b8f6b21729a0ef1fb05e162509fe231a3eb157a03f3da51f3efdf2302", + "query_ordinal": 261, + "query_timestamp": 1700007940000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "0414785baf5351cf874dd70d611b4493a3e691d93cc891f1e6bbc603e0f47976", + "control_graph_rank_sha256": "8476cd90402521c467674ef623801a9893e29def189c7106e091086f80303a16", + "control_public_rank_sha256": "a5c6cee1b9716386d2284f936aa435e0c9ffc7af817f4ab6fc6592851a00cccb", + "control_seed_rank_sha256": "0414785baf5351cf874dd70d611b4493a3e691d93cc891f1e6bbc603e0f47976", + "control_top1_age_events": 818, + "control_top1_age_ms": 818000, + "event_index": 7972, + "modality": "text", + "query_embedding_sha256": "36d1ee7452ea60ebd5c7aee3055b9a4a06f10f4505002770345322acbbafe5a6", + "query_ordinal": 262, + "query_timestamp": 1700007972000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "f52283db329fe0b507d304ebac4ef2621d3af61d7389fbf229948b060e6cc6b6", + "control_graph_rank_sha256": "e8cfed07d467e6c7fcf2e4a80f26cc35de62f485a077ef383a34230e796f112d", + "control_public_rank_sha256": "4f2b4ee2067488d171d8b48659aece02bebd4725596679698cd3f8f5b59b8764", + "control_seed_rank_sha256": "f52283db329fe0b507d304ebac4ef2621d3af61d7389fbf229948b060e6cc6b6", + "control_top1_age_events": 2342, + "control_top1_age_ms": 2342000, + "event_index": 8001, + "modality": "text", + "query_embedding_sha256": "418359930424d627833e2353f67dfad28060b6a4eb0fb1541479d41e503fb941", + "query_ordinal": 263, + "query_timestamp": 1700008001000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "f6d489ef9f7b659219e3119dff134108e31fdcb0c7d5cd4da0a6ad302d7c78a7", + "control_graph_rank_sha256": "3593d7ab31e8f22c0a3acac21c7acc4f0f39f01b2b27faa3f0b024575926a18c", + "control_public_rank_sha256": "645cf21a0bf4cfc385fc421d94b14ceb2dbb30ff54a9cd526695350354de297b", + "control_seed_rank_sha256": "f6d489ef9f7b659219e3119dff134108e31fdcb0c7d5cd4da0a6ad302d7c78a7", + "control_top1_age_events": 1248, + "control_top1_age_ms": 1248000, + "event_index": 8033, + "modality": "text", + "query_embedding_sha256": "b8fb79a43960e0290e8d0c6cf5c9b74390586d958f75ca27d119bef0b600fa71", + "query_ordinal": 264, + "query_timestamp": 1700008033000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "4c63e4277b574217d140fc92799d86df49c5c06609e03f81e7b381eb63805587", + "control_graph_rank_sha256": "5b832f3f9e805238ae8a9c2d3a6930698ff1a36b3df72d5d01893f953dece9e1", + "control_public_rank_sha256": "532cf49c2e261a61e159978cf36aebb88dd21e2345fa212b9328dc710c550bc9", + "control_seed_rank_sha256": "4c63e4277b574217d140fc92799d86df49c5c06609e03f81e7b381eb63805587", + "control_top1_age_events": 2755, + "control_top1_age_ms": 2755000, + "event_index": 8057, + "modality": "text", + "query_embedding_sha256": "8969796295279dd7c9a3d6eefa191b1678030187b8895e2470d34b103c9bfb1c", + "query_ordinal": 265, + "query_timestamp": 1700008057000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "ceea8528a66885847b6f4908cae385d913d2a3061b6e0dff6a3f50b5f3a0f59e", + "control_graph_rank_sha256": "aa22be271f143284056c15113996046d0940c9c072adf5007a5adfc8d057191e", + "control_public_rank_sha256": "745a303e87e91af53932e5b642e1141c7c8c711070afb83b907c33a740ae40b6", + "control_seed_rank_sha256": "ceea8528a66885847b6f4908cae385d913d2a3061b6e0dff6a3f50b5f3a0f59e", + "control_top1_age_events": 701, + "control_top1_age_ms": 701000, + "event_index": 8088, + "modality": "text", + "query_embedding_sha256": "d82668d045928275b8af323e424e70cce4bce8d335599903b0cec6ec596cccc0", + "query_ordinal": 266, + "query_timestamp": 1700008088000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "e98a58512430a2826dc2222010efe1e664f2740a1482a254cd3c6f3bae426687", + "control_graph_rank_sha256": "7708a19819b0f2ed15a6f6c84349c35dc68b340780798ac554c808dc071a11b6", + "control_public_rank_sha256": "ab403cc7114fe46f7da80faa7744e1222e94ef80822c58a50b28e893f4a29ab8", + "control_seed_rank_sha256": "e98a58512430a2826dc2222010efe1e664f2740a1482a254cd3c6f3bae426687", + "control_top1_age_events": 5631, + "control_top1_age_ms": 5631000, + "event_index": 8124, + "modality": "text", + "query_embedding_sha256": "78f09b20cdc220409f523d40dab5d71a3806e7fcfd4871f8cb281c0c2633f712", + "query_ordinal": 267, + "query_timestamp": 1700008124000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "9f3b4038424283fcfe8ebfedcf11684d5dc8e1bc5b2796bda75fd60d014feda3", + "control_graph_rank_sha256": "3d89709645df81781a8669cdacee2d97803b94f424a0040c404d8a29311616c8", + "control_public_rank_sha256": "50c4ae790b8838d06092427048504ae92c9e7d906f729af6f6371bc2c8b3a33a", + "control_seed_rank_sha256": "9f3b4038424283fcfe8ebfedcf11684d5dc8e1bc5b2796bda75fd60d014feda3", + "control_top1_age_events": 3100, + "control_top1_age_ms": 3100000, + "event_index": 8156, + "modality": "text", + "query_embedding_sha256": "962252768abfde0435f251113ee08d9475321f6f7334dd55abcba08ced881851", + "query_ordinal": 268, + "query_timestamp": 1700008156000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "2789228876df34a680c15bd065a3854d3191544c18a8ab59185b1e34696d4372", + "control_graph_rank_sha256": "6d540a7aa6b541a1d2afcbfbeb9cd2266b538a659d1e79d571859ffade9ba6e8", + "control_public_rank_sha256": "b0522a080a641e5789ad0188f02664f5de6d0d6e0a96940be9bd9e270a14fbf6", + "control_seed_rank_sha256": "2789228876df34a680c15bd065a3854d3191544c18a8ab59185b1e34696d4372", + "control_top1_age_events": 13, + "control_top1_age_ms": 13000, + "event_index": 8190, + "modality": "text", + "query_embedding_sha256": "a513d171b1703469480317c25f8e9610c0b679395c3d370f0f2f8f3204b98329", + "query_ordinal": 269, + "query_timestamp": 1700008190000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "ec998cd14cf42ad23ad7e1354163a51718a64a5425789fce977650cf4f0df7fc", + "control_graph_rank_sha256": "89d3789e13d8fe875d0d1eb404d7fef069c99024fc2d9c204a2e7f18fad9c33f", + "control_public_rank_sha256": "c40def0bdbc79a20e2934220462712abba724f7296c83a09859dfcabcb8be2de", + "control_seed_rank_sha256": "ec998cd14cf42ad23ad7e1354163a51718a64a5425789fce977650cf4f0df7fc", + "control_top1_age_events": 14, + "control_top1_age_ms": 14000, + "event_index": 8217, + "modality": "text", + "query_embedding_sha256": "79af1f6fcbc9ab97d307648dea21f10520fc079f029e048155552bfd53681f61", + "query_ordinal": 270, + "query_timestamp": 1700008217000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "283f4b0c8319db7de9898a5ea936fc72d2cd2b74595f1123bbba26902775bfed", + "control_graph_rank_sha256": "8bd174c32c73db6e8783853e2a867b15bb0ea1f8970838fc9abf89efdb9e3460", + "control_public_rank_sha256": "3545d3f0a81b391c2d047a9a0ff6a491c4684d3dbca909e3a08c8d6111e291e5", + "control_seed_rank_sha256": "283f4b0c8319db7de9898a5ea936fc72d2cd2b74595f1123bbba26902775bfed", + "control_top1_age_events": 2154, + "control_top1_age_ms": 2154000, + "event_index": 8247, + "modality": "text", + "query_embedding_sha256": "c1a42c844ade1a22fb1b22bf755807b970de948d16fc4de6f5d76bd9a70febb5", + "query_ordinal": 271, + "query_timestamp": 1700008247000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "4a311fa81d7a4bad2a6bf175cd557fa4216780cae169568f66d8fe5c31bdcc9d", + "control_graph_rank_sha256": "654cebc80e106b17b30a34aaefd70ee8eabb05b2658a73134a50ce48b054996a", + "control_public_rank_sha256": "eaec4f1c55ac98acfe26ba68c93cb843409c3aceb6bde165796fa36fb9998881", + "control_seed_rank_sha256": "4a311fa81d7a4bad2a6bf175cd557fa4216780cae169568f66d8fe5c31bdcc9d", + "control_top1_age_events": 1399, + "control_top1_age_ms": 1399000, + "event_index": 8274, + "modality": "text", + "query_embedding_sha256": "4f6e08e13c409ac5dee59d5343f5fdb1d16c35aa363aad75af8f0c144de29577", + "query_ordinal": 272, + "query_timestamp": 1700008274000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "560ecd70cf18f6105c88335deca328becc870d873676e5d6810b3d8ec4f92150", + "control_graph_rank_sha256": "b6e6b81b355d1f550bf5c19494f56226d53e7705e944d293434df19d209ef238", + "control_public_rank_sha256": "79b6828a4a55892de61ada0114889dbe7aab9e06bb8e56bc1014c3201906fba6", + "control_seed_rank_sha256": "560ecd70cf18f6105c88335deca328becc870d873676e5d6810b3d8ec4f92150", + "control_top1_age_events": 1151, + "control_top1_age_ms": 1151000, + "event_index": 8308, + "modality": "text", + "query_embedding_sha256": "c873e9f6c4a9082bfab6698176f26f70636e2098f8d9e06c2261387909c8bf56", + "query_ordinal": 273, + "query_timestamp": 1700008308000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "207c42c2342ac8ecdae8ae8fcd3c64934455959443db90b283a71f99a3c22bbe", + "control_graph_rank_sha256": "cbc9d1612c6e4e5e4dd1a0343fd5cadf98c7ac1b27d5aa4a4ac97f8686a24f4d", + "control_public_rank_sha256": "7e8e4582259b848b4f1d4abb0373b6b5bda61e6cabc7073e7acd3e71bd70b25c", + "control_seed_rank_sha256": "207c42c2342ac8ecdae8ae8fcd3c64934455959443db90b283a71f99a3c22bbe", + "control_top1_age_events": 40, + "control_top1_age_ms": 40000, + "event_index": 8344, + "modality": "text", + "query_embedding_sha256": "0e33760b4caa472c731a2e9156999a1ad46e883633fb2af0368f33e7c3ffb38e", + "query_ordinal": 274, + "query_timestamp": 1700008344000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "ff8b2d9c8209e399c78d1d9104b209c7c6322b59b8004d487ed1d8eba99cbc97", + "control_graph_rank_sha256": "ffa768c943745dabb27a0dd896d18186275404cbc1e352ccbddb1413ecf221f5", + "control_public_rank_sha256": "93aec3e447d8f1f484b3dfd4abacf082aef137e0e51d62c180bff8fe3aad07d5", + "control_seed_rank_sha256": "ff8b2d9c8209e399c78d1d9104b209c7c6322b59b8004d487ed1d8eba99cbc97", + "control_top1_age_events": 1494, + "control_top1_age_ms": 1494000, + "event_index": 8369, + "modality": "text", + "query_embedding_sha256": "af7c36f33aab2b97c1237d99dbb0231bd2dd8ab30ea638dd619ebbc7e218f660", + "query_ordinal": 275, + "query_timestamp": 1700008369000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "326f0b1ddefa9b23e2689eac201b9e315708498a8cb3cc4e3e25cd038aefd463", + "control_graph_rank_sha256": "ad4e946b4d22b23ab5dcba2eaaeb179d32f54561461c39d1ab85590f45dcb192", + "control_public_rank_sha256": "ba9c07c00f3003829ef660eaa33dfa4898d931831dd1357f8ac6294c70ab4d85", + "control_seed_rank_sha256": "326f0b1ddefa9b23e2689eac201b9e315708498a8cb3cc4e3e25cd038aefd463", + "control_top1_age_events": 2553, + "control_top1_age_ms": 2553000, + "event_index": 8404, + "modality": "text", + "query_embedding_sha256": "36f2c29ac473f0e0636fe07e8071f907c7c4f208f7c5b91cd87d64288b5506f0", + "query_ordinal": 276, + "query_timestamp": 1700008404000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "e2c4e21557329d5ff33b4867ff90b7e38ab22d79693086378e1961221b8fe6e7", + "control_graph_rank_sha256": "91697ea1091b90f4870c3af7273011b4a571ad357fb4c13935997a12390f7836", + "control_public_rank_sha256": "969291bf2b6883145c7e296c0310b3439d3e6120957d121e1503dd9dc9c358b4", + "control_seed_rank_sha256": "e2c4e21557329d5ff33b4867ff90b7e38ab22d79693086378e1961221b8fe6e7", + "control_top1_age_events": 23, + "control_top1_age_ms": 23000, + "event_index": 8435, + "modality": "text", + "query_embedding_sha256": "e022d29b84b472a318b935e4a191968caf59c93efb13ad1f5a15e8448e23986d", + "query_ordinal": 277, + "query_timestamp": 1700008435000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "d653583ffb2fc153223561556441560a49ee73cc1792e82375c76f13dd765086", + "control_graph_rank_sha256": "89f9e73004ca076607d3d8cfa12a6b77837dc0c1e1618a577f599932f134199b", + "control_public_rank_sha256": "472724c16acf25e64585ac2a266eb3cb7aec41efcd92d4b2d66b874b2ceaaeba", + "control_seed_rank_sha256": "d653583ffb2fc153223561556441560a49ee73cc1792e82375c76f13dd765086", + "control_top1_age_events": 101, + "control_top1_age_ms": 101000, + "event_index": 8470, + "modality": "text", + "query_embedding_sha256": "8bfd3edfbdff09bdca9935cb6ba3d3a4df567162236737c1d170cb67a5c74483", + "query_ordinal": 278, + "query_timestamp": 1700008470000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "f09ee132b312804c9c713ca28c2163819b0d8d9dfe96f09269a786ac8f1db29e", + "control_graph_rank_sha256": "b6cfb844c965619dda4efb2b2fdc9d38f07322a4377ffc0898aab5806d0bd535", + "control_public_rank_sha256": "6094617ef2ff47deac5e6c84e41932e4ddd286a70d55500a4084ac386e69dd38", + "control_seed_rank_sha256": "f09ee132b312804c9c713ca28c2163819b0d8d9dfe96f09269a786ac8f1db29e", + "control_top1_age_events": 15, + "control_top1_age_ms": 15000, + "event_index": 8498, + "modality": "text", + "query_embedding_sha256": "f1e0ad861f07afe261ae1666990b058acf9e326394ce184ade4c849f2f6224e3", + "query_ordinal": 279, + "query_timestamp": 1700008498000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "f964c46acd99109c99d1642373b7dc6c8f49983e70185231069416c0b99cb721", + "control_graph_rank_sha256": "dc15001c001ff95ffde8d76b0b513bf238a2644dfc3419462eb5181c8cf8bef5", + "control_public_rank_sha256": "e18e9f37a02c29b737c38d344874add29a585bd77c60706ed90bf9b599691060", + "control_seed_rank_sha256": "f964c46acd99109c99d1642373b7dc6c8f49983e70185231069416c0b99cb721", + "control_top1_age_events": 2280, + "control_top1_age_ms": 2280000, + "event_index": 8528, + "modality": "text", + "query_embedding_sha256": "cb824a81b76f26d82d5004436ef096c2bb6786b5658e2078d23833ec8864ec01", + "query_ordinal": 280, + "query_timestamp": 1700008528000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "3178f3387f956bacb0b45016514781448b00ab4a35dd67d7b981ffd81622224b", + "control_graph_rank_sha256": "877aa2266e7c27f68f9b77da50796b4f3c6aa68a8941658bbc7e8d52dd34d9bc", + "control_public_rank_sha256": "a46d7c3ff00fbaa719427d7dfe72d489795bdaf3d40ccdc47e3e8a59536a36ec", + "control_seed_rank_sha256": "3178f3387f956bacb0b45016514781448b00ab4a35dd67d7b981ffd81622224b", + "control_top1_age_events": 969, + "control_top1_age_ms": 969000, + "event_index": 8560, + "modality": "text", + "query_embedding_sha256": "5d480aab485c6e4acf1bd7c8449b799b02e0ae416c3efb1c8f0caa20303156fc", + "query_ordinal": 281, + "query_timestamp": 1700008560000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "310ebd7b889b5a299d7ec3b30f55aa5d88fd60d30b81359a5cfc44571e08240d", + "control_graph_rank_sha256": "014b5e6af8b38b66d559c8c99c3c47f72150e2fef51db48f780e96341ded1812", + "control_public_rank_sha256": "6b2c686991f9d1b745204fc7e2270838c9c7303f08285cabba083650ec434d90", + "control_seed_rank_sha256": "310ebd7b889b5a299d7ec3b30f55aa5d88fd60d30b81359a5cfc44571e08240d", + "control_top1_age_events": 1119, + "control_top1_age_ms": 1119000, + "event_index": 8590, + "modality": "text", + "query_embedding_sha256": "210db4c3dca8fe7d645f9667cc2db45e65d6a59987ff8592c3b00bd237c30ded", + "query_ordinal": 282, + "query_timestamp": 1700008590000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "199135807b133cfc89bbd65ec7ea4762d2a46885eaaa998893888eba404705e8", + "control_graph_rank_sha256": "de7d4fa21b17cbf94bccff1202f1ad7e56421a4169b66020946d88bde6dddd21", + "control_public_rank_sha256": "20436ac3316add8e37ab080de8e754ea8f0d123e2b8d8f193288e01e7e4b56f8", + "control_seed_rank_sha256": "199135807b133cfc89bbd65ec7ea4762d2a46885eaaa998893888eba404705e8", + "control_top1_age_events": 7622, + "control_top1_age_ms": 7622000, + "event_index": 8622, + "modality": "text", + "query_embedding_sha256": "336195d0986dfea40e6e498c7149dfc253e623f03bd0dd3fe0c15e8ceeeb27a8", + "query_ordinal": 283, + "query_timestamp": 1700008622000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "1b75edebd2f2d532843d9b72dce3d3224eff6d664040317eac90be83700f73e5", + "control_graph_rank_sha256": "a2e391ca208fac05bfc50b9374fc014ae12891eb1efe910afd9adba2f50397a7", + "control_public_rank_sha256": "1d072628bc9de4adee91c77cfc6afb9720b01183c15e3bc242dc9a485be6a376", + "control_seed_rank_sha256": "1b75edebd2f2d532843d9b72dce3d3224eff6d664040317eac90be83700f73e5", + "control_top1_age_events": 3514, + "control_top1_age_ms": 3514000, + "event_index": 8648, + "modality": "text", + "query_embedding_sha256": "a5cf2a1260f98dac1ae1b3286a9832126925e63c3d589d7b38334a3c72bb448a", + "query_ordinal": 284, + "query_timestamp": 1700008648000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "aaa0260812fcd3b4f73a276d944fb39744761ccb750ee1562c6726e8e8500703", + "control_graph_rank_sha256": "567ddc3c6072ebf89ab8d5d517eb4536aa2074c02915d0fc2449f8f936f30444", + "control_public_rank_sha256": "29672c201c7d035f9c7d6abe46d337005c31cc438c3356ac258ee28c04a285ad", + "control_seed_rank_sha256": "aaa0260812fcd3b4f73a276d944fb39744761ccb750ee1562c6726e8e8500703", + "control_top1_age_events": 123, + "control_top1_age_ms": 123000, + "event_index": 8683, + "modality": "text", + "query_embedding_sha256": "c83e26e405ccdfbb47b7f8e5da0585e0a7043df146f210b1095fa6dab409bab7", + "query_ordinal": 285, + "query_timestamp": 1700008683000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "02fd94b64843b6beaaad381c07c255806fa152f58e1126904ae8de535ea7835b", + "control_graph_rank_sha256": "fcc71a30699c5cdadcd045c6e805d11de849651753bac7262e9a7e6622c656d7", + "control_public_rank_sha256": "3c6c665cf51ab3ee1c9435fd815b2184d34275ea0a4e7ebbbd4204c798179083", + "control_seed_rank_sha256": "02fd94b64843b6beaaad381c07c255806fa152f58e1126904ae8de535ea7835b", + "control_top1_age_events": 93, + "control_top1_age_ms": 93000, + "event_index": 8711, + "modality": "text", + "query_embedding_sha256": "2c8ee236733e9207481101a06662fad3cf6d0c59c1dd2da92245a8d1f45932a5", + "query_ordinal": 286, + "query_timestamp": 1700008711000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "eb4ac23879837fda3b9904d0bb9b41c9aa8b6db9413040df8aea8a0b39a99505", + "control_graph_rank_sha256": "540a7f4158f5d58e975c2cf200d96ef017dba9c83a4aff5b3bf81a4c4e7239ed", + "control_public_rank_sha256": "5e9885b5727c48da8b2d8b6593166a67b70009169b069f2406009b17c5f3cba7", + "control_seed_rank_sha256": "eb4ac23879837fda3b9904d0bb9b41c9aa8b6db9413040df8aea8a0b39a99505", + "control_top1_age_events": 174, + "control_top1_age_ms": 174000, + "event_index": 8739, + "modality": "text", + "query_embedding_sha256": "4cd2aed2c77192cbe1d6079712bd2978572723ca39837661240cf7aa4bd230d9", + "query_ordinal": 287, + "query_timestamp": 1700008739000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "bbf4ac0c13d5824a2a00bc7566ed36abc69bc2e208da2fc24a7471aad078f305", + "control_graph_rank_sha256": "224296f053b19d29be5cf534dfed7bb84c8729d767e4f710a79053a90420b373", + "control_public_rank_sha256": "2bb3fea98f4c026723e4635acdc34a344687683fe3ab834d77631b5ba19276c7", + "control_seed_rank_sha256": "bbf4ac0c13d5824a2a00bc7566ed36abc69bc2e208da2fc24a7471aad078f305", + "control_top1_age_events": 1067, + "control_top1_age_ms": 1067000, + "event_index": 8771, + "modality": "text", + "query_embedding_sha256": "d48b3e81cffce1694e8387bf02f414340ccf9d21b077c980cbf7ae129359941e", + "query_ordinal": 288, + "query_timestamp": 1700008771000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "62c4acace90ea0f2db7d045541c57c23c365ff7273138e4b9665029f453c0a5e", + "control_graph_rank_sha256": "082b01338c4eeea217507cb0f2521d17d28ee4556f1647cb32924a7e432110c6", + "control_public_rank_sha256": "0d870eb8e1c34f93d3b122c9ccaf1000988e8eee330d80ab0f184d2553697b83", + "control_seed_rank_sha256": "62c4acace90ea0f2db7d045541c57c23c365ff7273138e4b9665029f453c0a5e", + "control_top1_age_events": 1140, + "control_top1_age_ms": 1140000, + "event_index": 8797, + "modality": "text", + "query_embedding_sha256": "0c1da721fe5464db0e94965f6b6493f4ff12b09819273226d8360230447ed21d", + "query_ordinal": 289, + "query_timestamp": 1700008797000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "370c3b457b7626a6b22e1fa09abc79311183b0d62fb3571f17510403cf6cb31f", + "control_graph_rank_sha256": "3d14aa5f7029c7590fa2ceadf0cfe660137d8d795915b7fde1359ca567347ac7", + "control_public_rank_sha256": "50fcecd20f12ed118e260f3dcf2d5452216187680e8c1d269406e1bf45d9d7f7", + "control_seed_rank_sha256": "370c3b457b7626a6b22e1fa09abc79311183b0d62fb3571f17510403cf6cb31f", + "control_top1_age_events": 13, + "control_top1_age_ms": 13000, + "event_index": 8828, + "modality": "text", + "query_embedding_sha256": "db35019fbd166c517db27ce95e57c59dd6d72d7db861da50ae6a220d260c3971", + "query_ordinal": 290, + "query_timestamp": 1700008828000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "0d81a5082f24ad7ed7c32398e0081657606af6b763de00b509dc0136d5c01b8c", + "control_graph_rank_sha256": "ce5ea1c3b4503608400fdf12c42456c242fd93d87a26de320217f4fced1a11a8", + "control_public_rank_sha256": "bc31dc31152e2d7b5e07e217d5c256b714d4478f215136963426e0bf2dfcdd7e", + "control_seed_rank_sha256": "0d81a5082f24ad7ed7c32398e0081657606af6b763de00b509dc0136d5c01b8c", + "control_top1_age_events": 297, + "control_top1_age_ms": 297000, + "event_index": 8857, + "modality": "text", + "query_embedding_sha256": "f78332b7b5519dca01706d5783f57191fbd50de6181f0208cb6e39fe45e4ed91", + "query_ordinal": 291, + "query_timestamp": 1700008857000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "c69ecb4a37a82febc0a8bdac387595bd35806c730ca1f47c01467d1e29a231dd", + "control_graph_rank_sha256": "830cfa88bae5f166a9add8d3c29f338770dbb3642cad73123efcda14f8f5dbba", + "control_public_rank_sha256": "9fdcdfe812ce9d28590b4fe5216d0628e5ea8b02a19cf2162d2eac8be4737dad", + "control_seed_rank_sha256": "c69ecb4a37a82febc0a8bdac387595bd35806c730ca1f47c01467d1e29a231dd", + "control_top1_age_events": 7607, + "control_top1_age_ms": 7607000, + "event_index": 8890, + "modality": "text", + "query_embedding_sha256": "03c363b8f4a6d43ef9eebf210b4f9ddd9efa96bfb2295a0af80f192a47e416ab", + "query_ordinal": 292, + "query_timestamp": 1700008890000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "c7e4cc25d28b779d1434a852021a0d94943437fb7c2f105872029d7e2e57f955", + "control_graph_rank_sha256": "92532d914da2f49efbc619d62a88db0870b515e736675384a41700510447d52d", + "control_public_rank_sha256": "f6a6480ccc13ef280fc5d96e1bca579c9503a6f7e3b9813676644651a93b46cf", + "control_seed_rank_sha256": "c7e4cc25d28b779d1434a852021a0d94943437fb7c2f105872029d7e2e57f955", + "control_top1_age_events": 1992, + "control_top1_age_ms": 1992000, + "event_index": 8926, + "modality": "text", + "query_embedding_sha256": "3e47f6b8fa2a301e2b4716dc47a28a3d54893b26ebfb0e2d9d490d8d0ce5c057", + "query_ordinal": 293, + "query_timestamp": 1700008926000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "c57747104bf7cd5cc123ac1f4474b93c6e0a18f829dd8e4d942266a7bd581aab", + "control_graph_rank_sha256": "bf90418a054d33fddf7e4abecbddb2f3c8c863d568e9280e6265bd7130786aff", + "control_public_rank_sha256": "3e9d603248ddb00f88dcea2f66a151df6cdd353dc937f3bd6350c96d37db7df3", + "control_seed_rank_sha256": "c57747104bf7cd5cc123ac1f4474b93c6e0a18f829dd8e4d942266a7bd581aab", + "control_top1_age_events": 1213, + "control_top1_age_ms": 1213000, + "event_index": 8954, + "modality": "text", + "query_embedding_sha256": "a1537d635318483e91fbc95370ec6c07eafdd0eb8962b6f920c58555f3838720", + "query_ordinal": 294, + "query_timestamp": 1700008954000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "010eb2a8d3f55d0bdc4bef465c84164f023b7573c50793791dadc9a198ccdb67", + "control_graph_rank_sha256": "48ef03b8a330f1e8bb8d085458b79b3014a865cfe0f05c609f8eb48ac4d963e8", + "control_public_rank_sha256": "5e17c2838148517fffc9a5d88795e205b4159ecfb21b2ced8ed3db58dff447c5", + "control_seed_rank_sha256": "010eb2a8d3f55d0bdc4bef465c84164f023b7573c50793791dadc9a198ccdb67", + "control_top1_age_events": 6304, + "control_top1_age_ms": 6304000, + "event_index": 8989, + "modality": "text", + "query_embedding_sha256": "05bd11a9958b5da4f9201f69fbaa92cf07daffc00f5e719a8c5e0336061a4230", + "query_ordinal": 295, + "query_timestamp": 1700008989000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "5b85a770e1ee9696921be8ffa4949956909d78ac01d476712810a4602025640d", + "control_graph_rank_sha256": "76da8fe7c6cee31a54216065a454d69a1aa8434916280912b43c9608fb73cbd1", + "control_public_rank_sha256": "04fc8a50c8b5cbc3dea6632d235697b12dadc5397400cea4cb67f0b6f45e9740", + "control_seed_rank_sha256": "5b85a770e1ee9696921be8ffa4949956909d78ac01d476712810a4602025640d", + "control_top1_age_events": 4, + "control_top1_age_ms": 4000, + "event_index": 9025, + "modality": "text", + "query_embedding_sha256": "8b405d18b7a409766da27f40c4384657bf2c464b9021e08f256c0f20cc62c8dc", + "query_ordinal": 296, + "query_timestamp": 1700009025000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "4f37106fb15f23d4791220f594b87cf9831a1371b5a46669df6f4a1606ce208b", + "control_graph_rank_sha256": "af7380e4d00e1a9b8e5f67da9bbd32c33f325b8f86b8998f57652cfb9bd49404", + "control_public_rank_sha256": "111e0cb9a6de60d97102ff7120cb6beb2480bd103fc36019e52bdffbe2f9247f", + "control_seed_rank_sha256": "4f37106fb15f23d4791220f594b87cf9831a1371b5a46669df6f4a1606ce208b", + "control_top1_age_events": 3667, + "control_top1_age_ms": 3667000, + "event_index": 9064, + "modality": "text", + "query_embedding_sha256": "b95dad50fc4b6610cbfdf8a212e965510fcf0afc6a39accf8113334ce01d10c6", + "query_ordinal": 297, + "query_timestamp": 1700009064000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "8e7cd25bb94ff1c2073d0ee93ec35e5267351745f3856b168314e44dac77f4a3", + "control_graph_rank_sha256": "feabf300863dabf07ea2adf25932634c0b5880feb5d5e53a24005c5bef909167", + "control_public_rank_sha256": "76c11e89573b24cd13e350d1661aa682df66ee4310c9f05115fc10ff0ae3544a", + "control_seed_rank_sha256": "8e7cd25bb94ff1c2073d0ee93ec35e5267351745f3856b168314e44dac77f4a3", + "control_top1_age_events": 13, + "control_top1_age_ms": 13000, + "event_index": 9098, + "modality": "text", + "query_embedding_sha256": "14a746905af677a5041c805d036f3c35ab3b45d24fa81d9495ebf739ed1c9ec2", + "query_ordinal": 298, + "query_timestamp": 1700009098000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "bf6060383713b80ef0f6974f6eefb6041330afb77766a1bf7e4a9dee8a33b08b", + "control_graph_rank_sha256": "d1921f692a66bc31dbd099b6ec17021b24406c2f32c448301c916942d9a0bd7b", + "control_public_rank_sha256": "5a8c34a0adab311a9ee7216b45dc5b9482ad70b6096e9202bdd119f0005e281e", + "control_seed_rank_sha256": "bf6060383713b80ef0f6974f6eefb6041330afb77766a1bf7e4a9dee8a33b08b", + "control_top1_age_events": 160, + "control_top1_age_ms": 160000, + "event_index": 9138, + "modality": "text", + "query_embedding_sha256": "343f76c67e55bb56be6ef203700e01140ed0c9863da2c62283e2916cc8c41c82", + "query_ordinal": 299, + "query_timestamp": 1700009138000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "a3019b53c9d84d38831fe1607ed3b2f8e28d1efe8cd9a32647434e0ccf35757f", + "control_graph_rank_sha256": "94ea96a92323796f619ab818f98342587a88785eafe565c25d77c216b812928c", + "control_public_rank_sha256": "33347aa9f5b084f04bda46d8323fdb348e5e6425f1d9761a25644fc7eb42e69d", + "control_seed_rank_sha256": "a3019b53c9d84d38831fe1607ed3b2f8e28d1efe8cd9a32647434e0ccf35757f", + "control_top1_age_events": 5, + "control_top1_age_ms": 5000, + "event_index": 9170, + "modality": "text", + "query_embedding_sha256": "97f27a8f0acd8f8a5acacb20af7997df38ed35211967c113a76ffd7abd95c74d", + "query_ordinal": 300, + "query_timestamp": 1700009170000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "430966fb94c1dddc81fffdf07705dfcf212fb37b85bb46577bd75ac677dabd80", + "control_graph_rank_sha256": "23a4c876cb4899e164817764ca5150f046008989fd7bda898e126b2112a30e98", + "control_public_rank_sha256": "1f5cb3327ebe91337bea16d702421833d90985f9d7ba89718d10f8f1d579bc88", + "control_seed_rank_sha256": "430966fb94c1dddc81fffdf07705dfcf212fb37b85bb46577bd75ac677dabd80", + "control_top1_age_events": 19, + "control_top1_age_ms": 19000, + "event_index": 9197, + "modality": "text", + "query_embedding_sha256": "938f4823a7c1996fffa373c95c93a7d10b183bd3337362a7941b67c81f248c28", + "query_ordinal": 301, + "query_timestamp": 1700009197000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "cef8e07555910adb8bc7022512c40097d8098d69930ec7c7069e12e314258285", + "control_graph_rank_sha256": "2da0bdd0710cd0619b63a823ff81ed1ce205415f769246a074aaf67b34b3b337", + "control_public_rank_sha256": "21f2c411653e601956d6021426c27dcb78b315e74d7ca4759337f39f9dc99fa1", + "control_seed_rank_sha256": "cef8e07555910adb8bc7022512c40097d8098d69930ec7c7069e12e314258285", + "control_top1_age_events": 3530, + "control_top1_age_ms": 3530000, + "event_index": 9226, + "modality": "text", + "query_embedding_sha256": "8f9acc8cc261856b5eb2ebf97ceba87ce92a80f198c17697d189532824099868", + "query_ordinal": 302, + "query_timestamp": 1700009226000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "d8b08fdba3f4bd70de9c63b052f073828b3b86382ab20f5c98634a826dfe659d", + "control_graph_rank_sha256": "4b9f5207ec88849ce06cadd34d84d2b99cbfe19cb3e581332dd19783e691b83e", + "control_public_rank_sha256": "e5218c931ede371075a662cd1dc150a2f2528935fab6d3a19d4f869494c1c5b0", + "control_seed_rank_sha256": "d8b08fdba3f4bd70de9c63b052f073828b3b86382ab20f5c98634a826dfe659d", + "control_top1_age_events": 191, + "control_top1_age_ms": 191000, + "event_index": 9256, + "modality": "text", + "query_embedding_sha256": "9b4d497b7aa5305101d3a400be2b303976577adc519238325c9046006e585745", + "query_ordinal": 303, + "query_timestamp": 1700009256000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "219cb0a68cf53560589f0af20eced8cfa47720c9661c2f2e4045169f40d79aac", + "control_graph_rank_sha256": "a20a05b6413ae7aa14a4b524714052a5214bbf457e5ca808fbd1051120875d78", + "control_public_rank_sha256": "e3fb6f0b15a2d2929ea47af3eafa4cc5b2c030d7f5876b29e44909a1d8a6b8b7", + "control_seed_rank_sha256": "219cb0a68cf53560589f0af20eced8cfa47720c9661c2f2e4045169f40d79aac", + "control_top1_age_events": 14, + "control_top1_age_ms": 14000, + "event_index": 9295, + "modality": "text", + "query_embedding_sha256": "4108bf4de6ad6e49c292e4bee3cf44567fe207fb17674580c974065948ccee57", + "query_ordinal": 304, + "query_timestamp": 1700009295000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "2f48f9396593db60aceb73733337068952466f4bf1f8abcfe4f849d375172378", + "control_graph_rank_sha256": "35662fdacfa22f89b9740005fe4a44d799d29130440930ad6b37380500717493", + "control_public_rank_sha256": "a31971e0d1d33eecd196124d90003d0101e05dea2af18ccd585068ca18c85ab5", + "control_seed_rank_sha256": "2f48f9396593db60aceb73733337068952466f4bf1f8abcfe4f849d375172378", + "control_top1_age_events": 621, + "control_top1_age_ms": 621000, + "event_index": 9328, + "modality": "text", + "query_embedding_sha256": "c881c63502fff0118e671e2505cfb3ac32077704586b48372ea323198dd85cd5", + "query_ordinal": 305, + "query_timestamp": 1700009328000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "272ce91da4fdafc0661ef2a58f4c1cb673499b733df87243d726bbb6c7da3f0e", + "control_graph_rank_sha256": "b256023990bf11c580205b03fa8deac5a26226571a328c286184b90ac610f60a", + "control_public_rank_sha256": "f1f66d7dff3c66169ce8f1cfaffa72706809ad0658447d7c01ff626cbc7add69", + "control_seed_rank_sha256": "272ce91da4fdafc0661ef2a58f4c1cb673499b733df87243d726bbb6c7da3f0e", + "control_top1_age_events": 8740, + "control_top1_age_ms": 8740000, + "event_index": 9358, + "modality": "text", + "query_embedding_sha256": "0225468b09154ee1651c88febe1dea435095ec1c278966451b94218a06317fc6", + "query_ordinal": 306, + "query_timestamp": 1700009358000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "f981c32c9bd4cc60b235e94ce6e1039af8f9f5ac65af3a6b0b782d5d3a0ea633", + "control_graph_rank_sha256": "6b7e908a530581aedad3771356063be072f43860fc5727409129e21660e25fea", + "control_public_rank_sha256": "e94fc8276d64ef8e79ce3752a3ceb085f2ad26968a76ce7ca43b97a939f145e1", + "control_seed_rank_sha256": "f981c32c9bd4cc60b235e94ce6e1039af8f9f5ac65af3a6b0b782d5d3a0ea633", + "control_top1_age_events": 2107, + "control_top1_age_ms": 2107000, + "event_index": 9391, + "modality": "text", + "query_embedding_sha256": "15fea5f0846603e8e0a3fe64e55f91d4b5890279e5a8ecc07961cb0610a537ef", + "query_ordinal": 307, + "query_timestamp": 1700009391000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "6cb584894b34db41ac605a1fe8b8fdd0755b5bf6474879ec8125c681d6438836", + "control_graph_rank_sha256": "d7db8774cba6630049fcbd112a75fe41ba44d4192e412ee71bbe7791ef179413", + "control_public_rank_sha256": "8474cd0b5c640e9c48a0461948c667bc80aebed9e106c51779f925d82c20d49e", + "control_seed_rank_sha256": "6cb584894b34db41ac605a1fe8b8fdd0755b5bf6474879ec8125c681d6438836", + "control_top1_age_events": 6696, + "control_top1_age_ms": 6696000, + "event_index": 9416, + "modality": "text", + "query_embedding_sha256": "e6b54175c9fc90c5a5579e9f4510fa0f34dfb37038858f7e6a3a4fa907682d14", + "query_ordinal": 308, + "query_timestamp": 1700009416000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "db4a2a4bb4a8e01219287550133c51640120fa350a2e01e946c979c7a51313c7", + "control_graph_rank_sha256": "05da8f1d74de1d026b332e54a74df7eb182ba14c960c45ca1c78aebbccb14c95", + "control_public_rank_sha256": "2f79690acb81ed9842dd02bb6bbf50c4c74eabb3c8daaafd47c6a050d834b9cc", + "control_seed_rank_sha256": "db4a2a4bb4a8e01219287550133c51640120fa350a2e01e946c979c7a51313c7", + "control_top1_age_events": 7469, + "control_top1_age_ms": 7469000, + "event_index": 9446, + "modality": "text", + "query_embedding_sha256": "69212ffb83d5a1b76f6627076f7c3dc35efb22ef5b83578970d96a91f382f66e", + "query_ordinal": 309, + "query_timestamp": 1700009446000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "3dd75f35013d3c8b2f99ec0565eb89f45844cf49750f5d1435d0196e7b083609", + "control_graph_rank_sha256": "c61946e2c93991f6398c2f8ccf9c4432c32dc36ab6d435b9c205f724bf5e35e2", + "control_public_rank_sha256": "4eba8c4de449115f2459cf45e8a6f1c9b4851c992172106343573121f96e6b7d", + "control_seed_rank_sha256": "3dd75f35013d3c8b2f99ec0565eb89f45844cf49750f5d1435d0196e7b083609", + "control_top1_age_events": 37, + "control_top1_age_ms": 37000, + "event_index": 9478, + "modality": "text", + "query_embedding_sha256": "90e589d17e8cf5e7be020abdaf0acd21fa990aebc3db1aa194aab73caee71ce1", + "query_ordinal": 310, + "query_timestamp": 1700009478000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "87121557a384b17a19f3d00ad318b10982040ba8f19b561f0b0d26729689e651", + "control_graph_rank_sha256": "60c309a7d001b541f1c6bd535723def2b588ca3f34569054ab46bdd6aa57d3cf", + "control_public_rank_sha256": "73b377343bccae9fa08be07d2e56bea00666487405dd315058d687c102a8d514", + "control_seed_rank_sha256": "87121557a384b17a19f3d00ad318b10982040ba8f19b561f0b0d26729689e651", + "control_top1_age_events": 710, + "control_top1_age_ms": 710000, + "event_index": 9510, + "modality": "text", + "query_embedding_sha256": "ecfe1e5546d83e752a2a31a000ff7c11db20b08039678ac51ff8a57b260f7f55", + "query_ordinal": 311, + "query_timestamp": 1700009510000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "9b4dc375a078acf34da3372f3fe2c8a6fd7cb23a69d96a53338353ed95b659eb", + "control_graph_rank_sha256": "f90aa172aaa771c9df188b947cdd580fd8cb6b6779c65cd790d54c68a790cf2c", + "control_public_rank_sha256": "a4624181102724153eb64e9195c0757b94a9228a17336ca9d471c7f30b69d3c3", + "control_seed_rank_sha256": "9b4dc375a078acf34da3372f3fe2c8a6fd7cb23a69d96a53338353ed95b659eb", + "control_top1_age_events": 7630, + "control_top1_age_ms": 7630000, + "event_index": 9537, + "modality": "text", + "query_embedding_sha256": "a038d61c442069ac413ffacc4dd5c420a17a4a6959bdcbe0f14010e47be5e74f", + "query_ordinal": 312, + "query_timestamp": 1700009537000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "3aab9d4746d2adfe517db478eed2c8f851e557f16c7c1948abc3ab4847226b1c", + "control_graph_rank_sha256": "b5f0cc6236fc156166c1b3bb3f69a23f6ede0ade015f284ee8385680321bef0f", + "control_public_rank_sha256": "950c786e13bae431c38762eb4c44df260c3b340a7d4a3f45c66783915fccf509", + "control_seed_rank_sha256": "3aab9d4746d2adfe517db478eed2c8f851e557f16c7c1948abc3ab4847226b1c", + "control_top1_age_events": 428, + "control_top1_age_ms": 428000, + "event_index": 9567, + "modality": "text", + "query_embedding_sha256": "58987d623ec096f345ea997419de3758e51f2d480812b8e532a273d2c26e9334", + "query_ordinal": 313, + "query_timestamp": 1700009567000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "aad57d08be9e58e949e7d8f2fa7484ff03e45b35f0c8262a541a006287e3e47d", + "control_graph_rank_sha256": "91a141098f511b5e703c75ac530646bf8743d612b79f19f4692d2e50da69c2ac", + "control_public_rank_sha256": "8fb8cff8c951f9522b07db5d527daa72f1b2d0c3f25ffbd8d26ec01755c868a5", + "control_seed_rank_sha256": "aad57d08be9e58e949e7d8f2fa7484ff03e45b35f0c8262a541a006287e3e47d", + "control_top1_age_events": 424, + "control_top1_age_ms": 424000, + "event_index": 9602, + "modality": "text", + "query_embedding_sha256": "eeaa0a77d2695eab172e4d5680f96660372962072fb15d9e90b63fc6db0f8c71", + "query_ordinal": 314, + "query_timestamp": 1700009602000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "662a1ff585e8de1165630a46e5d220cb9fd19a3941ea185f9256ec0d37020358", + "control_graph_rank_sha256": "a6534be2e2da5974def67e1429bfcbb78fc5030b3efa5f73fd3152dace20b2f9", + "control_public_rank_sha256": "f66fd8b7f2fc898860865603d60afc76cf6aa86d4998e7e373a37d5eadcad401", + "control_seed_rank_sha256": "662a1ff585e8de1165630a46e5d220cb9fd19a3941ea185f9256ec0d37020358", + "control_top1_age_events": 370, + "control_top1_age_ms": 370000, + "event_index": 9636, + "modality": "text", + "query_embedding_sha256": "c1b8649ccdb38bc24a311ea25b929c7d269aa859244ddee7befce23523bec9aa", + "query_ordinal": 315, + "query_timestamp": 1700009636000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "b8a9e21a32a73cf64dd9c5c65b07766dbc9efab6fa6bcd3b1e9b2cd9149798fb", + "control_graph_rank_sha256": "31a96a6f0ff28554a9f96c2f7d107eef0af8312746742e2f4d22c999f99e4c9a", + "control_public_rank_sha256": "28002341c23ff54bb019422dc8d1b0391b9e86a822de0eb5472060586406a6ba", + "control_seed_rank_sha256": "b8a9e21a32a73cf64dd9c5c65b07766dbc9efab6fa6bcd3b1e9b2cd9149798fb", + "control_top1_age_events": 564, + "control_top1_age_ms": 564000, + "event_index": 9675, + "modality": "text", + "query_embedding_sha256": "b0770e17a73833731ab7894c5eb340b96ed5c5ffefbf8a79670f3624bbd967c9", + "query_ordinal": 316, + "query_timestamp": 1700009675000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "6d57b58fa4ce0a0c22a5e9e092c1be6a8ed7cf54fa6cca22236a37f51a70fe38", + "control_graph_rank_sha256": "7f710e7aeddfc927925e327dcf45e8b2d2b16d9175f6bb94e09570a5cdbb8762", + "control_public_rank_sha256": "06dc278457fd34b69c4e5a24b0c862daf82d8b9eb323a0664abdd5c0d6715177", + "control_seed_rank_sha256": "6d57b58fa4ce0a0c22a5e9e092c1be6a8ed7cf54fa6cca22236a37f51a70fe38", + "control_top1_age_events": 1619, + "control_top1_age_ms": 1619000, + "event_index": 9707, + "modality": "text", + "query_embedding_sha256": "79dbf595163aa85b8418519d370671caccd8196f19fce2921ae84c10345bd433", + "query_ordinal": 317, + "query_timestamp": 1700009707000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "91c4e96a169a6d2af29fb34a03b66ae2511b127d2e844003d8fd6403124795d7", + "control_graph_rank_sha256": "fa49245f8ebf6b6fd3417e01defcbb936c29cd93b3fd55d2dee8682fedff0623", + "control_public_rank_sha256": "afdd13e5e984137e164d75bb68508c3155799669f0e2d53193fbdbc46ab2a786", + "control_seed_rank_sha256": "91c4e96a169a6d2af29fb34a03b66ae2511b127d2e844003d8fd6403124795d7", + "control_top1_age_events": 2949, + "control_top1_age_ms": 2949000, + "event_index": 9744, + "modality": "text", + "query_embedding_sha256": "25d15c46a765de175ccabe8420fcae14a687e40e2059a7dcf5d2081caf46907b", + "query_ordinal": 318, + "query_timestamp": 1700009744000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "84937c5cd3971c434d9d96f36fcb6eb8b7606172b730ea3a35e3f8181df39f5e", + "control_graph_rank_sha256": "afe92ac1417274a1ca14bf91fd47a9963c5b2d3c2b4dff0ff6fe331ef71bd54a", + "control_public_rank_sha256": "729eee1e816b49a90102430f2cb8c277dab6ac07f6be31941227cdc100b6c21a", + "control_seed_rank_sha256": "84937c5cd3971c434d9d96f36fcb6eb8b7606172b730ea3a35e3f8181df39f5e", + "control_top1_age_events": 480, + "control_top1_age_ms": 480000, + "event_index": 9775, + "modality": "text", + "query_embedding_sha256": "3a45f5fc39ff4caa58dcbdf12aaaa29efc51d1dbdb10286bad4e943173cc209d", + "query_ordinal": 319, + "query_timestamp": 1700009775000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "eb9ef6c3088b06505cc50f9e4c36faf2d929728a3fef3ca9f5421df5cc3913af", + "control_graph_rank_sha256": "f579c92b8bac0ff49cfc1e6e24ae7e5ef439858ca261424775c8dff813100152", + "control_public_rank_sha256": "9bbe809b41e37f6817062f1565d2eeaf2d74e605c06c1e81ab8757f0315e25d2", + "control_seed_rank_sha256": "eb9ef6c3088b06505cc50f9e4c36faf2d929728a3fef3ca9f5421df5cc3913af", + "control_top1_age_events": 327, + "control_top1_age_ms": 327000, + "event_index": 9808, + "modality": "text", + "query_embedding_sha256": "c28a606e028f74e8cdbc558e9a6efc5918e4da729a67f97abdfb2cd9a39831f1", + "query_ordinal": 320, + "query_timestamp": 1700009808000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "66cd73b4a61e0c7eeb60e24573e17c405527e23e2f724557f26d1c4d23e704b5", + "control_graph_rank_sha256": "160e80a16c8ebc90dde8c65296b2e30a8d105414ef0f4df406c21ee5f585d3a8", + "control_public_rank_sha256": "f98648b83165761f0ab1e0e3c50d5689f2381205713fb42f197b17e7d21c33ac", + "control_seed_rank_sha256": "66cd73b4a61e0c7eeb60e24573e17c405527e23e2f724557f26d1c4d23e704b5", + "control_top1_age_events": 3345, + "control_top1_age_ms": 3345000, + "event_index": 9841, + "modality": "text", + "query_embedding_sha256": "0eab653d0aa38a2ca06763694bd5145793ab8de4d010a94673fa4df38c421f1f", + "query_ordinal": 321, + "query_timestamp": 1700009841000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "14185b4c2a9fa9c476e180ac6c56f444e990da62a3d27677ba1b1ce3d359cc9e", + "control_graph_rank_sha256": "4497546ab49510d2b2ba642724de800ea76471da7cd4a3cbb5f3cc1ca09a4918", + "control_public_rank_sha256": "90f4e9340154993ef0dd0f4746ff6b5d9ccac86598d22dd1fdad1574cb331915", + "control_seed_rank_sha256": "14185b4c2a9fa9c476e180ac6c56f444e990da62a3d27677ba1b1ce3d359cc9e", + "control_top1_age_events": 166, + "control_top1_age_ms": 166000, + "event_index": 9873, + "modality": "text", + "query_embedding_sha256": "4a08b66dae7682731ab2b588ecbf011ad7bf94625c2e7287ccc21c6a9d27eaa0", + "query_ordinal": 322, + "query_timestamp": 1700009873000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "49d3b00824c9004d6d5dca71bd8431c14dc35f1f7bd825221013ebbca1e9b21a", + "control_graph_rank_sha256": "ab7419b8c0b45954804a46429f1cd40d0d25cc7ca0629c8240f5209d8ba11777", + "control_public_rank_sha256": "f9feb59014346a4081dc306ad2131da0e6d3a9234ae6efa50990152cb0e871ef", + "control_seed_rank_sha256": "49d3b00824c9004d6d5dca71bd8431c14dc35f1f7bd825221013ebbca1e9b21a", + "control_top1_age_events": 1165, + "control_top1_age_ms": 1165000, + "event_index": 9904, + "modality": "text", + "query_embedding_sha256": "65923c6df9b9b88c2068a34cb484d4f0839782f9aa54025b0fd0b3eeddd90a94", + "query_ordinal": 323, + "query_timestamp": 1700009904000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "6f2aeee46d66f6b30bf8f38609e6a45230d17da7945df7fc40e883a1a8aff56f", + "control_graph_rank_sha256": "e78b390eb96d1495174bcbcd7230272a8afc64ed11cee430640bdc1080fc8691", + "control_public_rank_sha256": "5c15799252ada5cc269b0d9a7e26bd15af31f916f692d4165b37280eab6e7c79", + "control_seed_rank_sha256": "6f2aeee46d66f6b30bf8f38609e6a45230d17da7945df7fc40e883a1a8aff56f", + "control_top1_age_events": 128, + "control_top1_age_ms": 128000, + "event_index": 9936, + "modality": "text", + "query_embedding_sha256": "9364ebbe1cf7407558a34b70064809375702ac7cb955f8a94b4b5c855157700d", + "query_ordinal": 324, + "query_timestamp": 1700009936000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "aba668a3ee1aaacad7b36fbae956857a65fcccedadcf7add879dc9e72f81511a", + "control_graph_rank_sha256": "fc3962e364bb027133ac1d440a81524660bfe57d487858c9c3fea444e3ec3146", + "control_public_rank_sha256": "9d1a235fd02a24f9d99ca2ad2c0514beeaf4ae88573867073a9aee2ec6239381", + "control_seed_rank_sha256": "aba668a3ee1aaacad7b36fbae956857a65fcccedadcf7add879dc9e72f81511a", + "control_top1_age_events": 2715, + "control_top1_age_ms": 2715000, + "event_index": 9964, + "modality": "text", + "query_embedding_sha256": "2479d3a10edce632ef02999c6c66dc2459702f4037390635619dafcacfb162bf", + "query_ordinal": 325, + "query_timestamp": 1700009964000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "e2a3d5078d0ead516232380981831564f5975175f305f531c746535ab6a91771", + "control_graph_rank_sha256": "4edfb04af8157daac7ef225d1b45be776d492e71bec750be5d559f7b70bbba2e", + "control_public_rank_sha256": "a2ba342054e2819363acb40c67e3deff5a7f51959373c7ad8b409b554f422abb", + "control_seed_rank_sha256": "e2a3d5078d0ead516232380981831564f5975175f305f531c746535ab6a91771", + "control_top1_age_events": 3309, + "control_top1_age_ms": 3309000, + "event_index": 9993, + "modality": "text", + "query_embedding_sha256": "daccb00e28f4ea703086dbc2efdb416ce5640e7a0d5dca29790505db02d888c2", + "query_ordinal": 326, + "query_timestamp": 1700009993000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "727e6ff8ba8fabbf3cd9115cf8d213604b058426334dc842c6c4a362e35e74aa", + "control_graph_rank_sha256": "64e02cc2824d3f65a82f4ba12fe75e7f2bcbc275ccc86ea1937df34d2e8d5a33", + "control_public_rank_sha256": "6527bc653ce3b78d06ca79392f92a1e0c5d70a7b6d75b636b47a9a5898ab8a94", + "control_seed_rank_sha256": "727e6ff8ba8fabbf3cd9115cf8d213604b058426334dc842c6c4a362e35e74aa", + "control_top1_age_events": 8, + "control_top1_age_ms": 8000, + "event_index": 10024, + "modality": "text", + "query_embedding_sha256": "096177a5a9d53a92573074f77cec7c81d3c44e4a634a577da09882014f8195e9", + "query_ordinal": 327, + "query_timestamp": 1700010024000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "48cd06aea656e1d33125d9ac5cb9f4fbd947763adb205378783ddcd0fa00ee6f", + "control_graph_rank_sha256": "41a18bc688c12141a61b1ee181234788dc70635b7ec370b85e81093b21c5c73c", + "control_public_rank_sha256": "12ec77f465a19396d12c125a8d0e030e3a69a0d5881336dbb6224ad0ae7a5ca7", + "control_seed_rank_sha256": "48cd06aea656e1d33125d9ac5cb9f4fbd947763adb205378783ddcd0fa00ee6f", + "control_top1_age_events": 22, + "control_top1_age_ms": 22000, + "event_index": 10054, + "modality": "text", + "query_embedding_sha256": "b6f06ed31b0e7b9bfad6b9aa093e0f92e9e0d76c7c06eedca80143cb626cc701", + "query_ordinal": 328, + "query_timestamp": 1700010054000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "576bfca91606853649b283a6aabf2a1f198ff68baa76e6a59f7be1405c19c2dc", + "control_graph_rank_sha256": "cb5a141dc57d0c59c8db8f5c7bdcb5009ae46d0e01bf691ac2138b9f7dee0295", + "control_public_rank_sha256": "7828ee2c73489b5bd727daf226fcda6a799621dd16be39ae383c4145e2a6e160", + "control_seed_rank_sha256": "576bfca91606853649b283a6aabf2a1f198ff68baa76e6a59f7be1405c19c2dc", + "control_top1_age_events": 11, + "control_top1_age_ms": 11000, + "event_index": 10086, + "modality": "text", + "query_embedding_sha256": "997861af9afc91b6ea05143424d2f39cd5c3041f76f351a2ef5ee039fc1812db", + "query_ordinal": 329, + "query_timestamp": 1700010086000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "6c30b95929b892765cdc187651bf6cd69480f2cffbc2eb0545fee6fd397d1e24", + "control_graph_rank_sha256": "ac85ecc45d8dbef2d0d8c173495f638ae7c3142430bdb57185eab12f61a23577", + "control_public_rank_sha256": "fce9699187c57d04bf06496915c838783a5f9d1c7a53e0db95742c3ba41ea2a9", + "control_seed_rank_sha256": "6c30b95929b892765cdc187651bf6cd69480f2cffbc2eb0545fee6fd397d1e24", + "control_top1_age_events": 6590, + "control_top1_age_ms": 6590000, + "event_index": 10118, + "modality": "text", + "query_embedding_sha256": "0c2274ccadbb0d568a7581408b31048b2609f4916d65e7cda3d4a51804940491", + "query_ordinal": 330, + "query_timestamp": 1700010118000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "7b9a020681e7a69f1bd601327481f88ca06243853e1e061c1e9b0d428054b29e", + "control_graph_rank_sha256": "f2aef7961ea39f6df2b3041f1d17dea8476aca2ddb5960125e8d819a6e67a566", + "control_public_rank_sha256": "4ea3b5702022dbd4f53dd78316382ef7bf9131a505658b1cc6043c2381740133", + "control_seed_rank_sha256": "7b9a020681e7a69f1bd601327481f88ca06243853e1e061c1e9b0d428054b29e", + "control_top1_age_events": 499, + "control_top1_age_ms": 499000, + "event_index": 10145, + "modality": "text", + "query_embedding_sha256": "3e12c69bcd356bfba756156ab6386e3a9793f339e254238ef94cfba2cb084567", + "query_ordinal": 331, + "query_timestamp": 1700010145000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "d037f220bb5a9f5c3436be7af9adb5ca2cfce67b89d3e3f2bd9231c0624460ed", + "control_graph_rank_sha256": "6476abe29a86315bc82b11c8db1a122849a4ec00e9b838ad65a50ad4a0c0c098", + "control_public_rank_sha256": "188f3bb666bb1d58ebc046a9b3ad3fa63f82b8d8ab2ffbb34d66dd47a97998a3", + "control_seed_rank_sha256": "d037f220bb5a9f5c3436be7af9adb5ca2cfce67b89d3e3f2bd9231c0624460ed", + "control_top1_age_events": 6287, + "control_top1_age_ms": 6287000, + "event_index": 10180, + "modality": "text", + "query_embedding_sha256": "9c4017918ff90f8aca8e14c1b839f16769987b513245defca3020a0e080c3190", + "query_ordinal": 332, + "query_timestamp": 1700010180000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "069d89e5fa7bad087fbdb995b213726742d9047cf061c67e83a20c8f619d5f1e", + "control_graph_rank_sha256": "40a17a59d4d3945b69624476f20df6965732dac3392f69b03835b6d4043116e1", + "control_public_rank_sha256": "6fdd24d791b9c295077444f0606b421962829326b04e812ada7de222c4c151aa", + "control_seed_rank_sha256": "069d89e5fa7bad087fbdb995b213726742d9047cf061c67e83a20c8f619d5f1e", + "control_top1_age_events": 3608, + "control_top1_age_ms": 3608000, + "event_index": 10210, + "modality": "text", + "query_embedding_sha256": "9508f1e068aa3819792963592a3f03449eb3c3b117579c676b59c61ed9c01f82", + "query_ordinal": 333, + "query_timestamp": 1700010210000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "3a710c9ed8acaafd9759514d1ced38bd60be6c85d96bb6c55a411cb0fd4abaa5", + "control_graph_rank_sha256": "ad29032c92c35c51f46870c215c76bdb84b7e988245ad2809adc25e7cfded85a", + "control_public_rank_sha256": "a589998b0b1964720c254971c63aa5f112c6e3087a317c5596a33feaf14dd194", + "control_seed_rank_sha256": "3a710c9ed8acaafd9759514d1ced38bd60be6c85d96bb6c55a411cb0fd4abaa5", + "control_top1_age_events": 2997, + "control_top1_age_ms": 2997000, + "event_index": 10246, + "modality": "text", + "query_embedding_sha256": "c5b00c1aed57320bcd21fb27b895e8845a9a194cdced3278a945a6b1a60c4f8f", + "query_ordinal": 334, + "query_timestamp": 1700010246000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "a89bbb66934e17b27acddad9e15257a288d0851eba4ef1d84eeaaa735f1650da", + "control_graph_rank_sha256": "d6f2d404990e7a0165525623a75037ed324255ccc0a3f448eda50b1206343412", + "control_public_rank_sha256": "b6d1faf1c8c589c3b792554cda2aa3120c6106f93acd1ee3ddb368d9f693dd31", + "control_seed_rank_sha256": "a89bbb66934e17b27acddad9e15257a288d0851eba4ef1d84eeaaa735f1650da", + "control_top1_age_events": 5995, + "control_top1_age_ms": 5995000, + "event_index": 10279, + "modality": "text", + "query_embedding_sha256": "e15639775802240e9c2e5e37fcd2142d86048f6c9b14043c5c86e63495a99529", + "query_ordinal": 335, + "query_timestamp": 1700010279000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "ba3c6664a96a06d784fd3c2535fdea44b1d66ad6ed64dbd32ebb8fb6b6ed6a46", + "control_graph_rank_sha256": "c976abc76bb0307a3a265b26d689a87c1394cf5e97182188edb78d1a7486d358", + "control_public_rank_sha256": "2ca8478237c416aa5d5b6df193b19c206a7b0c150c2a5d6b245e77c99be9df0d", + "control_seed_rank_sha256": "ba3c6664a96a06d784fd3c2535fdea44b1d66ad6ed64dbd32ebb8fb6b6ed6a46", + "control_top1_age_events": 430, + "control_top1_age_ms": 430000, + "event_index": 10303, + "modality": "text", + "query_embedding_sha256": "363cd51cde8fe2b508aa8dbf7ea7e23a743712f53072b6315987466ad85c71ba", + "query_ordinal": 336, + "query_timestamp": 1700010303000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "a1f2d934e6db2b005ca763ab80527d69960134058b82499e0ac8829732c0fcd9", + "control_graph_rank_sha256": "f01e18650baee47e1d964c625b31be28b458f51df10764da3294697bb0448729", + "control_public_rank_sha256": "ce7d6c5e26e121d3fb9b26c6850845f1e31286b7c6c3cbc019126056ce11c595", + "control_seed_rank_sha256": "a1f2d934e6db2b005ca763ab80527d69960134058b82499e0ac8829732c0fcd9", + "control_top1_age_events": 6051, + "control_top1_age_ms": 6051000, + "event_index": 10335, + "modality": "text", + "query_embedding_sha256": "e15639775802240e9c2e5e37fcd2142d86048f6c9b14043c5c86e63495a99529", + "query_ordinal": 337, + "query_timestamp": 1700010335000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "e69e71f1740364a60583f3235c7137dd4d68fb8ab0aa942daa4a14c2ae88f96d", + "control_graph_rank_sha256": "d349ff7de18d7f20d4e11f947a2c15b87934d9a737fdf553f3580f73fcba7a97", + "control_public_rank_sha256": "a14ae29fbef9741ec3d6248dc6418eb7e8a310a9bb87d31d9b35f4e21eeccc72", + "control_seed_rank_sha256": "e69e71f1740364a60583f3235c7137dd4d68fb8ab0aa942daa4a14c2ae88f96d", + "control_top1_age_events": 2395, + "control_top1_age_ms": 2395000, + "event_index": 10364, + "modality": "text", + "query_embedding_sha256": "b960803c518f3ff8e3bf8264b9e67aac067a8597f239ecc6548914f4d80e6f53", + "query_ordinal": 338, + "query_timestamp": 1700010364000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "458a82c93efc7713bc8b52e442fbaffd4ca550eb8eaa1e2bc1207b948db1a135", + "control_graph_rank_sha256": "e9fc6298bcf94864bf6c0c3b3f0b49ac6f1e52a4dafe23dfb2de4bd66dcd7e4a", + "control_public_rank_sha256": "efc701a090c91a3fa4691b454bee8bc5ee3102adf301ed2c7dd352d65352c2cd", + "control_seed_rank_sha256": "458a82c93efc7713bc8b52e442fbaffd4ca550eb8eaa1e2bc1207b948db1a135", + "control_top1_age_events": 3112, + "control_top1_age_ms": 3112000, + "event_index": 10396, + "modality": "text", + "query_embedding_sha256": "43baf000f62811cdf76a2148367fe89a761cc2050a91e591906ce2d371e7c9ed", + "query_ordinal": 339, + "query_timestamp": 1700010396000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "5b872a79fffddf3049ddcecefd43cecbd5afef4230536fd1e6ce0cd932e8c2c8", + "control_graph_rank_sha256": "ad966bda6517de9258e9f883fdbbe653a5d882047044a578e111140593530bf2", + "control_public_rank_sha256": "36fe79dac026f4149fdb1a68bcb8c6516cc1408f83234c483ac4feb6323509f4", + "control_seed_rank_sha256": "5b872a79fffddf3049ddcecefd43cecbd5afef4230536fd1e6ce0cd932e8c2c8", + "control_top1_age_events": 665, + "control_top1_age_ms": 665000, + "event_index": 10424, + "modality": "text", + "query_embedding_sha256": "16fdb12fa6b7026f5300d871f2981ef67f5aab02ee0f9bc3ee8fafa202ef5e82", + "query_ordinal": 340, + "query_timestamp": 1700010424000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "c3785a0cb2b83250deb10e0bb3f6490ebe8e9d210b8afa82acccd115c28d8e31", + "control_graph_rank_sha256": "d281a26a058bb797967d5b5dcb7d9de49ee3e207abf5b168ad8473251870494c", + "control_public_rank_sha256": "6c79a9f81a56539160701e6450c31dec4b97234e85883085c8a9010963ac6b5f", + "control_seed_rank_sha256": "c3785a0cb2b83250deb10e0bb3f6490ebe8e9d210b8afa82acccd115c28d8e31", + "control_top1_age_events": 5169, + "control_top1_age_ms": 5169000, + "event_index": 10456, + "modality": "text", + "query_embedding_sha256": "d7c124b03b90bf97dd4ff0af36094870b81905c1e6dd79b1dc718ac3c0f894e8", + "query_ordinal": 341, + "query_timestamp": 1700010456000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "320d9b3151d5226ddd9d3258dbe796c1da7e32aeba1df5b7e120c9a986f03b7a", + "control_graph_rank_sha256": "143089fd9cfd3bc58bc3635491a285f3421fb06d6644bdd33fb2d7f1f0584642", + "control_public_rank_sha256": "e164c1e609fe77a97b7f338bace06a8460a764574009907a82b4441151aa19e8", + "control_seed_rank_sha256": "320d9b3151d5226ddd9d3258dbe796c1da7e32aeba1df5b7e120c9a986f03b7a", + "control_top1_age_events": 5, + "control_top1_age_ms": 5000, + "event_index": 10488, + "modality": "text", + "query_embedding_sha256": "318be79b5952674768b09a766d2648fa104d9e721527e2942205f27a38b8141d", + "query_ordinal": 342, + "query_timestamp": 1700010488000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "3e8091c937069e4ea74bfef0de3ee20007fd86a00b496468bb6fb80dd9cc4e6f", + "control_graph_rank_sha256": "34287d4788fbaa0e190b08ec580ddbfd0b66e14f45c82fdaaff97a7e0f2dc94a", + "control_public_rank_sha256": "85e337be7970ed6afc7db3bb62c032bd7034f09f9addc6167709f8d48c3e08c1", + "control_seed_rank_sha256": "3e8091c937069e4ea74bfef0de3ee20007fd86a00b496468bb6fb80dd9cc4e6f", + "control_top1_age_events": 652, + "control_top1_age_ms": 652000, + "event_index": 10518, + "modality": "text", + "query_embedding_sha256": "05d2e954b22ba152157afaea5648fb95606c4358cb2c827c48f10f06c6626cca", + "query_ordinal": 343, + "query_timestamp": 1700010518000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "00616f37567e966146c03fd1fa1951914f662ffed3f59cb1538c32529c2ce419", + "control_graph_rank_sha256": "0d096c3c228263430e154ecbaff2b1d6e9106e081f41919e281a997c33114445", + "control_public_rank_sha256": "f15f62c4ef7e5dc16daebfd2ad5eeb53324b2d010806f377174b9ec692c58109", + "control_seed_rank_sha256": "00616f37567e966146c03fd1fa1951914f662ffed3f59cb1538c32529c2ce419", + "control_top1_age_events": 2938, + "control_top1_age_ms": 2938000, + "event_index": 10552, + "modality": "text", + "query_embedding_sha256": "8cbee09794a2601957c20c46b121ccfc6ce4551098933af2101bd3c57bca3c4b", + "query_ordinal": 344, + "query_timestamp": 1700010552000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "633f45ac54cbb6f8f7e8e973a92ee363ef3f950321cb33ca93eb908e8785fa1d", + "control_graph_rank_sha256": "16a8d9fe48a9a5acd054cadcbcfa2ee3022d1c4d643e240d2c4fb638158f55e4", + "control_public_rank_sha256": "d99598e10ce1ac716b2665f59b407f234bb0592b25b6d66576a9a30c0fd16d9b", + "control_seed_rank_sha256": "633f45ac54cbb6f8f7e8e973a92ee363ef3f950321cb33ca93eb908e8785fa1d", + "control_top1_age_events": 31, + "control_top1_age_ms": 31000, + "event_index": 10583, + "modality": "text", + "query_embedding_sha256": "da7d6985b5300991dfd2cb4c9ab8a53b8c8f3d6c1dd33ddac488a6d0ee1e0740", + "query_ordinal": 345, + "query_timestamp": 1700010583000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "2153745d4326c022712f4d11f39e408bf2be47fea07d10cbd2375254f8fb3b5c", + "control_graph_rank_sha256": "dd7f79ec9e3f7ac70969369f94775eeb41d8451a13497e1e01b3c4d52d0b3445", + "control_public_rank_sha256": "339d38ac1a87239c1496663b65f52d0b756a4a2112185cb6880327d12c3ef213", + "control_seed_rank_sha256": "2153745d4326c022712f4d11f39e408bf2be47fea07d10cbd2375254f8fb3b5c", + "control_top1_age_events": 7453, + "control_top1_age_ms": 7453000, + "event_index": 10617, + "modality": "text", + "query_embedding_sha256": "0e3dcb052e6af99d1826aa7088da02d599481c064db9c40e680fbbc23e2ce1d4", + "query_ordinal": 346, + "query_timestamp": 1700010617000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "f9abfc74e89a428d4a633c68b17ae3a4bad2c5d00a74ed2b9295af099930bffe", + "control_graph_rank_sha256": "53b38cd4b7c81fdaa519a9e8d8abdc3a2891e2a08a8d5afe7a7c14b549096c6e", + "control_public_rank_sha256": "56e730aef45ec518bf1194382b9cd99b02ab6a8a6c0f5d80806d489c4712ae8f", + "control_seed_rank_sha256": "f9abfc74e89a428d4a633c68b17ae3a4bad2c5d00a74ed2b9295af099930bffe", + "control_top1_age_events": 3017, + "control_top1_age_ms": 3017000, + "event_index": 10646, + "modality": "text", + "query_embedding_sha256": "1bda2fc14d1d5153e4838e59c25ebeb86b7ce9aad67e8d66e63dd0143630fe20", + "query_ordinal": 347, + "query_timestamp": 1700010646000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "5d40ead340040441dd43921107cba4440a5e0945ddf04d698e2152f84e34094b", + "control_graph_rank_sha256": "1e929e1d8def101097d2b79cd6b58df9872a51785c15757c2cc93ff3f0b64f50", + "control_public_rank_sha256": "26b5531d9caa33c1e22dcbb2a3f66118cdd1ec480db502b127e423351365891a", + "control_seed_rank_sha256": "5d40ead340040441dd43921107cba4440a5e0945ddf04d698e2152f84e34094b", + "control_top1_age_events": 8714, + "control_top1_age_ms": 8714000, + "event_index": 10682, + "modality": "text", + "query_embedding_sha256": "c18e7599f8aca6076f837feae487d226fb27b3313cd44c50794450e1031c7646", + "query_ordinal": 348, + "query_timestamp": 1700010682000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "2d69669d7c89d08c506f53238f63be75d5618abc6e43af957c7648487e8fab61", + "control_graph_rank_sha256": "413ff67874c0bda0b67469e51c5220f6584895351577e771c6238ce910b7c1aa", + "control_public_rank_sha256": "4056ae5d8dd9f8a272579f1e76cd707fa6161ec8eaa4847e6f056a28b4ee09bc", + "control_seed_rank_sha256": "2d69669d7c89d08c506f53238f63be75d5618abc6e43af957c7648487e8fab61", + "control_top1_age_events": 1235, + "control_top1_age_ms": 1235000, + "event_index": 10716, + "modality": "text", + "query_embedding_sha256": "1c2a6003a449c8d2d3bda5e4b8774d723e8c60b7d11bd27c4c300ab60f151a77", + "query_ordinal": 349, + "query_timestamp": 1700010716000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "db45c25c2f3b9df80a15995953b6c2012085104a6a454f2ab4e453588f606815", + "control_graph_rank_sha256": "96224488fd324db34a8db09a9159376aa48211deb9a3ccabaa4c8317eba1991f", + "control_public_rank_sha256": "ff082cfdabb7952b31a3bec5a939d855c50229672db7568a9cb5c5a266f1584f", + "control_seed_rank_sha256": "db45c25c2f3b9df80a15995953b6c2012085104a6a454f2ab4e453588f606815", + "control_top1_age_events": 8177, + "control_top1_age_ms": 8177000, + "event_index": 10743, + "modality": "text", + "query_embedding_sha256": "385e775d52860dcf019a026aabd7feb0f3aef5be0bfd5f78f6bc888fc81d2e30", + "query_ordinal": 350, + "query_timestamp": 1700010743000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "5d82a8f0747378f04dcbf2796e79c5d5d831d5e6cd81a49d093b7733bfcde21f", + "control_graph_rank_sha256": "68c268c69ad1e51f3daeba1a01c228e88c06b7628ada86a25da38f9bdb240b76", + "control_public_rank_sha256": "ea9138b066e7387c616b7de41a3eeb79384f1acf1bc91b2a39b49c8453ef552b", + "control_seed_rank_sha256": "5d82a8f0747378f04dcbf2796e79c5d5d831d5e6cd81a49d093b7733bfcde21f", + "control_top1_age_events": 2218, + "control_top1_age_ms": 2218000, + "event_index": 10778, + "modality": "text", + "query_embedding_sha256": "3a1af3040cc8ba5bc33872f4d41d8b7f8bf04b835e5b3034d9780834c4e797ff", + "query_ordinal": 351, + "query_timestamp": 1700010778000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "a6b50c02ca938ef9583bd28d6f43b4c1889395d05b3d3256d1a608f92183b66f", + "control_graph_rank_sha256": "5068725a7d7b9d0cca10eca1ba665b021806118da74ac46e0f116b68c62ac5f6", + "control_public_rank_sha256": "8fb3c6c1b03714ff136a838ca6eebd62d88b82e3476084ccc676a179cda4545a", + "control_seed_rank_sha256": "a6b50c02ca938ef9583bd28d6f43b4c1889395d05b3d3256d1a608f92183b66f", + "control_top1_age_events": 1614, + "control_top1_age_ms": 1614000, + "event_index": 10807, + "modality": "text", + "query_embedding_sha256": "0832fb95d4ad88939cff5f1d48748123971513ced628fb954178bdd0d95c05d9", + "query_ordinal": 352, + "query_timestamp": 1700010807000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "2cc176b44bf34006d4ee9be3b45f500adab9d7575f95132d95a5fe404c588cdb", + "control_graph_rank_sha256": "bcd853eb30f5bbb7d3fbcf0f23d8b5aa3c85c79cccfbfd9f8587379f21a0f991", + "control_public_rank_sha256": "787ece264ff70f12410b83d2fd2f7f6f302f5ac8603c7ecb560e3231fb349c31", + "control_seed_rank_sha256": "2cc176b44bf34006d4ee9be3b45f500adab9d7575f95132d95a5fe404c588cdb", + "control_top1_age_events": 30, + "control_top1_age_ms": 30000, + "event_index": 10838, + "modality": "text", + "query_embedding_sha256": "39afaa9e863098dfc07504723c24bf15e50bc3e7690c1ca627c80a7cd384c2d3", + "query_ordinal": 353, + "query_timestamp": 1700010838000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "eb60bc9e28f8af0ad18197805278afa1a0d228f97075d63044bff1e4e3cfb3fa", + "control_graph_rank_sha256": "4ce62e63a558c21ba523ea4c0e73c38b27d06d7c5174a4dcb5da4a06f1b8e71d", + "control_public_rank_sha256": "447eece66c0d08eadd59695e50f887cb42be2f339dfe8d1616c0e40d8b08fec3", + "control_seed_rank_sha256": "eb60bc9e28f8af0ad18197805278afa1a0d228f97075d63044bff1e4e3cfb3fa", + "control_top1_age_events": 688, + "control_top1_age_ms": 688000, + "event_index": 10868, + "modality": "text", + "query_embedding_sha256": "7b71a6fa6fd40c8975b9e38965c765c04a69a3456002fcd944f6b03cbf04638c", + "query_ordinal": 354, + "query_timestamp": 1700010868000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "10e85ca0f368a3d53805f38d1a965fc4c7ec8acb91c096315029f343a74ae40f", + "control_graph_rank_sha256": "5e5d128f9f9451fd3aea4b1ef9fadb872a725a1655f9c3526f2f49cd369cad27", + "control_public_rank_sha256": "c15b980a0df3719b35167751d8bf7b0c7e31910fea0a5495ca186495ffe5f0b2", + "control_seed_rank_sha256": "10e85ca0f368a3d53805f38d1a965fc4c7ec8acb91c096315029f343a74ae40f", + "control_top1_age_events": 4135, + "control_top1_age_ms": 4135000, + "event_index": 10904, + "modality": "text", + "query_embedding_sha256": "dc04cc3fc853bd7784b61b636e2a7b386740c70a57170da6603a152cfc482b06", + "query_ordinal": 355, + "query_timestamp": 1700010904000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "22439d3a58f991722d950cdc50a40f57cca64b457179dea8f95abfc5f2e26c40", + "control_graph_rank_sha256": "5e6a4f16d71fd86a10f4d746857ac27cad82da902437caaa521dccc2ad338007", + "control_public_rank_sha256": "6db6392b65ea8f22cdf547552d52f5d6106ec61412db246222167e63dd47fa12", + "control_seed_rank_sha256": "22439d3a58f991722d950cdc50a40f57cca64b457179dea8f95abfc5f2e26c40", + "control_top1_age_events": 3086, + "control_top1_age_ms": 3086000, + "event_index": 10935, + "modality": "text", + "query_embedding_sha256": "aacfce98651eadc3bcb901069e600590f60b6055d1af03f9b6319e430e51d8d0", + "query_ordinal": 356, + "query_timestamp": 1700010935000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "90e8635a0f0107126c2a27a761bd6eaf6dfce3f5e9c05cbc628de62737f6b047", + "control_graph_rank_sha256": "b32037c831d833f60311ba3059c37cc41ba212cf897b8f4c95aec840b9068ac8", + "control_public_rank_sha256": "50fd566400900ed30332c2f6036880095443ef2278fb5098ac73e2152e5b5722", + "control_seed_rank_sha256": "90e8635a0f0107126c2a27a761bd6eaf6dfce3f5e9c05cbc628de62737f6b047", + "control_top1_age_events": 8205, + "control_top1_age_ms": 8205000, + "event_index": 10965, + "modality": "text", + "query_embedding_sha256": "0f75262522620712b10fadd6de1b1c8cc441f7bd2d8db0975e5a6506e0f84bdc", + "query_ordinal": 357, + "query_timestamp": 1700010965000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "f24a7426d99cda57dd4d1d927a12b853f8189c18d32e90059d8d80218cd44a68", + "control_graph_rank_sha256": "02e026eedbf1b9db418964f4329e28085c8e72234bf4d0804f7ab3c3a36a437d", + "control_public_rank_sha256": "74ca4aefe785c63f4e2e7f1efbd5bed74f6388f579c0ac155f64c0a0bc0cb4a3", + "control_seed_rank_sha256": "f24a7426d99cda57dd4d1d927a12b853f8189c18d32e90059d8d80218cd44a68", + "control_top1_age_events": 10747, + "control_top1_age_ms": 10747000, + "event_index": 10994, + "modality": "text", + "query_embedding_sha256": "9b188f8b90455e17fac338afbe1b06054ea2d7dab79ef6b8d40072160013509c", + "query_ordinal": 358, + "query_timestamp": 1700010994000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "8edea194ed5dd64b1c68b8efc535ba12c56f43d15ae7b25eb021b933c66c8fb1", + "control_graph_rank_sha256": "d83503b1be1416eb042130099c164533193d91ff4b124a9db4fa94462a41cd20", + "control_public_rank_sha256": "529bed1523586a614fb5ed3c031ffefbc354254a39d9985f9cc7c820ea9c8285", + "control_seed_rank_sha256": "8edea194ed5dd64b1c68b8efc535ba12c56f43d15ae7b25eb021b933c66c8fb1", + "control_top1_age_events": 410, + "control_top1_age_ms": 410000, + "event_index": 11022, + "modality": "text", + "query_embedding_sha256": "bc68ead10798776a01876bc2d9a55e524fa310496f51901a1d828d29ad5548ba", + "query_ordinal": 359, + "query_timestamp": 1700011022000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "e7be8a11285e1db77caaece19eee916d84ba6c0343b11b1eb83e0d9cc71acfa4", + "control_graph_rank_sha256": "ce47a4b971340ac9da2a38cc087d4324b51eac1eba261ce32ca4c14fdffbfa52", + "control_public_rank_sha256": "c7b16cef30862341a060235ee7e1f0a87664ad7fb00cb4f658c1897cfa863ca8", + "control_seed_rank_sha256": "e7be8a11285e1db77caaece19eee916d84ba6c0343b11b1eb83e0d9cc71acfa4", + "control_top1_age_events": 38, + "control_top1_age_ms": 38000, + "event_index": 11054, + "modality": "text", + "query_embedding_sha256": "320eecee382be8d547f0ee2fc8af5ab4449c0570f320fc942520408a21319bb3", + "query_ordinal": 360, + "query_timestamp": 1700011054000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "5df61269c72b3ce4dc90c65cad6256fc976964e65ff234fab5e6a2d739206b4e", + "control_graph_rank_sha256": "3a1cf0dfdbfa49ac911ebaf1f9174ab9bf5ccd7e9f5019eb19f19a765d320b5f", + "control_public_rank_sha256": "07cdb7485f9c3af4911df09467e77fc1db437e140dca0d54149d69f661d658ba", + "control_seed_rank_sha256": "5df61269c72b3ce4dc90c65cad6256fc976964e65ff234fab5e6a2d739206b4e", + "control_top1_age_events": 1128, + "control_top1_age_ms": 1128000, + "event_index": 11084, + "modality": "text", + "query_embedding_sha256": "907ad3fe127f7ba512f104e12e2e911342cdc09bc565416b03c5db5448eb810d", + "query_ordinal": 361, + "query_timestamp": 1700011084000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "c43a3fc5d7e3d437c79324aeb3234719499fabb3fd292f067ed4d723a2bfb2fe", + "control_graph_rank_sha256": "854ad1f8e367fea293b86eec32009725f4b0846172b220d7ff9aafd1e064593d", + "control_public_rank_sha256": "eceebfed8d9287cff3a16fb24c96215515f658a4a9f6777f7de83886e4042b53", + "control_seed_rank_sha256": "c43a3fc5d7e3d437c79324aeb3234719499fabb3fd292f067ed4d723a2bfb2fe", + "control_top1_age_events": 2230, + "control_top1_age_ms": 2230000, + "event_index": 11116, + "modality": "text", + "query_embedding_sha256": "a18f64a94772e06cdff38b7a34c06dd7cbfacc6024bcaad0ebcbd6af36fa3025", + "query_ordinal": 362, + "query_timestamp": 1700011116000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "2ec05a83d476d5e22f18b3ebe9eb53739e5c299548b7ecef6ec6187703a9992a", + "control_graph_rank_sha256": "24ab936a83fed1322ba3dfebf59d019a5235f5ba47c21c64565303155abf9829", + "control_public_rank_sha256": "ded91e26ea2653c9f983ef1f14f180a0ba04a20c9ae311e1bec7577efc8359ed", + "control_seed_rank_sha256": "2ec05a83d476d5e22f18b3ebe9eb53739e5c299548b7ecef6ec6187703a9992a", + "control_top1_age_events": 44, + "control_top1_age_ms": 44000, + "event_index": 11153, + "modality": "text", + "query_embedding_sha256": "f40e655210404a5179d0278346d317f599d2671ced44b0509c23ff8a66f4ea2a", + "query_ordinal": 363, + "query_timestamp": 1700011153000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "e0625c928704c2d8a6fa5d0f123a24f609dc92d0c339a66a2b8e664facc1ba18", + "control_graph_rank_sha256": "017b5cfdf0a699c52840656c63cd1d40ad7cc3467fe0365b18ca030b91701077", + "control_public_rank_sha256": "80b681c3c9122ece71ef46bc677a9d926c3f2d5ae2bcdd26880c865c0e174b00", + "control_seed_rank_sha256": "e0625c928704c2d8a6fa5d0f123a24f609dc92d0c339a66a2b8e664facc1ba18", + "control_top1_age_events": 9685, + "control_top1_age_ms": 9685000, + "event_index": 11180, + "modality": "text", + "query_embedding_sha256": "2d5f6fbb55fba7412f2513d92cd5b1bb0ce8a3c62194bbd111cde83e6cc68f53", + "query_ordinal": 364, + "query_timestamp": 1700011180000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "b3478e7f3f6102dd3b8d165afcd5746719f59a6d408f8d65d79fff197d0adcf9", + "control_graph_rank_sha256": "b0f520f0f234e173601dfa5a53c8f486ad181e1f5f2ac851f4836d5cc98173eb", + "control_public_rank_sha256": "67326790ccf714d3696dbe4b1ea18978a0433020512a49180cb4eed773e632c3", + "control_seed_rank_sha256": "b3478e7f3f6102dd3b8d165afcd5746719f59a6d408f8d65d79fff197d0adcf9", + "control_top1_age_events": 4589, + "control_top1_age_ms": 4589000, + "event_index": 11215, + "modality": "text", + "query_embedding_sha256": "9e0e22e4f8dd5a12419a05eb54ecc7b7084a64632b5f1071d494c99cc3eca142", + "query_ordinal": 365, + "query_timestamp": 1700011215000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "c1076317548b19f9d2d1742380be3dcaca0fc43d919f31edf68411fff15a64bc", + "control_graph_rank_sha256": "bc3e6785bfa8ef40e532556963be09136649d54083a16a0bb9923b9ed6072484", + "control_public_rank_sha256": "10aa245b1c79c35ba96e591d7c6db6c0a22bcadf7530f37801f8b683046fdac4", + "control_seed_rank_sha256": "c1076317548b19f9d2d1742380be3dcaca0fc43d919f31edf68411fff15a64bc", + "control_top1_age_events": 581, + "control_top1_age_ms": 581000, + "event_index": 11242, + "modality": "text", + "query_embedding_sha256": "84badc3caa18453e8d470f52e61def8e2c627a68982521936e02c8149d353200", + "query_ordinal": 366, + "query_timestamp": 1700011242000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "467580df9ec141f6a05e1b81e454386ed09a5b24e3986f9a6153b5861703aaab", + "control_graph_rank_sha256": "56c78e63dc8885b30ecc8c7331749e7dd2b7d12a4dc83fcb0416879ccec21b1b", + "control_public_rank_sha256": "697582bfe66f8a5853312c6c0fa2979a638b1f71e275fc631b7f8c06372cac44", + "control_seed_rank_sha256": "467580df9ec141f6a05e1b81e454386ed09a5b24e3986f9a6153b5861703aaab", + "control_top1_age_events": 668, + "control_top1_age_ms": 668000, + "event_index": 11275, + "modality": "text", + "query_embedding_sha256": "df090a65a3dd283e65454a4814c3df92aa29e13000a014562fd705a282509e38", + "query_ordinal": 367, + "query_timestamp": 1700011275000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "19b652f376f643cac947894aef8b1dbbedd01a614fd39b41db788d9f9a625940", + "control_graph_rank_sha256": "954d0dc88dd5a36c39f98154e7b1f3965901864a020de1a2ad08e9a33d0bfe7c", + "control_public_rank_sha256": "df57a22e61ee8be4647c367aa5723be34152fce948277111cec668dcf68aa83c", + "control_seed_rank_sha256": "19b652f376f643cac947894aef8b1dbbedd01a614fd39b41db788d9f9a625940", + "control_top1_age_events": 4742, + "control_top1_age_ms": 4742000, + "event_index": 11309, + "modality": "text", + "query_embedding_sha256": "3fd9cc35451222ef4fe3fc4b43f4fef1d87ec08ffccd1ba86cc9877e6e3de1eb", + "query_ordinal": 368, + "query_timestamp": 1700011309000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "31c311333d82670eef26a836a6cff11d9573694e50ac121d99f77d65396c5ff4", + "control_graph_rank_sha256": "7f6bc5bdade9db338b8e8adc7c95aa03eeebd9e8f0b46f69678a1774a306a058", + "control_public_rank_sha256": "b0cc3e0f3a50afebecb4d8204c52de166b2ecc13f8e9aa4b0fe98ff96e29b064", + "control_seed_rank_sha256": "31c311333d82670eef26a836a6cff11d9573694e50ac121d99f77d65396c5ff4", + "control_top1_age_events": 7781, + "control_top1_age_ms": 7781000, + "event_index": 11339, + "modality": "text", + "query_embedding_sha256": "371e3113ee22d7dd0062d4f479d2427ed28bf5a085cfc2b21f27116b5afb9999", + "query_ordinal": 369, + "query_timestamp": 1700011339000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "a1078e3b47f97f5fb28a72c5830e886b87edf8b03983d72f66abcbd72f4f1ec9", + "control_graph_rank_sha256": "9c53c7830bace4425e550afba9c48a1fd5a776847f936f617c4c20ba6be256b3", + "control_public_rank_sha256": "1e0cc7a403c56e3616637b78358dd913eb65371d0d460c8ed5a1871a59f24f3c", + "control_seed_rank_sha256": "a1078e3b47f97f5fb28a72c5830e886b87edf8b03983d72f66abcbd72f4f1ec9", + "control_top1_age_events": 8492, + "control_top1_age_ms": 8492000, + "event_index": 11374, + "modality": "text", + "query_embedding_sha256": "de945984b36c16be92a17f7c13e802a1dad7ab031f5122681af6a6410fa5335f", + "query_ordinal": 370, + "query_timestamp": 1700011374000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "3b50dc272b9dbff6fe172bc58bfb358ddf3afdadd7f252fc252b80564d80681d", + "control_graph_rank_sha256": "5081197848b32ebd04e8cf5c3c76dd3e1d43a15065d152eae51565e1303707b7", + "control_public_rank_sha256": "fa5bda62066124fe1058d54ec0fc4ef315912d8b249f2bf10f3130cb1ae4c315", + "control_seed_rank_sha256": "3b50dc272b9dbff6fe172bc58bfb358ddf3afdadd7f252fc252b80564d80681d", + "control_top1_age_events": 3325, + "control_top1_age_ms": 3325000, + "event_index": 11401, + "modality": "text", + "query_embedding_sha256": "ef05a35481a27c5fe591df06122bf005ddc20ca3367f4b5158b66739423e5507", + "query_ordinal": 371, + "query_timestamp": 1700011401000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "c93cae7e68d7f9eb9b0e162606c040448d08903566bdfe1adeb502788bdf5dba", + "control_graph_rank_sha256": "a09170614adfbb68038e25b18d6606bfa0d5bd45ec1d010da5262f1188929ef5", + "control_public_rank_sha256": "fc9f93b99c4c1023cb4a9093f3fa6eccec97263280a24b43378817bc5c9b2c1f", + "control_seed_rank_sha256": "c93cae7e68d7f9eb9b0e162606c040448d08903566bdfe1adeb502788bdf5dba", + "control_top1_age_events": 1360, + "control_top1_age_ms": 1360000, + "event_index": 11432, + "modality": "text", + "query_embedding_sha256": "8dd25b85d767a0329ef4c77488818d5f2cb276c73eadc8dcbbd66554147e4962", + "query_ordinal": 372, + "query_timestamp": 1700011432000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "70f64d0519746883cf170f57663d60ba64c815f9aada8bf7b56a4b23f96f1d9d", + "control_graph_rank_sha256": "c95cdc94698387f88f6256acbfcc53e06029dcf6cedd0a6089b666b78462b8c1", + "control_public_rank_sha256": "f3fd4cfda7df07303f841438093e0fe96cc43ac2c999269ae0b43ee0bb19caeb", + "control_seed_rank_sha256": "70f64d0519746883cf170f57663d60ba64c815f9aada8bf7b56a4b23f96f1d9d", + "control_top1_age_events": 2466, + "control_top1_age_ms": 2466000, + "event_index": 11460, + "modality": "text", + "query_embedding_sha256": "9aff9fe5a0eb9d85716944245341345b5a2067facc1bc6b655ed20d11c0247ee", + "query_ordinal": 373, + "query_timestamp": 1700011460000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "da8a090e8cfe0ba995a3d7923c3c4fd1183934e8ee6233ed652ad292e0ec9808", + "control_graph_rank_sha256": "27e44f0fa4d5007247eb2ba1b2fd0a06477fce15336e7260b8ebf8ab8964992a", + "control_public_rank_sha256": "48a54800ac52039afa3a4ac6c8760e69b233b91511f387c0a5238c9e7e51f642", + "control_seed_rank_sha256": "da8a090e8cfe0ba995a3d7923c3c4fd1183934e8ee6233ed652ad292e0ec9808", + "control_top1_age_events": 885, + "control_top1_age_ms": 885000, + "event_index": 11492, + "modality": "text", + "query_embedding_sha256": "df090a65a3dd283e65454a4814c3df92aa29e13000a014562fd705a282509e38", + "query_ordinal": 374, + "query_timestamp": 1700011492000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "b762db95823a45ad302e13d06825c29aaaaecce9eb3147dd04407bbe08cb910f", + "control_graph_rank_sha256": "0983f1c879c5daeec59f00299eeb4c626d1d76b88fa54cf91dbdf544888f534e", + "control_public_rank_sha256": "1fec998af2bea01c74cd0b492bbf9fc225927a66df2fe492f864269061bd954d", + "control_seed_rank_sha256": "b762db95823a45ad302e13d06825c29aaaaecce9eb3147dd04407bbe08cb910f", + "control_top1_age_events": 1124, + "control_top1_age_ms": 1124000, + "event_index": 11521, + "modality": "text", + "query_embedding_sha256": "acc3a283f36f409cbbc87e186aa57d779c09aeab8a2020bc30f9f7445d2a156b", + "query_ordinal": 375, + "query_timestamp": 1700011521000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "8290da05f23b11b0cf5155b68a8eb4a6f089b3a9a7cc6363e087e3b626cf8955", + "control_graph_rank_sha256": "ae76576a9bbd02ba1c34bcdc426c2d0325742f90976509d69ce3e6961ede025d", + "control_public_rank_sha256": "345c150eba0f7f0ebab027e5cc7a25d07f66d94792bf2c0a8a52e0c0d947d9ce", + "control_seed_rank_sha256": "8290da05f23b11b0cf5155b68a8eb4a6f089b3a9a7cc6363e087e3b626cf8955", + "control_top1_age_events": 7478, + "control_top1_age_ms": 7478000, + "event_index": 11550, + "modality": "text", + "query_embedding_sha256": "6527c14f33c94e8e0b94e61cb324067b6b413208f8cb58f88567f3f546b91e78", + "query_ordinal": 376, + "query_timestamp": 1700011550000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "f4eb88fff975fbf5befe23b45276f18b338fa168d5fc2bb3138fa41e17d5b1cc", + "control_graph_rank_sha256": "553f8e6b133b571c1cefc393e163d7808720d1a1998de47a2594ff9eb51aa04b", + "control_public_rank_sha256": "506ee99149880eccdc2b92ade14bd23e6374b77cd246a594711ee6a3b4c64f42", + "control_seed_rank_sha256": "f4eb88fff975fbf5befe23b45276f18b338fa168d5fc2bb3138fa41e17d5b1cc", + "control_top1_age_events": 275, + "control_top1_age_ms": 275000, + "event_index": 11585, + "modality": "text", + "query_embedding_sha256": "46d1a02211b46aa4dab9177af501cf4da7a446b4c7cb211b2079917f283b254b", + "query_ordinal": 377, + "query_timestamp": 1700011585000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "32b758024d32d0908ee2699e15cff00b602fbac4404ad8ef0d8f4c758944f534", + "control_graph_rank_sha256": "7e1ea9d992a010ef141c69f4001f528df13711edd45f19aa1b945eea784b915b", + "control_public_rank_sha256": "6aa9dfb5764ff02be8ae73321fdac1355756ce771bdc31d7475d14eac5bebcab", + "control_seed_rank_sha256": "32b758024d32d0908ee2699e15cff00b602fbac4404ad8ef0d8f4c758944f534", + "control_top1_age_events": 5, + "control_top1_age_ms": 5000, + "event_index": 11615, + "modality": "text", + "query_embedding_sha256": "655370cc1037a99a1ab26f99a5818f482e453eb8a613be29319654ddb37a064c", + "query_ordinal": 378, + "query_timestamp": 1700011615000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "6613844ca4ea9f3c44e15a765c11a1d2598948cd1ca1f9218e442ee287028ba4", + "control_graph_rank_sha256": "76e428efe51ca209bd9e714658c781a7fce9c6d045b0773052cb2c51d4f0a323", + "control_public_rank_sha256": "ad0e567b872f62d3d4ae786e7813eb7a0e29d4830ea43ddfa62887ac2e41e796", + "control_seed_rank_sha256": "6613844ca4ea9f3c44e15a765c11a1d2598948cd1ca1f9218e442ee287028ba4", + "control_top1_age_events": 3123, + "control_top1_age_ms": 3123000, + "event_index": 11648, + "modality": "text", + "query_embedding_sha256": "1b06b6e0823f5665343e2505548987c2a6bf81e8e9d3e10bbabb0a21fb4b8ea7", + "query_ordinal": 379, + "query_timestamp": 1700011648000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "7e545e0704a8672c00ac393f26c0bf876bb2b4fc11ec758c855da6f08aa69bde", + "control_graph_rank_sha256": "d0a97bf0a91ea69e0228232ed4594a8db075aec89d4b7be1a20bce7378aa4989", + "control_public_rank_sha256": "9fc9e59d77a3274a6ee51e37a564b4ec9216b0c3ba702112afcc7c8b7756117c", + "control_seed_rank_sha256": "7e545e0704a8672c00ac393f26c0bf876bb2b4fc11ec758c855da6f08aa69bde", + "control_top1_age_events": 78, + "control_top1_age_ms": 78000, + "event_index": 11678, + "modality": "text", + "query_embedding_sha256": "246e2cf60197c81a8c64357b58b391c38f089b43cb6f1ab0220c1dd58115ec32", + "query_ordinal": 380, + "query_timestamp": 1700011678000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "140eae2318e18c28aca3e5e06028829f26bf34f1466c33ba9393265178b2b3b0", + "control_graph_rank_sha256": "cad9b4b4ba65e440521137948e20bd0e0397cafed13ec7261751e09b7edb6beb", + "control_public_rank_sha256": "4788d5833a742d7887b07d81572762664684245579f55f8820a1423a1825405b", + "control_seed_rank_sha256": "140eae2318e18c28aca3e5e06028829f26bf34f1466c33ba9393265178b2b3b0", + "control_top1_age_events": 9, + "control_top1_age_ms": 9000, + "event_index": 11713, + "modality": "text", + "query_embedding_sha256": "f4e0985d9c0c6982374d87f916ddd47c96a10080a4ad5fd53ac9a71f7fa0024e", + "query_ordinal": 381, + "query_timestamp": 1700011713000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "cd758300c245a199053042e8347b890d7fddee41145d0c0ea080be3996cd780b", + "control_graph_rank_sha256": "e73a0609e252f0ebd3e573e3453a4e99a6a1126cd81639f9bc933a28162caae4", + "control_public_rank_sha256": "97b219a92d08f0247584c13dac07ec5330020275642f2cb7e67e1a0a47b26800", + "control_seed_rank_sha256": "cd758300c245a199053042e8347b890d7fddee41145d0c0ea080be3996cd780b", + "control_top1_age_events": 131, + "control_top1_age_ms": 131000, + "event_index": 11749, + "modality": "text", + "query_embedding_sha256": "2e18d373176eb4c4feba4d20047c55588d273ee8589160a9fd425605c44d2918", + "query_ordinal": 382, + "query_timestamp": 1700011749000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "91c66463120f089336c083b10f3dd2c9eb131f358cf08295e0df384761a33516", + "control_graph_rank_sha256": "fd84bb28083d1a90ded7c29fe9f3d2178b73271ee7846f4e7e2e410c025d2550", + "control_public_rank_sha256": "2e75885f6e1701f4cd82725ea984329e4416aa18539e80d8008f7bf40efc602d", + "control_seed_rank_sha256": "91c66463120f089336c083b10f3dd2c9eb131f358cf08295e0df384761a33516", + "control_top1_age_events": 4341, + "control_top1_age_ms": 4341000, + "event_index": 11778, + "modality": "text", + "query_embedding_sha256": "5a7abd56513f526f43d5a87716bcf88726879a588f9d7b4cea14b235ff2aebda", + "query_ordinal": 383, + "query_timestamp": 1700011778000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "8619bbf52eb6c33a5fc9cdd78484f15d2081920fc794611d80adc008bbc0b1c1", + "control_graph_rank_sha256": "8c78acf99edd0855a3dfd49ad3d591440dcb05827e2e5f354a8f7c4f10c1d5f0", + "control_public_rank_sha256": "9836d62c5c954a9654719856ea345cff3ac3f5444aa9833ea904dc8c22c68aea", + "control_seed_rank_sha256": "8619bbf52eb6c33a5fc9cdd78484f15d2081920fc794611d80adc008bbc0b1c1", + "control_top1_age_events": 9244, + "control_top1_age_ms": 9244000, + "event_index": 11810, + "modality": "text", + "query_embedding_sha256": "2c84645e9a478744d55e4712bca2ba13c438221a868301a562c81cb9d17a5428", + "query_ordinal": 384, + "query_timestamp": 1700011810000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "f6140deee500a7055e198e552c2e3b559ed9d4963992e62f5ae28208589458cf", + "control_graph_rank_sha256": "0c4a1a45f0f30ddb923da16e7f3f0f415e64f8e94ad166fdc0b6c87f7ce9aafb", + "control_public_rank_sha256": "62a6dde9a44a51582665948c8619d4ded7e22f55a269e7463747f90063561c49", + "control_seed_rank_sha256": "f6140deee500a7055e198e552c2e3b559ed9d4963992e62f5ae28208589458cf", + "control_top1_age_events": 9278, + "control_top1_age_ms": 9278000, + "event_index": 11844, + "modality": "text", + "query_embedding_sha256": "84507cc624943fafd9d4058e52e6ab5b24c2537cbfca921f3bdb4be3f40f5161", + "query_ordinal": 385, + "query_timestamp": 1700011844000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "349ca70b2a7c5818ddd05fcbcada5b093506a21ad5e5e6c6c311561184840522", + "control_graph_rank_sha256": "69d1907d5653bdb585cd52b02bed08c821381e8bfa7cc1c6429e5805c5d10e0a", + "control_public_rank_sha256": "64e91c3d661944806d21446e657cdb14d853ac60d5b064aa12be78f35429cbfd", + "control_seed_rank_sha256": "349ca70b2a7c5818ddd05fcbcada5b093506a21ad5e5e6c6c311561184840522", + "control_top1_age_events": 5210, + "control_top1_age_ms": 5210000, + "event_index": 11875, + "modality": "text", + "query_embedding_sha256": "45ef42b4483d1cc3a69f5c9501158fd6db4402d34dfb90501e7a11c7c7a989ce", + "query_ordinal": 386, + "query_timestamp": 1700011875000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "5980dafb87ba858651b2790a78d995e22f703d2d1a4c8476146a00fbb1c565cd", + "control_graph_rank_sha256": "773fa481bf4e8edccd11974d952331ad458b77519b0ff0b34c266b7faefccff9", + "control_public_rank_sha256": "478c804eb2d0fe34269c7a198d9103077d9f0965ea042f44a7111125d4c493c2", + "control_seed_rank_sha256": "5980dafb87ba858651b2790a78d995e22f703d2d1a4c8476146a00fbb1c565cd", + "control_top1_age_events": 58, + "control_top1_age_ms": 58000, + "event_index": 11903, + "modality": "text", + "query_embedding_sha256": "e7611684038f93d8e4dcc864a00a813c17eb25e20545933a69ff7b89e591e0d7", + "query_ordinal": 387, + "query_timestamp": 1700011903000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "1ff0fa6e22c4e14732b9a646473cbb118a7a1dcd330a9d5e1112286255503780", + "control_graph_rank_sha256": "401b8d6a11d6b630b1158b48144ddd20d848a8b416c164c5291551f2aad84b87", + "control_public_rank_sha256": "b4250ee68eebe4d5df211397d7b7ce95234c640c580b7494714308aded2e7fb8", + "control_seed_rank_sha256": "1ff0fa6e22c4e14732b9a646473cbb118a7a1dcd330a9d5e1112286255503780", + "control_top1_age_events": 9367, + "control_top1_age_ms": 9367000, + "event_index": 11933, + "modality": "text", + "query_embedding_sha256": "86897db10d50e960a6c0ee9748a0bb1b71dd9fd67e6273316522391ff3f8b7bc", + "query_ordinal": 388, + "query_timestamp": 1700011933000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "ed70ddb001ca7ebcf7fd50240ea04afd91241b2130b34ab0815d333fd9af17e6", + "control_graph_rank_sha256": "f15817d4a5c722f7de9d4b4201ce99c5fe4ca7ff168ea2b3dfc95ca626c49cbb", + "control_public_rank_sha256": "b1ac9ffc514128e760678be8a4510c40ad390d436f8a95689b94ae9dcef4c5af", + "control_seed_rank_sha256": "ed70ddb001ca7ebcf7fd50240ea04afd91241b2130b34ab0815d333fd9af17e6", + "control_top1_age_events": 8885, + "control_top1_age_ms": 8885000, + "event_index": 11963, + "modality": "text", + "query_embedding_sha256": "a2c9269f22eee8c38979c21180287e94db36a2043fca24287520b764f4664309", + "query_ordinal": 389, + "query_timestamp": 1700011963000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "2c68dd58e5ed921b9b88ed18ec52a56b39de346c50621624c5bc262db21a2cc5", + "control_graph_rank_sha256": "2cca8475c7e3bd7ad1bee4b61c474895298527ab628d07ce60a1a86f352b9bc8", + "control_public_rank_sha256": "90cbd6529811ca7b94cdf1cab2c3b4a408b6dbfc91634ae713deca6277d62e52", + "control_seed_rank_sha256": "2c68dd58e5ed921b9b88ed18ec52a56b39de346c50621624c5bc262db21a2cc5", + "control_top1_age_events": 2244, + "control_top1_age_ms": 2244000, + "event_index": 11993, + "modality": "text", + "query_embedding_sha256": "7545f9b3c27b7784be9a5dab535f1e99f73024e9ae5011da217c69738ad1261c", + "query_ordinal": 390, + "query_timestamp": 1700011993000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "a3aec7e87b12bcb45091d17425748a82be20dff6dca60d79e3b59ef0731a9137", + "control_graph_rank_sha256": "a2c61479729b1f84ffdabd7387e61e37b3f5ee00a9dcc7efe6aec07e3096817b", + "control_public_rank_sha256": "a1147be7854963e5ad8c90973bd494d1f985eef7793876dc19f7e1598877aabf", + "control_seed_rank_sha256": "a3aec7e87b12bcb45091d17425748a82be20dff6dca60d79e3b59ef0731a9137", + "control_top1_age_events": 590, + "control_top1_age_ms": 590000, + "event_index": 12022, + "modality": "text", + "query_embedding_sha256": "649ea523210ca909df398357643817230435425c47d77acfb847466a8b290aab", + "query_ordinal": 391, + "query_timestamp": 1700012022000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "73801ae832d88eb5877922312f8af42129c6c7005ac15c1eeae5ff6d5ae0ec08", + "control_graph_rank_sha256": "43a7e0b79e5c5f9f16bbf8f7f5a23f9d0701cd7a55cc2d0f0e680458dffc5bdb", + "control_public_rank_sha256": "32fc0b28ca79f03ab63685765815f03fd2dd04949b29699a678f8b84af6f4270", + "control_seed_rank_sha256": "73801ae832d88eb5877922312f8af42129c6c7005ac15c1eeae5ff6d5ae0ec08", + "control_top1_age_events": 621, + "control_top1_age_ms": 621000, + "event_index": 12053, + "modality": "text", + "query_embedding_sha256": "e60778d1130efabb8ade02b205996d870d063b41936c8ff2a2a3ec51377b9211", + "query_ordinal": 392, + "query_timestamp": 1700012053000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "fe18ebadab0e9e2f6fba439d2ed97daf39435610e825ee83548b65e9447bd933", + "control_graph_rank_sha256": "b83f83af17fbbcf016c5f07b04b8f92ea58d3e14d6ef877d5acfca04ddc52eed", + "control_public_rank_sha256": "2eb2682ada13debba103fdd2c1460d2a1e03f3f33d93c3afe11688c94866f5b9", + "control_seed_rank_sha256": "fe18ebadab0e9e2f6fba439d2ed97daf39435610e825ee83548b65e9447bd933", + "control_top1_age_events": 783, + "control_top1_age_ms": 783000, + "event_index": 12083, + "modality": "text", + "query_embedding_sha256": "ec5a2a55ea273a9dab3c24bdce0e0b35d4693b8d07108a565bf4ed53439ff96d", + "query_ordinal": 393, + "query_timestamp": 1700012083000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "4122c9f28bd93818a8b492aac165325246184218c84c9641345e3acb810a4769", + "control_graph_rank_sha256": "6cdc5ef1191f2286ea62ee27141a5357735ddfab4991e2b541a65632b00358ba", + "control_public_rank_sha256": "04d33c3d8b85bed93c15b339cef6c743ad4375c8ec1f43198b79e19cda5441f0", + "control_seed_rank_sha256": "4122c9f28bd93818a8b492aac165325246184218c84c9641345e3acb810a4769", + "control_top1_age_events": 2284, + "control_top1_age_ms": 2284000, + "event_index": 12110, + "modality": "text", + "query_embedding_sha256": "beeb0b990bd54f983e3e1799b02270f9b0fb826dee4963517c4556552093ef57", + "query_ordinal": 394, + "query_timestamp": 1700012110000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "77ffae5f184b0e799fe0ea5c6c5fef0e9b0cd3daa5ebbcef4bf06c218ab6c674", + "control_graph_rank_sha256": "6d289e64f20dea4fbf6016b366dc756cf5cb268e557a4fdbc202c10c31ad1c3b", + "control_public_rank_sha256": "eb0444a1b24a52b7413fd9afbccbfc02fcca4ae0c176d568a090ec337cb91492", + "control_seed_rank_sha256": "77ffae5f184b0e799fe0ea5c6c5fef0e9b0cd3daa5ebbcef4bf06c218ab6c674", + "control_top1_age_events": 907, + "control_top1_age_ms": 907000, + "event_index": 12141, + "modality": "text", + "query_embedding_sha256": "5e244cf71da9ca58c6b5905c04fc414f6796c01f3662138813e66bc4371aefb3", + "query_ordinal": 395, + "query_timestamp": 1700012141000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "dff3b214596f4e873cbec85c72f334110f522e61dc3064cd1cb36f3ece62be05", + "control_graph_rank_sha256": "db3e08a3038fab941ff2d7f7ccc44d40e2ff6f141cc5b5806c953a5dc6fef9e9", + "control_public_rank_sha256": "474aaee06da4facbe352ff6b60248433b80aecf37a6b2b2eccb508fa42732c3c", + "control_seed_rank_sha256": "dff3b214596f4e873cbec85c72f334110f522e61dc3064cd1cb36f3ece62be05", + "control_top1_age_events": 4714, + "control_top1_age_ms": 4714000, + "event_index": 12172, + "modality": "text", + "query_embedding_sha256": "470ebbb222af438fdd15dbcc1f9aea3b5a53ce5b6351f4e2e234beb8a80c5e65", + "query_ordinal": 396, + "query_timestamp": 1700012172000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "fd34a3eef20a0d7ead03e19dce429281fbdf9b8375805e9ac32d618c911e921c", + "control_graph_rank_sha256": "f1087619f9c427c81ba8d4f0e8b86860f8208b5901a3be4b08e997cfad0fa026", + "control_public_rank_sha256": "026864a67017b2466b2da08769bb497a24b0b0400a588d82f83205a4a74d67b6", + "control_seed_rank_sha256": "fd34a3eef20a0d7ead03e19dce429281fbdf9b8375805e9ac32d618c911e921c", + "control_top1_age_events": 11384, + "control_top1_age_ms": 11384000, + "event_index": 12196, + "modality": "text", + "query_embedding_sha256": "a63322f41831b4635fc30486f01430e9ce74fe2ee733e2679c67ed9ab4f28c30", + "query_ordinal": 397, + "query_timestamp": 1700012196000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "f4373fb440c3e6c9273efb7f15e2bc7f5d307f2f01205ce2a67c0088c70033a8", + "control_graph_rank_sha256": "412625ebc1a8e08ad3a7fe275077c1410abba555f4001ed543479840adfcbfe2", + "control_public_rank_sha256": "e49090697bfc4f8778cd062441da01b354a9b2495867ff3ba7a95973b41f10a4", + "control_seed_rank_sha256": "f4373fb440c3e6c9273efb7f15e2bc7f5d307f2f01205ce2a67c0088c70033a8", + "control_top1_age_events": 3, + "control_top1_age_ms": 3000, + "event_index": 12226, + "modality": "text", + "query_embedding_sha256": "663b1e8367b4e73f6dfeebe62584fa5f770929e00888bfa94b74f4aad4887e48", + "query_ordinal": 398, + "query_timestamp": 1700012226000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "1ce1b6e120d62fe2bbbc250e75530be2fb8869346a3ad14b236661c6db6f5f49", + "control_graph_rank_sha256": "289ebde48ee667549c5a0c3f7e7b39bb7b781720feb55b5adadb14cf8d34046b", + "control_public_rank_sha256": "dd3d9e8b12130baa32646cea2859b26ed9b6f92bee8c6a358bb92f483fb639c1", + "control_seed_rank_sha256": "1ce1b6e120d62fe2bbbc250e75530be2fb8869346a3ad14b236661c6db6f5f49", + "control_top1_age_events": 1022, + "control_top1_age_ms": 1022000, + "event_index": 12256, + "modality": "text", + "query_embedding_sha256": "543fce0c52ea28c40af61cc8172df52aa1a0bb59363d918ce614aaa58688de93", + "query_ordinal": 399, + "query_timestamp": 1700012256000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "86e6174e627b790f805c005bd1e56a4df045c4b67145792673b9c5ff4ba49659", + "control_graph_rank_sha256": "4e218867b8ce8bc80b7e0072aa71bc6541c4b3e3868481210d93eccbc6b8e363", + "control_public_rank_sha256": "f7eac642f3b96507da220143487782aa5dcce2d85ddb3351daa6242f4aaa428f", + "control_seed_rank_sha256": "86e6174e627b790f805c005bd1e56a4df045c4b67145792673b9c5ff4ba49659", + "control_top1_age_events": 3033, + "control_top1_age_ms": 3033000, + "event_index": 12289, + "modality": "text", + "query_embedding_sha256": "7bd3e57ef786c739b4ff3dac36e3e34acfd619703ddbd22dd259e5c8aa956abf", + "query_ordinal": 400, + "query_timestamp": 1700012289000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "820f8464055509187a427d8c9c511c132731b346781af51d0cbe39582849ca15", + "control_graph_rank_sha256": "86d4e0c5c309f8fc2f0462b171f737c47c342041083637642e68c9608d33e91d", + "control_public_rank_sha256": "57cf66440529272ff1cd6de29cc7281f8270c41dfb6e9be5d277e32e039e779f", + "control_seed_rank_sha256": "820f8464055509187a427d8c9c511c132731b346781af51d0cbe39582849ca15", + "control_top1_age_events": 2742, + "control_top1_age_ms": 2742000, + "event_index": 12319, + "modality": "text", + "query_embedding_sha256": "371c58bdbc72bf0abd1312c650a37d19d6372ba066723d94f30bae79b5dcebb3", + "query_ordinal": 401, + "query_timestamp": 1700012319000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "50ebe986473d175cc4f5488bc254be8fde178ac1476b07068c51b1d19bffd3dd", + "control_graph_rank_sha256": "8c9875259acbf9423f5ded8a932bd2a9db8ea478551329ac4e4f3d74072d293a", + "control_public_rank_sha256": "5d774367902aacbe6da39233f4b409939ee8584c95ee1571f2b0e82de2831cfa", + "control_seed_rank_sha256": "50ebe986473d175cc4f5488bc254be8fde178ac1476b07068c51b1d19bffd3dd", + "control_top1_age_events": 4616, + "control_top1_age_ms": 4616000, + "event_index": 12352, + "modality": "text", + "query_embedding_sha256": "919a332d9c1700638f6bcf7a1e15c6624fc21e8e978df84f9355cd632175a503", + "query_ordinal": 402, + "query_timestamp": 1700012352000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "307c310059c43baf23d957f67a5bd145f9cba35c50cfa6226a551b96316cd519", + "control_graph_rank_sha256": "0da4870b83bb19723991b5da91f544eab37d71ff6e566e5f682562ac94b2fd55", + "control_public_rank_sha256": "ba6e1d9a1aaba034c8e17de331515f80fdd9b9920ec774cc10e14f33b6bbdb29", + "control_seed_rank_sha256": "307c310059c43baf23d957f67a5bd145f9cba35c50cfa6226a551b96316cd519", + "control_top1_age_events": 2025, + "control_top1_age_ms": 2025000, + "event_index": 12384, + "modality": "text", + "query_embedding_sha256": "09d03e401c8fe8eb25ccd4f2db13dce13570024cb1c5b15acfa50b08f8444c8a", + "query_ordinal": 403, + "query_timestamp": 1700012384000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "6429cb9c52d8865d11d66250ddce25be2103d2b18f0b3cee930396a1ec608d69", + "control_graph_rank_sha256": "d56b67e51590fd582808753778cb2941b9e5510bcecdd82a8d08823d985f6f17", + "control_public_rank_sha256": "307e93e618fde708efc673915be309c1701ea1f3f011428cb92493170ce1ff99", + "control_seed_rank_sha256": "6429cb9c52d8865d11d66250ddce25be2103d2b18f0b3cee930396a1ec608d69", + "control_top1_age_events": 6398, + "control_top1_age_ms": 6398000, + "event_index": 12413, + "modality": "text", + "query_embedding_sha256": "d38e5943247b641355adddccda07004dfed67279cc086c58fa637788f2afb4e7", + "query_ordinal": 404, + "query_timestamp": 1700012413000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "4af179b82658268153ecc68f8513a414e7b8be7ac61fd9d13710915feaa14ae7", + "control_graph_rank_sha256": "e6346359a8cff31eb565f64448111a9ace3f30bb9b0a58277ac38bdf3271723f", + "control_public_rank_sha256": "b16c3eb38ec5aaa00e72edf2d19447dac1e4b434358db95d41abe3fd56df59e1", + "control_seed_rank_sha256": "4af179b82658268153ecc68f8513a414e7b8be7ac61fd9d13710915feaa14ae7", + "control_top1_age_events": 3260, + "control_top1_age_ms": 3260000, + "event_index": 12448, + "modality": "text", + "query_embedding_sha256": "4d3a58ae36d54fa2ce01bc14c956bb34b270ed99024fbdad1dec881f0a5102c5", + "query_ordinal": 405, + "query_timestamp": 1700012448000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "d8097ce86ceddface2b32e0b5d6edf969858c5aeeec70d186105310aede167cf", + "control_graph_rank_sha256": "35589fbf65e59f76428623a40d3aa483d108a03ba2f497648c76cd5fb38ad3ee", + "control_public_rank_sha256": "6d8785e1f97c134fecd7d4c9b861a32be3d205359b801071ef8996ddda35124f", + "control_seed_rank_sha256": "d8097ce86ceddface2b32e0b5d6edf969858c5aeeec70d186105310aede167cf", + "control_top1_age_events": 2077, + "control_top1_age_ms": 2077000, + "event_index": 12474, + "modality": "text", + "query_embedding_sha256": "84926f50cfc6dbf1e4c92c6b5016adde334f4f453d49ac3e244c42ddaf07a21d", + "query_ordinal": 406, + "query_timestamp": 1700012474000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "a98ddb70dcde5ad6314242f797ddfbfd100cfc3385160ec5265dd6161eed99a9", + "control_graph_rank_sha256": "c1c81d3652723c887385b79a8918c91fce23f022f7f676ffade1443865acbc5f", + "control_public_rank_sha256": "cb7421dca1e8cfc7591029644488414d1cbff7c92d1ae537c210004bdbc27fcf", + "control_seed_rank_sha256": "a98ddb70dcde5ad6314242f797ddfbfd100cfc3385160ec5265dd6161eed99a9", + "control_top1_age_events": 2956, + "control_top1_age_ms": 2956000, + "event_index": 12503, + "modality": "text", + "query_embedding_sha256": "e77e001b3ac633bc63502940b964ad966653fd01128a2f4a9f0b4c2ed04d63b5", + "query_ordinal": 407, + "query_timestamp": 1700012503000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "1422297c2fecf2523ab96dd4df0ab3790e682fc4c5f601356ef58bcff6b727f5", + "control_graph_rank_sha256": "9e0cf258c7a0580377d08b868cf7cb9cb75857cd23c1a800ec327773ec10777f", + "control_public_rank_sha256": "f901545d0b0ced284dbda48eedf5ce1be20254c37207309c9202101e787ba0c8", + "control_seed_rank_sha256": "1422297c2fecf2523ab96dd4df0ab3790e682fc4c5f601356ef58bcff6b727f5", + "control_top1_age_events": 521, + "control_top1_age_ms": 521000, + "event_index": 12533, + "modality": "text", + "query_embedding_sha256": "c14cdbeacb3c37ae68c17f31221041e05328c3d9e520b4e7067f3b5da2140523", + "query_ordinal": 408, + "query_timestamp": 1700012533000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "2fc5e4c0c46af57410c786ca88318597ca969d46d3b13d3e91b0e2874adc7196", + "control_graph_rank_sha256": "b7154f9fb0040db836f0c81c5ff728f74958b76103ae2198ccfa613f4b3c3fd1", + "control_public_rank_sha256": "7fccf6303af1673e70e74e7432acb2b51f505450db3f1061e907f19b7bbfd10b", + "control_seed_rank_sha256": "2fc5e4c0c46af57410c786ca88318597ca969d46d3b13d3e91b0e2874adc7196", + "control_top1_age_events": 1930, + "control_top1_age_ms": 1930000, + "event_index": 12560, + "modality": "text", + "query_embedding_sha256": "dc90a33204253ed8ba3e579236b4246ee233c1ba8379d2b7a1d98b4c54ddaff3", + "query_ordinal": 409, + "query_timestamp": 1700012560000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "e88d16e5110e81468d89bf641369ed31e533b8836545234a6a3986382c106b35", + "control_graph_rank_sha256": "b29b56bd4f5f46d4c29b638e05b1e8aee4a9ca8e18d6bce666ffbe047ce54b10", + "control_public_rank_sha256": "1840c9638a5fa02f26f62d4194e10aecd92abf155ddfe05dce211b8eb02d9a0a", + "control_seed_rank_sha256": "e88d16e5110e81468d89bf641369ed31e533b8836545234a6a3986382c106b35", + "control_top1_age_events": 456, + "control_top1_age_ms": 456000, + "event_index": 12592, + "modality": "text", + "query_embedding_sha256": "7ff252b3f0fe0e20d0dfc71afeb7197856f37fe09a9edeb7fd72a73aa7e4beec", + "query_ordinal": 410, + "query_timestamp": 1700012592000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "f045cf03d961cd9201156164b4a67ac2af42625c948fe8154592b7375aae8c2b", + "control_graph_rank_sha256": "e567b519f99425e5834132006c358e4d91f39ae2075abeb9e480b3105b171ea7", + "control_public_rank_sha256": "e7ae442978a2c0db8cd0e636036a3934c7b6c3b10850f09b9a1a943bd327625f", + "control_seed_rank_sha256": "f045cf03d961cd9201156164b4a67ac2af42625c948fe8154592b7375aae8c2b", + "control_top1_age_events": 110, + "control_top1_age_ms": 110000, + "event_index": 12621, + "modality": "text", + "query_embedding_sha256": "12954aaa867db48df37b2453310f9276568f08dd38ef24aa53d8c0875c3b731a", + "query_ordinal": 411, + "query_timestamp": 1700012621000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "e875f2deeaafb4692eaf5c96dd3e61d9d0d1e26898c385bba33fb344ad46ccf7", + "control_graph_rank_sha256": "db263799ea89afa7de04e1045e1ffb674a111edaa63690b1efabede4dd6d0d23", + "control_public_rank_sha256": "dbc14d7c07fa5e72ff4a47948abe99ade5c97615255719336789b793793db7f5", + "control_seed_rank_sha256": "e875f2deeaafb4692eaf5c96dd3e61d9d0d1e26898c385bba33fb344ad46ccf7", + "control_top1_age_events": 10677, + "control_top1_age_ms": 10677000, + "event_index": 12654, + "modality": "text", + "query_embedding_sha256": "452efc973bafdcf4242a4eba2442d361a34d9544707c18a1dd177b174e39a1fc", + "query_ordinal": 412, + "query_timestamp": 1700012654000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "114f9a5c2ec515708a909159e4eca876824dcb571b1be635b3269249210fa261", + "control_graph_rank_sha256": "094deba7541b3805d118ec596380ea325c410f8b3de417f0141c38f6fce515e0", + "control_public_rank_sha256": "7dafdc2c324c8d1f238d5cea9fe80d1b5297ca7ba5433db23ff5f1e8e0b90136", + "control_seed_rank_sha256": "114f9a5c2ec515708a909159e4eca876824dcb571b1be635b3269249210fa261", + "control_top1_age_events": 13, + "control_top1_age_ms": 13000, + "event_index": 12684, + "modality": "text", + "query_embedding_sha256": "7f18dc31a740fcc1f9aa71412c075967d9ab63006e04552ab4a86a3e8358d3a5", + "query_ordinal": 413, + "query_timestamp": 1700012684000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "92bcfed3bc14644133eb26715e0c5be8d71d322cb8362a5fea09487757f627df", + "control_graph_rank_sha256": "13305ecfab1c984f01e1dc826985b4f3fb37ef07036bc3b7574f482ab0cf5e7a", + "control_public_rank_sha256": "4b504ec0b4957377fa5bdea9ba09f26ec3921c80d3361b9dd4a7ff2e4b2a0522", + "control_seed_rank_sha256": "92bcfed3bc14644133eb26715e0c5be8d71d322cb8362a5fea09487757f627df", + "control_top1_age_events": 22, + "control_top1_age_ms": 22000, + "event_index": 12715, + "modality": "text", + "query_embedding_sha256": "a91000f59d832ed2286b9773921fccbc6f44d2101731b6d6a6f15e447c810840", + "query_ordinal": 414, + "query_timestamp": 1700012715000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "6101207a1282d3ddef3187ca56b89a35a853226034b31621e65906fdb6d2ae45", + "control_graph_rank_sha256": "96fb9d5b85ead56f6c16a44941dbcaf844a5adcd464a42d5ded1420918beef90", + "control_public_rank_sha256": "9a6f527dbc1c752ebf78e93cc50652d247a4abc9007c040d3a1b118e5080d256", + "control_seed_rank_sha256": "6101207a1282d3ddef3187ca56b89a35a853226034b31621e65906fdb6d2ae45", + "control_top1_age_events": 324, + "control_top1_age_ms": 324000, + "event_index": 12747, + "modality": "text", + "query_embedding_sha256": "1c182b939f2b757a81ba676c722e5b7a76240c229532bcd5bcb9ff973c7f3daa", + "query_ordinal": 415, + "query_timestamp": 1700012747000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "3be111a340016c96dd67d5dbd7bd12b369ad158d63180e26b85d7605398de00d", + "control_graph_rank_sha256": "9c67a504d194d1d5f2a7c1fd5ad2d00fa717136181839fbe033740bd1ae5da00", + "control_public_rank_sha256": "b9ef02940f085408ab354cf037234e4984e460f10eb7ed7fd4fc2a4899df465a", + "control_seed_rank_sha256": "3be111a340016c96dd67d5dbd7bd12b369ad158d63180e26b85d7605398de00d", + "control_top1_age_events": 1285, + "control_top1_age_ms": 1285000, + "event_index": 12777, + "modality": "text", + "query_embedding_sha256": "df090a65a3dd283e65454a4814c3df92aa29e13000a014562fd705a282509e38", + "query_ordinal": 416, + "query_timestamp": 1700012777000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "804ed0452fc38e916dd871952f817cc30adf25bccc24ed39ccc6270219b5d808", + "control_graph_rank_sha256": "8660de0eb19bdd00c5d1a6b77ffde7b912e1bb1b6dbd00b64ad05486edac4c03", + "control_public_rank_sha256": "b4b84f0ba884a53aa4901f36eaf6249bfbf590b8138aed4ecbfda0289a1ce0ff", + "control_seed_rank_sha256": "804ed0452fc38e916dd871952f817cc30adf25bccc24ed39ccc6270219b5d808", + "control_top1_age_events": 438, + "control_top1_age_ms": 438000, + "event_index": 12807, + "modality": "text", + "query_embedding_sha256": "b0b0116bbc543d58bfd57ee1ea11592a111be632174edcc67596ee4d664539ed", + "query_ordinal": 417, + "query_timestamp": 1700012807000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "71a1ceca3ce6606bff6c8cb5309f0e495da396ff9e26ca523e5764d49ef7f9d8", + "control_graph_rank_sha256": "a6f44f32c1f8df597fc2c502b33bd5ae8f0358edfdc69af3e04dd8a181df2fb4", + "control_public_rank_sha256": "632132b46569e8236646e83114df7e2d9263aa1c48da28c1e7ed0335c4b0968c", + "control_seed_rank_sha256": "71a1ceca3ce6606bff6c8cb5309f0e495da396ff9e26ca523e5764d49ef7f9d8", + "control_top1_age_events": 261, + "control_top1_age_ms": 261000, + "event_index": 12831, + "modality": "text", + "query_embedding_sha256": "4293386c1efb0798c00a1fb05e2c5f012b150599d6993a82aae1603b6bc4e072", + "query_ordinal": 418, + "query_timestamp": 1700012831000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "4a2402ae28eb49ed9bbc26e57987307848a39d0475988994882f2110a47883d3", + "control_graph_rank_sha256": "be59d124a07af021aa54f7bdd94f9d918fbd3e29ab53a52df57850f7749a81c4", + "control_public_rank_sha256": "cde36014af3bf9cc9cb19a207ab4e71c74b9db305c701f4775cb39b07cf29294", + "control_seed_rank_sha256": "4a2402ae28eb49ed9bbc26e57987307848a39d0475988994882f2110a47883d3", + "control_top1_age_events": 1354, + "control_top1_age_ms": 1354000, + "event_index": 12861, + "modality": "text", + "query_embedding_sha256": "5dde647ae55be91146af9f00eda1b34efd3a6b0c8c8b44cef55e64f29eee77a9", + "query_ordinal": 419, + "query_timestamp": 1700012861000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "d73f20a7ec09adb93b6e7180a98097643de98bb632eb6687d290be6c0b8fcecc", + "control_graph_rank_sha256": "38bc5401422a7700ca7f8c3e82e62f3098569a5a7ee77c793fb0f9161a4b3ff6", + "control_public_rank_sha256": "b2d325f1ee250b0183bba6e861475edef947199e33328f195cb9c182eb45a6e7", + "control_seed_rank_sha256": "d73f20a7ec09adb93b6e7180a98097643de98bb632eb6687d290be6c0b8fcecc", + "control_top1_age_events": 8609, + "control_top1_age_ms": 8609000, + "event_index": 12893, + "modality": "text", + "query_embedding_sha256": "e15639775802240e9c2e5e37fcd2142d86048f6c9b14043c5c86e63495a99529", + "query_ordinal": 420, + "query_timestamp": 1700012893000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "61d8d230536dc094ba9b2df910734d661f2f4921fa565029654900e62eaf30d9", + "control_graph_rank_sha256": "87e6d23b57a51ff379940c8d9627c8665553fadbef5ec3d93784a531b71ceae2", + "control_public_rank_sha256": "901f7e87c676d7d274b8838eb52f32bb16ac8a4d97ff5f1821351538d41b9930", + "control_seed_rank_sha256": "61d8d230536dc094ba9b2df910734d661f2f4921fa565029654900e62eaf30d9", + "control_top1_age_events": 9406, + "control_top1_age_ms": 9406000, + "event_index": 12924, + "modality": "text", + "query_embedding_sha256": "b40c4ae4018f913fdb476fc72ec995b8183bcc14c4188685bfb7543b3db59c1f", + "query_ordinal": 421, + "query_timestamp": 1700012924000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "a090fc2a0ee0486f8e08fcd3e340f1e003a17b3b818eec6d59b3c548c8c278a2", + "control_graph_rank_sha256": "c85544b3125184a6d58ab73062ccf6fec3f0b9e914a87af638c61689053ac910", + "control_public_rank_sha256": "94908d293128d98c27a4192de1590fe24891986b7dc42bbf9b5d3e2bfce26315", + "control_seed_rank_sha256": "a090fc2a0ee0486f8e08fcd3e340f1e003a17b3b818eec6d59b3c548c8c278a2", + "control_top1_age_events": 279, + "control_top1_age_ms": 279000, + "event_index": 12955, + "modality": "text", + "query_embedding_sha256": "514e3bac9ccfbadd72649ca79dd17cc3c64a4a2998cf108448abbf9d3dd651ae", + "query_ordinal": 422, + "query_timestamp": 1700012955000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "dead380e6c48d58bee190226966d0f6f2d859c047ce9c82a0bedfb4d98770419", + "control_graph_rank_sha256": "6c5c286b9475b0517288ad6da0e195796b796f89508f11690f69da7861ffd74b", + "control_public_rank_sha256": "348dab736b0f91be4685ff7f92baaff9059a357e78e12aa86cbf2136fa5c853d", + "control_seed_rank_sha256": "dead380e6c48d58bee190226966d0f6f2d859c047ce9c82a0bedfb4d98770419", + "control_top1_age_events": 3790, + "control_top1_age_ms": 3790000, + "event_index": 12988, + "modality": "text", + "query_embedding_sha256": "4e15ec50531f6d733faf8b52c470a4b0e98b7cfb8f59217ad333e3838e5b74d7", + "query_ordinal": 423, + "query_timestamp": 1700012988000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "fd35bf85d7abc8f98071c1144041d617945d6ee0baa54e2dd8e27898f2dc9380", + "control_graph_rank_sha256": "330ac69f13c65257d41913fa47e1cb9078e66813c237bcb10343b26735cdf6f7", + "control_public_rank_sha256": "c061b6a4d96ff963ec51617d7704863981f24a28aea71b6f6ef6a5b567ea2b4f", + "control_seed_rank_sha256": "fd35bf85d7abc8f98071c1144041d617945d6ee0baa54e2dd8e27898f2dc9380", + "control_top1_age_events": 1058, + "control_top1_age_ms": 1058000, + "event_index": 13024, + "modality": "text", + "query_embedding_sha256": "32ad2fba1378d6c5378e6792a6b5232f07f74cccd5b67512ff7a09b8cf0d846e", + "query_ordinal": 424, + "query_timestamp": 1700013024000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "20cb16e58c3dbf372c499d749eed13e0199d3b4496a1bfc70c9726ae9c237f43", + "control_graph_rank_sha256": "a4ab31a6bf182044e3f10ec0ee4228e08e8ff48a6370e1f02ac879995d894a68", + "control_public_rank_sha256": "0be06064df14ffe32d697bb84a66953081ad6805775306f19b973ce4ae5b5241", + "control_seed_rank_sha256": "20cb16e58c3dbf372c499d749eed13e0199d3b4496a1bfc70c9726ae9c237f43", + "control_top1_age_events": 11670, + "control_top1_age_ms": 11670000, + "event_index": 13056, + "modality": "text", + "query_embedding_sha256": "ecd39108625d96560ed67c3b29d07a850b2bcb4b7a726f27d8003a1a9971bb22", + "query_ordinal": 425, + "query_timestamp": 1700013056000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "e477feaa6e666c84a956d3fdb0b6a2015e73a81f00e59723c2192adab9d2dd2f", + "control_graph_rank_sha256": "dc8cfc0915c2b1f0f014a39b4e2098b276913a8acfb53e82d35c395244c0bff1", + "control_public_rank_sha256": "47f34dda706914c4e54558f127485ca1bc4251c448a1c5340bc9ac074270c11e", + "control_seed_rank_sha256": "e477feaa6e666c84a956d3fdb0b6a2015e73a81f00e59723c2192adab9d2dd2f", + "control_top1_age_events": 37, + "control_top1_age_ms": 37000, + "event_index": 13093, + "modality": "text", + "query_embedding_sha256": "5cac7b2862f7544f77987a92963cf591145300953efbc192116f9cee8bdf3b1f", + "query_ordinal": 426, + "query_timestamp": 1700013093000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "57026c54cc1573a2ce9130d76e1bb1cdc03600420992df64b0323b4f9e409155", + "control_graph_rank_sha256": "1025654dee1625963c7de379b611f88dbbffea22c3f0e2229908403d4bfedf06", + "control_public_rank_sha256": "ddf136ac36fadf79a4a3d0209907d28a92d8a394b980f76451db402ba58de02c", + "control_seed_rank_sha256": "57026c54cc1573a2ce9130d76e1bb1cdc03600420992df64b0323b4f9e409155", + "control_top1_age_events": 35, + "control_top1_age_ms": 35000, + "event_index": 13119, + "modality": "text", + "query_embedding_sha256": "85be1a82ae9076a80e99fcac295074b7b43e7e8cfed52f4fee5d7831c08a92cf", + "query_ordinal": 427, + "query_timestamp": 1700013119000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "6b40fbf9b59d845cc5615839f8307ce4caf816eebda9739b00c52af1e72f8d82", + "control_graph_rank_sha256": "9102a3fa8e8d339af6dde9ba3c4eb7e665b0e95fc7507273364efe790f91018d", + "control_public_rank_sha256": "257f37b56bda69893b72c4968fe1b1f792e7bb0d6263fb98a66c2c768aa89161", + "control_seed_rank_sha256": "6b40fbf9b59d845cc5615839f8307ce4caf816eebda9739b00c52af1e72f8d82", + "control_top1_age_events": 253, + "control_top1_age_ms": 253000, + "event_index": 13150, + "modality": "text", + "query_embedding_sha256": "df090a65a3dd283e65454a4814c3df92aa29e13000a014562fd705a282509e38", + "query_ordinal": 428, + "query_timestamp": 1700013150000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "7e9ea0e4b490d1d15f7f02acf77ad8ee9b36962e92b8cdd6250f0a59bc7c6302", + "control_graph_rank_sha256": "9e0c68096bbd10c010c918b9e34c5a0ca495e5522916e9965c11471ab43dcfc6", + "control_public_rank_sha256": "12d09527758e331b835667448b941925742ccc1d866c18f9c01e2e6623ef2adf", + "control_seed_rank_sha256": "7e9ea0e4b490d1d15f7f02acf77ad8ee9b36962e92b8cdd6250f0a59bc7c6302", + "control_top1_age_events": 7968, + "control_top1_age_ms": 7968000, + "event_index": 13177, + "modality": "text", + "query_embedding_sha256": "c2f58b0ed4fcd368512d8a040b2aa620d30a0c57ab4ff8abb3c7c9b1519030d3", + "query_ordinal": 429, + "query_timestamp": 1700013177000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "737831167c17f48e611e49088b3730af2e5e1f10cbfe9922cb41d9ea9efcc13c", + "control_graph_rank_sha256": "7d3d74969891deb2434f436beb1b8c73cf569f4078261470479a17bf04d4288f", + "control_public_rank_sha256": "28fb6d29b904da86e74fe51cc9e2747f1844525326a13d86a10baae76109fd4f", + "control_seed_rank_sha256": "737831167c17f48e611e49088b3730af2e5e1f10cbfe9922cb41d9ea9efcc13c", + "control_top1_age_events": 698, + "control_top1_age_ms": 698000, + "event_index": 13209, + "modality": "text", + "query_embedding_sha256": "3eafee580bbff4d02451226ada3c53cf8922fe9d98fc370e229d1f6870faa2f0", + "query_ordinal": 430, + "query_timestamp": 1700013209000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "4a48a86c47ac12d2b4976feb12265ff271e055e4191d99f864e2f5aac5d862b6", + "control_graph_rank_sha256": "4f4acd18cdd3b9f608890757dcfa598da19d030e3f4eaedaf906cb5895267548", + "control_public_rank_sha256": "216ac9b470e110b1dd34672bca701a155f0f21be1716b865bc8533306aba9d88", + "control_seed_rank_sha256": "4a48a86c47ac12d2b4976feb12265ff271e055e4191d99f864e2f5aac5d862b6", + "control_top1_age_events": 317, + "control_top1_age_ms": 317000, + "event_index": 13241, + "modality": "text", + "query_embedding_sha256": "b08251a34cf388f7af866e26c96f19ea9167b962de0032f35177ceeaad7dd62e", + "query_ordinal": 431, + "query_timestamp": 1700013241000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "bea4baded6456e44885c2ef23d6ca0a632cfd19567557ecb149aa5f67429e946", + "control_graph_rank_sha256": "d67d72e38c3bdca213f0ee5bf56dc0e2859dbc7e6d2104e1cbab2a8abfae4a90", + "control_public_rank_sha256": "30911738d468ac08cbb020f3e0474599b84b08382913557e49c7ef7e73fd0156", + "control_seed_rank_sha256": "bea4baded6456e44885c2ef23d6ca0a632cfd19567557ecb149aa5f67429e946", + "control_top1_age_events": 759, + "control_top1_age_ms": 759000, + "event_index": 13270, + "modality": "text", + "query_embedding_sha256": "6be8662c512fd80e3084ea78dabb0c64470e5bb4be8324565c5772dd00e9018d", + "query_ordinal": 432, + "query_timestamp": 1700013270000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "080b5016a322ba659bf77d2cffc89bcf401b67df006a36830d9500c280292b1f", + "control_graph_rank_sha256": "d0bece16baec080f33d157620c319eee6508d7919e4a1be899adb2038aca023b", + "control_public_rank_sha256": "d20b5a933debe0daad0fae7512ee3e764fdd0a7e6bf44292747df5c9d351acdb", + "control_seed_rank_sha256": "080b5016a322ba659bf77d2cffc89bcf401b67df006a36830d9500c280292b1f", + "control_top1_age_events": 18, + "control_top1_age_ms": 18000, + "event_index": 13300, + "modality": "text", + "query_embedding_sha256": "006d2e114159892e1c13353dad182a86e5fbd99f201a18f4c75140903f372f0f", + "query_ordinal": 433, + "query_timestamp": 1700013300000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "ce424b24ead3523c6f4b4cf6a0271cae5f069c14b30397c52482720b1f29b17a", + "control_graph_rank_sha256": "bd91745838fb757ee06ef8ad473449424b7ca505dad0d6f1036198cc3567eddf", + "control_public_rank_sha256": "f316d509f626a8880f7a4f19e20dc1d1356a8c4b62901f6d9c1f9c4011e4d692", + "control_seed_rank_sha256": "ce424b24ead3523c6f4b4cf6a0271cae5f069c14b30397c52482720b1f29b17a", + "control_top1_age_events": 10587, + "control_top1_age_ms": 10587000, + "event_index": 13328, + "modality": "text", + "query_embedding_sha256": "81b5a8476ad080f829a03e99103bd081056c887971a4b86d3ad1cf2e0d64fd55", + "query_ordinal": 434, + "query_timestamp": 1700013328000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "493419fd5cd873d33bb4a75228c7f287f7c974933b0ca12143a390a1ae3821ae", + "control_graph_rank_sha256": "b95f0d0d73f81d935295fc53724d6a2afb3e39cf357879297364725e835cdd66", + "control_public_rank_sha256": "f2a7cb269d35460e89fc9c5a6b504a852277f2bb507f3616f268bc39e0c5bed7", + "control_seed_rank_sha256": "493419fd5cd873d33bb4a75228c7f287f7c974933b0ca12143a390a1ae3821ae", + "control_top1_age_events": 3379, + "control_top1_age_ms": 3379000, + "event_index": 13355, + "modality": "text", + "query_embedding_sha256": "dbe456aa9d1a4c23601c0688deade434fdd422341061233a7be6a0c03fdd7a33", + "query_ordinal": 435, + "query_timestamp": 1700013355000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "beb2f7e3021fd6a85e1d7e17fa10e171d4af086240d43b4dfde22f2aaa6cad18", + "control_graph_rank_sha256": "711772b8e83ea1c7d0e738028cdaae24a83a7895b7e4a0a6d1bbfb07981082ee", + "control_public_rank_sha256": "126ac7da557bcb83874bfdaf5ac77affa238ce63c428a8cbc26f7617120156fd", + "control_seed_rank_sha256": "beb2f7e3021fd6a85e1d7e17fa10e171d4af086240d43b4dfde22f2aaa6cad18", + "control_top1_age_events": 8408, + "control_top1_age_ms": 8408000, + "event_index": 13387, + "modality": "text", + "query_embedding_sha256": "2db96a5a45aa3896e79085724779899cf3a55cc500e235c341921eb977a66558", + "query_ordinal": 436, + "query_timestamp": 1700013387000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "4bf922587e10ba5472328181a8cb089d721431c9448a219f59e0015bf39f3d39", + "control_graph_rank_sha256": "7715e4f598d2745349cf4ce880b3924ba57f1eaa25580d08d5e09149cf11570f", + "control_public_rank_sha256": "a055b2b8e07114e6cdf26061616f153fc0948f233d1e0eed28a7b299ab204fc9", + "control_seed_rank_sha256": "4bf922587e10ba5472328181a8cb089d721431c9448a219f59e0015bf39f3d39", + "control_top1_age_events": 123, + "control_top1_age_ms": 123000, + "event_index": 13418, + "modality": "text", + "query_embedding_sha256": "c3cd921d6b22c75ae1788be34df07f7e4af060d5eb9570855870bf345e2d9d98", + "query_ordinal": 437, + "query_timestamp": 1700013418000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "99e529e686abc4c79a92dc2073f7c34fddc865f7c4e7d0c4527f21a422a2d496", + "control_graph_rank_sha256": "138002887b80faa7bd60df785e7076bfcff82096978a106becc7181a689e6462", + "control_public_rank_sha256": "269180e99106fde643c1c1ff59a8a408b0c488206cbcfb19417d9ae25a2876b3", + "control_seed_rank_sha256": "99e529e686abc4c79a92dc2073f7c34fddc865f7c4e7d0c4527f21a422a2d496", + "control_top1_age_events": 3099, + "control_top1_age_ms": 3099000, + "event_index": 13453, + "modality": "text", + "query_embedding_sha256": "98fe7e25e242b50eef079d9471b265de73d0e4376b098b6aa8133f74443e8ded", + "query_ordinal": 438, + "query_timestamp": 1700013453000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "2b6a184d484c1792b5e719cfe4c5ca5c23ece912382e31335bee36c8a52745fa", + "control_graph_rank_sha256": "39334747d72a6d62e0f1c327f1af8626a54c5fa20bb1d57ded5f5031e479103b", + "control_public_rank_sha256": "20f3740651ef283174ef87a98d3e0012d7fb38bd5dbeddd652af786036eceb2c", + "control_seed_rank_sha256": "2b6a184d484c1792b5e719cfe4c5ca5c23ece912382e31335bee36c8a52745fa", + "control_top1_age_events": 131, + "control_top1_age_ms": 131000, + "event_index": 13486, + "modality": "text", + "query_embedding_sha256": "73880fdf510bc8ea9653bcbea7c9980c590fb62e34f6e0807ab3df71fa05bb0a", + "query_ordinal": 439, + "query_timestamp": 1700013486000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "7e35a9bd1cf701a365c2accd03a86846961ce9e10abc60ea8444ce5ca0b32b64", + "control_graph_rank_sha256": "101ed4930c7d2f6f0fbdf43b1600561260da614da42493aaf739c96dd0090a92", + "control_public_rank_sha256": "8fbdb65b5ac5c4e93e387d5c7c7120abc9a024b706e40a324cf211e39da8b696", + "control_seed_rank_sha256": "7e35a9bd1cf701a365c2accd03a86846961ce9e10abc60ea8444ce5ca0b32b64", + "control_top1_age_events": 6100, + "control_top1_age_ms": 6100000, + "event_index": 13524, + "modality": "text", + "query_embedding_sha256": "28bec4ea683cd00a8335c72004aed775bbf3ae709dfe708a123f0e7bf7061cd4", + "query_ordinal": 440, + "query_timestamp": 1700013524000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "018cdf63f1f139c526adeddf62644c380d1d7366c6d7edf4d0d0ec44db77b103", + "control_graph_rank_sha256": "6859b128123fc4d26a48af2ee0e490200de724a9de649830047c18def9f7de80", + "control_public_rank_sha256": "4f855796e43bb82040c235854fc4b2f59fa95633e98b4ae6e0d29ce05d7161fa", + "control_seed_rank_sha256": "018cdf63f1f139c526adeddf62644c380d1d7366c6d7edf4d0d0ec44db77b103", + "control_top1_age_events": 2160, + "control_top1_age_ms": 2160000, + "event_index": 13553, + "modality": "text", + "query_embedding_sha256": "6e6c3b98a4d32f4c74b978c5f4d476119074d37347909d77bb7521c90f8a8c5b", + "query_ordinal": 441, + "query_timestamp": 1700013553000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "d1e0873cf906e7c3d70656397cb0bcb122acde286145620c418eeddc6077e419", + "control_graph_rank_sha256": "ae38cdaf76042943e979f769f2c7171697346d9670cc760a1ae547e9afe1bf37", + "control_public_rank_sha256": "c27fd8bd96aa13cc74f3f8732e603d68db7ab8eabb49a49e97453ea498b4c4e9", + "control_seed_rank_sha256": "d1e0873cf906e7c3d70656397cb0bcb122acde286145620c418eeddc6077e419", + "control_top1_age_events": 13302, + "control_top1_age_ms": 13302000, + "event_index": 13583, + "modality": "text", + "query_embedding_sha256": "06409de1927eb404e9d1639c66d632dc30fb2175f6782f36bc5834ac4c989691", + "query_ordinal": 442, + "query_timestamp": 1700013583000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "3bb408e17e7a61313b8edfe89eabce1991ad847ddc03755c0d5706db366e4602", + "control_graph_rank_sha256": "65dd1e5ef71fd9b0744e60b0241f20059361979d4a03e39bc26a7670b6dfddca", + "control_public_rank_sha256": "34250bf1bb02442a69c07930b08590e9bbe233c32833f9a3e3418d9aeaa69071", + "control_seed_rank_sha256": "3bb408e17e7a61313b8edfe89eabce1991ad847ddc03755c0d5706db366e4602", + "control_top1_age_events": 5559, + "control_top1_age_ms": 5559000, + "event_index": 13611, + "modality": "text", + "query_embedding_sha256": "672f73d71e8d15d11bfffe7cf7ccb82354b6dd193f906c2e3ed058184f9e2722", + "query_ordinal": 443, + "query_timestamp": 1700013611000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "1556013c359898a20ef01eb38bb94786008f1903a65edb4d5a44d15e39f572e7", + "control_graph_rank_sha256": "a9f17632c77f3af63bbb946ebb1332c5b8dcd1b76475db487142b87d3f0e14ba", + "control_public_rank_sha256": "f08c8afd90b27eede90afa9a4c0db52cb8c740c5d1578a077f94f99736ab8cbb", + "control_seed_rank_sha256": "1556013c359898a20ef01eb38bb94786008f1903a65edb4d5a44d15e39f572e7", + "control_top1_age_events": 136, + "control_top1_age_ms": 136000, + "event_index": 13643, + "modality": "text", + "query_embedding_sha256": "2e3e8ebc7c3f3ef574f3975f90326cde97af75fc7b13ceba3d42b99125b7d24a", + "query_ordinal": 444, + "query_timestamp": 1700013643000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "3672a783fffda8014cbda98fe2f07c2c08111abcea174537b14ad2f02b35512c", + "control_graph_rank_sha256": "a0e7340512ef5823054183c56105d79d3099548e7893d6ed5c12c50d479d1e6d", + "control_public_rank_sha256": "4447e391456a9d1ad6017838755843aa87392dd2bfc5371e8c216854b9a7fd14", + "control_seed_rank_sha256": "3672a783fffda8014cbda98fe2f07c2c08111abcea174537b14ad2f02b35512c", + "control_top1_age_events": 4975, + "control_top1_age_ms": 4975000, + "event_index": 13673, + "modality": "text", + "query_embedding_sha256": "e42e305192bf596fe19ab5645cd243a36505bdc59b6bba8fc0f308f3e5abafe2", + "query_ordinal": 445, + "query_timestamp": 1700013673000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "49bd0e1fe439dc43ee4d1125eef863930ff01378f0e83bedeadfd71e09ea13ea", + "control_graph_rank_sha256": "dbcb9c7f949d2771b2d4289f1492053585219003acc92ecc53cbbc6eb52e509f", + "control_public_rank_sha256": "d53d7818b9312aa2600073f812e2fc6861aedd63113cb53a3787f77fdbf3e480", + "control_seed_rank_sha256": "49bd0e1fe439dc43ee4d1125eef863930ff01378f0e83bedeadfd71e09ea13ea", + "control_top1_age_events": 42, + "control_top1_age_ms": 42000, + "event_index": 13702, + "modality": "text", + "query_embedding_sha256": "ac295cf433e20bfb427948472aff4c8f5cc438eaec9297657ec1c0644746b91b", + "query_ordinal": 446, + "query_timestamp": 1700013702000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "1763038e1a6bcbddcf2402f2b8d780d3df6c1d05aca8db464d9a4ceaa2551eac", + "control_graph_rank_sha256": "35bc6415d9e4197f4993defa05a13330a6bad4e923f3f9e27f53de74423e83f9", + "control_public_rank_sha256": "2a7ca8224b85b180003b2bc0249fbeedfe5610da3c1ab50fb65446f38112c47e", + "control_seed_rank_sha256": "1763038e1a6bcbddcf2402f2b8d780d3df6c1d05aca8db464d9a4ceaa2551eac", + "control_top1_age_events": 5567, + "control_top1_age_ms": 5567000, + "event_index": 13736, + "modality": "text", + "query_embedding_sha256": "5e65bf3a0fd78f8d9e9462e1b8cfc4ecf0bb2b4ca5c9ca9a477ca753ce8c50f8", + "query_ordinal": 447, + "query_timestamp": 1700013736000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "6b733c0f7903ef9e436320dfbb96869eb825ae48c94348ffea60bb86acd81db6", + "control_graph_rank_sha256": "6a6db0b4b4d22bd36cb4be2222f179532f09f1e58a485324d1647c578e544978", + "control_public_rank_sha256": "393c2fd4b4708508881242642f0ec4ff31be6202f94e91bd94e403d8d9127d38", + "control_seed_rank_sha256": "6b733c0f7903ef9e436320dfbb96869eb825ae48c94348ffea60bb86acd81db6", + "control_top1_age_events": 10404, + "control_top1_age_ms": 10404000, + "event_index": 13765, + "modality": "text", + "query_embedding_sha256": "b303a307c6a31a30aa76bdc66f808872f8037e641098a8b701c30dc2d16cfe71", + "query_ordinal": 448, + "query_timestamp": 1700013765000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "16ab1ea1fcafae25cf7b1e55018a00d7c8b240c080b9d1910cc4d65bbf53ff1c", + "control_graph_rank_sha256": "4aaac11be5e61df43de8a082a2952fc7dfefcc92fe892fbb02db5d2f7f4cb3ad", + "control_public_rank_sha256": "b50145f8c02dd06adff514a4449918842a242bda6d291e3a5ae5b55d795fdc43", + "control_seed_rank_sha256": "16ab1ea1fcafae25cf7b1e55018a00d7c8b240c080b9d1910cc4d65bbf53ff1c", + "control_top1_age_events": 17, + "control_top1_age_ms": 17000, + "event_index": 13799, + "modality": "text", + "query_embedding_sha256": "5a821ad2756e0fdf7b9785f110f0aa69a91f15f77448d20d8e3208080b50ed8e", + "query_ordinal": 449, + "query_timestamp": 1700013799000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "d9ea50c544c0a865eb02e17adda65ea5b088f134c3619adcdb82e273910d9242", + "control_graph_rank_sha256": "53ee61dcaa161df4334388cd937fce5f1267a3c7e05b6eb8b192f96d267b4057", + "control_public_rank_sha256": "2c9f6ccb71ea9dbdd722ce297149dd629854902611d6a0b25edf5c549d773dc0", + "control_seed_rank_sha256": "d9ea50c544c0a865eb02e17adda65ea5b088f134c3619adcdb82e273910d9242", + "control_top1_age_events": 12871, + "control_top1_age_ms": 12871000, + "event_index": 13831, + "modality": "text", + "query_embedding_sha256": "75b60ae9f4c28292bd55a286018ea2219e41b256ca0ed1459252166137482054", + "query_ordinal": 450, + "query_timestamp": 1700013831000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "8d1412eb8baf32e5c3d9a7101ddba85a772f3ffb003994b9928567e6a437fffd", + "control_graph_rank_sha256": "4629c9d02f50b3617d1723e8d364968f24fbd9911f17401fdee0946b16f5835e", + "control_public_rank_sha256": "792b7ef5086aaa4f0c706da3669bc033df38dae471da9409bb5fbab89719ddb7", + "control_seed_rank_sha256": "8d1412eb8baf32e5c3d9a7101ddba85a772f3ffb003994b9928567e6a437fffd", + "control_top1_age_events": 23, + "control_top1_age_ms": 23000, + "event_index": 13855, + "modality": "text", + "query_embedding_sha256": "846618bb64a2466628575a1fd52af9f326d75e5ca21910463e39ca26b586a45f", + "query_ordinal": 451, + "query_timestamp": 1700013855000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "54e22f71e6142f58f0a517d791a0aa73b8cfe5253b190ce3747b6f22d9833f40", + "control_graph_rank_sha256": "23d102017d0f7dd4c6db4e5c5269b27db2a5dea66168b062d5fa5e9c652a91ff", + "control_public_rank_sha256": "83490c282fa976e4a2d446ed809a06c7f8d706e51327f54170da9bdc848c0028", + "control_seed_rank_sha256": "54e22f71e6142f58f0a517d791a0aa73b8cfe5253b190ce3747b6f22d9833f40", + "control_top1_age_events": 685, + "control_top1_age_ms": 685000, + "event_index": 13886, + "modality": "text", + "query_embedding_sha256": "9d1f0a45cd7cef2b63e91f1c495138ee42c520879cd86a1562c866318727990f", + "query_ordinal": 452, + "query_timestamp": 1700013886000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "ca8a6fb49163944062e053c5b5cfa745ccc3a1d313474c9bd7b0ee9b24bdfc10", + "control_graph_rank_sha256": "fe2f3c79fd248b18c990199c059b4e5d2602b95888c62d0ddbd1bf1d7fe21ba4", + "control_public_rank_sha256": "014310d6a1f9ed13fa756c01c00adc849b03742201371a07fa256dca51a55037", + "control_seed_rank_sha256": "ca8a6fb49163944062e053c5b5cfa745ccc3a1d313474c9bd7b0ee9b24bdfc10", + "control_top1_age_events": 3, + "control_top1_age_ms": 3000, + "event_index": 13912, + "modality": "text", + "query_embedding_sha256": "391f66dbce1a36aea0513c1da83f1c555a1b11725b98981a6fb3bc04cd2963b0", + "query_ordinal": 453, + "query_timestamp": 1700013912000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "4423e83317b00ab9826a28c1254e8de9b5df4125acf1cc82c403d2a3d2246d79", + "control_graph_rank_sha256": "5e4c21d3adc0a55db4fce23eabadf07b623c46967967dd543adf77f6917b1328", + "control_public_rank_sha256": "74423da299641a953dd1e96146bb230aea9adf4aeaa27bae936e48afb85ddcd4", + "control_seed_rank_sha256": "4423e83317b00ab9826a28c1254e8de9b5df4125acf1cc82c403d2a3d2246d79", + "control_top1_age_events": 4759, + "control_top1_age_ms": 4759000, + "event_index": 13947, + "modality": "text", + "query_embedding_sha256": "1028d05a4a943060e019f99b5ef1c99642c3bc2c7f295301a3d3968593e4432a", + "query_ordinal": 454, + "query_timestamp": 1700013947000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "9a1e1d1809c0a64206b03d6bff6007d38b31d35fb48f88808f81f241334a8399", + "control_graph_rank_sha256": "5219fc2386e7129c9806873e1b83c54c31a1e7aa5526974ef2d027f811d71dee", + "control_public_rank_sha256": "5c66383cdcecafae7d6ee93e3cf8a16d769635d223263016aa7416b76c860878", + "control_seed_rank_sha256": "9a1e1d1809c0a64206b03d6bff6007d38b31d35fb48f88808f81f241334a8399", + "control_top1_age_events": 1043, + "control_top1_age_ms": 1043000, + "event_index": 13976, + "modality": "text", + "query_embedding_sha256": "59133c5060966bb0d199af050fa1fb414e275180aea0c2805ee36358a39ccdcc", + "query_ordinal": 455, + "query_timestamp": 1700013976000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "ca679b6f3c73de6b8e620580e9eb8770b183d8c5c04c7afbc98c171074703447", + "control_graph_rank_sha256": "da3a5ecb5da79de55eae8f30199451d7ba02a48043e06324db1a620f5a63e2a8", + "control_public_rank_sha256": "02cc3374e36fe4d53b1ac0c985576694cf0b47483a8d76a880600241f445ccfc", + "control_seed_rank_sha256": "ca679b6f3c73de6b8e620580e9eb8770b183d8c5c04c7afbc98c171074703447", + "control_top1_age_events": 27, + "control_top1_age_ms": 27000, + "event_index": 14008, + "modality": "text", + "query_embedding_sha256": "817ea0c5a9f6fd4c744e42a25f1de21865d6b4932bd8ac6ef1d1d0675dff6e92", + "query_ordinal": 456, + "query_timestamp": 1700014008000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "665a74ba56f474987234be8de1c64a362470f6bc04240f6f3d681dc761500e95", + "control_graph_rank_sha256": "b22542b87c257dfbe2bd94bea3da617d9f30b109ed35351458a072a183c07f45", + "control_public_rank_sha256": "e9593eafe2ca39109f994ae174eb046efe62d352e382740d441d54ff83764681", + "control_seed_rank_sha256": "665a74ba56f474987234be8de1c64a362470f6bc04240f6f3d681dc761500e95", + "control_top1_age_events": 5839, + "control_top1_age_ms": 5839000, + "event_index": 14042, + "modality": "text", + "query_embedding_sha256": "69843104772aa1aeadda835e86314b70c3b6700bc4996caed20cc93f450915b7", + "query_ordinal": 457, + "query_timestamp": 1700014042000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "dab3757b818b3c116bfc36d9d81b0bc34ec1801ba1c44270955cde8db6d0771b", + "control_graph_rank_sha256": "0f2086f466cd056a5c612d504eb2a545e8558eba174a1650186e951bb63eb5c8", + "control_public_rank_sha256": "9dd35d9ef0c98fc11456307f3abc9016699193a9e42c4b876db264bff203fd39", + "control_seed_rank_sha256": "dab3757b818b3c116bfc36d9d81b0bc34ec1801ba1c44270955cde8db6d0771b", + "control_top1_age_events": 1627, + "control_top1_age_ms": 1627000, + "event_index": 14071, + "modality": "text", + "query_embedding_sha256": "face9a2b8ba41608452b64d6df23a14015382fb7adb92caea1b5c222fff043a6", + "query_ordinal": 458, + "query_timestamp": 1700014071000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "d4d639fc0d7b3a8d0fed84ad6106a6614ef51121bf53a6239be46695631d2b80", + "control_graph_rank_sha256": "ac12bd4fcdb263926b2a2fe63fcfa9be8ffbd16d18661c30bf21b20be2229330", + "control_public_rank_sha256": "38897a751553070dd31224851b812516d9b7d61ceb24248b4b11c3d36ff56d51", + "control_seed_rank_sha256": "d4d639fc0d7b3a8d0fed84ad6106a6614ef51121bf53a6239be46695631d2b80", + "control_top1_age_events": 6818, + "control_top1_age_ms": 6818000, + "event_index": 14102, + "modality": "text", + "query_embedding_sha256": "b74caa0e7029faa0986189ebb2fa30161efb6b3983d00c054511f720f71bc50e", + "query_ordinal": 459, + "query_timestamp": 1700014102000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "2278d2703d3320da7ed817a37c11edebfb0af72e20254b018bedfcb548c26b6e", + "control_graph_rank_sha256": "f8d1fbc078b463185f5eb814cbd72f5c225da8437c5b061889a8957e17deae26", + "control_public_rank_sha256": "ed88efd5991eea146a546f09aef9ca60651703e36e75b19050bbbf49d94d32e9", + "control_seed_rank_sha256": "2278d2703d3320da7ed817a37c11edebfb0af72e20254b018bedfcb548c26b6e", + "control_top1_age_events": 8254, + "control_top1_age_ms": 8254000, + "event_index": 14128, + "modality": "text", + "query_embedding_sha256": "812301584ae84847ea4a5f4c0b0e2a01148741bca9c00dcacc74108269752979", + "query_ordinal": 460, + "query_timestamp": 1700014128000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "e771cefe36dc73b7256def2bcfda0fa0ddb066c442cf458fccddf734b9d55d7c", + "control_graph_rank_sha256": "1a06e2df66713e39bd684f8d3f07292b6f0c32b253b6c803940c65d0addc95f2", + "control_public_rank_sha256": "5effe0b411be71eb2a866adbbdfb8ecda289233806349446ad4fc20f04baae5f", + "control_seed_rank_sha256": "e771cefe36dc73b7256def2bcfda0fa0ddb066c442cf458fccddf734b9d55d7c", + "control_top1_age_events": 9518, + "control_top1_age_ms": 9518000, + "event_index": 14159, + "modality": "text", + "query_embedding_sha256": "77432e50f69b1e8c3fdd05e3cf82fc1b30eb5d197ef81c0084c3d25770334c84", + "query_ordinal": 461, + "query_timestamp": 1700014159000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "b4f5d9ed0d5f73eec3e3e415cb9d02d320e46121b5c072183521b446558236f7", + "control_graph_rank_sha256": "b16401c10ed92cac5e6aae5313e8e66f9f870d3b4d9e94a976df8758d768f645", + "control_public_rank_sha256": "90804c6d282c35af36aecb445fcc97ab167bd72d3a1c10f58e2804b9519a4595", + "control_seed_rank_sha256": "b4f5d9ed0d5f73eec3e3e415cb9d02d320e46121b5c072183521b446558236f7", + "control_top1_age_events": 4, + "control_top1_age_ms": 4000, + "event_index": 14189, + "modality": "text", + "query_embedding_sha256": "a80879755d9d6b8f8c1719a0cfa05344042204415738bf3583d062afa1630048", + "query_ordinal": 462, + "query_timestamp": 1700014189000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "44ec839d430b165f412442bbe824f31c5da71c8a8d2fa41aa3bec0858d325975", + "control_graph_rank_sha256": "5b02f7a7e3da26898d5e0fcf4a53c56e6e19baf274403285f18949a03f4fc694", + "control_public_rank_sha256": "1ef4c9c77b505d81690d9d02d171eec73ccc842233e9a652094ac0fe878f189b", + "control_seed_rank_sha256": "44ec839d430b165f412442bbe824f31c5da71c8a8d2fa41aa3bec0858d325975", + "control_top1_age_events": 2112, + "control_top1_age_ms": 2112000, + "event_index": 14217, + "modality": "text", + "query_embedding_sha256": "8e821bb8049d8a9fc59ef1c230461198d63dbb88726dc7c2e8aee21d4bd150c4", + "query_ordinal": 463, + "query_timestamp": 1700014217000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "7d8ff985c5bf97bb54c8af9bd84bad888acb93db14c97fc5f9c0735efa7c0aa1", + "control_graph_rank_sha256": "f9d0ac121a4cbbe389b2832d3f42680cbf9685fbccdfd3ec73897c2aa7d30485", + "control_public_rank_sha256": "e5fdb75de59bd0dd24fd4c7a53d5ec46738e4cdbbfa9bbdf0c36acc801f591aa", + "control_seed_rank_sha256": "7d8ff985c5bf97bb54c8af9bd84bad888acb93db14c97fc5f9c0735efa7c0aa1", + "control_top1_age_events": 11510, + "control_top1_age_ms": 11510000, + "event_index": 14251, + "modality": "text", + "query_embedding_sha256": "b53866c515568ef64a7fbf4781fd156c03e0e38377950540159b4a82c9683f70", + "query_ordinal": 464, + "query_timestamp": 1700014251000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "ab02cc61a751e46468baed0053221a29dc7dcde87dd147ff708e26a05006a6cc", + "control_graph_rank_sha256": "6171f63b4a9b76c1870a53504917ba66b67e8b5fef3042b0a21f7381862313e7", + "control_public_rank_sha256": "9e5cbc37ce6f7789d94297260b07e583436913a3a3970af52d0493f999c785d0", + "control_seed_rank_sha256": "ab02cc61a751e46468baed0053221a29dc7dcde87dd147ff708e26a05006a6cc", + "control_top1_age_events": 10, + "control_top1_age_ms": 10000, + "event_index": 14280, + "modality": "text", + "query_embedding_sha256": "5ccb2d4dea0a87faf2849d55855636c2b6e196b4b4ff96ff0d6e30802b63089e", + "query_ordinal": 465, + "query_timestamp": 1700014280000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "960a881eb13f8d58cfce19ec3f99a4737fb886c4a2aa245efd116fc5bfa38226", + "control_graph_rank_sha256": "a3dec6a1b279dcf89f842b0cb2b138aad34da87e57dfd2d3427f80568b4c02aa", + "control_public_rank_sha256": "d268ffde8baaa7bb2d60c5b870cd5675b141c0322342e1a640ad87c9aafaca82", + "control_seed_rank_sha256": "960a881eb13f8d58cfce19ec3f99a4737fb886c4a2aa245efd116fc5bfa38226", + "control_top1_age_events": 3130, + "control_top1_age_ms": 3130000, + "event_index": 14310, + "modality": "text", + "query_embedding_sha256": "f76687d3e06656863d815a3c1668d3bca82aa795a19ba2018ddb345adad60b5d", + "query_ordinal": 466, + "query_timestamp": 1700014310000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "7c67c23baec62b884762364d98046e1c6e3126987e069b8c299ca6ab7bdace5b", + "control_graph_rank_sha256": "4405ee1b4928116841f34b20bc1dd3e9163afd2f7f4a0a87cc1635c962b9df9b", + "control_public_rank_sha256": "185e2ddead4e3dab87b5d393f4f810fa9efa81e7fcc31263f4cfb8a04fef2b13", + "control_seed_rank_sha256": "7c67c23baec62b884762364d98046e1c6e3126987e069b8c299ca6ab7bdace5b", + "control_top1_age_events": 3, + "control_top1_age_ms": 3000, + "event_index": 14341, + "modality": "text", + "query_embedding_sha256": "d7ecdbad42ee3171e5a1e78a0dd4ee763e0bcfbdbc79190c68e648e2be6b8b45", + "query_ordinal": 467, + "query_timestamp": 1700014341000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "ec6edb90df7e96700eea1e62b084ad2d13c9ae3c3be3e4679a0d8bea5523005e", + "control_graph_rank_sha256": "43b0b67acb1b3d0e2943c374b556b0441d57814bd2a341923af405006ec8acd3", + "control_public_rank_sha256": "2aba1177459304f95748ea5145ba060709e8df6f83546868e8076a1977d51e77", + "control_seed_rank_sha256": "ec6edb90df7e96700eea1e62b084ad2d13c9ae3c3be3e4679a0d8bea5523005e", + "control_top1_age_events": 28, + "control_top1_age_ms": 28000, + "event_index": 14374, + "modality": "text", + "query_embedding_sha256": "d9902a649ed0988d56392c5d470e2dd94454148394ccd64b7ac6b52549584678", + "query_ordinal": 468, + "query_timestamp": 1700014374000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "08d6152294e5f1aa4630c2f85e26626e5d1a18352ebba6d433ce070083ad1a2c", + "control_graph_rank_sha256": "1c98fdee2800ab0cec4f92f5c7fe4814be9798c1fc3a065854c3c6690a81ceaf", + "control_public_rank_sha256": "d61568cb26ecdd70db4554a839917699ae04f7729363409c2c352575656a2ce3", + "control_seed_rank_sha256": "08d6152294e5f1aa4630c2f85e26626e5d1a18352ebba6d433ce070083ad1a2c", + "control_top1_age_events": 7, + "control_top1_age_ms": 7000, + "event_index": 14402, + "modality": "text", + "query_embedding_sha256": "30e54d88d1360ba1c9a9286aba1de1d041ff72fad0a17f5094f70cbf35c8da69", + "query_ordinal": 469, + "query_timestamp": 1700014402000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "021cc6efb012f4249d75f44fe67c1e014b034040abcad8c659f6aeb7b5efce7c", + "control_graph_rank_sha256": "49bd27034fed6f8631b9034e6dde41b738d5378657657b211768359331679b31", + "control_public_rank_sha256": "42ef8da2e71bb3d68a578174d074e32cdfdab6c9dfdadf8bac5c11b3db172b10", + "control_seed_rank_sha256": "021cc6efb012f4249d75f44fe67c1e014b034040abcad8c659f6aeb7b5efce7c", + "control_top1_age_events": 9793, + "control_top1_age_ms": 9793000, + "event_index": 14434, + "modality": "text", + "query_embedding_sha256": "406ad20bbf1c9fc298a9e90f027de36ca3f40bf412019351cf17ad9d1035be12", + "query_ordinal": 470, + "query_timestamp": 1700014434000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "eb080d3f18317035d835119f65938444c2a0aa206aea40b6c8921fdc792b2bde", + "control_graph_rank_sha256": "316c741967e4d45be24100e0920160f6ef2afc84c72e1db7e041ddfe3568d322", + "control_public_rank_sha256": "a2ad3ce0980e997bafdb0c0ef03524bee6c30cb117e2470f8a3199a28237f34b", + "control_seed_rank_sha256": "eb080d3f18317035d835119f65938444c2a0aa206aea40b6c8921fdc792b2bde", + "control_top1_age_events": 2300, + "control_top1_age_ms": 2300000, + "event_index": 14465, + "modality": "text", + "query_embedding_sha256": "717b02cde13d4a9359c40e7f089da3a5a35a92cc05cf5ea0fe753e6466c3912b", + "query_ordinal": 471, + "query_timestamp": 1700014465000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "0a58fbc7347fb7d79f835905fbef0041d228d046b41a3754668c41f90054a839", + "control_graph_rank_sha256": "92b86aca17d4094e60eaddbfff038de6785d337076eb4ee6b2c6baf5ce6f38f8", + "control_public_rank_sha256": "f761f3c73e274f67e707441ffc432252425255366cb702b7e433abf90494a816", + "control_seed_rank_sha256": "0a58fbc7347fb7d79f835905fbef0041d228d046b41a3754668c41f90054a839", + "control_top1_age_events": 293, + "control_top1_age_ms": 293000, + "event_index": 14492, + "modality": "text", + "query_embedding_sha256": "c822c8ab3e9569fed3a76adf48d89290374d0805cafe8fe05074d406ddf2c5ba", + "query_ordinal": 472, + "query_timestamp": 1700014492000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "33a6a99923f3dda230c0f803bbc927e5507ed550f96a05ba07ff2ee78235ff36", + "control_graph_rank_sha256": "baf094589884191ae6eebfba12938a28c44ab2a3a52d4ff8b26a221c294aa0a5", + "control_public_rank_sha256": "824550b51ad010bf0f3c94062d0bd90e3a1754550b9328ca1f396980541445fa", + "control_seed_rank_sha256": "33a6a99923f3dda230c0f803bbc927e5507ed550f96a05ba07ff2ee78235ff36", + "control_top1_age_events": 88, + "control_top1_age_ms": 88000, + "event_index": 14523, + "modality": "text", + "query_embedding_sha256": "e97d06fdbe520dacac1f9c737f361fa9033779e071cef6df392d3da1678bb223", + "query_ordinal": 473, + "query_timestamp": 1700014523000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "a8c98195806aea1531e84f9db67944145a25f013d22f0ea1412f7e7373343e71", + "control_graph_rank_sha256": "ec2ce5f3c87f4339de6d36b71bb103f9515049eb8801d9deb98db6cb50cf0311", + "control_public_rank_sha256": "09361055d0cb74edc14b6b00b0b198fad7dd31eab1a9f8a83fe4e21f004a2176", + "control_seed_rank_sha256": "a8c98195806aea1531e84f9db67944145a25f013d22f0ea1412f7e7373343e71", + "control_top1_age_events": 11, + "control_top1_age_ms": 11000, + "event_index": 14554, + "modality": "text", + "query_embedding_sha256": "1db5744f4530cf8ef7d194907bd4f05e5260b7e3f1820425b15286faf2a16674", + "query_ordinal": 474, + "query_timestamp": 1700014554000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "aa32c5b11d6031c746b4c6e8b2c5c0efb8ccb857c629ab734b0d5ef39b292210", + "control_graph_rank_sha256": "88b30f15d4ab1ebc6d37376c5481b90074d253298b1d1d62959eba215a806a97", + "control_public_rank_sha256": "7a5f41172ffdcb9d87f6b777a2098cc465b7ee9db0a88ada5711729ed4200462", + "control_seed_rank_sha256": "aa32c5b11d6031c746b4c6e8b2c5c0efb8ccb857c629ab734b0d5ef39b292210", + "control_top1_age_events": 380, + "control_top1_age_ms": 380000, + "event_index": 14584, + "modality": "text", + "query_embedding_sha256": "d7b0530c0e9b821f15371551627cf504908225f9efd3b26d5ab80c0526edd450", + "query_ordinal": 475, + "query_timestamp": 1700014584000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "4ae0eaaf069b75f9580e11c6e91792b53aa10c6289286e0cb94594c4c32caad6", + "control_graph_rank_sha256": "b0b32d7f4bad91600402087bc089893629de3367a13867879bf0175cbed712df", + "control_public_rank_sha256": "faae511832bf3765b56f9c31395e2cef078a0aefa6f62dda2aecd26ec1100abd", + "control_seed_rank_sha256": "4ae0eaaf069b75f9580e11c6e91792b53aa10c6289286e0cb94594c4c32caad6", + "control_top1_age_events": 8667, + "control_top1_age_ms": 8667000, + "event_index": 14614, + "modality": "text", + "query_embedding_sha256": "f55a422c9f4fb87fa0852f0592549b06250d2c3a4fa94c162484771b71ce7c76", + "query_ordinal": 476, + "query_timestamp": 1700014614000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "4ffb3326f738fabd7c778d6f70101a0a5c1f012929d4d71a3792f4aed24c13ca", + "control_graph_rank_sha256": "cb3cb8d8eb7ea8ae34b1fbc659be92e12d93e59fd451514e9e86ae7eb8ba59be", + "control_public_rank_sha256": "d230a06639d3ea66d59ddd1308749f4c51c1834d8666c80fed687564c58e9bdb", + "control_seed_rank_sha256": "4ffb3326f738fabd7c778d6f70101a0a5c1f012929d4d71a3792f4aed24c13ca", + "control_top1_age_events": 7769, + "control_top1_age_ms": 7769000, + "event_index": 14644, + "modality": "text", + "query_embedding_sha256": "8ef1cb7bef00cdd81f49f348b57d3cae3642b3a34c43701aa5f49ce58c3100da", + "query_ordinal": 477, + "query_timestamp": 1700014644000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "03fc21b60e3f6be94a5d102755ae01ace13c522c18220476e7c9376c54db5a31", + "control_graph_rank_sha256": "bef3dc8f660f0407bffaf9f88f41184d48e48802d3764792c601543c8f21b7aa", + "control_public_rank_sha256": "770bb4f6624f85f9122945332d17400ee8a53e43a8a4496b1cd34565e3b89499", + "control_seed_rank_sha256": "03fc21b60e3f6be94a5d102755ae01ace13c522c18220476e7c9376c54db5a31", + "control_top1_age_events": 960, + "control_top1_age_ms": 960000, + "event_index": 14677, + "modality": "text", + "query_embedding_sha256": "7f30668a47b27dec04a79b67141b939ec6a90c004b22618b3b8058b97b0d1bbb", + "query_ordinal": 478, + "query_timestamp": 1700014677000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "196b9faff2fa3e1ec639e7887ba204e51c521cedac98913f44f2693654615754", + "control_graph_rank_sha256": "cb4f12c8199c87ceb9c6acb9d7d33f8ae8af9e340a763e9dadd0eac22dbfc8d8", + "control_public_rank_sha256": "2fe378f772b6ddbafaa90aece588562dd7f33a05e80bdd7ced1113c66facf07e", + "control_seed_rank_sha256": "196b9faff2fa3e1ec639e7887ba204e51c521cedac98913f44f2693654615754", + "control_top1_age_events": 306, + "control_top1_age_ms": 306000, + "event_index": 14704, + "modality": "text", + "query_embedding_sha256": "60b2903d8cca7d510081505515dac0871a1b7d4930708b4f615e6543c1480dcb", + "query_ordinal": 479, + "query_timestamp": 1700014704000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "db4f32999a5bb5d162494530522956b43fe350d96b30b89529baee6e6a1af732", + "control_graph_rank_sha256": "850c8d9f05cd2ebd1fcf1c8d59ccb5236dd7952ddf1e32faa5eed81779264452", + "control_public_rank_sha256": "6a9dc94ffe058ec1b2b029a0e2b4a17c1150bf16f8a823ce23d54a732189b0f8", + "control_seed_rank_sha256": "db4f32999a5bb5d162494530522956b43fe350d96b30b89529baee6e6a1af732", + "control_top1_age_events": 5, + "control_top1_age_ms": 5000, + "event_index": 14731, + "modality": "text", + "query_embedding_sha256": "3af0622b3d838f33ffdd6f289bc1824ce881c07951d84ccfce8c779c06ba38c2", + "query_ordinal": 480, + "query_timestamp": 1700014731000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "a62e76c7be99cb6cf40ad13654e58a61c94ab1de2a44c49f2df419b386d920e2", + "control_graph_rank_sha256": "72ede8dde0f4c67e666f3bcef5dfde23d45b9432506d29134c0cc9997044bc0f", + "control_public_rank_sha256": "eb27db4afdba3af5ad6690ba1efb81361942cb50ed2c5ae90f3b1d5fc0a15255", + "control_seed_rank_sha256": "a62e76c7be99cb6cf40ad13654e58a61c94ab1de2a44c49f2df419b386d920e2", + "control_top1_age_events": 5281, + "control_top1_age_ms": 5281000, + "event_index": 14762, + "modality": "text", + "query_embedding_sha256": "faf6bca5f5237be88457f3b01634db62f446aa810250483bcbb17b9e71e316f7", + "query_ordinal": 481, + "query_timestamp": 1700014762000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "6c0d8e8ee91cc7a896f15e83ac4051931664136b1bef75847ea9e155aae66a17", + "control_graph_rank_sha256": "10af0f38cd7b117728da4f39aec4a3831268ba6e569c22ab19521c438d7240f6", + "control_public_rank_sha256": "5ec668164b7300887813a8d446c4de65c8e90edff2951b219571a6648e63016e", + "control_seed_rank_sha256": "6c0d8e8ee91cc7a896f15e83ac4051931664136b1bef75847ea9e155aae66a17", + "control_top1_age_events": 6337, + "control_top1_age_ms": 6337000, + "event_index": 14797, + "modality": "text", + "query_embedding_sha256": "1078444841a989c17cba6345f102b393753bbbdcec29c821a5bfb88ca4f1004b", + "query_ordinal": 482, + "query_timestamp": 1700014797000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "7706b1bfe54489b672eebdfa024a8ffd16731c71122253c158378a353f14caa0", + "control_graph_rank_sha256": "8f434bc2a050e60da87ccad6ae75107b1bcd7f2c29ce36d28ab2379056a210f4", + "control_public_rank_sha256": "9b541c00a4577ae4efb0ef25ab88038c7cd5909a7323e8e5761fa5253dd71cfb", + "control_seed_rank_sha256": "7706b1bfe54489b672eebdfa024a8ffd16731c71122253c158378a353f14caa0", + "control_top1_age_events": 5986, + "control_top1_age_ms": 5986000, + "event_index": 14827, + "modality": "text", + "query_embedding_sha256": "d7033b54f50734c4c6d2488e94fb08ff7b6397a39475d8fd99138640f3c50734", + "query_ordinal": 483, + "query_timestamp": 1700014827000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "83a32eb1be39d27d865021e4cf762ed319543f8b1ec1db3d011d2041cb31c045", + "control_graph_rank_sha256": "030ece40e9f7774183588fa8e41d3be43f53bc4b29de05ac351f70bdc6172487", + "control_public_rank_sha256": "cdd64c39a151951dec6350d3c066ec54b566431eac7243d22ad548ef4e3ce7dd", + "control_seed_rank_sha256": "83a32eb1be39d27d865021e4cf762ed319543f8b1ec1db3d011d2041cb31c045", + "control_top1_age_events": 3908, + "control_top1_age_ms": 3908000, + "event_index": 14865, + "modality": "text", + "query_embedding_sha256": "c55abb6a31025528b0fd5de8e739ff5bea409853f532eb7a98025fcebbe246e0", + "query_ordinal": 484, + "query_timestamp": 1700014865000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "a9a0eac6d79ebf53c20b62a3d7fc07e2ff14399cf1385fb1a3b5c6c8eeca9194", + "control_graph_rank_sha256": "f12e4e5a078938b25c360583fd620e736bebf45adf4cc65ef356dace7bec0372", + "control_public_rank_sha256": "a29042628dde1530b84db33f4854e4b443317cf135f677b031b0bc18919ba431", + "control_seed_rank_sha256": "a9a0eac6d79ebf53c20b62a3d7fc07e2ff14399cf1385fb1a3b5c6c8eeca9194", + "control_top1_age_events": 13857, + "control_top1_age_ms": 13857000, + "event_index": 14895, + "modality": "text", + "query_embedding_sha256": "72acec5034f76cd2d01a54d17c721848364b26f0e9ccb3c8935a7a6006eee1ed", + "query_ordinal": 485, + "query_timestamp": 1700014895000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "e642a41cd11240876e429abc1098b88d5c5995dc243c141633f084680916b0d3", + "control_graph_rank_sha256": "6066569cb227a86b6b641b05947d7f740b2a8a7c252e9c39730e7c504d15983b", + "control_public_rank_sha256": "1ea91d569ed160b4071dd9f7d9448439feae825098e6e77f46e939430ad8e620", + "control_seed_rank_sha256": "e642a41cd11240876e429abc1098b88d5c5995dc243c141633f084680916b0d3", + "control_top1_age_events": 1729, + "control_top1_age_ms": 1729000, + "event_index": 14925, + "modality": "text", + "query_embedding_sha256": "1f0968ddd101a38ae4bbe950d110ffb578392dadd7f038b9a87f1a3673506cd4", + "query_ordinal": 486, + "query_timestamp": 1700014925000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "1c6d47d199c0ca0457d6fb43e31897345a04b45c78fa1dd4b6c972cbe8ef12ab", + "control_graph_rank_sha256": "5a5ad4ebdb79ca0125e131db6b809d63e6d22536e07b8a5d2a2e01fb437176ee", + "control_public_rank_sha256": "8e4be483a9cfbee5ecace2634abc7f49e06e9d59cfe139108127b3f0f3720176", + "control_seed_rank_sha256": "1c6d47d199c0ca0457d6fb43e31897345a04b45c78fa1dd4b6c972cbe8ef12ab", + "control_top1_age_events": 26, + "control_top1_age_ms": 26000, + "event_index": 14954, + "modality": "text", + "query_embedding_sha256": "81567c45552340deb4a1dea7ffce21df9cd0f1fc5305df02f1b94f04696b3635", + "query_ordinal": 487, + "query_timestamp": 1700014954000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "7080e451d6a00b6de48035e29e7a7a62727e4ba42a43d9a5052f67525acdf309", + "control_graph_rank_sha256": "a824819c7c76054fdfcd8c123a3c73072a8c635010a393ae3b5a45b08b5e24a7", + "control_public_rank_sha256": "9ae19cbf6438d5bae68c93694495e3184ca4e5214ae938a37dbb964fe7826b42", + "control_seed_rank_sha256": "7080e451d6a00b6de48035e29e7a7a62727e4ba42a43d9a5052f67525acdf309", + "control_top1_age_events": 1264, + "control_top1_age_ms": 1264000, + "event_index": 14984, + "modality": "text", + "query_embedding_sha256": "84587433177852a5b67ac983f87d37932dbd638df0918b13e53b61ec551aa556", + "query_ordinal": 488, + "query_timestamp": 1700014984000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "dcdf5e30fa06ced70ce1015b2988130a8a32c84c1f01a98edddbee45f322de4f", + "control_graph_rank_sha256": "2b31fc9c187779940b5a6588c41cb12dd33a8403d811b315554e3df0b27c6d73", + "control_public_rank_sha256": "6e8cf083ffa6f8da352e055005ce646345ce1d59694e914a296e4f0a31052151", + "control_seed_rank_sha256": "dcdf5e30fa06ced70ce1015b2988130a8a32c84c1f01a98edddbee45f322de4f", + "control_top1_age_events": 6644, + "control_top1_age_ms": 6644000, + "event_index": 15016, + "modality": "text", + "query_embedding_sha256": "4350f251ddcb00ce551383045b4e1195664e79cdacc32a339ec97fb810dcb7c0", + "query_ordinal": 489, + "query_timestamp": 1700015016000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "615adf7ddf463144675b77384c1ce44e121b56735b126d50f409a362921ad41c", + "control_graph_rank_sha256": "38913e417ae7f55be8a961bda421fc86ad00a9b97c6edf4425db2b8036b3f8bc", + "control_public_rank_sha256": "b12913457a30f82df79da6281fe5e8c6e20c070925354e377a089a84902fee96", + "control_seed_rank_sha256": "615adf7ddf463144675b77384c1ce44e121b56735b126d50f409a362921ad41c", + "control_top1_age_events": 5214, + "control_top1_age_ms": 5214000, + "event_index": 15045, + "modality": "text", + "query_embedding_sha256": "f1bdd782f0671aab84929d1118c4c9a0ec8db8529b7a96f72e644e9a21801da4", + "query_ordinal": 490, + "query_timestamp": 1700015045000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "c6277391854708d7bb3ecad2328de79b6011fcb8c119975f72eea2176552427b", + "control_graph_rank_sha256": "8f548144d56471634b15b5e6df71c49c3a212d2c8cb88e5e930f55250cf087a2", + "control_public_rank_sha256": "fcd136c99e6054df3238cb5de2ff463725699c95e3216d3b3776fdcbaac2ee2a", + "control_seed_rank_sha256": "c6277391854708d7bb3ecad2328de79b6011fcb8c119975f72eea2176552427b", + "control_top1_age_events": 27, + "control_top1_age_ms": 27000, + "event_index": 15074, + "modality": "text", + "query_embedding_sha256": "aec52f60da8974932375cf65dc02ce988c09e444a7db2f3c592ad9dc0a55908a", + "query_ordinal": 491, + "query_timestamp": 1700015074000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "90373e3780595732b47483a3a11e28f5aaf1ce90c76f67cc3b4e3f72eae61928", + "control_graph_rank_sha256": "f8261f2bd666987f5afb247d0e12c9f2203774d22ca840b158af8cbbc712de94", + "control_public_rank_sha256": "2ff81cdc28a1879e5471388aa18de16e059237143219a456abb4636a90ef4246", + "control_seed_rank_sha256": "90373e3780595732b47483a3a11e28f5aaf1ce90c76f67cc3b4e3f72eae61928", + "control_top1_age_events": 61, + "control_top1_age_ms": 61000, + "event_index": 15108, + "modality": "text", + "query_embedding_sha256": "666ae5bfb4803a983d4ee65a7494349f9ba36a84206e71f4aa9f1d4fb535a0d3", + "query_ordinal": 492, + "query_timestamp": 1700015108000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "28a333af1b74f2a7a6818d5a1af92136cc5771589fe394960b44285156437ee7", + "control_graph_rank_sha256": "2ff015e48e674284b5ea10387122e643618be57a35b93afeb324dd63f169c7d9", + "control_public_rank_sha256": "a2dc79e02df3ea981a03e805f8f8f1ecdd59d67590f587e793a5779d10669469", + "control_seed_rank_sha256": "28a333af1b74f2a7a6818d5a1af92136cc5771589fe394960b44285156437ee7", + "control_top1_age_events": 5, + "control_top1_age_ms": 5000, + "event_index": 15137, + "modality": "text", + "query_embedding_sha256": "69abb6c66eb2a59a3ac52cace075af4848e3976125741f43412cb7ea8dc0360b", + "query_ordinal": 493, + "query_timestamp": 1700015137000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "e888c29a2ae19a2c0cdcb49e50bf7d86c7d0ced1591b2e7760fe076cd5783b37", + "control_graph_rank_sha256": "d7d8f45ddd8c0dbda5d277e20f7fba79d7ec2e28acdcc36e82927619561e82d4", + "control_public_rank_sha256": "e58300a59078535048e09f9ee5d5ab1602bd0c7c730e7e8ce95cb6424c80ef88", + "control_seed_rank_sha256": "e888c29a2ae19a2c0cdcb49e50bf7d86c7d0ced1591b2e7760fe076cd5783b37", + "control_top1_age_events": 126, + "control_top1_age_ms": 126000, + "event_index": 15167, + "modality": "text", + "query_embedding_sha256": "61c83a7da6faed2be19cbf68502943a2f047f362f4ea226a873397485a103b9d", + "query_ordinal": 494, + "query_timestamp": 1700015167000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "34c755c028b5cb3834472e979a431960cb3424021c689eb6fc7b365ad274e1ea", + "control_graph_rank_sha256": "43e26bc6401043025dcd3bcf340500a8d84721b91ab469496999674263c98940", + "control_public_rank_sha256": "a87e3d692998715ef5d38cbaa5ad7d44e83bc8b0acf5f89447d17346c7b631fe", + "control_seed_rank_sha256": "34c755c028b5cb3834472e979a431960cb3424021c689eb6fc7b365ad274e1ea", + "control_top1_age_events": 837, + "control_top1_age_ms": 837000, + "event_index": 15195, + "modality": "text", + "query_embedding_sha256": "d03ba47eb256981877f78f0f52ec284329624872818b0c0c0f498be2654a0f09", + "query_ordinal": 495, + "query_timestamp": 1700015195000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "198058d11626cd51830534507c2b75afad6547c09a366cdf826d50ef247a3225", + "control_graph_rank_sha256": "0e4c156a36c70fb91c769c7838c2dbffcb649882eb6690ece12a7397df140399", + "control_public_rank_sha256": "824922b61fc0d6b9eeb94c28519248fd1ee12681b440848ed7c532749f7b9acb", + "control_seed_rank_sha256": "198058d11626cd51830534507c2b75afad6547c09a366cdf826d50ef247a3225", + "control_top1_age_events": 7650, + "control_top1_age_ms": 7650000, + "event_index": 15226, + "modality": "text", + "query_embedding_sha256": "c4a2e376b03a9fe506d8e075ac615bbf76fdda1ecf9eb3bf8d658541c4050684", + "query_ordinal": 496, + "query_timestamp": 1700015226000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "ac416596681973ff416000fed150f941129173d4fc56b069c836ff682bbc65a8", + "control_graph_rank_sha256": "a4941e4b23ca0d69d2ddfe433e15b944e91a2d21a25200d3ff2154dbb666ae11", + "control_public_rank_sha256": "ad7de4a28956c689daacacd9ea5c6e9c067fec79541dcc93c440db56ec26b02a", + "control_seed_rank_sha256": "ac416596681973ff416000fed150f941129173d4fc56b069c836ff682bbc65a8", + "control_top1_age_events": 202, + "control_top1_age_ms": 202000, + "event_index": 15257, + "modality": "text", + "query_embedding_sha256": "8ca80cc79049c7f2c05a5013beb137e209f6a55b3998dc3bc4eaa08fcffd86d9", + "query_ordinal": 497, + "query_timestamp": 1700015257000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "ff2aaf2d7b844c2fe538e1b4d7ea084e4ef84a316b8e5f81e4f2420e5ee0904d", + "control_graph_rank_sha256": "b57ea19784d6370dbab95fa7f06e752b6a9c7a981c86480485a35b2ea3fee314", + "control_public_rank_sha256": "30e19b4f2ba552528a9d14cd3e0b99b1c346cec83c728f8bf10742ac0d9d2edb", + "control_seed_rank_sha256": "ff2aaf2d7b844c2fe538e1b4d7ea084e4ef84a316b8e5f81e4f2420e5ee0904d", + "control_top1_age_events": 8744, + "control_top1_age_ms": 8744000, + "event_index": 15287, + "modality": "text", + "query_embedding_sha256": "1806adce236cf88332fb40a6ff68e244ee200cbf38661bbabc215c944c665cc6", + "query_ordinal": 498, + "query_timestamp": 1700015287000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "bf41b5afd1f84126b89a6a5594d485aa69d342ef7e1377d5c1f33143e53a8e7e", + "control_graph_rank_sha256": "aa7b043442a87d9c78e0e5b8051dc6921022c9a3099b3b015973183753285412", + "control_public_rank_sha256": "14eb1ffb54863dfa4b84fd84dfbacda4fdb2359375a6ccee391769aef3f78f9b", + "control_seed_rank_sha256": "bf41b5afd1f84126b89a6a5594d485aa69d342ef7e1377d5c1f33143e53a8e7e", + "control_top1_age_events": 7239, + "control_top1_age_ms": 7239000, + "event_index": 15324, + "modality": "text", + "query_embedding_sha256": "8e16f0fc4120c668181f9e442edc3c008aeec32c40f4e222f3a3f84b85732d83", + "query_ordinal": 499, + "query_timestamp": 1700015324000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "19bf30142d412827580988c18775f9dea4c16441697b39977f420e4a5a420de8", + "control_graph_rank_sha256": "b964e14871ca7928e56bc8b8cc79c46ce7e566359129a53b96050d134a9a18b4", + "control_public_rank_sha256": "56834924e630660bf4792271cb8f1ed1e97ffb3ea850cb27d8eda378ed609985", + "control_seed_rank_sha256": "19bf30142d412827580988c18775f9dea4c16441697b39977f420e4a5a420de8", + "control_top1_age_events": 7401, + "control_top1_age_ms": 7401000, + "event_index": 15351, + "modality": "text", + "query_embedding_sha256": "0a870704fce7ebc790ceaf225ea4fcb9f005f4996b1b9dcee4a2ab4b14a6b031", + "query_ordinal": 500, + "query_timestamp": 1700015351000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "7aba78ffe0f8ae1dd9c4f2845a020cc21b29aa857ceb6041d408d77a1efe21a4", + "control_graph_rank_sha256": "759ce9543ffdf13d80fb0c8ae3c5aeea3b510cbf87204ecb82711c7324e1a836", + "control_public_rank_sha256": "60e1fda9e37c489ca90986947722efff5aee8b168c1f11abf6317832369739f2", + "control_seed_rank_sha256": "7aba78ffe0f8ae1dd9c4f2845a020cc21b29aa857ceb6041d408d77a1efe21a4", + "control_top1_age_events": 10081, + "control_top1_age_ms": 10081000, + "event_index": 15383, + "modality": "text", + "query_embedding_sha256": "83f2ae88964e67321f35c3f88735600e8606324714663d93d0149559b6a22212", + "query_ordinal": 501, + "query_timestamp": 1700015383000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "00559430b1af4b74700b21048f58803000511a805208c56d767db6b9106e5baa", + "control_graph_rank_sha256": "93d92771907648e6a9a916de248f722747594f3be277c805ad9f0482f27c540b", + "control_public_rank_sha256": "8c9975a552647dae49406dd340658ba4fba2d4996d41413c59b290f9f824a706", + "control_seed_rank_sha256": "00559430b1af4b74700b21048f58803000511a805208c56d767db6b9106e5baa", + "control_top1_age_events": 229, + "control_top1_age_ms": 229000, + "event_index": 15411, + "modality": "text", + "query_embedding_sha256": "e55b2fd708e8ac28d13c7a05b129885c87b48c98294e99ad49cbcbfc3c56d0e2", + "query_ordinal": 502, + "query_timestamp": 1700015411000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "25dd1ca3b5cd20767e154b4779889da13fbedace11d538411b68dcc56a99aba8", + "control_graph_rank_sha256": "cc8da86dd953c2cd8edc2f01a3c1739e084c8bcdd00ffd8d6916ba3304c4e243", + "control_public_rank_sha256": "7af1bee671a44706125e29f01b18de5cb02f3483ff83913cc8070ab1b45728ec", + "control_seed_rank_sha256": "25dd1ca3b5cd20767e154b4779889da13fbedace11d538411b68dcc56a99aba8", + "control_top1_age_events": 59, + "control_top1_age_ms": 59000, + "event_index": 15442, + "modality": "text", + "query_embedding_sha256": "2f29d458098a862c06605ef6028004a911e28985c359c7fb4e1bd8b30ef82118", + "query_ordinal": 503, + "query_timestamp": 1700015442000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "69a4b54e3d1446189d152fecf1d45617e69afe445c47155854245c252eca0b97", + "control_graph_rank_sha256": "2955a4cad43a0a5beeb2f54c9d6dd09364543513df36a7a852882009232b2373", + "control_public_rank_sha256": "27bd1eb7944d09f93dd9fbe7e22c311fcb679f6139e443af5e0f1edbffb226aa", + "control_seed_rank_sha256": "69a4b54e3d1446189d152fecf1d45617e69afe445c47155854245c252eca0b97", + "control_top1_age_events": 399, + "control_top1_age_ms": 399000, + "event_index": 15473, + "modality": "text", + "query_embedding_sha256": "4bbecbda1e56abd51b454309a0ead1853f5cd8a77153ccf54e15d82ee131cde6", + "query_ordinal": 504, + "query_timestamp": 1700015473000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "6098c7ef759e052f578308498a51e874823eccc1e7b8500716a2a8ced01b061c", + "control_graph_rank_sha256": "496934d535118204a3fb1811d3486c8bc40ff1c3c92262ad8310a2bf7a39388e", + "control_public_rank_sha256": "f3bcfe8e081f13d784eebcddd0619202b6a293a9dec3546b047261c6a6c38442", + "control_seed_rank_sha256": "6098c7ef759e052f578308498a51e874823eccc1e7b8500716a2a8ced01b061c", + "control_top1_age_events": 130, + "control_top1_age_ms": 130000, + "event_index": 15504, + "modality": "text", + "query_embedding_sha256": "6f3933a54c68477f2ef0d488b7393d2df4b4f9c97f35ba3de3f96f61edd84d66", + "query_ordinal": 505, + "query_timestamp": 1700015504000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "008a4881c9eac96e8b09689cf114441c97623151cda5c6a3a9287c8037d5e102", + "control_graph_rank_sha256": "0f9df9a28e952b3b3ecd821bd6da083a262027bcd1fb24a8b6e7c5a9d1adbef8", + "control_public_rank_sha256": "168ba06bf94b27e5c3ff602e3f85c12598f0b43428c11e4d8330101a44f35ac2", + "control_seed_rank_sha256": "008a4881c9eac96e8b09689cf114441c97623151cda5c6a3a9287c8037d5e102", + "control_top1_age_events": 2309, + "control_top1_age_ms": 2309000, + "event_index": 15536, + "modality": "text", + "query_embedding_sha256": "b67fa14ea8c06d47520cf7fe32770d29cf762b9e9a51abe902b09cf416bf0c41", + "query_ordinal": 506, + "query_timestamp": 1700015536000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "5e796b88489712ba7be09d6de7256646b0cf6280699a7fc301dfb9d593bf9d8a", + "control_graph_rank_sha256": "83dc9da8b884ac4dcd73ae5a2d89d6b948121dfc3113ef143a487c27997357d2", + "control_public_rank_sha256": "cdd2b52fb4121b673ffd8a1fc42101d89fecbadac562acd2f864972e0858c6fb", + "control_seed_rank_sha256": "5e796b88489712ba7be09d6de7256646b0cf6280699a7fc301dfb9d593bf9d8a", + "control_top1_age_events": 3102, + "control_top1_age_ms": 3102000, + "event_index": 15567, + "modality": "text", + "query_embedding_sha256": "93c699a69185c3ed415347a86fb4640f50959202b6c10851721bc7064a67c944", + "query_ordinal": 507, + "query_timestamp": 1700015567000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "2e262fa9f172753322b4402541a1044ed183a4efd6d2176dc5648d1a25a1b67f", + "control_graph_rank_sha256": "019b6d7fb0ae9a6d64a87cbecd0c6812749d9b08b4abb105fa4095cfc1ecb833", + "control_public_rank_sha256": "3549907c0f9e41588dec3ddeabbb9cb0bfd41a8ea75ebb5eb2fabe8356ac26bb", + "control_seed_rank_sha256": "2e262fa9f172753322b4402541a1044ed183a4efd6d2176dc5648d1a25a1b67f", + "control_top1_age_events": 8355, + "control_top1_age_ms": 8355000, + "event_index": 15596, + "modality": "text", + "query_embedding_sha256": "e7aa03fdc595992d8bda6b22fb85a19e4496966415388c4a118384d766ff0073", + "query_ordinal": 508, + "query_timestamp": 1700015596000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "c4164ca833a244d7b8218a45f7a7e9915984fe053887ec1bbca8452878028f85", + "control_graph_rank_sha256": "dbf26da2cc53a99c03d01c3410e6ea88e4809209f0e7a734d4265ad3a80b5872", + "control_public_rank_sha256": "2a36bd5d82f63e8c3ee0bd3f38d98d02756305daef985e90a76d25485dd3d24a", + "control_seed_rank_sha256": "c4164ca833a244d7b8218a45f7a7e9915984fe053887ec1bbca8452878028f85", + "control_top1_age_events": 20, + "control_top1_age_ms": 20000, + "event_index": 15625, + "modality": "text", + "query_embedding_sha256": "2045f2dbf0505f9e8287e4bfd78fe0b04db755eb693775cc51fd50bd3bb35dd5", + "query_ordinal": 509, + "query_timestamp": 1700015625000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "08de74390b788f2be25fdf92092f43095fbd7af5f5af7da9988a87298c9fc797", + "control_graph_rank_sha256": "e5d44a778d524eeb15b8c4c2fdcd18da2be581d88dca2469fd5c03641227dc82", + "control_public_rank_sha256": "a708673a54783858c84fda7a6f02c4811b8957ce4deead6e44f3096aff329cb2", + "control_seed_rank_sha256": "08de74390b788f2be25fdf92092f43095fbd7af5f5af7da9988a87298c9fc797", + "control_top1_age_events": 473, + "control_top1_age_ms": 473000, + "event_index": 15655, + "modality": "text", + "query_embedding_sha256": "e55b2fd708e8ac28d13c7a05b129885c87b48c98294e99ad49cbcbfc3c56d0e2", + "query_ordinal": 510, + "query_timestamp": 1700015655000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + }, + { + "candidate_seed_rank_sha256": "376be37742c53a1a9d681f149c3a9f1d503f81e5e3f4d77cfef45217cc23aad5", + "control_graph_rank_sha256": "bfc29ef28ea1001461fd00533ce94ca77944909c572161151b25ec3861310343", + "control_public_rank_sha256": "adf7cb4a03808fbd6c2adc19715db29b15d29e8b2494c529d243257578b33cf3", + "control_seed_rank_sha256": "376be37742c53a1a9d681f149c3a9f1d503f81e5e3f4d77cfef45217cc23aad5", + "control_top1_age_events": 2454, + "control_top1_age_ms": 2454000, + "event_index": 15691, + "modality": "text", + "query_embedding_sha256": "df090a65a3dd283e65454a4814c3df92aa29e13000a014562fd705a282509e38", + "query_ordinal": 511, + "query_timestamp": 1700015691000, + "source_id_blake3": "ca72cf19c76b3220d30f9bd0fcf0496868c79dc0371ae49d378bef9002dce410", + "top1_exact_match": true + } + ], + "result_k": 16, + "retrieval_active_event_count": 5404, + "schema": "cortext_current_public_retrieval_control_audit_v1", + "semantic_coverage": 1.0, + "source_digest_count": 1, + "status": "candidate-quality-passed", + "top1_miss_fingerprints": [], + "unresolved_limits": [] +} diff --git a/artifacts/flat_storage_cost/recenter-centroid-natural-full-v1-storage-audit.json b/artifacts/flat_storage_cost/recenter-centroid-natural-full-v1-storage-audit.json new file mode 100644 index 00000000..7e7d2390 --- /dev/null +++ b/artifacts/flat_storage_cost/recenter-centroid-natural-full-v1-storage-audit.json @@ -0,0 +1,4083 @@ +{ + "attribution": { + "detailed_subsections": { + "Competition.rif_recovery_active_sql": { + "delta_ms": 0.0023003624000000004, + "final_five_mean_ms": 0.0152683256, + "final_five_over_first_five": 1.1773881036306457, + "first_five_mean_ms": 0.0129679632 + }, + "Competition.score_candidates": { + "delta_ms": 8.372079999999997e-05, + "final_five_mean_ms": 0.0006562232, + "final_five_over_first_five": 1.1462365921959452, + "first_five_mean_ms": 0.0005725024 + }, + "EmotionalCascade.cache_bfs": { + "delta_ms": 0.0011452007999999997, + "final_five_mean_ms": 0.0035869815999999997, + "final_five_over_first_five": 1.4690022953739335, + "first_five_mean_ms": 0.0024417808 + }, + "EmotionalCascade.cache_ensure": { + "delta_ms": 4.555959999999999e-05, + "final_five_mean_ms": 0.0001855448, + "final_five_over_first_five": 1.325460120069836, + "first_five_mean_ms": 0.0001399852 + }, + "EmotionalCascade.current_values": { + "delta_ms": -1.2012e-06, + "final_five_mean_ms": 2.1e-06, + "final_five_over_first_five": 0.6361323155216285, + "first_five_mean_ms": 3.3012e-06 + }, + "EmotionalCascade.neighbor_lookup": { + "delta_ms": 0.00118993, + "final_five_mean_ms": 0.00377373, + "final_five_over_first_five": 1.4605348711200559, + "first_five_mean_ms": 0.0025838 + }, + "EmotionalCascade.source_query": { + "delta_ms": 1.0815600000000012e-05, + "final_five_mean_ms": 7.98328e-05, + "final_five_over_first_five": 1.1567087624534176, + "first_five_mean_ms": 6.90172e-05 + }, + "EmotionalCascade.telemetry": { + "delta_ms": 7.709599999999991e-06, + "final_five_mean_ms": 0.0001769852, + "final_five_over_first_five": 1.0455446620777005, + "first_five_mean_ms": 0.0001692756 + }, + "EmotionalCascade.total": { + "delta_ms": 0.0032442367999999996, + "final_five_mean_ms": 0.010344714, + "final_five_over_first_five": 1.4569040514629072, + "first_five_mean_ms": 0.0071004772 + }, + "EmotionalCascade.update_enqueue": { + "delta_ms": 0.0009363640000000001, + "final_five_mean_ms": 0.0017394288, + "final_five_over_first_five": 2.1659880995904692, + "first_five_mean_ms": 0.0008030647999999999 + }, + "GraphRetrieve.association_expansion": { + "delta_ms": 0.0005207896, + "final_five_mean_ms": 0.00259613, + "final_five_over_first_five": 1.2509417732146495, + "first_five_mean_ms": 0.0020753404 + }, + "GraphRetrieve.family_index": { + "delta_ms": 2.8125600000000007e-05, + "final_five_mean_ms": 0.0001221852, + "final_five_over_first_five": 1.29901891991886, + "first_five_mean_ms": 9.40596e-05 + }, + "GraphRetrieve.rank_candidates": { + "delta_ms": 0.0008206056000000005, + "final_five_mean_ms": 0.0043277204, + "final_five_over_first_five": 1.2339831020073824, + "first_five_mean_ms": 0.0035071148 + }, + "GraphRetrieve.reconstruction_append_current_surface": { + "delta_ms": 0.0075371828, + "final_five_mean_ms": 0.0101702172, + "final_five_over_first_five": 3.8625462698094637, + "first_five_mean_ms": 0.0026330344 + }, + "GraphRetrieve.reconstruction_append_insert_embedding": { + "delta_ms": 0.005800198800000001, + "final_five_mean_ms": 0.0080201156, + "final_five_over_first_five": 3.612800083318438, + "first_five_mean_ms": 0.0022199168 + }, + "GraphRetrieve.reconstruction_append_insert_record": { + "delta_ms": 0.001086556, + "final_five_mean_ms": 0.0015186544, + "final_five_over_first_five": 3.51460315520724, + "first_five_mean_ms": 0.0004320984 + }, + "GraphRetrieve.reconstruction_append_prune": { + "delta_ms": 0.0010323836, + "final_five_mean_ms": 0.0014573172, + "final_five_over_first_five": 3.4295174587276693, + "first_five_mean_ms": 0.0004249336 + }, + "GraphRetrieve.reconstruction_versions": { + "delta_ms": 0.0253268472, + "final_five_mean_ms": 0.0475178988, + "final_five_over_first_five": 2.141309013043798, + "first_five_mean_ms": 0.0221910516 + }, + "GraphRetrieve.seed_cache_distance": { + "delta_ms": 4.473599999999999e-06, + "final_five_mean_ms": 1.3613999999999999e-05, + "final_five_over_first_five": 1.4894315347249572, + "first_five_mean_ms": 9.1404e-06 + }, + "GraphRetrieve.seed_cache_eligibility": { + "delta_ms": 0.0476642204, + "final_five_mean_ms": 0.0785304604, + "final_five_over_first_five": 2.5442185507531856, + "first_five_mean_ms": 0.03086624 + }, + "GraphRetrieve.seed_cache_family": { + "delta_ms": 0.17652008880000003, + "final_five_mean_ms": 0.640075752, + "final_five_over_first_five": 1.3807958845361812, + "first_five_mean_ms": 0.46355566319999997 + }, + "GraphRetrieve.seed_cache_family_build": { + "delta_ms": 0.013478643199999966, + "final_five_mean_ms": 0.04888148599999998, + "final_five_over_first_five": 1.38072205885116, + "first_five_mean_ms": 0.035402842800000014 + }, + "GraphRetrieve.seed_cache_family_compare": { + "delta_ms": 0.1600975804, + "final_five_mean_ms": 0.5733030935999998, + "final_five_over_first_five": 1.387452672545803, + "first_five_mean_ms": 0.41320551319999976 + }, + "GraphRetrieve.seed_cache_sort": { + "delta_ms": 6.911880000000001e-05, + "final_five_mean_ms": 0.000315932, + "final_five_over_first_five": 1.2800449894900274, + "first_five_mean_ms": 0.0002468132 + }, + "GraphRetrieve.seed_knn_cache": { + "delta_ms": 1.0101790536, + "final_five_mean_ms": 1.8501279868, + "final_five_over_first_five": 2.202667226150839, + "first_five_mean_ms": 0.8399489332 + }, + "GraphRetrieve.seed_knn_cache_rebuild": { + "delta_ms": 0.0, + "final_five_mean_ms": 0.0, + "final_five_over_first_five": Infinity, + "first_five_mean_ms": 0.0 + }, + "GraphRetrieve.seed_knn_sql": { + "delta_ms": 0.0, + "final_five_mean_ms": 0.0, + "final_five_over_first_five": Infinity, + "first_five_mean_ms": 0.0 + }, + "GraphRetrieve.seed_processor_surface": { + "delta_ms": 0.0, + "final_five_mean_ms": 0.0, + "final_five_over_first_five": Infinity, + "first_five_mean_ms": 0.0 + }, + "GraphRetrieve.seed_rank": { + "delta_ms": 0.11607159479999996, + "final_five_mean_ms": 0.34947326959999997, + "final_five_over_first_five": 1.4973040356263971, + "first_five_mean_ms": 0.23340167480000001 + }, + "GraphRetrieve.total": { + "delta_ms": 1.6152159992000001, + "final_five_mean_ms": 3.2215930872, + "final_five_over_first_five": 2.00550238873925, + "first_five_mean_ms": 1.606377088 + }, + "MemoryStorage.begin_savepoints": { + "delta_ms": 0.00024946920000000006, + "final_five_mean_ms": 0.0028183012, + "final_five_over_first_five": 1.097113863421197, + "first_five_mean_ms": 0.002568832 + }, + "MemoryStorage.commit_savepoints": { + "delta_ms": 0.0002130652000000002, + "final_five_mean_ms": 0.001683566, + "final_five_over_first_five": 1.1448929507552803, + "first_five_mean_ms": 0.0014705007999999999 + }, + "MemoryStorage.content_blob": { + "delta_ms": 0.0005608491999999996, + "final_five_mean_ms": 0.0049285152, + "final_five_over_first_five": 1.1284093609721988, + "first_five_mean_ms": 0.004367666 + }, + "MemoryStorage.content_get_objects": { + "delta_ms": 9.37752e-05, + "final_five_mean_ms": 0.001901378, + "final_five_over_first_five": 1.0518782112973049, + "first_five_mean_ms": 0.0018076028 + }, + "MemoryStorage.content_put_object": { + "delta_ms": 0.00044270720000000015, + "final_five_mean_ms": 0.0027168036, + "final_five_over_first_five": 1.1946738933318746, + "first_five_mean_ms": 0.0022740964 + }, + "MemoryStorage.initial_reconstruction": { + "delta_ms": 0.008034374400000002, + "final_five_mean_ms": 0.0317527556, + "final_five_over_first_five": 1.3387404196033412, + "first_five_mean_ms": 0.0237183812 + }, + "MemoryStorage.insert_memory": { + "delta_ms": 0.0012010199999999997, + "final_five_mean_ms": 0.0081927016, + "final_five_over_first_five": 1.1717784173695782, + "first_five_mean_ms": 0.0069916816 + }, + "MemoryStorage.insert_memory_embedding": { + "delta_ms": 0.0024475956000000014, + "final_five_mean_ms": 0.0222830296, + "final_five_over_first_five": 1.1233951120000703, + "first_five_mean_ms": 0.019835434 + }, + "MemoryStorage.insert_signal_embeddings": { + "delta_ms": 0.0012689487999999992, + "final_five_mean_ms": 0.013756212, + "final_five_over_first_five": 1.1016194485273603, + "first_five_mean_ms": 0.012487263200000001 + }, + "MemoryStorage.insert_signal_rows": { + "delta_ms": 0.0009746119999999997, + "final_five_mean_ms": 0.0066294488, + "final_five_over_first_five": 1.172350155180429, + "first_five_mean_ms": 0.0056548368 + }, + "MemoryStorage.retrieval_surface_update": { + "delta_ms": 0.0016965596000000005, + "final_five_mean_ms": 0.0064564364, + "final_five_over_first_five": 1.3564293092627944, + "first_five_mean_ms": 0.0047598768 + }, + "MemoryStorage.select_embedding_id": { + "delta_ms": 4.929120000000004e-05, + "final_five_mean_ms": 0.0003828888, + "final_five_over_first_five": 1.147756458679559, + "first_five_mean_ms": 0.00033359759999999997 + }, + "MemoryStorage.select_memory_id": { + "delta_ms": 1.081159999999999e-05, + "final_five_mean_ms": 0.0001705944, + "final_five_over_first_five": 1.0676643543610451, + "first_five_mean_ms": 0.0001597828 + }, + "MemoryStorage.select_signal_ids": { + "delta_ms": 5.575479999999993e-05, + "final_five_mean_ms": 0.0005636996, + "final_five_over_first_five": 1.1097654705786926, + "first_five_mean_ms": 0.0005079448 + }, + "MemoryStorage.signal_payload_put": { + "delta_ms": -0.010834847599999996, + "final_five_mean_ms": 0.0165654572, + "final_five_over_first_five": 0.6045720046150729, + "first_five_mean_ms": 0.027400304799999997 + }, + "MemoryStorage.supersession_candidate_load": { + "delta_ms": 0.5065675664, + "final_five_mean_ms": 0.7339664484, + "final_five_over_first_five": 3.227660760442965, + "first_five_mean_ms": 0.227398882 + }, + "MemoryStorage.supersession_current_load": { + "delta_ms": 0.506168116, + "final_five_mean_ms": 0.7321023988, + "final_five_over_first_five": 3.2403333824644345, + "first_five_mean_ms": 0.2259342828 + }, + "MemoryStorage.supersession_edges": { + "delta_ms": 0.5122980956000001, + "final_five_mean_ms": 0.7596046652, + "final_five_over_first_five": 3.071510257202646, + "first_five_mean_ms": 0.2473065696 + }, + "MemoryStorage.supersession_historical_load": { + "delta_ms": -6.934000000000002e-06, + "final_five_mean_ms": 1.86512e-05, + "final_five_over_first_five": 0.728983943842534, + "first_five_mean_ms": 2.55852e-05 + }, + "MemoryStorage.supersession_score": { + "delta_ms": 0.0012376640000000003, + "final_five_mean_ms": 0.0065524848, + "final_five_over_first_five": 1.2328703161544037, + "first_five_mean_ms": 0.0053148208 + }, + "MemoryStorage.supersession_write": { + "delta_ms": 0.004346243599999999, + "final_five_mean_ms": 0.0185865348, + "final_five_over_first_five": 1.3052074946332557, + "first_five_mean_ms": 0.0142402912 + } + }, + "diagnostic_counters": { + "Competition.candidate_activity": { + "delta": -0.0008000000000000229, + "final_five_mean": 0.346, + "final_five_over_first_five": 0.9976931949250287, + "first_five_mean": 0.3468 + }, + "Competition.candidate_count": { + "delta": -0.009599999999999831, + "final_five_mean": 4.152, + "final_five_over_first_five": 0.9976931949250288, + "first_five_mean": 4.1616 + }, + "Competition.rows_touched": { + "delta": -0.0008000000000000229, + "final_five_mean": 0.346, + "final_five_over_first_five": 0.9976931949250287, + "first_five_mean": 0.3468 + }, + "Competition.rows_touched_activity": { + "delta": -0.0008000000000000229, + "final_five_mean": 0.346, + "final_five_over_first_five": 0.9976931949250287, + "first_five_mean": 0.3468 + }, + "Competition.rows_visited": { + "delta": -0.0008000000000000229, + "final_five_mean": 0.346, + "final_five_over_first_five": 0.9976931949250287, + "first_five_mean": 0.3468 + }, + "Competition.rows_visited_activity": { + "delta": -0.0008000000000000229, + "final_five_mean": 0.346, + "final_five_over_first_five": 0.9976931949250287, + "first_five_mean": 0.3468 + }, + "ConsolidationEpoch.accumulator_signal_count": { + "delta": -0.018799999999999928, + "final_five_mean": 1.7804, + "final_five_over_first_five": 0.9895509115162294, + "first_five_mean": 1.7992 + }, + "ConsolidationEpoch.consolidation_dirty_association_count": { + "delta": 1.1472000000000016, + "final_five_mean": 26.86, + "final_five_over_first_five": 1.0446159111415327, + "first_five_mean": 25.712799999999998 + }, + "ConsolidationEpoch.consolidation_dirty_index_count": { + "delta": 15.644400000000005, + "final_five_mean": 73.6568, + "final_five_over_first_five": 1.269673380173894, + "first_five_mean": 58.0124 + }, + "ConsolidationEpoch.consolidation_dirty_memory_count": { + "delta": 55.776399999999995, + "final_five_mean": 204.9924, + "final_five_over_first_five": 1.373796375723783, + "first_five_mean": 149.216 + }, + "ConsolidationEpoch.epoch_id": { + "delta": 78.194, + "final_five_mean": 109.3344, + "final_five_over_first_five": 3.511014630512132, + "first_five_mean": 31.1404 + }, + "ConsolidationEpoch.events_since_epoch_start": { + "delta": -0.2576000000000036, + "final_five_mean": 63.5132, + "final_five_over_first_five": 0.995960533661174, + "first_five_mean": 63.7708 + }, + "ConsolidationEpoch.working_memory_pending_signal_count": { + "delta": 1.4436000000000035, + "final_five_mean": 58.8616, + "final_five_over_first_five": 1.02514194155143, + "first_five_mean": 57.418 + }, + "Cortext.fallback_hydration_signal_limit": { + "delta": 0.0, + "final_five_mean": 125.0, + "final_five_over_first_five": 1.0, + "first_five_mean": 125.0 + }, + "Cortext.fallback_hydration_signal_rows": { + "delta": 9.848000000000013, + "final_five_mean": 134.848, + "final_five_over_first_five": 1.0787840000000002, + "first_five_mean": 125.0 + }, + "EmotionalCascade.edge_visit_count": { + "delta": 2.4968000000000004, + "final_five_mean": 13.7348, + "final_five_over_first_five": 1.222174764192917, + "first_five_mean": 11.238 + }, + "EmotionalCascade.edge_visit_limit": { + "delta": 0.0, + "final_five_mean": 0.0, + "final_five_over_first_five": Infinity, + "first_five_mean": 0.0 + }, + "EmotionalCascade.edge_visit_limit_reached": { + "delta": 0.0, + "final_five_mean": 0.0, + "final_five_over_first_five": Infinity, + "first_five_mean": 0.0 + }, + "EmotionalCascade.neighbor_activity": { + "delta": -0.011199999999999998, + "final_five_mean": 0.0212, + "final_five_over_first_five": 0.654320987654321, + "first_five_mean": 0.0324 + }, + "EmotionalCascade.neighbor_count": { + "delta": 2.5763999999999996, + "final_five_mean": 10.468, + "final_five_over_first_five": 1.3264737188909725, + "first_five_mean": 7.8916 + }, + "EmotionalCascade.neighbor_execution_count": { + "delta": 2.5763999999999996, + "final_five_mean": 10.468, + "final_five_over_first_five": 1.3264737188909725, + "first_five_mean": 7.8916 + }, + "EmotionalCascade.reachable_pair_count": { + "delta": 2.5763999999999996, + "final_five_mean": 10.468, + "final_five_over_first_five": 1.3264737188909725, + "first_five_mean": 7.8916 + }, + "EmotionalCascade.source_activity": { + "delta": -0.011199999999999998, + "final_five_mean": 0.0212, + "final_five_over_first_five": 0.654320987654321, + "first_five_mean": 0.0324 + }, + "EmotionalCascade.source_count": { + "delta": 0.00040000000000001146, + "final_five_mean": 0.1496, + "final_five_over_first_five": 1.002680965147453, + "first_five_mean": 0.1492 + }, + "EmotionalCascade.source_execution_count": { + "delta": 0.00040000000000001146, + "final_five_mean": 0.1496, + "final_five_over_first_five": 1.002680965147453, + "first_five_mean": 0.1492 + }, + "EmotionalCascade.source_inspection_count": { + "delta": 0.3336, + "final_five_mean": 1.022, + "final_five_over_first_five": 1.484601975595584, + "first_five_mean": 0.6884 + }, + "EmotionalCascade.source_inspection_limit": { + "delta": 0.0, + "final_five_mean": 0.0, + "final_five_over_first_five": Infinity, + "first_five_mean": 0.0 + }, + "EmotionalCascade.source_limit": { + "delta": 0.0, + "final_five_mean": 0.0, + "final_five_over_first_five": Infinity, + "first_five_mean": 0.0 + }, + "EmotionalCascade.source_limit_reached": { + "delta": 0.0, + "final_five_mean": 0.0, + "final_five_over_first_five": Infinity, + "first_five_mean": 0.0 + }, + "EmotionalCascade.update_activity": { + "delta": -0.011199999999999998, + "final_five_mean": 0.0212, + "final_five_over_first_five": 0.654320987654321, + "first_five_mean": 0.0324 + }, + "EmotionalCascade.update_count": { + "delta": 0.06000000000000001, + "final_five_mean": 0.14200000000000002, + "final_five_over_first_five": 1.731707317073171, + "first_five_mean": 0.082 + }, + "EmotionalCascade.update_execution_count": { + "delta": 0.06000000000000001, + "final_five_mean": 0.14200000000000002, + "final_five_over_first_five": 1.731707317073171, + "first_five_mean": 0.082 + }, + "EmotionalCascade.update_limit": { + "delta": 0.0, + "final_five_mean": 1248.0, + "final_five_over_first_five": 1.0, + "first_five_mean": 1248.0 + }, + "EmotionalCascade.update_limit_reached": { + "delta": 0.0, + "final_five_mean": 0.0, + "final_five_over_first_five": Infinity, + "first_five_mean": 0.0 + }, + "GraphRetrieve.cache_rebuild_activity": { + "delta": 0.0, + "final_five_mean": 0.0, + "final_five_over_first_five": Infinity, + "first_five_mean": 0.0 + }, + "GraphRetrieve.cache_rebuild_count": { + "delta": 0.0, + "final_five_mean": 0.0, + "final_five_over_first_five": Infinity, + "first_five_mean": 0.0 + }, + "GraphRetrieve.candidate_activity": { + "delta": -0.0008000000000000229, + "final_five_mean": 0.346, + "final_five_over_first_five": 0.9976931949250287, + "first_five_mean": 0.3468 + }, + "GraphRetrieve.candidate_count": { + "delta": -0.03279999999999994, + "final_five_mean": 14.186, + "final_five_over_first_five": 0.9976931949250288, + "first_five_mean": 14.2188 + }, + "GraphRetrieve.family_exact_comparison_activity": { + "delta": 0.04680000000000001, + "final_five_mean": 0.346, + "final_five_over_first_five": 1.1564171122994653, + "first_five_mean": 0.29919999999999997 + }, + "GraphRetrieve.family_exact_comparison_count": { + "delta": 3.4092000000000002, + "final_five_mean": 4.6044, + "final_five_over_first_five": 3.852409638554217, + "first_five_mean": 1.1952 + }, + "GraphRetrieve.rows_visited": { + "delta": 115.21679999999998, + "final_five_mean": 431.808, + "final_five_over_first_five": 1.3639292564038419, + "first_five_mean": 316.5912 + }, + "GraphRetrieve.rows_visited_activity": { + "delta": -0.0008000000000000229, + "final_five_mean": 0.346, + "final_five_over_first_five": 0.9976931949250287, + "first_five_mean": 0.3468 + }, + "GraphRetrieve.seed_cache_distance_rows": { + "delta": 115.21679999999998, + "final_five_mean": 431.808, + "final_five_over_first_five": 1.3639292564038419, + "first_five_mean": 316.5912 + }, + "GraphRetrieve.seed_cache_eligibility_rows": { + "delta": 115.21679999999998, + "final_five_mean": 431.808, + "final_five_over_first_five": 1.3639292564038419, + "first_five_mean": 316.5912 + }, + "GraphRetrieve.seed_cache_ranked_rows": { + "delta": 50.04239999999999, + "final_five_mean": 175.46959999999999, + "final_five_over_first_five": 1.3989756607817123, + "first_five_mean": 125.4272 + }, + "GraphRetrieve.seed_cache_rows": { + "delta": 0.017349681999999998, + "final_five_mean": 0.0505064956, + "final_five_over_first_five": 1.5232614390907575, + "first_five_mean": 0.0331568136 + }, + "GraphRetrieve.seed_cache_selected_rows": { + "delta": 14.940799999999996, + "final_five_mean": 136.3072, + "final_five_over_first_five": 1.12310491206792, + "first_five_mean": 121.3664 + }, + "GraphRetrieve.seed_sparse_route_active": { + "delta": -0.0008000000000000229, + "final_five_mean": 0.346, + "final_five_over_first_five": 0.9976931949250287, + "first_five_mean": 0.3468 + }, + "GraphRetrieve.sqlite_sparse_route_activated_identities": { + "delta": 115.21679999999998, + "final_five_mean": 431.808, + "final_five_over_first_five": 1.3639292564038419, + "first_five_mean": 316.5912 + }, + "GraphRetrieve.sqlite_sparse_route_activation_snapshot_cache_miss_rows": { + "delta": 0.0, + "final_five_mean": 0.0, + "final_five_over_first_five": Infinity, + "first_five_mean": 0.0 + }, + "GraphRetrieve.sqlite_sparse_route_activation_snapshot_rows": { + "delta": 119.67000000000002, + "final_five_mean": 431.808, + "final_five_over_first_five": 1.3833881167944948, + "first_five_mean": 312.138 + }, + "GraphRetrieve.sqlite_sparse_route_dirty_rows": { + "delta": 0.9787999999999997, + "final_five_mean": 9.6516, + "final_five_over_first_five": 1.1128585923807766, + "first_five_mean": 8.6728 + }, + "GraphRetrieve.sqlite_sparse_route_distance_evaluations": { + "delta": 718.6351999999999, + "final_five_mean": 1039.446, + "final_five_over_first_five": 3.240059249875627, + "first_five_mean": 320.81080000000003 + }, + "GraphRetrieve.sqlite_sparse_route_node_rows": { + "delta": 598.0012, + "final_five_mean": 598.0012, + "final_five_over_first_five": Infinity, + "first_five_mean": 0.0 + }, + "GraphRetrieve.sqlite_sparse_route_restart_rows": { + "delta": -0.0008000000000000229, + "final_five_mean": 0.346, + "final_five_over_first_five": 0.9976931949250287, + "first_five_mean": 0.3468 + }, + "GraphRetrieve.sqlite_sparse_route_search_effort": { + "delta": -1.995999999999981, + "final_five_mean": 863.27, + "final_five_over_first_five": 0.9976931949250288, + "first_five_mean": 865.266 + }, + "GraphRetrieve.sqlite_sparse_route_search_failure_code": { + "delta": 0.0, + "final_five_mean": 0.0, + "final_five_over_first_five": Infinity, + "first_five_mean": 0.0 + }, + "GraphRetrieve.sqlite_sparse_route_search_node_budget": { + "delta": -1.995999999999981, + "final_five_mean": 863.27, + "final_five_over_first_five": 0.9976931949250288, + "first_five_mean": 865.266 + }, + "MemoryStorage.supersession_current_candidate_activity": { + "delta": 0.006399999999999989, + "final_five_mean": 0.208, + "final_five_over_first_five": 1.0317460317460316, + "first_five_mean": 0.2016 + }, + "MemoryStorage.supersession_current_candidate_count": { + "delta": 2.5215999999999923, + "final_five_mean": 81.952, + "final_five_over_first_five": 1.0317460317460316, + "first_five_mean": 79.4304 + }, + "MemoryStorage.supersession_current_candidate_execution_count": { + "delta": 2.5215999999999923, + "final_five_mean": 81.952, + "final_five_over_first_five": 1.0317460317460316, + "first_five_mean": 79.4304 + }, + "MemoryStorage.supersession_current_rows_visited": { + "delta": 75.82560000000001, + "final_five_mean": 259.584, + "final_five_over_first_five": 1.4126374631037275, + "first_five_mean": 183.7584 + }, + "MemoryStorage.supersession_historical_candidate_activity": { + "delta": 0.0, + "final_five_mean": 0.0, + "final_five_over_first_five": Infinity, + "first_five_mean": 0.0 + }, + "MemoryStorage.supersession_historical_candidate_count": { + "delta": 0.0, + "final_five_mean": 0.0, + "final_five_over_first_five": Infinity, + "first_five_mean": 0.0 + }, + "MemoryStorage.supersession_historical_candidate_execution_count": { + "delta": 0.0, + "final_five_mean": 0.0, + "final_five_over_first_five": Infinity, + "first_five_mean": 0.0 + }, + "MemoryStorage.supersession_historical_coverage_proven": { + "delta": 0.006399999999999989, + "final_five_mean": 0.208, + "final_five_over_first_five": 1.0317460317460316, + "first_five_mean": 0.2016 + }, + "MemoryStorage.supersession_historical_rows_visited": { + "delta": 0.0, + "final_five_mean": 0.0, + "final_five_over_first_five": Infinity, + "first_five_mean": 0.0 + }, + "MemoryStorage.supersession_population_ambiguous": { + "delta": 0.0, + "final_five_mean": 0.0, + "final_five_over_first_five": Infinity, + "first_five_mean": 0.0 + }, + "MemoryStorage.supersession_population_mismatch_count": { + "delta": 117.67960000000001, + "final_five_mean": 132.6928, + "final_five_over_first_five": 8.838408866863826, + "first_five_mean": 15.0132 + }, + "MemoryStorage.supersession_rows_visited_activity": { + "delta": 0.006399999999999989, + "final_five_mean": 0.208, + "final_five_over_first_five": 1.0317460317460316, + "first_five_mean": 0.2016 + }, + "MemoryStorage.supersession_sparse_route_dirty_rows": { + "delta": 0.7216000000000005, + "final_five_mean": 5.7084, + "final_five_over_first_five": 1.1447020133151522, + "first_five_mean": 4.9868 + }, + "MemoryStorage.supersession_sparse_route_distance_evaluations": { + "delta": 438.41200000000003, + "final_five_mean": 624.6484, + "final_five_over_first_five": 3.3540618267964804, + "first_five_mean": 186.2364 + }, + "MemoryStorage.supersession_sparse_route_node_rows": { + "delta": 359.3636, + "final_five_mean": 359.3636, + "final_five_over_first_five": Infinity, + "first_five_mean": 0.0 + }, + "MemoryStorage.supersession_sql_fallback_count": { + "delta": 0.0, + "final_five_mean": 0.0, + "final_five_over_first_five": Infinity, + "first_five_mean": 0.0 + }, + "MemoryStorage.supersession_tie_order_equivalent": { + "delta": 0.006399999999999989, + "final_five_mean": 0.208, + "final_five_over_first_five": 1.0317460317460316, + "first_five_mean": 0.2016 + }, + "SignalProcessor.commit_cache_spill_count": { + "delta": 0.0, + "final_five_mean": 0.0, + "final_five_over_first_five": Infinity, + "first_five_mean": 0.0 + }, + "SignalProcessor.commit_cache_write_count": { + "delta": 15.973599999999998, + "final_five_mean": 57.5092, + "final_five_over_first_five": 1.3845761226514122, + "first_five_mean": 41.5356 + }, + "SignalProcessor.commit_table_row_count.associations": { + "delta": 0.012799999999999978, + "final_five_mean": 0.416, + "final_five_over_first_five": 1.0317460317460316, + "first_five_mean": 0.4032 + }, + "SignalProcessor.commit_table_row_count.cortext_active_signal_embeddings": { + "delta": 0.03280000000000016, + "final_five_mean": 1.8152000000000001, + "final_five_over_first_five": 1.0184021543985637, + "first_five_mean": 1.7824 + }, + "SignalProcessor.commit_table_row_count.cortext_mutation_trigger_journal": { + "delta": 2.1712000000000007, + "final_five_mean": 10.7972, + "final_five_over_first_five": 1.25170415024345, + "first_five_mean": 8.626 + }, + "SignalProcessor.commit_table_row_count.cortext_sparse_route_dirty": { + "delta": 0.06280000000000002, + "final_five_mean": 0.4312, + "final_five_over_first_five": 1.1704668838219328, + "first_five_mean": 0.3684 + }, + "SignalProcessor.commit_table_row_count.current_memory_embeddings_auxiliary": { + "delta": 0.15199999999999997, + "final_five_mean": 0.42719999999999997, + "final_five_over_first_five": 1.5523255813953487, + "first_five_mean": 0.2752 + }, + "SignalProcessor.commit_table_row_count.current_memory_embeddings_chunks": { + "delta": 0.2308, + "final_five_mean": 0.7448, + "final_five_over_first_five": 1.4490272373540856, + "first_five_mean": 0.514 + }, + "SignalProcessor.commit_table_row_count.current_memory_embeddings_rowids": { + "delta": 0.23119999999999996, + "final_five_mean": 0.7448, + "final_five_over_first_five": 1.4501557632398752, + "first_five_mean": 0.5136000000000001 + }, + "SignalProcessor.commit_table_row_count.current_memory_embeddings_vector_chunks00": { + "delta": 0.07879999999999998, + "final_five_mean": 0.3176, + "final_five_over_first_five": 1.3299832495812394, + "first_five_mean": 0.2388 + }, + "SignalProcessor.commit_table_row_count.embeddings_auxiliary": { + "delta": 0.08560000000000006, + "final_five_mean": 0.5256000000000001, + "final_five_over_first_five": 1.1945454545454548, + "first_five_mean": 0.44 + }, + "SignalProcessor.commit_table_row_count.embeddings_chunks": { + "delta": 0.17120000000000013, + "final_five_mean": 1.0516, + "final_five_over_first_five": 1.1944570649704682, + "first_five_mean": 0.8804 + }, + "SignalProcessor.commit_table_row_count.embeddings_rowids": { + "delta": 0.17120000000000013, + "final_five_mean": 1.0512000000000001, + "final_five_over_first_five": 1.1945454545454548, + "first_five_mean": 0.88 + }, + "SignalProcessor.commit_table_row_count.embeddings_vector_chunks00": { + "delta": 0.08560000000000001, + "final_five_mean": 0.526, + "final_five_over_first_five": 1.1943687556766576, + "first_five_mean": 0.4404 + }, + "SignalProcessor.commit_table_row_count.episodes": { + "delta": 0.005600000000000049, + "final_five_mean": 0.44480000000000003, + "final_five_over_first_five": 1.0127504553734064, + "first_five_mean": 0.4392 + }, + "SignalProcessor.commit_table_row_count.memories": { + "delta": 1.8856000000000002, + "final_five_mean": 20.5824, + "final_five_over_first_five": 1.1008514826066493, + "first_five_mean": 18.6968 + }, + "SignalProcessor.commit_table_row_count.memory_reconstructions": { + "delta": 0.07919999999999999, + "final_five_mean": 0.3176, + "final_five_over_first_five": 1.332214765100671, + "first_five_mean": 0.2384 + }, + "SignalProcessor.commit_table_row_count.meta_learning_coeffs": { + "delta": -0.010799999999999699, + "final_five_mean": 2.97, + "final_five_over_first_five": 0.996376811594203, + "first_five_mean": 2.9808 + }, + "SignalProcessor.commit_table_row_count.objstore_data": { + "delta": 0.012799999999999923, + "final_five_mean": 0.9236, + "final_five_over_first_five": 1.0140535792709704, + "first_five_mean": 0.9108 + }, + "SignalProcessor.commit_table_row_count.objstore_rowidx": { + "delta": 0.012799999999999923, + "final_five_mean": 0.9236, + "final_five_over_first_five": 1.0140535792709704, + "first_five_mean": 0.9108 + }, + "SignalProcessor.commit_table_row_count.rif_active_state": { + "delta": -0.04479999999999951, + "final_five_mean": 7.8148, + "final_five_over_first_five": 0.9942999643747774, + "first_five_mean": 7.8595999999999995 + }, + "SignalProcessor.commit_table_row_count.rif_recovery_clock": { + "delta": -0.0008000000000000229, + "final_five_mean": 0.346, + "final_five_over_first_five": 0.9976931949250287, + "first_five_mean": 0.3468 + }, + "SignalProcessor.commit_table_row_count.signals": { + "delta": 0.04919999999999991, + "final_five_mean": 2.7228, + "final_five_over_first_five": 1.0184021543985637, + "first_five_mean": 2.6736 + }, + "SignalProcessor.commit_table_row_count.soft_anchor_links": { + "delta": 0.0, + "final_five_mean": 0.0, + "final_five_over_first_five": Infinity, + "first_five_mean": 0.0 + }, + "SignalProcessor.commit_table_row_count.soft_anchors": { + "delta": 0.025599999999999956, + "final_five_mean": 0.832, + "final_five_over_first_five": 1.0317460317460316, + "first_five_mean": 0.8064 + }, + "SignalProcessor.commit_table_row_count.state": { + "delta": 0.0, + "final_five_mean": 2.0, + "final_five_over_first_five": 1.0, + "first_five_mean": 2.0 + }, + "SignalProcessor.predictive_id_activity": { + "delta": 0.0, + "final_five_mean": 1.0, + "final_five_over_first_five": 1.0, + "first_five_mean": 1.0 + }, + "SignalProcessor.predictive_id_count": { + "delta": 2.871600000000001, + "final_five_mean": 52.5708, + "final_five_over_first_five": 1.0577796020861503, + "first_five_mean": 49.6992 + }, + "SignalProcessor.retrieval_suppression_id_activity": { + "delta": -0.0008000000000000229, + "final_five_mean": 0.346, + "final_five_over_first_five": 0.9976931949250287, + "first_five_mean": 0.3468 + }, + "SignalProcessor.retrieval_suppression_id_count": { + "delta": -0.0047999999999999154, + "final_five_mean": 2.076, + "final_five_over_first_five": 0.9976931949250288, + "first_five_mean": 2.0808 + }, + "SignalProcessor.rif_active_epoch_allocated_bytes": { + "delta": 0.0, + "final_five_mean": 32768.0, + "final_five_over_first_five": 1.0, + "first_five_mean": 32768.0 + }, + "SignalProcessor.rif_active_epoch_event_count": { + "delta": -0.2576000000000036, + "final_five_mean": 63.5132, + "final_five_over_first_five": 0.995960533661174, + "first_five_mean": 63.7708 + }, + "SignalProcessor.rif_active_epoch_mutation_count": { + "delta": 0.8288000000000011, + "final_five_mean": 156.8588, + "final_five_over_first_five": 1.0053117990130103, + "first_five_mean": 156.03 + }, + "SignalProcessor.rif_active_epoch_required": { + "delta": 0.0, + "final_five_mean": 0.0, + "final_five_over_first_five": Infinity, + "first_five_mean": 0.0 + }, + "SignalProcessor.rif_active_epoch_row_batch_high_water": { + "delta": 0.026399999999999757, + "final_five_mean": 5.9928, + "final_five_over_first_five": 1.0044247787610618, + "first_five_mean": 5.9664 + }, + "SignalProcessor.rif_epoch_publication_rebuild_count": { + "delta": 0.0, + "final_five_mean": 0.0, + "final_five_over_first_five": Infinity, + "first_five_mean": 0.0 + }, + "SignalProcessor.rif_epoch_publication_recovery_count": { + "delta": 0.0, + "final_five_mean": 0.0, + "final_five_over_first_five": Infinity, + "first_five_mean": 0.0 + }, + "SignalProcessor.snapshot_cache_entry_copy_activity": { + "delta": 0.0, + "final_five_mean": 0.0, + "final_five_over_first_five": Infinity, + "first_five_mean": 0.0 + }, + "SignalProcessor.snapshot_cache_entry_copy_count": { + "delta": 0.0, + "final_five_mean": 0.0, + "final_five_over_first_five": Infinity, + "first_five_mean": 0.0 + }, + "SignalProcessor.snapshot_full_cache_copy_activity": { + "delta": 0.0, + "final_five_mean": 0.0, + "final_five_over_first_five": Infinity, + "first_five_mean": 0.0 + }, + "SignalProcessor.snapshot_full_cache_copy_count": { + "delta": 0.0, + "final_five_mean": 0.0, + "final_five_over_first_five": Infinity, + "first_five_mean": 0.0 + }, + "SignalProcessor.sqlite_sparse_route_ordinary_backfill_published": { + "delta": 0.0, + "final_five_mean": 0.0, + "final_five_over_first_five": Infinity, + "first_five_mean": 0.0 + }, + "SignalProcessor.sqlite_sparse_route_ordinary_backfill_succeeded": { + "delta": 0.0, + "final_five_mean": 0.0, + "final_five_over_first_five": Infinity, + "first_five_mean": 0.0 + }, + "SignalProcessor.sqlite_sparse_route_ordinary_seal_delta_count": { + "delta": 0.0, + "final_five_mean": 0.0, + "final_five_over_first_five": Infinity, + "first_five_mean": 0.0 + }, + "SignalProcessor.sqlite_sparse_route_ordinary_seal_failure_code": { + "delta": 0.0, + "final_five_mean": 0.0, + "final_five_over_first_five": Infinity, + "first_five_mean": 0.0 + }, + "SignalProcessor.sqlite_sparse_route_ordinary_seal_succeeded": { + "delta": 0.0, + "final_five_mean": 0.0, + "final_five_over_first_five": Infinity, + "first_five_mean": 0.0 + }, + "SignalProcessor.sqlite_sparse_route_recenter_centroid_cluster_count": { + "delta": 0.0, + "final_five_mean": 0.0, + "final_five_over_first_five": Infinity, + "first_five_mean": 0.0 + }, + "SignalProcessor.sqlite_sparse_route_recenter_centroid_member_count": { + "delta": 0.0, + "final_five_mean": 0.0, + "final_five_over_first_five": Infinity, + "first_five_mean": 0.0 + }, + "SignalProcessor.sqlite_sparse_route_recenter_overlap_count": { + "delta": 0.0, + "final_five_mean": 0.0, + "final_five_over_first_five": Infinity, + "first_five_mean": 0.0 + }, + "SignalProcessor.sqlite_sparse_route_recenter_overlap_failure_code": { + "delta": 0.0, + "final_five_mean": 0.0, + "final_five_over_first_five": Infinity, + "first_five_mean": 0.0 + }, + "SignalProcessor.sqlite_sparse_route_recenter_post_activated_count": { + "delta": 0.0, + "final_five_mean": 0.0, + "final_five_over_first_five": Infinity, + "first_five_mean": 0.0 + }, + "SignalProcessor.sqlite_sparse_route_recenter_post_node_count": { + "delta": 0.0, + "final_five_mean": 0.0, + "final_five_over_first_five": Infinity, + "first_five_mean": 0.0 + }, + "SignalProcessor.sqlite_sparse_route_recenter_pre_activated_count": { + "delta": 0.0, + "final_five_mean": 0.0, + "final_five_over_first_five": Infinity, + "first_five_mean": 0.0 + }, + "SignalProcessor.sqlite_sparse_route_recenter_pre_node_count": { + "delta": 0.0, + "final_five_mean": 0.0, + "final_five_over_first_five": Infinity, + "first_five_mean": 0.0 + }, + "WriteGate.accumulator_available": { + "delta": 0.0028000000000000247, + "final_five_mean": 0.22240000000000001, + "final_five_over_first_five": 1.0127504553734064, + "first_five_mean": 0.2196 + }, + "WriteGate.coverage": { + "delta": 3.611111111111176e-05, + "final_five_mean": 0.006647222222222223, + "final_five_over_first_five": 1.0054621848739498, + "first_five_mean": 0.006611111111111111 + }, + "WriteGate.effective_threshold": { + "delta": 0.0023420333008787597, + "final_five_mean": 0.07266246342536971, + "final_five_over_first_five": 1.0333051617678186, + "first_five_mean": 0.07032043012449095 + }, + "WriteGate.flush_trigger": { + "delta": 0.0028000000000000247, + "final_five_mean": 0.22240000000000001, + "final_five_over_first_five": 1.0127504553734064, + "first_five_mean": 0.2196 + }, + "WriteGate.force_write": { + "delta": -0.0011999999999999927, + "final_five_mean": 0.1212, + "final_five_over_first_five": 0.9901960784313726, + "first_five_mean": 0.1224 + }, + "WriteGate.n_signals": { + "delta": 0.005199999999999982, + "final_five_mean": 0.9571999999999999, + "final_five_over_first_five": 1.0054621848739496, + "first_five_mean": 0.952 + }, + "WriteGate.reason_code": { + "delta": 0.006000000000000227, + "final_five_mean": 2.5604, + "final_five_over_first_five": 1.0023488881929221, + "first_five_mean": 2.5544 + }, + "WriteGate.refractory_multiplier": { + "delta": 0.0005812235904181229, + "final_five_mean": 1.033917758107258, + "final_five_over_first_five": 1.000562472699845, + "first_five_mean": 1.03333653451684 + }, + "WriteGate.score_margin": { + "delta": 0.0019161543663120464, + "final_five_mean": 0.03139458551008486, + "final_five_over_first_five": 1.0650019112946187, + "first_five_mean": 0.029478431143772812 + }, + "WriteGate.spike_bypass": { + "delta": -0.0011999999999999927, + "final_five_mean": 0.1212, + "final_five_over_first_five": 0.9901960784313726, + "first_five_mean": 0.1224 + }, + "WriteGate.threshold_dynamic": { + "delta": 0.0064686531154334315, + "final_five_mean": 0.36092106652949835, + "final_five_over_first_five": 1.0182497081995514, + "first_five_mean": 0.3544524134140649 + }, + "WriteGate.window_score": { + "delta": 0.004258187667190799, + "final_five_mean": 0.10405704893545456, + "final_five_over_first_five": 1.0426676979384024, + "first_five_mean": 0.09979886126826376 + }, + "WriteGate.write_accumulator": { + "delta": 0.006399999999999989, + "final_five_mean": 0.208, + "final_five_over_first_five": 1.0317460317460316, + "first_five_mean": 0.2016 + }, + "WriteGate.write_scale": { + "delta": -0.000235638285191353, + "final_five_mean": 0.9522520766632381, + "final_five_over_first_five": 0.9997526075334168, + "first_five_mean": 0.9524877149484294 + } + }, + "explained_fraction": 1.0, + "named_positive_delta_ms": 2.5829935016000003, + "named_signed_delta_ms": 2.5754297604, + "passed": true, + "process": { + "delta_ms": 2.4588783428000003, + "final_five_mean_ms": 5.4005429092, + "final_five_over_first_five": 1.8358799201260285, + "first_five_mean_ms": 2.9416645664 + }, + "ranked_positive_contributors": [ + { + "delta_ms": 1.6266086872, + "final_five_mean_ms": 3.2598684956, + "final_five_over_first_five": 1.9959277016640018, + "first_five_mean_ms": 1.6332598084, + "fraction_of_process_delta": 0.6615246711830935, + "operation": "cortext::operations::GraphAugmentedRetrieveCandidates" + }, + { + "delta_ms": 0.5196894320000001, + "final_five_mean_ms": 0.8811147192000001, + "final_five_over_first_five": 2.4378889646213997, + "first_five_mean_ms": 0.3614252872, + "fraction_of_process_delta": 0.2113522344534597, + "operation": "cortext::operations::MemoryStorage" + }, + { + "delta_ms": 0.07463660999999999, + "final_five_mean_ms": 0.2042053312, + "final_five_over_first_five": 1.5760387947704773, + "first_five_mean_ms": 0.12956872120000001, + "fraction_of_process_delta": 0.030353925487427325, + "operation": "SignalProcessor.commit_transaction" + }, + { + "delta_ms": 0.07410627719999999, + "final_five_mean_ms": 0.2009685912, + "final_five_over_first_five": 1.5841472921580162, + "first_five_mean_ms": 0.126862314, + "fraction_of_process_delta": 0.03013824470698005, + "operation": "SignalProcessor.commit_sqlite" + }, + { + "delta_ms": 0.0632859244, + "final_five_mean_ms": 0.1761451396, + "final_five_over_first_five": 1.5607510586339786, + "first_five_mean_ms": 0.1128592152, + "fraction_of_process_delta": 0.02573772085362075, + "operation": "SignalProcessor.snapshot_context" + }, + { + "delta_ms": 0.05775551160000002, + "final_five_mean_ms": 0.12650634160000002, + "final_five_over_first_five": 1.8400700267909496, + "first_five_mean_ms": 0.06875083, + "fraction_of_process_delta": 0.023488560045728836, + "operation": "SignalProcessor.persist_working_memory" + }, + { + "delta_ms": 0.05018476320000001, + "final_five_mean_ms": 0.0801776792, + "final_five_over_first_five": 2.6732205431442546, + "first_five_mean_ms": 0.029992915999999998, + "fraction_of_process_delta": 0.02040961617598904, + "operation": "SignalProcessor.wm_update_slot_memory" + }, + { + "delta_ms": 0.0325471844, + "final_five_mean_ms": 0.0589661676, + "final_five_over_first_five": 2.231962038569297, + "first_five_mean_ms": 0.0264189832, + "fraction_of_process_delta": 0.01323659809982202, + "operation": "SignalProcessor.publish_rif_active_epoch" + }, + { + "delta_ms": 0.011090155199999993, + "final_five_mean_ms": 0.0641778168, + "final_five_over_first_five": 1.208902687851672, + "first_five_mean_ms": 0.0530876616, + "fraction_of_process_delta": 0.0045102496560977855, + "operation": "cortext::operations::ApplyPredictivePreActivation" + }, + { + "delta_ms": 0.010207319200000002, + "final_five_mean_ms": 0.0157262204, + "final_five_over_first_five": 2.849520190722023, + "first_five_mean_ms": 0.0055189012, + "fraction_of_process_delta": 0.004151209526038045, + "operation": "cortext::operations::UpdateStability" + }, + { + "delta_ms": 0.009346489599999994, + "final_five_mean_ms": 0.0669908484, + "final_five_over_first_five": 1.1621405770585134, + "first_five_mean_ms": 0.0576443588, + "fraction_of_process_delta": 0.0038011191677571406, + "operation": "cortext::operations::ApplyRetrievalCompetition" + }, + { + "delta_ms": 0.008713439199999992, + "final_five_mean_ms": 0.0947917024, + "final_five_over_first_five": 1.101226940182966, + "first_five_mean_ms": 0.0860782632, + "fraction_of_process_delta": 0.0035436642180831654, + "operation": "cortext::operations::UpdateMemoryStrength" + }, + { + "delta_ms": 0.006153832800000002, + "final_five_mean_ms": 0.0255948364, + "final_five_over_first_five": 1.3165388437045504, + "first_five_mean_ms": 0.0194410036, + "fraction_of_process_delta": 0.002502699175019958, + "operation": "SignalProcessor.profile_mutation_audit" + }, + { + "delta_ms": 0.0048687628000000024, + "final_five_mean_ms": 0.0331962644, + "final_five_over_first_five": 1.1718740631895332, + "first_five_mean_ms": 0.0283275016, + "fraction_of_process_delta": 0.0019800747012378795, + "operation": "SignalProcessor.wm_insert_signal_row" + }, + { + "delta_ms": 0.004714696799999998, + "final_five_mean_ms": 0.0253396108, + "final_five_over_first_five": 1.2285923131606753, + "first_five_mean_ms": 0.020624914, + "fraction_of_process_delta": 0.0019174176769686082, + "operation": "cortext::operations::ComputeMniGateDecision" + }, + { + "delta_ms": 0.003354657999999999, + "final_five_mean_ms": 0.0109250676, + "final_five_over_first_five": 1.4431276743599182, + "first_five_mean_ms": 0.0075704096, + "fraction_of_process_delta": 0.0013643041795146102, + "operation": "cortext::operations::PropagateEmotionalCascade" + }, + { + "delta_ms": 0.0028280584000000032, + "final_five_mean_ms": 0.0290866536, + "final_five_over_first_five": 1.1077002931215454, + "first_five_mean_ms": 0.0262585952, + "fraction_of_process_delta": 0.0011501416523029791, + "operation": "cortext::operations::ApplyMetaLearning" + }, + { + "delta_ms": 0.0021930644000000034, + "final_five_mean_ms": 0.0224639924, + "final_five_over_first_five": 1.1081876665932613, + "first_five_mean_ms": 0.020270927999999997, + "fraction_of_process_delta": 0.0008918962609198037, + "operation": "cortext::operations::ComputeCompositeScore" + }, + { + "delta_ms": 0.0021775775999999993, + "final_five_mean_ms": 0.008130924, + "final_five_over_first_five": 1.3657737100599419, + "first_five_mean_ms": 0.0059533464, + "fraction_of_process_delta": 0.0008855979419950988, + "operation": "cortext::operations::ApplySensitivityFeedback" + }, + { + "delta_ms": 0.0019505392000000003, + "final_five_mean_ms": 0.0146631756, + "final_five_over_first_five": 1.1534330990541033, + "first_five_mean_ms": 0.0127126364, + "fraction_of_process_delta": 0.0007932638089686297, + "operation": "SignalProcessor.persist_state" + }, + { + "delta_ms": 0.0014187868000000003, + "final_five_mean_ms": 0.0091839828, + "final_five_over_first_five": 1.182711009483856, + "first_five_mean_ms": 0.007765196, + "fraction_of_process_delta": 0.0005770056921093478, + "operation": "SignalProcessor.wm_insert_slot_embedding" + }, + { + "delta_ms": 0.0013253588000000007, + "final_five_mean_ms": 0.0123596308, + "final_five_over_first_five": 1.1201129354070662, + "first_five_mean_ms": 0.011034272, + "fraction_of_process_delta": 0.0005390095056475116, + "operation": "cortext::operations::ComputeCoherence" + }, + { + "delta_ms": 0.0010263452000000006, + "final_five_mean_ms": 0.0569330364, + "final_five_over_first_five": 1.0183581817841512, + "first_five_mean_ms": 0.0559066912, + "fraction_of_process_delta": 0.0004174038146317031, + "operation": "cortext::operations::ApplyReconsolidation" + }, + { + "delta_ms": 0.0009143948000000001, + "final_five_mean_ms": 0.0064888528, + "final_five_over_first_five": 1.164032951723737, + "first_five_mean_ms": 0.005574458, + "fraction_of_process_delta": 0.0003718747626036474, + "operation": "cortext::operations::UpdateSoftAnchor" + }, + { + "delta_ms": 0.0008888556000000002, + "final_five_mean_ms": 0.004438804, + "final_five_over_first_five": 1.2503854985610496, + "first_five_mean_ms": 0.0035499484, + "fraction_of_process_delta": 0.0003614882381646556, + "operation": "cortext::operations::DetectMemoryUsage" + }, + { + "delta_ms": 0.0008587739999999996, + "final_five_mean_ms": 0.00519123, + "final_five_over_first_five": 1.1982187470570964, + "first_five_mean_ms": 0.004332456, + "fraction_of_process_delta": 0.0003492543673478727, + "operation": "cortext::operations::WorkingMemory" + }, + { + "delta_ms": 0.0008230531999999999, + "final_five_mean_ms": 0.0055190104, + "final_five_over_first_five": 1.1752684628386305, + "first_five_mean_ms": 0.0046959572, + "fraction_of_process_delta": 0.0003347270931113916, + "operation": "SignalProcessor.start_new_episode" + }, + { + "delta_ms": 0.0007546059999999997, + "final_five_mean_ms": 0.010485372, + "final_five_over_first_five": 1.0775484684350647, + "first_five_mean_ms": 0.009730766, + "fraction_of_process_delta": 0.0003068903356726086, + "operation": "cortext::operations::ComputeFocusSpread" + }, + { + "delta_ms": 0.0007517956000000006, + "final_five_mean_ms": 0.0054085208, + "final_five_over_first_five": 1.1614429814325313, + "first_five_mean_ms": 0.0046567252, + "fraction_of_process_delta": 0.0003057473755061456, + "operation": "SignalProcessor.begin_transaction" + }, + { + "delta_ms": 0.0006894964000000001, + "final_five_mean_ms": 0.0017494796, + "final_five_over_first_five": 1.6504786113591237, + "first_five_mean_ms": 0.0010599831999999999, + "fraction_of_process_delta": 0.00028041094510387584, + "operation": "SignalProcessor.wm_close_stale" + }, + { + "delta_ms": 0.0006493820000000004, + "final_five_mean_ms": 0.012800358, + "final_five_over_first_five": 1.0534427851721542, + "first_five_mean_ms": 0.012150975999999999, + "fraction_of_process_delta": 0.00026409683988697433, + "operation": "cortext::operations::ComputeMetrics" + }, + { + "delta_ms": 0.0006187644000000001, + "final_five_mean_ms": 0.0050137952, + "final_five_over_first_five": 1.1407872727535835, + "first_five_mean_ms": 0.0043950308, + "fraction_of_process_delta": 0.00025164498349901853, + "operation": "cortext::operations::PersistSignalMetrics" + }, + { + "delta_ms": 0.0005369499999999996, + "final_five_mean_ms": 0.0043601388, + "final_five_over_first_five": 1.1404455882482183, + "first_five_mean_ms": 0.0038231888, + "fraction_of_process_delta": 0.00021837192619646165, + "operation": "cortext::operations::ApplyEmotionalConsolidation" + }, + { + "delta_ms": 0.0005082364000000006, + "final_five_mean_ms": 0.0094751524, + "final_five_over_first_five": 1.0566790633479783, + "first_five_mean_ms": 0.008966916, + "fraction_of_process_delta": 0.00020669440661356844, + "operation": "cortext::operations::UpdateUncertainty" + }, + { + "delta_ms": 0.0004488663999999997, + "final_five_mean_ms": 0.0034982912, + "final_five_over_first_five": 1.1471970713952349, + "first_five_mean_ms": 0.0030494248, + "fraction_of_process_delta": 0.00018254925109017868, + "operation": "cortext::operations::DetectBoundary" + }, + { + "delta_ms": 0.0004312176, + "final_five_mean_ms": 0.0034376788, + "final_five_over_first_five": 1.1434302894046995, + "first_five_mean_ms": 0.0030064612, + "fraction_of_process_delta": 0.0001753716694698117, + "operation": "cortext::operations::UpdateThreshold" + }, + { + "delta_ms": 0.00038970479999999967, + "final_five_mean_ms": 0.002565222, + "final_five_over_first_five": 1.1791320243296626, + "first_five_mean_ms": 0.0021755172, + "fraction_of_process_delta": 0.0001584888496582677, + "operation": "cortext::operations::ApplyInfluenceFeedback" + }, + { + "delta_ms": 0.0003307207999999999, + "final_five_mean_ms": 0.0013457468, + "final_five_over_first_five": 1.3258249542376253, + "first_five_mean_ms": 0.001015026, + "fraction_of_process_delta": 0.00013450067628128278, + "operation": "cortext::operations::InitializeEmbeddedCentroids" + }, + { + "delta_ms": 0.0003022483999999999, + "final_five_mean_ms": 0.0024488516, + "final_five_over_first_five": 1.1408031069738458, + "first_five_mean_ms": 0.0021466032, + "fraction_of_process_delta": 0.00012292125020541697, + "operation": "cortext::operations::UpdateNeuromodulators" + }, + { + "delta_ms": 0.00030087720000000024, + "final_five_mean_ms": 0.0023160172, + "final_five_over_first_five": 1.1493083358972578, + "first_five_mean_ms": 0.00201514, + "fraction_of_process_delta": 0.00012236359756513294, + "operation": "cortext::operations::ApplyStabilityFeedback" + }, + { + "delta_ms": 0.00028185679999999987, + "final_five_mean_ms": 0.0023471731999999998, + "final_five_over_first_five": 1.1364714868869485, + "first_five_mean_ms": 0.0020653164, + "fraction_of_process_delta": 0.00011462820062868214, + "operation": "cortext::operations::ComputeWriteGate" + }, + { + "delta_ms": 0.00026173160000000006, + "final_five_mean_ms": 0.001778064, + "final_five_over_first_five": 1.1726083278310218, + "first_five_mean_ms": 0.0015163324, + "fraction_of_process_delta": 0.0001064434931343363, + "operation": "SignalProcessor.finalize_episode" + }, + { + "delta_ms": 0.00023554160000000012, + "final_five_mean_ms": 0.0017706512, + "final_five_over_first_five": 1.153436340962235, + "first_five_mean_ms": 0.0015351096, + "fraction_of_process_delta": 9.579229516974869e-05, + "operation": "cortext::operations::UpdateEmbeddingPredictionError" + }, + { + "delta_ms": 0.00022675079999999996, + "final_five_mean_ms": 0.00066265, + "final_five_over_first_five": 1.5201909065215076, + "first_five_mean_ms": 0.0004358992, + "fraction_of_process_delta": 9.221716912671322e-05, + "operation": "SignalProcessor.wm_prune_select" + }, + { + "delta_ms": 0.00017492480000000019, + "final_five_mean_ms": 0.0044543452, + "final_five_over_first_five": 1.0408758157997284, + "first_five_mean_ms": 0.0042794204, + "fraction_of_process_delta": 7.114007917968318e-05, + "operation": "cortext::operations::UpdateFocus" + }, + { + "delta_ms": 0.0001631260000000001, + "final_five_mean_ms": 0.0009769124, + "final_five_over_first_five": 1.2004530918678415, + "first_five_mean_ms": 0.0008137864, + "fraction_of_process_delta": 6.634163112528923e-05, + "operation": "SignalProcessor.commit_mutation_audit_finalize" + }, + { + "delta_ms": 0.00015041000000000002, + "final_five_mean_ms": 0.0006591308, + "final_five_over_first_five": 1.295663161404055, + "first_five_mean_ms": 0.0005087208, + "fraction_of_process_delta": 6.117016746291056e-05, + "operation": "cortext::operations::UpdateRateState" + }, + { + "delta_ms": 0.00013627479999999987, + "final_five_mean_ms": 0.001861658, + "final_five_over_first_five": 1.0789823385321011, + "first_five_mean_ms": 0.0017253832, + "fraction_of_process_delta": 5.542153006432176e-05, + "operation": "cortext::operations::UpdateSensitivity" + }, + { + "delta_ms": 0.00012088759999999996, + "final_five_mean_ms": 0.0007492016, + "final_five_over_first_five": 1.1923999783547716, + "first_five_mean_ms": 0.000628314, + "fraction_of_process_delta": 4.9163717413664936e-05, + "operation": "cortext::operations::CheckStreamingPacing" + }, + { + "delta_ms": 7.757079999999995e-05, + "final_five_mean_ms": 0.0006327084, + "final_five_over_first_five": 1.139732563602249, + "first_five_mean_ms": 0.0005551376, + "fraction_of_process_delta": 3.154722974690472e-05, + "operation": "cortext::operations::ApplyFocusFeedback" + }, + { + "delta_ms": 7.367320000000008e-05, + "final_five_mean_ms": 0.0008523352, + "final_five_over_first_five": 1.0946151218372029, + "first_five_mean_ms": 0.000778662, + "fraction_of_process_delta": 2.9962116757718947e-05, + "operation": "cortext::operations::FitMetricWeightsRLS" + }, + { + "delta_ms": 6.874880000000004e-05, + "final_five_mean_ms": 0.0007000564, + "final_five_over_first_five": 1.1088990533299456, + "first_five_mean_ms": 0.0006313076, + "fraction_of_process_delta": 2.7959414991517503e-05, + "operation": "cortext::operations::UpdateAccumulatorScores" + }, + { + "delta_ms": 6.184840000000001e-05, + "final_five_mean_ms": 0.0004582796, + "final_five_over_first_five": 1.1560129475177534, + "first_five_mean_ms": 0.0003964312, + "fraction_of_process_delta": 2.515309477636512e-05, + "operation": "cortext::operations::ResetAccumulatorAfterFlush" + }, + { + "delta_ms": 6.0321599999999995e-05, + "final_five_mean_ms": 0.0007373732, + "final_five_over_first_five": 1.0890945387323507, + "first_five_mean_ms": 0.0006770516, + "fraction_of_process_delta": 2.4532161250121035e-05, + "operation": "cortext::operations::CheckSpikeBypass" + }, + { + "delta_ms": 5.48468e-05, + "final_five_mean_ms": 0.0004115604, + "final_five_over_first_five": 1.1537558422218832, + "first_five_mean_ms": 0.0003567136, + "fraction_of_process_delta": 2.23056175839689e-05, + "operation": "cortext::operations::ApplySerialPositionEffects" + }, + { + "delta_ms": 5.4211600000000015e-05, + "final_five_mean_ms": 0.0002020736, + "final_five_over_first_five": 1.3666364583192439, + "first_five_mean_ms": 0.000147862, + "fraction_of_process_delta": 2.204728841454905e-05, + "operation": "cortext::operations::BuildGraphFromConsolidation" + }, + { + "delta_ms": 5.152720000000001e-05, + "final_five_mean_ms": 0.0003826244, + "final_five_over_first_five": 1.155625598766767, + "first_five_mean_ms": 0.0003310972, + "fraction_of_process_delta": 2.09555711248912e-05, + "operation": "cortext::operations::ConsolidationGate" + }, + { + "delta_ms": 4.885879999999999e-05, + "final_five_mean_ms": 0.0004505264, + "final_five_over_first_five": 1.121639883326412, + "first_five_mean_ms": 0.0004016676, + "fraction_of_process_delta": 1.987036086720865e-05, + "operation": "cortext::operations::ComputeEffectiveFocus" + }, + { + "delta_ms": 4.382919999999996e-05, + "final_five_mean_ms": 0.0007128923999999999, + "final_five_over_first_five": 1.065508310724607, + "first_five_mean_ms": 0.0006690632, + "fraction_of_process_delta": 1.7824875365769543e-05, + "operation": "cortext::operations::UpdateDriftAccumulation" + }, + { + "delta_ms": 3.4204800000000015e-05, + "final_five_mean_ms": 0.0001547576, + "final_five_over_first_five": 1.2837329369371762, + "first_five_mean_ms": 0.0001205528, + "fraction_of_process_delta": 1.391073295682045e-05, + "operation": "cortext::operations::InitializeSensitivityPriors" + }, + { + "delta_ms": 3.309879999999999e-05, + "final_five_mean_ms": 0.0001767568, + "final_five_over_first_five": 1.2303999777248742, + "first_five_mean_ms": 0.000143658, + "fraction_of_process_delta": 1.3460934371527046e-05, + "operation": "cortext::operations::ConsolidationCluster" + }, + { + "delta_ms": 3.241799999999999e-05, + "final_five_mean_ms": 0.00042883, + "final_five_over_first_five": 1.0817785536260254, + "first_five_mean_ms": 0.000396412, + "fraction_of_process_delta": 1.3184060160977551e-05, + "operation": "cortext::operations::UpdateRecentContext" + }, + { + "delta_ms": 2.9912400000000022e-05, + "final_five_mean_ms": 0.0003270308, + "final_five_over_first_five": 1.1006750170975612, + "first_five_mean_ms": 0.0002971184, + "fraction_of_process_delta": 1.216505895364382e-05, + "operation": "cortext::operations::UpdatePrecisionDelta" + }, + { + "delta_ms": 2.796640000000001e-05, + "final_five_mean_ms": 0.0001760848, + "final_five_over_first_five": 1.188811113271545, + "first_five_mean_ms": 0.00014811839999999998, + "fraction_of_process_delta": 1.1373641189646582e-05, + "operation": "cortext::operations::InitializeStabilityPriors" + }, + { + "delta_ms": 2.48644e-05, + "final_five_mean_ms": 0.0001119808, + "final_five_over_first_five": 1.285415834446786, + "first_five_mean_ms": 8.71164e-05, + "fraction_of_process_delta": 1.0112090365433104e-05, + "operation": "cortext::operations::EvaluateConsolidation" + }, + { + "delta_ms": 2.284240000000005e-05, + "final_five_mean_ms": 0.00035712200000000003, + "final_five_over_first_five": 1.0683332156673637, + "first_five_mean_ms": 0.0003342796, + "fraction_of_process_delta": 9.289764199553163e-06, + "operation": "cortext::operations::ApplySerialPositionMultiplier" + }, + { + "delta_ms": 2.1413600000000008e-05, + "final_five_mean_ms": 0.0001304508, + "final_five_over_first_five": 1.196388021702685, + "first_five_mean_ms": 0.0001090372, + "fraction_of_process_delta": 8.708686244157849e-06, + "operation": "cortext::operations::ConsolidationShallow" + }, + { + "delta_ms": 1.977680000000005e-05, + "final_five_mean_ms": 0.00045301280000000003, + "final_five_over_first_five": 1.0456490227035613, + "first_five_mean_ms": 0.000433236, + "fraction_of_process_delta": 8.043016873083521e-06, + "operation": "cortext::operations::UpdateMood" + }, + { + "delta_ms": 1.1844799999999992e-05, + "final_five_mean_ms": 0.00011728159999999999, + "final_five_over_first_five": 1.1123402834683904, + "first_five_mean_ms": 0.0001054368, + "fraction_of_process_delta": 4.817155771322934e-06, + "operation": "cortext::operations::ResetAccumulatorOnInterrupt" + }, + { + "delta_ms": 6.6347999999999996e-06, + "final_five_mean_ms": 4.79408e-05, + "final_five_over_first_five": 1.160625574977001, + "first_five_mean_ms": 4.1306e-05, + "fraction_of_process_delta": 2.6983034843622027e-06, + "operation": "cortext::operations::InitializeFocusPriors" + }, + { + "delta_ms": 1.664e-07, + "final_five_mean_ms": 4.672e-07, + "final_five_over_first_five": 1.5531914893617023, + "first_five_mean_ms": 3.008e-07, + "fraction_of_process_delta": 6.767313254323726e-08, + "operation": "SignalProcessor.wm_prune_delete" + } + ], + "raw_explained_fraction": 1.047400237568191, + "residual_delta_ms": -0.11655141759999976, + "warmup_events": 3139, + "window_count": 25, + "window_size": 500, + "window_table": [ + { + "end_event_exclusive": 3639, + "mean_latency_ms": 7.261531992, + "mean_process_ms": 2.468867758, + "operation_ms": { + "SignalProcessor.begin_transaction": 0.004845318, + "SignalProcessor.commit_mutation_audit_finalize": 0.000814914, + "SignalProcessor.commit_sqlite": 0.11756248799999999, + "SignalProcessor.commit_transaction": 0.120279592, + "SignalProcessor.finalize_episode": 0.001656096, + "SignalProcessor.persist_state": 0.013004502, + "SignalProcessor.persist_working_memory": 0.068328162, + "SignalProcessor.profile_mutation_audit": 0.019666852, + "SignalProcessor.publish_rif_active_epoch": 0.02374008, + "SignalProcessor.snapshot_cache_entry_copy": 0.0, + "SignalProcessor.snapshot_context": 0.108510032, + "SignalProcessor.snapshot_full_cache_copy": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_backfill": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_backfill_rows": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_seal": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_centroid_source": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_derived_centroid": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_overlap_pair_valid": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_overlap_profiled": 0.0, + "SignalProcessor.start_new_episode": 0.0053951599999999995, + "SignalProcessor.wm_close_stale": 0.000989584, + "SignalProcessor.wm_insert_signal_row": 0.027539936, + "SignalProcessor.wm_insert_slot_embedding": 0.007524578, + "SignalProcessor.wm_insert_slot_memory": 0.0, + "SignalProcessor.wm_prune_delete": 1.66e-07, + "SignalProcessor.wm_prune_select": 0.000367746, + "SignalProcessor.wm_update_slot_memory": 0.030653014, + "cortext::operations::ApplyEmotionalConsolidation": 0.0038954280000000003, + "cortext::operations::ApplyFocusFeedback": 0.000566592, + "cortext::operations::ApplyInfluenceFeedback": 0.002115862, + "cortext::operations::ApplyMetaLearning": 0.026701738, + "cortext::operations::ApplyPredictivePreActivation": 0.0518725, + "cortext::operations::ApplyReconsolidation": 0.054501338, + "cortext::operations::ApplyRetrievalCompetition": 0.05627335, + "cortext::operations::ApplySensitivityFeedback": 0.005885502, + "cortext::operations::ApplySerialPositionEffects": 0.00036503, + "cortext::operations::ApplySerialPositionMultiplier": 0.000341874, + "cortext::operations::ApplyStabilityFeedback": 0.00195109, + "cortext::operations::ApplySynapticTagging": 0.046555592, + "cortext::operations::BuildGraphFromConsolidation": 0.000156836, + "cortext::operations::CheckSpikeBypass": 0.000715322, + "cortext::operations::CheckStreamingPacing": 0.000654882, + "cortext::operations::ComputeCoherence": 0.011228814, + "cortext::operations::ComputeCompositeScore": 0.020387594, + "cortext::operations::ComputeEffectiveFocus": 0.000425376, + "cortext::operations::ComputeFocusSpread": 0.009987756, + "cortext::operations::ComputeMetrics": 0.012264748, + "cortext::operations::ComputeMniGateDecision": 0.020456166, + "cortext::operations::ComputeWriteGate": 0.002146908, + "cortext::operations::ConsolidationCluster": 0.00014917, + "cortext::operations::ConsolidationGate": 0.000345096, + "cortext::operations::ConsolidationShallow": 0.000114682, + "cortext::operations::DetectBoundary": 0.003207348, + "cortext::operations::DetectMemoryUsage": 0.00358719, + "cortext::operations::EvaluateConsolidation": 9.060599999999999e-05, + "cortext::operations::FitMetricWeightsRLS": 0.00078108, + "cortext::operations::GraphAugmentedRetrieveCandidates": 1.22519666, + "cortext::operations::InitializeEmbeddedCentroids": 0.00106992, + "cortext::operations::InitializeFocusPriors": 4.3082e-05, + "cortext::operations::InitializeSensitivityPriors": 0.0001275, + "cortext::operations::InitializeStabilityPriors": 0.000136316, + "cortext::operations::MemoryStorage": 0.305259506, + "cortext::operations::PersistSignalMetrics": 0.00440633, + "cortext::operations::PropagateEmotionalCascade": 0.00780383, + "cortext::operations::ResetAccumulatorAfterFlush": 0.000439682, + "cortext::operations::ResetAccumulatorOnInterrupt": 8.2762e-05, + "cortext::operations::UpdateAccumulator": 0.004161906, + "cortext::operations::UpdateAccumulatorScores": 0.0006377479999999999, + "cortext::operations::UpdateDriftAccumulation": 0.000977588, + "cortext::operations::UpdateEmbeddingPredictionError": 0.001705372, + "cortext::operations::UpdateFocus": 0.004359492, + "cortext::operations::UpdateMemoryStrength": 0.08289716, + "cortext::operations::UpdateMood": 0.000429336, + "cortext::operations::UpdateNeuromodulators": 0.00215267, + "cortext::operations::UpdatePrecisionDelta": 0.000307322, + "cortext::operations::UpdateRateState": 0.00049665, + "cortext::operations::UpdateRecentContext": 0.00034502000000000003, + "cortext::operations::UpdateSensitivity": 0.001773688, + "cortext::operations::UpdateSoftAnchor": 0.005786404, + "cortext::operations::UpdateStability": 0.004533514, + "cortext::operations::UpdateThreshold": 0.003116908, + "cortext::operations::UpdateUncertainty": 0.00902308, + "cortext::operations::WorkingMemory": 0.004244762 + }, + "start_event": 3139 + }, + { + "end_event_exclusive": 4139, + "mean_latency_ms": 7.490978514, + "mean_process_ms": 2.706930594, + "operation_ms": { + "SignalProcessor.begin_transaction": 0.004780678, + "SignalProcessor.commit_mutation_audit_finalize": 0.000823164, + "SignalProcessor.commit_sqlite": 0.120249416, + "SignalProcessor.commit_transaction": 0.122970724, + "SignalProcessor.finalize_episode": 0.001455652, + "SignalProcessor.persist_state": 0.012636266, + "SignalProcessor.persist_working_memory": 0.069329926, + "SignalProcessor.profile_mutation_audit": 0.01950884, + "SignalProcessor.publish_rif_active_epoch": 0.025666516, + "SignalProcessor.snapshot_cache_entry_copy": 0.0, + "SignalProcessor.snapshot_context": 0.103346188, + "SignalProcessor.snapshot_full_cache_copy": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_backfill": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_backfill_rows": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_seal": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_centroid_source": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_derived_centroid": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_overlap_pair_valid": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_overlap_profiled": 0.0, + "SignalProcessor.start_new_episode": 0.004633832, + "SignalProcessor.wm_close_stale": 0.001042418, + "SignalProcessor.wm_insert_signal_row": 0.028393338, + "SignalProcessor.wm_insert_slot_embedding": 0.00814974, + "SignalProcessor.wm_insert_slot_memory": 0.0, + "SignalProcessor.wm_prune_delete": 4.98e-07, + "SignalProcessor.wm_prune_select": 0.000584582, + "SignalProcessor.wm_update_slot_memory": 0.030036966, + "cortext::operations::ApplyEmotionalConsolidation": 0.003840834, + "cortext::operations::ApplyFocusFeedback": 0.000548424, + "cortext::operations::ApplyInfluenceFeedback": 0.00229409, + "cortext::operations::ApplyMetaLearning": 0.026518826, + "cortext::operations::ApplyPredictivePreActivation": 0.053849824, + "cortext::operations::ApplyReconsolidation": 0.06112614, + "cortext::operations::ApplyRetrievalCompetition": 0.059304294, + "cortext::operations::ApplySensitivityFeedback": 0.005736504, + "cortext::operations::ApplySerialPositionEffects": 0.000340244, + "cortext::operations::ApplySerialPositionMultiplier": 0.000324332, + "cortext::operations::ApplyStabilityFeedback": 0.002164526, + "cortext::operations::ApplySynapticTagging": 0.045499916, + "cortext::operations::BuildGraphFromConsolidation": 0.000135938, + "cortext::operations::CheckSpikeBypass": 0.00064573, + "cortext::operations::CheckStreamingPacing": 0.000615848, + "cortext::operations::ComputeCoherence": 0.011168794, + "cortext::operations::ComputeCompositeScore": 0.020662418, + "cortext::operations::ComputeEffectiveFocus": 0.000395656, + "cortext::operations::ComputeFocusSpread": 0.009794908, + "cortext::operations::ComputeMetrics": 0.012567898, + "cortext::operations::ComputeMniGateDecision": 0.020453124, + "cortext::operations::ComputeWriteGate": 0.002032482, + "cortext::operations::ConsolidationCluster": 0.000138232, + "cortext::operations::ConsolidationGate": 0.000332394, + "cortext::operations::ConsolidationShallow": 0.000104076, + "cortext::operations::DetectBoundary": 0.003009084, + "cortext::operations::DetectMemoryUsage": 0.00347969, + "cortext::operations::EvaluateConsolidation": 7.6246e-05, + "cortext::operations::FitMetricWeightsRLS": 0.000758252, + "cortext::operations::GraphAugmentedRetrieveCandidates": 1.422938408, + "cortext::operations::InitializeEmbeddedCentroids": 0.001010162, + "cortext::operations::InitializeFocusPriors": 3.9656e-05, + "cortext::operations::InitializeSensitivityPriors": 0.000112784, + "cortext::operations::InitializeStabilityPriors": 0.000186182, + "cortext::operations::MemoryStorage": 0.328706358, + "cortext::operations::PersistSignalMetrics": 0.004425182, + "cortext::operations::PropagateEmotionalCascade": 0.009937116, + "cortext::operations::ResetAccumulatorAfterFlush": 0.000374414, + "cortext::operations::ResetAccumulatorOnInterrupt": 0.000144244, + "cortext::operations::UpdateAccumulator": 0.001976012, + "cortext::operations::UpdateAccumulatorScores": 0.000625196, + "cortext::operations::UpdateDriftAccumulation": 0.000590656, + "cortext::operations::UpdateEmbeddingPredictionError": 0.00156842, + "cortext::operations::UpdateFocus": 0.004341942, + "cortext::operations::UpdateMemoryStrength": 0.09236018, + "cortext::operations::UpdateMood": 0.000435646, + "cortext::operations::UpdateNeuromodulators": 0.002144672, + "cortext::operations::UpdatePrecisionDelta": 0.000287342, + "cortext::operations::UpdateRateState": 0.000486938, + "cortext::operations::UpdateRecentContext": 0.000366836, + "cortext::operations::UpdateSensitivity": 0.001728518, + "cortext::operations::UpdateSoftAnchor": 0.005583078, + "cortext::operations::UpdateStability": 0.00514634, + "cortext::operations::UpdateThreshold": 0.002928912, + "cortext::operations::UpdateUncertainty": 0.009119056, + "cortext::operations::WorkingMemory": 0.004471088 + }, + "start_event": 3639 + }, + { + "end_event_exclusive": 4639, + "mean_latency_ms": 7.638454566, + "mean_process_ms": 2.886059124, + "operation_ms": { + "SignalProcessor.begin_transaction": 0.004464238, + "SignalProcessor.commit_mutation_audit_finalize": 0.000753172, + "SignalProcessor.commit_sqlite": 0.116342076, + "SignalProcessor.commit_transaction": 0.118848846, + "SignalProcessor.finalize_episode": 0.001393664, + "SignalProcessor.persist_state": 0.012338076, + "SignalProcessor.persist_working_memory": 0.06732706, + "SignalProcessor.profile_mutation_audit": 0.01905491, + "SignalProcessor.publish_rif_active_epoch": 0.025646824, + "SignalProcessor.snapshot_cache_entry_copy": 0.0, + "SignalProcessor.snapshot_context": 0.105108068, + "SignalProcessor.snapshot_full_cache_copy": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_backfill": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_backfill_rows": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_seal": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_centroid_source": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_derived_centroid": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_overlap_pair_valid": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_overlap_profiled": 0.0, + "SignalProcessor.start_new_episode": 0.004264482, + "SignalProcessor.wm_close_stale": 0.000979418, + "SignalProcessor.wm_insert_signal_row": 0.027639918, + "SignalProcessor.wm_insert_slot_embedding": 0.008511996, + "SignalProcessor.wm_insert_slot_memory": 0.0, + "SignalProcessor.wm_prune_delete": 3.36e-07, + "SignalProcessor.wm_prune_select": 0.000526584, + "SignalProcessor.wm_update_slot_memory": 0.028573828, + "cortext::operations::ApplyEmotionalConsolidation": 0.003580932, + "cortext::operations::ApplyFocusFeedback": 0.000536154, + "cortext::operations::ApplyInfluenceFeedback": 0.00221718, + "cortext::operations::ApplyMetaLearning": 0.02481248, + "cortext::operations::ApplyPredictivePreActivation": 0.052252156, + "cortext::operations::ApplyReconsolidation": 0.056666008, + "cortext::operations::ApplyRetrievalCompetition": 0.056185082, + "cortext::operations::ApplySensitivityFeedback": 0.005957094, + "cortext::operations::ApplySerialPositionEffects": 0.00034224, + "cortext::operations::ApplySerialPositionMultiplier": 0.000340144, + "cortext::operations::ApplyStabilityFeedback": 0.002037748, + "cortext::operations::ApplySynapticTagging": 0.041008652, + "cortext::operations::BuildGraphFromConsolidation": 0.000133514, + "cortext::operations::CheckSpikeBypass": 0.000649352, + "cortext::operations::CheckStreamingPacing": 0.000599196, + "cortext::operations::ComputeCoherence": 0.01078084, + "cortext::operations::ComputeCompositeScore": 0.019818726, + "cortext::operations::ComputeEffectiveFocus": 0.000386448, + "cortext::operations::ComputeFocusSpread": 0.009517174, + "cortext::operations::ComputeMetrics": 0.011894318, + "cortext::operations::ComputeMniGateDecision": 0.02014842, + "cortext::operations::ComputeWriteGate": 0.001959494, + "cortext::operations::ConsolidationCluster": 0.000137176, + "cortext::operations::ConsolidationGate": 0.000311406, + "cortext::operations::ConsolidationShallow": 0.000102178, + "cortext::operations::DetectBoundary": 0.002908418, + "cortext::operations::DetectMemoryUsage": 0.003572518, + "cortext::operations::EvaluateConsolidation": 8.4826e-05, + "cortext::operations::FitMetricWeightsRLS": 0.000787234, + "cortext::operations::GraphAugmentedRetrieveCandidates": 1.627211892, + "cortext::operations::InitializeEmbeddedCentroids": 0.000972264, + "cortext::operations::InitializeFocusPriors": 3.5759999999999996e-05, + "cortext::operations::InitializeSensitivityPriors": 0.000110222, + "cortext::operations::InitializeStabilityPriors": 0.000133338, + "cortext::operations::MemoryStorage": 0.340943274, + "cortext::operations::PersistSignalMetrics": 0.004335826, + "cortext::operations::PropagateEmotionalCascade": 0.008253266, + "cortext::operations::ResetAccumulatorAfterFlush": 0.000329562, + "cortext::operations::ResetAccumulatorOnInterrupt": 0.000108172, + "cortext::operations::UpdateAccumulator": 0.002001606, + "cortext::operations::UpdateAccumulatorScores": 0.000594344, + "cortext::operations::UpdateDriftAccumulation": 0.000593826, + "cortext::operations::UpdateEmbeddingPredictionError": 0.001439918, + "cortext::operations::UpdateFocus": 0.004276252, + "cortext::operations::UpdateMemoryStrength": 0.084877568, + "cortext::operations::UpdateMood": 0.00041717, + "cortext::operations::UpdateNeuromodulators": 0.002121242, + "cortext::operations::UpdatePrecisionDelta": 0.000298168, + "cortext::operations::UpdateRateState": 0.000501642, + "cortext::operations::UpdateRecentContext": 0.000342144, + "cortext::operations::UpdateSensitivity": 0.001715026, + "cortext::operations::UpdateSoftAnchor": 0.005278812, + "cortext::operations::UpdateStability": 0.005399062, + "cortext::operations::UpdateThreshold": 0.002928076, + "cortext::operations::UpdateUncertainty": 0.008762256, + "cortext::operations::WorkingMemory": 0.00401009 + }, + "start_event": 4139 + }, + { + "end_event_exclusive": 5139, + "mean_latency_ms": 6.635060418, + "mean_process_ms": 3.294895576, + "operation_ms": { + "SignalProcessor.begin_transaction": 0.003948112, + "SignalProcessor.commit_mutation_audit_finalize": 0.000807252, + "SignalProcessor.commit_sqlite": 0.136984336, + "SignalProcessor.commit_transaction": 0.139654454, + "SignalProcessor.finalize_episode": 0.001608908, + "SignalProcessor.persist_state": 0.012286184, + "SignalProcessor.persist_working_memory": 0.068192096, + "SignalProcessor.profile_mutation_audit": 0.019300424, + "SignalProcessor.publish_rif_active_epoch": 0.028059992, + "SignalProcessor.snapshot_cache_entry_copy": 0.0, + "SignalProcessor.snapshot_context": 0.10734848, + "SignalProcessor.snapshot_full_cache_copy": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_backfill": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_backfill_rows": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_seal": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_centroid_source": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_derived_centroid": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_overlap_pair_valid": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_overlap_profiled": 0.0, + "SignalProcessor.start_new_episode": 0.004244172, + "SignalProcessor.wm_close_stale": 0.001288586, + "SignalProcessor.wm_insert_signal_row": 0.029374252, + "SignalProcessor.wm_insert_slot_embedding": 0.007469252, + "SignalProcessor.wm_insert_slot_memory": 0.0, + "SignalProcessor.wm_prune_delete": 4.2e-07, + "SignalProcessor.wm_prune_select": 0.0003705, + "SignalProcessor.wm_update_slot_memory": 0.028559672, + "cortext::operations::ApplyEmotionalConsolidation": 0.00408591, + "cortext::operations::ApplyFocusFeedback": 0.00054891, + "cortext::operations::ApplyInfluenceFeedback": 0.001872824, + "cortext::operations::ApplyMetaLearning": 0.024855908, + "cortext::operations::ApplyPredictivePreActivation": 0.052916568, + "cortext::operations::ApplyReconsolidation": 0.057963662, + "cortext::operations::ApplyRetrievalCompetition": 0.057555498000000004, + "cortext::operations::ApplySensitivityFeedback": 0.005234106, + "cortext::operations::ApplySerialPositionEffects": 0.00033997, + "cortext::operations::ApplySerialPositionMultiplier": 0.000319616, + "cortext::operations::ApplyStabilityFeedback": 0.001720548, + "cortext::operations::ApplySynapticTagging": 0.024889012, + "cortext::operations::BuildGraphFromConsolidation": 0.000144654, + "cortext::operations::CheckSpikeBypass": 0.000664118, + "cortext::operations::CheckStreamingPacing": 0.000607656, + "cortext::operations::ComputeCoherence": 0.01064501, + "cortext::operations::ComputeCompositeScore": 0.019433726, + "cortext::operations::ComputeEffectiveFocus": 0.00036218, + "cortext::operations::ComputeFocusSpread": 0.009518594, + "cortext::operations::ComputeMetrics": 0.011813668, + "cortext::operations::ComputeMniGateDecision": 0.02108864, + "cortext::operations::ComputeWriteGate": 0.001975622, + "cortext::operations::ConsolidationCluster": 0.000130888, + "cortext::operations::ConsolidationGate": 0.000315906, + "cortext::operations::ConsolidationShallow": 0.000104736, + "cortext::operations::DetectBoundary": 0.00288918, + "cortext::operations::DetectMemoryUsage": 0.00312693, + "cortext::operations::EvaluateConsolidation": 7.818e-05, + "cortext::operations::FitMetricWeightsRLS": 0.00076631, + "cortext::operations::GraphAugmentedRetrieveCandidates": 1.918450588, + "cortext::operations::InitializeEmbeddedCentroids": 0.00086801, + "cortext::operations::InitializeFocusPriors": 4.2522e-05, + "cortext::operations::InitializeSensitivityPriors": 0.000116672, + "cortext::operations::InitializeStabilityPriors": 0.000127758, + "cortext::operations::MemoryStorage": 0.447921456, + "cortext::operations::PersistSignalMetrics": 0.00445532, + "cortext::operations::PropagateEmotionalCascade": 0.005175008, + "cortext::operations::ResetAccumulatorAfterFlush": 0.000403742, + "cortext::operations::ResetAccumulatorOnInterrupt": 8.0512e-05, + "cortext::operations::UpdateAccumulator": 0.001880216, + "cortext::operations::UpdateAccumulatorScores": 0.00062916, + "cortext::operations::UpdateDriftAccumulation": 0.00053525, + "cortext::operations::UpdateEmbeddingPredictionError": 0.0013564199999999999, + "cortext::operations::UpdateFocus": 0.00418709, + "cortext::operations::UpdateMemoryStrength": 0.08551349, + "cortext::operations::UpdateMood": 0.00044409, + "cortext::operations::UpdateNeuromodulators": 0.002034602, + "cortext::operations::UpdatePrecisionDelta": 0.000290736, + "cortext::operations::UpdateRateState": 0.000525158, + "cortext::operations::UpdateRecentContext": 0.000552258, + "cortext::operations::UpdateSensitivity": 0.00164784, + "cortext::operations::UpdateSoftAnchor": 0.005718578, + "cortext::operations::UpdateStability": 0.005913428, + "cortext::operations::UpdateThreshold": 0.002802832, + "cortext::operations::UpdateUncertainty": 0.00891659, + "cortext::operations::WorkingMemory": 0.004823476 + }, + "start_event": 4639 + }, + { + "end_event_exclusive": 5639, + "mean_latency_ms": 8.819288986, + "mean_process_ms": 3.35156978, + "operation_ms": { + "SignalProcessor.begin_transaction": 0.00524528, + "SignalProcessor.commit_mutation_audit_finalize": 0.0008704299999999999, + "SignalProcessor.commit_sqlite": 0.143173254, + "SignalProcessor.commit_transaction": 0.14608999, + "SignalProcessor.finalize_episode": 0.001467342, + "SignalProcessor.persist_state": 0.013298154, + "SignalProcessor.persist_working_memory": 0.070576906, + "SignalProcessor.profile_mutation_audit": 0.019673992, + "SignalProcessor.publish_rif_active_epoch": 0.028981504, + "SignalProcessor.snapshot_cache_entry_copy": 0.0, + "SignalProcessor.snapshot_context": 0.139983308, + "SignalProcessor.snapshot_full_cache_copy": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_backfill": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_backfill_rows": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_seal": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_centroid_source": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_derived_centroid": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_overlap_pair_valid": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_overlap_profiled": 0.0, + "SignalProcessor.start_new_episode": 0.00494214, + "SignalProcessor.wm_close_stale": 0.00099991, + "SignalProcessor.wm_insert_signal_row": 0.028690064, + "SignalProcessor.wm_insert_slot_embedding": 0.007170414, + "SignalProcessor.wm_insert_slot_memory": 0.0, + "SignalProcessor.wm_prune_delete": 8.4e-08, + "SignalProcessor.wm_prune_select": 0.000330084, + "SignalProcessor.wm_update_slot_memory": 0.0321411, + "cortext::operations::ApplyEmotionalConsolidation": 0.00371284, + "cortext::operations::ApplyFocusFeedback": 0.000575608, + "cortext::operations::ApplyInfluenceFeedback": 0.00237763, + "cortext::operations::ApplyMetaLearning": 0.028404024, + "cortext::operations::ApplyPredictivePreActivation": 0.05454726, + "cortext::operations::ApplyReconsolidation": 0.049276308, + "cortext::operations::ApplyRetrievalCompetition": 0.05890357, + "cortext::operations::ApplySensitivityFeedback": 0.006953526, + "cortext::operations::ApplySerialPositionEffects": 0.000396084, + "cortext::operations::ApplySerialPositionMultiplier": 0.000345432, + "cortext::operations::ApplyStabilityFeedback": 0.002201788, + "cortext::operations::ApplySynapticTagging": 0.030209522, + "cortext::operations::BuildGraphFromConsolidation": 0.000168368, + "cortext::operations::CheckSpikeBypass": 0.000710736, + "cortext::operations::CheckStreamingPacing": 0.000663988, + "cortext::operations::ComputeCoherence": 0.011347902, + "cortext::operations::ComputeCompositeScore": 0.021052176, + "cortext::operations::ComputeEffectiveFocus": 0.000438678, + "cortext::operations::ComputeFocusSpread": 0.009835398, + "cortext::operations::ComputeMetrics": 0.012214248, + "cortext::operations::ComputeMniGateDecision": 0.02097822, + "cortext::operations::ComputeWriteGate": 0.002212076, + "cortext::operations::ConsolidationCluster": 0.000162824, + "cortext::operations::ConsolidationGate": 0.000350684, + "cortext::operations::ConsolidationShallow": 0.000119514, + "cortext::operations::DetectBoundary": 0.003233094, + "cortext::operations::DetectMemoryUsage": 0.003983414, + "cortext::operations::EvaluateConsolidation": 0.00010572399999999999, + "cortext::operations::FitMetricWeightsRLS": 0.000800434, + "cortext::operations::GraphAugmentedRetrieveCandidates": 1.972501494, + "cortext::operations::InitializeEmbeddedCentroids": 0.001154774, + "cortext::operations::InitializeFocusPriors": 4.5509999999999996e-05, + "cortext::operations::InitializeSensitivityPriors": 0.00013558599999999999, + "cortext::operations::InitializeStabilityPriors": 0.000156998, + "cortext::operations::MemoryStorage": 0.384295842, + "cortext::operations::PersistSignalMetrics": 0.004352496, + "cortext::operations::PropagateEmotionalCascade": 0.006682828, + "cortext::operations::ResetAccumulatorAfterFlush": 0.000434756, + "cortext::operations::ResetAccumulatorOnInterrupt": 0.000111494, + "cortext::operations::UpdateAccumulator": 0.002264644, + "cortext::operations::UpdateAccumulatorScores": 0.00067009, + "cortext::operations::UpdateDriftAccumulation": 0.000647996, + "cortext::operations::UpdateEmbeddingPredictionError": 0.001605418, + "cortext::operations::UpdateFocus": 0.004232326, + "cortext::operations::UpdateMemoryStrength": 0.084742918, + "cortext::operations::UpdateMood": 0.000439938, + "cortext::operations::UpdateNeuromodulators": 0.00227983, + "cortext::operations::UpdatePrecisionDelta": 0.000302024, + "cortext::operations::UpdateRateState": 0.000533216, + "cortext::operations::UpdateRecentContext": 0.000375802, + "cortext::operations::UpdateSensitivity": 0.001761844, + "cortext::operations::UpdateSoftAnchor": 0.005505418, + "cortext::operations::UpdateStability": 0.006602162, + "cortext::operations::UpdateThreshold": 0.003255578, + "cortext::operations::UpdateUncertainty": 0.009013598, + "cortext::operations::WorkingMemory": 0.004112864 + }, + "start_event": 5139 + }, + { + "end_event_exclusive": 6139, + "mean_latency_ms": 9.357836858, + "mean_process_ms": 3.62368033, + "operation_ms": { + "SignalProcessor.begin_transaction": 0.005365652, + "SignalProcessor.commit_mutation_audit_finalize": 0.000884602, + "SignalProcessor.commit_sqlite": 0.148305204, + "SignalProcessor.commit_transaction": 0.151144826, + "SignalProcessor.finalize_episode": 0.00155334, + "SignalProcessor.persist_state": 0.01329064, + "SignalProcessor.persist_working_memory": 0.071664312, + "SignalProcessor.profile_mutation_audit": 0.020505584, + "SignalProcessor.publish_rif_active_epoch": 0.031526524, + "SignalProcessor.snapshot_cache_entry_copy": 0.0, + "SignalProcessor.snapshot_context": 0.165028008, + "SignalProcessor.snapshot_full_cache_copy": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_backfill": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_backfill_rows": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_seal": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_centroid_source": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_derived_centroid": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_overlap_pair_valid": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_overlap_profiled": 0.0, + "SignalProcessor.start_new_episode": 0.005397726, + "SignalProcessor.wm_close_stale": 0.000978912, + "SignalProcessor.wm_insert_signal_row": 0.029076238, + "SignalProcessor.wm_insert_slot_embedding": 0.008133504, + "SignalProcessor.wm_insert_slot_memory": 0.0, + "SignalProcessor.wm_prune_delete": 5.8e-07, + "SignalProcessor.wm_prune_select": 0.000547248, + "SignalProcessor.wm_update_slot_memory": 0.031681328, + "cortext::operations::ApplyEmotionalConsolidation": 0.00397016, + "cortext::operations::ApplyFocusFeedback": 0.000583166, + "cortext::operations::ApplyInfluenceFeedback": 0.00210267, + "cortext::operations::ApplyMetaLearning": 0.027507754, + "cortext::operations::ApplyPredictivePreActivation": 0.056668804, + "cortext::operations::ApplyReconsolidation": 0.050118972, + "cortext::operations::ApplyRetrievalCompetition": 0.061388178, + "cortext::operations::ApplySensitivityFeedback": 0.006284252, + "cortext::operations::ApplySerialPositionEffects": 0.0003742, + "cortext::operations::ApplySerialPositionMultiplier": 0.00033818, + "cortext::operations::ApplyStabilityFeedback": 0.00189008, + "cortext::operations::ApplySynapticTagging": 0.020433272, + "cortext::operations::BuildGraphFromConsolidation": 0.000171978, + "cortext::operations::CheckSpikeBypass": 0.000705004, + "cortext::operations::CheckStreamingPacing": 0.0006457219999999999, + "cortext::operations::ComputeCoherence": 0.017613814, + "cortext::operations::ComputeCompositeScore": 0.020948434, + "cortext::operations::ComputeEffectiveFocus": 0.000454994, + "cortext::operations::ComputeFocusSpread": 0.009855434, + "cortext::operations::ComputeMetrics": 0.012269114, + "cortext::operations::ComputeMniGateDecision": 0.021818002, + "cortext::operations::ComputeWriteGate": 0.002216742, + "cortext::operations::ConsolidationCluster": 0.00018156, + "cortext::operations::ConsolidationGate": 0.000357926, + "cortext::operations::ConsolidationShallow": 0.000129316, + "cortext::operations::DetectBoundary": 0.003205484, + "cortext::operations::DetectMemoryUsage": 0.003651998, + "cortext::operations::EvaluateConsolidation": 0.00010698, + "cortext::operations::FitMetricWeightsRLS": 0.000827488, + "cortext::operations::GraphAugmentedRetrieveCandidates": 2.169218164, + "cortext::operations::InitializeEmbeddedCentroids": 0.001136264, + "cortext::operations::InitializeFocusPriors": 4.4908e-05, + "cortext::operations::InitializeSensitivityPriors": 0.000139082, + "cortext::operations::InitializeStabilityPriors": 0.000175482, + "cortext::operations::MemoryStorage": 0.421805194, + "cortext::operations::PersistSignalMetrics": 0.004498402, + "cortext::operations::PropagateEmotionalCascade": 0.00578008, + "cortext::operations::ResetAccumulatorAfterFlush": 0.00046025, + "cortext::operations::ResetAccumulatorOnInterrupt": 8.8424e-05, + "cortext::operations::UpdateAccumulator": 0.002176428, + "cortext::operations::UpdateAccumulatorScores": 0.000661972, + "cortext::operations::UpdateDriftAccumulation": 0.000676416, + "cortext::operations::UpdateEmbeddingPredictionError": 0.00156299, + "cortext::operations::UpdateFocus": 0.004372436, + "cortext::operations::UpdateMemoryStrength": 0.088001818, + "cortext::operations::UpdateMood": 0.000467576, + "cortext::operations::UpdateNeuromodulators": 0.00231794, + "cortext::operations::UpdatePrecisionDelta": 0.000345674, + "cortext::operations::UpdateRateState": 0.000537922, + "cortext::operations::UpdateRecentContext": 0.000374938, + "cortext::operations::UpdateSensitivity": 0.001807886, + "cortext::operations::UpdateSoftAnchor": 0.005479932, + "cortext::operations::UpdateStability": 0.0053421, + "cortext::operations::UpdateThreshold": 0.00321942, + "cortext::operations::UpdateUncertainty": 0.00922031, + "cortext::operations::WorkingMemory": 0.004544806 + }, + "start_event": 5639 + }, + { + "end_event_exclusive": 6639, + "mean_latency_ms": 9.953264658, + "mean_process_ms": 3.85741337, + "operation_ms": { + "SignalProcessor.begin_transaction": 0.005744264, + "SignalProcessor.commit_mutation_audit_finalize": 0.00093593, + "SignalProcessor.commit_sqlite": 0.15147516, + "SignalProcessor.commit_transaction": 0.154542944, + "SignalProcessor.finalize_episode": 0.001700748, + "SignalProcessor.persist_state": 0.014441152, + "SignalProcessor.persist_working_memory": 0.079559712, + "SignalProcessor.profile_mutation_audit": 0.021864264, + "SignalProcessor.publish_rif_active_epoch": 0.035867336, + "SignalProcessor.snapshot_cache_entry_copy": 0.0, + "SignalProcessor.snapshot_context": 0.16806649, + "SignalProcessor.snapshot_full_cache_copy": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_backfill": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_backfill_rows": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_seal": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_centroid_source": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_derived_centroid": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_overlap_pair_valid": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_overlap_profiled": 0.0, + "SignalProcessor.start_new_episode": 0.005342666, + "SignalProcessor.wm_close_stale": 0.001144326, + "SignalProcessor.wm_insert_signal_row": 0.030810175999999998, + "SignalProcessor.wm_insert_slot_embedding": 0.010779346, + "SignalProcessor.wm_insert_slot_memory": 0.0, + "SignalProcessor.wm_prune_delete": 2.52e-07, + "SignalProcessor.wm_prune_select": 0.000415414, + "SignalProcessor.wm_update_slot_memory": 0.034800812, + "cortext::operations::ApplyEmotionalConsolidation": 0.004147516, + "cortext::operations::ApplyFocusFeedback": 0.000637832, + "cortext::operations::ApplyInfluenceFeedback": 0.002229834, + "cortext::operations::ApplyMetaLearning": 0.030032188, + "cortext::operations::ApplyPredictivePreActivation": 0.061219812, + "cortext::operations::ApplyReconsolidation": 0.053850968, + "cortext::operations::ApplyRetrievalCompetition": 0.067370828, + "cortext::operations::ApplySensitivityFeedback": 0.0073918000000000005, + "cortext::operations::ApplySerialPositionEffects": 0.000406666, + "cortext::operations::ApplySerialPositionMultiplier": 0.00035458800000000003, + "cortext::operations::ApplyStabilityFeedback": 0.002090074, + "cortext::operations::ApplySynapticTagging": 0.019014984, + "cortext::operations::BuildGraphFromConsolidation": 0.000201598, + "cortext::operations::CheckSpikeBypass": 0.000749972, + "cortext::operations::CheckStreamingPacing": 0.000724908, + "cortext::operations::ComputeCoherence": 0.012081932, + "cortext::operations::ComputeCompositeScore": 0.022174168, + "cortext::operations::ComputeEffectiveFocus": 0.000451844, + "cortext::operations::ComputeFocusSpread": 0.009918172, + "cortext::operations::ComputeMetrics": 0.013071346, + "cortext::operations::ComputeMniGateDecision": 0.023006756, + "cortext::operations::ComputeWriteGate": 0.00248606, + "cortext::operations::ConsolidationCluster": 0.000196458, + "cortext::operations::ConsolidationGate": 0.000398976, + "cortext::operations::ConsolidationShallow": 0.000133512, + "cortext::operations::DetectBoundary": 0.003535412, + "cortext::operations::DetectMemoryUsage": 0.004299714, + "cortext::operations::EvaluateConsolidation": 0.000118078, + "cortext::operations::FitMetricWeightsRLS": 0.000846818, + "cortext::operations::GraphAugmentedRetrieveCandidates": 2.27852616, + "cortext::operations::InitializeEmbeddedCentroids": 0.001336502, + "cortext::operations::InitializeFocusPriors": 6.1398e-05, + "cortext::operations::InitializeSensitivityPriors": 0.000156488, + "cortext::operations::InitializeStabilityPriors": 0.000177332, + "cortext::operations::MemoryStorage": 0.486936594, + "cortext::operations::PersistSignalMetrics": 0.004646684, + "cortext::operations::PropagateEmotionalCascade": 0.005306816, + "cortext::operations::ResetAccumulatorAfterFlush": 0.000462714, + "cortext::operations::ResetAccumulatorOnInterrupt": 9.9404e-05, + "cortext::operations::UpdateAccumulator": 0.002377502, + "cortext::operations::UpdateAccumulatorScores": 0.000701342, + "cortext::operations::UpdateDriftAccumulation": 0.000714826, + "cortext::operations::UpdateEmbeddingPredictionError": 0.0017044200000000001, + "cortext::operations::UpdateFocus": 0.004705176, + "cortext::operations::UpdateMemoryStrength": 0.094095558, + "cortext::operations::UpdateMood": 0.000454664, + "cortext::operations::UpdateNeuromodulators": 0.002407318, + "cortext::operations::UpdatePrecisionDelta": 0.000331406, + "cortext::operations::UpdateRateState": 0.000612502, + "cortext::operations::UpdateRecentContext": 0.00039494, + "cortext::operations::UpdateSensitivity": 0.001866252, + "cortext::operations::UpdateSoftAnchor": 0.00602866, + "cortext::operations::UpdateStability": 0.007391482, + "cortext::operations::UpdateThreshold": 0.003410264, + "cortext::operations::UpdateUncertainty": 0.009536926, + "cortext::operations::WorkingMemory": 0.0048523179999999996 + }, + "start_event": 6139 + }, + { + "end_event_exclusive": 7139, + "mean_latency_ms": 9.598656594, + "mean_process_ms": 4.064861442, + "operation_ms": { + "SignalProcessor.begin_transaction": 0.005955156, + "SignalProcessor.commit_mutation_audit_finalize": 0.00097924, + "SignalProcessor.commit_sqlite": 0.161258024, + "SignalProcessor.commit_transaction": 0.164479174, + "SignalProcessor.finalize_episode": 0.00170401, + "SignalProcessor.persist_state": 0.014558446, + "SignalProcessor.persist_working_memory": 0.086544514, + "SignalProcessor.profile_mutation_audit": 0.038918658, + "SignalProcessor.publish_rif_active_epoch": 0.03674449, + "SignalProcessor.snapshot_cache_entry_copy": 0.0, + "SignalProcessor.snapshot_context": 0.164500332, + "SignalProcessor.snapshot_full_cache_copy": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_backfill": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_backfill_rows": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_seal": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_centroid_source": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_derived_centroid": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_overlap_pair_valid": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_overlap_profiled": 0.0, + "SignalProcessor.start_new_episode": 0.005633392, + "SignalProcessor.wm_close_stale": 0.00106507, + "SignalProcessor.wm_insert_signal_row": 0.037533354, + "SignalProcessor.wm_insert_slot_embedding": 0.010557752, + "SignalProcessor.wm_insert_slot_memory": 0.0, + "SignalProcessor.wm_prune_delete": 3.36e-07, + "SignalProcessor.wm_prune_select": 0.0005025, + "SignalProcessor.wm_update_slot_memory": 0.035526416, + "cortext::operations::ApplyEmotionalConsolidation": 0.004356422, + "cortext::operations::ApplyFocusFeedback": 0.000618326, + "cortext::operations::ApplyInfluenceFeedback": 0.002701682, + "cortext::operations::ApplyMetaLearning": 0.030401502, + "cortext::operations::ApplyPredictivePreActivation": 0.06317183, + "cortext::operations::ApplyReconsolidation": 0.058173942, + "cortext::operations::ApplyRetrievalCompetition": 0.065751002, + "cortext::operations::ApplySensitivityFeedback": 0.008609908, + "cortext::operations::ApplySerialPositionEffects": 0.000400256, + "cortext::operations::ApplySerialPositionMultiplier": 0.00036168400000000003, + "cortext::operations::ApplyStabilityFeedback": 0.002558662, + "cortext::operations::ApplySynapticTagging": 0.020828248, + "cortext::operations::BuildGraphFromConsolidation": 0.000194814, + "cortext::operations::CheckSpikeBypass": 0.000748822, + "cortext::operations::CheckStreamingPacing": 0.000739658, + "cortext::operations::ComputeCoherence": 0.012120686, + "cortext::operations::ComputeCompositeScore": 0.02222869, + "cortext::operations::ComputeEffectiveFocus": 0.00044941, + "cortext::operations::ComputeFocusSpread": 0.011024498, + "cortext::operations::ComputeMetrics": 0.012738662, + "cortext::operations::ComputeMniGateDecision": 0.024083978, + "cortext::operations::ComputeWriteGate": 0.002277234, + "cortext::operations::ConsolidationCluster": 0.00020059, + "cortext::operations::ConsolidationGate": 0.000373498, + "cortext::operations::ConsolidationShallow": 0.000129588, + "cortext::operations::DetectBoundary": 0.003425504, + "cortext::operations::DetectMemoryUsage": 0.004708262, + "cortext::operations::EvaluateConsolidation": 0.000113838, + "cortext::operations::FitMetricWeightsRLS": 0.000873674, + "cortext::operations::GraphAugmentedRetrieveCandidates": 2.392234086, + "cortext::operations::InitializeEmbeddedCentroids": 0.001288094, + "cortext::operations::InitializeFocusPriors": 5.5766e-05, + "cortext::operations::InitializeSensitivityPriors": 0.000145442, + "cortext::operations::InitializeStabilityPriors": 0.000156186, + "cortext::operations::MemoryStorage": 0.533693018, + "cortext::operations::PersistSignalMetrics": 0.004959494, + "cortext::operations::PropagateEmotionalCascade": 0.005005584, + "cortext::operations::ResetAccumulatorAfterFlush": 0.000458402, + "cortext::operations::ResetAccumulatorOnInterrupt": 0.000120814, + "cortext::operations::UpdateAccumulator": 0.002288132, + "cortext::operations::UpdateAccumulatorScores": 0.000689228, + "cortext::operations::UpdateDriftAccumulation": 0.000722162, + "cortext::operations::UpdateEmbeddingPredictionError": 0.00177458, + "cortext::operations::UpdateFocus": 0.004419284, + "cortext::operations::UpdateMemoryStrength": 0.096573248, + "cortext::operations::UpdateMood": 0.000452108, + "cortext::operations::UpdateNeuromodulators": 0.002334554, + "cortext::operations::UpdatePrecisionDelta": 0.000333676, + "cortext::operations::UpdateRateState": 0.000623496, + "cortext::operations::UpdateRecentContext": 0.000384136, + "cortext::operations::UpdateSensitivity": 0.002063674, + "cortext::operations::UpdateSoftAnchor": 0.00694452, + "cortext::operations::UpdateStability": 0.007963578, + "cortext::operations::UpdateThreshold": 0.00341897, + "cortext::operations::UpdateUncertainty": 0.00990592, + "cortext::operations::WorkingMemory": 0.004937762 + }, + "start_event": 6639 + }, + { + "end_event_exclusive": 7639, + "mean_latency_ms": 10.355642702, + "mean_process_ms": 4.08868434, + "operation_ms": { + "SignalProcessor.begin_transaction": 0.006435572, + "SignalProcessor.commit_mutation_audit_finalize": 0.000910152, + "SignalProcessor.commit_sqlite": 0.162290072, + "SignalProcessor.commit_transaction": 0.165294932, + "SignalProcessor.finalize_episode": 0.001613332, + "SignalProcessor.persist_state": 0.015832080000000002, + "SignalProcessor.persist_working_memory": 0.079955428, + "SignalProcessor.profile_mutation_audit": 0.020772432, + "SignalProcessor.publish_rif_active_epoch": 0.040273102, + "SignalProcessor.snapshot_cache_entry_copy": 0.0, + "SignalProcessor.snapshot_context": 0.166284334, + "SignalProcessor.snapshot_full_cache_copy": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_backfill": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_backfill_rows": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_seal": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_centroid_source": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_derived_centroid": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_overlap_pair_valid": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_overlap_profiled": 0.0, + "SignalProcessor.start_new_episode": 0.005605894, + "SignalProcessor.wm_close_stale": 0.001179172, + "SignalProcessor.wm_insert_signal_row": 0.033618574, + "SignalProcessor.wm_insert_slot_embedding": 0.008138336, + "SignalProcessor.wm_insert_slot_memory": 0.0, + "SignalProcessor.wm_prune_delete": 5.82e-07, + "SignalProcessor.wm_prune_select": 0.000888082, + "SignalProcessor.wm_update_slot_memory": 0.034824146, + "cortext::operations::ApplyEmotionalConsolidation": 0.004385662, + "cortext::operations::ApplyFocusFeedback": 0.000629176, + "cortext::operations::ApplyInfluenceFeedback": 0.002289816, + "cortext::operations::ApplyMetaLearning": 0.02806591, + "cortext::operations::ApplyPredictivePreActivation": 0.059241512, + "cortext::operations::ApplyReconsolidation": 0.071327922, + "cortext::operations::ApplyRetrievalCompetition": 0.064034662, + "cortext::operations::ApplySensitivityFeedback": 0.007099752, + "cortext::operations::ApplySerialPositionEffects": 0.000401918, + "cortext::operations::ApplySerialPositionMultiplier": 0.000355894, + "cortext::operations::ApplyStabilityFeedback": 0.002055666, + "cortext::operations::ApplySynapticTagging": 0.014281596, + "cortext::operations::BuildGraphFromConsolidation": 0.000179682, + "cortext::operations::CheckSpikeBypass": 0.000744422, + "cortext::operations::CheckStreamingPacing": 0.000697742, + "cortext::operations::ComputeCoherence": 0.011732994, + "cortext::operations::ComputeCompositeScore": 0.023547592, + "cortext::operations::ComputeEffectiveFocus": 0.000449742, + "cortext::operations::ComputeFocusSpread": 0.010018546, + "cortext::operations::ComputeMetrics": 0.014387888, + "cortext::operations::ComputeMniGateDecision": 0.022856162, + "cortext::operations::ComputeWriteGate": 0.002270156, + "cortext::operations::ConsolidationCluster": 0.000173516, + "cortext::operations::ConsolidationGate": 0.000362422, + "cortext::operations::ConsolidationShallow": 0.000123094, + "cortext::operations::DetectBoundary": 0.003398974, + "cortext::operations::DetectMemoryUsage": 0.003984964, + "cortext::operations::EvaluateConsolidation": 0.000109936, + "cortext::operations::FitMetricWeightsRLS": 0.000798548, + "cortext::operations::GraphAugmentedRetrieveCandidates": 2.421909814, + "cortext::operations::InitializeEmbeddedCentroids": 0.001259262, + "cortext::operations::InitializeFocusPriors": 4.4177999999999996e-05, + "cortext::operations::InitializeSensitivityPriors": 0.00016583, + "cortext::operations::InitializeStabilityPriors": 0.000164098, + "cortext::operations::MemoryStorage": 0.553381736, + "cortext::operations::PersistSignalMetrics": 0.005542668, + "cortext::operations::PropagateEmotionalCascade": 0.006231714, + "cortext::operations::ResetAccumulatorAfterFlush": 0.000440434, + "cortext::operations::ResetAccumulatorOnInterrupt": 0.000111916, + "cortext::operations::UpdateAccumulator": 0.002253746, + "cortext::operations::UpdateAccumulatorScores": 0.000673654, + "cortext::operations::UpdateDriftAccumulation": 0.000685834, + "cortext::operations::UpdateEmbeddingPredictionError": 0.001724592, + "cortext::operations::UpdateFocus": 0.004469568, + "cortext::operations::UpdateMemoryStrength": 0.09544299, + "cortext::operations::UpdateMood": 0.000452168, + "cortext::operations::UpdateNeuromodulators": 0.00231475, + "cortext::operations::UpdatePrecisionDelta": 0.000321936, + "cortext::operations::UpdateRateState": 0.000573682, + "cortext::operations::UpdateRecentContext": 0.00038858, + "cortext::operations::UpdateSensitivity": 0.00186871, + "cortext::operations::UpdateSoftAnchor": 0.00647009, + "cortext::operations::UpdateStability": 0.008598982, + "cortext::operations::UpdateThreshold": 0.003243758, + "cortext::operations::UpdateUncertainty": 0.00917867, + "cortext::operations::WorkingMemory": 0.005057322 + }, + "start_event": 7139 + }, + { + "end_event_exclusive": 8139, + "mean_latency_ms": 7.43608256, + "mean_process_ms": 3.969821322, + "operation_ms": { + "SignalProcessor.begin_transaction": 0.003666008, + "SignalProcessor.commit_mutation_audit_finalize": 0.0008468319999999999, + "SignalProcessor.commit_sqlite": 0.158553802, + "SignalProcessor.commit_transaction": 0.16130218, + "SignalProcessor.finalize_episode": 0.001659416, + "SignalProcessor.persist_state": 0.016493398, + "SignalProcessor.persist_working_memory": 0.07243501, + "SignalProcessor.profile_mutation_audit": 0.022057536, + "SignalProcessor.publish_rif_active_epoch": 0.036716986, + "SignalProcessor.snapshot_cache_entry_copy": 0.0, + "SignalProcessor.snapshot_context": 0.126686162, + "SignalProcessor.snapshot_full_cache_copy": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_backfill": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_backfill_rows": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_seal": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_centroid_source": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_derived_centroid": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_overlap_pair_valid": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_overlap_profiled": 0.0, + "SignalProcessor.start_new_episode": 0.004521982, + "SignalProcessor.wm_close_stale": 0.001107914, + "SignalProcessor.wm_insert_signal_row": 0.030811250000000002, + "SignalProcessor.wm_insert_slot_embedding": 0.008080736, + "SignalProcessor.wm_insert_slot_memory": 0.0, + "SignalProcessor.wm_prune_delete": 1.3339999999999998e-06, + "SignalProcessor.wm_prune_select": 0.000812672, + "SignalProcessor.wm_update_slot_memory": 0.030510746000000002, + "cortext::operations::ApplyEmotionalConsolidation": 0.004159244, + "cortext::operations::ApplyFocusFeedback": 0.00053906, + "cortext::operations::ApplyInfluenceFeedback": 0.002881422, + "cortext::operations::ApplyMetaLearning": 0.025800092, + "cortext::operations::ApplyPredictivePreActivation": 0.057519092, + "cortext::operations::ApplyReconsolidation": 0.058015324, + "cortext::operations::ApplyRetrievalCompetition": 0.063542752, + "cortext::operations::ApplySensitivityFeedback": 0.00889249, + "cortext::operations::ApplySerialPositionEffects": 0.00035302, + "cortext::operations::ApplySerialPositionMultiplier": 0.00033083, + "cortext::operations::ApplyStabilityFeedback": 0.002736984, + "cortext::operations::ApplySynapticTagging": 0.041402842, + "cortext::operations::BuildGraphFromConsolidation": 0.00013084, + "cortext::operations::CheckSpikeBypass": 0.000636554, + "cortext::operations::CheckStreamingPacing": 0.000635336, + "cortext::operations::ComputeCoherence": 0.010859982, + "cortext::operations::ComputeCompositeScore": 0.020070992, + "cortext::operations::ComputeEffectiveFocus": 0.000371714, + "cortext::operations::ComputeFocusSpread": 0.009802544, + "cortext::operations::ComputeMetrics": 0.012099314, + "cortext::operations::ComputeMniGateDecision": 0.022494932, + "cortext::operations::ComputeWriteGate": 0.00198823, + "cortext::operations::ConsolidationCluster": 0.000132248, + "cortext::operations::ConsolidationGate": 0.000358592, + "cortext::operations::ConsolidationShallow": 0.000106758, + "cortext::operations::DetectBoundary": 0.002977836, + "cortext::operations::DetectMemoryUsage": 0.004729, + "cortext::operations::EvaluateConsolidation": 8.3586e-05, + "cortext::operations::FitMetricWeightsRLS": 0.000728488, + "cortext::operations::GraphAugmentedRetrieveCandidates": 2.381472156, + "cortext::operations::InitializeEmbeddedCentroids": 0.00102336, + "cortext::operations::InitializeFocusPriors": 4.3803999999999996e-05, + "cortext::operations::InitializeSensitivityPriors": 0.000114242, + "cortext::operations::InitializeStabilityPriors": 0.000122838, + "cortext::operations::MemoryStorage": 0.540390162, + "cortext::operations::PersistSignalMetrics": 0.00462293, + "cortext::operations::PropagateEmotionalCascade": 0.005361252, + "cortext::operations::ResetAccumulatorAfterFlush": 0.000429508, + "cortext::operations::ResetAccumulatorOnInterrupt": 0.000126678, + "cortext::operations::UpdateAccumulator": 0.0058098939999999995, + "cortext::operations::UpdateAccumulatorScores": 0.000674736, + "cortext::operations::UpdateDriftAccumulation": 0.000549424, + "cortext::operations::UpdateEmbeddingPredictionError": 0.001419582, + "cortext::operations::UpdateFocus": 0.004424542, + "cortext::operations::UpdateMemoryStrength": 0.091478168, + "cortext::operations::UpdateMood": 0.000412328, + "cortext::operations::UpdateNeuromodulators": 0.002093726, + "cortext::operations::UpdatePrecisionDelta": 0.000283758, + "cortext::operations::UpdateRateState": 0.000556664, + "cortext::operations::UpdateRecentContext": 0.000397686, + "cortext::operations::UpdateSensitivity": 0.001791514, + "cortext::operations::UpdateSoftAnchor": 0.006010102, + "cortext::operations::UpdateStability": 0.008749168, + "cortext::operations::UpdateThreshold": 0.002800998, + "cortext::operations::UpdateUncertainty": 0.009715144, + "cortext::operations::WorkingMemory": 0.004385108 + }, + "start_event": 7639 + }, + { + "end_event_exclusive": 8639, + "mean_latency_ms": 6.581424758, + "mean_process_ms": 3.861440754, + "operation_ms": { + "SignalProcessor.begin_transaction": 0.003965082, + "SignalProcessor.commit_mutation_audit_finalize": 0.000835514, + "SignalProcessor.commit_sqlite": 0.14976848, + "SignalProcessor.commit_transaction": 0.152464484, + "SignalProcessor.finalize_episode": 0.001581068, + "SignalProcessor.persist_state": 0.012710378, + "SignalProcessor.persist_working_memory": 0.070395248, + "SignalProcessor.profile_mutation_audit": 0.020077142, + "SignalProcessor.publish_rif_active_epoch": 0.036735592, + "SignalProcessor.snapshot_cache_entry_copy": 0.0, + "SignalProcessor.snapshot_context": 0.130118496, + "SignalProcessor.snapshot_full_cache_copy": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_backfill": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_backfill_rows": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_seal": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_centroid_source": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_derived_centroid": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_overlap_pair_valid": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_overlap_profiled": 0.0, + "SignalProcessor.start_new_episode": 0.004686822, + "SignalProcessor.wm_close_stale": 0.001085588, + "SignalProcessor.wm_insert_signal_row": 0.02874516, + "SignalProcessor.wm_insert_slot_embedding": 0.00878825, + "SignalProcessor.wm_insert_slot_memory": 0.0, + "SignalProcessor.wm_prune_delete": 1.68e-07, + "SignalProcessor.wm_prune_select": 0.000431082, + "SignalProcessor.wm_update_slot_memory": 0.030243298, + "cortext::operations::ApplyEmotionalConsolidation": 0.003792246, + "cortext::operations::ApplyFocusFeedback": 0.00055334, + "cortext::operations::ApplyInfluenceFeedback": 0.001569764, + "cortext::operations::ApplyMetaLearning": 0.02580402, + "cortext::operations::ApplyPredictivePreActivation": 0.05315108, + "cortext::operations::ApplyReconsolidation": 0.055061812, + "cortext::operations::ApplyRetrievalCompetition": 0.057827818, + "cortext::operations::ApplySensitivityFeedback": 0.004338562, + "cortext::operations::ApplySerialPositionEffects": 0.000322212, + "cortext::operations::ApplySerialPositionMultiplier": 0.00032824, + "cortext::operations::ApplyStabilityFeedback": 0.001390092, + "cortext::operations::ApplySynapticTagging": 0.01513251, + "cortext::operations::BuildGraphFromConsolidation": 0.000124348, + "cortext::operations::CheckSpikeBypass": 0.000659656, + "cortext::operations::CheckStreamingPacing": 0.000637758, + "cortext::operations::ComputeCoherence": 0.010801904, + "cortext::operations::ComputeCompositeScore": 0.019986754, + "cortext::operations::ComputeEffectiveFocus": 0.000401736, + "cortext::operations::ComputeFocusSpread": 0.009729014, + "cortext::operations::ComputeMetrics": 0.011951266, + "cortext::operations::ComputeMniGateDecision": 0.020715094, + "cortext::operations::ComputeWriteGate": 0.002062676, + "cortext::operations::ConsolidationCluster": 0.00012994, + "cortext::operations::ConsolidationGate": 0.000324988, + "cortext::operations::ConsolidationShallow": 0.000105348, + "cortext::operations::DetectBoundary": 0.00298191, + "cortext::operations::DetectMemoryUsage": 0.002729756, + "cortext::operations::EvaluateConsolidation": 8.6996e-05, + "cortext::operations::FitMetricWeightsRLS": 0.000773836, + "cortext::operations::GraphAugmentedRetrieveCandidates": 2.325767086, + "cortext::operations::InitializeEmbeddedCentroids": 0.001030524, + "cortext::operations::InitializeFocusPriors": 4.8083999999999996e-05, + "cortext::operations::InitializeSensitivityPriors": 0.000104498, + "cortext::operations::InitializeStabilityPriors": 0.000114858, + "cortext::operations::MemoryStorage": 0.56607272, + "cortext::operations::PersistSignalMetrics": 0.004667686, + "cortext::operations::PropagateEmotionalCascade": 0.004331908, + "cortext::operations::ResetAccumulatorAfterFlush": 0.000366838, + "cortext::operations::ResetAccumulatorOnInterrupt": 6.5326e-05, + "cortext::operations::UpdateAccumulator": 0.00201211, + "cortext::operations::UpdateAccumulatorScores": 0.000601518, + "cortext::operations::UpdateDriftAccumulation": 0.000545342, + "cortext::operations::UpdateEmbeddingPredictionError": 0.001462978, + "cortext::operations::UpdateFocus": 0.00426499, + "cortext::operations::UpdateMemoryStrength": 0.084468118, + "cortext::operations::UpdateMood": 0.000417742, + "cortext::operations::UpdateNeuromodulators": 0.002213848, + "cortext::operations::UpdatePrecisionDelta": 0.000307612, + "cortext::operations::UpdateRateState": 0.000497604, + "cortext::operations::UpdateRecentContext": 0.00041931, + "cortext::operations::UpdateSensitivity": 0.001756554, + "cortext::operations::UpdateSoftAnchor": 0.005913916, + "cortext::operations::UpdateStability": 0.009322054, + "cortext::operations::UpdateThreshold": 0.002910988, + "cortext::operations::UpdateUncertainty": 0.008902836, + "cortext::operations::WorkingMemory": 0.00494427 + }, + "start_event": 8139 + }, + { + "end_event_exclusive": 9139, + "mean_latency_ms": 6.658232762, + "mean_process_ms": 3.85204941, + "operation_ms": { + "SignalProcessor.begin_transaction": 0.003911398, + "SignalProcessor.commit_mutation_audit_finalize": 0.000806006, + "SignalProcessor.commit_sqlite": 0.152996832, + "SignalProcessor.commit_transaction": 0.15564074, + "SignalProcessor.finalize_episode": 0.001553406, + "SignalProcessor.persist_state": 0.012485404, + "SignalProcessor.persist_working_memory": 0.070015154, + "SignalProcessor.profile_mutation_audit": 0.02062462, + "SignalProcessor.publish_rif_active_epoch": 0.036895756, + "SignalProcessor.snapshot_cache_entry_copy": 0.0, + "SignalProcessor.snapshot_context": 0.127526188, + "SignalProcessor.snapshot_full_cache_copy": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_backfill": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_backfill_rows": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_seal": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_centroid_source": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_derived_centroid": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_overlap_pair_valid": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_overlap_profiled": 0.0, + "SignalProcessor.start_new_episode": 0.004493064, + "SignalProcessor.wm_close_stale": 0.000950668, + "SignalProcessor.wm_insert_signal_row": 0.028855442000000002, + "SignalProcessor.wm_insert_slot_embedding": 0.009058668, + "SignalProcessor.wm_insert_slot_memory": 0.0, + "SignalProcessor.wm_prune_delete": 4.98e-07, + "SignalProcessor.wm_prune_select": 0.000720332, + "SignalProcessor.wm_update_slot_memory": 0.029324322, + "cortext::operations::ApplyEmotionalConsolidation": 0.003783514, + "cortext::operations::ApplyFocusFeedback": 0.0005504279999999999, + "cortext::operations::ApplyInfluenceFeedback": 0.0017200919999999999, + "cortext::operations::ApplyMetaLearning": 0.025037316, + "cortext::operations::ApplyPredictivePreActivation": 0.052309754, + "cortext::operations::ApplyReconsolidation": 0.052391586, + "cortext::operations::ApplyRetrievalCompetition": 0.056880752, + "cortext::operations::ApplySensitivityFeedback": 0.005078488, + "cortext::operations::ApplySerialPositionEffects": 0.000321564, + "cortext::operations::ApplySerialPositionMultiplier": 0.00031433, + "cortext::operations::ApplyStabilityFeedback": 0.001551374, + "cortext::operations::ApplySynapticTagging": 0.02971184, + "cortext::operations::BuildGraphFromConsolidation": 0.000123006, + "cortext::operations::CheckSpikeBypass": 0.00062648, + "cortext::operations::CheckStreamingPacing": 0.00060017, + "cortext::operations::ComputeCoherence": 0.010793572, + "cortext::operations::ComputeCompositeScore": 0.01993576, + "cortext::operations::ComputeEffectiveFocus": 0.000369618, + "cortext::operations::ComputeFocusSpread": 0.009575918, + "cortext::operations::ComputeMetrics": 0.011804352, + "cortext::operations::ComputeMniGateDecision": 0.020477996, + "cortext::operations::ComputeWriteGate": 0.001946492, + "cortext::operations::ConsolidationCluster": 0.00013911, + "cortext::operations::ConsolidationGate": 0.000325512, + "cortext::operations::ConsolidationShallow": 0.000108834, + "cortext::operations::DetectBoundary": 0.003016674, + "cortext::operations::DetectMemoryUsage": 0.003101164, + "cortext::operations::EvaluateConsolidation": 8.3242e-05, + "cortext::operations::FitMetricWeightsRLS": 0.000783094, + "cortext::operations::GraphAugmentedRetrieveCandidates": 2.311964822, + "cortext::operations::InitializeEmbeddedCentroids": 0.00086685, + "cortext::operations::InitializeFocusPriors": 4.3912e-05, + "cortext::operations::InitializeSensitivityPriors": 0.00010945, + "cortext::operations::InitializeStabilityPriors": 0.00011424, + "cortext::operations::MemoryStorage": 0.561096668, + "cortext::operations::PersistSignalMetrics": 0.004604438, + "cortext::operations::PropagateEmotionalCascade": 0.00726758, + "cortext::operations::ResetAccumulatorAfterFlush": 0.000405586, + "cortext::operations::ResetAccumulatorOnInterrupt": 5.6998e-05, + "cortext::operations::UpdateAccumulator": 0.001921244, + "cortext::operations::UpdateAccumulatorScores": 0.000603576, + "cortext::operations::UpdateDriftAccumulation": 0.000545576, + "cortext::operations::UpdateEmbeddingPredictionError": 0.001403748, + "cortext::operations::UpdateFocus": 0.004190424, + "cortext::operations::UpdateMemoryStrength": 0.08272841, + "cortext::operations::UpdateMood": 0.000409094, + "cortext::operations::UpdateNeuromodulators": 0.002082832, + "cortext::operations::UpdatePrecisionDelta": 0.00027992, + "cortext::operations::UpdateRateState": 0.000516024, + "cortext::operations::UpdateRecentContext": 0.000384284, + "cortext::operations::UpdateSensitivity": 0.001665062, + "cortext::operations::UpdateSoftAnchor": 0.005606316, + "cortext::operations::UpdateStability": 0.009898676, + "cortext::operations::UpdateThreshold": 0.002820726, + "cortext::operations::UpdateUncertainty": 0.008772762, + "cortext::operations::WorkingMemory": 0.004731754 + }, + "start_event": 8639 + }, + { + "end_event_exclusive": 9639, + "mean_latency_ms": 7.861333914, + "mean_process_ms": 4.233176356, + "operation_ms": { + "SignalProcessor.begin_transaction": 0.004056916, + "SignalProcessor.commit_mutation_audit_finalize": 0.00082185, + "SignalProcessor.commit_sqlite": 0.168361308, + "SignalProcessor.commit_transaction": 0.171093662, + "SignalProcessor.finalize_episode": 0.001628998, + "SignalProcessor.persist_state": 0.012971072, + "SignalProcessor.persist_working_memory": 0.07537777, + "SignalProcessor.profile_mutation_audit": 0.022181414, + "SignalProcessor.publish_rif_active_epoch": 0.04049991, + "SignalProcessor.snapshot_cache_entry_copy": 0.0, + "SignalProcessor.snapshot_context": 0.133970594, + "SignalProcessor.snapshot_full_cache_copy": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_backfill": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_backfill_rows": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_seal": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_centroid_source": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_derived_centroid": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_overlap_pair_valid": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_overlap_profiled": 0.0, + "SignalProcessor.start_new_episode": 0.004425088, + "SignalProcessor.wm_close_stale": 0.002097516, + "SignalProcessor.wm_insert_signal_row": 0.03297484, + "SignalProcessor.wm_insert_slot_embedding": 0.008051334, + "SignalProcessor.wm_insert_slot_memory": 0.0, + "SignalProcessor.wm_prune_delete": 9.16e-07, + "SignalProcessor.wm_prune_select": 0.000699916, + "SignalProcessor.wm_update_slot_memory": 0.03036816, + "cortext::operations::ApplyEmotionalConsolidation": 0.004123744, + "cortext::operations::ApplyFocusFeedback": 0.001421002, + "cortext::operations::ApplyInfluenceFeedback": 0.002382142, + "cortext::operations::ApplyMetaLearning": 0.02606418, + "cortext::operations::ApplyPredictivePreActivation": 0.058043442, + "cortext::operations::ApplyReconsolidation": 0.048822346, + "cortext::operations::ApplyRetrievalCompetition": 0.060947906, + "cortext::operations::ApplySensitivityFeedback": 0.007488492, + "cortext::operations::ApplySerialPositionEffects": 0.000328286, + "cortext::operations::ApplySerialPositionMultiplier": 0.00038541, + "cortext::operations::ApplyStabilityFeedback": 0.00224324, + "cortext::operations::ApplySynapticTagging": 0.023335098, + "cortext::operations::BuildGraphFromConsolidation": 0.000130142, + "cortext::operations::CheckSpikeBypass": 0.000618078, + "cortext::operations::CheckStreamingPacing": 0.000607582, + "cortext::operations::ComputeCoherence": 0.011021114, + "cortext::operations::ComputeCompositeScore": 0.019585814, + "cortext::operations::ComputeEffectiveFocus": 0.000382336, + "cortext::operations::ComputeFocusSpread": 0.009807502, + "cortext::operations::ComputeMetrics": 0.011859968, + "cortext::operations::ComputeMniGateDecision": 0.021549994, + "cortext::operations::ComputeWriteGate": 0.001989686, + "cortext::operations::ConsolidationCluster": 0.000123592, + "cortext::operations::ConsolidationGate": 0.000322256, + "cortext::operations::ConsolidationShallow": 0.000104966, + "cortext::operations::DetectBoundary": 0.002968422, + "cortext::operations::DetectMemoryUsage": 0.003939076, + "cortext::operations::EvaluateConsolidation": 8.2606e-05, + "cortext::operations::FitMetricWeightsRLS": 0.000742176, + "cortext::operations::GraphAugmentedRetrieveCandidates": 2.542872488, + "cortext::operations::InitializeEmbeddedCentroids": 0.00087733, + "cortext::operations::InitializeFocusPriors": 4.032e-05, + "cortext::operations::InitializeSensitivityPriors": 0.000112924, + "cortext::operations::InitializeStabilityPriors": 0.000114536, + "cortext::operations::MemoryStorage": 0.663196918, + "cortext::operations::PersistSignalMetrics": 0.005072614, + "cortext::operations::PropagateEmotionalCascade": 0.005377338, + "cortext::operations::ResetAccumulatorAfterFlush": 0.000375532, + "cortext::operations::ResetAccumulatorOnInterrupt": 9.6698e-05, + "cortext::operations::UpdateAccumulator": 0.001939114, + "cortext::operations::UpdateAccumulatorScores": 0.00060828, + "cortext::operations::UpdateDriftAccumulation": 0.000643892, + "cortext::operations::UpdateEmbeddingPredictionError": 0.001432908, + "cortext::operations::UpdateFocus": 0.00421334, + "cortext::operations::UpdateMemoryStrength": 0.087155038, + "cortext::operations::UpdateMood": 0.000413032, + "cortext::operations::UpdateNeuromodulators": 0.002070576, + "cortext::operations::UpdatePrecisionDelta": 0.000346406, + "cortext::operations::UpdateRateState": 0.000497514, + "cortext::operations::UpdateRecentContext": 0.000355348, + "cortext::operations::UpdateSensitivity": 0.001665674, + "cortext::operations::UpdateSoftAnchor": 0.006391756, + "cortext::operations::UpdateStability": 0.010342992, + "cortext::operations::UpdateThreshold": 0.002799084, + "cortext::operations::UpdateUncertainty": 0.009270988, + "cortext::operations::WorkingMemory": 0.00470088 + }, + "start_event": 9139 + }, + { + "end_event_exclusive": 10139, + "mean_latency_ms": 7.615379248, + "mean_process_ms": 4.362867756, + "operation_ms": { + "SignalProcessor.begin_transaction": 0.004599034, + "SignalProcessor.commit_mutation_audit_finalize": 0.000861476, + "SignalProcessor.commit_sqlite": 0.146936244, + "SignalProcessor.commit_transaction": 0.149765738, + "SignalProcessor.finalize_episode": 0.001715332, + "SignalProcessor.persist_state": 0.013335488, + "SignalProcessor.persist_working_memory": 0.073488006, + "SignalProcessor.profile_mutation_audit": 0.02141143, + "SignalProcessor.publish_rif_active_epoch": 0.040858252, + "SignalProcessor.snapshot_cache_entry_copy": 0.0, + "SignalProcessor.snapshot_context": 0.151087726, + "SignalProcessor.snapshot_full_cache_copy": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_backfill": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_backfill_rows": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_seal": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_centroid_source": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_derived_centroid": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_overlap_pair_valid": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_overlap_profiled": 0.0, + "SignalProcessor.start_new_episode": 0.00488789, + "SignalProcessor.wm_close_stale": 0.00101749, + "SignalProcessor.wm_insert_signal_row": 0.028964336, + "SignalProcessor.wm_insert_slot_embedding": 0.008759004, + "SignalProcessor.wm_insert_slot_memory": 0.0, + "SignalProcessor.wm_prune_delete": 5e-07, + "SignalProcessor.wm_prune_select": 0.001007412, + "SignalProcessor.wm_update_slot_memory": 0.032545598, + "cortext::operations::ApplyEmotionalConsolidation": 0.003960106, + "cortext::operations::ApplyFocusFeedback": 0.000603152, + "cortext::operations::ApplyInfluenceFeedback": 0.00155347, + "cortext::operations::ApplyMetaLearning": 0.027289066, + "cortext::operations::ApplyPredictivePreActivation": 0.056781514, + "cortext::operations::ApplyReconsolidation": 0.050006912, + "cortext::operations::ApplyRetrievalCompetition": 0.083394914, + "cortext::operations::ApplySensitivityFeedback": 0.005013322, + "cortext::operations::ApplySerialPositionEffects": 0.000358054, + "cortext::operations::ApplySerialPositionMultiplier": 0.000337074, + "cortext::operations::ApplyStabilityFeedback": 0.00150775, + "cortext::operations::ApplySynapticTagging": 0.027528356, + "cortext::operations::BuildGraphFromConsolidation": 0.000155672, + "cortext::operations::CheckSpikeBypass": 0.000675074, + "cortext::operations::CheckStreamingPacing": 0.000661312, + "cortext::operations::ComputeCoherence": 0.015039118, + "cortext::operations::ComputeCompositeScore": 0.020244994, + "cortext::operations::ComputeEffectiveFocus": 0.000404094, + "cortext::operations::ComputeFocusSpread": 0.010127224, + "cortext::operations::ComputeMetrics": 0.012211342, + "cortext::operations::ComputeMniGateDecision": 0.022786178, + "cortext::operations::ComputeWriteGate": 0.002258588, + "cortext::operations::ConsolidationCluster": 0.00015565, + "cortext::operations::ConsolidationGate": 0.00034373, + "cortext::operations::ConsolidationShallow": 0.00011599599999999999, + "cortext::operations::DetectBoundary": 0.003115756, + "cortext::operations::DetectMemoryUsage": 0.00324701, + "cortext::operations::EvaluateConsolidation": 9.64e-05, + "cortext::operations::FitMetricWeightsRLS": 0.000819032, + "cortext::operations::GraphAugmentedRetrieveCandidates": 2.549680346, + "cortext::operations::InitializeEmbeddedCentroids": 0.001020504, + "cortext::operations::InitializeFocusPriors": 4.4254e-05, + "cortext::operations::InitializeSensitivityPriors": 0.000122768, + "cortext::operations::InitializeStabilityPriors": 0.000132614, + "cortext::operations::MemoryStorage": 0.748393168, + "cortext::operations::PersistSignalMetrics": 0.00464551, + "cortext::operations::PropagateEmotionalCascade": 0.007038334, + "cortext::operations::ResetAccumulatorAfterFlush": 0.00046941, + "cortext::operations::ResetAccumulatorOnInterrupt": 6.3504e-05, + "cortext::operations::UpdateAccumulator": 0.006075166, + "cortext::operations::UpdateAccumulatorScores": 0.000643562, + "cortext::operations::UpdateDriftAccumulation": 0.000633964, + "cortext::operations::UpdateEmbeddingPredictionError": 0.00158534, + "cortext::operations::UpdateFocus": 0.004404186, + "cortext::operations::UpdateMemoryStrength": 0.088584742, + "cortext::operations::UpdateMood": 0.000438514, + "cortext::operations::UpdateNeuromodulators": 0.002189436, + "cortext::operations::UpdatePrecisionDelta": 0.000299586, + "cortext::operations::UpdateRateState": 0.000579916, + "cortext::operations::UpdateRecentContext": 0.000391098, + "cortext::operations::UpdateSensitivity": 0.002059066, + "cortext::operations::UpdateSoftAnchor": 0.006022896, + "cortext::operations::UpdateStability": 0.01115075, + "cortext::operations::UpdateThreshold": 0.003574674, + "cortext::operations::UpdateUncertainty": 0.009859558000000001, + "cortext::operations::WorkingMemory": 0.005022686 + }, + "start_event": 9639 + }, + { + "end_event_exclusive": 10639, + "mean_latency_ms": 13.406200024, + "mean_process_ms": 6.321119598, + "operation_ms": { + "SignalProcessor.begin_transaction": 0.008260414, + "SignalProcessor.commit_mutation_audit_finalize": 0.001288264, + "SignalProcessor.commit_sqlite": 0.233419846, + "SignalProcessor.commit_transaction": 0.237588154, + "SignalProcessor.finalize_episode": 0.002743086, + "SignalProcessor.persist_state": 0.018221182, + "SignalProcessor.persist_working_memory": 0.13896983, + "SignalProcessor.profile_mutation_audit": 0.03752458, + "SignalProcessor.publish_rif_active_epoch": 0.05607092, + "SignalProcessor.snapshot_cache_entry_copy": 0.0, + "SignalProcessor.snapshot_context": 0.22543008, + "SignalProcessor.snapshot_full_cache_copy": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_backfill": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_backfill_rows": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_seal": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_centroid_source": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_derived_centroid": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_overlap_pair_valid": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_overlap_profiled": 0.0, + "SignalProcessor.start_new_episode": 0.006371412, + "SignalProcessor.wm_close_stale": 0.001942424, + "SignalProcessor.wm_insert_signal_row": 0.040247234, + "SignalProcessor.wm_insert_slot_embedding": 0.015188576, + "SignalProcessor.wm_insert_slot_memory": 0.000123834, + "SignalProcessor.wm_prune_delete": 1.252e-06, + "SignalProcessor.wm_prune_select": 0.00089325, + "SignalProcessor.wm_update_slot_memory": 0.07812607, + "cortext::operations::ApplyEmotionalConsolidation": 0.007106722, + "cortext::operations::ApplyFocusFeedback": 0.000984174, + "cortext::operations::ApplyInfluenceFeedback": 0.00284592, + "cortext::operations::ApplyMetaLearning": 0.042767966, + "cortext::operations::ApplyPredictivePreActivation": 0.080054064, + "cortext::operations::ApplyReconsolidation": 0.068728488, + "cortext::operations::ApplyRetrievalCompetition": 0.093789422, + "cortext::operations::ApplySensitivityFeedback": 0.009376652, + "cortext::operations::ApplySerialPositionEffects": 0.000492492, + "cortext::operations::ApplySerialPositionMultiplier": 0.000413894, + "cortext::operations::ApplyStabilityFeedback": 0.00240242, + "cortext::operations::ApplySynapticTagging": 0.039405012, + "cortext::operations::BuildGraphFromConsolidation": 0.000310506, + "cortext::operations::CheckSpikeBypass": 0.000879566, + "cortext::operations::CheckStreamingPacing": 0.00107034, + "cortext::operations::ComputeCoherence": 0.019931428, + "cortext::operations::ComputeCompositeScore": 0.032630386, + "cortext::operations::ComputeEffectiveFocus": 0.000641162, + "cortext::operations::ComputeFocusSpread": 0.014491434, + "cortext::operations::ComputeMetrics": 0.016028424, + "cortext::operations::ComputeMniGateDecision": 0.035586698, + "cortext::operations::ComputeWriteGate": 0.003197904, + "cortext::operations::ConsolidationCluster": 0.00022353, + "cortext::operations::ConsolidationGate": 0.000469544, + "cortext::operations::ConsolidationShallow": 0.000179152, + "cortext::operations::DetectBoundary": 0.004705562, + "cortext::operations::DetectMemoryUsage": 0.005100512, + "cortext::operations::EvaluateConsolidation": 0.000135926, + "cortext::operations::FitMetricWeightsRLS": 0.0009923, + "cortext::operations::GraphAugmentedRetrieveCandidates": 3.738205394, + "cortext::operations::InitializeEmbeddedCentroids": 0.001821258, + "cortext::operations::InitializeFocusPriors": 6.2012e-05, + "cortext::operations::InitializeSensitivityPriors": 0.000195024, + "cortext::operations::InitializeStabilityPriors": 0.000204762, + "cortext::operations::MemoryStorage": 0.999692396, + "cortext::operations::PersistSignalMetrics": 0.00807782, + "cortext::operations::PropagateEmotionalCascade": 0.008376438, + "cortext::operations::ResetAccumulatorAfterFlush": 0.000626586, + "cortext::operations::ResetAccumulatorOnInterrupt": 0.000149938, + "cortext::operations::UpdateAccumulator": 0.003007226, + "cortext::operations::UpdateAccumulatorScores": 0.000996934, + "cortext::operations::UpdateDriftAccumulation": 0.001362854, + "cortext::operations::UpdateEmbeddingPredictionError": 0.00223367, + "cortext::operations::UpdateFocus": 0.006021656, + "cortext::operations::UpdateMemoryStrength": 0.129651342, + "cortext::operations::UpdateMood": 0.0008375899999999999, + "cortext::operations::UpdateNeuromodulators": 0.003094144, + "cortext::operations::UpdatePrecisionDelta": 0.000409432, + "cortext::operations::UpdateRateState": 0.00072914, + "cortext::operations::UpdateRecentContext": 0.000483742, + "cortext::operations::UpdateSensitivity": 0.002603498, + "cortext::operations::UpdateSoftAnchor": 0.010506992, + "cortext::operations::UpdateStability": 0.012125406, + "cortext::operations::UpdateThreshold": 0.004257776, + "cortext::operations::UpdateUncertainty": 0.012892824, + "cortext::operations::WorkingMemory": 0.007507564 + }, + "start_event": 10139 + }, + { + "end_event_exclusive": 11139, + "mean_latency_ms": 12.01463386, + "mean_process_ms": 6.371215256, + "operation_ms": { + "SignalProcessor.begin_transaction": 0.006997744, + "SignalProcessor.commit_mutation_audit_finalize": 0.001286176, + "SignalProcessor.commit_sqlite": 0.23562861, + "SignalProcessor.commit_transaction": 0.23988073, + "SignalProcessor.finalize_episode": 0.002639424, + "SignalProcessor.persist_state": 0.018499066, + "SignalProcessor.persist_working_memory": 0.141152204, + "SignalProcessor.profile_mutation_audit": 0.03344177, + "SignalProcessor.publish_rif_active_epoch": 0.06148891, + "SignalProcessor.snapshot_cache_entry_copy": 0.0, + "SignalProcessor.snapshot_context": 0.219979744, + "SignalProcessor.snapshot_full_cache_copy": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_backfill": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_backfill_rows": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_seal": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_centroid_source": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_derived_centroid": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_overlap_pair_valid": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_overlap_profiled": 0.0, + "SignalProcessor.start_new_episode": 0.006793724, + "SignalProcessor.wm_close_stale": 0.001923236, + "SignalProcessor.wm_insert_signal_row": 0.040834586, + "SignalProcessor.wm_insert_slot_embedding": 0.014318336000000001, + "SignalProcessor.wm_insert_slot_memory": 0.0, + "SignalProcessor.wm_prune_delete": 3.34e-07, + "SignalProcessor.wm_prune_select": 0.000694914, + "SignalProcessor.wm_update_slot_memory": 0.08110341, + "cortext::operations::ApplyEmotionalConsolidation": 0.006146176, + "cortext::operations::ApplyFocusFeedback": 0.000788866, + "cortext::operations::ApplyInfluenceFeedback": 0.002936722, + "cortext::operations::ApplyMetaLearning": 0.040163002, + "cortext::operations::ApplyPredictivePreActivation": 0.08636242, + "cortext::operations::ApplyReconsolidation": 0.076873168, + "cortext::operations::ApplyRetrievalCompetition": 0.088341322, + "cortext::operations::ApplySensitivityFeedback": 0.008722588, + "cortext::operations::ApplySerialPositionEffects": 0.000709518, + "cortext::operations::ApplySerialPositionMultiplier": 0.000641964, + "cortext::operations::ApplyStabilityFeedback": 0.002616606, + "cortext::operations::ApplySynapticTagging": 0.046436006, + "cortext::operations::BuildGraphFromConsolidation": 0.00028318, + "cortext::operations::CheckSpikeBypass": 0.000831294, + "cortext::operations::CheckStreamingPacing": 0.00112561, + "cortext::operations::ComputeCoherence": 0.019199156, + "cortext::operations::ComputeCompositeScore": 0.029471062, + "cortext::operations::ComputeEffectiveFocus": 0.000590146, + "cortext::operations::ComputeFocusSpread": 0.015450994, + "cortext::operations::ComputeMetrics": 0.018656266, + "cortext::operations::ComputeMniGateDecision": 0.032483258, + "cortext::operations::ComputeWriteGate": 0.003037992, + "cortext::operations::ConsolidationCluster": 0.000246162, + "cortext::operations::ConsolidationGate": 0.000476474, + "cortext::operations::ConsolidationShallow": 0.000144686, + "cortext::operations::DetectBoundary": 0.004201914, + "cortext::operations::DetectMemoryUsage": 0.00508549, + "cortext::operations::EvaluateConsolidation": 0.000136654, + "cortext::operations::FitMetricWeightsRLS": 0.001243642, + "cortext::operations::GraphAugmentedRetrieveCandidates": 3.744861998, + "cortext::operations::InitializeEmbeddedCentroids": 0.00166807, + "cortext::operations::InitializeFocusPriors": 6.0884e-05, + "cortext::operations::InitializeSensitivityPriors": 0.000175176, + "cortext::operations::InitializeStabilityPriors": 0.00021621999999999999, + "cortext::operations::MemoryStorage": 1.018128272, + "cortext::operations::PersistSignalMetrics": 0.008013232, + "cortext::operations::PropagateEmotionalCascade": 0.024222454, + "cortext::operations::ResetAccumulatorAfterFlush": 0.001100586, + "cortext::operations::ResetAccumulatorOnInterrupt": 0.000197506, + "cortext::operations::UpdateAccumulator": 0.00319683, + "cortext::operations::UpdateAccumulatorScores": 0.001252566, + "cortext::operations::UpdateDriftAccumulation": 0.000877998, + "cortext::operations::UpdateEmbeddingPredictionError": 0.002564676, + "cortext::operations::UpdateFocus": 0.00616127, + "cortext::operations::UpdateMemoryStrength": 0.127628602, + "cortext::operations::UpdateMood": 0.0005519, + "cortext::operations::UpdateNeuromodulators": 0.003038084, + "cortext::operations::UpdatePrecisionDelta": 0.000437494, + "cortext::operations::UpdateRateState": 0.000875846, + "cortext::operations::UpdateRecentContext": 0.000539564, + "cortext::operations::UpdateSensitivity": 0.002681794, + "cortext::operations::UpdateSoftAnchor": 0.009789014, + "cortext::operations::UpdateStability": 0.015141324, + "cortext::operations::UpdateThreshold": 0.004049592, + "cortext::operations::UpdateUncertainty": 0.01295019, + "cortext::operations::WorkingMemory": 0.006991328 + }, + "start_event": 10639 + }, + { + "end_event_exclusive": 11639, + "mean_latency_ms": 9.670117078, + "mean_process_ms": 4.730029862, + "operation_ms": { + "SignalProcessor.begin_transaction": 0.004930828, + "SignalProcessor.commit_mutation_audit_finalize": 0.00099299, + "SignalProcessor.commit_sqlite": 0.192546846, + "SignalProcessor.commit_transaction": 0.195631162, + "SignalProcessor.finalize_episode": 0.001619332, + "SignalProcessor.persist_state": 0.01379474, + "SignalProcessor.persist_working_memory": 0.099734574, + "SignalProcessor.profile_mutation_audit": 0.02359343, + "SignalProcessor.publish_rif_active_epoch": 0.04819841, + "SignalProcessor.snapshot_cache_entry_copy": 0.0, + "SignalProcessor.snapshot_context": 0.164714002, + "SignalProcessor.snapshot_full_cache_copy": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_backfill": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_backfill_rows": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_seal": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_centroid_source": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_derived_centroid": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_overlap_pair_valid": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_overlap_profiled": 0.0, + "SignalProcessor.start_new_episode": 0.005106174, + "SignalProcessor.wm_close_stale": 0.001278248, + "SignalProcessor.wm_insert_signal_row": 0.033731846, + "SignalProcessor.wm_insert_slot_embedding": 0.00792941, + "SignalProcessor.wm_insert_slot_memory": 0.0, + "SignalProcessor.wm_prune_delete": 1.66e-07, + "SignalProcessor.wm_prune_select": 0.000584332, + "SignalProcessor.wm_update_slot_memory": 0.05480533, + "cortext::operations::ApplyEmotionalConsolidation": 0.004488226, + "cortext::operations::ApplyFocusFeedback": 0.000590662, + "cortext::operations::ApplyInfluenceFeedback": 0.002315676, + "cortext::operations::ApplyMetaLearning": 0.028134076, + "cortext::operations::ApplyPredictivePreActivation": 0.058209532, + "cortext::operations::ApplyReconsolidation": 0.052904558, + "cortext::operations::ApplyRetrievalCompetition": 0.062421408, + "cortext::operations::ApplySensitivityFeedback": 0.007038506, + "cortext::operations::ApplySerialPositionEffects": 0.000374004, + "cortext::operations::ApplySerialPositionMultiplier": 0.000343742, + "cortext::operations::ApplyStabilityFeedback": 0.002046734, + "cortext::operations::ApplySynapticTagging": 0.027851922, + "cortext::operations::BuildGraphFromConsolidation": 0.000180336, + "cortext::operations::CheckSpikeBypass": 0.000697896, + "cortext::operations::CheckStreamingPacing": 0.000714296, + "cortext::operations::ComputeCoherence": 0.011408998, + "cortext::operations::ComputeCompositeScore": 0.020975276, + "cortext::operations::ComputeEffectiveFocus": 0.00041261199999999997, + "cortext::operations::ComputeFocusSpread": 0.009824074, + "cortext::operations::ComputeMetrics": 0.012483074, + "cortext::operations::ComputeMniGateDecision": 0.023360254, + "cortext::operations::ComputeWriteGate": 0.002239916, + "cortext::operations::ConsolidationCluster": 0.000170584, + "cortext::operations::ConsolidationGate": 0.000359876, + "cortext::operations::ConsolidationShallow": 0.00012083, + "cortext::operations::DetectBoundary": 0.003229402, + "cortext::operations::DetectMemoryUsage": 0.004123422, + "cortext::operations::EvaluateConsolidation": 0.00010837, + "cortext::operations::FitMetricWeightsRLS": 0.000799184, + "cortext::operations::GraphAugmentedRetrieveCandidates": 2.800830114, + "cortext::operations::InitializeEmbeddedCentroids": 0.001154664, + "cortext::operations::InitializeFocusPriors": 4.324e-05, + "cortext::operations::InitializeSensitivityPriors": 0.000137846, + "cortext::operations::InitializeStabilityPriors": 0.000149918, + "cortext::operations::MemoryStorage": 0.767696598, + "cortext::operations::PersistSignalMetrics": 0.005341274, + "cortext::operations::PropagateEmotionalCascade": 0.01887274, + "cortext::operations::ResetAccumulatorAfterFlush": 0.00040814, + "cortext::operations::ResetAccumulatorOnInterrupt": 9.7024e-05, + "cortext::operations::UpdateAccumulator": 0.002215482, + "cortext::operations::UpdateAccumulatorScores": 0.000636538, + "cortext::operations::UpdateDriftAccumulation": 0.000629736, + "cortext::operations::UpdateEmbeddingPredictionError": 0.001628762, + "cortext::operations::UpdateFocus": 0.00432343, + "cortext::operations::UpdateMemoryStrength": 0.090148092, + "cortext::operations::UpdateMood": 0.000435678, + "cortext::operations::UpdateNeuromodulators": 0.002419258, + "cortext::operations::UpdatePrecisionDelta": 0.000305972, + "cortext::operations::UpdateRateState": 0.000565546, + "cortext::operations::UpdateRecentContext": 0.000373588, + "cortext::operations::UpdateSensitivity": 0.00178145, + "cortext::operations::UpdateSoftAnchor": 0.006409412, + "cortext::operations::UpdateStability": 0.009467686, + "cortext::operations::UpdateThreshold": 0.003189326, + "cortext::operations::UpdateUncertainty": 0.009219262, + "cortext::operations::WorkingMemory": 0.00499614 + }, + "start_event": 11139 + }, + { + "end_event_exclusive": 12139, + "mean_latency_ms": 9.78914892, + "mean_process_ms": 4.957158478, + "operation_ms": { + "SignalProcessor.begin_transaction": 0.005250272, + "SignalProcessor.commit_mutation_audit_finalize": 0.000947746, + "SignalProcessor.commit_sqlite": 0.184327388, + "SignalProcessor.commit_transaction": 0.187407096, + "SignalProcessor.finalize_episode": 0.002070264, + "SignalProcessor.persist_state": 0.014220242, + "SignalProcessor.persist_working_memory": 0.115681584, + "SignalProcessor.profile_mutation_audit": 0.023305838, + "SignalProcessor.publish_rif_active_epoch": 0.050346762, + "SignalProcessor.snapshot_cache_entry_copy": 0.0, + "SignalProcessor.snapshot_context": 0.178258694, + "SignalProcessor.snapshot_full_cache_copy": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_backfill": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_backfill_rows": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_seal": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_centroid_source": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_derived_centroid": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_overlap_pair_valid": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_overlap_profiled": 0.0, + "SignalProcessor.start_new_episode": 0.005233332, + "SignalProcessor.wm_close_stale": 0.00174749, + "SignalProcessor.wm_insert_signal_row": 0.032573977999999996, + "SignalProcessor.wm_insert_slot_embedding": 0.00929658, + "SignalProcessor.wm_insert_slot_memory": 0.000122418, + "SignalProcessor.wm_prune_delete": 1.66e-07, + "SignalProcessor.wm_prune_select": 0.000418668, + "SignalProcessor.wm_update_slot_memory": 0.07003892, + "cortext::operations::ApplyEmotionalConsolidation": 0.004401406, + "cortext::operations::ApplyFocusFeedback": 0.000627, + "cortext::operations::ApplyInfluenceFeedback": 0.002229, + "cortext::operations::ApplyMetaLearning": 0.029574136, + "cortext::operations::ApplyPredictivePreActivation": 0.06105893, + "cortext::operations::ApplyReconsolidation": 0.058949352, + "cortext::operations::ApplyRetrievalCompetition": 0.065120666, + "cortext::operations::ApplySensitivityFeedback": 0.006981396, + "cortext::operations::ApplySerialPositionEffects": 0.000405504, + "cortext::operations::ApplySerialPositionMultiplier": 0.000356012, + "cortext::operations::ApplyStabilityFeedback": 0.002050248, + "cortext::operations::ApplySynapticTagging": 0.016754344, + "cortext::operations::BuildGraphFromConsolidation": 0.000196734, + "cortext::operations::CheckSpikeBypass": 0.000699746, + "cortext::operations::CheckStreamingPacing": 0.000712248, + "cortext::operations::ComputeCoherence": 0.012618086, + "cortext::operations::ComputeCompositeScore": 0.021614892, + "cortext::operations::ComputeEffectiveFocus": 0.000427114, + "cortext::operations::ComputeFocusSpread": 0.010101264, + "cortext::operations::ComputeMetrics": 0.013023338, + "cortext::operations::ComputeMniGateDecision": 0.024216190000000002, + "cortext::operations::ComputeWriteGate": 0.00225349, + "cortext::operations::ConsolidationCluster": 0.000204916, + "cortext::operations::ConsolidationGate": 0.00036124, + "cortext::operations::ConsolidationShallow": 0.000140012, + "cortext::operations::DetectBoundary": 0.003362504, + "cortext::operations::DetectMemoryUsage": 0.004066598, + "cortext::operations::EvaluateConsolidation": 0.00011152, + "cortext::operations::FitMetricWeightsRLS": 0.000827768, + "cortext::operations::GraphAugmentedRetrieveCandidates": 2.964507822, + "cortext::operations::InitializeEmbeddedCentroids": 0.001300676, + "cortext::operations::InitializeFocusPriors": 4.6214e-05, + "cortext::operations::InitializeSensitivityPriors": 0.0001474, + "cortext::operations::InitializeStabilityPriors": 0.000159692, + "cortext::operations::MemoryStorage": 0.794373844, + "cortext::operations::PersistSignalMetrics": 0.004930426, + "cortext::operations::PropagateEmotionalCascade": 0.013705984, + "cortext::operations::ResetAccumulatorAfterFlush": 0.000468668, + "cortext::operations::ResetAccumulatorOnInterrupt": 0.000103168, + "cortext::operations::UpdateAccumulator": 0.002373142, + "cortext::operations::UpdateAccumulatorScores": 0.000722494, + "cortext::operations::UpdateDriftAccumulation": 0.000665182, + "cortext::operations::UpdateEmbeddingPredictionError": 0.00170556, + "cortext::operations::UpdateFocus": 0.004647756, + "cortext::operations::UpdateMemoryStrength": 0.093092654, + "cortext::operations::UpdateMood": 0.000446674, + "cortext::operations::UpdateNeuromodulators": 0.002411804, + "cortext::operations::UpdatePrecisionDelta": 0.000331612, + "cortext::operations::UpdateRateState": 0.000600662, + "cortext::operations::UpdateRecentContext": 0.000404594, + "cortext::operations::UpdateSensitivity": 0.001996584, + "cortext::operations::UpdateSoftAnchor": 0.006271078, + "cortext::operations::UpdateStability": 0.01342876, + "cortext::operations::UpdateThreshold": 0.003363754, + "cortext::operations::UpdateUncertainty": 0.009160712, + "cortext::operations::WorkingMemory": 0.005270068 + }, + "start_event": 11639 + }, + { + "end_event_exclusive": 12639, + "mean_latency_ms": 11.120387594, + "mean_process_ms": 5.059965592, + "operation_ms": { + "SignalProcessor.begin_transaction": 0.00552733, + "SignalProcessor.commit_mutation_audit_finalize": 0.000971848, + "SignalProcessor.commit_sqlite": 0.19060917, + "SignalProcessor.commit_transaction": 0.193822938, + "SignalProcessor.finalize_episode": 0.00166567, + "SignalProcessor.persist_state": 0.014337004, + "SignalProcessor.persist_working_memory": 0.121363816, + "SignalProcessor.profile_mutation_audit": 0.024478522, + "SignalProcessor.publish_rif_active_epoch": 0.051960184, + "SignalProcessor.snapshot_cache_entry_copy": 0.0, + "SignalProcessor.snapshot_context": 0.18039067, + "SignalProcessor.snapshot_full_cache_copy": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_backfill": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_backfill_rows": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_seal": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_centroid_source": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_derived_centroid": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_overlap_pair_valid": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_overlap_profiled": 0.0, + "SignalProcessor.start_new_episode": 0.005302934, + "SignalProcessor.wm_close_stale": 0.001687338, + "SignalProcessor.wm_insert_signal_row": 0.0310684, + "SignalProcessor.wm_insert_slot_embedding": 0.009668252, + "SignalProcessor.wm_insert_slot_memory": 0.0, + "SignalProcessor.wm_prune_delete": 1.418e-06, + "SignalProcessor.wm_prune_select": 0.000591918, + "SignalProcessor.wm_update_slot_memory": 0.07684541, + "cortext::operations::ApplyEmotionalConsolidation": 0.004271316, + "cortext::operations::ApplyFocusFeedback": 0.000624772, + "cortext::operations::ApplyInfluenceFeedback": 0.00254691, + "cortext::operations::ApplyMetaLearning": 0.029746398, + "cortext::operations::ApplyPredictivePreActivation": 0.062676768, + "cortext::operations::ApplyReconsolidation": 0.057731418, + "cortext::operations::ApplyRetrievalCompetition": 0.066172254, + "cortext::operations::ApplySensitivityFeedback": 0.008353664, + "cortext::operations::ApplySerialPositionEffects": 0.000412592, + "cortext::operations::ApplySerialPositionMultiplier": 0.00035678, + "cortext::operations::ApplyStabilityFeedback": 0.002376176, + "cortext::operations::ApplySynapticTagging": 0.030153982, + "cortext::operations::BuildGraphFromConsolidation": 0.00021282, + "cortext::operations::CheckSpikeBypass": 0.000717076, + "cortext::operations::CheckStreamingPacing": 0.00073657, + "cortext::operations::ComputeCoherence": 0.011667592, + "cortext::operations::ComputeCompositeScore": 0.021900814, + "cortext::operations::ComputeEffectiveFocus": 0.000422658, + "cortext::operations::ComputeFocusSpread": 0.009914326, + "cortext::operations::ComputeMetrics": 0.012542856, + "cortext::operations::ComputeMniGateDecision": 0.025074818, + "cortext::operations::ComputeWriteGate": 0.002257504, + "cortext::operations::ConsolidationCluster": 0.000183932, + "cortext::operations::ConsolidationGate": 0.000386744, + "cortext::operations::ConsolidationShallow": 0.0001297, + "cortext::operations::DetectBoundary": 0.003443572, + "cortext::operations::DetectMemoryUsage": 0.00462458, + "cortext::operations::EvaluateConsolidation": 0.000119248, + "cortext::operations::FitMetricWeightsRLS": 0.000930654, + "cortext::operations::GraphAugmentedRetrieveCandidates": 3.051071932, + "cortext::operations::InitializeEmbeddedCentroids": 0.00128868, + "cortext::operations::InitializeFocusPriors": 4.4846e-05, + "cortext::operations::InitializeSensitivityPriors": 0.000160932, + "cortext::operations::InitializeStabilityPriors": 0.000170808, + "cortext::operations::MemoryStorage": 0.775483596, + "cortext::operations::PersistSignalMetrics": 0.004751676, + "cortext::operations::PropagateEmotionalCascade": 0.012820038, + "cortext::operations::ResetAccumulatorAfterFlush": 0.000468834, + "cortext::operations::ResetAccumulatorOnInterrupt": 0.00013216, + "cortext::operations::UpdateAccumulator": 0.002353324, + "cortext::operations::UpdateAccumulatorScores": 0.000656498, + "cortext::operations::UpdateDriftAccumulation": 0.000689574, + "cortext::operations::UpdateEmbeddingPredictionError": 0.0017585979999999999, + "cortext::operations::UpdateFocus": 0.004380922, + "cortext::operations::UpdateMemoryStrength": 0.093913758, + "cortext::operations::UpdateMood": 0.00044817, + "cortext::operations::UpdateNeuromodulators": 0.002484422, + "cortext::operations::UpdatePrecisionDelta": 0.00032049, + "cortext::operations::UpdateRateState": 0.000615276, + "cortext::operations::UpdateRecentContext": 0.000413932, + "cortext::operations::UpdateSensitivity": 0.001829342, + "cortext::operations::UpdateSoftAnchor": 0.00616392, + "cortext::operations::UpdateStability": 0.013546738, + "cortext::operations::UpdateThreshold": 0.00346749, + "cortext::operations::UpdateUncertainty": 0.009193742, + "cortext::operations::WorkingMemory": 0.00480811 + }, + "start_event": 12139 + }, + { + "end_event_exclusive": 13139, + "mean_latency_ms": 9.101997846, + "mean_process_ms": 5.114735836, + "operation_ms": { + "SignalProcessor.begin_transaction": 0.004294588, + "SignalProcessor.commit_mutation_audit_finalize": 0.000911862, + "SignalProcessor.commit_sqlite": 0.183345964, + "SignalProcessor.commit_transaction": 0.186396988, + "SignalProcessor.finalize_episode": 0.001692258, + "SignalProcessor.persist_state": 0.013821092, + "SignalProcessor.persist_working_memory": 0.120010574, + "SignalProcessor.profile_mutation_audit": 0.024454768, + "SignalProcessor.publish_rif_active_epoch": 0.05248613, + "SignalProcessor.snapshot_cache_entry_copy": 0.0, + "SignalProcessor.snapshot_context": 0.153473996, + "SignalProcessor.snapshot_full_cache_copy": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_backfill": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_backfill_rows": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_seal": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_centroid_source": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_derived_centroid": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_overlap_pair_valid": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_overlap_profiled": 0.0, + "SignalProcessor.start_new_episode": 0.0046986, + "SignalProcessor.wm_close_stale": 0.001884156, + "SignalProcessor.wm_insert_signal_row": 0.032526148, + "SignalProcessor.wm_insert_slot_embedding": 0.010639152, + "SignalProcessor.wm_insert_slot_memory": 0.0, + "SignalProcessor.wm_prune_delete": 2.48e-07, + "SignalProcessor.wm_prune_select": 0.000641502, + "SignalProcessor.wm_update_slot_memory": 0.072764958, + "cortext::operations::ApplyEmotionalConsolidation": 0.004419658, + "cortext::operations::ApplyFocusFeedback": 0.000593916, + "cortext::operations::ApplyInfluenceFeedback": 0.002294476, + "cortext::operations::ApplyMetaLearning": 0.026816912000000002, + "cortext::operations::ApplyPredictivePreActivation": 0.060573742, + "cortext::operations::ApplyReconsolidation": 0.05400328, + "cortext::operations::ApplyRetrievalCompetition": 0.063310242, + "cortext::operations::ApplySensitivityFeedback": 0.007772338, + "cortext::operations::ApplySerialPositionEffects": 0.00037016400000000003, + "cortext::operations::ApplySerialPositionMultiplier": 0.000338046, + "cortext::operations::ApplyStabilityFeedback": 0.002061322, + "cortext::operations::ApplySynapticTagging": 0.039450988, + "cortext::operations::BuildGraphFromConsolidation": 0.00018992, + "cortext::operations::CheckSpikeBypass": 0.000756414, + "cortext::operations::CheckStreamingPacing": 0.000736576, + "cortext::operations::ComputeCoherence": 0.011471944, + "cortext::operations::ComputeCompositeScore": 0.02075368, + "cortext::operations::ComputeEffectiveFocus": 0.000391994, + "cortext::operations::ComputeFocusSpread": 0.010094092, + "cortext::operations::ComputeMetrics": 0.012231408, + "cortext::operations::ComputeMniGateDecision": 0.023712592, + "cortext::operations::ComputeWriteGate": 0.002179914, + "cortext::operations::ConsolidationCluster": 0.000161834, + "cortext::operations::ConsolidationGate": 0.000351326, + "cortext::operations::ConsolidationShallow": 0.00011948199999999999, + "cortext::operations::DetectBoundary": 0.003194718, + "cortext::operations::DetectMemoryUsage": 0.004216586, + "cortext::operations::EvaluateConsolidation": 0.000102314, + "cortext::operations::FitMetricWeightsRLS": 0.00077191, + "cortext::operations::GraphAugmentedRetrieveCandidates": 3.085040784, + "cortext::operations::InitializeEmbeddedCentroids": 0.001114176, + "cortext::operations::InitializeFocusPriors": 4.234e-05, + "cortext::operations::InitializeSensitivityPriors": 0.000150262, + "cortext::operations::InitializeStabilityPriors": 0.000149244, + "cortext::operations::MemoryStorage": 0.84660641, + "cortext::operations::PersistSignalMetrics": 0.00509142, + "cortext::operations::PropagateEmotionalCascade": 0.013454342, + "cortext::operations::ResetAccumulatorAfterFlush": 0.000434162, + "cortext::operations::ResetAccumulatorOnInterrupt": 0.000119914, + "cortext::operations::UpdateAccumulator": 0.002108392, + "cortext::operations::UpdateAccumulatorScores": 0.000701344, + "cortext::operations::UpdateDriftAccumulation": 0.00060812, + "cortext::operations::UpdateEmbeddingPredictionError": 0.001587018, + "cortext::operations::UpdateFocus": 0.004334754, + "cortext::operations::UpdateMemoryStrength": 0.092302158, + "cortext::operations::UpdateMood": 0.00046148, + "cortext::operations::UpdateNeuromodulators": 0.002394678, + "cortext::operations::UpdatePrecisionDelta": 0.000306234, + "cortext::operations::UpdateRateState": 0.000631488, + "cortext::operations::UpdateRecentContext": 0.00041507, + "cortext::operations::UpdateSensitivity": 0.001771762, + "cortext::operations::UpdateSoftAnchor": 0.006796158, + "cortext::operations::UpdateStability": 0.014224408000000001, + "cortext::operations::UpdateThreshold": 0.003299238, + "cortext::operations::UpdateUncertainty": 0.009318828, + "cortext::operations::WorkingMemory": 0.005251486 + }, + "start_event": 12639 + }, + { + "end_event_exclusive": 13639, + "mean_latency_ms": 9.930546234, + "mean_process_ms": 5.215054394, + "operation_ms": { + "SignalProcessor.begin_transaction": 0.005450402, + "SignalProcessor.commit_mutation_audit_finalize": 0.0009688979999999999, + "SignalProcessor.commit_sqlite": 0.192925668, + "SignalProcessor.commit_transaction": 0.196076662, + "SignalProcessor.finalize_episode": 0.001702324, + "SignalProcessor.persist_state": 0.014529686, + "SignalProcessor.persist_working_memory": 0.12280219, + "SignalProcessor.profile_mutation_audit": 0.02518724, + "SignalProcessor.publish_rif_active_epoch": 0.054745974, + "SignalProcessor.snapshot_cache_entry_copy": 0.0, + "SignalProcessor.snapshot_context": 0.17458231, + "SignalProcessor.snapshot_full_cache_copy": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_backfill": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_backfill_rows": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_seal": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_centroid_source": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_derived_centroid": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_overlap_pair_valid": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_overlap_profiled": 0.0, + "SignalProcessor.start_new_episode": 0.005660692, + "SignalProcessor.wm_close_stale": 0.001793656, + "SignalProcessor.wm_insert_signal_row": 0.031995749999999996, + "SignalProcessor.wm_insert_slot_embedding": 0.007961088, + "SignalProcessor.wm_insert_slot_memory": 0.0, + "SignalProcessor.wm_prune_delete": 4.1799999999999996e-07, + "SignalProcessor.wm_prune_select": 0.000791334, + "SignalProcessor.wm_update_slot_memory": 0.078747416, + "cortext::operations::ApplyEmotionalConsolidation": 0.00437625, + "cortext::operations::ApplyFocusFeedback": 0.000658176, + "cortext::operations::ApplyInfluenceFeedback": 0.00246409, + "cortext::operations::ApplyMetaLearning": 0.02865476, + "cortext::operations::ApplyPredictivePreActivation": 0.062864142, + "cortext::operations::ApplyReconsolidation": 0.050980014, + "cortext::operations::ApplyRetrievalCompetition": 0.065561438, + "cortext::operations::ApplySensitivityFeedback": 0.007171896, + "cortext::operations::ApplySerialPositionEffects": 0.000406724, + "cortext::operations::ApplySerialPositionMultiplier": 0.000356674, + "cortext::operations::ApplyStabilityFeedback": 0.002128488, + "cortext::operations::ApplySynapticTagging": 0.024854504, + "cortext::operations::BuildGraphFromConsolidation": 0.000193504, + "cortext::operations::CheckSpikeBypass": 0.000742132, + "cortext::operations::CheckStreamingPacing": 0.000765496, + "cortext::operations::ComputeCoherence": 0.012189914, + "cortext::operations::ComputeCompositeScore": 0.021810262, + "cortext::operations::ComputeEffectiveFocus": 0.000429928, + "cortext::operations::ComputeFocusSpread": 0.010186568, + "cortext::operations::ComputeMetrics": 0.012533584, + "cortext::operations::ComputeMniGateDecision": 0.024919806, + "cortext::operations::ComputeWriteGate": 0.002337576, + "cortext::operations::ConsolidationCluster": 0.000176792, + "cortext::operations::ConsolidationGate": 0.000367924, + "cortext::operations::ConsolidationShallow": 0.00012865, + "cortext::operations::DetectBoundary": 0.003403854, + "cortext::operations::DetectMemoryUsage": 0.00408251, + "cortext::operations::EvaluateConsolidation": 0.000110348, + "cortext::operations::FitMetricWeightsRLS": 0.0008319, + "cortext::operations::GraphAugmentedRetrieveCandidates": 3.127027926, + "cortext::operations::InitializeEmbeddedCentroids": 0.001349496, + "cortext::operations::InitializeFocusPriors": 4.7064e-05, + "cortext::operations::InitializeSensitivityPriors": 0.000155974, + "cortext::operations::InitializeStabilityPriors": 0.00017832, + "cortext::operations::MemoryStorage": 0.864972968, + "cortext::operations::PersistSignalMetrics": 0.00500715, + "cortext::operations::PropagateEmotionalCascade": 0.014663402, + "cortext::operations::ResetAccumulatorAfterFlush": 0.000417282, + "cortext::operations::ResetAccumulatorOnInterrupt": 9.3262e-05, + "cortext::operations::UpdateAccumulator": 0.002398754, + "cortext::operations::UpdateAccumulatorScores": 0.000669326, + "cortext::operations::UpdateDriftAccumulation": 0.000722328, + "cortext::operations::UpdateEmbeddingPredictionError": 0.001760156, + "cortext::operations::UpdateFocus": 0.004291428, + "cortext::operations::UpdateMemoryStrength": 0.093356414, + "cortext::operations::UpdateMood": 0.000448822, + "cortext::operations::UpdateNeuromodulators": 0.002434736, + "cortext::operations::UpdatePrecisionDelta": 0.000313318, + "cortext::operations::UpdateRateState": 0.000598166, + "cortext::operations::UpdateRecentContext": 0.00040276, + "cortext::operations::UpdateSensitivity": 0.001864428, + "cortext::operations::UpdateSoftAnchor": 0.006639504, + "cortext::operations::UpdateStability": 0.014733926, + "cortext::operations::UpdateThreshold": 0.003366154, + "cortext::operations::UpdateUncertainty": 0.009106904, + "cortext::operations::WorkingMemory": 0.005606166 + }, + "start_event": 13139 + }, + { + "end_event_exclusive": 14139, + "mean_latency_ms": 9.398130178, + "mean_process_ms": 5.222462758, + "operation_ms": { + "SignalProcessor.begin_transaction": 0.00512735, + "SignalProcessor.commit_mutation_audit_finalize": 0.001003766, + "SignalProcessor.commit_sqlite": 0.19690557, + "SignalProcessor.commit_transaction": 0.200076996, + "SignalProcessor.finalize_episode": 0.00163458, + "SignalProcessor.persist_state": 0.01373309, + "SignalProcessor.persist_working_memory": 0.119413766, + "SignalProcessor.profile_mutation_audit": 0.0250056, + "SignalProcessor.publish_rif_active_epoch": 0.056717742, + "SignalProcessor.snapshot_cache_entry_copy": 0.0, + "SignalProcessor.snapshot_context": 0.171973248, + "SignalProcessor.snapshot_full_cache_copy": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_backfill": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_backfill_rows": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_seal": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_centroid_source": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_derived_centroid": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_overlap_pair_valid": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_overlap_profiled": 0.0, + "SignalProcessor.start_new_episode": 0.005469334, + "SignalProcessor.wm_close_stale": 0.001658178, + "SignalProcessor.wm_insert_signal_row": 0.031422684, + "SignalProcessor.wm_insert_slot_embedding": 0.009132918, + "SignalProcessor.wm_insert_slot_memory": 0.0, + "SignalProcessor.wm_prune_delete": 7.52e-07, + "SignalProcessor.wm_prune_select": 0.0007432539999999999, + "SignalProcessor.wm_update_slot_memory": 0.074944556, + "cortext::operations::ApplyEmotionalConsolidation": 0.004180848, + "cortext::operations::ApplyFocusFeedback": 0.000607494, + "cortext::operations::ApplyInfluenceFeedback": 0.002236154, + "cortext::operations::ApplyMetaLearning": 0.027766954, + "cortext::operations::ApplyPredictivePreActivation": 0.06299278, + "cortext::operations::ApplyReconsolidation": 0.0519601, + "cortext::operations::ApplyRetrievalCompetition": 0.063858844, + "cortext::operations::ApplySensitivityFeedback": 0.00721918, + "cortext::operations::ApplySerialPositionEffects": 0.000416336, + "cortext::operations::ApplySerialPositionMultiplier": 0.00035518, + "cortext::operations::ApplyStabilityFeedback": 0.002032336, + "cortext::operations::ApplySynapticTagging": 0.033540606, + "cortext::operations::BuildGraphFromConsolidation": 0.00019543, + "cortext::operations::CheckSpikeBypass": 0.000720828, + "cortext::operations::CheckStreamingPacing": 0.000735348, + "cortext::operations::ComputeCoherence": 0.01167226, + "cortext::operations::ComputeCompositeScore": 0.022093186, + "cortext::operations::ComputeEffectiveFocus": 0.00045901, + "cortext::operations::ComputeFocusSpread": 0.010318512, + "cortext::operations::ComputeMetrics": 0.012978658, + "cortext::operations::ComputeMniGateDecision": 0.023974618, + "cortext::operations::ComputeWriteGate": 0.002282424, + "cortext::operations::ConsolidationCluster": 0.000173738, + "cortext::operations::ConsolidationGate": 0.000432916, + "cortext::operations::ConsolidationShallow": 0.00012656, + "cortext::operations::DetectBoundary": 0.003259668, + "cortext::operations::DetectMemoryUsage": 0.004074744, + "cortext::operations::EvaluateConsolidation": 0.000111082, + "cortext::operations::FitMetricWeightsRLS": 0.000824776, + "cortext::operations::GraphAugmentedRetrieveCandidates": 3.1766983460000002, + "cortext::operations::InitializeEmbeddedCentroids": 0.001254322, + "cortext::operations::InitializeFocusPriors": 4.4816e-05, + "cortext::operations::InitializeSensitivityPriors": 0.000162334, + "cortext::operations::InitializeStabilityPriors": 0.000171754, + "cortext::operations::MemoryStorage": 0.827148104, + "cortext::operations::PersistSignalMetrics": 0.004973566, + "cortext::operations::PropagateEmotionalCascade": 0.008597112, + "cortext::operations::ResetAccumulatorAfterFlush": 0.000441254, + "cortext::operations::ResetAccumulatorOnInterrupt": 0.000118916, + "cortext::operations::UpdateAccumulator": 0.002343696, + "cortext::operations::UpdateAccumulatorScores": 0.00068577, + "cortext::operations::UpdateDriftAccumulation": 0.000722164, + "cortext::operations::UpdateEmbeddingPredictionError": 0.0017116, + "cortext::operations::UpdateFocus": 0.00433025, + "cortext::operations::UpdateMemoryStrength": 0.092509134, + "cortext::operations::UpdateMood": 0.000446838, + "cortext::operations::UpdateNeuromodulators": 0.00237816, + "cortext::operations::UpdatePrecisionDelta": 0.000310332, + "cortext::operations::UpdateRateState": 0.00066499, + "cortext::operations::UpdateRecentContext": 0.00041851, + "cortext::operations::UpdateSensitivity": 0.001795956, + "cortext::operations::UpdateSoftAnchor": 0.0061827440000000004, + "cortext::operations::UpdateStability": 0.016283914, + "cortext::operations::UpdateThreshold": 0.00330884, + "cortext::operations::UpdateUncertainty": 0.009317504, + "cortext::operations::WorkingMemory": 0.005269354 + }, + "start_event": 13639 + }, + { + "end_event_exclusive": 14639, + "mean_latency_ms": 9.730524858, + "mean_process_ms": 5.32340413, + "operation_ms": { + "SignalProcessor.begin_transaction": 0.005506936, + "SignalProcessor.commit_mutation_audit_finalize": 0.000955246, + "SignalProcessor.commit_sqlite": 0.193649328, + "SignalProcessor.commit_transaction": 0.196732504, + "SignalProcessor.finalize_episode": 0.001737332, + "SignalProcessor.persist_state": 0.014704648, + "SignalProcessor.persist_working_memory": 0.124799094, + "SignalProcessor.profile_mutation_audit": 0.023877438, + "SignalProcessor.publish_rif_active_epoch": 0.057244778, + "SignalProcessor.snapshot_cache_entry_copy": 0.0, + "SignalProcessor.snapshot_context": 0.17784875, + "SignalProcessor.snapshot_full_cache_copy": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_backfill": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_backfill_rows": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_seal": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_centroid_source": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_derived_centroid": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_overlap_pair_valid": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_overlap_profiled": 0.0, + "SignalProcessor.start_new_episode": 0.005224354, + "SignalProcessor.wm_close_stale": 0.001690078, + "SignalProcessor.wm_insert_signal_row": 0.031854164, + "SignalProcessor.wm_insert_slot_embedding": 0.0106759, + "SignalProcessor.wm_insert_slot_memory": 0.0, + "SignalProcessor.wm_prune_delete": 3.36e-07, + "SignalProcessor.wm_prune_select": 0.000518666, + "SignalProcessor.wm_update_slot_memory": 0.078559146, + "cortext::operations::ApplyEmotionalConsolidation": 0.00423935, + "cortext::operations::ApplyFocusFeedback": 0.000621608, + "cortext::operations::ApplyInfluenceFeedback": 0.002537856, + "cortext::operations::ApplyMetaLearning": 0.029652616, + "cortext::operations::ApplyPredictivePreActivation": 0.06420483, + "cortext::operations::ApplyReconsolidation": 0.055074256, + "cortext::operations::ApplyRetrievalCompetition": 0.067040658, + "cortext::operations::ApplySensitivityFeedback": 0.008205144, + "cortext::operations::ApplySerialPositionEffects": 0.000411004, + "cortext::operations::ApplySerialPositionMultiplier": 0.000349226, + "cortext::operations::ApplyStabilityFeedback": 0.002299424, + "cortext::operations::ApplySynapticTagging": 0.016559524, + "cortext::operations::BuildGraphFromConsolidation": 0.000200828, + "cortext::operations::CheckSpikeBypass": 0.00071808, + "cortext::operations::CheckStreamingPacing": 0.000718316, + "cortext::operations::ComputeCoherence": 0.012382004, + "cortext::operations::ComputeCompositeScore": 0.022068408, + "cortext::operations::ComputeEffectiveFocus": 0.00041332, + "cortext::operations::ComputeFocusSpread": 0.010058682, + "cortext::operations::ComputeMetrics": 0.012640136, + "cortext::operations::ComputeMniGateDecision": 0.025662094, + "cortext::operations::ComputeWriteGate": 0.00236684, + "cortext::operations::ConsolidationCluster": 0.000167894, + "cortext::operations::ConsolidationGate": 0.000355604, + "cortext::operations::ConsolidationShallow": 0.000128336, + "cortext::operations::DetectBoundary": 0.003404674, + "cortext::operations::DetectMemoryUsage": 0.004510904, + "cortext::operations::EvaluateConsolidation": 0.000109836, + "cortext::operations::FitMetricWeightsRLS": 0.000852984, + "cortext::operations::GraphAugmentedRetrieveCandidates": 3.22753476, + "cortext::operations::InitializeEmbeddedCentroids": 0.001388584, + "cortext::operations::InitializeFocusPriors": 4.706e-05, + "cortext::operations::InitializeSensitivityPriors": 0.000148708, + "cortext::operations::InitializeStabilityPriors": 0.000172116, + "cortext::operations::MemoryStorage": 0.874545906, + "cortext::operations::PersistSignalMetrics": 0.005003372, + "cortext::operations::PropagateEmotionalCascade": 0.00420965, + "cortext::operations::ResetAccumulatorAfterFlush": 0.000443518, + "cortext::operations::ResetAccumulatorOnInterrupt": 0.00011088, + "cortext::operations::UpdateAccumulator": 0.002450752, + "cortext::operations::UpdateAccumulatorScores": 0.000693684, + "cortext::operations::UpdateDriftAccumulation": 0.0006811639999999999, + "cortext::operations::UpdateEmbeddingPredictionError": 0.001764846, + "cortext::operations::UpdateFocus": 0.004492854, + "cortext::operations::UpdateMemoryStrength": 0.091999316, + "cortext::operations::UpdateMood": 0.000451266, + "cortext::operations::UpdateNeuromodulators": 0.002487238, + "cortext::operations::UpdatePrecisionDelta": 0.00032043, + "cortext::operations::UpdateRateState": 0.000643668, + "cortext::operations::UpdateRecentContext": 0.00043952199999999997, + "cortext::operations::UpdateSensitivity": 0.001854976, + "cortext::operations::UpdateSoftAnchor": 0.006387448, + "cortext::operations::UpdateStability": 0.015289510000000001, + "cortext::operations::UpdateThreshold": 0.00343226, + "cortext::operations::UpdateUncertainty": 0.009345104, + "cortext::operations::WorkingMemory": 0.004654244 + }, + "start_event": 14139 + }, + { + "end_event_exclusive": 15139, + "mean_latency_ms": 10.013047888, + "mean_process_ms": 5.613154834, + "operation_ms": { + "SignalProcessor.begin_transaction": 0.005444396, + "SignalProcessor.commit_mutation_audit_finalize": 0.000983238, + "SignalProcessor.commit_sqlite": 0.207574308, + "SignalProcessor.commit_transaction": 0.211134752, + "SignalProcessor.finalize_episode": 0.001848508, + "SignalProcessor.persist_state": 0.014873796, + "SignalProcessor.persist_working_memory": 0.131412832, + "SignalProcessor.profile_mutation_audit": 0.02741906, + "SignalProcessor.publish_rif_active_epoch": 0.062820258, + "SignalProcessor.snapshot_cache_entry_copy": 0.0, + "SignalProcessor.snapshot_context": 0.178926414, + "SignalProcessor.snapshot_full_cache_copy": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_backfill": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_backfill_rows": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_seal": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_centroid_source": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_derived_centroid": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_overlap_pair_valid": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_overlap_profiled": 0.0, + "SignalProcessor.start_new_episode": 0.005566832, + "SignalProcessor.wm_close_stale": 0.001765242, + "SignalProcessor.wm_insert_signal_row": 0.035909326, + "SignalProcessor.wm_insert_slot_embedding": 0.010123748, + "SignalProcessor.wm_insert_slot_memory": 0.0, + "SignalProcessor.wm_prune_delete": 4.98e-07, + "SignalProcessor.wm_prune_select": 0.000554578, + "SignalProcessor.wm_update_slot_memory": 0.0814849, + "cortext::operations::ApplyEmotionalConsolidation": 0.004615854, + "cortext::operations::ApplyFocusFeedback": 0.000645188, + "cortext::operations::ApplyInfluenceFeedback": 0.003046584, + "cortext::operations::ApplyMetaLearning": 0.029336416, + "cortext::operations::ApplyPredictivePreActivation": 0.06456324199999999, + "cortext::operations::ApplyReconsolidation": 0.069486084, + "cortext::operations::ApplyRetrievalCompetition": 0.071501612, + "cortext::operations::ApplySensitivityFeedback": 0.009098332, + "cortext::operations::ApplySerialPositionEffects": 0.0004094, + "cortext::operations::ApplySerialPositionMultiplier": 0.000364686, + "cortext::operations::ApplyStabilityFeedback": 0.002853838, + "cortext::operations::ApplySynapticTagging": 0.038792556, + "cortext::operations::BuildGraphFromConsolidation": 0.000204766, + "cortext::operations::CheckSpikeBypass": 0.00074215, + "cortext::operations::CheckStreamingPacing": 0.000757418, + "cortext::operations::ComputeCoherence": 0.012673208, + "cortext::operations::ComputeCompositeScore": 0.023392836, + "cortext::operations::ComputeEffectiveFocus": 0.000428924, + "cortext::operations::ComputeFocusSpread": 0.010571272, + "cortext::operations::ComputeMetrics": 0.012775516, + "cortext::operations::ComputeMniGateDecision": 0.026556696, + "cortext::operations::ComputeWriteGate": 0.00241178, + "cortext::operations::ConsolidationCluster": 0.00018436, + "cortext::operations::ConsolidationGate": 0.00037200600000000003, + "cortext::operations::ConsolidationShallow": 0.000134338, + "cortext::operations::DetectBoundary": 0.003849116, + "cortext::operations::DetectMemoryUsage": 0.004995946, + "cortext::operations::EvaluateConsolidation": 0.000116372, + "cortext::operations::FitMetricWeightsRLS": 0.00092544, + "cortext::operations::GraphAugmentedRetrieveCandidates": 3.382445936, + "cortext::operations::InitializeEmbeddedCentroids": 0.001321652, + "cortext::operations::InitializeFocusPriors": 5.2088e-05, + "cortext::operations::InitializeSensitivityPriors": 0.000154294, + "cortext::operations::InitializeStabilityPriors": 0.000190992, + "cortext::operations::MemoryStorage": 0.904745472, + "cortext::operations::PersistSignalMetrics": 0.00504107, + "cortext::operations::PropagateEmotionalCascade": 0.014349088, + "cortext::operations::ResetAccumulatorAfterFlush": 0.00050476, + "cortext::operations::ResetAccumulatorOnInterrupt": 0.000142164, + "cortext::operations::UpdateAccumulator": 0.002515762, + "cortext::operations::UpdateAccumulatorScores": 0.000731098, + "cortext::operations::UpdateDriftAccumulation": 0.000708802, + "cortext::operations::UpdateEmbeddingPredictionError": 0.001830486, + "cortext::operations::UpdateFocus": 0.004683024, + "cortext::operations::UpdateMemoryStrength": 0.099690386, + "cortext::operations::UpdateMood": 0.000459814, + "cortext::operations::UpdateNeuromodulators": 0.002387304, + "cortext::operations::UpdatePrecisionDelta": 0.000364346, + "cortext::operations::UpdateRateState": 0.000707588, + "cortext::operations::UpdateRecentContext": 0.000432054, + "cortext::operations::UpdateSensitivity": 0.001880928, + "cortext::operations::UpdateSoftAnchor": 0.006809652, + "cortext::operations::UpdateStability": 0.015966254, + "cortext::operations::UpdateThreshold": 0.003622912, + "cortext::operations::UpdateUncertainty": 0.010046918, + "cortext::operations::WorkingMemory": 0.005273854 + }, + "start_event": 14639 + }, + { + "end_event_exclusive": 15639, + "mean_latency_ms": 11.27346614, + "mean_process_ms": 5.62863843, + "operation_ms": { + "SignalProcessor.begin_transaction": 0.00551352, + "SignalProcessor.commit_mutation_audit_finalize": 0.000973414, + "SignalProcessor.commit_sqlite": 0.213788082, + "SignalProcessor.commit_transaction": 0.217005742, + "SignalProcessor.finalize_episode": 0.001967576, + "SignalProcessor.persist_state": 0.015474658, + "SignalProcessor.persist_working_memory": 0.134103826, + "SignalProcessor.profile_mutation_audit": 0.026484844, + "SignalProcessor.publish_rif_active_epoch": 0.063302086, + "SignalProcessor.snapshot_cache_entry_copy": 0.0, + "SignalProcessor.snapshot_context": 0.177394976, + "SignalProcessor.snapshot_full_cache_copy": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_backfill": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_backfill_rows": 0.0, + "SignalProcessor.sqlite_sparse_route_ordinary_seal": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_centroid_source": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_derived_centroid": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_overlap_pair_valid": 0.0, + "SignalProcessor.sqlite_sparse_route_recenter_overlap_profiled": 0.0, + "SignalProcessor.start_new_episode": 0.00567384, + "SignalProcessor.wm_close_stale": 0.001840244, + "SignalProcessor.wm_insert_signal_row": 0.034799398, + "SignalProcessor.wm_insert_slot_embedding": 0.00802626, + "SignalProcessor.wm_insert_slot_memory": 0.0, + "SignalProcessor.wm_prune_delete": 3.32e-07, + "SignalProcessor.wm_prune_select": 0.000705418, + "SignalProcessor.wm_update_slot_memory": 0.087152378, + "cortext::operations::ApplyEmotionalConsolidation": 0.004388392, + "cortext::operations::ApplyFocusFeedback": 0.000631076, + "cortext::operations::ApplyInfluenceFeedback": 0.002541426, + "cortext::operations::ApplyMetaLearning": 0.030022522, + "cortext::operations::ApplyPredictivePreActivation": 0.06626409, + "cortext::operations::ApplyReconsolidation": 0.057164728, + "cortext::operations::ApplyRetrievalCompetition": 0.06699169, + "cortext::operations::ApplySensitivityFeedback": 0.008960068, + "cortext::operations::ApplySerialPositionEffects": 0.000414338, + "cortext::operations::ApplySerialPositionMultiplier": 0.000359844, + "cortext::operations::ApplyStabilityFeedback": 0.0022660000000000002, + "cortext::operations::ApplySynapticTagging": 0.0366974, + "cortext::operations::BuildGraphFromConsolidation": 0.00021584, + "cortext::operations::CheckSpikeBypass": 0.000763676, + "cortext::operations::CheckStreamingPacing": 0.00076943, + "cortext::operations::ComputeCoherence": 0.012880768, + "cortext::operations::ComputeCompositeScore": 0.02295527, + "cortext::operations::ComputeEffectiveFocus": 0.00052145, + "cortext::operations::ComputeFocusSpread": 0.011291826, + "cortext::operations::ComputeMetrics": 0.013073896, + "cortext::operations::ComputeMniGateDecision": 0.02558484, + "cortext::operations::ComputeWriteGate": 0.002337246, + "cortext::operations::ConsolidationCluster": 0.000181, + "cortext::operations::ConsolidationGate": 0.000384672, + "cortext::operations::ConsolidationShallow": 0.00013437, + "cortext::operations::DetectBoundary": 0.003574144, + "cortext::operations::DetectMemoryUsage": 0.004529916, + "cortext::operations::EvaluateConsolidation": 0.000112266, + "cortext::operations::FitMetricWeightsRLS": 0.000826576, + "cortext::operations::GraphAugmentedRetrieveCandidates": 3.38563551, + "cortext::operations::InitializeEmbeddedCentroids": 0.00141468, + "cortext::operations::InitializeFocusPriors": 4.8676e-05, + "cortext::operations::InitializeSensitivityPriors": 0.000152478, + "cortext::operations::InitializeStabilityPriors": 0.000167242, + "cortext::operations::MemoryStorage": 0.934161146, + "cortext::operations::PersistSignalMetrics": 0.005043818, + "cortext::operations::PropagateEmotionalCascade": 0.012806086, + "cortext::operations::ResetAccumulatorAfterFlush": 0.000484584, + "cortext::operations::ResetAccumulatorOnInterrupt": 0.000121186, + "cortext::operations::UpdateAccumulator": 0.002474818, + "cortext::operations::UpdateAccumulatorScores": 0.000720404, + "cortext::operations::UpdateDriftAccumulation": 0.000730004, + "cortext::operations::UpdateEmbeddingPredictionError": 0.001786168, + "cortext::operations::UpdateFocus": 0.00447417, + "cortext::operations::UpdateMemoryStrength": 0.096403262, + "cortext::operations::UpdateMood": 0.000458324, + "cortext::operations::UpdateNeuromodulators": 0.00255682, + "cortext::operations::UpdatePrecisionDelta": 0.000326728, + "cortext::operations::UpdateRateState": 0.000681242, + "cortext::operations::UpdateRecentContext": 0.00045130400000000003, + "cortext::operations::UpdateSensitivity": 0.001912002, + "cortext::operations::UpdateSoftAnchor": 0.006424916, + "cortext::operations::UpdateStability": 0.016357497999999998, + "cortext::operations::UpdateThreshold": 0.003458228, + "cortext::operations::UpdateUncertainty": 0.009559332, + "cortext::operations::WorkingMemory": 0.005152532 + }, + "start_event": 15139 + } + ] + }, + "attribution_passed": true, + "behavior_sha256": "d92273190ea4b8305430d62664b61110cd48b9de7ac098ec8647984374034f79", + "flatness": [ + { + "bootstrap_95_upper_ms_per_message": 6.106373902e-05, + "final_five_mean_ms": 0.8811147192000001, + "final_five_over_first_five": 2.4378889646213997, + "first_five_mean_ms": 0.3614252872, + "operation": "cortext::operations::MemoryStorage", + "passed": false, + "theil_sen_ms_per_message": 5.257304442857143e-05, + "window_count": 25 + }, + { + "bootstrap_95_upper_ms_per_message": 5.863888581965812e-05, + "final_five_mean_ms": 0.7596046652, + "final_five_over_first_five": 3.071510257202646, + "first_five_mean_ms": 0.2473065696, + "operation": "MemoryStorage.supersession_edges", + "passed": false, + "theil_sen_ms_per_message": 5.167798822222222e-05, + "window_count": 25 + } + ], + "flatness_passed": false, + "legacy_latency_throughput": { + "final_five_mean_messages_per_second": 99.6892946743436, + "final_five_mean_process_ms": 5.4005429092, + "final_five_over_first_five_messages_per_second": 0.7481656127155062, + "final_five_over_first_five_process": 1.8358799201260285, + "first_five_mean_messages_per_second": 133.24495670486124, + "first_five_mean_process_ms": 2.9416645664, + "passed": false, + "window_count": 25 + }, + "legacy_latency_throughput_passed": false, + "logical_database_sha256": "8655933de15c74f890c112116457384b6db3342992961f2da82ca14ff7c21d07", + "logical_table_counts": { + "associations": 6515, + "memories": 3263, + "signals": 28504 + }, + "mean_process_ms": 3.8346852091111816, + "mean_total_ms": 8.657719102962737, + "plateau": null, + "plateau_passed": false, + "processed_events": 15695, + "schema": "cortext_storage_cost_profile_audit_v3", + "wall_ms": 144082 +} diff --git a/artifacts/flat_storage_cost/sqlite-hnsw-activation-snapshot-knob-ablation-v1.json b/artifacts/flat_storage_cost/sqlite-hnsw-activation-snapshot-knob-ablation-v1.json new file mode 100644 index 00000000..2e391d7b --- /dev/null +++ b/artifacts/flat_storage_cost/sqlite-hnsw-activation-snapshot-knob-ablation-v1.json @@ -0,0 +1,1171 @@ +{ + "schema": "cortext_sqlite_hnsw_knob_ablation_v6", + "status": "passed-nine-quality-points-with-evaluated-and-explicit-below-threshold-route-states", + "source_head": "16f6b950d0d33599e93aa398a01cbdeee32ee4c1", + "source_sha256": { + "src/operations/sparse_retrieval_knobs_internal.hpp": "faa17665386287d001bb384df787a4856bb15b811e0f129451bd7fc071e8904b", + "src/operations/sparse_retrieval_route_internal.hpp": "05885e3e7918f049e20ed03c66c62d41c21c1a3cd805ebee443c11dcf02e32ac", + "src/operations/sparse_retrieval_route_internal.cpp": "89b062d4966354d4c67202e545dcee654999542069b5dee12b7e55d4fab16f22", + "src/operations/sparse_retrieval_route_sqlite_internal.hpp": "1a1c8ffc5122d468f1ff8958d66c9fbef69dfa44eaf10c12fc151e5469c00a89", + "src/operations/sparse_retrieval_route_sqlite_internal.cpp": "03846f611f7a5641a84dd842a3086cafe7ccb3a1deae5bcc1e6a44ea4131945d", + "src/operations/rif_active_epoch_cache_internal.hpp": "0a8676749f8e18c3d97a679b0c1d3cbdb98b95d4a4b56624656431246e3322a9", + "src/operations/historical_surface_search_cache_internal.hpp": "ac6b21d91b501a734a5fce0deed3a5637b8ecc2a3442daca375191edb28fa74f", + "src/operations/graph_retrieval.cpp": "3d2024dba4113a044c93f625e0ba9976c192b3a0c55a2d9b34f6e69f02605b67", + "src/operations/memory_storage.cpp": "f302bcd16d981602801bbc5ad30261a793a5a4b775a7a26384faf0956e7e2f54", + "src/cortext.cpp": "2d8aaf0f85280240349dc85eae2fdfd9cac17a6bbeec3d7589568ec9aa8ef615", + "src/signal_processor.cpp": "a2869641e1f116206cee15cfcd64b7f5dd6d26e121124460a3427b2823f2c589", + "tests/operations_graph_retrieval.test.cpp": "8e3906fec0f4694c751d601d261b784e75b231a0d9c1c57ca5e498c7b6e618b5", + "tests/operations_memory_storage.test.cpp": "d7f6e840e50fd58cb9fbe421263360b8db04a716acc2fa267511f09356bc973a", + "tests/cortext.test.cpp": "379ab790f37e1746079377dd9f34520852caa0e97a3c7ce16169197db1b679d2", + "tests/signal_processor.test.cpp": "dea1103dd688ffc194ed782c04d4650a7913a76d801bf322c9f581dedc47dfb2", + "examples/benchmark/chat_replay_live_run.cpp": "89297f9f562115f9804fa6e8253724ab1850c694ad6cb1e12eba54be600e69d8", + "tools/audit_public_retrieval_control.py": "e1aff8adff790257bd68134df0480dc0082b31051bff279c2dda01f07f97e71f", + "tools/audit_storage_cost_profile.py": "354aa20ace2db10eb3f8ef82d5590da97fdb721a9200eeb7a0f178d834e0c064", + "tools/build_sqlite_hnsw_knob_ablation.py": "54ffc643609028a972e8039531a13581a7a07ab191fc2ef7a7db49a8a42d770f" + }, + "execution_identity": { + "benchmark_binary": { + "target": "cortext_chat_replay_live_run", + "filename": "cortext_chat_replay_live_run", + "sha256": "e547c12db7912b9a0dc0f1788c5b234c44a0323ba95097c86cfe90e6df60cd83", + "size_bytes": 6043008 + }, + "test_binary": { + "target": "cortext_tests", + "filename": "cortext_tests", + "sha256": "05d4ec9e60605fa52bc0736aba1fd5f070d3be6e84db20ca9119fc5442ca6380", + "size_bytes": 10632384 + }, + "identity_contract": "Every profile and retained SQLite topology database was generated by the benchmark binary named here; every JUnit artifact was generated by the test binary named here. The aggregate content-addresses all binaries, profiles, audits, databases, and XML results." + }, + "corpus": { + "kind": "owner-authorized-private-claude-jsonl-derived-sentence-packets", + "processed_events_per_run": 4000, + "sha256": "17a447f237ff7dd1b732eca1a0f31e908b89b2ffdd20ae8b32df2e719a0271a2" + }, + "formulas": { + "route_capacity": "C = lround(256 + 256*clamp(F) + 128*clamp(S) + 128*clamp(T))", + "backfill_batch_size": "B = lround(64 + 64*clamp(F) + 32*clamp(S) + 32*clamp(T))", + "fallback_hydration_signal_limit": "B recent indexed signal rows per hydrated memory", + "graph_neighbor_count": "max(8, B / 2)", + "graph_level_zero_links": "max(16, C / 4)", + "maximum_level": "ceil(log2(C))", + "reciprocal_update_count_per_level": "max(2, B / 16)", + "centroid_identity_quota": "max(2, B / 16), shared with the reciprocal-update budget", + "hnsw_construction_effort": "max(32, lround(C * 25 / 64))", + "hnsw_query_effort": "max(C, lround(C * 5 / 2))", + "bootstrap_limit": "2 * C", + "activation_identity_target": "2 * C + 2 * B retained activated identities per public search", + "activation_snapshot_capacity": "A identities persisted by consolidation and exactly compared without displacing canonical HNSW candidates", + "total_query_row_budget": "5 * C + A, with canonical HNSW and consolidation-snapshot rows recorded separately", + "search_node_budget": "5 * C hard ceiling per public activation", + "activation_search_node_budget_min": "5 * C hard ceiling at route open and after successful consolidation recenter", + "activation_search_node_budget_step": "0; consolidation changes the centroid, not the work envelope", + "search_expansion_batch": "max(8, B / 4)", + "search_effort": "5 * C fixed per public activation", + "activation_search_effort_min": "5 * C at route open and after successful consolidation recenter", + "activation_search_effort_step": "0; consolidation changes the centroid, not the work envelope", + "retrieval_cycle_edge_samples": "max(2, B / 32) retrieval-active queries per phase edge", + "shadow_cache_capacity": "24 * C", + "backfill_search_node_budget": "C + B", + "backfill_search_effort": "2 * B", + "historical_backfill_drain_limit": "B ordered rows per successful construction edge", + "historical_backfill_overflow_probe_limit": "logical B + 1 boundary: process B ordered entries, then test whether the in-memory iterator has another entry; no B + 1 row is read or processed", + "dirty_identity_drain_limit": "C per successful construction edge", + "dirty_identity_overflow_probe_limit": "C + 1 identities read only to detect overflow", + "route_metadata_open_row_limit": 1 + }, + "structural_invariants": { + "persisted_hnsw_hierarchy_count": 1, + "route_metadata_open_row_count": 1, + "runtime_hierarchy_required_for_sparse_route_traversed": true, + "successful_recenter_required_for_route_lifecycle_evaluated": true, + "whole_engine_restart_bounded": false, + "classification": "fixed SQLite representation, with all operational work limits knob-derived" + }, + "structural_grid": { + "focus_values": [ + 0.0, + 0.5, + 1.0 + ], + "sensitivity_values": [ + 0.0, + 0.5, + 1.0 + ], + "stability_values": [ + 0.0, + 0.5, + 1.0 + ], + "configuration_count": 27, + "passed": true, + "result_artifact": "sanitized/cortext-centroid-grid-v9-structural-junit.xml", + "result_sha256": "92e3841b3f342f793bf69a3b8a713735ebb5e5f0d3f39a97f45db232950a8c7a", + "assertions": 1160, + "failures": 0, + "errors": 0, + "test_binary": { + "target": "cortext_tests", + "filename": "cortext_tests", + "sha256": "05d4ec9e60605fa52bc0736aba1fd5f070d3be6e84db20ca9119fc5442ca6380", + "size_bytes": 10632384 + } + }, + "direct_regressions": { + "bounded_dirty_backfill_and_live_journal": { + "result_artifact": "sanitized/cortext-centroid-grid-v9-backfill-junit.xml", + "result_sha256": "36e8038033fcedfde4dfb7dfbd245d346e2aa6aefb9b89072362e69cb9bbd105", + "assertions": 1234, + "failures": 0, + "errors": 0, + "test_binary": { + "target": "cortext_tests", + "filename": "cortext_tests", + "sha256": "05d4ec9e60605fa52bc0736aba1fd5f070d3be6e84db20ca9119fc5442ca6380", + "size_bytes": 10632384 + } + }, + "route_metadata_open": { + "result_artifact": "sanitized/cortext-centroid-grid-v9-restart-junit.xml", + "result_sha256": "74fb158d7b2a3ca95ccc3d2ec676ab2f066499f209b1b29cf068ed2c4da070bc", + "assertions": 615, + "failures": 0, + "errors": 0, + "test_binary": { + "target": "cortext_tests", + "filename": "cortext_tests", + "sha256": "05d4ec9e60605fa52bc0736aba1fd5f070d3be6e84db20ca9119fc5442ca6380", + "size_bytes": 10632384 + } + }, + "core_knob_endpoints": { + "result_artifact": "sanitized/cortext-centroid-grid-v9-core-knob-junit.xml", + "result_sha256": "0f6de0dc0ee915561d8f324ae791228a3e0902a23b88951b4374c1722a5c11c3", + "assertions": 393, + "failures": 0, + "errors": 0, + "test_binary": { + "target": "cortext_tests", + "filename": "cortext_tests", + "sha256": "05d4ec9e60605fa52bc0736aba1fd5f070d3be6e84db20ca9119fc5442ca6380", + "size_bytes": 10632384 + } + }, + "active_route_source_modality_label_invariance": { + "result_artifact": "sanitized/cortext-centroid-grid-v9-invariance-junit.xml", + "result_sha256": "4d0bb2a6de89eb5df2c00a30a46768898d9e8a9f14df0a0aaf038eab60b101f8", + "assertions": 23, + "failures": 0, + "errors": 0, + "test_binary": { + "target": "cortext_tests", + "filename": "cortext_tests", + "sha256": "05d4ec9e60605fa52bc0736aba1fd5f070d3be6e84db20ca9119fc5442ca6380", + "size_bytes": 10632384 + } + } + }, + "system_quality_contract": { + "queries_per_run": 512, + "result_k": 16, + "exact_identity_recall_at_k_min": 0.998, + "exact_top1_per_run_min": 0.998046875, + "exact_top1_per_run_max_misses": 1, + "exact_top1_nine_run_aggregate_min": 0.999, + "semantic_coverage_min": 0.95, + "deterministic_tie_order_required": true, + "minimum_opaque_source_ids": 4, + "modalities": [ + "text" + ], + "modality_agnostic_proof": "active_route_source_modality_label_invariance" + }, + "experiments": [ + { + "id": "all-low", + "knobs": [ + 0.0, + 0.0, + 0.0 + ], + "resolved": { + "backfill_batch_size": 64, + "fallback_hydration_signal_limit": 64, + "backfill_search_effort": 128, + "backfill_search_node_budget": 320, + "bootstrap_limit": 512, + "graph_level_zero_links": 64, + "graph_neighbor_count": 32, + "family_exact_comparison_limit": 512, + "hnsw_construction_effort": 100, + "hnsw_query_effort": 640, + "maximum_level": 8, + "reciprocal_update_count": 4, + "route_capacity": 256, + "activation_identity_target": 640, + "activation_snapshot_capacity": 640, + "total_query_row_budget": 1920, + "activation_search_effort_min": 1280, + "activation_search_effort_step": 0, + "activation_search_node_budget_min": 1280, + "activation_search_node_budget_step": 0, + "search_effort": 1280, + "search_expansion_batch": 16, + "search_node_budget": 1280, + "shadow_cache_capacity": 6144, + "historical_backfill_drain_limit": 64, + "historical_backfill_overflow_probe_limit": 65, + "dirty_identity_drain_limit": 256, + "dirty_identity_overflow_probe_limit": 257 + }, + "active_epoch_limits": { + "event_count": 256, + "mutation_count": 16384, + "allocated_bytes": 33554432, + "row_batch_size": 64 + }, + "observed": { + "sqlite_sparse_route_event_count": 1505, + "maximum_activated_identities": 640.0, + "activation_identity_target": 640, + "maximum_search_node_rows": 1242.0, + "maximum_activation_snapshot_rows": 640.0, + "maximum_total_query_rows": 1882.0, + "maximum_dynamic_search_node_budget": 1280.0, + "successful_activation_reset_count": 25, + "cluster_centroid_reset_count": 25, + "active_signal_ring_centroid_reset_count": 0, + "valid_activation_overlap_count": 25, + "changed_activation_set_count": 19, + "minimum_activation_overlap_ratio": 0.4328125, + "maximum_activation_overlap_ratio": 1.0, + "maximum_route_metadata_open_rows": 1.0, + "maximum_backfill_rows": 0, + "total_backfill_rows": 0, + "maximum_fallback_hydration_signal_rows": 770.0, + "fallback_hydration_signal_limit": 64.0, + "backfill_failures": 0, + "search_failure_events": 0, + "consolidation_runs": 28, + "processed_events": 4000, + "wall_ms": 65134, + "mean_process_ms": 6.925114982500005, + "mean_total_ms": 15.822381741750004, + "peak_rss_mb": 10631.125, + "exact_identity_recall_at_16": 0.9996275605214152, + "exact_top1": 0.998046875, + "exact_top1_hits": 511, + "exact_top1_miss_count": 1, + "top1_miss_fingerprints": [ + { + "control_top1_age_events": 536, + "control_top1_age_ms": 536000, + "modality": "text", + "query_ordinal": 503, + "query_progress_quartile": 3, + "source_id_blake3": "97efc7f0cf8b0250ec39b28edfb58de6751a930d0a405d2de2ce2f44593e168c" + } + ], + "semantic_coverage": 0.9578653971354162, + "observed_max_level": 6, + "node_rows": 1910, + "upper_level_node_rows": 498, + "remaining_dirty_rows": 45, + "published_max_level": 6, + "published_active_count": 1910, + "published_generation": 1, + "upper_level_nonempty_adjacency_rows": 498, + "maximum_upper_level_adjacency_degree": 80 + }, + "quality_class": "route-lifecycle-evaluated-system-quality-passed", + "profile": "private/raw/cortext-centroid-grid-v10-all-low.json", + "profile_sha256": "b9d0c4c42c190206c68904fba7073fe6bfc83d637a6e544a8ba0f85c3d8f7915", + "audit": "sanitized/cortext-centroid-grid-v10-all-low-audit.json", + "audit_sha256": "cf050d1f623f9a4274bf3d9d2a4fdf8a2fc1a7c4c83b8ca0fcfd03263305b228", + "database": "private/raw/cortext-centroid-grid-v10-all-low.sqlite", + "db_sha256": "4ec5495123173e931942a390971f9ea6689285188bb7231a638e4e17206690bf", + "benchmark_binary": { + "target": "cortext_chat_replay_live_run", + "filename": "cortext_chat_replay_live_run", + "sha256": "e547c12db7912b9a0dc0f1788c5b234c44a0323ba95097c86cfe90e6df60cd83", + "size_bytes": 6043008 + } + }, + { + "id": "midpoint", + "knobs": [ + 0.5, + 0.5, + 0.5 + ], + "resolved": { + "backfill_batch_size": 128, + "fallback_hydration_signal_limit": 128, + "backfill_search_effort": 256, + "backfill_search_node_budget": 640, + "bootstrap_limit": 1024, + "graph_level_zero_links": 128, + "graph_neighbor_count": 64, + "family_exact_comparison_limit": 1024, + "hnsw_construction_effort": 200, + "hnsw_query_effort": 1280, + "maximum_level": 9, + "reciprocal_update_count": 8, + "route_capacity": 512, + "activation_identity_target": 1280, + "activation_snapshot_capacity": 1280, + "total_query_row_budget": 3840, + "activation_search_effort_min": 2560, + "activation_search_effort_step": 0, + "activation_search_node_budget_min": 2560, + "activation_search_node_budget_step": 0, + "search_effort": 2560, + "search_expansion_batch": 32, + "search_node_budget": 2560, + "shadow_cache_capacity": 12288, + "historical_backfill_drain_limit": 128, + "historical_backfill_overflow_probe_limit": 129, + "dirty_identity_drain_limit": 512, + "dirty_identity_overflow_probe_limit": 513 + }, + "active_epoch_limits": { + "event_count": 512, + "mutation_count": 32768, + "allocated_bytes": 67108864, + "row_batch_size": 128 + }, + "observed": { + "sqlite_sparse_route_event_count": 587, + "maximum_activated_identities": 1280.0, + "activation_identity_target": 1280, + "maximum_search_node_rows": 522.0, + "maximum_activation_snapshot_rows": 1280.0, + "maximum_total_query_rows": 1736.0, + "maximum_dynamic_search_node_budget": 2560.0, + "successful_activation_reset_count": 22, + "cluster_centroid_reset_count": 0, + "active_signal_ring_centroid_reset_count": 22, + "valid_activation_overlap_count": 22, + "changed_activation_set_count": 8, + "minimum_activation_overlap_ratio": 0.934375, + "maximum_activation_overlap_ratio": 1.0, + "maximum_route_metadata_open_rows": 1.0, + "maximum_backfill_rows": 0, + "total_backfill_rows": 0, + "maximum_fallback_hydration_signal_rows": 525.0, + "fallback_hydration_signal_limit": 128.0, + "backfill_failures": 0, + "search_failure_events": 0, + "consolidation_runs": 29, + "processed_events": 4000, + "wall_ms": 49259, + "mean_process_ms": 3.962435151499996, + "mean_total_ms": 11.831425379499981, + "peak_rss_mb": 10567.203125, + "exact_identity_recall_at_16": 1.0, + "exact_top1": 1.0, + "exact_top1_hits": 512, + "exact_top1_miss_count": 0, + "top1_miss_fingerprints": [], + "semantic_coverage": 1.0, + "observed_max_level": 5, + "node_rows": 1736, + "upper_level_node_rows": 445, + "remaining_dirty_rows": 52, + "published_max_level": 5, + "published_active_count": 1736, + "published_generation": 1, + "upper_level_nonempty_adjacency_rows": 445, + "maximum_upper_level_adjacency_degree": 146 + }, + "quality_class": "route-lifecycle-evaluated-system-quality-passed", + "profile": "private/raw/cortext-centroid-grid-v10-midpoint.json", + "profile_sha256": "2fc08f810f5ec7cca999a9b4aa43962f0cca31b5e0c3f2338e07b4d6ed678422", + "audit": "sanitized/cortext-centroid-grid-v10-midpoint-audit.json", + "audit_sha256": "8f65385afec8945e691145c837a0e42bbc88f436168a2193132be449b838f61d", + "database": "private/raw/cortext-centroid-grid-v10-midpoint.sqlite", + "db_sha256": "58551e5b49228e804b97d134e723eaad56729fa16b32acf2da63e3d64ecbe38e", + "benchmark_binary": { + "target": "cortext_chat_replay_live_run", + "filename": "cortext_chat_replay_live_run", + "sha256": "e547c12db7912b9a0dc0f1788c5b234c44a0323ba95097c86cfe90e6df60cd83", + "size_bytes": 6043008 + } + }, + { + "id": "all-high", + "knobs": [ + 1.0, + 1.0, + 1.0 + ], + "resolved": { + "backfill_batch_size": 192, + "fallback_hydration_signal_limit": 192, + "backfill_search_effort": 384, + "backfill_search_node_budget": 960, + "bootstrap_limit": 1536, + "graph_level_zero_links": 192, + "graph_neighbor_count": 96, + "family_exact_comparison_limit": 1536, + "hnsw_construction_effort": 300, + "hnsw_query_effort": 1920, + "maximum_level": 10, + "reciprocal_update_count": 12, + "route_capacity": 768, + "activation_identity_target": 1920, + "activation_snapshot_capacity": 1920, + "total_query_row_budget": 5760, + "activation_search_effort_min": 3840, + "activation_search_effort_step": 0, + "activation_search_node_budget_min": 3840, + "activation_search_node_budget_step": 0, + "search_effort": 3840, + "search_expansion_batch": 48, + "search_node_budget": 3840, + "shadow_cache_capacity": 18432, + "historical_backfill_drain_limit": 192, + "historical_backfill_overflow_probe_limit": 193, + "dirty_identity_drain_limit": 768, + "dirty_identity_overflow_probe_limit": 769 + }, + "active_epoch_limits": { + "event_count": 768, + "mutation_count": 49152, + "allocated_bytes": 100663296, + "row_batch_size": 192 + }, + "observed": { + "sqlite_sparse_route_event_count": 186, + "maximum_activated_identities": 1425.0, + "activation_identity_target": 1920, + "maximum_search_node_rows": 722.0, + "maximum_activation_snapshot_rows": 1365.0, + "maximum_total_query_rows": 1365.0, + "maximum_dynamic_search_node_budget": 3840.0, + "successful_activation_reset_count": 9, + "cluster_centroid_reset_count": 0, + "active_signal_ring_centroid_reset_count": 9, + "valid_activation_overlap_count": 9, + "changed_activation_set_count": 0, + "minimum_activation_overlap_ratio": 1.0, + "maximum_activation_overlap_ratio": 1.0, + "maximum_route_metadata_open_rows": 1.0, + "maximum_backfill_rows": 0, + "total_backfill_rows": 0, + "maximum_fallback_hydration_signal_rows": 15.0, + "fallback_hydration_signal_limit": 192.0, + "backfill_failures": 0, + "search_failure_events": 0, + "consolidation_runs": 17, + "processed_events": 4000, + "wall_ms": 62222, + "mean_process_ms": 10.399138594999982, + "mean_total_ms": 15.160645547749988, + "peak_rss_mb": 10598.671875, + "exact_identity_recall_at_16": 1.0, + "exact_top1": 1.0, + "exact_top1_hits": 512, + "exact_top1_miss_count": 0, + "top1_miss_fingerprints": [], + "semantic_coverage": 1.0, + "observed_max_level": 5, + "node_rows": 1365, + "upper_level_node_rows": 348, + "remaining_dirty_rows": 69, + "published_max_level": 5, + "published_active_count": 1365, + "published_generation": 1, + "upper_level_nonempty_adjacency_rows": 348, + "maximum_upper_level_adjacency_degree": 162 + }, + "quality_class": "route-lifecycle-evaluated-system-quality-passed", + "profile": "private/raw/cortext-centroid-grid-v10-all-high.json", + "profile_sha256": "10989734dd6988c22a90b98bea3da4cfad1866fafea22c350bf19d3e7e73e085", + "audit": "sanitized/cortext-centroid-grid-v10-all-high-audit.json", + "audit_sha256": "2d9a1d2d18e640d134915225b8f86d95950beab34312fcb30731d4d3336e0c56", + "database": "private/raw/cortext-centroid-grid-v10-all-high.sqlite", + "db_sha256": "af9556ac03300b3bbefb05b347ab9f1f42f0ef37e0878ca2fd0b5cf43b15119f", + "benchmark_binary": { + "target": "cortext_chat_replay_live_run", + "filename": "cortext_chat_replay_live_run", + "sha256": "e547c12db7912b9a0dc0f1788c5b234c44a0323ba95097c86cfe90e6df60cd83", + "size_bytes": 6043008 + } + }, + { + "id": "focus-low", + "knobs": [ + 0.0, + 0.5, + 0.5 + ], + "resolved": { + "backfill_batch_size": 96, + "fallback_hydration_signal_limit": 96, + "backfill_search_effort": 192, + "backfill_search_node_budget": 480, + "bootstrap_limit": 768, + "graph_level_zero_links": 96, + "graph_neighbor_count": 48, + "family_exact_comparison_limit": 768, + "hnsw_construction_effort": 150, + "hnsw_query_effort": 960, + "maximum_level": 9, + "reciprocal_update_count": 6, + "route_capacity": 384, + "activation_identity_target": 960, + "activation_snapshot_capacity": 960, + "total_query_row_budget": 2880, + "activation_search_effort_min": 1920, + "activation_search_effort_step": 0, + "activation_search_node_budget_min": 1920, + "activation_search_node_budget_step": 0, + "search_effort": 1920, + "search_expansion_batch": 24, + "search_node_budget": 1920, + "shadow_cache_capacity": 9216, + "historical_backfill_drain_limit": 96, + "historical_backfill_overflow_probe_limit": 97, + "dirty_identity_drain_limit": 384, + "dirty_identity_overflow_probe_limit": 385 + }, + "active_epoch_limits": { + "event_count": 384, + "mutation_count": 24576, + "allocated_bytes": 50331648, + "row_batch_size": 96 + }, + "observed": { + "sqlite_sparse_route_event_count": 1047, + "maximum_activated_identities": 960.0, + "activation_identity_target": 960, + "maximum_search_node_rows": 1008.0, + "maximum_activation_snapshot_rows": 960.0, + "maximum_total_query_rows": 1968.0, + "maximum_dynamic_search_node_budget": 1920.0, + "successful_activation_reset_count": 33, + "cluster_centroid_reset_count": 0, + "active_signal_ring_centroid_reset_count": 33, + "valid_activation_overlap_count": 33, + "changed_activation_set_count": 21, + "minimum_activation_overlap_ratio": 0.8114583333333333, + "maximum_activation_overlap_ratio": 1.0, + "maximum_route_metadata_open_rows": 1.0, + "maximum_backfill_rows": 0, + "total_backfill_rows": 0, + "maximum_fallback_hydration_signal_rows": 421.0, + "fallback_hydration_signal_limit": 96.0, + "backfill_failures": 0, + "search_failure_events": 0, + "consolidation_runs": 40, + "processed_events": 4000, + "wall_ms": 54002, + "mean_process_ms": 5.541320305249996, + "mean_total_ms": 12.984821234000005, + "peak_rss_mb": 10604.734375, + "exact_identity_recall_at_16": 1.0, + "exact_top1": 1.0, + "exact_top1_hits": 512, + "exact_top1_miss_count": 0, + "top1_miss_fingerprints": [], + "semantic_coverage": 0.9605102539062501, + "observed_max_level": 5, + "node_rows": 1968, + "upper_level_node_rows": 515, + "remaining_dirty_rows": 50, + "published_max_level": 5, + "published_active_count": 1968, + "published_generation": 1, + "upper_level_nonempty_adjacency_rows": 515, + "maximum_upper_level_adjacency_degree": 114 + }, + "quality_class": "route-lifecycle-evaluated-system-quality-passed", + "profile": "private/raw/cortext-centroid-grid-v10-f-low.json", + "profile_sha256": "8edcf8e6f36848ef06f03f3bd958312b9409c082dcd9ce7d7950834f706f4554", + "audit": "sanitized/cortext-centroid-grid-v10-f-low-audit.json", + "audit_sha256": "0e13ee16450c8040e6daee15415dc92a250ed4854af2c19c2dbf12a3bd0763da", + "database": "private/raw/cortext-centroid-grid-v10-f-low.sqlite", + "db_sha256": "276ee524e6b6adb7dc33fe67c6bbcec0f2563f8e4198aae8331a66c8152868dd", + "benchmark_binary": { + "target": "cortext_chat_replay_live_run", + "filename": "cortext_chat_replay_live_run", + "sha256": "e547c12db7912b9a0dc0f1788c5b234c44a0323ba95097c86cfe90e6df60cd83", + "size_bytes": 6043008 + } + }, + { + "id": "focus-high", + "knobs": [ + 1.0, + 0.5, + 0.5 + ], + "resolved": { + "backfill_batch_size": 160, + "fallback_hydration_signal_limit": 160, + "backfill_search_effort": 320, + "backfill_search_node_budget": 800, + "bootstrap_limit": 1280, + "graph_level_zero_links": 160, + "graph_neighbor_count": 80, + "family_exact_comparison_limit": 1280, + "hnsw_construction_effort": 250, + "hnsw_query_effort": 1600, + "maximum_level": 10, + "reciprocal_update_count": 10, + "route_capacity": 640, + "activation_identity_target": 1600, + "activation_snapshot_capacity": 1600, + "total_query_row_budget": 4800, + "activation_search_effort_min": 3200, + "activation_search_effort_step": 0, + "activation_search_node_budget_min": 3200, + "activation_search_node_budget_step": 0, + "search_effort": 3200, + "search_expansion_batch": 40, + "search_node_budget": 3200, + "shadow_cache_capacity": 15360, + "historical_backfill_drain_limit": 160, + "historical_backfill_overflow_probe_limit": 161, + "dirty_identity_drain_limit": 640, + "dirty_identity_overflow_probe_limit": 641 + }, + "active_epoch_limits": { + "event_count": 640, + "mutation_count": 40960, + "allocated_bytes": 83886080, + "row_batch_size": 160 + }, + "observed": { + "sqlite_sparse_route_event_count": 91, + "maximum_activated_identities": 1514.0, + "activation_identity_target": 1600, + "maximum_search_node_rows": 600.0, + "maximum_activation_snapshot_rows": 1490.0, + "maximum_total_query_rows": 1490.0, + "maximum_dynamic_search_node_budget": 3200.0, + "successful_activation_reset_count": 14, + "cluster_centroid_reset_count": 0, + "active_signal_ring_centroid_reset_count": 14, + "valid_activation_overlap_count": 14, + "changed_activation_set_count": 0, + "minimum_activation_overlap_ratio": 1.0, + "maximum_activation_overlap_ratio": 1.0, + "maximum_route_metadata_open_rows": 1.0, + "maximum_backfill_rows": 0, + "total_backfill_rows": 0, + "maximum_fallback_hydration_signal_rows": 284.0, + "fallback_hydration_signal_limit": 160.0, + "backfill_failures": 0, + "search_failure_events": 0, + "consolidation_runs": 23, + "processed_events": 4000, + "wall_ms": 40895, + "mean_process_ms": 2.98514754225, + "mean_total_ms": 9.767675884500015, + "peak_rss_mb": 10518.984375, + "exact_identity_recall_at_16": 1.0, + "exact_top1": 1.0, + "exact_top1_hits": 512, + "exact_top1_miss_count": 0, + "top1_miss_fingerprints": [], + "semantic_coverage": 1.0, + "observed_max_level": 5, + "node_rows": 1490, + "upper_level_node_rows": 378, + "remaining_dirty_rows": 27, + "published_max_level": 5, + "published_active_count": 1490, + "published_generation": 1, + "upper_level_nonempty_adjacency_rows": 378, + "maximum_upper_level_adjacency_degree": 146 + }, + "quality_class": "route-lifecycle-evaluated-system-quality-passed", + "profile": "private/raw/cortext-centroid-grid-v10-f-high.json", + "profile_sha256": "312d2fa3aa6a69e877b15df64abd43443424f53573f2d5bd34e0a2b48aae15ba", + "audit": "sanitized/cortext-centroid-grid-v10-f-high-audit.json", + "audit_sha256": "224ebfb4d8c708dd74f45815432941a15e2d1fde657abb3d350a607292e8523b", + "database": "private/raw/cortext-centroid-grid-v10-f-high.sqlite", + "db_sha256": "fb899ecfd0d9d9b3afef0a813e9fb2f6dd51e0b8b2f7bb03a6f1b18bc8b62703", + "benchmark_binary": { + "target": "cortext_chat_replay_live_run", + "filename": "cortext_chat_replay_live_run", + "sha256": "e547c12db7912b9a0dc0f1788c5b234c44a0323ba95097c86cfe90e6df60cd83", + "size_bytes": 6043008 + } + }, + { + "id": "sensitivity-low", + "knobs": [ + 0.5, + 0.0, + 0.5 + ], + "resolved": { + "backfill_batch_size": 112, + "fallback_hydration_signal_limit": 112, + "backfill_search_effort": 224, + "backfill_search_node_budget": 560, + "bootstrap_limit": 896, + "graph_level_zero_links": 112, + "graph_neighbor_count": 56, + "family_exact_comparison_limit": 896, + "hnsw_construction_effort": 175, + "hnsw_query_effort": 1120, + "maximum_level": 9, + "reciprocal_update_count": 7, + "route_capacity": 448, + "activation_identity_target": 1120, + "activation_snapshot_capacity": 1120, + "total_query_row_budget": 3360, + "activation_search_effort_min": 2240, + "activation_search_effort_step": 0, + "activation_search_node_budget_min": 2240, + "activation_search_node_budget_step": 0, + "search_effort": 2240, + "search_expansion_batch": 28, + "search_node_budget": 2240, + "shadow_cache_capacity": 10752, + "historical_backfill_drain_limit": 112, + "historical_backfill_overflow_probe_limit": 113, + "dirty_identity_drain_limit": 448, + "dirty_identity_overflow_probe_limit": 449 + }, + "active_epoch_limits": { + "event_count": 448, + "mutation_count": 28672, + "allocated_bytes": 58720256, + "row_batch_size": 112 + }, + "observed": { + "sqlite_sparse_route_event_count": 0, + "maximum_activated_identities": 0.0, + "activation_identity_target": 1120, + "maximum_search_node_rows": 0.0, + "maximum_activation_snapshot_rows": 0.0, + "maximum_total_query_rows": 0.0, + "maximum_dynamic_search_node_budget": 0.0, + "successful_activation_reset_count": 0, + "cluster_centroid_reset_count": 0, + "active_signal_ring_centroid_reset_count": 0, + "valid_activation_overlap_count": 0, + "changed_activation_set_count": 0, + "minimum_activation_overlap_ratio": null, + "maximum_activation_overlap_ratio": null, + "maximum_route_metadata_open_rows": 0.0, + "maximum_backfill_rows": 0, + "total_backfill_rows": 0, + "maximum_fallback_hydration_signal_rows": 692.0, + "fallback_hydration_signal_limit": 112.0, + "backfill_failures": 0, + "search_failure_events": 0, + "consolidation_runs": 28, + "processed_events": 4000, + "wall_ms": 38969, + "mean_process_ms": 1.6281483722500012, + "mean_total_ms": 9.43976964424999, + "peak_rss_mb": 10468.9375, + "exact_identity_recall_at_16": 1.0, + "exact_top1": 1.0, + "exact_top1_hits": 512, + "exact_top1_miss_count": 0, + "top1_miss_fingerprints": [], + "semantic_coverage": 1.0, + "observed_max_level": 6, + "node_rows": 395, + "upper_level_node_rows": 107, + "remaining_dirty_rows": 64, + "published_max_level": 6, + "published_active_count": 395, + "published_generation": 1, + "upper_level_nonempty_adjacency_rows": 107, + "maximum_upper_level_adjacency_degree": 77 + }, + "quality_class": "system-quality-passed-published-below-threshold-sparse-route-unevaluated", + "profile": "private/raw/cortext-centroid-grid-v10-s-low.json", + "profile_sha256": "78e02af0aff8db8733a7d0e03874dbd01fa626e959174aae0e1d27c0a1615548", + "audit": "sanitized/cortext-centroid-grid-v10-s-low-audit.json", + "audit_sha256": "e483609d12b9c7e26d4aabe2b3f80f0e48dbfb93dff25d38fcef011587f7224c", + "database": "private/raw/cortext-centroid-grid-v10-s-low.sqlite", + "db_sha256": "db40029426530548a583ba6a38bf0d2ea01d87fea255eb6510abc699128a9e3e", + "benchmark_binary": { + "target": "cortext_chat_replay_live_run", + "filename": "cortext_chat_replay_live_run", + "sha256": "e547c12db7912b9a0dc0f1788c5b234c44a0323ba95097c86cfe90e6df60cd83", + "size_bytes": 6043008 + } + }, + { + "id": "sensitivity-high", + "knobs": [ + 0.5, + 1.0, + 0.5 + ], + "resolved": { + "backfill_batch_size": 144, + "fallback_hydration_signal_limit": 144, + "backfill_search_effort": 288, + "backfill_search_node_budget": 720, + "bootstrap_limit": 1152, + "graph_level_zero_links": 144, + "graph_neighbor_count": 72, + "family_exact_comparison_limit": 1152, + "hnsw_construction_effort": 225, + "hnsw_query_effort": 1440, + "maximum_level": 10, + "reciprocal_update_count": 9, + "route_capacity": 576, + "activation_identity_target": 1440, + "activation_snapshot_capacity": 1440, + "total_query_row_budget": 4320, + "activation_search_effort_min": 2880, + "activation_search_effort_step": 0, + "activation_search_node_budget_min": 2880, + "activation_search_node_budget_step": 0, + "search_effort": 2880, + "search_expansion_batch": 36, + "search_node_budget": 2880, + "shadow_cache_capacity": 13824, + "historical_backfill_drain_limit": 144, + "historical_backfill_overflow_probe_limit": 145, + "dirty_identity_drain_limit": 576, + "dirty_identity_overflow_probe_limit": 577 + }, + "active_epoch_limits": { + "event_count": 576, + "mutation_count": 36864, + "allocated_bytes": 75497472, + "row_batch_size": 144 + }, + "observed": { + "sqlite_sparse_route_event_count": 692, + "maximum_activated_identities": 1440.0, + "activation_identity_target": 1440, + "maximum_search_node_rows": 590.0, + "maximum_activation_snapshot_rows": 1440.0, + "maximum_total_query_rows": 1870.0, + "maximum_dynamic_search_node_budget": 2880.0, + "successful_activation_reset_count": 19, + "cluster_centroid_reset_count": 0, + "active_signal_ring_centroid_reset_count": 19, + "valid_activation_overlap_count": 19, + "changed_activation_set_count": 7, + "minimum_activation_overlap_ratio": 0.9479166666666666, + "maximum_activation_overlap_ratio": 1.0, + "maximum_route_metadata_open_rows": 1.0, + "maximum_backfill_rows": 0, + "total_backfill_rows": 0, + "maximum_fallback_hydration_signal_rows": 622.0, + "fallback_hydration_signal_limit": 144.0, + "backfill_failures": 0, + "search_failure_events": 0, + "consolidation_runs": 26, + "processed_events": 4000, + "wall_ms": 138539, + "mean_process_ms": 25.341923406500015, + "mean_total_ms": 34.18377571500003, + "peak_rss_mb": 10582.765625, + "exact_identity_recall_at_16": 1.0, + "exact_top1": 1.0, + "exact_top1_hits": 512, + "exact_top1_miss_count": 0, + "top1_miss_fingerprints": [], + "semantic_coverage": 1.0, + "observed_max_level": 5, + "node_rows": 1870, + "upper_level_node_rows": 487, + "remaining_dirty_rows": 72, + "published_max_level": 5, + "published_active_count": 1870, + "published_generation": 1, + "upper_level_nonempty_adjacency_rows": 487, + "maximum_upper_level_adjacency_degree": 144 + }, + "quality_class": "route-lifecycle-evaluated-system-quality-passed", + "profile": "private/raw/cortext-centroid-grid-v10-s-high.json", + "profile_sha256": "7037644f0c7c53dc2f7d08fab7654f9b9b0bc0665bbed7458f7ab5cfec6cde9a", + "audit": "sanitized/cortext-centroid-grid-v10-s-high-audit.json", + "audit_sha256": "c4505cef6fa7162954a3aa9c2a73ab9932ee65ba0c0e4d8bd342a2cbaf4d1dc4", + "database": "private/raw/cortext-centroid-grid-v10-s-high.sqlite", + "db_sha256": "6873fe31f3810d5a0cb317d5c08199d2c02e3da2ac10555f6f3c9660fa8b93ad", + "benchmark_binary": { + "target": "cortext_chat_replay_live_run", + "filename": "cortext_chat_replay_live_run", + "sha256": "e547c12db7912b9a0dc0f1788c5b234c44a0323ba95097c86cfe90e6df60cd83", + "size_bytes": 6043008 + } + }, + { + "id": "stability-low", + "knobs": [ + 0.5, + 0.5, + 0.0 + ], + "resolved": { + "backfill_batch_size": 112, + "fallback_hydration_signal_limit": 112, + "backfill_search_effort": 224, + "backfill_search_node_budget": 560, + "bootstrap_limit": 896, + "graph_level_zero_links": 112, + "graph_neighbor_count": 56, + "family_exact_comparison_limit": 896, + "hnsw_construction_effort": 175, + "hnsw_query_effort": 1120, + "maximum_level": 9, + "reciprocal_update_count": 7, + "route_capacity": 448, + "activation_identity_target": 1120, + "activation_snapshot_capacity": 1120, + "total_query_row_budget": 3360, + "activation_search_effort_min": 2240, + "activation_search_effort_step": 0, + "activation_search_node_budget_min": 2240, + "activation_search_node_budget_step": 0, + "search_effort": 2240, + "search_expansion_batch": 28, + "search_node_budget": 2240, + "shadow_cache_capacity": 10752, + "historical_backfill_drain_limit": 112, + "historical_backfill_overflow_probe_limit": 113, + "dirty_identity_drain_limit": 448, + "dirty_identity_overflow_probe_limit": 449 + }, + "active_epoch_limits": { + "event_count": 448, + "mutation_count": 28672, + "allocated_bytes": 58720256, + "row_batch_size": 112 + }, + "observed": { + "sqlite_sparse_route_event_count": 1369, + "maximum_activated_identities": 1120.0, + "activation_identity_target": 1120, + "maximum_search_node_rows": 865.0, + "maximum_activation_snapshot_rows": 1120.0, + "maximum_total_query_rows": 1985.0, + "maximum_dynamic_search_node_budget": 2240.0, + "successful_activation_reset_count": 14, + "cluster_centroid_reset_count": 14, + "active_signal_ring_centroid_reset_count": 0, + "valid_activation_overlap_count": 14, + "changed_activation_set_count": 8, + "minimum_activation_overlap_ratio": 0.8491071428571428, + "maximum_activation_overlap_ratio": 1.0, + "maximum_route_metadata_open_rows": 1.0, + "maximum_backfill_rows": 0, + "total_backfill_rows": 0, + "maximum_fallback_hydration_signal_rows": 639.0, + "fallback_hydration_signal_limit": 112.0, + "backfill_failures": 0, + "search_failure_events": 0, + "consolidation_runs": 17, + "processed_events": 4000, + "wall_ms": 54879, + "mean_process_ms": 5.02626250599999, + "mean_total_ms": 13.322114759249972, + "peak_rss_mb": 10595.15625, + "exact_identity_recall_at_16": 1.0, + "exact_top1": 1.0, + "exact_top1_hits": 512, + "exact_top1_miss_count": 0, + "top1_miss_fingerprints": [], + "semantic_coverage": 1.0, + "observed_max_level": 5, + "node_rows": 1985, + "upper_level_node_rows": 521, + "remaining_dirty_rows": 25, + "published_max_level": 5, + "published_active_count": 1985, + "published_generation": 1, + "upper_level_nonempty_adjacency_rows": 521, + "maximum_upper_level_adjacency_degree": 112 + }, + "quality_class": "route-lifecycle-evaluated-system-quality-passed", + "profile": "private/raw/cortext-centroid-grid-v10-t-low.json", + "profile_sha256": "dfad6f03c7e98b287a29c9e6707b641621e98980fa8c0869b0d58ec03c043bea", + "audit": "sanitized/cortext-centroid-grid-v10-t-low-audit.json", + "audit_sha256": "b80769ad679b49c92db1a2bea945ab24f803e922793c4e637452be6b22f05cfe", + "database": "private/raw/cortext-centroid-grid-v10-t-low.sqlite", + "db_sha256": "d9f82ebbfb981ac100130c350e8ba2f31a334cb41f1911f5273d194adb3ed34e", + "benchmark_binary": { + "target": "cortext_chat_replay_live_run", + "filename": "cortext_chat_replay_live_run", + "sha256": "e547c12db7912b9a0dc0f1788c5b234c44a0323ba95097c86cfe90e6df60cd83", + "size_bytes": 6043008 + } + }, + { + "id": "stability-high", + "knobs": [ + 0.5, + 0.5, + 1.0 + ], + "resolved": { + "backfill_batch_size": 144, + "fallback_hydration_signal_limit": 144, + "backfill_search_effort": 288, + "backfill_search_node_budget": 720, + "bootstrap_limit": 1152, + "graph_level_zero_links": 144, + "graph_neighbor_count": 72, + "family_exact_comparison_limit": 1152, + "hnsw_construction_effort": 225, + "hnsw_query_effort": 1440, + "maximum_level": 10, + "reciprocal_update_count": 9, + "route_capacity": 576, + "activation_identity_target": 1440, + "activation_snapshot_capacity": 1440, + "total_query_row_budget": 4320, + "activation_search_effort_min": 2880, + "activation_search_effort_step": 0, + "activation_search_node_budget_min": 2880, + "activation_search_node_budget_step": 0, + "search_effort": 2880, + "search_expansion_batch": 36, + "search_node_budget": 2880, + "shadow_cache_capacity": 13824, + "historical_backfill_drain_limit": 144, + "historical_backfill_overflow_probe_limit": 145, + "dirty_identity_drain_limit": 576, + "dirty_identity_overflow_probe_limit": 577 + }, + "active_epoch_limits": { + "event_count": 576, + "mutation_count": 36864, + "allocated_bytes": 75497472, + "row_batch_size": 144 + }, + "observed": { + "sqlite_sparse_route_event_count": 710, + "maximum_activated_identities": 1440.0, + "activation_identity_target": 1440, + "maximum_search_node_rows": 543.0, + "maximum_activation_snapshot_rows": 1440.0, + "maximum_total_query_rows": 1775.0, + "maximum_dynamic_search_node_budget": 2880.0, + "successful_activation_reset_count": 10, + "cluster_centroid_reset_count": 0, + "active_signal_ring_centroid_reset_count": 10, + "valid_activation_overlap_count": 10, + "changed_activation_set_count": 3, + "minimum_activation_overlap_ratio": 0.9472222222222222, + "maximum_activation_overlap_ratio": 1.0, + "maximum_route_metadata_open_rows": 1.0, + "maximum_backfill_rows": 0, + "total_backfill_rows": 0, + "maximum_fallback_hydration_signal_rows": 604.0, + "fallback_hydration_signal_limit": 144.0, + "backfill_failures": 0, + "search_failure_events": 0, + "consolidation_runs": 14, + "processed_events": 4000, + "wall_ms": 50300, + "mean_process_ms": 3.8355747237500037, + "mean_total_ms": 12.203855887499977, + "peak_rss_mb": 10539.390625, + "exact_identity_recall_at_16": 1.0, + "exact_top1": 1.0, + "exact_top1_hits": 512, + "exact_top1_miss_count": 0, + "top1_miss_fingerprints": [], + "semantic_coverage": 1.0, + "observed_max_level": 5, + "node_rows": 1775, + "upper_level_node_rows": 457, + "remaining_dirty_rows": 12, + "published_max_level": 5, + "published_active_count": 1775, + "published_generation": 1, + "upper_level_nonempty_adjacency_rows": 457, + "maximum_upper_level_adjacency_degree": 150 + }, + "quality_class": "route-lifecycle-evaluated-system-quality-passed", + "profile": "private/raw/cortext-centroid-grid-v10-t-high.json", + "profile_sha256": "027a34b0ae951339ca1ce8b1412dd664b363dbac49874bc7e8139bfbf440a005", + "audit": "sanitized/cortext-centroid-grid-v10-t-high-audit.json", + "audit_sha256": "71f50acdc29a0813ebd6d03169935e9612baaa4c0a527a7083f117c9fd39e9c9", + "database": "private/raw/cortext-centroid-grid-v10-t-high.sqlite", + "db_sha256": "93a28e257c970c175b6f20c3a9e16e73a0e9c2428ff333f7ad5e1d79741915bf", + "benchmark_binary": { + "target": "cortext_chat_replay_live_run", + "filename": "cortext_chat_replay_live_run", + "sha256": "e547c12db7912b9a0dc0f1788c5b234c44a0323ba95097c86cfe90e6df60cd83", + "size_bytes": 6043008 + } + } + ], + "aggregate": { + "run_count": 9, + "system_quality_query_count": 4608, + "system_quality_pass_count": 9, + "route_lifecycle_evaluated_run_count": 8, + "route_lifecycle_unevaluated_run_count": 1, + "valid_activation_overlap_count": 146, + "changed_activation_set_count": 66, + "changed_activation_set_run_count": 6, + "sparse_route_quality_separately_materialized": false, + "sparse_route_quality_pass_count": null, + "sparse_route_traversed_recenter_unproven_run_count": 0, + "published_below_threshold_route_unevaluated_run_count": 1, + "exact_top1_min": 0.998046875, + "exact_top1_aggregate": 0.9997829861111112, + "exact_top1_aggregate_hits": 4607, + "exact_top1_aggregate_queries": 4608, + "exact_top1_aggregate_misses": 1, + "exact_top1_miss_cluster_audit": { + "passed": true, + "status": "misses-unclustered", + "miss_count": 1, + "cluster_definition": "two or more exact top-1 misses sharing a modality, opaque source, memory-age quartile, or exact F/S/T point", + "maximum_bucket_counts": { + "modality": 1, + "source_id": 1, + "memory_age_quartile": 1, + "knob_point": 1 + }, + "clustered_dimensions": [], + "misses": [ + { + "control_top1_age_events": 536, + "control_top1_age_ms": 536000, + "modality": "text", + "query_ordinal": 503, + "query_progress_quartile": 3, + "source_id_blake3": "97efc7f0cf8b0250ec39b28edfb58de6751a930d0a405d2de2ce2f44593e168c", + "run_id": "all-low", + "knobs": [ + 0.0, + 0.0, + 0.0 + ], + "memory_age_quartile": 0 + } + ] + }, + "exact_identity_recall_at_16_min": 0.9996275605214152, + "semantic_coverage_min": 0.9578653971354162, + "maximum_route_metadata_open_rows": 1.0, + "maximum_backfill_failure_count": 0, + "maximum_search_failure_event_count": 0, + "all_activation_identity_targets_respected": true, + "all_route_lifecycle_evaluated_runs_have_runtime_upper_levels": true, + "all_resolved_parameters_embedded_in_raw_profiles": true, + "all_system_quality_contracts_passed": true + }, + "limits": [ + "Whole-engine latency is not an HNSW-only measure because F, S, and T also change admission, consolidation frequency, and surface evolution.", + "A route lifecycle is evaluated only after both nonzero SQLite node visits and a successful consolidation recenter. The retained quality audit is whole-system quality and does not separately materialize a route-active query subset.", + "The route metadata open reads one row, but SignalProcessor startup still hydrates the complete current memory surface and therefore remains O(history). The route restart regression is not whole-engine bounded-restart proof.", + "The corpus matrix uses text ingress with four opaque source identifiers. Modality agnosticism is proved separately by the active SQLite-route label-invariance regression over text, audio, and image labels, so no fabricated media ingress is used in the corpus audit.", + "This 4,000-event matrix proves knob derivation, local work ceilings, bounded durable dirty drainage, explicit route-lifecycle or below-threshold classification at every point, accepted whole-system quality, and\u2014through the separate active-route regression\u2014source/modality label invariance. A below-threshold point is not promoted to route-lifecycle evidence. It does not prove route-only quality, bounded whole-engine restart, the full 15,695-event plateau, or production-wide boundedness." + ], + "production_cutover": false +} diff --git a/artifacts/flat_storage_cost/sqlite-hnsw-production-sawtooth-knob-ablation-v2.json b/artifacts/flat_storage_cost/sqlite-hnsw-production-sawtooth-knob-ablation-v2.json new file mode 100644 index 00000000..3ee61fa1 --- /dev/null +++ b/artifacts/flat_storage_cost/sqlite-hnsw-production-sawtooth-knob-ablation-v2.json @@ -0,0 +1,1146 @@ +{ + "schema": "cortext_sqlite_hnsw_knob_ablation_v7", + "status": "passed-production-default-nine-quality-points-with-explicit-route-maturity-classification", + "source_head": "16f6b950d0d33599e93aa398a01cbdeee32ee4c1", + "source_sha256": { + "src/operations/sparse_retrieval_knobs_internal.hpp": "f9e12ad7b97b5865f023327e4d0e470eb826b791baa6c52b98ec62a68c52ebcb", + "src/operations/sparse_retrieval_route_internal.hpp": "05885e3e7918f049e20ed03c66c62d41c21c1a3cd805ebee443c11dcf02e32ac", + "src/operations/sparse_retrieval_route_internal.cpp": "89b062d4966354d4c67202e545dcee654999542069b5dee12b7e55d4fab16f22", + "src/operations/sparse_retrieval_route_sqlite_internal.hpp": "e0a0de7ebf68d3c0cefb864b61dd09b7cf3076551d5fa63a0e0f97037cfe3a38", + "src/operations/sparse_retrieval_route_sqlite_internal.cpp": "aa202fc648ba26f83ca9c9e395889509c561af66d559eaab7444dcb0de1ad943", + "src/operations/rif_active_epoch_cache_internal.hpp": "0a8676749f8e18c3d97a679b0c1d3cbdb98b95d4a4b56624656431246e3322a9", + "src/operations/historical_surface_search_cache_internal.hpp": "ac6b21d91b501a734a5fce0deed3a5637b8ecc2a3442daca375191edb28fa74f", + "src/operations/graph_retrieval.cpp": "3d2024dba4113a044c93f625e0ba9976c192b3a0c55a2d9b34f6e69f02605b67", + "src/operations/memory_storage.cpp": "f302bcd16d981602801bbc5ad30261a793a5a4b775a7a26384faf0956e7e2f54", + "src/cortext.cpp": "2d8aaf0f85280240349dc85eae2fdfd9cac17a6bbeec3d7589568ec9aa8ef615", + "src/signal_processor.cpp": "a2869641e1f116206cee15cfcd64b7f5dd6d26e121124460a3427b2823f2c589", + "tests/operations_graph_retrieval.test.cpp": "7d2f1decd12535461de28cbdaa65d3b885be9abddf7535c8b7ee8b085a10342e", + "tests/operations_memory_storage.test.cpp": "d7f6e840e50fd58cb9fbe421263360b8db04a716acc2fa267511f09356bc973a", + "tests/cortext.test.cpp": "379ab790f37e1746079377dd9f34520852caa0e97a3c7ce16169197db1b679d2", + "tests/signal_processor.test.cpp": "dea1103dd688ffc194ed782c04d4650a7913a76d801bf322c9f581dedc47dfb2", + "examples/benchmark/chat_replay_live_run.cpp": "12e2ffaa60b0c3ba2dd8e1c212c5b1daa1c61114351ac6cbc0c07270a4f22d9c", + "tools/audit_public_retrieval_control.py": "e1aff8adff790257bd68134df0480dc0082b31051bff279c2dda01f07f97e71f", + "tools/audit_storage_cost_profile.py": "c95fca14ed4ccbfb7ec92b551f0b3a7048b08b42f9e4c98535284398fa01293a", + "tools/build_sqlite_hnsw_knob_ablation.py": "f38fc33f14030fc6a808812dc819ee9779fa3998399a1bf8c68b04d80b2b6b6c" + }, + "execution_identity": { + "benchmark_binary": { + "target": "cortext_chat_replay_live_run", + "filename": "cortext_chat_replay_live_run", + "sha256": "5e884ca9f7749f57b3ba2817b7525a378a261d8fd1ce501a3f215c5e551884cd", + "size_bytes": 6043424 + }, + "test_binary": { + "target": "cortext_tests", + "filename": "cortext_tests", + "sha256": "942f429a28562454563b599d08e8afac4c34feef4908d163a1bd6770de24d8a3", + "size_bytes": 10665904 + }, + "identity_contract": "Every profile and retained SQLite topology database was generated by the benchmark binary named here; every JUnit artifact was generated by the test binary named here. The aggregate content-addresses all binaries, profiles, audits, databases, and XML results." + }, + "corpus": { + "kind": "owner-authorized-private-claude-jsonl-derived-sentence-packets", + "processed_events_per_run": 4000, + "sha256": "17a447f237ff7dd1b732eca1a0f31e908b89b2ffdd20ae8b32df2e719a0271a2" + }, + "formulas": { + "route_capacity": "C = lround(256 + 256*clamp(F) + 128*clamp(S) + 128*clamp(T))", + "backfill_batch_size": "B = lround(64 + 64*clamp(F) + 32*clamp(S) + 32*clamp(T))", + "fallback_hydration_signal_limit": "B recent indexed signal rows per hydrated memory", + "graph_neighbor_count": "max(8, B / 2)", + "graph_level_zero_links": "max(16, C / 4)", + "maximum_level": "ceil(log2(C))", + "reciprocal_update_count_per_level": "max(2, B / 16)", + "centroid_identity_quota": "max(2, B / 16), shared with the reciprocal-update budget", + "hnsw_construction_effort": "max(32, lround(C * 25 / 64))", + "hnsw_query_effort": "max(C, lround(C * 5 / 2))", + "bootstrap_limit": "2 * C", + "activation_identity_target": "2 * C + 2 * B retained activated identities per public search", + "activation_snapshot_capacity": "A identities persisted by consolidation and exactly compared without displacing canonical HNSW candidates", + "total_query_row_budget": "9 * C + A, with canonical HNSW and consolidation-snapshot rows recorded separately", + "search_node_budget": "9 * C hard ceiling per public activation", + "activation_search_node_budget_min": "8 * C at route open and after successful consolidation recenter", + "activation_search_node_budget_step": "max(2, B / 16) per public activation until the 9 * C ceiling", + "search_expansion_batch": "max(8, B / 4)", + "search_effort": "9 * C hard ceiling per public activation", + "activation_search_effort_min": "8 * C at route open and after successful consolidation recenter", + "activation_search_effort_step": "max(2, B / 16) per public activation until the 9 * C ceiling", + "retrieval_cycle_edge_samples": "max(2, B / 32) retrieval-active queries per phase edge", + "shadow_cache_capacity": "24 * C", + "backfill_search_node_budget": "C + B", + "backfill_search_effort": "2 * B", + "historical_backfill_drain_limit": "B ordered rows per successful construction edge", + "historical_backfill_overflow_probe_limit": "logical B + 1 boundary: process B ordered entries, then test whether the in-memory iterator has another entry; no B + 1 row is read or processed", + "dirty_identity_drain_limit": "C per successful construction edge", + "dirty_identity_overflow_probe_limit": "C + 1 identities read only to detect overflow", + "route_metadata_open_row_limit": 1 + }, + "structural_invariants": { + "persisted_hnsw_hierarchy_count": 1, + "route_metadata_open_row_count": 1, + "runtime_hierarchy_required_for_sparse_route_traversed": true, + "valid_pre-post_activation_overlap_required_for_route_lifecycle_evaluated": true, + "whole_engine_restart_bounded": false, + "classification": "fixed SQLite representation with a consolidation-reset activation envelope and all operational work limits knob-derived" + }, + "structural_grid": { + "focus_values": [ + 0.0, + 0.5, + 1.0 + ], + "sensitivity_values": [ + 0.0, + 0.5, + 1.0 + ], + "stability_values": [ + 0.0, + 0.5, + 1.0 + ], + "configuration_count": 27, + "passed": true, + "result_artifact": "sanitized/cortext-default-saw8c9c-structural-junit.xml", + "result_sha256": "c238ead4f40a3570862ddf52283b1f5463d212a022852d75d5b80b8bb5392382", + "assertions": 1021, + "failures": 0, + "errors": 0, + "test_binary": { + "target": "cortext_tests", + "filename": "cortext_tests", + "sha256": "942f429a28562454563b599d08e8afac4c34feef4908d163a1bd6770de24d8a3", + "size_bytes": 10665904 + } + }, + "direct_regressions": { + "bounded_dirty_backfill_and_live_journal": { + "result_artifact": "sanitized/cortext-default-saw8c9c-backfill-junit.xml", + "result_sha256": "e9a3ba2c53f5c639c40412bd66674f7f839552a940bcb4be3c2635dbaf4c3b66", + "assertions": 1163, + "failures": 0, + "errors": 0, + "test_binary": { + "target": "cortext_tests", + "filename": "cortext_tests", + "sha256": "942f429a28562454563b599d08e8afac4c34feef4908d163a1bd6770de24d8a3", + "size_bytes": 10665904 + } + }, + "route_metadata_open": { + "result_artifact": "sanitized/cortext-default-saw8c9c-restart-junit.xml", + "result_sha256": "d6037198ea85457e8f4180f776b4f8fab894d961068510d1f38b067190892879", + "assertions": 617, + "failures": 0, + "errors": 0, + "test_binary": { + "target": "cortext_tests", + "filename": "cortext_tests", + "sha256": "942f429a28562454563b599d08e8afac4c34feef4908d163a1bd6770de24d8a3", + "size_bytes": 10665904 + } + }, + "core_knob_endpoints": { + "result_artifact": "sanitized/cortext-default-saw8c9c-core-knob-junit.xml", + "result_sha256": "d5203bb968f685800ba107d0b8a58750c0ba0506b3158950ccf645780fc6dbb3", + "assertions": 91, + "failures": 0, + "errors": 0, + "test_binary": { + "target": "cortext_tests", + "filename": "cortext_tests", + "sha256": "942f429a28562454563b599d08e8afac4c34feef4908d163a1bd6770de24d8a3", + "size_bytes": 10665904 + } + }, + "active_route_source_modality_label_invariance": { + "result_artifact": "sanitized/cortext-default-saw8c9c-invariance-junit.xml", + "result_sha256": "e61ca85dbcd5b900fec00bac452371aedbabcb8e29851148b9106f444b8f8a71", + "assertions": 2, + "failures": 0, + "errors": 0, + "test_binary": { + "target": "cortext_tests", + "filename": "cortext_tests", + "sha256": "942f429a28562454563b599d08e8afac4c34feef4908d163a1bd6770de24d8a3", + "size_bytes": 10665904 + } + } + }, + "system_quality_contract": { + "queries_per_run": 512, + "result_k": 16, + "exact_identity_recall_at_k_min": 0.998, + "exact_top1_per_run_min": 0.998046875, + "exact_top1_per_run_max_misses": 1, + "exact_top1_nine_run_aggregate_min": 0.999, + "semantic_coverage_min": 0.95, + "deterministic_tie_order_required": true, + "minimum_opaque_source_ids": 4, + "modalities": [ + "text" + ], + "modality_agnostic_proof": "active_route_source_modality_label_invariance" + }, + "experiments": [ + { + "id": "midpoint", + "knobs": [ + 0.5, + 0.5, + 0.5 + ], + "resolved": { + "backfill_batch_size": 128, + "fallback_hydration_signal_limit": 128, + "backfill_search_effort": 256, + "backfill_search_node_budget": 640, + "bootstrap_limit": 1024, + "graph_level_zero_links": 128, + "graph_neighbor_count": 64, + "family_exact_comparison_limit": 1024, + "hnsw_construction_effort": 200, + "hnsw_query_effort": 1280, + "maximum_level": 9, + "reciprocal_update_count": 8, + "route_capacity": 512, + "activation_identity_target": 1280, + "activation_snapshot_capacity": 1280, + "total_query_row_budget": 5888, + "activation_search_effort_min": 4096, + "activation_search_effort_step": 8, + "activation_search_node_budget_min": 4096, + "activation_search_node_budget_step": 8, + "search_effort": 4608, + "search_expansion_batch": 32, + "search_node_budget": 4608, + "shadow_cache_capacity": 12288, + "historical_backfill_drain_limit": 128, + "historical_backfill_overflow_probe_limit": 129, + "dirty_identity_drain_limit": 512, + "dirty_identity_overflow_probe_limit": 513 + }, + "active_epoch_limits": { + "event_count": 512, + "mutation_count": 32768, + "allocated_bytes": 67108864, + "row_batch_size": 128 + }, + "observed": { + "sqlite_sparse_route_event_count": 471, + "maximum_activated_identities": 1110.0, + "activation_identity_target": 1280, + "maximum_search_node_rows": 513.0, + "maximum_activation_snapshot_rows": 1005.0, + "maximum_total_query_rows": 1063.0, + "maximum_dynamic_search_node_budget": 4608.0, + "successful_activation_reset_count": 4, + "cluster_centroid_reset_count": 0, + "active_signal_ring_centroid_reset_count": 4, + "valid_activation_overlap_count": 0, + "changed_activation_set_count": 0, + "minimum_activation_overlap_ratio": null, + "maximum_activation_overlap_ratio": null, + "maximum_route_metadata_open_rows": 1.0, + "maximum_backfill_rows": 0, + "total_backfill_rows": 0, + "maximum_fallback_hydration_signal_rows": 525.0, + "fallback_hydration_signal_limit": 128.0, + "backfill_failures": 0, + "search_failure_events": 0, + "consolidation_runs": 7, + "processed_events": 4000, + "wall_ms": 41583, + "mean_process_ms": 2.4446162654999974, + "mean_total_ms": 10.143745737749986, + "peak_rss_mb": 10480.609375, + "exact_identity_recall_at_16": 1.0, + "exact_top1": 1.0, + "exact_top1_hits": 512, + "exact_top1_miss_count": 0, + "top1_miss_fingerprints": [], + "semantic_coverage": 1.0, + "observed_max_level": 5, + "node_rows": 1063, + "upper_level_node_rows": 276, + "remaining_dirty_rows": 85, + "published_max_level": 5, + "published_active_count": 1063, + "published_generation": 1, + "upper_level_nonempty_adjacency_rows": 276, + "maximum_upper_level_adjacency_degree": 112 + }, + "quality_class": "system-quality-passed-sparse-route-traversed-recenter-unproven", + "profile": "private/raw/cortext-default-saw8c9c-midpoint-4000-v1.json", + "profile_sha256": "8d448666c02a2cf9c83d15483be50c38bf9cc1b9d25e791fec61b2f97ffe8f36", + "audit": "sanitized/cortext-default-saw8c9c-midpoint-4000-v1-retrieval-audit.json", + "audit_sha256": "3c84f6c8beb4d30afe736647b0c039fec7154e98a9d8cda30ace64ffe5408ac1", + "database": "private/raw/cortext-default-saw8c9c-midpoint-4000-v1.sqlite", + "db_sha256": "fcf695e84fdd3cb0e81d48c6a059432b55d85ecc9438ba46ee7a2ecb5d30d391", + "benchmark_binary": { + "target": "cortext_chat_replay_live_run", + "filename": "cortext_chat_replay_live_run", + "sha256": "5e884ca9f7749f57b3ba2817b7525a378a261d8fd1ce501a3f215c5e551884cd", + "size_bytes": 6043424 + } + }, + { + "id": "all-low", + "knobs": [ + 0.0, + 0.0, + 0.0 + ], + "resolved": { + "backfill_batch_size": 64, + "fallback_hydration_signal_limit": 64, + "backfill_search_effort": 128, + "backfill_search_node_budget": 320, + "bootstrap_limit": 512, + "graph_level_zero_links": 64, + "graph_neighbor_count": 32, + "family_exact_comparison_limit": 512, + "hnsw_construction_effort": 100, + "hnsw_query_effort": 640, + "maximum_level": 8, + "reciprocal_update_count": 4, + "route_capacity": 256, + "activation_identity_target": 640, + "activation_snapshot_capacity": 640, + "total_query_row_budget": 2944, + "activation_search_effort_min": 2048, + "activation_search_effort_step": 4, + "activation_search_node_budget_min": 2048, + "activation_search_node_budget_step": 4, + "search_effort": 2304, + "search_expansion_batch": 16, + "search_node_budget": 2304, + "shadow_cache_capacity": 6144, + "historical_backfill_drain_limit": 64, + "historical_backfill_overflow_probe_limit": 65, + "dirty_identity_drain_limit": 256, + "dirty_identity_overflow_probe_limit": 257 + }, + "active_epoch_limits": { + "event_count": 256, + "mutation_count": 16384, + "allocated_bytes": 33554432, + "row_batch_size": 64 + }, + "observed": { + "sqlite_sparse_route_event_count": 559, + "maximum_activated_identities": 640.0, + "activation_identity_target": 640, + "maximum_search_node_rows": 400.0, + "maximum_activation_snapshot_rows": 640.0, + "maximum_total_query_rows": 1040.0, + "maximum_dynamic_search_node_budget": 2304.0, + "successful_activation_reset_count": 13, + "cluster_centroid_reset_count": 13, + "active_signal_ring_centroid_reset_count": 0, + "valid_activation_overlap_count": 0, + "changed_activation_set_count": 0, + "minimum_activation_overlap_ratio": null, + "maximum_activation_overlap_ratio": null, + "maximum_route_metadata_open_rows": 1.0, + "maximum_backfill_rows": 0, + "total_backfill_rows": 0, + "maximum_fallback_hydration_signal_rows": 262.0, + "fallback_hydration_signal_limit": 64.0, + "backfill_failures": 0, + "search_failure_events": 0, + "consolidation_runs": 16, + "processed_events": 4000, + "wall_ms": 37522, + "mean_process_ms": 2.850315907999998, + "mean_total_ms": 9.057766732500003, + "peak_rss_mb": 10429.984375, + "exact_identity_recall_at_16": 1.0, + "exact_top1": 1.0, + "exact_top1_hits": 512, + "exact_top1_miss_count": 0, + "top1_miss_fingerprints": [], + "semantic_coverage": 1.0, + "observed_max_level": 6, + "node_rows": 1040, + "upper_level_node_rows": 273, + "remaining_dirty_rows": 7, + "published_max_level": 6, + "published_active_count": 1040, + "published_generation": 1, + "upper_level_nonempty_adjacency_rows": 273, + "maximum_upper_level_adjacency_degree": 72 + }, + "quality_class": "system-quality-passed-sparse-route-traversed-recenter-unproven", + "profile": "private/raw/cortext-default-saw8c9c-all-low-4000-v1.json", + "profile_sha256": "5729acecc60ca1b09f089e3eff344f0e24ddb0b9abe82aa7544bf7a336803dc2", + "audit": "sanitized/cortext-default-saw8c9c-all-low-4000-v1-retrieval-audit.json", + "audit_sha256": "9d4c5b25448f657b4435b7681750fc4e9cc1fc138043b36836b6cc352024e82d", + "database": "private/raw/cortext-default-saw8c9c-all-low-4000-v1.sqlite", + "db_sha256": "55099a6c1a71bea3fc4b681800aeac3e4330d9260ae616c238b90319042f8fb5", + "benchmark_binary": { + "target": "cortext_chat_replay_live_run", + "filename": "cortext_chat_replay_live_run", + "sha256": "5e884ca9f7749f57b3ba2817b7525a378a261d8fd1ce501a3f215c5e551884cd", + "size_bytes": 6043424 + } + }, + { + "id": "all-high", + "knobs": [ + 1.0, + 1.0, + 1.0 + ], + "resolved": { + "backfill_batch_size": 192, + "fallback_hydration_signal_limit": 192, + "backfill_search_effort": 384, + "backfill_search_node_budget": 960, + "bootstrap_limit": 1536, + "graph_level_zero_links": 192, + "graph_neighbor_count": 96, + "family_exact_comparison_limit": 1536, + "hnsw_construction_effort": 300, + "hnsw_query_effort": 1920, + "maximum_level": 10, + "reciprocal_update_count": 12, + "route_capacity": 768, + "activation_identity_target": 1920, + "activation_snapshot_capacity": 1920, + "total_query_row_budget": 8832, + "activation_search_effort_min": 6144, + "activation_search_effort_step": 12, + "activation_search_node_budget_min": 6144, + "activation_search_node_budget_step": 12, + "search_effort": 6912, + "search_expansion_batch": 48, + "search_node_budget": 6912, + "shadow_cache_capacity": 18432, + "historical_backfill_drain_limit": 192, + "historical_backfill_overflow_probe_limit": 193, + "dirty_identity_drain_limit": 768, + "dirty_identity_overflow_probe_limit": 769 + }, + "active_epoch_limits": { + "event_count": 768, + "mutation_count": 49152, + "allocated_bytes": 100663296, + "row_batch_size": 192 + }, + "observed": { + "sqlite_sparse_route_event_count": 544, + "maximum_activated_identities": 1411.0, + "activation_identity_target": 1920, + "maximum_search_node_rows": 866.0, + "maximum_activation_snapshot_rows": 1359.0, + "maximum_total_query_rows": 1359.0, + "maximum_dynamic_search_node_budget": 6912.0, + "successful_activation_reset_count": 3, + "cluster_centroid_reset_count": 0, + "active_signal_ring_centroid_reset_count": 3, + "valid_activation_overlap_count": 0, + "changed_activation_set_count": 0, + "minimum_activation_overlap_ratio": null, + "maximum_activation_overlap_ratio": null, + "maximum_route_metadata_open_rows": 1.0, + "maximum_backfill_rows": 0, + "total_backfill_rows": 0, + "maximum_fallback_hydration_signal_rows": 16.0, + "fallback_hydration_signal_limit": 192.0, + "backfill_failures": 0, + "search_failure_events": 0, + "consolidation_runs": 5, + "processed_events": 4000, + "wall_ms": 67511, + "mean_process_ms": 11.210245507250018, + "mean_total_ms": 16.580607829500046, + "peak_rss_mb": 10472.953125, + "exact_identity_recall_at_16": 1.0, + "exact_top1": 1.0, + "exact_top1_hits": 512, + "exact_top1_miss_count": 0, + "top1_miss_fingerprints": [], + "semantic_coverage": 1.0, + "observed_max_level": 5, + "node_rows": 1359, + "upper_level_node_rows": 348, + "remaining_dirty_rows": 52, + "published_max_level": 5, + "published_active_count": 1359, + "published_generation": 1, + "upper_level_nonempty_adjacency_rows": 348, + "maximum_upper_level_adjacency_degree": 165 + }, + "quality_class": "system-quality-passed-sparse-route-traversed-recenter-unproven", + "profile": "private/raw/cortext-default-saw8c9c-all-high-4000-v1.json", + "profile_sha256": "b7fef702f03c16bd72129464419421e750f010ad62951022c921bf28fecb561e", + "audit": "sanitized/cortext-default-saw8c9c-all-high-4000-v1-retrieval-audit.json", + "audit_sha256": "4719f1f115678ed83184f22cf57f2fbe38369802b3763ecc72adfd703c759871", + "database": "private/raw/cortext-default-saw8c9c-all-high-4000-v1.sqlite", + "db_sha256": "4850acd216b73cc149eb0199dbcdef904a596f9fb8f3cbf6ff3730991e3c9a56", + "benchmark_binary": { + "target": "cortext_chat_replay_live_run", + "filename": "cortext_chat_replay_live_run", + "sha256": "5e884ca9f7749f57b3ba2817b7525a378a261d8fd1ce501a3f215c5e551884cd", + "size_bytes": 6043424 + } + }, + { + "id": "focus-low", + "knobs": [ + 0.0, + 0.5, + 0.5 + ], + "resolved": { + "backfill_batch_size": 96, + "fallback_hydration_signal_limit": 96, + "backfill_search_effort": 192, + "backfill_search_node_budget": 480, + "bootstrap_limit": 768, + "graph_level_zero_links": 96, + "graph_neighbor_count": 48, + "family_exact_comparison_limit": 768, + "hnsw_construction_effort": 150, + "hnsw_query_effort": 960, + "maximum_level": 9, + "reciprocal_update_count": 6, + "route_capacity": 384, + "activation_identity_target": 960, + "activation_snapshot_capacity": 960, + "total_query_row_budget": 4416, + "activation_search_effort_min": 3072, + "activation_search_effort_step": 6, + "activation_search_node_budget_min": 3072, + "activation_search_node_budget_step": 6, + "search_effort": 3456, + "search_expansion_batch": 24, + "search_node_budget": 3456, + "shadow_cache_capacity": 9216, + "historical_backfill_drain_limit": 96, + "historical_backfill_overflow_probe_limit": 97, + "dirty_identity_drain_limit": 384, + "dirty_identity_overflow_probe_limit": 385 + }, + "active_epoch_limits": { + "event_count": 384, + "mutation_count": 24576, + "allocated_bytes": 50331648, + "row_batch_size": 96 + }, + "observed": { + "sqlite_sparse_route_event_count": 832, + "maximum_activated_identities": 960.0, + "activation_identity_target": 960, + "maximum_search_node_rows": 440.0, + "maximum_activation_snapshot_rows": 960.0, + "maximum_total_query_rows": 1381.0, + "maximum_dynamic_search_node_budget": 3456.0, + "successful_activation_reset_count": 8, + "cluster_centroid_reset_count": 0, + "active_signal_ring_centroid_reset_count": 8, + "valid_activation_overlap_count": 0, + "changed_activation_set_count": 0, + "minimum_activation_overlap_ratio": null, + "maximum_activation_overlap_ratio": null, + "maximum_route_metadata_open_rows": 1.0, + "maximum_backfill_rows": 0, + "total_backfill_rows": 0, + "maximum_fallback_hydration_signal_rows": 387.0, + "fallback_hydration_signal_limit": 96.0, + "backfill_failures": 0, + "search_failure_events": 0, + "consolidation_runs": 11, + "processed_events": 4000, + "wall_ms": 50140, + "mean_process_ms": 3.9159435165000076, + "mean_total_ms": 12.217152838250005, + "peak_rss_mb": 10525.359375, + "exact_identity_recall_at_16": 1.0, + "exact_top1": 1.0, + "exact_top1_hits": 512, + "exact_top1_miss_count": 0, + "top1_miss_fingerprints": [], + "semantic_coverage": 1.0, + "observed_max_level": 5, + "node_rows": 1381, + "upper_level_node_rows": 352, + "remaining_dirty_rows": 8, + "published_max_level": 5, + "published_active_count": 1381, + "published_generation": 1, + "upper_level_nonempty_adjacency_rows": 352, + "maximum_upper_level_adjacency_degree": 108 + }, + "quality_class": "system-quality-passed-sparse-route-traversed-recenter-unproven", + "profile": "private/raw/cortext-default-saw8c9c-focus-low-4000-v1.json", + "profile_sha256": "01276ee08a18eef3ec011f6224dd5ec16767b6fe02be741a21b567c3b186ee9d", + "audit": "sanitized/cortext-default-saw8c9c-focus-low-4000-v1-retrieval-audit.json", + "audit_sha256": "9ac6c88f3fd7e538359ab1decdb8e4267471050f02281ad5c75d028e625d2b25", + "database": "private/raw/cortext-default-saw8c9c-focus-low-4000-v1.sqlite", + "db_sha256": "3bc330cf4e8844a60b024f1c1dbda2cd5d5adaf00918fbb79e81443e20ffbd6e", + "benchmark_binary": { + "target": "cortext_chat_replay_live_run", + "filename": "cortext_chat_replay_live_run", + "sha256": "5e884ca9f7749f57b3ba2817b7525a378a261d8fd1ce501a3f215c5e551884cd", + "size_bytes": 6043424 + } + }, + { + "id": "focus-high", + "knobs": [ + 1.0, + 0.5, + 0.5 + ], + "resolved": { + "backfill_batch_size": 160, + "fallback_hydration_signal_limit": 160, + "backfill_search_effort": 320, + "backfill_search_node_budget": 800, + "bootstrap_limit": 1280, + "graph_level_zero_links": 160, + "graph_neighbor_count": 80, + "family_exact_comparison_limit": 1280, + "hnsw_construction_effort": 250, + "hnsw_query_effort": 1600, + "maximum_level": 10, + "reciprocal_update_count": 10, + "route_capacity": 640, + "activation_identity_target": 1600, + "activation_snapshot_capacity": 1600, + "total_query_row_budget": 7360, + "activation_search_effort_min": 5120, + "activation_search_effort_step": 10, + "activation_search_node_budget_min": 5120, + "activation_search_node_budget_step": 10, + "search_effort": 5760, + "search_expansion_batch": 40, + "search_node_budget": 5760, + "shadow_cache_capacity": 15360, + "historical_backfill_drain_limit": 160, + "historical_backfill_overflow_probe_limit": 161, + "dirty_identity_drain_limit": 640, + "dirty_identity_overflow_probe_limit": 641 + }, + "active_epoch_limits": { + "event_count": 640, + "mutation_count": 40960, + "allocated_bytes": 83886080, + "row_batch_size": 160 + }, + "observed": { + "sqlite_sparse_route_event_count": 339, + "maximum_activated_identities": 1307.0, + "activation_identity_target": 1600, + "maximum_search_node_rows": 603.0, + "maximum_activation_snapshot_rows": 1291.0, + "maximum_total_query_rows": 1291.0, + "maximum_dynamic_search_node_budget": 5760.0, + "successful_activation_reset_count": 6, + "cluster_centroid_reset_count": 0, + "active_signal_ring_centroid_reset_count": 6, + "valid_activation_overlap_count": 0, + "changed_activation_set_count": 0, + "minimum_activation_overlap_ratio": null, + "maximum_activation_overlap_ratio": null, + "maximum_route_metadata_open_rows": 1.0, + "maximum_backfill_rows": 0, + "total_backfill_rows": 0, + "maximum_fallback_hydration_signal_rows": 841.0, + "fallback_hydration_signal_limit": 160.0, + "backfill_failures": 0, + "search_failure_events": 0, + "consolidation_runs": 8, + "processed_events": 4000, + "wall_ms": 51790, + "mean_process_ms": 2.6764048184999916, + "mean_total_ms": 12.62571114850005, + "peak_rss_mb": 10496.03125, + "exact_identity_recall_at_16": 1.0, + "exact_top1": 1.0, + "exact_top1_hits": 512, + "exact_top1_miss_count": 0, + "top1_miss_fingerprints": [], + "semantic_coverage": 1.0, + "observed_max_level": 5, + "node_rows": 1291, + "upper_level_node_rows": 333, + "remaining_dirty_rows": 16, + "published_max_level": 5, + "published_active_count": 1291, + "published_generation": 1, + "upper_level_nonempty_adjacency_rows": 333, + "maximum_upper_level_adjacency_degree": 140 + }, + "quality_class": "system-quality-passed-sparse-route-traversed-recenter-unproven", + "profile": "private/raw/cortext-default-saw8c9c-focus-high-4000-v1.json", + "profile_sha256": "5189d95991937d13c75bc4da35cc0a5e254cd5da09de8461a42aa6d4ec815fa2", + "audit": "sanitized/cortext-default-saw8c9c-focus-high-4000-v1-retrieval-audit.json", + "audit_sha256": "1853c68f9c7f940b7d813aa3832158aad349bb483799aea3ae84f31f354ffa0f", + "database": "private/raw/cortext-default-saw8c9c-focus-high-4000-v1.sqlite", + "db_sha256": "9c6cb3f152f77ef08ee536764e424608fa0d9915c84a07185c281226a2f77773", + "benchmark_binary": { + "target": "cortext_chat_replay_live_run", + "filename": "cortext_chat_replay_live_run", + "sha256": "5e884ca9f7749f57b3ba2817b7525a378a261d8fd1ce501a3f215c5e551884cd", + "size_bytes": 6043424 + } + }, + { + "id": "sensitivity-low", + "knobs": [ + 0.5, + 0.0, + 0.5 + ], + "resolved": { + "backfill_batch_size": 112, + "fallback_hydration_signal_limit": 112, + "backfill_search_effort": 224, + "backfill_search_node_budget": 560, + "bootstrap_limit": 896, + "graph_level_zero_links": 112, + "graph_neighbor_count": 56, + "family_exact_comparison_limit": 896, + "hnsw_construction_effort": 175, + "hnsw_query_effort": 1120, + "maximum_level": 9, + "reciprocal_update_count": 7, + "route_capacity": 448, + "activation_identity_target": 1120, + "activation_snapshot_capacity": 1120, + "total_query_row_budget": 5152, + "activation_search_effort_min": 3584, + "activation_search_effort_step": 7, + "activation_search_node_budget_min": 3584, + "activation_search_node_budget_step": 7, + "search_effort": 4032, + "search_expansion_batch": 28, + "search_node_budget": 4032, + "shadow_cache_capacity": 10752, + "historical_backfill_drain_limit": 112, + "historical_backfill_overflow_probe_limit": 113, + "dirty_identity_drain_limit": 448, + "dirty_identity_overflow_probe_limit": 449 + }, + "active_epoch_limits": { + "event_count": 448, + "mutation_count": 28672, + "allocated_bytes": 58720256, + "row_batch_size": 112 + }, + "observed": { + "sqlite_sparse_route_event_count": 75, + "maximum_activated_identities": 556.0, + "activation_identity_target": 1120, + "maximum_search_node_rows": 423.0, + "maximum_activation_snapshot_rows": 556.0, + "maximum_total_query_rows": 556.0, + "maximum_dynamic_search_node_budget": 4032.0, + "successful_activation_reset_count": 2, + "cluster_centroid_reset_count": 0, + "active_signal_ring_centroid_reset_count": 2, + "valid_activation_overlap_count": 0, + "changed_activation_set_count": 0, + "minimum_activation_overlap_ratio": null, + "maximum_activation_overlap_ratio": null, + "maximum_route_metadata_open_rows": 1.0, + "maximum_backfill_rows": 0, + "total_backfill_rows": 0, + "maximum_fallback_hydration_signal_rows": 456.0, + "fallback_hydration_signal_limit": 112.0, + "backfill_failures": 0, + "search_failure_events": 0, + "consolidation_runs": 11, + "processed_events": 4000, + "wall_ms": 39039, + "mean_process_ms": 1.3250394004999975, + "mean_total_ms": 9.518970606249985, + "peak_rss_mb": 10431.15625, + "exact_identity_recall_at_16": 1.0, + "exact_top1": 1.0, + "exact_top1_hits": 512, + "exact_top1_miss_count": 0, + "top1_miss_fingerprints": [], + "semantic_coverage": 1.0, + "observed_max_level": 6, + "node_rows": 556, + "upper_level_node_rows": 143, + "remaining_dirty_rows": 0, + "published_max_level": 6, + "published_active_count": 556, + "published_generation": 1, + "upper_level_nonempty_adjacency_rows": 143, + "maximum_upper_level_adjacency_degree": 82 + }, + "quality_class": "system-quality-passed-sparse-route-traversed-recenter-unproven", + "profile": "private/raw/cortext-default-saw8c9c-sensitivity-low-4000-v1.json", + "profile_sha256": "62f21e70793eea997162c932a8e11e6b8e6e7a0af946a32017089ed9992c9061", + "audit": "sanitized/cortext-default-saw8c9c-sensitivity-low-4000-v1-retrieval-audit.json", + "audit_sha256": "91755c86b0c5c528ae7940c151317c4608a6d89152b3ea6dd66bbf9011416655", + "database": "private/raw/cortext-default-saw8c9c-sensitivity-low-4000-v1.sqlite", + "db_sha256": "7e15a902872b33a22a5908922d3c51961f966ac3755b697fba5119384d55d4b4", + "benchmark_binary": { + "target": "cortext_chat_replay_live_run", + "filename": "cortext_chat_replay_live_run", + "sha256": "5e884ca9f7749f57b3ba2817b7525a378a261d8fd1ce501a3f215c5e551884cd", + "size_bytes": 6043424 + } + }, + { + "id": "sensitivity-high", + "knobs": [ + 0.5, + 1.0, + 0.5 + ], + "resolved": { + "backfill_batch_size": 144, + "fallback_hydration_signal_limit": 144, + "backfill_search_effort": 288, + "backfill_search_node_budget": 720, + "bootstrap_limit": 1152, + "graph_level_zero_links": 144, + "graph_neighbor_count": 72, + "family_exact_comparison_limit": 1152, + "hnsw_construction_effort": 225, + "hnsw_query_effort": 1440, + "maximum_level": 10, + "reciprocal_update_count": 9, + "route_capacity": 576, + "activation_identity_target": 1440, + "activation_snapshot_capacity": 1440, + "total_query_row_budget": 6624, + "activation_search_effort_min": 4608, + "activation_search_effort_step": 9, + "activation_search_node_budget_min": 4608, + "activation_search_node_budget_step": 9, + "search_effort": 5184, + "search_expansion_batch": 36, + "search_node_budget": 5184, + "shadow_cache_capacity": 13824, + "historical_backfill_drain_limit": 144, + "historical_backfill_overflow_probe_limit": 145, + "dirty_identity_drain_limit": 576, + "dirty_identity_overflow_probe_limit": 577 + }, + "active_epoch_limits": { + "event_count": 576, + "mutation_count": 36864, + "allocated_bytes": 75497472, + "row_batch_size": 144 + }, + "observed": { + "sqlite_sparse_route_event_count": 650, + "maximum_activated_identities": 1440.0, + "activation_identity_target": 1440, + "maximum_search_node_rows": 672.0, + "maximum_activation_snapshot_rows": 1440.0, + "maximum_total_query_rows": 1539.0, + "maximum_dynamic_search_node_budget": 5184.0, + "successful_activation_reset_count": 6, + "cluster_centroid_reset_count": 0, + "active_signal_ring_centroid_reset_count": 6, + "valid_activation_overlap_count": 0, + "changed_activation_set_count": 0, + "minimum_activation_overlap_ratio": null, + "maximum_activation_overlap_ratio": null, + "maximum_route_metadata_open_rows": 1.0, + "maximum_backfill_rows": 0, + "total_backfill_rows": 0, + "maximum_fallback_hydration_signal_rows": 951.0, + "fallback_hydration_signal_limit": 144.0, + "backfill_failures": 0, + "search_failure_events": 0, + "consolidation_runs": 8, + "processed_events": 4000, + "wall_ms": 140392, + "mean_process_ms": 23.69636734775004, + "mean_total_ms": 34.767835615249915, + "peak_rss_mb": 10583.109375, + "exact_identity_recall_at_16": 1.0, + "exact_top1": 1.0, + "exact_top1_hits": 512, + "exact_top1_miss_count": 0, + "top1_miss_fingerprints": [], + "semantic_coverage": 1.0, + "observed_max_level": 5, + "node_rows": 1539, + "upper_level_node_rows": 388, + "remaining_dirty_rows": 67, + "published_max_level": 5, + "published_active_count": 1539, + "published_generation": 1, + "upper_level_nonempty_adjacency_rows": 388, + "maximum_upper_level_adjacency_degree": 152 + }, + "quality_class": "system-quality-passed-sparse-route-traversed-recenter-unproven", + "profile": "private/raw/cortext-default-saw8c9c-sensitivity-high-4000-v1.json", + "profile_sha256": "72926536a33c94cf7047442a80d91e788f3b18311eb45a5b38457ac63d156ab3", + "audit": "sanitized/cortext-default-saw8c9c-sensitivity-high-4000-v1-retrieval-audit.json", + "audit_sha256": "6f9cd78e29daee4c5a3c9796786ccc39973ea83dea5daa39355ac84ae68cc5b5", + "database": "private/raw/cortext-default-saw8c9c-sensitivity-high-4000-v1.sqlite", + "db_sha256": "f198a40f8c704a34848c170d87180f00002b195568ba27423743281ff753e3fa", + "benchmark_binary": { + "target": "cortext_chat_replay_live_run", + "filename": "cortext_chat_replay_live_run", + "sha256": "5e884ca9f7749f57b3ba2817b7525a378a261d8fd1ce501a3f215c5e551884cd", + "size_bytes": 6043424 + } + }, + { + "id": "stability-low", + "knobs": [ + 0.5, + 0.5, + 0.0 + ], + "resolved": { + "backfill_batch_size": 112, + "fallback_hydration_signal_limit": 112, + "backfill_search_effort": 224, + "backfill_search_node_budget": 560, + "bootstrap_limit": 896, + "graph_level_zero_links": 112, + "graph_neighbor_count": 56, + "family_exact_comparison_limit": 896, + "hnsw_construction_effort": 175, + "hnsw_query_effort": 1120, + "maximum_level": 9, + "reciprocal_update_count": 7, + "route_capacity": 448, + "activation_identity_target": 1120, + "activation_snapshot_capacity": 1120, + "total_query_row_budget": 5152, + "activation_search_effort_min": 3584, + "activation_search_effort_step": 7, + "activation_search_node_budget_min": 3584, + "activation_search_node_budget_step": 7, + "search_effort": 4032, + "search_expansion_batch": 28, + "search_node_budget": 4032, + "shadow_cache_capacity": 10752, + "historical_backfill_drain_limit": 112, + "historical_backfill_overflow_probe_limit": 113, + "dirty_identity_drain_limit": 448, + "dirty_identity_overflow_probe_limit": 449 + }, + "active_epoch_limits": { + "event_count": 448, + "mutation_count": 28672, + "allocated_bytes": 58720256, + "row_batch_size": 112 + }, + "observed": { + "sqlite_sparse_route_event_count": 1204, + "maximum_activated_identities": 1120.0, + "activation_identity_target": 1120, + "maximum_search_node_rows": 746.0, + "maximum_activation_snapshot_rows": 1120.0, + "maximum_total_query_rows": 1866.0, + "maximum_dynamic_search_node_budget": 4032.0, + "successful_activation_reset_count": 13, + "cluster_centroid_reset_count": 13, + "active_signal_ring_centroid_reset_count": 0, + "valid_activation_overlap_count": 0, + "changed_activation_set_count": 0, + "minimum_activation_overlap_ratio": null, + "maximum_activation_overlap_ratio": null, + "maximum_route_metadata_open_rows": 1.0, + "maximum_backfill_rows": 3, + "total_backfill_rows": 3, + "maximum_fallback_hydration_signal_rows": 477.0, + "fallback_hydration_signal_limit": 112.0, + "backfill_failures": 0, + "search_failure_events": 0, + "consolidation_runs": 16, + "processed_events": 4000, + "wall_ms": 59100, + "mean_process_ms": 5.524340911000006, + "mean_total_ms": 14.341068261000016, + "peak_rss_mb": 10564.671875, + "exact_identity_recall_at_16": 1.0, + "exact_top1": 1.0, + "exact_top1_hits": 512, + "exact_top1_miss_count": 0, + "top1_miss_fingerprints": [], + "semantic_coverage": 1.0, + "observed_max_level": 5, + "node_rows": 1866, + "upper_level_node_rows": 487, + "remaining_dirty_rows": 80, + "published_max_level": 5, + "published_active_count": 1866, + "published_generation": 1, + "upper_level_nonempty_adjacency_rows": 487, + "maximum_upper_level_adjacency_degree": 132 + }, + "quality_class": "system-quality-passed-sparse-route-traversed-recenter-unproven", + "profile": "private/raw/cortext-default-saw8c9c-stability-low-4000-v1.json", + "profile_sha256": "f48567ee4fc6fbd86f96f290be83733ac7b010c28a2d8d93013a338425d72eed", + "audit": "sanitized/cortext-default-saw8c9c-stability-low-4000-v1-retrieval-audit.json", + "audit_sha256": "557dda9f2a8a02faa3f44efc9147507a16ecfbfff5c515689021fb584ff0d9bb", + "database": "private/raw/cortext-default-saw8c9c-stability-low-4000-v1.sqlite", + "db_sha256": "75a1c6749c753df20c4ca3b9a1c7b6f00d1f9591b8570f1ac5cba529e698e8fd", + "benchmark_binary": { + "target": "cortext_chat_replay_live_run", + "filename": "cortext_chat_replay_live_run", + "sha256": "5e884ca9f7749f57b3ba2817b7525a378a261d8fd1ce501a3f215c5e551884cd", + "size_bytes": 6043424 + } + }, + { + "id": "stability-high", + "knobs": [ + 0.5, + 0.5, + 1.0 + ], + "resolved": { + "backfill_batch_size": 144, + "fallback_hydration_signal_limit": 144, + "backfill_search_effort": 288, + "backfill_search_node_budget": 720, + "bootstrap_limit": 1152, + "graph_level_zero_links": 144, + "graph_neighbor_count": 72, + "family_exact_comparison_limit": 1152, + "hnsw_construction_effort": 225, + "hnsw_query_effort": 1440, + "maximum_level": 10, + "reciprocal_update_count": 9, + "route_capacity": 576, + "activation_identity_target": 1440, + "activation_snapshot_capacity": 1440, + "total_query_row_budget": 6624, + "activation_search_effort_min": 4608, + "activation_search_effort_step": 9, + "activation_search_node_budget_min": 4608, + "activation_search_node_budget_step": 9, + "search_effort": 5184, + "search_expansion_batch": 36, + "search_node_budget": 5184, + "shadow_cache_capacity": 13824, + "historical_backfill_drain_limit": 144, + "historical_backfill_overflow_probe_limit": 145, + "dirty_identity_drain_limit": 576, + "dirty_identity_overflow_probe_limit": 577 + }, + "active_epoch_limits": { + "event_count": 576, + "mutation_count": 36864, + "allocated_bytes": 75497472, + "row_batch_size": 144 + }, + "observed": { + "sqlite_sparse_route_event_count": 239, + "maximum_activated_identities": 1045.0, + "activation_identity_target": 1440, + "maximum_search_node_rows": 542.0, + "maximum_activation_snapshot_rows": 897.0, + "maximum_total_query_rows": 1005.0, + "maximum_dynamic_search_node_budget": 5184.0, + "successful_activation_reset_count": 3, + "cluster_centroid_reset_count": 0, + "active_signal_ring_centroid_reset_count": 3, + "valid_activation_overlap_count": 0, + "changed_activation_set_count": 0, + "minimum_activation_overlap_ratio": null, + "maximum_activation_overlap_ratio": null, + "maximum_route_metadata_open_rows": 1.0, + "maximum_backfill_rows": 0, + "total_backfill_rows": 0, + "maximum_fallback_hydration_signal_rows": 585.0, + "fallback_hydration_signal_limit": 144.0, + "backfill_failures": 0, + "search_failure_events": 0, + "consolidation_runs": 6, + "processed_events": 4000, + "wall_ms": 43934, + "mean_process_ms": 2.24997739775, + "mean_total_ms": 10.733162907999988, + "peak_rss_mb": 10482.34375, + "exact_identity_recall_at_16": 1.0, + "exact_top1": 1.0, + "exact_top1_hits": 512, + "exact_top1_miss_count": 0, + "top1_miss_fingerprints": [], + "semantic_coverage": 1.0, + "observed_max_level": 5, + "node_rows": 1005, + "upper_level_node_rows": 261, + "remaining_dirty_rows": 40, + "published_max_level": 5, + "published_active_count": 1005, + "published_generation": 1, + "upper_level_nonempty_adjacency_rows": 261, + "maximum_upper_level_adjacency_degree": 127 + }, + "quality_class": "system-quality-passed-sparse-route-traversed-recenter-unproven", + "profile": "private/raw/cortext-default-saw8c9c-stability-high-4000-v1.json", + "profile_sha256": "874ea3e83e16c9ded54df53ee86b02d54a75b32fc591bd527afbd0812528af64", + "audit": "sanitized/cortext-default-saw8c9c-stability-high-4000-v1-retrieval-audit.json", + "audit_sha256": "c5fc00c75dfc8b0a84e964587ffb6a243398eed1e9cfa6cd681ab47d8b02a858", + "database": "private/raw/cortext-default-saw8c9c-stability-high-4000-v1.sqlite", + "db_sha256": "a656372660ac1e7ef8cfad0fa207c9c7fd1a1b0733ff54ee3517e1a44e9b2397", + "benchmark_binary": { + "target": "cortext_chat_replay_live_run", + "filename": "cortext_chat_replay_live_run", + "sha256": "5e884ca9f7749f57b3ba2817b7525a378a261d8fd1ce501a3f215c5e551884cd", + "size_bytes": 6043424 + } + } + ], + "aggregate": { + "run_count": 9, + "system_quality_query_count": 4608, + "system_quality_pass_count": 9, + "route_lifecycle_evaluated_run_count": 0, + "route_lifecycle_unevaluated_run_count": 9, + "valid_activation_overlap_count": 0, + "changed_activation_set_count": 0, + "changed_activation_set_run_count": 0, + "sparse_route_quality_separately_materialized": false, + "sparse_route_quality_pass_count": null, + "sparse_route_traversed_recenter_unproven_run_count": 9, + "published_below_threshold_route_unevaluated_run_count": 0, + "exact_top1_min": 1.0, + "exact_top1_aggregate": 1.0, + "exact_top1_aggregate_hits": 4608, + "exact_top1_aggregate_queries": 4608, + "exact_top1_aggregate_misses": 0, + "exact_top1_miss_cluster_audit": { + "passed": true, + "status": "no-misses", + "miss_count": 0, + "cluster_definition": "two or more exact top-1 misses sharing a modality, opaque source, memory-age quartile, or exact F/S/T point", + "maximum_bucket_counts": { + "modality": 0, + "source_id": 0, + "memory_age_quartile": 0, + "knob_point": 0 + }, + "clustered_dimensions": [], + "misses": [] + }, + "exact_identity_recall_at_16_min": 1.0, + "semantic_coverage_min": 1.0, + "maximum_route_metadata_open_rows": 1.0, + "maximum_backfill_failure_count": 0, + "maximum_search_failure_event_count": 0, + "all_activation_identity_targets_respected": true, + "all_route_lifecycle_evaluated_runs_have_runtime_upper_levels": true, + "all_resolved_parameters_embedded_in_raw_profiles": true, + "all_system_quality_contracts_passed": true + }, + "limits": [ + "Whole-engine latency is not an HNSW-only measure because F, S, and T also change admission, consolidation frequency, and surface evolution.", + "A route lifecycle is evaluated only after both nonzero SQLite node visits and a successful consolidation recenter. The retained quality audit is whole-system quality and does not separately materialize a route-active query subset.", + "The route metadata open reads one row, but SignalProcessor startup still hydrates the complete current memory surface and therefore remains O(history). The route restart regression is not whole-engine bounded-restart proof.", + "The corpus matrix uses text ingress with four opaque source identifiers. Modality agnosticism is proved separately by the active SQLite-route label-invariance regression over text, audio, and image labels, so no fabricated media ingress is used in the corpus audit.", + "This 4,000-event matrix proves production-default knob derivation, local work ceilings, bounded durable dirty drainage, explicit route-maturity classification at every point, accepted whole-system quality, and\u2014through the separate active-route regression\u2014source/modality label invariance. It does not claim a mature 8C-to-9C recenter cycle when a run lacks a valid pre/post activation pair; that requires the separate long-horizon sawtooth experiment. It also does not prove route-only quality, bounded whole-engine restart, the full 15,695-event plateau, or production-wide boundedness." + ], + "production_cutover": true +} diff --git a/build.zig b/build.zig index ae801f1b..7cf92edd 100644 --- a/build.zig +++ b/build.zig @@ -55,6 +55,8 @@ const cortext_cpp_sources = &.{ "src/operations/meta_learning_internal.cpp", "src/operations/graph_build.cpp", "src/operations/graph_retrieval.cpp", + "src/operations/sparse_retrieval_route_internal.cpp", + "src/operations/sparse_retrieval_route_sqlite_internal.cpp", "src/operations/eviction_policy_override.cpp", "src/operations/storage_pressure.cpp", "src/operations/retrieval_trace_state.cpp", @@ -300,6 +302,7 @@ pub fn build(b: *std.Build) void { const ggml_blas_lib = b.option([]const u8, "ggml_blas_lib", "Optional path to libggml-blas"); const eigen = b.dependency("eigen", .{}); + const hnswlib = b.dependency("hnswlib", .{}); const nlohmann_json = b.dependency("nlohmann_json", .{}); const mod = b.createModule(.{ @@ -340,6 +343,7 @@ pub fn build(b: *std.Build) void { mod.addIncludePath(b.path("third_party/sqlite-objstore/include")); mod.addIncludePath(b.path("third_party/sqlite-objstore/third_party/blake3")); mod.addIncludePath(eigen.path("")); + mod.addIncludePath(hnswlib.path("")); mod.addIncludePath(nlohmann_json.path("include")); const generated = b.addWriteFiles(); diff --git a/build.zig.zon b/build.zig.zon index 4ad1bde9..96328e30 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -12,6 +12,10 @@ .url = "https://gitlab.com/libeigen/eigen/-/archive/3.4.0/eigen-3.4.0.tar.gz", .hash = "N-V-__8AABPI6wAbBLaww8cKO-HchZ0ft-BxUOEOyQtTSccD", }, + .hnswlib = .{ + .url = "https://github.com/nmslib/hnswlib/archive/d9b3608c83d83b46c96e25088cb1d729b29dcfe9.tar.gz", + .hash = "N-V-__8AAD5DBQCaIfPAc4pgydlB6awwGTsNcXXdVdM7JMGl", + }, .ggml = .{ .url = "https://github.com/ggml-org/ggml/archive/refs/tags/v0.9.5.tar.gz", .hash = "N-V-__8AAIGx0wBZa9Sz72m_vmGB455owNYDo1MTKim86Nqw", diff --git a/comments/consolidation-drift-retrigger/20260716T205900Z-orchestrator-goal-mdscript-converted.mdscript.md b/comments/consolidation-drift-retrigger/20260716T205900Z-orchestrator-goal-mdscript-converted.mdscript.md new file mode 100644 index 00000000..fd27e812 --- /dev/null +++ b/comments/consolidation-drift-retrigger/20260716T205900Z-orchestrator-goal-mdscript-converted.mdscript.md @@ -0,0 +1,51 @@ +--- +id: consolidation-drift-rearm-pr-monitor-worktree-entry +task_id: consolidation-drift-retrigger +owner_role: implementer +lane_id: consolidation-drift-retrigger +status: active +source_of_truth: current repository, current user corrections, this goal, task comments, exact private profiles and audits, and GitHub PR 6 only after implementation completion +model: gpt-5.6-terra +reasoning: high +model_selection_basis: cross-cutting C++ and SQLite implementation, deterministic bounded-work proof, research traceability, and PR ownership +canonical_monitor_entry: true +updated_at: 20260721T001500Z +--- + + +## Resume Goal + +* set `{{repository}}` to the canonical Git root containing this file; execute on branch `fix/consolidation-drift-rearm`; do not infer completion, merge authority, release authority, deployment authority, or production-wide boundedness +* treat `artifacts/flat_storage_cost/paper-traceability-current-state-v2.json` as the current control overlay over the content-addressed historical `~/.agents` state; the paused heartbeat must execute this goal rather than the superseded external 5C goal +* preserve one modality- and source-id-agnostic Natural/Durable operation path; Durable may add only its post-commit flush/checkpoint barrier, while Ephemeral retains its read-only semantics +* preserve current retrieval quality authority: each deterministic 512-query production-shaped run permits at most one exact top-1 miss, nine-run aggregate top-1 must be at least 0.999, mean exact identity recall@16 must be at least 0.998, semantic coverage must be at least 0.95, deterministic ties remain exact, and misses may not cluster by modality, opaque source id, memory age, or knob point +* preserve exact structural, rollback, transaction, source-provenance, modality-label, one-write-ownership, and work-ceiling invariants at 100 percent; do not substitute approximate retrieval tolerance for a structural tolerance +* derive every production work value from clamped F/S/T: `C=lround(256+256F+128S+128T)`, `B=lround(64+64F+32S+32T)`, `A=2C+2B`, and `R=max(2,B/16)`; neutral `.5,.5,.5` resolves C=512, B=128, A=1280, R=8, floor=4096, peak=4608, total=5888; 129 is only the logical unprocessed B+1 boundary +* retain the single existing SQLite HNSW route as production default with a post-consolidation 8C queue/node floor, R increment per retrieval-active query, 9C ceiling, separate A consolidation snapshot, and 9C+A total query-row ceiling; restart opens at 9C because ramp age is not durable +* retain private formula selectors only as historical experiment controls; the former selector 24 must resolve exactly equal to hooks-off production parameters +* keep consolidation explicit and shallow: it changes the persisted activation centroid/snapshot and resets the bounded retrieval envelope; do not claim it normalizes content-dependent per-event write incidence or raw process time + +## Current Proof + +* the experiment-only 30,380-packet `8C-to-9C-by-B/16` run passed mature retrieval shape with 511/512 top-1, recall@16 0.999265, semantic coverage 0.998571, deterministic ties, four opaque sources, 19/20 mature resets, stable peak/trough ratios, passing shape/template error, and zero work-bound violations +* the no-selector 15,695-packet Natural run processed 15,695 packets and 34 consolidations in 203,522 ms with mean process 4.921135 ms and mean total 12.658636 ms; its 512 controls passed top-1, recall@16, semantic coverage, and deterministic ties at 1.0 with four opaque sources +* the production-default nine-point 4,000-event matrix passed 4,608/4,608 exact top-1, minimum recall@16 1.0, minimum semantic coverage 1.0, deterministic ties, and zero misses; every route was traversed, but every short run is explicitly recenter-unevaluated because none reached the 8C maturity floor +* `artifacts/flat_storage_cost/sqlite-hnsw-production-sawtooth-knob-ablation-v2.json` content-addresses the nine profiles, audits, retained SQLite databases, exact benchmark and test binaries, source manifest, 27-point structural proof, bounded backfill/journal, metadata-open, core-knob, and source/modality invariance regressions +* the mature extended suffix shows store growth without continuing per-store work growth: non-overlapping late-half mean process fell 8.918 to 7.858 ms, graph seed-cache time fell 2.914 to 2.397 ms with per-node unit ratio 0.789, and supersession loading fell 1.860 to 1.520 ms with per-candidate unit ratio 0.855 +* the no-selector 2,016-message Durable run processed four consolidations in 79,481 ms with mean process 10.709666 ms and mean total 39.024183 ms; all 512 controls passed top-1, recall@16, semantic coverage, and ties at 1.0 with four opaque sources; its horizon is insufficient for ten post-warmup 500-event windows and therefore does not prove Durable plateau +* focused production-default derivation, route work, active-epoch reset, shared Natural/Durable path, Durable-barrier non-replay, source/modality, Python audit, and evidence-builder tests pass on the current release build +* all algorithm and experiment changes, accepted adverse timing, maturity boundary, failed-recenter rollback repair, and nonclaims are recorded in `docs/paper/sections/10_implementation.qmd` and `docs/paper/sections/11_optimization.qmd`; the regenerated manuscript SHA-256 is `f7ed5d59cadeb0cc3194da92ea4f574e20f0a030e5aa28e6ff54cefdd44a43de` +* the full media-enabled CTest suite passes 39,151 assertions in 688 cases, including failure injection proving a failed recenter preserves the existing effort and node budget; the complete Python tool suite passes 159 tests; `git diff --check` passes +* the current-state overlay, rebuilt 69-record manifest, and fail-closed audit have SHA-256 values `ad5eb97044e3db7b41b25bfae4715f375dc748ecb0326c26f40926f38f2ff73b`, `c32dd391ff4aa3db22ae1c49948939d4604b732c777e45c5c8be338170f175b6`, and `2463560aa3b2c9860c026c39f036e726f32fd0d8bc521c701a9bbc34fdfde640`; the audit passes with 69/69 inventory records and no uncovered inventory, claim mismatch, proof-level violation, or ownership violation + +## Remaining Execution + +* continue the required diminishing-severity fresh recursive `gabe-review` loop over the repaired complete current diff and intended scoped claim; resolve every required finding and preserve residuals +* after implementation, proof, paper, and review all pass, update the existing branch and PR 6 without force; do not merge or close +* only after the goal is achieved, resume the ten-minute PR monitor in this task; do not let monitoring interrupt implementation again +* re-enter with `/mdscript-exec {{repository}}/comments/consolidation-drift-retrigger/20260716T205900Z-orchestrator-goal-mdscript-converted.mdscript.md#resume-goal` + +## Completion Boundary + +* mark implementation complete only when current binaries, artifacts, paper, full tests, and recursive review agree on the scoped claim: knob-derived bounded retrieval sawtooth, accepted retrieval quality, one Natural/Durable operation path with Durable checkpoint only, and modality/source-id agnosticism +* keep whole-engine raw process reset, bounded whole-engine restart, Durable plateau, production-wide boundedness, merge, release, deployment, and publication explicitly unclaimed diff --git a/docs/paper/_manuscript/index.md b/docs/paper/_manuscript/index.md index 6bb221b9..5908778c 100644 --- a/docs/paper/_manuscript/index.md +++ b/docs/paper/_manuscript/index.md @@ -5510,23 +5510,29 @@ state, an expiry index, and a connection-local temporary effective-value view. The persistent migration inventory is exactly the three state tables plus the expiry index; it does not install durable views or triggers. Retrieval competition advances one global log-recovery clock -per event, materializes only rows whose exact suppression has crossed -the existing 10−9 active threshold, and updates only newly -suppressed losers. A full-recovery interval advances a generation; older -rows are materialized in bounded batches and reset markers are pruned -after their generation has no remaining active rows. Internal reads that -depend on strength, suppression, or the suppression timestamp use the -temporary effective view. Compatibility handling conservatively -materializes and rebuilds the private representation around every -caller-supplied SQL statement because aliases, wildcards, views, -subqueries, and triggers cannot be classified safely from SQL text. A -caller mutation also invalidates every database-derived processor cache -before the statement executes. +per event, materializes at most one knob-derived row batch whose exact +suppression has crossed the existing 10−9 active threshold, +and updates only newly suppressed losers. A full-recovery interval +advances a generation; older rows are materialized in the same +knob-derived batches and reset markers are pruned after their generation +has no remaining active rows. Internal reads that depend on strength, +suppression, or the suppression timestamp use the temporary effective +view. Compatibility handling conservatively materializes and rebuilds +the private representation around every caller-supplied SQL statement +because aliases, wildcards, views, subqueries, and triggers cannot be +classified safely from SQL text. A caller mutation also invalidates +every database-derived processor cache before the statement executes. The authoritative signal mutation still commits once to persistent SQLite. After that commit, a separate connection-local in-memory SQLite -database publishes only the current recovery clock and active-generation -inhibition rows. It never mirrors durable memory, signal, embedding, +database publishes only the current recovery clock and the identities +touched in the current engine epoch. Persistent SQLite may retain more +active inhibition identities than this disposable epoch projection. +Suppression, recovery-total, anchor, expiry, and effective-value fields +remain solely in persistent SQLite; no production consumer reads a +duplicated RIF value from the disposable identity ledger. Strength-only +changes that cannot alter active membership therefore do not republish +it. The ledger never mirrors durable memory, signal, embedding, association, or payload history. A failed persistent commit restores the pre-signal processor snapshot; a failed post-commit epoch publication discards and rebuilds the disposable database from persistent authority @@ -5534,15 +5540,84 @@ without replaying the committed signal. Natural returns after publication. Durable follows the identical path and then executes only the named WAL checkpoint barrier. -The active epoch records event, changed-row, and allocated-byte measures -with harness safety ceilings of 512 events, 32,768 mutations, and 64 -MiB. Reaching a ceiling raises the existing `Required` consolidation -hint before an honoring caller can enter another event. Ignoring the -hint neither starts another epoch nor drops mutations. A successful -explicit consolidation rebuilds the disposable epoch and resets its -mutable measures; a failed consolidation leaves the old epoch intact. +The active epoch records event, changed-row, allocated-byte, and maximum +statement-row measures. Its harness safety ceilings are derived from the +same clamped F/S/T route capacity and row batch + +*C*(*F*, *S*, *T*) = round (256 + 256*F* + 128*S* + 128*T*),   *B*(*F*, *S*, *T*) = round (64 + 64*F* + 32*S* + 32*T*). + +events are bounded by *C*, mutations by 64*C*, and allocated bytes by +131, 072*C*. Persistent active-row loads, in-memory SQLite publication, +recovery calibration, and retired-generation materialization use +statements of at most *B* rows. Thus all-low, midpoint, and all-high +resolve respectively to 256/16,384/32 MiB/64 rows, 512/32,768/64 MiB/128 +rows, and 768/49,152/96 MiB/192 rows. The midpoint values are defaults, +not fixed production constants. Reaching an epoch ceiling raises the +existing `Required` consolidation hint before an honoring caller can +enter another event. Ignoring the hint neither starts another epoch nor +drops mutations. A live *B* + 1 mutation set is completed by a second +independently *B*-bounded statement; *B* is a statement bound, not a +history cap. This is distinct from historical sparse-route backfill, +whose logical *B* + 1 completion probe does not read or process the +additional historical row. Any epoch overflow observation is named as +the resolved limit plus one and is not an additional work-batch size. A +successful explicit consolidation commits persistent SQLite and then +starts a fresh in-memory SQLite epoch containing only the current clock. +It does not copy the persistent active-identity population into the new +epoch. The next ordinary event publishes only its changed identities. A +failed consolidation leaves the old epoch intact, while a publication +failure after persistent commit discards and recreates the same empty +epoch without replaying the durable mutation. The retry intent is sticky +until that empty epoch is published: even if both publication and +immediate recovery fail, the next processor event executes the empty +reset rather than a full persistent-history rebuild. Retrieval-surface +reloads preserve the RIF epoch sidecar across their independent cache +refresh, including the exception path after a failed reload, so +consolidation cannot erase that retry intent after the durable commit. These are harness-scoped ceilings, not a claim that every production -workload is globally bounded. +workload is globally bounded. Non-finite F/S/T values fail before +integer capacity derivation; finite out-of-range values retain the +engine’s established clamping to \[0, 1\]. + +The row-batch contract is exercised structurally over all 27 points in +{0, 0.5, 1}3 and through live *B* + 1 publication at nine +production-shaped points: midpoint, both joint endpoints, and each +one-axis endpoint. The latter varies text, audio, image, shared-source, +and opaque-source labels while requiring the same resolved batch and the +same two-statement completion. Thus 128 is only the neutral-knob result, +and 129 is only its derived *B* + 1 boundary. + +The consolidation-reset regression uses the same nine knob points and +seeds a knob-derived *B* + 1 persistent active population with mixed +text, audio, image, shared-source, and opaque-source labels. At every +point the durable population survives consolidation, the new disposable +epoch contains zero copied identities, and the following event publishes +exactly its one changed identity. An additional failure-chain regression +seeds a neutral *B* + 1 = 129 mature durable population, injects +failures into publication, immediate recovery, and the following +retrieval-surface reload, and requires the next event to observe zero +copied rows before publishing exactly one changed identity. The +persistent 129-row population remains authoritative; it is never +converted into a 129-row statement. The reload exception was first +reproduced as a missing sidecar before the catch path was repaired. This +removes store-sized work from the successful-consolidation publication +edge. It does not yet bound initial processor startup: compatibility and +restart recovery may still reconstruct current-generation identity and +calibration state from persistent SQLite, so bounded whole-engine +restart remains an explicit open gate. + +The same derivation owns the integrated SQLite HNSW maintenance and +consolidation frontiers. Public route inspection and queue effort reset +to 8*C* after consolidation, advance by *R* = max (2, ⌊*B*/16⌋) per +retrieval-active query, and saturate at 9*C*; downstream activated +identities are bounded by *A* = 2*C* + 2*B*; graph degree is +*N* = max (8, ⌊*B*/2⌋); search expansion is *E* = max (8, ⌊*B*/4⌋); and +ordinary route sealing occurs at *B* − *E*. Score consolidation reads at +most *A* indexed low-strength identities and at most *N* association +edges for each admitted identity. Natural and Durable execute these same +operations and mutations; Durable adds only the existing post-commit +flush/checkpoint barrier. None of these bounds branches on modality or +source identifier. ### Bounded activation observation shadow @@ -5582,6 +5657,362 @@ implementation and measurement seams for fixed sparse activation; it does not replace exact retrieval, make the shadow authoritative, or claim bounded startup or live behavior. +### Packed sparse-route hybrid candidate + +The follow-on benchmark candidate replaces the centroid shadow’s single +lossy route with two independently constructed sparse graphs and a +persistent 512-neighbor route for each sealed embedding. Query work is +fixed independently of retained-history size: each graph receives at +most 1,280 exact embedding comparisons, and the merged candidates are +reranked by the same cosine distance and identity tie order as the exact +control. During a 512-event active epoch, each new embedding may propose +at most 64 reciprocal route updates. Building a sealed graph is likewise +capped at 16,384 construction comparisons per graph. These capacities +are functions of the engine knobs and embedding geometry; neither +`source_id` nor modality participates in routing. + +The benchmark persistence layout keeps SQLite authoritative. A sealed +snapshot stores normalized vectors, the two packed adjacency arrays, and +packed routes as four SQLite blobs, with 1,024 deterministic anchor rows +used to enter the graphs after restart. The current epoch remains a +bounded connection-local SQLite database. Restart opens the four blobs +and visits only metadata plus the anchor rows; it does not replay +retained embeddings. Consolidation is the epoch boundary: it seals +derived routes and then begins a fresh active epoch, producing the +intended sawtooth without introducing a second Natural/Durable write +algorithm. Durable would remain the shared write followed only by its +checkpoint barrier. + +This layout is still a benchmark design, not the current production +retrieval path. The first quality corpus contained all embedding rows, +including signal-only rows that the public seed path does not rank as +long-term memories; its control was therefore mislabeled as current +public retrieval. A corrected export uses current long-term memory +surfaces keyed by memory identity. The two-graph design reached exact +top-1 and recall-at-16 of 1.0 over 3,172 such surfaces, but that static +population still omitted runtime timestamp eligibility, supersession +filtering, current-surface selection, and family collapse. A subsequent +15,695-packet run captured 512 actual public retrieval controls across +events 6–15,691. Three standalone attempts reconstructed the +point-in-time route from the final database: all surface versions, one +current node per memory, and base plus replaceable current +reconstruction. Their apparent identity coverage remained near 0.984 and +top-1 near 0.914. An exhaustive dual-surface oracle reproduced those +misses exactly, showing that approximate graph search was not the cause. +The final database cannot reproduce every intermediate current surface +after reconsolidation mutates `memories.embedding_id`; therefore those +quality labels are invalidated rather than treated as candidate +failures. A valid follow-on captures the live surface mutation stream +during replay. No variant is enabled in production. The prototype’s +source graph construction and snapshot writer also have not yet passed +the engine’s transaction-failure, consolidation-publication, end-to-end +latency, or full-replay gates. The description records the algorithm +precisely so those gates test one content-addressed design rather than +an informal approximation. + +The replacement evaluation seam is an explicit private live-surface +mutation trace. It is disabled by default and enabled only by the replay +harness. After each successful process event it records ordered +long-term surface upserts and removals as memory identity, embedding +identity, and the 256-dimensional post-encoding vector; +consolidation-phase mutations are recorded separately after the process +phase. Normal execution neither stores nor copies these vectors. The +trace carries no routing branch for `source_id` or modality, and its raw +vectors remain private. A paired capture-off/capture-on replay must +retain exact public behavior and logical SQLite content before the trace +can be used as candidate evidence. + +The direct-control harness now observes the engine rather than +reimplementing its eligibility rules. On explicitly enabled benchmark +runs, `GraphAugmentedRetrieveCandidates` exposes its already-ranked +direct seeds to a thread-local trace after timestamp exclusion, +supersession filtering, current-surface selection, family collapse, +exact scoring, and deterministic tie ordering. The Natural replay +records those seed ranks together with the graph-expanded and hydrated +public ranks only on retrieval-active events, then selects an inclusive +even sample from that event stream. Normal execution does not construct +the extra seed trace. A paired 200-event replay produced the same +behavior digest and canonical logical-database digest with and without +capture, so the observer is behavior- and storage-neutral at that scope. +Query vectors remain only in the private proof artifact; the +paper-facing audit retains their digests and aggregate coverage. The +complete 15,695-event, 512-query control and live candidate comparison +are reported in the optimization evaluation. This instrumentation +remains a private proof seam rather than a production API. + +### Integrated HNSW candidate route + +The sparse route is wired into the existing +`GraphAugmentedRetrieveCandidates` operation; it is not a second +retrieval or ingestion API. SQLite-backed routing is the normal internal +path, with a private rollback switch retained for experiments. Natural +and Durable update the same current-memory surface and Durable adds only +its post-commit SQLite checkpoint barrier. Routing consumes only the +256-dimensional post-encoding vector and memory identity, so modality +and the opaque `source_id` never select graph structure, capacity, or +rank behavior. + +Every operational work limit is derived from the three public knobs. +After clamping *F*, *S*, and *T* independently to \[0, 1\], the +candidate capacity and legacy-store backfill batch are + +*C*(*F*, *S*, *T*) = round (256 + 256*F* + 128*S* + 128*T*), + +*B*(*F*, *S*, *T*) = round (64 + 64*F* + 32*S* + 32*T*). + +The downstream activation target is independently named: + +*A*(*F*, *S*, *T*) = 2*C*(*F*, *S*, *T*) + 2*B*(*F*, *S*, *T*). + +The graph neighbor limit is *m**a**x*(8, ⌊*B*/2⌋), the level-zero link +limit is *m**a**x*(16, ⌊*C*/4⌋), and maximum hierarchy level is +⌈log2*C*⌉. At each level a new node may update at most +*m**a**x*(2, ⌊*B*/16⌋) reciprocal rows. HNSW construction effort is +*m**a**x*(32, round (25*C*/64)) and query effort is +*m**a**x*(*C*, round (5*C*/2)). The bootstrap, maximum public +visited-node, maximum public queue, shadow-cache, construction-node, and +construction-queue limits are respectively 2*C*, 9*C*, 9*C*, 24*C*, +*C* + *B*, and 2*B*. The 9*C* quantity is a hard routing-inspection +ceiling, not the activated working set; the cache’s node map and FIFO +order are bounded together, and a successful seal clears both so +invalidated rows cannot leave accumulating order entries. After exact +reranking, no more than *A* identities may proceed into eligibility, +family collapse, graph expansion, and final ranking. Exact cosine family +checks have a separate 2*C* per-event ceiling. The breadth-first +adjacency fetch batch is *m**a**x*(8, ⌊*B*/4⌋). The larger query and +bounded cache coefficients were selected by copied-late quality probes: +2*C*/*C* and 3*C*/2*C* search candidates missed the exact-identity gate; +8*C*/4*C* with a 16*C* cache passed on the initial store but missed one +exact top-1 after the bounded supersession surface changed the live +graph. A later expanding 5*C* → 12*C* envelope restored exact sampled +quality but made both query and construction work grow with query age. +The retained candidate resets public route inspection to 8*C*, advances +it by *R* only until the 9*C* ceiling, fixes downstream activation at +*A* = 2*C* + 2*B*, and reserves the smaller *C* + *B*/2*B* envelope for +graph construction. These are knob-derived finite limits, not midpoint +constants. + +Consolidation changes activation locality without changing SQLite +authority or introducing a second route. Restart opens at the 9*C* +ceiling because in-process query age is not durable; every successful +recenter resets the shared path to the 8*C* floor, and subsequent +retrieval-active queries advance queue effort and actual-node ceiling +together by *R* until 9*C*. A successful route seal normalizes the +consolidation embedding, runs the canonical bounded search around that +semantic center, and persists at most *A* resulting memory identities as +the next activation snapshot. The canonical maximum-level entry +continues to own global HNSW descent. Ordinary retrieval loads the +packed snapshot through its independent *A* row budget and uses all +valid snapshot identities as deterministic level-zero entry points. +Neighbor rows discovered from those entry points remain charged to the +current canonical 8*C*–9*C* budget, so consolidation can steer the walk +without widening either envelope. The internal search used to construct +a recenter snapshot does not advance the retrieval-age ramp. If snapshot +persistence fails, both queue effort and the actual-node budget remain +at their pre-attempt values; only a successful recenter resets them to +8*C*. The floor, increment, and ceiling are derived from F/S/T rather +than independently tunable fourth knobs. Every query records its ceiling +and actual visited rows; canonical rows above the current ceiling or +above 9*C* fail the audit. The persisted snapshot remains independently +charged under its *A* ceiling and is joined with the canonical +candidates for final exact reranking. The returned set makes the +existing formula explicit: its best 2*C* canonical identities are +protected, while consolidation may supply the remaining 2*B* identities +in *A* = 2*C* + 2*B*. The final selected set is reranked by exact +distance. Total fetched-row work is therefore bounded by 9*C* + *A*. A +separate returned-identity counter still fails above *A*, so a changed +semantic center cannot be mistaken for an unbounded working set. The +normalized center, snapshot generation, and packed identity list live in +the single SQLite route-metadata row and survive reopen; malformed, +stale, duplicate, or over-capacity metadata invalidates the route. Graph +and memory rows remain authoritative in SQLite. + +Decoded activation-snapshot rows reuse the route’s existing +generation-qualified shadow-node cache rather than being selected and +decoded again for every query. The first query after reopen loads only +snapshot identities absent from that cache; later queries reuse those +immutable decoded rows while continuing to compute query distance +exactly. The shared cache remains bounded by 24*C*, and every successful +seal clears both its node map and FIFO order before any row from the +next authoritative SQLite state can be reused. A separate physical +snapshot-cache-miss counter distinguishes the fixed *A* rows evaluated +from the rows actually loaded from SQLite. This is a read-through +optimization of the one persisted route, not an in-memory authority or a +second write path, and it contains no modality or source-id predicate. + +Emotional propagation uses the same first-source-wins semantics while +avoiding duplicate downstream work. Its breadth-first kernel carries up +to 64 source ordinals in one bit mask. For each reached embedding, the +kernel records only the lowest source ordinal and that source’s first +(therefore shortest) positive depth; after all batches, it emits one +winning pair per embedding in deterministic source/depth/identity order. +Separate counters record all source–embedding reachability pairs and all +physical adjacency visits, so winner collapse does not relabel unbounded +traversal as bounded work. The optimization is independent of modality +and source-id labels and does not change persistence or add a write +path. + +The bounded-cascade experiment adds three independent F/S/T-derived +limits around that exact winner rule. Its maintained source-priority +snapshot holds at most the public routing budget 5*C*; one cascade +inspects no more than that snapshot and executes at most *B* eligible +sources. The shared traversal stops before physical adjacency visit +5*C* + 1, and the existing enqueue stage emits at most *A* = 2*C* + 2*B* +embedding updates. SQL fallback materializes at most the same 5*C* +source prefix. Inspection, accepted-source, physical-edge, winning-pair, +and update counts remain distinct, with their resolved limits recorded +on each profiled event. The snapshot ordering depends only on timestamp +and memory identity; no source-id or modality label participates. These +limits remain private experiment hooks until the complete quality, +plateau, restart, and knob-ablation contracts pass. + +The cycle auditor classifies retrieval independently from whole-engine +process shape. It selects retrieval-active events from explicit route +activity, queue, ceiling, visit, distance, snapshot, or activation +evidence. In sawtooth mode it requires the exact F/S/T-derived 8*C* +reset floor, *R* increment, and 9*C* ceiling, canonical visits no +greater than the current ceiling, snapshot visits no greater than *A*, +combined row visits no greater than 9*C* + *A*, nonzero unique distance +work no greater than the fetched-row union, and activated identities no +greater than *A*. Mature cycles must show the reset on consolidation and +pass the preregistered peak/trough, resampled-shape, and late-template +gates. A route-active event with missing or zero work therefore fails +rather than disappearing from the sample. Missing recenter evidence, a +changed post-consolidation canonical ceiling, or any work value above +its declared derived envelope also fails closed. Activated-identity +overlap is a separate centroid movement measurement; without it the +classifier and work envelope may pass, but the full retrieval-cycle +contract remains unproven. Process, throughput, and operation-slope +gates remain separate, so bounded routing cannot conceal a rising write +path. + +At neutral knobs these formulas retain the evaluated midpoint: +*C* = 512, *B* = 128, *A* = 1, 280, 64 neighbors, 128 level-zero links, +maximum level 9, 8 reciprocal updates per level, construction effort +200, query effort 1,280, and 1,024 exact family comparisons. The +canonical floor is 4,096 rows, the increment is 8, and the +canonical-plus-snapshot row ceiling is 9*C* + *A* = 5, 888 at neutral +knobs. The all-low and all-high endpoints are not aliases for this +midpoint; the complete 3 × 3 × 3 structural grid is tested. + +When the current surface contains at most *C* rows, the exact scan is +already inside the bound. Above it, one deterministic persisted HNSW +hierarchy proposes a sparse frontier. The same SQLite route then +completes the current query’s knob-bounded routing envelope with a +deterministic indexed slice of active rows, wrapping once around the +canonical entry identity, until the current 8*C*–9*C* actual-node +ceiling is reached or the surface is exhausted. Every routed row—whether +reached by an HNSW edge or by envelope completion—is exactly reranked. +The independently persisted consolidation snapshot then contributes at +most *A* additional rows to the same exact union, after which the +operation returns at most *A* memory identities to the existing +downstream path. Timestamp eligibility, current-surface membership, +supersession, long-term kind, cosine-family collapse, graph expansion, +final scoring, and deterministic ties remain authoritative. This sparse +activation route fixes disconnected-node blindness without introducing a +second retrieval or write path; HNSW controls locality while the derived +envelope controls exact coverage and work. + +Within one activation query, the row-addressed route stores each +persisted node’s exact query distance beside that query’s local node +view. Higher-level descent, level-zero expansion, best-set maintenance, +and the final exact activation rerank reuse that value instead of +recomputing the same 256-element distance. The canonical cache is +query-local and bounded by the same 9*C* maximum fetched-node ceiling; +snapshot materialization is separately bounded by *A*, and both are +discarded after the call. Pending updated embeddings use a separate +distance evaluation from their older persisted row, so an identity +cannot reuse a stale vector merely because its numeric ID is unchanged. +The route records both visited nodes and exact distance evaluations, and +requires the latter to be at most the unique union of canonical, +snapshot, and knob-bounded pending-delta rows. This changes only +repeated arithmetic: activated identities, order, downstream +eligibility, SQLite authority, and Natural/Durable ownership are +unchanged. + +SQLite remains canonical for both memory data and the row-addressed +graph. Active graph metadata and node rows are separate from an +unpublished build record. An existing store is backfilled in batches no +larger than *B* and the build is invisible to retrieval until its active +count matches the authoritative current surface. Exact retrieval remains +the candidate and the control during this interval. A durable +dirty-identity journal records every route upsert or removal in the +caller’s authoritative transaction. When the complete active journal +contains at most *C* identities, retrieval stages those authoritative +current embeddings or removals as an exact bounded delta over the +persisted hierarchy. More than *C* dirty identities fails closed to the +exact path. The journal query reads at most *C* + 1 identities only to +distinguish a complete *C*-row delta from overflow. At neutral knobs +this live-journal limit is therefore 512 and its overflow sentinel is +row 513. Historical ordered backfill remains independently bounded by +*B*. After advancing at most *B* = 128 historical rows, the +implementation tests whether the in-memory ordered iterator has another +entry. Thus 129 is the derived logical *B* + 1 boundary, not a physical +129th-row read and never a 129-row work batch. Opening the sparse route +loads one metadata row, validates at most *A* packed activation +identities from that row, resolves only that knob-bounded ordered slice, +and lazily fetches graph nodes under the 9*C* canonical plus *A* +snapshot public-query bounds; the route itself does not replay or mirror +complete history. This is not a bounded whole-engine restart claim: +`SignalProcessor` startup still materializes the complete current memory +surface before retrieval begins, so startup remains *O*(history) until +that separate hydration path is removed. + +Live writes do not grow an unbounded in-memory construction delta for +either active or unpublished routes. Each construction edge drains at +most *C* dirty identities from the SQLite journal and may independently +advance at most *B* ordered historical backfill rows. The larger dirty +bound is still knob-derived and lets an epoch that changes more than one +backfill batch converge instead of permanently chasing its own journal. +A successful seal deletes only the dirty identities included in that +bounded root set; any remainder stays authoritative for the next edge, +and an unpublished build cannot publish until both ordered backfill and +the journal are complete. Thus a busy active route or legacy-store +migration cannot turn the sparse index into a second unbounded write +path. + +Normal writes and reconsolidations append only their memory identities +to the durable journal. A successful seal writes changed nodes and +knob-bounded reciprocal neighbors, advances graph metadata, and clears +only its staged root identities in the same SQLite transaction. Neighbor +proposal during this seal uses the *C* + *B* node and 2*B* queue +construction envelope, not the public 9*C* activation envelope. Existing +active nodes retain their persisted topology when their current +embedding changes; the rejected bounded-relink experiment is reported in +the optimization section. A failed authoritative transaction cannot +leave a durable route mutation. An interrupted or failed seal leaves the +identities journaled for restaging, while exact retrieval remains +authoritative. This gives consolidation a real route-epoch boundary +without a store-sized graph rewrite. + +Application hydration uses the same bounded-surface rule when a memory +has no materialized memory or reconstruction blob. SQLite retains every +authoritative signal, but the fallback reads only the most recent *B* +signal rows for that memory through the `(memory_id, serial_position)` +index and returns the selected rows in chronological order. Thus neutral +knobs hydrate at most 128 fallback signal payloads per returned memory, +all-low hydrates 64, and all-high hydrates 192. The bound does not +inspect modality or `source_id`; text, audio, and image signals follow +the same indexed query. The runtime records the derived limit and the +number of fallback rows actually materialized on each public call. + +The same bounded activation surface now serves supersession selection +after the current memory population exceeds *C*. `MemoryStorage` asks +the persisted route for at most *A* identities, exactly reranks those +current embeddings, and keeps its existing timestamp, kind, threshold, +duplicate-band, edge-count, and tie rules. On this sparse path the +latest current embedding is the memory’s active centroid: an older base +embedding remains durable lineage but does not re-enter as a second +competing candidate after consolidation has moved that memory. Until the +route is published, when the dirty delta exceeds *C*, or when route +validation fails, the operation retains the exact fallback. This is one +shared, modality- and source-agnostic candidate route for Natural and +Durable; it does not add a second write API or make the connection-local +cache authoritative. The 4,000-event knob ablation and its remaining +full-horizon limits are reported in the optimization section. +`TRACE[state:integrated_hnsw_sparse_route_experiment]` and +`TRACE[state:sqlite_hnsw_knob_ablation]`. + Rollback snapshots move the private accumulator map, working-memory records, and their blob-reference vectors out of the generic context copy and restore their ownership immediately afterward. The active @@ -5700,90 +6131,95 @@ nonnegative; both upper bounds are also sound, so none can exclude a pair meeting the cosine threshold. The complementary bases avoid broad exact pairwise work for both sparse coordinate-aligned vectors and dense Hadamard-aligned vectors; arbitrary adversarial surfaces may still reach -the exact fallback. The normalized vector and both block-norm summaries -are immutable functions of an embedding, so the private surface computes -them on first family use and retains them with that entry. Replacing a -current surface entry replaces its summaries as part of the same cache -mutation. This removes repeated normalization and Walsh–Hadamard -construction without changing family order, comparison arithmetic, or -fallback behavior. If the private vector cache is unavailable, durable -processing rebuilds it once from the complete persisted surface and -immediately applies the same family and supersession filters before -truncation. A failed rebuild installs a failure sentinel rather than -repeating the two complete surface scans on every request. A unique -cached vector retains every long-term memory metadata alternative that -shares its base embedding, and query-time eligibility chooses a -nonsuperseded sibling without duplicating vector storage. The cache -separately indexes entries that have at least one long-term metadata -alternative. Retrieval applies the existing timestamp, current-surface, -and supersession predicates to that subset before evaluating vector -distance, so signal-only historical embeddings do not enter the distance -kernel. This is an execution-only index: it does not change the eligible -set, distance expression, tie order, family collapse, or source and -modality semantics. Alongside the shared association fanout cache, an -internal execution sidecar maintains, for each supersession target, the -earliest start timestamp of an eligible replacement. Retrieval tests -that timestamp directly instead of rebuilding a target set by scanning -every incoming edge. Memory storage publishes its already-committed -supersession decisions into the fanout cache and rebuilds the sidecar -index; missing target metadata invalidates the cache and returns to -authoritative SQLite rehydration. Neither structure is part of the -public processor layout. The strict replacement-before-query predicate -and base embedding identity remain unchanged. The emotional-metadata -portion of the sidecar is trusted only by the engine-owned operation -root that maintains it. A caller-supplied root’s transaction view -invalidates that sidecar before forwarding its first SQL statement, so a -custom transaction that updates emotional columns directly cannot leave -a valid-looking stale fixed point for a later operation in the same -transaction. Cache-only custom roots retain their exact rollback -snapshot. The fallback executes a demand-driven sequence of ordered SQL -pages over the current and historical vector surfaces. Each page joins -memory metadata and applies kind, timestamp, and supersession -eligibility before distance ordering, excludes a historical row when -that memory already has a current reconstruction, collapses -byte-identical historical vectors, and uses a second application of the -existing F/S/T-derived seed-search breadth as its row bound. One -in-memory cosine-family index spans every page; paging stops when the -ordinary semantic-family seed budget is full or the eligible surface is -exhausted. Processor hydration tracks persisted-current-surface currency -and processor-surface completeness independently. The private -current-vector search cache is built and incrementally updated from the -processor’s latest reconstruction surface, even when a test or storage -policy intentionally omits the corresponding persisted-current write. A -valid cache therefore performs distance ordering and cosine-family -accounting on latest vectors. If that cache is unavailable while the -processor surface is complete and original-base lineage remains -available, durable retrieval rebuilds a current-only cache from the -processor surface and ephemeral retrieval scans that surface directly -without mutating the registry. Missing base lineage or an incomplete -processor surface falls back to SQL; in that recovery case the query -substitutes each latest reconstruction before cross-page family -accounting. Base families that converge after reconstruction therefore -consume one current-family slot and cannot stop selection early. Current -per-memory reconstructions remain distinct rows and the corresponding -base row for that same memory is excluded. The same registry keeps an -exact index of supersession-eligible historical memory rows and the base -lineage of each current row. Memory storage first ranks the current -surface and records its exact cutoff. When current and historical -populations are identical except for explicitly tracked changed -memories, deterministic embedding-id and memory-id tie orders agree, and -every changed historical row is outside that cutoff, the current result -proves that the historical top-k contributes no unseen candidate. The -historical scan is then skipped; any ambiguous lineage, reversed tie -order, or failed cutoff proof falls back to the complete eligible -historical scan. A historical embedding referenced by more than one -eligible memory also disables both current-population shortcuts: the -historical query ranks embeddings before expanding every memory sibling, -whereas the current surface ranks per-memory rows. The complete -embedding-level pass therefore preserves sibling fanout even when the -per-memory candidate limit is saturated. This proof changes neither the -candidate population nor the chosen supersession edges, but the current -surface distance pass remains proportional to that surface. Rollback and -flush recovery also rehydrate each current entry’s original base ID from -`memories.embedding_id`; they never infer it from the reconstructed -surface. When constructive recall is disabled, both restart hydration -and cache-loss rebuild select the base embedding and ignore -reconstruction/current surfaces. This recovery path preserves an +the exact fallback. One event may execute at most 2*C* exact cosine +checks across all family-collapse stages. Exhaustion conservatively +admits the current candidate to the independently bounded rank/output +stages rather than performing a store-sized comparison tail. The +normalized vector and both block-norm summaries are immutable functions +of an embedding, so the private surface computes them on first family +use and retains them with that entry. Replacing a current surface entry +replaces its summaries as part of the same cache mutation. This removes +repeated normalization and Walsh–Hadamard construction without changing +family order, comparison arithmetic, or fallback behavior. If the +private vector cache is unavailable, durable processing rebuilds it once +from the complete persisted surface and immediately applies the same +family and supersession filters before truncation. A failed rebuild +installs a failure sentinel rather than repeating the two complete +surface scans on every request. A unique cached vector retains every +long-term memory metadata alternative that shares its base embedding, +and query-time eligibility chooses a nonsuperseded sibling without +duplicating vector storage. The cache separately indexes entries that +have at least one long-term metadata alternative. Retrieval applies the +existing timestamp, current-surface, and supersession predicates to that +subset before evaluating vector distance, so signal-only historical +embeddings do not enter the distance kernel. This is an execution-only +index: it does not change the eligible set, distance expression, tie +order, family collapse, or source and modality semantics. Alongside the +shared association fanout cache, an internal execution sidecar +maintains, for each supersession target, the earliest start timestamp of +an eligible replacement. Retrieval tests that timestamp directly instead +of rebuilding a target set by scanning every incoming edge. Memory +storage publishes its already-committed supersession decisions into the +fanout cache and recomputes only the affected target’s eligibility. A +current-surface change likewise recomputes only targets reached by that +memory’s outgoing `supersedes` edges. Missing target metadata +invalidates the cache and returns to authoritative SQLite rehydration. +Neither structure is part of the public processor layout. The strict +replacement-before-query predicate and base embedding identity remain +unchanged. The emotional-metadata portion of the sidecar is trusted only +by the engine-owned operation root that maintains it. A caller-supplied +root’s transaction view invalidates that sidecar before forwarding its +first SQL statement, so a custom transaction that updates emotional +columns directly cannot leave a valid-looking stale fixed point for a +later operation in the same transaction. Cache-only custom roots retain +their exact rollback snapshot. The fallback executes a demand-driven +sequence of ordered SQL pages over the current and historical vector +surfaces. Each page joins memory metadata and applies kind, timestamp, +and supersession eligibility before distance ordering, excludes a +historical row when that memory already has a current reconstruction, +collapses byte-identical historical vectors, and uses a second +application of the existing F/S/T-derived seed-search breadth as its row +bound. One in-memory cosine-family index spans every page; paging stops +when the ordinary semantic-family seed budget is full or the eligible +surface is exhausted. Processor hydration tracks +persisted-current-surface currency and processor-surface completeness +independently. The private current-vector search cache is built and +incrementally updated from the processor’s latest reconstruction +surface, even when a test or storage policy intentionally omits the +corresponding persisted-current write. A valid cache therefore performs +distance ordering and cosine-family accounting on latest vectors. If +that cache is unavailable while the processor surface is complete and +original-base lineage remains available, durable retrieval rebuilds a +current-only cache from the processor surface and ephemeral retrieval +scans that surface directly without mutating the registry. Missing base +lineage or an incomplete processor surface falls back to SQL; in that +recovery case the query substitutes each latest reconstruction before +cross-page family accounting. Base families that converge after +reconstruction therefore consume one current-family slot and cannot stop +selection early. Current per-memory reconstructions remain distinct rows +and the corresponding base row for that same memory is excluded. The +same registry keeps an exact index of supersession-eligible historical +memory rows and the base lineage of each current row. Memory storage +first ranks the current surface and records its exact cutoff. When +current and historical populations are identical except for explicitly +tracked changed memories, deterministic embedding-id and memory-id tie +orders agree, and every changed historical row is outside that cutoff, +the current result proves that the historical top-k contributes no +unseen candidate. The historical scan is then skipped; any ambiguous +lineage, reversed tie order, or failed cutoff proof falls back to the +complete eligible historical scan. A historical embedding referenced by +more than one eligible memory also disables both current-population +shortcuts: the historical query ranks embeddings before expanding every +memory sibling, whereas the current surface ranks per-memory rows. The +complete embedding-level pass therefore preserves sibling fanout even +when the per-memory candidate limit is saturated. This proof changes +neither the candidate population nor the chosen supersession edges, but +the current surface distance pass remains proportional to that surface. +Rollback and flush recovery also rehydrate each current entry’s original +base ID from `memories.embedding_id`; they never infer it from the +reconstructed surface. When constructive recall is disabled, both +restart hydration and cache-loss rebuild select the base embedding and +ignore reconstruction/current surfaces. This recovery path preserves an eligible target behind 900 closer ineligible rows and preserves an eligible sibling of a superseded shared embedding. A separate 600-member byte-distinct cosine-near family requires two bounded pages and cannot @@ -5894,6 +6330,62 @@ this claim. ## Computational Complexity +### Bounded Active Signal-Vector Snapshot + +Migration 30 removes accepted signal vectors from the store-wide +sqlite-vec search surface. The durable `signals` row and object-store +payload remain the authoritative event record, and +`signals.embedding_id` references the memory or working-memory centroid +that represents that event in global retrieval. Exact vectors for only +the active tail are retained in the internal +`cortext_active_signal_embeddings` SQLite table. This is one +SQLite-backed write path, not a second durability system: Natural +ingestion appends through the common path, and Durable adds the existing +flush/checkpoint boundary. + +The ring capacity reuses the knob-derived historical batch size + +*B*(*F*, *S*, *T*) = round (64 + 64*F* + 32*S* + 32*T*), + +after independently clamping each knob to \[0, 1\]. It therefore +contains 64, 128, and 192 rows at the all-low, midpoint, and all-high +corners. The logical rounding rule is C++ `std::lround`, so half-integer +ties round away from zero. For example, *F* = 1/128, *S* = *T* = 0 +yields 65 rather than 64. The logical *B* + 1 probe remains an +overflow/completion check; it is not a fetched or processed extra row. +Slot selection is `(signal_id - 1) mod B`, so each ring upsert replaces +at most one prior exact-vector row. One accepted pipeline event may +persist multiple accumulated signal records and therefore perform +multiple bounded upserts; the measured Natural maximum was 14 ring-table +mutations in one event. If knobs change, the table rehashes only the +newest rows that fit the newly resolved *B* and remains bounded by the +old or new knob-derived capacity throughout the transition. + +Recent-context and working-memory restart hydration first read the exact +vector from this bounded ring and fall back to the durable centroid +reference for an older signal or a pre-migration database. The global +vector index consequently contains memory centroids rather than a +growing population of signal-only decoys. The schema and routing code +contain no modality or `source_id` branch; text, audio, image, shared, +and opaque sources enter after encoding through the same slot formula. +Migration tests preserve the legacy fallback, and direct regressions +cover mixed modality/source labels, knob changes, and the 64/128/192 +capacity corners without widening the public API. The hydration +implementation reads the exact ring first and then the centroid +fallback, but this checkpoint does not claim a standalone end-to-end +restart regression or bounded whole-engine restart. + +Emotional propagation separately limits enqueued mutation statements to +the existing activation target *A* = 2*C* + 2*B*. This is a hard bound +on writes, not a claim that the current breadth-first emotional +traversal is fixed work. The full traversal remains an explicitly +unresolved optimization surface. A pass that reaches *A* is an +incomplete priority prefix and is not recorded as an emotional fixed +point; a persistent processor context therefore revisits its unresolved +tail on the next event. Commit-table mutation profiling is installed +whenever work-counter profiling is enabled and no longer depends on the +separate consolidation-epoch profiler. + The dominant per-signal cost is exact candidate discovery over the durable embedding and association surface. With `N` stored memories and embedding dimension `d`, the current write path computes exact @@ -6104,19 +6596,27 @@ payloads durable payload identity is preserved -exact durable-neighbor ranking -maintain private current/base embedding surfaces in a process-wide -lifecycle registry, including signal-only rows that affect the -sqlite-vec population; rank into typed borrowed/owned candidates; reuse -the query norm across exact cosine checks; track the exact historical -supersession population and current/base mismatches so a current top-k -cutoff can prove when no unseen historical row can enter the result -the registry follows processor teardown across sequential thread -migration and mirrors authoritative SQL write decisions; the same -candidate population, K, filters, tie order, cosine results, thresholds, -and supersession edges are retained; ambiguous lineage or tie order -falls back to the complete eligible scan; SQL remains the final fallback -and no public header or API layout changes +supersession neighbor ranking +below the sparse cutover, or whenever the route is unpublished, +overflowing, or invalid, maintain private current/base embedding +surfaces and retain the exact historical-coverage proof and SQL +fallback; above the knob-derived cutover, reuse the SQLite HNSW +activation surface, inspect an 8C post-consolidation floor that +advances by R = max (2, ⌊B/16⌋) to a +9C ceiling, rerank at most +A = 2C + 2B +activated current centroids, and count routed rows and activated +identities independently +the current centroid becomes the active post-consolidation identity +while older base embeddings remain durable lineage; total query rows +remain at most 9C + A; timestamp, kind, +duplicate band, similarity threshold, edge limit, deterministic tie +order, rollback, source/modality independence, and public API shape +remain unchanged; lower-rank candidates may differ within the separately +approved bounded-retrieval accuracy contract graph retrieval @@ -6234,18 +6734,390 @@ candidate scan into an asymptotically flat store search. The later active-epoch cutover targets the remaining store-size-dependent retrieval-inhibition recovery directly. A complete -15,695-packet Natural replay kept the active epoch within its harness -ceilings: the observed high-water marks were 512 events, 1,859 distinct -mutations, and 180,224 allocated bytes, with no over-limit event. The +15,695-packet Natural replay made before the active-epoch ceilings +became knob-derived kept the active epoch within its then-fixed midpoint +harness ceilings: the observed high-water marks were 512 events, 1,859 +distinct mutations, and 180,224 allocated bytes, with no over-limit +event. That evidence is retained as midpoint-only historical proof and +is not accepted as proof of the current F/S/T-derived contract. The caller honored 127 consolidations. Across the audit’s first and last five eligible windows, `Competition.rif_recovery_active_sql` changed from 0.008629 to 0.009038 ms, a 1.047 ratio. The whole write path did not plateau: mean process time rose from 2.265 to 5.507 ms and throughput fell from 36.27 to 9.14 packets/s. This run therefore -verifies the lazy-RIF hotspot and the scoped epoch ceilings, while -leaving graph retrieval, memory storage, and emotional propagation as -measured contributors. It is not a long-horizon or production-wide -boundedness claim. +verifies the lazy-RIF hotspot and the historical midpoint epoch +ceilings, while leaving graph retrieval, memory storage, and emotional +propagation as measured contributors. It is not a long-horizon or +production-wide boundedness claim. + +The subsequent implementation change derives the active-epoch event +ceiling from *C*(*F*, *S*, *T*), the mutation ceiling from 64*C*, the +allocation ceiling from 131, 072*C* bytes, and every RIF +persistent/shadow statement batch from the same *B*(*F*, *S*, *T*) used +by sparse-route backfill. A compiled structural regression covers all 27 +points in the {0, 0.5, 1}3 grid and separately evaluates the +nine midpoint, all-low, all-high, and one-axis-low/high points used by +the production-shaped route ablation. It proves the formulas resolve to +256/16,384/32 MiB/64 rows, 512/32,768/64 MiB/128 rows, and 768/49,152/96 +MiB/192 rows at the all-low, midpoint, and all-high corners. A separate +nine-point execution regression publishes *B* + 1 live active rows at +every named point, observes a maximum statement size of exactly the +resolved *B*, retains all *B* + 1 rows through a second statement, and +varies text, audio, image, shared, and opaque source metadata without +changing the schedule. The 129th midpoint live row is therefore +processed in a second statement; it must not be confused with the +historical backfill’s logical 129th completion probe, which is not read +or processed. The benchmark now records resolved values instead of +emitting fixed midpoint labels. Configured low, midpoint, and high +Natural and Durable regressions each reached their own resolved event +boundary, preserved `Required` at the logical limit-plus-one +observation, and reset after a successful consolidation; the same runs +varied opaque source and text, audio, and image labels without changing +the formula. One-event current-binary profile probes independently +emitted 256/16,384/32 MiB for all-low Natural and 768/49,152/96 MiB for +all-high Durable, with the recorded event limit equal to the +independently recorded route capacity. Non-finite knobs are rejected +before any capacity is converted to an integer, and the profile auditor +applies the same fail-closed rule. Long-horizon nine-point latency and +reset evidence is now complete over the full 15,695-packet corpus at +midpoint, both joint endpoints, and each one-axis endpoint. Every run +emitted its independently expected F/S/T-derived event, mutation, and +allocation limits; every run reached exactly its event limit without +exceeding any ceiling; and every run observed a successful reset. None +of the nine runs passed the whole-engine plateau or consolidation-cycle +contract, however. + + ++++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
F/S/T pointCWall time (ms)Mean process (ms)Final/first processPlateau
midpoint512111,5262.4301.716fail
all-low256119,5724.0201.963fail
all-high768809,69145.5665.517fail
focus-low38489,1972.3351.448fail
focus-high640246,9364.8021.838fail
sensitivity-low44874,8941.5651.554fail
sensitivity-high5761,866,911110.9896.841fail
stability-low448149,1614.1361.762fail
stability-high576105,3811.8871.760fail
+ +Sensitivity was the dominant adverse axis: the high-sensitivity wall +time was 24.93 times the low-sensitivity wall time, and +`PropagateEmotionalCascade` accounted for 98.78 percent of its +early-to-late process growth. The all-high run attributed 95.10 percent +of growth to the same operation. At midpoint and lower sensitivity, +graph retrieval and memory storage remained the dominant contributors. +The content-addressed aggregate is +`active-epoch-knob-long-horizon-ablation-v1.json`. These text-ingress +runs prove the knob formulas, hard epoch ceilings, and reset mechanics +across the selected grid, but reject latency boundedness within every +envelope; modality and source agnosticism remain separately covered by +the fixed-embedding active-route regression rather than inferred from +this corpus. + +The next retained active-epoch candidate removed redundant values from +the connection-local database rather than changing the persistent +recurrence. Profiling a copied mature 1,000-event slice first attributed +0.351847 ms of a 0.385052 ms publication to loading complete persistent +RIF rows. The retained identity ledger loads and publishes only active +`memory_id` values in the same knob-derived *B*-row statements; the +recovery clock, anchored suppression, recovery total, log factors, +expiry, and effective view remain authoritative only in persistent +SQLite. Strength-only refreshes do not publish when membership cannot +change. Natural and Durable still share the same write and publication +path, with Durable adding only its checkpoint. + +Against the same copied database and eight fixed consolidations, +publication fell from 0.384426 to 0.103604 ms, a 73.05 percent reduction +that passes the preregistered 20 percent local gate. Mean process time +changed from 3.282725 to 3.243371 ms, total latency from 14.891846 to +15.254791 ms (+2.44 percent), and wall time from 16,096 to 16,368 ms +(+1.69 percent). All 1,000 public behavior rows, the canonical logical +database, and the raw SQLite database were exact; the observed midpoint +statement high-water was 128. A separate fresh 1,000-event screen +recorded 0.009047 ms publication and 0.684362 ms process, but used four +live-hint consolidations and is therefore only a non-regression screen, +not fixed-index equivalence. Removing the membership preflight and using +`RETURNING` was rejected after publication regressed to 0.335491 ms. +These copied-slice source-health results did not decide the full +15,695-event Natural plateau, Durable horizon and checkpoint proof, or +bounded restart. `TRACE[state:rif_active_identity_ledger]`. + +The subsequent default-knob Natural replay resolved *B* = 125, processed +all 15,695 packets with an observed statement high-water of exactly 125, +and ran 31 consolidations in 82,994 ms. Mean process time was 1.944934 +ms, mean total latency was 5.107905 ms, and active-epoch publication +averaged 0.019719 ms. This closes the full-Natural batch-bound check but +not the engine plateau: over the final six eligible windows process and +throughput ratios were 1.0072 and 0.9555, while transaction commit was +1.1129 and the exact graph-comparison work counter was 1.1304. The +identity ledger is therefore retained as a local repair and the next +hotspot is reranked; Durable and bounded-restart proof stay open. + +The real 2,016-message Durable replay exercised that identical +default-knob path with four consolidations, the same derived *B* = 125 +and the same observed 125-row high-water. Mean process and total latency +were 5.883704 and 11.471774 ms, wall time was 23,845 ms, and the added +checkpoint barrier averaged only 0.000158 ms. This supports the +one-path-plus-flush architecture, but the corpus contains only three +post-warmup 500-event windows against the required ten; it cannot +establish a Durable plateau, and same-index copied-store equivalence +remains separate proof. + +That result nominates a bounded emotional-propagation experiment rather +than a larger retrieval envelope. The proposed `bounded-priority-prefix` +reuses the current-event retrieval capacity *C*, backfill batch *B*, and +activation target *A* = 2*C* + 2*B*. The candidate keeps a 5*C*-capacity +index of rows already satisfying the flashbulb, intensity, arousal, and +recency predicates, ordered by descending creation time and memory +identifier. It inspects that eligible prefix and uses at most 5*C**B* +comparisons or moves to select *B* sources in descending intensity and +ascending memory-identifier order. It may emit at most *B* source +memories and embeddings, visit 5*C* physical association edges, retain +5*C* + *B* frontier/visited and topology-footprint entries, consider *A* +activated identities, and enqueue *A* update statements. Source-index +maintenance is bounded independently by +(5*C*)2 = 25*C*2 comparisons or moves per event. + +A statement count alone is not a fixed-work guarantee because an +embedding can be shared by arbitrarily many memory rows. The candidate +therefore admits only embedding identities with at most *B* members and +gives current-value member reads, SQL-affected rows, and cache-row +mutations separate 5*C* total budgets. An identity whose complete member +set does not fit every remaining budget is skipped. Member-vector size +detects the logical *B* + 1 overflow boundary in constant time; no +plus-one row is fetched or mutated. At *F* = *S* = *T* = 0.5, *C* = 512, +*B* = 128, and *A* = 1, 280: every 5*C* surface is 2,560, every *B* +source surface is 128, every *A* surface is 1,280, every 5*C* + *B* +surface is 2,688, source-index maintenance is 6,553,600, priority +selection is 327,680, and the logical overflow boundary is 129. All-low +resolves these families to 1,280/64/640/1,344/1,638,400/81,920/65; +all-high resolves them to 3,840/192/1,920/4,032/14,745,600/737,280/193. +Thus 128 and 129 are consequences of neutral F/S/T, not hidden +constants. The proposal has no durable backlog or second write path: +SQLite remains authoritative and the in-memory metadata/fanout view +remains rebuildable and rollback-equivalent. Neither modality nor source +identifier is a predicate or budget input. + +This is a preregistered candidate, not a result or cutover. A +deterministic dense-graph regression must first fail on the current +unbounded traversal. The candidate must then prove all formulas over the +27-point structural knob grid, including source-index, selection, +emission, member-row, and cache work. Exact parity is required when the +unbounded event stays within every resolved source, edge, frontier, +identity, member, affected-row, and mutation limit. Above the envelope, +candidate and control run once on separate byte-identical pre-event +stores at identical consolidation indices. If *U**c* and +*U**b* are the control and bounded sets whose final minimum +intensity or bonus increased, the candidate requires +|*U**b* \\ *U**c*| = 0 and recall +|*U**b* ∩ *U**c*|/|*U**c*| ≥ 0.95; +empty control and bounded sets pass, while an empty control with a +nonempty bounded set fails. For each metric, retained delta is the ratio +of the sum of positive bounded changes to the sum of positive control +changes over *U**c* ∪ *U**b*, must be at least +0.99, and passes a zero control denominator only when the bounded +numerator is also zero. Non-finite values and bounded per-identity +deltas exceeding control by more than 10−12 fail. Downstream +gates allow at most one exact top-1 miss per 512-query run, require +identity recall at 16 of at least 0.998 and semantic coverage of at +least 0.95, and reject clustered top-1 misses. + +Per-event cascade timing includes zero-work events. Early and late means +use the first and last 3,000 events; positive-over-zero and non-finite +ratios fail. The p99 is nearest-rank ⌈0.99*n*⌉ over all events and must +be at most one quarter of the same-knob, same-retention control, with +zero control passing only zero candidate. Sensitivity-high and all-high +must also hold late/early mean to 1.10. The preregistered nine tuples +are midpoint, both joint endpoints, and the low/high endpoint of each +one-axis change while the other knobs remain 0.5. Every tuple runs fresh +matched candidate/control pairs for both the exact 15,695-packet Natural +corpus and 2,016-message Durable corpus, with one selected algorithm per +event, control-derived fixed consolidation indices, and exact +source-tree, build, binary, corpus, database, profile, audit, raw, and +sanitized digests. During that experiment the private selector accepted +only `control` or `bounded`, defaulted to `control`, and rejected any +other value before mutation. The candidate could have cut over only by +removing that selector and the unbounded implementation, leaving one +Natural/Durable path with Durable adding only its checkpoint. The +midpoint rejection instead removed the candidate; the measured envelope +and disposition are retained here. + +The rejected implementation packet exercised that preregistered shape +behind a private selector without claiming cutover. The red dense-graph +regression visited 2,561 edges against the neutral 5*C* = 2, 560 ceiling +on the prior path. The experimental implementation kept the eligible +recency prefix at 5*C*, performed deterministic bounded top-*B* +selection, traverses sources sequentially with first-source-wins +identity ownership, skips shared embeddings at the logical *B* + 1 +boundary, and updates accepted member rows with one row-addressed +`UPDATE ... RETURNING` statement. `RETURNING` is required for exact +accounting through caller-supplied transaction wrappers: a later +compatibility statement would otherwise overwrite SQLite’s +connection-local `changes()` value. The same statement was enclosed by a +narrow managed-mutation scope so the caller-SQL compatibility layer +could distinguish the cascade’s cache-maintained write from arbitrary +caller SQL. Arbitrary same-event caller SQL invalidated every +database-derived surface and the bounded cascade failed closed; the next +event rebuilt from committed SQLite before traversal. + +One hooks-on Release binary then passed 807 assertions in 13 fixed-work +tests and 907 assertions in 32 complete emotional-cascade tests. The +fixed-work set includes every one of the 27 structural F/S/T points, +exact *B* mutation, logical *B* + 1 overflow, source prefix and priority +work, dense edge saturation, below-envelope candidate/control parity, +invalid and mid-event selector behavior, caller-SQL invalidation and +rebuild, engine-owned rollback, process restart, and an explicit +consolidation event. A separate `FullRoot` regression passed 5,552 +assertions while varying two then four opaque source identifiers, +text/audio/image labels, and both Natural and Durable retention; every +cascade counter remained within the same F/S/T-derived ceiling, and +Durable alone reported the existing post-commit checkpoint. Those +focused results established the structural and lifecycle seams only. The +full-corpus midpoint below then failed the preregistered timing and +identity-quality gates, so the selector, managed-mutation seam, and +candidate-specific counters were removed. The structural results remain +historical experiment evidence, not production source health. +`TRACE[state:emotional_cascade_fixed_work_candidate]` +`TRACE[rejected:EmotionalCascade.knob-derived-bounded-priority-prefix]` + +The fixed-time midpoint screen rejected this candidate before the +nine-point matrix. A same-binary Natural control/candidate pair used +timestamps 1, 700, 000, 000, 000 + 1000*i* and the control’s 118 +successful consolidation indices for both fresh stores. Every candidate +hard-work counter remained within its neutral-knob limit: source +candidates and executions reached 37, physical edges reached +5*C* = 2, 560, frontier and topology entries reached 1,888 and 476, +activated identities reached *A* = 1, 280, and member reads, +SQL-affected rows, and cache mutations each reached 133. Nevertheless, +candidate p99 was 0.397625 ms versus 0.693875 ms for control, a 0.573 +ratio against the preregistered 0.25 maximum. Its late/early mean ratio +was 2.324. The control and candidate profiles are content-addressed by +`8ef80929db664afd8ac87c256033d7ae3c9ac88036edaddf5f270940c79e52ba` and +`dd0cdd0801b7656dd8835528977b8d3e925b15d2b8dca398c14bb7d819eacd55`; the +fixed schedule digest is +`901fac42a38125e525d6ca44b63312248b36b30b35d8eb3156ff5d4dc7fbcd8f`. + +Three implementation-only iterations retained every formula and semantic +boundary. First, traversal scratch was reserved from 5*C* + *B* and +reused across sources, while a fixed indexed `embedding_id` update +replaced variable-length SQL construction and required the exact +returned memory identifiers to match the cache before mutation. This +produced p99 0.395666 ms. Second, the candidate persisted the +already-budgeted 5*C* + *B* expandable topology footprint and reused a +fixed point only when a new edge was provably outside that footprint; +active traversals fell from 6,710 to 1,369 and mean cascade time fell +from 0.0644 to 0.0260 ms, but p99 rose to 0.475541 ms because the +nearest-rank percentile now landed inside the remaining full traversals. +Third, a generation-stamped visited map allocated each event’s unique +memory identities once instead of reallocating hash nodes per source. +Mean cascade time fell again to 0.023903 ms and p99 to 0.432000 ms, +while traversal alone remained 0.223292 ms at p99. These tuning profiles +have digests +`d06e1042784afbe760ff2e2917541bf07628adc7d9055561372fa513aa6274b8`, +`ca4039abeaf873acb500b9279dfb1dacd4fb99f57c24c25751c5d7f1edd36bef`, and +`5ee53d12f0fc98c8e746553500be2f12802a62a5d38de681d84672580d55d916`. They +are tuning diagnostics rather than admissible performance pairs because +their comparison control predates the corresponding binary changes. + +The final tuning profile independently failed the downstream +public-retrieval gate, so an additional exact-binary timing pair could +not rescue the candidate. Over 512 deterministic controls and four +opaque source identifiers, exact top-1 was 0.998047, identity recall at +16 was 0.980760, semantic coverage was 0.975084, and tie order remained +deterministic. The content-addressed audit digest is +`da402733380f8cf7f2eda5289a4f95f1a35b55fcd27ede4695499d8acd6b4973`. +Exact top-1 1.0 and recall 0.998 were mandatory, so +`bounded-priority-prefix` is terminally rejected without running the +remaining knob/corpus matrix or claiming direct bounded/control delta +fidelity. The structural formulas remain useful design evidence: neutral +128 and logical 129 were always derived from *B*(*F*, *S*, *T*), no +plus-one row was read or mutated, and the latest focused tests passed +824 assertions in 15 fixed-work cases, 924 in 34 emotional-cascade +cases, and 5,552 in the mixed source/modality FullRoot case. Those +source-health results do not override the measured rejection. The observation-only bounded activation graph was then implemented behind a default-off private flag and evaluated directly in compiled C++ @@ -6313,35 +7185,2405 @@ the final-five versus prior-five template error must be at most 0.10. Natural cutover cannot use flat-envelope mode to bypass these cycle gates; the already-flat Durable control remains eligible for its separate flat-envelope contract. The separate 512-query, top-16 corpus -gate preserves exact identifier recall and exact top-1 at 1.0 and -requires the complete ordered top-16 identity list to match, including -seven fixed identity-and-rank probes. The summary is recomputed from all -512 per-query records rather than trusted as a label. The candidate must -match a separate control artifact whose exact content digest was -approved before the audit; deterministic query indices, embedding -identities, ranked controls, and the seven fixed probe positions are -bound across those artifacts. The approved control must identify the -current public retrieval path, and the candidate must also preserve the -independently recorded digest of the pre-existing seven public -identity-and-rank probes; the pre- and post-restart probe digests at -every retained-history fraction must equal the candidate/control -fixed-probe digest, so a restart cannot preserve a consistent but -incorrect ranking; the benchmark’s exhaustive embedding-neighbor mode -can propose a control artifact but cannot label itself approved. Hashed -source provenance, modality, and history position come from the queried -embedding’s authoritative SQLite signal rows; together they must cover -early, middle, and late history, text, audio, image, and at least four -opaque sources. Restart acceptance likewise derives the fixed row-visit -ceiling from F/S/T and checks measured retained-row and visited-row -series from a production-shaped persistent restart rather than trusting -pass/fail labels. The three retained counts are fixed at 25%, 50%, and -100% of the bound corpus, visited-row counts must be nonzero and within -the F/S/T capacity, and a ranked probe digest before restart must match -the restored probe with at least top-16 candidate state. The current -synthetic full-history fallback measurement is explicitly ineligible. -These are candidate-selection thresholds, not evidence that the current +gate requires mean exact-identifier recall of at least 0.998, at most +one exact top-1 miss, and mean exact-neighbor semantic coverage of at +least 0.95. Across the prescribed nine-run matrix, aggregate top-1 must +remain at least 0.999 and two misses may not share a modality, opaque +source, memory-age quartile, or exact knob point. The candidate’s +complete ordered top-16 lists must repeat byte-for-byte under the same +seeds, while all seven fixed identity-and-rank probes must still match +the exact control. This permits only the explicitly approved bounded +approximation; it does not permit clustered top-1 drift, +nondeterministic ties, or semantic substitution below the exact-recall +floor. The summary is recomputed from all 512 per-query records rather +than trusted as a label. The candidate must bind to a separate control +artifact whose exact content digest was approved before the audit; +deterministic query indices, embedding identities, exact ranked +controls, provenance, and the seven fixed probe positions are bound +across those artifacts. Candidate ranks are separately content-addressed +across two complete runs rather than being required to equal the exact +control outside the approved lower-rank allowance. The approved control +must identify the current public retrieval path, and the candidate must +also preserve the independently recorded digest of the pre-existing +seven public identity-and-rank probes; the pre- and post-restart probe +digests at every retained-history fraction must equal each other, and +the full-history fraction must additionally equal the candidate/control +fixed-probe digest. Each smaller fraction uses probes drawn only from +its retained prefix, so the gate tests restart equality without +referring to absent history; the benchmark’s exhaustive +embedding-neighbor mode can propose a control artifact but cannot label +itself approved. Hashed source provenance, modality, and history +position come from the queried embedding’s authoritative SQLite signal +rows; together they must cover early, middle, and late history, text, +audio, image, and at least four opaque sources. Restart acceptance +likewise derives the fixed row-visit ceiling from F/S/T and checks +measured retained-row and visited-row series from a production-shaped +persistent restart rather than trusting pass/fail labels. The three +retained counts are fixed at 25%, 50%, and 100% of the bound corpus, +visited-row counts must be nonzero and within the F/S/T capacity, and a +ranked probe digest before restart must match the restored probe with at +least top-16 candidate state. The current synthetic full-history +fallback measurement is explicitly ineligible. These are +candidate-selection thresholds, not evidence that the current observation-only graph passes them. +The preliminary embedding-router feasibility selected a two-graph +packed-route hybrid evaluated over 34,456 normalized, 256-dimensional +embeddings. Each sealed embedding retained 512 route entries; each new +active-epoch embedding proposed at most 64 reciprocal updates; each +graph used a 16,384-comparison construction ceiling and a +1,280-comparison query ceiling. Across 512 deterministic top-16 queries, +exact top-1 was 1.0, mean exact-identifier recall was 0.998413, and mean +exact-neighbor semantic coverage was 0.999961. Thirteen of 8,192 +exact-neighbor slots were absent, spread across ten queries, while all +seven fixed identity-and-rank probes remained exact. The complete +candidate rank stream repeated with the same content digest in two runs. +Mixed-input evidence included four opaque sources and text, audio, and +image labels after encoding; the router consumed only embedding values +and embedding identity. + +The selected benchmark snapshot restarted from 1,024 anchor rows and +four packed SQLite blobs. At 25%, 50%, and 100% retained history, all +fixed prefix-local probe results were identical before and after +restart; the maximum restart visit count was 1,029 rows while the full +snapshot retained 34,456 embeddings. Active-epoch SQLite allocation +peaked at 708,608 bytes and reciprocal mutations peaked at 11,967, below +the historical midpoint 32,768 ceiling. Ten modeled material cycles had +zero normalized cycle-template error and zero late-template error, with +post-consolidation retrieval work 0.888889 of the preceding level. This +establishes a bounded and repeatable embedding-router direction, not the +production-shaped quality gate, live cycle, or latency proof: the cycle +result is derived from the fixed-work benchmark model and must still be +reproduced at public consolidation boundaries in the shared engine path. + +Several variants were rejected before selecting that point. A +reciprocal-route only design reached 0.979858 mean exact recall; adding +a third graph did not improve recall at equal per-graph work; reducing +construction to 4,096 comparisons per graph reached 0.995972; and an +8,192-comparison construction with 64 reciprocal proposals reached +0.997803. All retained exact top-1, but all fell below the approved +0.998 lower-rank recall floor. The chosen point therefore spends +additional bounded construction work to remove all but 13 lower-rank +misses on that feasibility population, rather than weakening the +top-result or semantic gates. + +An even simpler anchor-only route was also rejected on the corrected +3,172 current-memory surface. With four selected routes per query, 512 +anchors reached mean exact recall 0.98425 and exact top-1 0.97656; 1,024 +anchors reached 0.99194 and 0.98633 respectively. Adding exact +reciprocal node-route hops reached only approximately 0.982 recall. +These were private one-off randomized held-out feasibility probes and +their raw output was not retained, so they are recorded as negative +design evidence rather than reproducible acceptance proof. The result +rules out using anchors as the retrieval candidate set by themselves; +anchors remain useful only as bounded route entry points into the +independently constructed sparse graphs. +`TRACE[state:anchor_only_route_feasibility]`. + +A control audit then found that the 34,456 identities came from the +complete `embeddings` table. The public seed path ranks eligible +long-term/current memory surfaces, not signal-only embedding ids, and +additionally applies timestamp, supersession, current-surface, and +family filters. Labeling the exhaustive embedding-neighbor artifact +`current-public-retrieval` was therefore invalid. The corresponding +production-shaped pass is revoked; the result remains only +router-feasibility evidence. + +The corrected current long-term surface contains 3,172 memory +identities, a 10.86-fold smaller and semantically different population. +Over the same 512 deterministic top-16 queries, the two-graph route +reached exact top-1 1.0, exact recall-at-16 1.0, and semantic coverage +1.0 with no missing query. Maximum construction work was 6,344 +comparisons. Ten 128-memory-node incremental feasibility epochs used at +most 184,320 active SQLite bytes; mean graph insert, route construction, +and reciprocal-update times were 0.073002, 0.044416, and 0.013539 +seconds per epoch. At 25%, 50%, and 100% retained surfaces, restart +visited 798, 1,029, and 1,029 rows and preserved all prefix-local +probes. These results retain the sparse-route design but do not close +the public control: the next quality artifact must compare against the +runtime’s exact eligibility, supersession, current-surface, and family +behavior. The active sawtooth remains signal-event based, so the +128-memory-node epochs also cannot substitute for ten live 512-signal +consolidation cycles. This correction is +`TRACE[state:retrieval_quality_control_correction]`. + +To close that gap without another approximate population model, the +benchmark now captures the actual public retrieval ranks during Natural +ingestion. Queries are sampled evenly from retrieval-active events, not +from every event: the latter includes legitimate no-retrieval decisions +and would make a routing quality denominator vacuous. A 100-event smoke +contained 27 retrieval-active events; an eight-query sample covered +events 6 through 96 and retained nonempty direct, graph-expanded, and +hydrated rank lists for every query. In a separate paired 200-event run, +enabling the capture preserved behavior SHA-256 +`40833b57d441b8d7e704787768e8157bacdd8a2525616af8893bbf2d164a87bb` and +logical-database SHA-256 +`e83dabd67109258d9609d82c26ed01c227045c6ae1f7786ef4b15bb296824ff8` +exactly. The complete 15,695-packet run then sampled 512 controls from +5,390 retrieval-active events, spanning events 6 through 15,691. Direct +controls contained 1–16 identities and the hydrated public result +contained 1–12; the fail-closed audit accepted the control population. +The corpus itself is one opaque source and text-only, so it cannot +satisfy the independent four-source text/audio/image implementation +gate. `TRACE[state:public_retrieval_control_capture_experiment]` is +exact public-control evidence, not candidate acceptance. + +Three standalone HNSW variants then attempted to reconstruct +point-in-time candidate routes from the final database. All used two +graphs with *M* = 64, construction effort 200, query effort 1,280, and a +route cap of 512. Indexing every retained surface version produced +apparent identity coverage 0.983770, top-1 coverage 0.914063, and +73.8887 current candidates on average. Replacing each memory with one +current node raised occupancy to 406.641 but produced 0.983155 and +0.912109. Keeping the original surface plus one replaceable current +reconstruction produced 231.445 candidates and 0.983893/0.914063. An +exhaustive dual-surface top-512 oracle produced exactly the third +variant’s apparent misses, while every one of the 8,133 ranked control +slots was present in retained history at its sampled query (memory +identities repeat across queries). The mismatch is therefore not HNSW +approximation or eviction. + +The quality labels are invalidated because the final database is not an +exact time-travel log of the retrieval surface: reconsolidation updates +`memories.embedding_id`, and the retained reconstruction/current tables +do not encode every intermediate live processor surface at every earlier +query. Even substituting `original_centroid` cannot reconstruct that +mutation order. These runs remain useful negative evidence about the +post-run evaluation method, not evidence for accepting or rejecting the +sparse algorithm. The next valid experiment must capture surface +upserts/removals live and replay that stream against the unchanged +public controls. Four-source text/audio/image evidence, live cycles, and +production cutover remain pending. +`TRACE[state:public_hnsw_route_prototype_experiment]`. + +The live mutation capture first passed a 100-event source-health run: 48 +ordered upserts were recorded, every vector had 256 dimensions, 27 +events activated retrieval, and eight sampled public controls remained +valid. A paired 200-event run then produced identical behavior SHA-256 +`25ed7beeb14a7fc1e4201c632c324c1d45a4d6d1f31e2d9e10799738cdb42c5e` and +identical logical-database SHA-256 +`1625c3b6a85b585c4e55a8cc83c2871c2b7a6ab8730f788a21b2d9f41f268113` with +capture off and on. This proves observer neutrality only; the full live +mutation population was therefore still required. Using the live stream +as a conservative current-vector route, without attempting to replay +final-table supersession state backward in time, the two-graph candidate +covered every public seed identity and every top-1 identity in both the +eight-query/100-event and sixteen-query/200-event smokes. Candidate +occupancy grew from a mean 9.75 (maximum 20) to 21.9375 (maximum 41). +Exact timestamp, supersession, family, and final-rank decisions remain +downstream engine work; the preliminary exact coverage does not yet +establish full-run quality, bounded cycles, restart, or latency. +`TRACE[state:live_surface_mutation_capture_experiment]`. + +The complete live run recorded 9,175 ordered 256-dimensional upserts +across 15,695 packets; this corpus produced no surface removal. It +retained the same 5,390 retrieval-active events and 512 sampled queries +as the prior control. Capture and control had identical full-run +behavior digest +`ed1146a0ed9b2a85eb2ff7c4b511f39357e6db9c363827d941d96163dc7a1463` and +logical-database digest +`522f0dfa9e33e2053903ae938a7bb934319ff836ba608250bd8cd42677b950ca`. The +live two-graph route covered all 8,133 ranked public seed slots and all +512 top-1 identities: exact identity coverage 1.0 and top-1 coverage +1.0. It returned 470.977 candidates on average and at most 512, with a +10.5183-second offline evaluation time. A complete repeat produced the +same per-query candidate-order digest +`2b3e30b0f413692cd8c5a77a15c464ebcc953685901be3904c1b19c96eaf22af` and +the same normalized result digest +`f8dafb51cdac5fafda8f93e1b2b07e9a5135a4f43066625cec92f7a19acebcb0`. +Exact downstream filters remain authoritative, so this is a +candidate-set quality pass, not a final-rank rewrite or a production +cutover. The corpus is still one opaque source and text-only; +four-source text/audio/image evidence, restart bounds, ten live cycles, +and integrated latency remain open. + +The next experiment moved that exact candidate route into the real +retrieval operation and used a deterministic 2,500-packet Natural prefix +with four opaque source identities cycling across text, audio, and image +labels after the common encoder. It sampled 128 actual public controls +at *k* = 16. The exact control visited 1,078 current rows at the final +event and spent 1.83742 ms in cached seed discovery. The retained route +visited exactly 512 rows and spent 1.54363 ms, while all 128 ranked +identity lists, the complete behavior digest +`d5bf0c833a2b1677b2df21882145587b21ab03a44cd6b88935f0199d266c7dc2`, and +the logical-database digest +`05e7bf911fe848e1a7d7a8db77be7b7edcf289aab0055e965e901c80366dc06e` +remained exact. Total wall time moved from 48,176 to 49,828 ms +(1.03429x), and mean process time moved from 2.79103 to 2.85218 ms +(1.02191x). This is focused integrated evidence, not full-horizon +flatness, restart, or production cutover. + +Two direct integrations were rejected before that result. Updating both +HNSW graphs on every surface mutation retained the 512-row route and +exact sampled ranks but raised wall time to 90,022 ms and mean process +time to 19.7725 ms. A sealed graph plus exact delta that rebuilt after +every one of the run’s 356 consolidations raised wall time to 93,969 ms. +The retained algorithm keeps the sealed graphs across consolidation, +journals changed row addresses in the exact delta, and reseals only when +512 distinct changes accumulate. This is the measured reason +consolidation is an epoch boundary rather than a command to rewrite the +entire index every time it is requested. +`TRACE[state:integrated_hnsw_sparse_route_experiment]`. + +The same-event exact-control seam subsequently corrected the integrated +quality measurement. A complete 15,695-packet, four-source replay +cycling text, audio, and image labels sampled 512 retrieval-active +events while running the route and exact current-surface scan on the +same query. Exact top-1 was 1.0, exact identity recall at 16 was +0.999877451, and conservative semantic coverage was 0.999809451; +deterministic tie order and all control-population checks passed. The +exact scan is proof instrumentation only and its 1,160,884 ms wall time +is not a performance result. This satisfies the owner-authorized quality +tradeoff at this scope, but it does not establish bounded restart, cycle +symmetry, or default-on readiness. + +A follow-up candidate changed consolidation from threshold-triggered +full resealing to deterministic incremental sealing of every successful +epoch’s distinct additions, updates, and tombstones into the retained +graphs. Focused delete, seal, reinsert, delta-reset, and same-route +tests passed. Two 2,500-packet runs completed all 356 public +consolidations in 59,526 and 60,427 ms wall time, compared with 48,176 +ms for exact routing and 49,828 ms for the prior sealed-snapshot +candidate. In the first run, mean ordinary process time was 2.77838 ms +versus 2.79103 ms for control, mean reported total latency was 10.2603 +versus 9.65932 ms (1.06221x), and measured consolidation time was +14,341.6 versus 13,907.5 ms (1.03121x). Because the first two wall +regressions of 1.23559x–1.25430x exceeded those fields, a third run +persisted the consolidation-context route timings instead of assigning +the difference to HNSW by inference. It completed in 54,165 ms (1.12432x +control), with mean ordinary process time 2.66766 ms (0.95580x), mean +reported total latency 9.88112 ms (1.02296x), and consolidation time +14,058.0 ms (1.01083x). Across 204 route-active consolidations, +incremental sealing consumed 381.006 ms total (1.86768 ms per active +seal) for 1,163 distinct delta identities. Reloading the authoritative +retrieval surface consumed 9,220.74 ms across all 356 consolidations, +showing that the existing full-surface reload—not the incremental HNSW +mutation—is the dominant named route-epoch cost. The incremental seal is +therefore retained as a default-off candidate within the current latency +tradeoff, while row-addressed SQLite route startup and removal of the +full-surface reload remain required before cutover. +`TRACE[state:integrated_hnsw_consolidation_seal_experiment]`. + +### Historical pre-cutover knob-derived SQLite HNSW ablation + +The first row-addressed route was moved from a fixed midpoint to the +complete F/S/T-derived surface defined in the implementation section. A +structural 3 × 3 × 3 test grid covered all 27 low, midpoint, and high +combinations with 603 assertions over capacity, backfill, expansion +breadth, bootstrap, visited nodes, cache size, maximum level, topology, +reciprocal updates, and construction/query effort. The neutral setting +intentionally remains the measured 512-candidate, 128-row-backfill +configuration; low and high settings now change the topology and every +work ceiling with it. + +These nine runs describe the earlier 4*C* visited-node, 2*C* +search-effort, 8*C* cache candidate and its +exact-fallback-on-any-dirty-row policy. They remain retained as +evaluated history, but they are stale for the current source after the +quality-selected 8*C*/4*C*/16*C* route and bounded *B*-row dirty delta +were integrated. They cannot satisfy the final cutover matrix; the +current-source nine-point 2,000-event rerun is reported immediately +below, and the later 15,695-packet nine-point latency/reset ablation is +reported above. + +Nine production-shaped 2,000-event Natural replays then used the +authorized private Claude-session sentence corpus. Each run generated +its own 512-query same-event exact `GraphRetrieve` control at *k* = 16, +used four opaque source identities, and cycled text, audio, and image +labels after the shared encoder. All 4,608 system-path queries passed: +exact top-1 and mean identity recall at 16 were 1.0 in every run, +deterministic tie order held, and the minimum conservative semantic +coverage was 0.999532. Four configurations actually queried the SQLite +sparse route and passed those gates. Sensitivity-low remained below its +activation threshold. Focus-low had a published hierarchy but a nonempty +durable journal at every sampled route opportunity, while +sensitivity-high, stability-high, and all-high remained unpublished; all +five therefore exercised exact fallback. Those runs establish system +fallback quality, not sparse-route quality. Every raw profile records +the resolved knob configuration rather than relying on the evaluator to +reconstruct it. + + +++++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Configuration (F, S, T)C / B / max levelneighbors / L0 / reciprocalconstruction / querymax visited / restartprocess / total msroute state
all-low (0,0,0)256 / 64 / 832 / 64 / 4100 / 640776 / 125.532 / 33.749active; 5 SQLite-route events; observed level 5
Focus-low (0,.5,.5)384 / 96 / 948 / 96 / 6150 / 9600 / 019.010 / 25.449dirty journal; exact fallback; hierarchy reached level 5
Sensitivity-low (.5,0,.5)448 / 112 / 956 / 112 / 7175 / 1,1200 / 00.544 / 0.952surface stayed below C
Stability-low (.5,.5,0)448 / 112 / 956 / 112 / 7175 / 1,120906 / 119.443 / 23.669active; 31 SQLite-route events; observed level 5
neutral (.5,.5,.5)512 / 128 / 964 / 128 / 8200 / 1,280974 / 114.314 / 18.392active; 30 SQLite-route events; observed level 5
Sensitivity-high (.5,1,.5)576 / 144 / 1072 / 144 / 9225 / 1,4400 / 059.718 / 62.364build unpublished; exact fallback; observed level 4
Stability-high (.5,.5,1)576 / 144 / 1072 / 144 / 9225 / 1,4400 / 013.855 / 18.073build unpublished; exact fallback; observed level 4
Focus-high (1,.5,.5)640 / 160 / 1080 / 160 / 10250 / 1,600968 / 112.800 / 14.656active; 17 SQLite-route events; observed level 4
all-high (1,1,1)768 / 192 / 1096 / 192 / 12300 / 1,9200 / 051.722 / 52.864build unpublished; exact fallback; observed level 4
+ +The maximum observed backfill batches at the all-low, neutral, and +all-high points were exactly 64, 128, and 192 rows. Active routes never +exceeded their 4*C* visited-node limit and opened the route from one +metadata row. Zero visited rows do not claim zero retrieval work: those +configurations either remained below their activation threshold or had +not accumulated enough consolidation boundaries to publish the bounded +build, so the exact scan was both production candidate and control. + +Four defects were rejected during this ablation rather than folded into +the reported pass. The first all-low run visited 1,042 rows against its +1,024-row ceiling because hot-cache hits bypassed the database-miss +budget; the fetcher now applies one ceiling to cached and uncached +nodes, and a warmed-cache regression reproduces the low-knob case. +Earlier generation-reset variants also discarded resumable progress, and +a later build marker could resume nodes but lost committed live +mutations. The retained design instead keeps an authoritative +dirty-identity journal across both active and unpublished generations. +The unpublished build was also copying every live write into an +unbounded in-memory delta even though exact fallback remained +authoritative. At sensitivity-high this exceeded the construction search +ceiling on the second batch. The retained path keeps those live +identities in SQLite, drains at most *B* dirty identities plus *B* +backfill rows per construction edge, and clears only the identities +actually sealed. A focused 400-dirty-identity regression covers both +active and unpublished drainage. Finally, the first persisted +implementation assigned every node to level zero; the retained route +deterministically assigns hierarchy levels capped by +⌈log2*C*⌉, bounds upper-level links by the knob-derived +neighbor limit, and requires observed upper-level rows before a corpus +slice may be called route-lifecycle exercised. The retained databases +additionally decode to nonempty upper-level adjacency on every exercised +route (236, 160, 125, and 90 upper-level nodes respectively), rather +than merely containing positive level labels. The nine reruns now record +zero backfill and search failures. They were rerun with benchmark +executable SHA-256 +`a398ac2d0ce5188bb1708f811a30689d59412efcffc2c4c08587bb33c6f7c780`; the +four direct regression reports bind test executable SHA-256 +`4ee4dd4c5d28583ffea8dc2ab6f43bc40572f2496d589923736b9fb242ad4513`. All +nine SQLite databases are retained in the private artifact root and +content-addressed beside their profiles and audits. The aggregate +artifact is content-bound by SHA-256 +`8ef2012604c5efe6f547837bc8e8c0e625a691de52c051187858e43b344fe1a3`. + +This matrix proves knob derivation, local work ceilings, bounded +live-dirty drainage, source/modality agnosticism, runtime hierarchy +construction, route lifecycle exercise on four configurations, exact +whole-system quality on all nine, and one-row sparse-route metadata open +at 2,000 events. It does not separately materialize route-active query +quality and does not prove bounded whole-engine restart; processor +startup still loads the complete current surface. It also does not prove +the full 15,695-event plateau, repeated sawtooth symmetry, or +production-wide boundedness. Whole-engine timing is also not an +HNSW-only ablation: changing F, S, or T changes retrieval admission, +consolidation frequency, and surface evolution. +`TRACE[state:sqlite_hnsw_knob_ablation]`. + +### Consolidation-centroid and activation-effort follow-up + +The first bounded-supersession full replay retained the static 6*C* +query effort. It completed 15,695 events and kept write-time +supersession candidates bounded, but 2,833 consolidations did not +flatten retrieval: mean SQLite sparse route visits rose with the +persisted graph. This rejected the claim that candidate capacity alone +made consolidation restorative. + +A connection-local centroid recenter was then added. The first +5,000-event probe still consolidated 801 times because the detector +cooldown incorrectly used a backlog counter that can remain high when a +consolidation has no association mutations. Replacing that condition +with a post-acknowledgement observation count derived from *B* reduced +the same 5,000-event cadence to 35 consolidations, normally 128 +observations apart at neutral knobs. That probe still did not lower +route work: 6*C* exceeded the reachable graph in those epochs, so +changing only the entry centroid could not change traversal breadth. +Both variants were therefore retained as rejected diagnostic steps +rather than reported as a performance fix. + +The selected follow-up couples the centroid to the 2*C* → 6*C* +activation effort cycle described in the implementation section. A +1,000-event copied-late control at *F* = *S* = *T* = 0.5 exercised seven +successful resets to 2*C* = 1, 024. Its 512 independently captured +public controls across four opaque source identifiers and text, audio, +and image inputs retained exact top-1 1.0, recall at 16 of 1.0, semantic +coverage 1.0, and deterministic tie order. A separate 2,000-event +copied-late performance replay produced 15 complete large-store cycles. +The phase-edge sample is itself knob-derived as *m**a**x*(2, ⌊*B*/32⌋), +or four retrieval-active queries at neutral knobs. Eleven cycles had at +least a 1.10 pre-consolidation visited-row ramp and all 11 reset by at +least 10%; the median immediate reset ratio was 0.859. The first and +second halves of material-cycle peak work differed by 1.041, while +trough work differed by 0.992, both inside the 1.10 late-drift limit. A +fresh 5,000-event replay produced the intended 35-consolidation cadence +but remained below the 2*C* traversal envelope; it is warm-up evidence, +not a late-store sawtooth claim. + +The subsequent 15,695-event full replay rejected queue effort as the +only work-control mechanism. It completed 117 consolidations in 927,365 +ms. The recorded 2*C* → 6*C* waveform itself was repeatable (p95 +normalized shape error 0.0118 and late-template error 0.00496), but +actual node visits continued to rise: only 13 of 23 material cycles +reset, and late/early peak and trough ratios were 1.167 and 1.159. +End-anchored process windows rose from about 2.21 to 3.24 ms, throughput +fell from 29.07 to 10.38 events/s, and the final 500-event tail reached +9.44 events/s. Normalized consolidation cost rose 2.50-fold per sealed +event and 2.16-fold per sealed mutation. HNSW queue effort limits the +candidate queue, not the number of row-addressed graph nodes fetched, so +a symmetric control waveform did not make actual work restorative. + +The first actual-node candidate used the knob-derived ⌈11*C*/2⌉ → 12*C* +cycle, or 2,816 to 6,144 nodes in increments of 26 at neutral knobs. Its +copied-late quality probe passed exact top-1 at 1.0, recall at 16 at +0.999878, semantic coverage at 0.999947, and deterministic order. The +full 15,695-event replay cut wall time from 927,365 to 190,736 ms and +mean public latency from 57.542 to 11.068 ms, with no absolute or +dynamic node-budget violations. It nevertheless failed the +restorative-cycle gate: only 10 of 16 material cycles reset, late/early +peaks were 1.107, and troughs were 1.097. This floor was therefore +rejected as too shallow for the required symmetric sawtooth despite its +large runtime gain. + +The selected lower-floor candidate uses 5*C* → 12*C* with step +⌈(12*C* − 5*C*)/*B*⌉. At neutral knobs this is 2,560 to 6,144 nodes in +increments of 28. A corrected 1,000-event copied-mature quality probe +enabled the exact HNSW control capture explicitly and exercised eight +simultaneous queue/node resets to 1,024/2,560. Across 512 controls it +kept exact top-1 at 1.0, recall at 16 at 0.999146, semantic coverage at +0.998680, and deterministic order over four opaque sources and text, +audio, and image. Actual visits ranged from 2,560 to 3,740, recorded +ceilings ranged from 2,560 to 6,144, and no query exceeded its current +ceiling. An earlier run without the exact-control capture flag was +classified candidate-pending rather than accepted. + +Four follow-up variations were rejected rather than silently folded into +the selected result. Lowering the reset floor by one backfill batch to +5*C* − *B* = 4.75*C* reduced exact top-1 to 0.998047. Holding the 5*C* +floor while reducing its derived ramp increment from 28 to 27 also lost +exact top-1 on the copied mature store. Raising the queue floor +independently to 3*C*, 4*C*, or 5*C*, and holding it at 6*C*, reproduced +that same miss. Queue effort and the last quarter-batch of node budget +were therefore not the root cause. Inspection found a live target with +no incoming persisted links, and also found that the route’s +fetched-node cache was larger than the HNSW best queue but only the best +queue was exactly reranked. A connected traversal could never activate +that target regardless of queue tuning. + +The retained repair keeps the HNSW traversal in the existing SQLite +route, then fills the unused portion of the current knob-derived +actual-node envelope from a deterministic indexed active-row slice that +starts at the current entry and wraps once. It exactly reranks every +fetched row, not only the HNSW best queue, before returning the existing +*C*-identity candidate set. The completion is bounded by the same +5*C* → 12*C* ceiling and does not branch on source or modality. In a +512-query copied-mature probe this exact bounded activation kept top-1 +and recall at 16 at 1.0, semantic coverage at 0.999736, deterministic +ties, and zero work-bound violations. + +A final source review found that seal-time node invalidation erased +cache-map rows without erasing their FIFO order entries. Repeated +seal/search cycles could therefore grow bookkeeping even while the node +map stayed at 24*C*. The retained correction clears the map and order +together after a successful seal. The focused SQLite-route suite +directly checks both structures against the knob-derived 24*C* capacity; +this is bounded-cache source proof, not a new full-corpus latency claim. + +That expanding-envelope replay completed 117 consolidations in 175,166 +ms, with mean process latency 3.493 ms and mean public latency 9.942 ms. +All 15 material retrieval cycles reset, late/early peak and trough +ratios were 1.074 and 1.002, the late template error was 0.00450, and +the maximum observed node work was 3,357 under the 6,144 hard ceiling. +The retrieval-specific restorative sawtooth passed under that binary. +The whole-engine plateau did not: final-suffix process latency was 1.165 +times its leading suffix and throughput retained only 0.877 of its +leading rate. Consolidation process peak and trough ratios were 1.201 +and 1.273. After live dirty reconciliation was corrected from a *B* +drain to a *C* drain, however, the expanding public envelope also became +an expensive construction envelope. The current-binary replay took +394,645 ms, including 65,562 ms in 118 consolidations and 58,825 ms in +SQLite route sealing. Public retrieval activated as many as +12*C* = 6, 144 rows, and each dirty root could repeat that work while +selecting graph neighbors. Exact top-1 remained 1.0, mean identity +recall at 16 was 0.998407, and semantic coverage was 0.997572. The +expanding envelope is retained as a rejected experiment, not as the +current algorithm or an engine-wide boundedness claim. + +### Fixed activation and separate construction envelopes + +The first fixed-envelope candidate separated retrieval work from graph +maintenance. Public retrieval always uses a 5*C* actual-node envelope +and 2*C* queue. Consolidation recenters the connection-local entry but +does not increase or reset work size; the zero ramp is an invariant +selecting the fixed F/S/T-derived envelope. Incremental sealing uses the +independently derived *C* + *B* node and 2*B* queue construction +envelope. Historical backfill remains *B* rows; *B* + 1 names the +logical boundary tested by checking the post-*B* in-memory iterator, not +an extra row read. Live dirty reconciliation remains *C* rows, with +*C* + 1 used only as its overflow probe. + +The first neutral 2,500-packet current-binary probe used *C* = 512 and +*B* = 128: public work was fixed at 2,560 nodes and queue effort 1,024, +construction work was bounded at 640 nodes and queue effort 256, and 129 +remained solely the logical historical-overflow boundary. Across 512 +exact public controls, top-1 was 1.0, mean identity recall at 16 was +0.999876, semantic coverage was 0.999947, and all four opaque sources +plus text, audio, and image post-encoding inputs used the same route. +Eighteen consolidations spent 301.174 ms in SQLite route seals in total; +the maximum individual seal was 80.482 ms, down from the roughly +one-second late seals in the rejected current-binary expanding-envelope +run. This was only a quality and local-work probe. A full 15,695-packet +replay and new nine-point knob ablation were therefore required before +retention or plateau claims; those later runs are reported separately +and reject the whole-engine plateau. + +The corresponding full replay rejected that first fixed-envelope +candidate. All mature route queries stayed at exactly the 2,560-row +ceiling and maximum seal time stayed below 114 ms, but exact top-1 fell +to 0.992188, mean identity recall at 16 to 0.975490, and semantic +coverage to 0.967325. Recall by query quarter was 1.0, 1.0, 0.980469, +and 0.921875, so the failure was age-related rather than an immediate 5C +coverage defect. Inspection found that an existing memory whose +consolidation centroid moved updated its embedding but retained its old +outbound neighbor list. The graph became semantically stale even though +its row count and every query remained bounded. + +The relinking candidate recomputed outbound neighbors for both new and +changed active centroids under the same *C* + *B* node and 2*B* queue +construction envelope, preserves deterministic level, and applies at +most the derived max (2, ⌊*B*/16⌋) reciprocal updates per level. Its +focused restart regression proved a moved centroid changes persisted +links and remains the nearest result after reopen. The full replay +rejected it: exact top-1 fell to 0.980469, mean identity recall at 16 to +0.972794, semantic coverage to 0.964210, and maximum seal time rose to +140.669 ms. The source change and its regression were removed; the +result remains as negative evidence. + +The dual-seed candidate tested activation entry ownership instead. The +prior recenter operation replaced the canonical maximum-level HNSW entry +with the nearest consolidation centroid, which was often a level-zero +node. Later queries therefore skipped global hierarchy descent and +crawled only the local graph. The dual-seed candidate always descends +from the persisted canonical entry, then adds the consolidation centroid +as a second level-zero frontier seed and as the deterministic envelope +pivot. Both seeds share the same fixed 2*C*/5*C* envelope, so this did +not double work. Its full replay still failed: exact top-1 was 0.984375, +mean identity recall at 16 was 0.974142, and semantic coverage was +0.968592. The source change was removed. A copied-late +duplicate-ingestion diagnostic is excluded from acceptance because +replaying already-present packets changed the authoritative population +and timestamps. + +The 12*C*/6*C* candidate passed quality but saturated too late to +provide six complete mature 500-event windows, so it remains a +superseded experiment rather than plateau evidence. Reducing the fixed +public envelope to 10*C* nodes and a 5*C* queue moved saturation earlier +while construction remained independently bounded at *C* + *B* nodes and +2*B* queue effort. At neutral knobs these values are 5,120/2,560 for +public retrieval and 640/256 for construction. All are F/S/T-derived, +and the query-age increments remain zero. + +The first 10*C*/5*C* full replay isolated five late operation slopes to +one cause: each supersession write or current-surface change invalidated +the whole target-eligibility sidecar, so later storage, reconsolidation, +and emotional cascade cache ensures rebuilt every target. The retained +repair recomputes only the supersession targets affected by the +committed edge or changed source. The next exact-binary replay removed +every late operation failure. A separate family-comparison counter still +had a noisy half ratio even though its event maximum was only 130. A +first *B* = 128 hard cap and a second *C* = 512 cap were both rejected +because the 430- and 600-near-duplicate pagination regressions could +consume the budget before the semantic target. The retained 2*C* cap +passes those regressions and provides a stronger per-event absolute +bound; half ratios remain reported, but bounded work below 2*C* is not +misclassified as store growth. + +The final 15,695-packet Natural replay passed both quality and +whole-engine plateau gates. Exact top-1 was 1.0, mean identity recall at +16 was 0.999020, and semantic coverage was 0.998311 across 512 exact +public controls. The run took 333,475 ms overall, with mean process and +public total latencies of 8.885 and 16.617 ms. The accepted plateau +begins at event 11,695 and contains eight complete 500-event windows +while the authoritative store continues growing. Mean plateau process +time is 9.933 ms; late/early process and consolidation-inclusive +throughput ratios are 0.96177 and 0.97979, and the relative Theil–Sen +slope is -0.00768 per window. All operation and work-counter failures +are empty. Twenty-nine complete consolidation epochs form the intended +zero-amplitude fixed envelope, and the maximum 130 exact family checks +remain below the midpoint 2*C* = 1, 024 ceiling. Route sealing consumed +8,375 ms in total and no seal exceeded 97.562 ms. + +### Historical C-identity fixed-envelope knob ablation + +The prior 10*C*/5*C* candidate, which returned at most *C* identities +from the routing envelope, was rebuilt once and evaluated at all nine +prescribed F/S/T points. Each fresh SQLite store processed 2,000 corpus +packets and used its own 512-query exact public control at the same knob +values. The 4,608 controls covered four opaque source identifiers and +text, audio, and image post-encoding inputs. Exact top-1 and identity +recall at 16 were 1.0 in all nine runs; minimum semantic coverage was +0.999898. Midpoint and focus-low published and exercised the sparse +hierarchy. The other seven runs remained below threshold or ended with +bounded unpublished or dirty state and are therefore system-quality +exact fallbacks, not sparse-route quality claims. + + +++++++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Point (F/S/T)C/Bpublic nodes/queuedirty limit/sentinelbackfill limit/sentinelroute events/resetsquality classtop-1 / recall@16 / semanticprocess / total ms
midpoint (.5/.5/.5)512/1285120/2560512/513128/12915/1route lifecycle exercised1/1/113.749/17.930
all-low (0/0/0)256/642560/1280256/25764/650/0exact unpublished1/1/122.853/27.654
all-high (1/1/1)768/1927680/3840768/769192/1930/0exact unpublished1/1/148.580/49.771
focus-low (0/.5/.5)384/963840/1920384/38596/97232/5route lifecycle exercised1/1/0.99989810.794/15.802
focus-high (1/.5/.5)640/1606400/3200640/641160/1610/0exact unpublished1/1/112.363/14.390
sensitivity-low (.5/0/.5)448/1124480/2240448/449112/1130/0exact below threshold1/1/10.429/0.823
sensitivity-high (.5/1/.5)576/1445760/2880576/577144/1450/0exact unpublished1/1/157.418/60.169
stability-low (.5/.5/0)448/1124480/2240448/449112/1130/0exact unpublished1/1/117.766/21.884
stability-high (.5/.5/1)576/1445760/2880576/577144/1450/0exact unpublished1/1/113.264/17.515
+ +The complete 3 × 3 × 3 structural grid passed 780 assertions, while the +bounded backfill/journal, route-metadata-open, and core-knob suites +passed 1,220, 566, and 393 assertions. At neutral knobs the historical +batch is *B* = 128; 129 is exclusively the derived logical *B* + 1 +boundary. The implementation checks the post-*B* iterator without +reading or processing a 129th work row. The corresponding endpoint pairs +are 64/65 and 192/193. Public activation likewise scales from +2,560/1,280 nodes/queue through 5,120/2,560 to 7,680/3,840. Exact family +comparisons independently scale as 2*C*, or 512, 1,024, and 1,536 at +those same endpoints. The content-addressed aggregate digest is +`efdbd964cb255c44d4490814fde954380b683cd2e891ceae13723ba77b691313`. This +closed the earlier C-identity candidate’s knob-derivation and +sampled-quality gate. The later fixed-activation experiments below +supersede it: the *C*-identity route was fast enough for a plateau on +that binary, but did not retain exact long-history quality once the +activated working set was separated from the wider routing envelope. + +### Fixed activated-identity follow-up + +The retained route distinguishes two finite sets. SQLite routing may +inspect at most 5*C* graph identities so that a sparse hierarchy can +recover distant neighborhoods. Exact reranking then retains at most + +*A* = 2*C* + 2*B* + +identities for current-surface eligibility, family collapse, graph +expansion, and final ranking. At neutral knobs *C* = 512, *B* = 128, and +*A* = 1, 280; at the all-low and all-high endpoints *A* is 640 and +1,920. Construction remains a separate *C* + *B* node and 2*B* queue +operation. The canonical maximum-level HNSW entry performs global +descent, while the nearest consolidation centroid is an additional +level-zero seed and deterministic fill pivot. Neither identity set, +seed, nor limit depends on modality or `source_id`. + +The activated target was selected through a sequence of full-corpus and +focused negative experiments. The table reports exact top-1, mean +identity recall at 16, and semantic coverage. “Limited route” means the +routing-node ceiling was also set to the activated target rather than +retaining the wider 10*C* route. + + ++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
CandidateCorpus / wall mstop-1 / recall@16 / semanticDisposition
A = 2CDurable / 27,0060.994141 / 0.985797 / 0.978325rejected: three sampled top-1 misses
A = 3CDurable / 28,2421 / 0.999753 / 0.999285superseded: the 1,497 midpoint-near target saturated too late for +six mature windows
A = 2C + 2B, +limited routeDurable / 27,9631 / 0.998518 / 0.995665rejected for the shared path after Natural failed
A = 2C + 2B, +limited routeNatural / 115,4610.964844 / 0.939345 / 0.926401rejected: long-history neighborhoods were unreachable
canonical hierarchy plus consolidation seed, limited routeNatural / 114,9090.980469 / 0.963583 / 0.950696improved but rejected
fill the full target during traversal, limited routeNatural / 96,8590.978516 / 0.965016 / 0.952839rejected
several arbitrary highest-level seedsNatural / 111,7700.960938 / 0.938407 / 0.926448rejected and removed
query-adaptive coarse highest-level seedsNatural / 116,6190.980469 / 0.952914 / 0.939977rejected and removed
+ +A direct node-envelope ablation then varied the routing ceiling without +changing *C*, *B*, *A*, construction, downstream eligibility, or exact +reranking. The 5,000-packet screen rejected *C* and *C* + *B*. +Full-horizon runs rejected 2*C* and *A* despite their lower wall times +because both violated the mandatory exact-top-1 and recall contracts. +5*C* was the smallest tested envelope to retain exact top-1 and the +accepted recall gate; 10*C* was exact but wider and slower. These are +route-envelope results, not whole-engine plateau passes. + + ++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Routing ceilingEvents / wall mstop-1 / recall@16 / semanticDisposition
C5,000 / 28,8070.890625 / 0.875265 / 0.864615rejected
C + B5,000 / 29,7650.974609 / 0.970724 / 0.966273rejected
2C15,695 / 91,5910.935547 / 0.907982 / 0.884337rejected
A = 2C + 2B15,695 / 112,7130.984375 / 0.971970 / 0.959175rejected
5C15,695 / 101,5981 / 0.999507 / 0.999143retained: smallest passing envelope
10C15,695 / 103,5341 / 1 / 1superseded: wider than necessary
+ +A denser graph candidate increased each node to *B* outgoing neighbors +and *B*/4 reciprocal updates. Its focused 600-node HNSW regression did +not finish within three minutes, so it was interrupted before any corpus +result and the retained *B*/2 neighbor and *B*/16 reciprocal formulas +were restored. Earlier integration attempts are also retained as +negative evidence: one full Durable run stayed on exact fallback because +backfill advanced only at consolidation; a lifecycle repair activated +the route but truncated candidates before operation-specific eligibility +and lost quality; a later exact-quality run let visited-node work grow +with the sub-ceiling store and failed the plateau audit. An apparent +15,695-event “Durable” replay that forced each Natural sentence to +Durable was invalidated because it changed the corpus unit and is not +used as performance evidence. + +The selected implementation keeps the 5*C* routing ceiling and exact +rerank, then retains *A* = 2*C* + 2*B*. The final 15,695-packet Natural +replay at *F* = 0.45, *S* = *T* = 0.5 resolved *C* = 499, *B* = 125, +*A* = 1, 248, and a 2,495-row routing and queue ceiling. With no +experiment override, it completed in 100,805 ms with mean process and +public total latencies of 2.777 and 6.207 ms. Across 512 controls, exact +top-1 was 1.0, recall at 16 was 0.999507, semantic coverage was +0.999285, and ties were deterministic. The activated set never exceeded +*A*. This proves a fixed semantic activation set and a finite route +envelope, not a whole-engine plateau; the end-anchored plateau audit +still had no accepted suffix. + +The corresponding 2,016-message Durable replay used the identical +algorithm and knobs, with Durable adding only its post-commit +checkpoint. With no experiment override, it completed in 29,767 ms with +mean process and public total latencies of 8.178 and 14.350 ms. All +three retrieval quality measures were 1.0. Only three post-warmup +500-event windows existed, below the required ten, so this is +insufficient horizon rather than a Durable plateau pass. + +The new nine-point ablation rebuilt one binary and ran fresh +2,000-packet stores at midpoint, both joint endpoints, and each one-axis +endpoint. Every run used its own 512-query same-knob text control over +four opaque sources. A separate active-SQLite-route regression held +embeddings fixed and produced identical candidates and bounds while +varying memory and query labels across text, audio, image, shared +sources, and opaque sources. This split avoids fabricated media in the +corpus audit while proving that the post-encoding optimization has no +source or modality branch. All 4,608 whole-system controls achieved +exact top-1, recall at 16, and semantic coverage of 1.0. Five +configurations both traversed and successfully recentered the hierarchy. +Two traversed but are explicitly recenter-unproven; two remained exact +fallback. The retained audit does not separately materialize the +route-active query subset, so these are route-lifecycle classifications +paired with whole-system quality, not sparse-route-only quality claims. + + ++++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Point (F/S/T)C/B/Aroute events / recentersmax routed / activatedquality classprocess / total ms
midpoint (.5/.5/.5)512/128/128093/0573/578traversed, recenter-unproven1.522/7.519
all-low (0/0/0)256/64/640335/5525/534route lifecycle exercised1.723/6.366
all-high (1/1/1)768/192/192035/0769/785traversed, recenter-unproven5.339/9.030
focus-low (0/.5/.5)384/96/960274/2626/657route lifecycle exercised1.848/7.304
focus-high (1/.5/.5)640/160/160048/1643/671route lifecycle exercised1.601/7.757
sensitivity-low (.5/0/.5)448/112/11200/00/0exact below threshold0.921/6.440
sensitivity-high (.5/1/.5)576/144/1440379/2879/955route lifecycle exercised12.575/21.436
stability-low (.5/.5/0)448/112/1120470/4892/920route lifecycle exercised3.054/9.256
stability-high (.5/.5/1)576/144/14400/00/0exact unpublished1.309/7.771
+ +The structural, backfill/journal, route-metadata-open, core-knob, and +active-route label-invariance suites passed 853, 1,234, 566, 393, and 23 +assertions. All route and activation ceilings were respected; no search +or backfill failure occurred; route open read one metadata row. +Whole-engine startup remains *O*(history) because the processor still +hydrates every current memory. The neutral historical work batch remains +*B* = 128, while 129 is only the derived logical boundary checked +through post-*B* iterator state, not a fetched row. The +content-addressed aggregate digest for this pre-commit evidence snapshot +is `a6c8e94af01c1f84d1a1a25e83abc1a3f2cafe9d3880cd553d84dc4704ed66ec`. +Sensitivity-high remains the dominant whole-engine configuration at +43,418 ms wall and 12.575 ms mean process time; this reranks the +independent emotional cascade bound rather than weakening the fixed +retrieval envelope. Because the current Natural whole-engine plateau and +Durable horizon gates are open, these results establish the HNSW +cutover, knob derivation, exact sampled quality, and bounded activated +identity set without claiming the broader goal complete. + +### Consolidation-persisted activation snapshot + +The first attempt to make consolidation move the activated graph changed +only the route pivot. In a 13,000-packet neutral replay it reached exact +top-1 0.998047, recall at 16 of 0.993042, and semantic coverage of +0.998430. More importantly, none of 50 valid pre/post-recenter pairs +changed the activated identity set for the same consolidation query. +This rejected the hypothesis that replacing or supplementing an entry +pivot was sufficient: the canonical 5*C* completion dominated the pivot +while lower-rank quality fell below its 0.998 gate. + +The retained design leaves that canonical HNSW route intact and gives +consolidation one separate, SQLite-persisted activation snapshot. On +each successful seal, the normalized consolidation embedding defines the +semantic center and the route records at most *A* = 2*C* + 2*B* nearest +activated identities. Ordinary queries still perform canonical +maximum-level descent; the snapshot’s identities are loaded through the +separate *A* row budget and become deterministic level-zero entry +points. Neighbor rows discovered from those entry points are still +charged to the canonical 5*C* traversal ceiling. Queries exactly rerank +the union while protecting the best 2*C* canonical identities; the +snapshot may change the remaining 2*B* identities in *A* = 2*C* + 2*B*. +Canonical rows, snapshot rows, and their sum are recorded independently +and fail above 5*C*, *A*, and 5*C* + *A*. The center, generation, first +identity, and packed identity list survive reopen in the single +route-metadata row. This is an internal SQLite migration and does not +add a public API or another Natural/Durable write path. + +The neutral 13,000-packet screening replay used *C* = 512, *B* = 128, +and *A* = 1, 280. Canonical rows reached exactly 5*C* = 2, 560, snapshot +rows reached exactly *A*, and their sum reached but never exceeded +3,840. Across 512 public controls, exact top-1 was 1.0, recall at 16 was +0.999754, semantic coverage was 0.999789, and ties were deterministic. +Forty-six successful recenters were profiled; 35 snapshots reached their +full *A* capacity, 11 same-query pre/post pairs changed identity +membership, and no pair was invalid. This is the first retained result +in which consolidation demonstrably changes the fixed activated set +while preserving the canonical route. It was a screening predecessor, +not the final multi-entry implementation. + +Three complete 15,695-event variants then isolated the remaining quality +loss. The canonical-only walk plus post-search snapshot returned top-1 +0.998047, recall at 16 of 0.995213, and semantic coverage 0.994474. +Restoring one snapshot entry as a level-zero seed improved recall to +0.997054 but remained below the 0.998 floor. Protecting the best 2*C* +canonical identities produced perfect sampled top-1 but recall fell to +0.996072, showing that output-tail allocation could not recover +neighbors the walk never reached. The retained variant therefore makes +the complete persisted snapshot a bounded multi-entry surface before +traversal rather than only an after-the-fact rerank layer. + +That retained variant processed all 15,695 events in 470,440 ms with 63 +consolidations. Its 512 controls achieved exact top-1 1.0, recall at 16 +of 0.999877, semantic coverage 0.999809, and deterministic ties. All 57 +profiled recenter pairs were valid; 43 changed membership. In the final +3,000-event suffix, all 10 successful recenter edges changed the fixed +*A* = 1, 248 set and retained only 33.0–36.1 percent overlap. The same +suffix kept the canonical ceiling at 5*C* = 2, 495, the snapshot ceiling +at *A*, and the combined ceiling at 5*C* + *A* = 3, 743. This proves +consolidation changes activation locality while work remains fixed; it +does not prove the independent whole-process plateau. + +The required nine production-shaped 4,000-event ablations then rebuilt +fresh stores at midpoint, both joint endpoints, and every one-axis +endpoint. Each run captured 512 same-event public controls over four +opaque sources. All nine traversed the SQLite hierarchy and subsequently +completed between three and 17 successful recenters; none passed through +an exact-fallback-only lifecycle. All 4,608 controls achieved exact +top-1 and recall at 16 of 1.0; minimum semantic coverage was 0.999695, +with zero miss fingerprints. The acceptance policy permits at most one +top-1 miss in each 512-query run (0.998047), requires at least 0.999 +across all nine runs, and rejects two or more misses sharing a modality, +opaque source, memory-age quartile, or exact knob point. Thus the +contract allows a bounded approximation without describing it as exact, +while this measured matrix did not consume that allowance. + + +++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Point (F, S, T)C/B/Amax canonical / snapshot / total +rowsrecenters: valid / changedprocess / total ms
midpoint (.5/.5/.5)512/128/1280517 / 1096 / 109612 / 02.932 / 27.993
all-low (0/0/0)256/64/640405 / 640 / 104513 / 73.558 / 27.279
all-high (1/1/1)768/192/1920865 / 1415 / 14153 / 011.153 / 32.204
focus-low (0/.5/.5)384/96/960400 / 960 / 130412 / 63.666 / 26.646
focus-high (1/.5/.5)640/160/1600603 / 1267 / 12679 / 03.210 / 28.522
sensitivity-low (.5/0/.5)448/112/1120423 / 542 / 5424 / 01.241 / 25.032
sensitivity-high (.5/1/.5)576/144/1440592 / 1440 / 162217 / 423.536 / 49.794
stability-low (.5/.5/0)448/112/1120698 / 1120 / 181813 / 75.886 / 29.842
stability-high (.5/.5/1)576/144/1440543 / 931 / 9314 / 02.276 / 27.394
+ +All 87 successful recenter pairs had explicit, valid overlap evidence +and zero failure codes; 24 pairs changed membership across four knob +runs. A zero in the changed column is not treated as a fabricated reset: +in those short runs the reachable published surface fit inside *A*, so +the fixed snapshot already covered it and overlap correctly remained +1.0. The full-horizon production-knob run above supplies the +mature-store movement proof. + +The complete 27-point structural grid passed 985 assertions. The bounded +backfill/journal, restart plus centroid persistence, core-knob, and +active-route source/modality-invariance reports passed 1,234, 64, 393, +and 25 assertions with no failures. At neutral knobs the historical +batch remains *B* = 128 and 129 remains only the logical post-*B* +iterator boundary; no 129th historical row is fetched or processed. +Sensitivity-high remains an adverse whole-engine result rather than +being hidden by the aggregate. These runs prove formula derivation, +local work ceilings, persisted recenter behavior, label-agnostic +routing, and sampled quality. The full Natural plateau, the short +Durable horizon, whole-engine restart, and production-wide boundedness +remain separate gates. The content-addressed aggregate digest is +`f674c55915331279f99f7d4c9eb22e0ed9440b58acd6b3e2a529455219db93d1`. +`TRACE[state:sqlite_hnsw_knob_ablation]`. + +### Activation-snapshot read-through reuse + +The retained multi-entry route initially selected and decoded the same +persisted activation snapshot on every query. A read-through repair +places those generation-qualified node rows in the route’s existing +24*C* shadow cache. SQLite remains authoritative: reopen begins cold, +and every successful seal clears the cache before rows from the next +state may be reused. Query distances are still evaluated exactly, so +this changes row loading rather than the 5*C* + *A* semantic envelope. A +regression proves that the first query after reopen loads at most *A* +snapshot rows and an identical second query loads zero while returning +the same identities. + +The matched 15,695-packet Natural replay completed in 194,736 ms, down +from 470,440 ms for the uncached activation-snapshot run. Mean process +time fell from 6.384 to 4.729 ms and mean end-to-end time from 29.563 to +12.115 ms. Only 13 events physically loaded snapshot rows; the maximum +load was the derived *A* = 1, 248, and all other routed events reused +the bounded cache. The 512-query public control retained exact top-1 +1.0, recall at 16 of 0.999754, semantic coverage 0.999809, deterministic +ties, and four opaque sources. The late eight-window process ratio was +0.999920 and throughput ratio 1.021200, but the whole plateau remained +rejected by emotional-cascade growth, operation counters, and the +requirement for ten mature recenter edges. The different +wall-time-driven consolidation cadence is retained as production-like +temporal feedback, not described as behavior equivalence. + +A fixed 2*C* + *A* actual-node ablation was then tested against the same +complete replay and public control. It is rejected: eight of 512 top +identities missed (top-1 0.984375), recall at 16 fell to 0.969452, and +semantic coverage was 0.959699. Its 203,096 ms wall time and 4.502 ms +mean process time cannot waive that loss. This result is why the +accepted 0.998 quality floor is useful rather than ceremonial; the lower +envelope is not retained. + +### Exact emotional winner collapse + +The next measured late-suffix contributor was the emotional cascade. Its +shared bit-mask breadth-first walk already visits graph adjacency once +per 64-source batch, but it materialized a source–embedding pair for +every source that reached an embedding. The later update loop then +discarded all but the first pair under the established first-source-wins +rule. The exact repair performs that winner selection inside the shared +traversal: for each reached embedding it retains the lowest source +ordinal and that source’s shortest positive depth, then materializes one +winning pair. Reachable-pair and physical edge-visit counters remain +separate from the smaller winning-pair counter so the optimization +cannot hide an expanding graph walk. A 70-source regression now proves +70 reachable pairs and 70 physical edge visits collapse to one executed +winner with the same final intensity. Full-horizon performance, +work-bound, and retrieval results remain required before retention. + +The complete exact-winner replay kept top-1 at 1.0, recall at 16 at +0.999386, and semantic coverage at 0.999381, but it did not improve the +full run: wall time was 205,445 ms versus 194,736 ms for snapshot reuse +alone, and mean process time was 4.865 ms versus 4.729 ms. The new +physical counter also showed why: the walk still reached 6,786 adjacency +visits in one event. Exact winner collapse is therefore not promoted by +itself. + +An experiment then combined winner collapse with a deterministic +physical-edge ceiling equal to the existing public node formula 5*C*. At +the production knobs the maximum was exactly 2,495 visits; 1,190 of +1,912 active cascade events reached the ceiling, and no 2,496th edge was +visited. Mean cascade time fell from 0.107 to 0.072 ms/event and the +replay completed in 198,222 ms. Its public control consumed the allowed +single miss: top-1 was 511/512 (0.998047), recall at 16 was 0.999141, +semantic coverage was 0.999285, and ties remained deterministic over +four opaque sources. The ten-window suffix beginning at event 10,695 +passed whole-process ratio (1.018755), throughput ratio (1.012508), +relative slope (0.005399), and bootstrap upper slope (0.012176). It is +still an experiment rather than a cutover: the current source-selection +scan is not yet bounded by an F/S/T-derived prefix, operation incidence +remains visible, and one material consolidation edge failed the strict +raw post/trailing reset. + +The follow-up bounded the source side as well. The maintained source +snapshot now admits at most 5*C* timestamp/identity-ordered candidates +and each cascade executes at most *B* sources, while physical adjacency +remains capped at 5*C* and updates at *A*. A dense all-low regression +proves the exact 1,280-source inspection boundary and the separate +64-source execution boundary; the 1,281st candidate is not materialized. +The audit also stopped double-counting the route’s detailed node and +snapshot counters on top of the already-total +`GraphRetrieve.rows_visited` value. + +The corrected 15,695-packet release replay completed in 191,354 ms with +33 consolidations, mean process time 4.552 ms, and mean end-to-end time +11.903 ms. Its 512-query public control passed with top-1 1.0, identity +recall at 16 of 0.999386, semantic coverage 0.999667, deterministic +order, and four opaque sources. Observed maxima were 64 source +inspections and executions, 2,495 physical adjacency visits, 1,337 +winning neighbors, and 73 updates, all below their production-derived +5*C* = 2, 495, *B* = 125, 5*C*, 5*C*, and *A* = 1, 248 ceilings. The +ten-window suffix beginning at event 10,695 passed whole-process ratio +(0.992191), throughput ratio (0.994754), relative slope (-0.002547), +bootstrap upper slope (0.001772), and every active-work counter. All ten +mature recenter observations were pair-valid, changed the activation +set, preserved the fixed envelope, and had overlap from 0.348558 to +0.690705. + +This is still not a whole-goal cutover. Seven material consolidation +epochs were available, but the strict raw reset and normalized +consolidation-cost trend contracts failed, and several individually +timed bounded kernels varied by more than the current 1.05 component +ratio. The result therefore proves the quality and sparse-work envelope +of this experiment, not a completed Natural plateau, Durable +equivalence, or production-wide bound. + +### Post-cutover shared activation distance reuse + +The first complete Natural profile after the retained row-addressed HNSW +cutover still increased by 1.69146 ms between its first and final five +post-warmup windows. Graph retrieval contributed 0.97932 ms (57.90%) and +memory storage 0.52965 ms (31.31%), or 89.21% together. Both operations +call the same SQLite `SearchActivated` routine. The graph seed-cache +subsection alone increased by 0.66697 ms, while mean route-node work +increased 3.390x for graph retrieval and 3.460x for memory supersession. +These observations select query-distance materialization inside the +shared activation routine; they do not imply that HNSW routing itself or +the knob-derived activation target is unbounded. + +A deterministic 1,300-node regression exposed duplicate arithmetic +directly: one activation made 2,761 exact query-to-node distance +evaluations. The retained query-local distance slot reduces that count +to no more than one per visited persisted node plus one per pending +updated embedding, without changing the 5*C* visit ceiling or +*A* = 2*C* + 2*B* outward activation target. + +Two Release binaries built from the same source head then replayed the +same 500 events against byte-copies of the same mature Natural database. +The control removed only the query-local cached-distance early return; +the source delta, binaries, compiler, corpus, initial database, command +contract, profiles, and audits are content-addressed in the retained +evidence packet. Exact behavior, canonical logical-database, and +physical output-database digests matched. Mean process time fell from +4.10098 to 3.76532 ms (-8.18%), Graph retrieval from 2.02630 to 1.83392 +ms (-9.49%), its seed-cache section from 1.77608 to 1.59049 ms +(-10.45%), and Memory storage from 0.87427 to 0.77841 ms (-10.96%). +End-to-end mean fell 5.28% and wall time fell 5.49%. A separate earlier +matched fresh 2,500-event pair reduced mean process 1.05%, Graph +retrieval 2.47%, seed-cache work 4.68%, and Memory storage 1.84%; its +wall-time difference was +1.01%, so it is reported as noise rather than +a fresh-store wall-time win. This is a measured local repair, not proof +of the required full-horizon Natural/Durable plateau or +consolidation-cycle shape. + +The failed full replay also isolated a separate application-hydration +leak. The final six active working-memory slots contained 14,290 signal +rows, and because they lacked memory-level summary blobs, public +hydration replayed all 14,290 payloads on every packet. Mean hydration +increased from 3.07 ms in the early window to 96.16 ms in the final +window, dominating total latency. The retained fallback now selects only +each memory’s newest *B* indexed signal rows while SQLite keeps the +complete history. On a copied mature database, a 500-event tail probe at +neutral knobs recorded the 128-row limit on every event and materialized +642–655 fallback rows total across working and retrieved memories. Mean +hydration was 5.395 ms, mean process time 2.900 ms, mean public latency +12.327 ms, end-to-end time 14.166 ms, and wall time 7,160 ms. Relative +to the rejected full replay’s final 500 events, hydration fell 94.4% +(96.162 to 5.395 ms) while six working slots remained active. The +focused regression test proves the newest 128 rows and chronological +output independently for opaque text, audio, and image sources. This +copied-tail probe is direct mature-store performance evidence, not yet a +full-horizon plateau or application-quality claim for omitted older +fallback payloads. + +### Consolidation-cost and seal-cadence ablation + +A later full-horizon attribution pass corrected three observer and +routing details before changing the algorithm. Commit timing had +included a profiling-only vector identity lookup; identity resolution +now occurs when the committed mutation audit is consumed, while the +independent logical and physical audit streams remain intact. Mature +deterministic route completion now draws from the indexed generation +slice and applies active eligibility at ranking, so an inactive row +cannot make the fixed envelope appear one row short. The RIF changed-row +counter now records work performed by the current event rather than the +historical active population. Each correction has a red-then-green +regression and changes measurement, not public retrieval semantics. + +The remaining consolidation scan was bounded by the same knobs. Let +*A* = 2*C* + 2*B* and *N* = max (8, ⌊*B*/2⌋). Score consolidation now +admits at most *A* low-strength long-term identities from the indexed +strength/time frontier and counts at most *N* association edges per +admitted identity. A sentinel row publishes the exact input cardinality +even when no candidate is selected. The formula, counter, and +source/modality invariants pass all 27 +*F*, *S*, *T* ∈ {0, 0.5, 1}3 configurations across text, +audio, image, and four opaque source labels. At midpoint *C* = 512, +*B* = 128, *A* = 1280, and *N* = 64; 129 occurs only as the logical +*B* + 1 completion probe. + +Four ordinary SQLite-route seal cadences were evaluated. Sealing every +write raised full-replay wall time to 107,294 ms and did not remove +consolidation growth. Sealing at the search-expansion batch +*E* = max (8, ⌊*B*/4⌋) moved the sawtooth into ordinary writes. Sealing +at *N* = *B*/2 left late seed-rank and seal slopes. The retained +candidate seals at *B* − *E* (96 rows at neutral knobs and 94 at the +production replay’s *F* = 0.45, *S* = *T* = 0.5), which is derived at +every knob point rather than stored as a second threshold. Its +15,695-packet Natural replay completed 31 live consolidations and found +an accepted seven-window suffix beginning at event 12,195: no operation +or work-counter gate failed, six complete consolidation cycles were +present, fixed route work was 5*C* = 2495, and normalized consolidation +cost ratios were 0.984 per sealed event and 0.937 per sealed mutation. +This is the measured write-throughput-for-symmetry tradeoff selected for +further quality proof. + +The stricter fixed-time, fixed-consolidation, four-opaque-source public +control then exposed a quality boundary not visible in the earlier +control. With the retained 5*C* node and 5*C* queue envelope, exact +top-1 was 0.990234 and identity recall@16 was 0.979902. Restoring the +older *B* seal cadence was slightly worse (0.984375 top-1), so *B* − *E* +did not cause the loss. Bounded node ablations kept the queue at 5*C*: +10*C* reached 0.998047 top-1 and 0.998897 recall; 12*C* reached 0.998047 +and 0.999755; 16*C* reached 1.0 for top-1, recall, and semantic coverage +over all 512 queries. The 16*C* point is not retained: its 7,984-node +production budget exceeds the replay’s roughly 3,200 active memories, so +actual work has not saturated, continues growing with the store, and +fails the six-window plateau and fixed-envelope gates. Production +therefore remains at the only mature plateau candidate, 5*C*, while +exact top-1 remains an explicit unresolved cutover gate. These results +do not claim the overall goal complete. + +Five fixed-5*C* moved-centroid topology repairs were then evaluated and +rejected on the same 15,695-packet, 512-query control. The first +attached the most recent *B* − *E* changed centroids to the canonical +hierarchy entry; it improved top-1/recall/semantic coverage from +0.990234/0.979902/0.975038 to 0.994141/0.983333/0.976229 but still +missed three top results. Retaining a full *B* identities on that entry +also missed three (0.994141/0.983088/0.975419). Distributing *B* +identities across *R* = max (2, ⌊*B*/16⌋) hierarchy hubs displaced too +much useful locality and fell to 0.986328/0.972426/0.964653; the +narrower two-hub 2*B* target reached only 0.990234/0.977083/0.968464. +Finally, preserving each moved centroid’s old level-zero neighborhood +while splicing only *R* newly proposed links and reciprocals reached +0.992188/0.978554/0.969131. Production knobs for these runs were +*C* = 499, *B* = 125, *E* = 31, and *R* = 7; neutral knobs would have +resolved to *C* = 512, *B* = 128, *E* = 32, and *R* = 8. No experiment +used 129 as a row count: it remains solely the neutral logical *B* + 1 +completion boundary. The candidate source and its isolated +moved-centroid regression were removed after rejection. The profile +identities, in the order above, are +`41f4708064c9f0e9034a551c4fd356adfe8b73b4537a734a94920ee6d7e96858`, +`01464b04783eae0443707dc88187d05492c6f02e526d4e450a64c859ce58f5c0`, +`5b0eb95ee32d15f7a2a5ab2511cc5e2d1e72629f0b8d3fbbf968ceae77c2539e`, +`3f3a13a245331e1f9691bd0a7eaf0d6a0900f060bd3e9ed6626ba14117d4b8e8`, and +`1f3216ae0c41c7b105cbd27e299f11b30d0403f63401d2871c13ed98c0428ad5`. +Together these ablations reject bounded link sprinkling as the quality +repair; they do not reject a separately represented sparse activation +layer whose centroids are rebuilt at consolidation under a fixed +knob-derived capacity. + +### Historical expanding-envelope knob ablation + +The pre-fixed-envelope matrix regenerated all nine prescribed points +from empty SQLite stores on one rebuilt binary. Each run processed 2,000 +corpus packets and compared 512 public retrievals at *k* = 16 with an +exact control generated under the same F/S/T values. Across 4,608 +controls, exact top-1 and recall at 16 were 1.0; minimum semantic +coverage was 0.999898. The midpoint and focus-low runs published and +exercised the SQLite sparse route, including one and five successful +consolidation recenter resets respectively. The other seven are reported +as system-quality exact fallbacks, not misrepresented as sparse-route +quality: sensitivity-low remained below threshold, while the remaining +six ended with bounded unpublished or dirty hierarchy state. + + ++++++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Point (F/S/T)C/Bdirty limit/sentinelbackfill limit/sentinelroute events/resetsquality classtop-1 / recall@16 / semanticprocess / total ms
midpoint (.5/.5/.5)512/128512/513128/12915/1route lifecycle exercised1/1/113.994/18.326
all-low (0/0/0)256/64256/25764/650/0exact unpublished1/1/123.539/28.490
all-high (1/1/1)768/192768/769192/1930/0exact unpublished1/1/149.888/51.132
focus-low (0/.5/.5)384/96384/38596/97232/5route lifecycle exercised1/1/0.99989810.964/16.135
focus-high (1/.5/.5)640/160640/641160/1610/0exact unpublished1/1/112.467/14.549
sensitivity-low (.5/0/.5)448/112448/449112/1130/0exact below threshold1/1/10.461/0.878
sensitivity-high (.5/1/.5)576/144576/577144/1450/0exact unpublished1/1/159.519/62.366
stability-low (.5/.5/0)448/112448/449112/1130/0exact unpublished1/1/118.284/22.522
stability-high (.5/.5/1)576/144576/577144/1450/0exact unpublished1/1/113.813/18.273
+ +The matrix distinguishes the two ingestion surfaces that the earlier +pre-cutover experiment conflated. Historical backfill advances at most +*B* ordered rows; *B* + 1 is its logical overflow boundary, detected +from the post-*B* in-memory iterator rather than an extra row read. Live +dirty reconciliation drains at most *C* identities; *C* + 1 is only its +overflow probe. Thus neutral 129 is not a fetched row or work batch, and +neither 128 nor 129 is a hidden fixed value. The same formulas produce +64/65 and 192/193 at the endpoints, while live dirty limits become +256/257 and 768/769. The 27-point structural grid passed 752 assertions; +bounded backfill/journal, route-metadata-open, and core-knob suites +passed 1,220, 566, and 393 assertions, all without failures. The +aggregate digest is +`7313859052b25c87f6ddc103d6677c9a48572dbdf2b39333a19484a4ad75b892`. + +The audit treated queue effort and the actual-node ceiling as separate +derived shape proofs, actual SQLite node rows as effect and bound proof, +and fallback hydration rows as a selected-context bound. This prevents +query-content variation from being mislabeled as engine drift while +still rejecting a perfectly shaped control that fails to reduce real +work. The matrix closed the expanding-envelope knob-derivation and +sampled-quality gate; it does not validate the replacement fixed +envelope, and it did not convert the still-failing whole-engine plateau +into a boundedness claim. The epoch audit also corrected one ownership +assumption: ongoing source-stream accumulator contents are observed +active state but are not owned or cleared by consolidation. +Working-memory pending signals and the three typed dirty-identity sets +remain the required post-commit reset counters. +`TRACE[state:sqlite_hnsw_activation_effort_cycle]`. + +### Experiment and algorithm traceability inventory + +The following inventory binds the task’s durable experiment state and +every task-owned algorithm group to this paper. The detailed corpus +sizes, parameters, measurements, and failure boundaries remain in the +adjacent prose and tables; these stable identities make omissions +detectable when the state, source diff, or generated manuscript changes. +A retained source-health result is not a production-wide boundedness +claim, and a benchmark, modeled, synthetic, or observation-only result +is never promoted to production-path proof. + + ++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Trace identityRecorded disposition and proof boundary
TRACE[state:baseline_results]Immutable Natural and Durable controls; source-health baseline +only.
TRACE[state:post_hnsw_cost_attribution]The first complete retained-route Natural profile attributes 89.21% +of remaining process growth to the two operations sharing SQLite +activation and selects query-distance materialization without claiming +whole-engine boundedness.
TRACE[state:post_hnsw_query_distance_reuse]Retained query-local persisted-distance reuse; a source- and +binary-bound mature pair is behavior/database exact and improves the +local gate, while full-horizon Natural/Durable plateau proof remains +open.
TRACE[state:repair_results]Ranked measured repairs and their exact behavior/database +equivalence evidence.
TRACE[state:plateau_profiler_smoke_proof]Accepted instrumentation smoke proof; not plateau evidence.
TRACE[state:work_counter_activity_repair]Retained explicit activity-marker repair over 100/200 Natural and +Durable events.
TRACE[state:graph_partial_distance_evaluation]Retained local improvement; full-Natural flatness still failed.
TRACE[state:graph_eligibility_repair]Retained exact eligibility repair; full-Natural flatness still +failed.
TRACE[state:graph_eligibility_db_proof]Canonical database and fixed-probe equivalence proof for eligibility +routing.
TRACE[state:graph_supersession_eligibility_repair]Retained focused repair; the next independent graph-family +comparison remained required.
TRACE[state:graph_family_vector_bound_candidate]Rejected for fresh-process and graph regression.
TRACE[state:graph_family_projection_bound_candidate]Rejected for copied-late process, graph, and comparison +regression.
TRACE[state:graph_family_precomputed_features_candidate]Rejected for fresh/copied-late process and wall regression.
TRACE[state:supersession_metric_index_candidate]Rejected by the fresh process and wall hard gate.
TRACE[state:competition_rif_returning_candidate]Rejected by fresh process and RIF regression.
TRACE[state:competition_suppression_state_cache_candidate]Rejected by fresh process, wall, and RIF hard gates.
TRACE[state:emotional_metadata_cache_repair]Retained full-run improvement; the flatness audit reranked the next +contributor.
TRACE[state:emotional_cascade_fixed_point_repair]Retained focused fixed-point repair pending full-run +verification.
TRACE[state:emotional_cascade_fixed_point_full_natural]Retained hotspot improvement; the full Natural plateau still +failed.
TRACE[state:accepted_tree_natural_plateau_rerank]End-anchored plateau failure reranked the next independent exact +candidate.
TRACE[state:emotional_cascade_fixed_work_candidate]Terminally rejected bounded-priority experiment. The 27-point +structural grid and exact derived B/B + 1 seams passed, but +the fixed-time Natural midpoint missed both the p99-ratio gate (0.573 +versus at most 0.25) and public identity quality (top-1 0.998047; +recall@16 0.980760). Its selector was removed, and the nine-point matrix +was correctly skipped by fail-fast.
TRACE[state:shadow_sqlite_seam_proof]Private seam/ownership evidence only.
TRACE[state:shadow_sqlite_scoped_evaluation]Whole-operation shadow was rejected by numeric acceptance +gates.
TRACE[state:post_shadow_rerank]Rejected shadow evidence reranked the measured exact +contributors.
TRACE[state:bounded_sparse_routing_observation]Promising default-off observation; low exact recall and linear +restart forbid cutover.
TRACE[state:active_epoch_sqlite_evaluation]Private active-epoch feasibility and lazy-RIF evidence; production +cutover remains false.
TRACE[state:rif_active_identity_ledger]Retained identity-only, knob-batched active-epoch publication. A +matched copied-mature 1,000-event slice reduced the named hotspot 73.05 +percent with exact public behavior and SQLite state; a full default-knob +Natural replay respected B = 125 but rejected the +whole-engine plateau on commit and graph-work gates. Durable +checkpoint/horizon and bounded restart remain open.
TRACE[state:rif_epoch_consolidation_reset_candidate]Retained empty post-consolidation in-memory RIF epoch reset. The +nine production-shaped knob points and full 27-point structural grid +preserve B = round (64 + 64F + 32S + 32T); +at neutral knobs B = 128, +while 129 is only the logical B + 1 boundary. The named +publication hotspot stayed flat over 15,695 Natural packets, but +whole-engine plateau and retrieval-quality gates failed, so Durable +verification and production cutover remain open.
TRACE[state:post_emotional_priority_rejection_rerank]The valid control reranked active-epoch publication after the +emotional candidate failed; its final six 500-event means rose from +0.347663 to 0.406671 ms while final-suffix whole-process and throughput +gates passed.
TRACE[state:bounded_route_hybrid_observation]Embedding-router feasibility retained; its production-shaped quality +label was invalidated by the public-control population mismatch.
TRACE[state:retrieval_quality_control_correction]Corrected 3,172-memory-surface feasibility passed exactly; runtime +public eligibility/family control remains pending.
TRACE[state:anchor_only_route_feasibility]Rejected anchor-only candidate routing at both 512 and 1,024 +anchors; raw one-off output was not retained and is not acceptance +proof.
TRACE[state:public_retrieval_control_capture_experiment]Real GraphRetrieve control capture is observer-exact on the paired +smoke and validates 512 full-run public controls; the corpus is +one-source/text-only.
TRACE[state:public_hnsw_route_prototype_experiment]Three standalone HNSW quality labels were invalidated because the +final database cannot reconstruct every point-in-time live surface; live +mutation capture is required.
TRACE[state:live_surface_mutation_capture_experiment]Full live capture is behavior/database exact and the repeated +512-query route has exact identity/top-1 coverage; +cross-source/modality, restart, live-cycle, and latency gates +remain.
TRACE[state:integrated_hnsw_sparse_route_experiment]Historical default-off sealed-HNSW plus exact-delta integration +established same-event quality before the row-addressed SQLite route was +retained; full-horizon plateau and cycle proof remain open.
TRACE[state:integrated_hnsw_consolidation_seal_experiment]Historical incremental epoch sealing isolated 381 ms of seal work +versus 9,221 ms of pre-existing full-surface reload; the retained SQLite +route replaces full resealing, while full-horizon cycle proof remains +open.
TRACE[state:sqlite_hnsw_knob_ablation]Production-default 8C-to-9C plus consolidation-snapshot-A matrix: the 27-point structural +grid and all nine sequential 4,000-event corpus runs passed. All 4,608 +controls measured top-1, recall@16, and semantic coverage of 1.0 with +deterministic ties and zero miss clusters. Every short route was +traversed, but none reached the 8C maturity floor needed for a valid +pre/post activation pair, so all nine are explicitly +recenter-unevaluated. Separate backfill/journal, restart, core-knob, and +text/audio/image plus source-label invariance regressions pass. B/B + 1, C/C + 1, the 8C floor, R step, 9C ceiling, snapshot A, combined 9C + A, and +family-comparison 2C bounds +are distinct and knob-derived.
TRACE[state:sqlite_hnsw_sparse_route_integration]Retained row-addressed SQLite HNSW query and incremental seal in the +existing GraphRetrieve and MemoryStorage +paths; Natural and Durable share the same algorithm, and Durable adds +only its checkpoint. Current full-corpus retrieval quality and +activation bounds pass, while the Natural whole-engine plateau and +Durable horizon gates remain open.
TRACE[state:sqlite_hnsw_activation_effort_cycle]Queue-effort-only, fixed-5C, and dynamic 4C through 8C floor variants were rejected or +superseded. The retained candidate resets routing work to 8C, advances by R = max (2, ⌊B/16⌋) to +9C, keeps A = 2C + 2B +downstream activation and 2B/(C + B) +construction, passes the 30,380-packet mature-cycle gates at 511/512 +top-1 and recall@16 0.999265, and passes canonical and nine-point +quality without an engine-wide plateau claim.
TRACE[state:sqlite_hnsw_production_cutover]Retained the existing SQLite HNSW route as the production default at +an 8C post-consolidation +floor, R = max (2, ⌊B/16⌋) step, +9C ceiling, separate A = 2C + 2B +snapshot, and 9C + A +total row ceiling. The nine-point matrix passed 4,608/4,608 top-1 +controls, minimum recall@16 and semantic coverage 1.0, deterministic +ties, and source/modality-label invariance. Natural and Durable share +the operation path, with Durable adding only its checkpoint; +whole-engine reset, bounded restart, Durable plateau, release, and +deployment remain unclaimed.
TRACE[state:hnsw_fixed_6c_experiment]Rejected knob-derived fixed-6C routing envelope. All 27 +structural F/S/T points and 931 assertions passed; neutral C = 512 produced a 3,072-node +envelope while B = 128 and the +129 boundary remained distinct. An extra production-default +F=.45/S=.5/T=.5 pre-screen missed exact top-1, recall@16, plateau, and +wall-time gates, so fail-fast rejected the candidate before the exact +nine-point corpus matrix started and left production on fixed 5C.
TRACE[state:post_rif_empty_fixed_envelope_attribution]Repaired proof classification for the retained zero-increment +fixed-5C/5C route. +Retrieval mode is independent of whole-engine process shape; +route-active rows fail closed on missing work, and queue, node ceiling, +actual visits, distance work, and activation are checked separately +across at least ten mature unchanged-envelope recenters. The production +suffix beginning at event 10,195 passes the classifier and work envelope +across 12 complete recenters, while activated-identity overlap, +process-cycle reset, exact full-horizon retrieval, Durable horizon, and +bounded restart remain open.
TRACE[state:write_gate_incidence_attribution_v2]Deterministic range-bound observation-only 15,695-packet +production-knob attribution rejected boundary-to-write incidence as the +growth source: exact event ranges 0–2,499 and 13,195–15,694 contained +510 and 528 writes, while MemoryStorage time per write rose from 0.4833 +to 2.8343 ms as the existing shared SQLite HNSW route warmed toward the +fixed 5C = 2, 495 envelope. +Production C/B/A = 499/125/1, 248 +and construction C + B/2B = 624/250 +remain derived; neutral C/B/A = 512/128/1, 280 +and 129 is only logical B + 1. +Raw reset remains failed and unwaived; 27 structural and nine +production-shaped F/S/T ablations remain required.
TRACE[state:recenter_activation_overlap_natural_13000_v2]Fail-closed same-query pre/post activation measurement rejected the +current connection-local HNSW recenter as a consolidation-driven +centroid reset. A deterministic builder accepts only explicitly +pair-valid, zero-failure observations; across 22 such successful +recenters in 13,000 Natural events, including 14 at the full A = 1, 248 activation target and +later queries saturating the 5C = 2, 495 node envelope, all 22 +retained exactly the same activated identities (minimum overlap 1.0). +This proves the route is integrated but its current recenter does not +move the activated set; raw reset, 27 structural and nine +production-shaped F/S/T ablations, modality/source-id invariance, and +whole-goal proof remain open.
TRACE[state:current_verification]The no-selector production default passes canonical Natural quality +at 512/512 top-1 and nine-point quality at 4,608/4,608, with recall@16 +and semantic coverage 1.0 throughout. The 2,016-message Durable replay +also passes 512/512 with identical route parameters and only its +checkpoint barrier, but its horizon remains insufficient for plateau +proof. Structural, backfill/journal, route-metadata-open, core-knob, +source/modality invariance, Python, and C++ focused gates pass. +Whole-engine raw process reset and bounded restart remain open and are +not part of the scoped retrieval-envelope claim.
TRACE[state:fixed5c_moved_centroid_reachability]Five fixed-5C bounded +single-hierarchy moved-centroid link repairs were measured and rejected; +the result does not reject a separately represented +consolidation-rebuilt activation layer.
TRACE[state:bounded_fallback_hydration]Retained newest-B indexed +signal fallback reduced copied mature-tail hydration from 96.162 to +5.395 ms and passed opaque text/audio/image recency tests; full-horizon +and application-quality proof remain open.
TRACE[state:packed_route_sqlite_representation_experiment]Packed SQLite queries retained the exact route result, but +complete-snapshot rewrite was rejected for incremental +consolidation.
TRACE[state:row_addressed_route_sqlite_experiment]Row-addressed SQLite made a 200-event seal incremental at fresh and +copied-late history; the representation is now integrated, with +full-horizon copied-late and cycle proof still pending.
TRACE[rejected:shared-shadow-sqlite-operation-view]Rejected whole-history shadow projection.
TRACE[rejected:GraphRetrieve.seed_cache_family_compare.coordinate-block]Rejected exact coordinate-block graph candidate.
TRACE[rejected:GraphRetrieve.seed_cache_family_compare.projection-bound]Rejected projection-bound graph candidate.
TRACE[rejected:GraphRetrieve.seed_cache_family_compare.precomputed-features]Rejected immutable precomputed-feature graph candidate.
TRACE[rejected:MemoryStorage.supersession_metric_index]Rejected supersession metric-index candidate.
TRACE[rejected:Competition.rif_recovery_active_sql.update-returning]Rejected update-returning RIF candidate.
TRACE[rejected:Competition.rif_recovery_active_sql.suppression-cache]Rejected suppression-cache RIF candidate.
TRACE[rejected:RifActiveEpoch.row-batch-only-performance-cure]The knob-derived batching contract was retained, but batching +complete RIF values reduced copied-mature publication only 3.99 percent +versus the required 20 percent and was rejected as the performance +cure.
+ +The bounded-route search itself had five separately evaluated points +over the same 34,456-vector, 512-query top-16 benchmark: + + ++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Trace identityResult
TRACE[bounded-route-variant:reciprocal-route-only]Rejected: exact recall at 16 was 0.979858.
TRACE[bounded-route-variant:three-sparse-graphs]Rejected: no recall gain at equal per-graph work.
TRACE[bounded-route-variant:construction-budget-4096]Rejected: exact recall at 16 was 0.995972.
TRACE[bounded-route-variant:construction-budget-8192-reciprocal-64]Rejected: exact recall at 16 was 0.997803.
TRACE[bounded-route-variant:two-graphs-construction-16384-retrieval-1280-reciprocal-64]Selected benchmark design: exact top-1 1.0 and recall at 16 +0.998413; production proof pending.
+ +The source diff is partitioned into the following algorithm and +experiment implementation groups. The traceability audit requires every +changed C/C++ path under `src/` or `include/`, every changed benchmark +C/C++ path, and every changed non-test experiment/audit tool to belong +to exactly one group, so an unrecorded algorithm or experiment +implementation fails closed. + + ++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Trace identityAlgorithm surface
TRACE[algorithm:consolidation-envelope-and-detector]Drift rearm, accumulator reset, shallow consolidation, and +consolidation-throughput state.
TRACE[algorithm:shared-retention-and-rollback]Shared Natural/Durable accumulation, signal-record rollback journal, +working memory, and processor transaction ownership.
TRACE[algorithm:lazy-rif-active-epoch]Lazy RIF clock/generation state, active-epoch SQLite, +memory-strength integration, store compatibility, and migration.
TRACE[algorithm:bounded-graph-retrieval]Bounded activation observation, graph retrieval, historical search +cache, evaluated embedding-family features, and explicitly enabled +public-seed tracing.
TRACE[algorithm:emotional-propagation-cache]Emotional state, fixed-point propagation, and rebuildable metadata +cache.
TRACE[algorithm:memory-storage-and-graph-maintenance]Supersession storage, association fanout, eviction, +predictive/stability updates, and usage detection.
TRACE[algorithm:runtime-composition]Engine pipeline composition and hydration/routing integration.
TRACE[algorithm:bounded-work-instrumentation]Consolidation-epoch and mutation-ownership counters used by the +acceptance audit.
TRACE[algorithm:experiment-harness-and-audit]Owner-authorized session extraction, Natural/Durable replay, +public-surface export and control capture, row-addressed SQLite +experiment, and fail-closed performance/quality audit +implementation.
+ +Natural and Durable use one ingestion algorithm; Durable adds only the +post-commit flush/checkpoint barrier. The algorithm does not branch on +modality or source cardinality: `source_id` remains opaque provenance, +while text, audio, and image inputs converge after encoding. The final +traceability pass is rerun after production changes and the last +experiment, so this inventory cannot become a stale intermediate +snapshot. + +A follow-up SQLite representation run separated fixed query work from +snapshot write amplification. The four-blob, 1,024-anchor snapshot +occupied 207,847,424 bytes for 34,456 embeddings. Restart touched 1,029 +rows. The 512 top-16 route queries took 0.116659 seconds in total +(0.22785 ms/query), performed a mean 512.004 and maximum 513 exact +comparisons, and retained exact top-1 and recall-at-16 of 1.0. A +1,024-embedding fresh prefix built, exported, restarted, and checked in +0.44 seconds wall time. However, exporting the complete snapshot took +65.5011 seconds. +`TRACE[state:packed_route_sqlite_representation_experiment]` therefore +retains the row-addressed SQLite query seam but rejects rewriting the +store-sized packed blobs at consolidation. The production-shaped +candidate must append only the sealed epoch’s nodes, edges, and routes, +with bounded reciprocal updates; copied-late append, public-cycle, and +failure/ownership proof remain pending. + +The row-addressed follow-up retained separate indexed node, graph-edge, +and route rows and changed only the sealed epoch. In a 200-event fresh +database, derived apply plus commit took 0.002320 seconds (0.01160 +ms/event). At a 34,256-row copied-late prefix, inserting the same 200 +nodes and two edge rows per node plus updating 3,544 unique reciprocal +route rows took 0.010586 seconds (0.05293 ms/event). The 4.56 late/fresh +ratio reflects the deliberately absent reciprocal population in the +empty control, but its absolute cost remained small and no store-sized +value was rewritten. An injected pre-commit failure restored exact table +counts; close and reopen retained exact committed counts; restart read +the dimension plus 1,024 anchors, or 1,025 rows total. The 512 +fixed-route queries each compared exactly 512 embeddings and took +0.621792 seconds total (1.21444 ms/query). This is +`TRACE[state:row_addressed_route_sqlite_experiment]`: measured +representation evidence, not graph-construction, public-path latency, +post-authoritative-commit publication, Durable-barrier, or live-sawtooth +proof. + +The profiler’s zero-counter guard was also corrected during this +evaluation. The initial 100-event Natural and Durable smoke audits +incorrectly treated a positive recovery-operation duration as evidence +that at least one suppressed row must exist. Recovery may legitimately +run while the active suppression population is empty. The audit now +pairs every required work count with the engine’s explicit boolean +activity marker (`candidate_activity`, `rows_visited_activity`, and the +corresponding graph, rollback, emotional, predictive, and supersession +markers) rather than with an inclusive operation timer. A zero count +beside a zero activity marker is valid; a zero count beside a positive +marker still fails as a vacuous placeholder. A regression preserves that +distinction. Rebuilt 100- and 200-event Natural and Durable profiles +then passed row schema, producer/count equality, activity, +consolidation-epoch, active-epoch-limit, and Durable-barrier validation. +These short runs validate instrumentation only; they are not plateau or +long-horizon performance proof. + On 2026-06-30, a full Meta MSC replay rerun verified the retrieval-cache optimization on the same 9,130-turn slice used for the hosted frontier-judge artifact. The run preserved native probe behavior @@ -6603,6 +9845,625 @@ measured exact constant-factor improvements, but it does not prove bounded Natural writes or authorize a production-wide flat-storage claim. +## Signal-centroid ring cutover and knob ablation + +Commit profiling isolated a write-amplification defect that earlier +aggregate timings obscured. Every accepted signal inserted a new row +into the global sqlite-vec surface even though memory KNN later joined +through memories and discarded those signal-only rows. In a 2,000-event +control, accepted commits averaged 0.2240 ms and mutated 21.78 +`embeddings_chunks` rows per accepted write. The retained centroid-ring +candidate reduced those figures to 0.1594 ms and 4.00 rows, +respectively; mean process time fell from 0.8614 to 0.7048 ms. + +Two intermediate designs were rejected. Storing an exact vector inline +on the ever-growing `signals` table while repointing historical +working-memory rows to the newest centroid touched approximately 600 +signal rows per accepted write in the diagnostic profile. Removing the +repoint avoided that direct *O*(*N*) mutation but still left an +unbounded inline-vector table. The retained design instead stores one +global centroid per memory and a persistent bounded exact-vector ring of +size *B*(*F*, *S*, *T*). Signal rows reference the centroid, so the ring +changes neither durable payload identity nor the public retrieval +surface. + +The content-addressed benchmark binary then replayed all 15,695 Natural +packets at *F* = 0.45, *S* = *T* = 0.5, resolving *B* = 125 and +*A* = 1, 248. It processed 32 consolidations in 183,001 ms with mean +process and total times of 4.2730 and 11.4210 ms. The maximum ring-table +mutation count was 12 in any event. Emotional updates reached 133 +against the hard *A* = 1, 248 enqueue limit, and the limit was never +saturated. + +That run is not reported as a whole-engine plateau pass. No suffix +satisfied every combined consolidation-cycle, timing, and active-counter +gate. Its 512-query full-horizon control also measured exact top-1 +0.994141, identity recall@16 0.993623, and semantic coverage 0.990139; +top-1 and recall therefore miss the current mandatory whole-goal +thresholds. The exact 2,016-message Durable replay completed four +consolidations in 30,128 ms with mean process and total times of 9.1500 +and 14.5741 ms. Its retrieval controls remained 1.0, but neither +attribution nor the required plateau passed. These failures remain part +of the result rather than being replaced by the local ring improvement. + +The current-binary nine-point Natural ablation used 2,000 events, 512 +exact public GraphRetrieve controls, and four opaque source identifiers +per point. Every point passed exact top-1, exact identity recall at 16, +semantic coverage, and deterministic tie order at 1.0. A separate +active-route regression covers text, audio, and image labels plus shared +and opaque source identifiers, so the text-ingress corpus table is not +misrepresented as fabricated multimodal traffic. + + +++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
F/S/T pointring Bmax ring row mutations/eventwall (ms)top-1 / recall@16 / semantic
midpoint1281214,0721 / 1 / 1
all-low64812,0391 / 1 / 1
all-high192415,6191 / 1 / 1
focus-low961414,2221 / 1 / 1
focus-high160714,9971 / 1 / 1
sensitivity-low1121212,4641 / 1 / 1
sensitivity-high144639,9001 / 1 / 1
stability-low1121017,6231 / 1 / 1
stability-high1441414,5581 / 1 / 1
+ +The sensitivity-high latency outlier is retained as measured. The +aggregate `signal-centroid-ring-knob-ablation-v4.json` binds all +profiles and sanitized audits to benchmark binary SHA-256 +`4ac8b7239545cdc1fcc7a0b51a0c131c6ef4ce3656ddbcbe6706c8f3baa76e83` and +has SHA-256 +`d75f8244b84686b93578b644a7b4c2a9ecf0963bd98017f57dc75245204a7044`. Its +29-file source-code manifest has SHA-256 +`41ea4060829c156230e5f40cd8f06d4197b00650b8a10a3e9aca06e6b7df2897`; the +scope is explicit so unrelated concurrent branch work cannot silently +change the evidence identity. The v4 builder fails closed unless every +point contains exactly 2,000 rows with unique event indices covering 0 +through 1,999, 512 controls, four opaque source digests, all three +quality values at 1.0, deterministic ties, an observed ring-mutation +counter, and an audit digest bound to the private profile. Its capacity +check uses the production `std::lround` rule and includes a half-integer +regression. The plateau audit likewise treats +`MemoryStorage.insert_signal_rows` as elapsed time rather than inferring +diagnostics from a `_rows` suffix; a negative fixture grows only that +duration and must fail. This closes knob derivation, the named +nine-point ablation, public retrieval quality for those slices, and +source/modality-independent routing structure. It does not claim a +whole-engine plateau, a bounded emotional traversal, merge, release, or +deployment. `TRACE[state:signal_centroid_ring_cutover]`. + +Post-signal-ring attribution exposed a distinct consolidation-edge +defect in the retained identity ledger. Across the first and final five +successful consolidations of the 15,695-packet Natural replay, mean +consolidation duration rose from 21.306208 to 53.983433 ms. The +disposable-ledger publication rose from 0.425858 to 6.475533 ms while +the mean persistent current-generation identity population rose from +226.0 to 3,113.2. Each SQL statement still obeyed the derived *B* = 125 +limit, but the number of statements copied the complete population. +Batching therefore bounded statement size without bounding total +consolidation work. + +The measured repair keeps persistent SQLite authoritative and changes +only successful epoch reset: the new connection-local SQLite epoch +begins with its clock and no copied identities, and later events publish +only their changed identities. The deterministic regression covers all +nine production-shaped F/S/T points, using persistent *B* + 1 +populations and mixed modality and opaque source labels. It initially +failed at neutral knobs because 129 identities were copied, then passed +171 assertions after the repair; after the double-failure regression was +added, the complete active-epoch focused set passed 482 assertions in 15 +cases. Neutral 128 remains the derived batch, and 129 remains the +logical *B* + 1 test population rather than a work batch. + +Fresh blind review found that the first implementation did not carry the +empty-reset intent across consecutive failures. When both post-commit +publication and its immediate recovery failed, the next event could +rebuild the disposable RIF projection from all persistent active +identities. The first repair made the empty-reset requirement sticky and +preserved that sidecar across successful retrieval-surface reloads. +Round-two review then found that the reload exception handler still +erased it. That exact sequence was reproduced as a missing sidecar +before repair. The catch path now detaches and restores the RIF epoch +independently of the other disposable retrieval caches. A regression +with a neutral *B* + 1 = 129 mature persistent population injects +publication, recovery, and reload failures, then proves that the retry +observes an empty disposable epoch and publishes only one changed +identity; the durable 129 identities remain in persistent SQLite. This +is failure-path source-health evidence. The earlier 15,695-packet timing +run predates both review repairs and continues to support only the +successful-path local publication result. + +The exact repaired binary then completed the full 15,695-packet Natural +replay with 38 live-hint consolidations in 219,074 ms. The selected +publication edge was flat: its first-five and final-five consolidation +means were 0.198092 and 0.196425 ms, and all 38 publications consumed +9.043001 ms. The local repair is therefore retained. It did not complete +the engine goal. No suffix passed the consolidation-cycle contract, and +the 512-query public control reached exact top-1 0.998047, exact +identity recall at 16 of 0.996094, and semantic coverage 0.993760, below +the mandatory 1.0 and 0.998 identity gates. Durable verification was not +run after the first Natural acceptance gate failed. Bounded restart, +recursive review, overall plateau, and production boundedness remain +open. + +A smallest-next-envelope feasibility probe then raised only the private +HNSW node inspection bound from 5*C* to 6*C*; activation remained +*A* = 2*C* + 2*B* and every value remained F/S/T-derived. The complete +27-point structural grid passed 931 assertions, with neutral *C* = 512, +node budget 3,072, and *B* = 128; 129 remained only the logical *B* + 1 +boundary. An additional production-default F=.45/S=.5/T=.5 Natural +pre-screen resolved *C* = 499 and 6C=2,994, processed all 15,695 packets +in 231,275 ms, and regressed wall time 5.57 percent relative to the +repaired 5C run. Exact top-1 remained 0.998047 with the same one miss; +identity recall at 16 improved from 0.996094 to 0.997070 but remained +below 0.998. No suffix passed the plateau or consolidation-cycle +contracts. The 6C candidate is therefore rejected before the exact +nine-point corpus matrix started. This is a complete 27-point formula +ablation, one additional default-knob pre-screen rejection, and 0/9 +exact corpus-matrix points, not a nine-point performance pass. The +historical benchmark executable is bound by SHA-256 +`86bafe48d4a75e8ebaf6d942fb92aca59e3078af189d4a8148a31846ee3e5a13`; its +unchanged experiment-owned selector, formula, harness, regression, and +audit source manifest is bound by SHA-256 +`35c0de6f3f05dd3e0720db01c372fa32b58f572fe269610ed56a7a3ee26a5198`. + +Re-attribution also exposed a proof-classification defect rather than +another HNSW algorithm change. The retained route declares zero +activation increments, but the audit previously chose a ramping +retrieval-cycle test whenever process time formed a sawtooth. The same +fixed 5*C* work therefore failed for having no material retrieval ramp. +A deterministic regression reproduced the mismatch, and the repaired +audit now selects fixed-envelope retrieval from the declared F/S/T +parameter vector independently of process mode. Over the production +replay suffix beginning at event 10,195, 12 complete successful +recenters kept both queue and node envelopes at 5*C* = 2, 495 with no +classifier or work-envelope failure. The historical profile did not +record activated-identity overlap, so it cannot prove the full +centroid-movement retrieval-cycle contract. The whole goal remains open: +overlap, process-cycle reset, operation/counter suffix gates, exact +top-1/recall, Durable horizon, and bounded restart are unchanged. This +repair adds no runtime value, route, modality branch, or source-id +branch; the existing 27 structural and nine production-shaped knob +contracts remain the required ablations. + +The next process-reset attribution separated event incidence from +per-active-unit cost. Ten suffix epochs met the material-ramp +definition, and eight met the strict requirement that the following +50-event process mean be at most 0.9 of the trailing mean. The two +misses, epochs 28 and 35, still removed 90.65% and 66.40% of their +preceding process ramps. Their post windows contained two and six times +as many supersession candidates, respectively. Memory-storage time per +candidate improved by 28.46% in epoch 28 and changed by only 1.25% in +epoch 35. Epoch 28 also contained 3.69 times as many emotional neighbors +while time per neighbor improved by 7.57%; epoch 35 moved from no +trailing-neighbor activity to 472.48 neighbors per event after +consolidation. Thus these two absolute-latency misses do not identify a +store-size-dependent engine hotspot; they expose content-incidence +sensitivity in the strict reset audit. An activity-normalized diagnostic +now compares post to trailing windows separately for memory-storage +candidates and emotional-cascade neighbors. It uses ratios of window +sums, treats zero/zero activity as unevaluated, treats a one-sided zero +as incomparable, and deterministically ranks per-unit regressions before +activity-incidence explanations. It is diagnostic only: raw reset, peak, +trough, slope, height, throughput, work, and continued-store-growth +failures remain unchanged and cannot be waived. + +On the same production suffix, all evaluable rows were +activity-incidence rather than per-unit regressions. Epoch 35 memory +storage was selected deterministically because its post window added +24.215 ms while candidate incidence rose sixfold; its unit-cost ratio +was 1.0125, below the existing 1.05 operation threshold. The result +continues to attribution of the memory-storage activity-generation path +while the strict process-reset failure remains. Nineteen focused +diagnostic tests and all 111 storage-audit tests pass, including +contiguous adjacent and cross-operation-identical window checks, finite +aggregate checks, and label-invariant arithmetic for text, audio, image, +shared, and opaque labels. The candidate introduces no runtime work +value. A content-addressed inventory evaluates 33 existing F/S/T-derived +formulas over all 27 structural points and retains the exact nine +production-shaped points; neutral *B* = 128, while 129 remains only the +logical *B* + 1 exclusion boundary and never a fetched or processed row. +No runtime algorithm, knob formula, public API, schema, modality +behavior, or source-id behavior changed in this audit-only +implementation. + +Direct attribution of the selected memory-storage activity path +localized the remaining incidence jump one level earlier. In epoch 28 +the trailing and post windows stored 6 and 12 memories; in epoch 35 they +stored 2 and 12. Each stored memory in both windows returned exactly 394 +supersession candidates and visited the same F/S/T-derived 1,248-row +activation target. Thus the twofold and sixfold candidate totals are +exactly the twofold and sixfold counts of natural writes, not growth in +candidates per write. At epoch 35, sparse-route node rows per stored +memory changed by a factor of 1.0305, candidate-load time per stored +memory by 1.0144, and total memory-storage time per stored memory by +1.0125; epoch 28 improved on the corresponding time measures. The next +measured surface is therefore boundary-to-write incidence in +`ComputeWriteGate`, not another MemoryStorage candidate-search repair. +This is attribution, not authorization to alter memory semantics: the +raw reset miss remains failed and unwaived. + +The replay used production knobs *F* = .45, *S* = .5, and *T* = .5, +deriving *C* = 499, *B* = 125, *A* = 1, 248, 5*C* = 2, 495, 2*C* = 998, +*C* + *B* = 624, and 2*B* = 250. Neutral `.5/.5/.5` remains a distinct +ablation point with 512/128/1, 280/2, 560/1, 024/640/256; 129 is only +its logical, unprocessed *B* + 1 boundary. The attribution adds no fixed +work value and uses neither modality nor source-id labels as a budget +input. The production corpus is text-only evidence; separate mixed-label +regressions retain responsibility for modality/source-id invariance. + +### Write-gate incidence and existing-path HNSW attribution + +An observation-only `ComputeWriteGate` profile then recorded every +decision input and exit class without changing write semantics. A +deterministic builder binds the first comparison to event indices +0–2,499 and the end-anchored final comparison to 13,195–15,694. The +first range contains 575 boundary events and 510 writes: 330 were +forced, 180 passed the score test, and 65 failed it. The final range +contains 573 boundary events and 528 writes: 332 were forced, 196 +passed, and 45 failed. Mean scored margin changed from 0.0843 to 0.0895. +The gate therefore did not produce the measured storage-cost ramp: +boundaries changed by a factor of 0.997 and writes by 1.035. + +The same run demonstrates where HNSW is already incorporated. Natural +and Durable share the existing SQLite-authoritative operation graph, and +`MemoryStorage` supersession uses the same persisted sparse route as +ordinary retrieval rather than a second durable write algorithm. During +finite route warm-up, sparse node rows per stored memory rose from 9.82 +in the first range to 2,447.48 in the final range; exact current-row +comparisons reached the fixed *A* = 1, 248 target and mature routing +distance work reached the fixed 5*C* = 2, 495 envelope. Memory-storage +time per write consequently rose from 0.4833 ms to 2.8343 ms even though +write incidence stayed flat. The final seven end-anchored windows passed +process-half, throughput-half, relative-slope, height, operation, +work-counter, and continued-store-growth checks. Whole plateau +acceptance still failed because the strict absolute consolidation reset +classifier remained invalid; that raw failure is retained and unwaived. + +No new work constant was introduced. At the executed production knobs, +*C*/*B*/*A* = 499/125/1, 248, public routing is 5*C* = 2, 495, +construction remains *C* + *B* = 624 nodes and 2*B* = 250 queue effort, +and 126 is only the production logical *B* + 1 boundary. At neutral +`.5/.5/.5`, *B* = 128 and 129 remains only the logical, unprocessed +*B* + 1 probe. The existing 27-point structural grid and nine +production-shaped F/S/T corpus ablations remain the cutover requirement; +this single production-knob attribution neither replaces them nor claims +activated-identity overlap, bounded restart, Durable plateau, or overall +completion. + +### Same-query recenter overlap + +An experiment-only measurement now runs the same consolidation embedding +through the retained SQLite HNSW route immediately before and after each +successful recenter. A pair is valid only when both route queries +complete; the profile records a distinct pair-valid field and failure +code, and the deterministic builder rejects every invalid pair. Direct +consolidation-path regression covers both a valid equal-set result and +an invalid pre-query. Both searches retain the production-derived 5*C* +node ceiling and *A* = 2*C* + 2*B* activation target. Recenter timing +excludes both observer queries, the measurement is not part of the +accepted performance clock, and it does not change the production API or +schema. + +In a regenerated 13,000-event Natural replay at *F*/*S*/*T* = .45/.5/.5, +22 recenters had explicitly valid, zero-failure paired measurements and +zero profiled pairs were invalid. Fourteen occurred after activation +reached the full *A* = 1, 248 target, and late pairs visited the +complete 5*C* = 2, 495 node envelope. Every pair nevertheless had +overlap 1.0: zero recenters changed even one activated identity for the +same embedding. Thus HNSW is already executed on the shared +Natural/Durable path, but moving the current connection-local entry is +not an effective consolidation-driven activation-centroid reset under +this route. + +This is a rejected lifecycle behavior, not an accepted cycle. The next +candidate must change the sparse activated centroid while keeping the +result at *A*, query work at 5*C*, construction at *C* + *B* nodes and +2*B* effort, and all values derived from F/S/T. It must pass the 27 +structural and nine exact production-shaped knob ablations and remain +modality/source-id agnostic. The raw process-reset gate remains +separate, failed, and unwaived. At neutral `.5/.5/.5`, *B* = 128; 129 is +only the logical unprocessed *B* + 1 boundary and is never a fetched row +or work budget. + +### Saturated fixed-envelope quality boundary + +The revised approximate-retrieval contract does not require an +impossible perfect score from every 512-query run. Each +production-shaped run may contain at most one exact top-1 miss +(511/512 = 0.998046875), the nine-run aggregate must remain at least +0.999, mean exact-identity recall@16 must remain at least 0.998, +semantic coverage must remain at least 0.95, deterministic tie order is +still exact, and misses may not cluster by modality, source identifier, +memory age, or knob setting. Structural bounds, rollback, provenance, +and ordering invariants remain 100% requirements. + +A full-horizon saturation experiment then lowered only the private +routing-node envelope. At the production knobs +*F* = .45, *S* = *T* = .5, *C* = 499 and *B* = 125. The first point, +4*C* = 1, 996, saturated below the mature route population and met the +revised top-1 gate with 511/512 matches, but it was rejected because +identity recall@16 was 0.997791, below 0.998. Semantic coverage was +0.997571. + +The next point added the already-derived reciprocal-update term +*R* = max (2, ⌊*B*/16⌋), yielding 4*C* + *R* = 2, 003. Matching both the +queue and actual-node ceilings at that value and retaining the separate +*A* = 2*C* + 2*B* = 1, 248 consolidation snapshot bounded total query +rows by 4*C* + *R* + *A* = 3, 251. Over 15,695 packets and 512 controls +it measured exact top-1 0.998047, identity recall@16 0.998650, semantic +coverage 0.998047, and deterministic tie order. At neutral knobs the +same formulas resolve to *C* = 512, *B* = 128, *R* = 8, a 2,056-row +route, and *A* = 1, 280; 129 remains only the logical, unprocessed +*B* + 1 boundary. + +This is a quality-passing single production-knob experiment, not a +retained algorithm or a bounded-engine result. Its 15,695-packet run +took 206,060 ms, with mean process time 4.912 ms, mean end-to-end time +12.824 ms, and 33 consolidations. No audited suffix passed the whole +contract: emotional-cascade, commit, publication, and other operation +slopes remained; the raw post-consolidation process reset and +trough-stability gates remained failed; and the required nine-point +aggregate, mixed-modality/source regression, Durable run, and recursive +review have not been completed. The experiment therefore establishes +only that the 100% per-run top-1 requirement hid a viable saturated +quality point; it does not establish the storage-cost cure. + +### Consolidation-reset routing-envelope experiments + +The first dynamic experiment used the saturated quality point above as +its post-consolidation floor. Consolidation reset both queue effort and +actual-node ceiling to 4*C* + *R*, each retrieval-active query added +*R* = max (2, ⌊*B*/16⌋), and both values saturated at the retained 5*C* +ceiling. The separate activation snapshot remained bounded by +*A* = 2*C* + 2*B*, so total query-row work remained at most 5*C* + *A*. +At the production knobs this resolved to a 2,003-row floor, seven-row +steps, a 2,495-row peak, and a 3,743-row total ceiling; at neutral knobs +it resolves to 2,056, eight, 2,560, and 3,840 rows. No source-id or +modality condition participates in the formula. + +The canonical 15,695-packet screen passed its 512-query quality control +with top-1 1.0, recall@16 0.998650, semantic coverage 0.998666, and +deterministic ties. It completed 34 consolidations in 204,822 ms. +However, the corpus ended while some route peaks were still warming, so +a second diagnostic appended one complete later owner-authorized Claude +session using the identical extraction rules. The combined input +contained 30,380 real packets, with no trimming, cycling, padding, or +synthesis. This diagnostic completed 72 consolidations in 438,059 ms. +Mature retrieval cycles reset on 30/30 evaluated edges and their peak +and trough half ratios were 0.9972 and 1.0003, but the normalized p95 +shape error was 0.3074. More importantly, quality fell to 507/512 top-1 +(0.990234), recall@16 0.977225, and semantic coverage 0.971084. All five +top-1 misses appeared in the late-history query quartile. The candidate +therefore fails the numeric and anti-clustering gates and is rejected; +the canonical corpus remains the acceptance corpus, and this +owner-authorized extension is only a maturity diagnostic. + +The smallest follow-up was preregistered before measurement. It retained +the proven 5*C* canonical floor, reset to that floor after +consolidation, advanced queue effort and node ceiling by *R* per +retrieval-active query, and saturated at 6*C*. Total query-row work was +bounded by 6*C* + *A*. Production values were a 2,495-row floor, +seven-row step, 2,994-row peak, and 4,242-row total ceiling; neutral +values are 2,560, eight, 3,072, and 4,352 rows. The focused derivation +and reset regression passed 16 assertions, and all 116 storage-audit +fixtures passed after teaching the audit the new formula. + +The same 30,380-packet diagnostic completed 65 consolidations in 388,336 +ms, with 5.679 ms mean process time and 12.473 ms mean end-to-end time. +Exact top-1 was 512/512 and semantic coverage was 0.989234, but exact +identity recall@16 was only 0.992651. That is materially below the +preregistered 0.998 floor, so the candidate is rejected despite perfect +top-1. Its mature retrieval-cycle subcontract did pass: 24/24 cycles +reset, peak and trough half ratios were 1.0000 and 0.9985, normalized +p95 shape error was 0.1309, late-template error was 0.0137, and no +routing, queue, snapshot, combined-row, distance-coverage, or activation +bound was violated. Its shorter wall time than the lower-floor run is +not attributed to cheaper retrieval: the live time-based detector +requested seven fewer consolidations, and the run was not a +fixed-schedule throughput comparison. Neither dynamic envelope is +retained as a production algorithm, and neither result weakens the +quality thresholds. The sanitized decision record is +`artifacts/flat_storage_cost/dynamic-retrieval-sawtooth-maturity-v1.json`. + +Because the 5C-to-6C candidate passed the complete mature-cycle shape +contract but failed only exact-neighbor recall, the next and only +preregistered routing point raises the floor by one *C* while preserving +the same one-*C* amplitude. It resets at 6*C*, advances by +*R* = max (2, ⌊*B*/16⌋), and saturates at 7*C*; the separate snapshot +remains *A*, so total query-row work is at most 7*C* + *A*. Production +values are a 2,994-row floor, seven-row step, 3,493-row peak, and +4,741-row total ceiling. Neutral values are 3,072, eight, 3,584, and +4,864 rows. The 30,380-packet result retained 511/512 top-1, semantic +coverage 0.993569, and deterministic ties, but recall@16 was 0.995833 +and therefore failed the unchanged 0.998 gate. Its mature cycle passed +with 23/23 resets, peak/trough half ratios 1.0000/1.0003, p95 shape +error 0.0222, late-template error 0.0035, and no work-bound violation. +It is rejected. + +The next floor ablation is preregistered at 7*C* to 8*C* with the same +*R* step and separate *A* snapshot. Production values are 3,493 floor, +seven step, 3,992 peak, and 5,240 total rows; neutral values are 3,584, +eight, 4,096, and 5,376. The maturity run achieved 511/512 top-1, +recall@16 0.997672, semantic coverage 0.996856, deterministic ties, +22/22 resets, p95 shape error 0.0230, and no work-bound violations. +Recall was 0.000328 below the unchanged gate, so the candidate is +rejected. + +The final adjacent floor point is preregistered at 8*C* to 9*C*, again +stepped by *R* with the separate *A* snapshot. Production values are +3,992 floor, seven step, 4,491 peak, and 5,739 total rows; neutral +values are 4,096, eight, 4,608, and 5,888. The maturity run passed: +top-1 was 511/512, recall@16 was 0.999265, semantic coverage was +0.998571, ties were deterministic, and four opaque sources were +represented. In the suffix beginning at event 18,380, 19/20 material +cycles reset; peak and trough half ratios were 0.9991 and 0.9994, p95 +shape error was 0.1908, late-template error was 0.0795, and no routing, +queue, snapshot, combined-row, distance-coverage, or activation bound +was violated. The canonical 15,695-packet acceptance run then passed +quality with 512/512 top-1, recall@16 1.0, semantic coverage 1.0, +deterministic ties, and four opaque sources. It completed 34 +consolidations in 214,263 ms, with 5.233 ms mean process time and 13.334 +ms mean end-to-end time. This shorter corpus never reached the derived +3,992-row floor: maximum actual retrieval work was 3,064 rows, so it +contained no mature post-floor cycles and cannot independently prove the +sawtooth shape. Together the runs establish canonical quality plus +extended-history retrieval maturity, not a whole-engine cure. The +canonical audit still failed the whole-engine plateau: the largest +first-to-last-five timing increases were `GraphRetrieve.seed_knn_cache` +(1.217 to 2.496 ms) and supersession current/candidate loading (about +0.48 to 1.40 ms). At that point the nine-point aggregate, Durable path, +hotspot attribution, and production cutover were still pending; the next +subsection records their resolution and remaining limits. + +### Production-default 8C-to-9C cutover + +The accepted adjacent envelope was moved into the existing SQLite HNSW +route as the production default rather than added as another retrieval +or write path. With hooks disabled, the route now resets queue effort +and actual-node ceiling to 8*C* after a successful consolidation +recenter, advances both by *R* = max (2, ⌊*B*/16⌋) per retrieval-active +query, and saturates at 9*C*. The independent consolidation snapshot +remains bounded by *A* = 2*C* + 2*B*, so total fetched rows remain at +most 9*C* + *A*. Restart opens at the 9*C* ceiling because the +in-process ramp position is not durable. Historical private selectors +remain only as reproducibility controls; a regression requires the +former selector-24 formula to resolve identically to the production +default. No source-id or modality label participates in any formula, and +Natural and Durable still share the operation graph; Durable adds only +its post-commit checkpoint. + +A round-two rollback review found that the internal search used to build +a recenter snapshot could transiently advance the ramp before +persistence. The route now excludes recenter-building searches from the +*R* increment. A focused failure-injection regression aborts the +metadata update and proves that both effort and node budget remain +unchanged; successful recenter is still the only path that resets them +to 8*C*. + +The no-selector 15,695-packet Natural replay at +*F* = .45, *S* = *T* = .5 resolved *C* = 499, *B* = 125, *A* = 1, 248, +*R* = 7, a 3,992-row floor, 4,491-row peak, and 5,739-row combined +ceiling. It completed 34 consolidations in 203,522 ms, with 4.921 ms +mean process time and 12.659 ms mean end-to-end time. Its 512 public +controls passed at 512/512 exact top-1, recall@16 1.0, semantic coverage +1.0, deterministic ties, and four opaque source identifiers. Timing +cannot be compared causally with the earlier selector run because +timestamps, live consolidation incidence, and build identity differ. + +The production-default nine-point matrix replayed 4,000 packets +sequentially at midpoint, both joint endpoints, and each one-axis +endpoint. All 4,608 of 4,608 controls matched exact top-1; minimum +recall@16 and semantic coverage were both 1.0; tie order was +deterministic; and there were no misses to cluster by modality, opaque +source, memory age, or knob point. The focused 27-point structural grid +and bounded-backfill, metadata-open, core-knob, and text/audio/image +plus shared/opaque-source invariance regressions also passed. All nine +short routes were exercised, but none produced a valid mature +pre/post-activation pair: their active graphs remained below the 8C +floor. The aggregate therefore classifies them as quality-passing but +recenter-unevaluated rather than laundering warm-up into sawtooth +evidence. The 30,380-packet run above remains the mature-cycle proof. +Sensitivity-high took 140,392 ms versus 37,522–67,511 ms for the other +eight points and is retained as an adverse measured result, not hidden +by the perfect quality aggregate. + +The mature 8C-to-9C profile was also split into two non-overlapping late +halves. While the persistent store continued to grow, mean process time +fell from 8.918 to 7.858 ms. `GraphRetrieve.seed_knn_cache` fell from +2.914 to 2.397 ms and its per-node unit ratio was 0.789; supersession +loading fell from 1.860 to 1.520 ms and its per-candidate unit ratio was +0.855. Emotional work rose slightly per edge, but its total fell from +0.486 to 0.430 ms. This is evidence that mature per-store work is not +continuing to grow under the bounded route. It does not convert the +still-failing raw process-time reset diagnostic into a pass: +consolidation changes retrieval locality and its work envelope, but it +cannot force every following event to perform the same amount of +content-dependent write work. + +Finally, the real 2,016-message Durable corpus used the same no-selector +parameters and completed four consolidations in 79,481 ms, with 10.710 +ms mean process time and 39.024 ms mean end-to-end time. Its 512 +controls again passed at 512/512 top-1, recall@16 1.0, semantic coverage +1.0, deterministic ties, and four opaque sources. The corpus cannot +supply the required ten post-warmup 500-event windows, so this is +shared-path, checkpoint, and quality evidence; it is not a Durable +plateau claim. The production cutover is therefore scoped to the +knob-derived retrieval envelope and shared operation path, not to +bounded whole-engine restart, production-wide latency, release, or +deployment. + ## Standard Eviction-Frontier Estimate The standard file-backed pressure gate is 500,000,000 bytes. Exact diff --git a/docs/paper/sections/10_implementation.qmd b/docs/paper/sections/10_implementation.qmd index 9db4b003..228a06af 100644 --- a/docs/paper/sections/10_implementation.qmd +++ b/docs/paper/sections/10_implementation.qmd @@ -88,10 +88,11 @@ recovery clock, generation resets, per-memory anchored inhibition state, an expiry index, and a connection-local temporary effective-value view. The persistent migration inventory is exactly the three state tables plus the expiry index; it does not install durable views or triggers. Retrieval -competition advances one global log-recovery clock per event, materializes only rows whose exact -suppression has crossed the existing $10^{-9}$ active threshold, and updates -only newly suppressed losers. A full-recovery interval advances a generation; -older rows are materialized in bounded batches and reset markers are pruned +competition advances one global log-recovery clock per event, materializes at +most one knob-derived row batch whose exact suppression has crossed the +existing $10^{-9}$ active threshold, and updates only newly suppressed losers. +A full-recovery interval advances a generation; older rows are materialized in +the same knob-derived batches and reset markers are pruned after their generation has no remaining active rows. Internal reads that depend on strength, suppression, or the suppression timestamp use the temporary effective view. Compatibility handling conservatively materializes @@ -102,22 +103,99 @@ database-derived processor cache before the statement executes. The authoritative signal mutation still commits once to persistent SQLite. After that commit, a separate connection-local in-memory SQLite database -publishes only the current recovery clock and active-generation inhibition -rows. It never mirrors durable memory, signal, embedding, association, or -payload history. A failed persistent commit restores the pre-signal processor +publishes only the current recovery clock and the identities touched in the +current engine epoch. Persistent SQLite may retain more active inhibition +identities than this disposable epoch projection. Suppression, recovery-total, anchor, expiry, +and effective-value fields remain solely in persistent SQLite; no production +consumer reads a duplicated RIF value from the disposable identity ledger. +Strength-only changes that cannot alter active membership therefore do not +republish it. The ledger never mirrors durable memory, signal, embedding, +association, or payload history. A failed persistent commit restores the pre-signal processor snapshot; a failed post-commit epoch publication discards and rebuilds the disposable database from persistent authority without replaying the committed signal. Natural returns after publication. Durable follows the identical path and then executes only the named WAL checkpoint barrier. -The active epoch records event, changed-row, and allocated-byte measures with -harness safety ceilings of 512 events, 32,768 mutations, and 64 MiB. Reaching a -ceiling raises the existing `Required` consolidation hint before an honoring -caller can enter another event. Ignoring the hint neither starts another epoch -nor drops mutations. A successful explicit consolidation rebuilds the -disposable epoch and resets its mutable measures; a failed consolidation leaves -the old epoch intact. These are harness-scoped ceilings, not a claim that every -production workload is globally bounded. +The active epoch records event, changed-row, allocated-byte, and maximum +statement-row measures. Its harness safety ceilings are derived from the same +clamped F/S/T route capacity and row batch + +$$ +C(F,S,T)=\operatorname{round}(256+256F+128S+128T),\qquad +B(F,S,T)=\operatorname{round}(64+64F+32S+32T). +$$ + +events are bounded by $C$, mutations by $64C$, and allocated bytes by +$131{,}072C$. Persistent active-row loads, in-memory SQLite publication, +recovery calibration, and retired-generation materialization use statements +of at most $B$ rows. Thus all-low, midpoint, and all-high resolve respectively +to 256/16,384/32 MiB/64 rows, 512/32,768/64 MiB/128 rows, and +768/49,152/96 MiB/192 rows. The midpoint values are defaults, not fixed +production constants. Reaching an epoch ceiling raises +the existing `Required` consolidation hint before an honoring caller can enter +another event. Ignoring the hint neither starts another epoch nor drops +mutations. A live $B+1$ mutation set is completed by a second independently +$B$-bounded statement; $B$ is a statement bound, not a history cap. This is +distinct from historical sparse-route backfill, whose logical $B+1$ +completion probe does not read or process the additional historical row. Any +epoch overflow observation is named as the resolved limit plus one and is not +an additional work-batch size. A successful explicit consolidation commits +persistent SQLite and then starts a fresh in-memory SQLite epoch containing +only the current clock. It does not copy the persistent active-identity +population into the new epoch. The next ordinary event publishes only its +changed identities. A failed consolidation leaves the old epoch intact, while +a publication failure after persistent commit discards and recreates the same +empty epoch without replaying the durable mutation. The retry intent is sticky +until that empty epoch is published: even if both publication and immediate +recovery fail, the next processor event executes the empty reset rather than a +full persistent-history rebuild. Retrieval-surface reloads preserve the RIF +epoch sidecar across their independent cache refresh, including the exception +path after a failed reload, so consolidation cannot erase that retry intent +after the durable commit. These +are harness-scoped ceilings, not a claim that every production workload is +globally bounded. Non-finite F/S/T values fail before integer capacity +derivation; finite out-of-range values retain the engine's established clamping +to $[0,1]$. + +The row-batch contract is exercised structurally over all 27 points in +$\{0,0.5,1\}^3$ and through live $B+1$ publication at nine production-shaped +points: midpoint, both joint endpoints, and each one-axis endpoint. The latter +varies text, audio, image, shared-source, and opaque-source labels while +requiring the same resolved batch and the same two-statement completion. Thus +128 is only the neutral-knob result, and 129 is only its derived $B+1$ +boundary. + +The consolidation-reset regression uses the same nine knob points and seeds a +knob-derived $B+1$ persistent active population with mixed text, audio, image, +shared-source, and opaque-source labels. At every point the durable population +survives consolidation, the new disposable epoch contains zero copied +identities, and the following event publishes exactly its one changed identity. +An additional failure-chain regression seeds a neutral $B+1=129$ mature +durable population, injects failures into publication, immediate recovery, and +the following retrieval-surface reload, and requires the next event to observe +zero copied rows before publishing exactly one changed identity. The +persistent 129-row population remains authoritative; it is never converted +into a 129-row statement. The reload exception was first reproduced as a +missing sidecar before the catch path was repaired. +This removes store-sized work from the successful-consolidation publication +edge. It does not yet bound initial processor startup: compatibility and +restart recovery may still reconstruct current-generation identity and +calibration state from persistent SQLite, so bounded whole-engine restart +remains an explicit open gate. + +The same derivation owns the integrated SQLite HNSW maintenance and +consolidation frontiers. Public route inspection and queue effort reset to +$8C$ after consolidation, advance by +$R=\max(2,\lfloor B/16\rfloor)$ per retrieval-active query, and saturate at +$9C$; +downstream activated identities are bounded by $A=2C+2B$; graph degree is +$N=\max(8,\lfloor B/2\rfloor)$; search expansion is +$E=\max(8,\lfloor B/4\rfloor)$; and ordinary route sealing occurs at $B-E$. +Score consolidation reads at most $A$ indexed low-strength identities and at +most $N$ association edges for each admitted identity. Natural and Durable +execute these same operations and mutations; Durable adds only the existing +post-commit flush/checkpoint barrier. None of these bounds branches on +modality or source identifier. ### Bounded activation observation shadow @@ -154,6 +232,340 @@ The experiment therefore establishes implementation and measurement seams for fixed sparse activation; it does not replace exact retrieval, make the shadow authoritative, or claim bounded startup or live behavior. +### Packed sparse-route hybrid candidate + +The follow-on benchmark candidate replaces the centroid shadow's single lossy +route with two independently constructed sparse graphs and a persistent +512-neighbor route for each sealed embedding. Query work is fixed independently +of retained-history size: each graph receives at most 1,280 exact embedding +comparisons, and the merged candidates are reranked by the same cosine distance +and identity tie order as the exact control. During a 512-event active epoch, +each new embedding may propose at most 64 reciprocal route updates. Building a +sealed graph is likewise capped at 16,384 construction comparisons per graph. +These capacities are functions of the engine knobs and embedding geometry; +neither `source_id` nor modality participates in routing. + +The benchmark persistence layout keeps SQLite authoritative. A sealed snapshot +stores normalized vectors, the two packed adjacency arrays, and packed routes +as four SQLite blobs, with 1,024 deterministic anchor rows used to enter the +graphs after restart. The current epoch remains a bounded connection-local +SQLite database. Restart opens the four blobs and visits only metadata plus the +anchor rows; it does not replay retained embeddings. Consolidation is the epoch +boundary: it seals derived routes and then begins a fresh active epoch, +producing the intended sawtooth without introducing a second Natural/Durable +write algorithm. Durable would remain the shared write followed only by its +checkpoint barrier. + +This layout is still a benchmark design, not the current production retrieval +path. The first quality corpus contained all embedding rows, including +signal-only rows that the public seed path does not rank as long-term memories; +its control was therefore mislabeled as current public retrieval. A corrected +export uses current long-term memory surfaces keyed by memory identity. The +two-graph design reached exact top-1 and recall-at-16 of 1.0 over 3,172 such +surfaces, but that static population still omitted runtime timestamp +eligibility, supersession filtering, current-surface selection, and family +collapse. A subsequent 15,695-packet run captured 512 actual public retrieval +controls across events 6--15,691. Three standalone attempts reconstructed the +point-in-time route from the final database: all surface versions, one current +node per memory, and base plus replaceable current reconstruction. Their +apparent identity coverage remained near 0.984 and top-1 near 0.914. An +exhaustive dual-surface oracle reproduced those misses exactly, showing that +approximate graph search was not the cause. The final database cannot reproduce +every intermediate current surface after reconsolidation mutates +`memories.embedding_id`; therefore those quality labels are invalidated rather +than treated as candidate failures. A valid follow-on captures the live surface +mutation stream during replay. No variant is enabled in production. The +prototype's source graph construction and snapshot writer also have not yet +passed the engine's transaction-failure, consolidation-publication, +end-to-end latency, or full-replay gates. The description records the algorithm +precisely so those gates test one content-addressed design rather than an +informal approximation. + +The replacement evaluation seam is an explicit private live-surface mutation +trace. It is disabled by default and enabled only by the replay harness. After +each successful process event it records ordered long-term surface upserts and +removals as memory identity, embedding identity, and the 256-dimensional +post-encoding vector; consolidation-phase mutations are recorded separately +after the process phase. Normal execution neither stores nor copies these +vectors. The trace carries no routing branch for `source_id` or modality, and +its raw vectors remain private. A paired capture-off/capture-on replay must +retain exact public behavior and logical SQLite content before the trace can be +used as candidate evidence. + +The direct-control harness now observes the engine rather than reimplementing +its eligibility rules. On explicitly enabled benchmark runs, +`GraphAugmentedRetrieveCandidates` exposes its already-ranked direct seeds to +a thread-local trace after timestamp exclusion, supersession filtering, +current-surface selection, family collapse, exact scoring, and deterministic +tie ordering. The Natural replay records those seed ranks together with the +graph-expanded and hydrated public ranks only on retrieval-active events, then +selects an inclusive even sample from that event stream. Normal execution does +not construct the extra seed trace. A paired 200-event replay produced the same +behavior digest and canonical logical-database digest with and without capture, +so the observer is behavior- and storage-neutral at that scope. Query vectors +remain only in the private proof artifact; the paper-facing audit retains their +digests and aggregate coverage. The complete 15,695-event, 512-query control +and live candidate comparison are reported in the optimization evaluation. +This instrumentation remains a private proof seam rather than a production API. + +### Integrated HNSW candidate route + +The sparse route is wired into the existing +`GraphAugmentedRetrieveCandidates` operation; it is not a second retrieval or +ingestion API. SQLite-backed routing is the normal internal path, with a private +rollback switch retained for experiments. Natural and Durable update the same +current-memory surface and Durable adds only its post-commit SQLite checkpoint +barrier. Routing consumes only the 256-dimensional post-encoding vector and +memory identity, so modality and the opaque `source_id` never select graph +structure, capacity, or rank behavior. + +Every operational work limit is derived from the three public knobs. After +clamping $F$, $S$, and $T$ independently to $[0,1]$, the candidate capacity and +legacy-store backfill batch are + +$$ +C(F,S,T)=\operatorname{round}(256+256F+128S+128T), +$$ + +$$ +B(F,S,T)=\operatorname{round}(64+64F+32S+32T). +$$ + +The downstream activation target is independently named: + +$$ +A(F,S,T)=2C(F,S,T)+2B(F,S,T). +$$ + +The graph neighbor limit is $max(8,\lfloor B/2\rfloor)$, the level-zero +link limit is $max(16,\lfloor C/4\rfloor)$, and maximum hierarchy level is +$\lceil\log_2 C\rceil$. At each level a new node may update at most +$max(2,\lfloor B/16\rfloor)$ reciprocal rows. HNSW construction effort is +$max(32,\operatorname{round}(25C/64))$ and query effort is +$max(C,\operatorname{round}(5C/2))$. The bootstrap, maximum public visited-node, +maximum public queue, shadow-cache, construction-node, and construction-queue limits +are respectively $2C$, $9C$, $9C$, $24C$, $C+B$, and $2B$. The $9C$ +quantity is a hard routing-inspection ceiling, not the activated working set; +the cache's node map and FIFO order are bounded together, and a successful +seal clears both so invalidated rows cannot leave accumulating order entries. +After exact reranking, no more than $A$ identities may proceed into eligibility, +family collapse, graph expansion, and final ranking. Exact cosine +family checks have a separate $2C$ per-event ceiling. The breadth-first adjacency fetch +batch is $max(8,\lfloor B/4\rfloor)$. The larger query and bounded cache +coefficients were selected by copied-late quality probes: $2C/C$ and +$3C/2C$ search candidates missed the exact-identity gate; $8C/4C$ with a +$16C$ cache passed on the initial store but missed one exact top-1 after the +bounded supersession surface changed the live graph. A later expanding +$5C\rightarrow12C$ envelope restored exact sampled quality but made both query +and construction work grow with query age. The retained candidate resets +public route inspection to $8C$, advances it by $R$ only until the $9C$ +ceiling, fixes downstream activation at $A=2C+2B$, and reserves the smaller +$C+B/2B$ envelope for graph construction. These are knob-derived finite +limits, not midpoint constants. + +Consolidation changes activation locality without changing SQLite authority or +introducing a second route. Restart opens at the $9C$ ceiling because +in-process query age is not durable; every successful recenter resets the +shared path to the $8C$ floor, and subsequent retrieval-active queries advance +queue effort and actual-node ceiling together by $R$ until $9C$. A successful route +seal normalizes the consolidation embedding, runs the canonical bounded search +around that semantic center, and persists at most $A$ resulting memory +identities as the next activation snapshot. The canonical maximum-level entry +continues to own global HNSW descent. Ordinary retrieval loads the packed +snapshot through its independent $A$ row budget and uses all valid snapshot +identities as deterministic level-zero entry points. Neighbor rows discovered +from those entry points remain charged to the current canonical $8C$--$9C$ budget, +so consolidation can steer the walk without widening either envelope. +The internal search used to construct a recenter snapshot does not advance the +retrieval-age ramp. If snapshot persistence fails, both queue effort and the +actual-node budget remain at their pre-attempt values; only a successful +recenter resets them to $8C$. +The floor, increment, and ceiling are derived from F/S/T rather than +independently tunable fourth knobs. Every query records its ceiling and actual +visited rows; canonical rows above the current ceiling or above $9C$ fail the +audit. The persisted +snapshot remains independently charged under its $A$ ceiling and is joined +with the canonical candidates for final exact reranking. The returned set makes +the existing formula explicit: its best $2C$ canonical identities are +protected, while consolidation may supply the remaining $2B$ identities in +$A=2C+2B$. The final selected set is reranked by exact distance. Total fetched-row +work is therefore bounded by $9C+A$. A separate returned-identity counter still +fails above $A$, so a changed semantic center cannot be mistaken for an +unbounded working set. The normalized center, snapshot generation, and packed +identity list live in the single SQLite route-metadata row and survive reopen; +malformed, stale, duplicate, or over-capacity metadata invalidates the route. +Graph and memory rows remain authoritative in SQLite. + +Decoded activation-snapshot rows reuse the route's existing generation-qualified +shadow-node cache rather than being selected and decoded again for every query. +The first query after reopen loads only snapshot identities absent from that +cache; later queries reuse those immutable decoded rows while continuing to +compute query distance exactly. The shared cache remains bounded by $24C$, and +every successful seal clears both its node map and FIFO order before any row +from the next authoritative SQLite state can be reused. A separate physical +snapshot-cache-miss counter distinguishes the fixed $A$ rows evaluated from the +rows actually loaded from SQLite. This is a read-through optimization of the +one persisted route, not an in-memory authority or a second write path, and it +contains no modality or source-id predicate. + +Emotional propagation uses the same first-source-wins semantics while avoiding +duplicate downstream work. Its breadth-first kernel carries up to 64 source +ordinals in one bit mask. For each reached embedding, the kernel records only +the lowest source ordinal and that source's first (therefore shortest) positive +depth; after all batches, it emits one winning pair per embedding in +deterministic source/depth/identity order. Separate counters record all +source--embedding reachability pairs and all physical adjacency visits, so +winner collapse does not relabel unbounded traversal as bounded work. The +optimization is independent of modality and source-id labels and does not +change persistence or add a write path. + +The bounded-cascade experiment adds three independent F/S/T-derived limits +around that exact winner rule. Its maintained source-priority snapshot holds +at most the public routing budget $5C$; one cascade inspects no more than that +snapshot and executes at most $B$ eligible sources. The shared traversal stops +before physical adjacency visit $5C+1$, and the existing enqueue stage emits at +most $A=2C+2B$ embedding updates. SQL fallback materializes at most the same +$5C$ source prefix. Inspection, accepted-source, physical-edge, winning-pair, +and update counts remain distinct, with their resolved limits recorded on each +profiled event. The snapshot ordering depends only on timestamp and memory +identity; no source-id or modality label participates. These limits remain +private experiment hooks until the complete quality, plateau, restart, and +knob-ablation contracts pass. + +The cycle auditor classifies retrieval independently from whole-engine process +shape. It selects retrieval-active events from explicit route activity, queue, +ceiling, visit, distance, snapshot, or activation evidence. In sawtooth mode it +requires the exact F/S/T-derived $8C$ reset floor, $R$ increment, and $9C$ +ceiling, canonical visits no greater than the current ceiling, snapshot visits +no greater than $A$, combined row visits no greater than $9C+A$, nonzero unique +distance work no greater than the fetched-row union, and activated identities +no greater than $A$. Mature cycles must show the reset on consolidation and +pass the preregistered peak/trough, resampled-shape, and late-template gates. A +route-active event with missing or zero work therefore fails rather than +disappearing from the sample. Missing recenter evidence, a changed +post-consolidation canonical ceiling, or any work value above its declared +derived envelope also fails closed. Activated-identity overlap is a separate centroid +movement measurement; without it the classifier and work envelope may pass, +but the full retrieval-cycle contract remains unproven. +Process, throughput, and operation-slope gates remain separate, so bounded +routing cannot conceal a rising write path. + +At neutral knobs these formulas retain +the evaluated midpoint: $C=512$, $B=128$, $A=1{,}280$, 64 neighbors, 128 level-zero links, +maximum level 9, 8 reciprocal updates per level, construction effort 200, +query effort 1,280, and 1,024 exact family comparisons. The canonical floor is +4,096 rows, the increment is 8, and the canonical-plus-snapshot row ceiling is +$9C+A=5{,}888$ at neutral knobs. The +all-low and all-high endpoints are not aliases for this midpoint; the complete +$3\times3\times3$ structural grid is tested. + +When the current surface contains at most $C$ rows, the exact scan is already +inside the bound. Above it, one deterministic persisted HNSW hierarchy proposes +a sparse frontier. The same SQLite route then completes the current query's +knob-bounded routing envelope with a deterministic indexed slice of active +rows, wrapping once around the canonical entry identity, until the current +$8C$--$9C$ actual-node ceiling is reached or the surface is exhausted. +Every routed row---whether reached by an HNSW edge or by envelope +completion---is exactly reranked. The independently persisted consolidation +snapshot then contributes at most $A$ additional rows to the same exact union, +after which the operation returns at most $A$ +memory identities to the existing downstream path. Timestamp eligibility, current-surface membership, +supersession, long-term kind, cosine-family collapse, graph expansion, final +scoring, and deterministic ties remain authoritative. This sparse activation +route fixes disconnected-node blindness without introducing a second retrieval +or write path; HNSW controls locality while the derived envelope controls exact +coverage and work. + +Within one activation query, the row-addressed route stores each persisted +node's exact query distance beside that query's local node view. Higher-level +descent, level-zero expansion, best-set maintenance, and the final exact +activation rerank reuse that value instead of recomputing the same 256-element +distance. The canonical cache is query-local and bounded by the same $9C$ maximum +fetched-node ceiling; snapshot materialization is separately bounded by $A$, +and both are discarded after the call. Pending updated embeddings use a +separate distance evaluation from their older persisted row, so an identity +cannot reuse a stale vector merely because its numeric ID is unchanged. The +route records both visited nodes and exact distance evaluations, and requires +the latter to be at most the unique union of canonical, snapshot, and +knob-bounded pending-delta rows. This changes only repeated arithmetic: activated identities, order, +downstream eligibility, SQLite authority, and Natural/Durable ownership are +unchanged. + +SQLite remains canonical for both memory data and the row-addressed graph. +Active graph metadata and node rows are separate from an unpublished build +record. An existing store is backfilled in batches no larger than $B$ and the +build is invisible to retrieval until its active count matches the +authoritative current surface. Exact retrieval remains the candidate and the +control during this interval. A durable dirty-identity journal records every +route upsert or removal in the caller's authoritative transaction. When the +complete active journal contains at most $C$ identities, retrieval stages those +authoritative current embeddings or removals as an exact bounded delta over the +persisted hierarchy. More than $C$ dirty identities fails closed to the exact +path. The journal query reads at most $C+1$ identities only to distinguish a +complete $C$-row delta from overflow. At neutral knobs this live-journal limit +is therefore 512 and its overflow sentinel is row 513. Historical ordered +backfill remains independently bounded by $B$. After advancing at most +$B=128$ historical rows, the implementation tests whether the in-memory +ordered iterator has another entry. Thus 129 is the derived logical $B+1$ +boundary, not a physical 129th-row read and never a 129-row work batch. Opening the sparse +route loads one metadata row, validates at most $A$ packed activation +identities from that row, resolves only that knob-bounded ordered slice, +and lazily fetches graph nodes under the $9C$ canonical plus $A$ snapshot +public-query bounds; the route +itself does not replay or mirror complete history. This is not a bounded +whole-engine restart claim: `SignalProcessor` startup still materializes the +complete current memory surface before retrieval begins, so startup remains +$O(\text{history})$ until that separate hydration path is removed. + +Live writes do not grow an unbounded in-memory construction delta for either +active or unpublished routes. Each construction edge drains at most $C$ dirty +identities from the SQLite journal and may independently advance at most $B$ +ordered historical backfill rows. The larger dirty bound is still knob-derived +and lets an epoch that changes more than one backfill batch converge instead of +permanently chasing its own journal. A successful seal deletes only the dirty identities included in that +bounded root set; any remainder stays authoritative for the next edge, and an +unpublished build cannot publish until both ordered backfill and the journal are +complete. Thus a busy active route or legacy-store migration cannot turn the +sparse index into a second unbounded write path. + +Normal writes and reconsolidations append only their memory identities to the +durable journal. A successful seal writes changed nodes and knob-bounded +reciprocal neighbors, advances graph metadata, and clears only its staged root +identities in the same SQLite transaction. Neighbor proposal during this seal +uses the $C+B$ node and $2B$ queue construction envelope, not the public $9C$ +activation envelope. Existing active nodes retain their persisted topology when +their current embedding changes; the rejected bounded-relink experiment is +reported in the optimization section. A failed authoritative transaction +cannot leave a durable route mutation. An interrupted or failed seal leaves the +identities journaled for restaging, while exact retrieval remains authoritative. +This gives consolidation a real route-epoch boundary without a store-sized graph +rewrite. + +Application hydration uses the same bounded-surface rule when a memory has no +materialized memory or reconstruction blob. SQLite retains every authoritative +signal, but the fallback reads only the most recent $B$ signal rows for that +memory through the `(memory_id, serial_position)` index and returns the selected +rows in chronological order. Thus neutral knobs hydrate at most 128 fallback +signal payloads per returned memory, all-low hydrates 64, and all-high hydrates +192. The bound does not inspect modality or `source_id`; text, audio, and image +signals follow the same indexed query. The runtime records the derived limit +and the number of fallback rows actually materialized on each public call. + +The same bounded activation surface now serves supersession selection after the +current memory population exceeds $C$. `MemoryStorage` asks the persisted route +for at most $A$ identities, exactly reranks those current embeddings, and keeps +its existing timestamp, kind, threshold, duplicate-band, edge-count, and tie +rules. On this sparse path the latest current embedding is the memory's active +centroid: an older base embedding remains durable lineage but does not re-enter +as a second competing candidate after consolidation has moved that memory. +Until the route is published, when the dirty delta exceeds $C$, or when route +validation fails, the operation retains the exact fallback. This is one shared, +modality- and source-agnostic candidate route for Natural and Durable; it does +not add a second write API or make the connection-local cache authoritative. +The 4,000-event knob ablation and its remaining full-horizon limits are reported +in the optimization section. `TRACE[state:integrated_hnsw_sparse_route_experiment]` +and `TRACE[state:sqlite_hnsw_knob_ablation]`. + Rollback snapshots move the private accumulator map, working-memory records, and their blob-reference vectors out of the generic context copy and restore their ownership immediately afterward. The active source's bounded scalar @@ -268,7 +680,10 @@ both upper bounds are also sound, so none can exclude a pair meeting the cosine threshold. The complementary bases avoid broad exact pairwise work for both sparse coordinate-aligned vectors and dense Hadamard-aligned vectors; arbitrary adversarial surfaces may still reach the -exact fallback. The normalized vector and both block-norm summaries are +exact fallback. One event may execute at most $2C$ exact cosine checks across +all family-collapse stages. Exhaustion conservatively admits the current +candidate to the independently bounded rank/output stages rather than +performing a store-sized comparison tail. The normalized vector and both block-norm summaries are immutable functions of an embedding, so the private surface computes them on first family use and retains them with that entry. Replacing a current surface entry replaces its summaries as part of the same cache mutation. This removes @@ -292,8 +707,10 @@ maintains, for each supersession target, the earliest start timestamp of an eligible replacement. Retrieval tests that timestamp directly instead of rebuilding a target set by scanning every incoming edge. Memory storage publishes its already-committed supersession decisions into the fanout cache -and rebuilds the sidecar index; missing target metadata invalidates the cache -and returns to authoritative SQLite rehydration. Neither structure is part of +and recomputes only the affected target's eligibility. A current-surface change +likewise recomputes only targets reached by that memory's outgoing +`supersedes` edges. Missing target metadata invalidates the cache and returns +to authoritative SQLite rehydration. Neither structure is part of the public processor layout. The strict replacement-before-query predicate and base embedding identity remain unchanged. The emotional-metadata portion of the sidecar is trusted only by the @@ -450,6 +867,60 @@ features, and no bundled chat renderer is part of this claim. ## Computational Complexity +### Bounded Active Signal-Vector Snapshot + +Migration 30 removes accepted signal vectors from the store-wide sqlite-vec +search surface. The durable `signals` row and object-store payload remain the +authoritative event record, and `signals.embedding_id` references the memory or +working-memory centroid that represents that event in global retrieval. Exact +vectors for only the active tail are retained in the internal +`cortext_active_signal_embeddings` SQLite table. This is one SQLite-backed +write path, not a second durability system: Natural ingestion appends through +the common path, and Durable adds the existing flush/checkpoint boundary. + +The ring capacity reuses the knob-derived historical batch size + +$$ +B(F,S,T)=\operatorname{round}(64+64F+32S+32T), +$$ + +after independently clamping each knob to $[0,1]$. It therefore contains 64, +128, and 192 rows at the all-low, midpoint, and all-high corners. The logical +rounding rule is C++ `std::lround`, so half-integer ties round away from zero. +For example, $F=1/128,S=T=0$ yields 65 rather than 64. The logical +$B+1$ probe remains an overflow/completion check; it is not a fetched or +processed extra row. Slot selection is +`(signal_id - 1) mod B`, so each ring upsert replaces at most one prior +exact-vector row. One accepted pipeline event may persist multiple accumulated +signal records and therefore perform multiple bounded upserts; the measured +Natural maximum was 14 ring-table mutations in one event. If knobs change, the +table rehashes only the newest rows that +fit the newly resolved $B$ and remains bounded by the old or new knob-derived +capacity throughout the transition. + +Recent-context and working-memory restart hydration first read the exact vector +from this bounded ring and fall back to the durable centroid reference for an +older signal or a pre-migration database. The global vector index consequently +contains memory centroids rather than a growing population of signal-only +decoys. The schema and routing code contain no modality or `source_id` branch; +text, audio, image, shared, and opaque sources enter after encoding through the +same slot formula. Migration tests preserve the legacy fallback, and direct +regressions cover mixed modality/source labels, knob changes, and the +64/128/192 capacity corners without widening the public API. The hydration +implementation reads the exact ring first and then the centroid fallback, but +this checkpoint does not claim a standalone end-to-end restart regression or +bounded whole-engine restart. + +Emotional propagation separately limits enqueued mutation statements to the +existing activation target $A=2C+2B$. This is a hard bound on writes, not a +claim that the current breadth-first emotional traversal is fixed work. The +full traversal remains an explicitly unresolved optimization surface. A pass +that reaches $A$ is an incomplete priority prefix and is not recorded as an +emotional fixed point; a persistent processor context therefore revisits its +unresolved tail on the next event. Commit-table mutation profiling is installed +whenever work-counter profiling is enabled and no longer depends on the +separate consolidation-epoch profiler. + The dominant per-signal cost is exact candidate discovery over the durable embedding and association surface. With `N` stored memories and embedding dimension `d`, the current write path computes exact current/base distances in diff --git a/docs/paper/sections/11_optimization.qmd b/docs/paper/sections/11_optimization.qmd index abc80e1a..775160e8 100644 --- a/docs/paper/sections/11_optimization.qmd +++ b/docs/paper/sections/11_optimization.qmd @@ -66,7 +66,7 @@ The current branch includes the following implementation-level changes: | supersession eligibility | derive target-to-earliest-replacement timestamps in an internal execution sidecar beside the shared association fanout cache and incrementally publish committed MemoryStorage supersession edges instead of invalidating and rebuilding all fanout rows | exact edge direction, base embedding ids, strict timestamp boundary, source/modality independence, SQLite fallback, rollback rehydration, and the public processor layout are retained | | reconstruction | knob-bounded retrieval-time reconstruction append | constructive recall remains non-decoder and can be disabled cleanly | | memory storage | avoid redundant object-store writes for single-signal memory payloads | durable payload identity is preserved | -| exact durable-neighbor ranking | maintain private current/base embedding surfaces in a process-wide lifecycle registry, including signal-only rows that affect the sqlite-vec population; rank into typed borrowed/owned candidates; reuse the query norm across exact cosine checks; track the exact historical supersession population and current/base mismatches so a current top-k cutoff can prove when no unseen historical row can enter the result | the registry follows processor teardown across sequential thread migration and mirrors authoritative SQL write decisions; the same candidate population, K, filters, tie order, cosine results, thresholds, and supersession edges are retained; ambiguous lineage or tie order falls back to the complete eligible scan; SQL remains the final fallback and no public header or API layout changes | +| supersession neighbor ranking | below the sparse cutover, or whenever the route is unpublished, overflowing, or invalid, maintain private current/base embedding surfaces and retain the exact historical-coverage proof and SQL fallback; above the knob-derived cutover, reuse the SQLite HNSW activation surface, inspect an $8C$ post-consolidation floor that advances by $R=\max(2,\lfloor B/16\rfloor)$ to a $9C$ ceiling, rerank at most $A=2C+2B$ activated current centroids, and count routed rows and activated identities independently | the current centroid becomes the active post-consolidation identity while older base embeddings remain durable lineage; total query rows remain at most $9C+A$; timestamp, kind, duplicate band, similarity threshold, edge limit, deterministic tie order, rollback, source/modality independence, and public API shape remain unchanged; lower-rank candidates may differ within the separately approved bounded-retrieval accuracy contract | | graph retrieval | score vector similarity first, restrict recency to a tie-break, cap graph bonus, and reserve final occupancy for direct semantic anchors | recent unrelated rows and noisy graph neighbors cannot displace the semantic seed surface | | rollback snapshots | detach rebuildable durable caches, deep-copy the internal execution-sidecar state only for full snapshots, move the private accumulator map, and detach working-memory signal-record and blob-reference vectors before copying remaining processor state; journal active-source vector lengths for ordinary appends and lazily deep-back up only the active source before accepted storage, flush reset, or interrupt reset can mutate prior records; trim working-memory appends and move an evicted slot's record ownership into the journal; reserve a full-map hook for explicit foreign-source accumulator-topology mutation | non-boundary Natural ingestion does not recopy the growing pending unit or source map; a one-source flush does not copy unrelated open-source or working-memory history; failed writes and public no-store queries restore durable and volatile state exactly; public state layout and retention semantics are unchanged | | emotional cascade metadata | maintain a private rebuildable cache of per-memory emotional rows, per-embedding shared-member minima, recency-ordered flashbulb sources, and the expandable topology footprint of the last fixed point; update it at the same successful storage, consolidation, cascade, association, and eviction decisions and rehydrate it after journal-aware rollback; caller-supplied roots invalidate the sidecar before forwarding their first transaction statement, while cache-only roots retain their exact snapshot; share breadth-first edge visits across source-order 64-bit batches while retaining a distinct visited bit and radius for every source | source eligibility and stable tie order, shared-embedding `MIN`/`MAX` semantics, shortest depth per source, first-source-wins ordering, custom raw-SQL updates within the current transaction, update decisions, and durable database state match the scalar path; an inserted edge outside every source's remaining-radius footprint advances the fixed point without a graph walk, topology rebuilds invalidate conservatively, batches continue for arbitrary source counts, and neither path keys behavior by source id or modality; ordinary engine-owned snapshot work still copies zero store-sized cache entries | @@ -119,17 +119,283 @@ an asymptotically flat store search. The later active-epoch cutover targets the remaining store-size-dependent retrieval-inhibition recovery directly. A complete 15,695-packet Natural replay -kept the active epoch within its harness ceilings: the observed high-water -marks were 512 events, 1,859 distinct mutations, and 180,224 allocated bytes, -with no over-limit event. The caller honored 127 consolidations. Across the +made before the active-epoch ceilings became knob-derived kept the active epoch +within its then-fixed midpoint harness ceilings: the observed high-water marks +were 512 events, 1,859 distinct mutations, and 180,224 allocated bytes, with no +over-limit event. That evidence is retained as midpoint-only historical proof +and is not accepted as proof of the current F/S/T-derived contract. The caller +honored 127 consolidations. Across the audit's first and last five eligible windows, `Competition.rif_recovery_active_sql` changed from 0.008629 to 0.009038 ms, a 1.047 ratio. The whole write path did not plateau: mean process time rose from 2.265 to 5.507 ms and throughput fell from 36.27 to 9.14 packets/s. This run -therefore verifies the lazy-RIF hotspot and the scoped epoch ceilings, while +therefore verifies the lazy-RIF hotspot and the historical midpoint epoch +ceilings, while leaving graph retrieval, memory storage, and emotional propagation as measured contributors. It is not a long-horizon or production-wide boundedness claim. +The subsequent implementation change derives the active-epoch event ceiling +from $C(F,S,T)$, the mutation ceiling from $64C$, the allocation ceiling from +$131{,}072C$ bytes, and every RIF persistent/shadow statement batch from the +same $B(F,S,T)$ used by sparse-route backfill. A compiled structural regression +covers all 27 points +in the $\{0,0.5,1\}^3$ grid and separately evaluates the nine midpoint, +all-low, all-high, and one-axis-low/high points used by the production-shaped +route ablation. It proves the formulas resolve to 256/16,384/32 MiB/64 rows, +512/32,768/64 MiB/128 rows, and 768/49,152/96 MiB/192 rows at the all-low, +midpoint, and all-high corners. A separate nine-point execution regression +publishes $B+1$ live active rows at every named point, observes a maximum +statement size of exactly the resolved $B$, retains all $B+1$ rows through a +second statement, and varies text, audio, image, shared, and opaque source +metadata without changing the schedule. The 129th midpoint live row is +therefore processed in a second statement; it must not be confused with the +historical backfill's logical 129th completion probe, which is not read or +processed. The benchmark now records resolved values instead of emitting fixed +midpoint labels. Configured low, midpoint, and high Natural and Durable +regressions each reached their own resolved event boundary, preserved +`Required` at the logical limit-plus-one observation, and reset after a +successful consolidation; the same runs varied opaque source and text, audio, +and image labels without changing the formula. One-event current-binary profile +probes independently emitted 256/16,384/32 MiB for all-low Natural and +768/49,152/96 MiB for all-high Durable, with the recorded event limit equal to +the independently recorded route capacity. Non-finite knobs are rejected before +any capacity is converted to an integer, and the profile auditor applies the +same fail-closed rule. Long-horizon nine-point latency and reset evidence is +now complete over the full 15,695-packet corpus at midpoint, both joint +endpoints, and each one-axis endpoint. Every run emitted its independently +expected F/S/T-derived event, mutation, and allocation limits; every run +reached exactly its event limit without exceeding any ceiling; and every run +observed a successful reset. None of the nine runs passed the whole-engine +plateau or consolidation-cycle contract, however. + +| F/S/T point | $C$ | Wall time (ms) | Mean process (ms) | Final/first process | Plateau | +|---|---:|---:|---:|---:|---| +| midpoint | 512 | 111,526 | 2.430 | 1.716 | fail | +| all-low | 256 | 119,572 | 4.020 | 1.963 | fail | +| all-high | 768 | 809,691 | 45.566 | 5.517 | fail | +| focus-low | 384 | 89,197 | 2.335 | 1.448 | fail | +| focus-high | 640 | 246,936 | 4.802 | 1.838 | fail | +| sensitivity-low | 448 | 74,894 | 1.565 | 1.554 | fail | +| sensitivity-high | 576 | 1,866,911 | 110.989 | 6.841 | fail | +| stability-low | 448 | 149,161 | 4.136 | 1.762 | fail | +| stability-high | 576 | 105,381 | 1.887 | 1.760 | fail | + +Sensitivity was the dominant adverse axis: the high-sensitivity wall time was +24.93 times the low-sensitivity wall time, and `PropagateEmotionalCascade` +accounted for 98.78 percent of its early-to-late process growth. The all-high +run attributed 95.10 percent of growth to the same operation. At midpoint and +lower sensitivity, graph retrieval and memory storage remained the dominant +contributors. The content-addressed aggregate is +`active-epoch-knob-long-horizon-ablation-v1.json`. These text-ingress runs prove +the knob formulas, hard epoch ceilings, and reset mechanics across the selected +grid, but reject latency boundedness within every envelope; modality and source +agnosticism remain separately covered by the fixed-embedding active-route +regression rather than inferred from this corpus. + +The next retained active-epoch candidate removed redundant values from the +connection-local database rather than changing the persistent recurrence. +Profiling a copied mature 1,000-event slice first attributed 0.351847 ms of a +0.385052 ms publication to loading complete persistent RIF rows. The retained +identity ledger loads and publishes only active `memory_id` values in the same +knob-derived $B$-row statements; the recovery clock, anchored suppression, +recovery total, log factors, expiry, and effective view remain authoritative +only in persistent SQLite. Strength-only refreshes do not publish when +membership cannot change. Natural and Durable still share the same write and +publication path, with Durable adding only its checkpoint. + +Against the same copied database and eight fixed consolidations, publication +fell from 0.384426 to 0.103604 ms, a 73.05 percent reduction that passes the +preregistered 20 percent local gate. Mean process time changed from 3.282725 to +3.243371 ms, total latency from 14.891846 to 15.254791 ms (+2.44 percent), and +wall time from 16,096 to 16,368 ms (+1.69 percent). All 1,000 public behavior +rows, the canonical logical database, and the raw SQLite database were exact; +the observed midpoint statement high-water was 128. A separate fresh +1,000-event screen recorded 0.009047 ms publication and 0.684362 ms process, +but used four live-hint consolidations and is therefore only a non-regression +screen, not fixed-index equivalence. Removing the membership preflight and +using `RETURNING` was rejected after publication regressed to 0.335491 ms. +These copied-slice source-health results did not decide the full 15,695-event +Natural plateau, Durable horizon and checkpoint proof, or bounded restart. +`TRACE[state:rif_active_identity_ledger]`. + +The subsequent default-knob Natural replay resolved $B=125$, processed all +15,695 packets with an observed statement high-water of exactly 125, and ran +31 consolidations in 82,994 ms. Mean process time was 1.944934 ms, mean total +latency was 5.107905 ms, and active-epoch publication averaged 0.019719 ms. +This closes the full-Natural batch-bound check but not the engine plateau: over +the final six eligible windows process and throughput ratios were 1.0072 and +0.9555, while transaction commit was 1.1129 and the exact graph-comparison +work counter was 1.1304. The identity ledger is therefore retained as a local +repair and the next hotspot is reranked; Durable and bounded-restart proof stay +open. + +The real 2,016-message Durable replay exercised that identical default-knob +path with four consolidations, the same derived $B=125$ and the same observed +125-row high-water. Mean process and total latency were 5.883704 and 11.471774 +ms, wall time was 23,845 ms, and the added checkpoint barrier averaged only +0.000158 ms. This supports the one-path-plus-flush architecture, but the corpus +contains only three post-warmup 500-event windows against the required ten; +it cannot establish a Durable plateau, and same-index copied-store equivalence +remains separate proof. + +That result nominates a bounded emotional-propagation experiment rather than a +larger retrieval envelope. The proposed `bounded-priority-prefix` reuses the +current-event retrieval capacity $C$, backfill batch $B$, and activation target +$A=2C+2B$. The candidate keeps a $5C$-capacity index of rows already satisfying +the flashbulb, intensity, arousal, and recency predicates, ordered by descending +creation time and memory identifier. It inspects that eligible prefix and uses +at most $5CB$ comparisons or moves to select $B$ sources in descending +intensity and ascending memory-identifier order. It may emit at most $B$ source +memories and embeddings, visit $5C$ physical association edges, retain $5C+B$ +frontier/visited and topology-footprint entries, consider $A$ activated +identities, and enqueue $A$ update statements. Source-index maintenance is +bounded independently by $(5C)^2=25C^2$ comparisons or moves per event. + +A statement count alone is not a fixed-work guarantee because an embedding can +be shared by arbitrarily many memory rows. The candidate therefore admits only +embedding identities with at most $B$ members and gives current-value member +reads, SQL-affected rows, and cache-row mutations separate $5C$ total budgets. +An identity whose complete member set does not fit every remaining budget is +skipped. Member-vector size detects the logical $B+1$ overflow boundary in +constant time; no plus-one row is fetched or mutated. At $F=S=T=0.5$, $C=512$, +$B=128$, and $A=1{,}280$: every $5C$ surface is 2,560, every $B$ source surface +is 128, every $A$ surface is 1,280, every $5C+B$ surface is 2,688, source-index +maintenance is 6,553,600, priority selection is 327,680, and the logical +overflow boundary is 129. All-low resolves these families to +1,280/64/640/1,344/1,638,400/81,920/65; all-high resolves them to +3,840/192/1,920/4,032/14,745,600/737,280/193. Thus 128 and 129 are consequences +of neutral F/S/T, not hidden constants. The proposal has no durable backlog or +second write path: SQLite remains authoritative and the in-memory +metadata/fanout view remains rebuildable and rollback-equivalent. Neither +modality nor source identifier is a predicate or budget input. + +This is a preregistered candidate, not a result or cutover. A deterministic +dense-graph regression must first fail on the current unbounded traversal. The +candidate must then prove all formulas over the 27-point structural knob grid, +including source-index, selection, emission, member-row, and cache work. Exact +parity is required when the unbounded event stays within every resolved source, +edge, frontier, identity, member, affected-row, and mutation limit. Above the +envelope, candidate and control run once on separate byte-identical pre-event +stores at identical consolidation indices. If $U_c$ and $U_b$ are the control +and bounded sets whose final minimum intensity or bonus increased, the candidate +requires $|U_b\setminus U_c|=0$ and recall +$|U_b\cap U_c|/|U_c|\geq0.95$; empty control and bounded sets pass, while an +empty control with a nonempty bounded set fails. For each metric, retained +delta is the ratio of the sum of positive bounded changes to the sum of positive +control changes over $U_c\cup U_b$, must be at least 0.99, and passes a zero +control denominator only when the bounded numerator is also zero. Non-finite +values and bounded per-identity deltas exceeding control by more than +$10^{-12}$ fail. Downstream gates allow at most one exact top-1 miss per +512-query run, require identity recall at 16 of at least 0.998 and semantic +coverage of at least 0.95, and reject clustered top-1 misses. + +Per-event cascade timing includes zero-work events. Early and late means use +the first and last 3,000 events; positive-over-zero and non-finite ratios fail. +The p99 is nearest-rank $\lceil0.99n\rceil$ over all events and must be at most +one quarter of the same-knob, same-retention control, with zero control passing +only zero candidate. Sensitivity-high and all-high must also hold late/early +mean to 1.10. The preregistered nine tuples are midpoint, both joint endpoints, +and the low/high endpoint of each one-axis change while the other knobs remain +0.5. Every tuple runs fresh matched candidate/control pairs for both the exact +15,695-packet Natural corpus and 2,016-message Durable corpus, with one selected +algorithm per event, control-derived fixed consolidation indices, and exact +source-tree, build, binary, corpus, database, profile, audit, raw, and sanitized +digests. During that experiment the private selector accepted only `control` or +`bounded`, defaulted to `control`, and rejected any other value before mutation. +The candidate could have cut over only by removing that selector and the +unbounded implementation, leaving one Natural/Durable path with Durable adding +only its checkpoint. The midpoint rejection instead removed the candidate; +the measured envelope and disposition are retained here. + +The rejected implementation packet exercised that preregistered shape behind +a private selector without claiming cutover. The red dense-graph regression +visited 2,561 edges against the neutral $5C=2{,}560$ ceiling on the prior path. +The experimental implementation kept the eligible recency prefix at $5C$, performed +deterministic bounded top-$B$ selection, traverses sources sequentially with +first-source-wins identity ownership, skips shared embeddings at the logical +$B+1$ boundary, and updates accepted member rows with one row-addressed +`UPDATE ... RETURNING` statement. `RETURNING` is required for exact accounting +through caller-supplied transaction wrappers: a later compatibility statement +would otherwise overwrite SQLite's connection-local `changes()` value. The +same statement was enclosed by a narrow managed-mutation scope so the +caller-SQL compatibility layer could distinguish the cascade's cache-maintained +write from arbitrary caller SQL. Arbitrary same-event caller SQL invalidated +every database-derived surface and the bounded cascade failed closed; the next +event rebuilt from committed SQLite before traversal. + +One hooks-on Release binary then passed 807 assertions in 13 fixed-work tests +and 907 assertions in 32 complete emotional-cascade tests. The fixed-work set +includes every one of the 27 structural F/S/T points, exact $B$ mutation, +logical $B+1$ overflow, source prefix and priority work, dense edge saturation, +below-envelope candidate/control parity, invalid and mid-event selector +behavior, caller-SQL invalidation and rebuild, engine-owned rollback, process +restart, and an explicit consolidation event. A separate `FullRoot` regression +passed 5,552 assertions while varying two then four opaque source identifiers, +text/audio/image labels, and both Natural and Durable retention; every cascade +counter remained within the same F/S/T-derived ceiling, and Durable alone +reported the existing post-commit checkpoint. Those focused results established +the structural and lifecycle seams only. The full-corpus midpoint below then +failed the preregistered timing and identity-quality gates, so the selector, +managed-mutation seam, and candidate-specific counters were removed. The +structural results remain historical experiment evidence, not production +source health. +`TRACE[state:emotional_cascade_fixed_work_candidate]` +`TRACE[rejected:EmotionalCascade.knob-derived-bounded-priority-prefix]` + +The fixed-time midpoint screen rejected this candidate before the nine-point +matrix. A same-binary Natural control/candidate pair used timestamps +$1{,}700{,}000{,}000{,}000+1000i$ and the control's 118 successful +consolidation indices for both fresh stores. Every candidate hard-work counter +remained within its neutral-knob limit: source candidates and executions +reached 37, physical edges reached $5C=2{,}560$, frontier and topology entries +reached 1,888 and 476, activated identities reached $A=1{,}280$, and member +reads, SQL-affected rows, and cache mutations each reached 133. Nevertheless, +candidate p99 was 0.397625 ms versus 0.693875 ms for control, a 0.573 ratio +against the preregistered 0.25 maximum. Its late/early mean ratio was 2.324. +The control and candidate profiles are content-addressed by +`8ef80929db664afd8ac87c256033d7ae3c9ac88036edaddf5f270940c79e52ba` +and +`dd0cdd0801b7656dd8835528977b8d3e925b15d2b8dca398c14bb7d819eacd55`; +the fixed schedule digest is +`901fac42a38125e525d6ca44b63312248b36b30b35d8eb3156ff5d4dc7fbcd8f`. + +Three implementation-only iterations retained every formula and semantic +boundary. First, traversal scratch was reserved from $5C+B$ and reused across +sources, while a fixed indexed `embedding_id` update replaced variable-length +SQL construction and required the exact returned memory identifiers to match +the cache before mutation. This produced p99 0.395666 ms. Second, the candidate +persisted the already-budgeted $5C+B$ expandable topology footprint and reused +a fixed point only when a new edge was provably outside that footprint; active +traversals fell from 6,710 to 1,369 and mean cascade time fell from 0.0644 to +0.0260 ms, but p99 rose to 0.475541 ms because the nearest-rank percentile now +landed inside the remaining full traversals. Third, a generation-stamped +visited map allocated each event's unique memory identities once instead of +reallocating hash nodes per source. Mean cascade time fell again to 0.023903 ms +and p99 to 0.432000 ms, while traversal alone remained 0.223292 ms at p99. +These tuning profiles have digests +`d06e1042784afbe760ff2e2917541bf07628adc7d9055561372fa513aa6274b8`, +`ca4039abeaf873acb500b9279dfb1dacd4fb99f57c24c25751c5d7f1edd36bef`, +and +`5ee53d12f0fc98c8e746553500be2f12802a62a5d38de681d84672580d55d916`. +They are tuning diagnostics rather than admissible performance pairs because +their comparison control predates the corresponding binary changes. + +The final tuning profile independently failed the downstream public-retrieval +gate, so an additional exact-binary timing pair could not rescue the candidate. +Over 512 deterministic controls and four opaque source identifiers, exact +top-1 was 0.998047, identity recall at 16 was 0.980760, semantic coverage was +0.975084, and tie order remained deterministic. The content-addressed audit +digest is +`da402733380f8cf7f2eda5289a4f95f1a35b55fcd27ede4695499d8acd6b4973`. +Exact top-1 1.0 and recall 0.998 were mandatory, so +`bounded-priority-prefix` is terminally rejected without running the remaining +knob/corpus matrix or claiming direct bounded/control delta fidelity. The +structural formulas remain useful design evidence: neutral 128 and logical 129 +were always derived from $B(F,S,T)$, no plus-one row was read or mutated, and +the latest focused tests passed 824 assertions in 15 fixed-work cases, 924 in +34 emotional-cascade cases, and 5,552 in the mixed source/modality FullRoot +case. Those source-health results do not override the measured rejection. + The observation-only bounded activation graph was then implemented behind a default-off private flag and evaluated directly in compiled C++ over 35,496 256-dimensional embeddings with 512 age-stratified queries. At F=S=T=0.5 it @@ -192,19 +458,30 @@ error must be at most 0.20; and the final-five versus prior-five template error must be at most 0.10. Natural cutover cannot use flat-envelope mode to bypass these cycle gates; the already-flat Durable control remains eligible for its separate flat-envelope contract. The separate 512-query, top-16 corpus gate -preserves exact -identifier recall and exact top-1 at 1.0 and requires the complete ordered -top-16 identity list to match, including seven fixed identity-and-rank probes. -The summary is recomputed from all 512 per-query records rather than trusted as -a label. The candidate must match a separate control artifact whose exact -content digest was approved before the audit; deterministic query indices, -embedding identities, ranked controls, and the seven fixed probe positions are -bound across those artifacts. The approved control must identify the current +requires mean exact-identifier recall of at least 0.998, at most one exact +top-1 miss, and mean exact-neighbor semantic coverage of at least 0.95. Across +the prescribed nine-run matrix, aggregate top-1 must remain at least 0.999 and +two misses may not share a modality, opaque source, memory-age quartile, or +exact knob point. The candidate's +complete ordered top-16 lists must repeat byte-for-byte under the same seeds, +while all seven fixed identity-and-rank probes must still match the exact +control. This permits only the explicitly approved bounded approximation; it +does not permit clustered top-1 drift, nondeterministic ties, or semantic substitution below +the exact-recall floor. The summary is recomputed from all 512 per-query +records rather than trusted as a label. The candidate must bind to a separate +control artifact whose exact content digest was approved before the audit; +deterministic query indices, embedding identities, exact ranked controls, +provenance, and the seven fixed probe positions are bound across those +artifacts. Candidate ranks are separately content-addressed across two +complete runs rather than being required to equal the exact control outside +the approved lower-rank allowance. The approved control must identify the current public retrieval path, and the candidate must also preserve the independently recorded digest of the pre-existing seven public identity-and-rank probes; the pre- and post-restart probe digests at every retained-history fraction must -equal the candidate/control fixed-probe digest, so a restart cannot preserve a -consistent but incorrect ranking; the +equal each other, and the full-history fraction must additionally equal the +candidate/control fixed-probe digest. Each smaller fraction uses probes drawn +only from its retained prefix, so the gate tests restart equality without +referring to absent history; the benchmark's exhaustive embedding-neighbor mode can propose a control artifact but cannot label itself approved. Hashed source provenance, modality, and history position come from the queried embedding's authoritative SQLite signal rows; @@ -219,6 +496,1241 @@ probe with at least top-16 candidate state. The current synthetic full-history fallback measurement is explicitly ineligible. These are candidate-selection thresholds, not evidence that the current observation-only graph passes them. +The preliminary embedding-router feasibility selected a two-graph packed-route +hybrid evaluated over 34,456 normalized, +256-dimensional embeddings. Each sealed embedding retained 512 route entries; +each new active-epoch embedding proposed at most 64 reciprocal updates; each +graph used a 16,384-comparison construction ceiling and a 1,280-comparison query +ceiling. Across 512 deterministic top-16 queries, exact top-1 was 1.0, mean +exact-identifier recall was 0.998413, and mean exact-neighbor semantic coverage +was 0.999961. Thirteen of 8,192 exact-neighbor slots were absent, spread across +ten queries, while all seven fixed identity-and-rank probes remained exact. The +complete candidate rank stream repeated with the same content digest in two +runs. Mixed-input evidence included four opaque sources and text, audio, and +image labels after encoding; the router consumed only embedding values and +embedding identity. + +The selected benchmark snapshot restarted from 1,024 anchor rows and four +packed SQLite blobs. At 25%, 50%, and 100% retained history, all fixed +prefix-local probe results were identical before and after restart; the maximum +restart visit count was 1,029 rows while the full snapshot retained 34,456 +embeddings. Active-epoch SQLite allocation peaked at 708,608 bytes and +reciprocal mutations peaked at 11,967, below the historical midpoint 32,768 +ceiling. Ten modeled +material cycles had zero normalized cycle-template error and zero late-template +error, with post-consolidation retrieval work 0.888889 of the preceding level. +This establishes a bounded and repeatable embedding-router direction, not the +production-shaped quality gate, live cycle, or latency proof: the cycle result +is derived from the fixed-work benchmark model and must still be reproduced at +public consolidation boundaries in the shared engine path. + +Several variants were rejected before selecting that point. A reciprocal-route +only design reached 0.979858 mean exact recall; adding a third graph did not +improve recall at equal per-graph work; reducing construction to 4,096 +comparisons per graph reached 0.995972; and an 8,192-comparison construction +with 64 reciprocal proposals reached 0.997803. All retained exact top-1, but all +fell below the approved 0.998 lower-rank recall floor. The chosen point therefore +spends additional bounded construction work to remove all but 13 lower-rank +misses on that feasibility population, rather than weakening the top-result or +semantic gates. + +An even simpler anchor-only route was also rejected on the corrected 3,172 +current-memory surface. With four selected routes per query, 512 anchors reached +mean exact recall 0.98425 and exact top-1 0.97656; 1,024 anchors reached 0.99194 +and 0.98633 respectively. Adding exact reciprocal node-route hops reached only +approximately 0.982 recall. These were private one-off randomized held-out +feasibility probes and their raw output was not retained, so they are recorded +as negative design evidence rather than reproducible acceptance proof. The +result rules out using anchors as the retrieval candidate set by themselves; +anchors remain useful only as bounded route entry points into the independently +constructed sparse graphs. `TRACE[state:anchor_only_route_feasibility]`. + +A control audit then found that the 34,456 identities came from the complete +`embeddings` table. The public seed path ranks eligible long-term/current memory +surfaces, not signal-only embedding ids, and additionally applies timestamp, +supersession, current-surface, and family filters. Labeling the exhaustive +embedding-neighbor artifact `current-public-retrieval` was therefore invalid. +The corresponding production-shaped pass is revoked; the result remains only +router-feasibility evidence. + +The corrected current long-term surface contains 3,172 memory identities, a +10.86-fold smaller and semantically different population. Over the same 512 +deterministic top-16 queries, the two-graph route reached exact top-1 1.0, +exact recall-at-16 1.0, and semantic coverage 1.0 with no missing query. Maximum +construction work was 6,344 comparisons. Ten 128-memory-node incremental +feasibility epochs used at most 184,320 active SQLite bytes; mean graph insert, +route construction, and reciprocal-update times were 0.073002, 0.044416, and +0.013539 seconds per epoch. At 25%, 50%, and 100% retained surfaces, restart +visited 798, 1,029, and 1,029 rows and preserved all prefix-local probes. These +results retain the sparse-route design but do not close the public control: +the next quality artifact must compare against the runtime's exact eligibility, +supersession, current-surface, and family behavior. The active sawtooth remains +signal-event based, so the 128-memory-node epochs also cannot substitute for ten +live 512-signal consolidation cycles. This correction is +`TRACE[state:retrieval_quality_control_correction]`. + +To close that gap without another approximate population model, the benchmark +now captures the actual public retrieval ranks during Natural ingestion. +Queries are sampled evenly from retrieval-active events, not from every event: +the latter includes legitimate no-retrieval decisions and would make a routing +quality denominator vacuous. A 100-event smoke contained 27 retrieval-active +events; an eight-query sample covered events 6 through 96 and retained nonempty +direct, graph-expanded, and hydrated rank lists for every query. In a separate +paired 200-event run, enabling the capture preserved behavior SHA-256 +`40833b57d441b8d7e704787768e8157bacdd8a2525616af8893bbf2d164a87bb` +and logical-database SHA-256 +`e83dabd67109258d9609d82c26ed01c227045c6ae1f7786ef4b15bb296824ff8` +exactly. The complete 15,695-packet run then sampled 512 controls from 5,390 +retrieval-active events, spanning events 6 through 15,691. Direct controls +contained 1--16 identities and the hydrated public result contained 1--12; +the fail-closed audit accepted the control population. The corpus itself is one +opaque source and text-only, so it cannot satisfy the independent four-source +text/audio/image implementation gate. `TRACE[state:public_retrieval_control_capture_experiment]` +is exact public-control evidence, not candidate acceptance. + +Three standalone HNSW variants then attempted to reconstruct point-in-time +candidate routes from the final database. All used two graphs with $M=64$, +construction effort 200, query effort 1,280, and a route cap of 512. Indexing +every retained surface version produced apparent identity coverage 0.983770, +top-1 coverage 0.914063, and 73.8887 current candidates on average. Replacing +each memory with one current node raised occupancy to 406.641 but produced +0.983155 and 0.912109. Keeping the original surface plus one replaceable current +reconstruction produced 231.445 candidates and 0.983893/0.914063. An exhaustive +dual-surface top-512 oracle produced exactly the third variant's apparent +misses, while every one of the 8,133 ranked control slots was present in +retained history at its sampled query (memory identities repeat across +queries). The mismatch is therefore not HNSW approximation or eviction. + +The quality labels are invalidated because the final database is not an exact +time-travel log of the retrieval surface: reconsolidation updates +`memories.embedding_id`, and the retained reconstruction/current tables do not +encode every intermediate live processor surface at every earlier query. Even +substituting `original_centroid` cannot reconstruct that mutation order. These +runs remain useful negative evidence about the post-run evaluation method, not +evidence for accepting or rejecting the sparse algorithm. The next valid +experiment must capture surface upserts/removals live and replay that stream +against the unchanged public controls. Four-source text/audio/image evidence, +live cycles, and production cutover remain pending. +`TRACE[state:public_hnsw_route_prototype_experiment]`. + +The live mutation capture first passed a 100-event source-health run: 48 ordered +upserts were recorded, every vector had 256 dimensions, 27 events activated +retrieval, and eight sampled public controls remained valid. A paired 200-event +run then produced identical behavior SHA-256 +`25ed7beeb14a7fc1e4201c632c324c1d45a4d6d1f31e2d9e10799738cdb42c5e` +and identical logical-database SHA-256 +`1625c3b6a85b585c4e55a8cc83c2871c2b7a6ab8730f788a21b2d9f41f268113` +with capture off and on. This proves observer neutrality only; the full live +mutation population was therefore still required. Using the +live stream as a conservative current-vector route, without attempting to +replay final-table supersession state backward in time, the two-graph candidate +covered every public seed identity and every top-1 identity in both the +eight-query/100-event and sixteen-query/200-event smokes. Candidate occupancy +grew from a mean 9.75 (maximum 20) to 21.9375 (maximum 41). Exact timestamp, +supersession, family, and final-rank decisions remain downstream engine work; +the preliminary exact coverage does not yet establish full-run quality, +bounded cycles, restart, or latency. +`TRACE[state:live_surface_mutation_capture_experiment]`. + +The complete live run recorded 9,175 ordered 256-dimensional upserts across +15,695 packets; this corpus produced no surface removal. It retained the same +5,390 retrieval-active events and 512 sampled queries as the prior control. +Capture and control had identical full-run behavior digest +`ed1146a0ed9b2a85eb2ff7c4b511f39357e6db9c363827d941d96163dc7a1463` +and logical-database digest +`522f0dfa9e33e2053903ae938a7bb934319ff836ba608250bd8cd42677b950ca`. +The live two-graph route covered all 8,133 ranked public seed slots and all 512 +top-1 identities: exact identity coverage 1.0 and top-1 coverage 1.0. It +returned 470.977 candidates on average and at most 512, with a 10.5183-second +offline evaluation time. A complete repeat produced the same per-query +candidate-order digest +`2b3e30b0f413692cd8c5a77a15c464ebcc953685901be3904c1b19c96eaf22af` +and the same normalized result digest +`f8dafb51cdac5fafda8f93e1b2b07e9a5135a4f43066625cec92f7a19acebcb0`. +Exact downstream filters remain authoritative, so this is a candidate-set +quality pass, not a final-rank rewrite or a production cutover. The corpus is +still one opaque source and text-only; four-source text/audio/image evidence, +restart bounds, ten live cycles, and integrated latency remain open. + +The next experiment moved that exact candidate route into the real retrieval +operation and used a deterministic 2,500-packet Natural prefix with four opaque +source identities cycling across text, audio, and image labels after the common +encoder. It sampled 128 actual public controls at $k=16$. The exact control +visited 1,078 current rows at the final event and spent 1.83742 ms in cached +seed discovery. The retained route visited exactly 512 rows and spent 1.54363 +ms, while all 128 ranked identity lists, the complete behavior digest +`d5bf0c833a2b1677b2df21882145587b21ab03a44cd6b88935f0199d266c7dc2`, +and the logical-database digest +`05e7bf911fe848e1a7d7a8db77be7b7edcf289aab0055e965e901c80366dc06e` +remained exact. Total wall time moved from 48,176 to 49,828 ms (1.03429x), and +mean process time moved from 2.79103 to 2.85218 ms (1.02191x). This is focused +integrated evidence, not full-horizon flatness, restart, or production cutover. + +Two direct integrations were rejected before that result. Updating both HNSW +graphs on every surface mutation retained the 512-row route and exact sampled +ranks but raised wall time to 90,022 ms and mean process time to 19.7725 ms. +A sealed graph plus exact delta that rebuilt after every one of the run's 356 +consolidations raised wall time to 93,969 ms. The retained algorithm keeps the +sealed graphs across consolidation, journals changed row addresses in the exact +delta, and reseals only when 512 distinct changes accumulate. This is the +measured reason consolidation is an epoch boundary rather than a command to +rewrite the entire index every time it is requested. +`TRACE[state:integrated_hnsw_sparse_route_experiment]`. + +The same-event exact-control seam subsequently corrected the integrated +quality measurement. A complete 15,695-packet, four-source replay cycling +text, audio, and image labels sampled 512 retrieval-active events while running +the route and exact current-surface scan on the same query. Exact top-1 was +1.0, exact identity recall at 16 was 0.999877451, and conservative semantic +coverage was 0.999809451; deterministic tie order and all control-population +checks passed. The exact scan is proof instrumentation only and its 1,160,884 +ms wall time is not a performance result. This satisfies the owner-authorized +quality tradeoff at this scope, but it does not establish bounded restart, +cycle symmetry, or default-on readiness. + +A follow-up candidate changed consolidation from threshold-triggered full +resealing to deterministic incremental sealing of every successful epoch's +distinct additions, updates, and tombstones into the retained graphs. Focused +delete, seal, reinsert, delta-reset, and same-route tests passed. Two +2,500-packet runs completed all 356 public consolidations in 59,526 and 60,427 +ms wall time, compared with 48,176 ms for exact routing and 49,828 ms for the +prior sealed-snapshot candidate. In the first run, mean ordinary process time +was 2.77838 ms versus 2.79103 ms for control, mean reported total latency was +10.2603 versus 9.65932 ms (1.06221x), and measured consolidation time was +14,341.6 versus 13,907.5 ms (1.03121x). Because the first two wall regressions +of 1.23559x--1.25430x exceeded those fields, a third run persisted the +consolidation-context route timings instead of assigning the difference to +HNSW by inference. It completed in 54,165 ms (1.12432x control), with mean +ordinary process time 2.66766 ms (0.95580x), mean reported total latency +9.88112 ms (1.02296x), and consolidation time 14,058.0 ms (1.01083x). +Across 204 route-active consolidations, incremental sealing consumed 381.006 +ms total (1.86768 ms per active seal) for 1,163 distinct delta identities. +Reloading the authoritative retrieval surface consumed 9,220.74 ms across all +356 consolidations, showing that the existing full-surface reload—not the +incremental HNSW mutation—is the dominant named route-epoch cost. The +incremental seal is therefore retained as a default-off candidate within the +current latency tradeoff, while row-addressed SQLite route startup and removal +of the full-surface reload remain required before cutover. +`TRACE[state:integrated_hnsw_consolidation_seal_experiment]`. + +### Historical pre-cutover knob-derived SQLite HNSW ablation + +The first row-addressed route was moved from a fixed midpoint to the +complete F/S/T-derived surface defined in the implementation section. A +structural $3\times3\times3$ test grid covered all 27 low, midpoint, and high +combinations with 603 assertions over capacity, backfill, expansion breadth, +bootstrap, visited nodes, cache size, maximum level, topology, reciprocal +updates, and construction/query effort. +The neutral setting intentionally remains the measured 512-candidate, +128-row-backfill configuration; low and high settings now change the topology +and every work ceiling with it. + +These nine runs describe the earlier $4C$ visited-node, $2C$ search-effort, +$8C$ cache candidate and its exact-fallback-on-any-dirty-row policy. They remain +retained as evaluated history, but they are stale for the current source after +the quality-selected $8C/4C/16C$ route and bounded $B$-row dirty delta were +integrated. They cannot satisfy the final cutover matrix; the current-source +nine-point 2,000-event rerun is reported immediately below, and the later +15,695-packet nine-point latency/reset ablation is reported above. + +Nine production-shaped 2,000-event Natural replays then used the authorized +private Claude-session sentence corpus. Each run generated its own 512-query +same-event exact `GraphRetrieve` control at $k=16$, used four opaque source +identities, and cycled text, audio, and image labels after the shared encoder. +All 4,608 system-path queries passed: exact top-1 and mean identity recall at +16 were 1.0 in every run, deterministic tie order held, and the minimum +conservative semantic coverage was 0.999532. Four configurations actually +queried the SQLite sparse route and passed those gates. Sensitivity-low remained +below its activation threshold. Focus-low had a published hierarchy but a +nonempty durable journal at every sampled route opportunity, while +sensitivity-high, stability-high, and all-high remained unpublished; all five +therefore exercised exact fallback. Those runs establish system fallback +quality, not sparse-route quality. Every raw profile records the resolved knob +configuration rather than relying on the evaluator to reconstruct it. + +| Configuration $(F,S,T)$ | $C$ / $B$ / max level | neighbors / L0 / reciprocal | construction / query | max visited / restart | process / total ms | route state | +|---|---:|---:|---:|---:|---:|---| +| all-low (0,0,0) | 256 / 64 / 8 | 32 / 64 / 4 | 100 / 640 | 776 / 1 | 25.532 / 33.749 | active; 5 SQLite-route events; observed level 5 | +| Focus-low (0,.5,.5) | 384 / 96 / 9 | 48 / 96 / 6 | 150 / 960 | 0 / 0 | 19.010 / 25.449 | dirty journal; exact fallback; hierarchy reached level 5 | +| Sensitivity-low (.5,0,.5) | 448 / 112 / 9 | 56 / 112 / 7 | 175 / 1,120 | 0 / 0 | 0.544 / 0.952 | surface stayed below $C$ | +| Stability-low (.5,.5,0) | 448 / 112 / 9 | 56 / 112 / 7 | 175 / 1,120 | 906 / 1 | 19.443 / 23.669 | active; 31 SQLite-route events; observed level 5 | +| neutral (.5,.5,.5) | 512 / 128 / 9 | 64 / 128 / 8 | 200 / 1,280 | 974 / 1 | 14.314 / 18.392 | active; 30 SQLite-route events; observed level 5 | +| Sensitivity-high (.5,1,.5) | 576 / 144 / 10 | 72 / 144 / 9 | 225 / 1,440 | 0 / 0 | 59.718 / 62.364 | build unpublished; exact fallback; observed level 4 | +| Stability-high (.5,.5,1) | 576 / 144 / 10 | 72 / 144 / 9 | 225 / 1,440 | 0 / 0 | 13.855 / 18.073 | build unpublished; exact fallback; observed level 4 | +| Focus-high (1,.5,.5) | 640 / 160 / 10 | 80 / 160 / 10 | 250 / 1,600 | 968 / 1 | 12.800 / 14.656 | active; 17 SQLite-route events; observed level 4 | +| all-high (1,1,1) | 768 / 192 / 10 | 96 / 192 / 12 | 300 / 1,920 | 0 / 0 | 51.722 / 52.864 | build unpublished; exact fallback; observed level 4 | + +The maximum observed backfill batches at the all-low, neutral, and all-high +points were exactly 64, 128, and 192 rows. Active routes never exceeded their +$4C$ visited-node limit and opened the route from one metadata row. Zero visited rows +do not claim zero retrieval work: those configurations either remained below +their activation threshold or had not accumulated enough consolidation +boundaries to publish the bounded build, so the exact scan was both production +candidate and control. + +Four defects were rejected during this ablation rather than folded into the +reported pass. The first all-low run visited 1,042 rows against its 1,024-row +ceiling because hot-cache hits bypassed the database-miss budget; the fetcher +now applies one ceiling to cached and uncached nodes, and a warmed-cache +regression reproduces the low-knob case. Earlier generation-reset variants also +discarded resumable progress, and a later build marker could resume nodes but +lost committed live mutations. The retained design instead keeps an +authoritative dirty-identity journal across both active and unpublished +generations. The unpublished build was also copying every live write +into an unbounded in-memory delta even though exact fallback remained +authoritative. At sensitivity-high this exceeded the construction search +ceiling on the second batch. The retained path keeps those live identities in +SQLite, drains at most $B$ dirty identities plus $B$ backfill rows per +construction edge, and clears only the identities actually sealed. A focused +400-dirty-identity regression covers both active and unpublished drainage. +Finally, the first persisted implementation assigned every node to level zero; +the retained route deterministically assigns hierarchy levels capped by +$\lceil\log_2 C\rceil$, bounds upper-level links by the knob-derived neighbor +limit, and requires observed upper-level rows before a corpus slice may be +called route-lifecycle exercised. The retained databases additionally decode +to nonempty upper-level adjacency on every exercised route (236, 160, 125, and 90 +upper-level nodes respectively), rather than merely containing positive level +labels. The nine reruns now record zero backfill and search failures. They were +rerun with benchmark executable SHA-256 +`a398ac2d0ce5188bb1708f811a30689d59412efcffc2c4c08587bb33c6f7c780`; +the four direct regression reports bind test executable SHA-256 +`4ee4dd4c5d28583ffea8dc2ab6f43bc40572f2496d589923736b9fb242ad4513`. +All nine SQLite databases are retained in the private artifact root and +content-addressed beside their profiles and audits. The aggregate artifact is +content-bound by SHA-256 +`8ef2012604c5efe6f547837bc8e8c0e625a691de52c051187858e43b344fe1a3`. + +This matrix proves knob derivation, local work ceilings, bounded live-dirty +drainage, source/modality agnosticism, runtime hierarchy construction, route +lifecycle exercise on four configurations, exact whole-system quality on all +nine, and one-row sparse-route metadata open at 2,000 events. It does not +separately materialize route-active query quality and does not prove bounded +whole-engine restart; processor startup still loads the complete current +surface. It also does not prove the full +15,695-event plateau, repeated sawtooth +symmetry, or production-wide boundedness. Whole-engine timing is also not an +HNSW-only ablation: changing F, S, or T changes retrieval admission, +consolidation frequency, and surface evolution. `TRACE[state:sqlite_hnsw_knob_ablation]`. + +### Consolidation-centroid and activation-effort follow-up + +The first bounded-supersession full replay retained the static $6C$ query +effort. It completed 15,695 events and kept write-time supersession candidates +bounded, but 2,833 consolidations did not flatten retrieval: mean SQLite sparse +route visits rose with the persisted graph. This rejected the claim that +candidate capacity alone made consolidation restorative. + +A connection-local centroid recenter was then added. The first 5,000-event +probe still consolidated 801 times because the detector cooldown incorrectly +used a backlog counter that can remain high when a consolidation has no +association mutations. Replacing that condition with a post-acknowledgement +observation count derived from $B$ reduced the same 5,000-event cadence to 35 +consolidations, normally 128 observations apart at neutral knobs. That probe +still did not lower route work: $6C$ exceeded the reachable graph in those +epochs, so changing only the entry centroid could not change traversal breadth. +Both variants were therefore retained as rejected diagnostic steps rather than +reported as a performance fix. + +The selected follow-up couples the centroid to the $2C\rightarrow6C$ activation +effort cycle described in the implementation section. A 1,000-event +copied-late control at $F=S=T=0.5$ exercised seven successful resets to +$2C=1{,}024$. Its 512 independently captured public controls across four +opaque source identifiers and text, audio, and image inputs retained exact +top-1 1.0, recall at 16 of 1.0, semantic coverage 1.0, and deterministic tie +order. A separate 2,000-event copied-late performance replay produced 15 +complete large-store cycles. The phase-edge sample is itself knob-derived as +$max(2,\lfloor B/32\rfloor)$, or four retrieval-active queries at neutral +knobs. Eleven cycles had at least a 1.10 pre-consolidation visited-row ramp and +all 11 reset by at least 10%; the median immediate reset ratio was 0.859. The +first and second halves of material-cycle peak work differed by 1.041, while +trough work differed by 0.992, both inside the 1.10 late-drift limit. A fresh +5,000-event replay produced the intended 35-consolidation cadence but remained +below the $2C$ traversal envelope; it is warm-up evidence, not a late-store +sawtooth claim. + +The subsequent 15,695-event full replay rejected queue effort as the only +work-control mechanism. It completed 117 consolidations in 927,365 ms. The +recorded $2C\rightarrow6C$ waveform itself was repeatable (p95 normalized +shape error 0.0118 and late-template error 0.00496), but actual node visits +continued to rise: only 13 of 23 material cycles reset, and late/early peak and +trough ratios were 1.167 and 1.159. End-anchored process windows rose from +about 2.21 to 3.24 ms, throughput fell from 29.07 to 10.38 events/s, and the +final 500-event tail reached 9.44 events/s. Normalized consolidation cost rose +2.50-fold per sealed event and 2.16-fold per sealed mutation. HNSW queue effort +limits the candidate queue, not the number of row-addressed graph nodes fetched, +so a symmetric control waveform did not make actual work restorative. + +The first actual-node candidate used the knob-derived +$\lceil11C/2\rceil\rightarrow12C$ cycle, or 2,816 to 6,144 nodes in increments +of 26 at neutral knobs. Its copied-late quality probe passed exact top-1 at 1.0, +recall at 16 at 0.999878, semantic coverage at 0.999947, and deterministic +order. The full 15,695-event replay cut wall time from 927,365 to 190,736 ms +and mean public latency from 57.542 to 11.068 ms, with no absolute or dynamic +node-budget violations. It nevertheless failed the restorative-cycle gate: +only 10 of 16 material cycles reset, late/early peaks were 1.107, and troughs +were 1.097. This floor was therefore rejected as too shallow for the required +symmetric sawtooth despite its large runtime gain. + +The selected lower-floor candidate uses $5C\rightarrow12C$ with step +$\lceil(12C-5C)/B\rceil$. At neutral knobs this is 2,560 to 6,144 nodes in +increments of 28. A corrected 1,000-event copied-mature quality probe enabled +the exact HNSW control capture explicitly and exercised eight simultaneous +queue/node resets to 1,024/2,560. Across 512 controls it kept exact top-1 at +1.0, recall at 16 at 0.999146, semantic coverage at 0.998680, and deterministic +order over four opaque sources and text, audio, and image. Actual visits ranged +from 2,560 to 3,740, recorded ceilings ranged from 2,560 to 6,144, and no query +exceeded its current ceiling. An earlier run without the exact-control capture +flag was classified candidate-pending rather than accepted. + +Four follow-up variations were rejected rather than silently folded into the +selected result. Lowering the reset floor by one backfill batch to +$5C-B=4.75C$ reduced exact top-1 to 0.998047. Holding the $5C$ floor while +reducing its derived ramp increment from 28 to 27 also lost exact top-1 on the +copied mature store. Raising the queue floor independently to $3C$, $4C$, or +$5C$, and holding it at $6C$, reproduced that same miss. Queue effort and the +last quarter-batch of node budget were therefore not the root cause. Inspection +found a live target with no incoming persisted links, and also found that the +route's fetched-node cache was larger than the HNSW best queue but only the +best queue was exactly reranked. A connected traversal could never activate +that target regardless of queue tuning. + +The retained repair keeps the HNSW traversal in the existing SQLite route, then +fills the unused portion of the current knob-derived actual-node envelope from +a deterministic indexed active-row slice that starts at the current entry and +wraps once. It exactly reranks every fetched row, not only the HNSW best queue, +before returning the existing $C$-identity candidate set. The completion is +bounded by the same $5C\rightarrow12C$ ceiling and does not branch on source or +modality. In a 512-query copied-mature probe this exact bounded activation kept +top-1 and recall at 16 at 1.0, semantic coverage at 0.999736, deterministic +ties, and zero work-bound violations. + +A final source review found that seal-time node invalidation erased cache-map +rows without erasing their FIFO order entries. Repeated seal/search cycles +could therefore grow bookkeeping even while the node map stayed at $24C$. +The retained correction clears the map and order together after a successful +seal. The focused SQLite-route suite directly checks both structures against +the knob-derived $24C$ capacity; this is bounded-cache source proof, not a new +full-corpus latency claim. + +That expanding-envelope replay completed 117 consolidations in 175,166 ms, +with mean process latency 3.493 ms and mean public latency 9.942 ms. All 15 +material retrieval cycles reset, late/early peak and trough ratios were 1.074 +and 1.002, the late template error was 0.00450, and the maximum observed node +work was 3,357 under the 6,144 hard ceiling. The retrieval-specific restorative +sawtooth passed under that binary. The whole-engine plateau did not: final-suffix +process latency was 1.165 times its leading suffix and throughput retained only +0.877 of its leading rate. Consolidation process peak and trough ratios were +1.201 and 1.273. After live dirty reconciliation was corrected from a $B$ drain +to a $C$ drain, however, the expanding public envelope also became an +expensive construction envelope. The current-binary replay took 394,645 ms, +including 65,562 ms in 118 consolidations and 58,825 ms in SQLite route +sealing. Public retrieval activated as many as $12C=6,144$ rows, and each dirty +root could repeat that work while selecting graph neighbors. Exact top-1 +remained 1.0, mean identity recall at 16 was 0.998407, and semantic coverage +was 0.997572. The expanding envelope is retained as a rejected experiment, +not as the current algorithm or an engine-wide boundedness claim. + +### Fixed activation and separate construction envelopes + +The first fixed-envelope candidate separated retrieval work from graph maintenance. Public +retrieval always uses a $5C$ actual-node envelope and $2C$ queue. Consolidation +recenters the connection-local entry but does not increase or reset work size; +the zero ramp is an invariant selecting the fixed F/S/T-derived envelope. +Incremental sealing uses the independently derived $C+B$ node and $2B$ queue +construction envelope. Historical backfill remains $B$ rows; $B+1$ names the +logical boundary tested by checking the post-$B$ in-memory iterator, not an +extra row read. Live dirty reconciliation remains $C$ rows, +with $C+1$ used only as its overflow probe. + +The first neutral 2,500-packet current-binary probe used $C=512$ and $B=128$: +public work was fixed at 2,560 nodes and queue effort 1,024, construction work +was bounded at 640 nodes and queue effort 256, and 129 remained solely the +logical historical-overflow boundary. Across 512 exact public controls, top-1 was 1.0, +mean identity recall at 16 was 0.999876, semantic coverage was 0.999947, and +all four opaque sources plus text, audio, and image post-encoding inputs used +the same route. Eighteen consolidations spent 301.174 ms in SQLite route seals +in total; the maximum individual seal was 80.482 ms, down from the roughly +one-second late seals in the rejected current-binary expanding-envelope run. +This was only a quality and local-work probe. A full 15,695-packet replay and +new nine-point knob ablation were therefore required before retention or +plateau claims; those later runs are reported separately and reject the +whole-engine plateau. + +The corresponding full replay rejected that first fixed-envelope candidate. +All mature route queries stayed at exactly the 2,560-row ceiling and maximum +seal time stayed below 114 ms, but exact top-1 fell to 0.992188, mean identity +recall at 16 to 0.975490, and semantic coverage to 0.967325. Recall by query +quarter was 1.0, 1.0, 0.980469, and 0.921875, so the failure was age-related +rather than an immediate 5C coverage defect. Inspection found that an existing +memory whose consolidation centroid moved updated its embedding but retained +its old outbound neighbor list. The graph became semantically stale even +though its row count and every query remained bounded. + +The relinking candidate recomputed outbound neighbors for both new and changed +active centroids under the same $C+B$ node and $2B$ queue construction +envelope, preserves deterministic level, and applies at most the derived +$\max(2,\lfloor B/16\rfloor)$ reciprocal updates per level. Its focused +restart regression proved a moved centroid changes persisted links and remains +the nearest result after reopen. The full replay rejected it: exact top-1 fell +to 0.980469, mean identity recall at 16 to 0.972794, semantic coverage to +0.964210, and maximum seal time rose to 140.669 ms. The source change and its +regression were removed; the result remains as negative evidence. + +The dual-seed candidate tested activation entry ownership instead. The prior +recenter operation replaced the canonical maximum-level HNSW entry with the +nearest consolidation centroid, which was often a level-zero node. Later +queries therefore skipped global hierarchy descent and crawled only the local +graph. The dual-seed candidate always descends from the persisted canonical +entry, then adds the consolidation centroid as a second level-zero frontier +seed and as the deterministic envelope pivot. Both seeds share the same fixed +$2C/5C$ envelope, so this did not double work. Its full replay still failed: +exact top-1 was 0.984375, mean identity recall at 16 was 0.974142, and semantic +coverage was 0.968592. The source change was removed. A copied-late duplicate-ingestion diagnostic is excluded from +acceptance because replaying already-present packets changed the authoritative +population and timestamps. + +The $12C/6C$ candidate passed quality but saturated too late to provide six +complete mature 500-event windows, so it remains a superseded experiment rather +than plateau evidence. Reducing the fixed public envelope to $10C$ nodes and a +$5C$ queue moved saturation earlier while construction remained independently +bounded at $C+B$ nodes and $2B$ queue effort. At neutral knobs these values are +5,120/2,560 for public retrieval and 640/256 for construction. All are +F/S/T-derived, and the query-age increments remain zero. + +The first $10C/5C$ full replay isolated five late operation slopes to one +cause: each supersession write or current-surface change invalidated the whole +target-eligibility sidecar, so later storage, reconsolidation, and emotional +cascade cache ensures rebuilt every target. The retained repair recomputes only +the supersession targets affected by the committed edge or changed source. +The next exact-binary replay removed every late operation failure. A separate +family-comparison counter still had a noisy half ratio even though its event +maximum was only 130. A first $B=128$ hard cap and a second $C=512$ cap were +both rejected because the 430- and 600-near-duplicate pagination regressions +could consume the budget before the semantic target. The retained $2C$ cap +passes those regressions and provides a stronger per-event absolute bound; +half ratios remain reported, but bounded work below $2C$ is not misclassified +as store growth. + +The final 15,695-packet Natural replay passed both quality and whole-engine +plateau gates. Exact top-1 was 1.0, mean identity recall at 16 was 0.999020, +and semantic coverage was 0.998311 across 512 exact public controls. The run +took 333,475 ms overall, with mean process and public total latencies of 8.885 +and 16.617 ms. The accepted plateau begins at event 11,695 and contains eight +complete 500-event windows while the authoritative store continues growing. +Mean plateau process time is 9.933 ms; late/early process and +consolidation-inclusive throughput ratios are 0.96177 and 0.97979, and the +relative Theil--Sen slope is -0.00768 per window. All operation and work-counter +failures are empty. Twenty-nine complete consolidation epochs form the intended +zero-amplitude fixed envelope, and the maximum 130 exact family checks remain +below the midpoint $2C=1,024$ ceiling. Route sealing consumed 8,375 ms in total +and no seal exceeded 97.562 ms. + +### Historical C-identity fixed-envelope knob ablation + +The prior $10C/5C$ candidate, which returned at most $C$ identities from the +routing envelope, was rebuilt once and evaluated at all nine +prescribed F/S/T points. Each fresh SQLite store processed 2,000 corpus packets +and used its own 512-query exact public control at the same knob values. The +4,608 controls covered four opaque source identifiers and text, audio, and +image post-encoding inputs. Exact top-1 and identity recall at 16 were 1.0 in +all nine runs; minimum semantic coverage was 0.999898. Midpoint and focus-low +published and exercised the sparse hierarchy. The other seven runs remained +below threshold or ended with bounded unpublished or dirty state and are +therefore system-quality exact fallbacks, not sparse-route quality claims. + +| Point (F/S/T) | C/B | public nodes/queue | dirty limit/sentinel | backfill limit/sentinel | route events/resets | quality class | top-1 / recall@16 / semantic | process / total ms | +|---|---:|---:|---:|---:|---:|---|---:|---:| +| midpoint (.5/.5/.5) | 512/128 | 5120/2560 | 512/513 | 128/129 | 15/1 | route lifecycle exercised | 1/1/1 | 13.749/17.930 | +| all-low (0/0/0) | 256/64 | 2560/1280 | 256/257 | 64/65 | 0/0 | exact unpublished | 1/1/1 | 22.853/27.654 | +| all-high (1/1/1) | 768/192 | 7680/3840 | 768/769 | 192/193 | 0/0 | exact unpublished | 1/1/1 | 48.580/49.771 | +| focus-low (0/.5/.5) | 384/96 | 3840/1920 | 384/385 | 96/97 | 232/5 | route lifecycle exercised | 1/1/0.999898 | 10.794/15.802 | +| focus-high (1/.5/.5) | 640/160 | 6400/3200 | 640/641 | 160/161 | 0/0 | exact unpublished | 1/1/1 | 12.363/14.390 | +| sensitivity-low (.5/0/.5) | 448/112 | 4480/2240 | 448/449 | 112/113 | 0/0 | exact below threshold | 1/1/1 | 0.429/0.823 | +| sensitivity-high (.5/1/.5) | 576/144 | 5760/2880 | 576/577 | 144/145 | 0/0 | exact unpublished | 1/1/1 | 57.418/60.169 | +| stability-low (.5/.5/0) | 448/112 | 4480/2240 | 448/449 | 112/113 | 0/0 | exact unpublished | 1/1/1 | 17.766/21.884 | +| stability-high (.5/.5/1) | 576/144 | 5760/2880 | 576/577 | 144/145 | 0/0 | exact unpublished | 1/1/1 | 13.264/17.515 | + +The complete $3\times3\times3$ structural grid passed 780 assertions, while +the bounded backfill/journal, route-metadata-open, and core-knob suites passed 1,220, 566, +and 393 assertions. At neutral knobs the historical batch is $B=128$; 129 is +exclusively the derived logical $B+1$ boundary. The implementation checks the +post-$B$ iterator without reading or processing a 129th work row. The +corresponding endpoint pairs are 64/65 and 192/193. Public +activation likewise scales from 2,560/1,280 nodes/queue through +5,120/2,560 to 7,680/3,840. Exact family comparisons independently scale as +$2C$, or 512, 1,024, and 1,536 at those same endpoints. The content-addressed +aggregate digest is +`efdbd964cb255c44d4490814fde954380b683cd2e891ceae13723ba77b691313`. +This closed the earlier C-identity candidate's knob-derivation and +sampled-quality gate. The later fixed-activation experiments below supersede it: +the $C$-identity route was fast enough for a plateau on that binary, but did not +retain exact long-history quality once the activated working set was separated +from the wider routing envelope. + +### Fixed activated-identity follow-up + +The retained route distinguishes two finite sets. SQLite routing may inspect at +most $5C$ graph identities so that a sparse hierarchy can recover distant +neighborhoods. Exact reranking then retains at most + +$$ +A=2C+2B +$$ + +identities for current-surface eligibility, family collapse, graph expansion, +and final ranking. At neutral knobs $C=512$, $B=128$, and $A=1{,}280$; at the +all-low and all-high endpoints $A$ is 640 and 1,920. Construction remains a +separate $C+B$ node and $2B$ queue operation. The canonical maximum-level HNSW +entry performs global descent, while the nearest consolidation centroid is an +additional level-zero seed and deterministic fill pivot. Neither identity set, +seed, nor limit depends on modality or `source_id`. + +The activated target was selected through a sequence of full-corpus and focused +negative experiments. The table reports exact top-1, mean identity recall at +16, and semantic coverage. “Limited route” means the routing-node ceiling was +also set to the activated target rather than retaining the wider $10C$ route. + +| Candidate | Corpus / wall ms | top-1 / recall@16 / semantic | Disposition | +|---|---:|---:|---| +| $A=2C$ | Durable / 27,006 | 0.994141 / 0.985797 / 0.978325 | rejected: three sampled top-1 misses | +| $A=3C$ | Durable / 28,242 | 1 / 0.999753 / 0.999285 | superseded: the 1,497 midpoint-near target saturated too late for six mature windows | +| $A=2C+2B$, limited route | Durable / 27,963 | 1 / 0.998518 / 0.995665 | rejected for the shared path after Natural failed | +| $A=2C+2B$, limited route | Natural / 115,461 | 0.964844 / 0.939345 / 0.926401 | rejected: long-history neighborhoods were unreachable | +| canonical hierarchy plus consolidation seed, limited route | Natural / 114,909 | 0.980469 / 0.963583 / 0.950696 | improved but rejected | +| fill the full target during traversal, limited route | Natural / 96,859 | 0.978516 / 0.965016 / 0.952839 | rejected | +| several arbitrary highest-level seeds | Natural / 111,770 | 0.960938 / 0.938407 / 0.926448 | rejected and removed | +| query-adaptive coarse highest-level seeds | Natural / 116,619 | 0.980469 / 0.952914 / 0.939977 | rejected and removed | + +A direct node-envelope ablation then varied the routing ceiling without +changing $C$, $B$, $A$, construction, downstream eligibility, or exact +reranking. The 5,000-packet screen rejected $C$ and $C+B$. Full-horizon runs +rejected $2C$ and $A$ despite their lower wall times because both violated the +mandatory exact-top-1 and recall contracts. $5C$ was the smallest tested +envelope to retain exact top-1 and the accepted recall gate; $10C$ was exact +but wider and slower. These are route-envelope results, not whole-engine +plateau passes. + +| Routing ceiling | Events / wall ms | top-1 / recall@16 / semantic | Disposition | +|---|---:|---:|---| +| $C$ | 5,000 / 28,807 | 0.890625 / 0.875265 / 0.864615 | rejected | +| $C+B$ | 5,000 / 29,765 | 0.974609 / 0.970724 / 0.966273 | rejected | +| $2C$ | 15,695 / 91,591 | 0.935547 / 0.907982 / 0.884337 | rejected | +| $A=2C+2B$ | 15,695 / 112,713 | 0.984375 / 0.971970 / 0.959175 | rejected | +| $5C$ | 15,695 / 101,598 | 1 / 0.999507 / 0.999143 | retained: smallest passing envelope | +| $10C$ | 15,695 / 103,534 | 1 / 1 / 1 | superseded: wider than necessary | + +A denser graph candidate increased each node to $B$ outgoing neighbors and +$B/4$ reciprocal updates. Its focused 600-node HNSW regression did not finish +within three minutes, so it was interrupted before any corpus result and the +retained $B/2$ neighbor and $B/16$ reciprocal formulas were restored. Earlier +integration attempts are also retained as negative evidence: one full Durable +run stayed on exact fallback because backfill advanced only at consolidation; +a lifecycle repair activated the route but truncated candidates before +operation-specific eligibility and lost quality; a later exact-quality run let +visited-node work grow with the sub-ceiling store and failed the plateau audit. +An apparent 15,695-event “Durable” replay that forced each Natural sentence to +Durable was invalidated because it changed the corpus unit and is not used as +performance evidence. + +The selected implementation keeps the $5C$ routing ceiling and exact rerank, +then retains $A=2C+2B$. The final 15,695-packet Natural replay at +$F=0.45,S=T=0.5$ resolved $C=499$, $B=125$, $A=1{,}248$, and a 2,495-row +routing and queue ceiling. With no experiment override, it completed in +100,805 ms with mean process and public total latencies of 2.777 and 6.207 ms. +Across 512 controls, exact top-1 was 1.0, recall at 16 was 0.999507, semantic +coverage was 0.999285, and ties were deterministic. The activated set never +exceeded $A$. This proves a fixed semantic activation set and a finite route +envelope, not a whole-engine plateau; the end-anchored plateau audit still had +no accepted suffix. + +The corresponding 2,016-message Durable replay used the identical algorithm +and knobs, with Durable adding only its post-commit checkpoint. With no +experiment override, it completed in 29,767 ms with mean process and public +total latencies of 8.178 and 14.350 ms. All three retrieval quality measures +were 1.0. Only three post-warmup 500-event windows existed, below the required +ten, so this is insufficient horizon rather than a Durable plateau pass. + +The new nine-point ablation rebuilt one binary and ran fresh 2,000-packet stores +at midpoint, both joint endpoints, and each one-axis endpoint. Every run used +its own 512-query same-knob text control over four opaque sources. A separate +active-SQLite-route regression held embeddings fixed and produced identical +candidates and bounds while varying memory and query labels across text, +audio, image, shared sources, and opaque sources. This split avoids fabricated +media in the corpus audit while proving that the post-encoding optimization has +no source or modality branch. All 4,608 whole-system controls achieved exact +top-1, recall at 16, and semantic coverage of 1.0. Five configurations both +traversed and successfully recentered the hierarchy. Two traversed but are +explicitly recenter-unproven; two remained exact fallback. The retained audit +does not separately materialize the route-active +query subset, so these are route-lifecycle classifications paired with +whole-system quality, not sparse-route-only quality claims. + +| Point (F/S/T) | C/B/A | route events / recenters | max routed / activated | quality class | process / total ms | +|---|---:|---:|---:|---|---:| +| midpoint (.5/.5/.5) | 512/128/1280 | 93/0 | 573/578 | traversed, recenter-unproven | 1.522/7.519 | +| all-low (0/0/0) | 256/64/640 | 335/5 | 525/534 | route lifecycle exercised | 1.723/6.366 | +| all-high (1/1/1) | 768/192/1920 | 35/0 | 769/785 | traversed, recenter-unproven | 5.339/9.030 | +| focus-low (0/.5/.5) | 384/96/960 | 274/2 | 626/657 | route lifecycle exercised | 1.848/7.304 | +| focus-high (1/.5/.5) | 640/160/1600 | 48/1 | 643/671 | route lifecycle exercised | 1.601/7.757 | +| sensitivity-low (.5/0/.5) | 448/112/1120 | 0/0 | 0/0 | exact below threshold | 0.921/6.440 | +| sensitivity-high (.5/1/.5) | 576/144/1440 | 379/2 | 879/955 | route lifecycle exercised | 12.575/21.436 | +| stability-low (.5/.5/0) | 448/112/1120 | 470/4 | 892/920 | route lifecycle exercised | 3.054/9.256 | +| stability-high (.5/.5/1) | 576/144/1440 | 0/0 | 0/0 | exact unpublished | 1.309/7.771 | + +The structural, backfill/journal, route-metadata-open, core-knob, and +active-route label-invariance suites passed 853, 1,234, 566, 393, and 23 +assertions. All route and activation ceilings were +respected; no search or backfill failure occurred; route open read one metadata +row. Whole-engine startup remains $O(\text{history})$ because the processor +still hydrates every current memory. The neutral historical work batch remains +$B=128$, while 129 is only the derived logical boundary checked through +post-$B$ iterator state, not a fetched row. The content-addressed aggregate digest for this +pre-commit evidence snapshot is +`a6c8e94af01c1f84d1a1a25e83abc1a3f2cafe9d3880cd553d84dc4704ed66ec`. +Sensitivity-high remains the dominant whole-engine configuration at 43,418 ms +wall and 12.575 ms mean process time; this reranks the independent emotional +cascade bound rather than weakening the fixed retrieval envelope. +Because the current Natural whole-engine plateau and Durable horizon gates are +open, these results establish the HNSW cutover, knob derivation, exact sampled +quality, and bounded activated identity set without claiming the broader goal +complete. + +### Consolidation-persisted activation snapshot + +The first attempt to make consolidation move the activated graph changed only +the route pivot. In a 13,000-packet neutral replay it reached exact top-1 +0.998047, recall at 16 of 0.993042, and semantic coverage of 0.998430. More +importantly, none of 50 valid pre/post-recenter pairs changed the activated +identity set for the same consolidation query. This rejected the hypothesis +that replacing or supplementing an entry pivot was sufficient: the canonical +$5C$ completion dominated the pivot while lower-rank quality fell below its +0.998 gate. + +The retained design leaves that canonical HNSW route intact and gives +consolidation one separate, SQLite-persisted activation snapshot. On each +successful seal, the normalized consolidation embedding defines the semantic +center and the route records at most $A=2C+2B$ nearest activated identities. +Ordinary queries still perform canonical maximum-level descent; the snapshot's +identities are loaded through the separate $A$ row budget and become +deterministic level-zero entry points. Neighbor rows discovered from those +entry points are still charged to the canonical $5C$ traversal ceiling. Queries exactly +rerank the union while protecting the best $2C$ canonical identities; the +snapshot may change the remaining $2B$ identities in $A=2C+2B$. Canonical rows, snapshot rows, and +their sum are recorded independently and fail above $5C$, $A$, and $5C+A$. +The center, generation, first identity, and packed identity list survive reopen +in the single route-metadata row. This is an internal SQLite migration and does +not add a public API or another Natural/Durable write path. + +The neutral 13,000-packet screening replay used $C=512$, $B=128$, and +$A=1{,}280$. Canonical rows reached exactly $5C=2{,}560$, snapshot rows reached +exactly $A$, and their sum reached but never exceeded 3,840. Across 512 public +controls, exact top-1 was 1.0, recall at 16 was 0.999754, semantic coverage was +0.999789, and ties were deterministic. Forty-six successful recenters were +profiled; 35 snapshots reached their full $A$ capacity, 11 same-query +pre/post pairs changed identity membership, and no pair was invalid. This is +the first retained result in which consolidation demonstrably changes the +fixed activated set while preserving the canonical route. It was a screening +predecessor, not the final multi-entry implementation. + +Three complete 15,695-event variants then isolated the remaining quality loss. +The canonical-only walk plus post-search snapshot returned top-1 0.998047, +recall at 16 of 0.995213, and semantic coverage 0.994474. Restoring one +snapshot entry as a level-zero seed improved recall to 0.997054 but remained +below the 0.998 floor. Protecting the best $2C$ canonical identities produced +perfect sampled top-1 but recall fell to 0.996072, showing that output-tail +allocation could not recover neighbors the walk never reached. The retained +variant therefore makes the complete persisted snapshot a bounded multi-entry +surface before traversal rather than only an after-the-fact rerank layer. + +That retained variant processed all 15,695 events in 470,440 ms with 63 +consolidations. Its 512 controls achieved exact top-1 1.0, recall at 16 of +0.999877, semantic coverage 0.999809, and deterministic ties. All 57 profiled +recenter pairs were valid; 43 changed membership. In the final 3,000-event +suffix, all 10 successful recenter edges changed the fixed $A=1{,}248$ set and +retained only 33.0--36.1 percent overlap. The same suffix kept the canonical +ceiling at $5C=2{,}495$, the snapshot ceiling at $A$, and the combined ceiling +at $5C+A=3{,}743$. This proves consolidation changes activation locality while +work remains fixed; it does not prove the independent whole-process plateau. + +The required nine production-shaped 4,000-event ablations then rebuilt fresh +stores at midpoint, both joint endpoints, and every one-axis endpoint. Each run +captured 512 same-event public controls over four opaque sources. All nine +traversed the SQLite hierarchy and subsequently completed between three and 17 +successful recenters; none passed through an exact-fallback-only lifecycle. +All 4,608 controls achieved exact top-1 and recall at 16 of 1.0; minimum +semantic coverage was 0.999695, with zero miss fingerprints. The acceptance policy permits at most one +top-1 miss in each 512-query run (0.998047), requires at least 0.999 across all +nine runs, and rejects two or more misses sharing a modality, opaque source, +memory-age quartile, or exact knob point. Thus the contract allows a bounded +approximation without describing it as exact, while this measured matrix did +not consume that allowance. + +| Point $(F,S,T)$ | $C/B/A$ | max canonical / snapshot / total rows | recenters: valid / changed | process / total ms | +|---|---:|---:|---:|---:| +| midpoint (.5/.5/.5) | 512/128/1280 | 517 / 1096 / 1096 | 12 / 0 | 2.932 / 27.993 | +| all-low (0/0/0) | 256/64/640 | 405 / 640 / 1045 | 13 / 7 | 3.558 / 27.279 | +| all-high (1/1/1) | 768/192/1920 | 865 / 1415 / 1415 | 3 / 0 | 11.153 / 32.204 | +| focus-low (0/.5/.5) | 384/96/960 | 400 / 960 / 1304 | 12 / 6 | 3.666 / 26.646 | +| focus-high (1/.5/.5) | 640/160/1600 | 603 / 1267 / 1267 | 9 / 0 | 3.210 / 28.522 | +| sensitivity-low (.5/0/.5) | 448/112/1120 | 423 / 542 / 542 | 4 / 0 | 1.241 / 25.032 | +| sensitivity-high (.5/1/.5) | 576/144/1440 | 592 / 1440 / 1622 | 17 / 4 | 23.536 / 49.794 | +| stability-low (.5/.5/0) | 448/112/1120 | 698 / 1120 / 1818 | 13 / 7 | 5.886 / 29.842 | +| stability-high (.5/.5/1) | 576/144/1440 | 543 / 931 / 931 | 4 / 0 | 2.276 / 27.394 | + +All 87 successful recenter pairs had explicit, valid overlap evidence and zero +failure codes; 24 pairs changed membership across four knob runs. A zero in the +changed column is not treated as a fabricated reset: in those short runs the +reachable published surface fit inside $A$, so the fixed snapshot already +covered it and overlap correctly remained 1.0. The full-horizon production-knob +run above supplies the mature-store movement proof. + +The complete 27-point structural grid passed 985 assertions. The bounded +backfill/journal, restart plus centroid persistence, core-knob, and active-route +source/modality-invariance reports passed 1,234, 64, 393, and 25 assertions +with no failures. At neutral knobs the historical batch remains $B=128$ and +129 remains only the logical post-$B$ iterator boundary; no 129th historical +row is fetched or processed. Sensitivity-high remains an adverse whole-engine +result rather than being hidden by the aggregate. These runs prove formula +derivation, local work ceilings, persisted recenter behavior, label-agnostic +routing, and sampled quality. The full Natural plateau, the short Durable +horizon, whole-engine restart, and production-wide boundedness remain separate +gates. The content-addressed aggregate digest is +`f674c55915331279f99f7d4c9eb22e0ed9440b58acd6b3e2a529455219db93d1`. +`TRACE[state:sqlite_hnsw_knob_ablation]`. + +### Activation-snapshot read-through reuse + +The retained multi-entry route initially selected and decoded the same +persisted activation snapshot on every query. A read-through repair places +those generation-qualified node rows in the route's existing $24C$ shadow +cache. SQLite remains authoritative: reopen begins cold, and every successful +seal clears the cache before rows from the next state may be reused. Query +distances are still evaluated exactly, so this changes row loading rather than +the $5C+A$ semantic envelope. A regression proves that the first query after +reopen loads at most $A$ snapshot rows and an identical second query loads +zero while returning the same identities. + +The matched 15,695-packet Natural replay completed in 194,736 ms, down from +470,440 ms for the uncached activation-snapshot run. Mean process time fell +from 6.384 to 4.729 ms and mean end-to-end time from 29.563 to 12.115 ms. +Only 13 events physically loaded snapshot rows; the maximum load was the +derived $A=1{,}248$, and all other routed events reused the bounded cache. +The 512-query public control retained exact top-1 1.0, recall at 16 of +0.999754, semantic coverage 0.999809, deterministic ties, and four opaque +sources. The late eight-window process ratio was 0.999920 and throughput ratio +1.021200, but the whole plateau remained rejected by emotional-cascade growth, +operation counters, and the requirement for ten mature recenter edges. The +different wall-time-driven consolidation cadence is retained as production-like +temporal feedback, not described as behavior equivalence. + +A fixed $2C+A$ actual-node ablation was then tested against the same complete +replay and public control. It is rejected: eight of 512 top identities missed +(top-1 0.984375), recall at 16 fell to 0.969452, and semantic coverage was +0.959699. Its 203,096 ms wall time and 4.502 ms mean process time cannot waive +that loss. This result is why the accepted 0.998 quality floor is useful rather +than ceremonial; the lower envelope is not retained. + +### Exact emotional winner collapse + +The next measured late-suffix contributor was the emotional cascade. Its +shared bit-mask breadth-first walk already visits graph adjacency once per +64-source batch, but it materialized a source--embedding pair for every source +that reached an embedding. The later update loop then discarded all but the +first pair under the established first-source-wins rule. The exact repair +performs that winner selection inside the shared traversal: for each reached +embedding it retains the lowest source ordinal and that source's shortest +positive depth, then materializes one winning pair. Reachable-pair and physical +edge-visit counters remain separate from the smaller winning-pair counter so +the optimization cannot hide an expanding graph walk. A 70-source regression +now proves 70 reachable pairs and 70 physical edge visits collapse to one +executed winner with the same final intensity. Full-horizon performance, +work-bound, and retrieval results remain required before retention. + +The complete exact-winner replay kept top-1 at 1.0, recall at 16 at +0.999386, and semantic coverage at 0.999381, but it did not improve the full +run: wall time was 205,445 ms versus 194,736 ms for snapshot reuse alone, and +mean process time was 4.865 ms versus 4.729 ms. The new physical counter also +showed why: the walk still reached 6,786 adjacency visits in one event. Exact +winner collapse is therefore not promoted by itself. + +An experiment then combined winner collapse with a deterministic physical-edge +ceiling equal to the existing public node formula $5C$. At the production +knobs the maximum was exactly 2,495 visits; 1,190 of 1,912 active cascade events +reached the ceiling, and no 2,496th edge was visited. Mean cascade time fell +from 0.107 to 0.072 ms/event and the replay completed in 198,222 ms. Its public +control consumed the allowed single miss: top-1 was 511/512 (0.998047), recall +at 16 was 0.999141, semantic coverage was 0.999285, and ties remained +deterministic over four opaque sources. The ten-window suffix beginning at +event 10,695 passed whole-process ratio (1.018755), throughput ratio (1.012508), +relative slope (0.005399), and bootstrap upper slope (0.012176). It is still an +experiment rather than a cutover: the current source-selection scan is not yet +bounded by an F/S/T-derived prefix, operation incidence remains visible, and +one material consolidation edge failed the strict raw post/trailing reset. + +The follow-up bounded the source side as well. The maintained source snapshot +now admits at most $5C$ timestamp/identity-ordered candidates and each cascade +executes at most $B$ sources, while physical adjacency remains capped at $5C$ +and updates at $A$. A dense all-low regression proves the exact 1,280-source +inspection boundary and the separate 64-source execution boundary; the +1,281st candidate is not materialized. The audit also stopped double-counting +the route's detailed node and snapshot counters on top of the already-total +`GraphRetrieve.rows_visited` value. + +The corrected 15,695-packet release replay completed in 191,354 ms with 33 +consolidations, mean process time 4.552 ms, and mean end-to-end time 11.903 ms. +Its 512-query public control passed with top-1 1.0, identity recall at 16 of +0.999386, semantic coverage 0.999667, deterministic order, and four opaque +sources. Observed maxima were 64 source inspections and executions, 2,495 +physical adjacency visits, 1,337 winning neighbors, and 73 updates, all below +their production-derived $5C=2{,}495$, $B=125$, $5C$, $5C$, and +$A=1{,}248$ ceilings. The ten-window suffix beginning at event 10,695 passed +whole-process ratio (0.992191), throughput ratio (0.994754), relative slope +(-0.002547), bootstrap upper slope (0.001772), and every active-work counter. +All ten mature recenter observations were pair-valid, changed the activation +set, preserved the fixed envelope, and had overlap from 0.348558 to 0.690705. + +This is still not a whole-goal cutover. Seven material consolidation epochs +were available, but the strict raw reset and normalized consolidation-cost +trend contracts failed, and several individually timed bounded kernels varied +by more than the current 1.05 component ratio. The result therefore proves the +quality and sparse-work envelope of this experiment, not a completed Natural +plateau, Durable equivalence, or production-wide bound. + +### Post-cutover shared activation distance reuse + +The first complete Natural profile after the retained row-addressed HNSW +cutover still increased by 1.69146 ms between its first and final five +post-warmup windows. Graph retrieval contributed 0.97932 ms (57.90%) and +memory storage 0.52965 ms (31.31%), or 89.21% together. Both operations call +the same SQLite `SearchActivated` routine. The graph seed-cache subsection +alone increased by 0.66697 ms, while mean route-node work increased 3.390x for +graph retrieval and 3.460x for memory supersession. These observations select +query-distance materialization inside the shared activation routine; they do +not imply that HNSW routing itself or the knob-derived activation target is +unbounded. + +A deterministic 1,300-node regression exposed duplicate arithmetic directly: +one activation made 2,761 exact query-to-node distance evaluations. The +retained query-local distance slot reduces that count to no more than one per +visited persisted node plus one per pending updated embedding, without +changing the $5C$ visit ceiling or $A=2C+2B$ outward activation target. + +Two Release binaries built from the same source head then replayed the same 500 +events against byte-copies of the same mature Natural database. The control +removed only the query-local cached-distance early return; the source delta, +binaries, compiler, corpus, initial database, command contract, profiles, and +audits are content-addressed in the retained evidence packet. Exact behavior, +canonical logical-database, and physical output-database digests matched. Mean +process time fell from 4.10098 to 3.76532 ms (-8.18%), Graph retrieval from +2.02630 to 1.83392 ms (-9.49%), its seed-cache section from 1.77608 to 1.59049 +ms (-10.45%), and Memory storage from 0.87427 to 0.77841 ms (-10.96%). +End-to-end mean fell 5.28% and wall time fell 5.49%. A separate earlier matched +fresh 2,500-event pair reduced mean process +1.05%, Graph retrieval 2.47%, seed-cache work 4.68%, and Memory storage 1.84%; +its wall-time difference was +1.01%, so it is reported as noise rather than a +fresh-store wall-time win. This is a measured local repair, not proof of the +required full-horizon Natural/Durable plateau or consolidation-cycle shape. + +The failed full replay also isolated a separate application-hydration leak. +The final six active working-memory slots contained 14,290 signal rows, and +because they lacked memory-level summary blobs, public hydration replayed all +14,290 payloads on every packet. Mean hydration increased from 3.07 ms in the +early window to 96.16 ms in the final window, dominating total latency. The +retained fallback now selects only each memory's newest $B$ indexed signal rows +while SQLite keeps the complete history. On a copied mature database, a +500-event tail probe at neutral knobs recorded the 128-row limit on every event +and materialized 642--655 fallback rows total across working and retrieved +memories. Mean hydration was 5.395 ms, mean process time 2.900 ms, mean public +latency 12.327 ms, end-to-end time 14.166 ms, and wall time 7,160 ms. Relative +to the rejected full replay's final 500 events, hydration fell 94.4% (96.162 to +5.395 ms) while six working slots remained active. The focused regression test +proves the newest 128 rows and chronological output independently for opaque +text, audio, and image sources. This copied-tail probe is direct mature-store +performance evidence, not yet a full-horizon plateau or application-quality +claim for omitted older fallback payloads. + +### Consolidation-cost and seal-cadence ablation + +A later full-horizon attribution pass corrected three observer and routing +details before changing the algorithm. Commit timing had included a +profiling-only vector identity lookup; identity resolution now occurs when the +committed mutation audit is consumed, while the independent logical and +physical audit streams remain intact. Mature deterministic route completion +now draws from the indexed generation slice and applies active eligibility at +ranking, so an inactive row cannot make the fixed envelope appear one row +short. The RIF changed-row counter now records work performed by the current +event rather than the historical active population. Each correction has a +red-then-green regression and changes measurement, not public retrieval +semantics. + +The remaining consolidation scan was bounded by the same knobs. Let +$A=2C+2B$ and $N=\max(8,\lfloor B/2\rfloor)$. Score consolidation now admits +at most $A$ low-strength long-term identities from the indexed strength/time +frontier and counts at most $N$ association edges per admitted identity. A +sentinel row publishes the exact input cardinality even when no candidate is +selected. The formula, counter, and source/modality invariants pass all 27 +$F,S,T\in\{0,0.5,1\}^3$ configurations across text, audio, image, and four +opaque source labels. At midpoint $C=512$, $B=128$, $A=1280$, and $N=64$; +129 occurs only as the logical $B+1$ completion probe. + +Four ordinary SQLite-route seal cadences were evaluated. Sealing every write +raised full-replay wall time to 107,294 ms and did not remove consolidation +growth. Sealing at the search-expansion batch +$E=\max(8,\lfloor B/4\rfloor)$ moved the sawtooth into ordinary writes. +Sealing at $N=B/2$ left late seed-rank and seal slopes. The retained candidate +seals at $B-E$ (96 rows at neutral knobs and 94 at the production replay's +$F=0.45,S=T=0.5$), which is derived at every knob point rather than stored as +a second threshold. Its 15,695-packet Natural replay completed 31 live +consolidations and found an accepted seven-window suffix beginning at event +12,195: no operation or work-counter gate failed, six complete consolidation +cycles were present, fixed route work was $5C=2495$, and normalized +consolidation cost ratios were 0.984 per sealed event and 0.937 per sealed +mutation. This is the measured write-throughput-for-symmetry tradeoff selected +for further quality proof. + +The stricter fixed-time, fixed-consolidation, four-opaque-source public control +then exposed a quality boundary not visible in the earlier control. With the +retained $5C$ node and $5C$ queue envelope, exact top-1 was 0.990234 and +identity recall@16 was 0.979902. Restoring the older $B$ seal cadence was +slightly worse (0.984375 top-1), so $B-E$ did not cause the loss. Bounded node +ablations kept the queue at $5C$: $10C$ reached 0.998047 top-1 and 0.998897 +recall; $12C$ reached 0.998047 and 0.999755; $16C$ reached 1.0 for top-1, +recall, and semantic coverage over all 512 queries. The $16C$ point is not +retained: its 7,984-node production budget exceeds the replay's roughly 3,200 +active memories, so actual work has not saturated, continues growing with the +store, and fails the six-window plateau and fixed-envelope gates. Production +therefore remains at the only mature plateau candidate, $5C$, while exact +top-1 remains an explicit unresolved cutover gate. These results do not claim +the overall goal complete. + +Five fixed-$5C$ moved-centroid topology repairs were then evaluated and +rejected on the same 15,695-packet, 512-query control. The first attached the +most recent $B-E$ changed centroids to the canonical hierarchy entry; it +improved top-1/recall/semantic coverage from +0.990234/0.979902/0.975038 to 0.994141/0.983333/0.976229 but still missed three +top results. Retaining a full $B$ identities on that entry also missed three +(0.994141/0.983088/0.975419). Distributing $B$ identities across +$R=\max(2,\lfloor B/16\rfloor)$ hierarchy hubs displaced too much useful +locality and fell to 0.986328/0.972426/0.964653; the narrower two-hub $2B$ +target reached only 0.990234/0.977083/0.968464. Finally, preserving each moved +centroid's old level-zero neighborhood while splicing only $R$ newly proposed +links and reciprocals reached 0.992188/0.978554/0.969131. Production knobs for +these runs were $C=499$, $B=125$, $E=31$, and $R=7$; neutral knobs would have +resolved to $C=512$, $B=128$, $E=32$, and $R=8$. No experiment used 129 as a +row count: it remains solely the neutral logical $B+1$ completion boundary. +The candidate source and its isolated moved-centroid regression were removed +after rejection. The profile identities, in the order above, are +`41f4708064c9f0e9034a551c4fd356adfe8b73b4537a734a94920ee6d7e96858`, +`01464b04783eae0443707dc88187d05492c6f02e526d4e450a64c859ce58f5c0`, +`5b0eb95ee32d15f7a2a5ab2511cc5e2d1e72629f0b8d3fbbf968ceae77c2539e`, +`3f3a13a245331e1f9691bd0a7eaf0d6a0900f060bd3e9ed6626ba14117d4b8e8`, +and `1f3216ae0c41c7b105cbd27e299f11b30d0403f63401d2871c13ed98c0428ad5`. +Together these ablations reject bounded link sprinkling as the quality repair; +they do not reject a separately represented sparse activation layer whose +centroids are rebuilt at consolidation under a fixed knob-derived capacity. + +### Historical expanding-envelope knob ablation + +The pre-fixed-envelope matrix regenerated all nine prescribed points from empty SQLite +stores on one rebuilt binary. Each run processed 2,000 corpus packets and +compared 512 public retrievals at $k=16$ with an exact control generated under +the same F/S/T values. Across 4,608 controls, exact top-1 and recall at 16 were +1.0; minimum semantic coverage was 0.999898. The midpoint and focus-low runs +published and exercised the SQLite sparse route, including one and five +successful consolidation recenter resets respectively. The other seven are +reported as system-quality exact fallbacks, not misrepresented as sparse-route +quality: sensitivity-low remained below threshold, while the remaining six +ended with bounded unpublished or dirty hierarchy state. + +| Point (F/S/T) | C/B | dirty limit/sentinel | backfill limit/sentinel | route events/resets | quality class | top-1 / recall@16 / semantic | process / total ms | +|---|---:|---:|---:|---:|---|---:|---:| +| midpoint (.5/.5/.5) | 512/128 | 512/513 | 128/129 | 15/1 | route lifecycle exercised | 1/1/1 | 13.994/18.326 | +| all-low (0/0/0) | 256/64 | 256/257 | 64/65 | 0/0 | exact unpublished | 1/1/1 | 23.539/28.490 | +| all-high (1/1/1) | 768/192 | 768/769 | 192/193 | 0/0 | exact unpublished | 1/1/1 | 49.888/51.132 | +| focus-low (0/.5/.5) | 384/96 | 384/385 | 96/97 | 232/5 | route lifecycle exercised | 1/1/0.999898 | 10.964/16.135 | +| focus-high (1/.5/.5) | 640/160 | 640/641 | 160/161 | 0/0 | exact unpublished | 1/1/1 | 12.467/14.549 | +| sensitivity-low (.5/0/.5) | 448/112 | 448/449 | 112/113 | 0/0 | exact below threshold | 1/1/1 | 0.461/0.878 | +| sensitivity-high (.5/1/.5) | 576/144 | 576/577 | 144/145 | 0/0 | exact unpublished | 1/1/1 | 59.519/62.366 | +| stability-low (.5/.5/0) | 448/112 | 448/449 | 112/113 | 0/0 | exact unpublished | 1/1/1 | 18.284/22.522 | +| stability-high (.5/.5/1) | 576/144 | 576/577 | 144/145 | 0/0 | exact unpublished | 1/1/1 | 13.813/18.273 | + +The matrix distinguishes the two ingestion surfaces that the earlier +pre-cutover experiment conflated. Historical backfill advances at most $B$ +ordered rows; $B+1$ is its logical overflow boundary, detected from the +post-$B$ in-memory iterator rather than an extra row read. Live dirty reconciliation +drains at most $C$ identities; $C+1$ is only its overflow probe. Thus neutral +129 is not a fetched row or work batch, and neither 128 nor 129 is a hidden fixed value. The +same formulas produce 64/65 and 192/193 at the endpoints, while live dirty +limits become 256/257 and 768/769. The 27-point structural grid passed 752 +assertions; bounded backfill/journal, route-metadata-open, and core-knob suites passed +1,220, 566, and 393 assertions, all without failures. The aggregate digest is +`7313859052b25c87f6ddc103d6677c9a48572dbdf2b39333a19484a4ad75b892`. + +The audit treated queue effort and the actual-node ceiling as separate derived +shape proofs, actual SQLite node rows as effect and bound proof, and fallback +hydration rows as a selected-context bound. This prevents query-content +variation from being mislabeled as engine drift while still rejecting a +perfectly shaped control that fails to reduce real work. The matrix closed the +expanding-envelope knob-derivation and sampled-quality gate; it does not +validate the replacement fixed envelope, and it did not convert the +still-failing whole-engine plateau into a boundedness claim. +The epoch audit also corrected one ownership assumption: ongoing +source-stream accumulator contents are observed active state but are not owned +or cleared by consolidation. Working-memory pending signals and the three +typed dirty-identity sets remain the required post-commit reset counters. +`TRACE[state:sqlite_hnsw_activation_effort_cycle]`. + +### Experiment and algorithm traceability inventory + +The following inventory binds the task's durable experiment state and every +task-owned algorithm group to this paper. The detailed corpus sizes, parameters, +measurements, and failure boundaries remain in the adjacent prose and tables; +these stable identities make omissions detectable when the state, source diff, +or generated manuscript changes. A retained source-health result is not a +production-wide boundedness claim, and a benchmark, modeled, synthetic, or +observation-only result is never promoted to production-path proof. + +| Trace identity | Recorded disposition and proof boundary | +|---|---| +| `TRACE[state:baseline_results]` | Immutable Natural and Durable controls; source-health baseline only. | +| `TRACE[state:post_hnsw_cost_attribution]` | The first complete retained-route Natural profile attributes 89.21% of remaining process growth to the two operations sharing SQLite activation and selects query-distance materialization without claiming whole-engine boundedness. | +| `TRACE[state:post_hnsw_query_distance_reuse]` | Retained query-local persisted-distance reuse; a source- and binary-bound mature pair is behavior/database exact and improves the local gate, while full-horizon Natural/Durable plateau proof remains open. | +| `TRACE[state:repair_results]` | Ranked measured repairs and their exact behavior/database equivalence evidence. | +| `TRACE[state:plateau_profiler_smoke_proof]` | Accepted instrumentation smoke proof; not plateau evidence. | +| `TRACE[state:work_counter_activity_repair]` | Retained explicit activity-marker repair over 100/200 Natural and Durable events. | +| `TRACE[state:graph_partial_distance_evaluation]` | Retained local improvement; full-Natural flatness still failed. | +| `TRACE[state:graph_eligibility_repair]` | Retained exact eligibility repair; full-Natural flatness still failed. | +| `TRACE[state:graph_eligibility_db_proof]` | Canonical database and fixed-probe equivalence proof for eligibility routing. | +| `TRACE[state:graph_supersession_eligibility_repair]` | Retained focused repair; the next independent graph-family comparison remained required. | +| `TRACE[state:graph_family_vector_bound_candidate]` | Rejected for fresh-process and graph regression. | +| `TRACE[state:graph_family_projection_bound_candidate]` | Rejected for copied-late process, graph, and comparison regression. | +| `TRACE[state:graph_family_precomputed_features_candidate]` | Rejected for fresh/copied-late process and wall regression. | +| `TRACE[state:supersession_metric_index_candidate]` | Rejected by the fresh process and wall hard gate. | +| `TRACE[state:competition_rif_returning_candidate]` | Rejected by fresh process and RIF regression. | +| `TRACE[state:competition_suppression_state_cache_candidate]` | Rejected by fresh process, wall, and RIF hard gates. | +| `TRACE[state:emotional_metadata_cache_repair]` | Retained full-run improvement; the flatness audit reranked the next contributor. | +| `TRACE[state:emotional_cascade_fixed_point_repair]` | Retained focused fixed-point repair pending full-run verification. | +| `TRACE[state:emotional_cascade_fixed_point_full_natural]` | Retained hotspot improvement; the full Natural plateau still failed. | +| `TRACE[state:accepted_tree_natural_plateau_rerank]` | End-anchored plateau failure reranked the next independent exact candidate. | +| `TRACE[state:emotional_cascade_fixed_work_candidate]` | Terminally rejected bounded-priority experiment. The 27-point structural grid and exact derived $B/B+1$ seams passed, but the fixed-time Natural midpoint missed both the p99-ratio gate (0.573 versus at most 0.25) and public identity quality (top-1 0.998047; recall@16 0.980760). Its selector was removed, and the nine-point matrix was correctly skipped by fail-fast. | +| `TRACE[state:shadow_sqlite_seam_proof]` | Private seam/ownership evidence only. | +| `TRACE[state:shadow_sqlite_scoped_evaluation]` | Whole-operation shadow was rejected by numeric acceptance gates. | +| `TRACE[state:post_shadow_rerank]` | Rejected shadow evidence reranked the measured exact contributors. | +| `TRACE[state:bounded_sparse_routing_observation]` | Promising default-off observation; low exact recall and linear restart forbid cutover. | +| `TRACE[state:active_epoch_sqlite_evaluation]` | Private active-epoch feasibility and lazy-RIF evidence; production cutover remains false. | +| `TRACE[state:rif_active_identity_ledger]` | Retained identity-only, knob-batched active-epoch publication. A matched copied-mature 1,000-event slice reduced the named hotspot 73.05 percent with exact public behavior and SQLite state; a full default-knob Natural replay respected $B=125$ but rejected the whole-engine plateau on commit and graph-work gates. Durable checkpoint/horizon and bounded restart remain open. | +| `TRACE[state:rif_epoch_consolidation_reset_candidate]` | Retained empty post-consolidation in-memory RIF epoch reset. The nine production-shaped knob points and full 27-point structural grid preserve $B=\operatorname{round}(64+64F+32S+32T)$; at neutral knobs $B=128$, while 129 is only the logical $B+1$ boundary. The named publication hotspot stayed flat over 15,695 Natural packets, but whole-engine plateau and retrieval-quality gates failed, so Durable verification and production cutover remain open. | +| `TRACE[state:post_emotional_priority_rejection_rerank]` | The valid control reranked active-epoch publication after the emotional candidate failed; its final six 500-event means rose from 0.347663 to 0.406671 ms while final-suffix whole-process and throughput gates passed. | +| `TRACE[state:bounded_route_hybrid_observation]` | Embedding-router feasibility retained; its production-shaped quality label was invalidated by the public-control population mismatch. | +| `TRACE[state:retrieval_quality_control_correction]` | Corrected 3,172-memory-surface feasibility passed exactly; runtime public eligibility/family control remains pending. | +| `TRACE[state:anchor_only_route_feasibility]` | Rejected anchor-only candidate routing at both 512 and 1,024 anchors; raw one-off output was not retained and is not acceptance proof. | +| `TRACE[state:public_retrieval_control_capture_experiment]` | Real GraphRetrieve control capture is observer-exact on the paired smoke and validates 512 full-run public controls; the corpus is one-source/text-only. | +| `TRACE[state:public_hnsw_route_prototype_experiment]` | Three standalone HNSW quality labels were invalidated because the final database cannot reconstruct every point-in-time live surface; live mutation capture is required. | +| `TRACE[state:live_surface_mutation_capture_experiment]` | Full live capture is behavior/database exact and the repeated 512-query route has exact identity/top-1 coverage; cross-source/modality, restart, live-cycle, and latency gates remain. | +| `TRACE[state:integrated_hnsw_sparse_route_experiment]` | Historical default-off sealed-HNSW plus exact-delta integration established same-event quality before the row-addressed SQLite route was retained; full-horizon plateau and cycle proof remain open. | +| `TRACE[state:integrated_hnsw_consolidation_seal_experiment]` | Historical incremental epoch sealing isolated 381 ms of seal work versus 9,221 ms of pre-existing full-surface reload; the retained SQLite route replaces full resealing, while full-horizon cycle proof remains open. | +| `TRACE[state:sqlite_hnsw_knob_ablation]` | Production-default $8C$-to-$9C$ plus consolidation-snapshot-$A$ matrix: the 27-point structural grid and all nine sequential 4,000-event corpus runs passed. All 4,608 controls measured top-1, recall@16, and semantic coverage of 1.0 with deterministic ties and zero miss clusters. Every short route was traversed, but none reached the $8C$ maturity floor needed for a valid pre/post activation pair, so all nine are explicitly recenter-unevaluated. Separate backfill/journal, restart, core-knob, and text/audio/image plus source-label invariance regressions pass. $B/B+1$, $C/C+1$, the $8C$ floor, $R$ step, $9C$ ceiling, snapshot $A$, combined $9C+A$, and family-comparison $2C$ bounds are distinct and knob-derived. | +| `TRACE[state:sqlite_hnsw_sparse_route_integration]` | Retained row-addressed SQLite HNSW query and incremental seal in the existing `GraphRetrieve` and `MemoryStorage` paths; Natural and Durable share the same algorithm, and Durable adds only its checkpoint. Current full-corpus retrieval quality and activation bounds pass, while the Natural whole-engine plateau and Durable horizon gates remain open. | +| `TRACE[state:sqlite_hnsw_activation_effort_cycle]` | Queue-effort-only, fixed-$5C$, and dynamic $4C$ through $8C$ floor variants were rejected or superseded. The retained candidate resets routing work to $8C$, advances by $R=\max(2,\lfloor B/16\rfloor)$ to $9C$, keeps $A=2C+2B$ downstream activation and $2B/(C+B)$ construction, passes the 30,380-packet mature-cycle gates at 511/512 top-1 and recall@16 0.999265, and passes canonical and nine-point quality without an engine-wide plateau claim. | +| `TRACE[state:sqlite_hnsw_production_cutover]` | Retained the existing SQLite HNSW route as the production default at an $8C$ post-consolidation floor, $R=\max(2,\lfloor B/16\rfloor)$ step, $9C$ ceiling, separate $A=2C+2B$ snapshot, and $9C+A$ total row ceiling. The nine-point matrix passed 4,608/4,608 top-1 controls, minimum recall@16 and semantic coverage 1.0, deterministic ties, and source/modality-label invariance. Natural and Durable share the operation path, with Durable adding only its checkpoint; whole-engine reset, bounded restart, Durable plateau, release, and deployment remain unclaimed. | +| `TRACE[state:hnsw_fixed_6c_experiment]` | Rejected knob-derived fixed-$6C$ routing envelope. All 27 structural F/S/T points and 931 assertions passed; neutral $C=512$ produced a 3,072-node envelope while $B=128$ and the 129 boundary remained distinct. An extra production-default F=.45/S=.5/T=.5 pre-screen missed exact top-1, recall@16, plateau, and wall-time gates, so fail-fast rejected the candidate before the exact nine-point corpus matrix started and left production on fixed $5C$. | +| `TRACE[state:post_rif_empty_fixed_envelope_attribution]` | Repaired proof classification for the retained zero-increment fixed-$5C/5C$ route. Retrieval mode is independent of whole-engine process shape; route-active rows fail closed on missing work, and queue, node ceiling, actual visits, distance work, and activation are checked separately across at least ten mature unchanged-envelope recenters. The production suffix beginning at event 10,195 passes the classifier and work envelope across 12 complete recenters, while activated-identity overlap, process-cycle reset, exact full-horizon retrieval, Durable horizon, and bounded restart remain open. | +| `TRACE[state:write_gate_incidence_attribution_v2]` | Deterministic range-bound observation-only 15,695-packet production-knob attribution rejected boundary-to-write incidence as the growth source: exact event ranges 0--2,499 and 13,195--15,694 contained 510 and 528 writes, while MemoryStorage time per write rose from 0.4833 to 2.8343 ms as the existing shared SQLite HNSW route warmed toward the fixed $5C=2{,}495$ envelope. Production $C/B/A=499/125/1{,}248$ and construction $C+B/2B=624/250$ remain derived; neutral $C/B/A=512/128/1{,}280$ and 129 is only logical $B+1$. Raw reset remains failed and unwaived; 27 structural and nine production-shaped F/S/T ablations remain required. | +| `TRACE[state:recenter_activation_overlap_natural_13000_v2]` | Fail-closed same-query pre/post activation measurement rejected the current connection-local HNSW recenter as a consolidation-driven centroid reset. A deterministic builder accepts only explicitly pair-valid, zero-failure observations; across 22 such successful recenters in 13,000 Natural events, including 14 at the full $A=1{,}248$ activation target and later queries saturating the $5C=2{,}495$ node envelope, all 22 retained exactly the same activated identities (minimum overlap 1.0). This proves the route is integrated but its current recenter does not move the activated set; raw reset, 27 structural and nine production-shaped F/S/T ablations, modality/source-id invariance, and whole-goal proof remain open. | +| `TRACE[state:current_verification]` | The no-selector production default passes canonical Natural quality at 512/512 top-1 and nine-point quality at 4,608/4,608, with recall@16 and semantic coverage 1.0 throughout. The 2,016-message Durable replay also passes 512/512 with identical route parameters and only its checkpoint barrier, but its horizon remains insufficient for plateau proof. Structural, backfill/journal, route-metadata-open, core-knob, source/modality invariance, Python, and C++ focused gates pass. Whole-engine raw process reset and bounded restart remain open and are not part of the scoped retrieval-envelope claim. | +| `TRACE[state:fixed5c_moved_centroid_reachability]` | Five fixed-$5C$ bounded single-hierarchy moved-centroid link repairs were measured and rejected; the result does not reject a separately represented consolidation-rebuilt activation layer. | +| `TRACE[state:bounded_fallback_hydration]` | Retained newest-$B$ indexed signal fallback reduced copied mature-tail hydration from 96.162 to 5.395 ms and passed opaque text/audio/image recency tests; full-horizon and application-quality proof remain open. | +| `TRACE[state:packed_route_sqlite_representation_experiment]` | Packed SQLite queries retained the exact route result, but complete-snapshot rewrite was rejected for incremental consolidation. | +| `TRACE[state:row_addressed_route_sqlite_experiment]` | Row-addressed SQLite made a 200-event seal incremental at fresh and copied-late history; the representation is now integrated, with full-horizon copied-late and cycle proof still pending. | +| `TRACE[rejected:shared-shadow-sqlite-operation-view]` | Rejected whole-history shadow projection. | +| `TRACE[rejected:GraphRetrieve.seed_cache_family_compare.coordinate-block]` | Rejected exact coordinate-block graph candidate. | +| `TRACE[rejected:GraphRetrieve.seed_cache_family_compare.projection-bound]` | Rejected projection-bound graph candidate. | +| `TRACE[rejected:GraphRetrieve.seed_cache_family_compare.precomputed-features]` | Rejected immutable precomputed-feature graph candidate. | +| `TRACE[rejected:MemoryStorage.supersession_metric_index]` | Rejected supersession metric-index candidate. | +| `TRACE[rejected:Competition.rif_recovery_active_sql.update-returning]` | Rejected update-returning RIF candidate. | +| `TRACE[rejected:Competition.rif_recovery_active_sql.suppression-cache]` | Rejected suppression-cache RIF candidate. | +| `TRACE[rejected:RifActiveEpoch.row-batch-only-performance-cure]` | The knob-derived batching contract was retained, but batching complete RIF values reduced copied-mature publication only 3.99 percent versus the required 20 percent and was rejected as the performance cure. | + +The bounded-route search itself had five separately evaluated points over the +same 34,456-vector, 512-query top-16 benchmark: + +| Trace identity | Result | +|---|---| +| `TRACE[bounded-route-variant:reciprocal-route-only]` | Rejected: exact recall at 16 was 0.979858. | +| `TRACE[bounded-route-variant:three-sparse-graphs]` | Rejected: no recall gain at equal per-graph work. | +| `TRACE[bounded-route-variant:construction-budget-4096]` | Rejected: exact recall at 16 was 0.995972. | +| `TRACE[bounded-route-variant:construction-budget-8192-reciprocal-64]` | Rejected: exact recall at 16 was 0.997803. | +| `TRACE[bounded-route-variant:two-graphs-construction-16384-retrieval-1280-reciprocal-64]` | Selected benchmark design: exact top-1 1.0 and recall at 16 0.998413; production proof pending. | + +The source diff is partitioned into the following algorithm and experiment +implementation groups. The traceability audit requires every changed C/C++ +path under `src/` or `include/`, every changed benchmark C/C++ path, and every +changed non-test experiment/audit tool to belong to exactly one group, so an +unrecorded algorithm or experiment implementation fails closed. + +| Trace identity | Algorithm surface | +|---|---| +| `TRACE[algorithm:consolidation-envelope-and-detector]` | Drift rearm, accumulator reset, shallow consolidation, and consolidation-throughput state. | +| `TRACE[algorithm:shared-retention-and-rollback]` | Shared Natural/Durable accumulation, signal-record rollback journal, working memory, and processor transaction ownership. | +| `TRACE[algorithm:lazy-rif-active-epoch]` | Lazy RIF clock/generation state, active-epoch SQLite, memory-strength integration, store compatibility, and migration. | +| `TRACE[algorithm:bounded-graph-retrieval]` | Bounded activation observation, graph retrieval, historical search cache, evaluated embedding-family features, and explicitly enabled public-seed tracing. | +| `TRACE[algorithm:emotional-propagation-cache]` | Emotional state, fixed-point propagation, and rebuildable metadata cache. | +| `TRACE[algorithm:memory-storage-and-graph-maintenance]` | Supersession storage, association fanout, eviction, predictive/stability updates, and usage detection. | +| `TRACE[algorithm:runtime-composition]` | Engine pipeline composition and hydration/routing integration. | +| `TRACE[algorithm:bounded-work-instrumentation]` | Consolidation-epoch and mutation-ownership counters used by the acceptance audit. | +| `TRACE[algorithm:experiment-harness-and-audit]` | Owner-authorized session extraction, Natural/Durable replay, public-surface export and control capture, row-addressed SQLite experiment, and fail-closed performance/quality audit implementation. | + +Natural and Durable use one ingestion algorithm; Durable adds only the post-commit flush/checkpoint barrier. +The algorithm does not branch on modality or source cardinality: `source_id` +remains opaque provenance, while text, audio, and image inputs converge after +encoding. The final traceability pass is rerun after production changes and the +last experiment, so this inventory cannot become a stale intermediate snapshot. + +A follow-up SQLite representation run separated fixed query work from snapshot +write amplification. The four-blob, 1,024-anchor snapshot occupied 207,847,424 +bytes for 34,456 embeddings. Restart touched 1,029 rows. The 512 top-16 route +queries took 0.116659 seconds in total (0.22785 ms/query), performed a mean +512.004 and maximum 513 exact comparisons, and retained exact top-1 and +recall-at-16 of 1.0. A 1,024-embedding fresh prefix built, exported, restarted, +and checked in 0.44 seconds wall time. However, exporting the complete snapshot +took 65.5011 seconds. `TRACE[state:packed_route_sqlite_representation_experiment]` +therefore retains the row-addressed SQLite query seam but rejects rewriting the +store-sized packed blobs at consolidation. The production-shaped candidate must +append only the sealed epoch's nodes, edges, and routes, with bounded reciprocal +updates; copied-late append, public-cycle, and failure/ownership proof remain +pending. + +The row-addressed follow-up retained separate indexed node, graph-edge, and +route rows and changed only the sealed epoch. In a 200-event fresh database, +derived apply plus commit took 0.002320 seconds (0.01160 ms/event). At a +34,256-row copied-late prefix, inserting the same 200 nodes and two edge rows +per node plus updating 3,544 unique reciprocal route rows took 0.010586 seconds +(0.05293 ms/event). The 4.56 late/fresh ratio reflects the deliberately absent +reciprocal population in the empty control, but its absolute cost remained +small and no store-sized value was rewritten. An injected pre-commit failure +restored exact table counts; close and reopen retained exact committed counts; +restart read the dimension plus 1,024 anchors, or 1,025 rows total. The 512 +fixed-route queries each compared exactly 512 embeddings and took 0.621792 +seconds total (1.21444 ms/query). This is +`TRACE[state:row_addressed_route_sqlite_experiment]`: measured representation +evidence, not graph-construction, public-path latency, post-authoritative-commit +publication, Durable-barrier, or live-sawtooth proof. + +The profiler's zero-counter guard was also corrected during this evaluation. +The initial 100-event Natural and Durable smoke audits incorrectly treated a +positive recovery-operation duration as evidence that at least one suppressed +row must exist. Recovery may legitimately run while the active suppression +population is empty. The audit now pairs every required work count with the +engine's explicit boolean activity marker (`candidate_activity`, +`rows_visited_activity`, and the corresponding graph, rollback, emotional, +predictive, and supersession markers) rather than with an inclusive operation +timer. A zero count beside a zero activity marker is valid; a zero count beside +a positive marker still fails as a vacuous placeholder. A regression preserves +that distinction. Rebuilt 100- and 200-event Natural and Durable profiles then +passed row schema, producer/count equality, activity, consolidation-epoch, +active-epoch-limit, and Durable-barrier validation. These short runs validate +instrumentation only; they are not plateau or long-horizon performance proof. + On 2026-06-30, a full Meta MSC replay rerun verified the retrieval-cache optimization on the same 9,130-turn slice used for the hosted frontier-judge artifact. The run preserved native probe behavior exactly: all non-timing probe @@ -423,6 +1935,505 @@ semantic equivalence for this replay and preserves the measured exact constant-factor improvements, but it does not prove bounded Natural writes or authorize a production-wide flat-storage claim. +## Signal-centroid ring cutover and knob ablation + +Commit profiling isolated a write-amplification defect that earlier aggregate +timings obscured. Every accepted signal inserted a new row into the global +sqlite-vec surface even though memory KNN later joined through memories and +discarded those signal-only rows. In a 2,000-event control, accepted commits +averaged 0.2240 ms and mutated 21.78 `embeddings_chunks` rows per accepted +write. The retained centroid-ring candidate reduced those figures to 0.1594 ms +and 4.00 rows, respectively; mean process time fell from 0.8614 to 0.7048 ms. + +Two intermediate designs were rejected. Storing an exact vector inline on the +ever-growing `signals` table while repointing historical working-memory rows to +the newest centroid touched approximately 600 signal rows per accepted write +in the diagnostic profile. Removing the repoint avoided that direct +$O(N)$ mutation but still left an unbounded inline-vector table. The retained +design instead stores one global centroid per memory and a persistent bounded +exact-vector ring of size $B(F,S,T)$. Signal rows reference the centroid, so +the ring changes neither durable payload identity nor the public retrieval +surface. + +The content-addressed benchmark binary then replayed all 15,695 Natural packets at +$F=0.45,S=T=0.5$, resolving $B=125$ and $A=1,248$. It processed 32 +consolidations in 183,001 ms with mean process and total times of 4.2730 and +11.4210 ms. The maximum ring-table mutation count was 12 in any event. +Emotional updates reached 133 against the +hard $A=1,248$ enqueue limit, and the limit was never saturated. + +That run is not reported as a whole-engine plateau pass. No suffix satisfied +every combined consolidation-cycle, timing, and active-counter gate. Its +512-query full-horizon control also measured exact top-1 0.994141, +identity recall@16 0.993623, and semantic coverage 0.990139; top-1 and recall +therefore miss the current mandatory whole-goal thresholds. The exact +2,016-message Durable replay completed four consolidations in 30,128 ms with +mean process and total times of 9.1500 and 14.5741 ms. Its retrieval controls +remained 1.0, but neither attribution nor the required plateau passed. These +failures remain part of the result rather than being replaced by the local +ring improvement. + +The current-binary nine-point Natural ablation used 2,000 events, 512 exact +public GraphRetrieve controls, and four opaque source identifiers per point. +Every point passed exact top-1, exact identity recall at 16, semantic coverage, +and deterministic tie order at 1.0. A separate active-route regression covers +text, audio, and image labels plus shared and opaque source identifiers, so the +text-ingress corpus table is not misrepresented as fabricated multimodal +traffic. + +| F/S/T point | ring $B$ | max ring row mutations/event | wall (ms) | top-1 / recall@16 / semantic | +|---|---:|---:|---:|---:| +| midpoint | 128 | 12 | 14,072 | 1 / 1 / 1 | +| all-low | 64 | 8 | 12,039 | 1 / 1 / 1 | +| all-high | 192 | 4 | 15,619 | 1 / 1 / 1 | +| focus-low | 96 | 14 | 14,222 | 1 / 1 / 1 | +| focus-high | 160 | 7 | 14,997 | 1 / 1 / 1 | +| sensitivity-low | 112 | 12 | 12,464 | 1 / 1 / 1 | +| sensitivity-high | 144 | 6 | 39,900 | 1 / 1 / 1 | +| stability-low | 112 | 10 | 17,623 | 1 / 1 / 1 | +| stability-high | 144 | 14 | 14,558 | 1 / 1 / 1 | + +The sensitivity-high latency outlier is retained as measured. The aggregate +`signal-centroid-ring-knob-ablation-v4.json` binds all profiles and sanitized +audits to benchmark binary SHA-256 +`4ac8b7239545cdc1fcc7a0b51a0c131c6ef4ce3656ddbcbe6706c8f3baa76e83` +and has SHA-256 +`d75f8244b84686b93578b644a7b4c2a9ecf0963bd98017f57dc75245204a7044`. +Its 29-file source-code manifest has SHA-256 +`41ea4060829c156230e5f40cd8f06d4197b00650b8a10a3e9aca06e6b7df2897`; +the scope is explicit so unrelated concurrent branch work cannot silently change +the evidence identity. +The v4 builder fails closed unless every point contains exactly 2,000 rows +with unique event indices covering 0 through 1,999, 512 controls, four opaque +source digests, all three quality values at 1.0, deterministic ties, an +observed ring-mutation counter, and an audit digest bound to the private +profile. Its capacity check +uses the production `std::lround` rule and includes a half-integer regression. +The plateau audit likewise treats `MemoryStorage.insert_signal_rows` as elapsed +time rather than inferring diagnostics from a `_rows` suffix; a negative fixture +grows only that duration and must fail. +This closes knob derivation, the named nine-point ablation, public retrieval +quality for those slices, and source/modality-independent routing structure. +It does not claim a whole-engine plateau, a bounded emotional traversal, +merge, release, or deployment. `TRACE[state:signal_centroid_ring_cutover]`. + +Post-signal-ring attribution exposed a distinct consolidation-edge defect in +the retained identity ledger. Across the first and final five successful +consolidations of the 15,695-packet Natural replay, mean consolidation duration +rose from 21.306208 to 53.983433 ms. The disposable-ledger publication rose +from 0.425858 to 6.475533 ms while the mean persistent current-generation +identity population rose from 226.0 to 3,113.2. Each SQL statement still obeyed +the derived $B=125$ limit, but the number of statements copied the complete +population. Batching therefore bounded statement size without bounding total +consolidation work. + +The measured repair keeps persistent SQLite authoritative and changes only +successful epoch reset: the new connection-local SQLite epoch begins with its +clock and no copied identities, and later events publish only their changed +identities. The deterministic regression covers all nine production-shaped +F/S/T points, using persistent $B+1$ populations and mixed modality and opaque +source labels. It initially failed at neutral knobs because 129 identities were +copied, then passed 171 assertions after the repair; after the double-failure +regression was added, the complete active-epoch focused set passed 482 +assertions in 15 cases. Neutral 128 remains the derived +batch, and 129 remains the logical $B+1$ test population rather than a work +batch. + +Fresh blind review found that the first implementation did not carry the +empty-reset intent across consecutive failures. When both post-commit +publication and its immediate recovery failed, the next event could rebuild +the disposable RIF projection from all persistent active identities. The +first repair made the empty-reset requirement sticky and preserved that +sidecar across successful retrieval-surface reloads. Round-two review then +found that the reload exception handler still erased it. That exact sequence +was reproduced as a missing sidecar before repair. The catch path now detaches +and restores the RIF epoch independently of the other disposable retrieval +caches. A regression with a neutral $B+1=129$ mature persistent population +injects publication, recovery, and reload failures, then proves that the retry +observes an empty disposable epoch and publishes only one changed identity; +the durable 129 identities remain in persistent SQLite. This is failure-path +source-health evidence. The earlier 15,695-packet timing run predates both +review repairs and continues to support only the successful-path local +publication result. + +The exact repaired binary then completed the full 15,695-packet Natural replay +with 38 live-hint consolidations in 219,074 ms. The selected publication edge +was flat: its first-five and final-five consolidation means were 0.198092 and +0.196425 ms, and all 38 publications consumed 9.043001 ms. The local repair is +therefore retained. It did not complete the engine goal. No suffix passed the +consolidation-cycle contract, and the 512-query public control reached exact +top-1 0.998047, exact identity recall at 16 of 0.996094, and semantic coverage +0.993760, below the mandatory 1.0 and 0.998 identity gates. Durable verification +was not run after the first Natural acceptance gate failed. Bounded restart, +recursive review, overall plateau, and production boundedness remain open. + +A smallest-next-envelope feasibility probe then raised only the private HNSW +node inspection bound from $5C$ to $6C$; activation remained $A=2C+2B$ and +every value remained F/S/T-derived. The complete 27-point structural grid +passed 931 assertions, with neutral $C=512$, node budget 3,072, and $B=128$; +129 remained only the logical $B+1$ boundary. An additional production-default +F=.45/S=.5/T=.5 Natural pre-screen resolved $C=499$ and 6C=2,994, processed all +15,695 packets in 231,275 ms, and regressed wall time 5.57 percent relative to +the repaired 5C run. Exact top-1 remained 0.998047 with the same one miss; +identity recall at 16 improved from 0.996094 to 0.997070 but remained below +0.998. No suffix passed the plateau or consolidation-cycle contracts. The 6C +candidate is therefore rejected before the exact nine-point corpus matrix +started. This is a complete 27-point formula ablation, one additional +default-knob pre-screen rejection, and 0/9 exact corpus-matrix points, not a +nine-point performance pass. The historical benchmark executable is bound by +SHA-256 `86bafe48d4a75e8ebaf6d942fb92aca59e3078af189d4a8148a31846ee3e5a13`; +its unchanged experiment-owned selector, formula, harness, regression, and +audit source manifest is bound by SHA-256 +`35c0de6f3f05dd3e0720db01c372fa32b58f572fe269610ed56a7a3ee26a5198`. + +Re-attribution also exposed a proof-classification defect rather than another +HNSW algorithm change. The retained route declares zero activation increments, +but the audit previously chose a ramping retrieval-cycle test whenever process +time formed a sawtooth. The same fixed $5C$ work therefore failed for having no +material retrieval ramp. A deterministic regression reproduced the mismatch, +and the repaired audit now selects fixed-envelope retrieval from the declared +F/S/T parameter vector independently of process mode. Over the production +replay suffix beginning at event 10,195, 12 complete successful recenters kept +both queue and node envelopes at $5C=2{,}495$ with no classifier or work-envelope +failure. The historical profile did not record activated-identity overlap, so +it cannot prove the full centroid-movement retrieval-cycle contract. The whole +goal remains open: overlap, process-cycle reset, operation/counter suffix gates, +exact top-1/recall, Durable horizon, and bounded restart are unchanged. +This repair adds no runtime value, route, modality branch, or source-id branch; +the existing 27 structural and nine production-shaped knob contracts remain +the required ablations. + +The next process-reset attribution separated event incidence from per-active-unit +cost. Ten suffix epochs met the material-ramp definition, and eight met the +strict requirement that the following 50-event process mean be at most 0.9 of +the trailing mean. The two misses, epochs 28 and 35, still removed 90.65% and +66.40% of their preceding process ramps. Their post windows contained two and +six times as many supersession candidates, respectively. Memory-storage time +per candidate improved by 28.46% in epoch 28 and changed by only 1.25% in +epoch 35. Epoch 28 also contained 3.69 times as many emotional neighbors while +time per neighbor improved by 7.57%; epoch 35 moved from no trailing-neighbor +activity to 472.48 neighbors per event after consolidation. Thus these two +absolute-latency misses do not identify a store-size-dependent engine hotspot; +they expose content-incidence sensitivity in the strict reset audit. An +activity-normalized diagnostic now compares post to trailing windows separately +for memory-storage candidates and emotional-cascade neighbors. It uses ratios of +window sums, treats zero/zero activity as unevaluated, treats a one-sided zero as +incomparable, and deterministically ranks per-unit regressions before +activity-incidence explanations. It is diagnostic only: raw reset, peak, +trough, slope, height, throughput, work, and continued-store-growth failures +remain unchanged and cannot be waived. + +On the same production suffix, all evaluable rows were activity-incidence rather +than per-unit regressions. Epoch 35 memory storage was selected deterministically +because its post window added 24.215 ms while candidate incidence rose sixfold; +its unit-cost ratio was 1.0125, below the existing 1.05 operation threshold. +The result continues to attribution of the memory-storage activity-generation +path while the strict process-reset failure remains. Nineteen focused diagnostic +tests and all 111 storage-audit tests pass, including contiguous adjacent and +cross-operation-identical window checks, finite aggregate checks, and +label-invariant arithmetic for text, audio, image, shared, and opaque labels. +The candidate introduces no runtime work value. A content-addressed inventory evaluates 33 existing +F/S/T-derived formulas over all 27 structural points and retains the exact nine +production-shaped points; neutral $B=128$, while 129 remains only the logical +$B+1$ exclusion boundary and never a fetched or processed row. No runtime +algorithm, knob formula, public API, schema, modality behavior, or source-id +behavior changed in this audit-only implementation. + +Direct attribution of the selected memory-storage activity path localized the +remaining incidence jump one level earlier. In epoch 28 the trailing and post +windows stored 6 and 12 memories; in epoch 35 they stored 2 and 12. Each stored +memory in both windows returned exactly 394 supersession candidates and visited +the same F/S/T-derived 1,248-row activation target. Thus the twofold and sixfold +candidate totals are exactly the twofold and sixfold counts of natural writes, +not growth in candidates per write. At epoch 35, sparse-route node rows per +stored memory changed by a factor of 1.0305, candidate-load time per stored +memory by 1.0144, and total memory-storage time per stored memory by 1.0125; +epoch 28 improved on the corresponding time measures. The next measured surface +is therefore boundary-to-write incidence in `ComputeWriteGate`, not another +MemoryStorage candidate-search repair. This is attribution, not authorization +to alter memory semantics: the raw reset miss remains failed and unwaived. + +The replay used production knobs $F=.45$, $S=.5$, and $T=.5$, deriving +$C=499$, $B=125$, $A=1{,}248$, $5C=2{,}495$, $2C=998$, $C+B=624$, and +$2B=250$. Neutral `.5/.5/.5` remains a distinct ablation point with +$512/128/1{,}280/2{,}560/1{,}024/640/256$; 129 is only its logical, +unprocessed $B+1$ boundary. The attribution adds no fixed work value and uses +neither modality nor source-id labels as a budget input. The production corpus +is text-only evidence; separate mixed-label regressions retain responsibility +for modality/source-id invariance. + +### Write-gate incidence and existing-path HNSW attribution + +An observation-only `ComputeWriteGate` profile then recorded every decision +input and exit class without changing write semantics. A deterministic builder +binds the first comparison to event indices 0--2,499 and the end-anchored final +comparison to 13,195--15,694. The first range contains 575 boundary events and +510 writes: 330 were forced, 180 passed the score test, and 65 failed it. The +final range contains 573 boundary events and 528 writes: 332 were forced, 196 +passed, and 45 failed. Mean scored margin changed from 0.0843 to 0.0895. The +gate therefore did not produce the measured storage-cost ramp: boundaries +changed by a factor of 0.997 and writes by 1.035. + +The same run demonstrates where HNSW is already incorporated. Natural and +Durable share the existing SQLite-authoritative operation graph, and +`MemoryStorage` supersession uses the same persisted sparse route as ordinary +retrieval rather than a second durable write algorithm. During finite route +warm-up, sparse node rows per stored memory rose from 9.82 in the first range +to 2,447.48 in the final range; exact current-row comparisons reached +the fixed $A=1{,}248$ target and mature routing distance work reached the fixed +$5C=2{,}495$ envelope. Memory-storage time per write consequently rose from +0.4833 ms to 2.8343 ms even though write incidence stayed flat. The final +seven end-anchored windows passed process-half, throughput-half, relative-slope, +height, operation, work-counter, and continued-store-growth checks. Whole +plateau acceptance still failed because the strict absolute consolidation +reset classifier remained invalid; that raw failure is retained and unwaived. + +No new work constant was introduced. At the executed production knobs, +$C/B/A=499/125/1{,}248$, public routing is $5C=2{,}495$, construction remains +$C+B=624$ nodes and $2B=250$ queue effort, and 126 is only the production +logical $B+1$ boundary. At neutral `.5/.5/.5`, $B=128$ and 129 remains only +the logical, unprocessed $B+1$ probe. The existing 27-point structural grid and +nine production-shaped F/S/T corpus ablations remain the cutover requirement; +this single production-knob attribution neither replaces them nor claims +activated-identity overlap, bounded restart, Durable plateau, or overall +completion. + +### Same-query recenter overlap + +An experiment-only measurement now runs the same consolidation embedding +through the retained SQLite HNSW route immediately before and after each +successful recenter. A pair is valid only when both route queries complete; +the profile records a distinct pair-valid field and failure code, and the +deterministic builder rejects every invalid pair. Direct consolidation-path +regression covers both a valid equal-set result and an invalid pre-query. +Both searches retain the production-derived $5C$ node ceiling and +$A=2C+2B$ activation target. Recenter timing excludes both observer queries, +the measurement is not part of the accepted performance clock, and it does +not change the production API or schema. + +In a regenerated 13,000-event Natural replay at $F/S/T=.45/.5/.5$, 22 +recenters had explicitly valid, zero-failure paired measurements and zero +profiled pairs were invalid. Fourteen occurred after activation reached the full $A=1{,}248$ +target, and late pairs visited the complete $5C=2{,}495$ node envelope. Every +pair nevertheless had overlap 1.0: zero recenters changed even one activated +identity for the same embedding. Thus HNSW is already executed on the shared +Natural/Durable path, but moving the current connection-local entry is not an +effective consolidation-driven activation-centroid reset under this route. + +This is a rejected lifecycle behavior, not an accepted cycle. The next +candidate must change the sparse activated centroid while keeping the result +at $A$, query work at $5C$, construction at $C+B$ nodes and $2B$ effort, and +all values derived from F/S/T. It must pass the 27 structural and nine exact +production-shaped knob ablations and remain modality/source-id agnostic. The +raw process-reset gate remains separate, failed, and unwaived. +At neutral `.5/.5/.5`, $B=128$; 129 is only the logical unprocessed $B+1$ +boundary and is never a fetched row or work budget. + +### Saturated fixed-envelope quality boundary + +The revised approximate-retrieval contract does not require an impossible +perfect score from every 512-query run. Each production-shaped run may contain +at most one exact top-1 miss ($511/512=0.998046875$), the nine-run aggregate +must remain at least 0.999, mean exact-identity recall@16 must remain at least +0.998, semantic coverage must remain at least 0.95, deterministic tie order is +still exact, and misses may not cluster by modality, source identifier, memory +age, or knob setting. Structural bounds, rollback, provenance, and ordering +invariants remain 100% requirements. + +A full-horizon saturation experiment then lowered only the private routing-node +envelope. At the production knobs $F=.45,S=T=.5$, $C=499$ and $B=125$. The +first point, $4C=1{,}996$, saturated below the mature route population and met +the revised top-1 gate with 511/512 matches, but it was rejected because +identity recall@16 was 0.997791, below 0.998. Semantic coverage was 0.997571. + +The next point added the already-derived reciprocal-update term +$R=\max(2,\lfloor B/16\rfloor)$, yielding $4C+R=2{,}003$. Matching both the +queue and actual-node ceilings at that value and retaining the separate +$A=2C+2B=1{,}248$ consolidation snapshot bounded total query rows by +$4C+R+A=3{,}251$. Over 15,695 packets and 512 controls it measured exact +top-1 0.998047, identity recall@16 0.998650, semantic coverage 0.998047, and +deterministic tie order. At neutral knobs the same formulas resolve to +$C=512$, $B=128$, $R=8$, a 2,056-row route, and $A=1{,}280$; 129 remains only +the logical, unprocessed $B+1$ boundary. + +This is a quality-passing single production-knob experiment, not a retained +algorithm or a bounded-engine result. Its 15,695-packet run took 206,060 ms, +with mean process time 4.912 ms, mean end-to-end time 12.824 ms, and 33 +consolidations. No audited suffix passed the whole contract: emotional-cascade, +commit, publication, and other operation slopes remained; the raw +post-consolidation process reset and trough-stability gates remained failed; +and the required nine-point aggregate, mixed-modality/source regression, +Durable run, and recursive review have not been completed. The experiment +therefore establishes only that the 100% per-run top-1 requirement hid a viable +saturated quality point; it does not establish the storage-cost cure. + +### Consolidation-reset routing-envelope experiments + +The first dynamic experiment used the saturated quality point above as its +post-consolidation floor. Consolidation reset both queue effort and actual-node +ceiling to $4C+R$, each retrieval-active query added +$R=\max(2,\lfloor B/16\rfloor)$, and both values saturated at the retained +$5C$ ceiling. The separate activation snapshot remained bounded by +$A=2C+2B$, so total query-row work remained at most $5C+A$. At the production +knobs this resolved to a 2,003-row floor, seven-row steps, a 2,495-row peak, +and a 3,743-row total ceiling; at neutral knobs it resolves to 2,056, eight, +2,560, and 3,840 rows. No source-id or modality condition participates in the +formula. + +The canonical 15,695-packet screen passed its 512-query quality control with +top-1 1.0, recall@16 0.998650, semantic coverage 0.998666, and deterministic +ties. It completed 34 consolidations in 204,822 ms. However, the corpus ended +while some route peaks were still warming, so a second diagnostic appended one +complete later owner-authorized Claude session using the identical extraction +rules. The combined input contained 30,380 real packets, with no trimming, +cycling, padding, or synthesis. This diagnostic completed 72 consolidations in +438,059 ms. Mature retrieval cycles reset on 30/30 evaluated edges and their +peak and trough half ratios were 0.9972 and 1.0003, but the normalized p95 +shape error was 0.3074. More importantly, quality fell to 507/512 top-1 +(0.990234), recall@16 0.977225, and semantic coverage 0.971084. All five top-1 +misses appeared in the late-history query quartile. The candidate therefore +fails the numeric and anti-clustering gates and is rejected; the canonical +corpus remains the acceptance corpus, and this owner-authorized extension is +only a maturity diagnostic. + +The smallest follow-up was preregistered before measurement. It retained the +proven $5C$ canonical floor, reset to that floor after consolidation, advanced +queue effort and node ceiling by $R$ per retrieval-active query, and saturated +at $6C$. Total query-row work was bounded by $6C+A$. Production values were a +2,495-row floor, seven-row step, 2,994-row peak, and 4,242-row total ceiling; +neutral values are 2,560, eight, 3,072, and 4,352 rows. The focused derivation +and reset regression passed 16 assertions, and all 116 storage-audit fixtures +passed after teaching the audit the new formula. + +The same 30,380-packet diagnostic completed 65 consolidations in 388,336 ms, +with 5.679 ms mean process time and 12.473 ms mean end-to-end time. Exact top-1 +was 512/512 and semantic coverage was 0.989234, but exact identity recall@16 +was only 0.992651. That is materially below the preregistered 0.998 floor, so +the candidate is rejected despite perfect top-1. Its mature retrieval-cycle +subcontract did pass: 24/24 cycles reset, peak and trough half ratios were +1.0000 and 0.9985, normalized p95 shape error was 0.1309, late-template error +was 0.0137, and no routing, queue, snapshot, combined-row, distance-coverage, +or activation bound was violated. Its shorter wall time than the lower-floor +run is not attributed to cheaper retrieval: the live time-based detector +requested seven fewer consolidations, and the run was not a fixed-schedule +throughput comparison. Neither dynamic envelope is retained as a production +algorithm, and neither result weakens the quality thresholds. The sanitized +decision record is `artifacts/flat_storage_cost/dynamic-retrieval-sawtooth-maturity-v1.json`. + +Because the 5C-to-6C candidate passed the complete mature-cycle shape contract +but failed only exact-neighbor recall, the next and only preregistered routing +point raises the floor by one $C$ while preserving the same one-$C$ amplitude. +It resets at $6C$, advances by $R=\max(2,\lfloor B/16\rfloor)$, and saturates at +$7C$; the separate snapshot remains $A$, so total query-row work is at most +$7C+A$. Production values are a 2,994-row floor, seven-row step, 3,493-row +peak, and 4,741-row total ceiling. Neutral values are 3,072, eight, 3,584, and +4,864 rows. The 30,380-packet result retained 511/512 top-1, semantic coverage +0.993569, and deterministic ties, but recall@16 was 0.995833 and therefore +failed the unchanged 0.998 gate. Its mature cycle passed with 23/23 resets, +peak/trough half ratios 1.0000/1.0003, p95 shape error 0.0222, late-template +error 0.0035, and no work-bound violation. It is rejected. + +The next floor ablation is preregistered at $7C$ to $8C$ with the same $R$ +step and separate $A$ snapshot. Production values are 3,493 floor, seven step, +3,992 peak, and 5,240 total rows; neutral values are 3,584, eight, 4,096, and +5,376. The maturity run achieved 511/512 top-1, recall@16 0.997672, semantic +coverage 0.996856, deterministic ties, 22/22 resets, p95 shape error 0.0230, +and no work-bound violations. Recall was 0.000328 below the unchanged gate, so +the candidate is rejected. + +The final adjacent floor point is preregistered at $8C$ to $9C$, again stepped +by $R$ with the separate $A$ snapshot. Production values are 3,992 floor, +seven step, 4,491 peak, and 5,739 total rows; neutral values are 4,096, eight, +4,608, and 5,888. The maturity run passed: top-1 was 511/512, recall@16 was +0.999265, semantic coverage was 0.998571, ties were deterministic, and four +opaque sources were represented. In the suffix beginning at event 18,380, +19/20 material cycles reset; peak and trough half ratios were 0.9991 and +0.9994, p95 shape error was 0.1908, late-template error was 0.0795, and no +routing, queue, snapshot, combined-row, distance-coverage, or activation bound +was violated. The canonical 15,695-packet acceptance run then passed quality +with 512/512 top-1, recall@16 1.0, semantic coverage 1.0, deterministic ties, +and four opaque sources. It completed 34 consolidations in 214,263 ms, with +5.233 ms mean process time and 13.334 ms mean end-to-end time. This shorter +corpus never reached the derived 3,992-row floor: maximum actual retrieval work +was 3,064 rows, so it contained no mature post-floor cycles and cannot +independently prove the sawtooth shape. Together the runs establish canonical +quality plus extended-history retrieval maturity, not a whole-engine cure. +The canonical audit still failed the whole-engine plateau: the largest +first-to-last-five timing increases were `GraphRetrieve.seed_knn_cache` +(1.217 to 2.496 ms) and supersession current/candidate loading (about 0.48 to +1.40 ms). At that point the nine-point aggregate, Durable path, hotspot +attribution, and production cutover were still pending; the next subsection +records their resolution and remaining limits. + +### Production-default 8C-to-9C cutover + +The accepted adjacent envelope was moved into the existing SQLite HNSW route +as the production default rather than added as another retrieval or write path. +With hooks disabled, the route now resets queue effort and actual-node ceiling +to $8C$ after a successful consolidation recenter, advances both by +$R=\max(2,\lfloor B/16\rfloor)$ per retrieval-active query, and saturates at +$9C$. The independent consolidation snapshot remains bounded by $A=2C+2B$, +so total fetched rows remain at most $9C+A$. Restart opens at the $9C$ ceiling +because the in-process ramp position is not durable. Historical private +selectors remain only as reproducibility controls; a regression requires the +former selector-24 formula to resolve identically to the production default. +No source-id or modality label participates in any formula, and Natural and +Durable still share the operation graph; Durable adds only its post-commit +checkpoint. + +A round-two rollback review found that the internal search used to build a +recenter snapshot could transiently advance the ramp before persistence. The +route now excludes recenter-building searches from the $R$ increment. A focused +failure-injection regression aborts the metadata update and proves that both +effort and node budget remain unchanged; successful recenter is still the only +path that resets them to $8C$. + +The no-selector 15,695-packet Natural replay at $F=.45,S=T=.5$ resolved +$C=499$, $B=125$, $A=1{,}248$, $R=7$, a 3,992-row floor, 4,491-row peak, and +5,739-row combined ceiling. It completed 34 consolidations in 203,522 ms, with +4.921 ms mean process time and 12.659 ms mean end-to-end time. Its 512 public +controls passed at 512/512 exact top-1, recall@16 1.0, semantic coverage 1.0, +deterministic ties, and four opaque source identifiers. Timing cannot be +compared causally with the earlier selector run because timestamps, live +consolidation incidence, and build identity differ. + +The production-default nine-point matrix replayed 4,000 packets sequentially +at midpoint, both joint endpoints, and each one-axis endpoint. All 4,608 of +4,608 controls matched exact top-1; minimum recall@16 and semantic coverage +were both 1.0; tie order was deterministic; and there were no misses to cluster +by modality, opaque source, memory age, or knob point. The focused 27-point +structural grid and bounded-backfill, metadata-open, core-knob, and +text/audio/image plus shared/opaque-source invariance regressions also passed. +All nine short routes were exercised, but none produced a valid mature +pre/post-activation pair: their active graphs remained below the 8C floor. The +aggregate therefore classifies them as quality-passing but recenter-unevaluated +rather than laundering warm-up into sawtooth evidence. The 30,380-packet run +above remains the mature-cycle proof. Sensitivity-high took 140,392 ms versus +37,522--67,511 ms for the other eight points and is retained as an adverse +measured result, not hidden by the perfect quality aggregate. + +The mature 8C-to-9C profile was also split into two non-overlapping late +halves. While the persistent store continued to grow, mean process time fell +from 8.918 to 7.858 ms. `GraphRetrieve.seed_knn_cache` fell from 2.914 to +2.397 ms and its per-node unit ratio was 0.789; supersession loading fell from +1.860 to 1.520 ms and its per-candidate unit ratio was 0.855. Emotional work +rose slightly per edge, but its total fell from 0.486 to 0.430 ms. This is +evidence that mature per-store work is not continuing to grow under the +bounded route. It does not convert the still-failing raw process-time reset +diagnostic into a pass: consolidation changes retrieval locality and its work +envelope, but it cannot force every following event to perform the same amount +of content-dependent write work. + +Finally, the real 2,016-message Durable corpus used the same no-selector +parameters and completed four consolidations in 79,481 ms, with 10.710 ms mean +process time and 39.024 ms mean end-to-end time. Its 512 controls again passed +at 512/512 top-1, recall@16 1.0, semantic coverage 1.0, deterministic ties, and +four opaque sources. The corpus cannot supply the required ten post-warmup +500-event windows, so this is shared-path, checkpoint, and quality evidence; +it is not a Durable plateau claim. The production cutover is therefore scoped +to the knob-derived retrieval envelope and shared operation path, not to +bounded whole-engine restart, production-wide latency, release, or deployment. + ## Standard Eviction-Frontier Estimate The standard file-backed pressure gate is 500,000,000 bytes. Exact databases diff --git a/examples/benchmark/chat_replay_live_run.cpp b/examples/benchmark/chat_replay_live_run.cpp index 8428e90e..026c8325 100644 --- a/examples/benchmark/chat_replay_live_run.cpp +++ b/examples/benchmark/chat_replay_live_run.cpp @@ -8,7 +8,11 @@ #include "../../src/encoder/text_encoder_factory.hpp" #include "../../src/operations/bounded_activation_shadow_internal.hpp" +#include "../../src/operations/active_signal_embedding_ring_internal.hpp" #include "../../src/operations/retrieval_trace_state.hpp" +#include "../../src/operations/rif_active_epoch_cache_internal.hpp" +#include "../../src/operations/sparse_retrieval_knobs_internal.hpp" +#include "../../src/operations/sparse_retrieval_route_sqlite_internal.hpp" #include @@ -27,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -76,6 +81,8 @@ struct Config fs::path packet_corpus; fs::path message_corpus; fs::path shadow_embedding_corpus; + fs::path export_shadow_embedding_corpus; + fs::path fixed_consolidation_indices; fs::path db_path = "build/chat_replay_live_run.sqlite"; fs::path output_path = "build/chat_replay_live_run_summary.json"; int skip_messages = 0; @@ -83,6 +90,8 @@ struct Config int max_packets = -1; int shadow_queries = 512; int shadow_result_k = 16; + int public_retrieval_queries = 512; + int public_retrieval_result_k = 16; int skip_packets = 0; int media_limit = 0; int consolidate_every = 0; @@ -101,6 +110,8 @@ struct Config bool resume_from_existing = false; bool profile_probes_only = false; bool shadow_quality_control = false; + bool public_retrieval_control = false; + bool opaque_source_control = false; bool checkpoint_eval_only = false; int progress_stride = 1000; std::uint64_t fixed_timestamp_base_ms = 0; @@ -119,6 +130,104 @@ struct Config std::string sqlite_profile = "realtime"; }; +nlohmann::json +SparseRouteParametersJson (const Config &cfg) +{ + const auto parameters = cortext::operations:: + sparse_retrieval_route_sqlite_internal::DeriveParameters ( + cfg.focus, cfg.sensitivity, cfg.stability); + return { + { "route_capacity", parameters.route_capacity }, + { "activation_identity_target", + parameters.activation_identity_target }, + { "activation_snapshot_capacity", + parameters.activation_snapshot_capacity }, + { "total_query_row_budget", parameters.total_query_row_budget }, + { "backfill_batch_size", parameters.backfill_batch_size }, + { "fallback_hydration_signal_limit", + cortext::operations::sparse_retrieval_knobs_internal:: + HydrationFallbackSignalLimit (cfg.focus, cfg.sensitivity, + cfg.stability) }, + { "bootstrap_limit", parameters.route_bootstrap_limit }, + { "search_node_budget", parameters.search_node_budget }, + { "activation_search_node_budget_min", + parameters.activation_search_node_budget_min }, + { "activation_search_node_budget_step", + parameters.activation_search_node_budget_step }, + { "search_expansion_batch", parameters.search_expansion_batch }, + { "search_effort", parameters.search_ef }, + { "activation_search_effort_min", + parameters.activation_search_ef_min }, + { "activation_search_effort_step", + parameters.activation_search_ef_step }, + { "shadow_cache_capacity", parameters.shadow_node_capacity }, + { "backfill_search_node_budget", + parameters.backfill_search_node_budget }, + { "backfill_search_effort", parameters.backfill_search_ef }, + { "graph_neighbor_count", parameters.row_addressed_neighbor_count }, + { "graph_level_zero_links", parameters.row_addressed_level_zero_links }, + { "family_exact_comparison_limit", + parameters.family_exact_comparison_limit }, + { "maximum_level", parameters.maximum_level }, + { "reciprocal_update_count", parameters.reciprocal_update_count }, + { "hnsw_construction_effort", parameters.hnsw.construction_effort }, + { "hnsw_query_effort", parameters.hnsw.query_effort }, + }; +} + +std::optional +ExperimentalSparseNodeEnvelopeFormula () +{ + const char *value + = std::getenv ("CORTEXT_EXPERIMENT_SQLITE_SPARSE_NODE_ENVELOPE"); + if (value == nullptr) + return std::nullopt; + const std::string selector (value); + if (selector == "1") + return "C"; + if (selector == "2") + return "A"; + if (selector == "3") + return "C+B"; + if (selector == "4") + return "2C"; + if (selector == "5") + return "5C"; + if (selector == "6") + return "6C"; + if (selector == "8") + return "4C"; + if (selector == "18") + return "4C+B/16"; + if (selector == "19") + return "fixed-4C+B/16"; + if (selector == "20") + return "4C+B/16-to-5C"; + if (selector == "21") + return "5C-to-6C-by-B/16"; + if (selector == "22") + return "6C-to-7C-by-B/16"; + if (selector == "23") + return "7C-to-8C-by-B/16"; + if (selector == "24") + return "8C-to-9C-by-B/16"; + if (selector == "10") + return "10C"; + if (selector == "12") + return "12C"; + if (selector == "16") + return "16C"; + return std::nullopt; +} + +void +RecordSparseRouteParameters (nlohmann::json &out, const Config &cfg) +{ + out["sparse_route_parameters"] = SparseRouteParametersJson (cfg); + if (const auto formula = ExperimentalSparseNodeEnvelopeFormula ()) + out["experimental_sparse_node_envelope_formula"] = *formula; +} + struct ShadowQualityModeMetadata { const char *role; @@ -1008,6 +1117,8 @@ WorkCountersJson (const cortext::Cortext::Context &ctx) = value ("MemoryStorage.supersession_current_rows_visited"); const double supersession_historical_rows = value ("MemoryStorage.supersession_historical_rows_visited"); + const double supersession_sparse_route_rows + = value ("MemoryStorage.supersession_sparse_route_node_rows"); return { { "retrieval_suppression_id_count", value ("SignalProcessor.retrieval_suppression_id_count") }, @@ -1021,7 +1132,8 @@ WorkCountersJson (const cortext::Cortext::Context &ctx) value ("GraphRetrieve.family_exact_comparison_count") }, { "graph_cache_rebuild_count", value ("GraphRetrieve.cache_rebuild_count") }, - { "graph_rows_visited", value ("GraphRetrieve.rows_visited") }, + { "graph_rows_visited", + value ("GraphRetrieve.rows_visited") }, { "competition_candidate_count", value ("Competition.candidate_count") }, { "competition_rows_visited", value ("Competition.rows_visited") }, @@ -1029,7 +1141,8 @@ WorkCountersJson (const cortext::Cortext::Context &ctx) { "supersession_current_candidate_count", supersession_current }, { "supersession_historical_candidate_count", supersession_historical }, { "supersession_rows_visited", - supersession_current_rows + supersession_historical_rows }, + supersession_current_rows + supersession_historical_rows + + supersession_sparse_route_rows }, { "emotional_source_count", value ("EmotionalCascade.source_count") }, { "emotional_neighbor_count", value ("EmotionalCascade.neighbor_count") }, { "emotional_update_count", value ("EmotionalCascade.update_count") }, @@ -1048,6 +1161,18 @@ RequiredOperationCounter (const cortext::Cortext::Context &ctx, return static_cast (value->second); } +double +OperationValue (const cortext::Cortext::Context &ctx, + const std::string &name) +{ + const auto value = ctx.output.operation_ms.find (name); + if (value == ctx.output.operation_ms.end ()) + return 0.0; + if (!std::isfinite (value->second) || value->second < 0.0) + throw std::runtime_error ("invalid operation value: " + name); + return value->second; +} + nlohmann::json ConsolidationEpochCountersJson (const cortext::Cortext::Context &ctx, const std::string &prefix) @@ -1081,6 +1206,9 @@ ActiveEpochCountersJson (const cortext::Cortext::Context &ctx) { "allocated_bytes", RequiredOperationCounter ( ctx, "SignalProcessor.rif_active_epoch_allocated_bytes") }, + { "row_batch_high_water", + RequiredOperationCounter ( + ctx, "SignalProcessor.rif_active_epoch_row_batch_high_water") }, { "required", RequiredOperationCounter ( ctx, "SignalProcessor.rif_active_epoch_required") == 1.0 }, @@ -1846,8 +1974,16 @@ ParseArgs (int argc, char **argv) cfg.message_corpus = require_value (); else if (arg == "--shadow-embedding-corpus") cfg.shadow_embedding_corpus = require_value (); + else if (arg == "--export-shadow-embedding-corpus") + cfg.export_shadow_embedding_corpus = require_value (); + else if (arg == "--fixed-consolidation-indices") + cfg.fixed_consolidation_indices = require_value (); else if (arg == "--shadow-quality-control") cfg.shadow_quality_control = true; + else if (arg == "--public-retrieval-control") + cfg.public_retrieval_control = true; + else if (arg == "--opaque-source-control") + cfg.opaque_source_control = true; else if (arg == "--db") cfg.db_path = require_value (); else if (arg == "--out") @@ -1860,6 +1996,10 @@ ParseArgs (int argc, char **argv) cfg.shadow_queries = std::stoi (require_value ()); else if (arg == "--shadow-result-k") cfg.shadow_result_k = std::stoi (require_value ()); + else if (arg == "--public-retrieval-queries") + cfg.public_retrieval_queries = std::stoi (require_value ()); + else if (arg == "--public-retrieval-result-k") + cfg.public_retrieval_result_k = std::stoi (require_value ()); else if (arg == "--skip-packets") cfg.skip_packets = std::stoi (require_value ()); else if (arg == "--skip-messages") @@ -1961,6 +2101,9 @@ ParseArgs (int argc, char **argv) else throw std::runtime_error ("unknown argument: " + arg); } + if (!std::isfinite (cfg.focus) || !std::isfinite (cfg.sensitivity) + || !std::isfinite (cfg.stability)) + throw std::runtime_error ("--focus/--sensitivity/--stability must be finite"); return cfg; } @@ -2109,8 +2252,13 @@ ReadShadowQueryProvenance (const fs::path &database_path, raw_database, sqlite3_close); sqlite3_stmt *raw_statement = nullptr; constexpr const char *query - = "SELECT embedding_id, source_id, modality FROM signals " - "WHERE embedding_id IS NOT NULL ORDER BY timestamp, signal_id"; + = "SELECT m.memory_id, " + " COALESCE(s.source_id, m.source_id) AS source_id, " + " COALESCE(s.modality, m.modality) AS modality " + "FROM memories m " + "LEFT JOIN signals s ON s.memory_id = m.memory_id " + "WHERE m.kind = 'LONG_TERM' " + "ORDER BY m.start_ts, m.memory_id, s.serial_position, s.signal_id"; if (sqlite3_prepare_v2 (database.get (), query, -1, &raw_statement, nullptr) != SQLITE_OK) throw std::runtime_error ("failed to query shadow provenance database: " @@ -2118,12 +2266,12 @@ ReadShadowQueryProvenance (const fs::path &database_path, std::unique_ptr statement ( raw_statement, sqlite3_finalize); - std::unordered_map by_embedding; + std::unordered_map by_identity; int step = SQLITE_ROW; std::size_t history_ordinal = 0; while ((step = sqlite3_step (statement.get ())) == SQLITE_ROW) { - const auto embedding_id = sqlite3_column_int64 (statement.get (), 0); + const auto memory_id = sqlite3_column_int64 (statement.get (), 0); const auto *source = reinterpret_cast ( sqlite3_column_text (statement.get (), 1)); const auto *modality = reinterpret_cast ( @@ -2131,12 +2279,12 @@ ReadShadowQueryProvenance (const fs::path &database_path, if (source == nullptr || modality == nullptr) throw std::runtime_error ( "shadow provenance contains a null source or modality"); - auto &entry = by_embedding[embedding_id]; - entry.history_ordinal - = std::min (entry.history_ordinal, history_ordinal); + auto [found, inserted] = by_identity.try_emplace (memory_id); + auto &entry = found->second; + if (inserted) + entry.history_ordinal = history_ordinal++; entry.source_id_digests.push_back (PrivateValueDigest (source)); entry.modalities.emplace_back (modality); - ++history_ordinal; } if (step != SQLITE_DONE) throw std::runtime_error ("failed while reading shadow provenance: " @@ -2144,13 +2292,13 @@ ReadShadowQueryProvenance (const fs::path &database_path, std::vector result; result.reserve (corpus.ids.size ()); - for (const auto embedding_id : corpus.ids) + for (const auto memory_id : corpus.ids) { - auto found = by_embedding.find (embedding_id); - if (found == by_embedding.end ()) + auto found = by_identity.find (memory_id); + if (found == by_identity.end ()) throw std::runtime_error ( - "shadow embedding lacks authoritative signal provenance: " - + std::to_string (embedding_id)); + "shadow retrieval surface lacks authoritative provenance: " + + std::to_string (memory_id)); auto provenance = found->second; provenance.history_count = history_ordinal; for (auto *values : { &provenance.source_id_digests, @@ -2578,6 +2726,75 @@ RunShadowEmbeddingQuality (const Config &cfg) return 0; } +int +ExportShadowEmbeddingCorpus (const Config &cfg) +{ + if (cfg.db_path.empty () || !fs::exists (cfg.db_path)) + throw std::runtime_error ( + "shadow embedding export requires an existing --db"); + auto store = cortext::SQLiteStore::Create (cfg.db_path.string ()); + const auto rows = store->Execute ( + "SELECT cme.memory_id AS identity, cme.embedding " + "FROM current_memory_embeddings cme " + "JOIN memories m ON m.memory_id = cme.memory_id " + "WHERE m.kind = 'LONG_TERM' " + "ORDER BY cme.memory_id"); + if (rows.empty ()) + throw std::runtime_error ("shadow embedding export found no embeddings"); + + std::ofstream stream (cfg.export_shadow_embedding_corpus, + std::ios::binary | std::ios::trunc); + if (!stream) + throw std::runtime_error ("failed to create shadow embedding corpus: " + + cfg.export_shadow_embedding_corpus.string ()); + const std::uint64_t count = rows.size (); + std::uint32_t dimension = 0; + std::vector>> records; + records.reserve (rows.size ()); + for (const auto &row : rows) + { + const auto id_it = row.find ("identity"); + const auto embedding_it = row.find ("embedding"); + if (id_it == row.end () || embedding_it == row.end ()) + throw std::runtime_error ( + "shadow embedding export row lacks identity or embedding"); + const auto id = cortext::store::AnyToLongLong (id_it->second); + auto bytes = cortext::store::BlobFromAny (embedding_it->second); + if (!id || *id <= 0 || bytes.empty () + || bytes.size () % sizeof (float) != 0) + throw std::runtime_error ("shadow embedding export row is invalid"); + const auto row_dimension + = static_cast (bytes.size () / sizeof (float)); + if (dimension == 0) + dimension = row_dimension; + if (row_dimension != dimension) + throw std::runtime_error ( + "shadow embedding export dimensions are inconsistent"); + records.emplace_back (*id, std::move (bytes)); + } + stream.write (reinterpret_cast (&count), sizeof (count)); + stream.write (reinterpret_cast (&dimension), + sizeof (dimension)); + for (const auto &[id, bytes] : records) + { + stream.write (reinterpret_cast (&id), sizeof (id)); + stream.write (reinterpret_cast (bytes.data ()), + static_cast (bytes.size ())); + } + if (!stream) + throw std::runtime_error ("failed while writing shadow embedding corpus"); + std::cout << nlohmann::json ( + { { "schema", "cortext_retrieval_surface_export_v2" }, + { "identity_kind", "long-term-memory-id" }, + { "population", "current-long-term-memory-embedding-surface" }, + { "embedding_count", count }, + { "embedding_dimension", dimension }, + { "output", cfg.export_shadow_embedding_corpus.string () } }) + .dump (2) + << "\n"; + return 0; +} + int RunPacketCorpusProfile (const Config &cfg, const nlohmann::json &sqlite_profile) @@ -2612,10 +2829,64 @@ RunPacketCorpusProfile (const Config &cfg, cfg.max_packets); if (packets.empty ()) throw std::runtime_error ("corpus contains no events"); + if (!cfg.fixed_consolidation_indices.empty () + && cfg.honor_required_consolidation) + throw std::runtime_error ( + "--fixed-consolidation-indices and --honor-required-consolidation are mutually exclusive"); + std::vector fixed_consolidation_indices; + std::unordered_set fixed_consolidation_index_set; + if (!cfg.fixed_consolidation_indices.empty ()) + { + std::ifstream stream (cfg.fixed_consolidation_indices); + if (!stream) + throw std::runtime_error ( + "failed to open fixed consolidation indices"); + nlohmann::json encoded; + stream >> encoded; + if (!encoded.is_array ()) + throw std::runtime_error ( + "fixed consolidation indices must be a JSON array"); + fixed_consolidation_indices.reserve (encoded.size ()); + for (const auto &value : encoded) + { + if (!value.is_number_unsigned () && !value.is_number_integer ()) + throw std::runtime_error ( + "fixed consolidation indices must be positive integers"); + const auto index = value.get (); + if (index <= 0 + || static_cast (index) > packets.size ()) + throw std::runtime_error ( + "fixed consolidation index is outside the replay"); + const auto normalized = static_cast (index); + if (!fixed_consolidation_index_set.insert (normalized).second) + throw std::runtime_error ( + "fixed consolidation indices must be unique"); + fixed_consolidation_indices.push_back (normalized); + } + if (!std::is_sorted (fixed_consolidation_indices.begin (), + fixed_consolidation_indices.end ())) + throw std::runtime_error ( + "fixed consolidation indices must be strictly increasing"); + } + if (cfg.public_retrieval_control + && (cfg.public_retrieval_queries <= 0 + || cfg.public_retrieval_result_k <= 0 + || static_cast (cfg.public_retrieval_queries) + > packets.size ())) + throw std::runtime_error ( + "public retrieval query count must fit the nonempty replay and result k must be positive"); + if (cfg.opaque_source_control && !cfg.public_retrieval_control) + throw std::runtime_error ( + "opaque source control requires public retrieval control"); SetEnvValue ("CORTEXT_PROFILE_WORK_COUNTERS", "1", true); SetEnvValue ("CORTEXT_PROFILE_CONSOLIDATION_EPOCH", "1", true); SetEnvValue ("CORTEXT_PROFILE_EMOTIONAL_CASCADE", "1", true); + if (cfg.public_retrieval_control) + { + SetEnvValue ("CORTEXT_CAPTURE_RETRIEVAL_SEEDS", "1", true); + SetEnvValue ("CORTEXT_CAPTURE_HNSW_EXACT_CONTROL", "1", true); + } SetEnvValue ("CORTEXT_PROFILE_GRAPH_RETRIEVAL", "1", false); cortext::Cortext::Config cortext_cfg; @@ -2629,12 +2900,21 @@ RunPacketCorpusProfile (const Config &cfg, auto engine = cortext::Cortext::Create ( cortext_cfg, cfg.db_path.string (), std::move (replay_clock)); - constexpr std::array kSelectedOperations { + constexpr std::array kSelectedOperations { "cortext::operations::GraphAugmentedRetrieveCandidates", "GraphRetrieve.total", "GraphRetrieve.family_index", "GraphRetrieve.seed_cache_family_compare", "GraphRetrieve.seed_cache_distance", + "GraphRetrieve.sqlite_sparse_route_activated_identities", + "GraphRetrieve.sqlite_sparse_route_node_rows", + "GraphRetrieve.sqlite_sparse_route_activation_snapshot_rows", + "GraphRetrieve.sqlite_sparse_route_distance_evaluations", + "GraphRetrieve.sqlite_sparse_route_search_effort", + "GraphRetrieve.sqlite_sparse_route_search_node_budget", + "GraphRetrieve.sqlite_sparse_route_restart_rows", + "GraphRetrieve.sqlite_sparse_route_dirty_rows", + "GraphRetrieve.seed_sparse_route_active", "GraphRetrieve.seed_knn_cache", "GraphRetrieve.seed_processor_surface", "GraphRetrieve.seed_knn_cache_rebuild", @@ -2654,6 +2934,9 @@ RunPacketCorpusProfile (const Config &cfg, "MemoryStorage.supersession_historical_candidate_execution_count", "MemoryStorage.supersession_current_rows_visited", "MemoryStorage.supersession_historical_rows_visited", + "MemoryStorage.supersession_sparse_route_node_rows", + "MemoryStorage.supersession_sparse_route_distance_evaluations", + "MemoryStorage.supersession_sparse_route_dirty_rows", "MemoryStorage.supersession_sql_fallback_count", "cortext::operations::PropagateEmotionalCascade", "EmotionalCascade.source_execution_count", @@ -2663,27 +2946,102 @@ RunPacketCorpusProfile (const Config &cfg, "SignalProcessor.snapshot_full_cache_copy", "SignalProcessor.snapshot_cache_entry_copy", "SignalProcessor.commit_transaction", + "SignalProcessor.profile_mutation_audit", "SignalProcessor.retrieval_suppression_id_count", + "SignalProcessor.retrieval_suppression_id_activity", "SignalProcessor.predictive_id_count", + "SignalProcessor.predictive_id_activity", "SignalProcessor.snapshot_full_cache_copy_count", + "SignalProcessor.snapshot_full_cache_copy_activity", "SignalProcessor.snapshot_cache_entry_copy_count", + "SignalProcessor.snapshot_cache_entry_copy_activity", "GraphRetrieve.candidate_count", + "GraphRetrieve.candidate_activity", "GraphRetrieve.family_exact_comparison_count", + "GraphRetrieve.family_exact_comparison_activity", "GraphRetrieve.cache_rebuild_count", + "GraphRetrieve.cache_rebuild_activity", "GraphRetrieve.rows_visited", + "GraphRetrieve.rows_visited_activity", "Competition.candidate_count", + "Competition.candidate_activity", "Competition.rows_visited", + "Competition.rows_visited_activity", "Competition.rows_touched", + "Competition.rows_touched_activity", "MemoryStorage.supersession_current_candidate_count", + "MemoryStorage.supersession_current_candidate_activity", "MemoryStorage.supersession_historical_candidate_count", + "MemoryStorage.supersession_historical_candidate_activity", + "MemoryStorage.supersession_rows_visited_activity", "EmotionalCascade.source_count", + "EmotionalCascade.source_activity", "EmotionalCascade.neighbor_count", + "EmotionalCascade.neighbor_activity", "EmotionalCascade.update_count", + "EmotionalCascade.update_activity", + "WriteGate.flush_trigger", + "WriteGate.spike_bypass", + "WriteGate.accumulator_available", + "WriteGate.n_signals", + "WriteGate.coverage", + "WriteGate.window_score", + "WriteGate.threshold_dynamic", + "WriteGate.refractory_multiplier", + "WriteGate.write_scale", + "WriteGate.effective_threshold", + "WriteGate.score_margin", + "WriteGate.force_write", + "WriteGate.write_accumulator", + "WriteGate.reason_code", + "SignalProcessor.sqlite_sparse_route_recenter_overlap_profiled", + "SignalProcessor.sqlite_sparse_route_recenter_overlap_pair_valid", + "SignalProcessor.sqlite_sparse_route_recenter_overlap_failure_code", + "SignalProcessor.sqlite_sparse_route_recenter_derived_centroid", + "SignalProcessor.sqlite_sparse_route_recenter_centroid_source", + "SignalProcessor.sqlite_sparse_route_recenter_centroid_cluster_count", + "SignalProcessor.sqlite_sparse_route_recenter_centroid_member_count", + "SignalProcessor.sqlite_sparse_route_recenter_pre_activated_count", + "SignalProcessor.sqlite_sparse_route_recenter_post_activated_count", + "SignalProcessor.sqlite_sparse_route_recenter_overlap_count", + "SignalProcessor.sqlite_sparse_route_recenter_pre_node_count", + "SignalProcessor.sqlite_sparse_route_recenter_post_node_count", }; nlohmann::json rows = nlohmann::json::array (); nlohmann::json consolidation_events = nlohmann::json::array (); nlohmann::json store_checkpoints = nlohmann::json::array (); + nlohmann::json public_retrieval_observations + = nlohmann::json::array (); + nlohmann::json public_surface_mutations = nlohmann::json::array (); + cortext::operations::retrieval_trace::SetSurfaceMutationCaptureEnabled ( + cfg.public_retrieval_control); + const auto append_surface_mutations + = [&] (std::size_t event_index, std::uint64_t timestamp, + const char *phase) { + for (const auto &mutation : cortext::operations::retrieval_trace:: + GetSurfaceMutations ()) + { + nlohmann::json row = { + { "event_index", event_index }, + { "event_phase", phase }, + { "event_timestamp", timestamp }, + { "action", + mutation.action + == cortext::operations::retrieval_trace:: + SurfaceMutation::Action::Upsert + ? "upsert" + : "remove" }, + { "memory_id", mutation.memory_id }, + { "embedding_id", mutation.embedding_id }, + }; + if (mutation.action + == cortext::operations::retrieval_trace::SurfaceMutation:: + Action::Upsert) + row["embedding"] = mutation.embedding; + public_surface_mutations.push_back (std::move (row)); + } + }; const std::size_t checkpoint_stride = message_mode ? 100U : 500U; const std::size_t leading_checkpoint = packets.size () % checkpoint_stride; @@ -2708,22 +3066,133 @@ RunPacketCorpusProfile (const Config &cfg, std::chrono::system_clock::now ().time_since_epoch ()) .count ()); EventDoc doc { - static_cast (index), timestamp, "profile/corpus", "text", + static_cast (index), timestamp, + cfg.opaque_source_control + ? "profile/source/" + std::to_string (index % 4) + : "profile/corpus", + "text", packets[index], }; - auto ctx = cfg.fixed_timestamp_base_ms > 0 - ? engine->ProcessTextAt (packets[index], doc.source_id, - timestamp, cfg.retention) - : engine->ProcessText (packets[index], doc.source_id, - cfg.retention); + if (cfg.public_retrieval_control) + cortext::operations::retrieval_trace::ClearSurfaceMutations (); + auto ctx = cfg.public_retrieval_control + ? cortext::internal::ReplayIngress::ProcessTextAt ( + *engine, packets[index], doc.source_id, timestamp, + cfg.retention, true) + : (cfg.fixed_timestamp_base_ms > 0 + ? engine->ProcessTextAt ( + packets[index], doc.source_id, timestamp, + cfg.retention) + : engine->ProcessText ( + packets[index], doc.source_id, + cfg.retention)); + if (cfg.public_retrieval_control) + { + const auto append_ranked = [&] (const auto &candidates) { + nlohmann::json ranked = nlohmann::json::array (); + const std::size_t limit = std::min ( + candidates.size (), static_cast ( + cfg.public_retrieval_result_k)); + for (std::size_t rank = 0; rank < limit; ++rank) + ranked.push_back ( + { { "memory_id", candidates[rank].memory_id }, + { "embedding_id", candidates[rank].embedding_id }, + { "score", candidates[rank].score }, + { "rank", rank } }); + return ranked; + }; + nlohmann::json public_ranked = nlohmann::json::array (); + const std::size_t public_limit = std::min ( + ctx.retrieved_memory.size (), static_cast ( + cfg.public_retrieval_result_k)); + for (std::size_t rank = 0; rank < public_limit; ++rank) + public_ranked.push_back ( + { { "memory_id", ctx.retrieved_memory[rank].id }, + { "score", ctx.retrieved_memory[rank].composite_score }, + { "rank", rank } }); + auto seed_ranked = append_ranked ( + cortext::operations::retrieval_trace:: + GetLastSeedCandidates ()); + const auto &exact_seed_candidates + = cortext::operations::retrieval_trace:: + GetLastExactSeedCandidates (); + const bool candidate_available + = !exact_seed_candidates.empty (); + auto exact_seed_ranked + = candidate_available + ? append_ranked (exact_seed_candidates) + : nlohmann::json (seed_ranked); + double semantic_coverage = 0.0; + bool deterministic_tie_order = true; + if (candidate_available && !exact_seed_candidates.empty ()) + { + std::unordered_map + candidate_positions; + const auto &candidate_seed_candidates + = cortext::operations::retrieval_trace:: + GetLastSeedCandidates (); + for (std::size_t rank = 0; + rank < candidate_seed_candidates.size (); ++rank) + candidate_positions.emplace ( + candidate_seed_candidates[rank].memory_id, rank); + std::optional previous_common_rank; + std::size_t exact_hits = 0; + for (const auto &control_candidate : exact_seed_candidates) + { + const auto found = candidate_positions.find ( + control_candidate.memory_id); + if (found == candidate_positions.end ()) + continue; + ++exact_hits; + if (previous_common_rank + && found->second <= *previous_common_rank) + deterministic_tie_order = false; + previous_common_rank = found->second; + } + semantic_coverage + = static_cast (exact_hits) + / static_cast ( + exact_seed_candidates.size ()); + } + if (!seed_ranked.empty ()) + public_retrieval_observations.push_back ( + { { "event_index", index }, + { "query_timestamp", timestamp }, + { "source_id_blake3", + PrivateValueDigest (doc.source_id) }, + { "modality", doc.modality }, + { "query_embedding", ctx.embedding }, + { "control_seed_ranked", + std::move (exact_seed_ranked) }, + { "candidate_seed_ranked", + candidate_available + ? std::move (seed_ranked) + : nlohmann::json::array () }, + { "control_graph_ranked", + append_ranked ( + cortext::operations::retrieval_trace:: + GetLastRankedCandidates ()) }, + { "control_public_ranked", std::move (public_ranked) }, + { "candidate_available", candidate_available }, + { "semantic_coverage", semantic_coverage }, + { "deterministic_tie_order", + deterministic_tie_order } }); + append_surface_mutations (index, timestamp, "process"); + } process_ms_total += ctx.process_ms; total_ms_total += ctx.total_ms; double event_consolidation_ms = 0.0; std::optional consolidation_event; - if (cfg.honor_required_consolidation - && ctx.consolidation_state == cortext::ConsolidationState::Required) + const bool fixed_consolidation + = fixed_consolidation_index_set.contains (index + 1); + if (fixed_consolidation + || (cfg.honor_required_consolidation + && ctx.consolidation_state + == cortext::ConsolidationState::Required)) { + if (cfg.public_retrieval_control) + cortext::operations::retrieval_trace::ClearSurfaceMutations (); const auto consolidation_start = std::chrono::steady_clock::now (); auto consolidation_ctx = engine->Consolidate (); const double consolidation_ms = std::chrono::duration< @@ -2736,6 +3205,8 @@ RunPacketCorpusProfile (const Config &cfg, consolidation_event = { { "event_index", index }, { "closing_event_index", index }, + { "one_based_event_index", index + 1 }, + { "fixed_schedule", fixed_consolidation }, { "consolidation_epoch_id", RequiredOperationCounter ( consolidation_ctx, @@ -2758,6 +3229,135 @@ RunPacketCorpusProfile (const Config &cfg, consolidation_ctx, "ConsolidationEpoch.sealed_mutation_identity_count") }, { "duration_ms", consolidation_ms }, + { "operation_ms", + OperationTimingsJson ( + consolidation_ctx.output.operation_ms) }, + { "retrieval_surface_reload_ms", + OperationValue ( + consolidation_ctx, + "SignalProcessor.reload_retrieval_surface") }, + { "sparse_route_seal_ms", + OperationValue (consolidation_ctx, + "SignalProcessor.sparse_route_seal") }, + { "sparse_route_seal_delta_count", + OperationValue ( + consolidation_ctx, + "SignalProcessor.sparse_route_seal_delta_count") }, + { "sparse_route_seal_succeeded", + OperationValue ( + consolidation_ctx, + "SignalProcessor.sparse_route_seal_succeeded") == 1.0 }, + { "sqlite_sparse_route_seal_ms", + OperationValue ( + consolidation_ctx, + "SignalProcessor.sqlite_sparse_route_seal") }, + { "sqlite_sparse_route_seal_delta_count", + OperationValue ( + consolidation_ctx, + "SignalProcessor.sqlite_sparse_route_seal_delta_count") }, + { "sqlite_sparse_route_seal_succeeded", + OperationValue ( + consolidation_ctx, + "SignalProcessor.sqlite_sparse_route_seal_succeeded") + == 1.0 }, + { "sqlite_sparse_route_seal_failure_code", + OperationValue ( + consolidation_ctx, + "SignalProcessor.sqlite_sparse_route_seal_failure_code") }, + { "sqlite_sparse_route_recenter_ms", + OperationValue ( + consolidation_ctx, + "SignalProcessor.sqlite_sparse_route_recenter") }, + { "sqlite_sparse_route_recenter_succeeded", + OperationValue ( + consolidation_ctx, + "SignalProcessor.sqlite_sparse_route_recenter_succeeded") + == 1.0 }, + { "sqlite_sparse_route_recenter_derived_centroid", + OperationValue ( + consolidation_ctx, + "SignalProcessor.sqlite_sparse_route_recenter_derived_centroid") + == 1.0 }, + { "sqlite_sparse_route_recenter_centroid_source", + OperationValue ( + consolidation_ctx, + "SignalProcessor.sqlite_sparse_route_recenter_centroid_source") }, + { "sqlite_sparse_route_recenter_centroid_cluster_count", + OperationValue ( + consolidation_ctx, + "SignalProcessor.sqlite_sparse_route_recenter_centroid_cluster_count") }, + { "sqlite_sparse_route_recenter_centroid_member_count", + OperationValue ( + consolidation_ctx, + "SignalProcessor.sqlite_sparse_route_recenter_centroid_member_count") }, + { "sqlite_sparse_route_recenter_overlap_profiled", + OperationValue ( + consolidation_ctx, + "SignalProcessor.sqlite_sparse_route_recenter_overlap_profiled") + == 1.0 }, + { "sqlite_sparse_route_recenter_overlap_pair_valid", + OperationValue ( + consolidation_ctx, + "SignalProcessor.sqlite_sparse_route_recenter_overlap_pair_valid") + == 1.0 }, + { "sqlite_sparse_route_recenter_overlap_failure_code", + OperationValue ( + consolidation_ctx, + "SignalProcessor.sqlite_sparse_route_recenter_overlap_failure_code") }, + { "sqlite_sparse_route_recenter_pre_activated_count", + OperationValue ( + consolidation_ctx, + "SignalProcessor.sqlite_sparse_route_recenter_pre_activated_count") }, + { "sqlite_sparse_route_recenter_post_activated_count", + OperationValue ( + consolidation_ctx, + "SignalProcessor.sqlite_sparse_route_recenter_post_activated_count") }, + { "sqlite_sparse_route_recenter_overlap_count", + OperationValue ( + consolidation_ctx, + "SignalProcessor.sqlite_sparse_route_recenter_overlap_count") }, + { "sqlite_sparse_route_recenter_pre_node_count", + OperationValue ( + consolidation_ctx, + "SignalProcessor.sqlite_sparse_route_recenter_pre_node_count") }, + { "sqlite_sparse_route_recenter_post_node_count", + OperationValue ( + consolidation_ctx, + "SignalProcessor.sqlite_sparse_route_recenter_post_node_count") }, + { "sqlite_sparse_route_activation_search_effort", + OperationValue ( + consolidation_ctx, + "SignalProcessor.sqlite_sparse_route_activation_search_effort") }, + { "sqlite_sparse_route_activation_node_budget", + OperationValue ( + consolidation_ctx, + "SignalProcessor.sqlite_sparse_route_activation_node_budget") }, + { "sqlite_sparse_route_backfill_ms", + OperationValue ( + consolidation_ctx, + "SignalProcessor.sqlite_sparse_route_backfill") }, + { "sqlite_sparse_route_backfill_rows", + OperationValue ( + consolidation_ctx, + "SignalProcessor.sqlite_sparse_route_backfill_rows") }, + { "sqlite_sparse_route_backfill_published", + OperationValue ( + consolidation_ctx, + "SignalProcessor.sqlite_sparse_route_backfill_published") + == 1.0 }, + { "sqlite_sparse_route_backfill_succeeded", + OperationValue ( + consolidation_ctx, + "SignalProcessor.sqlite_sparse_route_backfill_succeeded") + == 1.0 }, + { "sqlite_sparse_route_backfill_failure_code", + OperationValue ( + consolidation_ctx, + "SignalProcessor.sqlite_sparse_route_backfill_failure_code") }, + { "sqlite_sparse_route_backfill_failure_count", + OperationValue ( + consolidation_ctx, + "SignalProcessor.sqlite_sparse_route_backfill_failure_count") }, { "pre_reset_counters", ConsolidationEpochCountersJson ( consolidation_ctx, "ConsolidationEpoch.pre") }, @@ -2771,6 +3371,8 @@ RunPacketCorpusProfile (const Config &cfg, consolidation_ctx.consolidation_state) }, }; consolidation_events.push_back (*consolidation_event); + if (cfg.public_retrieval_control) + append_surface_mutations (index, timestamp, "consolidation"); } const auto event_ended = std::chrono::steady_clock::now (); if (!cfg.no_profile_rows) @@ -2861,16 +3463,37 @@ RunPacketCorpusProfile (const Config &cfg, out["focus"] = cfg.focus; out["sensitivity"] = cfg.sensitivity; out["stability"] = cfg.stability; + RecordSparseRouteParameters (out, cfg); out["sqlite_profile"] = sqlite_profile; out["full_operation_ms"] = true; out["behavior_oracle"] = true; out["profile_rows_enabled"] = !cfg.no_profile_rows; out["honor_required_consolidation"] = cfg.honor_required_consolidation; + out["fixed_consolidation_indices"] = fixed_consolidation_indices; + out["consolidation_schedule_policy"] + = fixed_consolidation_indices.empty () + ? (cfg.honor_required_consolidation + ? "live-required-hint" + : "none") + : "fixed-one-based-control-derived-indices"; + const auto active_epoch_limits + = cortext::operations::rif_active_epoch_cache_internal::DeriveLimits ( + cfg.focus, cfg.sensitivity, cfg.stability); out["active_epoch_limits"] = { - { "event_count", 512 }, - { "mutation_count", 32768 }, - { "allocated_bytes", 64ULL * 1024ULL * 1024ULL }, + { "event_count", active_epoch_limits.event_count }, + { "mutation_count", active_epoch_limits.mutation_count }, + { "allocated_bytes", active_epoch_limits.allocated_bytes }, + { "row_batch_size", active_epoch_limits.row_batch_size }, + }; + out["active_signal_embedding_ring"] = { + { "capacity", + cortext::operations::active_signal_embedding_ring_internal::Capacity ( + cfg.focus, cfg.sensitivity, cfg.stability) }, + { "capacity_formula", "round(64 + 64F + 32S + 32T)" }, + { "authority", "persistent SQLite bounded exact-vector snapshot" }, + { "source_id_branching", false }, + { "modality_branching", false }, }; out["fixed_timestamp_base_ms"] = cfg.fixed_timestamp_base_ms; out["fixed_timestamp_step_ms"] = cfg.fixed_timestamp_step_ms; @@ -2885,6 +3508,165 @@ RunPacketCorpusProfile (const Config &cfg, = "end-anchored complete-window boundaries captured outside per-event timing"; out["store_checkpoints"] = std::move (store_checkpoints); out["peak_rss_mb"] = PeakRssMb (); + if (cfg.public_retrieval_control) + { + if (public_retrieval_observations.size () + < static_cast (cfg.public_retrieval_queries)) + throw std::runtime_error ( + "public retrieval replay produced too few retrieval-active events"); + std::vector selected_observations; + selected_observations.reserve ( + static_cast (cfg.public_retrieval_queries)); + for (int query = 0; query < cfg.public_retrieval_queries; ++query) + { + const std::size_t observation + = cfg.public_retrieval_queries == 1 + ? public_retrieval_observations.size () - 1 + : static_cast ( + static_cast (query) + * static_cast ( + public_retrieval_observations.size () - 1) + / static_cast ( + cfg.public_retrieval_queries - 1)); + selected_observations.push_back (observation); + } + const auto ensure_sample_value = [&] (const char *field, + const std::string &value) { + const auto selected_has_value = [&] { + return std::any_of ( + selected_observations.begin (), selected_observations.end (), + [&] (std::size_t observation) { + return public_retrieval_observations[observation] + .value (field, std::string{}) + == value; + }); + }; + if (selected_has_value ()) + return; + const auto target = std::find_if ( + public_retrieval_observations.begin (), + public_retrieval_observations.end (), [&] (const auto &row) { + return row.value (field, std::string{}) == value; + }); + if (target == public_retrieval_observations.end ()) + return; + const auto target_index = static_cast ( + std::distance (public_retrieval_observations.begin (), target)); + if (std::find (selected_observations.begin (), + selected_observations.end (), target_index) + != selected_observations.end ()) + return; + + std::unordered_map modality_counts; + std::unordered_map source_counts; + for (const auto observation : selected_observations) + { + const auto &row = public_retrieval_observations[observation]; + ++modality_counts[row.value ("modality", std::string{})]; + ++source_counts[row.value ("source_id_blake3", std::string{})]; + } + std::size_t replace_position = selected_observations.size (); + std::size_t best_distance = std::numeric_limits::max (); + for (std::size_t position = 0; + position < selected_observations.size (); ++position) + { + const auto observation = selected_observations[position]; + const auto &row = public_retrieval_observations[observation]; + if (modality_counts[row.value ("modality", std::string{})] <= 1 + || source_counts[row.value ("source_id_blake3", + std::string{})] + <= 1) + continue; + const std::size_t distance = observation > target_index + ? observation - target_index + : target_index - observation; + if (distance < best_distance) + { + replace_position = position; + best_distance = distance; + } + } + if (replace_position == selected_observations.size ()) + throw std::runtime_error ( + "public retrieval sample cannot preserve modality/source strata"); + selected_observations[replace_position] = target_index; + }; + ensure_sample_value ("modality", "text"); + std::unordered_set observed_sources; + for (const auto &row : public_retrieval_observations) + observed_sources.insert ( + row.value ("source_id_blake3", std::string{})); + std::vector ordered_sources (observed_sources.begin (), + observed_sources.end ()); + std::sort (ordered_sources.begin (), ordered_sources.end ()); + for (const auto &source : ordered_sources) + ensure_sample_value ("source_id_blake3", source); + std::sort (selected_observations.begin (), selected_observations.end ()); + + nlohmann::json public_retrieval_queries = nlohmann::json::array (); + for (std::size_t query = 0; query < selected_observations.size (); + ++query) + { + auto selected + = public_retrieval_observations[selected_observations[query]]; + selected["query_ordinal"] = query; + public_retrieval_queries.push_back (std::move (selected)); + } + nlohmann::json public_control = nlohmann::json::object (); + public_control["schema"] + = "cortext_current_public_retrieval_control_v1"; + const bool candidate_available = std::all_of ( + public_retrieval_queries.begin (), + public_retrieval_queries.end (), [] (const auto &query) { + return query.value ("candidate_available", false); + }); + public_control["status"] + = candidate_available + ? "exact-public-control-and-candidate-captured" + : "exact-public-control-captured-candidate-pending"; + public_control["control_path"] + = "GraphAugmentedRetrieveCandidates"; + public_control["identity_kind"] = "memory-id"; + public_control["query_count"] = cfg.public_retrieval_queries; + public_control["result_k"] = cfg.public_retrieval_result_k; + public_control["query_sampling"] + = "inclusive-even-retrieval-active-event-order"; + public_control["retrieval_active_event_count"] + = public_retrieval_observations.size (); + public_control["population"] + = "runtime query-time eligible current long-term memory surface"; + public_control["eligibility_semantics"] = { + { "timestamp_exclusion", true }, + { "supersession_exclusion", true }, + { "current_surface_selection", true }, + { "family_collapse", true }, + { "deterministic_tie_order", true }, + }; + public_control["source_id_semantics"] = "opaque-provenance-only"; + public_control["modality_semantics"] + = "shared-post-encoding-retrieval"; + public_control["opaque_source_control"] = cfg.opaque_source_control; + public_control["coverage_contract"] = { + { "minimum_opaque_source_ids", cfg.opaque_source_control ? 4 : 1 }, + { "required_modalities", { "text" } }, + { "modality_agnostic_proof", + "separate active-SQLite-route source/modality label-invariance regression" }, + }; + public_control["candidate_available"] = candidate_available; + public_control["production_cutover"] = false; + public_control["surface_mutation_schema"] + = "cortext_live_retrieval_surface_mutations_v1"; + public_control["surface_mutation_order"] + = "event-index-then-process-before-consolidation"; + public_control["surface_mutation_count"] + = public_surface_mutations.size (); + public_control["surface_mutations"] + = std::move (public_surface_mutations); + public_control["queries"] = std::move (public_retrieval_queries); + out["public_retrieval_control"] = std::move (public_control); + } + cortext::operations::retrieval_trace::SetSurfaceMutationCaptureEnabled ( + false); const auto shadow_snapshots = cortext::operations::bounded_activation_shadow_internal::Snapshots (); if (!shadow_snapshots.empty ()) @@ -2978,6 +3760,8 @@ main (int argc, char **argv) { Config cfg = ParseArgs (argc, argv); ApplyReplayTimezone (cfg.replay_timezone); + if (!cfg.export_shadow_embedding_corpus.empty ()) + return ExportShadowEmbeddingCorpus (cfg); if (!cfg.shadow_embedding_corpus.empty ()) return RunShadowEmbeddingQuality (cfg); const nlohmann::json sqlite_profile @@ -3541,6 +4325,7 @@ main (int argc, char **argv) { "sensitivity", cfg.sensitivity }, { "stability", cfg.stability }, }; + RecordSparseRouteParameters (out, cfg); out["media_candidates_found"] = media.size (); out["media_attempted"] = checkpoint_media_attempted; out["media_processed"] @@ -3791,6 +4576,7 @@ main (int argc, char **argv) { "sensitivity", cfg.sensitivity }, { "stability", cfg.stability }, }; + RecordSparseRouteParameters (out, cfg); out["wall_ms"] = std::chrono::duration_cast ( profile_ended - profile_started) @@ -4425,6 +5211,7 @@ main (int argc, char **argv) { "sensitivity", cfg.sensitivity }, { "stability", cfg.stability }, }; + RecordSparseRouteParameters (out, cfg); out["media_candidates_found"] = media.size (); out["media_attempted"] = media_attempted; out["media_processed"] = media_processed; diff --git a/src/cortext.cpp b/src/cortext.cpp index 79b834d7..38f9d7dd 100644 --- a/src/cortext.cpp +++ b/src/cortext.cpp @@ -12,6 +12,7 @@ #include "operations/meta_learning_internal.hpp" #include "operations/retrieval_trace_state.hpp" #include "operations/signal_record_rollback_internal.hpp" +#include "operations/sparse_retrieval_knobs_internal.hpp" #include "experimental_env.hpp" #include "signal_filter.hpp" #include "streaming_text_probe.hpp" @@ -453,6 +454,8 @@ LoadSignalBlobs (Store *store, long long memory_id, ObjectStore *object_store, const std::string &memory_modality, const std::string &memory_mime, + int max_signal_blobs, + std::size_t *loaded_signal_blobs, std::vector> &out) { if (!store || memory_id <= 0) @@ -460,11 +463,17 @@ LoadSignalBlobs (Store *store, long long memory_id, try { + const long long limit = std::max (1, max_signal_blobs); auto rows = store->Execute ( - "SELECT modality, mime, blob_id FROM signals " - "WHERE memory_id = ? AND blob_id IS NOT NULL " + "SELECT modality, mime, blob_id FROM (" + " SELECT modality, mime, blob_id, serial_position " + " FROM signals " + " WHERE memory_id = ? AND blob_id IS NOT NULL " + " ORDER BY serial_position DESC " + " LIMIT ?" + ") recent_signals " "ORDER BY serial_position ASC", - { memory_id }); + { memory_id, limit }); for (const auto &row : rows) { @@ -485,6 +494,10 @@ LoadSignalBlobs (Store *store, long long memory_id, signal_mime, payload)) { out.push_back (std::move (payload)); + if (loaded_signal_blobs) + { + ++*loaded_signal_blobs; + } } } } @@ -605,7 +618,9 @@ LoadSoftAnchors ( void HydrateMemory (Store *store, ObjectStore *object_store, long long id, Cortext::Context::Memory &m, - int max_hydrated_soft_anchors) + int max_hydrated_soft_anchors, + int max_fallback_signal_blobs, + std::size_t *loaded_fallback_signal_blobs) { if (!store) return; @@ -710,7 +725,9 @@ HydrateMemory (Store *store, ObjectStore *object_store, long long id, { // v2 fallback: old databases may only have signal-level blobs. LoadSignalBlobs (store, memory_id, object_store, m.modality, - m.mimetype, m.content); + m.mimetype, max_fallback_signal_blobs, + loaded_fallback_signal_blobs, + m.content); } // v2: Counts are inline on memories table @@ -973,7 +990,9 @@ ResolveDisplayMemoriesForEmptyRetrieval (Store *store, long long memory_id, void HydrateWorkingMemoryFromDB (Store *store, ObjectStore *object_store, std::vector &out, - int max_hydrated_soft_anchors) + int max_hydrated_soft_anchors, + int max_fallback_signal_blobs, + std::size_t *loaded_fallback_signal_blobs) { if (!store) return; @@ -1071,7 +1090,9 @@ HydrateWorkingMemoryFromDB (Store *store, ObjectStore *object_store, { // v2 fallback: old databases may only have signal-level blobs. LoadSignalBlobs (store, m.id, object_store, m.modality, - m.mimetype, m.content); + m.mimetype, max_fallback_signal_blobs, + loaded_fallback_signal_blobs, + m.content); } StripSourceBlobsIfDisabled (m); LoadSoftAnchors (store, m.id, m.soft_anchors, @@ -1627,13 +1648,24 @@ struct Cortext::Impl const auto linked_hydration_ordering_weights = core::RetrievalLinkedHydrationOrderingWeights ( cfg.focus, cfg.sensitivity, cfg.stability); + const int max_fallback_signal_blobs + = operations::sparse_retrieval_knobs_internal:: + HydrationFallbackSignalLimit ( + cfg.focus, cfg.sensitivity, cfg.stability); + std::size_t loaded_fallback_signal_blobs = 0; if (hydrate_working_memory) { HydrateWorkingMemoryFromDB (store.get (), object_store.get (), result.working_memory, - max_hydrated_soft_anchors); + max_hydrated_soft_anchors, + max_fallback_signal_blobs, + &loaded_fallback_signal_blobs); } + result.output.operation_ms["Cortext.fallback_hydration_signal_limit"] + = static_cast (max_fallback_signal_blobs); + result.output.operation_ms["Cortext.fallback_hydration_signal_rows"] + = static_cast (loaded_fallback_signal_blobs); if (!hydrate_retrieved_memory) { @@ -1703,7 +1735,9 @@ struct Cortext::Impl Cortext::Context::Memory m; m.id = memory_id; HydrateMemory (store.get (), object_store.get (), memory_id, m, - max_hydrated_soft_anchors); + max_hydrated_soft_anchors, + max_fallback_signal_blobs, + &loaded_fallback_signal_blobs); // Prefer a linked memory's own ranked trace. Otherwise use the // source-specific query/relationship score computed during linked // selection; never relabel the routing node's score as a source score. @@ -1752,7 +1786,9 @@ struct Cortext::Impl Cortext::Context::Memory m; m.id = memory_id; HydrateMemory (store.get (), object_store.get (), memory_id, m, - max_hydrated_soft_anchors); + max_hydrated_soft_anchors, + max_fallback_signal_blobs, + &loaded_fallback_signal_blobs); ApplyRetrievalScore (m, ranked_by_memory_id); const bool has_content = HasHydratedContent (m); const bool prefer_linked_sources @@ -1804,6 +1840,8 @@ struct Cortext::Impl } } + result.output.operation_ms["Cortext.fallback_hydration_signal_rows"] + = static_cast (loaded_fallback_signal_blobs); return result; } }; diff --git a/src/experimental_env.hpp b/src/experimental_env.hpp index 3bcdd8c3..a22f9707 100644 --- a/src/experimental_env.hpp +++ b/src/experimental_env.hpp @@ -53,6 +53,19 @@ Flag (const char *name) #endif } +inline std::optional +String (const char *name) +{ +#if defined(CORTEXT_EXPERIMENT_HOOKS) + const auto value = detail::Get (name); + return value ? std::optional (detail::Lower (*value)) + : std::nullopt; +#else + (void)name; + return std::nullopt; +#endif +} + inline bool Bool (const char *name, bool fallback) { diff --git a/src/operations/active_signal_embedding_ring_internal.hpp b/src/operations/active_signal_embedding_ring_internal.hpp new file mode 100644 index 00000000..d077b0ab --- /dev/null +++ b/src/operations/active_signal_embedding_ring_internal.hpp @@ -0,0 +1,100 @@ +#pragma once + +#include "cortext/store/store.hpp" +#include "cortext/store/utils.hpp" +#include "sparse_retrieval_knobs_internal.hpp" + +#include +#include +#include +#include +#include + +namespace cortext::operations::active_signal_embedding_ring_internal +{ + +inline int +Capacity (double focus, double sensitivity, double stability) +{ + return sparse_retrieval_knobs_internal::BackfillBatchSize ( + focus, sensitivity, stability); +} + +inline long long +SlotFor (long long signal_id, int capacity) +{ + if (signal_id <= 0 || capacity <= 0) + throw std::invalid_argument ("invalid active signal embedding ring key"); + return (signal_id - 1) % static_cast (capacity); +} + +inline void +InsertAtCapacity (Transaction &tx, long long signal_id, + const std::any &embedding, long long created_at, + int capacity) +{ + tx.Execute ( + "INSERT INTO cortext_active_signal_embeddings(" + "slot, signal_id, embedding, created_at, capacity) " + "VALUES (?, ?, ?, ?, ?) " + "ON CONFLICT(slot) DO UPDATE SET " + "signal_id = excluded.signal_id, " + "embedding = excluded.embedding, " + "created_at = excluded.created_at, " + "capacity = excluded.capacity", + { SlotFor (signal_id, capacity), signal_id, embedding, created_at, + static_cast (capacity) }); +} + +inline void +EnsureCapacity (Transaction &tx, int capacity) +{ + if (capacity <= 0) + throw std::invalid_argument ("active signal embedding capacity is zero"); + const auto capacity_rows = tx.Execute ( + "SELECT DISTINCT capacity FROM cortext_active_signal_embeddings " + "ORDER BY capacity LIMIT 2"); + if (capacity_rows.empty ()) + return; + if (capacity_rows.size () != 1) + throw std::runtime_error ("mixed active signal embedding capacities"); + const auto stored_capacity = store::AnyToLongLong ( + capacity_rows.front ().at ("capacity")); + if (!stored_capacity || *stored_capacity <= 0) + throw std::runtime_error ("invalid active signal embedding capacity"); + if (*stored_capacity == capacity) + return; + + // This table is already bounded by the previous knob-derived capacity. + // Rehash only the newest rows that fit the new knob-derived capacity. + auto rows = tx.Execute ( + "SELECT signal_id, embedding, created_at " + "FROM cortext_active_signal_embeddings " + "ORDER BY signal_id DESC LIMIT ?", + { static_cast (capacity) }); + tx.Execute ("DELETE FROM cortext_active_signal_embeddings"); + std::reverse (rows.begin (), rows.end ()); + for (const auto &row : rows) + { + const auto signal_id + = store::AnyToLongLong (row.at ("signal_id")).value_or (0); + const auto created_at + = store::AnyToLongLong (row.at ("created_at")).value_or (0); + if (signal_id <= 0 || !row.at ("embedding").has_value ()) + throw std::runtime_error ("invalid active signal embedding row"); + InsertAtCapacity (tx, signal_id, row.at ("embedding"), created_at, + capacity); + } +} + +inline void +Upsert (Transaction &tx, long long signal_id, + const std::vector &embedding, long long created_at, + double focus, double sensitivity, double stability) +{ + const int capacity = Capacity (focus, sensitivity, stability); + EnsureCapacity (tx, capacity); + InsertAtCapacity (tx, signal_id, embedding, created_at, capacity); +} + +} // namespace cortext::operations::active_signal_embedding_ring_internal diff --git a/src/operations/association_fanout_cache_internal.hpp b/src/operations/association_fanout_cache_internal.hpp index 2b2e22a3..518adf21 100644 --- a/src/operations/association_fanout_cache_internal.hpp +++ b/src/operations/association_fanout_cache_internal.hpp @@ -142,6 +142,44 @@ UpsertFanoutEdge ( return true; } +inline void +RecomputeSupersessionEligibilityTarget ( + const ProcessorContext::AssociationFanoutCache &cache, + const ProcessorContext &p_ctx, long long target_memory_id) +{ + auto &eligibility = execution_cache_sidecar_internal::Ensure (p_ctx) + ->supersession_eligibility; + eligibility.activation_ts_by_target.erase (target_memory_id); + const auto target = cache.in_by_target.find (target_memory_id); + if (target == cache.in_by_target.end ()) + return; + + std::optional activation_ts; + for (const auto &edge : target->second) + { + if (edge.edge_type != "supersedes") + continue; + const auto surface_it + = p_ctx.retrieval_surface_index.find (edge.memory_id); + if (surface_it == p_ctx.retrieval_surface_index.end () + || surface_it->second >= p_ctx.retrieval_surface_cache.size ()) + continue; + const auto &replacement + = p_ctx.retrieval_surface_cache[surface_it->second]; + if (replacement.memory_id <= 0 || replacement.embedding_id <= 0 + || replacement.start_ts < 0 + || (replacement.kind != "LONG_TERM" + && replacement.kind != "ASSOCIATION")) + continue; + activation_ts = activation_ts + ? std::min (*activation_ts, replacement.start_ts) + : replacement.start_ts; + } + if (activation_ts) + eligibility.activation_ts_by_target.emplace (target_memory_id, + *activation_ts); +} + inline void UpsertAssociation (ProcessorContext &p_ctx, ProcessorContext::AssociationFanoutCache &cache, @@ -155,9 +193,10 @@ UpsertAssociation (ProcessorContext &p_ctx, { return; } - if (edge_type == "supersedes") - execution_cache_sidecar_internal::Ensure (p_ctx) - ->supersession_eligibility.valid = false; + const auto sidecar = execution_cache_sidecar_internal::Ensure (p_ctx); + const bool maintain_supersession_eligibility + = edge_type == "supersedes" + && sidecar->supersession_eligibility.valid; double old_weight = 0.0; long long old_last_reinforced = 0; long long old_target_embedding_id = 0; @@ -197,6 +236,9 @@ UpsertAssociation (ProcessorContext &p_ctx, - std::llround (old_weight * 1000000.0)); cache.last_reinforced_sum += last_reinforced - old_last_reinforced; } + if (maintain_supersession_eligibility) + RecomputeSupersessionEligibilityTarget (cache, p_ctx, + target_memory_id); } inline void @@ -256,11 +298,13 @@ NotifyRetrievalSurfaceChanged (const ProcessorContext &p_ctx, memory_id); if (edges == p_ctx.association_fanout_cache.out_by_source.end ()) return; - if (std::any_of (edges->second.begin (), edges->second.end (), - [] (const auto &edge) { - return edge.edge_type == "supersedes"; - })) - InvalidateSupersessionEligibility (p_ctx); + const auto sidecar = execution_cache_sidecar_internal::Find (p_ctx); + if (!sidecar || !sidecar->supersession_eligibility.valid) + return; + for (const auto &edge : edges->second) + if (edge.edge_type == "supersedes") + RecomputeSupersessionEligibilityTarget ( + p_ctx.association_fanout_cache, p_ctx, edge.memory_id); } inline ProcessorContext::AssociationFanoutCache * diff --git a/src/operations/bounded_activation_shadow_internal.hpp b/src/operations/bounded_activation_shadow_internal.hpp index 045856ac..04535df1 100644 --- a/src/operations/bounded_activation_shadow_internal.hpp +++ b/src/operations/bounded_activation_shadow_internal.hpp @@ -1422,8 +1422,12 @@ RebuildFromPersistentAuthority (State &state, Store &store) try { const auto rows = store.Execute ( - "SELECT s.signal_id, s.timestamp, e.embedding " - "FROM signals s JOIN embeddings e " + "SELECT s.signal_id, s.timestamp, " + "COALESCE(a.embedding, e.embedding) AS embedding " + "FROM signals s " + "LEFT JOIN cortext_active_signal_embeddings a " + "ON a.signal_id = s.signal_id " + "LEFT JOIN embeddings e " "ON e.embedding_id = s.embedding_id " "ORDER BY s.signal_id"); const auto authoritative_signal_count diff --git a/src/operations/competition.cpp b/src/operations/competition.cpp index dc7b444c..922c157a 100644 --- a/src/operations/competition.cpp +++ b/src/operations/competition.cpp @@ -81,7 +81,11 @@ ApplyRIFRecovery (OperationContext &context, Transaction &tx, long long now_ts, const auto calibration_memory_ids = sidecar->rif_active_epoch.calibration_memory_ids; const auto result = rif_state_internal::AdvanceRecovery ( - tx, now_ts, recovery_time, calibration_memory_ids); + tx, now_ts, recovery_time, calibration_memory_ids, + sidecar->rif_active_epoch.limits.row_batch_size); + sidecar->rif_active_epoch.row_batch_high_water = std::max ( + sidecar->rif_active_epoch.row_batch_high_water, + result.maximum_statement_rows); sidecar->rif_active_epoch.calibration_memory_ids.clear (); rif_active_epoch_cache_internal::StageClock ( sidecar->rif_active_epoch, result.clock.generation, diff --git a/src/operations/consolidation.cpp b/src/operations/consolidation.cpp index 6636db82..51bf400a 100644 --- a/src/operations/consolidation.cpp +++ b/src/operations/consolidation.cpp @@ -6,6 +6,7 @@ #include "cortext/core/utils.hpp" #include "cortext/processor/operation_context.hpp" #include "cortext/telemetry/telemetry.hpp" +#include "sparse_retrieval_knobs_internal.hpp" #include #include #include @@ -51,13 +52,30 @@ ScoreConsolidation::Execute (OperationContext &context, Transaction &tx) const // Uses unified memories table which contains per-memory state. const double tag_weight = core::ConsolidationCandidateTagWeight ( F_raw, S_raw, T); + const auto candidate_input_limit + = sparse_retrieval_knobs_internal::ActivationIdentityTarget ( + F_raw, S_raw, T); + const auto association_edge_limit + = sparse_retrieval_knobs_internal::GraphNeighborCount ( + F_raw, S_raw, T); const std::string query - = "WITH edge_counts AS (" - " SELECT m.memory_id, " - " (SELECT COUNT(*) FROM associations a " - " WHERE a.source_memory_id = m.memory_id " - " OR a.target_memory_id = m.memory_id) AS cnt " - " FROM memories m" + = "WITH candidate_ids AS MATERIALIZED (" + " SELECT memory_id " + " FROM memories INDEXED BY idx_memories_ltm_strength_created " + " WHERE kind = 'LONG_TERM' " + " ORDER BY strength ASC, created_at ASC, embedding_id ASC " + " LIMIT ?8" + "), input_count AS (" + " SELECT COUNT(*) AS candidate_input_count FROM candidate_ids" + "), edge_counts AS (" + " SELECT ci.memory_id, " + " (SELECT COUNT(*) FROM (" + " SELECT 1 FROM associations a " + " WHERE a.source_memory_id = ci.memory_id " + " OR a.target_memory_id = ci.memory_id " + " LIMIT ?9" + " )) AS cnt " + " FROM candidate_ids ci" "), max_cnt AS (" " SELECT COALESCE(MAX(cnt), 0) AS maximum FROM edge_counts" "), scored AS (" @@ -74,30 +92,54 @@ ScoreConsolidation::Execute (OperationContext &context, Transaction &tx) const " ELSE 0.0 END)) AS computed_score, " " COALESCE(cme.embedding, e.embedding) AS embedding, " " m.created_at " - " FROM memories m " + " FROM candidate_ids ci " + " JOIN memories m ON m.memory_id = ci.memory_id " " JOIN rif_effective_memories rif ON rif.memory_id = m.memory_id " " JOIN embeddings e ON m.embedding_id = e.embedding_id " " LEFT JOIN current_memory_embeddings cme " " ON cme.memory_id = m.memory_id " " LEFT JOIN edge_counts ec ON ec.memory_id = m.memory_id " " CROSS JOIN max_cnt " - " WHERE m.kind = 'LONG_TERM' " - " AND m.cluster_id IS NULL" + " WHERE m.cluster_id IS NULL" ") " - "SELECT memory_id, embedding_id, computed_score, embedding " - "FROM scored WHERE computed_score < ?7 " - "ORDER BY computed_score ASC, created_at ASC, memory_id ASC;"; + "SELECT memory_id, embedding_id, computed_score, embedding, " + " created_at, candidate_input_count, 0 AS sentinel " + "FROM scored CROSS JOIN input_count WHERE computed_score < ?7 " + "UNION ALL " + "SELECT NULL, NULL, NULL, NULL, NULL, candidate_input_count, " + " 1 AS sentinel FROM input_count " + "ORDER BY sentinel ASC, computed_score ASC, created_at ASC, " + " memory_id ASC;"; const auto candidate_query_start = std::chrono::steady_clock::now (); auto rows = tx.Execute ( query, { T, F_eff, S_eff, T, tag_weight, static_cast (now_ts), - floor_cutoff }); + floor_cutoff, static_cast (candidate_input_limit), + static_cast (association_edge_limit) }); context.AddOperationTiming ( "ScoreConsolidation.candidate_query_sql", std::chrono::duration ( std::chrono::steady_clock::now () - candidate_query_start) .count ()); internal::ThrowIfStopRequested (); + long long candidate_input_count = 0; + if (!rows.empty ()) + { + const auto input_count = rows.back ().find ("candidate_input_count"); + if (input_count != rows.back ().end () + && input_count->second.type () == typeid (long long)) + candidate_input_count + = std::any_cast (input_count->second); + } + context.AddOperationTiming ( + "ScoreConsolidation.candidate_input_limit", + static_cast (candidate_input_limit)); + context.AddOperationTiming ( + "ScoreConsolidation.candidate_input_count", + static_cast (candidate_input_count)); + context.AddOperationTiming ( + "ScoreConsolidation.association_edge_limit", + static_cast (association_edge_limit)); std::vector candidates; if (!rows.empty()) { diff --git a/src/operations/consolidation_throughput_state_internal.hpp b/src/operations/consolidation_throughput_state_internal.hpp index bfb7eb9e..25909244 100644 --- a/src/operations/consolidation_throughput_state_internal.hpp +++ b/src/operations/consolidation_throughput_state_internal.hpp @@ -1,11 +1,14 @@ #pragma once +#include "sparse_retrieval_knobs_internal.hpp" + #include "cortext/consolidation_state.hpp" #include "cortext/core/knobs.hpp" #include "cortext/processor/processor_context.hpp" #include #include +#include #include #include @@ -18,6 +21,8 @@ struct State double peak = 0.0; bool initialized = false; bool armed = true; + long long observations_since_ack = 0; + bool cooldown_active = false; }; struct RegistryState @@ -58,6 +63,10 @@ Reset (const ProcessorContext &ctx, State state = {}) { state.peak = state.floor; } + state.observations_since_ack + = std::max (0LL, state.observations_since_ack); + if (!state.armed && !state.cooldown_active) + state.cooldown_active = true; auto ®istry = Registry (); std::lock_guard lock (registry.mutex); registry.states[&ctx] = state; @@ -109,6 +118,10 @@ Observe (const ProcessorContext &ctx, double rate, double focus, auto ®istry = Registry (); std::lock_guard lock (registry.mutex); auto &state = registry.states[&ctx]; + if (state.cooldown_active + && state.observations_since_ack + < std::numeric_limits::max ()) + ++state.observations_since_ack; if (!state.initialized) { state.floor = rate; @@ -167,6 +180,8 @@ Acknowledge (const ProcessorContext &ctx, double rate) state.peak = rate; state.initialized = true; state.armed = false; + state.observations_since_ack = 0; + state.cooldown_active = true; } inline double @@ -190,12 +205,25 @@ RequiredTriggerFraction (double focus, double sensitivity, double stability) / core::ConsolidationEscalationMultiplier (stability); } +inline long long +MinimumBacklog (double focus, double sensitivity, double stability) +{ + return static_cast ( + sparse_retrieval_knobs_internal::BackfillBatchSize ( + focus, sensitivity, stability)); +} + inline ConsolidationState Classify (const State &state, double current_rate, long long backlog, double focus, double sensitivity, double stability) { constexpr double kRangeEpsilon = 1e-9; - if (!state.armed || backlog <= 0 || !std::isfinite (current_rate)) + if (!state.armed + || backlog < MinimumBacklog (focus, sensitivity, stability) + || (state.cooldown_active + && state.observations_since_ack + < MinimumBacklog (focus, sensitivity, stability)) + || !std::isfinite (current_rate)) { return ConsolidationState::None; } diff --git a/src/operations/emotion_cascade.cpp b/src/operations/emotion_cascade.cpp index 29cfe7f4..362ef181 100644 --- a/src/operations/emotion_cascade.cpp +++ b/src/operations/emotion_cascade.cpp @@ -7,6 +7,7 @@ #include "cortext/telemetry/telemetry.hpp" #include "association_fanout_cache_internal.hpp" #include "emotional_metadata_cache_internal.hpp" +#include "sparse_retrieval_knobs_internal.hpp" #include "../experimental_env.hpp" #include #include @@ -62,13 +63,15 @@ std::vector LoadEmotionalSources (Store *store, long long recent_window_ts, double theta_intensity, double theta_arousal, const EmotionCascadeParams &fallback, + std::size_t candidate_limit, + std::size_t *inspected_count, std::size_t *accepted_count) { std::vector sources; // v2: Query memories for high-intensity flashbulb memories // Only process recently tagged ones (within consolidation window) - auto rows = store->Execute ( + std::string query = "SELECT source.embedding_id, source.emotional_intensity, " " source.half_life_bonus, source.cascade_radius, " " source.cascade_decay, " @@ -80,11 +83,21 @@ LoadEmotionalSources (Store *store, long long recent_window_ts, "WHERE flashbulb = 1 AND emotional_intensity >= ?1 " "AND s_arousal_avg >= ?2 " "AND created_at >= ?3 " - "ORDER BY emotional_intensity DESC, source.memory_id ASC", - { theta_intensity, theta_arousal, recent_window_ts }); + "ORDER BY emotional_intensity DESC, source.memory_id ASC"; + std::vector parameters{ + theta_intensity, theta_arousal, recent_window_ts + }; + if (candidate_limit > 0) + { + query += " LIMIT ?4"; + parameters.emplace_back (static_cast (candidate_limit)); + } + auto rows = store->Execute (query, parameters); for (const auto &row : rows) { + if (inspected_count) + ++*inspected_count; auto it_id = row.find ("embedding_id"); auto it_intensity = row.find ("emotional_intensity"); @@ -166,6 +179,8 @@ LoadEmotionalSourcesFromCache (const ProcessorContext &p_ctx, double theta_intensity, double theta_arousal, const EmotionCascadeParams &fallback, + std::size_t candidate_limit, + std::size_t *inspected_count, std::size_t *accepted_count) { const auto state @@ -176,6 +191,11 @@ LoadEmotionalSourcesFromCache (const ProcessorContext &p_ctx, const auto &cache = state->emotional_metadata; for (const long long memory_id : cache.source_query_order) { + if (candidate_limit > 0 && inspected_count + && *inspected_count >= candidate_limit) + break; + if (inspected_count) + ++*inspected_count; const auto row_it = cache.rows_by_memory.find (memory_id); if (row_it == cache.rows_by_memory.end ()) continue; @@ -321,6 +341,14 @@ RecordCascadeFixedPoint (ProcessorContext &p_ctx, fixed.cascade_decay = params.cascade_decay; } +void +InvalidateCascadeFixedPoint (ProcessorContext &p_ctx) +{ + const auto state = emotional_metadata_cache_internal::FindState (p_ctx); + if (state) + state->emotional_fixed_point.valid = false; +} + /// @brief Find each source's shortest positive-depth neighbors while sharing /// graph traversal across source-order batches. std::vector> @@ -328,15 +356,28 @@ FindCascadeNeighbors (const AssociationFanoutCache &cache, const std::vector &sources, const EmotionCascadeParams &fallback, std::vector> - *expandable_by_source) + *expandable_by_source, + std::size_t *reachable_pair_count, + std::size_t *edge_visit_count, + bool collapse_winners, + std::size_t edge_visit_limit, + bool *edge_visit_limit_reached) { + struct Winner + { + std::size_t source_index; + int depth; + }; std::vector> neighbors (sources.size ()); + std::unordered_map winners; if (expandable_by_source) expandable_by_source->assign (sources.size (), {}); constexpr std::size_t kSourcesPerBatch = 64; for (std::size_t batch_begin = 0; batch_begin < sources.size (); batch_begin += kSourcesPerBatch) { + if (edge_visit_limit_reached && *edge_visit_limit_reached) + break; const std::size_t batch_size = std::min ( kSourcesPerBatch, sources.size () - batch_begin); std::vector active_by_depth (1, 0); @@ -379,6 +420,15 @@ FindCascadeNeighbors (const AssociationFanoutCache &cache, return; for (const auto &edge : edge_it->second) { + if (edge_visit_limit > 0 && edge_visit_count + && *edge_visit_count >= edge_visit_limit) + { + if (edge_visit_limit_reached) + *edge_visit_limit_reached = true; + break; + } + if (edge_visit_count) + ++*edge_visit_count; if (edge.memory_id <= 0) continue; if (edge.embedding_id > 0) @@ -410,6 +460,8 @@ FindCascadeNeighbors (const AssociationFanoutCache &cache, }; for (const auto &[memory_id, frontier_mask] : frontier) { + if (edge_visit_limit_reached && *edge_visit_limit_reached) + break; const std::uint64_t source_mask = frontier_mask & active; if (source_mask == 0) continue; @@ -419,18 +471,43 @@ FindCascadeNeighbors (const AssociationFanoutCache &cache, for (const auto &[embedding_id, reached] : reached_embeddings) { std::uint64_t unseen = reached & ~seen_embeddings[embedding_id]; - seen_embeddings[embedding_id] |= unseen; - while (unseen != 0) + seen_embeddings[embedding_id] |= reached; + if (reachable_pair_count) + *reachable_pair_count += std::popcount (unseen); + if (collapse_winners && unseen != 0) { const unsigned local = std::countr_zero (unseen); - neighbors[batch_begin + local].push_back ( - { embedding_id, depth }); - unseen &= unseen - 1; + const std::size_t source_index = batch_begin + local; + const auto winner = winners.find (embedding_id); + if (winner == winners.end () + || source_index < winner->second.source_index) + winners[embedding_id] = { source_index, depth }; } + else + while (unseen != 0) + { + const unsigned local = std::countr_zero (unseen); + neighbors[batch_begin + local].push_back ( + { embedding_id, depth }); + unseen &= unseen - 1; + } } frontier = std::move (next_frontier); } } + if (collapse_winners) + { + for (const auto &[embedding_id, winner] : winners) + neighbors[winner.source_index].push_back ( + { embedding_id, winner.depth }); + for (auto &source_neighbors : neighbors) + std::sort (source_neighbors.begin (), source_neighbors.end (), + [] (const auto &left, const auto &right) { + if (left.depth != right.depth) + return left.depth < right.depth; + return left.embedding_id < right.embedding_id; + }); + } return neighbors; } @@ -486,6 +563,27 @@ PropagateEmotionalCascade::Execute (OperationContext &context, Transaction &tx) const auto &cfg = context.GetConfig (); auto params = EmotionCascadeParams::FromKnobs (cfg.focus, cfg.sensitivity, cfg.stability); + const std::size_t update_limit = static_cast ( + sparse_retrieval_knobs_internal::ActivationIdentityTarget ( + cfg.focus, cfg.sensitivity, cfg.stability)); + const bool collapse_winners = internal::experimental_env::Flag ( + "CORTEXT_EXPERIMENT_EMOTIONAL_WINNER_COLLAPSE"); + const bool bound_edge_visits = collapse_winners + && internal::experimental_env::Flag ( + "CORTEXT_EXPERIMENT_EMOTIONAL_EDGE_LIMIT"); + const std::size_t edge_visit_limit + = bound_edge_visits + ? static_cast ( + sparse_retrieval_knobs_internal::PublicQueryNodeBudget ( + cfg.focus, cfg.sensitivity, cfg.stability)) + : 0; + const std::size_t source_limit + = bound_edge_visits + ? static_cast ( + sparse_retrieval_knobs_internal::BackfillBatchSize ( + cfg.focus, cfg.sensitivity, cfg.stability)) + : 0; + const std::size_t source_inspection_limit = edge_visit_limit; const long long now_ts = static_cast (context.GetSignal ().timestamp); @@ -549,6 +647,11 @@ PropagateEmotionalCascade::Execute (OperationContext &context, Transaction &tx) context.AddOperationTiming ("EmotionalCascade.source_count", 0.0); context.AddOperationTiming ( "EmotionalCascade.source_execution_count", 0.0); + context.AddOperationTiming ( + "EmotionalCascade.source_inspection_count", 0.0); + context.AddOperationTiming ( + "EmotionalCascade.source_inspection_limit", + static_cast (source_inspection_limit)); context.AddOperationTiming ("EmotionalCascade.source_activity", 0.0); context.AddOperationTiming ("EmotionalCascade.neighbor_lookup", cache_ensure_ms); @@ -557,11 +660,29 @@ PropagateEmotionalCascade::Execute (OperationContext &context, Transaction &tx) context.AddOperationTiming ("EmotionalCascade.cache_bfs", 0.0); context.AddOperationTiming ("EmotionalCascade.current_values", 0.0); context.AddOperationTiming ("EmotionalCascade.neighbor_count", 0.0); + context.AddOperationTiming ( + "EmotionalCascade.reachable_pair_count", 0.0); + context.AddOperationTiming ("EmotionalCascade.edge_visit_count", 0.0); + context.AddOperationTiming ( + "EmotionalCascade.edge_visit_limit", + static_cast (edge_visit_limit)); + context.AddOperationTiming ( + "EmotionalCascade.edge_visit_limit_reached", 0.0); + context.AddOperationTiming ( + "EmotionalCascade.source_limit", + static_cast (source_limit)); + context.AddOperationTiming ( + "EmotionalCascade.source_limit_reached", 0.0); context.AddOperationTiming ( "EmotionalCascade.neighbor_execution_count", 0.0); context.AddOperationTiming ("EmotionalCascade.neighbor_activity", 0.0); context.AddOperationTiming ("EmotionalCascade.update_enqueue", 0.0); context.AddOperationTiming ("EmotionalCascade.update_count", 0.0); + context.AddOperationTiming ( + "EmotionalCascade.update_limit", + static_cast (update_limit)); + context.AddOperationTiming ( + "EmotionalCascade.update_limit_reached", 0.0); context.AddOperationTiming ( "EmotionalCascade.update_execution_count", 0.0); context.AddOperationTiming ("EmotionalCascade.update_activity", 0.0); @@ -572,15 +693,24 @@ PropagateEmotionalCascade::Execute (OperationContext &context, Transaction &tx) // Load high-intensity emotional sources only when the fixed input changed. const auto source_query_start = std::chrono::steady_clock::now (); + std::size_t source_inspection_count = 0; std::size_t source_execution_count = 0; auto sources = use_metadata_cache ? LoadEmotionalSourcesFromCache ( p_ctx, recent_window_ts, theta_intensity, theta_arousal, params, + source_inspection_limit, + &source_inspection_count, &source_execution_count) : LoadEmotionalSources (store, recent_window_ts, theta_intensity, theta_arousal, - params, &source_execution_count); + params, source_inspection_limit, + &source_inspection_count, + &source_execution_count); + const bool source_limit_reached + = source_limit > 0 && sources.size () > source_limit; + if (source_limit_reached) + sources.resize (source_limit); record_timing ("EmotionalCascade.source_query", source_query_start); if (profile_cascade) { @@ -592,6 +722,18 @@ PropagateEmotionalCascade::Execute (OperationContext &context, Transaction &tx) context.AddOperationTiming ( "EmotionalCascade.source_execution_count", static_cast (source_execution_count)); + context.AddOperationTiming ( + "EmotionalCascade.source_inspection_count", + static_cast (source_inspection_count)); + context.AddOperationTiming ( + "EmotionalCascade.source_inspection_limit", + static_cast (source_inspection_limit)); + context.AddOperationTiming ( + "EmotionalCascade.source_limit", + static_cast (source_limit)); + context.AddOperationTiming ( + "EmotionalCascade.source_limit_reached", + source_limit_reached ? 1.0 : 0.0); } if (sources.empty ()) @@ -620,11 +762,24 @@ PropagateEmotionalCascade::Execute (OperationContext &context, Transaction &tx) context.AddOperationTiming ("EmotionalCascade.cache_bfs", 0.0); context.AddOperationTiming ("EmotionalCascade.current_values", 0.0); context.AddOperationTiming ("EmotionalCascade.neighbor_count", 0.0); + context.AddOperationTiming ( + "EmotionalCascade.reachable_pair_count", 0.0); + context.AddOperationTiming ("EmotionalCascade.edge_visit_count", 0.0); + context.AddOperationTiming ( + "EmotionalCascade.edge_visit_limit", + static_cast (edge_visit_limit)); + context.AddOperationTiming ( + "EmotionalCascade.edge_visit_limit_reached", 0.0); context.AddOperationTiming ( "EmotionalCascade.neighbor_execution_count", 0.0); context.AddOperationTiming ("EmotionalCascade.neighbor_activity", 0.0); context.AddOperationTiming ("EmotionalCascade.update_enqueue", 0.0); context.AddOperationTiming ("EmotionalCascade.update_count", 0.0); + context.AddOperationTiming ( + "EmotionalCascade.update_limit", + static_cast (update_limit)); + context.AddOperationTiming ( + "EmotionalCascade.update_limit_reached", 0.0); context.AddOperationTiming ( "EmotionalCascade.update_execution_count", 0.0); context.AddOperationTiming ("EmotionalCascade.update_activity", 0.0); @@ -638,8 +793,12 @@ PropagateEmotionalCascade::Execute (OperationContext &context, Transaction &tx) int max_hops = 0; std::size_t neighbor_count = 0; std::size_t neighbor_execution_count = 0; + std::size_t reachable_pair_count = 0; + std::size_t edge_visit_count = 0; + bool edge_visit_limit_reached = false; std::size_t update_count = 0; std::size_t update_execution_count = 0; + bool update_limit_reached = false; double neighbor_lookup_ms = 0.0; double cache_bfs_ms = 0.0; double current_values_ms = 0.0; @@ -651,14 +810,16 @@ PropagateEmotionalCascade::Execute (OperationContext &context, Transaction &tx) if (fanout_cache && fanout_cache->valid) { std::vector> expandable_by_source; - source_neighbors = FindCascadeNeighbors (*fanout_cache, sources, - params, - &expandable_by_source); + source_neighbors = FindCascadeNeighbors ( + *fanout_cache, sources, params, &expandable_by_source, + &reachable_pair_count, &edge_visit_count, collapse_winners, + edge_visit_limit, &edge_visit_limit_reached); if (use_metadata_cache && emotional_state) { emotional_state->emotional_cascade_topology_footprint - = { true, std::move (expandable_by_source) }; - ConsumeAssociationTopologyChanges (*emotional_state); + = execution_cache_sidecar_internal:: + EmotionalCascadeTopologyFootprint { + true, std::move (expandable_by_source) }; } for (const auto &neighbors : source_neighbors) neighbor_count += neighbors.size (); @@ -720,6 +881,11 @@ PropagateEmotionalCascade::Execute (OperationContext &context, Transaction &tx) { continue; } + if (update_count >= update_limit) + { + update_limit_reached = true; + break; + } const auto update_start = std::chrono::steady_clock::now (); Add (tx, @@ -736,12 +902,20 @@ PropagateEmotionalCascade::Execute (OperationContext &context, Transaction &tx) ++update_count; ++update_execution_count; } + if (update_limit_reached) + break; } - if (use_metadata_cache && fanout_cache && fanout_cache->valid) - RecordCascadeFixedPoint ( - p_ctx, *fanout_cache, emotional_input_generation, recent_window_ts, - theta_intensity, theta_arousal, intensity_floor, params); + if (update_limit_reached) + InvalidateCascadeFixedPoint (p_ctx); + else if (use_metadata_cache && fanout_cache && fanout_cache->valid) + { + RecordCascadeFixedPoint ( + p_ctx, *fanout_cache, emotional_input_generation, recent_window_ts, + theta_intensity, theta_arousal, intensity_floor, params); + if (emotional_state) + ConsumeAssociationTopologyChanges (*emotional_state); + } const auto telemetry_start = std::chrono::steady_clock::now (); telemetry::LogDebug("cortext.emotion_cascade", { @@ -761,6 +935,18 @@ PropagateEmotionalCascade::Execute (OperationContext &context, Transaction &tx) context.AddOperationTiming ( "EmotionalCascade.neighbor_count", static_cast (neighbor_count)); // Experimental count, not ms. + context.AddOperationTiming ( + "EmotionalCascade.reachable_pair_count", + static_cast (reachable_pair_count)); + context.AddOperationTiming ( + "EmotionalCascade.edge_visit_count", + static_cast (edge_visit_count)); + context.AddOperationTiming ( + "EmotionalCascade.edge_visit_limit", + static_cast (edge_visit_limit)); + context.AddOperationTiming ( + "EmotionalCascade.edge_visit_limit_reached", + edge_visit_limit_reached ? 1.0 : 0.0); context.AddOperationTiming ("EmotionalCascade.neighbor_activity", neighbor_count > 0 ? 1.0 : 0.0); context.AddOperationTiming ( @@ -771,6 +957,12 @@ PropagateEmotionalCascade::Execute (OperationContext &context, Transaction &tx) context.AddOperationTiming ( "EmotionalCascade.update_count", static_cast (update_count)); // Experimental count, not ms. + context.AddOperationTiming ( + "EmotionalCascade.update_limit", + static_cast (update_limit)); + context.AddOperationTiming ( + "EmotionalCascade.update_limit_reached", + update_limit_reached ? 1.0 : 0.0); context.AddOperationTiming ("EmotionalCascade.update_activity", update_count > 0 ? 1.0 : 0.0); context.AddOperationTiming ( diff --git a/src/operations/emotional_metadata_cache_internal.hpp b/src/operations/emotional_metadata_cache_internal.hpp index 58edda10..1993efbd 100644 --- a/src/operations/emotional_metadata_cache_internal.hpp +++ b/src/operations/emotional_metadata_cache_internal.hpp @@ -98,6 +98,14 @@ BeforeSourceQuery (const Row &left, const Row &right) return left.memory_id < right.memory_id; } +inline bool +BeforeBoundedSourceQuery (const Row &left, const Row &right) +{ + if (left.created_at != right.created_at) + return left.created_at > right.created_at; + return left.memory_id > right.memory_id; +} + inline void Upsert (ProcessorContext &p_ctx, Row row) { @@ -128,10 +136,16 @@ Upsert (ProcessorContext &p_ctx, Row row) cache.source_query_order.begin (), cache.source_query_order.end (), stored, [&cache] (long long existing_memory_id, const Row &candidate) { - return BeforeSourceQuery ( - cache.rows_by_memory.at (existing_memory_id), candidate); + const auto &existing + = cache.rows_by_memory.at (existing_memory_id); + return cache.source_query_capacity + == std::numeric_limits::max () + ? BeforeSourceQuery (existing, candidate) + : BeforeBoundedSourceQuery (existing, candidate); }); cache.source_query_order.insert (position, memory_id); + if (cache.source_query_order.size () > cache.source_query_capacity) + cache.source_query_order.pop_back (); } RecomputeEmbedding (cache, embedding_id); // A newly persisted, unconnected non-source cannot change a completed @@ -143,13 +157,16 @@ Upsert (ProcessorContext &p_ctx, Row row) } inline void -Reset (ProcessorContext &p_ctx, std::vector rows) +Reset (ProcessorContext &p_ctx, std::vector rows, + std::size_t source_query_capacity + = std::numeric_limits::max ()) { const std::uint64_t next_generation = Ensure (p_ctx).cascade_input_generation + 1; auto &cache = Ensure (p_ctx); cache = {}; cache.valid = true; + cache.source_query_capacity = source_query_capacity; cache.cascade_input_generation = next_generation; cache.rows_by_memory.reserve (rows.size ()); cache.source_query_order.reserve (rows.size ()); @@ -203,10 +220,16 @@ OverwriteEmbedding (ProcessorContext &p_ctx, long long embedding_id, cache.source_query_order.begin (), cache.source_query_order.end (), row, [&cache] (long long existing_memory_id, const Row &candidate) { - return BeforeSourceQuery ( - cache.rows_by_memory.at (existing_memory_id), candidate); + const auto &existing + = cache.rows_by_memory.at (existing_memory_id); + return cache.source_query_capacity + == std::numeric_limits::max () + ? BeforeSourceQuery (existing, candidate) + : BeforeBoundedSourceQuery (existing, candidate); }); cache.source_query_order.insert (position, memory_id); + if (cache.source_query_order.size () > cache.source_query_capacity) + cache.source_query_order.pop_back (); } } RecomputeEmbedding (cache, embedding_id); diff --git a/src/operations/execution_cache_sidecar_internal.hpp b/src/operations/execution_cache_sidecar_internal.hpp index 7ca71433..6661db9b 100644 --- a/src/operations/execution_cache_sidecar_internal.hpp +++ b/src/operations/execution_cache_sidecar_internal.hpp @@ -5,6 +5,7 @@ #include #include +#include #include #include #include @@ -43,6 +44,8 @@ struct EmotionalMetadataCache memory_ids_by_embedding; std::unordered_map values_by_embedding; + std::size_t source_query_capacity + = std::numeric_limits::max (); std::vector source_query_order; }; diff --git a/src/operations/graph_retrieval.cpp b/src/operations/graph_retrieval.cpp index 1563ff07..e5e78710 100644 --- a/src/operations/graph_retrieval.cpp +++ b/src/operations/graph_retrieval.cpp @@ -63,26 +63,46 @@ struct SeedCacheProfile std::size_t eligibility_rows = 0; std::size_t ranked_rows = 0; std::size_t selected_rows = 0; + std::size_t sqlite_sparse_route_activated_identities = 0; + std::size_t sqlite_sparse_route_node_rows = 0; + std::size_t sqlite_sparse_route_activation_snapshot_rows = 0; + std::size_t sqlite_sparse_route_activation_snapshot_cache_miss_rows = 0; + std::size_t sqlite_sparse_route_distance_evaluations = 0; + std::size_t sqlite_sparse_route_search_effort = 0; + std::size_t sqlite_sparse_route_search_node_budget = 0; + std::size_t sqlite_sparse_route_restart_rows = 0; + std::size_t sqlite_sparse_route_dirty_rows = 0; + int sqlite_sparse_route_search_failure_code = 0; + bool sparse_route_used = false; }; -thread_local std::size_t *g_family_exact_comparison_counter = nullptr; +struct FamilyExactComparisonBudget +{ + std::size_t used = 0; + std::size_t limit = 0; + bool record_trace = true; +}; + +thread_local FamilyExactComparisonBudget *g_family_exact_comparison_budget + = nullptr; class ScopedFamilyExactComparisonCounter { public: - explicit ScopedFamilyExactComparisonCounter (std::size_t *counter) - : previous_ (g_family_exact_comparison_counter) + explicit ScopedFamilyExactComparisonCounter ( + FamilyExactComparisonBudget *budget) + : previous_ (g_family_exact_comparison_budget) { - g_family_exact_comparison_counter = counter; + g_family_exact_comparison_budget = budget; } ~ScopedFamilyExactComparisonCounter () { - g_family_exact_comparison_counter = previous_; + g_family_exact_comparison_budget = previous_; } private: - std::size_t *previous_ = nullptr; + FamilyExactComparisonBudget *previous_ = nullptr; }; void @@ -326,6 +346,8 @@ RefreshProcessorSurfaces (Transaction &tx, ProcessorContext &p_ctx, historical_surface_search_cache_internal:: SetCurrentSurfaceDatabaseCurrent (p_ctx, false); } + retrieval_trace::RecordSurfaceUpsert ( + memory_id, new_embedding_id, ToFloatVector (embedding)); } void @@ -432,11 +454,22 @@ class FamilyRepresentativeIndex continue; } + if (g_family_exact_comparison_budget + && g_family_exact_comparison_budget->used + >= g_family_exact_comparison_budget->limit) + { + // The candidate remains eligible when the bounded duplicate test + // cannot make another exact comparison. Output cardinality and + // ranking remain independently bounded downstream. + return false; + } + if (g_family_exact_comparison_budget) + ++g_family_exact_comparison_budget->used; #ifdef CORTEXT_TESTING - retrieval_trace::IncrementLastFamilyExactComparisonCount (); + if (!g_family_exact_comparison_budget + || g_family_exact_comparison_budget->record_trace) + retrieval_trace::IncrementLastFamilyExactComparisonCount (); #endif - if (g_family_exact_comparison_counter) - ++*g_family_exact_comparison_counter; double cosine = 0.0; for (Eigen::Index dimension = 0; dimension < candidate.normalized.size (); ++dimension) @@ -672,10 +705,14 @@ LoadHistoricalSeedRowsFromCache ( std::optional>> LoadCurrentSeedRowsFromCache ( - const ProcessorContext &p_ctx, const Eigen::VectorXf &query_embedding, + Store *store, const ProcessorContext &p_ctx, + const Eigen::VectorXf &query_embedding, long long exclusion_ts, int candidate_limit, const auto &superseded_memory_ids, - double duplicate_threshold, SeedCacheProfile *profile) + double duplicate_threshold, SeedCacheProfile *profile, + bool sparse_route_enabled, + bool sqlite_sparse_route_enabled, + std::size_t sparse_route_capacity) { const auto state = historical_surface_search_cache_internal::Find (p_ctx); @@ -694,29 +731,111 @@ LoadCurrentSeedRowsFromCache ( return std::vector>{}; } + const bool use_sparse_route + = sparse_route_enabled && entry_count > sparse_route_capacity; + std::vector candidate_indices; + if (use_sparse_route) + { + auto mutable_state + = historical_surface_search_cache_internal::FindMutable (p_ctx); + auto sqlite_route + = mutable_state && store && sqlite_sparse_route_enabled + ? historical_surface_search_cache_internal:: + OpenSQLiteSparseRoute (*mutable_state, *store) + : nullptr; + auto route + = mutable_state && !sqlite_route && !sqlite_sparse_route_enabled + ? historical_surface_search_cache_internal::EnsureSparseRoute ( + *mutable_state) + : nullptr; + if (sqlite_route) + { + const auto dirty_rows = historical_surface_search_cache_internal:: + StageSQLiteSparseRouteDirtyForSearch ( + *mutable_state, *sqlite_route); + if (!dirty_rows) + return std::nullopt; + if (profile) + { + profile->sqlite_sparse_route_dirty_rows = *dirty_rows; + profile->sqlite_sparse_route_search_effort + = sqlite_route->ActivationSearchEffort (); + profile->sqlite_sparse_route_search_node_budget + = sqlite_route->ActivationSearchNodeBudget (); + } + } + const auto memory_ids = sqlite_route + ? sqlite_route->SearchActivated ( + query_embedding) + : route + ? route->Search (query_embedding, + sparse_route_capacity) + : std::nullopt; + if (!memory_ids) + { + if (profile && sqlite_route) + profile->sqlite_sparse_route_search_failure_code + = sqlite_route->LastSearchFailureCode (); + return std::nullopt; + } + if (profile) + { + profile->sparse_route_used = true; + profile->sqlite_sparse_route_activated_identities + = memory_ids->size (); + } + if (profile && sqlite_route) + { + profile->sqlite_sparse_route_node_rows + = sqlite_route->LastSearchNodeRows (); + profile->sqlite_sparse_route_activation_snapshot_rows + = sqlite_route->LastActivationSnapshotRows (); + profile->sqlite_sparse_route_activation_snapshot_cache_miss_rows + = sqlite_route->LastActivationSnapshotCacheMissRows (); + profile->sqlite_sparse_route_distance_evaluations + = sqlite_route->LastSearchDistanceEvaluations (); + profile->sqlite_sparse_route_restart_rows + = sqlite_route->RestartRowsLoaded (); + } + candidate_indices.reserve (memory_ids->size ()); + for (const long long memory_id : *memory_ids) + { + const auto index = state->current_memory_index.find (memory_id); + if (index == state->current_memory_index.end () + || index->second >= entry_count) + return std::nullopt; + candidate_indices.push_back (index->second); + } + } + const auto distance_started = std::chrono::steady_clock::now (); - using RowMajorMatrix - = Eigen::Matrix; - const Eigen::Map matrix ( - state->current_search.data (), static_cast (entry_count), - embedding_dim); auto &distance_scratch = state->distance_scratch; - distance_scratch.resize (entry_count); - Eigen::Map distances ( - distance_scratch.data (), static_cast (entry_count)); - distances = (matrix.rowwise () - query_embedding.transpose ()) - .rowwise () + if (!use_sparse_route) + { + distance_scratch.resize (entry_count); + for (std::size_t index = 0; index < entry_count; ++index) + distance_scratch[index] + = (state->current_entries[index].embedding - query_embedding) .squaredNorm (); + } if (profile) - profile->distance_rows += entry_count; + profile->distance_rows + += use_sparse_route ? candidate_indices.size () : entry_count; AddSeedCachePhaseTime (profile, &SeedCacheProfile::distance_ms, distance_started); const auto eligibility_started = std::chrono::steady_clock::now (); auto &ranked = state->ranked_scratch; ranked.clear (); - ranked.reserve (entry_count); - for (std::size_t index = 0; index < entry_count; ++index) + ranked.reserve (use_sparse_route ? candidate_indices.size () + : entry_count); + const std::size_t eligibility_count + = use_sparse_route ? candidate_indices.size () : entry_count; + for (std::size_t candidate_index = 0; + candidate_index < eligibility_count; ++candidate_index) { + const std::size_t index = use_sparse_route + ? candidate_indices[candidate_index] + : candidate_index; const auto &entry = state->current_entries[index]; if (entry.memory_id <= 0 || entry.embedding_id <= 0 || entry.embedding.size () != embedding_dim) @@ -732,11 +851,13 @@ LoadCurrentSeedRowsFromCache ( || superseded_memory_ids.Contains (entry.memory_id)) continue; ranked.push_back ( - { index, distances[static_cast (index)] }); + { index, use_sparse_route + ? (entry.embedding - query_embedding).squaredNorm () + : distance_scratch[index] }); } if (profile) { - profile->eligibility_rows += entry_count; + profile->eligibility_rows += eligibility_count; profile->ranked_rows += ranked.size (); } AddSeedCachePhaseTime (profile, &SeedCacheProfile::eligibility_ms, @@ -1446,6 +1567,8 @@ GraphAugmentedRetrieveCandidates::Execute (OperationContext &context, auto started = std::chrono::steady_clock::now (); retrieval_trace::ClearLastSelectedEmbeddingOrder (); retrieval_trace::ClearLastRankedCandidates (); + retrieval_trace::ClearLastSeedCandidates (); + retrieval_trace::ClearLastExactSeedCandidates (); retrieval_trace::ClearLastRejectedCandidates (); retrieval_trace::ClearLastEvidencePackets (); retrieval_trace::ClearLastRetrievalSummary (); @@ -1486,9 +1609,28 @@ GraphAugmentedRetrieveCandidates::Execute (OperationContext &context, = !constructive_recall::Disabled (); const bool profile_graph_retrieval = internal::experimental_env::Flag ( "CORTEXT_PROFILE_GRAPH_RETRIEVAL"); - std::size_t family_exact_comparison_count = 0; + // SQLite-backed HNSW is the normal internal retrieval route. The flag is a + // private rollback hook for experiments; it does not select another public + // write or retrieval API. + const bool sqlite_sparse_route_enabled = internal::experimental_env::Bool ( + "CORTEXT_SQLITE_SPARSE_ROUTE", true); + const bool sparse_route_enabled + = sqlite_sparse_route_enabled + || internal::experimental_env::Flag ("CORTEXT_HNSW_SPARSE_ROUTE"); + const bool any_sparse_route_enabled + = sparse_route_enabled || sqlite_sparse_route_enabled; + const bool capture_sparse_exact_control + = any_sparse_route_enabled && internal::experimental_env::Flag ( + "CORTEXT_CAPTURE_HNSW_EXACT_CONTROL"); + const auto sparse_route_parameters + = sparse_retrieval_route_sqlite_internal::DeriveParameters (F, S, T); + const std::size_t sparse_route_capacity + = sparse_route_parameters.route_capacity; + FamilyExactComparisonBudget family_exact_comparison_budget { + 0, sparse_route_parameters.family_exact_comparison_limit, true + }; ScopedFamilyExactComparisonCounter family_counter_scope ( - profile_graph_retrieval ? &family_exact_comparison_count : nullptr); + &family_exact_comparison_budget); std::size_t cache_rebuild_count = 0; auto profile_timing = [&context, profile_graph_retrieval] ( @@ -1524,6 +1666,11 @@ GraphAugmentedRetrieveCandidates::Execute (OperationContext &context, std::unordered_set seen_seed_memory_ids; bool sql_fallback_rows_current = false; bool cache_search_available = false; + // Ephemeral retrieval may consume an already-installed cache, but must not + // create processor-owned state when it falls back to SQL. + if (signal.retention != Retention::Ephemeral) + historical_surface_search_cache_internal::SetSparseRouteParameters ( + p_ctx, sparse_route_parameters); auto surface_search_state = historical_surface_search_cache_internal::Find (p_ctx); SeedCacheProfile seed_cache_profile; @@ -1536,13 +1683,23 @@ GraphAugmentedRetrieveCandidates::Execute (OperationContext &context, if (cache_surface_usable (surface_search_state)) { auto current_knn_rows = LoadCurrentSeedRowsFromCache ( - p_ctx, signal.embedding, static_cast (exclusion_ts), - seed_search_limit, superseded_memory_ids, duplicate_threshold, - seed_cache_profile_ptr); - auto historical_knn_rows = LoadHistoricalSeedRowsFromCache ( - p_ctx, signal.embedding, static_cast (exclusion_ts), + context.GetStore (), p_ctx, signal.embedding, + static_cast (exclusion_ts), seed_search_limit, superseded_memory_ids, duplicate_threshold, - seed_cache_profile_ptr); + seed_cache_profile_ptr, any_sparse_route_enabled, + sqlite_sparse_route_enabled, + sparse_route_capacity); + std::optional>> + historical_knn_rows; + if (any_sparse_route_enabled + && surface_search_state->processor_surface_complete) + historical_knn_rows + = std::vector>{}; + else + historical_knn_rows = LoadHistoricalSeedRowsFromCache ( + p_ctx, signal.embedding, static_cast (exclusion_ts), + seed_search_limit, superseded_memory_ids, duplicate_threshold, + seed_cache_profile_ptr); if (current_knn_rows && historical_knn_rows) { cache_search_available = true; @@ -1581,6 +1738,51 @@ GraphAugmentedRetrieveCandidates::Execute (OperationContext &context, context.AddOperationTiming ( "GraphRetrieve.seed_cache_selected_rows", static_cast (seed_cache_profile.selected_rows)); + context.AddOperationTiming ( + "GraphRetrieve.sqlite_sparse_route_activated_identities", + static_cast ( + seed_cache_profile.sqlite_sparse_route_activated_identities)); + context.AddOperationTiming ( + "GraphRetrieve.sqlite_sparse_route_node_rows", + static_cast ( + seed_cache_profile.sqlite_sparse_route_node_rows)); + context.AddOperationTiming ( + "GraphRetrieve.sqlite_sparse_route_activation_snapshot_rows", + static_cast ( + seed_cache_profile + .sqlite_sparse_route_activation_snapshot_rows)); + context.AddOperationTiming ( + "GraphRetrieve.sqlite_sparse_route_activation_snapshot_cache_miss_rows", + static_cast ( + seed_cache_profile + .sqlite_sparse_route_activation_snapshot_cache_miss_rows)); + context.AddOperationTiming ( + "GraphRetrieve.sqlite_sparse_route_distance_evaluations", + static_cast ( + seed_cache_profile.sqlite_sparse_route_distance_evaluations)); + context.AddOperationTiming ( + "GraphRetrieve.sqlite_sparse_route_search_effort", + static_cast ( + seed_cache_profile.sqlite_sparse_route_search_effort)); + context.AddOperationTiming ( + "GraphRetrieve.sqlite_sparse_route_search_node_budget", + static_cast ( + seed_cache_profile.sqlite_sparse_route_search_node_budget)); + context.AddOperationTiming ( + "GraphRetrieve.sqlite_sparse_route_restart_rows", + static_cast ( + seed_cache_profile.sqlite_sparse_route_restart_rows)); + context.AddOperationTiming ( + "GraphRetrieve.sqlite_sparse_route_dirty_rows", + static_cast ( + seed_cache_profile.sqlite_sparse_route_dirty_rows)); + context.AddOperationTiming ( + "GraphRetrieve.sqlite_sparse_route_search_failure_code", + static_cast ( + seed_cache_profile.sqlite_sparse_route_search_failure_code)); + context.AddOperationTiming ( + "GraphRetrieve.seed_sparse_route_active", + seed_cache_profile.sparse_route_used ? 1.0 : 0.0); } if (!cache_search_available && surface_search_state @@ -1594,9 +1796,11 @@ GraphAugmentedRetrieveCandidates::Execute (OperationContext &context, surface_search_state = historical_surface_search_cache_internal::Find (p_ctx); if (auto current_knn_rows = LoadCurrentSeedRowsFromCache ( - p_ctx, signal.embedding, + context.GetStore (), p_ctx, signal.embedding, static_cast (exclusion_ts), seed_search_limit, - superseded_memory_ids, duplicate_threshold, nullptr)) + superseded_memory_ids, duplicate_threshold, nullptr, + any_sparse_route_enabled, sqlite_sparse_route_enabled, + sparse_route_capacity)) { cache_search_available = true; AppendUniqueRows (rows, std::move (*current_knn_rows), @@ -1629,13 +1833,23 @@ GraphAugmentedRetrieveCandidates::Execute (OperationContext &context, if (cache_surface_usable (surface_search_state)) { auto current_knn_rows = LoadCurrentSeedRowsFromCache ( - p_ctx, signal.embedding, - static_cast (exclusion_ts), seed_search_limit, - superseded_memory_ids, duplicate_threshold, nullptr); - auto historical_knn_rows = LoadHistoricalSeedRowsFromCache ( - p_ctx, signal.embedding, + context.GetStore (), p_ctx, signal.embedding, static_cast (exclusion_ts), seed_search_limit, - superseded_memory_ids, duplicate_threshold, nullptr); + superseded_memory_ids, duplicate_threshold, nullptr, + any_sparse_route_enabled, sqlite_sparse_route_enabled, + sparse_route_capacity); + std::optional< + std::vector>> + historical_knn_rows; + if (any_sparse_route_enabled + && surface_search_state->processor_surface_complete) + historical_knn_rows + = std::vector>{}; + else + historical_knn_rows = LoadHistoricalSeedRowsFromCache ( + p_ctx, signal.embedding, + static_cast (exclusion_ts), seed_search_limit, + superseded_memory_ids, duplicate_threshold, nullptr); if (current_knn_rows && historical_knn_rows) { cache_search_available = true; @@ -1679,55 +1893,117 @@ GraphAugmentedRetrieveCandidates::Execute (OperationContext &context, profile_timing ("GraphRetrieve.seed_knn_sql", section_start); } - start_profile_timing (); - std::vector seeded; - seeded.reserve (rows.size ()); - for (const auto &row : rows) - { - Candidate candidate; - candidate.memory_id = AnyLongLong (row, "memory_id"); - candidate.embedding_id = AnyLongLong (row, "embedding_id"); - candidate.start_ts = AnyLongLong (row, "start_ts"); - auto it_embedding = row.find ("embedding"); - if (candidate.memory_id <= 0 || candidate.embedding_id <= 0 - || superseded_memory_ids.Contains (candidate.memory_id) - || it_embedding == row.end () - || !AnyToEmbedding (it_embedding->second, embedding_dim, - candidate.embedding)) + std::optional>> + exact_control_rows; + if (capture_sparse_exact_control && cache_search_available) + { + surface_search_state + = historical_surface_search_cache_internal::Find (p_ctx); + if (cache_surface_usable (surface_search_state) + && surface_search_state->processor_surface_complete) { - continue; + FamilyExactComparisonBudget exact_control_family_budget { + 0, sparse_route_parameters.family_exact_comparison_limit, false + }; + ScopedFamilyExactComparisonCounter exact_control_family_scope ( + &exact_control_family_budget); + exact_control_rows = LoadCurrentSeedRowsFromCache ( + context.GetStore (), p_ctx, signal.embedding, + static_cast (exclusion_ts), seed_search_limit, + superseded_memory_ids, duplicate_threshold, nullptr, false, + false, sparse_route_capacity); } - if (constructive_recall_enabled) - { - if (!sql_fallback_rows_current - && !RefreshCandidateFromProcessorSurface ( - p_ctx, candidate, embedding_dim)) - { + } + else if (capture_sparse_exact_control && !rows.empty ()) + { + // During bounded legacy backfill, or after a fail-closed route miss, + // the production path deliberately falls back to the exact SQL seed + // query. That result is both the candidate and its exact control; only + // an active sparse route needs a second full-surface oracle pass. + exact_control_rows = rows; + } + + start_profile_timing (); + const auto build_seeded = [&] ( + const auto &seed_rows, + bool rows_are_current) { + std::vector result; + result.reserve (seed_rows.size ()); + for (const auto &row : seed_rows) + { + Candidate candidate; + candidate.memory_id = AnyLongLong (row, "memory_id"); + candidate.embedding_id = AnyLongLong (row, "embedding_id"); + candidate.start_ts = AnyLongLong (row, "start_ts"); + auto it_embedding = row.find ("embedding"); + if (candidate.memory_id <= 0 || candidate.embedding_id <= 0 + || superseded_memory_ids.Contains (candidate.memory_id) + || it_embedding == row.end () + || !AnyToEmbedding (it_embedding->second, embedding_dim, + candidate.embedding)) + continue; + if (constructive_recall_enabled) + { + if (!rows_are_current + && !RefreshCandidateFromProcessorSurface ( + p_ctx, candidate, embedding_dim)) (void)RefreshCandidateToCurrentSurface ( tx, candidate, embedding_dim); - } - } - candidate.seed_score = core::Map01 ( - Cosine (signal.embedding, candidate.embedding)); - candidate.source_confidence = OriginalEvidenceConfidence ( - p_ctx, candidate.memory_id, - signal.embedding) - .value_or (candidate.seed_score); - candidate.temporal_score = TemporalScore ( - signal.timestamp, candidate.start_ts, F, S, T); - candidate.score = SemanticFirstScore ( - candidate.seed_score, candidate.temporal_score); - candidate.direct_seed = true; - seeded.push_back (std::move (candidate)); - } - if (sql_fallback_rows_current) - { - SortAndLimitCandidates (seeded, seed_limit); - } - else + } + candidate.seed_score = core::Map01 ( + Cosine (signal.embedding, candidate.embedding)); + candidate.source_confidence = OriginalEvidenceConfidence ( + p_ctx, candidate.memory_id, + signal.embedding) + .value_or (candidate.seed_score); + candidate.temporal_score = TemporalScore ( + signal.timestamp, candidate.start_ts, F, S, T); + candidate.score = SemanticFirstScore ( + candidate.seed_score, candidate.temporal_score); + candidate.direct_seed = true; + result.push_back (std::move (candidate)); + } + if (rows_are_current) + SortAndLimitCandidates (result, seed_limit); + else + result = SelectFamilyRepresentatives ( + std::move (result), duplicate_threshold, seed_limit); + return result; + }; + std::vector seeded + = build_seeded (rows, sql_fallback_rows_current); + bool capture_seed_trace = false; +#ifdef CORTEXT_TESTING + capture_seed_trace = true; +#else + capture_seed_trace = internal::experimental_env::Flag ( + "CORTEXT_CAPTURE_RETRIEVAL_SEEDS"); +#endif + if (capture_seed_trace) { - seeded = SelectFamilyRepresentatives ( - std::move (seeded), duplicate_threshold, seed_limit); + const auto trace_candidates = [] (const auto &candidates) { + std::vector traced; + traced.reserve (candidates.size ()); + for (const auto &candidate : candidates) + { + retrieval_trace::RankedCandidate trace; + trace.embedding_id = candidate.embedding_id; + trace.memory_id = candidate.memory_id; + trace.score = candidate.score; + trace.relevance = candidate.seed_score; + trace.temporal_score = candidate.temporal_score; + trace.evidence_confidence = candidate.source_confidence; + trace.activation.base_level = candidate.seed_score; + trace.activation.activation_total = candidate.score; + traced.push_back (trace); + } + return traced; + }; + retrieval_trace::SetLastSeedCandidates ( + trace_candidates (seeded)); + if (exact_control_rows) + retrieval_trace::SetLastExactSeedCandidates ( + trace_candidates (build_seeded (*exact_control_rows, false))); } profile_timing ("GraphRetrieve.seed_rank", section_start); @@ -2138,10 +2414,10 @@ GraphAugmentedRetrieveCandidates::Execute (OperationContext &context, ranked_all.empty () ? 0.0 : 1.0); context.AddOperationTiming ( "GraphRetrieve.family_exact_comparison_count", - static_cast (family_exact_comparison_count)); + static_cast (family_exact_comparison_budget.used)); context.AddOperationTiming ( "GraphRetrieve.family_exact_comparison_activity", - family_exact_comparison_count > 0 ? 1.0 : 0.0); + family_exact_comparison_budget.used > 0 ? 1.0 : 0.0); context.AddOperationTiming ( "GraphRetrieve.cache_rebuild_count", static_cast (cache_rebuild_count)); diff --git a/src/operations/historical_surface_search_cache_internal.hpp b/src/operations/historical_surface_search_cache_internal.hpp index b602cc7c..95277f96 100644 --- a/src/operations/historical_surface_search_cache_internal.hpp +++ b/src/operations/historical_surface_search_cache_internal.hpp @@ -2,12 +2,15 @@ #include "cortext/processor/processor_context.hpp" #include "family_embedding_features_internal.hpp" +#include "sparse_retrieval_route_internal.hpp" +#include "sparse_retrieval_route_sqlite_internal.hpp" #include #include #include #include +#include #include #include #include @@ -146,10 +149,339 @@ struct State std::vector current_entries; std::vector current_search; std::unordered_map current_memory_index; + std::map current_memory_order; mutable std::vector distance_scratch; mutable std::vector ranked_scratch; + sparse_retrieval_route_sqlite_internal::Parameters + sparse_route_parameters + = sparse_retrieval_route_sqlite_internal::DefaultParameters (); + std::shared_ptr sparse_route; + std::shared_ptr + sqlite_sparse_route; + std::shared_ptr + sqlite_sparse_route_backfill; + std::size_t sqlite_sparse_route_backfill_last_sealed_rows = 0; + bool sqlite_sparse_route_backfill_last_published = false; + int sqlite_sparse_route_backfill_failure_code = 0; + std::size_t sqlite_sparse_route_backfill_failure_count = 0; }; +inline std::shared_ptr +EnsureSparseRoute (State &state) +{ + if (state.sparse_route) + return state.sparse_route; + std::vector> entries; + entries.reserve (state.current_entries.size ()); + for (const auto &entry : state.current_entries) + { + if (entry.memory_id <= 0 + || entry.embedding.size () != state.embedding_dim) + return nullptr; + entries.emplace_back (entry.memory_id, entry.embedding); + } + state.sparse_route = sparse_retrieval_route_internal::Route::Create ( + state.embedding_dim, entries, state.sparse_route_parameters.hnsw); + return state.sparse_route; +} + +inline std::shared_ptr +BootstrapSparseRoute (State &state) +{ + if (state.sparse_route) + return state.sparse_route; + if (state.current_entries.size () + <= state.sparse_route_parameters.route_capacity + || state.current_entries.size () + > state.sparse_route_parameters.route_bootstrap_limit) + return nullptr; + return EnsureSparseRoute (state); +} + +inline std::shared_ptr +OpenSQLiteSparseRoute (State &state, Store &store) +{ + if (state.sqlite_sparse_route) + return state.sqlite_sparse_route; + state.sqlite_sparse_route + = sparse_retrieval_route_sqlite_internal::Route::Open ( + store, state.embedding_dim, state.sparse_route_parameters); + if (!state.sqlite_sparse_route) + return nullptr; + + if (!state.sqlite_sparse_route->HasDirtyMemoryIds () + && state.sqlite_sparse_route->ActiveCount () + != state.current_entries.size ()) + { + (void)state.sqlite_sparse_route->Invalidate (); + state.sqlite_sparse_route.reset (); + } + return state.sqlite_sparse_route; +} + +/// Stage the durable dirty journal as a knob-bounded exact delta over the +/// persisted graph. The graph may stay stale between consolidation edges: +/// changed and newly inserted nodes are scored from the authoritative current +/// surface, removed nodes are excluded, and unchanged nodes continue to use +/// row-addressed HNSW traversal. Overflow fails closed to the exact path. +inline std::optional +StageSQLiteSparseRouteDirtyForSearch ( + State &state, + sparse_retrieval_route_sqlite_internal::Route &route) +{ + const std::size_t capacity + = state.sparse_route_parameters.route_capacity; + if (capacity == 0) + return std::nullopt; + // Read one derived sentinel beyond C only to prove whether the complete + // journal fits. At most C identities are ever staged as query work. + const auto dirty_memory_ids = route.DirtyMemoryIds (capacity + 1); + if (!dirty_memory_ids || dirty_memory_ids->size () > capacity) + return std::nullopt; + for (const long long memory_id : *dirty_memory_ids) + { + const auto current = state.current_memory_index.find (memory_id); + if (current == state.current_memory_index.end ()) + { + if (!route.StagePendingRemove (memory_id)) + return std::nullopt; + continue; + } + const std::size_t index = current->second; + if (index >= state.current_entries.size () + || state.current_entries[index].memory_id != memory_id + || !route.StagePendingUpsert ( + memory_id, state.current_entries[index].embedding)) + return std::nullopt; + } + return dirty_memory_ids->size (); +} + +inline bool +AdvanceSQLiteSparseRouteBackfill (State &state, Store &store) +{ + state.sqlite_sparse_route_backfill_last_sealed_rows = 0; + state.sqlite_sparse_route_backfill_last_published = false; + const std::size_t proactive_start_size + = state.sparse_route_parameters.route_capacity + > state.sparse_route_parameters.backfill_batch_size + ? state.sparse_route_parameters.route_capacity + - state.sparse_route_parameters.backfill_batch_size + : 1; + if (state.sqlite_sparse_route + || state.current_entries.size () < proactive_start_size) + return true; + if (!state.sqlite_sparse_route_backfill) + state.sqlite_sparse_route_backfill + = sparse_retrieval_route_sqlite_internal::Route::OpenOrBeginBuild ( + store, state.embedding_dim, state.sparse_route_parameters); + auto &build = state.sqlite_sparse_route_backfill; + if (!build || !build->IsBuilding ()) + return false; + + const auto dirty_memory_ids = build->DirtyMemoryIds ( + state.sparse_route_parameters.route_capacity); + if (!dirty_memory_ids) + return false; + std::size_t dirty_staged = 0; + for (const long long memory_id : *dirty_memory_ids) + { + const auto current = state.current_memory_index.find (memory_id); + if (current == state.current_memory_index.end ()) + { + if (!build->StagePendingRemove (memory_id)) + return false; + ++dirty_staged; + continue; + } + const std::size_t index = current->second; + if (index >= state.current_entries.size () + || state.current_entries[index].memory_id != memory_id + || !build->StagePendingUpsert ( + memory_id, state.current_entries[index].embedding)) + return false; + ++dirty_staged; + } + + const long long cursor = build->BuildCursor (); + auto current = state.current_memory_order.upper_bound (cursor); + std::size_t staged = 0; + long long next_cursor = cursor; + while (current != state.current_memory_order.end () + && staged < state.sparse_route_parameters.backfill_batch_size) + { + const long long memory_id = current->first; + const std::size_t index = current->second; + if (index >= state.current_entries.size () + || state.current_entries[index].memory_id != memory_id + || !build->StagePendingUpsert ( + memory_id, state.current_entries[index].embedding)) + { + (void)build->Invalidate (); + build.reset (); + return false; + } + next_cursor = memory_id; + ++staged; + ++current; + } + if (dirty_staged > 0 || staged > 0) + { + if (!build->SetBuildCursor (next_cursor) || !build->Seal ()) + { + state.sqlite_sparse_route_backfill_failure_code + = build->LastSealFailureCode (); + ++state.sqlite_sparse_route_backfill_failure_count; + (void)build->SetBuildCursor (cursor); + return false; + } + // Preserve the most recent failure code after a later successful retry. + // The cumulative failure count is otherwise impossible to diagnose from + // a completed profile because success would erase the paired cause. + state.sqlite_sparse_route_backfill_last_sealed_rows = staged; + } + if (build->HasDirtyMemoryIds ()) + return true; + if (current != state.current_memory_order.end ()) + return true; + if (build->ActiveCount () != state.current_entries.size () + || !build->PublishBuild (state.current_entries.size ())) + return false; + state.sqlite_sparse_route = build; + build.reset (); + state.sqlite_sparse_route_backfill_last_published = true; + return true; +} + +inline bool +ReconcileSQLiteSparseRoute ( + State &state, Store &store, + const std::shared_ptr + &prior, + const std::shared_ptr &hnsw) +{ + if (prior) + { + const auto dirty_memory_ids = prior->DirtyMemoryIds ( + state.sparse_route_parameters.route_capacity); + if (!dirty_memory_ids) + { + (void)prior->Invalidate (); + state.sqlite_sparse_route.reset (); + return false; + } + for (const long long memory_id : *dirty_memory_ids) + { + const auto current = state.current_memory_index.find (memory_id); + if (current == state.current_memory_index.end ()) + { + if (!prior->StagePendingRemove (memory_id)) + return false; + continue; + } + const std::size_t index = current->second; + if (index >= state.current_entries.size () + || state.current_entries[index].memory_id != memory_id + || !prior->StagePendingUpsert ( + memory_id, state.current_entries[index].embedding)) + return false; + } + if (!dirty_memory_ids->empty () && !prior->Seal ()) + { + (void)prior->Invalidate (); + state.sqlite_sparse_route.reset (); + return false; + } + state.sqlite_sparse_route = prior; + return true; + } + if (auto persisted + = sparse_retrieval_route_sqlite_internal::Route::Open ( + store, state.embedding_dim, state.sparse_route_parameters)) + { + state.sqlite_sparse_route = std::move (persisted); + return true; + } + if (!hnsw) + return false; + std::vector> entries; + entries.reserve (state.current_entries.size ()); + for (const auto &entry : state.current_entries) + { + if (entry.memory_id <= 0 + || entry.embedding.size () != state.embedding_dim) + return false; + entries.emplace_back (entry.memory_id, entry.embedding); + } + state.sqlite_sparse_route + = sparse_retrieval_route_sqlite_internal::Route::Create ( + store, state.embedding_dim, entries, *hnsw, + state.sparse_route_parameters); + return state.sqlite_sparse_route != nullptr; +} + +inline bool +IncrementalSparseRouteSealReady (const State &state, + bool require_sqlite_route) +{ + return !state.recovery_failed && state.current_surface_search_current + && state.processor_surface_complete + && (require_sqlite_route + ? (state.sqlite_sparse_route != nullptr + || state.sqlite_sparse_route_backfill != nullptr + || state.current_entries.size () + > state.sparse_route_parameters.route_capacity) + : (state.sparse_route != nullptr + || state.current_entries.size () + > state.sparse_route_parameters.route_capacity)); +} + +inline bool +SealSparseRouteDelta (State &state) +{ + if (!state.sparse_route || !state.sparse_route->SealDelta ()) + { + if (state.sqlite_sparse_route) + (void)state.sqlite_sparse_route->Invalidate (); + state.sparse_route.reset (); + state.sqlite_sparse_route.reset (); + return false; + } + return true; +} + +inline bool +ReconcileSparseRoute ( + State &state, + const std::shared_ptr &prior) +{ + std::vector> entries; + entries.reserve (state.current_entries.size ()); + for (const auto &entry : state.current_entries) + { + if (entry.memory_id <= 0 + || entry.embedding.size () != state.embedding_dim) + return false; + entries.emplace_back (entry.memory_id, entry.embedding); + } + if (prior && prior->Sync (entries) && prior->SealDelta ()) + { + state.sparse_route = prior; + return true; + } + if (prior) + { + // A failed incremental seal must not hide an unbounded consolidation + // rebuild. Drop the derived route and let exact retrieval remain the + // correctness fallback until it can be recovered from SQLite. + state.sparse_route.reset (); + return false; + } + state.sparse_route = sparse_retrieval_route_internal::Route::Create ( + state.embedding_dim, entries, state.sparse_route_parameters.hnsw); + return state.sparse_route != nullptr; +} + inline bool CurrentMatchesSupersessionEntry (const State &state, long long memory_id) { @@ -317,6 +649,19 @@ SetProcessorSurfaceComplete (const ProcessorContext &ctx, bool complete) state->processor_surface_complete = complete; } +inline void +SetSparseRouteParameters ( + const ProcessorContext &ctx, + sparse_retrieval_route_sqlite_internal::Parameters parameters) +{ + auto ®istry = Registry (); + std::lock_guard lock (registry.mutex); + auto &state = registry.states[&ctx]; + if (!state) + state = std::make_shared (); + state->sparse_route_parameters = std::move (parameters); +} + inline void MarkRecoveryFailed (const ProcessorContext &ctx, bool preserve_surface_state = false) @@ -333,11 +678,24 @@ MarkRecoveryFailed (const ProcessorContext &ctx, = existing->second->current_surface_database_current; state->processor_surface_complete = existing->second->processor_surface_complete; + state->embedding_dim = existing->second->embedding_dim; + state->sparse_route_parameters + = existing->second->sparse_route_parameters; // Preserve only the current-to-base lineage needed to reconstruct the // search surface. The searchable vector buffer is intentionally not // copied, and recovery_failed keeps every cache reader fail-closed. state->current_entries = existing->second->current_entries; state->current_memory_index = existing->second->current_memory_index; + state->current_memory_order = existing->second->current_memory_order; + // An unpublished generation cannot affect retrieval correctness. Keep + // its bounded progress across exact-SQL recovery and let the next + // authoritative Reset validate the population before publication. + state->sqlite_sparse_route_backfill + = existing->second->sqlite_sparse_route_backfill; + state->sqlite_sparse_route_backfill_failure_code + = existing->second->sqlite_sparse_route_backfill_failure_code; + state->sqlite_sparse_route_backfill_failure_count + = existing->second->sqlite_sparse_route_backfill_failure_count; } registry.states[&ctx] = std::move (state); } @@ -350,10 +708,35 @@ Erase (const ProcessorContext &ctx) registry.states.erase (&ctx); } +inline void +InvalidateHistoricalPreserveCurrent (const ProcessorContext &ctx) +{ + auto state = FindMutable (ctx); + if (!state) + return; + state->entries.clear (); + state->search.clear (); + state->embedding_index.clear (); + state->long_term_entry_indices.clear (); + state->long_term_index_positions.clear (); + state->supersession_entry_indices.clear (); + state->supersession_index_positions.clear (); + state->supersession_entry_by_memory.clear (); + state->supersession_population_mismatches.clear (); + state->supersession_population_ambiguous = false; + state->supersession_tie_order_equivalent = true; + state->supersession_embedding_fanout = false; + state->supersession_max_embedding_id = 0; + state->supersession_max_memory_id = 0; + state->distance_scratch.clear (); + state->ranked_scratch.clear (); +} + inline bool Reset (const ProcessorContext &ctx, std::vector entries, std::vector current_entries = {}) { + const auto prior_state = FindMutable (ctx); auto state = std::make_shared (); std::unordered_map unique_embedding_index; state->entries.reserve (entries.size ()); @@ -505,6 +888,7 @@ Reset (const ProcessorContext &ctx, std::vector entries, Erase (ctx); return false; } + state->current_memory_order.emplace (entry.memory_id, index); state->current_search.insert (state->current_search.end (), entry.embedding.data (), entry.embedding.data () @@ -518,6 +902,30 @@ Reset (const ProcessorContext &ctx, std::vector entries, } for (const auto &entry : state->current_entries) RefreshSupersessionPopulationMismatch (*state, entry.memory_id); + // A search-buffer refresh does not create a new retrieval-route lifecycle. + // Preserve process-owned route handles that have already observed the same + // authoritative mutations; explicit Erase/recovery paths still discard + // them before Reset and therefore fail closed. + if (prior_state && prior_state->embedding_dim == state->embedding_dim) + { + state->sparse_route_parameters + = prior_state->sparse_route_parameters; + state->current_surface_database_current + = prior_state->current_surface_database_current; + state->processor_surface_complete + = prior_state->processor_surface_complete; + if (!prior_state->recovery_failed) + { + state->sparse_route = prior_state->sparse_route; + state->sqlite_sparse_route = prior_state->sqlite_sparse_route; + } + state->sqlite_sparse_route_backfill + = prior_state->sqlite_sparse_route_backfill; + state->sqlite_sparse_route_backfill_failure_code + = prior_state->sqlite_sparse_route_backfill_failure_code; + state->sqlite_sparse_route_backfill_failure_count + = prior_state->sqlite_sparse_route_backfill_failure_count; + } auto ®istry = Registry (); state->current_surface_search_current = true; std::lock_guard lock (registry.mutex); @@ -561,18 +969,49 @@ UpsertCurrent (const ProcessorContext &ctx, Entry entry) + static_cast (offset)); RefreshSupersessionPopulationMismatch ( state, state.current_entries[index].memory_id); + if (state.sparse_route + && !state.sparse_route->Upsert ( + state.current_entries[index].memory_id, + state.current_entries[index].embedding)) + state.sparse_route.reset (); + if (state.sqlite_sparse_route + && !state.sqlite_sparse_route->Upsert ( + state.current_entries[index].memory_id, + state.current_entries[index].embedding)) + state.sqlite_sparse_route.reset (); + if (state.sqlite_sparse_route_backfill + && !state.sqlite_sparse_route_backfill->Upsert ( + state.current_entries[index].memory_id, + state.current_entries[index].embedding)) + state.sqlite_sparse_route_backfill.reset (); return; } if (entry.base_embedding_id <= 0) entry.base_embedding_id = entry.embedding_id; state.current_memory_index.emplace (entry.memory_id, state.current_entries.size ()); + state.current_memory_order.emplace (entry.memory_id, + state.current_entries.size ()); state.current_search.insert (state.current_search.end (), entry.embedding.data (), entry.embedding.data () + entry.embedding.size ()); state.current_entries.push_back (std::move (entry)); RefreshSupersessionPopulationMismatch ( state, state.current_entries.back ().memory_id); + if (state.sparse_route + && !state.sparse_route->Upsert (state.current_entries.back ().memory_id, + state.current_entries.back ().embedding)) + state.sparse_route.reset (); + if (state.sqlite_sparse_route + && !state.sqlite_sparse_route->Upsert ( + state.current_entries.back ().memory_id, + state.current_entries.back ().embedding)) + state.sqlite_sparse_route.reset (); + if (state.sqlite_sparse_route_backfill + && !state.sqlite_sparse_route_backfill->Upsert ( + state.current_entries.back ().memory_id, + state.current_entries.back ().embedding)) + state.sqlite_sparse_route_backfill.reset (); } inline long long @@ -615,6 +1054,8 @@ RemoveCurrent (const ProcessorContext &ctx, long long memory_id) { state.current_entries[index] = std::move (state.current_entries[last]); state.current_memory_index[state.current_entries[index].memory_id] = index; + state.current_memory_order[state.current_entries[index].memory_id] + = index; const std::size_t dst = index * static_cast (state.embedding_dim); const std::size_t src @@ -625,11 +1066,20 @@ RemoveCurrent (const ProcessorContext &ctx, long long memory_id) state.current_search.begin () + static_cast (dst)); } state.current_memory_index.erase (memory_id); + state.current_memory_order.erase (memory_id); state.current_entries.pop_back (); state.current_search.resize ( state.current_entries.size () * static_cast (state.embedding_dim)); RefreshSupersessionPopulationMismatch (state, memory_id); + if (state.sparse_route && !state.sparse_route->Remove (memory_id)) + state.sparse_route.reset (); + if (state.sqlite_sparse_route + && !state.sqlite_sparse_route->Remove (memory_id)) + state.sqlite_sparse_route.reset (); + if (state.sqlite_sparse_route_backfill + && !state.sqlite_sparse_route_backfill->Remove (memory_id)) + state.sqlite_sparse_route_backfill.reset (); } inline void diff --git a/src/operations/memory_storage.cpp b/src/operations/memory_storage.cpp index 2658f667..cf9d2121 100644 --- a/src/operations/memory_storage.cpp +++ b/src/operations/memory_storage.cpp @@ -1,6 +1,8 @@ #include "cortext/operations/memory_storage.hpp" #include "constructive_recall_internal.hpp" +#include "active_signal_embedding_ring_internal.hpp" #include "historical_surface_search_cache_internal.hpp" +#include "retrieval_trace_state.hpp" #include "association_fanout_cache_internal.hpp" #include "emotional_metadata_cache_internal.hpp" #include "signal_record_rollback_internal.hpp" @@ -142,6 +144,10 @@ struct BorrowedSupersessionCandidate struct CurrentSupersessionSearchProof { bool valid = false; + bool bounded_current_surface = false; + std::size_t sparse_route_node_rows = 0; + std::size_t sparse_route_distance_evaluations = 0; + std::size_t sparse_route_dirty_rows = 0; std::vector ranked_memory_ids; float cutoff_distance = 0.0f; long long cutoff_memory_id = 0; @@ -393,6 +399,18 @@ LoadHistoricalSupersessionRowsFromCache ( return std::nullopt; } + // Once the complete current surface is served through the bounded route, + // consolidation's current centroid is the active supersession identity. + // Historical embeddings remain durable lineage but no longer form a second + // competing candidate population for the same memory. + if (current_search_proof.bounded_current_surface + && state->processor_surface_complete) + { + if (coverage_proven) + *coverage_proven = true; + return std::vector{}; + } + if (historical_surface_search_cache_internal:: CurrentPopulationCoversHistorical (*state, memory_id)) { @@ -489,8 +507,9 @@ LoadHistoricalSupersessionRowsFromCache ( std::optional> LoadCurrentSupersessionRowsFromCache ( + Store *store, const std::shared_ptr< - const historical_surface_search_cache_internal::State> &state, + historical_surface_search_cache_internal::State> &state, const ProcessorContext &p_ctx, const Eigen::VectorXf &query_embedding, long long memory_id, long long end_ts, int candidate_limit, CurrentSupersessionSearchProof *proof, std::size_t *rows_visited) @@ -514,31 +533,80 @@ LoadCurrentSupersessionRowsFromCache ( proof->valid = true; return std::vector{}; } + + const bool use_sparse_route + = entry_count > state->sparse_route_parameters.route_capacity; + std::vector candidate_indices; + if (use_sparse_route) + { + auto route = store + ? historical_surface_search_cache_internal:: + OpenSQLiteSparseRoute (*state, *store) + : nullptr; + if (!route) + return std::nullopt; + const auto dirty_rows = historical_surface_search_cache_internal:: + StageSQLiteSparseRouteDirtyForSearch (*state, *route); + if (!dirty_rows) + return std::nullopt; + const auto memory_ids = route->SearchActivated (query_embedding); + if (!memory_ids) + return std::nullopt; + candidate_indices.reserve (memory_ids->size ()); + for (const long long candidate_memory_id : *memory_ids) + { + const auto index + = state->current_memory_index.find (candidate_memory_id); + if (index == state->current_memory_index.end () + || index->second >= entry_count) + return std::nullopt; + candidate_indices.push_back (index->second); + } + if (proof) + { + proof->bounded_current_surface = true; + proof->sparse_route_node_rows = route->LastSearchNodeRows (); + proof->sparse_route_distance_evaluations + = route->LastSearchDistanceEvaluations (); + proof->sparse_route_dirty_rows = *dirty_rows; + } + } using RowMajorMatrix = Eigen::Matrix; const Eigen::Map matrix ( state->current_search.data (), static_cast (entry_count), embedding_dim); + const std::size_t comparison_count + = use_sparse_route ? candidate_indices.size () : entry_count; if (rows_visited) - *rows_visited = entry_count; + *rows_visited = comparison_count; auto &distance_scratch = state->distance_scratch; - distance_scratch.resize (entry_count); - Eigen::Map distances ( - distance_scratch.data (), static_cast (entry_count)); - distances = (matrix.rowwise () - query_embedding.transpose ()) - .rowwise () - .squaredNorm (); + if (!use_sparse_route) + { + distance_scratch.resize (entry_count); + Eigen::Map distances ( + distance_scratch.data (), static_cast (entry_count)); + distances = (matrix.rowwise () - query_embedding.transpose ()) + .rowwise () + .squaredNorm (); + } auto &ranked = state->ranked_scratch; ranked.clear (); - ranked.reserve (entry_count); - for (std::size_t index = 0; index < entry_count; ++index) + ranked.reserve (comparison_count); + for (std::size_t candidate = 0; candidate < comparison_count; ++candidate) { + const std::size_t index + = use_sparse_route ? candidate_indices[candidate] : candidate; const auto &entry = state->current_entries[index]; if (entry.memory_id <= 0 || entry.embedding_id <= 0 || entry.embedding.size () != embedding_dim) return std::nullopt; - ranked.push_back ( - { index, distances[static_cast (index)] }); + ranked.push_back ({ + index, + use_sparse_route + ? (entry.embedding - query_embedding).squaredNorm () + : distance_scratch[static_cast (index)] + }); } auto by_distance = [&state] ( const historical_surface_search_cache_internal::RankedEntry &a, @@ -556,7 +624,7 @@ LoadCurrentSupersessionRowsFromCache ( } std::sort (ranked.begin (), ranked.end (), by_distance); - if (proof) + if (proof && !use_sparse_route) { proof->valid = true; proof->ranked_memory_ids.reserve (ranked.size ()); @@ -605,6 +673,8 @@ LoadSupersessionCandidateRows (OperationContext &context, Transaction &tx, SupersessionCandidateRows result; result.cache_owner = historical_surface_search_cache_internal::Find (p_ctx); + auto mutable_cache_owner + = historical_surface_search_cache_internal::FindMutable (p_ctx); std::unordered_set seen_memory_ids; std::size_t current_execution_count = 0; std::size_t historical_execution_count = 0; @@ -616,7 +686,8 @@ LoadSupersessionCandidateRows (OperationContext &context, Transaction &tx, embedding_to_store); const auto current_start = SteadyClock::now (); auto current_cache_rows = LoadCurrentSupersessionRowsFromCache ( - result.cache_owner, p_ctx, embedding_to_store, memory_id, end_ts, + context.GetStore (), mutable_cache_owner, p_ctx, embedding_to_store, + memory_id, end_ts, candidate_limit, ¤t_search_proof, ¤t_rows_visited); if (current_cache_rows) { @@ -739,9 +810,22 @@ LoadSupersessionCandidateRows (OperationContext &context, Transaction &tx, context.AddOperationTiming ( "MemoryStorage.supersession_current_rows_visited", static_cast (current_rows_visited)); + context.AddOperationTiming ( + "MemoryStorage.supersession_sparse_route_node_rows", + static_cast (current_search_proof.sparse_route_node_rows)); + context.AddOperationTiming ( + "MemoryStorage.supersession_sparse_route_distance_evaluations", + static_cast ( + current_search_proof.sparse_route_distance_evaluations)); + context.AddOperationTiming ( + "MemoryStorage.supersession_sparse_route_dirty_rows", + static_cast (current_search_proof.sparse_route_dirty_rows)); context.AddOperationTiming ( "MemoryStorage.supersession_historical_rows_visited", static_cast (historical_rows_visited)); + context.AddOperationTiming ( + "MemoryStorage.supersession_rows_visited_activity", + current_rows_visited + historical_rows_visited > 0 ? 1.0 : 0.0); // When both cache searches completed and historical coverage was proven, // an empty result is exact even when the just-inserted memory is the sole @@ -1252,44 +1336,20 @@ MemoryStorage::Execute (OperationContext &context, Transaction &tx) const double signal_embedding_insert_ms = 0.0; double signal_row_insert_ms = 0.0; double signal_id_select_ms = 0.0; + const int active_signal_embedding_capacity + = active_signal_embedding_ring_internal::Capacity ( + cfg.focus, cfg.sensitivity, cfg.stability); + const auto ensure_signal_embedding_ring_start = SteadyClock::now (); + active_signal_embedding_ring_internal::EnsureCapacity ( + *savepoint, active_signal_embedding_capacity); + signal_embedding_insert_ms + += ElapsedMillis (ensure_signal_embedding_ring_start); for (const auto &sig_rec : acc.signals) { const std::vector signal_embedding = sig_rec.embedding.size () > 0 ? EigenToFloatVec (sig_rec.embedding) : emb_vec; - const auto signal_embedding_start = SteadyClock::now (); - savepoint->Execute (insert_sql, - { signal_embedding, - static_cast (sig_rec.timestamp) }); - signal_embedding_insert_ms += ElapsedMillis (signal_embedding_start); - - const auto signal_embedding_id_start = SteadyClock::now (); - auto signal_embedding_id_rows - = savepoint->Execute ("SELECT last_insert_rowid() AS id", {}); - signal_id_select_ms += ElapsedMillis (signal_embedding_id_start); - if (signal_embedding_id_rows.empty () - || signal_embedding_id_rows[0].count ("id") == 0) - { - rollback_savepoints (); - telemetry::AddCounter ( - "cortext.memory_storage.signal_embedding_error_total", 1); - return; - } - const long long signal_embedding_id - = AnyToLongLong (signal_embedding_id_rows[0].at ("id")) - .value_or (0); - if (signal_embedding_id <= 0) - { - rollback_savepoints (); - telemetry::AddCounter ( - "cortext.memory_storage.signal_embedding_error_total", 1); - return; - } - inserted_search_entries.push_back ( - { signal_embedding_id, 0, 0, std::string (), std::string (), - sig_rec.embedding.size () > 0 ? sig_rec.embedding - : embedding_to_store }); const auto signal_row_start = SteadyClock::now (); savepoint->Execute ( @@ -1297,7 +1357,7 @@ MemoryStorage::Execute (OperationContext &context, Transaction &tx) const " memory_id, source_id, embedding_id, timestamp, modality, " " mime, blob_id, serial_position, score, created_at" ") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", - { memory_id, signal.source_id, signal_embedding_id, + { memory_id, signal.source_id, embedding_id, static_cast (sig_rec.timestamp), sig_rec.modality, sig_rec.mime, sig_rec.blob_id.empty () ? std::any () @@ -1316,6 +1376,13 @@ MemoryStorage::Execute (OperationContext &context, Transaction &tx) const = AnyToLongLong (signal_id_rows[0].at ("id")); if (signal_id && *signal_id > 0) { + const auto signal_embedding_start = SteadyClock::now (); + active_signal_embedding_ring_internal::InsertAtCapacity ( + *savepoint, *signal_id, signal_embedding, + static_cast (sig_rec.timestamp), + active_signal_embedding_capacity); + signal_embedding_insert_ms + += ElapsedMillis (signal_embedding_start); stored_signal_id = *signal_id; if (sig_rec.timestamp == signal.timestamp && sig_rec.modality == signal.modality) @@ -1334,8 +1401,6 @@ MemoryStorage::Execute (OperationContext &context, Transaction &tx) const for (auto &entry : inserted_search_entries) { - // Signal-only embeddings participate in sqlite-vec's top-k - // population even though the subsequent memory join filters them. historical_surface_search_cache_internal::Append ( p_ctx, std::move (entry)); } @@ -1417,6 +1482,8 @@ MemoryStorage::Execute (OperationContext &context, Transaction &tx) const } surface_entry.embedding = embedding_to_store; p_ctx.UpsertRetrievalSurface (std::move (surface_entry)); + retrieval_trace::RecordSurfaceUpsert ( + memory_id, embedding_id, ToFloatVector (embedding_to_store)); auto &fanout_cache = p_ctx.association_fanout_cache; if (fanout_cache.valid && !supersession_edges.empty ()) { @@ -1449,11 +1516,16 @@ MemoryStorage::Execute (OperationContext &context, Transaction &tx) const embedding_id, target_embedding_id, "supersedes", edge.weight, static_cast (end_ts)); } - if (incrementally_maintained) - association_fanout_cache::BuildSupersessionEligibility ( - fanout_cache, p_ctx); - else + if (!incrementally_maintained) fanout_cache.valid = false; + else + { + const auto sidecar + = execution_cache_sidecar_internal::Ensure (p_ctx); + if (!sidecar->supersession_eligibility.valid) + association_fanout_cache::BuildSupersessionEligibility ( + fanout_cache, p_ctx); + } } if (!constructive_recall::Disabled () && !constructive_recall::CurrentSurfaceWritesDisabled ()) diff --git a/src/operations/memory_strength.cpp b/src/operations/memory_strength.cpp index fa9e7cb5..de68885a 100644 --- a/src/operations/memory_strength.cpp +++ b/src/operations/memory_strength.cpp @@ -1,5 +1,6 @@ #include "cortext/operations/memory_strength.hpp" #include "historical_surface_search_cache_internal.hpp" +#include "retrieval_trace_state.hpp" #include "emotional_metadata_cache_internal.hpp" #include "execution_cache_sidecar_internal.hpp" #include "association_fanout_cache_internal.hpp" @@ -508,9 +509,6 @@ UpdateMemoryStrength::Execute (OperationContext &context, Transaction &tx) const traces[2], traces[3], ts, lookup_id }); rif_state_internal::RefreshActiveStrengthWhere ( tx, std::string (lookup_column) + " = ?", { lookup_id }); - rif_active_epoch_cache_internal::StageMemory ( - execution_cache_sidecar_internal::Ensure (p_ctx)->rif_active_epoch, - row_memory_id); if (row_memory_id > 0) { p_ctx.UpdateRetrievalSurfaceUsageByMemory (row_memory_id, @@ -677,11 +675,15 @@ UpdateMemoryStrength::Execute (OperationContext &context, Transaction &tx) const association_fanout_cache::NotifyRetrievalSurfaceChanged (p_ctx, memory_id); p_ctx.RemoveRetrievalSurface (memory_id); + retrieval_trace::RecordSurfaceRemove (memory_id); + historical_surface_search_cache_internal::RemoveCurrent (p_ctx, + memory_id); } // The embedding deletion phase can preserve rows still referenced by other // owners. Drop the private accelerator rather than guess at post-transaction // membership; the exact SQL path remains authoritative after eviction. - historical_surface_search_cache_internal::Erase (p_ctx); + historical_surface_search_cache_internal:: + InvalidateHistoricalPreserveCurrent (p_ctx); const auto reconstruction_embedding_select_start = SteadyClock::now (); ForEachChunk (evictable_memory_ids.size (), @@ -849,8 +851,9 @@ UpdateMemoryStrength::Execute (OperationContext &context, Transaction &tx) const { // Some candidates may remain referenced after eviction. Invalidate the // private population rather than guessing which conditional deletes won. - historical_surface_search_cache_internal::Erase ( - context.GetProcessorContext ()); + historical_surface_search_cache_internal:: + InvalidateHistoricalPreserveCurrent ( + context.GetProcessorContext ()); } const auto embedding_delete_start = SteadyClock::now (); ForEachChunk (evictable_embedding_ids.size (), diff --git a/src/operations/reconsolidation.cpp b/src/operations/reconsolidation.cpp index 5bd2f986..4ad82ad9 100644 --- a/src/operations/reconsolidation.cpp +++ b/src/operations/reconsolidation.cpp @@ -2,6 +2,7 @@ #include "historical_surface_search_cache_internal.hpp" #include "association_fanout_cache_internal.hpp" #include "constructive_recall_internal.hpp" +#include "retrieval_trace_state.hpp" #include "neuromodulator_internal.hpp" #include "cortext/core/algorithms.hpp" #include "cortext/core/knobs.hpp" @@ -131,6 +132,8 @@ RefreshProcessorSurfaces (Transaction &tx, ProcessorContext *p_ctx, { new_embedding_id, memory_id, 0, std::string (), std::string (), embedding }); } + retrieval_trace::RecordSurfaceUpsert ( + memory_id, new_embedding_id, ToFloatVector (embedding)); } long long @@ -173,7 +176,8 @@ WriteEmbeddingInPlaceOrFork (Transaction &tx, long long memory_id, // Replacing or forking a joined base row changes both the vector and its // join metadata. Fall back to authoritative SQL rather than risk a // partially updated pre-filter population. - historical_surface_search_cache_internal::Erase (*p_ctx); + historical_surface_search_cache_internal:: + InvalidateHistoricalPreserveCurrent (*p_ctx); } auto ref_rows = tx.Execute ( "SELECT " diff --git a/src/operations/retrieval_trace_state.cpp b/src/operations/retrieval_trace_state.cpp index 6cff1997..32d39c90 100644 --- a/src/operations/retrieval_trace_state.cpp +++ b/src/operations/retrieval_trace_state.cpp @@ -8,9 +8,13 @@ namespace thread_local std::vector g_last_selected_embedding_order; thread_local std::vector g_last_ranked_candidates; +thread_local std::vector g_last_seed_candidates; +thread_local std::vector g_last_exact_seed_candidates; thread_local std::vector g_last_rejected_candidates; thread_local std::vector g_last_evidence_packets; thread_local RetrievalSummary g_last_retrieval_summary; +thread_local std::vector g_surface_mutations; +thread_local bool g_surface_mutation_capture_enabled = false; #ifdef CORTEXT_TESTING thread_local std::size_t g_last_family_exact_comparison_count = 0; thread_local std::size_t g_last_sql_fallback_query_count = 0; @@ -20,6 +24,53 @@ thread_local bool g_capture_enabled = true; } // namespace +void +SetSurfaceMutationCaptureEnabled (bool enabled) +{ + g_surface_mutation_capture_enabled = enabled; + if (!enabled) + g_surface_mutations.clear (); +} + +bool +SurfaceMutationCaptureEnabled () +{ + return g_surface_mutation_capture_enabled; +} + +void +ClearSurfaceMutations () +{ + g_surface_mutations.clear (); +} + +void +RecordSurfaceUpsert (long long memory_id, long long embedding_id, + std::vector embedding) +{ + if (!g_surface_mutation_capture_enabled || memory_id <= 0 + || embedding_id <= 0 || embedding.empty ()) + return; + g_surface_mutations.push_back ( + { SurfaceMutation::Action::Upsert, memory_id, embedding_id, + std::move (embedding) }); +} + +void +RecordSurfaceRemove (long long memory_id) +{ + if (!g_surface_mutation_capture_enabled || memory_id <= 0) + return; + g_surface_mutations.push_back ( + { SurfaceMutation::Action::Remove, memory_id, 0, {} }); +} + +const std::vector & +GetSurfaceMutations () +{ + return g_surface_mutations; +} + void ClearLastSelectedEmbeddingOrder () { @@ -56,6 +107,43 @@ GetLastRankedCandidates () return g_last_ranked_candidates; } +void +ClearLastSeedCandidates () +{ + g_last_seed_candidates.clear (); +} + +void +SetLastSeedCandidates (const std::vector &candidates) +{ + g_last_seed_candidates = candidates; +} + +const std::vector & +GetLastSeedCandidates () +{ + return g_last_seed_candidates; +} + +void +ClearLastExactSeedCandidates () +{ + g_last_exact_seed_candidates.clear (); +} + +void +SetLastExactSeedCandidates ( + const std::vector &candidates) +{ + g_last_exact_seed_candidates = candidates; +} + +const std::vector & +GetLastExactSeedCandidates () +{ + return g_last_exact_seed_candidates; +} + void ClearLastRejectedCandidates () { diff --git a/src/operations/retrieval_trace_state.hpp b/src/operations/retrieval_trace_state.hpp index 3dd94084..31e23a96 100644 --- a/src/operations/retrieval_trace_state.hpp +++ b/src/operations/retrieval_trace_state.hpp @@ -89,12 +89,33 @@ struct RetrievalSummary double evidence_packet_confidence_mean = 0.0; }; +struct SurfaceMutation +{ + enum class Action + { + Upsert, + Remove, + }; + + Action action = Action::Upsert; + long long memory_id = 0; + long long embedding_id = 0; + std::vector embedding; +}; + void ClearLastSelectedEmbeddingOrder (); void SetLastSelectedEmbeddingOrder (const std::vector &embedding_ids); const std::vector &GetLastSelectedEmbeddingOrder (); void ClearLastRankedCandidates (); void SetLastRankedCandidates (const std::vector &candidates); const std::vector &GetLastRankedCandidates (); +void ClearLastSeedCandidates (); +void SetLastSeedCandidates (const std::vector &candidates); +const std::vector &GetLastSeedCandidates (); +void ClearLastExactSeedCandidates (); +void +SetLastExactSeedCandidates (const std::vector &candidates); +const std::vector &GetLastExactSeedCandidates (); void ClearLastRejectedCandidates (); void SetLastRejectedCandidates (const std::vector &candidates); @@ -114,6 +135,13 @@ std::size_t GetLastSqlFallbackQueryCount (); void ClearLastSqlFallbackMaterializedRowCount (); void SetLastSqlFallbackMaterializedRowCount (std::size_t count); std::size_t GetLastSqlFallbackMaterializedRowCount (); +void SetSurfaceMutationCaptureEnabled (bool enabled); +bool SurfaceMutationCaptureEnabled (); +void ClearSurfaceMutations (); +void RecordSurfaceUpsert (long long memory_id, long long embedding_id, + std::vector embedding); +void RecordSurfaceRemove (long long memory_id); +const std::vector &GetSurfaceMutations (); bool CaptureEnabled (); diff --git a/src/operations/rif_active_epoch_cache_internal.hpp b/src/operations/rif_active_epoch_cache_internal.hpp index 190e46e4..8b208ac0 100644 --- a/src/operations/rif_active_epoch_cache_internal.hpp +++ b/src/operations/rif_active_epoch_cache_internal.hpp @@ -3,13 +3,16 @@ #include "cortext/store/sqlite_store.hpp" #include "cortext/store/store.hpp" #include "cortext/store/utils.hpp" +#include "sparse_retrieval_knobs_internal.hpp" #include #include #include #include +#include #include #include +#include #include #include #include @@ -18,9 +21,32 @@ namespace cortext::operations::rif_active_epoch_cache_internal { -inline constexpr std::size_t kEventLimit = 512; -inline constexpr std::size_t kMutationLimit = 32768; -inline constexpr std::size_t kAllocatedByteLimit = 64ULL * 1024ULL * 1024ULL; +struct Limits +{ + std::size_t event_count = 0; + std::size_t mutation_count = 0; + std::size_t allocated_bytes = 0; + std::size_t row_batch_size = 0; + + bool operator== (const Limits &) const = default; +}; + +inline Limits +DeriveLimits (double focus, double sensitivity, double stability) +{ + const auto event_count = static_cast ( + sparse_retrieval_knobs_internal::RouteCapacity ( + focus, sensitivity, stability)); + const auto row_batch_size = static_cast ( + sparse_retrieval_knobs_internal::BackfillBatchSize ( + focus, sensitivity, stability)); + return { + event_count, + event_count * 64, + event_count * 128ULL * 1024ULL, + row_batch_size, + }; +} struct State { @@ -28,6 +54,7 @@ struct State // snapshotted. It is read-only until the authoritative transaction commits; // pending publication metadata below is copied by value. std::shared_ptr database; + Limits limits = DeriveLimits (0.5, 0.5, 0.5); bool valid = false; long long generation = 0; double log_factor = 0.0; @@ -36,6 +63,7 @@ struct State std::size_t event_count = 0; std::size_t mutation_count = 0; std::size_t allocated_bytes = 0; + std::size_t row_batch_high_water = 0; std::vector calibration_memory_ids; std::vector pending_memory_ids; bool pending_clock = false; @@ -45,6 +73,7 @@ struct State bool pending_rebuild = false; bool pending_rebuild_resets_counters = false; bool invalid_rebuild_resets_counters = true; + bool empty_epoch_reset_required = false; }; struct PublishResult @@ -53,14 +82,16 @@ struct PublishResult bool rebuilt = false; bool recovered_from_failure = false; std::size_t changed_rows = 0; + std::size_t maximum_statement_rows = 0; }; inline bool RequiresConsolidation (const State &state) { - return state.event_count >= kEventLimit - || state.mutation_count >= kMutationLimit - || state.allocated_bytes >= kAllocatedByteLimit; + return state.event_count >= state.limits.event_count + || state.mutation_count >= state.limits.mutation_count + || state.allocated_bytes >= state.limits.allocated_bytes + || state.row_batch_high_water > state.limits.row_batch_size; } inline long long @@ -100,12 +131,7 @@ CreateDatabase () "last_ts INTEGER NOT NULL)"); database->Execute ( "CREATE TABLE active_state(" - "memory_id INTEGER PRIMARY KEY, generation INTEGER NOT NULL, " - "anchor_suppression REAL NOT NULL, recovery_total REAL NOT NULL, " - "anchor_log_factor REAL NOT NULL, expires_log_factor REAL NOT NULL)"); - database->Execute ( - "CREATE INDEX active_state_due ON active_state(" - "generation, expires_log_factor, memory_id)"); + "memory_id INTEGER PRIMARY KEY)"); return database; } @@ -125,10 +151,55 @@ Placeholders (std::size_t count) inline std::vector> LoadCurrentRows (Store &persistent, long long generation, + std::size_t row_batch_size, const std::vector *memory_ids = nullptr) { if (memory_ids && memory_ids->empty ()) return {}; + if (row_batch_size == 0) + throw std::invalid_argument ("RIF active-epoch row batch is zero"); + if (!memory_ids) + { + std::vector> rows; + long long after_memory_id = 0; + while (true) + { + auto batch_rows = persistent.Execute ( + "SELECT memory_id FROM rif_active_state WHERE generation = ? " + "AND memory_id > ? ORDER BY memory_id LIMIT ?", + { generation, after_memory_id, + static_cast (row_batch_size) }); + if (batch_rows.empty ()) + break; + after_memory_id = GetInt64 ( + batch_rows.back (), "memory_id", after_memory_id); + const bool complete = batch_rows.size () < row_batch_size; + rows.insert (rows.end (), + std::make_move_iterator (batch_rows.begin ()), + std::make_move_iterator (batch_rows.end ())); + if (complete) + break; + } + return rows; + } + if (memory_ids && memory_ids->size () > row_batch_size) + { + std::vector> rows; + for (std::size_t begin = 0; begin < memory_ids->size (); + begin += row_batch_size) + { + const std::size_t end = std::min ( + memory_ids->size (), begin + row_batch_size); + const std::vector batch (memory_ids->begin () + begin, + memory_ids->begin () + end); + auto batch_rows = LoadCurrentRows ( + persistent, generation, row_batch_size, &batch); + rows.insert (rows.end (), + std::make_move_iterator (batch_rows.begin ()), + std::make_move_iterator (batch_rows.end ())); + } + return rows; + } std::vector params { generation }; std::string predicate; if (memory_ids && !memory_ids->empty ()) @@ -140,9 +211,8 @@ LoadCurrentRows (Store &persistent, long long generation, params.push_back (memory_id); } return persistent.Execute ( - "SELECT memory_id, generation, anchor_suppression, recovery_total, " - "anchor_log_factor, expires_log_factor FROM rif_active_state " - "WHERE generation = ?" + predicate + " ORDER BY memory_id", + "SELECT memory_id FROM rif_active_state " + "WHERE generation = ?" + predicate, params); } @@ -158,16 +228,32 @@ LoadClock (Store &persistent) } inline void -InsertRow (Transaction &transaction, - const std::map &row) +InsertRows (Transaction &transaction, + const std::vector> &rows, + std::size_t row_batch_size) { - transaction.Execute ( - "INSERT OR REPLACE INTO active_state(" - "memory_id, generation, anchor_suppression, recovery_total, " - "anchor_log_factor, expires_log_factor) VALUES(?, ?, ?, ?, ?, ?)", - { row.at ("memory_id"), row.at ("generation"), - row.at ("anchor_suppression"), row.at ("recovery_total"), - row.at ("anchor_log_factor"), row.at ("expires_log_factor") }); + if (row_batch_size == 0) + throw std::invalid_argument ("RIF active-epoch row batch is zero"); + for (std::size_t begin = 0; begin < rows.size (); begin += row_batch_size) + { + const std::size_t end + = std::min (rows.size (), begin + row_batch_size); + std::string values; + std::vector params; + values.reserve ((end - begin) * 4); + params.reserve (end - begin); + for (std::size_t index = begin; index < end; ++index) + { + if (index > begin) + values += ","; + values += "(?)"; + const auto &row = rows[index]; + params.push_back (row.at ("memory_id")); + } + transaction.Execute ( + "INSERT OR REPLACE INTO active_state(memory_id) VALUES" + values, + params); + } } inline void @@ -175,25 +261,46 @@ Rebuild (State &state, Store &persistent, bool reset_counters = true) { const std::size_t prior_event_count = state.event_count; const std::size_t prior_mutation_count = state.mutation_count; + const std::size_t prior_row_batch_high_water + = state.row_batch_high_water; const auto clock = LoadClock (persistent); const long long generation = GetInt64 (clock, "generation", 1); - const auto rows = LoadCurrentRows (persistent, generation); - const auto calibration_rows = persistent.Execute ( - "SELECT a.memory_id FROM rif_active_state a " - "JOIN rif_recovery_clock c ON c.singleton = 1 " - "JOIN memories m ON m.memory_id = a.memory_id " - "WHERE a.generation = c.generation " - " AND a.anchor_log_factor = c.log_factor " - " AND COALESCE(m.suppression_ts, 0) <> c.last_ts " - "ORDER BY a.memory_id"); + const auto rows = LoadCurrentRows ( + persistent, generation, state.limits.row_batch_size); + std::vector> calibration_rows; + long long calibration_after_memory_id = 0; + while (true) + { + auto batch_rows = persistent.Execute ( + "SELECT a.memory_id FROM rif_active_state a " + "JOIN rif_recovery_clock c ON c.singleton = 1 " + "JOIN memories m ON m.memory_id = a.memory_id " + "WHERE a.generation = c.generation " + " AND a.anchor_log_factor = c.log_factor " + " AND COALESCE(m.suppression_ts, 0) <> c.last_ts " + " AND a.memory_id > ? ORDER BY a.memory_id LIMIT ?", + { calibration_after_memory_id, + static_cast (state.limits.row_batch_size) }); + if (batch_rows.empty ()) + break; + calibration_after_memory_id = GetInt64 ( + batch_rows.back (), "memory_id", calibration_after_memory_id); + const bool complete + = batch_rows.size () < state.limits.row_batch_size; + calibration_rows.insert ( + calibration_rows.end (), + std::make_move_iterator (batch_rows.begin ()), + std::make_move_iterator (batch_rows.end ())); + if (complete) + break; + } auto replacement = CreateDatabase (); auto transaction = replacement->Begin (); transaction->Execute ( "INSERT INTO epoch_clock(singleton, generation, log_factor, last_ts) " "VALUES(1, ?, ?, ?)", { generation, clock.at ("log_factor"), clock.at ("last_ts") }); - for (const auto &row : rows) - InsertRow (*transaction, row); + InsertRows (*transaction, rows, state.limits.row_batch_size); transaction->Commit (); state.database = std::move (replacement); @@ -204,6 +311,12 @@ Rebuild (State &state, Store &persistent, bool reset_counters = true) state.active_rows = rows.size (); state.event_count = reset_counters ? 0 : prior_event_count; state.mutation_count = reset_counters ? 0 : prior_mutation_count; + state.row_batch_high_water + = reset_counters + ? std::min (rows.size (), state.limits.row_batch_size) + : std::max (prior_row_batch_high_water, + std::min (rows.size (), + state.limits.row_batch_size)); state.allocated_bytes = DatabaseBytes (*state.database); state.calibration_memory_ids.clear (); state.calibration_memory_ids.reserve (calibration_rows.size ()); @@ -221,10 +334,48 @@ Rebuild (State &state, Store &persistent, bool reset_counters = true) } inline void -Ensure (State &state, Store &persistent) +ResetActiveEpoch (State &state, Store &persistent) { + const auto clock = LoadClock (persistent); + const long long generation = GetInt64 (clock, "generation", 1); + auto replacement = CreateDatabase (); + auto transaction = replacement->Begin (); + transaction->Execute ( + "INSERT INTO epoch_clock(singleton, generation, log_factor, last_ts) " + "VALUES(1, ?, ?, ?)", + { generation, clock.at ("log_factor"), clock.at ("last_ts") }); + transaction->Commit (); + + state.database = std::move (replacement); + state.valid = true; + state.generation = generation; + state.log_factor = store::AnyToDouble (clock.at ("log_factor"), 0.0); + state.last_ts = GetInt64 (clock, "last_ts", 0); + state.active_rows = 0; + state.event_count = 0; + state.mutation_count = 0; + state.allocated_bytes = DatabaseBytes (*state.database); + state.row_batch_high_water = 0; + state.calibration_memory_ids.clear (); + state.pending_memory_ids.clear (); + state.pending_clock = false; + state.pending_rebuild = false; + state.pending_rebuild_resets_counters = false; + state.invalid_rebuild_resets_counters = true; + state.empty_epoch_reset_required = false; +} + +inline void +Ensure (State &state, Store &persistent, Limits limits) +{ + state.limits = limits; if (!state.valid || !state.database) - Rebuild (state, persistent, state.invalid_rebuild_resets_counters); + { + if (state.empty_epoch_reset_required) + ResetActiveEpoch (state, persistent); + else + Rebuild (state, persistent, state.invalid_rebuild_resets_counters); + } } inline void @@ -247,6 +398,8 @@ StageRebuild (State &state, bool reset_counters = false) state.pending_rebuild = true; state.pending_rebuild_resets_counters = state.pending_rebuild_resets_counters || reset_counters; + state.empty_epoch_reset_required + = state.empty_epoch_reset_required || reset_counters; state.pending_clock = true; } @@ -307,22 +460,29 @@ PublishOnce (State &state, Store &persistent) && !state.pending_rebuild) { ++state.event_count; - return { true, false, false, 0 }; + return { true, false, false, 0, 0 }; } if (state.pending_rebuild || !state.valid || !state.database) { const bool reset_counters - = state.pending_rebuild + = state.empty_epoch_reset_required + || (state.pending_rebuild ? state.pending_rebuild_resets_counters - : state.invalid_rebuild_resets_counters; + : state.invalid_rebuild_resets_counters); MaybeFailPublicationForTest (3); - Rebuild (state, persistent, reset_counters); + if (reset_counters) + ResetActiveEpoch (state, persistent); + else + Rebuild (state, persistent, false); if (!reset_counters) { ++state.event_count; state.mutation_count += state.active_rows; } - return { true, true, false, state.active_rows }; + const std::size_t changed_rows + = reset_counters ? 0 : state.active_rows; + return { true, true, false, changed_rows, + std::min (changed_rows, state.limits.row_batch_size) }; } const long long generation @@ -336,7 +496,9 @@ PublishOnce (State &state, Store &persistent) Rebuild (state, persistent, false); ++state.event_count; state.mutation_count += state.active_rows; - return { true, true, false, state.active_rows }; + return { true, true, false, state.active_rows, + std::min (state.active_rows, + state.limits.row_batch_size) }; } std::sort (state.pending_memory_ids.begin (), @@ -346,7 +508,8 @@ PublishOnce (State &state, Store &persistent) state.pending_memory_ids.end ()), state.pending_memory_ids.end ()); const auto persistent_rows - = LoadCurrentRows (persistent, generation, &state.pending_memory_ids); + = LoadCurrentRows (persistent, generation, state.limits.row_batch_size, + &state.pending_memory_ids); std::unordered_set present; present.reserve (persistent_rows.size ()); for (const auto &row : persistent_rows) @@ -354,15 +517,19 @@ PublishOnce (State &state, Store &persistent) std::unordered_set cached; cached.reserve (state.pending_memory_ids.size ()); - if (!state.pending_memory_ids.empty ()) + for (std::size_t begin = 0; begin < state.pending_memory_ids.size (); + begin += state.limits.row_batch_size) { + const std::size_t end = std::min ( + state.pending_memory_ids.size (), + begin + state.limits.row_batch_size); std::vector params; - params.reserve (state.pending_memory_ids.size ()); - for (const long long memory_id : state.pending_memory_ids) - params.push_back (memory_id); + params.reserve (end - begin); + for (std::size_t index = begin; index < end; ++index) + params.push_back (state.pending_memory_ids[index]); const auto cached_rows = state.database->Execute ( "SELECT memory_id FROM active_state WHERE memory_id IN (" - + Placeholders (state.pending_memory_ids.size ()) + ")", + + Placeholders (end - begin) + ")", params); for (const auto &row : cached_rows) cached.insert (GetInt64 (row, "memory_id", 0)); @@ -374,12 +541,26 @@ PublishOnce (State &state, Store &persistent) "UPDATE epoch_clock SET log_factor = ?, last_ts = ? " "WHERE singleton = 1", { log_factor, last_ts }); - for (const auto &row : persistent_rows) - InsertRow (*transaction, row); + InsertRows (*transaction, persistent_rows, state.limits.row_batch_size); + std::vector missing; + missing.reserve (state.pending_memory_ids.size () - persistent_rows.size ()); for (const long long memory_id : state.pending_memory_ids) if (!present.contains (memory_id)) - transaction->Execute ("DELETE FROM active_state WHERE memory_id = ?", - { memory_id }); + missing.push_back (memory_id); + for (std::size_t begin = 0; begin < missing.size (); + begin += state.limits.row_batch_size) + { + const std::size_t end + = std::min (missing.size (), begin + state.limits.row_batch_size); + std::vector params; + params.reserve (end - begin); + for (std::size_t index = begin; index < end; ++index) + params.push_back (missing[index]); + transaction->Execute ( + "DELETE FROM active_state WHERE memory_id IN (" + + Placeholders (end - begin) + ")", + params); + } MaybeFailPublicationForTest (2); transaction->Commit (); @@ -406,17 +587,21 @@ PublishOnce (State &state, Store &persistent) state.calibration_memory_ids.end ()); } const std::size_t changed_rows = state.pending_memory_ids.size (); + const std::size_t maximum_statement_rows + = std::min (changed_rows, state.limits.row_batch_size); state.log_factor = log_factor; state.last_ts = last_ts; ++state.event_count; state.mutation_count += changed_rows + (state.pending_clock ? 1 : 0); + state.row_batch_high_water = std::max ( + state.row_batch_high_water, maximum_statement_rows); if (changed_rows > 0) state.allocated_bytes = DatabaseBytes (*state.database); state.pending_memory_ids.clear (); state.pending_clock = false; state.pending_rebuild = false; state.pending_rebuild_resets_counters = false; - return { true, false, false, changed_rows }; + return { true, false, false, changed_rows, maximum_statement_rows }; } inline PublishResult @@ -430,7 +615,9 @@ PublishAfterPersistentCommit (State &state, Store &persistent) { // Persistent SQLite has already committed. Never replay it: discard the // disposable epoch and rebuild only its bounded current-generation state. - const bool reset_counters = state.pending_rebuild_resets_counters; + const bool reset_counters + = state.empty_epoch_reset_required + || state.pending_rebuild_resets_counters; const std::size_t committed_rebuild_rows = state.active_rows; state.database.reset (); state.valid = false; @@ -440,22 +627,30 @@ PublishAfterPersistentCommit (State &state, Store &persistent) state.pending_rebuild = false; state.pending_rebuild_resets_counters = false; state.invalid_rebuild_resets_counters = reset_counters; + state.empty_epoch_reset_required = reset_counters; try { MaybeFailPublicationForTest (4); - Rebuild (state, persistent, reset_counters); + if (reset_counters) + ResetActiveEpoch (state, persistent); + else + Rebuild (state, persistent, false); if (!reset_counters) { ++state.event_count; state.mutation_count += state.active_rows; } - return { true, true, true, state.active_rows }; + const std::size_t changed_rows + = reset_counters ? 0 : state.active_rows; + return { true, true, true, changed_rows, + std::min (changed_rows, state.limits.row_batch_size) }; } catch (...) { state.database.reset (); state.valid = false; state.invalid_rebuild_resets_counters = reset_counters; + state.empty_epoch_reset_required = reset_counters; if (reset_counters) { state.event_count = 0; @@ -466,7 +661,7 @@ PublishAfterPersistentCommit (State &state, Store &persistent) ++state.event_count; state.mutation_count += committed_rebuild_rows; } - return { false, false, true, 0 }; + return { false, false, true, 0, 0 }; } } } diff --git a/src/operations/rif_state_internal.hpp b/src/operations/rif_state_internal.hpp index e7a89870..2a1ce98d 100644 --- a/src/operations/rif_state_internal.hpp +++ b/src/operations/rif_state_internal.hpp @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -29,6 +30,7 @@ struct RecoveryResult { std::size_t expired_rows = 0; std::size_t retired_rows = 0; + std::size_t maximum_statement_rows = 0; bool generation_reset = false; std::vector changed_memory_ids; Clock clock; @@ -130,12 +132,14 @@ PruneRetiredGenerationResets (Executor &executor) inline std::vector MaterializeRetiredBatch (Transaction &tx, long long current_generation, - std::size_t limit = 64) + std::size_t row_batch_size) { + if (row_batch_size == 0) + throw std::invalid_argument ("RIF row batch is zero"); const auto rows = tx.Execute ( "SELECT memory_id FROM rif_active_state " "WHERE generation < ? ORDER BY generation, memory_id LIMIT ?", - { current_generation, static_cast (limit) }); + { current_generation, static_cast (row_batch_size) }); std::vector memory_ids; memory_ids.reserve (rows.size ()); for (const auto &row : rows) @@ -194,14 +198,16 @@ LoadMemoryIdsWhere (Transaction &tx, const std::string &where_sql, inline std::vector RecoverMemoryIds (Transaction &tx, const std::vector &memory_ids, - long long now_ts, double recovery_time) + long long now_ts, double recovery_time, + std::size_t row_batch_size) { - constexpr std::size_t kChunkSize = 400; + if (row_batch_size == 0) + throw std::invalid_argument ("RIF row batch is zero"); for (std::size_t begin = 0; begin < memory_ids.size (); - begin += kChunkSize) + begin += row_batch_size) { const std::size_t end - = std::min (memory_ids.size (), begin + kChunkSize); + = std::min (memory_ids.size (), begin + row_batch_size); std::vector params; params.reserve (11 + end - begin); params.insert (params.end (), { @@ -229,52 +235,73 @@ RecoverMemoryIds (Transaction &tx, const std::vector &memory_ids, inline void UpsertActiveMemoryIdsAtClock (Transaction &tx, - const std::vector &memory_ids) + const std::vector &memory_ids, + std::size_t row_batch_size) { if (memory_ids.empty ()) return; - std::vector ids; - ids.reserve (memory_ids.size ()); - for (const long long memory_id : memory_ids) - ids.push_back (memory_id); - tx.Execute ( - "INSERT OR REPLACE INTO rif_active_state(" - "memory_id, generation, anchor_suppression, recovery_total, " - "anchor_log_factor, expires_log_factor) " - "SELECT m.memory_id, c.generation, m.suppression, " - " m.strength + m.suppression, c.log_factor, " - " c.log_factor + ln(1e-9 / m.suppression) " - "FROM memories m CROSS JOIN rif_recovery_clock c " - "WHERE c.singleton = 1 AND m.memory_id IN (" - + Placeholders (memory_ids.size ()) + ") " - " AND m.suppression > 1e-9", - ids); + if (row_batch_size == 0) + throw std::invalid_argument ("RIF row batch is zero"); + for (std::size_t begin = 0; begin < memory_ids.size (); + begin += row_batch_size) + { + const std::size_t end + = std::min (memory_ids.size (), begin + row_batch_size); + std::vector ids; + ids.reserve (end - begin); + for (std::size_t index = begin; index < end; ++index) + ids.push_back (memory_ids[index]); + tx.Execute ( + "INSERT OR REPLACE INTO rif_active_state(" + "memory_id, generation, anchor_suppression, recovery_total, " + "anchor_log_factor, expires_log_factor) " + "SELECT m.memory_id, c.generation, m.suppression, " + " m.strength + m.suppression, c.log_factor, " + " c.log_factor + ln(1e-9 / m.suppression) " + "FROM memories m CROSS JOIN rif_recovery_clock c " + "WHERE c.singleton = 1 AND m.memory_id IN (" + + Placeholders (end - begin) + ") " + " AND m.suppression > 1e-9", + ids); + } } inline std::vector CalibrateMemoryIdsAtClock (Transaction &tx, const std::vector &memory_ids, - double recovery_time) + double recovery_time, + std::size_t row_batch_size) { if (memory_ids.empty ()) return {}; + if (row_batch_size == 0) + throw std::invalid_argument ("RIF row batch is zero"); const Clock clock = LoadClock (tx); - std::vector ids; - ids.reserve (memory_ids.size ()); - for (const long long memory_id : memory_ids) - ids.push_back (memory_id); - const std::string placeholders = Placeholders (memory_ids.size ()); - tx.Execute ("DELETE FROM rif_active_state WHERE memory_id IN (" - + placeholders + ")", - ids); - RecoverMemoryIds (tx, memory_ids, clock.last_ts, recovery_time); - UpsertActiveMemoryIdsAtClock (tx, memory_ids); + for (std::size_t begin = 0; begin < memory_ids.size (); + begin += row_batch_size) + { + const std::size_t end + = std::min (memory_ids.size (), begin + row_batch_size); + std::vector ids; + ids.reserve (end - begin); + for (std::size_t index = begin; index < end; ++index) + ids.push_back (memory_ids[index]); + tx.Execute ("DELETE FROM rif_active_state WHERE memory_id IN (" + + Placeholders (end - begin) + ")", + ids); + } + RecoverMemoryIds ( + tx, memory_ids, clock.last_ts, recovery_time, row_batch_size); + UpsertActiveMemoryIdsAtClock (tx, memory_ids, row_batch_size); return memory_ids; } inline RecoveryResult -AdvanceRecovery (Transaction &tx, long long now_ts, double recovery_time) +AdvanceRecovery (Transaction &tx, long long now_ts, double recovery_time, + std::size_t row_batch_size) { + if (row_batch_size == 0) + throw std::invalid_argument ("RIF row batch is zero"); const Clock before = LoadClock (tx); const double elapsed = static_cast (now_ts - before.last_ts); @@ -294,8 +321,10 @@ AdvanceRecovery (Transaction &tx, long long now_ts, double recovery_time) "UPDATE rif_recovery_clock SET log_factor = 0.0, last_ts = ? " "WHERE singleton = 1", { now_ts }); - auto retired = MaterializeRetiredBatch (tx, before.generation); - return { 0, retired.size (), false, std::move (retired), + auto retired = MaterializeRetiredBatch ( + tx, before.generation, row_batch_size); + return { 0, retired.size (), retired.size (), false, + std::move (retired), { before.generation, 0.0, now_ts } }; } @@ -311,8 +340,10 @@ AdvanceRecovery (Transaction &tx, long long now_ts, double recovery_time) "SET generation = generation + 1, log_factor = 0.0, last_ts = ? " "WHERE singleton = 1", { now_ts }); - auto retired = MaterializeRetiredBatch (tx, before.generation + 1); - return { 0, retired.size (), true, std::move (retired), + auto retired = MaterializeRetiredBatch ( + tx, before.generation + 1, row_batch_size); + return { 0, retired.size (), retired.size (), true, + std::move (retired), { before.generation + 1, 0.0, now_ts } }; } @@ -330,45 +361,76 @@ AdvanceRecovery (Transaction &tx, long long now_ts, double recovery_time) { next_log_factor, now_ts }); const std::vector due_params { - before.generation, next_log_factor + before.generation, next_log_factor, + static_cast (row_batch_size) }; - auto expired = LoadMemoryIdsWhere ( - tx, "generation = ? AND expires_log_factor >= ?", due_params); + const auto expired_rows = tx.Execute ( + "SELECT memory_id FROM rif_active_state " + "WHERE generation = ? AND expires_log_factor >= ? " + "ORDER BY expires_log_factor DESC, memory_id LIMIT ?", + due_params); + std::vector expired; + expired.reserve (expired_rows.size ()); + for (const auto &row : expired_rows) + { + const long long memory_id = GetInt64 (row, "memory_id", 0); + if (memory_id > 0) + expired.push_back (memory_id); + } if (!expired.empty ()) { - MaterializeWhere (tx, - "generation = ? AND expires_log_factor >= ?", - due_params); - tx.Execute ( - "DELETE FROM rif_active_state " - "WHERE generation = ? AND expires_log_factor >= ?", - due_params); + std::vector expired_params; + expired_params.reserve (expired.size ()); + for (const long long memory_id : expired) + expired_params.push_back (memory_id); + const std::string placeholders = Placeholders (expired.size ()); + MaterializeWhere ( + tx, "memory_id IN (" + placeholders + ")", expired_params); + tx.Execute ("DELETE FROM rif_active_state WHERE memory_id IN (" + + placeholders + ")", + expired_params); } - auto retired = MaterializeRetiredBatch (tx, before.generation); + auto retired = MaterializeRetiredBatch ( + tx, before.generation, row_batch_size); const std::size_t retired_count = retired.size (); std::vector changed = expired; changed.insert (changed.end (), retired.begin (), retired.end ()); - return { expired.size (), retired_count, false, std::move (changed), + return { expired.size (), retired_count, + std::max (expired.size (), retired_count), false, + std::move (changed), { before.generation, next_log_factor, now_ts } }; } inline RecoveryResult AdvanceRecovery (Transaction &tx, long long now_ts, double recovery_time, - const std::vector &calibration_memory_ids) + const std::vector &calibration_memory_ids, + std::size_t row_batch_size) { if (calibration_memory_ids.empty ()) - return AdvanceRecovery (tx, now_ts, recovery_time); - std::vector calibration_params; - calibration_params.reserve (calibration_memory_ids.size ()); - for (const long long memory_id : calibration_memory_ids) - calibration_params.push_back (memory_id); - tx.Execute ("DELETE FROM rif_active_state WHERE memory_id IN (" - + Placeholders (calibration_memory_ids.size ()) + ")", - calibration_params); - auto result = AdvanceRecovery (tx, now_ts, recovery_time); + return AdvanceRecovery (tx, now_ts, recovery_time, row_batch_size); + if (row_batch_size == 0) + throw std::invalid_argument ("RIF row batch is zero"); + for (std::size_t begin = 0; begin < calibration_memory_ids.size (); + begin += row_batch_size) + { + const std::size_t end = std::min ( + calibration_memory_ids.size (), begin + row_batch_size); + std::vector calibration_params; + calibration_params.reserve (end - begin); + for (std::size_t index = begin; index < end; ++index) + calibration_params.push_back (calibration_memory_ids[index]); + tx.Execute ("DELETE FROM rif_active_state WHERE memory_id IN (" + + Placeholders (end - begin) + ")", + calibration_params); + } + auto result = AdvanceRecovery ( + tx, now_ts, recovery_time, row_batch_size); const auto calibrated = RecoverMemoryIds ( - tx, calibration_memory_ids, now_ts, recovery_time); - UpsertActiveMemoryIdsAtClock (tx, calibrated); + tx, calibration_memory_ids, now_ts, recovery_time, row_batch_size); + UpsertActiveMemoryIdsAtClock (tx, calibrated, row_batch_size); + result.maximum_statement_rows = std::max ( + result.maximum_statement_rows, + std::min (calibration_memory_ids.size (), row_batch_size)); result.changed_memory_ids.insert (result.changed_memory_ids.end (), calibrated.begin (), calibrated.end ()); return result; diff --git a/src/operations/sparse_retrieval_knobs_internal.hpp b/src/operations/sparse_retrieval_knobs_internal.hpp new file mode 100644 index 00000000..53d3d257 --- /dev/null +++ b/src/operations/sparse_retrieval_knobs_internal.hpp @@ -0,0 +1,170 @@ +#pragma once + +#include +#include +#include + +namespace cortext::operations::sparse_retrieval_knobs_internal +{ + +inline double +ClampUnit (double value) +{ + if (!std::isfinite (value)) + throw std::invalid_argument ("Cortext knob must be finite"); + return std::clamp (value, 0.0, 1.0); +} + +inline int +RouteCapacity (double focus, double sensitivity, double stability) +{ + const double f = ClampUnit (focus); + const double s = ClampUnit (sensitivity); + const double t = ClampUnit (stability); + return static_cast ( + std::lround (256.0 + 256.0 * f + 128.0 * s + 128.0 * t)); +} + +inline int +BackfillBatchSize (double focus, double sensitivity, double stability) +{ + const double f = ClampUnit (focus); + const double s = ClampUnit (sensitivity); + const double t = ClampUnit (stability); + return static_cast ( + std::lround (64.0 + 64.0 * f + 32.0 * s + 32.0 * t)); +} + +inline int +ActivationIdentityTarget (double focus, double sensitivity, + double stability) +{ + return 2 * RouteCapacity (focus, sensitivity, stability) + + 2 * BackfillBatchSize (focus, sensitivity, stability); +} + +// Signal-level payload fallback is part of the same bounded retrieval surface. +// A memory may retain arbitrarily many authoritative signal rows in SQLite, +// but one hydration returns at most B recent rows. +inline int +HydrationFallbackSignalLimit (double focus, double sensitivity, + double stability) +{ + return BackfillBatchSize (focus, sensitivity, stability); +} + +// Family collapse is data dependent inside the fixed candidate envelope, but +// exact cosine checks must never become another store-sized scan. +inline int +FamilyExactComparisonLimit (double focus, double sensitivity, + double stability) +{ + return 2 * RouteCapacity (focus, sensitivity, stability); +} + +inline int +GraphNeighborCount (double focus, double sensitivity, double stability) +{ + return std::max ( + 8, BackfillBatchSize (focus, sensitivity, stability) / 2); +} + +inline int +SearchExpansionBatch (double focus, double sensitivity, double stability) +{ + return std::max ( + 8, BackfillBatchSize (focus, sensitivity, stability) / 4); +} + +inline int +PublicQueryNodeBudget (double focus, double sensitivity, double stability) +{ + return 5 * RouteCapacity (focus, sensitivity, stability); +} + +inline int +PublicQueryEffort (double focus, double sensitivity, double stability) +{ + return 5 * RouteCapacity (focus, sensitivity, stability); +} + +// The retained retrieval lifecycle pays a larger, still fixed SQLite HNSW +// envelope so consolidation can reset work without falling below the measured +// identity-quality boundary. The ramp step reuses the independently derived +// reciprocal-update unit; no packet age, modality, or source label participates. +inline int +RetrievalSawtoothFloor (double focus, double sensitivity, double stability) +{ + return 8 * RouteCapacity (focus, sensitivity, stability); +} + +inline int +RetrievalSawtoothPeak (double focus, double sensitivity, double stability) +{ + return 9 * RouteCapacity (focus, sensitivity, stability); +} + +inline int +RetrievalSawtoothStep (double focus, double sensitivity, double stability) +{ + return std::max ( + 2, BackfillBatchSize (focus, sensitivity, stability) / 16); +} + +inline int +OrdinarySealBatch (double focus, double sensitivity, double stability) +{ + return BackfillBatchSize (focus, sensitivity, stability) + - SearchExpansionBatch (focus, sensitivity, stability); +} + +inline int +GraphLevelZeroLinks (double focus, double sensitivity, double stability) +{ + return std::max (16, RouteCapacity (focus, sensitivity, stability) / 4); +} + +inline int +MaximumLevel (double focus, double sensitivity, double stability) +{ + int remaining + = std::max (1, RouteCapacity (focus, sensitivity, stability) - 1); + int levels = 0; + while (remaining > 0) + { + ++levels; + remaining >>= 1; + } + return std::max (1, levels); +} + +inline int +ReciprocalUpdateCount (double focus, double sensitivity, double stability) +{ + return std::max ( + 2, BackfillBatchSize (focus, sensitivity, stability) / 16); +} + +inline int +ConstructionEffort (double focus, double sensitivity, double stability) +{ + return std::max ( + 32, + static_cast (std::lround ( + static_cast ( + RouteCapacity (focus, sensitivity, stability)) + * 25.0 / 64.0))); +} + +inline int +QueryEffort (double focus, double sensitivity, double stability) +{ + const int route_capacity + = RouteCapacity (focus, sensitivity, stability); + return std::max ( + route_capacity, + static_cast ( + std::lround (static_cast (route_capacity) * 5.0 / 2.0))); +} + +} // namespace cortext::operations::sparse_retrieval_knobs_internal diff --git a/src/operations/sparse_retrieval_route_internal.cpp b/src/operations/sparse_retrieval_route_internal.cpp new file mode 100644 index 00000000..ca509ce5 --- /dev/null +++ b/src/operations/sparse_retrieval_route_internal.cpp @@ -0,0 +1,504 @@ +#include "sparse_retrieval_route_internal.hpp" + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace cortext::operations::sparse_retrieval_route_internal +{ + +namespace +{ + +constexpr std::size_t kFirstSeed = 100; +constexpr std::size_t kSecondSeed = 777; + +std::optional> +Normalize (const Eigen::VectorXf &embedding, int embedding_dim) +{ + if (embedding_dim <= 0 || embedding.size () != embedding_dim) + return std::nullopt; + double norm_squared = 0.0; + std::vector normalized (static_cast (embedding_dim)); + for (Eigen::Index index = 0; index < embedding.size (); ++index) + { + const float value = embedding[index]; + if (!std::isfinite (value)) + return std::nullopt; + normalized[static_cast (index)] = value; + norm_squared += static_cast (value) * value; + } + if (!(norm_squared > 0.0) || !std::isfinite (norm_squared)) + return std::nullopt; + const float inverse_norm + = static_cast (1.0 / std::sqrt (norm_squared)); + for (float &value : normalized) + value *= inverse_norm; + return normalized; +} + +float +InnerProductDistance (const std::vector &left, + const std::vector &right) +{ + double dot = 0.0; + for (std::size_t index = 0; index < left.size (); ++index) + dot += static_cast (left[index]) * right[index]; + return static_cast (1.0 - dot); +} + +} // namespace + +struct Route::Impl +{ + explicit Impl (int dimension, std::size_t initial_capacity, + Parameters parameters_value) + : embedding_dim (dimension), + capacity (std::max (parameters_value.minimum_capacity, + initial_capacity)), + parameters (std::move (parameters_value)), + space (static_cast (dimension)), + first (&space, capacity, parameters.graph_neighbor_count, + parameters.construction_effort, kFirstSeed), + second (&space, capacity, parameters.graph_neighbor_count, + parameters.construction_effort, kSecondSeed) + { + first.setEf (parameters.query_effort); + second.setEf (parameters.query_effort); + } + + bool AddSealed (long long memory_id, const Eigen::VectorXf &embedding) + { + auto normalized = Normalize (embedding, embedding_dim); + if (!normalized || memory_id <= 0 + || sealed_embeddings.count (memory_id) != 0) + return false; + const auto label = static_cast (memory_id); + first.addPoint (normalized->data (), label); + second.addPoint (normalized->data (), label); + sealed_embeddings.emplace (memory_id, std::move (*normalized)); + return true; + } + + struct SealedFilter : hnswlib::BaseFilterFunctor + { + explicit SealedFilter (const Impl &owner) : owner_ (owner) {} + + bool operator() (hnswlib::labeltype label) override + { + const long long memory_id = static_cast (label); + return owner_.delta_embeddings.count (memory_id) == 0 + && owner_.removed.count (memory_id) == 0 + && owner_.sealed_removed.count (memory_id) == 0; + } + + private: + const Impl &owner_; + }; + + int embedding_dim = 0; + std::size_t capacity = 0; + Parameters parameters; + hnswlib::InnerProductSpace space; + hnswlib::HierarchicalNSW first; + hnswlib::HierarchicalNSW second; + std::unordered_map> sealed_embeddings; + std::unordered_map> delta_embeddings; + std::unordered_set removed; + std::unordered_set sealed_removed; + mutable std::mutex mutex; +}; + +Route::Route (std::unique_ptr impl) : impl_ (std::move (impl)) {} + +Route::~Route () = default; + +std::shared_ptr +Route::Create ( + int embedding_dim, + const std::vector> &entries, + Parameters parameters) +{ + if (embedding_dim <= 0 || parameters.minimum_capacity == 0 + || parameters.graph_neighbor_count == 0 + || parameters.construction_effort == 0 + || parameters.query_effort == 0) + return nullptr; + try + { + auto route = std::shared_ptr (new Route (std::make_unique ( + embedding_dim, entries.size () * 2, std::move (parameters)))); + for (const auto &[memory_id, embedding] : entries) + if (!route->impl_->AddSealed (memory_id, embedding)) + return nullptr; + return route; + } + catch (...) + { + return nullptr; + } +} + +bool +Route::Upsert (long long memory_id, const Eigen::VectorXf &embedding) +{ + if (!impl_ || memory_id <= 0) + return false; + auto normalized = Normalize (embedding, impl_->embedding_dim); + if (!normalized) + return false; + try + { + std::lock_guard lock (impl_->mutex); + impl_->removed.erase (memory_id); + impl_->delta_embeddings[memory_id] = std::move (*normalized); + return true; + } + catch (...) + { + return false; + } +} + +bool +Route::Remove (long long memory_id) +{ + if (!impl_ || memory_id <= 0) + return false; + try + { + std::lock_guard lock (impl_->mutex); + impl_->delta_embeddings.erase (memory_id); + if (impl_->sealed_embeddings.count (memory_id) != 0 + && impl_->sealed_removed.count (memory_id) == 0) + impl_->removed.insert (memory_id); + return true; + } + catch (...) + { + return false; + } +} + +bool +Route::Sync ( + const std::vector> &entries) +{ + if (!impl_) + return false; + try + { + std::lock_guard lock (impl_->mutex); + std::unordered_set incoming; + incoming.reserve (entries.size ()); + for (const auto &[memory_id, embedding] : entries) + { + auto normalized = Normalize (embedding, impl_->embedding_dim); + if (memory_id <= 0 || !normalized + || !incoming.insert (memory_id).second) + return false; + const auto sealed = impl_->sealed_embeddings.find (memory_id); + if (sealed != impl_->sealed_embeddings.end () + && impl_->sealed_removed.count (memory_id) == 0 + && sealed->second == *normalized) + { + impl_->delta_embeddings.erase (memory_id); + impl_->removed.erase (memory_id); + continue; + } + impl_->removed.erase (memory_id); + impl_->delta_embeddings[memory_id] = std::move (*normalized); + } + for (const auto &[memory_id, embedding] : impl_->sealed_embeddings) + { + (void)embedding; + if (incoming.count (memory_id) == 0 + && impl_->sealed_removed.count (memory_id) == 0) + impl_->removed.insert (memory_id); + } + for (auto current = impl_->delta_embeddings.begin (); + current != impl_->delta_embeddings.end ();) + { + if (incoming.count (current->first) == 0) + current = impl_->delta_embeddings.erase (current); + else + ++current; + } + return true; + } + catch (...) + { + return false; + } +} + +bool +Route::SealDelta () +{ + if (!impl_) + return false; + try + { + std::lock_guard lock (impl_->mutex); + std::vector removed (impl_->removed.begin (), + impl_->removed.end ()); + std::sort (removed.begin (), removed.end ()); + std::vector *>> delta; + delta.reserve (impl_->delta_embeddings.size ()); + std::size_t new_label_count = 0; + for (const auto &[memory_id, embedding] : impl_->delta_embeddings) + { + delta.emplace_back (memory_id, &embedding); + if (impl_->sealed_embeddings.count (memory_id) == 0) + ++new_label_count; + } + std::sort (delta.begin (), delta.end (), [] (const auto &left, + const auto &right) { + return left.first < right.first; + }); + + const std::size_t required + = impl_->first.cur_element_count + new_label_count; + if (required > impl_->capacity) + { + const std::size_t new_capacity + = std::max (required, impl_->capacity * 2); + impl_->first.resizeIndex (new_capacity); + impl_->second.resizeIndex (new_capacity); + impl_->capacity = new_capacity; + } + + for (const long long memory_id : removed) + { + const auto label = static_cast (memory_id); + impl_->first.markDelete (label); + impl_->second.markDelete (label); + impl_->sealed_removed.insert (memory_id); + } + for (const auto &[memory_id, embedding] : delta) + { + const auto label = static_cast (memory_id); + impl_->first.addPoint (embedding->data (), label); + impl_->second.addPoint (embedding->data (), label); + impl_->sealed_embeddings[memory_id] = *embedding; + impl_->sealed_removed.erase (memory_id); + } + impl_->removed.clear (); + impl_->delta_embeddings.clear (); + return true; + } + catch (...) + { + return false; + } +} + +std::optional> +Route::Search (const Eigen::VectorXf &query, + std::size_t route_capacity) const +{ + if (!impl_ || route_capacity == 0) + return std::nullopt; + auto normalized = Normalize (query, impl_->embedding_dim); + if (!normalized) + return std::nullopt; + try + { + std::lock_guard lock (impl_->mutex); + if (impl_->sealed_embeddings.empty () + && impl_->delta_embeddings.empty ()) + return std::vector{}; + const std::size_t per_graph + = std::min (route_capacity, impl_->sealed_embeddings.size ()); + std::unordered_set labels; + labels.reserve (per_graph * 2 + impl_->delta_embeddings.size ()); + Impl::SealedFilter filter (*impl_); + if (per_graph > 0) + { + for (const auto *index : { &impl_->first, &impl_->second }) + { + auto found = index->searchKnn (normalized->data (), per_graph, + &filter); + while (!found.empty ()) + { + labels.insert ( + static_cast (found.top ().second)); + found.pop (); + } + } + } + for (const auto &[memory_id, embedding] : impl_->delta_embeddings) + { + (void)embedding; + labels.insert (memory_id); + } + struct Candidate + { + float distance = 0.0f; + long long memory_id = 0; + }; + std::vector candidates; + candidates.reserve (labels.size ()); + for (const long long memory_id : labels) + { + const auto delta = impl_->delta_embeddings.find (memory_id); + const auto sealed = impl_->sealed_embeddings.find (memory_id); + const std::vector *embedding + = delta != impl_->delta_embeddings.end () + ? &delta->second + : sealed != impl_->sealed_embeddings.end () + && impl_->removed.count (memory_id) == 0 + && impl_->sealed_removed.count (memory_id) == 0 + ? &sealed->second + : nullptr; + if (!embedding) + continue; + candidates.push_back ( + { InnerProductDistance (*normalized, *embedding), + memory_id }); + } + std::sort (candidates.begin (), candidates.end (), + [] (const Candidate &left, const Candidate &right) { + return left.distance < right.distance + || (left.distance == right.distance + && left.memory_id < right.memory_id); + }); + if (candidates.size () > route_capacity) + candidates.resize (route_capacity); + std::vector memory_ids; + memory_ids.reserve (candidates.size ()); + for (const auto &candidate : candidates) + memory_ids.push_back (candidate.memory_id); + return memory_ids; + } + catch (...) + { + return std::nullopt; + } +} + +std::optional +Route::Snapshot (const std::vector &roots) const +{ + if (!impl_) + return std::nullopt; + try + { + std::lock_guard lock (impl_->mutex); + GraphSnapshot snapshot; + if (impl_->first.cur_element_count == 0) + return snapshot; + + const auto entry_internal = impl_->first.enterpoint_node_; + snapshot.entry_memory_id = static_cast ( + impl_->first.getExternalLabel (entry_internal)); + snapshot.max_level = impl_->first.maxlevel_; + + std::unordered_set selected; + if (roots.empty ()) + { + selected.reserve (impl_->first.cur_element_count); + for (hnswlib::tableint internal_id = 0; + internal_id < impl_->first.cur_element_count; ++internal_id) + selected.insert (internal_id); + } + else + { + selected.reserve ( + roots.size () * (impl_->parameters.graph_neighbor_count + 1)); + for (const long long memory_id : roots) + { + const auto found = impl_->first.label_lookup_.find ( + static_cast (memory_id)); + if (found == impl_->first.label_lookup_.end ()) + continue; + selected.insert (found->second); + const int level = impl_->first.element_levels_[found->second]; + for (int graph_level = 0; graph_level <= level; ++graph_level) + { + const auto neighbors = impl_->first.getConnectionsWithLock ( + found->second, graph_level); + selected.insert (neighbors.begin (), neighbors.end ()); + } + } + } + + std::vector ordered (selected.begin (), + selected.end ()); + std::sort (ordered.begin (), ordered.end (), [&] (const auto left, + const auto right) { + return impl_->first.getExternalLabel (left) + < impl_->first.getExternalLabel (right); + }); + snapshot.nodes.reserve (ordered.size ()); + for (const hnswlib::tableint internal_id : ordered) + { + const long long memory_id = static_cast ( + impl_->first.getExternalLabel (internal_id)); + const auto embedding = impl_->sealed_embeddings.find (memory_id); + if (memory_id <= 0 || embedding == impl_->sealed_embeddings.end ()) + return std::nullopt; + NodeSnapshot node; + node.memory_id = memory_id; + node.embedding = Eigen::Map ( + embedding->second.data (), impl_->embedding_dim); + node.level = impl_->first.element_levels_[internal_id]; + node.active = impl_->sealed_removed.count (memory_id) == 0 + && impl_->removed.count (memory_id) == 0; + node.links.resize (static_cast (node.level + 1)); + for (int graph_level = 0; graph_level <= node.level; ++graph_level) + { + const auto neighbors = impl_->first.getConnectionsWithLock ( + internal_id, graph_level); + auto &links = node.links[static_cast (graph_level)]; + links.reserve (neighbors.size ()); + for (const hnswlib::tableint neighbor : neighbors) + links.push_back (static_cast ( + impl_->first.getExternalLabel (neighbor))); + } + snapshot.nodes.push_back (std::move (node)); + } + return snapshot; + } + catch (...) + { + return std::nullopt; + } +} + +std::size_t +Route::Size () const +{ + if (!impl_) + return 0; + std::lock_guard lock (impl_->mutex); + std::size_t size = impl_->delta_embeddings.size (); + for (const auto &[memory_id, embedding] : impl_->sealed_embeddings) + { + (void)embedding; + if (impl_->delta_embeddings.count (memory_id) == 0 + && impl_->removed.count (memory_id) == 0 + && impl_->sealed_removed.count (memory_id) == 0) + ++size; + } + return size; +} + +std::size_t +Route::DeltaSize () const +{ + if (!impl_) + return 0; + std::lock_guard lock (impl_->mutex); + return impl_->delta_embeddings.size () + impl_->removed.size (); +} + +} // namespace cortext::operations::sparse_retrieval_route_internal diff --git a/src/operations/sparse_retrieval_route_internal.hpp b/src/operations/sparse_retrieval_route_internal.hpp new file mode 100644 index 00000000..80745781 --- /dev/null +++ b/src/operations/sparse_retrieval_route_internal.hpp @@ -0,0 +1,108 @@ +#pragma once + +#include "sparse_retrieval_knobs_internal.hpp" + +#include + +#include +#include +#include +#include +#include + +namespace cortext::operations::sparse_retrieval_route_internal +{ + +struct Parameters +{ + std::size_t minimum_capacity = 0; + std::size_t graph_neighbor_count = 0; + std::size_t construction_effort = 0; + std::size_t query_effort = 0; +}; + +inline Parameters +DeriveParameters (double focus, double sensitivity, double stability) +{ + return { + static_cast ( + sparse_retrieval_knobs_internal::RouteCapacity ( + focus, sensitivity, stability)) + * 2, + static_cast (sparse_retrieval_knobs_internal:: + GraphNeighborCount ( + focus, sensitivity, stability)), + static_cast (sparse_retrieval_knobs_internal:: + ConstructionEffort ( + focus, sensitivity, stability)), + static_cast (sparse_retrieval_knobs_internal::QueryEffort ( + focus, sensitivity, stability)), + }; +} + +inline Parameters +DefaultParameters () +{ + return DeriveParameters (0.5, 0.5, 0.5); +} + +struct NodeSnapshot +{ + long long memory_id = 0; + Eigen::VectorXf embedding; + int level = 0; + bool active = false; + std::vector> links; +}; + +struct GraphSnapshot +{ + long long entry_memory_id = 0; + int max_level = 0; + std::vector nodes; +}; + +/// Private, modality/source-agnostic HNSW route over the current memory +/// surface. The route only proposes memory IDs; callers retain authoritative +/// timestamp, supersession, kind, family, and final-rank checks. +class Route +{ +public: + static std::shared_ptr Create ( + int embedding_dim, + const std::vector> &entries, + Parameters parameters); + + ~Route (); + + Route (const Route &) = delete; + Route &operator= (const Route &) = delete; + + bool Upsert (long long memory_id, const Eigen::VectorXf &embedding); + bool Remove (long long memory_id); + bool Sync ( + const std::vector> &entries); + bool SealDelta (); + + std::optional> Search ( + const Eigen::VectorXf &query, std::size_t route_capacity) const; + + /// Capture exact adjacency from the primary HNSW graph. When roots are + /// supplied, the snapshot contains the roots and their direct graph + /// neighbors so an incremental persistent mirror can update every node + /// whose reciprocal links may have changed. + std::optional Snapshot ( + const std::vector &roots = {}) const; + + std::size_t Size () const; + std::size_t DeltaSize () const; + +private: + struct Impl; + + explicit Route (std::unique_ptr impl); + + std::unique_ptr impl_; +}; + +} // namespace cortext::operations::sparse_retrieval_route_internal diff --git a/src/operations/sparse_retrieval_route_sqlite_internal.cpp b/src/operations/sparse_retrieval_route_sqlite_internal.cpp new file mode 100644 index 00000000..e13db0e5 --- /dev/null +++ b/src/operations/sparse_retrieval_route_sqlite_internal.cpp @@ -0,0 +1,2012 @@ +#include "sparse_retrieval_route_sqlite_internal.hpp" + +#include "sparse_retrieval_route_internal.hpp" + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace cortext::operations::sparse_retrieval_route_sqlite_internal +{ + +namespace +{ + +constexpr int kSchemaVersion = 1; + +struct NodeRow +{ + long long memory_id = 0; + std::vector embedding; + int level = 0; + std::vector> links; + bool active = false; +}; + +std::optional> +Normalize (const Eigen::VectorXf &embedding, int embedding_dim) +{ + if (embedding_dim <= 0 || embedding.size () != embedding_dim) + return std::nullopt; + double norm_squared = 0.0; + std::vector normalized (static_cast (embedding_dim)); + for (Eigen::Index index = 0; index < embedding.size (); ++index) + { + const float value = embedding[index]; + if (!std::isfinite (value)) + return std::nullopt; + normalized[static_cast (index)] = value; + norm_squared += static_cast (value) * value; + } + if (!(norm_squared > 0.0) || !std::isfinite (norm_squared)) + return std::nullopt; + const float inverse_norm + = static_cast (1.0 / std::sqrt (norm_squared)); + for (float &value : normalized) + value *= inverse_norm; + return normalized; +} + +float +Distance (const std::vector &left, const std::vector &right) +{ + double dot = 0.0; + for (std::size_t index = 0; index < left.size (); ++index) + dot += static_cast (left[index]) * right[index]; + return static_cast (1.0 - dot); +} + +int +DeterministicLevel (long long memory_id, std::size_t maximum_level) +{ + std::uint64_t value = static_cast (memory_id) + + 0x9e3779b97f4a7c15ULL; + value = (value ^ (value >> 30U)) * 0xbf58476d1ce4e5b9ULL; + value = (value ^ (value >> 27U)) * 0x94d049bb133111ebULL; + value ^= value >> 31U; + int level = 0; + while (level < static_cast (maximum_level) + && (value & 0x3ULL) == 0) + { + ++level; + value >>= 2U; + } + return level; +} + +std::vector +EncodeEmbedding (const Eigen::VectorXf &embedding) +{ + std::vector bytes ( + static_cast (embedding.size ()) * sizeof (float)); + if (!bytes.empty ()) + std::memcpy (bytes.data (), embedding.data (), bytes.size ()); + return bytes; +} + +std::vector +EncodeEmbedding (const std::vector &embedding) +{ + std::vector bytes (embedding.size () * sizeof (float)); + if (!bytes.empty ()) + std::memcpy (bytes.data (), embedding.data (), bytes.size ()); + return bytes; +} + +std::optional> +DecodeEmbedding (const std::any &value, int embedding_dim) +{ + const auto bytes = store::BlobFromAny (value); + if (embedding_dim <= 0 + || bytes.size () + != static_cast (embedding_dim) * sizeof (float)) + return std::nullopt; + std::vector embedding (static_cast (embedding_dim)); + std::memcpy (embedding.data (), bytes.data (), bytes.size ()); + for (const float component : embedding) + if (!std::isfinite (component)) + return std::nullopt; + return embedding; +} + +void +AppendUint32 (std::vector &bytes, std::uint32_t value) +{ + for (std::size_t byte = 0; byte < sizeof (value); ++byte) + bytes.push_back ( + static_cast ((value >> (byte * 8)) & 0xffU)); +} + +void +AppendInt64 (std::vector &bytes, long long value) +{ + const auto encoded = static_cast (value); + for (std::size_t byte = 0; byte < sizeof (encoded); ++byte) + bytes.push_back (static_cast ( + (encoded >> (byte * 8)) & 0xffU)); +} + +std::optional +ReadUint32 (const std::vector &bytes, std::size_t &offset) +{ + if (bytes.size () - std::min (bytes.size (), offset) + < sizeof (std::uint32_t)) + return std::nullopt; + std::uint32_t value = 0; + for (std::size_t byte = 0; byte < sizeof (value); ++byte) + value |= static_cast (bytes[offset++]) << (byte * 8); + return value; +} + +std::optional +ReadInt64 (const std::vector &bytes, std::size_t &offset) +{ + if (bytes.size () - std::min (bytes.size (), offset) + < sizeof (std::uint64_t)) + return std::nullopt; + std::uint64_t value = 0; + for (std::size_t byte = 0; byte < sizeof (value); ++byte) + value |= static_cast (bytes[offset++]) << (byte * 8); + return static_cast (value); +} + +std::vector +EncodeLinks (const std::vector> &links) +{ + std::vector bytes; + AppendUint32 (bytes, static_cast (links.size ())); + for (const auto &level : links) + { + AppendUint32 (bytes, static_cast (level.size ())); + for (const long long memory_id : level) + AppendInt64 (bytes, memory_id); + } + return bytes; +} + +std::vector +EncodeIdentityIds (const std::vector &memory_ids) +{ + std::vector bytes; + bytes.reserve (sizeof (std::uint32_t) + + memory_ids.size () * sizeof (std::uint64_t)); + AppendUint32 (bytes, static_cast (memory_ids.size ())); + for (const long long memory_id : memory_ids) + AppendInt64 (bytes, memory_id); + return bytes; +} + +std::optional> +DecodeIdentityIds (const std::any &value, std::size_t capacity) +{ + const auto bytes = store::BlobFromAny (value); + if (bytes.empty ()) + return std::vector{}; + std::size_t offset = 0; + const auto count = ReadUint32 (bytes, offset); + if (!count || *count == 0 || *count > capacity) + return std::nullopt; + std::vector memory_ids; + memory_ids.reserve (*count); + std::unordered_set unique; + unique.reserve (*count); + for (std::uint32_t index = 0; index < *count; ++index) + { + const auto memory_id = ReadInt64 (bytes, offset); + if (!memory_id || *memory_id <= 0 || !unique.insert (*memory_id).second) + return std::nullopt; + memory_ids.push_back (*memory_id); + } + if (offset != bytes.size ()) + return std::nullopt; + return memory_ids; +} + +std::optional>> +DecodeLinks (const std::any &value, int expected_level, + const Parameters ¶meters) +{ + if (expected_level < 0 + || static_cast (expected_level) > parameters.maximum_level) + return std::nullopt; + const auto bytes = store::BlobFromAny (value); + std::size_t offset = 0; + const auto level_count = ReadUint32 (bytes, offset); + if (!level_count + || *level_count != static_cast (expected_level + 1)) + return std::nullopt; + std::vector> links (*level_count); + for (std::size_t level_index = 0; level_index < links.size (); + ++level_index) + { + auto &level = links[level_index]; + const auto count = ReadUint32 (bytes, offset); + const std::size_t link_limit + = level_index == 0 ? parameters.row_addressed_level_zero_links + : parameters.row_addressed_neighbor_count; + if (!count || *count > link_limit) + return std::nullopt; + level.reserve (*count); + for (std::uint32_t index = 0; index < *count; ++index) + { + const auto memory_id = ReadInt64 (bytes, offset); + if (!memory_id || *memory_id <= 0) + return std::nullopt; + level.push_back (*memory_id); + } + } + if (offset != bytes.size ()) + return std::nullopt; + return links; +} + +std::string +Placeholders (std::size_t count) +{ + std::string result; + for (std::size_t index = 0; index < count; ++index) + { + if (index != 0) + result += ','; + result += '?'; + } + return result; +} + +long long +Int64 (const std::map &row, const std::string &key, + long long fallback = 0) +{ + const auto value = row.find (key); + return value == row.end () + ? fallback + : store::AnyToLongLong (value->second).value_or (fallback); +} + +std::optional +DecodeNode (const std::map &row, int embedding_dim, + const Parameters ¶meters) +{ + NodeRow node; + node.memory_id = Int64 (row, "memory_id"); + node.level = static_cast (Int64 (row, "level", -1)); + node.active = Int64 (row, "active", -1) == 1; + const auto embedding = row.find ("embedding"); + const auto links = row.find ("links"); + if (node.memory_id <= 0 || embedding == row.end () || links == row.end ()) + return std::nullopt; + auto decoded_embedding + = DecodeEmbedding (embedding->second, embedding_dim); + auto decoded_links = DecodeLinks (links->second, node.level, parameters); + if (!decoded_embedding || !decoded_links) + return std::nullopt; + node.embedding = std::move (*decoded_embedding); + node.links = std::move (*decoded_links); + return node; +} + +std::optional> +FetchNodes (Store &store, int embedding_dim, + const Parameters ¶meters, + long long generation, + const std::vector &memory_ids) +{ + if (memory_ids.empty ()) + return std::vector{}; + std::vector params; + params.reserve (memory_ids.size () + 1); + params.emplace_back (generation); + for (const long long memory_id : memory_ids) + params.emplace_back (memory_id); + const auto rows = store.Execute ( + "SELECT memory_id, embedding, level, links, active " + "FROM cortext_sparse_route_nodes WHERE generation = ? AND memory_id IN (" + + Placeholders (memory_ids.size ()) + ")", + params); + std::vector decoded; + decoded.reserve (rows.size ()); + for (const auto &row : rows) + { + auto node = DecodeNode (row, embedding_dim, parameters); + if (!node) + return std::nullopt; + decoded.push_back (std::move (*node)); + } + return decoded; +} + +} // namespace + +struct Route::Impl +{ + Impl (Store &route_store, int dimension, long long route_entry_memory_id, + int route_max_level, long long route_active_count, + long long route_generation, Parameters route_parameters, + bool route_building = false, + long long route_build_cursor = 0) + : store (&route_store), embedding_dim (dimension), + entry_memory_id (route_entry_memory_id), max_level (route_max_level), + active_count (route_active_count), generation (route_generation), + building (route_building), build_cursor (route_build_cursor), + parameters (std::move (route_parameters)) + { + activation_search_ef = parameters.search_ef; + activation_search_node_budget = parameters.search_node_budget; + } + + Store *store = nullptr; + int embedding_dim = 0; + long long entry_memory_id = 0; + int max_level = 0; + long long activation_entry_memory_id = 0; + int activation_entry_level = 0; + long long active_count = 0; + long long generation = 0; + bool building = false; + long long build_cursor = 0; + Parameters parameters; + mutable std::size_t activation_search_ef = 0; + mutable std::size_t activation_search_node_budget = 0; + std::unordered_map> delta_embeddings; + std::unordered_set removed; + std::unordered_map> node_cache; + std::deque node_cache_order; + std::vector activation_centroid; + std::vector activation_identity_ids; + mutable std::size_t last_search_node_rows = 0; + mutable std::size_t last_activation_snapshot_rows = 0; + mutable std::size_t last_activation_snapshot_cache_miss_rows = 0; + mutable std::size_t last_search_distance_evaluations = 0; + mutable int last_search_failure_code = 0; + mutable int last_seal_failure_code = 0; + mutable std::mutex mutex; +}; + +Route::Route (std::unique_ptr impl) : impl_ (std::move (impl)) {} + +Route::~Route () = default; + +std::shared_ptr +Route::Create ( + Store &store, int embedding_dim, + const std::vector> &entries, + const sparse_retrieval_route_internal::Route &hnsw_route, + Parameters parameters) +{ + if (embedding_dim <= 0) + return nullptr; + try + { + const auto snapshot = hnsw_route.Snapshot (); + if (!snapshot || snapshot->nodes.size () != entries.size ()) + return nullptr; + std::unordered_set expected; + expected.reserve (entries.size ()); + for (const auto &[memory_id, embedding] : entries) + if (memory_id <= 0 || !Normalize (embedding, embedding_dim) + || !expected.insert (memory_id).second) + return nullptr; + + auto tx = store.Begin (); + tx->Execute ("DELETE FROM cortext_sparse_route_nodes"); + tx->Execute ("DELETE FROM cortext_sparse_route_meta"); + tx->Execute ("DELETE FROM cortext_sparse_route_build"); + tx->Execute ("DELETE FROM cortext_sparse_route_dirty"); + for (const auto &node : snapshot->nodes) + { + if (!node.active || expected.erase (node.memory_id) != 1 + || node.embedding.size () != embedding_dim + || node.level < 0 + || node.links.size () + != static_cast (node.level + 1)) + return nullptr; + tx->Execute ( + "INSERT INTO cortext_sparse_route_nodes(" + "memory_id, embedding, level, links, active, generation) " + "VALUES(?, ?, ?, ?, 1, 1)", + { node.memory_id, EncodeEmbedding (node.embedding), + static_cast (node.level), EncodeLinks (node.links) }); + } + if (!expected.empty ()) + return nullptr; + tx->Execute ( + "INSERT INTO cortext_sparse_route_meta(" + "singleton, schema_version, embedding_dim, entry_memory_id, " + "max_level, active_count, generation) VALUES(1, ?, ?, ?, ?, ?, 1)", + { static_cast (kSchemaVersion), + static_cast (embedding_dim), + snapshot->entry_memory_id, + static_cast (snapshot->max_level), + static_cast (snapshot->nodes.size ()) }); + tx->Commit (); + return std::shared_ptr (new Route (std::make_unique ( + store, embedding_dim, snapshot->entry_memory_id, + snapshot->max_level, + static_cast (snapshot->nodes.size ()), 1, + std::move (parameters)))); + } + catch (...) + { + return nullptr; + } +} + +std::shared_ptr +Route::Open (Store &store, int embedding_dim, Parameters parameters) +{ + if (embedding_dim <= 0) + return nullptr; + try + { + const auto meta = store.Execute ( + "SELECT schema_version, embedding_dim, entry_memory_id, max_level, " + "active_count, generation, activation_entry_memory_id, " + "activation_generation, COALESCE(activation_centroid, X'') AS " + "activation_centroid, COALESCE(activation_identity_ids, X'') AS " + "activation_identity_ids FROM cortext_sparse_route_meta " + "WHERE singleton = 1"); + if (meta.size () != 1 + || Int64 (meta.front (), "schema_version") != kSchemaVersion + || Int64 (meta.front (), "embedding_dim") != embedding_dim) + return nullptr; + const long long entry_memory_id + = Int64 (meta.front (), "entry_memory_id", -1); + const long long max_level = Int64 (meta.front (), "max_level", -1); + const long long active_count + = Int64 (meta.front (), "active_count", -1); + const long long generation + = Int64 (meta.front (), "generation", -1); + const long long activation_entry + = Int64 (meta.front (), "activation_entry_memory_id", -1); + const long long activation_generation + = Int64 (meta.front (), "activation_generation", -1); + const auto activation_centroid_bytes + = store::BlobFromAny (meta.front ().at ("activation_centroid")); + const auto activation_centroid + = activation_centroid_bytes.empty () + ? std::optional>{} + : DecodeEmbedding (meta.front ().at ("activation_centroid"), + embedding_dim); + const auto activation_identity_bytes + = store::BlobFromAny (meta.front ().at ("activation_identity_ids")); + const auto activation_identity_ids = DecodeIdentityIds ( + meta.front ().at ("activation_identity_ids"), + parameters.activation_snapshot_capacity); + if (entry_memory_id < 0 || max_level < 0 + || max_level > static_cast (parameters.maximum_level) + || active_count < 0 || generation < 0 || activation_entry < 0 + || activation_generation < 0 + || (active_count > 0 && entry_memory_id == 0)) + return nullptr; + const bool has_activation = activation_entry > 0; + if (has_activation + && (activation_generation != generation || !activation_centroid + || !activation_identity_ids || activation_identity_ids->empty () + || activation_identity_ids->front () != activation_entry)) + return nullptr; + if (!has_activation + && (activation_generation != 0 + || !activation_centroid_bytes.empty () + || !activation_identity_bytes.empty ())) + return nullptr; + auto impl = std::make_unique ( + store, embedding_dim, entry_memory_id, static_cast (max_level), + active_count, generation, std::move (parameters)); + if (has_activation) + { + const auto entry = FetchNodes ( + store, embedding_dim, impl->parameters, generation, + { activation_entry }); + if (!entry || entry->size () != 1 || !entry->front ().active) + return nullptr; + impl->activation_entry_memory_id = activation_entry; + impl->activation_entry_level = entry->front ().level; + impl->activation_centroid = *activation_centroid; + impl->activation_identity_ids = *activation_identity_ids; + } + return std::shared_ptr (new Route (std::move (impl))); + } + catch (...) + { + return nullptr; + } +} + +std::shared_ptr +Route::OpenOrBeginBuild (Store &store, int embedding_dim, + Parameters parameters) +{ + if (embedding_dim <= 0) + return nullptr; + try + { + const auto build = store.Execute ( + "SELECT schema_version, embedding_dim, cursor_memory_id, " + "entry_memory_id, max_level, active_count, generation " + "FROM cortext_sparse_route_build WHERE singleton = 1"); + if (build.size () == 1 + && Int64 (build.front (), "schema_version") == kSchemaVersion + && Int64 (build.front (), "embedding_dim") == embedding_dim) + { + const long long cursor + = Int64 (build.front (), "cursor_memory_id", -1); + const long long entry + = Int64 (build.front (), "entry_memory_id", -1); + const long long max_level + = Int64 (build.front (), "max_level", -1); + const long long active_count + = Int64 (build.front (), "active_count", -1); + const long long generation + = Int64 (build.front (), "generation", -1); + if (cursor >= 0 && entry >= 0 && max_level >= 0 + && max_level + <= static_cast (parameters.maximum_level) + && active_count >= 0 && generation > 0) + return std::shared_ptr (new Route ( + std::make_unique ( + store, embedding_dim, entry, + static_cast (max_level), active_count, generation, + parameters, true, cursor))); + } + + // A missing build record means the prior partial generation was not + // sealed before a crash. Start a new isolated generation; stale rows + // remain unreachable because every fetch is generation-qualified. + const auto generation_rows = store.Execute ( + "SELECT COALESCE(MAX(generation), 0) + 1 AS generation " + "FROM cortext_sparse_route_nodes"); + const long long generation + = generation_rows.empty () + ? 1 + : std::max (1LL, Int64 (generation_rows.front (), + "generation", 1)); + auto tx = store.Begin (); + tx->Execute ("DELETE FROM cortext_sparse_route_meta"); + tx->Execute ("DELETE FROM cortext_sparse_route_build"); + tx->Execute ("DELETE FROM cortext_sparse_route_dirty"); + tx->Execute ( + "INSERT INTO cortext_sparse_route_build(" + "singleton, schema_version, embedding_dim, cursor_memory_id, " + "entry_memory_id, max_level, active_count, generation) " + "VALUES(1, ?, ?, 0, 0, 0, 0, ?)", + { static_cast (kSchemaVersion), + static_cast (embedding_dim), generation }); + tx->Commit (); + return std::shared_ptr (new Route (std::make_unique ( + store, embedding_dim, 0, 0, 0, generation, + std::move (parameters), true, 0))); + } + catch (...) + { + return nullptr; + } +} + +bool +Route::Upsert (long long memory_id, const Eigen::VectorXf &embedding) +{ + if (!impl_ || !impl_->store || memory_id <= 0) + return false; + auto normalized = Normalize (embedding, impl_->embedding_dim); + if (!normalized) + return false; + // This statement joins the caller's authoritative signal transaction when + // one is active. The durable identity journal lets a restart restage the + // latest value from the authoritative current surface without rebuilding + // the unchanged graph or reopening stale rows as current. + try + { + impl_->store->Execute ( + "INSERT OR IGNORE INTO cortext_sparse_route_dirty(memory_id) " + "VALUES(?)", + { memory_id }); + // Live changes stay only in SQLite until a consolidation edge stages a + // knob-bounded slice. Retrieval falls back to the exact SQL surface + // while any journal row remains, so correctness does not require an + // unbounded in-memory delta on either active or unpublished routes. + return true; + } + catch (...) + { + return false; + } +} + +bool +Route::Remove (long long memory_id) +{ + if (!impl_ || !impl_->store || memory_id <= 0) + return false; + try + { + impl_->store->Execute ( + "INSERT OR IGNORE INTO cortext_sparse_route_dirty(memory_id) " + "VALUES(?)", + { memory_id }); + return true; + } + catch (...) + { + return false; + } +} + +bool +Route::StagePendingUpsert (long long memory_id, + const Eigen::VectorXf &embedding) +{ + if (!impl_ || memory_id <= 0) + return false; + auto normalized = Normalize (embedding, impl_->embedding_dim); + if (!normalized) + return false; + try + { + std::lock_guard lock (impl_->mutex); + impl_->removed.erase (memory_id); + impl_->delta_embeddings[memory_id] = std::move (*normalized); + return true; + } + catch (...) + { + return false; + } +} + +bool +Route::StagePendingRemove (long long memory_id) +{ + if (!impl_ || memory_id <= 0) + return false; + try + { + std::lock_guard lock (impl_->mutex); + impl_->delta_embeddings.erase (memory_id); + impl_->removed.insert (memory_id); + return true; + } + catch (...) + { + return false; + } +} + +std::optional> +Route::Search (const Eigen::VectorXf &query, std::size_t route_capacity) const +{ + return SearchWithEnvelope (query, route_capacity, false, false); +} + +std::optional> +Route::SearchActivated (const Eigen::VectorXf &query) const +{ + return SearchWithEnvelope (query, impl_ ? impl_->parameters.route_capacity + : 0, + false, true); +} + +std::optional> +Route::SearchWithEnvelope (const Eigen::VectorXf &query, + std::size_t route_capacity, + bool construction_search, + bool return_all_activated, + bool rebuild_activation) const +{ + if (!impl_ || !impl_->store || route_capacity == 0) + return std::nullopt; + route_capacity = std::min (route_capacity, + impl_->parameters.route_capacity); + auto normalized = Normalize (query, impl_->embedding_dim); + if (!normalized) + { + std::lock_guard lock (impl_->mutex); + impl_->last_search_failure_code = 1; + return std::nullopt; + } + try + { + std::lock_guard lock (impl_->mutex); + impl_->last_search_failure_code = 0; + impl_->last_search_node_rows = 0; + impl_->last_activation_snapshot_rows = 0; + impl_->last_activation_snapshot_cache_miss_rows = 0; + impl_->last_search_distance_evaluations = 0; + const bool use_construction_envelope + = impl_->building || construction_search; + const std::size_t search_node_budget + = use_construction_envelope + ? impl_->parameters.backfill_search_node_budget + : impl_->activation_search_node_budget; + const std::size_t search_effort + = use_construction_envelope + ? impl_->parameters.backfill_search_ef + : impl_->activation_search_ef; + if (impl_->delta_embeddings.size () > search_node_budget) + { + impl_->last_search_failure_code = 2; + return std::nullopt; + } + const std::size_t persisted_node_budget + = use_construction_envelope + ? search_node_budget + : search_node_budget - impl_->delta_embeddings.size (); + const std::size_t activation_identity_target + = use_construction_envelope + ? search_node_budget + : impl_->parameters.activation_identity_target; + const std::size_t node_fetch_budget = persisted_node_budget; + struct QueryNode + { + std::shared_ptr row; + std::optional distance; + }; + std::unordered_map cache; + cache.reserve (node_fetch_budget + activation_identity_target); + std::vector> activation_nodes; + if (return_all_activated && !use_construction_envelope + && !rebuild_activation && !impl_->activation_identity_ids.empty ()) + { + std::vector missing; + missing.reserve (impl_->activation_identity_ids.size ()); + activation_nodes.reserve (impl_->activation_identity_ids.size ()); + for (const long long memory_id : impl_->activation_identity_ids) + { + const auto cached = impl_->node_cache.find (memory_id); + if (cached == impl_->node_cache.end ()) + missing.push_back (memory_id); + else + { + activation_nodes.push_back (cached->second); + cache.emplace (memory_id, + QueryNode{ cached->second, {} }); + } + } + const auto fetched = FetchNodes ( + *impl_->store, impl_->embedding_dim, impl_->parameters, + impl_->generation, missing); + if (!fetched) + { + impl_->last_search_failure_code = 10; + return std::nullopt; + } + impl_->last_activation_snapshot_cache_miss_rows + = fetched->size (); + for (auto node : *fetched) + { + const long long memory_id = node.memory_id; + auto shared + = std::make_shared (std::move (node)); + impl_->node_cache[memory_id] = shared; + impl_->node_cache_order.push_back (memory_id); + activation_nodes.push_back (shared); + cache.emplace (memory_id, QueryNode{ std::move (shared), {} }); + } + impl_->last_activation_snapshot_rows = activation_nodes.size (); + if (impl_->last_activation_snapshot_rows + > impl_->parameters.activation_snapshot_capacity + || impl_->last_activation_snapshot_rows + != impl_->activation_identity_ids.size ()) + { + impl_->last_search_failure_code = 11; + return std::nullopt; + } + while (impl_->node_cache.size () + > impl_->parameters.shadow_node_capacity + && !impl_->node_cache_order.empty ()) + { + const long long oldest = impl_->node_cache_order.front (); + impl_->node_cache_order.pop_front (); + impl_->node_cache.erase (oldest); + } + } + std::unordered_set canonical_ids; + canonical_ids.reserve (node_fetch_budget); + std::size_t canonical_node_rows = 0; + auto persisted_query_distance = [&] (const long long memory_id) { + auto &node = cache.at (memory_id); + if (node.distance) + return *node.distance; + node.distance = Distance (*normalized, node.row->embedding); + ++impl_->last_search_distance_evaluations; + return *node.distance; + }; + auto delta_query_distance = [&] (const std::vector &embedding) { + const float distance = Distance (*normalized, embedding); + ++impl_->last_search_distance_evaluations; + return distance; + }; + auto fetch = [&] (std::vector memory_ids) -> bool { + std::sort (memory_ids.begin (), memory_ids.end ()); + memory_ids.erase (std::unique (memory_ids.begin (), memory_ids.end ()), + memory_ids.end ()); + memory_ids.erase ( + std::remove_if (memory_ids.begin (), memory_ids.end (), + [&] (const long long memory_id) { + return cache.count (memory_id) != 0; + }), + memory_ids.end ()); + std::vector missing; + missing.reserve (memory_ids.size ()); + for (const long long memory_id : memory_ids) + { + if (canonical_node_rows + missing.size () >= node_fetch_budget) + break; + const auto cached = impl_->node_cache.find (memory_id); + if (cached == impl_->node_cache.end ()) + missing.push_back (memory_id); + else + { + cache.emplace (memory_id, + QueryNode{ cached->second, {} }); + canonical_ids.insert (memory_id); + ++canonical_node_rows; + } + } + const std::size_t remaining + = node_fetch_budget - canonical_node_rows; + if (missing.size () > remaining) + missing.resize (remaining); + const auto nodes + = FetchNodes (*impl_->store, impl_->embedding_dim, + impl_->parameters, impl_->generation, missing); + // Links can point into an older unpublished generation while a + // bounded rebuild is in progress. Those nodes are simply not part of + // this generation's traversal surface. + if (!nodes) + { + impl_->last_search_failure_code = 3; + return false; + } + for (auto node : *nodes) + { + const long long memory_id = node.memory_id; + auto shared + = std::make_shared (std::move (node)); + impl_->node_cache[memory_id] = shared; + impl_->node_cache_order.push_back (memory_id); + cache.emplace (memory_id, QueryNode{ std::move (shared), {} }); + canonical_ids.insert (memory_id); + ++canonical_node_rows; + } + while (impl_->node_cache.size () + > impl_->parameters.shadow_node_capacity + && !impl_->node_cache_order.empty ()) + { + const long long oldest = impl_->node_cache_order.front (); + impl_->node_cache_order.pop_front (); + impl_->node_cache.erase (oldest); + } + impl_->last_search_node_rows = canonical_node_rows; + return true; + }; + + // Every query retains the canonical maximum-level entry and uses the + // current F/S/T-derived HNSW envelope: 8C after consolidation, ramping + // by R to 9C. The independently A-bounded consolidation snapshot owns + // level-zero fill locality without replacing canonical hierarchy descent. + long long current_id = impl_->entry_memory_id; + const long long activation_entry_id + = !use_construction_envelope && !rebuild_activation + && impl_->activation_entry_memory_id > 0 + ? impl_->activation_entry_memory_id + : 0; + if (current_id > 0 + && !fetch ({ current_id, activation_entry_id })) + { + impl_->last_search_failure_code = 4; + return std::nullopt; + } + if (current_id > 0 && cache.count (current_id) == 0) + { + impl_->last_search_failure_code = 5; + return std::nullopt; + } + float current_distance + = current_id > 0 + ? persisted_query_distance (current_id) + : std::numeric_limits::infinity (); + for (int level = impl_->max_level; level > 0; --level) + { + bool improved = true; + std::size_t hops = 0; + while (improved + && hops++ < impl_->parameters.hnsw.query_effort) + { + improved = false; + const auto current = cache.find (current_id); + if (current == cache.end () + || current->second.row->level < level) + break; + const auto &neighbors + = current->second.row + ->links[static_cast (level)]; + if (!fetch (neighbors)) + { + impl_->last_search_failure_code = 6; + return std::nullopt; + } + for (const long long neighbor_id : neighbors) + { + const auto neighbor = cache.find (neighbor_id); + if (neighbor == cache.end ()) + continue; + const float distance + = persisted_query_distance (neighbor_id); + if (distance < current_distance + || (distance == current_distance + && neighbor_id < current_id)) + { + current_distance = distance; + current_id = neighbor_id; + improved = true; + } + } + } + } + + using Ranked = std::pair; + const std::size_t best_capacity + = return_all_activated ? node_fetch_budget : route_capacity; + std::priority_queue, std::greater> + frontier; + std::priority_queue best; + std::unordered_set visited; + visited.reserve (search_node_budget + activation_nodes.size ()); + auto seed_frontier = [&] (const long long memory_id) { + if (memory_id <= 0 || !visited.insert (memory_id).second) + return; + const auto node = cache.find (memory_id); + if (node == cache.end ()) + return; + const float distance = persisted_query_distance (memory_id); + frontier.emplace (distance, memory_id); + if (node->second.row->active + && impl_->removed.count (memory_id) == 0 + && impl_->delta_embeddings.count (memory_id) == 0) + best.emplace (distance, memory_id); + }; + seed_frontier (current_id); + // Consolidation persists an A-bounded activation snapshot in SQLite. + // Treat its identities as deterministic level-zero entry points so the + // changed centroid actually steers the next sparse walk; their rows are + // charged to the separate A envelope and never consume the current + // 8C-to-9C traversal budget. + for (const long long memory_id : impl_->activation_identity_ids) + seed_frontier (memory_id); + + std::size_t expanded_count = 0; + while (!frontier.empty () && canonical_node_rows < node_fetch_budget + && expanded_count < search_effort) + { + if (best.size () >= best_capacity + && frontier.top ().first > best.top ().first) + break; + std::vector expansion; + expansion.reserve (impl_->parameters.search_expansion_batch); + while (!frontier.empty () + && expansion.size () + < impl_->parameters.search_expansion_batch + && expanded_count + expansion.size () < search_effort) + { + if (best.size () >= best_capacity + && frontier.top ().first > best.top ().first) + break; + expansion.push_back (frontier.top ()); + frontier.pop (); + } + expanded_count += expansion.size (); + std::vector neighbor_ids; + for (const auto &[distance, memory_id] : expansion) + { + (void)distance; + const auto node = cache.find (memory_id); + if (node == cache.end () + || node->second.row->links.empty ()) + continue; + for (const long long neighbor_id + : node->second.row->links.front ()) + if (visited.insert (neighbor_id).second) + neighbor_ids.push_back (neighbor_id); + } + if (!fetch (neighbor_ids)) + { + impl_->last_search_failure_code = 7; + return std::nullopt; + } + for (const long long memory_id : neighbor_ids) + { + const auto node = cache.find (memory_id); + if (node == cache.end ()) + continue; + const float distance = persisted_query_distance (memory_id); + if (best.size () < best_capacity + || distance <= best.top ().first) + frontier.emplace (distance, memory_id); + if (node->second.row->active + && impl_->removed.count (memory_id) == 0 + && impl_->delta_embeddings.count (memory_id) == 0 + && (best.size () < best_capacity + || distance <= best.top ().first)) + { + best.emplace (distance, memory_id); + if (best.size () > best_capacity) + best.pop (); + } + } + } + + // HNSW's distance stop can exhaust a locally reachable frontier before + // the knob-derived node envelope, including when an otherwise-current + // node has lost every reciprocal incoming edge. Complete the routing + // envelope with a deterministic, indexed slice of the same authoritative + // SQLite graph. This is not a second retrieval path: the rows join the + // same exact rerank below, fetch() still enforces the per-query ceiling, + // and only activation_identity_target identities leave this route. + const std::size_t minimum_persisted_rows + = return_all_activated + ? node_fetch_budget + : std::min ( + node_fetch_budget, + route_capacity + impl_->removed.size () + > impl_->delta_embeddings.size () + ? route_capacity + impl_->removed.size () + - impl_->delta_embeddings.size () + : 0); + auto fill_ordered_generation_slice + = [&] (const char *comparison, long long pivot) -> bool { + if (canonical_node_rows >= minimum_persisted_rows) + return true; + const auto rows = impl_->store->Execute ( + std::string ( + "SELECT memory_id FROM cortext_sparse_route_nodes " + "WHERE generation = ? AND memory_id ") + + comparison + + " ? ORDER BY memory_id LIMIT ?", + { impl_->generation, pivot, + static_cast (minimum_persisted_rows) }); + std::vector memory_ids; + memory_ids.reserve (rows.size ()); + for (const auto &row : rows) + { + const long long memory_id = Int64 (row, "memory_id", 0); + if (memory_id <= 0) + return false; + memory_ids.push_back (memory_id); + } + return fetch (std::move (memory_ids)); + }; + const long long fill_pivot + = activation_entry_id > 0 ? activation_entry_id : current_id; + if (fill_pivot > 0 + && (!fill_ordered_generation_slice (">=", fill_pivot) + || !fill_ordered_generation_slice ("<", fill_pivot))) + { + impl_->last_search_failure_code = 9; + return std::nullopt; + } + + std::vector ranked; + ranked.reserve (cache.size () + impl_->delta_embeddings.size ()); + for (const auto &[memory_id, node] : cache) + if (canonical_ids.count (memory_id) != 0 && node.row->active + && impl_->removed.count (memory_id) == 0 + && impl_->delta_embeddings.count (memory_id) == 0) + ranked.emplace_back (persisted_query_distance (memory_id), + memory_id); + for (const auto &[memory_id, embedding] : impl_->delta_embeddings) + ranked.emplace_back (delta_query_distance (embedding), memory_id); + std::sort (ranked.begin (), ranked.end ()); + std::vector protected_canonical; + if (return_all_activated && !use_construction_envelope + && !rebuild_activation) + { + const std::size_t protected_count + = std::min (ranked.size (), + impl_->parameters.family_exact_comparison_limit); + protected_canonical.assign ( + ranked.begin (), ranked.begin () + protected_count); + } + // A successful consolidation snapshots at most A identities selected + // under the current 8C-to-9C route. Querying that fixed snapshot is an + // independent A-bounded exact layer. The 2C canonical semantic core is + // protected, while an R=max(2,B/16) portion of A may move with the + // consolidation snapshot before the final exact rerank. + if (return_all_activated && !use_construction_envelope + && !rebuild_activation && !impl_->activation_identity_ids.empty ()) + { + std::unordered_set already_ranked; + already_ranked.reserve (ranked.size ()); + for (const auto &[distance, memory_id] : ranked) + { + (void)distance; + already_ranked.insert (memory_id); + } + for (const long long memory_id : impl_->activation_identity_ids) + { + const auto node = cache.find (memory_id); + if (node != cache.end () && node->second.row->active + && impl_->removed.count (memory_id) == 0 + && impl_->delta_embeddings.count (memory_id) == 0 + && already_ranked.insert (memory_id).second) + { + ranked.emplace_back (persisted_query_distance (memory_id), + memory_id); + } + } + } + std::sort (ranked.begin (), ranked.end ()); + const std::size_t result_limit + = return_all_activated ? activation_identity_target + : route_capacity; + if (!protected_canonical.empty () && ranked.size () > result_limit) + { + std::unordered_set selected_ids; + selected_ids.reserve (result_limit); + std::vector selected; + selected.reserve (result_limit); + for (const auto &item : protected_canonical) + if (selected_ids.insert (item.second).second) + selected.push_back (item); + // A is 2C + 2B. Preserve the exact 2C query core, then reserve only + // the independently knob-derived B/16 reciprocal-update budget from + // the consolidation-centroid snapshot before filling the remainder + // by exact query rank. This lets consolidation move the activated + // neighborhood without allowing the centroid to displace a whole + // backfill batch of query-relevant identities. + const std::size_t centroid_quota = std::min ( + impl_->parameters.reciprocal_update_count, + result_limit - selected.size ()); + std::size_t centroid_selected = 0; + for (const long long memory_id : impl_->activation_identity_ids) + { + if (centroid_selected >= centroid_quota) + break; + const auto node = cache.find (memory_id); + if (node == cache.end () || !node->second.row->active + || impl_->removed.count (memory_id) != 0 + || impl_->delta_embeddings.count (memory_id) != 0 + || !selected_ids.insert (memory_id).second) + continue; + selected.emplace_back (persisted_query_distance (memory_id), + memory_id); + ++centroid_selected; + } + for (const auto &item : ranked) + if (selected.size () < result_limit + && selected_ids.insert (item.second).second) + selected.push_back (item); + std::sort (selected.begin (), selected.end ()); + ranked = std::move (selected); + } + else if (ranked.size () > result_limit) + ranked.resize (result_limit); + std::vector result; + result.reserve (ranked.size ()); + for (const auto &[distance, memory_id] : ranked) + { + (void)distance; + result.push_back (memory_id); + } + if (!impl_->building && !construction_search && !rebuild_activation) + { + impl_->activation_search_ef = std::min ( + impl_->parameters.search_ef, + impl_->activation_search_ef + + impl_->parameters.activation_search_ef_step); + impl_->activation_search_node_budget = std::min ( + impl_->parameters.search_node_budget, + impl_->activation_search_node_budget + + impl_->parameters.activation_search_node_budget_step); + } + return result; + } + catch (...) + { + std::lock_guard lock (impl_->mutex); + impl_->last_search_failure_code = 8; + return std::nullopt; + } +} + +bool +Route::Recenter (const Eigen::VectorXf &consolidation_embedding) +{ + if (!impl_ || !impl_->store) + return false; + const auto activated = SearchWithEnvelope ( + consolidation_embedding, impl_->parameters.route_capacity, false, true, + true); + if (!activated || activated->empty ()) + return ActiveCount () == 0; + const auto normalized + = Normalize (consolidation_embedding, impl_->embedding_dim); + if (!normalized) + return false; + try + { + std::lock_guard lock (impl_->mutex); + const auto rows = FetchNodes ( + *impl_->store, impl_->embedding_dim, impl_->parameters, + impl_->generation, { activated->front () }); + if (!rows || rows->size () != 1 || !rows->front ().active) + return false; + auto tx = impl_->store->Begin (); + tx->Execute ( + "UPDATE cortext_sparse_route_meta SET " + "activation_entry_memory_id = ?, activation_generation = ?, " + "activation_centroid = ?, activation_identity_ids = ? " + "WHERE singleton = 1 AND generation = ?", + { rows->front ().memory_id, impl_->generation, + EncodeEmbedding (*normalized), EncodeIdentityIds (*activated), + impl_->generation }); + tx->Commit (); + impl_->activation_entry_memory_id = rows->front ().memory_id; + impl_->activation_entry_level = rows->front ().level; + impl_->activation_centroid = *normalized; + impl_->activation_identity_ids = *activated; + impl_->activation_search_ef + = impl_->parameters.activation_search_ef_min; + impl_->activation_search_node_budget + = impl_->parameters.activation_search_node_budget_min; + return true; + } + catch (...) + { + return false; + } +} + +bool +Route::Seal (const sparse_retrieval_route_internal::Route *hnsw_route) +{ + if (!impl_ || !impl_->store) + return false; + std::unordered_map> neighbor_proposals; + if (!hnsw_route) + { + impl_->last_seal_failure_code = 10; + std::vector> queries; + { + std::lock_guard lock (impl_->mutex); + if (impl_->delta_embeddings.empty () && impl_->removed.empty ()) + return true; + queries.reserve (impl_->delta_embeddings.size ()); + for (const auto &[memory_id, embedding] : impl_->delta_embeddings) + { + Eigen::VectorXf query ( + static_cast (embedding.size ())); + std::copy (embedding.begin (), embedding.end (), query.data ()); + queries.emplace_back (memory_id, std::move (query)); + } + } + for (const auto &[memory_id, query] : queries) + { + auto candidates = SearchWithEnvelope ( + query, impl_->parameters.row_addressed_neighbor_count + + queries.size (), + true, false); + if (!candidates) + { + std::lock_guard lock (impl_->mutex); + impl_->last_seal_failure_code + = 100 + impl_->last_search_failure_code; + return false; + } + candidates->erase ( + std::remove (candidates->begin (), candidates->end (), + memory_id), + candidates->end ()); + neighbor_proposals.emplace (memory_id, std::move (*candidates)); + } + impl_->last_seal_failure_code = 0; + } + try + { + std::lock_guard lock (impl_->mutex); + impl_->last_seal_failure_code = 0; + if (impl_->delta_embeddings.empty () && impl_->removed.empty ()) + return true; + // Metadata and the durable dirty identities remain visible until the + // row updates, refreshed metadata, and journal clear commit atomically. + // An interrupted seal can therefore restage only the committed delta. + + std::vector roots; + roots.reserve (impl_->delta_embeddings.size () + impl_->removed.size ()); + for (const auto &[memory_id, embedding] : impl_->delta_embeddings) + { + (void)embedding; + roots.push_back (memory_id); + } + roots.insert (roots.end (), impl_->removed.begin (), impl_->removed.end ()); + std::sort (roots.begin (), roots.end ()); + roots.erase (std::unique (roots.begin (), roots.end ()), roots.end ()); + if (!hnsw_route) + { + impl_->last_seal_failure_code = 60; + const auto prior_rows + = FetchNodes (*impl_->store, impl_->embedding_dim, + impl_->parameters, impl_->generation, roots); + if (!prior_rows) + return false; + std::unordered_map prior_by_id; + prior_by_id.reserve (prior_rows->size ()); + for (auto node : *prior_rows) + prior_by_id.emplace (node.memory_id, std::move (node)); + + std::unordered_map updates; + updates.reserve (roots.size () + * (impl_->parameters.reciprocal_update_count + 1)); + long long next_active_count = impl_->active_count; + long long next_entry_memory_id = impl_->entry_memory_id; + int next_max_level = impl_->max_level; + const long long next_generation = impl_->generation; + + for (const long long memory_id : roots) + { + const auto removed = impl_->removed.count (memory_id) != 0; + const auto delta = impl_->delta_embeddings.find (memory_id); + const auto prior = prior_by_id.find (memory_id); + if (removed) + { + if (prior == prior_by_id.end ()) + continue; + NodeRow node = prior->second; + if (node.active) + --next_active_count; + node.active = false; + updates[memory_id] = std::move (node); + continue; + } + if (delta == impl_->delta_embeddings.end ()) + continue; + + if (prior != prior_by_id.end ()) + { + NodeRow node = prior->second; + if (!node.active) + ++next_active_count; + node.embedding = delta->second; + node.active = true; + updates[memory_id] = std::move (node); + if (next_entry_memory_id == 0) + next_entry_memory_id = memory_id; + continue; + } + + std::vector proposed + = neighbor_proposals[memory_id]; + const auto proposed_rows = FetchNodes ( + *impl_->store, impl_->embedding_dim, impl_->parameters, + impl_->generation, proposed); + if (!proposed_rows) + return false; + std::unordered_map proposed_by_id; + proposed_by_id.reserve (proposed_rows->size ()); + for (auto node : *proposed_rows) + proposed_by_id.emplace (node.memory_id, std::move (node)); + + struct Neighbor + { + float distance = 0.0f; + long long memory_id = 0; + NodeRow node; + }; + std::vector neighbors; + neighbors.reserve (proposed.size ()); + for (const long long candidate_id : proposed) + { + if (candidate_id == memory_id + || impl_->removed.count (candidate_id) != 0) + continue; + NodeRow candidate; + const auto updated = updates.find (candidate_id); + if (updated != updates.end ()) + candidate = updated->second; + else + { + const auto persisted + = proposed_by_id.find (candidate_id); + if (persisted == proposed_by_id.end ()) + continue; + candidate = persisted->second; + } + if (!candidate.active || candidate.links.empty ()) + continue; + neighbors.push_back ( + { Distance (delta->second, candidate.embedding), + candidate_id, std::move (candidate) }); + } + std::sort (neighbors.begin (), neighbors.end (), + [] (const Neighbor &left, const Neighbor &right) { + return left.distance < right.distance + || (left.distance == right.distance + && left.memory_id < right.memory_id); + }); + NodeRow node; + node.memory_id = memory_id; + node.embedding = delta->second; + node.level = DeterministicLevel ( + memory_id, impl_->parameters.maximum_level); + node.links.resize (static_cast (node.level + 1)); + node.active = true; + for (int level = 0; level <= node.level; ++level) + { + auto &links + = node.links[static_cast (level)]; + const std::size_t link_limit + = level == 0 + ? impl_->parameters + .row_addressed_level_zero_links + : impl_->parameters + .row_addressed_neighbor_count; + links.reserve (std::min (link_limit, neighbors.size ())); + for (const auto &neighbor : neighbors) + { + if (neighbor.node.level < level) + continue; + links.push_back (neighbor.memory_id); + if (links.size () >= link_limit) + break; + } + } + updates[memory_id] = node; + ++next_active_count; + if (next_entry_memory_id == 0 || node.level > next_max_level) + { + next_entry_memory_id = memory_id; + next_max_level = node.level; + } + + for (int level = 0; level <= node.level; ++level) + { + std::size_t reciprocal_count = 0; + for (const auto &candidate : neighbors) + { + if (candidate.node.level < level) + continue; + NodeRow neighbor = candidate.node; + const auto updated = updates.find ( + candidate.memory_id); + if (updated != updates.end ()) + neighbor = updated->second; + auto &level_links + = neighbor.links[static_cast (level)]; + if (std::find (level_links.begin (), level_links.end (), + memory_id) + == level_links.end ()) + { + const std::size_t link_limit + = level == 0 + ? impl_->parameters + .row_addressed_level_zero_links + : impl_->parameters + .row_addressed_neighbor_count; + if (level_links.size () < link_limit) + level_links.push_back (memory_id); + else if (!level_links.empty ()) + level_links.back () = memory_id; + } + updates[neighbor.memory_id] = std::move (neighbor); + if (++reciprocal_count + >= impl_->parameters.reciprocal_update_count) + break; + } + } + } + + if (next_active_count < 0) + return false; + + std::vector update_ids; + update_ids.reserve (updates.size ()); + for (const auto &[memory_id, node] : updates) + { + (void)node; + update_ids.push_back (memory_id); + } + std::sort (update_ids.begin (), update_ids.end ()); + impl_->last_seal_failure_code = 61; + auto tx = impl_->store->Begin (); + for (const long long memory_id : update_ids) + { + const auto &node = updates.at (memory_id); + if (node.memory_id <= 0 + || node.embedding.size () + != static_cast (impl_->embedding_dim) + || node.level < 0 + || node.links.size () + != static_cast (node.level + 1)) + return false; + tx->Execute ( + "INSERT INTO cortext_sparse_route_nodes(" + "memory_id, embedding, level, links, active, generation) " + "VALUES(?, ?, ?, ?, ?, ?) " + "ON CONFLICT(memory_id) DO UPDATE SET " + "embedding = excluded.embedding, level = excluded.level, " + "links = excluded.links, active = excluded.active, " + "generation = excluded.generation", + { node.memory_id, EncodeEmbedding (node.embedding), + static_cast (node.level), + EncodeLinks (node.links), + static_cast (node.active ? 1 : 0), + next_generation }); + } + if (impl_->building) + tx->Execute ( + "INSERT INTO cortext_sparse_route_build(" + "singleton, schema_version, embedding_dim, " + "cursor_memory_id, entry_memory_id, max_level, " + "active_count, generation) VALUES(1, ?, ?, ?, ?, ?, ?, ?) " + "ON CONFLICT(singleton) DO UPDATE SET " + "schema_version = excluded.schema_version, " + "embedding_dim = excluded.embedding_dim, " + "cursor_memory_id = excluded.cursor_memory_id, " + "entry_memory_id = excluded.entry_memory_id, " + "max_level = excluded.max_level, " + "active_count = excluded.active_count, " + "generation = excluded.generation", + { static_cast (kSchemaVersion), + static_cast (impl_->embedding_dim), + impl_->build_cursor, next_entry_memory_id, + static_cast (next_max_level), + next_active_count, next_generation }); + else + tx->Execute ( + "INSERT INTO cortext_sparse_route_meta(" + "singleton, schema_version, embedding_dim, entry_memory_id, " + "max_level, active_count, generation) " + "VALUES(1, ?, ?, ?, ?, ?, ?) " + "ON CONFLICT(singleton) DO UPDATE SET " + "schema_version = excluded.schema_version, " + "embedding_dim = excluded.embedding_dim, " + "entry_memory_id = excluded.entry_memory_id, " + "max_level = excluded.max_level, " + "active_count = excluded.active_count, " + "generation = excluded.generation", + { static_cast (kSchemaVersion), + static_cast (impl_->embedding_dim), + next_entry_memory_id, + static_cast (next_max_level), + next_active_count, next_generation }); + for (const long long memory_id : roots) + tx->Execute ( + "DELETE FROM cortext_sparse_route_dirty WHERE memory_id = ?", + { memory_id }); + tx->Commit (); + impl_->last_seal_failure_code = 0; + impl_->entry_memory_id = next_entry_memory_id; + impl_->max_level = next_max_level; + impl_->active_count = next_active_count; + impl_->generation = next_generation; + // A seal can invalidate cached rows out of FIFO order. Clear the + // bookkeeping with the cache so stale order entries cannot grow + // across repeated update/search cycles. + impl_->node_cache.clear (); + impl_->node_cache_order.clear (); + impl_->delta_embeddings.clear (); + impl_->removed.clear (); + return true; + } + impl_->last_seal_failure_code = 20; + const auto snapshot = hnsw_route->Snapshot (roots); + if (!snapshot) + { + impl_->last_seal_failure_code = 2; + return false; + } + impl_->last_seal_failure_code = 0; + + impl_->last_seal_failure_code = 30; + const auto prior_rows + = FetchNodes (*impl_->store, impl_->embedding_dim, + impl_->parameters, impl_->generation, roots); + if (!prior_rows) + { + impl_->last_seal_failure_code = 3; + return false; + } + impl_->last_seal_failure_code = 0; + std::unordered_map prior_active; + for (const auto &node : *prior_rows) + prior_active.emplace (node.memory_id, node.active); + long long next_active_count = impl_->active_count; + for (const long long memory_id : roots) + { + const bool was_active = prior_active[memory_id]; + const bool is_active + = impl_->delta_embeddings.count (memory_id) != 0 + && impl_->removed.count (memory_id) == 0; + next_active_count += static_cast (is_active) + - static_cast (was_active); + } + if (next_active_count < 0) + { + impl_->last_seal_failure_code = 4; + return false; + } + + const long long next_generation = impl_->generation; + impl_->last_seal_failure_code = 40; + auto tx = impl_->store->Begin (); + for (const auto &node : snapshot->nodes) + { + if (node.memory_id <= 0 + || node.embedding.size () != impl_->embedding_dim + || node.level < 0 + || static_cast (node.level) + > impl_->parameters.maximum_level + || node.links.size () + != static_cast (node.level + 1)) + throw std::runtime_error ("invalid HNSW sparse route snapshot"); + tx->Execute ( + "INSERT INTO cortext_sparse_route_nodes(" + "memory_id, embedding, level, links, active, generation) " + "VALUES(?, ?, ?, ?, ?, ?) ON CONFLICT(memory_id) DO UPDATE SET " + "embedding = excluded.embedding, level = excluded.level, " + "links = excluded.links, active = excluded.active, " + "generation = excluded.generation", + { node.memory_id, EncodeEmbedding (node.embedding), + static_cast (node.level), EncodeLinks (node.links), + static_cast (node.active ? 1 : 0), next_generation }); + } + const std::string metadata_table + = impl_->building ? "cortext_sparse_route_build" + : "cortext_sparse_route_meta"; + const std::string cursor_column + = impl_->building ? "cursor_memory_id, " : ""; + const std::string cursor_placeholder + = impl_->building ? "?, " : ""; + std::vector metadata_params{ + static_cast (kSchemaVersion), + static_cast (impl_->embedding_dim) + }; + if (impl_->building) + metadata_params.emplace_back (impl_->build_cursor); + metadata_params.insert ( + metadata_params.end (), + { snapshot->entry_memory_id, + static_cast (snapshot->max_level), next_active_count, + next_generation }); + tx->Execute ( + "INSERT INTO " + metadata_table + "(" + "singleton, schema_version, embedding_dim, " + cursor_column + + "entry_memory_id, max_level, active_count, generation) " + "VALUES(1, ?, ?, " + cursor_placeholder + "?, ?, ?, ?) " + "ON CONFLICT(singleton) DO UPDATE SET " + "schema_version = excluded.schema_version, " + "embedding_dim = excluded.embedding_dim, " + + (impl_->building + ? "cursor_memory_id = excluded.cursor_memory_id, " + : "") + + "entry_memory_id = excluded.entry_memory_id, " + "max_level = excluded.max_level, " + "active_count = excluded.active_count, " + "generation = excluded.generation", + metadata_params); + for (const long long memory_id : roots) + tx->Execute ( + "DELETE FROM cortext_sparse_route_dirty WHERE memory_id = ?", + { memory_id }); + tx->Commit (); + impl_->last_seal_failure_code = 0; + impl_->entry_memory_id = snapshot->entry_memory_id; + impl_->max_level = snapshot->max_level; + impl_->active_count = next_active_count; + impl_->generation = next_generation; + // A seal can invalidate cached rows out of FIFO order. Clear the + // bookkeeping with the cache so stale order entries cannot grow + // across repeated update/search cycles. + impl_->node_cache.clear (); + impl_->node_cache_order.clear (); + impl_->delta_embeddings.clear (); + impl_->removed.clear (); + return true; + } + catch (...) + { + if (impl_ && impl_->last_seal_failure_code == 0) + impl_->last_seal_failure_code = 50; + return false; + } +} + +bool +Route::Invalidate () +{ + if (!impl_ || !impl_->store) + return false; + try + { + std::lock_guard lock (impl_->mutex); + auto tx = impl_->store->Begin (); + tx->Execute ( + impl_->building + ? "DELETE FROM cortext_sparse_route_build WHERE singleton = 1" + : "DELETE FROM cortext_sparse_route_meta WHERE singleton = 1"); + tx->Execute ("DELETE FROM cortext_sparse_route_dirty"); + tx->Commit (); + return true; + } + catch (...) + { + return false; + } +} + +bool +Route::SetBuildCursor (long long memory_id) +{ + if (!impl_ || !impl_->building || memory_id < 0) + return false; + std::lock_guard lock (impl_->mutex); + impl_->build_cursor = memory_id; + return true; +} + +bool +Route::PublishBuild (std::size_t expected_active_count) +{ + if (!impl_ || !impl_->store || !impl_->building) + return false; + try + { + std::lock_guard lock (impl_->mutex); + if (!impl_->delta_embeddings.empty () || !impl_->removed.empty () + || impl_->entry_memory_id <= 0 + || impl_->active_count + != static_cast (expected_active_count)) + return false; + auto tx = impl_->store->Begin (); + tx->Execute ("DELETE FROM cortext_sparse_route_meta"); + tx->Execute ( + "INSERT INTO cortext_sparse_route_meta(" + "singleton, schema_version, embedding_dim, entry_memory_id, " + "max_level, active_count, generation) VALUES(1, ?, ?, ?, ?, ?, ?)", + { static_cast (kSchemaVersion), + static_cast (impl_->embedding_dim), + impl_->entry_memory_id, static_cast (impl_->max_level), + impl_->active_count, impl_->generation }); + tx->Execute ("DELETE FROM cortext_sparse_route_build"); + tx->Execute ("DELETE FROM cortext_sparse_route_dirty"); + tx->Commit (); + impl_->building = false; + return true; + } + catch (...) + { + return false; + } +} + +std::size_t +Route::DeltaSize () const +{ + if (!impl_) + return 0; + std::lock_guard lock (impl_->mutex); + return impl_->delta_embeddings.size () + impl_->removed.size (); +} + +std::size_t +Route::ActiveCount () const +{ + if (!impl_) + return 0; + std::lock_guard lock (impl_->mutex); + return static_cast (std::max (0LL, impl_->active_count)); +} + +long long +Route::BuildCursor () const +{ + if (!impl_) + return 0; + std::lock_guard lock (impl_->mutex); + return impl_->building ? impl_->build_cursor : 0; +} + +bool +Route::IsBuilding () const +{ + if (!impl_) + return false; + std::lock_guard lock (impl_->mutex); + return impl_->building; +} + +std::optional> +Route::DirtyMemoryIds (std::size_t limit) const +{ + if (!impl_ || !impl_->store) + return std::vector{}; + if (limit == 0 + || limit > static_cast ( + std::numeric_limits::max ())) + return std::nullopt; + try + { + std::lock_guard lock (impl_->mutex); + const auto rows = impl_->store->Execute ( + "SELECT memory_id FROM cortext_sparse_route_dirty " + "ORDER BY memory_id LIMIT ?", + { static_cast (limit) }); + std::vector memory_ids; + memory_ids.reserve (rows.size ()); + for (const auto &row : rows) + { + const long long memory_id = Int64 (row, "memory_id", 0); + if (memory_id <= 0) + return std::nullopt; + memory_ids.push_back (memory_id); + } + return memory_ids; + } + catch (...) + { + return std::nullopt; + } +} + +bool +Route::HasDirtyMemoryIds () const +{ + if (!impl_ || !impl_->store) + return false; + try + { + std::lock_guard lock (impl_->mutex); + return !impl_->store + ->Execute ( + "SELECT 1 AS present FROM cortext_sparse_route_dirty " + "LIMIT 1") + .empty (); + } + catch (...) + { + // Fail closed to exact retrieval when journal state cannot be read. + return true; + } +} + +std::size_t +Route::RestartRowsLoaded () const +{ + return impl_ ? 1 : 0; +} + +std::size_t +Route::LastSearchNodeRows () const +{ + if (!impl_) + return 0; + std::lock_guard lock (impl_->mutex); + return impl_->last_search_node_rows; +} + +std::size_t +Route::LastActivationSnapshotRows () const +{ + if (!impl_) + return 0; + std::lock_guard lock (impl_->mutex); + return impl_->last_activation_snapshot_rows; +} + +std::size_t +Route::LastActivationSnapshotCacheMissRows () const +{ + if (!impl_) + return 0; + std::lock_guard lock (impl_->mutex); + return impl_->last_activation_snapshot_cache_miss_rows; +} + +std::size_t +Route::LastSearchDistanceEvaluations () const +{ + if (!impl_) + return 0; + std::lock_guard lock (impl_->mutex); + return impl_->last_search_distance_evaluations; +} + +std::size_t +Route::CachedNodeRows () const +{ + if (!impl_) + return 0; + std::lock_guard lock (impl_->mutex); + return impl_->node_cache.size (); +} + +std::size_t +Route::CacheOrderRows () const +{ + if (!impl_) + return 0; + std::lock_guard lock (impl_->mutex); + return impl_->node_cache_order.size (); +} + +int +Route::LastSearchFailureCode () const +{ + if (!impl_) + return 0; + std::lock_guard lock (impl_->mutex); + return impl_->last_search_failure_code; +} + +int +Route::LastSealFailureCode () const +{ + if (!impl_) + return -1; + std::lock_guard lock (impl_->mutex); + return impl_->last_seal_failure_code; +} + +long long +Route::ActivationEntryMemoryId () const +{ + if (!impl_) + return 0; + std::lock_guard lock (impl_->mutex); + return impl_->activation_entry_memory_id; +} + +std::size_t +Route::ActivationIdentityCount () const +{ + if (!impl_) + return 0; + std::lock_guard lock (impl_->mutex); + return impl_->activation_identity_ids.size (); +} + +std::vector +Route::ActivationIdentityIds () const +{ + if (!impl_) + return {}; + std::lock_guard lock (impl_->mutex); + return impl_->activation_identity_ids; +} + +std::size_t +Route::ActivationSearchEffort () const +{ + if (!impl_) + return 0; + std::lock_guard lock (impl_->mutex); + return impl_->activation_search_ef; +} + +std::size_t +Route::ActivationSearchNodeBudget () const +{ + if (!impl_) + return 0; + std::lock_guard lock (impl_->mutex); + return impl_->activation_search_node_budget; +} + +} // namespace cortext::operations::sparse_retrieval_route_sqlite_internal diff --git a/src/operations/sparse_retrieval_route_sqlite_internal.hpp b/src/operations/sparse_retrieval_route_sqlite_internal.hpp new file mode 100644 index 00000000..f8ada359 --- /dev/null +++ b/src/operations/sparse_retrieval_route_sqlite_internal.hpp @@ -0,0 +1,342 @@ +#pragma once + +#include "sparse_retrieval_knobs_internal.hpp" +#include "sparse_retrieval_route_internal.hpp" +#include "../experimental_env.hpp" + +#include + +#include +#include +#include +#include +#include +#include + +namespace cortext +{ +class Store; +} + +namespace cortext::operations::sparse_retrieval_route_sqlite_internal +{ + +struct Parameters +{ + std::size_t route_capacity = 0; + std::size_t activation_identity_target = 0; + std::size_t activation_snapshot_capacity = 0; + std::size_t total_query_row_budget = 0; + std::size_t route_bootstrap_limit = 0; + std::size_t search_node_budget = 0; + std::size_t activation_search_node_budget_min = 0; + std::size_t activation_search_node_budget_step = 0; + std::size_t search_expansion_batch = 0; + std::size_t search_ef = 0; + std::size_t activation_search_ef_min = 0; + std::size_t activation_search_ef_step = 0; + std::size_t shadow_node_capacity = 0; + std::size_t backfill_batch_size = 0; + std::size_t backfill_search_node_budget = 0; + std::size_t backfill_search_ef = 0; + std::size_t row_addressed_neighbor_count = 0; + std::size_t row_addressed_level_zero_links = 0; + std::size_t family_exact_comparison_limit = 0; + std::size_t maximum_level = 0; + std::size_t reciprocal_update_count = 0; + sparse_retrieval_route_internal::Parameters hnsw; +}; + +inline Parameters +DeriveParameters (double focus, double sensitivity, double stability) +{ + const auto route_capacity = static_cast ( + sparse_retrieval_knobs_internal::RouteCapacity ( + focus, sensitivity, stability)); + const auto backfill_batch_size = static_cast ( + sparse_retrieval_knobs_internal::BackfillBatchSize ( + focus, sensitivity, stability)); + const auto retrieval_sawtooth_floor = static_cast ( + sparse_retrieval_knobs_internal::RetrievalSawtoothFloor ( + focus, sensitivity, stability)); + const auto retrieval_sawtooth_peak = static_cast ( + sparse_retrieval_knobs_internal::RetrievalSawtoothPeak ( + focus, sensitivity, stability)); + const auto retrieval_sawtooth_step = static_cast ( + sparse_retrieval_knobs_internal::RetrievalSawtoothStep ( + focus, sensitivity, stability)); + Parameters parameters { + route_capacity, + static_cast ( + sparse_retrieval_knobs_internal::ActivationIdentityTarget ( + focus, sensitivity, stability)), + static_cast ( + sparse_retrieval_knobs_internal::ActivationIdentityTarget ( + focus, sensitivity, stability)), + retrieval_sawtooth_peak + + static_cast ( + sparse_retrieval_knobs_internal::ActivationIdentityTarget ( + focus, sensitivity, stability)), + route_capacity * 2, + retrieval_sawtooth_peak, + retrieval_sawtooth_floor, + retrieval_sawtooth_step, + static_cast ( + sparse_retrieval_knobs_internal::SearchExpansionBatch ( + focus, sensitivity, stability)), + retrieval_sawtooth_peak, + retrieval_sawtooth_floor, + retrieval_sawtooth_step, + route_capacity * 24, + backfill_batch_size, + route_capacity + backfill_batch_size, + backfill_batch_size * 2, + static_cast (sparse_retrieval_knobs_internal:: + GraphNeighborCount ( + focus, sensitivity, stability)), + static_cast (sparse_retrieval_knobs_internal:: + GraphLevelZeroLinks ( + focus, sensitivity, stability)), + static_cast (sparse_retrieval_knobs_internal:: + FamilyExactComparisonLimit ( + focus, sensitivity, stability)), + static_cast (sparse_retrieval_knobs_internal::MaximumLevel ( + focus, sensitivity, stability)), + static_cast (sparse_retrieval_knobs_internal:: + ReciprocalUpdateCount ( + focus, sensitivity, stability)), + sparse_retrieval_route_internal::DeriveParameters ( + focus, sensitivity, stability), + }; + + // Private historical-ablation hook: every selectable node envelope is + // composed only from the F/S/T-derived C, B, and A formulas. Hooks-off + // production uses the 8C-to-9C lifecycle initialized above. + if (const auto envelope = internal::experimental_env::Int ( + "CORTEXT_EXPERIMENT_SQLITE_SPARSE_NODE_ENVELOPE")) + { + const std::size_t legacy_query_budget = route_capacity * 5; + std::size_t node_budget = legacy_query_budget; + bool dynamic_activation_envelope = false; + parameters.search_ef = legacy_query_budget; + parameters.activation_search_ef_min = legacy_query_budget; + parameters.activation_search_ef_step = 0; + parameters.activation_search_node_budget_min = legacy_query_budget; + parameters.activation_search_node_budget_step = 0; + parameters.total_query_row_budget + = legacy_query_budget + parameters.activation_identity_target; + switch (*envelope) + { + case 1: + node_budget = route_capacity; + break; + case 2: + node_budget = parameters.activation_identity_target; + break; + case 3: + node_budget = route_capacity + backfill_batch_size; + break; + case 4: + node_budget = route_capacity * 2; + break; + case 5: + node_budget = route_capacity * 5; + break; + case 6: + node_budget = route_capacity * 6; + break; + case 8: + node_budget = route_capacity * 4; + break; + case 18: + node_budget + = route_capacity * 4 + parameters.reciprocal_update_count; + break; + case 19: + node_budget + = route_capacity * 4 + parameters.reciprocal_update_count; + parameters.search_ef = node_budget; + parameters.activation_search_ef_min = node_budget; + parameters.total_query_row_budget + = node_budget + parameters.activation_identity_target; + break; + case 20: + dynamic_activation_envelope = true; + parameters.activation_search_ef_min + = route_capacity * 4 + parameters.reciprocal_update_count; + parameters.activation_search_ef_step + = parameters.reciprocal_update_count; + parameters.activation_search_node_budget_min + = parameters.activation_search_ef_min; + parameters.activation_search_node_budget_step + = parameters.reciprocal_update_count; + break; + case 21: + dynamic_activation_envelope = true; + node_budget = route_capacity * 6; + parameters.search_ef = node_budget; + parameters.activation_search_ef_min = route_capacity * 5; + parameters.activation_search_ef_step + = parameters.reciprocal_update_count; + parameters.activation_search_node_budget_min + = parameters.activation_search_ef_min; + parameters.activation_search_node_budget_step + = parameters.reciprocal_update_count; + parameters.total_query_row_budget + = node_budget + parameters.activation_identity_target; + break; + case 22: + dynamic_activation_envelope = true; + node_budget = route_capacity * 7; + parameters.search_ef = node_budget; + parameters.activation_search_ef_min = route_capacity * 6; + parameters.activation_search_ef_step + = parameters.reciprocal_update_count; + parameters.activation_search_node_budget_min + = parameters.activation_search_ef_min; + parameters.activation_search_node_budget_step + = parameters.reciprocal_update_count; + parameters.total_query_row_budget + = node_budget + parameters.activation_identity_target; + break; + case 23: + dynamic_activation_envelope = true; + node_budget = route_capacity * 8; + parameters.search_ef = node_budget; + parameters.activation_search_ef_min = route_capacity * 7; + parameters.activation_search_ef_step + = parameters.reciprocal_update_count; + parameters.activation_search_node_budget_min + = parameters.activation_search_ef_min; + parameters.activation_search_node_budget_step + = parameters.reciprocal_update_count; + parameters.total_query_row_budget + = node_budget + parameters.activation_identity_target; + break; + case 24: + dynamic_activation_envelope = true; + node_budget = route_capacity * 9; + parameters.search_ef = node_budget; + parameters.activation_search_ef_min = route_capacity * 8; + parameters.activation_search_ef_step + = parameters.reciprocal_update_count; + parameters.activation_search_node_budget_min + = parameters.activation_search_ef_min; + parameters.activation_search_node_budget_step + = parameters.reciprocal_update_count; + parameters.total_query_row_budget + = node_budget + parameters.activation_identity_target; + break; + case 10: + node_budget = route_capacity * 10; + break; + case 12: + node_budget = route_capacity * 12; + break; + case 16: + node_budget = route_capacity * 16; + break; + default: + break; + } + parameters.search_node_budget = node_budget; + if (!dynamic_activation_envelope) + parameters.activation_search_node_budget_min = node_budget; + } + return parameters; +} + +inline Parameters +DefaultParameters () +{ + return DeriveParameters (0.5, 0.5, 0.5); +} + +/// SQLite-authoritative, row-addressed mirror of the existing HNSW route. +/// Restart loads only graph metadata. Queries walk persisted HNSW adjacency +/// under an F/S/T-derived node envelope and rerank every activated row exactly. +class Route +{ +public: + ~Route (); + + static std::shared_ptr Create ( + Store &store, int embedding_dim, + const std::vector> &entries, + const sparse_retrieval_route_internal::Route &hnsw_route, + Parameters parameters); + + static std::shared_ptr Open ( + Store &store, int embedding_dim, + Parameters parameters); + + /// Open or begin an unpublished generation used for bounded legacy-store + /// backfill. The generation is invisible to normal retrieval until + /// PublishBuild succeeds. + static std::shared_ptr OpenOrBeginBuild (Store &store, + int embedding_dim, + Parameters parameters); + + bool Upsert (long long memory_id, const Eigen::VectorXf &embedding); + bool Remove (long long memory_id); + bool StagePendingUpsert (long long memory_id, + const Eigen::VectorXf &embedding); + bool StagePendingRemove (long long memory_id); + bool Seal (const sparse_retrieval_route_internal::Route *hnsw_route + = nullptr); + bool Invalidate (); + bool SetBuildCursor (long long memory_id); + bool PublishBuild (std::size_t expected_active_count); + + std::optional> Search ( + const Eigen::VectorXf &query, std::size_t route_capacity) const; + /// Return every exactly reranked identity activated within the fixed query + /// envelope. Callers apply operation-specific eligibility before reducing + /// to the route-capacity result set. + std::optional> SearchActivated ( + const Eigen::VectorXf &query) const; + /// Persist the level-zero activation pivot nearest the consolidation + /// embedding. Persisted graph rows and the canonical hierarchy entry remain + /// authoritative. + bool Recenter (const Eigen::VectorXf &consolidation_embedding); + + std::size_t DeltaSize () const; + std::size_t ActiveCount () const; + long long BuildCursor () const; + bool IsBuilding () const; + std::optional> DirtyMemoryIds ( + std::size_t limit) const; + bool HasDirtyMemoryIds () const; + std::size_t RestartRowsLoaded () const; + std::size_t LastSearchNodeRows () const; + /// Rows evaluated from the consolidation snapshot in addition to the + /// current 8C-to-9C HNSW envelope. This is independently bounded by A. + std::size_t LastActivationSnapshotRows () const; + /// Snapshot rows physically loaded from SQLite for the last query. A + /// repeated query may reuse the bounded generation-qualified shadow cache, + /// while SQLite remains authoritative across seals and restarts. + std::size_t LastActivationSnapshotCacheMissRows () const; + std::size_t LastSearchDistanceEvaluations () const; + std::size_t CachedNodeRows () const; + std::size_t CacheOrderRows () const; + int LastSearchFailureCode () const; + int LastSealFailureCode () const; + long long ActivationEntryMemoryId () const; + std::size_t ActivationIdentityCount () const; + std::vector ActivationIdentityIds () const; + std::size_t ActivationSearchEffort () const; + std::size_t ActivationSearchNodeBudget () const; + +private: + std::optional> SearchWithEnvelope ( + const Eigen::VectorXf &query, std::size_t route_capacity, + bool construction_search, bool return_all_activated, + bool rebuild_activation = false) const; + + struct Impl; + explicit Route (std::unique_ptr impl); + + std::unique_ptr impl_; +}; + +} // namespace cortext::operations::sparse_retrieval_route_sqlite_internal diff --git a/src/operations/write_gate.cpp b/src/operations/write_gate.cpp index ae6e07f8..38b2d0b3 100644 --- a/src/operations/write_gate.cpp +++ b/src/operations/write_gate.cpp @@ -1,6 +1,7 @@ #include "cortext/operations/write_gate.hpp" #include "neuromodulator_internal.hpp" +#include "../experimental_env.hpp" #include "cortext/core/algorithms.hpp" #include "cortext/core/knobs.hpp" #include "cortext/processor/operation_context.hpp" @@ -11,6 +12,64 @@ namespace cortext::operations { +namespace +{ + +enum class WriteGateProfileReason +{ + Ephemeral = 1, + NoTrigger = 2, + NoAccumulator = 3, + Forced = 4, + ScoreAccepted = 5, + ScoreRejected = 6, +}; + +bool +ProfileWriteGateEnabled () +{ + return internal::experimental_env::Flag ("CORTEXT_PROFILE_WORK_COUNTERS"); +} + +void +RecordWriteGateProfile (OperationContext &context, bool flush, + bool spike_bypass, bool accumulator_available, + double n_signals, double coverage, + double window_score, double threshold_dynamic, + double refractory_multiplier, double write_scale, + double effective_threshold, double score_margin, + bool force_write, bool write_accumulator, + WriteGateProfileReason reason) +{ + if (!ProfileWriteGateEnabled ()) + return; + + context.AddOperationTiming ("WriteGate.flush_trigger", flush ? 1.0 : 0.0); + context.AddOperationTiming ("WriteGate.spike_bypass", + spike_bypass ? 1.0 : 0.0); + context.AddOperationTiming ("WriteGate.accumulator_available", + accumulator_available ? 1.0 : 0.0); + context.AddOperationTiming ("WriteGate.n_signals", n_signals); + context.AddOperationTiming ("WriteGate.coverage", coverage); + context.AddOperationTiming ("WriteGate.window_score", window_score); + context.AddOperationTiming ("WriteGate.threshold_dynamic", + threshold_dynamic); + context.AddOperationTiming ("WriteGate.refractory_multiplier", + refractory_multiplier); + context.AddOperationTiming ("WriteGate.write_scale", write_scale); + context.AddOperationTiming ("WriteGate.effective_threshold", + effective_threshold); + context.AddOperationTiming ("WriteGate.score_margin", score_margin); + context.AddOperationTiming ("WriteGate.force_write", + force_write ? 1.0 : 0.0); + context.AddOperationTiming ("WriteGate.write_accumulator", + write_accumulator ? 1.0 : 0.0); + context.AddOperationTiming ("WriteGate.reason_code", + static_cast (reason)); +} + +} // namespace + void ComputeWriteGate::Execute (OperationContext &context, Transaction &tx) const @@ -29,6 +88,10 @@ ComputeWriteGate::Execute (OperationContext &context, { context.SetAccumulatorWriteDecision (false); context.SetWriteDecision (false); + RecordWriteGateProfile ( + context, flush, spike_bypass, false, 0.0, 0.0, 0.0, + context.GetThresholdTDynamic (), 1.0, 1.0, 0.0, 0.0, false, + false, WriteGateProfileReason::Ephemeral); telemetry::AddCounter ("cortext.retention.ephemeral_no_store_total", 1); telemetry::LogDebug ("cortext.write_gate", { telemetry::Attribute::String ("retention", "ephemeral"), @@ -41,6 +104,10 @@ ComputeWriteGate::Execute (OperationContext &context, { // No flush trigger - no write decision context.SetAccumulatorWriteDecision (false); + RecordWriteGateProfile ( + context, flush, spike_bypass, false, 0.0, 0.0, 0.0, + context.GetThresholdTDynamic (), 1.0, 1.0, 0.0, 0.0, false, + false, WriteGateProfileReason::NoTrigger); return; } @@ -50,6 +117,10 @@ ComputeWriteGate::Execute (OperationContext &context, { // No accumulator state - fall back to per-signal gate context.SetAccumulatorWriteDecision (false); + RecordWriteGateProfile ( + context, flush, spike_bypass, false, 0.0, 0.0, 0.0, + context.GetThresholdTDynamic (), 1.0, 1.0, 0.0, 0.0, false, + false, WriteGateProfileReason::NoAccumulator); return; } @@ -96,6 +167,15 @@ ComputeWriteGate::Execute (OperationContext &context, const bool write_accumulator = force_write || (flush && (S_window > theta_accumulator)); + RecordWriteGateProfile ( + context, flush, spike_bypass, true, static_cast (n), coverage, + S_window, T_dynamic, M_write_refrac, write_scale, theta_accumulator, + S_window - theta_accumulator, force_write, write_accumulator, + force_write ? WriteGateProfileReason::Forced + : (write_accumulator + ? WriteGateProfileReason::ScoreAccepted + : WriteGateProfileReason::ScoreRejected)); + context.SetAccumulatorWriteDecision (write_accumulator); context.SetWriteDecision (write_accumulator); diff --git a/src/signal_processor.cpp b/src/signal_processor.cpp index cc59311a..def552cc 100644 --- a/src/signal_processor.cpp +++ b/src/signal_processor.cpp @@ -11,6 +11,7 @@ #include "cortext/store/schema.hpp" #include "cortext/store/utils.hpp" #include "operations/constructive_recall_internal.hpp" +#include "operations/active_signal_embedding_ring_internal.hpp" #include "operations/bounded_activation_shadow_internal.hpp" #include "operations/consolidation_epoch_profile_internal.hpp" #include "operations/consolidation_throughput_state_internal.hpp" @@ -19,9 +20,11 @@ #include "operations/historical_surface_search_cache_internal.hpp" #include "operations/rif_state_internal.hpp" #include "operations/signal_record_rollback_internal.hpp" +#include "operations/sparse_retrieval_knobs_internal.hpp" #include "experimental_env.hpp" #include "working_memory_time_internal.hpp" #include "store/mutation_audit_internal.hpp" +#include "store/commit_profile_internal.hpp" #include #include #include @@ -33,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -57,6 +61,7 @@ constexpr std::uintmax_t kWalPassiveCheckpointMinBytes #if defined(CORTEXT_TESTING) std::atomic g_sqlite_checkpoint_failure_once { false }; +std::atomic g_retrieval_surface_reload_failure_once { false }; #endif bool @@ -88,7 +93,8 @@ AddConsolidationEpochCounters ( } void -EnsureRifActiveEpochCache (Store *store, ProcessorContext &context) +EnsureRifActiveEpochCache (Store *store, ProcessorContext &context, + const SignalProcessor::Config &config) { if (!store) return; @@ -97,7 +103,9 @@ EnsureRifActiveEpochCache (Store *store, ProcessorContext &context) try { operations::rif_active_epoch_cache_internal::Ensure ( - sidecar->rif_active_epoch, *store); + sidecar->rif_active_epoch, *store, + operations::rif_active_epoch_cache_internal::DeriveLimits ( + config.focus, config.sensitivity, config.stability)); } catch (...) { @@ -117,6 +125,52 @@ ElapsedMillis (std::chrono::steady_clock::time_point start, .count (); } +struct ConsolidationActivationCentroid +{ + std::optional embedding; + std::size_t cluster_count = 0; + std::size_t member_count = 0; +}; + +ConsolidationActivationCentroid +BuildConsolidationActivationCentroid (const OperationContext &context) +{ + ConsolidationActivationCentroid result; + Eigen::VectorXd weighted_sum; + for (const auto &cluster : context.GetConsolidationClusters ()) + { + const std::size_t member_count + = cluster.memory_ids.empty () ? cluster.embedding_ids.size () + : cluster.memory_ids.size (); + if (cluster.centroid.empty () || member_count == 0) + continue; + if (weighted_sum.size () == 0) + weighted_sum = Eigen::VectorXd::Zero ( + static_cast (cluster.centroid.size ())); + if (weighted_sum.size () + != static_cast (cluster.centroid.size ())) + return {}; + for (std::size_t index = 0; index < cluster.centroid.size (); ++index) + { + const double value = cluster.centroid[index]; + if (!std::isfinite (value)) + return {}; + weighted_sum[static_cast (index)] + += value * static_cast (member_count); + } + ++result.cluster_count; + result.member_count += member_count; + } + if (result.cluster_count == 0 || result.member_count == 0) + return result; + weighted_sum /= static_cast (result.member_count); + const double norm = weighted_sum.norm (); + if (!(norm > 0.0) || !std::isfinite (norm)) + return {}; + result.embedding = weighted_sum.cast (); + return result; +} + inline int64_t ExtractInt64 (const std::map &row, const std::string &key, int64_t default_val); @@ -1242,7 +1296,8 @@ class CustomOperationTransaction final : public Transaction return; const auto changed = operations::rif_state_internal::CalibrateMemoryIdsAtClock ( - *transaction_, memory_ids, rif_recovery_time_); + *transaction_, memory_ids, rif_recovery_time_, + sidecar->rif_active_epoch.limits.row_batch_size); sidecar->rif_active_epoch.calibration_memory_ids.clear (); operations::rif_active_epoch_cache_internal::StageMemories ( sidecar->rif_active_epoch, changed); @@ -1311,7 +1366,8 @@ class CustomOperationStore final : public Store auto transaction = store_->Begin (); const auto changed = operations::rif_state_internal::CalibrateMemoryIdsAtClock ( - *transaction, memory_ids, rif_recovery_time_); + *transaction, memory_ids, rif_recovery_time_, + sidecar->rif_active_epoch.limits.row_batch_size); transaction->Commit (); sidecar->rif_active_epoch.calibration_memory_ids.clear (); operations::rif_active_epoch_cache_internal::StageMemories ( @@ -1848,6 +1904,44 @@ BlobToEigen (const std::any &blob) return result; } +ConsolidationActivationCentroid +BuildActiveSignalRingCentroid (Store &store, int embedding_dim, + double focus, double sensitivity, + double stability) +{ + ConsolidationActivationCentroid result; + const int capacity + = operations::active_signal_embedding_ring_internal::Capacity ( + focus, sensitivity, stability); + if (embedding_dim <= 0 || capacity <= 0) + return result; + const auto rows = store.Execute ( + "SELECT embedding, capacity " + "FROM cortext_active_signal_embeddings " + "ORDER BY signal_id ASC"); + if (rows.empty () + || rows.size () > static_cast (capacity)) + return result; + Eigen::VectorXd sum = Eigen::VectorXd::Zero (embedding_dim); + for (const auto &row : rows) + { + const auto stored_capacity + = store::AnyToLongLong (row.at ("capacity")).value_or (0); + const Eigen::VectorXf embedding = BlobToEigen (row.at ("embedding")); + if (stored_capacity != capacity || embedding.size () != embedding_dim + || !embedding.allFinite ()) + return {}; + sum += embedding.cast (); + } + sum /= static_cast (rows.size ()); + const double norm = sum.norm (); + if (!(norm > 0.0) || !std::isfinite (norm)) + return result; + result.embedding = sum.cast (); + result.member_count = rows.size (); + return result; +} + // Serialize blender P matrix (2D vector of doubles) to flat float vector inline std::vector SerializeMatrix (const std::vector > &mat) @@ -2323,9 +2417,13 @@ LoadRecentContext (Store &store, ProcessorContext &ctx, core::KCtx (config.stability)))); auto rows = store.Execute ( "SELECT embedding FROM (" - " SELECT s.signal_id, s.embedding_id, e.embedding, s.timestamp " + " SELECT s.signal_id, s.embedding_id, " + " COALESCE(a.embedding, e.embedding) AS embedding, " + " s.timestamp " " FROM signals s " - " JOIN embeddings e ON s.embedding_id = e.embedding_id " + " LEFT JOIN cortext_active_signal_embeddings a " + " ON a.signal_id = s.signal_id " + " LEFT JOIN embeddings e ON s.embedding_id = e.embedding_id " " ORDER BY s.timestamp DESC, s.signal_id DESC " " LIMIT ?" ") ORDER BY timestamp ASC, signal_id ASC", @@ -2498,9 +2596,15 @@ LoadHistoricalSurfaceSearchCache ( ? base_embedding_ids->at (surface.memory_id) : surface.embedding_id }); } - if (search_entries.size () != embedding_rows.size () - || !operations::historical_surface_search_cache_internal::Reset ( - ctx, std::move (search_entries), std::move (current_entries))) + const bool historical_complete + = search_entries.size () == embedding_rows.size (); + if (!operations::historical_surface_search_cache_internal::Reset ( + ctx, + historical_complete ? std::move (search_entries) + : std::vector{}, + std::move (current_entries))) { operations::historical_surface_search_cache_internal::Erase (ctx); } @@ -2516,7 +2620,9 @@ LoadHistoricalSurfaceSearchCache ( } void -LoadEmotionalMetadataCache (Store &store, ProcessorContext &ctx) +LoadEmotionalMetadataCache (Store &store, ProcessorContext &ctx, + double focus, double sensitivity, + double stability) { auto rows = store.Execute ( "SELECT memory_id, embedding_id, created_at, flashbulb, " @@ -2545,17 +2651,46 @@ LoadEmotionalMetadataCache (Store &store, ProcessorContext &ctx) static_cast (ExtractInt64 (row, "cascade_radius", 0)), ExtractDouble (row, "cascade_decay", 0.0) }); } + const std::size_t source_query_capacity + = internal::experimental_env::Flag ( + "CORTEXT_EXPERIMENT_EMOTIONAL_WINNER_COLLAPSE") + && internal::experimental_env::Flag ( + "CORTEXT_EXPERIMENT_EMOTIONAL_EDGE_LIMIT") + ? static_cast (operations:: + sparse_retrieval_knobs_internal::PublicQueryNodeBudget ( + focus, sensitivity, stability)) + : std::numeric_limits::max (); operations::emotional_metadata_cache_internal::Reset ( - ctx, std::move (metadata)); + ctx, std::move (metadata), source_query_capacity); } void -LoadRetrievalSurfaceCache (Store &store, ProcessorContext &ctx) +LoadRetrievalSurfaceCache (Store &store, ProcessorContext &ctx, + double focus, double sensitivity, + double stability) { + std::optional rif_epoch; + auto detach_rif_epoch = [&] { + if (auto sidecar + = operations::execution_cache_sidecar_internal::Find (ctx)) + rif_epoch = std::move (sidecar->rif_active_epoch); + }; + auto restore_rif_epoch = [&] { + if (rif_epoch) + operations::execution_cache_sidecar_internal::Ensure (ctx) + ->rif_active_epoch = std::move (*rif_epoch); + }; try { - operations::historical_surface_search_cache_internal::Erase (ctx); + detach_rif_epoch (); operations::execution_cache_sidecar_internal::Erase (ctx); + restore_rif_epoch (); +#if defined(CORTEXT_TESTING) + if (g_retrieval_surface_reload_failure_once.exchange ( + false, std::memory_order_relaxed)) + throw std::runtime_error ( + "injected retrieval-surface reload failure"); +#endif ctx.retrieval_surface_cache.clear (); ctx.retrieval_surface_index.clear (); ctx.retrieval_surface_embedding_index.clear (); @@ -2687,7 +2822,31 @@ LoadRetrievalSurfaceCache (Store &store, ProcessorContext &ctx) association_is_association); } LoadHistoricalSurfaceSearchCache (store, ctx, &base_embedding_ids); - LoadEmotionalMetadataCache (store, ctx); + operations::historical_surface_search_cache_internal:: + SetSparseRouteParameters ( + ctx, operations::sparse_retrieval_route_sqlite_internal:: + DeriveParameters (focus, sensitivity, stability)); + if (internal::experimental_env::Bool ( + "CORTEXT_SQLITE_SPARSE_ROUTE", true)) + if (auto state = operations:: + historical_surface_search_cache_internal::FindMutable (ctx)) + { + const auto route = operations:: + historical_surface_search_cache_internal:: + OpenSQLiteSparseRoute (*state, store); + if (!route + && state->current_entries.size () + > state->sparse_route_parameters.route_capacity + && !(internal::experimental_env::Flag ( + "CORTEXT_HNSW_SPARSE_ROUTE") + && state->current_entries.size () + <= state->sparse_route_parameters + .route_bootstrap_limit)) + (void)operations:: + historical_surface_search_cache_internal:: + AdvanceSQLiteSparseRouteBackfill (*state, store); + } + LoadEmotionalMetadataCache (store, ctx, focus, sensitivity, stability); operations::historical_surface_search_cache_internal:: SetCurrentSurfaceDatabaseCurrent ( ctx, current_surface_database_current); @@ -2702,8 +2861,10 @@ LoadRetrievalSurfaceCache (Store &store, ProcessorContext &ctx) } catch (const std::exception &e) { + detach_rif_epoch (); operations::historical_surface_search_cache_internal::Erase (ctx); operations::execution_cache_sidecar_internal::Erase (ctx); + restore_rif_epoch (); operations::historical_surface_search_cache_internal:: SetCurrentSurfaceDatabaseCurrent (ctx, false); operations::historical_surface_search_cache_internal:: @@ -2855,9 +3016,12 @@ LoadWorkingMemory (Store &store, ProcessorContext &ctx, // Load signal records for this WM slot (ordered) auto sig_rows = store.Execute ( - "SELECT embedding_id, timestamp, modality, mime, blob_id, " - " score, serial_position " - "FROM signals WHERE memory_id = ? " + "SELECT s.embedding_id, a.embedding, s.timestamp, s.modality, " + " s.mime, s.blob_id, s.score, s.serial_position " + "FROM signals s " + "LEFT JOIN cortext_active_signal_embeddings a " + "ON a.signal_id = s.signal_id " + "WHERE s.memory_id = ? " "ORDER BY serial_position ASC", { slot.memory_id }); for (const auto &sig_row : sig_rows) @@ -2920,20 +3084,30 @@ LoadWorkingMemory (Store &store, ProcessorContext &ctx, } } - const auto sig_emb_id - = ExtractInt64 (sig_row, "embedding_id", 0); - if (sig_emb_id > 0) + const auto inline_embedding = sig_row.find ("embedding"); + if (inline_embedding != sig_row.end () + && inline_embedding->second.has_value ()) { - auto sig_emb_rows = store.Execute ( - "SELECT embedding FROM embeddings WHERE embedding_id = ?", - { sig_emb_id }); - if (!sig_emb_rows.empty ()) + rec.embedding = BlobToEigen (inline_embedding->second); + } + else + { + const auto sig_emb_id + = ExtractInt64 (sig_row, "embedding_id", 0); + if (sig_emb_id > 0) { - auto it_emb = sig_emb_rows[0].find ("embedding"); - if (it_emb != sig_emb_rows[0].end () - && it_emb->second.has_value ()) + auto sig_emb_rows = store.Execute ( + "SELECT embedding FROM embeddings " + "WHERE embedding_id = ?", + { sig_emb_id }); + if (!sig_emb_rows.empty ()) { - rec.embedding = BlobToEigen (it_emb->second); + auto it_emb = sig_emb_rows[0].find ("embedding"); + if (it_emb != sig_emb_rows[0].end () + && it_emb->second.has_value ()) + { + rec.embedding = BlobToEigen (it_emb->second); + } } } } @@ -3106,6 +3280,13 @@ SetSQLiteCheckpointFailureOnceForTest () { g_sqlite_checkpoint_failure_once.store (true, std::memory_order_relaxed); } + +void +SetRetrievalSurfaceReloadFailureOnceForTest () +{ + g_retrieval_surface_reload_failure_once.store (true, + std::memory_order_relaxed); +} } // namespace testing #endif @@ -3126,6 +3307,13 @@ SignalProcessor::SignalProcessor (const Config &config, throw std::invalid_argument ( "SignalProcessor requires a non-null Encoder"); } + if (!std::isfinite (config_.focus) + || !std::isfinite (config_.sensitivity) + || !std::isfinite (config_.stability)) + { + throw std::invalid_argument ( + "SignalProcessor requires finite F/S/T knobs"); + } // Initialize rate observation window capacity derived from Stability knob. if (context_) { @@ -3153,7 +3341,8 @@ SignalProcessor::SignalProcessor (const Config &config, loaded_state = LoadState (*store_, *context_, config_); // Unified state LoadPredictivePreActivationIds (*store_, *context_); LoadRetrievalSuppressionIds (*store_, *context_); - LoadRetrievalSurfaceCache (*store_, *context_); + LoadRetrievalSurfaceCache (*store_, *context_, config_.focus, + config_.sensitivity, config_.stability); LoadRecentContext (*store_, *context_, config_); LoadRecentScores (*store_, *context_, config_); LoadObservedRetentionHistory ( @@ -3163,7 +3352,7 @@ SignalProcessor::SignalProcessor (const Config &config, LoadWorkingMemory (*store_, *context_, config_, now_ms); // From MEMORIES LoadSoftAnchors (*store_, *context_); - EnsureRifActiveEpochCache (store_.get (), *context_); + EnsureRifActiveEpochCache (store_.get (), *context_, config_); operations::bounded_activation_shadow_internal::Initialize ( *context_, store_.get (), config_.focus, config_.sensitivity, config_.stability); @@ -3206,6 +3395,33 @@ SignalProcessor::Process (const Signal &signal) telemetry::ScopedSpan span ("cortext.process"); const bool read_only = signal.retention == Retention::Ephemeral; const bool maintenance = signal.force_consolidation && !read_only; + const bool sqlite_sparse_route_enabled = internal::experimental_env::Bool ( + "CORTEXT_SQLITE_SPARSE_ROUTE", true); + const bool hnsw_sparse_route_enabled + = internal::experimental_env::Flag ("CORTEXT_HNSW_SPARSE_ROUTE"); + const bool any_sparse_route_enabled + = hnsw_sparse_route_enabled || sqlite_sparse_route_enabled; + std::shared_ptr + premaintenance_sparse_route; + std::shared_ptr< + operations::sparse_retrieval_route_sqlite_internal::Route> + premaintenance_sqlite_sparse_route; + std::shared_ptr< + operations::sparse_retrieval_route_sqlite_internal::Route> + premaintenance_sqlite_sparse_route_backfill; + if (maintenance && any_sparse_route_enabled) + if (const auto state = operations:: + historical_surface_search_cache_internal::FindMutable (*context_)) + { + if (sqlite_sparse_route_enabled && !state->sqlite_sparse_route + && !state->sqlite_sparse_route_backfill) + (void)operations::historical_surface_search_cache_internal:: + OpenSQLiteSparseRoute (*state, *store_); + premaintenance_sparse_route = state->sparse_route; + premaintenance_sqlite_sparse_route = state->sqlite_sparse_route; + premaintenance_sqlite_sparse_route_backfill + = state->sqlite_sparse_route_backfill; + } std::optional consolidation_epoch_pre; if (maintenance @@ -3216,7 +3432,7 @@ SignalProcessor::Process (const Signal &signal) // The disposable SQLite epoch is rebuilt only from committed authority and // never after the signal transaction has begun. - EnsureRifActiveEpochCache (store_.get (), *context_); + EnsureRifActiveEpochCache (store_.get (), *context_, config_); // Create transaction for this signal processing const auto tx_begin_start = std::chrono::steady_clock::now (); @@ -3376,7 +3592,9 @@ SignalProcessor::Process (const Signal &signal) } else { - LoadRetrievalSurfaceCache (*store_, *context_); + LoadRetrievalSurfaceCache (*store_, *context_, config_.focus, + config_.sensitivity, + config_.stability); LoadPredictivePreActivationIds (*store_, *context_); LoadRetrievalSuppressionIds (*store_, *context_); } @@ -3396,7 +3614,9 @@ SignalProcessor::Process (const Signal &signal) ClearDbDerivedProcessorCaches (*context_); if (store_) { - LoadRetrievalSurfaceCache (*store_, *context_); + LoadRetrievalSurfaceCache (*store_, *context_, config_.focus, + config_.sensitivity, + config_.stability); LoadPredictivePreActivationIds (*store_, *context_); LoadRetrievalSuppressionIds (*store_, *context_); } @@ -3530,6 +3750,28 @@ SignalProcessor::Process (const Signal &signal) op_context.AddOperationTiming ( "SignalProcessor.commit_transaction", ElapsedMillis (op_start, std::chrono::steady_clock::now ())); + const auto commit_profile + = internal::ConsumeSQLiteCommitProfile (store_.get ()); + if (commit_profile.available) + { + op_context.AddOperationTiming ( + "SignalProcessor.commit_sqlite", + commit_profile.sqlite_commit_ms); + op_context.AddOperationTiming ( + "SignalProcessor.commit_mutation_audit_finalize", + commit_profile.mutation_audit_finalize_ms); + op_context.AddOperationTiming ( + "SignalProcessor.commit_cache_write_count", + static_cast (commit_profile.cache_write_count)); + op_context.AddOperationTiming ( + "SignalProcessor.commit_cache_spill_count", + static_cast (commit_profile.cache_spill_count)); + for (const auto &[table, count] : + commit_profile.table_row_counts) + op_context.AddOperationTiming ( + "SignalProcessor.commit_table_row_count." + table, + static_cast (count)); + } const auto bounded_shadow_publish = operations::bounded_activation_shadow_internal:: PublishAfterCanonicalTransactionCommit ( @@ -3558,15 +3800,31 @@ SignalProcessor::Process (const Signal &signal) } op_context.SetCurrentOperationType ("PublishRifActiveEpoch"); op_start = std::chrono::steady_clock::now (); - const auto rif_publish - = operations::rif_active_epoch_cache_internal:: - PublishAfterPersistentCommit ( - operations::execution_cache_sidecar_internal::Ensure ( - *context_)->rif_active_epoch, - *store_); + auto rif_sidecar + = operations::execution_cache_sidecar_internal::Ensure (*context_); + const auto rif_publish = operations::rif_active_epoch_cache_internal:: + PublishAfterPersistentCommit (rif_sidecar->rif_active_epoch, + *store_); + if (maintenance && !rif_publish.published) + { + // The durable consolidation commit succeeded. Preserve the + // empty-epoch transition across a failed publication/recovery so + // the next signal cannot fall back to a full-history rebuild. + operations::rif_active_epoch_cache_internal::StageRebuild ( + rif_sidecar->rif_active_epoch, true); + } op_context.AddOperationTiming ( "SignalProcessor.publish_rif_active_epoch", ElapsedMillis (op_start, std::chrono::steady_clock::now ())); + if (ProfileWorkCountersEnabled ()) + { + op_context.AddOperationTiming ( + "SignalProcessor.retrieval_suppression_id_count", + static_cast (rif_publish.changed_rows)); + op_context.AddOperationTiming ( + "SignalProcessor.retrieval_suppression_id_activity", + rif_publish.changed_rows == 0 ? 0.0 : 1.0); + } op_context.AddOperationTiming ( "SignalProcessor.rif_epoch_publication_rebuild_count", rif_publish.rebuilt ? 1.0 : 0.0); @@ -3586,22 +3844,414 @@ SignalProcessor::Process (const Signal &signal) op_context.AddOperationTiming ( "SignalProcessor.rif_active_epoch_allocated_bytes", static_cast (rif_epoch.allocated_bytes)); + op_context.AddOperationTiming ( + "SignalProcessor.rif_active_epoch_row_batch_high_water", + static_cast (rif_epoch.row_batch_high_water)); op_context.AddOperationTiming ( "SignalProcessor.rif_active_epoch_required", operations::rif_active_epoch_cache_internal:: RequiresConsolidation (rif_epoch) ? 1.0 : 0.0); + if (!signal.force_consolidation && snapshot_owner.IsEngineOwned () + && sqlite_sparse_route_enabled) + { + auto state = operations:: + historical_surface_search_cache_internal::FindMutable ( + *context_); + if (state && state->processor_surface_complete + && !state->sqlite_sparse_route) + { + op_start = std::chrono::steady_clock::now (); + const bool backfill_ok = operations:: + historical_surface_search_cache_internal:: + AdvanceSQLiteSparseRouteBackfill (*state, *store_); + op_context.AddOperationTiming ( + "SignalProcessor.sqlite_sparse_route_ordinary_backfill", + ElapsedMillis (op_start, + std::chrono::steady_clock::now ())); + op_context.AddOperationTiming ( + "SignalProcessor.sqlite_sparse_route_ordinary_backfill_rows", + static_cast ( + state + ->sqlite_sparse_route_backfill_last_sealed_rows)); + op_context.AddOperationTiming ( + "SignalProcessor.sqlite_sparse_route_ordinary_backfill_published", + state->sqlite_sparse_route_backfill_last_published ? 1.0 + : 0.0); + op_context.AddOperationTiming ( + "SignalProcessor.sqlite_sparse_route_ordinary_backfill_succeeded", + backfill_ok ? 1.0 : 0.0); + } + if (state && state->sqlite_sparse_route) + { + const std::size_t ordinary_seal_watermark + = static_cast (operations:: + sparse_retrieval_knobs_internal::OrdinarySealBatch ( + config_.focus, config_.sensitivity, + config_.stability)); + const auto dirty_memory_ids + = state->sqlite_sparse_route->DirtyMemoryIds ( + ordinary_seal_watermark + 1); + if (dirty_memory_ids + && dirty_memory_ids->size () + >= ordinary_seal_watermark) + { + const auto prior = state->sqlite_sparse_route; + op_start = std::chrono::steady_clock::now (); + const bool sealed = operations:: + historical_surface_search_cache_internal:: + ReconcileSQLiteSparseRoute ( + *state, *store_, prior, + state->sparse_route); + op_context.AddOperationTiming ( + "SignalProcessor.sqlite_sparse_route_ordinary_seal", + ElapsedMillis (op_start, + std::chrono::steady_clock::now ())); + op_context.AddOperationTiming ( + "SignalProcessor.sqlite_sparse_route_ordinary_seal_delta_count", + static_cast (dirty_memory_ids->size ())); + op_context.AddOperationTiming ( + "SignalProcessor.sqlite_sparse_route_ordinary_seal_succeeded", + sealed ? 1.0 : 0.0); + op_context.AddOperationTiming ( + "SignalProcessor.sqlite_sparse_route_ordinary_seal_failure_code", + sealed ? 0.0 + : static_cast ( + prior->LastSealFailureCode ())); + } + } + } if (signal.force_consolidation) { - // Force persistence can prune or rewrite broad embedding sets, - // so its transaction invalidates the private historical mirror. - // Rebuild only after the authoritative commit succeeds; a failed - // commit restores the exact pre-signal snapshot in the catch path. - LoadRetrievalSurfaceCache (*store_, *context_); + // Engine-owned operations incrementally maintain a complete + // current surface. Seal that bounded epoch delta directly when + // the cache remained healthy; operations that prune, rewrite, + // or otherwise invalidate the cache still reload SQLite. + auto prior_sparse_route = premaintenance_sparse_route; + auto prior_sqlite_sparse_route + = premaintenance_sqlite_sparse_route; + const auto prior_state = operations:: + historical_surface_search_cache_internal::FindMutable ( + *context_); + if (sqlite_sparse_route_enabled && prior_state + && !prior_sqlite_sparse_route + && !prior_state->sqlite_sparse_route_backfill) + prior_sqlite_sparse_route = operations:: + historical_surface_search_cache_internal:: + OpenSQLiteSparseRoute (*prior_state, *store_); + const bool incremental_seal + = snapshot_owner.IsEngineOwned () + && any_sparse_route_enabled && prior_state + && operations:: + historical_surface_search_cache_internal:: + IncrementalSparseRouteSealReady ( + *prior_state, + sqlite_sparse_route_enabled); + const std::size_t sparse_route_delta_size + = prior_sparse_route ? prior_sparse_route->DeltaSize () : 0; + const std::size_t sqlite_sparse_route_delta_size + = prior_sqlite_sparse_route && prior_state + ? prior_sqlite_sparse_route + ->DirtyMemoryIds ( + prior_state->sparse_route_parameters + .route_capacity) + .value_or (std::vector{}) + .size () + : 0; + double reload_ms = 0.0; + if (!incremental_seal) + { + // The operation invalidated the incremental surface. Make + // the old persistent generation fail closed before the + // authoritative reload can reopen it. + if (prior_sqlite_sparse_route) + { + (void)prior_sqlite_sparse_route->Invalidate (); + prior_sqlite_sparse_route.reset (); + } + if (premaintenance_sqlite_sparse_route_backfill) + { + (void)premaintenance_sqlite_sparse_route_backfill + ->Invalidate (); + premaintenance_sqlite_sparse_route_backfill.reset (); + } + if (prior_state) + { + prior_state->sparse_route.reset (); + prior_state->sqlite_sparse_route.reset (); + prior_state->sqlite_sparse_route_backfill.reset (); + } + op_start = std::chrono::steady_clock::now (); + LoadRetrievalSurfaceCache (*store_, *context_, + config_.focus, + config_.sensitivity, + config_.stability); + reload_ms = ElapsedMillis ( + op_start, std::chrono::steady_clock::now ()); + } + op_context.AddOperationTiming ( + "SignalProcessor.reload_retrieval_surface", + reload_ms); + op_context.AddOperationTiming ( + "SignalProcessor.reload_retrieval_surface_skipped", + incremental_seal ? 1.0 : 0.0); + if (any_sparse_route_enabled) + { + auto state = operations:: + historical_surface_search_cache_internal::FindMutable ( + *context_); + if (state && sqlite_sparse_route_enabled + && !state->sqlite_sparse_route + && !state->sparse_route) + { + if (hnsw_sparse_route_enabled + && state->current_entries.size () + <= state->sparse_route_parameters + .route_bootstrap_limit) + (void)operations:: + historical_surface_search_cache_internal:: + BootstrapSparseRoute (*state); + else + { + op_start = std::chrono::steady_clock::now (); + const bool backfill_ok = operations:: + historical_surface_search_cache_internal:: + AdvanceSQLiteSparseRouteBackfill ( + *state, *store_); + op_context.AddOperationTiming ( + "SignalProcessor.sqlite_sparse_route_backfill", + ElapsedMillis ( + op_start, + std::chrono::steady_clock::now ())); + op_context.AddOperationTiming ( + "SignalProcessor.sqlite_sparse_route_backfill_rows", + static_cast ( + state + ->sqlite_sparse_route_backfill_last_sealed_rows)); + op_context.AddOperationTiming ( + "SignalProcessor.sqlite_sparse_route_backfill_published", + state + ->sqlite_sparse_route_backfill_last_published + ? 1.0 : 0.0); + op_context.AddOperationTiming ( + "SignalProcessor.sqlite_sparse_route_backfill_succeeded", + backfill_ok ? 1.0 : 0.0); + op_context.AddOperationTiming ( + "SignalProcessor.sqlite_sparse_route_backfill_failure_code", + static_cast ( + state->sqlite_sparse_route_backfill_failure_code)); + op_context.AddOperationTiming ( + "SignalProcessor.sqlite_sparse_route_backfill_failure_count", + static_cast ( + state->sqlite_sparse_route_backfill_failure_count)); + } + } + if (state + && state->sparse_route + && state->current_entries.size () + > state->sparse_route_parameters.route_capacity) + { + op_start = std::chrono::steady_clock::now (); + const bool sealed + = incremental_seal && prior_sparse_route + ? operations:: + historical_surface_search_cache_internal:: + SealSparseRouteDelta (*state) + : operations:: + historical_surface_search_cache_internal:: + ReconcileSparseRoute ( + *state, prior_sparse_route); + op_context.AddOperationTiming ( + "SignalProcessor.sparse_route_seal", + ElapsedMillis (op_start, + std::chrono::steady_clock::now ())); + op_context.AddOperationTiming ( + "SignalProcessor.sparse_route_seal_delta_count", + static_cast (sparse_route_delta_size)); + op_context.AddOperationTiming ( + "SignalProcessor.sparse_route_seal_succeeded", + sealed ? 1.0 : 0.0); + } + } + if (sqlite_sparse_route_enabled) + { + auto state = operations:: + historical_surface_search_cache_internal::FindMutable ( + *context_); + if (state + && state->current_entries.size () + > state->sparse_route_parameters.route_capacity + && !(state->sqlite_sparse_route_backfill + && !state->sqlite_sparse_route)) + { + op_start = std::chrono::steady_clock::now (); + const bool sealed = operations:: + historical_surface_search_cache_internal:: + ReconcileSQLiteSparseRoute ( + *state, *store_, prior_sqlite_sparse_route, + state->sparse_route); + op_context.AddOperationTiming ( + "SignalProcessor.sqlite_sparse_route_seal", + ElapsedMillis (op_start, + std::chrono::steady_clock::now ())); + op_context.AddOperationTiming ( + "SignalProcessor.sqlite_sparse_route_seal_delta_count", + static_cast ( + sqlite_sparse_route_delta_size)); + op_context.AddOperationTiming ( + "SignalProcessor.sqlite_sparse_route_seal_succeeded", + sealed ? 1.0 : 0.0); + op_context.AddOperationTiming ( + "SignalProcessor.sqlite_sparse_route_seal_failure_code", + sealed || !prior_sqlite_sparse_route + ? 0.0 + : static_cast ( + prior_sqlite_sparse_route + ->LastSealFailureCode ())); + const bool profile_recenter_overlap + = internal::experimental_env::Flag ( + "CORTEXT_PROFILE_RECENTER_ACTIVATION_OVERLAP"); + auto consolidation_centroid + = BuildConsolidationActivationCentroid (op_context); + int consolidation_centroid_source = 1; + if (!consolidation_centroid.embedding) + { + consolidation_centroid + = BuildActiveSignalRingCentroid ( + *store_, signal.embedding.size (), + config_.focus, config_.sensitivity, + config_.stability); + consolidation_centroid_source = 2; + } + if (!consolidation_centroid.embedding) + consolidation_centroid_source = 0; + std::optional> + pre_recenter_activated; + std::size_t pre_recenter_node_rows = 0; + if (profile_recenter_overlap + && state->sqlite_sparse_route) + { + pre_recenter_activated + = state->sqlite_sparse_route->SearchActivated ( + signal.embedding); + pre_recenter_node_rows + = state->sqlite_sparse_route + ->LastSearchNodeRows (); + } + op_start = std::chrono::steady_clock::now (); + const bool recentered + = sealed && state->sqlite_sparse_route + && consolidation_centroid.embedding + && state->sqlite_sparse_route->Recenter ( + *consolidation_centroid.embedding); + op_context.AddOperationTiming ( + "SignalProcessor.sqlite_sparse_route_recenter", + ElapsedMillis ( + op_start, std::chrono::steady_clock::now ())); + op_context.AddOperationTiming ( + "SignalProcessor.sqlite_sparse_route_recenter_succeeded", + recentered ? 1.0 : 0.0); + op_context.AddOperationTiming ( + "SignalProcessor.sqlite_sparse_route_recenter_derived_centroid", + consolidation_centroid.embedding ? 1.0 : 0.0); + op_context.AddOperationTiming ( + "SignalProcessor.sqlite_sparse_route_recenter_centroid_source", + static_cast ( + consolidation_centroid_source)); + op_context.AddOperationTiming ( + "SignalProcessor.sqlite_sparse_route_recenter_centroid_cluster_count", + static_cast ( + consolidation_centroid.cluster_count)); + op_context.AddOperationTiming ( + "SignalProcessor.sqlite_sparse_route_recenter_centroid_member_count", + static_cast ( + consolidation_centroid.member_count)); + std::optional> + post_recenter_activated; + std::size_t post_recenter_node_rows = 0; + if (profile_recenter_overlap && recentered) + { + post_recenter_activated + = state->sqlite_sparse_route->SearchActivated ( + signal.embedding); + post_recenter_node_rows + = state->sqlite_sparse_route + ->LastSearchNodeRows (); + } + const bool overlap_pair_valid + = pre_recenter_activated.has_value () + && post_recenter_activated.has_value (); + int overlap_failure_code = 0; + if (profile_recenter_overlap) + { + if (!state->sqlite_sparse_route) + overlap_failure_code = 1; + else if (!pre_recenter_activated) + overlap_failure_code = 2; + else if (!recentered) + overlap_failure_code = 3; + else if (!post_recenter_activated) + overlap_failure_code = 4; + } + std::size_t overlap_count = 0; + if (overlap_pair_valid) + { + std::unordered_set pre_ids ( + pre_recenter_activated->begin (), + pre_recenter_activated->end ()); + for (const long long memory_id + : *post_recenter_activated) + overlap_count += pre_ids.count (memory_id); + } + op_context.AddOperationTiming ( + "SignalProcessor.sqlite_sparse_route_recenter_overlap_profiled", + profile_recenter_overlap ? 1.0 : 0.0); + op_context.AddOperationTiming ( + "SignalProcessor.sqlite_sparse_route_recenter_overlap_pair_valid", + overlap_pair_valid ? 1.0 : 0.0); + op_context.AddOperationTiming ( + "SignalProcessor.sqlite_sparse_route_recenter_overlap_failure_code", + static_cast (overlap_failure_code)); + op_context.AddOperationTiming ( + "SignalProcessor.sqlite_sparse_route_recenter_pre_activated_count", + pre_recenter_activated + ? static_cast ( + pre_recenter_activated->size ()) + : 0.0); + op_context.AddOperationTiming ( + "SignalProcessor.sqlite_sparse_route_recenter_post_activated_count", + post_recenter_activated + ? static_cast ( + post_recenter_activated->size ()) + : 0.0); + op_context.AddOperationTiming ( + "SignalProcessor.sqlite_sparse_route_recenter_overlap_count", + static_cast (overlap_count)); + op_context.AddOperationTiming ( + "SignalProcessor.sqlite_sparse_route_recenter_pre_node_count", + static_cast (pre_recenter_node_rows)); + op_context.AddOperationTiming ( + "SignalProcessor.sqlite_sparse_route_recenter_post_node_count", + static_cast (post_recenter_node_rows)); + op_context.AddOperationTiming ( + "SignalProcessor.sqlite_sparse_route_activation_search_effort", + state->sqlite_sparse_route + ? static_cast ( + state->sqlite_sparse_route + ->ActivationSearchEffort ()) + : 0.0); + op_context.AddOperationTiming ( + "SignalProcessor.sqlite_sparse_route_activation_node_budget", + state->sqlite_sparse_route + ? static_cast ( + state->sqlite_sparse_route + ->ActivationSearchNodeBudget ()) + : 0.0); + } + } } - if (signal.force_consolidation - || signal.retention == Retention::Durable) + if (signal.retention == Retention::Durable) { // Durable is the shared ingestion transaction plus this explicit // post-commit SQLite edge. It does not select a second write @@ -3675,8 +4325,13 @@ SignalProcessor::Process (const Signal &signal) Output out; if (operations::consolidation_epoch_profile_internal::Enabled ()) { + const auto mutation_audit_start = std::chrono::steady_clock::now (); const auto mutations = internal::ConsumeSQLiteCommittedMutations (store_.get ()); + op_context.AddOperationTiming ( + "SignalProcessor.profile_mutation_audit", + ElapsedMillis (mutation_audit_start, + std::chrono::steady_clock::now ())); if (maintenance) { auto seal = operations::consolidation_epoch_profile_internal::Seal ( @@ -3733,16 +4388,6 @@ SignalProcessor::Process (const Signal &signal) && context_->predictive_pre_activation_memory_ids.empty () ? 0.0 : 1.0); - op_context.AddOperationTiming ( - "SignalProcessor.retrieval_suppression_id_count", - static_cast ( - operations::execution_cache_sidecar_internal::Ensure (*context_) - ->rif_active_epoch.active_rows)); - op_context.AddOperationTiming ( - "SignalProcessor.retrieval_suppression_id_activity", - operations::execution_cache_sidecar_internal::Ensure (*context_) - ->rif_active_epoch.active_rows == 0 - ? 0.0 : 1.0); } if (read_only_output.has_value ()) { @@ -3779,6 +4424,22 @@ SignalProcessor::Flush () { return; } + std::shared_ptr + preserved_sparse_route; + std::shared_ptr< + operations::sparse_retrieval_route_sqlite_internal::Route> + preserved_sqlite_sparse_route; + std::shared_ptr< + operations::sparse_retrieval_route_sqlite_internal::Route> + preserved_sqlite_sparse_route_backfill; + if (const auto state = operations:: + historical_surface_search_cache_internal::FindMutable (*context_)) + { + preserved_sparse_route = state->sparse_route; + preserved_sqlite_sparse_route = state->sqlite_sparse_route; + preserved_sqlite_sparse_route_backfill + = state->sqlite_sparse_route_backfill; + } ProcessorContext context_snapshot; DetachedProcessorCaches context_cache_snapshot; const auto consolidation_throughput_snapshot @@ -3840,7 +4501,24 @@ SignalProcessor::Flush () LoadHistoricalSurfaceSearchCache (*store_, *context_); throw; } - LoadRetrievalSurfaceCache (*store_, *context_); + LoadRetrievalSurfaceCache (*store_, *context_, config_.focus, + config_.sensitivity, config_.stability); + if (auto state = operations::historical_surface_search_cache_internal:: + FindMutable (*context_)) + { + // Flush persists state and working-memory rows only. Those writes do not + // alter the LONG_TERM/ASSOCIATION route population, so the route + // lifecycle must survive the cache rebuild even if the historical + // surface itself had to fall back to exact SQL. + if (preserved_sparse_route) + state->sparse_route = std::move (preserved_sparse_route); + if (preserved_sqlite_sparse_route) + state->sqlite_sparse_route + = std::move (preserved_sqlite_sparse_route); + if (preserved_sqlite_sparse_route_backfill) + state->sqlite_sparse_route_backfill + = std::move (preserved_sqlite_sparse_route_backfill); + } CheckpointSQLiteStore (store_.get (), true, nullptr, nullptr); } @@ -4133,9 +4811,12 @@ SignalProcessor::PersistWorkingMemory (Transaction &tx, bool force, if (op_context == nullptr) { // The process-wide historical registry is not part of the processor - // snapshot. Rebuild it from authoritative SQL after either commit or - // rollback of any flush-time embedding mutation. - operations::historical_surface_search_cache_internal::Erase (*context_); + // snapshot. Flush only mutates working-memory rows, which are outside + // the current LONG_TERM/ASSOCIATION sparse route. Invalidate historical + // material while preserving the independently maintained route and any + // unpublished bounded backfill progress. + operations::historical_surface_search_cache_internal:: + InvalidateHistoricalPreserveCurrent (*context_); } auto add_timing @@ -4232,8 +4913,8 @@ SignalProcessor::PersistWorkingMemory (Transaction &tx, bool force, { // Force pruning can delete a broad set of embedding rows. Exact // incremental ownership is not available here, so fail closed. - operations::historical_surface_search_cache_internal::Erase ( - *context_); + operations::historical_surface_search_cache_internal:: + InvalidateHistoricalPreserveCurrent (*context_); } const int prune_batch = force ? kClosedWorkingMemoryPruneBatch : kClosedWorkingMemoryIncrementalPruneBatch; @@ -4362,10 +5043,6 @@ SignalProcessor::PersistWorkingMemory (Transaction &tx, bool force, strength_ts_ms, memory_id }); operations::rif_state_internal::RefreshActiveStrengthWhere ( tx, "memory_id = ?", { memory_id }); - operations::rif_active_epoch_cache_internal::StageMemory ( - operations::execution_cache_sidecar_internal::Ensure ( - *context_)->rif_active_epoch, - memory_id); add_timing ("SignalProcessor.wm_update_slot_memory", t_sql_start); } @@ -4431,41 +5108,12 @@ SignalProcessor::PersistWorkingMemory (Transaction &tx, bool force, const auto &rec = slot.signal_records[rec_index]; try { - long long signal_embedding_id = embedding_id; - if (rec.embedding.size () > 0 - && rec.embedding.size () == slot.embedding.size ()) - { - failure_stage = "insert_signal_embedding"; - const std::vector sig_vec - = ToFloatVector (rec.embedding); - const auto t_sql_start - = std::chrono::steady_clock::now (); - tx.Execute ( - "INSERT INTO embeddings (embedding, created_at) " - "VALUES (?, ?)", - { sig_vec, - static_cast (rec.timestamp) }); - auto sig_rows - = tx.Execute ("SELECT last_insert_rowid() AS id", {}); - if (!sig_rows.empty ()) - { - signal_embedding_id = ExtractInt64 ( - sig_rows[0], "id", embedding_id); - } - if (signal_embedding_id > 0) - { - operations:: - historical_surface_search_cache_internal:: - Append ( - *context_, - { signal_embedding_id, 0, 0, - std::string (), std::string (), - rec.embedding }); - } - add_timing ( - "SignalProcessor.wm_insert_signal_embedding", - t_sql_start); - } + const std::vector signal_embedding + = rec.embedding.size () > 0 + && rec.embedding.size () + == slot.embedding.size () + ? ToFloatVector (rec.embedding) + : ToFloatVector (slot.embedding); failure_stage = "insert_signal_row"; const auto t_sql_start @@ -4479,13 +5127,28 @@ SignalProcessor::PersistWorkingMemory (Transaction &tx, bool force, { memory_id, slot.source_id.empty () ? std::string ("unknown") : slot.source_id, - signal_embedding_id, + embedding_id, static_cast (rec.timestamp), rec.modality, rec.mime, rec.blob_id.empty () ? std::any () : std::any (rec.blob_id), static_cast (rec.serial_position), rec.score, static_cast (rec.timestamp) }); + const auto signal_id_rows + = tx.Execute ("SELECT last_insert_rowid() AS id"); + const long long signal_id + = signal_id_rows.empty () + ? 0 + : ExtractInt64 (signal_id_rows.front (), "id", + 0); + if (signal_id <= 0) + throw std::runtime_error ( + "working-memory signal id unavailable"); + operations::active_signal_embedding_ring_internal:: + Upsert (tx, signal_id, signal_embedding, + static_cast (rec.timestamp), + config_.focus, config_.sensitivity, + config_.stability); add_timing ("SignalProcessor.wm_insert_signal_row", t_sql_start); } diff --git a/src/store.cpp b/src/store.cpp index c7348dd9..bcd36ad7 100644 --- a/src/store.cpp +++ b/src/store.cpp @@ -1,7 +1,9 @@ #include "cortext/store/sqlite_store.hpp" +#include "store/commit_profile_internal.hpp" #include "store/mutation_audit_internal.hpp" #include +#include #include #include #include @@ -61,10 +63,14 @@ struct SQLiteMutationAuditState bool root_active = false; std::vector pending; std::vector pending_physical; + std::vector committed_physical; std::vector committed; std::unordered_map vec_logical_ids; std::unordered_map marks; bool trigger_journal_ready = false; +#if defined(CORTEXT_TESTING) + std::size_t commit_vec_lookup_count = 0; +#endif }; struct SQLiteMutationAuditRegistry @@ -73,6 +79,126 @@ struct SQLiteMutationAuditRegistry std::unordered_map stores; }; +struct SQLiteCommitProfileState +{ + int cache_writes_before = 0; + int cache_spills_before = 0; + bool root_active = false; + std::unordered_map table_row_counts; + internal::SQLiteCommitProfile last; +}; + +struct SQLiteCommitProfileRegistry +{ + std::mutex mutex; + std::unordered_map stores; +}; + +SQLiteCommitProfileRegistry & +CommitProfileRegistry () +{ + static auto *registry = new SQLiteCommitProfileRegistry (); + return *registry; +} + +bool +CommitProfileEnabled () +{ + const char *value = std::getenv ("CORTEXT_PROFILE_WORK_COUNTERS"); + return value != nullptr && value[0] != '\0' && std::string_view (value) != "0" + && std::string_view (value) != "false"; +} + +int +SQLiteDbStatusCurrent (sqlite3 *connection, int operation) +{ + int current = 0; + int high_water = 0; + if (!connection + || sqlite3_db_status (connection, operation, ¤t, &high_water, 0) + != SQLITE_OK) + return 0; + return current; +} + +void +BeginCommitProfile (SQLiteStore *store, sqlite3 *connection) +{ + if (!CommitProfileEnabled ()) + return; + auto ®istry = CommitProfileRegistry (); + std::lock_guard lock (registry.mutex); + auto &state = registry.stores[store]; + state.cache_writes_before + = SQLiteDbStatusCurrent (connection, SQLITE_DBSTATUS_CACHE_WRITE); + state.cache_spills_before + = SQLiteDbStatusCurrent (connection, SQLITE_DBSTATUS_CACHE_SPILL); + state.root_active = true; + state.table_row_counts.clear (); + state.last = {}; +} + +void +ObserveCommitProfileTableMutation (SQLiteStore *store, + std::string_view table) +{ + if (!CommitProfileEnabled ()) + return; + auto ®istry = CommitProfileRegistry (); + std::lock_guard lock (registry.mutex); + const auto it = registry.stores.find (store); + if (it == registry.stores.end () || !it->second.root_active) + return; + it->second.table_row_counts[std::string (table)] += 1; +} + +void +FinishCommitProfile (SQLiteStore *store, sqlite3 *connection, + double sqlite_commit_ms, + double mutation_audit_finalize_ms) +{ + if (!CommitProfileEnabled ()) + return; + const int cache_writes + = SQLiteDbStatusCurrent (connection, SQLITE_DBSTATUS_CACHE_WRITE); + const int cache_spills + = SQLiteDbStatusCurrent (connection, SQLITE_DBSTATUS_CACHE_SPILL); + auto ®istry = CommitProfileRegistry (); + std::lock_guard lock (registry.mutex); + auto &state = registry.stores[store]; + state.last.available = true; + state.last.sqlite_commit_ms = sqlite_commit_ms; + state.last.mutation_audit_finalize_ms = mutation_audit_finalize_ms; + state.last.cache_write_count + = std::max (0, cache_writes - state.cache_writes_before); + state.last.cache_spill_count + = std::max (0, cache_spills - state.cache_spills_before); + state.last.table_row_counts.assign (state.table_row_counts.begin (), + state.table_row_counts.end ()); + std::sort (state.last.table_row_counts.begin (), + state.last.table_row_counts.end ()); + state.table_row_counts.clear (); + state.root_active = false; +} + +void +DiscardCommitProfile (SQLiteStore *store) +{ + auto ®istry = CommitProfileRegistry (); + std::lock_guard lock (registry.mutex); + const auto it = registry.stores.find (store); + if (it != registry.stores.end ()) + it->second.root_active = false; +} + +void +EraseCommitProfileStore (SQLiteStore *store) +{ + auto ®istry = CommitProfileRegistry (); + std::lock_guard lock (registry.mutex); + registry.stores.erase (store); +} + SQLiteMutationAuditRegistry & MutationAuditRegistry () { @@ -178,6 +304,7 @@ MutationAuditPreupdateHook (void *opaque, sqlite3 *db, int operation, if (!opaque || !db || !table) return; auto *store = static_cast (opaque); + ObserveCommitProfileTableMutation (store, table); std::vector identities; if (auto before = MutationAuditLogicalIdentity (db, operation, table, true)) identities.push_back (std::move (*before)); @@ -231,35 +358,44 @@ MutationAuditVecPhysicalKey (std::string_view surface, std::int64_t row_id) } std::optional -MutationAuditResolveVecId (sqlite3 *db, std::string_view surface, +MutationAuditResolveVecId (SQLiteStore &store, std::string_view surface, std::int64_t row_id) { - const std::string sql = "SELECT id FROM \"" + std::string (surface) - + "_rowids\" WHERE rowid = ?"; - sqlite3_stmt *statement = nullptr; - if (sqlite3_prepare_v2 (db, sql.c_str (), -1, &statement, nullptr) - != SQLITE_OK) - return std::nullopt; - sqlite3_bind_int64 (statement, 1, static_cast (row_id)); - std::optional result; - if (sqlite3_step (statement) == SQLITE_ROW) - { - if (sqlite3_column_type (statement, 0) == SQLITE_INTEGER) - result = std::to_string (sqlite3_column_int64 (statement, 0)); - else if (const auto *text = sqlite3_column_text (statement, 0)) - result = std::string (reinterpret_cast (text)); - else - result = std::to_string (row_id); + try + { + const auto rows = store.Execute ( + "SELECT id FROM \"" + std::string (surface) + + "_rowids\" WHERE rowid = ?", + { static_cast (row_id) }); + if (rows.empty ()) + return std::nullopt; + const auto value = rows.front ().find ("id"); + if (value == rows.front ().end ()) + return std::nullopt; + if (value->second.type () == typeid (long long)) + return std::to_string (std::any_cast (value->second)); + if (value->second.type () == typeid (std::string)) + return std::any_cast (value->second); + if (!value->second.has_value () + || value->second.type () == typeid (std::nullptr_t)) + return std::to_string (row_id); } - sqlite3_finalize (statement); - return result; + catch (const std::exception &) + { + } + return std::nullopt; } void -ResolveMutationAuditVecMutations (SQLiteMutationAuditState &state, sqlite3 *db) +ResolveCommittedMutationAuditVecMutations (SQLiteMutationAuditState &state, + SQLiteStore &store) { - for (const auto &mutation : state.pending_physical) + for (const auto &mutation : state.committed_physical) { +#if defined(CORTEXT_TESTING) + if (state.root_active) + state.commit_vec_lookup_count += 1; +#endif const std::string physical_key = MutationAuditVecPhysicalKey (mutation.surface, mutation.row_id); std::optional logical_id; @@ -273,17 +409,17 @@ ResolveMutationAuditVecMutations (SQLiteMutationAuditState &state, sqlite3 *db) else { logical_id = MutationAuditResolveVecId ( - db, mutation.surface, mutation.row_id); + store, mutation.surface, mutation.row_id); if (logical_id) state.vec_logical_ids[physical_key] = *logical_id; } if (logical_id) - state.pending.push_back ({ + state.committed.push_back ({ internal::SQLiteMutationKind::Index, mutation.surface, mutation.surface + ":" + MutationAuditComponent (*logical_id) }); } - state.pending_physical.clear (); + state.committed_physical.clear (); } void @@ -310,7 +446,7 @@ RegisterMutationAuditTransaction (SQLiteStore *store, void CommitMutationAuditTransaction (SQLiteStore *store, const SQLiteTransaction *transaction, - bool root, sqlite3 *db = nullptr) + bool root) { auto ®istry = MutationAuditRegistry (); std::lock_guard lock (registry.mutex); @@ -320,11 +456,13 @@ CommitMutationAuditTransaction (SQLiteStore *store, it->second.marks.erase (transaction); if (!root) return; - if (db) - ResolveMutationAuditVecMutations (it->second, db); it->second.committed.insert (it->second.committed.end (), it->second.pending.begin (), it->second.pending.end ()); + it->second.committed_physical.insert ( + it->second.committed_physical.end (), + it->second.pending_physical.begin (), + it->second.pending_physical.end ()); it->second.pending.clear (); it->second.pending_physical.clear (); it->second.marks.clear (); @@ -925,11 +1063,15 @@ ResetSQLiteMutationAudit (Store *store) return; it->second.pending.clear (); it->second.pending_physical.clear (); + it->second.committed_physical.clear (); it->second.committed.clear (); it->second.vec_logical_ids = std::move (vec_logical_ids); it->second.marks.clear (); it->second.root_active = false; it->second.trigger_journal_ready = trigger_journal_ready; +#if defined(CORTEXT_TESTING) + it->second.commit_vec_lookup_count = 0; +#endif } SQLiteMutationAuditBatch @@ -945,8 +1087,13 @@ ConsumeSQLiteCommittedMutations (Store *store) auto it = registry.stores.find (sqlite_store); if (it == registry.stores.end ()) return {}; + ResolveCommittedMutationAuditVecMutations (it->second, *sqlite_store); result.committed_hook_identities.swap (it->second.committed); result.trigger_journal_ready = it->second.trigger_journal_ready; +#if defined(CORTEXT_TESTING) + result.commit_vec_lookup_count = it->second.commit_vec_lookup_count; + it->second.commit_vec_lookup_count = 0; +#endif } if (!result.trigger_journal_ready) return result; @@ -976,6 +1123,22 @@ ConsumeSQLiteCommittedMutations (Store *store) return result; } +SQLiteCommitProfile +ConsumeSQLiteCommitProfile (Store *store) +{ + auto *sqlite_store = dynamic_cast (store); + if (!sqlite_store) + return {}; + auto ®istry = CommitProfileRegistry (); + std::lock_guard lock (registry.mutex); + const auto it = registry.stores.find (sqlite_store); + if (it == registry.stores.end ()) + return {}; + auto result = it->second.last; + it->second.last = {}; + return result; +} + } // namespace internal // SQLiteConnection implementation @@ -1328,6 +1491,7 @@ SQLiteStore::~SQLiteStore () sqlite3_update_hook (connection_->GetConnection (), nullptr, nullptr); } EraseMutationAuditStore (this); + EraseCommitProfileStore (this); ClearStatementCache (); } @@ -1405,17 +1569,20 @@ SQLiteStore::SQLiteStore (std::unique_ptr connection) #if defined(CORTEXT_ENABLE_DYNAMIC_EXTENSIONS) && !defined(__EMSCRIPTEN__) TryLoadDynamicExtensions (connection_->GetConnection ()); #endif - if (MutationAuditEnabled ()) + const bool mutation_audit_enabled = MutationAuditEnabled (); + if (mutation_audit_enabled || CommitProfileEnabled ()) { - auto ®istry = MutationAuditRegistry (); - { - std::lock_guard lock (registry.mutex); - registry.stores.try_emplace (this); - } + if (mutation_audit_enabled) + { + auto ®istry = MutationAuditRegistry (); + std::lock_guard lock (registry.mutex); + registry.stores.try_emplace (this); + } sqlite3_preupdate_hook (connection_->GetConnection (), MutationAuditPreupdateHook, this); - sqlite3_update_hook (connection_->GetConnection (), - MutationAuditVirtualTableUpdateHook, this); + if (mutation_audit_enabled) + sqlite3_update_hook (connection_->GetConnection (), + MutationAuditVirtualTableUpdateHook, this); } } @@ -1464,6 +1631,8 @@ SQLiteStore::Begin () auto transaction = std::make_unique (this, parent); SQLiteTransaction *transaction_ptr = transaction.get (); RegisterMutationAuditTransaction (this, transaction_ptr, parent == nullptr); + if (parent == nullptr) + BeginCommitProfile (this, connection_->GetConnection ()); transaction_stack_.push_back (transaction_ptr); return transaction; } @@ -1481,6 +1650,7 @@ SQLiteStore::Commit () if (root) { + const auto sqlite_commit_start = std::chrono::steady_clock::now (); if (in_transaction_) { if (IsDbInTransaction ()) @@ -1489,6 +1659,19 @@ SQLiteStore::Commit () } in_transaction_ = false; } + const double sqlite_commit_ms = std::chrono::duration ( + std::chrono::steady_clock::now () - sqlite_commit_start) + .count (); + const auto audit_start = std::chrono::steady_clock::now (); + current_tx->is_committed_ = true; + transaction_stack_.pop_back (); + CommitMutationAuditTransaction (this, current_tx, true); + const double audit_ms = std::chrono::duration ( + std::chrono::steady_clock::now () - audit_start) + .count (); + FinishCommitProfile (this, connection_->GetConnection (), + sqlite_commit_ms, audit_ms); + return; } else { @@ -1497,9 +1680,7 @@ SQLiteStore::Commit () current_tx->is_committed_ = true; transaction_stack_.pop_back (); - CommitMutationAuditTransaction ( - this, current_tx, root, - root ? connection_->GetConnection () : nullptr); + CommitMutationAuditTransaction (this, current_tx, root); } void @@ -1533,6 +1714,8 @@ SQLiteStore::Rollback () current_tx->is_rolled_back_ = true; transaction_stack_.pop_back (); RollbackMutationAuditTransaction (this, current_tx, root); + if (root) + DiscardCommitProfile (this); } void @@ -1553,6 +1736,7 @@ SQLiteStore::CommitRootTransaction (SQLiteTransaction *transaction) // Only commit if this is the root transaction (no parent) if (transaction->parent_transaction_ == nullptr) { + const auto sqlite_commit_start = std::chrono::steady_clock::now (); if (in_transaction_) { if (IsDbInTransaction ()) @@ -1561,12 +1745,23 @@ SQLiteStore::CommitRootTransaction (SQLiteTransaction *transaction) } in_transaction_ = false; } + const double sqlite_commit_ms = std::chrono::duration ( + std::chrono::steady_clock::now () - sqlite_commit_start) + .count (); + transaction_stack_.pop_back (); + const auto audit_start = std::chrono::steady_clock::now (); + CommitMutationAuditTransaction (this, transaction, true); + const double audit_ms = std::chrono::duration ( + std::chrono::steady_clock::now () - audit_start) + .count (); + FinishCommitProfile (this, connection_->GetConnection (), + sqlite_commit_ms, audit_ms); + return; } // Remove from stack transaction_stack_.pop_back (); - CommitMutationAuditTransaction (this, transaction, true, - connection_->GetConnection ()); + CommitMutationAuditTransaction (this, transaction, true); } void @@ -1600,6 +1795,7 @@ SQLiteStore::RollbackRootTransaction (SQLiteTransaction *transaction) // Remove from stack transaction_stack_.pop_back (); RollbackMutationAuditTransaction (this, transaction, true); + DiscardCommitProfile (this); } std::vector > diff --git a/src/store/commit_profile_internal.hpp b/src/store/commit_profile_internal.hpp new file mode 100644 index 00000000..bfa1de10 --- /dev/null +++ b/src/store/commit_profile_internal.hpp @@ -0,0 +1,27 @@ +#pragma once + +#include "cortext/store/store.hpp" + +#include +#include +#include +#include + +namespace cortext::internal +{ + +/// @brief Profiling-only decomposition of the most recent root SQLite commit. +struct SQLiteCommitProfile +{ + bool available = false; + double sqlite_commit_ms = 0.0; + double mutation_audit_finalize_ms = 0.0; + std::int64_t cache_write_count = 0; + std::int64_t cache_spill_count = 0; + std::vector> table_row_counts; +}; + +/// @brief Consume the last root-commit profile for this store. +SQLiteCommitProfile ConsumeSQLiteCommitProfile (Store *store); + +} // namespace cortext::internal diff --git a/src/store/mutation_audit_internal.hpp b/src/store/mutation_audit_internal.hpp index ed4264f9..e195b4d7 100644 --- a/src/store/mutation_audit_internal.hpp +++ b/src/store/mutation_audit_internal.hpp @@ -31,6 +31,9 @@ struct SQLiteMutationAuditBatch std::vector committed_hook_identities; std::vector committed_trigger_identities; bool trigger_journal_ready = false; +#if defined(CORTEXT_TESTING) + std::size_t commit_vec_lookup_count = 0; +#endif }; /// @brief Drop schema/setup mutations and begin a fresh profiling stream. diff --git a/src/store/schema.cpp b/src/store/schema.cpp index bfba559c..10fbf1f0 100644 --- a/src/store/schema.cpp +++ b/src/store/schema.cpp @@ -865,6 +865,84 @@ GetCoreMigrations () "FROM memories WHERE suppression > 1e-9", }, }, + { + 29, + "Persist row-addressed sparse retrieval route", + { + "CREATE TABLE IF NOT EXISTS cortext_sparse_route_meta(" + "singleton INTEGER PRIMARY KEY CHECK(singleton = 1), " + "schema_version INTEGER NOT NULL CHECK(schema_version = 1), " + "embedding_dim INTEGER NOT NULL CHECK(embedding_dim > 0), " + "entry_memory_id INTEGER NOT NULL CHECK(entry_memory_id >= 0), " + "max_level INTEGER NOT NULL CHECK(max_level >= 0), " + "active_count INTEGER NOT NULL CHECK(active_count >= 0), " + "generation INTEGER NOT NULL CHECK(generation >= 0))", + "CREATE TABLE IF NOT EXISTS cortext_sparse_route_nodes(" + "memory_id INTEGER PRIMARY KEY, " + "embedding BLOB NOT NULL, " + "level INTEGER NOT NULL CHECK(level >= 0), " + "links BLOB NOT NULL, " + "active INTEGER NOT NULL CHECK(active IN (0, 1)), " + "generation INTEGER NOT NULL CHECK(generation >= 0))", + "CREATE TABLE IF NOT EXISTS cortext_sparse_route_build(" + "singleton INTEGER PRIMARY KEY CHECK(singleton = 1), " + "schema_version INTEGER NOT NULL CHECK(schema_version = 1), " + "embedding_dim INTEGER NOT NULL CHECK(embedding_dim > 0), " + "cursor_memory_id INTEGER NOT NULL " + "CHECK(cursor_memory_id >= 0), " + "entry_memory_id INTEGER NOT NULL CHECK(entry_memory_id >= 0), " + "max_level INTEGER NOT NULL CHECK(max_level >= 0), " + "active_count INTEGER NOT NULL CHECK(active_count >= 0), " + "generation INTEGER NOT NULL CHECK(generation > 0))", + "CREATE TABLE IF NOT EXISTS " + "cortext_sparse_route_dirty(" + "memory_id INTEGER PRIMARY KEY CHECK(memory_id > 0))", + "CREATE INDEX IF NOT EXISTS idx_sparse_route_nodes_active " + "ON cortext_sparse_route_nodes(generation, active, memory_id)", + "CREATE INDEX IF NOT EXISTS idx_sparse_route_nodes_generation " + "ON cortext_sparse_route_nodes(generation)", + }, + }, + { + 30, + "Persist exact signal embeddings outside the global vector route", + { + "CREATE TABLE IF NOT EXISTS cortext_active_signal_embeddings(" + "slot INTEGER PRIMARY KEY CHECK(slot >= 0), " + "signal_id INTEGER NOT NULL UNIQUE, " + "embedding BLOB NOT NULL, " + "created_at INTEGER NOT NULL, " + "capacity INTEGER NOT NULL CHECK(capacity > 0), " + "FOREIGN KEY(signal_id) REFERENCES signals(signal_id) " + "ON DELETE CASCADE)", + "DROP VIEW IF EXISTS recent_context", + "CREATE VIEW recent_context AS " + "SELECT s.signal_id, s.embedding_id, " + "COALESCE(a.embedding, e.embedding) AS embedding, s.timestamp " + "FROM signals s " + "LEFT JOIN cortext_active_signal_embeddings a " + "ON a.signal_id = s.signal_id " + "LEFT JOIN embeddings e ON s.embedding_id = e.embedding_id " + "ORDER BY s.timestamp DESC " + "LIMIT 64", + }, + }, + { + 31, + "Persist the consolidation-rebuilt sparse activation centroid", + { + "ALTER TABLE cortext_sparse_route_meta ADD COLUMN " + "activation_entry_memory_id INTEGER NOT NULL DEFAULT 0 " + "CHECK(activation_entry_memory_id >= 0)", + "ALTER TABLE cortext_sparse_route_meta ADD COLUMN " + "activation_generation INTEGER NOT NULL DEFAULT 0 " + "CHECK(activation_generation >= 0)", + "ALTER TABLE cortext_sparse_route_meta ADD COLUMN " + "activation_centroid BLOB", + "ALTER TABLE cortext_sparse_route_meta ADD COLUMN " + "activation_identity_ids BLOB", + }, + }, }; } diff --git a/tests/core_knobs.test.cpp b/tests/core_knobs.test.cpp index d2a7de95..1d5946b3 100644 --- a/tests/core_knobs.test.cpp +++ b/tests/core_knobs.test.cpp @@ -537,7 +537,6 @@ TEST_CASE ("Retrieval source pressure and scoring helpers derive from knobs", > RetrievalSparseKeySize (0.5, 0.0, 0.5)); REQUIRE (RetrievalSparseKeySize (0.5, 0.5, 1.0) < RetrievalSparseKeySize (0.5, 0.5, 0.0)); - REQUIRE (RetrievalTokenOverlapQueryWeight (1.0, 0.5, 0.5) > RetrievalTokenOverlapQueryWeight (0.0, 0.5, 0.5)); REQUIRE (RetrievalRouteTokenMinChars (0.5, 0.5, 0.5) == 3); diff --git a/tests/cortext.test.cpp b/tests/cortext.test.cpp index b0ad7a69..b9155acd 100644 --- a/tests/cortext.test.cpp +++ b/tests/cortext.test.cpp @@ -3,6 +3,8 @@ #include "../src/cortext_pipeline_internal.hpp" #include "../src/operations/retrieval_trace_state.hpp" #include "../src/operations/bounded_activation_shadow_internal.hpp" +#include "../src/operations/rif_active_epoch_cache_internal.hpp" +#include "../src/operations/sparse_retrieval_knobs_internal.hpp" #include #include #include @@ -779,7 +781,7 @@ TEST_CASE ("encoded modalities and source cardinalities share bounded work", const char *secondary; double fixed_bound; }; - constexpr std::array kCounters { { + const std::array kCounters { { { "retrieval_suppression_id_count", "SignalProcessor.retrieval_suppression_id_count", nullptr, 4096.0 }, { "predictive_id_count", "SignalProcessor.predictive_id_count", nullptr, @@ -791,7 +793,10 @@ TEST_CASE ("encoded modalities and source cardinalities share bounded work", { "graph_candidate_count", "GraphRetrieve.candidate_count", nullptr, 4096.0 }, { "graph_exact_comparison_count", - "GraphRetrieve.family_exact_comparison_count", nullptr, 131072.0 }, + "GraphRetrieve.family_exact_comparison_count", nullptr, + static_cast ( + cortext::operations::sparse_retrieval_knobs_internal:: + FamilyExactComparisonLimit (0.5, 0.5, 0.5)) }, { "graph_cache_rebuild_count", "GraphRetrieve.cache_rebuild_count", nullptr, 1.0 }, { "graph_rows_visited", "GraphRetrieve.rows_visited", nullptr, 4096.0 }, @@ -840,6 +845,9 @@ TEST_CASE ("encoded modalities and source cardinalities share bounded work", cfg.sensitivity = 0.5; cfg.stability = 0.5; cortext::testing::RequireEncoder (cfg); + const auto active_epoch_limits + = cortext::operations::rif_active_epoch_cache_internal::DeriveLimits ( + cfg.focus, cfg.sensitivity, cfg.stability); const int supersession_candidate_limit = cortext::core::SupersessionCandidateLimit ( cfg.focus, cfg.sensitivity, cfg.stability); @@ -922,13 +930,15 @@ TEST_CASE ("encoded modalities and source cardinalities share bounded work", REQUIRE (output.operation_ms.at ( "SignalProcessor.rif_active_epoch_event_count") - <= 512.0); + <= static_cast (active_epoch_limits.event_count)); REQUIRE (output.operation_ms.at ( "SignalProcessor.rif_active_epoch_mutation_count") - <= 32768.0); + <= static_cast ( + active_epoch_limits.mutation_count)); REQUIRE (output.operation_ms.at ( "SignalProcessor.rif_active_epoch_allocated_bytes") - <= 64.0 * 1024.0 * 1024.0); + <= static_cast ( + active_epoch_limits.allocated_bytes)); for (const auto *operation : kSharedOperations) REQUIRE (output.operation_ms.contains (operation)); @@ -980,7 +990,7 @@ TEST_CASE ("encoded modalities and source cardinalities share bounded work", == 0.0); REQUIRE (reset.operation_ms.at ( "SignalProcessor.rif_active_epoch_allocated_bytes") - < 64.0 * 1024.0 * 1024.0); + < static_cast (active_epoch_limits.allocated_bytes)); const auto after_maintenance = shadow::SnapshotsForTest (); REQUIRE (after_maintenance.size () == 1); REQUIRE (after_maintenance.front ().generation @@ -1484,6 +1494,111 @@ TEST_CASE ("Cortext hydrates sqlite-objstore payloads", } } +TEST_CASE ("Fallback hydration keeps a knob-bounded recent slice across " + "sources and modalities", + "[cortext][objstore][hydration][bounded][aist]") +{ + ScopedTempDb temp_db; + const auto &db_path = temp_db.path (); + auto store = cortext::SQLiteStore::Create (db_path); + cortext::testing::InitializeCoreSchema (*store); + + constexpr double kFocus = 0.5; + constexpr double kSensitivity = 0.5; + constexpr double kStability = 0.5; + const int limit + = cortext::operations::sparse_retrieval_knobs_internal:: + HydrationFallbackSignalLimit (kFocus, kSensitivity, kStability); + REQUIRE (limit == 128); + + struct Surface + { + long long memory_id; + std::string source_id; + std::string modality; + std::string mime; + }; + const std::array surfaces = { + Surface{ 101, "opaque-source-7f", "text", "text/plain" }, + Surface{ 202, "device://opaque/91", "audio", "audio/pcm" }, + Surface{ 303, "urn:opaque:source:ab", "image", "image/png" }, + }; + + for (std::size_t surface_index = 0; surface_index < surfaces.size (); + ++surface_index) + { + const auto &surface = surfaces[surface_index]; + const int row_count = limit + 7; + store->Execute ( + "INSERT INTO memories(memory_id, source_id, kind, start_ts, " + "end_ts, n_signals, modality, created_at) " + "VALUES (?, ?, 'WORKING', ?, NULL, ?, ?, ?)", + { surface.memory_id, surface.source_id, + static_cast (surface_index + 1), + static_cast (row_count), surface.modality, + static_cast (surface_index + 1) }); + + for (int serial = 0; serial < row_count; ++serial) + { + std::vector blob_id (32, 0); + blob_id[0] = static_cast (surface_index + 1); + blob_id[1] = static_cast (serial & 0xff); + blob_id[2] + = static_cast ((serial >> 8) & 0xff); + const std::string marker + = std::to_string (surface.memory_id) + ":" + + std::to_string (serial); + const std::vector payload (marker.begin (), + marker.end ()); + store->Execute ( + "INSERT INTO objstore_data(id, data) VALUES (?, ?)", + { blob_id, payload }); + store->Execute ( + "INSERT INTO signals(memory_id, source_id, embedding_id, " + "blob_id, timestamp, modality, mime, serial_position, " + "created_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)", + { surface.memory_id, surface.source_id, + static_cast (100000 + serial), blob_id, + static_cast (serial), surface.modality, + surface.mime, static_cast (serial), + static_cast (serial) }); + } + } + + cortext::Cortext::Config cfg; + cfg.focus = kFocus; + cfg.sensitivity = kSensitivity; + cfg.stability = kStability; + auto ctx = cortext::Cortext::Create (cfg, db_path); + REQUIRE (ctx != nullptr); + const auto hydrated = ctx->DebugHydrateForTest ({}, {}); + + REQUIRE (hydrated.working_memory.size () == surfaces.size ()); + REQUIRE (hydrated.output.operation_ms.at ( + "Cortext.fallback_hydration_signal_limit") + == 128.0); + REQUIRE (hydrated.output.operation_ms.at ( + "Cortext.fallback_hydration_signal_rows") + == 384.0); + for (std::size_t i = 0; i < surfaces.size (); ++i) + { + const auto &surface = surfaces[i]; + const auto &memory = hydrated.working_memory[i]; + INFO (surface.modality); + REQUIRE (memory.id == surface.memory_id); + REQUIRE (memory.source_id == surface.source_id); + REQUIRE (memory.modality == surface.modality); + REQUIRE (memory.mimetype == surface.mime); + REQUIRE (memory.content.size () == static_cast (limit)); + const std::string first (memory.content.front ().begin (), + memory.content.front ().end ()); + const std::string last (memory.content.back ().begin (), + memory.content.back ().end ()); + REQUIRE (first == std::to_string (surface.memory_id) + ":7"); + REQUIRE (last == std::to_string (surface.memory_id) + ":134"); + } +} + TEST_CASE ("Cortext filters mixed signal blobs to the memory surface", "[cortext][hydration][aist]") { diff --git a/tests/migration_core.test.cpp b/tests/migration_core.test.cpp index d6bfbbac..e0f0c34c 100644 --- a/tests/migration_core.test.cpp +++ b/tests/migration_core.test.cpp @@ -6,9 +6,12 @@ #include #include #include +#include #include +#include #include #include +#include #include #include #include @@ -382,6 +385,155 @@ TEST_CASE("Migration 28 fails atomically on an incompatible partial schema", .empty()); } +TEST_CASE("Migration 29 adds a modality and source agnostic sparse route", + "[schema][migration][retrieval][sqlite]") { + auto store = SQLiteStore::Create(":memory:"); + cortext::store::DebugApplyCoreMigrationsThroughForTest(*store, 28); + REQUIRE(store->Execute( + "SELECT name FROM sqlite_master " + "WHERE name LIKE 'cortext_sparse_route_%'").empty()); + + cortext::store::ApplyMigrations(*store); + + const auto ids = cortext::store::DebugGetAppliedMigrationIdsForTest(*store); + REQUIRE(ids.count(29) == 1); + const auto objects = store->Execute( + "SELECT type, name FROM sqlite_master WHERE name IN (" + "'cortext_sparse_route_meta', 'cortext_sparse_route_nodes', " + "'cortext_sparse_route_build', " + "'cortext_sparse_route_dirty', " + "'idx_sparse_route_nodes_active', " + "'idx_sparse_route_nodes_generation')"); + REQUIRE(objects.size() == 6); + + for (const auto *table : {"cortext_sparse_route_meta", + "cortext_sparse_route_nodes", + "cortext_sparse_route_build", + "cortext_sparse_route_dirty"}) { + const auto columns = store->Execute( + std::string("PRAGMA table_info(") + table + ")"); + REQUIRE_FALSE(columns.empty()); + for (const auto &column : columns) { + const auto name = std::any_cast(column.at("name")); + REQUIRE(name != "modality"); + REQUIRE(name != "source_id"); + } + } +} + +TEST_CASE("Migration 29 fails atomically on an incompatible partial schema", + "[schema][migration][retrieval][sqlite][partial][rollback]") { + auto store = SQLiteStore::Create(":memory:"); + cortext::store::DebugApplyCoreMigrationsThroughForTest(*store, 28); + store->Execute( + "CREATE TABLE cortext_sparse_route_nodes(memory_id INTEGER)"); + + REQUIRE_THROWS(cortext::store::ApplyMigrations(*store)); + const auto ids + = cortext::store::DebugGetAppliedMigrationIdsForTest(*store); + REQUIRE(ids.count(29) == 0); + REQUIRE(store->Execute( + "SELECT name FROM sqlite_master " + "WHERE name = 'cortext_sparse_route_meta'").empty()); + REQUIRE(store->Execute( + "SELECT name FROM sqlite_master " + "WHERE name = 'cortext_sparse_route_build'").empty()); + REQUIRE(store->Execute( + "SELECT name FROM sqlite_master " + "WHERE name = 'cortext_sparse_route_dirty'").empty()); + const auto columns + = store->Execute("PRAGMA table_info(cortext_sparse_route_nodes)"); + REQUIRE(columns.size() == 1); + REQUIRE(std::any_cast(columns[0].at("name")) + == "memory_id"); +} + +TEST_CASE("Migration 30 moves exact signal vectors outside the global route", + "[schema][migration][signals][embedding_population]") { + auto store = SQLiteStore::Create(":memory:"); + cortext::store::DebugApplyCoreMigrationsThroughForTest(*store, 29); + REQUIRE(store->Execute( + "SELECT name FROM sqlite_master " + "WHERE name = 'cortext_active_signal_embeddings'").empty()); + + std::vector legacy_embedding(256, 0.0f); + legacy_embedding[3] = 1.0f; + store->Execute( + "INSERT INTO embeddings(embedding_id, embedding, created_at) " + "VALUES (301, ?, 1000)", {legacy_embedding}); + store->Execute( + "INSERT INTO signals(signal_id, memory_id, source_id, embedding_id, " + "timestamp, modality, created_at) " + "VALUES (401, NULL, 'opaque/legacy', 301, 1000, 'audio', 1000)"); + + cortext::store::ApplyMigrations(*store); + + const auto ids = cortext::store::DebugGetAppliedMigrationIdsForTest(*store); + REQUIRE(ids.count(30) == 1); + const auto columns = store->Execute( + "PRAGMA table_info(cortext_active_signal_embeddings)"); + REQUIRE(columns.size() == 5); + for (const auto &column : columns) { + const auto name = std::any_cast(column.at("name")); + REQUIRE(name != "modality"); + REQUIRE(name != "source_id"); + } + + std::vector inline_embedding(256, 0.0f); + inline_embedding[7] = 1.0f; + store->Execute( + "INSERT INTO signals(signal_id, memory_id, source_id, embedding_id, " + "timestamp, modality, created_at) " + "VALUES (402, NULL, 'opaque/current', 301, 1001, 'image', 1001)"); + store->Execute( + "INSERT INTO cortext_active_signal_embeddings(" + "slot, signal_id, embedding, created_at, capacity) " + "VALUES (17, 402, ?, 1001, 128)", {inline_embedding}); + + const auto rows = store->Execute( + "SELECT signal_id, embedding FROM recent_context ORDER BY signal_id"); + REQUIRE(rows.size() == 2); + std::vector legacy_bytes( + legacy_embedding.size() * sizeof(float)); + std::memcpy(legacy_bytes.data(), legacy_embedding.data(), + legacy_bytes.size()); + std::vector inline_bytes( + inline_embedding.size() * sizeof(float)); + std::memcpy(inline_bytes.data(), inline_embedding.data(), + inline_bytes.size()); + REQUIRE(cortext::store::BlobFromAny(rows[0].at("embedding")) + == legacy_bytes); + REQUIRE(cortext::store::BlobFromAny(rows[1].at("embedding")) + == inline_bytes); +} + +TEST_CASE("Migration 31 persists a knob-bounded activation centroid without " + "modality or source labels", + "[schema][migration][retrieval][sqlite][activation]") { + auto store = SQLiteStore::Create(":memory:"); + cortext::store::DebugApplyCoreMigrationsThroughForTest(*store, 30); + auto before = store->Execute( + "PRAGMA table_info(cortext_sparse_route_meta)"); + REQUIRE(before.size() == 7); + + cortext::store::ApplyMigrations(*store); + + const auto ids = cortext::store::DebugGetAppliedMigrationIdsForTest(*store); + REQUIRE(ids.count(31) == 1); + const auto columns = store->Execute( + "PRAGMA table_info(cortext_sparse_route_meta)"); + REQUIRE(columns.size() == 11); + std::unordered_set names; + for (const auto &column : columns) + names.insert(std::any_cast(column.at("name"))); + REQUIRE(names.count("activation_entry_memory_id") == 1); + REQUIRE(names.count("activation_generation") == 1); + REQUIRE(names.count("activation_centroid") == 1); + REQUIRE(names.count("activation_identity_ids") == 1); + REQUIRE(names.count("modality") == 0); + REQUIRE(names.count("source_id") == 0); +} + TEST_CASE("Migrations preserve 64-bit applied migration ids", "[schema][migration]") { auto store = SQLiteStore::Create(":memory:"); diff --git a/tests/operations_competition.test.cpp b/tests/operations_competition.test.cpp index fe5aea1d..151a8ce4 100644 --- a/tests/operations_competition.test.cpp +++ b/tests/operations_competition.test.cpp @@ -5,6 +5,7 @@ #include "../src/operations/signal_record_rollback_internal.hpp" #include #include +#include #include #include #include @@ -12,6 +13,7 @@ #include #include #include +#include #include #include @@ -29,6 +31,14 @@ namespace constexpr int kEmbeddingDim = 256; +std::size_t +MidpointRifRowBatch () +{ + return cortext::operations::rif_active_epoch_cache_internal::DeriveLimits ( + 0.5, 0.5, 0.5) + .row_batch_size; +} + inline Eigen::VectorXf Norm (Eigen::VectorXf v) { @@ -511,7 +521,7 @@ TEST_CASE ("Lazy RIF clock preserves eager recurrence without active scans", auto tx = store->Begin (); const auto result = cortext::operations::rif_state_internal::AdvanceRecovery ( - *tx, 2000, 10000.0); + *tx, 2000, 10000.0, MidpointRifRowBatch ()); REQUIRE_FALSE (result.generation_reset); REQUIRE (result.expired_rows == 0); tx->Commit (); @@ -536,7 +546,7 @@ TEST_CASE ("Lazy RIF clock preserves eager recurrence without active scans", { auto tx = store->Begin (); cortext::operations::rif_state_internal::AdvanceRecovery ( - *tx, 3000, 10000.0); + *tx, 3000, 10000.0, MidpointRifRowBatch ()); cortext::operations::rif_state_internal::SuppressMemory ( *tx, 1, 0.1, 3000); tx->Commit (); @@ -555,7 +565,7 @@ TEST_CASE ("Lazy RIF clock preserves eager recurrence without active scans", auto tx = store->Begin (); const auto result = cortext::operations::rif_state_internal::AdvanceRecovery ( - *tx, 13000, 10000.0); + *tx, 13000, 10000.0, MidpointRifRowBatch ()); REQUIRE (result.generation_reset); tx->Commit (); } @@ -593,7 +603,7 @@ TEST_CASE ("Lazy RIF recovery work is independent of the active row count", tx = store->Begin (); const auto result = cortext::operations::rif_state_internal::AdvanceRecovery ( - *tx, 1001, 600000.0); + *tx, 1001, 600000.0, MidpointRifRowBatch ()); tx->Commit (); REQUIRE_FALSE (result.generation_reset); REQUIRE (result.expired_rows == 0); @@ -622,7 +632,7 @@ TEST_CASE ("Lazy RIF freezes the exact eager value at the active threshold", auto tx = store->Begin (); auto result = cortext::operations::rif_state_internal::AdvanceRecovery ( - *tx, 2000, 10000.0); + *tx, 2000, 10000.0, MidpointRifRowBatch ()); tx->Commit (); cortext::operations::rif_state_internal::RebuildFromMaterialized (*store); REQUIRE (result.expired_rows == 1); @@ -641,7 +651,7 @@ TEST_CASE ("Lazy RIF freezes the exact eager value at the active threshold", tx = store->Begin (); result = cortext::operations::rif_state_internal::AdvanceRecovery ( - *tx, 3000, 10000.0); + *tx, 3000, 10000.0, MidpointRifRowBatch ()); tx->Commit (); REQUIRE (result.expired_rows == 0); const auto frozen = store->Execute ( @@ -660,8 +670,11 @@ TEST_CASE ("Lazy RIF retires full-recovery generations in bounded batches", { auto store = cortext::SQLiteStore::Create (":memory:"); cortext::testing::InitializeCoreSchema (*store); + const auto row_batch_size = MidpointRifRowBatch (); auto tx = store->Begin (); - for (long long memory_id = 1; memory_id <= 130; ++memory_id) + for (long long memory_id = 1; + memory_id <= static_cast (2 * row_batch_size + 2); + ++memory_id) tx->Execute ( "INSERT INTO memories(memory_id, source_id, kind, start_ts, " "n_signals, modality, strength, suppression, suppression_ts, " @@ -674,23 +687,23 @@ TEST_CASE ("Lazy RIF retires full-recovery generations in bounded batches", tx = store->Begin (); const auto first = cortext::operations::rif_state_internal::AdvanceRecovery ( - *tx, 12000, 10000.0); + *tx, 12000, 10000.0, MidpointRifRowBatch ()); tx->Commit (); REQUIRE (first.generation_reset); - REQUIRE (first.retired_rows == 64); + REQUIRE (first.retired_rows == row_batch_size); tx = store->Begin (); const auto second = cortext::operations::rif_state_internal::AdvanceRecovery ( - *tx, 13000, 10000.0); + *tx, 13000, 10000.0, MidpointRifRowBatch ()); tx->Commit (); REQUIRE_FALSE (second.generation_reset); - REQUIRE (second.retired_rows == 64); + REQUIRE (second.retired_rows == row_batch_size); tx = store->Begin (); const auto third = cortext::operations::rif_state_internal::AdvanceRecovery ( - *tx, 14000, 10000.0); + *tx, 14000, 10000.0, MidpointRifRowBatch ()); tx->Commit (); REQUIRE (third.retired_rows == 2); REQUIRE (store->Execute ("SELECT 1 FROM rif_active_state LIMIT 1").empty ()); @@ -699,7 +712,8 @@ TEST_CASE ("Lazy RIF retires full-recovery generations in bounded batches", const auto values = store->Execute ( "SELECT COUNT(*) AS n FROM memories WHERE strength = 1.0 " "AND suppression = 0.0 AND suppression_ts = 12000"); - REQUIRE (std::any_cast (values[0].at ("n")) == 130); + REQUIRE (std::any_cast (values[0].at ("n")) + == static_cast (2 * row_batch_size + 2)); } TEST_CASE ("Lazy RIF reanchors absolute strength writes", @@ -715,7 +729,7 @@ TEST_CASE ("Lazy RIF reanchors absolute strength writes", cortext::operations::rif_state_internal::RebuildFromMaterialized (*store); auto tx = store->Begin (); cortext::operations::rif_state_internal::AdvanceRecovery ( - *tx, 2000, 10000.0); + *tx, 2000, 10000.0, MidpointRifRowBatch ()); tx->Execute ("UPDATE memories SET strength = 0.2 WHERE memory_id = 1"); cortext::operations::rif_state_internal::RefreshActiveStrengthWhere ( *tx, "memory_id = ?", { 1LL }); @@ -731,7 +745,7 @@ TEST_CASE ("Lazy RIF reanchors absolute strength writes", tx = store->Begin (); cortext::operations::rif_state_internal::AdvanceRecovery ( - *tx, 3000, 10000.0); + *tx, 3000, 10000.0, MidpointRifRowBatch ()); tx->Commit (); effective = store->Execute ( "SELECT strength, suppression FROM rif_effective_memories " @@ -759,27 +773,26 @@ TEST_CASE ("RIF active epoch publishes only after persistent commit and " cortext::operations::rif_state_internal::RebuildFromMaterialized (*store); cache::State epoch; - cache::Ensure (epoch, *store); + cache::Ensure (epoch, *store, cache::DeriveLimits (0.5, 0.5, 0.5)); REQUIRE (epoch.valid); REQUIRE (epoch.active_rows == 1); REQUIRE (epoch.database); auto cached = epoch.database->Execute ( - "SELECT anchor_suppression FROM active_state WHERE memory_id = 1"); + "SELECT memory_id FROM active_state WHERE memory_id = 1"); REQUIRE (cached.size () == 1); - REQUIRE (std::any_cast (cached[0].at ("anchor_suppression")) - == Catch::Approx (0.5)); + REQUIRE (std::any_cast (cached[0].at ("memory_id")) == 1); auto tx = store->Begin (); - const auto recovered = rif::AdvanceRecovery (*tx, 2000, 10000.0); + const auto recovered = rif::AdvanceRecovery ( + *tx, 2000, 10000.0, MidpointRifRowBatch ()); cache::StageClock (epoch, recovered.clock.generation, recovered.clock.log_factor, recovered.clock.last_ts); cache::StageMemories (epoch, recovered.changed_memory_ids); - // The shadow remains at the previously committed value while the durable - // transaction is open. + // The shadow identity ledger remains at its previously committed state + // while the durable transaction is open. cached = epoch.database->Execute ( - "SELECT anchor_suppression FROM active_state WHERE memory_id = 1"); - REQUIRE (std::any_cast (cached[0].at ("anchor_suppression")) - == Catch::Approx (0.5)); + "SELECT memory_id FROM active_state WHERE memory_id = 1"); + REQUIRE (cached.size () == 1); tx->Commit (); cache::SetPublishFailureStageForTest (2); @@ -793,20 +806,185 @@ TEST_CASE ("RIF active epoch publishes only after persistent commit and " "SELECT strength, suppression FROM rif_effective_memories " "WHERE memory_id = 1"); cached = epoch.database->Execute ( - "SELECT anchor_suppression, recovery_total FROM active_state " - "WHERE memory_id = 1"); + "SELECT memory_id FROM active_state WHERE memory_id = 1"); REQUIRE (std::any_cast (effective[0].at ("suppression")) == Catch::Approx (0.45)); - REQUIRE (std::any_cast (cached[0].at ("anchor_suppression")) - == Catch::Approx (0.5)); - REQUIRE (std::any_cast (cached[0].at ("recovery_total")) - == Catch::Approx (1.0)); + REQUIRE (cached.size () == 1); cache::State restarted; - cache::Ensure (restarted, *store); + cache::Ensure (restarted, *store, cache::DeriveLimits (0.5, 0.5, 0.5)); REQUIRE (restarted.active_rows == epoch.active_rows); REQUIRE (restarted.generation == epoch.generation); - REQUIRE (restarted.allocated_bytes <= 64ULL * 1024ULL * 1024ULL); + REQUIRE (restarted.allocated_bytes <= restarted.limits.allocated_bytes); +} + +TEST_CASE ("RIF active epoch row batches follow nine F S T points and " + "preserve a live B plus one mutation", + "[operations][competition][rif_state][active_epoch][knobs]") +{ + namespace cache + = cortext::operations::rif_active_epoch_cache_internal; + struct Point + { + double focus; + double sensitivity; + double stability; + }; + const std::array points { { + { 0.5, 0.5, 0.5 }, + { 0.0, 0.0, 0.0 }, + { 1.0, 1.0, 1.0 }, + { 0.0, 0.5, 0.5 }, + { 1.0, 0.5, 0.5 }, + { 0.5, 0.0, 0.5 }, + { 0.5, 1.0, 0.5 }, + { 0.5, 0.5, 0.0 }, + { 0.5, 0.5, 1.0 }, + } }; + + for (const auto &point : points) + { + auto store = cortext::SQLiteStore::Create (":memory:"); + cortext::testing::InitializeCoreSchema (*store); + const auto limits = cache::DeriveLimits ( + point.focus, point.sensitivity, point.stability); + const auto live_mutation_count = limits.row_batch_size + 1; + auto tx = store->Begin (); + for (std::size_t index = 0; index < live_mutation_count; ++index) + { + const long long memory_id = static_cast (index + 1); + const std::string source_id + = index % 2 == 0 ? "opaque/source-a" : "opaque/source-b"; + const std::string modality + = index % 3 == 0 ? "text" + : index % 3 == 1 ? "audio" + : "image"; + tx->Execute ( + "INSERT INTO memories(memory_id, source_id, kind, start_ts, " + "n_signals, modality, strength, suppression, suppression_ts, " + "created_at) VALUES(?, ?, 'LONG_TERM', 1000, 1, ?, 0.5, " + "0.5, 1000, 1000)", + { memory_id, source_id, modality }); + } + tx->Commit (); + cortext::operations::rif_state_internal::RebuildFromMaterialized ( + *store); + + cache::State epoch; + cache::Ensure (epoch, *store, limits); + epoch.pending_memory_ids.reserve (live_mutation_count); + for (std::size_t index = 0; index < live_mutation_count; ++index) + cache::StageMemory (epoch, static_cast (index + 1)); + const auto publication = cache::PublishAfterPersistentCommit ( + epoch, *store); + REQUIRE (publication.published); + REQUIRE_FALSE (publication.rebuilt); + REQUIRE (publication.changed_rows == live_mutation_count); + REQUIRE (publication.maximum_statement_rows + == limits.row_batch_size); + REQUIRE (epoch.row_batch_high_water == limits.row_batch_size); + REQUIRE (epoch.database->Execute ( + "SELECT memory_id FROM active_state ORDER BY memory_id") + .size () + == live_mutation_count); + } +} + +TEST_CASE ("RIF consolidation starts an empty knob-derived epoch without " + "copying durable active history", + "[operations][competition][rif_state][active_epoch][consolidation]" + "[knobs][regression]") +{ + namespace cache + = cortext::operations::rif_active_epoch_cache_internal; + struct Point + { + double focus; + double sensitivity; + double stability; + }; + const std::array points { { + { 0.5, 0.5, 0.5 }, + { 0.0, 0.0, 0.0 }, + { 1.0, 1.0, 1.0 }, + { 0.0, 0.5, 0.5 }, + { 1.0, 0.5, 0.5 }, + { 0.5, 0.0, 0.5 }, + { 0.5, 1.0, 0.5 }, + { 0.5, 0.5, 0.0 }, + { 0.5, 0.5, 1.0 }, + } }; + + for (const auto &point : points) + { + CAPTURE (point.focus, point.sensitivity, point.stability); + auto store = cortext::SQLiteStore::Create (":memory:"); + cortext::testing::InitializeCoreSchema (*store); + const auto limits = cache::DeriveLimits ( + point.focus, point.sensitivity, point.stability); + const std::size_t durable_history_rows = limits.row_batch_size + 1; + auto transaction = store->Begin (); + for (std::size_t index = 0; index < durable_history_rows; ++index) + { + const long long memory_id = static_cast (index + 1); + const std::string source_id + = index % 2 == 0 ? "opaque/source-a" : "opaque/source-b"; + const std::string modality + = index % 3 == 0 ? "text" + : index % 3 == 1 ? "audio" + : "image"; + transaction->Execute ( + "INSERT INTO memories(memory_id, source_id, kind, start_ts, " + "n_signals, modality, strength, suppression, suppression_ts, " + "created_at) VALUES(?, ?, 'LONG_TERM', 1000, 1, ?, 0.5, " + "0.5, 1000, 1000)", + { memory_id, source_id, modality }); + } + transaction->Commit (); + cortext::operations::rif_state_internal::RebuildFromMaterialized ( + *store); + + cache::State epoch; + cache::Ensure (epoch, *store, limits); + REQUIRE (epoch.active_rows == durable_history_rows); + REQUIRE (epoch.database->Execute ( + "SELECT memory_id FROM active_state ORDER BY memory_id") + .size () + == durable_history_rows); + + cache::StageRebuild (epoch, true); + const auto reset + = cache::PublishAfterPersistentCommit (epoch, *store); + REQUIRE (reset.published); + REQUIRE (reset.rebuilt); + REQUIRE_FALSE (reset.recovered_from_failure); + REQUIRE (reset.changed_rows == 0); + REQUIRE (reset.maximum_statement_rows == 0); + REQUIRE (epoch.active_rows == 0); + REQUIRE (epoch.event_count == 0); + REQUIRE (epoch.mutation_count == 0); + REQUIRE (epoch.row_batch_high_water == 0); + REQUIRE (epoch.database->Execute ( + "SELECT memory_id FROM active_state ORDER BY memory_id") + .empty ()); + REQUIRE (cortext::operations::rif_state_internal::CountRows ( + *store, + "SELECT COUNT(*) AS row_count FROM rif_active_state") + == static_cast (durable_history_rows)); + + cache::StageMemory (epoch, 1); + const auto next_event + = cache::PublishAfterPersistentCommit (epoch, *store); + REQUIRE (next_event.published); + REQUIRE_FALSE (next_event.rebuilt); + REQUIRE (next_event.changed_rows == 1); + REQUIRE (next_event.maximum_statement_rows == 1); + REQUIRE (epoch.active_rows == 1); + REQUIRE (epoch.database->Execute ( + "SELECT memory_id FROM active_state WHERE memory_id = 1") + .size () + == 1); + } } TEST_CASE ("Lazy RIF migration preserves divergent historical timestamps", @@ -825,13 +1003,16 @@ TEST_CASE ("Lazy RIF migration preserves divergent historical timestamps", "SELECT COUNT(*) AS row_count FROM rif_active_state") == 2); cortext::operations::rif_active_epoch_cache_internal::State epoch; cortext::operations::rif_active_epoch_cache_internal::Ensure ( - epoch, *store); + epoch, *store, + cortext::operations::rif_active_epoch_cache_internal::DeriveLimits ( + 0.5, 0.5, 0.5)); REQUIRE (epoch.calibration_memory_ids == std::vector { 1 }); auto tx = store->Begin (); const auto result = cortext::operations::rif_state_internal::AdvanceRecovery ( - *tx, 2000, 10000.0, epoch.calibration_memory_ids); + *tx, 2000, 10000.0, epoch.calibration_memory_ids, + epoch.limits.row_batch_size); tx->Commit (); REQUIRE (result.changed_memory_ids.size () == 1); const auto rows = store->Execute ( @@ -850,7 +1031,7 @@ TEST_CASE ("Lazy RIF migration preserves divergent historical timestamps", tx = store->Begin (); const auto continued = cortext::operations::rif_state_internal::AdvanceRecovery ( - *tx, 3000, 10000.0); + *tx, 3000, 10000.0, MidpointRifRowBatch ()); tx->Commit (); REQUIRE (continued.changed_memory_ids.empty ()); const auto continued_rows = store->Execute ( diff --git a/tests/operations_consolidation.test.cpp b/tests/operations_consolidation.test.cpp index a690d76f..42fe4fbf 100644 --- a/tests/operations_consolidation.test.cpp +++ b/tests/operations_consolidation.test.cpp @@ -1,5 +1,6 @@ // tests/operations_consolidation.test.cpp #include +#include #include #include #include @@ -14,6 +15,7 @@ #include #include #include "../src/operations/consolidation_throughput_state_internal.hpp" +#include "../src/operations/sparse_retrieval_knobs_internal.hpp" #include using namespace cortext; @@ -144,6 +146,9 @@ TEST_CASE ("Consolidation throughput trigger fraction is monotonic in F/S/T", REQUIRE (throughput::DriftRearmFraction (0.5, 0.5, 0.8) > throughput::DriftRearmFraction (0.5, 0.5, 0.2)); REQUIRE (throughput::DriftRearmFraction (0.5, 0.5, 1.0) >= 0.30); + REQUIRE (throughput::MinimumBacklog (0.0, 0.0, 0.0) == 64); + REQUIRE (throughput::MinimumBacklog (0.5, 0.5, 0.5) == 128); + REQUIRE (throughput::MinimumBacklog (1.0, 1.0, 1.0) == 192); } TEST_CASE ("Consolidation throughput observation tracks moving floor and peak", @@ -198,50 +203,61 @@ TEST_CASE ("Consolidation state boundaries are inclusive and required-first", = throughput::TriggerFraction (focus, sensitivity, stability); const double required = throughput::RequiredTriggerFraction (focus, sensitivity, stability); + const long long backlog + = throughput::MinimumBacklog (focus, sensitivity, stability); REQUIRE (throughput::Classify ( - state, std::nextafter (recommended, 1.0), 1, + state, required, backlog - 1, focus, sensitivity, stability) + == ConsolidationState::None); + + REQUIRE (throughput::Classify ( + state, std::nextafter (recommended, 1.0), backlog, focus, sensitivity, stability) == ConsolidationState::None); REQUIRE (throughput::Classify ( - state, recommended, 1, focus, sensitivity, stability) + state, recommended, backlog, focus, sensitivity, stability) == ConsolidationState::Recommended); REQUIRE (throughput::Classify ( - state, std::nextafter (required, 1.0), 1, + state, std::nextafter (required, 1.0), backlog, focus, sensitivity, stability) == ConsolidationState::Recommended); REQUIRE (throughput::Classify ( - state, required, 1, focus, sensitivity, stability) + state, required, backlog, focus, sensitivity, stability) == ConsolidationState::Required); } TEST_CASE ("Consolidation state follows the ordered throughput drawdown", "[operations][consolidation][hint]") { + namespace throughput + = operations::consolidation_throughput_state_internal; SignalProcessor::Config cfg; cortext::testing::RequireEncoder (cfg); cfg.focus = 0.5; cfg.sensitivity = 0.5; cfg.stability = 0.5; + const int backlog = static_cast ( + throughput::MinimumBacklog ( + cfg.focus, cfg.sensitivity, cfg.stability)); SECTION ("bootstrap has no range") { const auto output = RunConsolidationHint ( - cfg, { 4.0, 4.0, 4.0, 3 }); + cfg, { 4.0, 4.0, 4.0, backlog }); REQUIRE (output.consolidation_state == ConsolidationState::None); } SECTION ("rate above recommendation boundary is none") { const auto output = RunConsolidationHint ( - cfg, { 2.0, 10.0, 7.0, 3 }); + cfg, { 2.0, 10.0, 7.0, backlog }); REQUIRE (output.consolidation_state == ConsolidationState::None); } SECTION ("drawdown enters recommended band") { const auto output = RunConsolidationHint ( - cfg, { 2.0, 10.0, 5.0, 3 }); + cfg, { 2.0, 10.0, 5.0, backlog }); REQUIRE (output.consolidation_state == ConsolidationState::Recommended); } @@ -249,7 +265,7 @@ TEST_CASE ("Consolidation state follows the ordered throughput drawdown", SECTION ("deeper drawdown enters required band") { const auto output = RunConsolidationHint ( - cfg, { 2.0, 10.0, 3.0, 3 }); + cfg, { 2.0, 10.0, 3.0, backlog }); REQUIRE (output.consolidation_state == ConsolidationState::Required); } @@ -270,7 +286,7 @@ TEST_CASE ("Consolidation state follows the ordered throughput drawdown", SECTION ("explicit consolidation input emits none") { const auto output = RunConsolidationHint ( - cfg, { 2.0, 10.0, 2.0, 3 }, "test/source", "text", true); + cfg, { 2.0, 10.0, 2.0, backlog }, "test/source", "text", true); REQUIRE (output.consolidation_state == ConsolidationState::None); } } @@ -283,17 +299,19 @@ TEST_CASE ("Consolidation recommendation rearms after a lower throughput regime" constexpr double focus = 0.5; constexpr double sensitivity = 0.5; constexpr double stability = 0.5; + const long long backlog + = throughput::MinimumBacklog (focus, sensitivity, stability); ProcessorContext pctx; throughput::Reset (pctx, { 2.0, 100.0, true, true }); - REQUIRE (throughput::Classify (throughput::Find (pctx), 3.0, 4, focus, + REQUIRE (throughput::Classify (throughput::Find (pctx), 3.0, backlog, focus, sensitivity, stability) != ConsolidationState::None); throughput::Acknowledge (pctx, 3.0); REQUIRE_FALSE (throughput::Find (pctx).armed); REQUIRE (throughput::Find (pctx).floor == 3.0); REQUIRE (throughput::Find (pctx).peak == 3.0); - REQUIRE (throughput::Classify (throughput::Find (pctx), 3.0, 4, focus, + REQUIRE (throughput::Classify (throughput::Find (pctx), 3.0, backlog, focus, sensitivity, stability) == ConsolidationState::None); @@ -301,8 +319,9 @@ TEST_CASE ("Consolidation recommendation rearms after a lower throughput regime" // new event-derived range and rearms the classifier. throughput::Observe (pctx, 20.0, focus, sensitivity, stability); REQUIRE (throughput::Find (pctx).armed); - throughput::Observe (pctx, 3.0, focus, sensitivity, stability); - REQUIRE (throughput::Classify (throughput::Find (pctx), 3.0, 4, focus, + for (long long observation = 1; observation < backlog; ++observation) + throughput::Observe (pctx, 3.0, focus, sensitivity, stability); + REQUIRE (throughput::Classify (throughput::Find (pctx), 3.0, backlog, focus, sensitivity, stability) != ConsolidationState::None); @@ -310,8 +329,9 @@ TEST_CASE ("Consolidation recommendation rearms after a lower throughput regime" throughput::Acknowledge (pctx, 3.0); throughput::Observe (pctx, 12.0, focus, sensitivity, stability); REQUIRE (throughput::Find (pctx).armed); - throughput::Observe (pctx, 3.0, focus, sensitivity, stability); - REQUIRE (throughput::Classify (throughput::Find (pctx), 3.0, 4, focus, + for (long long observation = 1; observation < backlog; ++observation) + throughput::Observe (pctx, 3.0, focus, sensitivity, stability); + REQUIRE (throughput::Classify (throughput::Find (pctx), 3.0, backlog, focus, sensitivity, stability) != ConsolidationState::None); throughput::Erase (pctx); @@ -331,9 +351,12 @@ TEST_CASE ("Sustained throughput drift rearms consolidation after acknowledgment for (const double stability : knob_values) { CAPTURE (focus, sensitivity, stability); + const long long backlog + = throughput::MinimumBacklog ( + focus, sensitivity, stability); throughput::Reset (pctx, { 20.0, 100.0, true, true }); REQUIRE (throughput::Classify (throughput::Find (pctx), 20.0, - 1, focus, sensitivity, stability) + backlog, focus, sensitivity, stability) != ConsolidationState::None); throughput::Acknowledge (pctx, 100.0); @@ -343,7 +366,8 @@ TEST_CASE ("Sustained throughput drift rearms consolidation after acknowledgment throughput::Observe (pctx, static_cast (rate), focus, sensitivity, stability); later_hint = throughput::Classify ( - throughput::Find (pctx), static_cast (rate), 1, + throughput::Find (pctx), static_cast (rate), + backlog, focus, sensitivity, stability); if (later_hint != ConsolidationState::None) { @@ -351,6 +375,17 @@ TEST_CASE ("Sustained throughput drift rearms consolidation after acknowledgment } } + while (later_hint == ConsolidationState::None + && throughput::Find (pctx).observations_since_ack + < backlog) + { + throughput::Observe (pctx, 0.0, focus, sensitivity, + stability); + later_hint = throughput::Classify ( + throughput::Find (pctx), 0.0, backlog, focus, + sensitivity, stability); + } + REQUIRE (later_hint != ConsolidationState::None); } } @@ -374,14 +409,24 @@ TEST_CASE ("Stable noisy throughput stays disarmed after acknowledgment", for (const double stability : knob_values) { CAPTURE (focus, sensitivity, stability); + const long long backlog + = throughput::MinimumBacklog ( + focus, sensitivity, stability); throughput::Reset (pctx, { 20.0, 100.0, true, true }); throughput::Acknowledge (pctx, 100.0); - for (const double rate : ordinary_noise) + for (long long observation = 0; + observation < backlog + + static_cast ( + std::size (ordinary_noise)); + ++observation) { + const double rate = ordinary_noise[ + static_cast (observation) + % std::size (ordinary_noise)]; throughput::Observe (pctx, rate, focus, sensitivity, stability); REQUIRE (throughput::Classify ( - throughput::Find (pctx), rate, 1, focus, + throughput::Find (pctx), rate, backlog, focus, sensitivity, stability) == ConsolidationState::None); } @@ -407,7 +452,12 @@ TEST_CASE ("Consolidation throughput hint ignores source and modality", { SignalProcessor::Config cfg; cortext::testing::RequireEncoder (cfg); - const SetupConsolidationHintOp setup { 2.0, 10.0, 5.0, 3 }; + const SetupConsolidationHintOp setup { + 2.0, 10.0, 5.0, + static_cast ( + operations::consolidation_throughput_state_internal::MinimumBacklog ( + cfg.focus, cfg.sensitivity, cfg.stability)) + }; const auto text = RunConsolidationHint ( cfg, setup, "one/source", "text"); const auto image = RunConsolidationHint ( @@ -677,6 +727,133 @@ TEST_CASE ("ScoreConsolidation identifies low-strength candidates", REQUIRE (std::any_cast (connectivity_rows[0].at ("c")) == 0); } +TEST_CASE ("ScoreConsolidation bounds its active candidate frontier from " + "F S T knobs", + "[operations][consolidation][bounded][knobs][regression]") +{ + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + cortext::store::ApplyMigrations (*store); + + SignalProcessor::Config cfg; + cortext::testing::RequireEncoder (cfg); + cfg.focus = 0.0; + cfg.sensitivity = 0.0; + cfg.stability = 0.0; + const auto candidate_limit = static_cast ( + operations::sparse_retrieval_knobs_internal:: + ActivationIdentityTarget ( + cfg.focus, cfg.sensitivity, cfg.stability)); + REQUIRE (candidate_limit == 640); + + Signal signal; + signal.timestamp = 50'000ULL; + signal.source_id = "opaque/consolidation"; + signal.modality = "audio"; + signal.force_consolidation = true; + signal.embedding = Eigen::VectorXf::Zero (4); + ProcessorContext p_ctx; + OperationContext ctx (signal, p_ctx, cfg, store.get ()); + + for (std::size_t index = 0; index <= candidate_limit; ++index) + { + const long long id = static_cast (index + 1); + std::vector embedding (256, 0.0f); + embedding[index % embedding.size ()] = 1.0f; + store->Execute ( + "INSERT INTO embeddings(embedding_id, embedding, created_at) " + "VALUES(?, ?, ?)", + { id, embedding, id }); + store->Execute ( + "INSERT INTO memories(memory_id, embedding_id, source_id, kind, " + "start_ts, n_signals, modality, strength, stability, redundancy, " + "created_at) VALUES(?, ?, ?, 'LONG_TERM', ?, 1, ?, 0.0, 0.0, " + "0.0, ?)", + { id, id, "opaque/" + std::to_string (index % 5), id, + index % 2 == 0 ? "audio" : "image", id }); + } + + ScoreConsolidation scorer; + auto tx = store->Begin (); + scorer.Execute (ctx, *tx); + + const auto &candidates = ctx.GetConsolidationCandidates (); + REQUIRE (candidates.size () == candidate_limit); + REQUIRE (candidates.front ().memory_id == 1); + REQUIRE (candidates.back ().memory_id + == static_cast (candidate_limit)); + REQUIRE (ctx.GetOperationTimings ().at ( + "ScoreConsolidation.candidate_input_limit") + == static_cast (candidate_limit)); + REQUIRE (ctx.GetOperationTimings ().at ( + "ScoreConsolidation.candidate_input_count") + == static_cast (candidate_limit)); +} + +TEST_CASE ("ScoreConsolidation emits its full F S T derived work envelope", + "[operations][consolidation][bounded][knobs][ablation]") +{ + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + cortext::store::ApplyMigrations (*store); + std::vector embedding (256, 0.0f); + embedding[0] = 1.0f; + store->Execute ( + "INSERT INTO embeddings(embedding_id, embedding, created_at) " + "VALUES(1, ?, 1)", + { embedding }); + store->Execute ( + "INSERT INTO memories(memory_id, embedding_id, source_id, kind, " + "start_ts, n_signals, modality, strength, stability, redundancy, " + "created_at) VALUES(1, 1, 'opaque/history', 'LONG_TERM', 1, 1, " + "'image', 0.0, 0.0, 0.0, 1)", + {}); + + constexpr std::array kValues { 0.0, 0.5, 1.0 }; + std::size_t ablation_points = 0; + for (const double focus : kValues) + for (const double sensitivity : kValues) + for (const double stability : kValues) + { + SignalProcessor::Config cfg; + cortext::testing::RequireEncoder (cfg); + cfg.focus = focus; + cfg.sensitivity = sensitivity; + cfg.stability = stability; + Signal signal; + signal.timestamp = 60'000ULL + ablation_points; + signal.source_id + = "opaque/" + std::to_string (ablation_points % 4); + signal.modality + = std::array { "text", "audio", "image" } + [ablation_points % 3]; + signal.force_consolidation = true; + signal.embedding = Eigen::VectorXf::Zero (4); + ProcessorContext p_ctx; + OperationContext ctx (signal, p_ctx, cfg, store.get ()); + auto tx = store->Begin (); + ScoreConsolidation{}.Execute (ctx, *tx); + + const double expected_candidates = static_cast ( + operations::sparse_retrieval_knobs_internal:: + ActivationIdentityTarget ( + focus, sensitivity, stability)); + const double expected_edges = static_cast ( + operations::sparse_retrieval_knobs_internal:: + GraphNeighborCount ( + focus, sensitivity, stability)); + REQUIRE (ctx.GetOperationTimings ().at ( + "ScoreConsolidation.candidate_input_limit") + == expected_candidates); + REQUIRE (ctx.GetOperationTimings ().at ( + "ScoreConsolidation.association_edge_limit") + == expected_edges); + REQUIRE (ctx.GetOperationTimings ().at ( + "ScoreConsolidation.candidate_input_count") + == 1.0); + ++ablation_points; + } + REQUIRE (ablation_points == 27); +} + TEST_CASE ("ScoreConsolidation forced mode preserves eligibility threshold", "[operations][consolidation]") { diff --git a/tests/operations_emotion_cascade.test.cpp b/tests/operations_emotion_cascade.test.cpp index a6b4373a..ae5be02a 100644 --- a/tests/operations_emotion_cascade.test.cpp +++ b/tests/operations_emotion_cascade.test.cpp @@ -2,11 +2,16 @@ #include "test_helpers.hpp" #include "../src/operations/association_fanout_cache_internal.hpp" #include "../src/operations/emotional_metadata_cache_internal.hpp" +#include "../src/operations/sparse_retrieval_knobs_internal.hpp" +#include "../src/operations/signal_record_rollback_internal.hpp" +#include #include #include #include #include +#include #include +#include #include #include @@ -143,6 +148,52 @@ class RawEmotionalMutationThenCascade final : public IOperation mutable int call_count_ = 0; }; +class CascadeThenFailOnce final : public IOperation +{ +public: + void + Execute (OperationContext &context, Transaction &tx) const override + { + PropagateEmotionalCascade cascade; + cascade.Execute (context, tx); + if (fail_once_) + { + fail_once_ = false; + throw std::runtime_error ("forced cascade rollback"); + } + } + +private: + mutable bool fail_once_ = true; +}; + +class ScopedTempDatabase +{ +public: + ScopedTempDatabase () + : path_ (cortext::testing::UniqueTempPath ( + "cortext_emotional_cascade_", ".db")) + { + } + + ~ScopedTempDatabase () + { + std::error_code error; + std::filesystem::remove (path_, error); + std::filesystem::remove (path_.string () + "-wal", error); + std::filesystem::remove (path_.string () + "-shm", error); + } + + const std::filesystem::path & + Path () const + { + return path_; + } + +private: + std::filesystem::path path_; +}; + static double RunCustomRawEmotionalMutation (bool cascade_on_next_call, bool use_store = false) @@ -167,13 +218,15 @@ RunCustomRawEmotionalMutation (bool cascade_on_next_call, } static std::unordered_map -ExecuteCascade (const std::shared_ptr &store, bool commit = true) +ExecuteCascade (const std::shared_ptr &store, bool commit = true, + double focus = 0.5, double sensitivity = 0.5, + double stability = 0.5) { SignalProcessor::Config cfg; cortext::testing::RequireEncoder (cfg); - cfg.focus = 0.5; - cfg.sensitivity = 0.5; - cfg.stability = 0.5; + cfg.focus = focus; + cfg.sensitivity = sensitivity; + cfg.stability = stability; ProcessorContext processor_context; ScopedExecutionCacheSidecar sidecar_scope (processor_context); const Signal signal = MakeSignal (1'000'000); @@ -225,6 +278,7 @@ TEST_CASE ("EmotionCascadeParams derives from knobs correctly", REQUIRE (params2.cascade_decay == Catch::Approx (0.3).margin (1e-6)); // lerp(0.7, 0.3, 1) } + TEST_CASE ("Emotional metadata cache preserves shared embedding minima", "[operations][emotion_cascade][metadata_cache][shared_embedding]") { @@ -281,6 +335,28 @@ TEST_CASE ("Emotional metadata cache preserves shared embedding minima", == std::vector{ 20 }); } +TEST_CASE ("Emotional source index retains only its newest bounded prefix", + "[operations][emotion_cascade][metadata_cache][bounds]") +{ + ProcessorContext processor_context; + ScopedExecutionCacheSidecar sidecar_scope (processor_context); + std::vector + rows; + for (long long memory_id = 1; memory_id <= 5; ++memory_id) + rows.push_back ( + { memory_id, memory_id, memory_id, true, 0.8, 0.9, 2.0, 1, + 0.5 }); + operations::emotional_metadata_cache_internal::Reset ( + processor_context, std::move (rows), 3); + const auto state + = operations::emotional_metadata_cache_internal::FindState ( + processor_context); + REQUIRE (state); + REQUIRE (state->emotional_metadata.source_query_order + == std::vector{ 5, 4, 3 }); +} + TEST_CASE ("CascadeRadius and CascadeDecay knob values", "[operations][emotion_cascade][knobs]") { @@ -748,6 +824,8 @@ TEST_CASE ("PropagateEmotionalCascade batches more than 64 sources exactly", { cortext::testing::ScopedEnvVar profile ( "CORTEXT_PROFILE_EMOTIONAL_CASCADE", "1"); + cortext::testing::ScopedEnvVar collapse ( + "CORTEXT_EXPERIMENT_EMOTIONAL_WINNER_COLLAPSE", "1"); auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); cortext::testing::InitializeCoreSchema (*store); constexpr long long kTargetMemoryId = 1000; @@ -762,8 +840,179 @@ TEST_CASE ("PropagateEmotionalCascade batches more than 64 sources exactly", const auto timings = ExecuteCascade (store); REQUIRE (timings.at ("EmotionalCascade.source_count") == 70.0); - REQUIRE (timings.at ("EmotionalCascade.neighbor_count") == 70.0); + // The shared bit-mask traversal may observe the target from every source, + // but first-source-wins means only one winning source/target pair should be + // materialized and executed. + REQUIRE (timings.at ("EmotionalCascade.neighbor_count") == 1.0); + REQUIRE (timings.at ("EmotionalCascade.neighbor_execution_count") == 1.0); + REQUIRE (timings.at ("EmotionalCascade.reachable_pair_count") == 70.0); + REQUIRE (timings.at ("EmotionalCascade.edge_visit_count") == 70.0); REQUIRE (timings.at ("EmotionalCascade.update_count") == 1.0); REQUIRE (MemoryIntensity (*store, kTargetMemoryId) == Catch::Approx (0.45).margin (1e-9)); } + +TEST_CASE ("PropagateEmotionalCascade edge experiment uses the knob-derived " + "physical ceiling", + "[operations][emotion_cascade][bounds][edge_visit]") +{ + cortext::testing::ScopedEnvVar profile ( + "CORTEXT_PROFILE_EMOTIONAL_CASCADE", "1"); + cortext::testing::ScopedEnvVar collapse ( + "CORTEXT_EXPERIMENT_EMOTIONAL_WINNER_COLLAPSE", "1"); + cortext::testing::ScopedEnvVar edge_limit ( + "CORTEXT_EXPERIMENT_EMOTIONAL_EDGE_LIMIT", "1"); + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + cortext::testing::InitializeCoreSchema (*store); + constexpr double kFocus = 0.0; + constexpr double kSensitivity = 0.0; + constexpr double kStability = 0.0; + const long long limit = operations::sparse_retrieval_knobs_internal:: + PublicQueryNodeBudget (kFocus, kSensitivity, kStability); + REQUIRE (limit == 1280); + SeedCascadeMemory (*store, 1, 1); + SetCascadeSource (*store, 1, 0.9, 1, 0.9); + for (long long target = 2; target <= limit + 8; ++target) + { + SeedCascadeMemory (*store, target, target); + AddCascadeEdge (*store, 1, target); + } + + const auto timings = ExecuteCascade ( + store, true, kFocus, kSensitivity, kStability); + REQUIRE (timings.at ("EmotionalCascade.edge_visit_limit") == limit); + REQUIRE (timings.at ("EmotionalCascade.edge_visit_count") == limit); + REQUIRE (timings.at ("EmotionalCascade.edge_visit_limit_reached") == 1.0); + REQUIRE (timings.at ("EmotionalCascade.neighbor_count") <= limit); +} + +TEST_CASE ("PropagateEmotionalCascade bounds source inspection and execution " + "from the same knobs", + "[operations][emotion_cascade][bounds][source]") +{ + cortext::testing::ScopedEnvVar profile ( + "CORTEXT_PROFILE_EMOTIONAL_CASCADE", "1"); + cortext::testing::ScopedEnvVar collapse ( + "CORTEXT_EXPERIMENT_EMOTIONAL_WINNER_COLLAPSE", "1"); + cortext::testing::ScopedEnvVar edge_limit ( + "CORTEXT_EXPERIMENT_EMOTIONAL_EDGE_LIMIT", "1"); + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + cortext::testing::InitializeCoreSchema (*store); + constexpr double kFocus = 0.0; + constexpr double kSensitivity = 0.0; + constexpr double kStability = 0.0; + const long long inspection_limit + = operations::sparse_retrieval_knobs_internal::PublicQueryNodeBudget ( + kFocus, kSensitivity, kStability); + const long long execution_limit + = operations::sparse_retrieval_knobs_internal::BackfillBatchSize ( + kFocus, kSensitivity, kStability); + REQUIRE (inspection_limit == 1280); + REQUIRE (execution_limit == 64); + for (long long source = 1; source <= inspection_limit + 8; ++source) + { + SeedCascadeMemory (*store, source, source); + SetCascadeSource (*store, source, 0.9, 1, 0.5); + } + + const auto timings = ExecuteCascade ( + store, true, kFocus, kSensitivity, kStability); + REQUIRE (timings.at ("EmotionalCascade.source_inspection_limit") + == inspection_limit); + REQUIRE (timings.at ("EmotionalCascade.source_inspection_count") + == inspection_limit); + REQUIRE (timings.at ("EmotionalCascade.source_execution_count") + == inspection_limit); + REQUIRE (timings.at ("EmotionalCascade.source_limit") + == execution_limit); + REQUIRE (timings.at ("EmotionalCascade.source_count") == execution_limit); + REQUIRE (timings.at ("EmotionalCascade.source_limit_reached") == 1.0); +} + +TEST_CASE ("PropagateEmotionalCascade caps writes at a knob-derived identity " + "envelope", + "[operations][emotion_cascade][bounds][knobs]") +{ + cortext::testing::ScopedEnvVar profile ( + "CORTEXT_PROFILE_EMOTIONAL_CASCADE", "1"); + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + cortext::testing::InitializeCoreSchema (*store); + constexpr double kFocus = 0.0; + constexpr double kSensitivity = 0.0; + constexpr double kStability = 0.0; + const int update_limit + = operations::sparse_retrieval_knobs_internal:: + ActivationIdentityTarget (kFocus, kSensitivity, kStability); + REQUIRE (update_limit == 640); + + SeedCascadeMemory (*store, 1, 1); + SetCascadeSource (*store, 1, 0.9, 1, 0.9); + for (long long target = 2; target <= update_limit + 3; ++target) + SeedCascadeMemory (*store, target, target); + AddCascadeEdge (*store, 1, 2); + + SignalProcessor::Config cfg; + cortext::testing::RequireEncoder (cfg); + cfg.focus = kFocus; + cfg.sensitivity = kSensitivity; + cfg.stability = kStability; + ProcessorContext processor_context; + ScopedExecutionCacheSidecar sidecar_scope (processor_context); + std::vector + metadata; + metadata.reserve (static_cast (update_limit + 3)); + metadata.push_back ( + { 1, 1, 1'000'000, true, 0.9, 0.9, 2.0, 1, 0.9 }); + for (long long target = 2; target <= update_limit + 3; ++target) + metadata.push_back ( + { target, target, 1'000'000, false, 0.0, 0.0, 0.0, 0, 0.0 }); + operations::emotional_metadata_cache_internal::Reset ( + processor_context, std::move (metadata)); + auto execute = [&] (uint64_t timestamp) { + const Signal signal = MakeSignal (timestamp); + OperationContext context (signal, processor_context, cfg, store.get ()); + auto transaction = store->Begin (); + PropagateEmotionalCascade operation; + operation.Execute (context, *transaction); + transaction->Commit (); + return context.GetOperationTimings (); + }; + + // Establish a real fixed point before the reachable topology expands. + const auto initial = execute (1'000'000); + REQUIRE (initial.at ("EmotionalCascade.update_count") == 1.0); + REQUIRE (initial.at ("EmotionalCascade.update_limit_reached") == 0.0); + + for (long long target = 3; target <= update_limit + 3; ++target) + { + AddCascadeEdge (*store, 1, target); + operations::association_fanout_cache::UpsertAssociation ( + processor_context, processor_context.association_fanout_cache, + 1, target, 1, target, "co_occurs", 1.0, 1'000'001); + } + + const auto timings = execute (1'000'001); + REQUIRE (timings.at ("EmotionalCascade.update_limit") == update_limit); + REQUIRE (timings.at ("EmotionalCascade.update_count") == update_limit); + REQUIRE (timings.at ("EmotionalCascade.update_limit_reached") == 1.0); + const auto changed = store->Execute ( + "SELECT COUNT(*) AS n FROM memories " + "WHERE memory_id >= 2 AND emotional_intensity > 0.0"); + REQUIRE (changed.size () == 1); + REQUIRE (store::AnyToLongLong (changed[0].at ("n")) + == update_limit + 1); + + // A saturated pass is an incomplete prefix, not a fixed point. Reusing the + // same ProcessorContext must revisit the unresolved tail on the next event. + const auto resumed = execute (1'000'002); + REQUIRE (resumed.at ("EmotionalCascade.source_count") == 1.0); + REQUIRE (resumed.at ("EmotionalCascade.update_limit_reached") == 0.0); + REQUIRE (resumed.at ("EmotionalCascade.update_count") == 1.0); + const auto all_changed = store->Execute ( + "SELECT COUNT(*) AS n FROM memories " + "WHERE memory_id >= 2 AND emotional_intensity > 0.0"); + REQUIRE (all_changed.size () == 1); + REQUIRE (store::AnyToLongLong (all_changed[0].at ("n")) + == update_limit + 2); +} diff --git a/tests/operations_graph_retrieval.test.cpp b/tests/operations_graph_retrieval.test.cpp index e8147296..2e603b87 100644 --- a/tests/operations_graph_retrieval.test.cpp +++ b/tests/operations_graph_retrieval.test.cpp @@ -3,6 +3,8 @@ #include "../src/operations/constructive_recall_internal.hpp" #include "../src/operations/historical_surface_search_cache_internal.hpp" #include "../src/operations/retrieval_trace_state.hpp" +#include "../src/operations/sparse_retrieval_route_internal.hpp" +#include "../src/operations/sparse_retrieval_route_sqlite_internal.hpp" #include #include @@ -32,6 +34,32 @@ using namespace cortext; using cortext::operations::GraphAugmentedRetrieveCandidates; +TEST_CASE ("retrieval surface mutation capture is explicit and ordered", + "[graph-retrieval][trace]") +{ + using namespace cortext::operations::retrieval_trace; + SetSurfaceMutationCaptureEnabled (false); + RecordSurfaceUpsert (1, 2, { 1.0f, 0.0f }); + REQUIRE (GetSurfaceMutations ().empty ()); + + SetSurfaceMutationCaptureEnabled (true); + ClearSurfaceMutations (); + RecordSurfaceUpsert (7, 11, { 0.25f, 0.75f }); + RecordSurfaceRemove (7); + const auto &mutations = GetSurfaceMutations (); + REQUIRE (mutations.size () == 2); + CHECK (mutations[0].action == SurfaceMutation::Action::Upsert); + CHECK (mutations[0].memory_id == 7); + CHECK (mutations[0].embedding_id == 11); + CHECK ((mutations[0].embedding + == std::vector{ 0.25f, 0.75f })); + CHECK (mutations[1].action == SurfaceMutation::Action::Remove); + CHECK (mutations[1].memory_id == 7); + + SetSurfaceMutationCaptureEnabled (false); + REQUIRE (GetSurfaceMutations ().empty ()); +} + namespace { constexpr int kEmbeddingDim = 256; @@ -44,6 +72,587 @@ UnitVec (int dim) return v; } +TEST_CASE ("Sparse retrieval route is deterministic across upsert and remove", + "[operations][graph][retrieval][hnsw]") +{ + using operations::sparse_retrieval_route_internal::Route; + const std::vector> entries { + { 10, UnitVec (0) }, { 20, UnitVec (1) }, { 30, UnitVec (2) } + }; + const auto parameters + = operations::sparse_retrieval_route_internal::DefaultParameters (); + auto first = Route::Create (kEmbeddingDim, entries, parameters); + auto second = Route::Create (kEmbeddingDim, entries, parameters); + REQUIRE (first != nullptr); + REQUIRE (second != nullptr); + REQUIRE (first->DeltaSize () == 0); + REQUIRE (first->Search (UnitVec (0), 2) + == second->Search (UnitVec (0), 2)); + REQUIRE (first->Search (UnitVec (0), 2)->front () == 10); + + REQUIRE (first->Upsert (10, UnitVec (3))); + REQUIRE (first->DeltaSize () == 1); + REQUIRE (first->Search (UnitVec (3), 3)->front () == 10); + REQUIRE (first->Sync ( + { { 10, UnitVec (0) }, { 20, UnitVec (1) }, { 30, UnitVec (2) } })); + REQUIRE (first->DeltaSize () == 0); + REQUIRE (first->Remove (10)); + REQUIRE (first->DeltaSize () == 1); + const auto after_remove = first->Search (UnitVec (3), 3); + REQUIRE (after_remove.has_value ()); + REQUIRE (std::find (after_remove->begin (), after_remove->end (), 10) + == after_remove->end ()); + REQUIRE (first->Size () == 2); + REQUIRE (first->SealDelta ()); + REQUIRE (first->DeltaSize () == 0); + REQUIRE (first->Size () == 2); + REQUIRE (first->Search (UnitVec (0), 3)->front () != 10); + REQUIRE (first->Upsert (10, UnitVec (0))); + REQUIRE (first->SealDelta ()); + REQUIRE (first->DeltaSize () == 0); + REQUIRE (first->Size () == 3); + REQUIRE (first->Search (UnitVec (0), 3)->front () == 10); +} + +TEST_CASE ("SQLite sparse route restart and query work stay row bounded", + "[operations][graph][retrieval][hnsw][sqlite]") +{ + using HnswRoute + = operations::sparse_retrieval_route_internal::Route; + using SQLiteRoute + = operations::sparse_retrieval_route_sqlite_internal::Route; + const auto parameters = operations::sparse_retrieval_route_sqlite_internal:: + DefaultParameters (); + auto unique_store = SQLiteStore::Create (":memory:"); + auto store = std::shared_ptr (std::move (unique_store)); + cortext::testing::InitializeCoreSchema (*store); + + std::vector> entries; + for (long long index = 0; index < 600; ++index) + entries.emplace_back (index + 1, + UnitVec (static_cast ( + index % kEmbeddingDim))); + auto hnsw = HnswRoute::Create ( + kEmbeddingDim, entries, + operations::sparse_retrieval_route_internal::DefaultParameters ()); + REQUIRE (hnsw != nullptr); + auto route = SQLiteRoute::Create ( + *store, kEmbeddingDim, entries, *hnsw, parameters); + REQUIRE (route != nullptr); + REQUIRE (route->RestartRowsLoaded () == 1); + REQUIRE (route->ActivationSearchEffort () == parameters.search_ef); + REQUIRE (route->ActivationSearchNodeBudget () + == parameters.search_node_budget); + + const auto initial = route->Search (UnitVec (0), 32); + REQUIRE (initial.has_value ()); + REQUIRE_FALSE (initial->empty ()); + REQUIRE (initial->front () == 1); + REQUIRE (route->LastSearchNodeRows () == entries.size ()); + REQUIRE (route->LastSearchNodeRows () <= parameters.search_node_budget); + REQUIRE (route->CachedNodeRows () <= parameters.shadow_node_capacity); + REQUIRE (route->CacheOrderRows () <= parameters.shadow_node_capacity); + + REQUIRE (route->ActivationEntryMemoryId () == 0); + const auto recenter_target + = route->Search (UnitVec (5), parameters.route_capacity); + REQUIRE (recenter_target); + REQUIRE_FALSE (recenter_target->empty ()); + REQUIRE (route->Recenter (UnitVec (5))); + REQUIRE (route->ActivationEntryMemoryId () == recenter_target->front ()); + REQUIRE (route->ActivationSearchEffort () + == parameters.activation_search_ef_min); + REQUIRE (route->ActivationSearchNodeBudget () + == parameters.activation_search_node_budget_min); + REQUIRE (route->Search (UnitVec (5), 32)); + REQUIRE (route->ActivationSearchEffort () + == std::min (parameters.search_ef, + parameters.activation_search_ef_min + + parameters.activation_search_ef_step)); + REQUIRE ( + route->ActivationSearchNodeBudget () + == std::min (parameters.search_node_budget, + parameters.activation_search_node_budget_min + + parameters.activation_search_node_budget_step)); + const auto effort_before_failed_recenter + = route->ActivationSearchEffort (); + const auto budget_before_failed_recenter + = route->ActivationSearchNodeBudget (); + store->Execute ( + "CREATE TRIGGER fail_sparse_route_recenter BEFORE UPDATE " + "ON cortext_sparse_route_meta BEGIN " + "SELECT RAISE(ABORT, 'injected sparse route recenter failure'); END"); + REQUIRE_FALSE (route->Recenter (UnitVec (6))); + REQUIRE (route->ActivationSearchEffort () + == effort_before_failed_recenter); + REQUIRE (route->ActivationSearchNodeBudget () + == budget_before_failed_recenter); + store->Execute ("DROP TRIGGER fail_sparse_route_recenter"); + const auto before_restart = route->Search (UnitVec (0), 32); + REQUIRE (before_restart); + + auto restarted = SQLiteRoute::Open (*store, kEmbeddingDim, parameters); + REQUIRE (restarted != nullptr); + REQUIRE (restarted->RestartRowsLoaded () == 1); + REQUIRE (restarted->ActivationEntryMemoryId () == recenter_target->front ()); + REQUIRE (restarted->ActivationSearchEffort () == parameters.search_ef); + REQUIRE (restarted->ActivationSearchNodeBudget () + == parameters.search_node_budget); + REQUIRE (restarted->Search (UnitVec (0), 32) == before_restart); + REQUIRE (restarted->Upsert (1000, UnitVec (0))); + REQUIRE (restarted->Remove (1)); + REQUIRE (restarted->StagePendingUpsert (1000, UnitVec (0))); + REQUIRE (restarted->StagePendingRemove (1)); + REQUIRE (hnsw->Upsert (1000, UnitVec (0))); + REQUIRE (hnsw->Remove (1)); + REQUIRE (hnsw->SealDelta ()); + REQUIRE (restarted->DeltaSize () == 2); + store->Execute ( + "CREATE TRIGGER fail_sparse_route_seal BEFORE UPDATE " + "ON cortext_sparse_route_nodes WHEN NEW.generation > 0 " + "BEGIN SELECT RAISE(ABORT, 'injected sparse route seal failure'); END"); + REQUIRE_FALSE (restarted->Seal (hnsw.get ())); + REQUIRE (restarted->DeltaSize () == 2); + const auto pending = restarted->Search (UnitVec (0), 32); + REQUIRE (pending.has_value ()); + REQUIRE (std::find (pending->begin (), pending->end (), 1) + == pending->end ()); + REQUIRE (std::find (pending->begin (), pending->end (), 1000) + != pending->end ()); + auto persisted_before_retry = SQLiteRoute::Open ( + *store, kEmbeddingDim, parameters); + REQUIRE (persisted_before_retry); + REQUIRE (persisted_before_retry->HasDirtyMemoryIds ()); + store->Execute ("DROP TRIGGER fail_sparse_route_seal"); + REQUIRE (restarted->Seal (hnsw.get ())); + REQUIRE (restarted->DeltaSize () == 0); + REQUIRE (restarted->CachedNodeRows () == 0); + REQUIRE (restarted->CacheOrderRows () == 0); + + restarted = SQLiteRoute::Open (*store, kEmbeddingDim, parameters); + REQUIRE (restarted != nullptr); + const auto inserted_rows = store->Execute ( + "SELECT active FROM cortext_sparse_route_nodes WHERE memory_id = ?", + { 1000LL }); + REQUIRE (inserted_rows.size () == 1); + REQUIRE (store::AnyToLongLong (inserted_rows.front ().at ("active")) + .value_or (0) + == 1); + const auto after_seal = restarted->Search (UnitVec (0), 32); + REQUIRE (after_seal.has_value ()); + REQUIRE (std::find (after_seal->begin (), after_seal->end (), 1) + == after_seal->end ()); + const auto inserted = restarted->SearchActivated (UnitVec (0)); + REQUIRE (inserted.has_value ()); + REQUIRE (std::find (inserted->begin (), inserted->end (), 1000) + != inserted->end ()); + REQUIRE (restarted->LastSearchNodeRows () + <= parameters.search_node_budget); + + Eigen::VectorXf row_addressed = Eigen::VectorXf::Zero (kEmbeddingDim); + row_addressed[0] = 0.6f; + row_addressed[1] = 0.8f; + REQUIRE (restarted->Upsert (2000, row_addressed)); + REQUIRE (restarted->StagePendingUpsert (2000, row_addressed)); + REQUIRE (restarted->DeltaSize () == 1); + REQUIRE (restarted->Seal ()); + REQUIRE (restarted->LastSearchNodeRows () + <= parameters.backfill_search_node_budget); + REQUIRE (restarted->ActivationSearchEffort () == parameters.search_ef); + REQUIRE (restarted->ActivationSearchNodeBudget () + == parameters.search_node_budget); + REQUIRE (restarted->DeltaSize () == 0); + restarted = SQLiteRoute::Open (*store, kEmbeddingDim, parameters); + REQUIRE (restarted != nullptr); + const auto row_addressed_inserted + = restarted->Search (row_addressed, 32); + REQUIRE (row_addressed_inserted.has_value ()); + REQUIRE_FALSE (row_addressed_inserted->empty ()); + REQUIRE (row_addressed_inserted->front () == 2000); + REQUIRE (restarted->LastSearchNodeRows () + <= parameters.search_node_budget); + REQUIRE (restarted->Remove (2000)); + REQUIRE (restarted->StagePendingRemove (2000)); + REQUIRE (restarted->Seal ()); + restarted = SQLiteRoute::Open (*store, kEmbeddingDim, parameters); + REQUIRE (restarted != nullptr); + const auto row_addressed_removed + = restarted->Search (row_addressed, 32); + REQUIRE (row_addressed_removed.has_value ()); + REQUIRE (std::find (row_addressed_removed->begin (), + row_addressed_removed->end (), 2000) + == row_addressed_removed->end ()); + +} + +TEST_CASE ("Consolidation resets the experimental derived retrieval sawtooth", + "[operations][graph][retrieval][hnsw][sqlite][consolidation]" + "[activation][knobs][experiment_hooks]") +{ + using HnswRoute + = operations::sparse_retrieval_route_internal::Route; + using SQLiteRoute + = operations::sparse_retrieval_route_sqlite_internal::Route; + cortext::testing::ScopedEnvVar envelope ( + "CORTEXT_EXPERIMENT_SQLITE_SPARSE_NODE_ENVELOPE", "20"); + const auto parameters + = operations::sparse_retrieval_route_sqlite_internal:: + DeriveParameters (0.0, 0.0, 0.0); + const std::size_t step = parameters.reciprocal_update_count; + REQUIRE (parameters.activation_search_node_budget_min + == parameters.route_capacity * 4 + step); + REQUIRE (parameters.activation_search_node_budget_step == step); + REQUIRE (parameters.activation_search_ef_min + == parameters.activation_search_node_budget_min); + REQUIRE (parameters.activation_search_ef_step == step); + + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + cortext::testing::InitializeCoreSchema (*store); + std::vector> entries; + entries.reserve (700); + for (long long memory_id = 1; memory_id <= 700; ++memory_id) + entries.emplace_back ( + memory_id, + UnitVec (static_cast (memory_id % kEmbeddingDim))); + auto hnsw = HnswRoute::Create (kEmbeddingDim, entries, parameters.hnsw); + REQUIRE (hnsw); + auto route = SQLiteRoute::Create ( + *store, kEmbeddingDim, entries, *hnsw, parameters); + REQUIRE (route); + REQUIRE (route->ActivationSearchNodeBudget () + == parameters.search_node_budget); + REQUIRE (route->Recenter (UnitVec (0))); + REQUIRE (route->ActivationSearchNodeBudget () + == parameters.activation_search_node_budget_min); + REQUIRE (route->ActivationSearchEffort () + == parameters.activation_search_ef_min); + + REQUIRE (route->SearchActivated (UnitVec (0))); + REQUIRE (route->ActivationSearchNodeBudget () + == parameters.activation_search_node_budget_min + step); + REQUIRE (route->ActivationSearchEffort () + == parameters.activation_search_ef_min + step); + while (route->ActivationSearchNodeBudget () + < parameters.search_node_budget) + REQUIRE (route->SearchActivated (UnitVec (0))); + REQUIRE (route->ActivationSearchNodeBudget () + == parameters.search_node_budget); + REQUIRE (route->ActivationSearchEffort () == parameters.search_ef); +} + +TEST_CASE ("Quality-preserving experimental retrieval sawtooth keeps the " + "canonical floor", + "[operations][graph][retrieval][hnsw][sqlite][consolidation]" + "[activation][knobs][experiment_hooks]") +{ + using HnswRoute + = operations::sparse_retrieval_route_internal::Route; + using SQLiteRoute + = operations::sparse_retrieval_route_sqlite_internal::Route; + cortext::testing::ScopedEnvVar envelope ( + "CORTEXT_EXPERIMENT_SQLITE_SPARSE_NODE_ENVELOPE", "21"); + const auto parameters + = operations::sparse_retrieval_route_sqlite_internal:: + DeriveParameters (0.0, 0.0, 0.0); + const std::size_t step = parameters.reciprocal_update_count; + REQUIRE (parameters.activation_search_node_budget_min + == parameters.route_capacity * 5); + REQUIRE (parameters.activation_search_node_budget_step == step); + REQUIRE (parameters.search_node_budget == parameters.route_capacity * 6); + REQUIRE (parameters.search_ef == parameters.search_node_budget); + REQUIRE (parameters.activation_search_ef_min + == parameters.activation_search_node_budget_min); + REQUIRE (parameters.activation_search_ef_step == step); + REQUIRE (parameters.total_query_row_budget + == parameters.search_node_budget + + parameters.activation_identity_target); + + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + cortext::testing::InitializeCoreSchema (*store); + std::vector> entries; + entries.reserve (500); + for (long long memory_id = 1; memory_id <= 500; ++memory_id) + entries.emplace_back ( + memory_id, + UnitVec (static_cast (memory_id % kEmbeddingDim))); + auto hnsw = HnswRoute::Create (kEmbeddingDim, entries, parameters.hnsw); + REQUIRE (hnsw); + auto route = SQLiteRoute::Create ( + *store, kEmbeddingDim, entries, *hnsw, parameters); + REQUIRE (route); + REQUIRE (route->ActivationSearchNodeBudget () + == parameters.search_node_budget); + REQUIRE (route->Recenter (UnitVec (0))); + REQUIRE (route->ActivationSearchNodeBudget () + == parameters.activation_search_node_budget_min); + REQUIRE (route->ActivationSearchEffort () + == parameters.activation_search_ef_min); + REQUIRE (route->SearchActivated (UnitVec (0))); + REQUIRE (route->ActivationSearchNodeBudget () + == parameters.activation_search_node_budget_min + step); + REQUIRE (route->ActivationSearchEffort () + == parameters.activation_search_ef_min + step); +} + +TEST_CASE ("Experimental retrieval sawtooth can raise only its derived floor", + "[operations][graph][retrieval][hnsw][sqlite][consolidation]" + "[activation][knobs][experiment_hooks]") +{ + cortext::testing::ScopedEnvVar envelope ( + "CORTEXT_EXPERIMENT_SQLITE_SPARSE_NODE_ENVELOPE", "22"); + const auto parameters + = operations::sparse_retrieval_route_sqlite_internal:: + DeriveParameters (0.5, 0.5, 0.5); + REQUIRE (parameters.activation_search_node_budget_min + == parameters.route_capacity * 6); + REQUIRE (parameters.activation_search_ef_min + == parameters.route_capacity * 6); + REQUIRE (parameters.search_node_budget == parameters.route_capacity * 7); + REQUIRE (parameters.search_ef == parameters.route_capacity * 7); + REQUIRE (parameters.activation_search_node_budget_step + == parameters.reciprocal_update_count); + REQUIRE (parameters.activation_search_ef_step + == parameters.reciprocal_update_count); + REQUIRE (parameters.total_query_row_budget + == parameters.search_node_budget + + parameters.activation_identity_target); +} + +TEST_CASE ("Experimental retrieval floor ablation remains knob-derived", + "[operations][graph][retrieval][hnsw][sqlite][consolidation]" + "[activation][knobs][experiment_hooks]") +{ + cortext::testing::ScopedEnvVar envelope ( + "CORTEXT_EXPERIMENT_SQLITE_SPARSE_NODE_ENVELOPE", "23"); + const auto parameters + = operations::sparse_retrieval_route_sqlite_internal:: + DeriveParameters (0.5, 0.5, 0.5); + REQUIRE (parameters.activation_search_node_budget_min + == parameters.route_capacity * 7); + REQUIRE (parameters.activation_search_ef_min + == parameters.route_capacity * 7); + REQUIRE (parameters.search_node_budget == parameters.route_capacity * 8); + REQUIRE (parameters.search_ef == parameters.route_capacity * 8); + REQUIRE (parameters.activation_search_node_budget_step + == parameters.reciprocal_update_count); + REQUIRE (parameters.activation_search_ef_step + == parameters.reciprocal_update_count); + REQUIRE (parameters.total_query_row_budget + == parameters.search_node_budget + + parameters.activation_identity_target); +} + +TEST_CASE ("Final adjacent retrieval floor ablation remains knob-derived", + "[operations][graph][retrieval][hnsw][sqlite][consolidation]" + "[activation][knobs][experiment_hooks]") +{ + const auto production + = operations::sparse_retrieval_route_sqlite_internal:: + DeriveParameters (0.5, 0.5, 0.5); + cortext::testing::ScopedEnvVar envelope ( + "CORTEXT_EXPERIMENT_SQLITE_SPARSE_NODE_ENVELOPE", "24"); + const auto parameters + = operations::sparse_retrieval_route_sqlite_internal:: + DeriveParameters (0.5, 0.5, 0.5); + REQUIRE (parameters.activation_search_node_budget_min + == parameters.route_capacity * 8); + REQUIRE (parameters.activation_search_ef_min + == parameters.route_capacity * 8); + REQUIRE (parameters.search_node_budget == parameters.route_capacity * 9); + REQUIRE (parameters.search_ef == parameters.route_capacity * 9); + REQUIRE (parameters.activation_search_node_budget_step + == parameters.reciprocal_update_count); + REQUIRE (parameters.activation_search_ef_step + == parameters.reciprocal_update_count); + REQUIRE (parameters.total_query_row_budget + == parameters.search_node_budget + + parameters.activation_identity_target); + REQUIRE (parameters.search_node_budget == production.search_node_budget); + REQUIRE (parameters.activation_search_node_budget_min + == production.activation_search_node_budget_min); + REQUIRE (parameters.activation_search_node_budget_step + == production.activation_search_node_budget_step); + REQUIRE (parameters.search_ef == production.search_ef); + REQUIRE (parameters.activation_search_ef_min + == production.activation_search_ef_min); + REQUIRE (parameters.activation_search_ef_step + == production.activation_search_ef_step); + REQUIRE (parameters.total_query_row_budget + == production.total_query_row_budget); +} + +TEST_CASE ("Mature SQLite activation fills its knob-derived node envelope " + "across inactive graph rows", + "[operations][graph][retrieval][hnsw][sqlite][consolidation]" + "[regression]") +{ + using HnswRoute + = operations::sparse_retrieval_route_internal::Route; + using SQLiteRoute + = operations::sparse_retrieval_route_sqlite_internal::Route; + const auto parameters + = operations::sparse_retrieval_route_sqlite_internal:: + DeriveParameters (0.0, 0.0, 0.0); + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + cortext::testing::InitializeCoreSchema (*store); + + const long long active_count + = static_cast (parameters.search_node_budget - 1); + std::vector> entries; + entries.reserve (static_cast (active_count)); + for (long long memory_id = 1; memory_id <= active_count; ++memory_id) + entries.emplace_back ( + memory_id, + UnitVec (static_cast (memory_id % kEmbeddingDim))); + auto hnsw = HnswRoute::Create ( + kEmbeddingDim, entries, parameters.hnsw); + REQUIRE (hnsw); + auto route = SQLiteRoute::Create ( + *store, kEmbeddingDim, entries, *hnsw, parameters); + REQUIRE (route); + const std::vector empty_level_zero_links { + 1, 0, 0, 0, 0, 0, 0, 0 + }; + const long long inactive_memory_id = active_count + 1; + store->Execute ( + "INSERT INTO cortext_sparse_route_nodes(" + "memory_id, embedding, level, links, active, generation) " + "SELECT ?, embedding, 0, ?, 0, generation " + "FROM cortext_sparse_route_nodes WHERE memory_id = 1", + { inactive_memory_id, empty_level_zero_links }); + route.reset (); + route = SQLiteRoute::Open (*store, kEmbeddingDim, parameters); + REQUIRE (route); + + const auto activated = route->SearchActivated (UnitVec (0)); + REQUIRE (activated); + REQUIRE (activated->size () == parameters.activation_identity_target); + REQUIRE (std::find (activated->begin (), activated->end (), + inactive_memory_id) + == activated->end ()); + REQUIRE (route->LastSearchNodeRows () + == parameters.search_node_budget); +} + +TEST_CASE ("Consolidation rebuilds and restarts a knob-bounded SQLite " + "activation centroid", + "[operations][graph][retrieval][hnsw][sqlite][consolidation]" + "[activation][knobs][restart]") +{ + using HnswRoute + = operations::sparse_retrieval_route_internal::Route; + using SQLiteRoute + = operations::sparse_retrieval_route_sqlite_internal::Route; + const auto parameters = operations::sparse_retrieval_route_sqlite_internal:: + DeriveParameters (0.0, 0.0, 0.0); + REQUIRE (parameters.activation_identity_target == 640); + REQUIRE (parameters.search_node_budget == 2304); + REQUIRE (parameters.activation_search_node_budget_min == 2048); + REQUIRE (parameters.activation_search_node_budget_step == 4); + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + cortext::testing::InitializeCoreSchema (*store); + + std::vector> entries; + entries.reserve (1400); + for (long long memory_id = 1; memory_id <= 1400; ++memory_id) + entries.emplace_back (memory_id, + UnitVec (memory_id <= 700 ? 0 : 1)); + auto hnsw = HnswRoute::Create ( + kEmbeddingDim, entries, parameters.hnsw); + REQUIRE (hnsw); + auto route = SQLiteRoute::Create ( + *store, kEmbeddingDim, entries, *hnsw, parameters); + REQUIRE (route); + const Eigen::VectorXf observer_query = UnitVec (2); + const auto canonical_observer = route->Search (observer_query, 16); + REQUIRE (canonical_observer); + REQUIRE_FALSE (canonical_observer->empty ()); + const auto initial_activation = route->SearchActivated (observer_query); + REQUIRE (initial_activation); + REQUIRE (initial_activation->size () + == parameters.activation_identity_target); + + REQUIRE (route->Recenter (UnitVec (0))); + const long long first_entry = route->ActivationEntryMemoryId (); + REQUIRE (first_entry > 0); + REQUIRE (first_entry <= 700); + const auto first_snapshot = route->ActivationIdentityIds (); + REQUIRE (first_snapshot.size () + == parameters.activation_identity_target); + REQUIRE (first_snapshot.front () == first_entry); + const auto first_activation = route->SearchActivated (observer_query); + REQUIRE (first_activation); + REQUIRE (first_activation->size () + == parameters.activation_identity_target); + REQUIRE (route->LastSearchNodeRows () + <= parameters.search_node_budget); + + route = SQLiteRoute::Open (*store, kEmbeddingDim, parameters); + REQUIRE (route); + REQUIRE (route->ActivationEntryMemoryId () == first_entry); + REQUIRE (route->SearchActivated (observer_query) == first_activation); + REQUIRE (route->LastActivationSnapshotCacheMissRows () > 0); + REQUIRE (route->LastActivationSnapshotCacheMissRows () + <= parameters.activation_identity_target); + REQUIRE (route->SearchActivated (observer_query) == first_activation); + REQUIRE (route->LastActivationSnapshotCacheMissRows () == 0); + REQUIRE (route->RestartRowsLoaded () == 1); + + REQUIRE (route->Recenter (UnitVec (1))); + const long long second_entry = route->ActivationEntryMemoryId (); + REQUIRE (second_entry > 700); + REQUIRE (second_entry != first_entry); + const auto second_snapshot = route->ActivationIdentityIds (); + REQUIRE (second_snapshot.size () + == parameters.activation_identity_target); + REQUIRE (second_snapshot.front () == second_entry); + REQUIRE (second_snapshot != first_snapshot); + const auto second_activation = route->SearchActivated (observer_query); + REQUIRE (second_activation); + REQUIRE (second_activation->size () + == parameters.activation_identity_target); + REQUIRE (*second_activation != *first_activation); + REQUIRE (second_activation->front () == canonical_observer->front ()); + const auto shifted_query = route->SearchActivated (UnitVec (0)); + REQUIRE (shifted_query); + REQUIRE (shifted_query->front () == 1); + REQUIRE (static_cast (std::count_if ( + shifted_query->begin (), shifted_query->end (), + [] (const long long memory_id) { return memory_id > 700; })) + == parameters.reciprocal_update_count); + REQUIRE (route->LastActivationSnapshotRows () + <= parameters.activation_identity_target); + REQUIRE (route->LastSearchNodeRows () + <= parameters.search_node_budget); + + const auto metadata = store->Execute ( + "SELECT activation_entry_memory_id, activation_generation, " + "length(activation_centroid) AS centroid_bytes, " + "length(activation_identity_ids) AS identity_bytes " + "FROM cortext_sparse_route_meta WHERE singleton = 1"); + REQUIRE (metadata.size () == 1); + REQUIRE (std::any_cast ( + metadata[0].at ("activation_entry_memory_id")) + == second_entry); + REQUIRE (std::any_cast ( + metadata[0].at ("activation_generation")) + == 1); + REQUIRE (std::any_cast (metadata[0].at ("centroid_bytes")) + == static_cast (kEmbeddingDim * sizeof (float))); + REQUIRE (std::any_cast (metadata[0].at ("identity_bytes")) + == static_cast ( + sizeof (std::uint32_t) + + parameters.activation_identity_target + * sizeof (std::uint64_t))); + + route = SQLiteRoute::Open (*store, kEmbeddingDim, parameters); + REQUIRE (route); + REQUIRE (route->ActivationEntryMemoryId () == second_entry); + REQUIRE (route->ActivationIdentityIds () == second_snapshot); + REQUIRE (route->SearchActivated (observer_query) == second_activation); + REQUIRE (route->RestartRowsLoaded () == 1); +} + Eigen::VectorXf VectorWithCosineToDim0 (float cosine) { @@ -215,11 +824,16 @@ TEST_CASE ("Graph retrieval returns nearest retained memory", const auto out = processor.Process (MakeSignal (UnitVec (0), 2000)); const auto selected = operations::retrieval_trace::GetLastSelectedEmbeddingOrder (); + const auto seeds = operations::retrieval_trace::GetLastSeedCandidates (); REQUIRE_FALSE (out.candidate_memory_ids.empty ()); REQUIRE (std::find (out.candidate_memory_ids.begin (), out.candidate_memory_ids.end (), 10) != out.candidate_memory_ids.end ()); REQUIRE_FALSE (selected.empty ()); + REQUIRE_FALSE (seeds.empty ()); + REQUIRE (seeds.front ().memory_id == 10LL); + REQUIRE (seeds.front ().embedding_id > 0); + REQUIRE (seeds.front ().score >= seeds.back ().score); auto current_rows = store->Execute ( "SELECT embedding_id FROM current_memory_embeddings " "WHERE memory_id = ?", @@ -501,8 +1115,7 @@ TEST_CASE ("Family features are cached and replaced with their embedding", surface_cache::Erase (pctx); } -TEST_CASE ("Supersession eligibility index invalidates only for indexed " - "source changes", +TEST_CASE ("Supersession eligibility index updates only affected targets", "[operations][graph][retrieval][supersession][cache][scaling]") { ProcessorContext pctx; @@ -533,9 +1146,7 @@ TEST_CASE ("Supersession eligibility index invalidates only for indexed " "image", -1.0, 0, 0.0, 0.0, 0.0, false, true, UnitVec (0) }); operations::association_fanout_cache::NotifyRetrievalSurfaceChanged ( pctx, 20); - REQUIRE_FALSE (sidecar->supersession_eligibility.valid); - operations::association_fanout_cache::BuildSupersessionEligibility ( - cache, pctx); + REQUIRE (sidecar->supersession_eligibility.valid); REQUIRE (sidecar->supersession_eligibility.activation_ts_by_target.at (10) == 7000); } @@ -1053,7 +1664,10 @@ TEST_CASE ("Graph retrieval ranking is invariant to source and modality labels", { cortext::testing::ScopedEnvVar disable_constructive_recall ( "CORTEXT_DISABLE_CONSTRUCTIVE_RECALL", "1"); - auto run = [] (bool shared_source, const std::string &modality) { + auto run = [] (bool shared_source, const std::string &modality, + bool sparse_route) { + cortext::testing::ScopedEnvVar sparse_route_flag ( + "CORTEXT_HNSW_SPARSE_ROUTE", sparse_route ? "1" : "0"); auto unique_store = SQLiteStore::Create (":memory:"); auto store = std::shared_ptr (std::move (unique_store)); cortext::testing::InitializeCoreSchema (*store); @@ -1091,9 +1705,1039 @@ TEST_CASE ("Graph retrieval ranking is invariant to source and modality labels", return signature; }; - const auto shared_text = run (true, "text"); - const auto unique_audio = run (false, "audio"); + const auto shared_text = run (true, "text", false); + const auto unique_audio = run (false, "audio", true); + const auto unique_image = run (false, "image", true); REQUIRE (shared_text == unique_audio); + REQUIRE (shared_text == unique_image); +} + +TEST_CASE ("Graph retrieval captures same-event exact control for sparse route", + "[operations][graph][retrieval][hnsw][control]") +{ + cortext::testing::ScopedEnvVar disable_constructive_recall ( + "CORTEXT_DISABLE_CONSTRUCTIVE_RECALL", "1"); + cortext::testing::ScopedEnvVar sparse_route_flag ( + "CORTEXT_HNSW_SPARSE_ROUTE", "1"); + cortext::testing::ScopedEnvVar exact_control_flag ( + "CORTEXT_CAPTURE_HNSW_EXACT_CONTROL", "1"); + auto unique_store = SQLiteStore::Create (":memory:"); + auto store = std::shared_ptr (std::move (unique_store)); + cortext::testing::InitializeCoreSchema (*store); + for (long long index = 0; index < 600; ++index) + SeedMemory (*store, index + 1, 1000 + index, + VectorWithCosineToDim0 ( + 0.10f + static_cast (index) * 0.001f), + 1000 + index, "opaque/" + std::to_string (index % 4)); + + SignalProcessor::Config cfg; + cortext::testing::RequireEncoder (cfg); + cfg.focus = 0.5; + cfg.sensitivity = 0.5; + cfg.stability = 0.5; + auto ops = std::make_unique ( + std::make_unique (), + std::make_unique ()); + SignalProcessor processor (cfg, store, std::move (ops)); + + (void)processor.Process (MakeSignal (UnitVec (0), 100000)); + const auto candidate + = operations::retrieval_trace::GetLastSeedCandidates (); + const auto exact + = operations::retrieval_trace::GetLastExactSeedCandidates (); + REQUIRE_FALSE (candidate.empty ()); + REQUIRE_FALSE (exact.empty ()); + REQUIRE (candidate.size () == exact.size ()); + for (std::size_t index = 0; index < exact.size (); ++index) + { + REQUIRE (candidate[index].memory_id == exact[index].memory_id); + REQUIRE (candidate[index].score == exact[index].score); + } +} + +TEST_CASE ("Graph retrieval reopens SQLite sparse route on the existing path", + "[operations][graph][retrieval][hnsw][sqlite][integration]") +{ + cortext::testing::ScopedEnvVar disable_constructive_recall ( + "CORTEXT_DISABLE_CONSTRUCTIVE_RECALL", "1"); + cortext::testing::ScopedEnvVar hnsw_route_flag ( + "CORTEXT_HNSW_SPARSE_ROUTE", "0"); + cortext::testing::ScopedEnvVar sqlite_route_flag ( + "CORTEXT_SQLITE_SPARSE_ROUTE", "1"); + cortext::testing::ScopedEnvVar exact_control_flag ( + "CORTEXT_CAPTURE_HNSW_EXACT_CONTROL", "1"); + cortext::testing::ScopedEnvVar profile_flag ( + "CORTEXT_PROFILE_GRAPH_RETRIEVAL", "1"); + auto unique_store = SQLiteStore::Create (":memory:"); + auto store = std::shared_ptr (std::move (unique_store)); + cortext::testing::InitializeCoreSchema (*store); + const auto parameters + = operations::sparse_retrieval_route_sqlite_internal:: + DefaultParameters (); + std::vector> route_entries; + route_entries.reserve (600); + for (long long index = 0; index < 600; ++index) + { + auto embedding = VectorWithCosineToDim0 ( + 0.10f + static_cast (index) * 0.001f); + SeedMemory (*store, index + 1, 1000 + index, embedding, + 1000 + index, + "opaque/" + std::to_string (index % 4)); + route_entries.emplace_back (index + 1, std::move (embedding)); + } + auto hnsw = operations::sparse_retrieval_route_internal::Route::Create ( + kEmbeddingDim, route_entries, + operations::sparse_retrieval_route_internal::DefaultParameters ()); + REQUIRE (hnsw != nullptr); + auto sqlite_route = operations::sparse_retrieval_route_sqlite_internal:: + Route::Create ( + *store, kEmbeddingDim, route_entries, *hnsw, parameters); + REQUIRE (sqlite_route != nullptr); + + const auto meta = store->Execute ( + "SELECT active_count FROM cortext_sparse_route_meta " + "WHERE singleton = 1"); + REQUIRE (meta.size () == 1); + REQUIRE (store::AnyToLongLong (meta.front ().at ("active_count")) + .value_or (0) + == 600); + + struct RouteRun + { + std::vector candidate_ids; + double node_rows = 0.0; + double activated_identities = 0.0; + double restart_rows = 0.0; + }; + const auto run = [&] (const std::string &modality, + const std::string &query_source, + bool shared_memory_source) { + store->Execute ( + shared_memory_source + ? "UPDATE memories SET modality = ?, source_id = 'shared/source'" + : "UPDATE memories SET modality = ?, source_id = 'opaque/' || " + "CAST(memory_id % 4 AS TEXT)", + { modality }); + SignalProcessor::Config cfg; + cortext::testing::RequireEncoder (cfg); + cfg.focus = 0.5; + cfg.sensitivity = 0.5; + cfg.stability = 0.5; + auto ops = std::make_unique ( + std::make_unique (), + std::make_unique ()); + SignalProcessor processor (cfg, store, std::move (ops)); + auto signal = MakeSignal (UnitVec (0), 100000); + signal.source_id = query_source; + signal.modality = modality; + const auto output = processor.Process (signal); + const auto candidates + = operations::retrieval_trace::GetLastSeedCandidates (); + RouteRun result; + for (const auto &candidate : candidates) + result.candidate_ids.push_back (candidate.memory_id); + result.node_rows = output.operation_ms.at ( + "GraphRetrieve.sqlite_sparse_route_node_rows"); + result.activated_identities = output.operation_ms.at ( + "GraphRetrieve.sqlite_sparse_route_activated_identities"); + result.restart_rows = output.operation_ms.at ( + "GraphRetrieve.sqlite_sparse_route_restart_rows"); + return result; + }; + + const auto shared_text = run ("text", "query/shared", true); + const auto opaque_audio = run ("audio", "query/opaque/audio", false); + const auto opaque_image = run ("image", "query/opaque/image", false); + REQUIRE_FALSE (shared_text.candidate_ids.empty ()); + REQUIRE (shared_text.candidate_ids == opaque_audio.candidate_ids); + REQUIRE (shared_text.candidate_ids == opaque_image.candidate_ids); + for (const auto &result : { shared_text, opaque_audio, opaque_image }) + { + INFO ("sqlite route rows=" << result.node_rows); + REQUIRE (result.node_rows > 0.0); + REQUIRE (result.node_rows + <= static_cast (parameters.search_node_budget)); + REQUIRE (result.activated_identities + <= static_cast ( + parameters.activation_identity_target)); + REQUIRE (result.restart_rows == 1.0); + } + auto restarted = operations::sparse_retrieval_route_sqlite_internal::Route:: + Open (*store, kEmbeddingDim, parameters); + REQUIRE (restarted != nullptr); + REQUIRE (restarted->RestartRowsLoaded () == 1); + REQUIRE ( + restarted->Search (UnitVec (0), parameters.route_capacity).has_value ()); + REQUIRE (restarted->LastSearchNodeRows () + <= parameters.search_node_budget); +} + +TEST_CASE ("SQLite sparse route restages active mutations after restart", + "[operations][graph][retrieval][hnsw][sqlite][restart]") +{ + namespace cache + = operations::historical_surface_search_cache_internal; + const auto parameters + = operations::sparse_retrieval_route_sqlite_internal:: + DefaultParameters (); + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + cortext::testing::InitializeCoreSchema (*store); + + std::vector> route_entries; + route_entries.reserve (600); + for (long long memory_id = 1; memory_id <= 600; ++memory_id) + route_entries.emplace_back ( + memory_id, + VectorWithCosineToDim0 ( + 0.10f + static_cast (memory_id - 1) * 0.001f)); + auto hnsw = operations::sparse_retrieval_route_internal::Route::Create ( + kEmbeddingDim, route_entries, + operations::sparse_retrieval_route_internal::DefaultParameters ()); + REQUIRE (hnsw); + auto route = operations::sparse_retrieval_route_sqlite_internal::Route:: + Create (*store, kEmbeddingDim, route_entries, *hnsw, + parameters); + REQUIRE (route); + + const Eigen::VectorXf revised = UnitVec (5); + REQUIRE (route->Upsert (1, revised)); + REQUIRE (route->Remove (2)); + REQUIRE (store->Execute ( + "SELECT singleton FROM cortext_sparse_route_meta") + .size () + == 1); + REQUIRE (store->Execute ( + "SELECT memory_id FROM cortext_sparse_route_dirty") + .size () + == 2); + + cache::State state; + state.embedding_dim = kEmbeddingDim; + state.current_entries.reserve (599); + for (const auto &[memory_id, embedding] : route_entries) + { + if (memory_id == 2) + continue; + const std::size_t index = state.current_entries.size (); + state.current_entries.emplace_back ( + memory_id, memory_id, 1000 + memory_id, "LONG_TERM", "opaque", + memory_id == 1 ? revised : embedding, memory_id); + state.current_memory_index.emplace (memory_id, index); + state.current_memory_order.emplace (memory_id, index); + } + + route.reset (); + route = cache::OpenSQLiteSparseRoute (state, *store); + REQUIRE (route); + REQUIRE (route->RestartRowsLoaded () == 1); + REQUIRE (route->DeltaSize () == 0); + REQUIRE (route->HasDirtyMemoryIds ()); + const auto staged_dirty + = cache::StageSQLiteSparseRouteDirtyForSearch (state, *route); + REQUIRE (staged_dirty == 2); + REQUIRE (route->DeltaSize () == 2); + const auto unsealed_revised_result + = route->Search (revised, parameters.route_capacity); + REQUIRE (unsealed_revised_result); + REQUIRE_FALSE (unsealed_revised_result->empty ()); + REQUIRE (unsealed_revised_result->front () == 1); + const auto unsealed_removed_result + = route->Search (route_entries[1].second, parameters.route_capacity); + REQUIRE (unsealed_removed_result); + REQUIRE (std::find (unsealed_removed_result->begin (), + unsealed_removed_result->end (), 2) + == unsealed_removed_result->end ()); + REQUIRE (cache::ReconcileSQLiteSparseRoute ( + state, *store, route, + std::shared_ptr< + operations::sparse_retrieval_route_internal::Route>{})); + route = state.sqlite_sparse_route; + REQUIRE (route); + REQUIRE_FALSE (route->HasDirtyMemoryIds ()); + const auto revised_result + = route->Search (revised, parameters.route_capacity); + REQUIRE (revised_result); + REQUIRE_FALSE (revised_result->empty ()); + REQUIRE (revised_result->front () == 1); + const auto removed_result + = route->Search (route_entries[1].second, parameters.route_capacity); + REQUIRE (removed_result); + REQUIRE (std::find (removed_result->begin (), removed_result->end (), 2) + == removed_result->end ()); + + REQUIRE (store->Execute ( + "SELECT memory_id FROM cortext_sparse_route_dirty") + .empty ()); + const auto meta = store->Execute ( + "SELECT active_count FROM cortext_sparse_route_meta " + "WHERE singleton = 1"); + REQUIRE (meta.size () == 1); + REQUIRE (store::AnyToLongLong (meta.front ().at ("active_count")) + .value_or (0) + == 599); + + state.sqlite_sparse_route.reset (); + route = cache::OpenSQLiteSparseRoute (state, *store); + REQUIRE (route); + REQUIRE (route->DeltaSize () == 0); + const auto sealed_result + = route->Search (revised, parameters.route_capacity); + REQUIRE (sealed_result); + REQUIRE_FALSE (sealed_result->empty ()); + REQUIRE (sealed_result->front () == 1); + + // Dirty reconciliation and historical backfill are separate derived + // surfaces. Dirty search stages at most C identities and reads C+1 only to + // detect journal overflow; historical backfill remains B and checks its + // logical B+1 boundary from the post-B iterator without reading that row. + const std::size_t overflow_count = parameters.route_capacity + 1; + for (std::size_t offset = 0; offset < overflow_count; ++offset) + { + const long long memory_id = 3 + static_cast (offset); + REQUIRE (route->Upsert ( + memory_id, + route_entries[static_cast (memory_id - 1)].second)); + } + REQUIRE (store->Execute ( + "SELECT memory_id FROM cortext_sparse_route_dirty") + .size () + == overflow_count); + REQUIRE_FALSE ( + cache::StageSQLiteSparseRouteDirtyForSearch (state, *route)); + REQUIRE (route->DeltaSize () == 0); +} + +TEST_CASE ("SQLite sparse route backfills a large existing surface in fixed " + "unpublished batches", + "[operations][graph][retrieval][hnsw][sqlite][backfill]") +{ + namespace cache + = operations::historical_surface_search_cache_internal; + const auto parameters + = operations::sparse_retrieval_route_sqlite_internal:: + DefaultParameters (); + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + cortext::testing::InitializeCoreSchema (*store); + + cache::State state; + state.embedding_dim = kEmbeddingDim; + constexpr long long kEntryCount = 1300; + state.current_entries.reserve (kEntryCount); + for (long long memory_id = 1; memory_id <= kEntryCount; ++memory_id) + { + Eigen::VectorXf embedding (kEmbeddingDim); + for (Eigen::Index dimension = 0; dimension < embedding.size (); + ++dimension) + embedding[dimension] = std::sin ( + static_cast (memory_id * (dimension + 1)) * 0.013f); + embedding.normalize (); + const std::size_t index = state.current_entries.size (); + state.current_entries.emplace_back ( + memory_id, memory_id, 1000 + memory_id, "LONG_TERM", "opaque", + std::move (embedding), memory_id); + state.current_memory_index.emplace (memory_id, index); + state.current_memory_order.emplace (memory_id, index); + } + + REQUIRE (cache::AdvanceSQLiteSparseRouteBackfill (state, *store)); + REQUIRE_FALSE (state.sqlite_sparse_route); + REQUIRE (state.sqlite_sparse_route_backfill); + REQUIRE (state.sqlite_sparse_route_backfill->BuildCursor () + == static_cast (parameters.backfill_batch_size)); + REQUIRE (state.sqlite_sparse_route_backfill->ActiveCount () + == static_cast (parameters.backfill_batch_size)); + REQUIRE (store->Execute ( + "SELECT singleton FROM cortext_sparse_route_meta") + .empty ()); + REQUIRE (store->Execute ( + "SELECT singleton FROM cortext_sparse_route_build") + .size () + == 1); + REQUIRE (store->Execute ( + "SELECT memory_id FROM cortext_sparse_route_nodes") + .size () + <= operations::sparse_retrieval_route_sqlite_internal:: + DefaultParameters () + .backfill_batch_size); + + // Construction progress is durable, but the incomplete generation remains + // invisible to the normal retrieval path after restart. + state.sqlite_sparse_route_backfill.reset (); + REQUIRE_FALSE ( + operations::sparse_retrieval_route_sqlite_internal::Route::Open ( + *store, kEmbeddingDim, parameters)); + state.sqlite_sparse_route_backfill + = operations::sparse_retrieval_route_sqlite_internal::Route:: + OpenOrBeginBuild (*store, kEmbeddingDim, parameters); + REQUIRE (state.sqlite_sparse_route_backfill); + REQUIRE (state.sqlite_sparse_route_backfill->BuildCursor () + == static_cast (parameters.backfill_batch_size)); + + Eigen::VectorXf revised = Eigen::VectorXf::Zero (kEmbeddingDim); + revised[0] = 1.0f; + state.current_entries.front ().embedding = revised; + REQUIRE (state.sqlite_sparse_route_backfill->Upsert (1, revised)); + REQUIRE (store->Execute ( + "SELECT singleton FROM cortext_sparse_route_build") + .size () + == 1); + REQUIRE (store->Execute ( + "SELECT memory_id FROM cortext_sparse_route_dirty") + .size () + == 1); + state.sqlite_sparse_route_backfill.reset (); + state.sqlite_sparse_route_backfill + = operations::sparse_retrieval_route_sqlite_internal::Route:: + OpenOrBeginBuild (*store, kEmbeddingDim, parameters); + REQUIRE (state.sqlite_sparse_route_backfill); + REQUIRE (state.sqlite_sparse_route_backfill->BuildCursor () + == static_cast (parameters.backfill_batch_size)); + REQUIRE (cache::AdvanceSQLiteSparseRouteBackfill (state, *store)); + REQUIRE (state.sqlite_sparse_route_backfill->BuildCursor () + == static_cast (parameters.backfill_batch_size * 2)); + REQUIRE (store->Execute ( + "SELECT singleton FROM cortext_sparse_route_build") + .size () + == 1); + REQUIRE (store->Execute ( + "SELECT memory_id FROM cortext_sparse_route_dirty") + .empty ()); + + std::size_t advances = 2; + while (!state.sqlite_sparse_route && advances++ < 20) + REQUIRE (cache::AdvanceSQLiteSparseRouteBackfill (state, *store)); + REQUIRE (state.sqlite_sparse_route); + REQUIRE_FALSE (state.sqlite_sparse_route_backfill); + REQUIRE (state.sqlite_sparse_route->ActiveCount () == kEntryCount); + REQUIRE (store->Execute ( + "SELECT singleton FROM cortext_sparse_route_build") + .empty ()); + const auto topology = store->Execute ( + "SELECT MAX(level) AS max_level, " + "SUM(CASE WHEN level > 0 THEN 1 ELSE 0 END) AS upper_nodes " + "FROM cortext_sparse_route_nodes WHERE active = 1"); + REQUIRE (topology.size () == 1); + REQUIRE (store::AnyToLongLong (topology.front ().at ("max_level")) + .value_or (0) + > 0); + REQUIRE (store::AnyToLongLong (topology.front ().at ("upper_nodes")) + .value_or (0) + > 0); + + auto restarted + = operations::sparse_retrieval_route_sqlite_internal::Route::Open ( + *store, kEmbeddingDim, parameters); + REQUIRE (restarted); + REQUIRE (restarted->RestartRowsLoaded () == 1); + const auto revised_result + = restarted->Search (revised, parameters.route_capacity); + REQUIRE (revised_result); + REQUIRE_FALSE (revised_result->empty ()); + + const auto activated = restarted->SearchActivated (revised); + REQUIRE (activated); + REQUIRE (activated->size () >= revised_result->size ()); + REQUIRE (activated->size () == parameters.activation_identity_target); + REQUIRE (activated->size () + <= parameters.activation_identity_target); + REQUIRE (restarted->LastSearchNodeRows () >= activated->size ()); + REQUIRE (restarted->LastSearchNodeRows () + <= parameters.search_node_budget); + REQUIRE (restarted->LastSearchDistanceEvaluations () > 0); + REQUIRE (restarted->LastSearchDistanceEvaluations () + <= restarted->LastSearchNodeRows () + restarted->DeltaSize ()); + REQUIRE (revised_result->front () == 1); + for (const long long memory_id : { 1LL, 129LL, 777LL, 1300LL }) + { + const auto result = restarted->Search ( + state.current_entries[static_cast (memory_id - 1)] + .embedding, + parameters.route_capacity); + REQUIRE (result); + REQUIRE_FALSE (result->empty ()); + REQUIRE (result->front () == memory_id); + REQUIRE (restarted->LastSearchNodeRows () + <= parameters.search_node_budget); + } +} + +TEST_CASE ("SQLite sparse route starts backfill at the knob-derived headroom " + "watermark", + "[operations][graph][retrieval][hnsw][sqlite][backfill][knobs]") +{ + namespace cache + = operations::historical_surface_search_cache_internal; + const auto parameters + = operations::sparse_retrieval_route_sqlite_internal:: + DefaultParameters (); + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + cortext::testing::InitializeCoreSchema (*store); + + cache::State state; + state.embedding_dim = kEmbeddingDim; + state.sparse_route_parameters = parameters; + const std::size_t start_size + = parameters.route_capacity - parameters.backfill_batch_size; + auto append_entry = [&] (long long memory_id) { + Eigen::VectorXf embedding = Eigen::VectorXf::Zero (kEmbeddingDim); + embedding[static_cast (memory_id % kEmbeddingDim)] = 1.0f; + const std::size_t index = state.current_entries.size (); + state.current_entries.emplace_back ( + memory_id, memory_id, 1000 + memory_id, "LONG_TERM", "opaque", + std::move (embedding), memory_id); + state.current_memory_index.emplace (memory_id, index); + state.current_memory_order.emplace (memory_id, index); + }; + for (std::size_t index = 1; index < start_size; ++index) + append_entry (static_cast (index)); + + REQUIRE (cache::AdvanceSQLiteSparseRouteBackfill (state, *store)); + REQUIRE_FALSE (state.sqlite_sparse_route_backfill); + + append_entry (static_cast (start_size)); + REQUIRE (cache::AdvanceSQLiteSparseRouteBackfill (state, *store)); + REQUIRE (state.sqlite_sparse_route_backfill); + REQUIRE (state.sqlite_sparse_route_backfill_last_sealed_rows + <= parameters.backfill_batch_size); + REQUIRE (state.sqlite_sparse_route_backfill->ActiveCount () + <= static_cast (parameters.route_capacity + + parameters.backfill_batch_size)); +} + +TEST_CASE ("SQLite sparse route keeps active live mutations in a bounded " + "durable journal", + "[operations][graph][retrieval][hnsw][sqlite][backfill]" + "[regression]") +{ + namespace cache + = operations::historical_surface_search_cache_internal; + namespace sqlite_route + = operations::sparse_retrieval_route_sqlite_internal; + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + cortext::testing::InitializeCoreSchema (*store); + const auto parameters = sqlite_route::DeriveParameters (0.0, 0.0, 0.0); + + cache::State state; + state.embedding_dim = kEmbeddingDim; + state.sparse_route_parameters = parameters; + std::vector> entries; + entries.reserve (600); + for (long long memory_id = 1; memory_id <= 600; ++memory_id) + { + auto embedding = VectorWithCosineToDim0 ( + 0.10f + static_cast (memory_id - 1) * 0.001f); + const std::size_t index = state.current_entries.size (); + state.current_entries.emplace_back ( + memory_id, memory_id, 1000 + memory_id, "LONG_TERM", "opaque", + embedding, memory_id); + state.current_memory_index.emplace (memory_id, index); + state.current_memory_order.emplace (memory_id, index); + entries.emplace_back (memory_id, std::move (embedding)); + } + auto hnsw = operations::sparse_retrieval_route_internal::Route::Create ( + kEmbeddingDim, entries, parameters.hnsw); + REQUIRE (hnsw); + auto route = sqlite_route::Route::Create ( + *store, kEmbeddingDim, entries, *hnsw, parameters); + REQUIRE (route); + + for (long long memory_id = 1; memory_id <= 400; ++memory_id) + { + Eigen::VectorXf revised = UnitVec ( + static_cast (memory_id % kEmbeddingDim)); + state.current_entries[static_cast (memory_id - 1)] + .embedding = revised; + REQUIRE (route->Upsert (memory_id, revised)); + } + REQUIRE (route->DeltaSize () == 0); + REQUIRE (route->HasDirtyMemoryIds ()); + const auto first_slice = route->DirtyMemoryIds (parameters.route_capacity); + REQUIRE (first_slice); + REQUIRE (first_slice->size () == parameters.route_capacity); + REQUIRE_FALSE ( + cache::StageSQLiteSparseRouteDirtyForSearch (state, *route)); + REQUIRE (route->DeltaSize () == 0); + + std::size_t remaining = 400; + while (remaining > parameters.route_capacity) + { + REQUIRE_FALSE ( + cache::StageSQLiteSparseRouteDirtyForSearch (state, *route)); + REQUIRE (cache::ReconcileSQLiteSparseRoute ( + state, *store, route, + std::shared_ptr< + operations::sparse_retrieval_route_internal::Route>{})); + remaining -= parameters.route_capacity; + REQUIRE (store->Execute ( + "SELECT memory_id FROM cortext_sparse_route_dirty") + .size () + == remaining); + } + const auto staged_remainder + = cache::StageSQLiteSparseRouteDirtyForSearch (state, *route); + REQUIRE (staged_remainder == remaining); + REQUIRE (route->DeltaSize () == remaining); + REQUIRE (route->Search (UnitVec (0), parameters.route_capacity)); + REQUIRE (cache::ReconcileSQLiteSparseRoute ( + state, *store, route, + std::shared_ptr< + operations::sparse_retrieval_route_internal::Route>{})); + REQUIRE (route->DeltaSize () == 0); + REQUIRE_FALSE (route->HasDirtyMemoryIds ()); +} + +TEST_CASE ("SQLite sparse route drains live build mutations in knob-bounded " + "slices", + "[operations][graph][retrieval][hnsw][sqlite][backfill]" + "[regression]") +{ + namespace cache + = operations::historical_surface_search_cache_internal; + namespace sqlite_route + = operations::sparse_retrieval_route_sqlite_internal; + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + cortext::testing::InitializeCoreSchema (*store); + + cache::State state; + state.embedding_dim = kEmbeddingDim; + state.sparse_route_parameters + = sqlite_route::DeriveParameters (0.0, 0.0, 0.0); + constexpr long long kEntryCount = 800; + state.current_entries.reserve (kEntryCount); + for (long long memory_id = 1; memory_id <= kEntryCount; ++memory_id) + { + Eigen::VectorXf embedding (kEmbeddingDim); + for (Eigen::Index dimension = 0; dimension < embedding.size (); + ++dimension) + embedding[dimension] = std::cos ( + static_cast (memory_id * (dimension + 11)) * 0.004f); + embedding.normalize (); + const std::size_t index = state.current_entries.size (); + state.current_entries.emplace_back ( + memory_id, memory_id, 1000 + memory_id, "LONG_TERM", "opaque", + std::move (embedding), memory_id); + state.current_memory_index.emplace (memory_id, index); + state.current_memory_order.emplace (memory_id, index); + } + + REQUIRE (cache::AdvanceSQLiteSparseRouteBackfill (state, *store)); + REQUIRE (state.sqlite_sparse_route_backfill); + auto &build = state.sqlite_sparse_route_backfill; + const std::size_t backfill_batch + = state.sparse_route_parameters.backfill_batch_size; + REQUIRE (build->BuildCursor () + == static_cast (backfill_batch)); + constexpr std::size_t kDirtyCount = 700; + for (long long memory_id = 1; + memory_id <= static_cast (kDirtyCount); ++memory_id) + REQUIRE (build->Upsert ( + memory_id, + state.current_entries[static_cast (memory_id - 1)] + .embedding)); + REQUIRE (build->DeltaSize () == 0); + REQUIRE (store->Execute ( + "SELECT memory_id FROM cortext_sparse_route_dirty") + .size () + == kDirtyCount); + const auto bounded_dirty = build->DirtyMemoryIds ( + state.sparse_route_parameters.route_capacity); + REQUIRE (bounded_dirty); + REQUIRE (bounded_dirty->size () + == state.sparse_route_parameters.route_capacity); + REQUIRE (build->HasDirtyMemoryIds ()); + + REQUIRE (cache::AdvanceSQLiteSparseRouteBackfill (state, *store)); + REQUIRE (state.sqlite_sparse_route_backfill_failure_count == 0); + REQUIRE (build->DeltaSize () == 0); + REQUIRE (build->BuildCursor () + == static_cast (backfill_batch * 2)); + REQUIRE (state.sqlite_sparse_route_backfill_last_sealed_rows + == backfill_batch); + const std::size_t expected_remaining_dirty + = kDirtyCount - state.sparse_route_parameters.route_capacity; + REQUIRE (store->Execute ( + "SELECT memory_id FROM cortext_sparse_route_dirty") + .size () + == expected_remaining_dirty); + REQUIRE (build->DirtyMemoryIds ( + state.sparse_route_parameters.route_capacity) + ->size () + == state.sparse_route_parameters.route_capacity); + + std::size_t remaining_dirty = expected_remaining_dirty; + std::size_t drain_count = 0; + while (remaining_dirty > 0 && drain_count++ < 10) + { + const bool advanced + = cache::AdvanceSQLiteSparseRouteBackfill (state, *store); + CAPTURE (drain_count, build->LastSealFailureCode (), + build->LastSearchNodeRows (), build->DeltaSize (), + build->ActivationEntryMemoryId (), + build->ActivationSearchNodeBudget (), + state.sqlite_sparse_route_backfill_failure_code); + REQUIRE (advanced); + REQUIRE (state.sqlite_sparse_route_backfill_failure_count == 0); + REQUIRE (build->DeltaSize () == 0); + const std::size_t next_remaining + = store->Execute ( + "SELECT memory_id FROM cortext_sparse_route_dirty") + .size (); + REQUIRE (next_remaining < remaining_dirty); + REQUIRE (remaining_dirty - next_remaining + <= state.sparse_route_parameters.route_capacity + + state.sparse_route_parameters.backfill_batch_size); + remaining_dirty = next_remaining; + } + REQUIRE (remaining_dirty == 0); +} + +TEST_CASE ("SQLite sparse route work budgets derive from every knob", + "[operations][graph][retrieval][hnsw][sqlite][knobs]") +{ + namespace sqlite_route + = operations::sparse_retrieval_route_sqlite_internal; + for (const double focus : { 0.0, 0.5, 1.0 }) + for (const double sensitivity : { 0.0, 0.5, 1.0 }) + for (const double stability : { 0.0, 0.5, 1.0 }) + { + CAPTURE (focus, sensitivity, stability); + const auto parameters = sqlite_route::DeriveParameters ( + focus, sensitivity, stability); + REQUIRE ( + parameters.route_capacity + == static_cast ( + operations::sparse_retrieval_knobs_internal::RouteCapacity ( + focus, sensitivity, stability))); + REQUIRE ( + parameters.backfill_batch_size + == static_cast ( + operations::sparse_retrieval_knobs_internal:: + BackfillBatchSize ( + focus, sensitivity, stability))); + REQUIRE ( + operations::sparse_retrieval_knobs_internal:: + HydrationFallbackSignalLimit ( + focus, sensitivity, stability) + == static_cast (parameters.backfill_batch_size)); + REQUIRE (parameters.route_bootstrap_limit + == parameters.route_capacity * 2); + REQUIRE (parameters.activation_identity_target + == parameters.route_capacity * 2 + + parameters.backfill_batch_size * 2); + REQUIRE (parameters.activation_snapshot_capacity + == parameters.activation_identity_target); + REQUIRE (parameters.total_query_row_budget + == parameters.search_node_budget + + parameters.activation_snapshot_capacity); + REQUIRE (parameters.search_node_budget + == static_cast ( + operations::sparse_retrieval_knobs_internal:: + RetrievalSawtoothPeak ( + focus, sensitivity, stability))); + REQUIRE (parameters.activation_search_node_budget_min + == static_cast ( + operations::sparse_retrieval_knobs_internal:: + RetrievalSawtoothFloor ( + focus, sensitivity, stability))); + REQUIRE (parameters.activation_search_node_budget_step + == parameters.reciprocal_update_count); + REQUIRE (parameters.search_expansion_batch + == std::max ( + 8, parameters.backfill_batch_size / 4)); + REQUIRE ( + operations::sparse_retrieval_knobs_internal::OrdinarySealBatch ( + focus, sensitivity, stability) + == static_cast (parameters.backfill_batch_size + - parameters.search_expansion_batch)); + REQUIRE (parameters.search_ef == parameters.search_node_budget); + REQUIRE (parameters.activation_search_ef_min + == parameters.activation_search_node_budget_min); + REQUIRE (parameters.activation_search_ef_step + == parameters.reciprocal_update_count); + REQUIRE (parameters.shadow_node_capacity + == parameters.route_capacity * 24); + REQUIRE (parameters.backfill_search_node_budget + == parameters.route_capacity + + parameters.backfill_batch_size); + REQUIRE (parameters.backfill_search_ef + == parameters.backfill_batch_size * 2); + REQUIRE ( + parameters.row_addressed_neighbor_count + == static_cast ( + operations::sparse_retrieval_knobs_internal:: + GraphNeighborCount ( + focus, sensitivity, stability))); + REQUIRE ( + parameters.row_addressed_level_zero_links + == static_cast ( + operations::sparse_retrieval_knobs_internal:: + GraphLevelZeroLinks ( + focus, sensitivity, stability))); + REQUIRE ( + parameters.family_exact_comparison_limit + == static_cast ( + operations::sparse_retrieval_knobs_internal:: + FamilyExactComparisonLimit ( + focus, sensitivity, stability))); + REQUIRE ( + parameters.maximum_level + == static_cast ( + operations::sparse_retrieval_knobs_internal::MaximumLevel ( + focus, sensitivity, stability))); + REQUIRE ( + parameters.reciprocal_update_count + == static_cast ( + operations::sparse_retrieval_knobs_internal:: + ReciprocalUpdateCount ( + focus, sensitivity, stability))); + REQUIRE (parameters.hnsw.minimum_capacity + == parameters.route_bootstrap_limit); + REQUIRE (parameters.hnsw.graph_neighbor_count + == parameters.row_addressed_neighbor_count); + REQUIRE ( + parameters.hnsw.construction_effort + == static_cast ( + operations::sparse_retrieval_knobs_internal:: + ConstructionEffort ( + focus, sensitivity, stability))); + REQUIRE ( + parameters.hnsw.query_effort + == static_cast ( + operations::sparse_retrieval_knobs_internal::QueryEffort ( + focus, sensitivity, stability))); + { + cortext::testing::ScopedEnvVar envelope ( + "CORTEXT_EXPERIMENT_SQLITE_SPARSE_NODE_ENVELOPE", "6"); + const auto selected = sqlite_route::DeriveParameters ( + focus, sensitivity, stability); + REQUIRE (selected.search_node_budget + == parameters.route_capacity * 6); + REQUIRE (selected.activation_search_node_budget_min + == parameters.route_capacity * 6); + } + } + + const auto midpoint = sqlite_route::DeriveParameters (0.5, 0.5, 0.5); + REQUIRE (midpoint.route_capacity == 512); + REQUIRE (midpoint.activation_identity_target == 1280); + REQUIRE (midpoint.backfill_batch_size == 128); + REQUIRE (midpoint.row_addressed_neighbor_count == 64); + REQUIRE (midpoint.row_addressed_level_zero_links == 128); + REQUIRE (midpoint.family_exact_comparison_limit == 1024); + REQUIRE (midpoint.maximum_level == 9); + REQUIRE (midpoint.reciprocal_update_count == 8); + REQUIRE (midpoint.hnsw.construction_effort == 200); + REQUIRE (midpoint.hnsw.query_effort == 1280); + + for (const auto &[selector, expected] : + std::vector>{ + { "1", midpoint.route_capacity }, + { "2", midpoint.activation_identity_target }, + { "3", midpoint.route_capacity + midpoint.backfill_batch_size }, + { "4", midpoint.route_capacity * 2 }, + { "5", midpoint.route_capacity * 5 }, + { "6", midpoint.route_capacity * 6 }, + { "8", midpoint.route_capacity * 4 }, + { "18", midpoint.route_capacity * 4 + + midpoint.reciprocal_update_count }, + { "19", midpoint.route_capacity * 4 + + midpoint.reciprocal_update_count }, + { "10", midpoint.route_capacity * 10 }, + { "12", midpoint.route_capacity * 12 }, + { "16", midpoint.route_capacity * 16 }, + }) + { + CAPTURE (selector, expected); + cortext::testing::ScopedEnvVar envelope ( + "CORTEXT_EXPERIMENT_SQLITE_SPARSE_NODE_ENVELOPE", selector); + const auto selected = sqlite_route::DeriveParameters (0.5, 0.5, 0.5); + REQUIRE (selected.search_node_budget == expected); + REQUIRE (selected.activation_search_node_budget_min == expected); + REQUIRE (selected.activation_identity_target == 1280); + const std::size_t expected_effort + = selector == "19" ? expected : selected.route_capacity * 5; + REQUIRE (selected.search_ef == expected_effort); + REQUIRE (selected.activation_search_ef_min + == expected_effort); + REQUIRE ( + selected.total_query_row_budget + == (selector == "19" + ? expected + selected.activation_identity_target + : selected.route_capacity * 5 + + selected.activation_identity_target)); + REQUIRE (selected.backfill_search_node_budget + == selected.route_capacity + selected.backfill_batch_size); + } + + { + cortext::testing::ScopedEnvVar envelope ( + "CORTEXT_EXPERIMENT_SQLITE_SPARSE_NODE_ENVELOPE", "20"); + const auto selected = sqlite_route::DeriveParameters (0.5, 0.5, 0.5); + const std::size_t minimum + = selected.route_capacity * 4 + selected.reciprocal_update_count; + REQUIRE (selected.search_node_budget == selected.route_capacity * 5); + REQUIRE (selected.search_ef == selected.route_capacity * 5); + REQUIRE (selected.activation_search_node_budget_min == minimum); + REQUIRE (selected.activation_search_ef_min == minimum); + REQUIRE (selected.activation_search_node_budget_step + == selected.reciprocal_update_count); + REQUIRE (selected.activation_search_ef_step + == selected.reciprocal_update_count); + } + + { + cortext::testing::ScopedEnvVar envelope ( + "CORTEXT_EXPERIMENT_SQLITE_SPARSE_NODE_ENVELOPE", "7"); + const auto ignored = sqlite_route::DeriveParameters (0.5, 0.5, 0.5); + REQUIRE (ignored.search_node_budget == ignored.route_capacity * 5); + REQUIRE (ignored.activation_search_node_budget_min + == ignored.route_capacity * 5); + } + + const auto first_seal_rows = [] (double focus, double sensitivity, + double stability) { + namespace cache + = operations::historical_surface_search_cache_internal; + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + cortext::testing::InitializeCoreSchema (*store); + cache::State state; + state.embedding_dim = kEmbeddingDim; + state.sparse_route_parameters = sqlite_route::DeriveParameters ( + focus, sensitivity, stability); + constexpr long long kEntryCount = 800; + state.current_entries.reserve (kEntryCount); + for (long long memory_id = 1; memory_id <= kEntryCount; ++memory_id) + { + Eigen::VectorXf embedding (kEmbeddingDim); + for (Eigen::Index dimension = 0; dimension < embedding.size (); + ++dimension) + embedding[dimension] = std::sin ( + static_cast (memory_id * (dimension + 5)) * 0.009f); + embedding.normalize (); + const std::size_t index = state.current_entries.size (); + state.current_entries.emplace_back ( + memory_id, memory_id, 1000 + memory_id, "LONG_TERM", + "opaque/" + std::to_string (memory_id % 4), + std::move (embedding), memory_id); + state.current_memory_index.emplace (memory_id, index); + state.current_memory_order.emplace (memory_id, index); + } + REQUIRE (cache::AdvanceSQLiteSparseRouteBackfill (state, *store)); + return state.sqlite_sparse_route_backfill_last_sealed_rows; + }; + REQUIRE (first_seal_rows (0.0, 0.0, 0.0) == 64); + REQUIRE (first_seal_rows (0.5, 0.5, 0.5) == 128); + REQUIRE (first_seal_rows (1.0, 1.0, 1.0) == 192); + + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + cortext::testing::InitializeCoreSchema (*store); + std::vector> route_entries; + route_entries.reserve (1300); + for (long long memory_id = 1; memory_id <= 1300; ++memory_id) + { + Eigen::VectorXf embedding (kEmbeddingDim); + for (Eigen::Index dimension = 0; dimension < embedding.size (); + ++dimension) + embedding[dimension] = std::sin ( + static_cast (memory_id * (dimension + 7)) * 0.005f); + embedding.normalize (); + route_entries.emplace_back (memory_id, std::move (embedding)); + } + const auto low_parameters = sqlite_route::DeriveParameters (0.0, 0.0, 0.0); + auto hnsw = operations::sparse_retrieval_route_internal::Route::Create ( + kEmbeddingDim, route_entries, low_parameters.hnsw); + REQUIRE (hnsw); + auto sqlite = sqlite_route::Route::Create ( + *store, kEmbeddingDim, route_entries, *hnsw, low_parameters); + REQUIRE (sqlite); + for (std::size_t query = 0; query < 64; ++query) + { + const auto result = sqlite->Search ( + route_entries[(query * 19) % route_entries.size ()].second, + low_parameters.route_capacity); + REQUIRE (result); + REQUIRE (sqlite->LastSearchNodeRows () + <= low_parameters.search_node_budget); + } +} + +TEST_CASE ("SQLite sparse route backfill survives an authoritative cache " + "refresh", + "[operations][graph][retrieval][hnsw][sqlite][backfill]" + "[regression]") +{ + namespace cache + = operations::historical_surface_search_cache_internal; + const auto parameters + = operations::sparse_retrieval_route_sqlite_internal:: + DefaultParameters (); + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + cortext::testing::InitializeCoreSchema (*store); + + ProcessorContext pctx; + std::vector current_entries; + constexpr long long kEntryCount = 600; + current_entries.reserve (kEntryCount); + for (long long memory_id = 1; memory_id <= kEntryCount; ++memory_id) + { + Eigen::VectorXf embedding (kEmbeddingDim); + for (Eigen::Index dimension = 0; dimension < embedding.size (); + ++dimension) + embedding[dimension] = std::cos ( + static_cast (memory_id * (dimension + 3)) * 0.007f); + embedding.normalize (); + current_entries.emplace_back ( + memory_id, memory_id, 1000 + memory_id, "LONG_TERM", + "opaque/" + std::to_string (memory_id % 4), + std::move (embedding), memory_id); + } + + REQUIRE (cache::Reset (pctx, {}, std::move (current_entries))); + cache::SetSparseRouteParameters (pctx, parameters); + cache::SetCurrentSurfaceDatabaseCurrent (pctx, true); + cache::SetProcessorSurfaceComplete (pctx, true); + auto state = cache::FindMutable (pctx); + REQUIRE (state); + REQUIRE (cache::AdvanceSQLiteSparseRouteBackfill (*state, *store)); + const auto build = state->sqlite_sparse_route_backfill; + REQUIRE (build); + REQUIRE (build->BuildCursor () + == static_cast (parameters.backfill_batch_size)); + REQUIRE (cache::IncrementalSparseRouteSealReady (*state, true)); + + auto refreshed_entries = state->current_entries; + REQUIRE (cache::Reset (pctx, {}, std::move (refreshed_entries))); + state = cache::FindMutable (pctx); + REQUIRE (state); + REQUIRE (state->current_surface_database_current); + REQUIRE (state->processor_surface_complete); + REQUIRE (state->sqlite_sparse_route_backfill == build); + REQUIRE (state->sqlite_sparse_route_backfill->BuildCursor () + == static_cast (parameters.backfill_batch_size)); + REQUIRE (cache::IncrementalSparseRouteSealReady (*state, true)); + + REQUIRE (cache::AdvanceSQLiteSparseRouteBackfill (*state, *store)); + REQUIRE (state->sqlite_sparse_route_backfill); + REQUIRE (state->sqlite_sparse_route_backfill->BuildCursor () + == static_cast (parameters.backfill_batch_size * 2)); + const auto generations = store->Execute ( + "SELECT COUNT(DISTINCT generation) AS generation_count, " + "MIN(generation) AS min_generation, MAX(generation) AS max_generation " + "FROM cortext_sparse_route_nodes"); + REQUIRE (generations.size () == 1); + REQUIRE (store::AnyToLongLong ( + generations.front ().at ("generation_count")) + .value_or (0) + == 1); + REQUIRE (store::AnyToLongLong ( + generations.front ().at ("min_generation")) + .value_or (0) + == 1); + REQUIRE (store::AnyToLongLong ( + generations.front ().at ("max_generation")) + .value_or (0) + == 1); + cache::Erase (pctx); } TEST_CASE ("Graph retrieval soundly collapses cosine-near families before KNN cap", @@ -1129,8 +2773,15 @@ TEST_CASE ("Graph retrieval soundly collapses cosine-near families before KNN ca REQUIRE (std::find (out.candidate_memory_ids.begin (), out.candidate_memory_ids.end (), kTargetMemoryId) != out.candidate_memory_ids.end ()); + const auto exact_comparison_count + = operations::retrieval_trace::GetLastFamilyExactComparisonCount (); + REQUIRE (exact_comparison_count > 0); REQUIRE ( - operations::retrieval_trace::GetLastFamilyExactComparisonCount () > 0); + exact_comparison_count + <= static_cast ( + operations::sparse_retrieval_knobs_internal:: + FamilyExactComparisonLimit ( + cfg.focus, cfg.sensitivity, cfg.stability))); } TEST_CASE ("Graph retrieval bounds exact family checks on diverse embeddings", diff --git a/tests/operations_memory_storage.test.cpp b/tests/operations_memory_storage.test.cpp index 7e65b271..1cf59e81 100644 --- a/tests/operations_memory_storage.test.cpp +++ b/tests/operations_memory_storage.test.cpp @@ -11,6 +11,7 @@ #include #include #include "../src/operations/constructive_recall_internal.hpp" +#include "../src/operations/active_signal_embedding_ring_internal.hpp" #include "../src/operations/execution_cache_sidecar_internal.hpp" #include "../src/operations/historical_surface_search_cache_internal.hpp" #include @@ -23,6 +24,7 @@ #include #include #include +#include using namespace cortext; using cortext::operations::MemoryStorage; @@ -217,6 +219,9 @@ TEST_CASE ("MemoryStorage uses default SqlObjectStore inside processor " REQUIRE (out.operation_ms.at ( "MemoryStorage.supersession_historical_rows_visited") == 0.0); + REQUIRE (out.operation_ms.at ( + "MemoryStorage.supersession_rows_visited_activity") + == 0.0); REQUIRE (out.operation_ms.at ( "MemoryStorage.supersession_sql_fallback_count") == 3.0); @@ -524,6 +529,193 @@ TEST_CASE ("MemoryStorage stores memory even when no payload", REQUIRE (sig_blob_id.empty ()); } +TEST_CASE ("MemoryStorage keeps exact signal vectors out of the global route", + "[operations][memory_storage][embedding_population][modality]") +{ + ScopedTempDb db; + Store *store = db.get (); + REQUIRE (store != nullptr); + + SignalProcessor::Config cfg; + cortext::testing::RequireEncoder (cfg); + ProcessorContext pctx; + MemoryStorage op; + + const std::vector sources = { + "opaque/source/alpha", "opaque/source/beta" + }; + const std::vector modalities = { "text", "audio", "image" }; + std::vector expected_signal_embeddings; + std::vector expected_memory_embedding_ids; + + for (std::size_t source_index = 0; source_index < sources.size (); + ++source_index) + { + Signal signal; + signal.embedding = UnitVec (static_cast (source_index)); + signal.timestamp = 1000 + source_index * 100; + signal.source_id = sources[source_index]; + signal.modality = modalities.front (); + signal.mimetype = "text/plain"; + + AccumulatorState acc; + acc.mu_acc = signal.embedding; + acc.c_t = signal.embedding; + acc.n_signals = static_cast (modalities.size ()); + acc.s_sum = 1.8; + acc.s_max = 0.8; + acc.t_start = signal.timestamp; + for (std::size_t modality_index = 0; + modality_index < modalities.size (); ++modality_index) + { + SignalRecord rec; + rec.embedding = UnitVec ( + static_cast (source_index * modalities.size () + + modality_index)); + rec.timestamp = signal.timestamp + modality_index; + rec.modality = modalities[modality_index]; + rec.mime = modalities[modality_index] == "text" + ? "text/plain" + : "application/octet-stream"; + rec.score = 0.6; + rec.serial_position = static_cast (modality_index); + expected_signal_embeddings.push_back (rec.embedding); + acc.signals.push_back (std::move (rec)); + } + pctx.accumulator_states[signal.source_id] = std::move (acc); + + OperationContext ctx (signal, pctx, cfg, store); + ctx.SetAccumulatorWriteDecision (true); + ctx.SetRepresentativeEmbedding (signal.embedding); + auto tx = store->Begin (); + op.Execute (ctx, *tx); + tx->Commit (); + + REQUIRE (ctx.GetStoredEmbeddingId ().has_value ()); + expected_memory_embedding_ids.push_back (*ctx.GetStoredEmbeddingId ()); + } + + const auto embedding_count_rows + = store->Execute ("SELECT COUNT(*) AS n FROM embeddings"); + REQUIRE (embedding_count_rows.size () == 1); + REQUIRE (AnyToLongLong (embedding_count_rows[0].at ("n")) + == static_cast (sources.size ())); + + const auto signal_rows = store->Execute ( + "SELECT s.source_id, s.embedding_id, a.embedding, a.capacity " + "FROM signals s " + "LEFT JOIN cortext_active_signal_embeddings a " + "ON a.signal_id = s.signal_id " + "ORDER BY s.signal_id"); + REQUIRE (signal_rows.size () == expected_signal_embeddings.size ()); + for (std::size_t index = 0; index < signal_rows.size (); ++index) + { + const std::size_t source_index = index / modalities.size (); + REQUIRE (std::any_cast ( + signal_rows[index].at ("source_id")) + == sources[source_index]); + REQUIRE (AnyToLongLong (signal_rows[index].at ("embedding_id")) + == expected_memory_embedding_ids[source_index]); + REQUIRE (AnyToLongLong (signal_rows[index].at ("capacity")) + == operations::active_signal_embedding_ring_internal::Capacity ( + cfg.focus, cfg.sensitivity, cfg.stability)); + const auto bytes = BlobFromAny (signal_rows[index].at ("embedding")); + REQUIRE (bytes.size () + == static_cast (kEmbeddingDim) + * sizeof (float)); + Eigen::VectorXf restored (kEmbeddingDim); + std::memcpy (restored.data (), bytes.data (), bytes.size ()); + REQUIRE (restored.isApprox (expected_signal_embeddings[index], 0.0f)); + } +} + +TEST_CASE ("Active signal embedding ring obeys knob-derived capacities", + "[operations][memory_storage][embedding_population][knobs]") +{ + namespace ring = operations::active_signal_embedding_ring_internal; + const std::vector> points = { + { 0.5, 0.5, 0.5 }, { 0.0, 0.0, 0.0 }, { 1.0, 1.0, 1.0 }, + { 0.0, 0.5, 0.5 }, { 1.0, 0.5, 0.5 }, { 0.5, 0.0, 0.5 }, + { 0.5, 1.0, 0.5 }, { 0.5, 0.5, 0.0 }, { 0.5, 0.5, 1.0 } + }; + + for (const auto &[focus, sensitivity, stability] : points) + { + auto store = SQLiteStore::Create (":memory:"); + cortext::testing::InitializeCoreSchema (*store); + const int capacity = ring::Capacity (focus, sensitivity, stability); + REQUIRE (capacity + == operations::sparse_retrieval_knobs_internal:: + BackfillBatchSize (focus, sensitivity, stability)); + + auto tx = store->Begin (); + for (long long signal_id = 1; signal_id <= capacity + 3; ++signal_id) + { + tx->Execute ( + "INSERT INTO signals(signal_id, source_id, embedding_id, " + "timestamp, modality, created_at) VALUES (?, ?, 1, ?, ?, ?)", + { signal_id, + signal_id % 2 == 0 ? std::string ("opaque/even") + : std::string ("opaque/odd"), + signal_id, + signal_id % 3 == 0 ? std::string ("image") + : (signal_id % 3 == 1 + ? std::string ("text") + : std::string ("audio")), + signal_id }); + std::vector embedding (kEmbeddingDim, 0.0f); + embedding[static_cast (signal_id) % kEmbeddingDim] + = 1.0f; + ring::Upsert (*tx, signal_id, embedding, signal_id, focus, + sensitivity, stability); + } + tx->Commit (); + + const auto rows = store->Execute ( + "SELECT COUNT(*) AS n, MIN(signal_id) AS first_id, " + "MAX(signal_id) AS last_id, MIN(capacity) AS min_capacity, " + "MAX(capacity) AS max_capacity " + "FROM cortext_active_signal_embeddings"); + REQUIRE (rows.size () == 1); + REQUIRE (AnyToLongLong (rows[0].at ("n")) == capacity); + REQUIRE (AnyToLongLong (rows[0].at ("first_id")) == 4); + REQUIRE (AnyToLongLong (rows[0].at ("last_id")) == capacity + 3); + REQUIRE (AnyToLongLong (rows[0].at ("min_capacity")) == capacity); + REQUIRE (AnyToLongLong (rows[0].at ("max_capacity")) == capacity); + } + + auto resized_store = SQLiteStore::Create (":memory:"); + cortext::testing::InitializeCoreSchema (*resized_store); + auto resized_tx = resized_store->Begin (); + std::vector embedding (kEmbeddingDim, 0.0f); + embedding[0] = 1.0f; + for (long long signal_id = 1; signal_id <= 131; ++signal_id) + { + resized_tx->Execute ( + "INSERT INTO signals(signal_id, source_id, embedding_id, timestamp, " + "modality, created_at) VALUES (?, 'opaque/resize', 1, ?, 'text', ?)", + { signal_id, signal_id, signal_id }); + if (signal_id <= 130) + ring::Upsert (*resized_tx, signal_id, embedding, signal_id, 0.5, 0.5, + 0.5); + else + ring::Upsert (*resized_tx, signal_id, embedding, signal_id, 0.0, 0.0, + 0.0); + } + resized_tx->Commit (); + const auto resized_rows = resized_store->Execute ( + "SELECT COUNT(*) AS n, MIN(signal_id) AS first_id, " + "MAX(signal_id) AS last_id, MIN(capacity) AS min_capacity, " + "MAX(capacity) AS max_capacity " + "FROM cortext_active_signal_embeddings"); + REQUIRE (resized_rows.size () == 1); + REQUIRE (AnyToLongLong (resized_rows[0].at ("n")) == 64); + REQUIRE (AnyToLongLong (resized_rows[0].at ("first_id")) == 68); + REQUIRE (AnyToLongLong (resized_rows[0].at ("last_id")) == 131); + REQUIRE (AnyToLongLong (resized_rows[0].at ("min_capacity")) == 64); + REQUIRE (AnyToLongLong (resized_rows[0].at ("max_capacity")) == 64); +} + TEST_CASE ("MemoryStorage writes modality-agnostic supersedes edges", "[operations][memory_storage][supersession][fanout_cache]") { @@ -771,6 +963,9 @@ TEST_CASE ("Shared embeddings retain every supersession memory sibling", REQUIRE (ctx.GetOperationTimings ().at ( "MemoryStorage.supersession_current_rows_visited") == static_cast (sibling_count)); + REQUIRE (ctx.GetOperationTimings ().at ( + "MemoryStorage.supersession_rows_visited_activity") + == 1.0); REQUIRE (ctx.GetOperationTimings ().at ( "MemoryStorage.supersession_historical_coverage_proven") == 0.0); @@ -840,6 +1035,9 @@ TEST_CASE ("Exact empty supersession coverage skips the recent SQL fallback", REQUIRE (ctx.GetOperationTimings ().at ( "MemoryStorage.supersession_historical_rows_visited") == 0.0); + REQUIRE (ctx.GetOperationTimings ().at ( + "MemoryStorage.supersession_rows_visited_activity") + == 0.0); REQUIRE (ctx.GetOperationTimings ().at ( "MemoryStorage.supersession_historical_coverage_proven") == 1.0); @@ -849,6 +1047,138 @@ TEST_CASE ("Exact empty supersession coverage skips the recent SQL fallback", cache::Erase (pctx); } +TEST_CASE ("Large supersession population uses the knob-bounded SQLite route", + "[operations][memory_storage][supersession][hnsw][sqlite][knobs]") +{ + namespace cache + = operations::historical_surface_search_cache_internal; + namespace sqlite_route + = operations::sparse_retrieval_route_sqlite_internal; + ScopedTempDb db; + Store *store = db.get (); + REQUIRE (store != nullptr); + + SignalProcessor::Config cfg; + cortext::testing::RequireEncoder (cfg); + const auto parameters = sqlite_route::DeriveParameters ( + cfg.focus, cfg.sensitivity, cfg.stability); + REQUIRE (parameters.route_capacity == 512); + REQUIRE (parameters.backfill_batch_size == 128); + const std::size_t population = parameters.route_capacity + 1; + + ProcessorContext pctx; + std::vector historical_entries; + std::vector current_entries; + std::vector> route_entries; + historical_entries.reserve (population); + current_entries.reserve (population); + route_entries.reserve (population); + const Eigen::VectorXf target = VectorWithCosineToDim0 (0.94f); + for (std::size_t index = 0; index < population; ++index) + { + const long long memory_id = 10 + static_cast (index); + const long long embedding_id = 1000 + static_cast (index); + const long long start_ts = 1000 + static_cast (index); + Eigen::VectorXf embedding = Eigen::VectorXf::Zero (kEmbeddingDim); + if (index == 0) + embedding = target; + else + { + embedding[1 + static_cast ( + index % (kEmbeddingDim - 1))] + = 1.0f; + } + const std::string source_id + = "opaque/" + std::to_string (index % 4); + cortext::testing::SeedEmbeddingV2 ( + *store, embedding_id, embedding, start_ts); + cortext::testing::SeedMemoryV2 ( + *store, memory_id, embedding_id, source_id, "LONG_TERM", 1.0, + start_ts); + ProcessorContext::RetrievalSurfaceEntry surface; + surface.memory_id = memory_id; + surface.embedding_id = embedding_id; + surface.start_ts = start_ts; + surface.kind = "LONG_TERM"; + surface.embedding = embedding; + pctx.UpsertRetrievalSurface (std::move (surface)); + historical_entries.push_back ( + { embedding_id, memory_id, start_ts, "LONG_TERM", source_id, + embedding }); + current_entries.push_back ( + { embedding_id, memory_id, start_ts, "LONG_TERM", source_id, + embedding, embedding_id }); + route_entries.emplace_back (memory_id, std::move (embedding)); + } + REQUIRE (cache::Reset (pctx, std::move (historical_entries), + std::move (current_entries))); + cache::SetProcessorSurfaceComplete (pctx, true); + cache::SetSparseRouteParameters (pctx, parameters); + auto state = cache::FindMutable (pctx); + REQUIRE (state); + auto hnsw = cache::EnsureSparseRoute (*state); + REQUIRE (hnsw); + state->sqlite_sparse_route = sqlite_route::Route::Create ( + *store, kEmbeddingDim, route_entries, *hnsw, parameters); + REQUIRE (state->sqlite_sparse_route); + + Signal signal; + signal.embedding = UnitVec (0); + signal.timestamp = 10000; + signal.source_id = "opaque/correction"; + signal.modality = "image"; + signal.mimetype = "image/test"; + AccumulatorState acc; + acc.mu_acc = signal.embedding; + acc.n_signals = 1; + acc.s_sum = 0.8; + acc.s_max = 0.8; + acc.t_start = signal.timestamp; + SignalRecord record; + record.embedding = signal.embedding; + record.timestamp = signal.timestamp; + record.modality = signal.modality; + record.mime = signal.mimetype; + record.score = 0.8; + acc.signals.push_back (std::move (record)); + pctx.accumulator_states[signal.source_id] = std::move (acc); + + OperationContext ctx (signal, pctx, cfg, store); + ctx.SetAccumulatorWriteDecision (true); + ctx.SetRepresentativeEmbedding (signal.embedding); + MemoryStorage operation; + auto tx = store->Begin (); + operation.Execute (ctx, *tx); + tx->Commit (); + + REQUIRE (ctx.GetStoredMemoryId ()); + REQUIRE (ctx.GetOperationTimings ().at ( + "MemoryStorage.supersession_current_rows_visited") + <= static_cast (parameters.activation_identity_target)); + REQUIRE (ctx.GetOperationTimings ().at ( + "MemoryStorage.supersession_sparse_route_node_rows") + <= static_cast (parameters.search_node_budget)); + REQUIRE (ctx.GetOperationTimings ().at ( + "MemoryStorage.supersession_sparse_route_distance_evaluations") + <= ctx.GetOperationTimings ().at ( + "MemoryStorage.supersession_sparse_route_node_rows")); + REQUIRE (ctx.GetOperationTimings ().at ( + "MemoryStorage.supersession_historical_rows_visited") + == 0.0); + REQUIRE (ctx.GetOperationTimings ().at ( + "MemoryStorage.supersession_historical_coverage_proven") + == 1.0); + REQUIRE (ctx.GetOperationTimings ().at ( + "MemoryStorage.supersession_sql_fallback_count") + == 0.0); + const auto edge_rows = store->Execute ( + "SELECT 1 FROM associations WHERE source_memory_id = ? " + "AND target_memory_id = 10 AND edge_type = 'supersedes'", + { *ctx.GetStoredMemoryId () }); + REQUIRE (edge_rows.size () == 1); + cache::Erase (pctx); +} + TEST_CASE ("Equivalent current population proves historical coverage in O1", "[operations][memory_storage][supersession][coverage]") { @@ -1125,7 +1455,7 @@ TEST_CASE ("MemoryStorage preserves SQL KNN behavior with signal-only decoys", operations::historical_surface_search_cache_internal::Erase (pctx); } -TEST_CASE ("Runtime reconstruction occupies the sqlite-vec pre-filter cutoff", +TEST_CASE ("Runtime reconstruction does not restore signal-only cutoff pollution", "[operations][memory_storage][supersession][reconstruction][knn_population]") { namespace cache @@ -1238,7 +1568,7 @@ TEST_CASE ("Runtime reconstruction occupies the sqlite-vec pre-filter cutoff", + signal.embedding.size ()), static_cast (candidate_limit), *ctx.GetStoredMemoryId (), 2000LL }); - REQUIRE (std::none_of ( + REQUIRE (std::any_of ( sql_candidates.begin (), sql_candidates.end (), [] (const auto &row) { return AnyToLongLong (row.at ("memory_id")) == 10LL; })); @@ -1247,7 +1577,7 @@ TEST_CASE ("Runtime reconstruction occupies the sqlite-vec pre-filter cutoff", "WHERE source_memory_id = ? AND target_memory_id = ? " " AND edge_type = 'supersedes'", { *ctx.GetStoredMemoryId (), 10LL }); - REQUIRE (target_edges.empty ()); + REQUIRE (target_edges.size () == 1); cache::Erase (pctx); } diff --git a/tests/operations_write_gate.test.cpp b/tests/operations_write_gate.test.cpp index 1d6cac9f..ecd2f68d 100644 --- a/tests/operations_write_gate.test.cpp +++ b/tests/operations_write_gate.test.cpp @@ -321,3 +321,162 @@ TEST_CASE ("ComputeWriteGate lowers threshold under high NE", #endif } } + +TEST_CASE ("ComputeWriteGate profiles every decision input without changing it", + "[operations][write_gate][profile]") +{ + cortext::testing::ScopedEnvVar profile ( + "CORTEXT_PROFILE_WORK_COUNTERS", "1"); + + Signal s; + s.embedding = Eigen::VectorXf::Ones (kEmbeddingDim); + s.embedding.normalize (); + s.timestamp = 100000; + s.source_id = "opaque/profile/source"; + + ProcessorContext pctx; + SignalProcessor::Config cfg; + cortext::testing::RequireEncoder (cfg); + cfg.focus = 0.5; + cfg.sensitivity = 0.5; + cfg.stability = 0.5; + SetupAccumulatorState (pctx, s, 0.8, 2.0, 3); + + OperationContext ctx (s, pctx, cfg); + ctx.SetFlushRequired (true); + ctx.SetThresholdTDynamic (0.3); + + ComputeWriteGate op; + op.Execute (ctx, cortext::testing::GetNullTransaction ()); + + const auto &profile_values = ctx.GetOperationTimings (); + REQUIRE (ctx.GetAccumulatorWriteDecision ()); + REQUIRE (profile_values.at ("WriteGate.flush_trigger") == 1.0); + REQUIRE (profile_values.at ("WriteGate.spike_bypass") == 0.0); + REQUIRE (profile_values.at ("WriteGate.accumulator_available") == 1.0); + REQUIRE (profile_values.at ("WriteGate.n_signals") == 3.0); + REQUIRE (profile_values.at ("WriteGate.write_accumulator") == 1.0); + REQUIRE (profile_values.at ("WriteGate.reason_code") == 5.0); + REQUIRE (profile_values.at ("WriteGate.window_score") + > profile_values.at ("WriteGate.effective_threshold")); + REQUIRE (profile_values.at ("WriteGate.score_margin") > 0.0); +} + +TEST_CASE ("ComputeWriteGate profiles non-boundary rejection", + "[operations][write_gate][profile]") +{ + cortext::testing::ScopedEnvVar profile ( + "CORTEXT_PROFILE_WORK_COUNTERS", "1"); + + Signal s; + s.embedding = Eigen::VectorXf::Ones (kEmbeddingDim); + s.embedding.normalize (); + s.timestamp = 100000; + s.source_id = "opaque/profile/source"; + + ProcessorContext pctx; + SignalProcessor::Config cfg; + cortext::testing::RequireEncoder (cfg); + SetupAccumulatorState (pctx, s, 0.8, 2.0, 3); + + OperationContext ctx (s, pctx, cfg); + ctx.SetFlushRequired (false); + ctx.SetThresholdTDynamic (0.3); + + ComputeWriteGate op; + op.Execute (ctx, cortext::testing::GetNullTransaction ()); + + const auto &profile_values = ctx.GetOperationTimings (); + REQUIRE_FALSE (ctx.GetAccumulatorWriteDecision ()); + REQUIRE (profile_values.at ("WriteGate.flush_trigger") == 0.0); + REQUIRE (profile_values.at ("WriteGate.write_accumulator") == 0.0); + REQUIRE (profile_values.at ("WriteGate.reason_code") == 2.0); +} + +TEST_CASE ("ComputeWriteGate profiles every remaining exit class", + "[operations][write_gate][profile]") +{ + cortext::testing::ScopedEnvVar profile ( + "CORTEXT_PROFILE_WORK_COUNTERS", "1"); + + Signal s; + s.embedding = Eigen::VectorXf::Ones (kEmbeddingDim); + s.embedding.normalize (); + s.timestamp = 100000; + s.source_id = "opaque/profile/source"; + + SignalProcessor::Config cfg; + cortext::testing::RequireEncoder (cfg); + cfg.focus = 0.5; + cfg.sensitivity = 0.5; + cfg.stability = 0.5; + + ComputeWriteGate op; + + SECTION ("ephemeral") + { + s.retention = Retention::Ephemeral; + ProcessorContext pctx; + SetupAccumulatorState (pctx, s, 0.8, 2.0, 3); + OperationContext ctx (s, pctx, cfg); + ctx.SetFlushRequired (true); + ctx.SetSpikeBypass (true); + ctx.SetThresholdTDynamic (0.3); + op.Execute (ctx, cortext::testing::GetNullTransaction ()); + + const auto &values = ctx.GetOperationTimings (); + REQUIRE_FALSE (ctx.GetAccumulatorWriteDecision ()); + REQUIRE (values.at ("WriteGate.accumulator_available") == 0.0); + REQUIRE (values.at ("WriteGate.write_accumulator") == 0.0); + REQUIRE (values.at ("WriteGate.reason_code") == 1.0); + } + + SECTION ("no accumulator") + { + ProcessorContext pctx; + OperationContext ctx (s, pctx, cfg); + ctx.SetFlushRequired (true); + ctx.SetThresholdTDynamic (0.3); + op.Execute (ctx, cortext::testing::GetNullTransaction ()); + + const auto &values = ctx.GetOperationTimings (); + REQUIRE_FALSE (ctx.GetAccumulatorWriteDecision ()); + REQUIRE (values.at ("WriteGate.accumulator_available") == 0.0); + REQUIRE (values.at ("WriteGate.write_accumulator") == 0.0); + REQUIRE (values.at ("WriteGate.reason_code") == 3.0); + } + + SECTION ("forced") + { + ProcessorContext pctx; + SetupAccumulatorState (pctx, s, 0.1, 0.2, 2); + OperationContext ctx (s, pctx, cfg); + ctx.SetFlushRequired (false); + ctx.SetSpikeBypass (true); + ctx.SetThresholdTDynamic (0.9); + op.Execute (ctx, cortext::testing::GetNullTransaction ()); + + const auto &values = ctx.GetOperationTimings (); + REQUIRE (ctx.GetAccumulatorWriteDecision ()); + REQUIRE (values.at ("WriteGate.force_write") == 1.0); + REQUIRE (values.at ("WriteGate.write_accumulator") == 1.0); + REQUIRE (values.at ("WriteGate.reason_code") == 4.0); + } + + SECTION ("score rejected") + { + ProcessorContext pctx; + SetupAccumulatorState (pctx, s, 0.1, 0.2, 2); + OperationContext ctx (s, pctx, cfg); + ctx.SetFlushRequired (true); + ctx.SetThresholdTDynamic (0.9); + op.Execute (ctx, cortext::testing::GetNullTransaction ()); + + const auto &values = ctx.GetOperationTimings (); + REQUIRE_FALSE (ctx.GetAccumulatorWriteDecision ()); + REQUIRE (values.at ("WriteGate.force_write") == 0.0); + REQUIRE (values.at ("WriteGate.write_accumulator") == 0.0); + REQUIRE (values.at ("WriteGate.reason_code") == 6.0); + REQUIRE (values.at ("WriteGate.score_margin") < 0.0); + } +} diff --git a/tests/signal_processor.test.cpp b/tests/signal_processor.test.cpp index eb31764b..0a81b6e9 100644 --- a/tests/signal_processor.test.cpp +++ b/tests/signal_processor.test.cpp @@ -1,5 +1,5 @@ -#include #include "test_helpers.hpp" +#include #include #include #include @@ -8,13 +8,18 @@ #include #include #include "../src/operations/association_fanout_cache_internal.hpp" +#include "../src/operations/active_signal_embedding_ring_internal.hpp" #include "../src/operations/bounded_activation_shadow_internal.hpp" #include "../src/operations/emotional_metadata_cache_internal.hpp" #include "../src/operations/historical_surface_search_cache_internal.hpp" +#include "../src/operations/rif_active_epoch_cache_internal.hpp" #include "../src/operations/rif_state_internal.hpp" #include "../src/operations/consolidation_throughput_state_internal.hpp" #include "../src/operations/signal_record_rollback_internal.hpp" +#include +#include #include +#include using namespace cortext; @@ -28,6 +33,7 @@ void SetSignalRecordSnapshotSetupThrowStageForTest (int stage); void SetRifActiveEpochPublishFailureStageForTest (int stage); void SetRifActiveEpochPublishFailureMaskForTest (unsigned int mask); void SetSQLiteCheckpointFailureOnceForTest (); +void SetRetrievalSurfaceReloadFailureOnceForTest (); } namespace cortext::store @@ -42,6 +48,14 @@ ExecutionCacheState (const ProcessorContext &ctx) return operations::execution_cache_sidecar_internal::Find (ctx); } +static std::size_t +MidpointRifRowBatch () +{ + return operations::rif_active_epoch_cache_internal::DeriveLimits ( + 0.5, 0.5, 0.5) + .row_batch_size; +} + struct InsertOp : IOperation { void @@ -122,7 +136,8 @@ struct AdvanceRifEpochOp : IOperation ctx.GetProcessorContext ()); const auto result = operations::rif_state_internal::AdvanceRecovery ( tx, static_cast (ctx.GetSignal ().timestamp), 10000.0, - sidecar->rif_active_epoch.calibration_memory_ids); + sidecar->rif_active_epoch.calibration_memory_ids, + sidecar->rif_active_epoch.limits.row_batch_size); sidecar->rif_active_epoch.calibration_memory_ids.clear (); operations::rif_active_epoch_cache_internal::StageClock ( sidecar->rif_active_epoch, result.clock.generation, @@ -158,7 +173,7 @@ struct PrimeRifEpochBoundaryOp : IOperation auto sidecar = operations::execution_cache_sidecar_internal::Ensure ( ctx.GetProcessorContext ()); sidecar->rif_active_epoch.event_count - = operations::rif_active_epoch_cache_internal::kEventLimit - 1; + = sidecar->rif_active_epoch.limits.event_count - 1; primed = true; } @@ -195,6 +210,93 @@ struct ConsolidationInsertOp : IOperation } }; +struct ConsolidationResetRetryProbeOp : IOperation +{ + void + Execute (OperationContext &ctx, Transaction &tx) const override + { + auto sidecar = operations::execution_cache_sidecar_internal::Ensure ( + ctx.GetProcessorContext ()); + captured = &ctx.GetProcessorContext (); + if (ctx.GetSignal ().force_consolidation) + { + saw_consolidation = true; + reset_required_during_consolidation + = sidecar->rif_active_epoch.empty_epoch_reset_required; + tx.Execute ("INSERT OR IGNORE INTO consolidation_derived(id) VALUES(1)"); + return; + } + if (saw_consolidation) + active_rows_before_retry_stage = sidecar->rif_active_epoch.active_rows; + operations::rif_active_epoch_cache_internal::StageMemory ( + sidecar->rif_active_epoch, 1); + } + + mutable bool saw_consolidation = false; + mutable bool reset_required_during_consolidation = false; + mutable std::size_t active_rows_before_retry_stage + = std::numeric_limits::max (); + mutable ProcessorContext *captured = nullptr; +}; + +struct ConsolidationSurfaceUpdateOp : IOperation +{ + explicit ConsolidationSurfaceUpdateOp ( + bool invalidate_cache = false, + std::optional consolidation_centroid_dimension = std::nullopt) + : invalidate_cache (invalidate_cache), + consolidation_centroid_dimension ( + consolidation_centroid_dimension) + { + } + + void + Execute (OperationContext &ctx, Transaction &tx) const override + { + captured = &ctx.GetProcessorContext (); + if (!ctx.GetSignal ().force_consolidation) + return; + auto &p_ctx = ctx.GetProcessorContext (); + const auto found = p_ctx.retrieval_surface_index.find (1); + REQUIRE (found != p_ctx.retrieval_surface_index.end ()); + REQUIRE (found->second < p_ctx.retrieval_surface_cache.size ()); + auto surface = p_ctx.retrieval_surface_cache[found->second]; + Eigen::VectorXf embedding = Eigen::VectorXf::Zero (256); + embedding[0] = 1.0f; + std::vector values (256, 0.0f); + values[0] = 1.0f; + tx.Execute ("UPDATE embeddings SET embedding = ? WHERE embedding_id = 1", + { values }); + surface.embedding = embedding; + p_ctx.UpsertRetrievalSurface (std::move (surface)); + if (invalidate_cache) + { + operations::historical_surface_search_cache_internal::Erase (p_ctx); + return; + } + operations::historical_surface_search_cache_internal::UpsertCurrent ( + p_ctx, + { 1, 1, 1001, "LONG_TERM", "seed/1", std::move (embedding), 1 }); + if (consolidation_centroid_dimension && !centroid_emitted) + { + ClusterInfo cluster; + cluster.cluster_id = 1; + cluster.memory_ids = { 1 }; + cluster.embedding_ids = { 1 }; + cluster.centroid.assign (256, 0.0f); + cluster.centroid[static_cast ( + *consolidation_centroid_dimension)] = 1.0f; + ctx.SetConsolidationClusters ({ std::move (cluster) }); + centroid_emitted = true; + } + } + + bool invalidate_cache = false; + std::optional consolidation_centroid_dimension; + mutable bool centroid_emitted = false; + mutable ProcessorContext *captured = nullptr; +}; + struct CustomRifReadWriteOp : IOperation { explicit CustomRifReadWriteOp (double *observed_strength, @@ -2087,7 +2189,7 @@ TEST_CASE ("Custom operation SQL observes and preserves effective lazy RIF " cortext::operations::rif_state_internal::RebuildFromMaterialized (*store); auto recovery_tx = store->Begin (); cortext::operations::rif_state_internal::AdvanceRecovery ( - *recovery_tx, 2000, 10000.0); + *recovery_tx, 2000, 10000.0, MidpointRifRowBatch ()); recovery_tx->Commit (); double observed_strength = 0.0; @@ -2138,7 +2240,7 @@ TEST_CASE ("Custom operation indirect views observe effective lazy RIF values", cortext::operations::rif_state_internal::RebuildFromMaterialized (*store); auto recovery_tx = store->Begin (); cortext::operations::rif_state_internal::AdvanceRecovery ( - *recovery_tx, 2000, 10000.0); + *recovery_tx, 2000, 10000.0, MidpointRifRowBatch ()); recovery_tx->Commit (); double observed_strength = 0.0; @@ -2313,10 +2415,9 @@ TEST_CASE ("Migrated active working slots reanchor persisted strength", REQUIRE (sidecar); REQUIRE (sidecar->rif_active_epoch.database); const auto epoch_rows = sidecar->rif_active_epoch.database->Execute ( - "SELECT recovery_total FROM active_state WHERE memory_id = 1"); + "SELECT memory_id FROM active_state WHERE memory_id = 1"); REQUIRE (epoch_rows.size () == 1); - REQUIRE (std::any_cast (epoch_rows[0].at ("recovery_total")) - == Catch::Approx (0.7)); + REQUIRE (std::any_cast (epoch_rows[0].at ("memory_id")) == 1); } auto effective = store->Execute ( @@ -2342,16 +2443,15 @@ TEST_CASE ("Migrated active working slots reanchor persisted strength", REQUIRE (restarted_sidecar->rif_active_epoch.database); const auto restarted_rows = restarted_sidecar->rif_active_epoch.database->Execute ( - "SELECT recovery_total FROM active_state WHERE memory_id = 1"); + "SELECT memory_id FROM active_state WHERE memory_id = 1"); REQUIRE (restarted_rows.size () == 1); - REQUIRE (std::any_cast ( - restarted_rows[0].at ("recovery_total")) - == Catch::Approx (0.7)); + REQUIRE (std::any_cast ( + restarted_rows[0].at ("memory_id")) == 1); } auto recovery_tx = store->Begin (); cortext::operations::rif_state_internal::AdvanceRecovery ( - *recovery_tx, 2000, 10000.0); + *recovery_tx, 2000, 10000.0, MidpointRifRowBatch ()); recovery_tx->Commit (); effective = store->Execute ( "SELECT strength, suppression FROM rif_effective_memories " @@ -2366,46 +2466,190 @@ TEST_CASE ("RIF active epoch requires consolidation at its bound and resets " "only after a successful maintenance commit", "[processor][rif][active_epoch][bound]") { + const auto exercise = [] (double focus, double sensitivity, + double stability, Retention retention) { + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + SignalProcessor::Config cfg; + cfg.focus = focus; + cfg.sensitivity = sensitivity; + cfg.stability = stability; + cortext::testing::RequireEncoder (cfg); + auto root = std::make_unique ( + std::make_unique ()); + SignalProcessor processor (cfg, store, std::move (root)); + + Signal signal; + signal.embedding = Eigen::VectorXf::Zero (256); + signal.source_id = "opaque/source-a"; + signal.modality = "audio"; + signal.retention = retention; + signal.timestamp = 1000; + const auto at_limit = processor.Process (signal); + const auto limits + = operations::rif_active_epoch_cache_internal::DeriveLimits ( + focus, sensitivity, stability); + REQUIRE (at_limit.consolidation_state == ConsolidationState::Required); + REQUIRE (at_limit.operation_ms.at ( + "SignalProcessor.rif_active_epoch_event_count") + == static_cast (limits.event_count)); + + signal.source_id = "opaque/source-b"; + signal.modality = "image"; + signal.timestamp = 2000; + const auto ignored = processor.Process (signal); + REQUIRE (ignored.consolidation_state == ConsolidationState::Required); + REQUIRE (ignored.operation_ms.at ( + "SignalProcessor.rif_active_epoch_event_count") + == static_cast (limits.event_count + 1)); + + signal.force_consolidation = true; + signal.modality = "text"; + signal.timestamp = 3000; + const auto reset = processor.Process (signal); + REQUIRE (reset.consolidation_state == ConsolidationState::None); + REQUIRE (reset.operation_ms.at ( + "SignalProcessor.rif_active_epoch_event_count") + == 0.0); + REQUIRE (reset.operation_ms.at ( + "SignalProcessor.rif_active_epoch_mutation_count") + == 0.0); + REQUIRE (reset.operation_ms.at ( + "SignalProcessor.rif_active_epoch_allocated_bytes") + < static_cast (limits.allocated_bytes)); + }; + + for (const auto retention : { Retention::Natural, Retention::Durable }) + { + exercise (0.0, 0.0, 0.0, retention); + exercise (0.5, 0.5, 0.5, retention); + exercise (1.0, 1.0, 1.0, retention); + } +} + +TEST_CASE ("RIF work counter reports event publication rows rather than " + "historical active state", + "[processor][rif][active_epoch][profiling][regression]") +{ + cortext::testing::ScopedEnvVar profile_work ( + "CORTEXT_PROFILE_WORK_COUNTERS", "1"); auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + cortext::testing::InitializeCoreSchema (*store); + store->Execute ( + "INSERT INTO memories(memory_id, source_id, kind, start_ts, n_signals, " + "modality, strength, suppression, suppression_ts, created_at) " + "VALUES(1, 'historical/source', 'LONG_TERM', 1000, 1, 'text', " + "0.5, 0.5, 1000, 1000)"); + operations::rif_state_internal::RebuildFromMaterialized (*store); + SignalProcessor::Config cfg; cortext::testing::RequireEncoder (cfg); - auto root = std::make_unique ( - std::make_unique ()); - SignalProcessor processor (cfg, store, std::move (root)); - + SignalProcessor processor ( + cfg, store, std::make_unique ()); Signal signal; signal.embedding = Eigen::VectorXf::Zero (256); - signal.source_id = "source-a"; - signal.retention = Retention::Natural; - signal.timestamp = 1000; - const auto at_limit = processor.Process (signal); - REQUIRE (at_limit.consolidation_state == ConsolidationState::Required); - REQUIRE (at_limit.operation_ms.at ( - "SignalProcessor.rif_active_epoch_event_count") - == 512.0); - + signal.source_id = "current/source"; + signal.modality = "image"; signal.timestamp = 2000; - const auto ignored = processor.Process (signal); - REQUIRE (ignored.consolidation_state == ConsolidationState::Required); - REQUIRE (ignored.operation_ms.at ( - "SignalProcessor.rif_active_epoch_event_count") - == 513.0); + const auto output = processor.Process (signal); - signal.force_consolidation = true; - signal.timestamp = 3000; - const auto reset = processor.Process (signal); - REQUIRE (reset.consolidation_state == ConsolidationState::None); - REQUIRE (reset.operation_ms.at ( - "SignalProcessor.rif_active_epoch_event_count") + const auto active_rows = store->Execute ( + "SELECT COUNT(*) AS n FROM rif_active_state"); + REQUIRE (active_rows.size () == 1); + REQUIRE (std::any_cast (active_rows[0].at ("n")) == 1); + REQUIRE (output.operation_ms.at ( + "SignalProcessor.retrieval_suppression_id_count") == 0.0); - REQUIRE (reset.operation_ms.at ( - "SignalProcessor.rif_active_epoch_mutation_count") + REQUIRE (output.operation_ms.at ( + "SignalProcessor.retrieval_suppression_id_activity") == 0.0); - REQUIRE (reset.operation_ms.at ( - "SignalProcessor.rif_active_epoch_allocated_bytes") - < static_cast ( - operations::rif_active_epoch_cache_internal:: - kAllocatedByteLimit)); +} + +TEST_CASE ("RIF active epoch limits follow the full F S T knob surface", + "[processor][rif][active_epoch][bound][knobs]") +{ + namespace epoch = operations::rif_active_epoch_cache_internal; + constexpr std::array kValues { 0.0, 0.5, 1.0 }; + std::size_t structural_points = 0; + for (const double focus : kValues) + for (const double sensitivity : kValues) + for (const double stability : kValues) + { + const auto limits = epoch::DeriveLimits ( + focus, sensitivity, stability); + const auto capacity = static_cast ( + std::lround (256.0 + 256.0 * focus + + 128.0 * sensitivity + 128.0 * stability)); + REQUIRE (limits.event_count == capacity); + REQUIRE (limits.mutation_count == capacity * 64); + REQUIRE (limits.allocated_bytes + == capacity * 128ULL * 1024ULL); + const auto row_batch_size = static_cast ( + std::lround (64.0 + 64.0 * focus + + 32.0 * sensitivity + 32.0 * stability)); + REQUIRE (limits.row_batch_size == row_batch_size); + ++structural_points; + } + REQUIRE (structural_points == 27); + + struct ProductionPoint + { + double focus; + double sensitivity; + double stability; + epoch::Limits expected; + }; + const std::array production_points { { + { 0.5, 0.5, 0.5, { 512, 32768, 67108864, 128 } }, + { 0.0, 0.0, 0.0, { 256, 16384, 33554432, 64 } }, + { 1.0, 1.0, 1.0, { 768, 49152, 100663296, 192 } }, + { 0.0, 0.5, 0.5, { 384, 24576, 50331648, 96 } }, + { 1.0, 0.5, 0.5, { 640, 40960, 83886080, 160 } }, + { 0.5, 0.0, 0.5, { 448, 28672, 58720256, 112 } }, + { 0.5, 1.0, 0.5, { 576, 36864, 75497472, 144 } }, + { 0.5, 0.5, 0.0, { 448, 28672, 58720256, 112 } }, + { 0.5, 0.5, 1.0, { 576, 36864, 75497472, 144 } }, + } }; + std::unordered_set event_limits; + for (const auto &point : production_points) + { + const auto actual = epoch::DeriveLimits ( + point.focus, point.sensitivity, point.stability); + REQUIRE (actual == point.expected); + event_limits.insert (actual.event_count); + } + REQUIRE (event_limits.size () > 3); + + REQUIRE (epoch::DeriveLimits (0.0, 0.0, 0.0) + == epoch::Limits { 256, 16384, 33554432, 64 }); + REQUIRE (epoch::DeriveLimits (0.5, 0.5, 0.5) + == epoch::Limits { 512, 32768, 67108864, 128 }); + REQUIRE (epoch::DeriveLimits (1.0, 1.0, 1.0) + == epoch::Limits { 768, 49152, 100663296, 192 }); +} + +TEST_CASE ("RIF active epoch rejects non-finite knobs before deriving bounds", + "[processor][rif][active_epoch][bound][knobs]") +{ + namespace epoch = operations::rif_active_epoch_cache_internal; + const double nan = std::numeric_limits::quiet_NaN (); + REQUIRE_THROWS_AS (epoch::DeriveLimits (nan, 0.5, 0.5), + std::invalid_argument); + REQUIRE_THROWS_AS (epoch::DeriveLimits (0.5, nan, 0.5), + std::invalid_argument); + REQUIRE_THROWS_AS (epoch::DeriveLimits (0.5, 0.5, nan), + std::invalid_argument); + REQUIRE (epoch::DeriveLimits (-1.0, -2.0, -3.0) + == epoch::DeriveLimits (0.0, 0.0, 0.0)); + REQUIRE (epoch::DeriveLimits (2.0, 3.0, 4.0) + == epoch::DeriveLimits (1.0, 1.0, 1.0)); + + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + SignalProcessor::Config cfg; + cfg.focus = nan; + cortext::testing::RequireEncoder (cfg); + REQUIRE_THROWS_AS ( + SignalProcessor (cfg, store, std::make_unique ()), + std::invalid_argument); } TEST_CASE ("Failed consolidation keeps the prior RIF epoch and a later " @@ -2513,38 +2757,64 @@ TEST_CASE ("Post-commit consolidation epoch reset failure rebuilds without " } TEST_CASE ("RIF epoch retry preserves a committed consolidation reset after " - "publication and recovery both fail", + "publication and recovery both fail without copying mature history", "[processor][rif][active_epoch][consolidation][failure][retry]") { auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + cortext::testing::InitializeCoreSchema (*store); store->Execute ("CREATE TABLE consolidation_derived(id INTEGER PRIMARY KEY)"); + const std::size_t durable_history_rows = MidpointRifRowBatch () + 1; + for (std::size_t index = 0; index < durable_history_rows; ++index) + { + const long long memory_id = static_cast (index + 1); + const std::string source_id + = index % 2 == 0 ? "opaque/source-a" : "opaque/source-b"; + const std::string modality = index % 3 == 0 ? "text" + : index % 3 == 1 ? "audio" + : "image"; + store->Execute ( + "INSERT INTO memories(memory_id, source_id, kind, start_ts, " + "n_signals, modality, strength, suppression, suppression_ts, " + "created_at) VALUES(?, ?, 'LONG_TERM', 1000, 1, ?, 0.5, 0.5, " + "1000, 1000)", + { memory_id, source_id, modality }); + } + cortext::operations::rif_state_internal::RebuildFromMaterialized (*store); SignalProcessor::Config cfg; cortext::testing::RequireEncoder (cfg); - auto root = std::make_unique ( - std::make_unique ()); - SignalProcessor processor (cfg, store, std::move (root)); + auto operation = std::make_unique (); + auto *probe = operation.get (); + auto root + = std::make_unique (std::move (operation)); + SignalProcessor processor ( + cfg, store, + operations::signal_record_rollback_internal:: + MarkEngineOwnedJournalAware (std::move (root))); Signal signal; signal.embedding = Eigen::VectorXf::Zero (256); signal.source_id = "source-a"; signal.retention = Retention::Natural; - signal.timestamp = 1000; - const auto ordinary = processor.Process (signal); - REQUIRE (ordinary.operation_ms.at ( - "SignalProcessor.rif_active_epoch_event_count") - == 1.0); - signal.force_consolidation = true; signal.timestamp = 2000; cortext::testing::SetRifActiveEpochPublishFailureMaskForTest ( (1U << 3U) | (1U << 4U)); + cortext::testing::SetRetrievalSurfaceReloadFailureOnceForTest (); const auto failed_publication = processor.Process (signal); + REQUIRE (probe->reset_required_during_consolidation); REQUIRE (failed_publication.operation_ms.at ( "SignalProcessor.rif_epoch_publication_recovery_count") == 1.0); REQUIRE (failed_publication.operation_ms.at ( "SignalProcessor.rif_active_epoch_event_count") == 0.0); + REQUIRE (probe->captured != nullptr); + const auto failed_sidecar = ExecutionCacheState (*probe->captured); + REQUIRE (failed_sidecar); + REQUIRE_FALSE (failed_sidecar->rif_active_epoch.valid); + REQUIRE (failed_sidecar->rif_active_epoch.pending_rebuild); + REQUIRE (failed_sidecar->rif_active_epoch.pending_rebuild_resets_counters); + REQUIRE (failed_sidecar->rif_active_epoch.empty_epoch_reset_required); signal.force_consolidation = false; signal.timestamp = 3000; @@ -2555,11 +2825,24 @@ TEST_CASE ("RIF epoch retry preserves a committed consolidation reset after " REQUIRE (retried.operation_ms.at ( "SignalProcessor.rif_active_epoch_event_count") == 1.0); + REQUIRE (probe->active_rows_before_retry_stage == 0); + REQUIRE (probe->captured != nullptr); + const auto retry_sidecar = ExecutionCacheState (*probe->captured); + REQUIRE (retry_sidecar); + REQUIRE (retry_sidecar->rif_active_epoch.active_rows == 1); + REQUIRE (retry_sidecar->rif_active_epoch.database->Execute ( + "SELECT memory_id FROM active_state ORDER BY memory_id") + .size () + == 1); REQUIRE (std::any_cast ( store->Execute ( "SELECT COUNT(*) AS n FROM consolidation_derived")[0] - .at ("n")) + .at ("n")) == 1LL); + REQUIRE (cortext::operations::rif_state_internal::CountRows ( + *store, + "SELECT COUNT(*) AS row_count FROM rif_active_state") + == static_cast (durable_history_rows)); } TEST_CASE ("Durable checkpoint failure cannot replay the committed signal", @@ -2598,6 +2881,35 @@ TEST_CASE ("Durable checkpoint failure cannot replay the committed signal", == 2LL); } +TEST_CASE ("Natural consolidation does not borrow the Durable checkpoint", + "[processor][consolidation][durable][barrier]") +{ + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + store->Execute ( + "CREATE TABLE t(id INTEGER PRIMARY KEY AUTOINCREMENT, v TEXT)"); + SignalProcessor::Config cfg; + cortext::testing::RequireEncoder (cfg); + auto root + = std::make_unique (std::make_unique ()); + SignalProcessor processor (cfg, store, std::move (root)); + + Signal signal; + signal.embedding = Eigen::VectorXf::Zero (256); + signal.source_id = "source-a"; + signal.force_consolidation = true; + signal.retention = Retention::Natural; + signal.timestamp = 1000; + const auto natural = processor.Process (signal); + REQUIRE_FALSE (natural.operation_ms.contains ( + "SignalProcessor.sqlite_wal_checkpoint")); + + signal.retention = Retention::Durable; + signal.timestamp = 2000; + const auto durable = processor.Process (signal); + REQUIRE (durable.operation_ms.contains ( + "SignalProcessor.sqlite_wal_checkpoint")); +} + TEST_CASE ("SignalProcessor executes pipeline in order", "[processor][order]") { auto uniq = SQLiteStore::Create (":memory:"); @@ -3314,6 +3626,387 @@ TEST_CASE ("SignalProcessor rebuilds historical cache after force commit", REQUIRE (cache::RegistrySizeForTest () == baseline_size + 1); } +TEST_CASE ("Engine consolidation seals an incrementally current sparse route " + "without reloading the full retrieval surface", + "[processor][cache][consolidation][hnsw][sqlite]") +{ + namespace cache + = operations::historical_surface_search_cache_internal; + cortext::testing::ScopedEnvVar disable_constructive_recall ( + "CORTEXT_DISABLE_CONSTRUCTIVE_RECALL", "1"); + cortext::testing::ScopedEnvVar hnsw_route_flag ( + "CORTEXT_HNSW_SPARSE_ROUTE", "1"); + cortext::testing::ScopedEnvVar sqlite_route_flag ( + "CORTEXT_SQLITE_SPARSE_ROUTE", "1"); + cortext::testing::ScopedEnvVar recenter_overlap_profile ( + "CORTEXT_PROFILE_RECENTER_ACTIVATION_OVERLAP", "1"); + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + cortext::testing::InitializeCoreSchema (*store); + for (long long memory_id = 1; memory_id <= 513; ++memory_id) + { + std::vector embedding (256, 0.0f); + embedding[static_cast ((memory_id % 255) + 1)] = 1.0f; + cortext::testing::SeedEmbeddingV2 ( + *store, memory_id, embedding, 1000 + memory_id); + cortext::testing::SeedMemoryV2 ( + *store, memory_id, memory_id, + "seed/" + std::to_string (memory_id), "LONG_TERM", 1.0, + 1000 + memory_id); + } + + SignalProcessor::Config cfg; + cortext::testing::RequireEncoder (cfg); + auto operation = std::make_unique ( + false, 1); + auto *capturing_operation = operation.get (); + auto root = std::make_unique (std::move (operation)); + SignalProcessor processor ( + cfg, store, + operations::signal_record_rollback_internal:: + MarkEngineOwnedJournalAware (std::move (root))); + + std::vector active_signal_embedding (256, 0.0f); + active_signal_embedding[3] = 1.0f; + cortext::testing::SeedSignalV2 ( + *store, 7001, 3, "opaque/source", 99999); + { + auto tx = store->Begin (); + operations::active_signal_embedding_ring_internal::Upsert ( + *tx, 7001, active_signal_embedding, 99999, cfg.focus, + cfg.sensitivity, cfg.stability); + tx->Commit (); + } + + Signal signal; + signal.embedding = Eigen::VectorXf::Zero (256); + signal.embedding[0] = 1.0f; + signal.source_id = "maintenance"; + signal.timestamp = 100000; + signal.force_consolidation = true; + const auto output = processor.Process (signal); + REQUIRE (output.operation_ms.at ( + "SignalProcessor.reload_retrieval_surface_skipped") + == 1.0); + REQUIRE (output.operation_ms.at ( + "SignalProcessor.reload_retrieval_surface") + == 0.0); + REQUIRE (output.operation_ms.at ( + "SignalProcessor.sparse_route_seal_delta_count") + == 0.0); + REQUIRE (output.operation_ms.at ( + "SignalProcessor.sqlite_sparse_route_seal_delta_count") + == 0.0); + REQUIRE (output.operation_ms.at ( + "SignalProcessor.sparse_route_seal_succeeded") + == 1.0); + REQUIRE (output.operation_ms.at ( + "SignalProcessor.sqlite_sparse_route_seal_succeeded") + == 1.0); + REQUIRE (output.operation_ms.at ( + "SignalProcessor.sqlite_sparse_route_recenter_overlap_profiled") + == 1.0); + REQUIRE (output.operation_ms.at ( + "SignalProcessor.sqlite_sparse_route_recenter_overlap_pair_valid") + == 1.0); + REQUIRE (output.operation_ms.at ( + "SignalProcessor.sqlite_sparse_route_recenter_overlap_failure_code") + == 0.0); + REQUIRE (output.operation_ms.at ( + "SignalProcessor.sqlite_sparse_route_recenter_centroid_source") + == 1.0); + const double pre_activated = output.operation_ms.at ( + "SignalProcessor.sqlite_sparse_route_recenter_pre_activated_count"); + REQUIRE (pre_activated > 0.0); + REQUIRE (output.operation_ms.at ( + "SignalProcessor.sqlite_sparse_route_recenter_post_activated_count") + == pre_activated); + REQUIRE (output.operation_ms.at ( + "SignalProcessor.sqlite_sparse_route_recenter_overlap_count") + == pre_activated); + REQUIRE (capturing_operation->captured != nullptr); + auto state = cache::FindMutable (*capturing_operation->captured); + REQUIRE (state); + REQUIRE (state->sparse_route); + REQUIRE (state->sqlite_sparse_route); + REQUIRE (state->sqlite_sparse_route->ActivationEntryMemoryId () == 255); + + auto restarted = operations::sparse_retrieval_route_sqlite_internal::Route:: + Open (*store, 256, + operations::sparse_retrieval_route_sqlite_internal:: + DefaultParameters ()); + REQUIRE (restarted); + Eigen::VectorXf query = Eigen::VectorXf::Zero (256); + query[0] = 1.0f; + const auto result = restarted->Search (query, 512); + REQUIRE (result); + REQUIRE_FALSE (result->empty ()); + REQUIRE (result->front () == 1); + REQUIRE (restarted->RestartRowsLoaded () == 1); + + signal.embedding = Eigen::VectorXf::Zero (256); + signal.timestamp = 100001; + const auto invalid_pair_output = processor.Process (signal); + REQUIRE (invalid_pair_output.operation_ms.at ( + "SignalProcessor.sqlite_sparse_route_recenter_overlap_profiled") + == 1.0); + REQUIRE (invalid_pair_output.operation_ms.at ( + "SignalProcessor.sqlite_sparse_route_recenter_overlap_pair_valid") + == 0.0); + REQUIRE (invalid_pair_output.operation_ms.at ( + "SignalProcessor.sqlite_sparse_route_recenter_overlap_failure_code") + == 2.0); + REQUIRE (invalid_pair_output.operation_ms.at ( + "SignalProcessor.sqlite_sparse_route_recenter_succeeded") + == 1.0); + REQUIRE (invalid_pair_output.operation_ms.at ( + "SignalProcessor.sqlite_sparse_route_recenter_centroid_source") + == 2.0); + REQUIRE (invalid_pair_output.operation_ms.at ( + "SignalProcessor.sqlite_sparse_route_recenter_centroid_member_count") + == 1.0); + REQUIRE (state->sqlite_sparse_route->ActivationEntryMemoryId () == 2); +} + +TEST_CASE ("Invalidated consolidation surface reloads authority and replaces " + "the prior sparse route generation", + "[processor][cache][consolidation][hnsw][sqlite][fallback]") +{ + namespace cache + = operations::historical_surface_search_cache_internal; + cortext::testing::ScopedEnvVar disable_constructive_recall ( + "CORTEXT_DISABLE_CONSTRUCTIVE_RECALL", "1"); + cortext::testing::ScopedEnvVar hnsw_route_flag ( + "CORTEXT_HNSW_SPARSE_ROUTE", "1"); + cortext::testing::ScopedEnvVar sqlite_route_flag ( + "CORTEXT_SQLITE_SPARSE_ROUTE", "1"); + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + cortext::testing::InitializeCoreSchema (*store); + for (long long memory_id = 1; memory_id <= 513; ++memory_id) + { + std::vector embedding (256, 0.0f); + embedding[static_cast ((memory_id % 255) + 1)] = 1.0f; + cortext::testing::SeedEmbeddingV2 ( + *store, memory_id, embedding, 1000 + memory_id); + cortext::testing::SeedMemoryV2 ( + *store, memory_id, memory_id, + "seed/" + std::to_string (memory_id), "LONG_TERM", 1.0, + 1000 + memory_id); + } + + SignalProcessor::Config cfg; + cortext::testing::RequireEncoder (cfg); + auto operation = std::make_unique (true); + auto *capturing_operation = operation.get (); + auto root = std::make_unique (std::move (operation)); + SignalProcessor processor ( + cfg, store, + operations::signal_record_rollback_internal:: + MarkEngineOwnedJournalAware (std::move (root))); + + Signal signal; + signal.embedding = Eigen::VectorXf::Zero (256); + signal.source_id = "maintenance"; + signal.timestamp = 100000; + signal.force_consolidation = true; + const auto output = processor.Process (signal); + REQUIRE (output.operation_ms.at ( + "SignalProcessor.reload_retrieval_surface_skipped") + == 0.0); + REQUIRE (output.operation_ms.at ( + "SignalProcessor.reload_retrieval_surface") + >= 0.0); + REQUIRE (capturing_operation->captured != nullptr); + auto state = cache::Find (*capturing_operation->captured); + REQUIRE (state); + REQUIRE (state->sparse_route); + REQUIRE (state->sqlite_sparse_route); + auto restarted = operations::sparse_retrieval_route_sqlite_internal::Route:: + Open (*store, 256, + operations::sparse_retrieval_route_sqlite_internal:: + DefaultParameters ()); + REQUIRE (restarted); + Eigen::VectorXf query = Eigen::VectorXf::Zero (256); + query[0] = 1.0f; + const auto result = restarted->Search (query, 512); + REQUIRE (result); + REQUIRE_FALSE (result->empty ()); + REQUIRE (result->front () == 1); +} + +TEST_CASE ("Restarted SQLite sparse route seals a bounded row-addressed delta " + "without reconstructing in-memory HNSW", + "[processor][cache][consolidation][hnsw][sqlite][restart]") +{ + namespace cache + = operations::historical_surface_search_cache_internal; + cortext::testing::ScopedEnvVar disable_constructive_recall ( + "CORTEXT_DISABLE_CONSTRUCTIVE_RECALL", "1"); + cortext::testing::ScopedEnvVar hnsw_route_flag ( + "CORTEXT_HNSW_SPARSE_ROUTE", "1"); + cortext::testing::ScopedEnvVar sqlite_route_flag ( + "CORTEXT_SQLITE_SPARSE_ROUTE", "1"); + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + cortext::testing::InitializeCoreSchema (*store); + std::vector> route_entries; + route_entries.reserve (513); + for (long long memory_id = 1; memory_id <= 513; ++memory_id) + { + Eigen::VectorXf vector = Eigen::VectorXf::Zero (256); + vector[static_cast ((memory_id % 255) + 1)] = 1.0f; + std::vector embedding (vector.data (), + vector.data () + vector.size ()); + cortext::testing::SeedEmbeddingV2 ( + *store, memory_id, embedding, 1000 + memory_id); + cortext::testing::SeedMemoryV2 ( + *store, memory_id, memory_id, + "seed/" + std::to_string (memory_id), "LONG_TERM", 1.0, + 1000 + memory_id); + route_entries.emplace_back (memory_id, std::move (vector)); + } + auto hnsw = operations::sparse_retrieval_route_internal::Route::Create ( + 256, route_entries, + operations::sparse_retrieval_route_internal::DefaultParameters ()); + REQUIRE (hnsw); + auto persisted + = operations::sparse_retrieval_route_sqlite_internal::Route::Create ( + *store, 256, route_entries, *hnsw, + operations::sparse_retrieval_route_sqlite_internal:: + DefaultParameters ()); + REQUIRE (persisted); + hnsw.reset (); + persisted.reset (); + + SignalProcessor::Config cfg; + cortext::testing::RequireEncoder (cfg); + auto operation = std::make_unique (); + auto *capturing_operation = operation.get (); + auto root = std::make_unique (std::move (operation)); + SignalProcessor processor ( + cfg, store, + operations::signal_record_rollback_internal:: + MarkEngineOwnedJournalAware (std::move (root))); + + Signal signal; + signal.embedding = Eigen::VectorXf::Zero (256); + signal.source_id = "maintenance"; + signal.timestamp = 100000; + signal.force_consolidation = true; + const auto output = processor.Process (signal); + REQUIRE (output.operation_ms.at ( + "SignalProcessor.reload_retrieval_surface_skipped") + == 1.0); + REQUIRE (output.operation_ms.at ( + "SignalProcessor.sqlite_sparse_route_seal_delta_count") + == 1.0); + REQUIRE (output.operation_ms.at ( + "SignalProcessor.sqlite_sparse_route_seal_succeeded") + == 1.0); + REQUIRE (output.operation_ms.at ( + "SignalProcessor.sqlite_sparse_route_seal_failure_code") + == 0.0); + REQUIRE (capturing_operation->captured != nullptr); + const auto state = cache::Find (*capturing_operation->captured); + REQUIRE (state); + REQUIRE_FALSE (state->sparse_route); + REQUIRE (state->sqlite_sparse_route); + + auto restarted = operations::sparse_retrieval_route_sqlite_internal::Route:: + Open (*store, 256, + operations::sparse_retrieval_route_sqlite_internal:: + DefaultParameters ()); + REQUIRE (restarted); + Eigen::VectorXf query = Eigen::VectorXf::Zero (256); + query[0] = 1.0f; + const auto result = restarted->Search (query, 512); + REQUIRE (result); + REQUIRE_FALSE (result->empty ()); + REQUIRE (result->front () == 1); + REQUIRE (restarted->RestartRowsLoaded () == 1); +} + +TEST_CASE ("Ordinary sparse-route maintenance seals at its knob-derived " + "backfill-minus-expansion batch", + "[processor][cache][hnsw][sqlite][knobs][regression]") +{ + cortext::testing::ScopedEnvVar disable_constructive_recall ( + "CORTEXT_DISABLE_CONSTRUCTIVE_RECALL", "1"); + cortext::testing::ScopedEnvVar sqlite_route_flag ( + "CORTEXT_SQLITE_SPARSE_ROUTE", "1"); + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + cortext::testing::InitializeCoreSchema (*store); + const auto parameters + = operations::sparse_retrieval_route_sqlite_internal:: + DefaultParameters (); + REQUIRE (parameters.backfill_batch_size == 128); + REQUIRE (parameters.search_expansion_batch == 32); + const std::size_t ordinary_seal_batch + = static_cast ( + operations::sparse_retrieval_knobs_internal::OrdinarySealBatch ( + 0.5, 0.5, 0.5)); + REQUIRE (ordinary_seal_batch == 96); + + std::vector> route_entries; + route_entries.reserve (513); + for (long long memory_id = 1; memory_id <= 513; ++memory_id) + { + Eigen::VectorXf vector = Eigen::VectorXf::Zero (256); + vector[static_cast ((memory_id % 255) + 1)] = 1.0f; + std::vector embedding (vector.data (), + vector.data () + vector.size ()); + cortext::testing::SeedEmbeddingV2 ( + *store, memory_id, embedding, 1000 + memory_id); + cortext::testing::SeedMemoryV2 ( + *store, memory_id, memory_id, + "seed/" + std::to_string (memory_id), "LONG_TERM", 1.0, + 1000 + memory_id); + route_entries.emplace_back (memory_id, std::move (vector)); + } + auto hnsw = operations::sparse_retrieval_route_internal::Route::Create ( + 256, route_entries, + operations::sparse_retrieval_route_internal::DefaultParameters ()); + REQUIRE (hnsw); + auto persisted + = operations::sparse_retrieval_route_sqlite_internal::Route::Create ( + *store, 256, route_entries, *hnsw, parameters); + REQUIRE (persisted); + for (std::size_t index = 0; index < ordinary_seal_batch; + ++index) + { + Eigen::VectorXf revised = Eigen::VectorXf::Zero (256); + revised[static_cast ((index + 17) % 255)] = 1.0f; + REQUIRE (persisted->Upsert ( + static_cast (index + 1), revised)); + } + REQUIRE (persisted->HasDirtyMemoryIds ()); + persisted.reset (); + hnsw.reset (); + + SignalProcessor::Config cfg; + cortext::testing::RequireEncoder (cfg); + auto root = std::make_unique ( + std::make_unique ()); + SignalProcessor processor ( + cfg, store, + operations::signal_record_rollback_internal:: + MarkEngineOwnedJournalAware (std::move (root))); + Signal signal; + signal.embedding = Eigen::VectorXf::Zero (256); + signal.source_id = "opaque/ordinary"; + signal.modality = "audio"; + signal.timestamp = 100000; + const auto output = processor.Process (signal); + + REQUIRE (store->Execute ( + "SELECT memory_id FROM cortext_sparse_route_dirty") + .empty ()); + REQUIRE (output.operation_ms.at ( + "SignalProcessor.sqlite_sparse_route_ordinary_seal_delta_count") + == static_cast (ordinary_seal_batch)); + REQUIRE (output.operation_ms.at ( + "SignalProcessor.sqlite_sparse_route_ordinary_seal_succeeded") + == 1.0); +} + TEST_CASE ("SignalProcessor restores historical cache after force commit " "failure", "[processor][rollback][cache][consolidation]") diff --git a/tests/store.test.cpp b/tests/store.test.cpp index 33da67a1..2a64a6a1 100644 --- a/tests/store.test.cpp +++ b/tests/store.test.cpp @@ -7,6 +7,7 @@ #include #include #include "../src/operations/consolidation_epoch_profile_internal.hpp" +#include "../src/store/commit_profile_internal.hpp" #include "../src/store/mutation_audit_internal.hpp" #include #include @@ -52,6 +53,27 @@ TEST_CASE ("SQLiteStore rejects bind parameter count mismatches", Catch::Matchers::ContainsSubstring ("parameter count mismatch")); } +TEST_CASE ("SQLite commit table profiling does not require epoch profiling", + "[store][profiling][commit][regression]") +{ + cortext::testing::ScopedEnvVar work ("CORTEXT_PROFILE_WORK_COUNTERS", "1"); + cortext::testing::ScopedEnvVar epoch ( + "CORTEXT_PROFILE_CONSOLIDATION_EPOCH", "0"); + auto store = cortext::SQLiteStore::Create (":memory:"); + store->Execute ("CREATE TABLE profiled_rows(id INTEGER PRIMARY KEY)"); + auto transaction = store->Begin (); + transaction->Execute ("INSERT INTO profiled_rows VALUES(1)"); + transaction->Commit (); + const auto profile + = cortext::internal::ConsumeSQLiteCommitProfile (store.get ()); + REQUIRE (profile.available); + const auto count = std::find_if ( + profile.table_row_counts.begin (), profile.table_row_counts.end (), + [] (const auto &entry) { return entry.first == "profiled_rows"; }); + REQUIRE (count != profile.table_row_counts.end ()); + REQUIRE (count->second == 1); +} + TEST_CASE ("SQLite mutation audit publishes committed logical identities", "[store][profiling][transaction]") { @@ -108,6 +130,7 @@ TEST_CASE ("SQLite mutation audit publishes committed logical identities", == 3); REQUIRE (MutationKeys (committed_batch.committed_hook_identities) == MutationKeys (committed_batch.committed_trigger_identities)); + REQUIRE (committed_batch.commit_vec_lookup_count == 0); { auto transaction = store->Begin (); diff --git a/tools/audit_paper_traceability.py b/tools/audit_paper_traceability.py new file mode 100644 index 00000000..ab67c99c --- /dev/null +++ b/tools/audit_paper_traceability.py @@ -0,0 +1,413 @@ +#!/usr/bin/env python3 +"""Fail-closed audit for experiment and algorithm paper traceability.""" + +from __future__ import annotations + +import argparse +import hashlib +import json +import re +import subprocess +import sys +from pathlib import Path +from typing import Any, Iterable + + +STATE_INVENTORY_PATTERN = re.compile( + r"(candidate|proof|experiment|evaluation|observation|repair|result|rerank)", + re.IGNORECASE, +) +ALGORITHM_SUFFIXES = {".c", ".cc", ".cpp", ".h", ".hh", ".hpp"} +REQUIRED_RECORD_FIELDS = { + "inventory_id", + "decision", + "corpus_parameter_scope", + "evidence_fingerprints", + "unresolved_limits", + "proof_level", + "evidence_kind", + "source_section", + "source_claim_fingerprints", + "manuscript_claim_fingerprints", +} +NON_PRODUCTION_EVIDENCE = { + "benchmark-only", + "modeled", + "observation-only", + "synthetic", +} + + +class DuplicateKeyError(ValueError): + pass + + +def _reject_duplicate_keys(pairs: list[tuple[str, Any]]) -> dict[str, Any]: + result: dict[str, Any] = {} + for key, value in pairs: + if key in result: + raise DuplicateKeyError(f"duplicate JSON key: {key}") + result[key] = value + return result + + +def load_json(path: Path) -> Any: + with path.open("r", encoding="utf-8") as stream: + return json.load(stream, object_pairs_hook=_reject_duplicate_keys) + + +def merge_state(base: dict[str, Any], overlay: dict[str, Any]) -> dict[str, Any]: + """Apply a task-local current-state overlay to the historical ledger.""" + if not isinstance(base, dict) or not isinstance(overlay, dict): + raise ValueError("paper traceability state and overlay must be objects") + return {**base, **overlay} + + +def sha256_text(value: str) -> str: + return hashlib.sha256(value.encode("utf-8")).hexdigest() + + +def state_inventory(state: dict[str, Any]) -> set[str]: + inventory: set[str] = set() + for key, value in state.items(): + if not isinstance(value, dict): + continue + serialized = json.dumps(value, sort_keys=True, separators=(",", ":")) + if ( + STATE_INVENTORY_PATTERN.search(key) + or '"decision"' in serialized + or '"proof_artifact"' in serialized + or '"experiment_result"' in serialized + ): + inventory.add(f"state:{key}") + for candidate in state.get("rejected_candidate_ids", []): + if isinstance(candidate, str) and candidate: + inventory.add(f"rejected:{candidate}") + return inventory + + +def _git_lines(repository: Path, arguments: list[str]) -> list[str]: + result = subprocess.run( + ["git", *arguments], + cwd=repository, + check=True, + text=True, + capture_output=True, + ) + return [line for line in result.stdout.splitlines() if line] + + +def changed_algorithm_paths(repository: Path, base_commit: str) -> set[str]: + committed = _git_lines( + repository, ["diff", "--name-only", f"{base_commit}...HEAD"] + ) + working = _git_lines(repository, ["diff", "--name-only"]) + untracked = _git_lines(repository, ["ls-files", "--others", "--exclude-standard"]) + result: set[str] = set() + for relative in committed + working + untracked: + path = Path(relative) + is_engine_algorithm = ( + path.parts + and path.parts[0] in {"src", "include"} + and path.suffix.lower() in ALGORITHM_SUFFIXES + ) + is_benchmark_implementation = ( + len(path.parts) >= 3 + and path.parts[:2] == ("examples", "benchmark") + and path.suffix.lower() in ALGORITHM_SUFFIXES + ) + is_experiment_tool = ( + len(path.parts) == 2 + and path.parts[0] == "tools" + and path.suffix == ".py" + and not path.stem.endswith("_test") + and path.name not in { + "audit_paper_traceability.py", + "build_paper_traceability_manifest.py", + } + ) + if is_engine_algorithm or is_benchmark_implementation or is_experiment_tool: + result.add(path.as_posix()) + return result + + +def section_contains_heading(text: str, heading: str) -> bool: + for line in text.splitlines(): + if not line.startswith("#"): + continue + normalized = re.sub(r"\s*\{[^}]*\}\s*$", "", line.lstrip("#").strip()) + if normalized == heading: + return True + return False + + +def _all_present(text: str, fingerprints: Iterable[str]) -> bool: + return all(isinstance(value, str) and value and value in text for value in fingerprints) + + +def audit( + state: dict[str, Any], + manifest: dict[str, Any], + sections_root: Path, + manuscript_path: Path, + repository: Path, +) -> dict[str, Any]: + uncovered_inventory: list[str] = [] + missing_source_claims: list[str] = [] + generated_claim_mismatches: list[str] = [] + proof_level_violations: list[str] = [] + ownership_violations: list[str] = [] + + if manifest.get("schema") != "cortext_paper_traceability_v1": + uncovered_inventory.append("manifest:schema") + + records = manifest.get("records") + if not isinstance(records, list): + records = [] + uncovered_inventory.append("manifest:records") + + record_by_id: dict[str, dict[str, Any]] = {} + duplicate_record_ids: set[str] = set() + record_defaults = manifest.get("record_defaults", {}) + if not isinstance(record_defaults, dict): + uncovered_inventory.append("manifest:record_defaults") + record_defaults = {} + for index, raw_record in enumerate(records): + record = raw_record + if not isinstance(record, dict): + uncovered_inventory.append(f"record:{index}:not-object") + continue + record = {**record_defaults, **record} + inventory_id = record.get("inventory_id") + if isinstance(inventory_id, str) and inventory_id: + marker = f"TRACE[{inventory_id}]" + record.setdefault("source_claim_fingerprints", [marker]) + record.setdefault("manuscript_claim_fingerprints", [marker]) + missing = sorted(REQUIRED_RECORD_FIELDS - set(record)) + if missing: + uncovered_inventory.extend( + f"record:{index}:missing:{field}" for field in missing + ) + inventory_id = record.get("inventory_id") + if not isinstance(inventory_id, str) or not inventory_id: + uncovered_inventory.append(f"record:{index}:invalid-inventory-id") + continue + if inventory_id in record_by_id: + duplicate_record_ids.add(inventory_id) + record_by_id[inventory_id] = record + uncovered_inventory.extend( + f"duplicate:{inventory_id}" for inventory_id in sorted(duplicate_record_ids) + ) + + expected_inventory = state_inventory(state) + variants = manifest.get("evaluated_bounded_route_variants", []) + if not isinstance(variants, list) or not variants: + uncovered_inventory.append("manifest:evaluated_bounded_route_variants") + variants = [] + for variant in variants: + if isinstance(variant, str) and variant: + expected_inventory.add(f"bounded-route-variant:{variant}") + else: + uncovered_inventory.append("manifest:invalid-bounded-route-variant") + + groups = manifest.get("algorithm_groups", []) + if not isinstance(groups, list) or not groups: + ownership_violations.append("manifest:algorithm_groups") + groups = [] + owned_paths: dict[str, list[str]] = {} + for group in groups: + if not isinstance(group, dict): + ownership_violations.append("algorithm-group:not-object") + continue + group_id = group.get("id") + paths = group.get("paths") + if not isinstance(group_id, str) or not group_id: + ownership_violations.append("algorithm-group:invalid-id") + continue + expected_inventory.add(f"algorithm:{group_id}") + if not isinstance(paths, list) or not paths: + ownership_violations.append(f"algorithm:{group_id}:missing-paths") + continue + for path in paths: + if not isinstance(path, str) or not path: + ownership_violations.append(f"algorithm:{group_id}:invalid-path") + continue + owned_paths.setdefault(path, []).append(group_id) + + base_commit = manifest.get("base_commit") + if not isinstance(base_commit, str) or not re.fullmatch(r"[0-9a-f]{40}", base_commit): + ownership_violations.append("manifest:base_commit") + changed_paths: set[str] = set() + else: + try: + changed_paths = changed_algorithm_paths(repository, base_commit) + except (OSError, subprocess.CalledProcessError) as error: + ownership_violations.append(f"git-diff:{type(error).__name__}") + changed_paths = set() + for path in sorted(changed_paths): + owners = owned_paths.get(path, []) + if len(owners) != 1: + ownership_violations.append( + f"algorithm-path:{path}:owner-count:{len(owners)}" + ) + for path, owners in sorted(owned_paths.items()): + if path not in changed_paths: + ownership_violations.append(f"algorithm-path:{path}:not-in-task-diff") + if len(owners) != 1: + ownership_violations.append( + f"algorithm-path:{path}:owner-count:{len(owners)}" + ) + + for inventory_id in sorted(expected_inventory): + if inventory_id not in record_by_id: + uncovered_inventory.append(inventory_id) + for inventory_id in sorted(set(record_by_id) - expected_inventory): + uncovered_inventory.append(f"unexpected:{inventory_id}") + + manuscript = manuscript_path.read_text(encoding="utf-8") + section_cache: dict[Path, str] = {} + for inventory_id, record in sorted(record_by_id.items()): + evidence = record.get("evidence_fingerprints") + limits = record.get("unresolved_limits") + if not isinstance(evidence, list) or not evidence: + missing_source_claims.append(f"{inventory_id}:evidence-fingerprints") + if not isinstance(limits, list): + missing_source_claims.append(f"{inventory_id}:unresolved-limits") + + proof_level = record.get("proof_level") + evidence_kind = record.get("evidence_kind") + if proof_level == "production-path" and evidence_kind in NON_PRODUCTION_EVIDENCE: + proof_level_violations.append( + f"{inventory_id}:{evidence_kind}-labeled-production-path" + ) + if proof_level not in { + "source-health", + "benchmark-only", + "modeled", + "production-path", + }: + proof_level_violations.append(f"{inventory_id}:unknown:{proof_level}") + + section = record.get("source_section") + if not isinstance(section, dict): + missing_source_claims.append(f"{inventory_id}:source-section") + continue + relative_path = section.get("path") + heading = section.get("heading") + if not isinstance(relative_path, str) or not isinstance(heading, str): + missing_source_claims.append(f"{inventory_id}:source-location") + continue + section_path = repository / relative_path + try: + section_path.relative_to(sections_root) + except ValueError: + missing_source_claims.append(f"{inventory_id}:outside-sections") + continue + if not section_path.is_file(): + missing_source_claims.append(f"{inventory_id}:missing-section") + continue + text = section_cache.setdefault( + section_path, section_path.read_text(encoding="utf-8") + ) + if not section_contains_heading(text, heading): + missing_source_claims.append(f"{inventory_id}:missing-heading:{heading}") + source_fingerprints = record.get("source_claim_fingerprints") + if not isinstance(source_fingerprints, list) or not _all_present( + text, source_fingerprints + ): + missing_source_claims.append(f"{inventory_id}:claim-fingerprint") + manuscript_fingerprints = record.get("manuscript_claim_fingerprints") + if not isinstance(manuscript_fingerprints, list) or not _all_present( + manuscript, manuscript_fingerprints + ): + generated_claim_mismatches.append( + f"{inventory_id}:manuscript-fingerprint" + ) + + ownership = manifest.get("ownership_model", {}) + if not isinstance(ownership, dict): + ownership_violations.append("ownership-model:not-object") + else: + if ownership.get("natural_durable_shared_algorithm") is not True: + ownership_violations.append("ownership-model:shared-algorithm") + if ownership.get("durable_only_flush_barrier") is not True: + ownership_violations.append("ownership-model:durable-barrier") + source_fingerprints = ownership.get("source_claim_fingerprints", []) + manuscript_fingerprints = ownership.get("manuscript_claim_fingerprints", []) + section_text = "\n".join(section_cache.values()) + if not _all_present(section_text, source_fingerprints): + ownership_violations.append("ownership-model:source-claim") + if not _all_present(manuscript, manuscript_fingerprints): + ownership_violations.append("ownership-model:manuscript-claim") + + result = { + "schema": "cortext_paper_traceability_audit_v1", + "passed": not any( + ( + uncovered_inventory, + missing_source_claims, + generated_claim_mismatches, + proof_level_violations, + ownership_violations, + ) + ), + "inventory_count": len(expected_inventory), + "record_count": len(records), + "state_sha256": sha256_text( + json.dumps(state, sort_keys=True, separators=(",", ":")) + ), + "manifest_sha256": sha256_text( + json.dumps(manifest, sort_keys=True, separators=(",", ":")) + ), + "manuscript_sha256": sha256_text(manuscript), + "uncovered_inventory": sorted(set(uncovered_inventory)), + "missing_source_claims": sorted(set(missing_source_claims)), + "generated_claim_mismatches": sorted(set(generated_claim_mismatches)), + "proof_level_violations": sorted(set(proof_level_violations)), + "ownership_violations": sorted(set(ownership_violations)), + } + return result + + +def main() -> int: + parser = argparse.ArgumentParser() + parser.add_argument("--state", required=True, type=Path) + parser.add_argument("--state-overlay", type=Path) + parser.add_argument("--manifest", required=True, type=Path) + parser.add_argument("--sections", required=True, type=Path) + parser.add_argument("--manuscript", required=True, type=Path) + parser.add_argument("--out", required=True, type=Path) + args = parser.parse_args() + + repository = Path.cwd().resolve() + try: + state = load_json(args.state) + if args.state_overlay is not None: + state = merge_state(state, load_json(args.state_overlay)) + manifest = load_json(args.manifest) + result = audit( + state, + manifest, + args.sections.resolve(), + args.manuscript.resolve(), + repository, + ) + except (DuplicateKeyError, json.JSONDecodeError, OSError, ValueError) as error: + result = { + "schema": "cortext_paper_traceability_audit_v1", + "passed": False, + "error": f"{type(error).__name__}: {error}", + "uncovered_inventory": ["audit-input-invalid"], + "missing_source_claims": [], + "generated_claim_mismatches": [], + "proof_level_violations": [], + "ownership_violations": [], + } + args.out.parent.mkdir(parents=True, exist_ok=True) + args.out.write_text(json.dumps(result, indent=2, sort_keys=True) + "\n") + print(json.dumps(result, indent=2, sort_keys=True)) + return 0 if result.get("passed") is True else 1 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/tools/audit_paper_traceability_test.py b/tools/audit_paper_traceability_test.py new file mode 100644 index 00000000..1a1b4c24 --- /dev/null +++ b/tools/audit_paper_traceability_test.py @@ -0,0 +1,134 @@ +#!/usr/bin/env python3 + +import tempfile +import unittest +from pathlib import Path + +import audit_paper_traceability as traceability +import build_paper_traceability_manifest as manifest_builder + + +class PaperTraceabilityAuditTests(unittest.TestCase): + def test_current_state_overlay_replaces_stale_control_fields(self): + merged = traceability.merge_state( + {"phase": "implement-hotspot", "completion": False}, + { + "phase": "production-cutover-review", + "sqlite_hnsw_production_cutover": { + "decision": "retained-production-default" + }, + }, + ) + self.assertEqual(merged["phase"], "production-cutover-review") + self.assertIn( + "state:sqlite_hnsw_production_cutover", + traceability.state_inventory(merged), + ) + + def test_knob_derived_candidates_preserve_exact_ablation_scope(self): + rif_scope = manifest_builder.state_scope( + "rif_epoch_consolidation_reset_candidate" + ) + self.assertIn("27 structural F/S/T points", rif_scope) + self.assertIn("nine production-shaped reset points", rif_scope) + self.assertIn("neutral B=128", rif_scope) + self.assertIn("129 used only", rif_scope) + + hnsw_scope = manifest_builder.state_scope("hnsw_fixed_6c_experiment") + self.assertIn("27 structural F/S/T points", hnsw_scope) + self.assertIn("production-default pre-screen", hnsw_scope) + self.assertIn("exact nine-point corpus matrix not started", hnsw_scope) + self.assertEqual( + manifest_builder.state_proof_level("hnsw_fixed_6c_experiment"), + ("benchmark-only", "measured"), + ) + + def test_state_inventory_includes_candidates_repairs_and_rejections(self): + state = { + "plain": {"value": 1}, + "candidate_a": {"status": "rejected"}, + "measured": {"decision": "accepted"}, + "repair_b": {"artifact": "proof.json"}, + "rejected_candidate_ids": ["old-route"], + } + self.assertEqual( + traceability.state_inventory(state), + { + "state:candidate_a", + "state:measured", + "state:repair_b", + "rejected:old-route", + }, + ) + + def test_duplicate_json_keys_fail_closed(self): + with tempfile.TemporaryDirectory() as directory: + path = Path(directory) / "duplicate.json" + path.write_text('{"a": 1, "a": 2}', encoding="utf-8") + with self.assertRaises(traceability.DuplicateKeyError): + traceability.load_json(path) + + def test_heading_ignores_quarto_identifier(self): + text = "# Title {#title}\n\n## Exact heading\n" + self.assertTrue(traceability.section_contains_heading(text, "Title")) + self.assertTrue( + traceability.section_contains_heading(text, "Exact heading") + ) + self.assertFalse(traceability.section_contains_heading(text, "Other")) + + def test_modeled_evidence_cannot_be_production_path(self): + with tempfile.TemporaryDirectory() as directory: + root = Path(directory) + sections = root / "docs" / "paper" / "sections" + sections.mkdir(parents=True) + section = sections / "test.qmd" + section.write_text("# Test\n\nTRACE[state:candidate]\n", encoding="utf-8") + manuscript = root / "index.md" + manuscript.write_text("TRACE[state:candidate]\nshared path\nbarrier\n") + state = {"candidate": {"decision": "accepted"}} + manifest = { + "schema": "cortext_paper_traceability_v1", + "base_commit": "0" * 40, + "evaluated_bounded_route_variants": ["route"], + "algorithm_groups": [{"id": "group", "paths": ["src/a.cpp"]}], + "ownership_model": { + "natural_durable_shared_algorithm": True, + "durable_only_flush_barrier": True, + "source_claim_fingerprints": ["TRACE[state:candidate]"], + "manuscript_claim_fingerprints": ["shared path", "barrier"], + }, + "records": [ + { + "inventory_id": "state:candidate", + "decision": "accepted", + "corpus_parameter_scope": "fixed", + "evidence_fingerprints": ["a" * 64], + "unresolved_limits": ["live proof pending"], + "proof_level": "production-path", + "evidence_kind": "modeled", + "source_section": { + "path": "docs/paper/sections/test.qmd", + "heading": "Test", + }, + "source_claim_fingerprints": ["TRACE[state:candidate]"], + "manuscript_claim_fingerprints": ["TRACE[state:candidate]"], + } + ], + } + original = traceability.changed_algorithm_paths + traceability.changed_algorithm_paths = lambda *_: {"src/a.cpp"} + try: + result = traceability.audit( + state, manifest, sections, manuscript, root + ) + finally: + traceability.changed_algorithm_paths = original + self.assertFalse(result["passed"]) + self.assertEqual( + result["proof_level_violations"], + ["state:candidate:modeled-labeled-production-path"], + ) + + +if __name__ == "__main__": + unittest.main() diff --git a/tools/audit_public_retrieval_control.py b/tools/audit_public_retrieval_control.py new file mode 100644 index 00000000..ca04acdb --- /dev/null +++ b/tools/audit_public_retrieval_control.py @@ -0,0 +1,367 @@ +#!/usr/bin/env python3 +"""Validate and sanitize the exact public GraphRetrieve control artifact.""" + +from __future__ import annotations + +import argparse +import hashlib +import json +import math +import sys +from pathlib import Path +from typing import Any + + +class DuplicateKeyError(ValueError): + pass + + +def reject_duplicate_keys(pairs: list[tuple[str, Any]]) -> dict[str, Any]: + result: dict[str, Any] = {} + for key, value in pairs: + if key in result: + raise DuplicateKeyError(f"duplicate JSON key: {key}") + result[key] = value + return result + + +def load_json(path: Path) -> Any: + with path.open("r", encoding="utf-8") as stream: + return json.load(stream, object_pairs_hook=reject_duplicate_keys) + + +def canonical_bytes(value: Any) -> bytes: + return json.dumps( + value, sort_keys=True, separators=(",", ":"), ensure_ascii=True + ).encode("utf-8") + + +def sha256(value: Any) -> str: + return hashlib.sha256(canonical_bytes(value)).hexdigest() + + +def file_sha256(path: Path) -> str: + digest = hashlib.sha256() + with path.open("rb") as stream: + for chunk in iter(lambda: stream.read(1024 * 1024), b""): + digest.update(chunk) + return digest.hexdigest() + + +def ranked_ids( + value: Any, *, query_ordinal: int, field: str, limit: int +) -> list[int]: + if not isinstance(value, list) or not value: + raise ValueError(f"query {query_ordinal} has empty {field}") + result: list[int] = [] + previous_score = math.inf + for expected_rank, row in enumerate(value[:limit]): + if not isinstance(row, dict): + raise ValueError(f"query {query_ordinal} {field} row is not an object") + memory_id = row.get("memory_id") + rank = row.get("rank") + score = row.get("score") + if not isinstance(memory_id, int) or memory_id <= 0: + raise ValueError(f"query {query_ordinal} {field} memory id is invalid") + if rank != expected_rank: + raise ValueError(f"query {query_ordinal} {field} ranks are not contiguous") + if not isinstance(score, (int, float)) or not math.isfinite(float(score)): + raise ValueError(f"query {query_ordinal} {field} score is invalid") + if float(score) > previous_score + 1.0e-12: + raise ValueError(f"query {query_ordinal} {field} scores are not ranked") + previous_score = float(score) + result.append(memory_id) + if len(result) != len(set(result)): + raise ValueError(f"query {query_ordinal} {field} repeats a memory id") + return result + + +def audit(profile: dict[str, Any], profile_sha256: str) -> dict[str, Any]: + control = profile.get("public_retrieval_control") + if not isinstance(control, dict): + raise ValueError("profile lacks public_retrieval_control object") + if control.get("schema") != "cortext_current_public_retrieval_control_v1": + raise ValueError("unexpected public retrieval control schema") + query_count = control.get("query_count") + result_k = control.get("result_k") + queries = control.get("queries") + if not isinstance(query_count, int) or query_count <= 0: + raise ValueError("query_count must be positive") + if not isinstance(result_k, int) or result_k <= 0: + raise ValueError("result_k must be positive") + if not isinstance(queries, list) or len(queries) != query_count: + raise ValueError("query population does not match query_count") + semantics = control.get("eligibility_semantics") + required_semantics = { + "timestamp_exclusion", + "supersession_exclusion", + "current_surface_selection", + "family_collapse", + "deterministic_tie_order", + } + if not isinstance(semantics, dict) or any( + semantics.get(key) is not True for key in required_semantics + ): + raise ValueError("public retrieval eligibility semantics are incomplete") + if control.get("identity_kind") != "memory-id": + raise ValueError("public retrieval control is not keyed by memory id") + if control.get("production_cutover") is not False: + raise ValueError("benchmark control must not claim production cutover") + coverage_contract = control.get("coverage_contract") + if not isinstance(coverage_contract, dict): + raise ValueError("public retrieval coverage contract is missing") + minimum_source_ids = coverage_contract.get("minimum_opaque_source_ids") + required_modalities_raw = coverage_contract.get("required_modalities") + modality_agnostic_proof = coverage_contract.get("modality_agnostic_proof") + if not isinstance(minimum_source_ids, int) or minimum_source_ids <= 0: + raise ValueError("minimum opaque source count is invalid") + if ( + not isinstance(required_modalities_raw, list) + or not required_modalities_raw + or any( + not isinstance(modality, str) or not modality + for modality in required_modalities_raw + ) + ): + raise ValueError("required modality coverage is invalid") + required_modalities = set(required_modalities_raw) + if not isinstance(modality_agnostic_proof, str) or not modality_agnostic_proof: + raise ValueError("modality-agnostic proof locator is missing") + + first_memory_events: dict[int, tuple[int, int]] = {} + surface_mutations = control.get("surface_mutations", []) + if not isinstance(surface_mutations, list): + raise ValueError("public retrieval surface mutations are invalid") + for mutation in surface_mutations: + if not isinstance(mutation, dict) or mutation.get("action") != "upsert": + continue + memory_id = mutation.get("memory_id") + event_index = mutation.get("event_index") + event_timestamp = mutation.get("event_timestamp") + if ( + not isinstance(memory_id, int) + or memory_id <= 0 + or not isinstance(event_index, int) + or event_index < 0 + or not isinstance(event_timestamp, int) + or event_timestamp < 0 + ): + raise ValueError("public retrieval surface upsert identity is invalid") + prior = first_memory_events.get(memory_id) + if prior is None or (event_index, event_timestamp) < prior: + first_memory_events[memory_id] = (event_index, event_timestamp) + + prior_event = -1 + prior_timestamp = -1 + source_digests: set[str] = set() + modalities: set[str] = set() + exact_hits = 0 + exact_expected = 0 + top1_hits = 0 + candidate_queries = 0 + semantic_coverage_total = 0.0 + deterministic_ties = True + query_fingerprints: list[dict[str, Any]] = [] + top1_miss_fingerprints: list[dict[str, Any]] = [] + for ordinal, query in enumerate(queries): + if not isinstance(query, dict) or query.get("query_ordinal") != ordinal: + raise ValueError("query ordinals are not contiguous") + event_index = query.get("event_index") + timestamp = query.get("query_timestamp") + if not isinstance(event_index, int) or event_index <= prior_event: + raise ValueError("query event indices are not strictly increasing") + if not isinstance(timestamp, int) or timestamp <= prior_timestamp: + raise ValueError("query timestamps are not strictly increasing") + prior_event = event_index + prior_timestamp = timestamp + source_digest = query.get("source_id_blake3") + modality = query.get("modality") + if not isinstance(source_digest, str) or len(source_digest) != 64: + raise ValueError("query source digest is invalid") + if not isinstance(modality, str) or not modality: + raise ValueError("query modality is invalid") + source_digests.add(source_digest) + modalities.add(modality) + query_embedding = query.get("query_embedding") + if ( + not isinstance(query_embedding, list) + or len(query_embedding) != 256 + or any( + not isinstance(value, (int, float)) + or not math.isfinite(float(value)) + for value in query_embedding + ) + ): + raise ValueError("query embedding is not a finite 256-vector") + control_ids = ranked_ids( + query.get("control_seed_ranked"), + query_ordinal=ordinal, + field="control_seed_ranked", + limit=result_k, + ) + candidate_ids: list[int] | None = None + top1_exact_match: bool | None = None + if query.get("candidate_available") is True: + candidate_ids = ranked_ids( + query.get("candidate_seed_ranked"), + query_ordinal=ordinal, + field="candidate_seed_ranked", + limit=result_k, + ) + candidate_queries += 1 + exact_hits += len(set(control_ids) & set(candidate_ids)) + exact_expected += len(control_ids) + top1_exact_match = control_ids[0] == candidate_ids[0] + top1_hits += int(top1_exact_match) + coverage = query.get("semantic_coverage") + if not isinstance(coverage, (int, float)) or not math.isfinite( + float(coverage) + ): + raise ValueError("candidate semantic coverage is invalid") + semantic_coverage_total += float(coverage) + deterministic_ties = deterministic_ties and ( + query.get("deterministic_tie_order") is True + ) + first_memory_event = first_memory_events.get(control_ids[0]) + control_top1_age_events = ( + event_index - first_memory_event[0] + if first_memory_event is not None + else None + ) + control_top1_age_ms = ( + timestamp - first_memory_event[1] + if first_memory_event is not None + else None + ) + fingerprint = { + "query_ordinal": ordinal, + "event_index": event_index, + "query_timestamp": timestamp, + "source_id_blake3": source_digest, + "modality": modality, + "query_embedding_sha256": sha256(query_embedding), + "control_seed_rank_sha256": sha256(control_ids), + "control_graph_rank_sha256": sha256( + query.get("control_graph_ranked") + ), + "control_public_rank_sha256": sha256( + query.get("control_public_ranked") + ), + "candidate_seed_rank_sha256": ( + sha256(candidate_ids) if candidate_ids is not None else None + ), + "top1_exact_match": top1_exact_match, + "control_top1_age_events": control_top1_age_events, + "control_top1_age_ms": control_top1_age_ms, + } + query_fingerprints.append(fingerprint) + if top1_exact_match is False: + top1_miss_fingerprints.append( + { + "query_ordinal": ordinal, + "query_progress_quartile": min(3, ordinal * 4 // query_count), + "source_id_blake3": source_digest, + "modality": modality, + "control_top1_age_events": control_top1_age_events, + "control_top1_age_ms": control_top1_age_ms, + } + ) + + candidate_complete = candidate_queries == query_count + recall = ( + exact_hits / exact_expected + if candidate_complete and exact_expected > 0 + else None + ) + top1 = top1_hits / query_count if candidate_complete else None + top1_miss_count = query_count - top1_hits if candidate_complete else None + semantic = ( + semantic_coverage_total / query_count if candidate_complete else None + ) + quality_passed = bool( + candidate_complete + and recall is not None + and recall >= 0.998 + and top1 is not None + and top1 >= 0.998 + and top1_miss_count is not None + and top1_miss_count <= 1 + and semantic is not None + and semantic >= 0.95 + and deterministic_ties + and len(source_digests) >= minimum_source_ids + and required_modalities.issubset(modalities) + ) + return { + "schema": "cortext_current_public_retrieval_control_audit_v1", + "status": ( + "candidate-quality-passed" + if quality_passed + else ( + "exact-public-control-validated-candidate-pending" + if not candidate_complete + else "candidate-quality-failed" + ) + ), + "passed": True, + "control_population_passed": True, + "candidate_complete": candidate_complete, + "candidate_quality_passed": quality_passed, + "query_count": query_count, + "result_k": result_k, + "retrieval_active_event_count": control.get( + "retrieval_active_event_count" + ), + "event_index_first": queries[0]["event_index"], + "event_index_last": queries[-1]["event_index"], + "source_digest_count": len(source_digests), + "modalities": sorted(modalities), + "coverage_contract": { + "minimum_opaque_source_ids": minimum_source_ids, + "required_modalities": sorted(required_modalities), + "modality_agnostic_proof": modality_agnostic_proof, + }, + "exact_identity_recall_at_k": recall, + "exact_top1": top1, + "exact_top1_hits": top1_hits, + "exact_top1_miss_count": top1_miss_count, + "exact_top1_minimum": max (0.998, (query_count - 1) / query_count), + "semantic_coverage": semantic, + "deterministic_tie_order": deterministic_ties if candidate_complete else None, + "private_profile_sha256": profile_sha256, + "query_fingerprints": query_fingerprints, + "top1_miss_fingerprints": top1_miss_fingerprints, + "production_cutover": False, + "unresolved_limits": ( + [] + if quality_passed + else [ + "bounded candidate ranks or the declared source/modality coverage contract remains pending" + ] + ), + } + + +def main() -> int: + parser = argparse.ArgumentParser() + parser.add_argument("--profile", required=True, type=Path) + parser.add_argument("--out", required=True, type=Path) + args = parser.parse_args() + try: + result = audit(load_json(args.profile), file_sha256(args.profile)) + except (DuplicateKeyError, json.JSONDecodeError, OSError, ValueError) as error: + result = { + "schema": "cortext_current_public_retrieval_control_audit_v1", + "status": "invalid", + "passed": False, + "error": f"{type(error).__name__}: {error}", + "production_cutover": False, + } + args.out.parent.mkdir(parents=True, exist_ok=True) + args.out.write_text(json.dumps(result, indent=2, sort_keys=True) + "\n") + print(json.dumps(result, indent=2, sort_keys=True)) + return 0 if result.get("passed") is True else 1 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/tools/audit_public_retrieval_control_test.py b/tools/audit_public_retrieval_control_test.py new file mode 100644 index 00000000..d6554201 --- /dev/null +++ b/tools/audit_public_retrieval_control_test.py @@ -0,0 +1,149 @@ +import copy +import unittest + +from audit_public_retrieval_control import audit + + +def ranked(ids): + return [ + {"memory_id": identity, "embedding_id": identity + 100, "score": 1 - rank / 100, "rank": rank} + for rank, identity in enumerate(ids) + ] + + +def fixture(candidate=False): + queries = [] + for ordinal in range(2): + query = { + "query_ordinal": ordinal, + "event_index": 10 + ordinal * 10, + "query_timestamp": 1000 + ordinal * 1000, + "source_id_blake3": f"{ordinal + 1:064x}", + "modality": "text", + "query_embedding": [0.0] * 256, + "control_seed_ranked": ranked([1, 2]), + "control_graph_ranked": ranked([1, 2]), + "control_public_ranked": ranked([1, 2]), + "candidate_available": candidate, + } + if candidate: + query.update( + { + "candidate_seed_ranked": ranked([1, 2]), + "semantic_coverage": 1.0, + "deterministic_tie_order": True, + } + ) + queries.append(query) + return { + "public_retrieval_control": { + "schema": "cortext_current_public_retrieval_control_v1", + "identity_kind": "memory-id", + "query_count": 2, + "result_k": 2, + "retrieval_active_event_count": 10, + "eligibility_semantics": { + "timestamp_exclusion": True, + "supersession_exclusion": True, + "current_surface_selection": True, + "family_collapse": True, + "deterministic_tie_order": True, + }, + "coverage_contract": { + "minimum_opaque_source_ids": 4, + "required_modalities": ["text"], + "modality_agnostic_proof": "focused active-route label-invariance test", + }, + "production_cutover": False, + "surface_mutations": [ + { + "action": "upsert", + "memory_id": 1, + "event_index": 2, + "event_timestamp": 200, + }, + { + "action": "upsert", + "memory_id": 2, + "event_index": 3, + "event_timestamp": 300, + }, + ], + "queries": queries, + } + } + + +class PublicRetrievalControlAuditTest(unittest.TestCase): + def test_control_only_is_valid_but_not_candidate_proof(self): + result = audit(fixture(), "0" * 64) + self.assertTrue(result["passed"]) + self.assertTrue(result["control_population_passed"]) + self.assertFalse(result["candidate_complete"]) + self.assertFalse(result["candidate_quality_passed"]) + + def test_duplicate_or_unsorted_identity_fails(self): + value = fixture() + value["public_retrieval_control"]["queries"][0]["control_seed_ranked"] = ranked([1, 1]) + with self.assertRaisesRegex(ValueError, "repeats"): + audit(value, "0" * 64) + + def test_missing_runtime_semantic_fails(self): + value = fixture() + del value["public_retrieval_control"]["eligibility_semantics"]["family_collapse"] + with self.assertRaisesRegex(ValueError, "semantics"): + audit(value, "0" * 64) + + def test_candidate_without_declared_source_coverage_does_not_pass(self): + result = audit(fixture(candidate=True), "0" * 64) + self.assertTrue(result["candidate_complete"]) + self.assertEqual(result["exact_top1"], 1.0) + self.assertFalse(result["candidate_quality_passed"]) + + def test_candidate_passes_declared_system_coverage_contract(self): + value = fixture(candidate=True) + value["public_retrieval_control"]["coverage_contract"][ + "minimum_opaque_source_ids" + ] = 2 + result = audit(value, "0" * 64) + self.assertTrue(result["candidate_quality_passed"]) + self.assertEqual(result["modalities"], ["text"]) + self.assertEqual(result["top1_miss_fingerprints"], []) + self.assertTrue(result["query_fingerprints"][0]["top1_exact_match"]) + self.assertEqual( + result["query_fingerprints"][0]["control_top1_age_events"], 8 + ) + + def test_single_top1_miss_has_sanitized_cluster_dimensions(self): + value = fixture(candidate=True) + value["public_retrieval_control"]["coverage_contract"][ + "minimum_opaque_source_ids" + ] = 2 + value["public_retrieval_control"]["queries"][0][ + "candidate_seed_ranked" + ] = ranked([2, 1]) + result = audit(value, "0" * 64) + self.assertEqual(result["exact_top1_miss_count"], 1) + self.assertEqual( + result["top1_miss_fingerprints"], + [ + { + "query_ordinal": 0, + "query_progress_quartile": 0, + "source_id_blake3": f"{1:064x}", + "modality": "text", + "control_top1_age_events": 8, + "control_top1_age_ms": 800, + } + ], + ) + + def test_missing_coverage_contract_fails(self): + value = fixture(candidate=True) + del value["public_retrieval_control"]["coverage_contract"] + with self.assertRaisesRegex(ValueError, "coverage contract"): + audit(value, "0" * 64) + + +if __name__ == "__main__": + unittest.main() diff --git a/tools/audit_storage_cost_profile.py b/tools/audit_storage_cost_profile.py old mode 100644 new mode 100755 index 10e45a79..4e435ec8 --- a/tools/audit_storage_cost_profile.py +++ b/tools/audit_storage_cost_profile.py @@ -52,6 +52,27 @@ "emotional_neighbor_count", "emotional_update_count", ) +# Historical profiles from the rejected emotional-priority experiment contain +# these extra counters. They remain readable evidence, but current profiles do +# not emit them and they never count as timing measurements. +LEGACY_REJECTED_EMOTIONAL_WORK_COUNTERS = { + "emotional_source_candidate_count", + "emotional_source_priority_comparison_count", + "emotional_source_priority_move_count", + "emotional_source_memory_emission_count", + "emotional_source_embedding_emission_count", + "emotional_edge_visit_count", + "emotional_frontier_entry_count", + "emotional_topology_footprint_entry_count", + "emotional_activated_identity_count", + "emotional_member_overflow_count", + "emotional_member_budget_skip_count", + "emotional_member_read_count", + "emotional_sql_affected_row_count", + "emotional_cache_row_mutation_count", + "emotional_source_index_comparison_count", + "emotional_source_index_move_count", +} REQUIRED_CONSOLIDATION_EPOCH_COUNTERS = ( "accumulator_signal_count", "working_memory_pending_signal_count", @@ -59,45 +80,70 @@ "consolidation_dirty_association_count", "consolidation_dirty_index_count", ) -ACTIVE_EPOCH_LIMITS = { - "event_count": 512, - "mutation_count": 32768, - "allocated_bytes": 64 * 1024 * 1024, -} +RESETTABLE_CONSOLIDATION_EPOCH_COUNTERS = ( + "working_memory_pending_signal_count", + "consolidation_dirty_memory_count", + "consolidation_dirty_association_count", + "consolidation_dirty_index_count", +) + + +def active_epoch_limits( + focus: float, sensitivity: float, stability: float +) -> dict[str, int]: + def clamped(value: float, label: str) -> float: + if isinstance(value, bool) or not isinstance(value, (int, float)): + raise ValueError(f"{label} must be numeric") + result = float(value) + if not math.isfinite(result): + raise ValueError(f"{label} must be finite") + return min(1.0, max(0.0, result)) + + f = clamped(focus, "profile focus") + s = clamped(sensitivity, "profile sensitivity") + t = clamped(stability, "profile stability") + capacity = math.floor(256.0 + 256.0 * f + 128.0 * s + 128.0 * t + 0.5) + row_batch_size = math.floor(64.0 + 64.0 * f + 32.0 * s + 32.0 * t + 0.5) + return { + "event_count": capacity, + "mutation_count": capacity * 64, + "allocated_bytes": capacity * 128 * 1024, + "row_batch_size": row_batch_size, + } + + COUNTER_ACTIVITY_OPERATIONS = { "retrieval_suppression_id_count": ( - "Competition.rif_recovery_active_sql", + "SignalProcessor.retrieval_suppression_id_activity", ), - "predictive_id_count": ("Predictive.decay_active_sql",), + "predictive_id_count": ("SignalProcessor.predictive_id_activity",), "rollback_full_cache_copy_count": ( - "SignalProcessor.snapshot_full_cache_copy", + "SignalProcessor.snapshot_full_cache_copy_activity", ), "rollback_cache_entry_copy_count": ( - "SignalProcessor.snapshot_cache_entry_copy", + "SignalProcessor.snapshot_cache_entry_copy_activity", ), - "graph_candidate_count": ("GraphRetrieve.total",), + "graph_candidate_count": ("GraphRetrieve.candidate_activity",), "graph_exact_comparison_count": ( - "GraphRetrieve.seed_cache_family_compare", + "GraphRetrieve.family_exact_comparison_activity", ), - "graph_cache_rebuild_count": ("GraphRetrieve.seed_knn_cache_rebuild",), - "graph_rows_visited": ("GraphRetrieve.seed_cache_distance",), - "competition_candidate_count": ("Competition.score_candidates",), - "competition_rows_visited": ("Competition.rif_recovery_active_sql",), - "competition_rows_touched": ("Competition.rif_recovery_active_sql",), + "graph_cache_rebuild_count": ("GraphRetrieve.cache_rebuild_activity",), + "graph_rows_visited": ("GraphRetrieve.rows_visited_activity",), + "competition_candidate_count": ("Competition.candidate_activity",), + "competition_rows_visited": ("Competition.rows_visited_activity",), + "competition_rows_touched": ("Competition.rows_touched_activity",), "supersession_current_candidate_count": ( - "MemoryStorage.supersession_current_candidate_execution_count", + "MemoryStorage.supersession_current_candidate_activity", ), "supersession_historical_candidate_count": ( - "MemoryStorage.supersession_historical_candidate_execution_count", + "MemoryStorage.supersession_historical_candidate_activity", ), "supersession_rows_visited": ( - "MemoryStorage.supersession_candidate_load", + "MemoryStorage.supersession_rows_visited_activity", ), - "emotional_source_count": ("EmotionalCascade.source_execution_count",), - "emotional_neighbor_count": ( - "EmotionalCascade.neighbor_execution_count", - ), - "emotional_update_count": ("EmotionalCascade.update_execution_count",), + "emotional_source_count": ("EmotionalCascade.source_activity",), + "emotional_neighbor_count": ("EmotionalCascade.neighbor_activity",), + "emotional_update_count": ("EmotionalCascade.update_activity",), } COUNTER_SOURCE_OPERATIONS = { "retrieval_suppression_id_count": ( @@ -115,7 +161,9 @@ "GraphRetrieve.family_exact_comparison_count", ), "graph_cache_rebuild_count": ("GraphRetrieve.cache_rebuild_count",), - "graph_rows_visited": ("GraphRetrieve.rows_visited",), + "graph_rows_visited": ( + "GraphRetrieve.rows_visited", + ), "competition_candidate_count": ("Competition.candidate_count",), "competition_rows_visited": ("Competition.rows_visited",), "competition_rows_touched": ("Competition.rows_touched",), @@ -128,12 +176,20 @@ "supersession_rows_visited": ( "MemoryStorage.supersession_current_rows_visited", "MemoryStorage.supersession_historical_rows_visited", + "MemoryStorage.supersession_sparse_route_node_rows", ), "emotional_source_count": ("EmotionalCascade.source_count",), "emotional_neighbor_count": ("EmotionalCascade.neighbor_count",), "emotional_update_count": ("EmotionalCascade.update_count",), } OTHER_DIAGNOSTIC_OPERATION_KEYS = { + "GraphRetrieve.sqlite_sparse_route_activated_identities", + "GraphRetrieve.sqlite_sparse_route_node_rows", + "GraphRetrieve.sqlite_sparse_route_activation_snapshot_rows", + "GraphRetrieve.sqlite_sparse_route_activation_snapshot_cache_miss_rows", + "GraphRetrieve.sqlite_sparse_route_distance_evaluations", + "GraphRetrieve.sqlite_sparse_route_restart_rows", + "GraphRetrieve.sqlite_sparse_route_dirty_rows", "GraphRetrieve.seed_cache_distance_rows", "GraphRetrieve.seed_cache_eligibility_rows", "GraphRetrieve.seed_cache_ranked_rows", @@ -142,14 +198,83 @@ "SignalProcessor.rif_active_epoch_event_count", "SignalProcessor.rif_active_epoch_mutation_count", "SignalProcessor.rif_active_epoch_allocated_bytes", + "SignalProcessor.rif_active_epoch_row_batch_high_water", + "EmotionalCascade.update_limit_reached", "SignalProcessor.rif_active_epoch_required", "SignalProcessor.rif_epoch_publication_rebuild_count", "SignalProcessor.rif_epoch_publication_recovery_count", "SignalProcessor.sqlite_wal_checkpoint_failure_count", "MemoryStorage.supersession_current_rows_visited", "MemoryStorage.supersession_historical_rows_visited", + "MemoryStorage.supersession_sparse_route_node_rows", + "MemoryStorage.supersession_sparse_route_distance_evaluations", + "MemoryStorage.supersession_sparse_route_dirty_rows", "MemoryStorage.supersession_sql_fallback_count", + "MemoryStorage.supersession_population_mismatch_count", + "WriteGate.flush_trigger", + "WriteGate.spike_bypass", + "WriteGate.accumulator_available", + "WriteGate.n_signals", + "WriteGate.coverage", + "WriteGate.window_score", + "WriteGate.threshold_dynamic", + "WriteGate.refractory_multiplier", + "WriteGate.write_scale", + "WriteGate.effective_threshold", + "WriteGate.score_margin", + "WriteGate.force_write", + "WriteGate.write_accumulator", + "WriteGate.reason_code", + "Cortext.fallback_hydration_signal_rows", + "EmotionalCascade.bounded_mode", + "EmotionalCascade.source_candidate_count", + "EmotionalCascade.source_priority_comparison_count", + "EmotionalCascade.source_priority_move_count", + "EmotionalCascade.source_memory_emission_count", + "EmotionalCascade.source_embedding_emission_count", + "EmotionalCascade.edge_visit_count", + "EmotionalCascade.frontier_entry_count", + "EmotionalCascade.topology_footprint_entry_count", + "EmotionalCascade.activated_identity_count", + "EmotionalCascade.member_overflow_count", + "EmotionalCascade.member_budget_skip_count", + "EmotionalCascade.member_read_count", + "EmotionalCascade.sql_affected_row_count", + "EmotionalCascade.cache_row_mutation_count", + "EmotionalCascade.source_index_comparison_count", + "EmotionalCascade.source_index_move_count", + "EmotionalCascade.source_candidate_limit", + "EmotionalCascade.source_execution_limit", + "EmotionalCascade.edge_visit_limit", + "EmotionalCascade.frontier_entry_limit", + "EmotionalCascade.activated_identity_limit", + "EmotionalCascade.update_statement_limit", + "EmotionalCascade.shared_member_limit", + "EmotionalCascade.logical_member_overflow_boundary", + "EmotionalCascade.member_read_limit", + "EmotionalCascade.sql_affected_row_limit", + "EmotionalCascade.cache_row_mutation_limit", + "EmotionalCascade.topology_footprint_entry_limit", + "EmotionalCascade.source_index_maintenance_limit", + "EmotionalCascade.source_priority_comparison_limit", } +DIAGNOSTIC_OPERATION_SUFFIXES = ( + "_activity", + "_active", + "_ambiguous", + "_budget", + "_count", + "_effort", + "_equivalent", + "_failure_code", + "_limit", + "_proven", + "_published", + "_reached", + "_skipped", + "_succeeded", + "_target", +) def diagnostic_operation_keys() -> set[str]: @@ -169,6 +294,8 @@ def is_duration_operation(name: str) -> bool: return ( name not in diagnostic_operation_keys() and not name.startswith("ConsolidationEpoch.") + and not name.startswith("SignalProcessor.commit_table_row_count.") + and not name.endswith(DIAGNOSTIC_OPERATION_SUFFIXES) ) MINIMUM_POST_WARMUP_WINDOWS = 10 PLATEAU_MINIMUM_WINDOWS = 6 @@ -214,8 +341,9 @@ def is_duration_operation(name: str) -> bool: RETRIEVAL_CYCLE_MAX_OVER_TRAILING_MEAN_MAX = 1.25 RETRIEVAL_QUALITY_QUERY_COUNT = 512 RETRIEVAL_QUALITY_K = 16 -RETRIEVAL_EXACT_ID_RECALL_MIN = 1.0 -RETRIEVAL_EXACT_TOP1_MIN = 1.0 +RETRIEVAL_EXACT_ID_RECALL_MIN = 0.998 +RETRIEVAL_EXACT_TOP1_MIN = 511 / 512 +RETRIEVAL_EXACT_TOP1_MAX_MISSES = 1 RETRIEVAL_SEMANTIC_COVERAGE_MIN = 0.95 CONSOLIDATION_EPOCH_MATERIAL_RAMP_RATIO_MIN = 1.10 CONSOLIDATION_EPOCH_POST_PRE_PROCESS_RATIO_MAX = 0.90 @@ -328,15 +456,24 @@ def bootstrap_upper_slope( y - (intercept + fitted_slope * x) for x, y in zip(xs, ys) ] + mean_x = statistics.mean(xs) + centered_xs = [x - mean_x for x in xs] + denominator = sum(value * value for value in centered_xs) + if denominator == 0.0: + raise ValueError("at least two distinct windows are required") rng = random.Random(0) slopes = [] for _ in range(repetitions): - sampled = [rng.choice(residuals) for _ in residuals] - synthetic = [ - intercept + fitted_slope * x + residual - for x, residual in zip(xs, sampled) - ] - slopes.append(theil_sen(xs, synthetic)) + # Keep the robust Theil-Sen line as the bootstrap center, then fit the + # resampled residual perturbation in O(n). Re-running the O(n^2) + # pairwise estimator for every repetition makes a valid long epoch + # series require billions of comparisons without changing the named + # deterministic residual-bootstrap contract. + residual_slope = sum( + centered_x * rng.choice(residuals) + for centered_x in centered_xs + ) / denominator + slopes.append(fitted_slope + residual_slope) slopes.sort() return slopes[math.ceil(0.95 * len(slopes)) - 1] @@ -564,6 +701,238 @@ def ratio(numerator: float, denominator: float) -> float: return numerator / denominator +def activity_normalized_reset_diagnostic( + evaluation_inputs: Sequence[dict[str, Any]], + raw_gate_failures: Sequence[str], + *, + knob_context: dict[str, Any] | None = None, +) -> dict[str, Any]: + """Classify activity incidence without changing the raw sawtooth verdict.""" + if not isinstance(raw_gate_failures, Sequence) or isinstance( + raw_gate_failures, (str, bytes) + ): + raise ValueError("raw gate failures must be a sequence") + preserved_failures = [] + for failure in raw_gate_failures: + if not isinstance(failure, str): + raise ValueError("raw gate failure must be a string") + preserved_failures.append(failure) + + resolved_knobs = None + if knob_context is not None: + if not isinstance(knob_context, dict): + raise ValueError("knob context must be an object") + limits = active_epoch_limits( + knob_context.get("focus"), + knob_context.get("sensitivity"), + knob_context.get("stability"), + ) + processed_rows = nonnegative_integer( + knob_context.get("processed_backfill_rows", 0), + "processed backfill rows", + ) + backfill_batch = limits["row_batch_size"] + if processed_rows > backfill_batch: + raise ValueError("processed rows exceed F/S/T-derived B") + resolved_knobs = { + "backfill_batch": backfill_batch, + "logical_backfill_boundary_only": backfill_batch + 1, + "processed_backfill_rows": processed_rows, + } + + evaluations = [] + epoch_windows: dict[int, tuple[tuple[int, ...], tuple[int, ...]]] = {} + seen_epoch_operations: set[tuple[int, str]] = set() + for item in evaluation_inputs: + if not isinstance(item, dict): + raise ValueError("activity-normalized evaluation must be an object") + operation = item.get("operation") + if not isinstance(operation, str) or not operation: + raise ValueError("activity-normalized operation id must be a string") + epoch = nonnegative_integer(item.get("epoch"), "activity epoch") + sequence_names = ( + "trailing_event_indices", + "post_event_indices", + "trailing_ms", + "post_ms", + "trailing_activity", + "post_activity", + ) + sequences = {} + for name in sequence_names: + value = item.get(name) + if not isinstance(value, list): + raise ValueError(f"{name} must be a list") + sequences[name] = value + lengths = {len(value) for value in sequences.values()} + if len(lengths) != 1 or not lengths or next(iter(lengths)) == 0: + raise ValueError("activity normalization requires matching event windows") + trailing_indices = [ + nonnegative_integer(value, "trailing event index") + for value in sequences["trailing_event_indices"] + ] + post_indices = [ + nonnegative_integer(value, "post event index") + for value in sequences["post_event_indices"] + ] + if len(set(trailing_indices + post_indices)) != len( + trailing_indices + post_indices + ): + raise ValueError("activity normalization requires matching event windows") + if ( + trailing_indices != list(range( + trailing_indices[0], trailing_indices[0] + len(trailing_indices) + )) + or post_indices != list(range( + post_indices[0], post_indices[0] + len(post_indices) + )) + or post_indices[0] != trailing_indices[-1] + 1 + ): + raise ValueError( + "activity normalization requires contiguous adjacent event windows" + ) + window_identity = (tuple(trailing_indices), tuple(post_indices)) + prior_window = epoch_windows.setdefault(epoch, window_identity) + if prior_window != window_identity: + raise ValueError( + "activity-normalized operations in the same epoch must share event windows" + ) + epoch_operation = (epoch, operation) + if epoch_operation in seen_epoch_operations: + raise ValueError("duplicate activity-normalized epoch operation") + seen_epoch_operations.add(epoch_operation) + numeric = { + name: [ + finite_nonnegative(value, f"activity-normalized {name}") + for value in sequences[name] + ] + for name in ( + "trailing_ms", + "post_ms", + "trailing_activity", + "post_activity", + ) + } + trailing_ms = finite_nonnegative( + sum(numeric["trailing_ms"]), "aggregate trailing milliseconds" + ) + post_ms = finite_nonnegative( + sum(numeric["post_ms"]), "aggregate post milliseconds" + ) + trailing_activity = finite_nonnegative( + sum(numeric["trailing_activity"]), "aggregate trailing activity" + ) + post_activity = finite_nonnegative( + sum(numeric["post_activity"]), "aggregate post activity" + ) + operation_ms_delta = post_ms - trailing_ms + if not math.isfinite(operation_ms_delta): + raise ValueError("aggregate operation delta must be finite") + result = { + "epoch": epoch, + "operation": operation, + "status": "valid", + "trailing_ms": trailing_ms, + "post_ms": post_ms, + "trailing_activity": trailing_activity, + "post_activity": post_activity, + "activity_ratio": None, + "trailing_unit_cost": None, + "post_unit_cost": None, + "unit_cost_ratio": None, + "operation_ms_delta": operation_ms_delta, + "classification": None, + } + if trailing_activity == 0.0 and post_activity == 0.0: + result["status"] = "unevaluated" + result["classification"] = "not-explanatory" + elif trailing_activity == 0.0 or post_activity == 0.0: + result["status"] = "incomparable" + result["classification"] = "not-explanatory" + else: + trailing_unit_cost = finite_nonnegative( + trailing_ms / trailing_activity, + "activity-normalized trailing unit cost", + ) + post_unit_cost = finite_nonnegative( + post_ms / post_activity, + "activity-normalized post unit cost", + ) + unit_cost_ratio = finite_nonnegative( + ratio(post_unit_cost, trailing_unit_cost), + "activity-normalized unit-cost ratio", + ) + activity_ratio = finite_nonnegative( + post_activity / trailing_activity, + "activity-normalized activity ratio", + ) + result.update({ + "activity_ratio": activity_ratio, + "trailing_unit_cost": trailing_unit_cost, + "post_unit_cost": post_unit_cost, + "unit_cost_ratio": unit_cost_ratio, + }) + if unit_cost_ratio > OPERATION_HALF_RATIO_MAX: + result["classification"] = "per-unit-regression" + elif activity_ratio > 1.0 and operation_ms_delta > 0.0: + result["classification"] = "activity-incidence" + else: + result["classification"] = "not-explanatory" + evaluations.append(result) + + per_unit = [ + item for item in evaluations + if item["classification"] == "per-unit-regression" + ] + incidence = [ + item for item in evaluations + if item["classification"] == "activity-incidence" + ] + selected = None + diagnostic_result = "diagnostic-inconclusive" + continuation = "deepen-profile" + if per_unit: + selected = sorted( + per_unit, + key=lambda item: ( + -float(item["unit_cost_ratio"]), + -max(0.0, float(item["operation_ms_delta"])), + str(item["operation"]), + int(item["epoch"]), + ), + )[0] + diagnostic_result = "per-unit-regression" + continuation = "implement-per-unit-cost-hotspot" + elif incidence: + selected = sorted( + incidence, + key=lambda item: ( + -float(item["operation_ms_delta"]), + -float(item["activity_ratio"]), + str(item["operation"]), + int(item["epoch"]), + ), + )[0] + diagnostic_result = "activity-incidence" + continuation = "attribute-activity-generation" + selected_hotspot = None if selected is None else { + "operation": selected["operation"], + "epoch": selected["epoch"], + "classification": selected["classification"], + } + return { + "diagnostic_result": diagnostic_result, + "selected_hotspot": selected_hotspot, + "continuation": continuation, + "evaluations": evaluations, + "raw_gate_passed": not preserved_failures, + "raw_gate_failures": preserved_failures, + "raw_gate_waived": False, + "label_arithmetic": "ignored", + "knob_context": resolved_knobs, + } + + def half_comparison(values: Sequence[float]) -> dict[str, float]: half = len(values) // 2 if half == 0: @@ -601,7 +970,12 @@ def validate_profile_rows( retention = profile.get("retention") if retention not in {"natural", "durable"}: raise ValueError("profile retention must be natural or durable") - if profile.get("active_epoch_limits") != ACTIVE_EPOCH_LIMITS: + expected_active_epoch_limits = active_epoch_limits( + profile.get("focus"), + profile.get("sensitivity"), + profile.get("stability"), + ) + if profile.get("active_epoch_limits") != expected_active_epoch_limits: raise ValueError("profile active-epoch limits do not match the contract") honors_required = profile.get("honor_required_consolidation") if not isinstance(honors_required, bool): @@ -610,6 +984,243 @@ def validate_profile_rows( operation_activity = {name: 0.0 for name in COUNTER_ACTIVITY_OPERATIONS} row_consolidation_total = 0.0 row_consolidation_events: list[int] = [] + warmup_events = math.ceil(0.20 * len(rows)) + sparse_parameters = profile.get("sparse_route_parameters") + fallback_hydration_limit = None + if ( + isinstance(sparse_parameters, dict) + and "fallback_hydration_signal_limit" in sparse_parameters + ): + focus = finite_fraction(profile.get("focus"), "focus") + sensitivity = finite_fraction(profile.get("sensitivity"), "sensitivity") + stability = finite_fraction(profile.get("stability"), "stability") + derived_limit = math.floor( + 64.0 + 64.0 * focus + 32.0 * sensitivity + 32.0 * stability + 0.5 + ) + fallback_hydration_limit = nonnegative_integer( + sparse_parameters.get("fallback_hydration_signal_limit"), + "sparse_route_parameters.fallback_hydration_signal_limit", + ) + if fallback_hydration_limit != derived_limit: + raise ValueError("fallback hydration limit does not match F/S/T") + if isinstance(sparse_parameters, dict) and "search_node_budget" in sparse_parameters: + focus = finite_fraction(profile.get("focus"), "focus") + sensitivity = finite_fraction(profile.get("sensitivity"), "sensitivity") + stability = finite_fraction(profile.get("stability"), "stability") + rounded = lambda value: math.floor(value + 0.5) + route_capacity = rounded( + 256.0 + 256.0 * focus + 128.0 * sensitivity + 128.0 * stability + ) + backfill_batch_size = rounded( + 64.0 + 64.0 * focus + 32.0 * sensitivity + 32.0 * stability + ) + expected_sparse_parameters = { + "route_capacity": route_capacity, + "activation_identity_target": route_capacity * 2 + backfill_batch_size * 2, + "activation_snapshot_capacity": route_capacity * 2 + backfill_batch_size * 2, + "total_query_row_budget": ( + route_capacity * 11 + backfill_batch_size * 2 + ), + "bootstrap_limit": route_capacity * 2, + "search_node_budget": route_capacity * 9, + "activation_search_node_budget_min": route_capacity * 8, + "activation_search_node_budget_step": max( + 2, backfill_batch_size // 16 + ), + "search_expansion_batch": max(8, backfill_batch_size // 4), + "search_effort": route_capacity * 9, + "activation_search_effort_min": route_capacity * 8, + "activation_search_effort_step": max( + 2, backfill_batch_size // 16 + ), + "shadow_cache_capacity": route_capacity * 24, + "backfill_batch_size": backfill_batch_size, + "backfill_search_node_budget": route_capacity + backfill_batch_size, + "backfill_search_effort": backfill_batch_size * 2, + "graph_neighbor_count": max(8, backfill_batch_size // 2), + "graph_level_zero_links": max(16, route_capacity // 4), + "family_exact_comparison_limit": route_capacity * 2, + "maximum_level": max(1, max(1, route_capacity - 1).bit_length()), + "reciprocal_update_count": max(2, backfill_batch_size // 16), + "hnsw_construction_effort": max( + 32, rounded(route_capacity * 25.0 / 64.0) + ), + "hnsw_query_effort": max( + route_capacity, rounded(route_capacity * 5.0 / 2.0) + ), + "fallback_hydration_signal_limit": backfill_batch_size, + } + experimental_node_formula = profile.get( + "experimental_sparse_node_envelope_formula" + ) + experimental_node_budgets = { + "C": route_capacity, + "A": route_capacity * 2 + backfill_batch_size * 2, + "C+B": route_capacity + backfill_batch_size, + "2C": route_capacity * 2, + "4C": route_capacity * 4, + "4C+B/16": route_capacity * 4 + + max(2, backfill_batch_size // 16), + "fixed-4C+B/16": route_capacity * 4 + + max(2, backfill_batch_size // 16), + "4C+B/16-to-5C": route_capacity * 5, + "5C-to-6C-by-B/16": route_capacity * 6, + "6C-to-7C-by-B/16": route_capacity * 7, + "7C-to-8C-by-B/16": route_capacity * 8, + "8C-to-9C-by-B/16": route_capacity * 9, + "5C": route_capacity * 5, + "6C": route_capacity * 6, + "10C": route_capacity * 10, + "12C": route_capacity * 12, + "16C": route_capacity * 16, + } + if experimental_node_formula is not None: + expected_sparse_parameters["search_node_budget"] = route_capacity * 5 + expected_sparse_parameters[ + "activation_search_node_budget_min" + ] = route_capacity * 5 + expected_sparse_parameters["activation_search_node_budget_step"] = 0 + expected_sparse_parameters["search_effort"] = route_capacity * 5 + expected_sparse_parameters[ + "activation_search_effort_min" + ] = route_capacity * 5 + expected_sparse_parameters["activation_search_effort_step"] = 0 + expected_sparse_parameters["total_query_row_budget"] = ( + route_capacity * 7 + backfill_batch_size * 2 + ) + if experimental_node_formula not in experimental_node_budgets: + raise ValueError( + "experimental sparse node envelope formula is invalid" + ) + selected_node_budget = experimental_node_budgets[ + experimental_node_formula + ] + expected_sparse_parameters["search_node_budget"] = selected_node_budget + expected_sparse_parameters[ + "activation_search_node_budget_min" + ] = selected_node_budget + if experimental_node_formula == "fixed-4C+B/16": + expected_sparse_parameters["search_effort"] = selected_node_budget + expected_sparse_parameters[ + "activation_search_effort_min" + ] = selected_node_budget + expected_sparse_parameters["total_query_row_budget"] = ( + selected_node_budget + + expected_sparse_parameters["activation_identity_target"] + ) + if experimental_node_formula == "4C+B/16-to-5C": + reciprocal_update_count = expected_sparse_parameters[ + "reciprocal_update_count" + ] + minimum = route_capacity * 4 + reciprocal_update_count + expected_sparse_parameters[ + "activation_search_effort_min" + ] = minimum + expected_sparse_parameters[ + "activation_search_effort_step" + ] = reciprocal_update_count + expected_sparse_parameters[ + "activation_search_node_budget_min" + ] = minimum + expected_sparse_parameters[ + "activation_search_node_budget_step" + ] = reciprocal_update_count + if experimental_node_formula == "5C-to-6C-by-B/16": + reciprocal_update_count = expected_sparse_parameters[ + "reciprocal_update_count" + ] + minimum = route_capacity * 5 + expected_sparse_parameters["search_effort"] = selected_node_budget + expected_sparse_parameters[ + "activation_search_effort_min" + ] = minimum + expected_sparse_parameters[ + "activation_search_effort_step" + ] = reciprocal_update_count + expected_sparse_parameters[ + "activation_search_node_budget_min" + ] = minimum + expected_sparse_parameters[ + "activation_search_node_budget_step" + ] = reciprocal_update_count + expected_sparse_parameters["total_query_row_budget"] = ( + selected_node_budget + + expected_sparse_parameters["activation_identity_target"] + ) + if experimental_node_formula == "6C-to-7C-by-B/16": + reciprocal_update_count = expected_sparse_parameters[ + "reciprocal_update_count" + ] + minimum = route_capacity * 6 + expected_sparse_parameters["search_effort"] = selected_node_budget + expected_sparse_parameters[ + "activation_search_effort_min" + ] = minimum + expected_sparse_parameters[ + "activation_search_effort_step" + ] = reciprocal_update_count + expected_sparse_parameters[ + "activation_search_node_budget_min" + ] = minimum + expected_sparse_parameters[ + "activation_search_node_budget_step" + ] = reciprocal_update_count + expected_sparse_parameters["total_query_row_budget"] = ( + selected_node_budget + + expected_sparse_parameters["activation_identity_target"] + ) + if experimental_node_formula == "7C-to-8C-by-B/16": + reciprocal_update_count = expected_sparse_parameters[ + "reciprocal_update_count" + ] + minimum = route_capacity * 7 + expected_sparse_parameters["search_effort"] = selected_node_budget + expected_sparse_parameters[ + "activation_search_effort_min" + ] = minimum + expected_sparse_parameters[ + "activation_search_effort_step" + ] = reciprocal_update_count + expected_sparse_parameters[ + "activation_search_node_budget_min" + ] = minimum + expected_sparse_parameters[ + "activation_search_node_budget_step" + ] = reciprocal_update_count + expected_sparse_parameters["total_query_row_budget"] = ( + selected_node_budget + + expected_sparse_parameters["activation_identity_target"] + ) + if experimental_node_formula == "8C-to-9C-by-B/16": + reciprocal_update_count = expected_sparse_parameters[ + "reciprocal_update_count" + ] + minimum = route_capacity * 8 + expected_sparse_parameters["search_effort"] = selected_node_budget + expected_sparse_parameters[ + "activation_search_effort_min" + ] = minimum + expected_sparse_parameters[ + "activation_search_effort_step" + ] = reciprocal_update_count + expected_sparse_parameters[ + "activation_search_node_budget_min" + ] = minimum + expected_sparse_parameters[ + "activation_search_node_budget_step" + ] = reciprocal_update_count + expected_sparse_parameters["total_query_row_budget"] = ( + selected_node_budget + + expected_sparse_parameters["activation_identity_target"] + ) + if set(sparse_parameters) != set(expected_sparse_parameters): + raise ValueError("sparse-route parameter schema does not match F/S/T contract") + for name, expected in expected_sparse_parameters.items(): + actual = nonnegative_integer( + sparse_parameters.get(name), f"sparse_route_parameters.{name}" + ) + if actual != expected: + raise ValueError(f"sparse-route parameter {name} does not match F/S/T") for expected_index, row in enumerate(rows): if row.get("event_index") != expected_index: raise ValueError("profile event_index values must be unique and contiguous") @@ -636,40 +1247,91 @@ def validate_profile_rows( active_epoch = row.get("active_epoch") if not isinstance(active_epoch, dict): raise ValueError("profile row lacks active_epoch counters") - if set(active_epoch) != {*ACTIVE_EPOCH_LIMITS, "required"}: + expected_active_epoch_keys = { + "event_count", + "mutation_count", + "allocated_bytes", + "row_batch_high_water", + "required", + } + if set(active_epoch) != expected_active_epoch_keys: raise ValueError("profile active_epoch counter schema mismatch") - active_values = { + epoch_values = { name: nonnegative_integer( active_epoch.get(name), f"active_epoch.{name}" ) - for name in ACTIVE_EPOCH_LIMITS + for name in ("event_count", "mutation_count", "allocated_bytes") } + row_batch_high_water = nonnegative_integer( + active_epoch.get("row_batch_high_water"), + "active_epoch.row_batch_high_water", + ) active_required = active_epoch.get("required") if not isinstance(active_required, bool): raise ValueError("active_epoch.required must be boolean") at_or_above_limit = any( - active_values[name] >= limit - for name, limit in ACTIVE_EPOCH_LIMITS.items() + epoch_values[name] >= expected_active_epoch_limits[name] + for name in epoch_values ) if at_or_above_limit and not active_required: raise ValueError("active-epoch boundary was not preserved") if honors_required and any( - active_values[name] > limit - for name, limit in ACTIVE_EPOCH_LIMITS.items() + epoch_values[name] > expected_active_epoch_limits[name] + for name in epoch_values ): raise ValueError("honored active epoch crossed a safety ceiling") + if row_batch_high_water > expected_active_epoch_limits["row_batch_size"]: + raise ValueError("active-epoch row batch crossed its F/S/T ceiling") counters = row.get("work_counters") if not isinstance(counters, dict): raise ValueError("profile row lacks work_counters") - if set(counters) != set(REQUIRED_WORK_COUNTERS): - missing = sorted(set(REQUIRED_WORK_COUNTERS) - set(counters)) - extra = sorted(set(counters) - set(REQUIRED_WORK_COUNTERS)) + counter_names = set(counters) + required_counter_names = set(REQUIRED_WORK_COUNTERS) + missing = sorted(required_counter_names - counter_names) + extra = sorted(counter_names - required_counter_names) + if missing or not set(extra).issubset( + LEGACY_REJECTED_EMOTIONAL_WORK_COUNTERS + ): raise ValueError( f"work counter schema mismatch; missing={missing}, extra={extra}" ) operations = row.get("operation_ms") if not isinstance(operations, dict): raise ValueError("profile lacks full operation timing") + if ( + isinstance(sparse_parameters, dict) + and "activation_identity_target" in sparse_parameters + ): + activation_target = nonnegative_integer( + sparse_parameters.get("activation_identity_target"), + "sparse_route_parameters.activation_identity_target", + positive=True, + ) + activated_identities = finite_nonnegative( + operations.get( + "GraphRetrieve.sqlite_sparse_route_activated_identities" + ), + "operation_ms.GraphRetrieve.sqlite_sparse_route_activated_identities", + ) + if activated_identities > activation_target: + raise ValueError("sparse-route activation exceeded its F/S/T target") + sparse_route_active = finite_nonnegative( + operations.get("GraphRetrieve.seed_sparse_route_active", 0.0), + "operation_ms.GraphRetrieve.seed_sparse_route_active", + ) + if sparse_route_active > 0.0 and activated_identities <= 0.0: + raise ValueError("active sparse route reported no activated identities") + if fallback_hydration_limit is not None: + observed_limit = finite_nonnegative( + operations.get("Cortext.fallback_hydration_signal_limit"), + "operation_ms.Cortext.fallback_hydration_signal_limit", + ) + finite_nonnegative( + operations.get("Cortext.fallback_hydration_signal_rows"), + "operation_ms.Cortext.fallback_hydration_signal_rows", + ) + if observed_limit != float(fallback_hydration_limit): + raise ValueError("event fallback hydration limit differs from F/S/T") if ( retention == "durable" and "SignalProcessor.sqlite_wal_checkpoint" not in operations @@ -695,9 +1357,9 @@ def validate_profile_rows( operations["MemoryStorage.supersession_sql_fallback_count"], "operation_ms.MemoryStorage.supersession_sql_fallback_count", ) - if supersession_fallbacks != 0.0: + if supersession_fallbacks != 0.0 and expected_index >= warmup_events: raise ValueError( - "supersession SQL fallback prevents exact visited-row accounting" + "post-warmup supersession SQL fallback prevents bounded plateau accounting" ) operation_barrier_ms = finite_nonnegative( operations.get("SignalProcessor.sqlite_wal_checkpoint", 0.0), @@ -777,16 +1439,29 @@ def validate_profile_rows( post_epoch = event.get("post_reset_active_epoch") if not isinstance(post_epoch, dict): raise ValueError("consolidation event lacks post-reset active epoch") - if set(post_epoch) != {*ACTIVE_EPOCH_LIMITS, "required"}: + if set(post_epoch) != { + "event_count", + "mutation_count", + "allocated_bytes", + "row_batch_high_water", + "required", + }: raise ValueError("post-reset active epoch schema mismatch") if post_epoch.get("required") is not False: raise ValueError("successful consolidation did not clear epoch boundary") - for name, limit in ACTIVE_EPOCH_LIMITS.items(): + for name in ("event_count", "mutation_count", "allocated_bytes"): + limit = expected_active_epoch_limits[name] value = nonnegative_integer( post_epoch.get(name), f"post_reset_active_epoch.{name}" ) if value >= limit: raise ValueError("successful consolidation did not reset active epoch") + post_row_batch = nonnegative_integer( + post_epoch.get("row_batch_high_water"), + "post_reset_active_epoch.row_batch_high_water", + ) + if post_row_batch > expected_active_epoch_limits["row_batch_size"]: + raise ValueError("post-reset row batch crossed its F/S/T ceiling") event_indices.append(event_index) if event_indices != row_consolidation_events: raise ValueError("consolidation event indices do not match rows") @@ -825,12 +1500,95 @@ def retrieval_work(row: dict[str, Any]) -> float: ) + finite_nonnegative( counters.get("graph_exact_comparison_count"), "work_counters.graph_exact_comparison_count", + ) + finite_nonnegative( + counters.get("graph_rows_visited"), + "work_counters.graph_rows_visited", + ) + finite_nonnegative( + counters.get("supersession_rows_visited"), + "work_counters.supersession_rows_visited", + ) + + +def sparse_route_value(row: dict[str, Any], name: str) -> float: + operation_ms = row.get("operation_ms") + if not isinstance(operation_ms, dict): + return 0.0 + return finite_nonnegative(operation_ms.get(name, 0.0), f"operation_ms.{name}") + + +def sparse_route_retrieval_work(row: dict[str, Any]) -> float: + return sparse_route_value( + row, "GraphRetrieve.sqlite_sparse_route_distance_evaluations" + ) + + +def sparse_route_retrieval_active(row: dict[str, Any]) -> bool: + return any( + sparse_route_value(row, name) > 0.0 + for name in ( + "GraphRetrieve.seed_sparse_route_active", + "GraphRetrieve.sqlite_sparse_route_search_effort", + "GraphRetrieve.sqlite_sparse_route_search_node_budget", + "GraphRetrieve.sqlite_sparse_route_node_rows", + "GraphRetrieve.sqlite_sparse_route_activation_snapshot_rows", + "GraphRetrieve.sqlite_sparse_route_dirty_rows", + "GraphRetrieve.sqlite_sparse_route_distance_evaluations", + "GraphRetrieve.sqlite_sparse_route_activated_identities", + ) + ) + + +def sparse_route_retrieval_queue_effort(row: dict[str, Any]) -> float: + return sparse_route_value( + row, "GraphRetrieve.sqlite_sparse_route_search_effort" + ) + + +def sparse_route_retrieval_effort(row: dict[str, Any]) -> float: + return sparse_route_value( + row, "GraphRetrieve.sqlite_sparse_route_search_node_budget" + ) + + +def sparse_route_retrieval_actual_visits(row: dict[str, Any]) -> float: + return sparse_route_value( + row, "GraphRetrieve.sqlite_sparse_route_node_rows" + ) + sparse_route_value( + row, "GraphRetrieve.sqlite_sparse_route_dirty_rows" + ) + + +def sparse_route_activation_snapshot_visits(row: dict[str, Any]) -> float: + return sparse_route_value( + row, "GraphRetrieve.sqlite_sparse_route_activation_snapshot_rows" + ) + + +def sparse_route_retrieval_activated_identities( + row: dict[str, Any], +) -> float: + return sparse_route_value( + row, "GraphRetrieve.sqlite_sparse_route_activated_identities" ) def resample_equal_progress(values: Sequence[float], bins: int) -> list[float]: - if bins <= 0 or len(values) < bins: + if bins <= 0 or not values: raise ValueError("retrieval cycle cannot be resampled to required bins") + if len(values) < bins: + if len(values) == 1: + return [float(values[0])] * bins + result = [] + for index in range(bins): + position = index * (len(values) - 1) / (bins - 1) + lower = math.floor(position) + upper = math.ceil(position) + fraction = position - lower + result.append( + float(values[lower]) * (1.0 - fraction) + + float(values[upper]) * fraction + ) + return result result = [] for index in range(bins): begin = index * len(values) // bins @@ -904,6 +1662,96 @@ def knob_normal_comparison_bound(artifact: dict[str, Any]) -> int: ) +def knob_sparse_retrieval_work_bound(artifact: dict[str, Any]) -> int: + parameters = artifact.get("sparse_route_parameters") + if not isinstance(parameters, dict): + return knob_normal_comparison_bound(artifact) + node_budget = nonnegative_integer( + parameters.get("search_node_budget"), + "sparse_route_parameters.search_node_budget", + ) + if node_budget == 0: + raise ValueError("sparse-route work bounds must be positive") + return node_budget + + +def knob_sparse_total_query_row_bound(artifact: dict[str, Any]) -> int: + parameters = artifact.get("sparse_route_parameters") + if not isinstance(parameters, dict): + return knob_normal_comparison_bound(artifact) + return nonnegative_integer( + parameters.get("total_query_row_budget"), + "sparse_route_parameters.total_query_row_budget", + positive=True, + ) + + +def knob_sparse_cycle_edge_samples(artifact: dict[str, Any]) -> int: + parameters = artifact.get("sparse_route_parameters") + if not isinstance(parameters, dict): + raise ValueError("sparse-route parameters are required for cycle edges") + backfill_batch = nonnegative_integer( + parameters.get("backfill_batch_size"), + "sparse_route_parameters.backfill_batch_size", + ) + if backfill_batch == 0: + raise ValueError("sparse-route backfill batch must be positive") + return max(2, backfill_batch // 32) + + +def knob_work_counter_bound( + artifact: dict[str, Any], counter: str, +) -> int | None: + if counter not in { + "graph_exact_comparison_count", + "graph_rows_visited", + "supersession_rows_visited", + "emotional_source_count", + "emotional_neighbor_count", + "emotional_update_count", + }: + return None + parameters = artifact.get("sparse_route_parameters") + if not isinstance(parameters, dict): + return None + if counter == "emotional_update_count": + return nonnegative_integer( + parameters.get("activation_identity_target"), + "sparse_route_parameters.activation_identity_target", + positive=True, + ) + if counter == "graph_rows_visited": + return nonnegative_integer( + parameters.get("activation_identity_target"), + "sparse_route_parameters.activation_identity_target", + positive=True, + ) + if counter == "supersession_rows_visited": + return nonnegative_integer( + parameters.get("total_query_row_budget"), + "sparse_route_parameters.total_query_row_budget", + positive=True, + ) + if counter == "emotional_source_count": + return nonnegative_integer( + parameters.get("backfill_batch_size"), + "sparse_route_parameters.backfill_batch_size", + positive=True, + ) + if counter == "emotional_neighbor_count": + route_capacity = nonnegative_integer( + parameters.get("route_capacity"), + "sparse_route_parameters.route_capacity", + positive=True, + ) + return route_capacity * 5 + return nonnegative_integer( + parameters.get("family_exact_comparison_limit"), + "sparse_route_parameters.family_exact_comparison_limit", + positive=True, + ) + + def ranked_query_evidence_result( artifact: dict[str, Any], result_k: int, ) -> dict[str, Any]: @@ -1032,12 +1880,26 @@ def ranked_query_evidence_result( probe_payload.append({"query_number": query_number, "ranked_ids": exact_ids}) count = len(evidence) + candidate_rank_payload = [ + { + "query_number": query_number, + "candidate_ranked_ids": by_number[query_number][ + "candidate_ranked_ids" + ], + } + for query_number in range(count) + ] + candidate_identity_rank_sha256 = hashlib.sha256( + canonical_json(candidate_rank_payload) + ).hexdigest() return { "count": count, "mean_exact_id_recall_at_k": exact_recall_total / count, "mean_top1_exact_id": exact_top1_total / count, + "exact_top1_hit_count": int(exact_top1_total), "mean_exact_neighbor_semantic_coverage": semantic_total / count, "exact_rank_match": exact_rank_match, + "candidate_identity_rank_sha256": candidate_identity_rank_sha256, "source_count": len(source_ids), "modalities": sorted(modalities), "history_segments": sorted(history_segments), @@ -1052,6 +1914,15 @@ def ranked_query_evidence_result( def retrieval_cycle_symmetry_result( material_epochs: Sequence[dict[str, Any]], retrieval_work_bound: int, accepted_suffix_retrieval_work: Sequence[float], + accepted_suffix_retrieval_effort: Sequence[float], + *, + accepted_suffix_queue_effort: Sequence[float] | None = None, + queue_effort_bound: int | None = None, + accepted_suffix_total_work: Sequence[float] | None = None, + total_query_row_bound: int | None = None, + accepted_suffix_snapshot_visits: Sequence[float] | None = None, + activation_identity_target: int | None = None, + accepted_suffix_activated_identities: Sequence[float] | None = None, ) -> dict[str, Any]: failures = [] profiles = [epoch["_retrieval_cycle_profile"] for epoch in material_epochs] @@ -1089,6 +1960,87 @@ def retrieval_cycle_symmetry_result( ) if work_bound_exceeded_count: failures.append("retrieval work exceeds F/S/T bound") + if len(accepted_suffix_retrieval_work) != len( + accepted_suffix_retrieval_effort + ): + raise ValueError("retrieval work and dynamic node ceilings differ in length") + dynamic_bound_exceeded_count = sum( + work > effort + for work, effort in zip( + accepted_suffix_retrieval_work, + accepted_suffix_retrieval_effort, + ) + ) + if dynamic_bound_exceeded_count: + failures.append("retrieval work exceeds current dynamic node ceiling") + dynamic_queue_bound_exceeded_count = 0 + total_work_bound_exceeded_count = 0 + snapshot_bound_exceeded_count = 0 + combined_visit_bound_exceeded_count = 0 + distance_coverage_mismatch_count = 0 + activated_identity_exceeded_count = 0 + optional_samples = ( + accepted_suffix_queue_effort, + accepted_suffix_total_work, + accepted_suffix_snapshot_visits, + accepted_suffix_activated_identities, + ) + if any(values is not None for values in optional_samples): + if any(values is None for values in optional_samples): + raise ValueError("dynamic sparse retrieval metrics are incomplete") + if ( + queue_effort_bound is None + or total_query_row_bound is None + or activation_identity_target is None + ): + raise ValueError("dynamic sparse retrieval bounds are incomplete") + sample_count = len(accepted_suffix_retrieval_work) + if any(len(values) != sample_count for values in optional_samples): + raise ValueError("dynamic sparse retrieval metric samples differ") + queue_effort = accepted_suffix_queue_effort or () + total_work = accepted_suffix_total_work or () + snapshot_visits = accepted_suffix_snapshot_visits or () + activated_identities = accepted_suffix_activated_identities or () + dynamic_queue_bound_exceeded_count = sum( + queue > queue_effort_bound for queue in queue_effort + ) + total_work_bound_exceeded_count = sum( + work > total_query_row_bound for work in total_work + ) + snapshot_bound_exceeded_count = sum( + visits > activation_identity_target + for visits in snapshot_visits + ) + combined_visit_bound_exceeded_count = sum( + canonical + snapshot > total_query_row_bound + for canonical, snapshot in zip( + accepted_suffix_retrieval_work, snapshot_visits + ) + ) + distance_coverage_mismatch_count = sum( + work > canonical + snapshot + for work, canonical, snapshot in zip( + total_work, + accepted_suffix_retrieval_work, + snapshot_visits, + ) + ) + activated_identity_exceeded_count = sum( + count > activation_identity_target + for count in activated_identities + ) + if dynamic_queue_bound_exceeded_count: + failures.append("dynamic queue exceeds F/S/T bound") + if total_work_bound_exceeded_count: + failures.append("retrieval work exceeds total F/S/T row bound") + if snapshot_bound_exceeded_count: + failures.append("retrieval snapshot visits exceed F/S/T bound") + if combined_visit_bound_exceeded_count: + failures.append("retrieval total visits exceed F/S/T bound") + if distance_coverage_mismatch_count: + failures.append("retrieval distance work exceeds fetched-row coverage") + if activated_identity_exceeded_count: + failures.append("retrieval activation exceeds F/S/T target") reset_count = sum( epoch["retrieval_post_over_trailing"] <= CONSOLIDATION_EPOCH_POST_PRE_PROCESS_RATIO_MAX @@ -1159,6 +2111,19 @@ def retrieval_cycle_symmetry_result( ), "excessive_spike_count": excessive_spike_count, "work_bound_exceeded_count": work_bound_exceeded_count, + "dynamic_bound_exceeded_count": dynamic_bound_exceeded_count, + "dynamic_queue_bound_exceeded_count": ( + dynamic_queue_bound_exceeded_count + ), + "total_work_bound_exceeded_count": total_work_bound_exceeded_count, + "snapshot_bound_exceeded_count": snapshot_bound_exceeded_count, + "combined_visit_bound_exceeded_count": ( + combined_visit_bound_exceeded_count + ), + "distance_coverage_mismatch_count": distance_coverage_mismatch_count, + "activated_identity_exceeded_count": ( + activated_identity_exceeded_count + ), "retrieval_work_bound": retrieval_work_bound, "accepted_suffix_maximum_retrieval_work": max( accepted_suffix_retrieval_work, default=0.0 @@ -1176,6 +2141,247 @@ def retrieval_cycle_symmetry_result( } +def fixed_retrieval_envelope_result( + complete_epochs: Sequence[dict[str, Any]], + recenter_events: Sequence[dict[str, Any]], canonical_node_bound: int, + total_query_row_bound: int, + accepted_suffix_retrieval_work: Sequence[float], + accepted_suffix_queue_effort: Sequence[float], + accepted_suffix_retrieval_effort: Sequence[float], + accepted_suffix_actual_visits: Sequence[float], + accepted_suffix_snapshot_visits: Sequence[float], + accepted_suffix_activated_identities: Sequence[float], + activation_identity_target: int, +) -> dict[str, Any]: + failures = [] + sample_count = len(accepted_suffix_retrieval_work) + if any( + len(values) != sample_count + for values in ( + accepted_suffix_queue_effort, + accepted_suffix_retrieval_effort, + accepted_suffix_actual_visits, + accepted_suffix_snapshot_visits, + accepted_suffix_activated_identities, + ) + ): + raise ValueError("fixed retrieval metric samples differ in length") + unevaluated_epoch_count = sum( + not epoch["retrieval_cycle_evaluated"] for epoch in complete_epochs + ) + zero_work_count = sum(work <= 0.0 for work in accepted_suffix_retrieval_work) + work_bound_exceeded_count = sum( + work > total_query_row_bound for work in accepted_suffix_retrieval_work + ) + queue_effort_mismatch_count = sum( + effort != canonical_node_bound + for effort in accepted_suffix_queue_effort + ) + node_ceiling_mismatch_count = sum( + effort != canonical_node_bound + for effort in accepted_suffix_retrieval_effort + ) + actual_visit_exceeded_count = sum( + visits > canonical_node_bound + for visits in accepted_suffix_actual_visits + ) + snapshot_visit_exceeded_count = sum( + visits > activation_identity_target + for visits in accepted_suffix_snapshot_visits + ) + total_visit_exceeded_count = sum( + canonical + snapshot > total_query_row_bound + for canonical, snapshot in zip( + accepted_suffix_actual_visits, + accepted_suffix_snapshot_visits, + ) + ) + distance_coverage_mismatch_count = sum( + work > canonical + snapshot + for work, canonical, snapshot in zip( + accepted_suffix_retrieval_work, + accepted_suffix_actual_visits, + accepted_suffix_snapshot_visits, + ) + ) + activated_identity_exceeded_count = sum( + count > activation_identity_target + for count in accepted_suffix_activated_identities + ) + epoch_edge_mismatch_count = sum( + any( + value <= 0.0 or value > total_query_row_bound + for value in ( + epoch["leading_mean_retrieval_work"], + epoch["trailing_peak_mean_retrieval_work"], + epoch["following_trough_mean_retrieval_work"], + epoch["maximum_retrieval_work"], + ) + ) + for epoch in complete_epochs + ) + recentered_events = [ + event + for event in recenter_events + if event.get("sqlite_sparse_route_recenter_succeeded") is True + ] + recenter_envelope_mismatch_count = sum( + finite_nonnegative( + event.get("sqlite_sparse_route_activation_search_effort", 0.0), + "consolidation sqlite sparse route activation effort", + ) + != canonical_node_bound + or finite_nonnegative( + event.get("sqlite_sparse_route_activation_node_budget", 0.0), + "consolidation sqlite sparse route activation node budget", + ) + != canonical_node_bound + for event in recentered_events + ) + overlap_missing_count = 0 + overlap_invalid_count = 0 + overlap_changed_count = 0 + overlap_ratios = [] + for event in recentered_events: + if event.get("sqlite_sparse_route_recenter_overlap_profiled") is not True: + overlap_missing_count += 1 + continue + if ( + event.get("sqlite_sparse_route_recenter_overlap_pair_valid") is not True + or finite_nonnegative( + event.get("sqlite_sparse_route_recenter_overlap_failure_code", 0.0), + "consolidation sqlite sparse route overlap failure code", + ) + != 0.0 + ): + overlap_invalid_count += 1 + continue + pre_count = finite_nonnegative( + event.get("sqlite_sparse_route_recenter_pre_activated_count"), + "consolidation sqlite sparse route pre activation count", + ) + post_count = finite_nonnegative( + event.get("sqlite_sparse_route_recenter_post_activated_count"), + "consolidation sqlite sparse route post activation count", + ) + overlap_count = finite_nonnegative( + event.get("sqlite_sparse_route_recenter_overlap_count"), + "consolidation sqlite sparse route overlap count", + ) + if ( + pre_count <= 0.0 + or post_count <= 0.0 + or pre_count > activation_identity_target + or post_count > activation_identity_target + or overlap_count > min(pre_count, post_count) + ): + overlap_invalid_count += 1 + continue + overlap_ratios.append(ratio(overlap_count, post_count)) + if overlap_count < post_count: + overlap_changed_count += 1 + if not accepted_suffix_retrieval_work: + failures.append("fixed retrieval envelope has no activated work") + if unevaluated_epoch_count: + failures.append("fixed retrieval envelope lacks complete epoch coverage") + if zero_work_count: + failures.append("fixed retrieval work is absent on an active route") + if work_bound_exceeded_count: + failures.append("fixed retrieval work exceeds total F/S/T row bound") + if queue_effort_mismatch_count: + failures.append("fixed queue effort differs from F/S/T bound") + if node_ceiling_mismatch_count: + failures.append("fixed dynamic node ceiling differs from F/S/T bound") + if actual_visit_exceeded_count: + failures.append("fixed retrieval visits exceed F/S/T bound") + if snapshot_visit_exceeded_count: + failures.append("fixed retrieval snapshot visits exceed F/S/T bound") + if total_visit_exceeded_count: + failures.append("fixed retrieval total visits exceed F/S/T bound") + if distance_coverage_mismatch_count: + failures.append("fixed retrieval distance work exceeds fetched-row coverage") + if activated_identity_exceeded_count: + failures.append("fixed retrieval activation exceeds F/S/T target") + if epoch_edge_mismatch_count: + failures.append("fixed retrieval envelope changes across consolidation") + if len(recentered_events) < RETRIEVAL_CYCLE_MINIMUM_MATERIAL_CYCLES: + failures.append("fewer than ten mature fixed-envelope recenters") + if recenter_envelope_mismatch_count: + failures.append("fixed retrieval recenter changes F/S/T envelope") + classifier_passed = not failures + overlap_recorded = ( + bool(recentered_events) + and overlap_missing_count == 0 + and overlap_invalid_count == 0 + and len(overlap_ratios) == len(recentered_events) + ) + full_cycle_passed = ( + classifier_passed + and overlap_recorded + and overlap_changed_count > 0 + ) + full_cycle_unproven_reason = None + if not overlap_recorded: + full_cycle_unproven_reason = ( + "profile lacks valid pre/post activated-identity overlap across " + "every recenter" + ) + elif overlap_changed_count == 0: + full_cycle_unproven_reason = ( + "recenter overlap is valid but activated identity membership never changes" + ) + full_failures = list(failures) + if full_cycle_unproven_reason is not None: + full_failures.append(full_cycle_unproven_reason) + return { + "passed": full_cycle_passed, + "fixed_envelope_classifier_passed": classifier_passed, + "fixed_work_envelope_subcontract_passed": classifier_passed, + "activated_identity_overlap_recorded": overlap_recorded, + "full_cycle_passed": full_cycle_passed, + "full_cycle_unproven_reason": full_cycle_unproven_reason, + "overlap_profile_missing_count": overlap_missing_count, + "overlap_profile_invalid_count": overlap_invalid_count, + "changed_activation_set_count": overlap_changed_count, + "minimum_activation_overlap_ratio": ( + min(overlap_ratios) if overlap_ratios else None + ), + "maximum_activation_overlap_ratio": ( + max(overlap_ratios) if overlap_ratios else None + ), + "mode": "fixed-envelope", + "material_cycle_count": 0, + "complete_cycle_count": len(complete_epochs), + "unevaluated_epoch_count": unevaluated_epoch_count, + "work_mismatch_count": zero_work_count + work_bound_exceeded_count, + "zero_work_count": zero_work_count, + "work_bound_exceeded_count": work_bound_exceeded_count, + "effort_mismatch_count": queue_effort_mismatch_count, + "queue_effort_mismatch_count": queue_effort_mismatch_count, + "node_ceiling_mismatch_count": node_ceiling_mismatch_count, + "actual_visit_exceeded_count": actual_visit_exceeded_count, + "snapshot_visit_exceeded_count": snapshot_visit_exceeded_count, + "total_visit_exceeded_count": total_visit_exceeded_count, + "distance_coverage_mismatch_count": distance_coverage_mismatch_count, + "activated_identity_exceeded_count": ( + activated_identity_exceeded_count + ), + "activation_identity_target": activation_identity_target, + "epoch_edge_mismatch_count": epoch_edge_mismatch_count, + "mature_recenter_count": len(recentered_events), + "recenter_envelope_mismatch_count": ( + recenter_envelope_mismatch_count + ), + "retrieval_work_bound": total_query_row_bound, + "canonical_retrieval_node_bound": canonical_node_bound, + "activation_snapshot_row_bound": activation_identity_target, + "accepted_suffix_maximum_retrieval_work": max( + accepted_suffix_retrieval_work, default=0.0 + ), + "failures": sorted(set(full_failures)), + } + + def bounded_activation_quality_result( artifact: dict[str, Any], control_artifact: dict[str, Any], approved_control_sha256: str, @@ -1231,7 +2437,6 @@ def bounded_activation_quality_result( "query_index", "query_embedding_id", "exact_ranked_ids", - "candidate_ranked_ids", "source_ids", "modalities", "history_ordinal", @@ -1270,6 +2475,19 @@ def bounded_activation_quality_result( evidence["history_segments"] ) ) + reported_candidate_rank_digest = artifact.get( + "candidate_identity_rank_sha256" + ) + repeated_candidate_rank_digest = artifact.get( + "repeat_candidate_identity_rank_sha256" + ) + deterministic_candidate_rank_passed = ( + isinstance(reported_candidate_rank_digest, str) + and len(reported_candidate_rank_digest) == 64 + and reported_candidate_rank_digest + == evidence["candidate_identity_rank_sha256"] + and repeated_candidate_rank_digest == reported_candidate_rank_digest + ) restart = artifact.get("sqlite_restart_measurements") if not isinstance(restart, list) or len(restart) != 3: raise ValueError("exactly three bounded activation restart measurements are required") @@ -1323,8 +2541,11 @@ def bounded_activation_quality_result( or not isinstance(pre_digest, str) or len(pre_digest) != 64 or any(char not in "0123456789abcdef" for char in pre_digest) - or pre_digest != restart_probe_digest - or post_digest != restart_probe_digest + or pre_digest != post_digest + or ( + expected_fraction == 1.0 + and pre_digest != restart_probe_digest + ) ): raise ValueError( "restart measurement is not bound to restored corpus state" @@ -1354,8 +2575,11 @@ def bounded_activation_quality_result( failures.append("exact identity recall below invariant") if exact_top1 < RETRIEVAL_EXACT_TOP1_MIN: failures.append("exact top-1 below invariant") - if not evidence["exact_rank_match"]: - failures.append("deterministic exact rank order differs") + exact_top1_miss_count = query_count - evidence["exact_top1_hit_count"] + if exact_top1_miss_count > RETRIEVAL_EXACT_TOP1_MAX_MISSES: + failures.append("exact top-1 miss count exceeds invariant") + if not deterministic_candidate_rank_passed: + failures.append("candidate rank order is not repeat-deterministic") if semantic_coverage < RETRIEVAL_SEMANTIC_COVERAGE_MIN: failures.append("semantic coverage below threshold") if not coverage_passed: @@ -1377,8 +2601,12 @@ def bounded_activation_quality_result( "result_k": result_k, "mean_exact_id_recall_at_k": exact_recall, "mean_top1_exact_id": exact_top1, + "exact_top1_miss_count": exact_top1_miss_count, "mean_exact_neighbor_semantic_coverage": semantic_coverage, - "deterministic_exact_rank_order_passed": evidence["exact_rank_match"], + "deterministic_candidate_rank_order_passed": ( + deterministic_candidate_rank_passed + ), + "candidate_identity_rank_sha256": reported_candidate_rank_digest, "query_input_coverage_passed": coverage_passed, "query_source_count": evidence["source_count"], "query_modalities": evidence["modalities"], @@ -1408,6 +2636,19 @@ def consolidation_epoch_result( if suffix_start <= event["event_index"] < suffix_end ] complete_epochs = [] + sparse_cycle_contract = isinstance( + profile.get("sparse_route_parameters"), dict + ) + dynamic_sparse_cycle = bool( + sparse_cycle_contract + and nonnegative_integer( + profile["sparse_route_parameters"].get( + "activation_search_node_budget_step" + ), + "sparse_route_parameters.activation_search_node_budget_step", + ) + > 0 + ) k = CONSOLIDATION_EPOCH_PRE_POST_EVENTS for event_index, event in enumerate(events): close = event["event_index"] @@ -1434,15 +2675,75 @@ def consolidation_epoch_result( float(row["process_ms"]) for row in epoch_rows[-k:] ) post = statistics.mean(float(row["process_ms"]) for row in post_rows) - retrieval_values = [retrieval_work(row) for row in epoch_rows] - retrieval_leading = statistics.mean(retrieval_values[:k]) - retrieval_trailing = statistics.mean(retrieval_values[-k:]) - retrieval_post = statistics.mean(retrieval_work(row) for row in post_rows) + if sparse_cycle_contract: + retrieval_pairs = [ + ( + ( + sparse_route_retrieval_actual_visits(row) + if dynamic_sparse_cycle + else sparse_route_retrieval_work(row) + ), + sparse_route_retrieval_effort(row), + ) + for row in epoch_rows + if sparse_route_retrieval_active(row) + ] + post_pairs = [ + ( + ( + sparse_route_retrieval_actual_visits(row) + if dynamic_sparse_cycle + else sparse_route_retrieval_work(row) + ), + sparse_route_retrieval_effort(row), + ) + for row in post_rows + if sparse_route_retrieval_active(row) + ] + edge_samples = knob_sparse_cycle_edge_samples(profile) + retrieval_cycle_evaluated = ( + len(retrieval_pairs) >= 2 * edge_samples + and len(post_pairs) >= edge_samples + and all(effort > 0.0 for _, effort in retrieval_pairs) + ) + retrieval_values = [work for work, _ in retrieval_pairs] + retrieval_efforts = [effort for _, effort in retrieval_pairs] + if retrieval_cycle_evaluated: + retrieval_leading = statistics.mean( + retrieval_values[:edge_samples] + ) + retrieval_trailing = statistics.mean( + retrieval_values[-edge_samples:] + ) + retrieval_post = statistics.mean( + work for work, _ in post_pairs[:edge_samples] + ) + effort_leading = statistics.mean( + retrieval_efforts[:edge_samples] + ) + effort_trailing = statistics.mean( + retrieval_efforts[-edge_samples:] + ) + else: + retrieval_leading = retrieval_trailing = retrieval_post = 0.0 + effort_leading = effort_trailing = 0.0 + else: + retrieval_values = [retrieval_work(row) for row in epoch_rows] + retrieval_efforts = retrieval_values + retrieval_leading = statistics.mean(retrieval_values[:k]) + retrieval_trailing = statistics.mean(retrieval_values[-k:]) + retrieval_post = statistics.mean( + retrieval_work(row) for row in post_rows + ) + effort_leading = retrieval_leading + effort_trailing = retrieval_trailing + retrieval_cycle_evaluated = True retrieval_ramp = retrieval_trailing - retrieval_leading + retrieval_effort_ramp = effort_trailing - effort_leading retrieval_negative_variation = sum( max(0.0, previous - current) for previous, current in zip( - retrieval_values, retrieval_values[1:] + retrieval_efforts, retrieval_efforts[1:] ) ) ramp_ratio = ratio(trailing, leading) @@ -1455,8 +2756,14 @@ def consolidation_epoch_result( for name in REQUIRED_CONSOLIDATION_EPOCH_COUNTERS } material = ramp_ratio >= CONSOLIDATION_EPOCH_MATERIAL_RAMP_RATIO_MIN + retrieval_material = ( + retrieval_cycle_evaluated + and ratio(retrieval_trailing, retrieval_leading) + >= CONSOLIDATION_EPOCH_MATERIAL_RAMP_RATIO_MIN + ) reset_failures = { name: value for name, value in reset_ratios.items() + if name in RESETTABLE_CONSOLIDATION_EPOCH_COUNTERS if value > CONSOLIDATION_EPOCH_RESET_COUNTER_RATIO_MAX and not ( float(event["pre_reset_counters"][name]) == 0.0 @@ -1483,23 +2790,45 @@ def consolidation_epoch_result( "retrieval_trailing_over_leading": ratio( retrieval_trailing, retrieval_leading ), - "maximum_retrieval_work": max(retrieval_values), + "maximum_retrieval_work": max(retrieval_values, default=0.0), "retrieval_negative_variation_over_ramp": ratio( - retrieval_negative_variation, max(0.0, retrieval_ramp) + retrieval_negative_variation, + max(0.0, retrieval_effort_ramp), ), "retrieval_max_over_trailing_mean": ratio( - max(retrieval_values), retrieval_trailing + max(retrieval_efforts, default=0.0), effort_trailing ), "_retrieval_cycle_profile": normalized_cycle( resample_equal_progress( - retrieval_values, RETRIEVAL_CYCLE_RESAMPLE_BINS + retrieval_efforts, RETRIEVAL_CYCLE_RESAMPLE_BINS ), - retrieval_leading, - retrieval_trailing, - ), + effort_leading, + effort_trailing, + ) if retrieval_cycle_evaluated else [], "material": material, + "retrieval_cycle_evaluated": retrieval_cycle_evaluated, + "retrieval_material": retrieval_material, "reset_counter_ratios": reset_ratios, "reset_counter_failures": reset_failures, + "sqlite_sparse_route_recenter_succeeded": ( + event.get("sqlite_sparse_route_recenter_succeeded") is True + ), + "sqlite_sparse_route_activation_search_effort": ( + finite_nonnegative( + event.get( + "sqlite_sparse_route_activation_search_effort", 0.0 + ), + "consolidation sqlite sparse route activation effort", + ) + ), + "sqlite_sparse_route_activation_node_budget": ( + finite_nonnegative( + event.get( + "sqlite_sparse_route_activation_node_budget", 0.0 + ), + "consolidation sqlite sparse route activation node budget", + ) + ), "consolidation_ms_per_event": ratio( float(event["duration_ms"]), float(max(1, sealed_count)) ), @@ -1510,6 +2839,9 @@ def consolidation_epoch_result( }) material_epochs = [epoch for epoch in complete_epochs if epoch["material"]] + retrieval_material_epochs = [ + epoch for epoch in complete_epochs if epoch["retrieval_material"] + ] failures = [] mode = "invalid" peak_trend = None @@ -1580,7 +2912,117 @@ def consolidation_epoch_result( failures.append("consolidation cost per sealed mutation rises") retrieval_cycle_symmetry = None - if mode == "sawtooth": + if sparse_cycle_contract and profile.get("retention") == "natural": + accepted_sparse_rows = [ + row + for row in rows + if suffix_start + <= nonnegative_integer(row.get("event_index"), "event_index") + < suffix_end + and sparse_route_retrieval_active(row) + ] + accepted_sparse_work = [ + sparse_route_retrieval_work(row) for row in accepted_sparse_rows + ] + accepted_sparse_effort = [ + sparse_route_retrieval_effort(row) for row in accepted_sparse_rows + ] + accepted_sparse_queue_effort = [ + sparse_route_retrieval_queue_effort(row) + for row in accepted_sparse_rows + ] + accepted_sparse_actual_visits = [ + sparse_route_retrieval_actual_visits(row) + for row in accepted_sparse_rows + ] + accepted_sparse_snapshot_visits = [ + sparse_route_activation_snapshot_visits(row) + for row in accepted_sparse_rows + ] + accepted_sparse_activated_identities = [ + sparse_route_retrieval_activated_identities(row) + for row in accepted_sparse_rows + ] + retrieval_work_bound = knob_sparse_retrieval_work_bound(profile) + total_query_row_bound = knob_sparse_total_query_row_bound(profile) + fixed_envelope_selected = ( + nonnegative_integer( + profile["sparse_route_parameters"].get( + "activation_search_node_budget_min" + ), + "sparse_route_parameters.activation_search_node_budget_min", + ) + == retrieval_work_bound + and nonnegative_integer( + profile["sparse_route_parameters"].get( + "activation_search_node_budget_step" + ), + "sparse_route_parameters.activation_search_node_budget_step", + ) + == 0 + and nonnegative_integer( + profile["sparse_route_parameters"].get( + "activation_search_effort_min" + ), + "sparse_route_parameters.activation_search_effort_min", + ) + == retrieval_work_bound + and nonnegative_integer( + profile["sparse_route_parameters"].get( + "activation_search_effort_step" + ), + "sparse_route_parameters.activation_search_effort_step", + ) + == 0 + ) + if fixed_envelope_selected: + retrieval_cycle_symmetry = fixed_retrieval_envelope_result( + complete_epochs, + events, + retrieval_work_bound, + total_query_row_bound, + accepted_sparse_work, + accepted_sparse_queue_effort, + accepted_sparse_effort, + accepted_sparse_actual_visits, + accepted_sparse_snapshot_visits, + accepted_sparse_activated_identities, + nonnegative_integer( + profile["sparse_route_parameters"].get( + "activation_identity_target" + ), + "sparse_route_parameters.activation_identity_target", + ), + ) + else: + retrieval_cycle_symmetry = retrieval_cycle_symmetry_result( + retrieval_material_epochs, + retrieval_work_bound, + accepted_sparse_actual_visits, + accepted_sparse_effort, + accepted_suffix_queue_effort=accepted_sparse_queue_effort, + queue_effort_bound=nonnegative_integer( + profile["sparse_route_parameters"].get("search_effort"), + "sparse_route_parameters.search_effort", + positive=True, + ), + accepted_suffix_total_work=accepted_sparse_work, + total_query_row_bound=total_query_row_bound, + accepted_suffix_snapshot_visits=( + accepted_sparse_snapshot_visits + ), + activation_identity_target=nonnegative_integer( + profile["sparse_route_parameters"].get( + "activation_identity_target" + ), + "sparse_route_parameters.activation_identity_target", + ), + accepted_suffix_activated_identities=( + accepted_sparse_activated_identities + ), + ) + failures.extend(retrieval_cycle_symmetry["failures"]) + elif mode == "sawtooth": retrieval_cycle_symmetry = retrieval_cycle_symmetry_result( material_epochs, knob_normal_comparison_bound(profile), @@ -1591,10 +3033,86 @@ def consolidation_epoch_result( <= nonnegative_integer(row.get("event_index"), "event_index") < suffix_end ], + [ + retrieval_work(row) + for row in rows + if suffix_start + <= nonnegative_integer(row.get("event_index"), "event_index") + < suffix_end + ], ) failures.extend(retrieval_cycle_symmetry["failures"]) elif mode == "flat-envelope" and profile.get("retention") == "natural": failures.append("natural cutover requires retrieval cycle symmetry") + + activity_normalized_reset = None + reset_miss_epochs = [ + epoch for epoch in material_epochs + if epoch["post_over_trailing"] + > CONSOLIDATION_EPOCH_POST_PRE_PROCESS_RATIO_MAX + ] + if reset_miss_epochs: + evaluation_inputs = [] + operation_activity_pairs = ( + ( + "MemoryStorage", + "cortext::operations::MemoryStorage", + "supersession_current_candidate_count", + ), + ( + "PropagateEmotionalCascade", + "cortext::operations::PropagateEmotionalCascade", + "emotional_neighbor_count", + ), + ) + for epoch in reset_miss_epochs: + close = int(epoch["closing_event"]) + trailing_rows = rows[close - k + 1 : close + 1] + post_rows = rows[close + 1 : close + 1 + k] + for operation, operation_key, activity_key in operation_activity_pairs: + evaluation_inputs.append({ + "epoch": epoch["consolidation_epoch_id"], + "operation": operation, + "trailing_event_indices": [ + row["event_index"] for row in trailing_rows + ], + "post_event_indices": [ + row["event_index"] for row in post_rows + ], + "trailing_ms": [ + row["operation_ms"][operation_key] + for row in trailing_rows + ], + "post_ms": [ + row["operation_ms"][operation_key] + for row in post_rows + ], + "trailing_activity": [ + row["work_counters"][activity_key] + for row in trailing_rows + ], + "post_activity": [ + row["work_counters"][activity_key] + for row in post_rows + ], + }) + raw_gate_failure_names = { + "material epoch does not lower following process time", + "sawtooth peaks rise", + "sawtooth troughs rise", + "peak relative slope rises", + "trough relative slope rises", + "peak bootstrap upper rises", + "trough bootstrap upper rises", + "consolidation reset counter does not fall", + } + activity_normalized_reset = activity_normalized_reset_diagnostic( + evaluation_inputs, + sorted({ + failure for failure in failures + if failure in raw_gate_failure_names + }), + ) for epoch in complete_epochs: epoch.pop("_retrieval_cycle_profile", None) @@ -1611,6 +3129,7 @@ def consolidation_epoch_result( "normalized_mutation_cost_trend": normalized_mutation_cost, "frequency_trend": frequency_trend, "retrieval_cycle_symmetry": retrieval_cycle_symmetry, + "activity_normalized_reset_diagnostic": activity_normalized_reset, "failures": sorted(set(failures)), } @@ -1732,17 +3251,29 @@ def suffix_plateau_result( operation_results[name] = {"mean_ms": mean_value, **result} if result["second_over_first"] > OPERATION_HALF_RATIO_MAX: operation_failures[name] = result["second_over_first"] - counter_results = { - name: half_comparison(values[suffix_start:]) - for name, values in counter_windows.items() - } - counter_failures = { - name: result["second_over_first"] - for name, result in counter_results.items() - if result["second_over_first"] > WORK_COUNTER_HALF_RATIO_MAX - } start_event = suffix_ranges[0][0] end_event = suffix_ranges[-1][1] + counter_results = {} + counter_failures = {} + for name, values in counter_windows.items(): + result = half_comparison(values[suffix_start:]) + bound = knob_work_counter_bound(profile, name) + maximum = max( + float(row["work_counters"][name]) + for row in rows[start_event:end_event] + ) + absolute_bound_passed = bound is not None and maximum <= bound + counter_results[name] = { + **result, + "maximum": maximum, + "knob_derived_absolute_bound": bound, + "absolute_bound_passed": absolute_bound_passed, + } + if ( + result["second_over_first"] > WORK_COUNTER_HALF_RATIO_MAX + and not absolute_bound_passed + ) or (bound is not None and maximum > bound): + counter_failures[name] = result["second_over_first"] half = len(suffix_ranges) // 2 middle_event = suffix_ranges[half][0] start_rows = total_authoritative_rows(checkpoints[start_event]) @@ -1805,11 +3336,14 @@ def suffix_plateau_result( "relative_slope": relative_slope, "relative_upper": relative_upper, "operation_failure_count": len(operation_failures), + "operation_failures": sorted(operation_failures), "counter_failure_count": len(counter_failures), + "counter_failures": sorted(counter_failures), "store_growth_passed": store_growth_passed, "height_passed": suffix_mean <= height_ceiling, "consolidation_epoch_passed": epoch_result["passed"], "consolidation_mode": epoch_result["mode"], + "consolidation_epoch_failures": epoch_result["failures"], }) return { "passed": accepted is not None, diff --git a/tools/audit_storage_cost_profile_test.py b/tools/audit_storage_cost_profile_test.py index 8b11d074..1a226641 100644 --- a/tools/audit_storage_cost_profile_test.py +++ b/tools/audit_storage_cost_profile_test.py @@ -4,6 +4,7 @@ from __future__ import annotations import json +import math import sqlite3 import subprocess import sys @@ -46,6 +47,7 @@ def fixture_rows() -> list[dict[str, object]]: "event_count": index + 1, "mutation_count": index + 1, "allocated_bytes": 16384, + "row_batch_high_water": 0, "required": False, }, "behavior": {}, @@ -62,6 +64,7 @@ def fixture_operation_ms(counters: dict[str, float]) -> dict[str, float]: "GraphRetrieve.seed_knn_cache_rebuild": 0.1, "GraphRetrieve.seed_cache_family_compare": 0.1, "GraphRetrieve.seed_cache_distance": 0.1, + "GraphRetrieve.sqlite_sparse_route_distance_evaluations": 0.0, "cortext::operations::ApplyRetrievalCompetition": 0.1, "Competition.rif_recovery_active_sql": 0.1, "Competition.score_candidates": 0.1, @@ -73,6 +76,8 @@ def fixture_operation_ms(counters: dict[str, float]) -> dict[str, float]: "MemoryStorage.supersession_historical_candidate_execution_count": 0.1, "MemoryStorage.supersession_current_rows_visited": 0.1, "MemoryStorage.supersession_historical_rows_visited": 0.1, + "MemoryStorage.supersession_sparse_route_node_rows": 0.0, + "MemoryStorage.supersession_sparse_route_dirty_rows": 0.0, "MemoryStorage.supersession_sql_fallback_count": 0.0, "cortext::operations::PropagateEmotionalCascade": 0.1, "EmotionalCascade.source_query": 0.1, @@ -85,6 +90,14 @@ def fixture_operation_ms(counters: dict[str, float]) -> dict[str, float]: for counter, sources in audit.COUNTER_SOURCE_OPERATIONS.items(): if len(sources) == 1: operations[sources[0]] = float(counters[counter]) + operations["GraphRetrieve.rows_visited"] = float( + counters["graph_rows_visited"] + ) + operations["GraphRetrieve.sqlite_sparse_route_node_rows"] = 0.0 + operations[ + "GraphRetrieve.sqlite_sparse_route_activation_snapshot_rows" + ] = 0.0 + operations["GraphRetrieve.sqlite_sparse_route_activated_identities"] = 0.0 operations["MemoryStorage.supersession_current_rows_visited"] = float( counters["supersession_current_candidate_count"] ) @@ -156,6 +169,7 @@ def plateau_fixture( "event_count": event_index + 1, "mutation_count": event_index + 1, "allocated_bytes": 16384, + "row_batch_high_water": 0, "required": False, }, "durable_barrier_ms": 0.0, @@ -190,6 +204,9 @@ def plateau_fixture( profile: dict[str, object] = { "schema": "cortext_packet_storage_profile_v2", "processed_events": event_count, + "focus": 0.5, + "sensitivity": 0.5, + "stability": 0.5, "consolidation_epoch_relational_contract_sha256": ( audit.CONSOLIDATION_EPOCH_RELATIONAL_CONTRACT_SHA256 ), @@ -198,7 +215,7 @@ def plateau_fixture( "consolidation_ms": 0.0, "consolidation_events": [], "honor_required_consolidation": True, - "active_epoch_limits": audit.ACTIVE_EPOCH_LIMITS, + "active_epoch_limits": audit.active_epoch_limits(0.5, 0.5, 0.5), "store_checkpoints": checkpoints, } return profile, rows @@ -239,6 +256,7 @@ def epoch_fixture( } work_counters["graph_candidate_count"] = process_ms * 5.0 work_counters["graph_exact_comparison_count"] = process_ms * 5.0 + work_counters["graph_rows_visited"] = process_ms * 30.0 work_counters["supersession_rows_visited"] = ( work_counters["supersession_current_candidate_count"] + work_counters["supersession_historical_candidate_count"] @@ -272,6 +290,7 @@ def epoch_fixture( "event_count": events_since, "mutation_count": events_since * 3, "allocated_bytes": 16384, + "row_batch_high_water": 0, "required": False, }, "work_counters": work_counters, @@ -299,6 +318,7 @@ def epoch_fixture( "event_count": 0, "mutation_count": 0, "allocated_bytes": 16384, + "row_batch_high_water": 0, "required": False, }, "state_after": "none", @@ -339,7 +359,7 @@ def epoch_fixture( "consolidation_ms": consolidation_total, "consolidation_events": events, "honor_required_consolidation": True, - "active_epoch_limits": audit.ACTIVE_EPOCH_LIMITS, + "active_epoch_limits": audit.active_epoch_limits(0.5, 0.5, 0.5), "store_checkpoints": checkpoints, }, rows @@ -357,7 +377,190 @@ def set_fixture_retention( ] = 0.0 +def fixture_sparse_parameters( + focus: float = 0.5, sensitivity: float = 0.5, stability: float = 0.5, +) -> dict[str, int]: + rounded = lambda value: math.floor(value + 0.5) + route_capacity = rounded( + 256.0 + 256.0 * focus + 128.0 * sensitivity + 128.0 * stability + ) + backfill_batch_size = rounded( + 64.0 + 64.0 * focus + 32.0 * sensitivity + 32.0 * stability + ) + return { + "route_capacity": route_capacity, + "activation_identity_target": route_capacity * 2 + backfill_batch_size * 2, + "activation_snapshot_capacity": route_capacity * 2 + backfill_batch_size * 2, + "total_query_row_budget": ( + route_capacity * 11 + backfill_batch_size * 2 + ), + "bootstrap_limit": route_capacity * 2, + "search_node_budget": route_capacity * 9, + "activation_search_node_budget_min": route_capacity * 8, + "activation_search_node_budget_step": max(2, backfill_batch_size // 16), + "search_expansion_batch": max(8, backfill_batch_size // 4), + "search_effort": route_capacity * 9, + "activation_search_effort_min": route_capacity * 8, + "activation_search_effort_step": max(2, backfill_batch_size // 16), + "shadow_cache_capacity": route_capacity * 24, + "backfill_batch_size": backfill_batch_size, + "backfill_search_node_budget": route_capacity + backfill_batch_size, + "backfill_search_effort": backfill_batch_size * 2, + "graph_neighbor_count": max(8, backfill_batch_size // 2), + "graph_level_zero_links": max(16, route_capacity // 4), + "family_exact_comparison_limit": route_capacity * 2, + "maximum_level": max(1, max(1, route_capacity - 1).bit_length()), + "reciprocal_update_count": max(2, backfill_batch_size // 16), + "hnsw_construction_effort": max( + 32, rounded(route_capacity * 25.0 / 64.0) + ), + "hnsw_query_effort": max( + route_capacity, rounded(route_capacity * 5.0 / 2.0) + ), + "fallback_hydration_signal_limit": backfill_batch_size, + } + + +def enable_sparse_retrieval_cycles( + profile: dict[str, object], rows: list[dict[str, object]], +) -> None: + profile["sparse_route_parameters"] = fixture_sparse_parameters() + profile["sparse_route_parameters"].update( + { + "total_query_row_budget": 3840, + "search_node_budget": 2560, + "activation_search_node_budget_min": 1280, + "activation_search_node_budget_step": 10, + "search_effort": 2560, + "activation_search_effort_min": 1024, + "activation_search_effort_step": 12, + } + ) + for row in rows: + epoch_id = int(row["consolidation_epoch_id"]) + phase = int(row["events_since_epoch_start"]) + operation_ms = row["operation_ms"] + if phase % 2 == 0: + if epoch_id == 0: + effort = 2560.0 + node_budget = 2560.0 + visited = 2400.0 + else: + progress = (phase - 2) / 116.0 + effort = min(2560.0, 1024.0 + 1536.0 * progress) + node_budget = min(2560.0, 1280.0 + 1280.0 * progress) + visited = 1200.0 + 800.0 * progress + operation_ms[ + "GraphRetrieve.sqlite_sparse_route_search_effort" + ] = effort + operation_ms[ + "GraphRetrieve.sqlite_sparse_route_search_node_budget" + ] = node_budget + operation_ms[ + "GraphRetrieve.sqlite_sparse_route_node_rows" + ] = visited + operation_ms[ + "GraphRetrieve.sqlite_sparse_route_distance_evaluations" + ] = visited + else: + operation_ms[ + "GraphRetrieve.sqlite_sparse_route_search_effort" + ] = 0.0 + operation_ms[ + "GraphRetrieve.sqlite_sparse_route_search_node_budget" + ] = 0.0 + operation_ms[ + "GraphRetrieve.sqlite_sparse_route_node_rows" + ] = 0.0 + operation_ms[ + "GraphRetrieve.sqlite_sparse_route_distance_evaluations" + ] = 0.0 + + +def enable_fixed_sparse_retrieval_envelope( + profile: dict[str, object], rows: list[dict[str, object]], +) -> None: + profile["sparse_route_parameters"] = fixture_sparse_parameters() + profile["experimental_sparse_node_envelope_formula"] = "5C" + profile["sparse_route_parameters"].update( + { + "total_query_row_budget": 3840, + "search_node_budget": 2560, + "activation_search_node_budget_min": 2560, + "activation_search_node_budget_step": 0, + "search_effort": 2560, + "activation_search_effort_min": 2560, + "activation_search_effort_step": 0, + } + ) + bound = float(profile["sparse_route_parameters"]["search_node_budget"]) + for row in rows: + operation_ms = row["operation_ms"] + operation_ms["GraphRetrieve.sqlite_sparse_route_search_effort"] = bound + operation_ms[ + "GraphRetrieve.sqlite_sparse_route_search_node_budget" + ] = bound + operation_ms["GraphRetrieve.sqlite_sparse_route_node_rows"] = bound + operation_ms[ + "GraphRetrieve.sqlite_sparse_route_distance_evaluations" + ] = bound + for event in profile["consolidation_events"]: + event["sqlite_sparse_route_recenter_succeeded"] = True + event["sqlite_sparse_route_activation_search_effort"] = bound + event["sqlite_sparse_route_activation_node_budget"] = bound + event["sqlite_sparse_route_recenter_overlap_profiled"] = True + event["sqlite_sparse_route_recenter_overlap_pair_valid"] = True + event["sqlite_sparse_route_recenter_overlap_failure_code"] = 0.0 + event["sqlite_sparse_route_recenter_pre_activated_count"] = 1280.0 + event["sqlite_sparse_route_recenter_post_activated_count"] = 1280.0 + event["sqlite_sparse_route_recenter_overlap_count"] = 640.0 + + class AttributionContractTest(unittest.TestCase): + def test_active_epoch_limits_follow_low_mid_high_and_axis_knobs(self) -> None: + self.assertEqual( + audit.active_epoch_limits(0.0, 0.0, 0.0), + {"event_count": 256, "mutation_count": 16384, + "allocated_bytes": 33554432, "row_batch_size": 64}, + ) + self.assertEqual( + audit.active_epoch_limits(0.5, 0.5, 0.5), + {"event_count": 512, "mutation_count": 32768, + "allocated_bytes": 67108864, "row_batch_size": 128}, + ) + self.assertEqual( + audit.active_epoch_limits(1.0, 1.0, 1.0), + {"event_count": 768, "mutation_count": 49152, + "allocated_bytes": 100663296, "row_batch_size": 192}, + ) + points = [ + (0.5, 0.5, 0.5), (0.0, 0.0, 0.0), (1.0, 1.0, 1.0), + (0.0, 0.5, 0.5), (1.0, 0.5, 0.5), + (0.5, 0.0, 0.5), (0.5, 1.0, 0.5), + (0.5, 0.5, 0.0), (0.5, 0.5, 1.0), + ] + self.assertGreater( + len({audit.active_epoch_limits(*point)["event_count"] + for point in points}), + 3, + ) + + def test_active_epoch_limits_reject_nonfinite_knobs(self) -> None: + for point in ( + (math.nan, 0.5, 0.5), + (0.5, math.inf, 0.5), + (0.5, 0.5, -math.inf), + ): + with self.subTest(point=point): + with self.assertRaisesRegex(ValueError, "must be finite"): + audit.active_epoch_limits(*point) + + def test_active_epoch_row_batch_high_water_is_independently_bounded(self) -> None: + profile, rows = plateau_fixture() + rows[0]["active_epoch"]["row_batch_high_water"] = 129 + with self.assertRaisesRegex(ValueError, "row batch crossed"): + audit.validate_profile_rows(profile, rows) + def test_late_operation_is_attributed_with_zero_for_absent_rows(self) -> None: result = audit.attribution_result(fixture_rows(), 10) contributors = { @@ -438,6 +641,303 @@ def test_attribution_cli_does_not_require_prefix_flatness(self) -> None: class PlateauContractTest(unittest.TestCase): + def test_sparse_route_parameter_vector_is_bound_to_all_three_knobs( + self, + ) -> None: + for focus in (0.0, 0.5, 1.0): + for sensitivity in (0.0, 0.5, 1.0): + for stability in (0.0, 0.5, 1.0): + profile, rows = plateau_fixture() + profile.update( + { + "focus": focus, + "sensitivity": sensitivity, + "stability": stability, + "active_epoch_limits": audit.active_epoch_limits( + focus, sensitivity, stability + ), + "sparse_route_parameters": fixture_sparse_parameters( + focus, sensitivity, stability + ), + } + ) + for row in rows: + row["operation_ms"][ + "Cortext.fallback_hydration_signal_limit" + ] = float( + profile["sparse_route_parameters"][ + "fallback_hydration_signal_limit" + ] + ) + row["operation_ms"][ + "Cortext.fallback_hydration_signal_rows" + ] = 0.0 + audit.validate_profile_rows(profile, rows) + + midpoint = fixture_sparse_parameters() + self.assertEqual(midpoint["backfill_batch_size"], 128) + self.assertEqual(midpoint["fallback_hydration_signal_limit"], 128) + self.assertEqual(midpoint["family_exact_comparison_limit"], 1024) + self.assertEqual(midpoint["activation_identity_target"], 1280) + self.assertEqual(midpoint["search_node_budget"], 4608) + self.assertEqual(midpoint["activation_search_node_budget_min"], 4096) + self.assertEqual(midpoint["activation_search_node_budget_step"], 8) + + def test_rejects_one_non_knob_sparse_route_parameter(self) -> None: + profile, rows = plateau_fixture() + profile.update( + { + "focus": 0.5, + "sensitivity": 0.5, + "stability": 0.5, + "sparse_route_parameters": fixture_sparse_parameters(), + } + ) + profile["sparse_route_parameters"]["search_node_budget"] += 1 + with self.assertRaisesRegex( + ValueError, "search_node_budget does not match F/S/T" + ): + audit.validate_profile_rows(profile, rows) + + def test_accepts_only_named_knob_derived_experimental_node_envelopes( + self, + ) -> None: + expected = { + "C": 512, + "A": 1280, + "C+B": 640, + "2C": 1024, + "4C": 2048, + "4C+B/16": 2056, + "fixed-4C+B/16": 2056, + "4C+B/16-to-5C": 2560, + "5C-to-6C-by-B/16": 3072, + "6C-to-7C-by-B/16": 3584, + "7C-to-8C-by-B/16": 4096, + "8C-to-9C-by-B/16": 4608, + "5C": 2560, + "6C": 3072, + "10C": 5120, + "12C": 6144, + "16C": 8192, + } + for formula, node_budget in expected.items(): + profile, rows = plateau_fixture() + profile.update( + { + "focus": 0.5, + "sensitivity": 0.5, + "stability": 0.5, + "experimental_sparse_node_envelope_formula": formula, + "sparse_route_parameters": fixture_sparse_parameters(), + } + ) + profile["sparse_route_parameters"].update( + { + "total_query_row_budget": 3840, + "search_node_budget": 2560, + "activation_search_node_budget_min": 2560, + "activation_search_node_budget_step": 0, + "search_effort": 2560, + "activation_search_effort_min": 2560, + "activation_search_effort_step": 0, + } + ) + profile["sparse_route_parameters"]["search_node_budget"] = node_budget + profile["sparse_route_parameters"][ + "activation_search_node_budget_min" + ] = node_budget + if formula == "fixed-4C+B/16": + profile["sparse_route_parameters"]["search_effort"] = node_budget + profile["sparse_route_parameters"][ + "activation_search_effort_min" + ] = node_budget + profile["sparse_route_parameters"]["total_query_row_budget"] = ( + node_budget + + profile["sparse_route_parameters"][ + "activation_identity_target" + ] + ) + if formula == "4C+B/16-to-5C": + reciprocal_update_count = profile["sparse_route_parameters"][ + "reciprocal_update_count" + ] + minimum = 2048 + reciprocal_update_count + profile["sparse_route_parameters"][ + "activation_search_effort_min" + ] = minimum + profile["sparse_route_parameters"][ + "activation_search_effort_step" + ] = reciprocal_update_count + profile["sparse_route_parameters"][ + "activation_search_node_budget_min" + ] = minimum + profile["sparse_route_parameters"][ + "activation_search_node_budget_step" + ] = reciprocal_update_count + if formula == "5C-to-6C-by-B/16": + reciprocal_update_count = profile["sparse_route_parameters"][ + "reciprocal_update_count" + ] + minimum = 2560 + profile["sparse_route_parameters"]["search_effort"] = node_budget + profile["sparse_route_parameters"][ + "activation_search_effort_min" + ] = minimum + profile["sparse_route_parameters"][ + "activation_search_effort_step" + ] = reciprocal_update_count + profile["sparse_route_parameters"][ + "activation_search_node_budget_min" + ] = minimum + profile["sparse_route_parameters"][ + "activation_search_node_budget_step" + ] = reciprocal_update_count + profile["sparse_route_parameters"]["total_query_row_budget"] = ( + node_budget + + profile["sparse_route_parameters"][ + "activation_identity_target" + ] + ) + if formula == "6C-to-7C-by-B/16": + reciprocal_update_count = profile["sparse_route_parameters"][ + "reciprocal_update_count" + ] + minimum = 3072 + profile["sparse_route_parameters"]["search_effort"] = node_budget + profile["sparse_route_parameters"][ + "activation_search_effort_min" + ] = minimum + profile["sparse_route_parameters"][ + "activation_search_effort_step" + ] = reciprocal_update_count + profile["sparse_route_parameters"][ + "activation_search_node_budget_min" + ] = minimum + profile["sparse_route_parameters"][ + "activation_search_node_budget_step" + ] = reciprocal_update_count + profile["sparse_route_parameters"]["total_query_row_budget"] = ( + node_budget + + profile["sparse_route_parameters"][ + "activation_identity_target" + ] + ) + if formula == "7C-to-8C-by-B/16": + reciprocal_update_count = profile["sparse_route_parameters"][ + "reciprocal_update_count" + ] + minimum = 3584 + profile["sparse_route_parameters"]["search_effort"] = node_budget + profile["sparse_route_parameters"][ + "activation_search_effort_min" + ] = minimum + profile["sparse_route_parameters"][ + "activation_search_effort_step" + ] = reciprocal_update_count + profile["sparse_route_parameters"][ + "activation_search_node_budget_min" + ] = minimum + profile["sparse_route_parameters"][ + "activation_search_node_budget_step" + ] = reciprocal_update_count + profile["sparse_route_parameters"]["total_query_row_budget"] = ( + node_budget + + profile["sparse_route_parameters"][ + "activation_identity_target" + ] + ) + if formula == "8C-to-9C-by-B/16": + reciprocal_update_count = profile["sparse_route_parameters"][ + "reciprocal_update_count" + ] + minimum = 4096 + profile["sparse_route_parameters"]["search_effort"] = node_budget + profile["sparse_route_parameters"][ + "activation_search_effort_min" + ] = minimum + profile["sparse_route_parameters"][ + "activation_search_effort_step" + ] = reciprocal_update_count + profile["sparse_route_parameters"][ + "activation_search_node_budget_min" + ] = minimum + profile["sparse_route_parameters"][ + "activation_search_node_budget_step" + ] = reciprocal_update_count + profile["sparse_route_parameters"]["total_query_row_budget"] = ( + node_budget + + profile["sparse_route_parameters"][ + "activation_identity_target" + ] + ) + for row in rows: + row["operation_ms"][ + "Cortext.fallback_hydration_signal_limit" + ] = 128.0 + row["operation_ms"][ + "Cortext.fallback_hydration_signal_rows" + ] = 0.0 + audit.validate_profile_rows(profile, rows) + + profile, rows = plateau_fixture() + profile.update( + { + "focus": 0.5, + "sensitivity": 0.5, + "stability": 0.5, + "experimental_sparse_node_envelope_formula": "7C", + "sparse_route_parameters": fixture_sparse_parameters(), + } + ) + for row in rows: + row["operation_ms"][ + "Cortext.fallback_hydration_signal_limit" + ] = 128.0 + row["operation_ms"][ + "Cortext.fallback_hydration_signal_rows" + ] = 0.0 + with self.assertRaisesRegex( + ValueError, "experimental sparse node envelope formula is invalid" + ): + audit.validate_profile_rows(profile, rows) + + def test_fallback_hydration_limit_is_bound_to_knobs_and_every_event( + self, + ) -> None: + profile, rows = plateau_fixture() + profile.update({"focus": 0.5, "sensitivity": 0.5, "stability": 0.5}) + profile["sparse_route_parameters"] = { + "fallback_hydration_signal_limit": 128, + } + for row in rows: + row["operation_ms"][ + "Cortext.fallback_hydration_signal_limit" + ] = 128.0 + row["operation_ms"][ + "Cortext.fallback_hydration_signal_rows" + ] = 64.0 + audit.validate_profile_rows(profile, rows) + + rows[-1]["operation_ms"][ + "Cortext.fallback_hydration_signal_limit" + ] = 129.0 + with self.assertRaisesRegex(ValueError, "event fallback hydration"): + audit.validate_profile_rows(profile, rows) + + def test_residual_bootstrap_is_exact_for_a_linear_series(self) -> None: + xs = [float(index) for index in range(2048)] + ys = [3.0 + 2.0 * value for value in xs] + self.assertEqual(audit.bootstrap_upper_slope(xs, ys), 2.0) + + def test_residual_bootstrap_is_deterministic_for_long_epoch_series(self) -> None: + xs = [float(index) for index in range(2048)] + ys = [10.0 + 0.001 * value + (index % 7) * 0.01 + for index, value in enumerate(xs)] + first = audit.bootstrap_upper_slope(xs, ys) + second = audit.bootstrap_upper_slope(xs, ys) + self.assertEqual(first, second) + def test_accepts_bounded_consolidation_sawtooth(self) -> None: profile, rows = epoch_fixture() result = audit.consolidation_epoch_result(profile, rows, 0, len(rows)) @@ -448,6 +948,279 @@ def test_accepts_bounded_consolidation_sawtooth(self) -> None: full_result = audit.suffix_plateau_result(profile, rows, 50) self.assertTrue(full_result["passed"], full_result["candidate_failures"]) + def test_accepts_flat_process_with_knob_bounded_sparse_retrieval_cycles( + self, + ) -> None: + profile, rows = epoch_fixture(material=False) + enable_sparse_retrieval_cycles(profile, rows) + result = audit.consolidation_epoch_result(profile, rows, 0, len(rows)) + self.assertTrue(result["passed"], result["failures"]) + self.assertEqual(result["mode"], "flat-envelope") + self.assertEqual(result["material_epoch_count"], 0) + self.assertTrue(result["retrieval_cycle_symmetry"]["passed"]) + self.assertGreaterEqual( + result["retrieval_cycle_symmetry"]["material_cycle_count"], 10 + ) + + def test_accepts_fixed_knob_bounded_sparse_retrieval_envelope(self) -> None: + profile, rows = epoch_fixture(material=False) + enable_fixed_sparse_retrieval_envelope(profile, rows) + result = audit.consolidation_epoch_result(profile, rows, 0, len(rows)) + self.assertTrue(result["passed"], result["failures"]) + self.assertEqual(result["mode"], "flat-envelope") + self.assertEqual( + result["retrieval_cycle_symmetry"]["mode"], "fixed-envelope" + ) + self.assertEqual( + result["retrieval_cycle_symmetry"]["retrieval_work_bound"], 3840 + ) + self.assertTrue( + result["retrieval_cycle_symmetry"][ + "fixed_envelope_classifier_passed" + ] + ) + self.assertTrue( + result["retrieval_cycle_symmetry"][ + "fixed_work_envelope_subcontract_passed" + ] + ) + self.assertTrue( + result["retrieval_cycle_symmetry"][ + "activated_identity_overlap_recorded" + ] + ) + self.assertTrue( + result["retrieval_cycle_symmetry"]["full_cycle_passed"] + ) + + def test_fixed_sparse_retrieval_requires_activation_overlap(self) -> None: + profile, rows = epoch_fixture(material=False) + enable_fixed_sparse_retrieval_envelope(profile, rows) + for event in profile["consolidation_events"]: + del event["sqlite_sparse_route_recenter_overlap_profiled"] + result = audit.consolidation_epoch_result(profile, rows, 0, len(rows)) + self.assertFalse(result["passed"]) + self.assertFalse( + result["retrieval_cycle_symmetry"]["full_cycle_passed"] + ) + self.assertEqual( + result["retrieval_cycle_symmetry"][ + "overlap_profile_missing_count" + ], + len(profile["consolidation_events"]), + ) + + def test_fixed_sparse_retrieval_envelope_is_independent_of_process_mode( + self, + ) -> None: + profile, rows = epoch_fixture(material=True) + enable_fixed_sparse_retrieval_envelope(profile, rows) + result = audit.consolidation_epoch_result(profile, rows, 0, len(rows)) + self.assertTrue(result["passed"], result["failures"]) + self.assertEqual(result["mode"], "sawtooth") + self.assertEqual( + result["retrieval_cycle_symmetry"]["mode"], "fixed-envelope" + ) + self.assertEqual( + result["retrieval_cycle_symmetry"]["retrieval_work_bound"], 3840 + ) + + def test_fixed_sparse_retrieval_requires_mature_recenter_evidence( + self, + ) -> None: + profile, rows = epoch_fixture(material=True) + enable_fixed_sparse_retrieval_envelope(profile, rows) + for event in profile["consolidation_events"]: + event["sqlite_sparse_route_recenter_succeeded"] = False + result = audit.consolidation_epoch_result(profile, rows, 0, len(rows)) + self.assertFalse(result["passed"]) + self.assertIn( + "fewer than ten mature fixed-envelope recenters", + result["failures"], + ) + + def test_fixed_sparse_retrieval_recenter_keeps_knob_envelope(self) -> None: + profile, rows = epoch_fixture(material=True) + enable_fixed_sparse_retrieval_envelope(profile, rows) + profile["consolidation_events"][-2][ + "sqlite_sparse_route_activation_node_budget" + ] -= 1.0 + result = audit.consolidation_epoch_result(profile, rows, 0, len(rows)) + self.assertFalse(result["passed"]) + self.assertIn( + "fixed retrieval recenter changes F/S/T envelope", + result["failures"], + ) + + def test_fixed_envelope_counts_persisted_and_delta_distance_work(self) -> None: + profile, rows = epoch_fixture(material=False) + enable_fixed_sparse_retrieval_envelope(profile, rows) + bound = float(profile["sparse_route_parameters"]["search_node_budget"]) + for row in rows: + operation_ms = row["operation_ms"] + if operation_ms[ + "GraphRetrieve.sqlite_sparse_route_search_node_budget" + ] == 0.0: + continue + operation_ms["GraphRetrieve.sqlite_sparse_route_node_rows"] = ( + bound - 17.0 + ) + operation_ms["GraphRetrieve.sqlite_sparse_route_dirty_rows"] = 17.0 + result = audit.consolidation_epoch_result(profile, rows, 0, len(rows)) + self.assertTrue(result["passed"], result["failures"]) + self.assertEqual( + result["retrieval_cycle_symmetry"]["work_mismatch_count"], 0 + ) + + def test_accepts_fixed_sparse_retrieval_below_ceiling(self) -> None: + profile, rows = epoch_fixture(material=False) + enable_fixed_sparse_retrieval_envelope(profile, rows) + rows[1000]["operation_ms"][ + "GraphRetrieve.sqlite_sparse_route_distance_evaluations" + ] -= 1.0 + result = audit.consolidation_epoch_result(profile, rows, 0, len(rows)) + self.assertTrue(result["passed"], result["failures"]) + + def test_route_active_zero_or_missing_work_fails_closed(self) -> None: + for remove_metric in (False, True): + with self.subTest(remove_metric=remove_metric): + profile, rows = epoch_fixture(material=False) + enable_fixed_sparse_retrieval_envelope(profile, rows) + operation_ms = rows[1000]["operation_ms"] + operation_ms["GraphRetrieve.seed_sparse_route_active"] = 1.0 + if remove_metric: + operation_ms.pop( + "GraphRetrieve.sqlite_sparse_route_distance_evaluations" + ) + else: + operation_ms[ + "GraphRetrieve.sqlite_sparse_route_distance_evaluations" + ] = 0.0 + result = audit.consolidation_epoch_result( + profile, rows, 0, len(rows) + ) + self.assertFalse(result["passed"]) + self.assertIn( + "fixed retrieval work is absent on an active route", + result["failures"], + ) + + def test_fixed_sparse_retrieval_metrics_are_independently_bounded( + self, + ) -> None: + cases = ( + ( + "GraphRetrieve.sqlite_sparse_route_search_effort", + "fixed queue effort differs from F/S/T bound", + ), + ( + "GraphRetrieve.sqlite_sparse_route_search_node_budget", + "fixed dynamic node ceiling differs from F/S/T bound", + ), + ( + "GraphRetrieve.sqlite_sparse_route_node_rows", + "fixed retrieval visits exceed F/S/T bound", + ), + ( + "GraphRetrieve.sqlite_sparse_route_activated_identities", + "fixed retrieval activation exceeds F/S/T target", + ), + ) + for metric, expected_failure in cases: + with self.subTest(metric=metric): + profile, rows = epoch_fixture(material=False) + enable_fixed_sparse_retrieval_envelope(profile, rows) + bound = float( + profile["sparse_route_parameters"]["search_node_budget"] + ) + value = ( + float( + profile["sparse_route_parameters"][ + "activation_identity_target" + ] + ) + if metric.endswith("activated_identities") + else bound + ) + rows[1000]["operation_ms"][metric] = value + 1.0 + result = audit.consolidation_epoch_result( + profile, rows, 0, len(rows) + ) + self.assertFalse(result["passed"]) + self.assertIn(expected_failure, result["failures"]) + + def test_rejects_fixed_sparse_retrieval_over_total_row_bound(self) -> None: + profile, rows = epoch_fixture(material=False) + enable_fixed_sparse_retrieval_envelope(profile, rows) + rows[1000]["operation_ms"][ + "GraphRetrieve.sqlite_sparse_route_distance_evaluations" + ] = float( + profile["sparse_route_parameters"]["total_query_row_budget"] + 1 + ) + result = audit.consolidation_epoch_result(profile, rows, 0, len(rows)) + self.assertFalse(result["passed"]) + self.assertIn( + "fixed retrieval work exceeds total F/S/T row bound", + result["failures"], + ) + + def test_rejects_sparse_retrieval_that_exceeds_its_current_node_ceiling( + self, + ) -> None: + profile, rows = epoch_fixture(material=False) + enable_sparse_retrieval_cycles(profile, rows) + row = next( + row + for row in rows + if row["operation_ms"].get( + "GraphRetrieve.sqlite_sparse_route_search_node_budget", 0.0 + ) + > 0.0 + ) + row["operation_ms"][ + "GraphRetrieve.sqlite_sparse_route_node_rows" + ] = ( + row["operation_ms"][ + "GraphRetrieve.sqlite_sparse_route_search_node_budget" + ] + + 1.0 + ) + row["operation_ms"][ + "GraphRetrieve.sqlite_sparse_route_distance_evaluations" + ] = row["operation_ms"][ + "GraphRetrieve.sqlite_sparse_route_node_rows" + ] + result = audit.consolidation_epoch_result(profile, rows, 0, len(rows)) + self.assertFalse(result["passed"]) + self.assertIn( + "retrieval work exceeds current dynamic node ceiling", + result["failures"], + ) + self.assertEqual( + result["retrieval_cycle_symmetry"][ + "dynamic_bound_exceeded_count" + ], + 1, + ) + + def test_accumulator_state_is_observed_but_not_a_consolidation_reset( + self, + ) -> None: + profile, rows = epoch_fixture() + for event in profile["consolidation_events"]: + event["post_reset_counters"]["accumulator_signal_count"] = event[ + "pre_reset_counters" + ]["accumulator_signal_count"] + result = audit.consolidation_epoch_result(profile, rows, 0, len(rows)) + self.assertTrue(result["passed"], result["failures"]) + self.assertTrue( + all( + epoch["reset_counter_ratios"]["accumulator_signal_count"] + == 1.0 + for epoch in result["complete_epochs"] + ) + ) + def test_accepts_durable_flat_envelope_without_consolidation(self) -> None: profile, rows = plateau_fixture() set_fixture_retention(profile, rows, "durable") @@ -733,7 +1506,7 @@ def test_rejects_work_bound_violation_in_final_partial_cycle(self) -> None: result["retrieval_cycle_symmetry"][ "accepted_suffix_maximum_retrieval_work" ], - 200.0, + 256.0, ) def test_rejects_consolidation_reset_counter_that_does_not_fall(self) -> None: @@ -744,7 +1517,7 @@ def test_rejects_consolidation_reset_counter_that_does_not_fall(self) -> None: def test_zero_reset_counter_must_remain_zero(self) -> None: profile, rows = epoch_fixture() - counter = "accumulator_signal_count" + counter = "working_memory_pending_signal_count" for event in profile["consolidation_events"]: close = event["event_index"] rows[close]["consolidation_epoch_counters"][counter] = 0 @@ -775,7 +1548,7 @@ def test_zero_reset_counter_must_remain_zero(self) -> None: def test_nonmaterial_zero_reset_counter_must_remain_zero(self) -> None: profile, rows = epoch_fixture(material=False) set_fixture_retention(profile, rows, "durable") - counter = "accumulator_signal_count" + counter = "working_memory_pending_signal_count" for event in profile["consolidation_events"]: close = event["event_index"] rows[close]["consolidation_epoch_counters"][counter] = 0 @@ -1003,12 +1776,20 @@ def test_rejects_failed_durable_barrier(self) -> None: with self.assertRaisesRegex(ValueError, "failed post-commit barrier"): audit.validate_profile_rows(profile, rows) - def test_rejects_supersession_fallback_without_exact_visit_count(self) -> None: + def test_allows_finite_warmup_supersession_fallback(self) -> None: profile, rows = plateau_fixture() rows[0]["operation_ms"][ "MemoryStorage.supersession_sql_fallback_count" ] = 1.0 - with self.assertRaisesRegex(ValueError, "fallback"): + audit.validate_profile_rows(profile, rows) + + def test_rejects_post_warmup_supersession_fallback(self) -> None: + profile, rows = plateau_fixture() + first_post_warmup = math.ceil(0.20 * len(rows)) + rows[first_post_warmup]["operation_ms"][ + "MemoryStorage.supersession_sql_fallback_count" + ] = 1.0 + with self.assertRaisesRegex(ValueError, "post-warmup.*fallback"): audit.validate_profile_rows(profile, rows) def test_rejects_flat_plateau_above_height_ceiling(self) -> None: @@ -1034,6 +1815,69 @@ def test_rejects_missing_and_vacuous_work_counters(self) -> None: with self.assertRaisesRegex(ValueError, "all zero"): audit.suffix_plateau_result(profile, vacuous, 10) + def test_accepts_only_known_rejected_candidate_counter_extensions(self) -> None: + profile, rows = plateau_fixture() + for row in rows: + for name in audit.LEGACY_REJECTED_EMOTIONAL_WORK_COUNTERS: + row["work_counters"][name] = 0.0 + audit.validate_profile_rows(profile, rows) + self.assertFalse( + audit.is_duration_operation("EmotionalCascade.edge_visit_count") + ) + self.assertFalse( + audit.is_duration_operation("EmotionalCascade.edge_visit_limit") + ) + self.assertFalse( + audit.is_duration_operation( + "MemoryStorage.supersession_current_candidate_execution_count" + ) + ) + self.assertFalse( + audit.is_duration_operation( + "GraphRetrieve.sqlite_sparse_route_search_effort" + ) + ) + for name in ( + "GraphRetrieve.sqlite_sparse_route_activation_snapshot_cache_miss_rows", + "GraphRetrieve.sqlite_sparse_route_restart_rows", + "GraphRetrieve.sqlite_sparse_route_dirty_rows", + ): + self.assertFalse(audit.is_duration_operation(name), name) + + rows[0]["work_counters"]["unknown_candidate_counter"] = 0.0 + with self.assertRaisesRegex(ValueError, "schema mismatch"): + audit.validate_profile_rows(profile, rows) + + def test_write_gate_profile_values_are_diagnostics_not_durations(self) -> None: + for name in ( + "WriteGate.flush_trigger", + "WriteGate.spike_bypass", + "WriteGate.accumulator_available", + "WriteGate.n_signals", + "WriteGate.coverage", + "WriteGate.window_score", + "WriteGate.threshold_dynamic", + "WriteGate.refractory_multiplier", + "WriteGate.write_scale", + "WriteGate.effective_threshold", + "WriteGate.score_margin", + "WriteGate.force_write", + "WriteGate.write_accumulator", + "WriteGate.reason_code", + ): + self.assertFalse(audit.is_duration_operation(name), name) + + def test_zero_suppression_population_is_not_vacuous_recovery_work(self) -> None: + profile, rows = plateau_fixture() + for row in rows: + row["work_counters"]["retrieval_suppression_id_count"] = 0.0 + row["operation_ms"]["SignalProcessor.retrieval_suppression_id_count"] = 0.0 + row["operation_ms"]["SignalProcessor.retrieval_suppression_id_activity"] = 0.0 + self.assertGreater( + row["operation_ms"]["Competition.rif_recovery_active_sql"], 0.0 + ) + audit.validate_profile_rows(profile, rows) + def test_rejects_emotional_neighbor_producer_mismatch(self) -> None: profile, rows = plateau_fixture() for row in rows: @@ -1072,6 +1916,12 @@ def test_diagnostic_row_counts_are_not_timing_operations(self) -> None: set_fixture_retention(profile, rows, "durable") ranges = audit.end_anchored_ranges(len(rows), 10) for row in rows: + row["operation_ms"][ + "Cortext.fallback_hydration_signal_limit" + ] = 128.0 + row["operation_ms"][ + "Cortext.fallback_hydration_signal_rows" + ] = 0.0 window_index = next( ( index @@ -1086,6 +1936,12 @@ def test_diagnostic_row_counts_are_not_timing_operations(self) -> None: row["operation_ms"]["GraphRetrieve.seed_cache_rows"] = ( 1.09**window_index ) + row["operation_ms"][ + "MemoryStorage.supersession_population_mismatch_count" + ] = 1.10**window_index + row["operation_ms"][ + "SignalProcessor.commit_table_row_count.embeddings_chunks" + ] = 1.11**window_index result = audit.suffix_plateau_result(profile, rows, 10) self.assertTrue(result["passed"], result.get("candidate_failures")) self.assertNotIn( @@ -1096,11 +1952,233 @@ def test_diagnostic_row_counts_are_not_timing_operations(self) -> None: "GraphRetrieve.seed_cache_rows", result["accepted_suffix"]["operation_results"], ) + self.assertNotIn( + "MemoryStorage.supersession_population_mismatch_count", + result["accepted_suffix"]["operation_results"], + ) + self.assertNotIn( + "SignalProcessor.commit_table_row_count.embeddings_chunks", + result["accepted_suffix"]["operation_results"], + ) + + def test_rejects_growing_signal_row_insert_duration(self) -> None: + profile, rows = plateau_fixture() + ranges = audit.end_anchored_ranges(len(rows), 10) + for row in rows: + window_index = next( + ( + index + for index, (start, end) in enumerate(ranges) + if start <= row["event_index"] < end + ), + 0, + ) + row["operation_ms"]["MemoryStorage.insert_signal_rows"] = ( + 0.1 * (1.08**window_index) + ) + result = audit.suffix_plateau_result(profile, rows, 10) + self.assertFalse(result["passed"]) + self.assertTrue(audit.is_duration_operation("MemoryStorage.insert_signal_rows")) def test_rejects_one_growing_active_counter(self) -> None: profile, rows = plateau_fixture(growing_counter="graph_rows_visited") self.assertFalse(audit.suffix_plateau_result(profile, rows, 10)["passed"]) + def test_emotional_work_bounds_are_knob_derived(self) -> None: + profile = {"sparse_route_parameters": fixture_sparse_parameters()} + self.assertEqual( + audit.knob_work_counter_bound(profile, "graph_rows_visited"), + 1280, + ) + self.assertEqual( + audit.knob_work_counter_bound( + profile, "supersession_rows_visited" + ), + 5888, + ) + self.assertEqual( + audit.knob_work_counter_bound(profile, "emotional_source_count"), + 128, + ) + self.assertEqual( + audit.knob_work_counter_bound(profile, "emotional_neighbor_count"), + 2560, + ) + self.assertEqual( + audit.knob_work_counter_bound(profile, "emotional_update_count"), + 1280, + ) + self.assertFalse( + audit.is_duration_operation( + "EmotionalCascade.edge_visit_limit_reached" + ) + ) + self.assertFalse( + audit.is_duration_operation( + "GraphRetrieve.sqlite_sparse_route_node_rows" + ) + ) + self.assertFalse( + audit.is_duration_operation("Cortext.fallback_hydration_signal_rows") + ) + self.assertEqual( + audit.COUNTER_SOURCE_OPERATIONS["graph_rows_visited"], + ("GraphRetrieve.rows_visited",), + ) + + def test_accepts_variable_exact_comparisons_under_knob_bound(self) -> None: + profile, rows = plateau_fixture() + set_fixture_retention(profile, rows, "durable") + profile.update( + { + "focus": 0.5, + "sensitivity": 0.5, + "stability": 0.5, + "sparse_route_parameters": fixture_sparse_parameters(), + } + ) + ranges = audit.end_anchored_ranges(len(rows), 10) + for row in rows: + row["operation_ms"][ + "Cortext.fallback_hydration_signal_limit" + ] = 128.0 + row["operation_ms"][ + "Cortext.fallback_hydration_signal_rows" + ] = 0.0 + window_index = next( + ( + index + for index, (start, end) in enumerate(ranges) + if start <= row["event_index"] < end + ), + 0, + ) + value = min(1024.0, 10.0 * 1.2**window_index) + row["work_counters"]["graph_exact_comparison_count"] = value + row["operation_ms"][ + "GraphRetrieve.family_exact_comparison_count" + ] = value + result = audit.suffix_plateau_result(profile, rows, 10) + self.assertTrue(result["passed"], result.get("candidate_failures")) + counter = result["accepted_suffix"]["work_counter_results"][ + "graph_exact_comparison_count" + ] + self.assertGreater(counter["second_over_first"], 1.10) + self.assertTrue(counter["absolute_bound_passed"]) + + def test_accepts_sparse_route_rows_under_knob_bounds(self) -> None: + profile, rows = plateau_fixture() + set_fixture_retention(profile, rows, "durable") + profile.update( + { + "focus": 0.5, + "sensitivity": 0.5, + "stability": 0.5, + "sparse_route_parameters": fixture_sparse_parameters(), + } + ) + ranges = audit.end_anchored_ranges(len(rows), 10) + for row in rows: + row["operation_ms"][ + "Cortext.fallback_hydration_signal_limit" + ] = 128.0 + row["operation_ms"][ + "Cortext.fallback_hydration_signal_rows" + ] = 0.0 + window_index = next( + ( + index + for index, (start, end) in enumerate(ranges) + if start <= row["event_index"] < end + ), + 0, + ) + graph_rows = min(1280.0, 10.0 * 1.2**window_index) + supersession_rows = min(5888.0, 20.0 * 1.2**window_index) + row["work_counters"]["graph_rows_visited"] = graph_rows + row["operation_ms"]["GraphRetrieve.rows_visited"] = graph_rows + row["work_counters"][ + "supersession_rows_visited" + ] = supersession_rows + row["operation_ms"][ + "MemoryStorage.supersession_sparse_route_node_rows" + ] = supersession_rows - 20.0 + result = audit.suffix_plateau_result(profile, rows, 10) + self.assertTrue(result["passed"], result.get("candidate_failures")) + for counter_name, expected_bound in ( + ("graph_rows_visited", 1280), + ("supersession_rows_visited", 5888), + ): + counter = result["accepted_suffix"]["work_counter_results"][ + counter_name + ] + self.assertEqual( + counter["knob_derived_absolute_bound"], expected_bound + ) + self.assertTrue(counter["absolute_bound_passed"]) + + def test_accepts_variable_emotional_updates_under_knob_bound(self) -> None: + profile, rows = plateau_fixture() + set_fixture_retention(profile, rows, "durable") + profile.update( + { + "focus": 0.5, + "sensitivity": 0.5, + "stability": 0.5, + "sparse_route_parameters": fixture_sparse_parameters(), + } + ) + ranges = audit.end_anchored_ranges(len(rows), 10) + for row in rows: + row["operation_ms"][ + "Cortext.fallback_hydration_signal_limit" + ] = 128.0 + row["operation_ms"][ + "Cortext.fallback_hydration_signal_rows" + ] = 0.0 + window_index = next( + ( + index + for index, (start, end) in enumerate(ranges) + if start <= row["event_index"] < end + ), + 0, + ) + value = min(1280.0, 4.0 * 1.2**window_index) + row["work_counters"]["emotional_update_count"] = value + row["operation_ms"]["EmotionalCascade.update_count"] = value + result = audit.suffix_plateau_result(profile, rows, 10) + self.assertTrue(result["passed"], result.get("candidate_failures")) + counter = result["accepted_suffix"]["work_counter_results"][ + "emotional_update_count" + ] + self.assertEqual(counter["knob_derived_absolute_bound"], 1280) + self.assertTrue(counter["absolute_bound_passed"]) + + def test_rejects_exact_comparison_above_knob_bound(self) -> None: + profile, rows = plateau_fixture() + set_fixture_retention(profile, rows, "durable") + profile.update( + { + "focus": 0.5, + "sensitivity": 0.5, + "stability": 0.5, + "sparse_route_parameters": fixture_sparse_parameters(), + } + ) + for row in rows: + row["operation_ms"][ + "Cortext.fallback_hydration_signal_limit" + ] = 128.0 + row["operation_ms"][ + "Cortext.fallback_hydration_signal_rows" + ] = 0.0 + rows[-1]["work_counters"]["graph_exact_comparison_count"] = 1025.0 + rows[-1]["operation_ms"][ + "GraphRetrieve.family_exact_comparison_count" + ] = 1025.0 + self.assertFalse(audit.suffix_plateau_result(profile, rows, 10)["passed"]) + def test_rejects_growing_consolidation_cost_with_flat_process(self) -> None: profile, rows = plateau_fixture( elapsed_windows=[2.0, 4.0, 6.0, 8.0] @@ -1115,6 +2193,212 @@ def test_rejects_plateau_shorter_than_six_windows(self) -> None: self.assertFalse(audit.suffix_plateau_result(profile, rows, 10)["passed"]) +class ActivityNormalizedResetDiagnosticTest(unittest.TestCase): + @staticmethod + def evaluation( + *, + operation: object = "MemoryStorage", + epoch: int = 28, + trailing_ms: list[float] | None = None, + post_ms: list[float] | None = None, + trailing_activity: list[float] | None = None, + post_activity: list[float] | None = None, + modality: str = "text", + source_id: str = "opaque-a", + ) -> dict[str, object]: + return { + "epoch": epoch, + "operation": operation, + "trailing_event_indices": [100, 101], + "post_event_indices": [102, 103], + "trailing_ms": trailing_ms if trailing_ms is not None else [1.0, 1.0], + "post_ms": post_ms if post_ms is not None else [2.0, 2.0], + "trailing_activity": ( + trailing_activity if trailing_activity is not None else [2.0, 2.0] + ), + "post_activity": ( + post_activity if post_activity is not None else [8.0, 8.0] + ), + "modality": modality, + "source_id": source_id, + } + + def test_rising_raw_peak_cannot_be_waived(self) -> None: + result = audit.activity_normalized_reset_diagnostic( + [self.evaluation()], ["sawtooth peaks rise"] + ) + self.assertFalse(result["raw_gate_passed"]) + self.assertEqual(result["raw_gate_failures"], ["sawtooth peaks rise"]) + + def test_rising_raw_trough_cannot_be_waived(self) -> None: + result = audit.activity_normalized_reset_diagnostic( + [self.evaluation()], ["sawtooth troughs rise"] + ) + self.assertFalse(result["raw_gate_passed"]) + self.assertEqual(result["raw_gate_failures"], ["sawtooth troughs rise"]) + + def test_raw_reset_miss_cannot_be_waived(self) -> None: + result = audit.activity_normalized_reset_diagnostic( + [self.evaluation()], ["material epoch does not lower following process time"] + ) + self.assertFalse(result["raw_gate_passed"]) + self.assertEqual(result["diagnostic_result"], "activity-incidence") + + def test_positive_positive_uses_ratio_of_sums(self) -> None: + result = audit.activity_normalized_reset_diagnostic([ + self.evaluation( + trailing_ms=[1.0, 9.0], + trailing_activity=[1.0, 9.0], + post_ms=[2.0, 18.0], + post_activity=[1.0, 99.0], + ) + ], []) + row = result["evaluations"][0] + self.assertEqual(row["trailing_unit_cost"], 1.0) + self.assertEqual(row["post_unit_cost"], 0.2) + self.assertEqual(row["unit_cost_ratio"], 0.2) + + def test_zero_zero_is_unevaluated_and_non_rescuing(self) -> None: + result = audit.activity_normalized_reset_diagnostic([ + self.evaluation( + trailing_ms=[0.0, 0.0], + post_ms=[0.0, 0.0], + trailing_activity=[0.0, 0.0], + post_activity=[0.0, 0.0], + ) + ], ["raw miss"]) + self.assertEqual(result["evaluations"][0]["status"], "unevaluated") + self.assertIsNone(result["selected_hotspot"]) + self.assertFalse(result["raw_gate_passed"]) + + def test_one_sided_zero_is_incomparable(self) -> None: + result = audit.activity_normalized_reset_diagnostic([ + self.evaluation( + trailing_ms=[0.0, 0.0], + trailing_activity=[0.0, 0.0], + post_ms=[1.0, 1.0], + post_activity=[2.0, 2.0], + ) + ], []) + self.assertEqual(result["evaluations"][0]["status"], "incomparable") + self.assertEqual(result["diagnostic_result"], "diagnostic-inconclusive") + + def test_negative_value_is_rejected(self) -> None: + with self.assertRaisesRegex(ValueError, "nonnegative"): + audit.activity_normalized_reset_diagnostic([ + self.evaluation(trailing_ms=[-1.0, 1.0]) + ], []) + + def test_nonfinite_value_is_rejected(self) -> None: + with self.assertRaisesRegex(ValueError, "finite"): + audit.activity_normalized_reset_diagnostic([ + self.evaluation(trailing_ms=[math.nan, 1.0]) + ], []) + + def test_unequal_windows_are_rejected(self) -> None: + item = self.evaluation() + item["post_event_indices"] = [102] + with self.assertRaisesRegex(ValueError, "matching event windows"): + audit.activity_normalized_reset_diagnostic([item], []) + + def test_equal_length_interleaved_windows_are_rejected(self) -> None: + item = self.evaluation() + item["trailing_event_indices"] = [100, 102] + item["post_event_indices"] = [101, 103] + with self.assertRaisesRegex(ValueError, "contiguous adjacent event windows"): + audit.activity_normalized_reset_diagnostic([item], []) + + def test_operations_in_one_epoch_require_identical_windows(self) -> None: + first = self.evaluation(operation="MemoryStorage", epoch=28) + second = self.evaluation(operation="PropagateEmotionalCascade", epoch=28) + second["trailing_event_indices"] = [200, 201] + second["post_event_indices"] = [202, 203] + with self.assertRaisesRegex(ValueError, "same epoch must share event windows"): + audit.activity_normalized_reset_diagnostic([first, second], []) + + def test_finite_samples_that_overflow_aggregate_are_rejected(self) -> None: + with self.assertRaisesRegex(ValueError, "aggregate.*finite"): + audit.activity_normalized_reset_diagnostic([ + self.evaluation(post_activity=[1e308, 1e308]) + ], []) + + def test_pooled_operations_are_rejected(self) -> None: + with self.assertRaisesRegex(ValueError, "operation id"): + audit.activity_normalized_reset_diagnostic([ + self.evaluation(operation=["MemoryStorage", "PropagateEmotionalCascade"]) + ], []) + + def test_modality_and_source_labels_do_not_change_arithmetic(self) -> None: + baseline = audit.activity_normalized_reset_diagnostic([ + self.evaluation(modality="text", source_id="shared") + ], []) + for modality, source_id in (("audio", "opaque-a"), ("image", "opaque-b")): + with self.subTest(modality=modality, source_id=source_id): + varied = audit.activity_normalized_reset_diagnostic([ + self.evaluation(modality=modality, source_id=source_id) + ], []) + self.assertEqual(varied, baseline) + + def test_non_neutral_knobs_reject_hidden_midpoint_batch(self) -> None: + with self.assertRaisesRegex(ValueError, "processed rows exceed F/S/T-derived B"): + audit.activity_normalized_reset_diagnostic( + [self.evaluation()], [], + knob_context={"focus": 0.0, "sensitivity": 0.0, "stability": 0.0, + "processed_backfill_rows": 128}, + ) + + def test_neutral_b_plus_one_is_logical_not_processed(self) -> None: + with self.assertRaisesRegex(ValueError, "processed rows exceed F/S/T-derived B"): + audit.activity_normalized_reset_diagnostic( + [self.evaluation()], [], + knob_context={"focus": 0.5, "sensitivity": 0.5, "stability": 0.5, + "processed_backfill_rows": 129}, + ) + + def test_no_evaluable_operation_returns_deepen_profile(self) -> None: + result = audit.activity_normalized_reset_diagnostic([ + self.evaluation( + trailing_ms=[0.0, 0.0], post_ms=[0.0, 0.0], + trailing_activity=[0.0, 0.0], post_activity=[0.0, 0.0], + ) + ], []) + self.assertEqual(result["diagnostic_result"], "diagnostic-inconclusive") + self.assertEqual(result["continuation"], "deepen-profile") + self.assertIsNone(result["selected_hotspot"]) + + def test_deterministic_tie_uses_operation_then_epoch(self) -> None: + result = audit.activity_normalized_reset_diagnostic([ + self.evaluation(operation="PropagateEmotionalCascade", epoch=28), + self.evaluation(operation="MemoryStorage", epoch=35), + ], []) + self.assertEqual(result["selected_hotspot"]["operation"], "MemoryStorage") + self.assertEqual(result["selected_hotspot"]["epoch"], 35) + + def test_consolidation_result_reports_diagnostic_without_waiving_raw_miss( + self, + ) -> None: + profile, rows = epoch_fixture() + close = profile["consolidation_events"][0]["event_index"] + for row in rows[close + 1 : close + 51]: + row["process_ms"] = 1.14 + row["end_to_end_ms"] = 1.14 + row["operation_ms"]["cortext::operations::MemoryStorage"] = 0.2 + row["work_counters"]["supersession_current_candidate_count"] = 20.0 + result = audit.consolidation_epoch_result(profile, rows, 0, len(rows)) + diagnostic = result["activity_normalized_reset_diagnostic"] + self.assertFalse(result["passed"]) + self.assertIn( + "material epoch does not lower following process time", + result["failures"], + ) + self.assertFalse(diagnostic["raw_gate_passed"]) + self.assertFalse(diagnostic["raw_gate_waived"]) + self.assertEqual(diagnostic["diagnostic_result"], "activity-incidence") + self.assertEqual( + diagnostic["selected_hotspot"]["operation"], "MemoryStorage" + ) + + class BoundedActivationQualityContractTest(unittest.TestCase): def quality_fixture(self, role: str = "candidate") -> dict[str, object]: evidence = [] @@ -1214,6 +2498,13 @@ def quality_fixture(self, role: str = "candidate") -> dict[str, object]: } ], } + candidate_rank_digest = audit.ranked_query_evidence_result( + artifact, 16 + )["candidate_identity_rank_sha256"] + artifact["candidate_identity_rank_sha256"] = candidate_rank_digest + artifact["repeat_candidate_identity_rank_sha256"] = ( + candidate_rank_digest + ) restart_probe_digest = audit.ranked_query_evidence_result( artifact, 16 )["fixed_probe_identity_rank_sha256"] @@ -1241,6 +2532,30 @@ def test_accepts_exact_quality_and_bounded_restart(self) -> None: result = self.audit_result(self.quality_fixture()) self.assertTrue(result["passed"], result["failures"]) + def test_accepts_approved_lower_rank_loss_above_floor(self) -> None: + fixture = self.quality_fixture() + fixture["query_evidence"][37]["candidate_ranked_ids"][-1] = 99999999 + fixture["quality"]["all"]["mean_exact_id_recall_at_k"] = ( + 8191 / 8192 + ) + digest = audit.ranked_query_evidence_result( + fixture, 16 + )["candidate_identity_rank_sha256"] + fixture["candidate_identity_rank_sha256"] = digest + fixture["repeat_candidate_identity_rank_sha256"] = digest + result = self.audit_result(fixture) + self.assertTrue(result["passed"], result["failures"]) + + def test_rejects_unrepeated_candidate_rank_digest(self) -> None: + fixture = self.quality_fixture() + fixture["repeat_candidate_identity_rank_sha256"] = "f" * 64 + result = self.audit_result(fixture) + self.assertFalse(result["passed"]) + self.assertIn( + "candidate rank order is not repeat-deterministic", + result["failures"], + ) + def test_rejects_unapproved_control_digest(self) -> None: with self.assertRaisesRegex(ValueError, "control digest is not approved"): audit.bounded_activation_quality_result( @@ -1261,8 +2576,8 @@ def test_rejects_unbound_existing_public_probe_digest(self) -> None: def test_rejects_candidate_that_differs_from_approved_control_rank(self) -> None: control = self.control_fixture() - control["query_evidence"][37]["candidate_ranked_ids"][1:3] = reversed( - control["query_evidence"][37]["candidate_ranked_ids"][1:3] + control["query_evidence"][37]["exact_ranked_ids"][1:3] = reversed( + control["query_evidence"][37]["exact_ranked_ids"][1:3] ) result = self.audit_result(self.quality_fixture(), control) self.assertFalse(result["passed"]) @@ -1310,6 +2625,11 @@ def test_rejects_current_observation_residuals(self) -> None: probe["candidate_ranked_ids"] = fixture["query_evidence"][ query_number ]["candidate_ranked_ids"] + digest = audit.ranked_query_evidence_result( + fixture, 16 + )["candidate_identity_rank_sha256"] + fixture["candidate_identity_rank_sha256"] = digest + fixture["repeat_candidate_identity_rank_sha256"] = digest fixture["quality"]["all"]["mean_exact_id_recall_at_k"] = 0.0 fixture["quality"]["all"]["mean_top1_exact_id"] = 0.0 for item in fixture["sqlite_restart_measurements"]: @@ -1322,6 +2642,21 @@ def test_rejects_current_observation_residuals(self) -> None: self.assertIn("exact top-1 below invariant", result["failures"]) self.assertIn("restart remains proportional to history", result["failures"]) + def test_accepts_one_nonclusterable_top1_miss_in_512_queries(self) -> None: + fixture = self.quality_fixture() + fixture["query_evidence"][37]["candidate_ranked_ids"][0:2] = reversed( + fixture["query_evidence"][37]["candidate_ranked_ids"][0:2] + ) + digest = audit.ranked_query_evidence_result( + fixture, 16 + )["candidate_identity_rank_sha256"] + fixture["candidate_identity_rank_sha256"] = digest + fixture["repeat_candidate_identity_rank_sha256"] = digest + fixture["quality"]["all"]["mean_top1_exact_id"] = 511 / 512 + result = self.audit_result(fixture) + self.assertTrue(result["passed"], result["failures"]) + self.assertEqual(result["exact_top1_miss_count"], 1) + def test_rejects_missing_mixed_input_coverage(self) -> None: fixture = self.quality_fixture() control = self.control_fixture() @@ -1357,9 +2692,6 @@ def test_rejects_reordered_exact_neighbors(self) -> None: ]["candidate_ranked_ids"] result = self.audit_result(fixture, control) self.assertFalse(result["passed"]) - self.assertIn( - "deterministic exact rank order differs", result["failures"] - ) self.assertIn("fixed identity-rank probe differs", result["failures"]) def test_rejects_unbound_query_count(self) -> None: @@ -1379,6 +2711,18 @@ def test_rejects_linear_restart_despite_passing_labels(self) -> None: "restart remains proportional to history", result["failures"] ) + def test_accepts_fraction_local_restart_probe_digests(self) -> None: + fixture = self.quality_fixture() + for index, digest in enumerate(("a" * 64, "b" * 64)): + fixture["sqlite_restart_measurements"][index][ + "pre_restart_probe_identity_rank_sha256" + ] = digest + fixture["sqlite_restart_measurements"][index][ + "post_restart_probe_identity_rank_sha256" + ] = digest + result = self.audit_result(fixture) + self.assertTrue(result["passed"], result["failures"]) + def test_rejects_vacuous_restart_series(self) -> None: fixture = self.quality_fixture() for index, item in enumerate(fixture["sqlite_restart_measurements"]): diff --git a/tools/benchmark_row_addressed_route_sqlite.py b/tools/benchmark_row_addressed_route_sqlite.py new file mode 100644 index 00000000..c722f435 --- /dev/null +++ b/tools/benchmark_row_addressed_route_sqlite.py @@ -0,0 +1,417 @@ +#!/usr/bin/env python3 +"""Measure an incrementally writable SQLite representation of sparse routes. + +The input is a private packed-route feasibility database. Output contains only +aggregate timings, counts, and content digests; it never contains corpus text, +source identifiers, local paths, or embedding values. +""" + +from __future__ import annotations + +import argparse +import hashlib +import json +import math +import os +import sqlite3 +import statistics +import struct +import time +from pathlib import Path +from typing import Iterable + +import numpy as np + + +ROUTE_CAPACITY = 512 +EDGE_CAPACITY = 128 +DIMENSION = 256 + + +def sha256_bytes(value: bytes) -> str: + return hashlib.sha256(value).hexdigest() + + +def create_schema(database: sqlite3.Connection) -> None: + database.executescript( + """ + PRAGMA journal_mode=WAL; + PRAGMA synchronous=NORMAL; + CREATE TABLE nodes( + label INTEGER PRIMARY KEY, + identity INTEGER NOT NULL, + embedding BLOB NOT NULL, + embedding_hash INTEGER NOT NULL + ); + CREATE INDEX nodes_hash_identity + ON nodes(embedding_hash, identity); + CREATE TABLE edges( + graph INTEGER NOT NULL, + label INTEGER NOT NULL, + neighbors BLOB NOT NULL, + PRIMARY KEY(graph, label) + ) WITHOUT ROWID; + CREATE TABLE routes( + label INTEGER PRIMARY KEY, + neighbors BLOB NOT NULL + ); + CREATE TABLE anchors( + ordinal INTEGER PRIMARY KEY, + label INTEGER NOT NULL, + centroid BLOB NOT NULL + ); + CREATE TABLE meta( + key TEXT PRIMARY KEY, + value INTEGER NOT NULL + ) WITHOUT ROWID; + """ + ) + + +def route_blob(packed: bytes, label: int) -> bytes: + stride = (ROUTE_CAPACITY + 1) * 4 + start = label * stride + return packed[start : start + stride] + + +def unpack_route(blob: bytes) -> tuple[int, ...]: + values = struct.unpack(f"<{ROUTE_CAPACITY + 1}I", blob) + count = values[0] + if count > ROUTE_CAPACITY: + raise ValueError("packed route exceeds fixed capacity") + return values[1 : count + 1] + + +def copy_prefix( + source: sqlite3.Connection, + target: sqlite3.Connection, + packed_routes: bytes, + count: int, +) -> None: + target.execute("BEGIN IMMEDIATE") + target.executemany( + "INSERT INTO nodes VALUES(?,?,?,?)", + source.execute( + "SELECT label,identity,embedding,embedding_hash FROM nodes " + "WHERE label < ? ORDER BY label", + (count,), + ), + ) + target.executemany( + "INSERT INTO edges VALUES(?,?,?)", + source.execute( + "SELECT graph,label,neighbors FROM edges WHERE label < ? " + "ORDER BY graph,label", + (count,), + ), + ) + target.executemany( + "INSERT INTO routes VALUES(?,?)", + ((label, route_blob(packed_routes, label)) for label in range(count)), + ) + target.executemany( + "INSERT INTO anchors VALUES(?,?,?)", + source.execute("SELECT ordinal,label,centroid FROM anchors ORDER BY ordinal"), + ) + target.executemany( + "INSERT INTO meta VALUES(?,?)", + source.execute("SELECT key,value FROM meta ORDER BY key"), + ) + target.execute( + "INSERT OR REPLACE INTO meta VALUES('sealed_count',?)", (count,) + ) + target.commit() + + +def rows_for_range( + source: sqlite3.Connection, + packed_routes: bytes, + begin: int, + end: int, +) -> tuple[list[tuple], list[tuple], list[tuple]]: + nodes = list( + source.execute( + "SELECT label,identity,embedding,embedding_hash FROM nodes " + "WHERE label >= ? AND label < ? ORDER BY label", + (begin, end), + ) + ) + edges = list( + source.execute( + "SELECT graph,label,neighbors FROM edges " + "WHERE label >= ? AND label < ? ORDER BY graph,label", + (begin, end), + ) + ) + routes = [ + (label, route_blob(packed_routes, label)) for label in range(begin, end) + ] + if len(nodes) != end - begin or len(edges) != 2 * (end - begin): + raise ValueError("source graph range is incomplete") + return nodes, edges, routes + + +def reciprocal_updates( + source: sqlite3.Connection, + packed_routes: bytes, + begin: int, + end: int, + proposals_per_embedding: int, +) -> list[tuple[bytes, int]]: + updates: dict[int, bytes] = {} + for label in range(begin, end): + proposed = unpack_route(route_blob(packed_routes, label))[ + :proposals_per_embedding + ] + for target in proposed: + if target >= begin: + continue + updates[target] = route_blob(packed_routes, target) + return [(blob, label) for label, blob in sorted(updates.items())] + + +def apply_epoch( + target: sqlite3.Connection, + nodes: list[tuple], + edges: list[tuple], + routes: list[tuple], + reciprocal: list[tuple[bytes, int]], + sealed_count: int, + failure_stage: str | None = None, +) -> float: + started = time.perf_counter() + target.execute("BEGIN IMMEDIATE") + try: + target.executemany("INSERT INTO nodes VALUES(?,?,?,?)", nodes) + target.executemany("INSERT INTO edges VALUES(?,?,?)", edges) + target.executemany("INSERT INTO routes VALUES(?,?)", routes) + target.executemany( + "UPDATE routes SET neighbors=? WHERE label=?", reciprocal + ) + target.execute( + "INSERT OR REPLACE INTO meta VALUES('sealed_count',?)", + (sealed_count,), + ) + if failure_stage == "before-commit": + raise RuntimeError("injected before derived commit") + target.commit() + except Exception: + target.rollback() + raise + if failure_stage == "after-commit": + raise RuntimeError("injected after derived commit") + return time.perf_counter() - started + + +def restart_rows(database: sqlite3.Connection) -> int: + rows = 0 + dimension = database.execute( + "SELECT value FROM meta WHERE key='dimension'" + ).fetchone() + if dimension != (DIMENSION,): + raise ValueError("route dimension mismatch") + rows += 1 + anchors = database.execute( + "SELECT label,centroid FROM anchors ORDER BY ordinal" + ).fetchall() + if len(anchors) != 1024: + raise ValueError("route anchor count mismatch") + for _, centroid in anchors: + if len(centroid) != DIMENSION * 4: + raise ValueError("route anchor dimension mismatch") + rows += len(anchors) + return rows + + +def query_route(database: sqlite3.Connection, label: int) -> tuple[list[int], int]: + row = database.execute( + "SELECT n.embedding,r.neighbors FROM nodes n JOIN routes r " + "ON r.label=n.label WHERE n.label=?", + (label,), + ).fetchone() + if row is None: + raise ValueError("missing route query label") + query = np.frombuffer(row[0], dtype=np.float32) + candidates = unpack_route(row[1]) + if not candidates: + raise ValueError("empty route") + placeholders = ",".join("?" for _ in candidates) + rows = database.execute( + f"SELECT label,identity,embedding FROM nodes WHERE label IN ({placeholders})", + candidates, + ).fetchall() + if len(rows) != len(set(candidates)): + raise ValueError("route refers to an absent node") + matrix = np.vstack([np.frombuffer(row[2], dtype=np.float32) for row in rows]) + distances = 1.0 - matrix @ query + ranked = sorted( + zip(distances.tolist(), (row[1] for row in rows), (row[0] for row in rows)) + ) + return [label for _, _, label in ranked[:16]], len(rows) + + +def measure_queries( + database: sqlite3.Connection, count: int, query_count: int +) -> dict[str, float | int | str]: + labels = [index * (count - 1) // (query_count - 1) for index in range(query_count)] + digest = hashlib.sha256() + comparisons: list[int] = [] + started = time.perf_counter() + for label in labels: + ranked, current = query_route(database, label) + comparisons.append(current) + digest.update(struct.pack(f"<{len(ranked)}q", *ranked)) + elapsed = time.perf_counter() - started + return { + "query_count": query_count, + "seconds": elapsed, + "mean_ms": elapsed * 1000.0 / query_count, + "mean_comparisons": statistics.fmean(comparisons), + "maximum_comparisons": max(comparisons), + "rank_digest_sha256": digest.hexdigest(), + } + + +def database_counts(database: sqlite3.Connection) -> dict[str, int]: + return { + table: database.execute(f"SELECT COUNT(*) FROM {table}").fetchone()[0] + for table in ("nodes", "edges", "routes", "anchors") + } + + +def run(args: argparse.Namespace) -> dict: + if args.epoch_events <= 0 or args.epoch_events > 512: + raise ValueError("epoch events must be between 1 and 512") + source = sqlite3.connect(f"file:{args.source}?mode=ro", uri=True) + packed_row = source.execute("SELECT payload FROM packed WHERE id=3").fetchone() + if packed_row is None: + raise ValueError("source lacks packed routes") + packed_routes = packed_row[0] + count = source.execute("SELECT COUNT(*) FROM nodes").fetchone()[0] + expected_bytes = count * (ROUTE_CAPACITY + 1) * 4 + if len(packed_routes) != expected_bytes: + raise ValueError("packed route size mismatch") + begin = count - args.epoch_events + late_rows = rows_for_range(source, packed_routes, begin, count) + fresh_rows = rows_for_range(source, packed_routes, 0, args.epoch_events) + late_reciprocal = reciprocal_updates( + source, packed_routes, begin, count, args.reciprocal_proposals + ) + fresh_reciprocal: list[tuple[bytes, int]] = [] + + for path in (args.fresh_db, args.late_db): + for suffix in ("", "-wal", "-shm"): + try: + os.remove(f"{path}{suffix}") + except FileNotFoundError: + pass + + fresh = sqlite3.connect(args.fresh_db) + create_schema(fresh) + fresh.execute("BEGIN IMMEDIATE") + fresh.executemany( + "INSERT INTO anchors VALUES(?,?,?)", + source.execute("SELECT ordinal,label,centroid FROM anchors ORDER BY ordinal"), + ) + fresh.executemany( + "INSERT INTO meta VALUES(?,?)", + source.execute("SELECT key,value FROM meta ORDER BY key"), + ) + fresh.commit() + fresh_seconds = apply_epoch( + fresh, *fresh_rows, fresh_reciprocal, args.epoch_events + ) + + late = sqlite3.connect(args.late_db) + create_schema(late) + copy_prefix(source, late, packed_routes, begin) + before_counts = database_counts(late) + try: + apply_epoch( + late, *late_rows, late_reciprocal, count, failure_stage="before-commit" + ) + except RuntimeError: + pass + rollback_counts = database_counts(late) + if rollback_counts != before_counts: + raise ValueError("derived rollback did not restore row counts") + late_seconds = apply_epoch(late, *late_rows, late_reciprocal, count) + committed_counts = database_counts(late) + late.close() + late = sqlite3.connect(args.late_db) + restarted_counts = database_counts(late) + if restarted_counts != committed_counts: + raise ValueError("restart changed committed route counts") + restart_visited = restart_rows(late) + queries = measure_queries(late, count, args.query_count) + + source.close() + fresh.close() + late.close() + return { + "schema": "cortext_row_addressed_route_sqlite_v1", + "proof_level": "benchmark-only", + "evidence_kind": "measured-private-representation", + "parameters": { + "embedding_count": count, + "embedding_dimension": DIMENSION, + "epoch_events": args.epoch_events, + "route_capacity": ROUTE_CAPACITY, + "reciprocal_proposals_per_embedding": args.reciprocal_proposals, + "query_count": args.query_count, + }, + "fresh_epoch": { + "apply_commit_seconds": fresh_seconds, + "mean_ms_per_event": fresh_seconds * 1000.0 / args.epoch_events, + }, + "copied_late_epoch": { + "prefix_rows": begin, + "apply_commit_seconds": late_seconds, + "mean_ms_per_event": late_seconds * 1000.0 / args.epoch_events, + "fresh_ratio": late_seconds / fresh_seconds, + "reciprocal_rows_updated": len(late_reciprocal), + }, + "failure_and_restart": { + "before_commit_rollback_exact": rollback_counts == before_counts, + "committed_restart_exact": restarted_counts == committed_counts, + "restart_rows_visited": restart_visited, + "committed_counts": committed_counts, + }, + "route_query": queries, + "database_bytes": { + "fresh": os.path.getsize(args.fresh_db), + "copied_late": os.path.getsize(args.late_db), + }, + "source_fingerprint": { + "packed_route_sha256": sha256_bytes(packed_routes), + "node_count": count, + }, + "decision": "representation-seam-only-production-path-proof-pending", + "production_cutover": False, + "unresolved_limits": [ + "graph construction and public-path integration are outside this representation benchmark", + "post-authoritative-commit publication and Durable barrier failures require engine-path proof", + "the result does not establish a live public-consolidation sawtooth", + ], + } + + +def main() -> int: + parser = argparse.ArgumentParser() + parser.add_argument("--source", required=True, type=Path) + parser.add_argument("--fresh-db", required=True, type=Path) + parser.add_argument("--late-db", required=True, type=Path) + parser.add_argument("--out", required=True, type=Path) + parser.add_argument("--epoch-events", type=int, default=200) + parser.add_argument("--reciprocal-proposals", type=int, default=64) + parser.add_argument("--query-count", type=int, default=512) + args = parser.parse_args() + result = run(args) + args.out.parent.mkdir(parents=True, exist_ok=True) + args.out.write_text(json.dumps(result, indent=2, sort_keys=True) + "\n") + print(json.dumps(result, indent=2, sort_keys=True)) + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/tools/benchmark_row_addressed_route_sqlite_test.py b/tools/benchmark_row_addressed_route_sqlite_test.py new file mode 100644 index 00000000..aafff002 --- /dev/null +++ b/tools/benchmark_row_addressed_route_sqlite_test.py @@ -0,0 +1,52 @@ +#!/usr/bin/env python3 + +import sqlite3 +import struct +import unittest + +import benchmark_row_addressed_route_sqlite as benchmark + + +class RowAddressedRouteSQLiteTests(unittest.TestCase): + def test_route_slice_and_unpack_respect_fixed_capacity(self): + first = struct.pack( + f"<{benchmark.ROUTE_CAPACITY + 1}I", + 2, + 7, + 9, + *([0] * (benchmark.ROUTE_CAPACITY - 2)), + ) + second = struct.pack( + f"<{benchmark.ROUTE_CAPACITY + 1}I", + 1, + 11, + *([0] * (benchmark.ROUTE_CAPACITY - 1)), + ) + packed = first + second + self.assertEqual(benchmark.unpack_route(benchmark.route_blob(packed, 0)), (7, 9)) + self.assertEqual(benchmark.unpack_route(benchmark.route_blob(packed, 1)), (11,)) + + def test_injected_precommit_failure_rolls_back_all_route_rows(self): + database = sqlite3.connect(":memory:") + benchmark.create_schema(database) + embedding = struct.pack(f"<{benchmark.DIMENSION}f", *([0.0] * benchmark.DIMENSION)) + edge = struct.pack(f"<{benchmark.EDGE_CAPACITY + 1}I", *([0] * (benchmark.EDGE_CAPACITY + 1))) + route = struct.pack(f"<{benchmark.ROUTE_CAPACITY + 1}I", *([0] * (benchmark.ROUTE_CAPACITY + 1))) + with self.assertRaises(RuntimeError): + benchmark.apply_epoch( + database, + [(0, 1, embedding, 2)], + [(0, 0, edge), (1, 0, edge)], + [(0, route)], + [], + 1, + failure_stage="before-commit", + ) + self.assertEqual( + benchmark.database_counts(database), + {"nodes": 0, "edges": 0, "routes": 0, "anchors": 0}, + ) + + +if __name__ == "__main__": + unittest.main() diff --git a/tools/build_paper_traceability_manifest.py b/tools/build_paper_traceability_manifest.py new file mode 100644 index 00000000..aa297385 --- /dev/null +++ b/tools/build_paper_traceability_manifest.py @@ -0,0 +1,413 @@ +#!/usr/bin/env python3 +"""Build the content-addressed paper traceability inventory.""" + +from __future__ import annotations + +import argparse +import hashlib +import json +from pathlib import Path +from typing import Any + +from audit_paper_traceability import load_json, merge_state, state_inventory + + +BASE_COMMIT = "1bf3f1c5f6470bb8c4d458a0389c19c5123f9b81" +SECTION = { + "path": "docs/paper/sections/11_optimization.qmd", + "heading": "Experiment and algorithm traceability inventory", +} +VARIANTS = [ + "reciprocal-route-only", + "three-sparse-graphs", + "construction-budget-4096", + "construction-budget-8192-reciprocal-64", + "two-graphs-construction-16384-retrieval-1280-reciprocal-64", +] +ALGORITHM_GROUPS = [ + { + "id": "consolidation-envelope-and-detector", + "paths": [ + "src/operations/accumulator_reset.cpp", + "src/operations/consolidation.cpp", + "src/operations/consolidation_shallow.cpp", + "src/operations/consolidation_throughput_state_internal.hpp", + ], + }, + { + "id": "shared-retention-and-rollback", + "paths": [ + "src/operations/accumulator.cpp", + "src/operations/signal_record_rollback_internal.hpp", + "src/operations/write_gate.cpp", + "src/operations/working_memory.cpp", + "src/signal_processor.cpp", + ], + }, + { + "id": "lazy-rif-active-epoch", + "paths": [ + "src/operations/competition.cpp", + "src/operations/execution_cache_sidecar_internal.hpp", + "src/operations/memory_strength.cpp", + "src/operations/rif_active_epoch_cache_internal.hpp", + "src/operations/rif_state_internal.hpp", + "src/store.cpp", + "src/store/schema.cpp", + ], + }, + { + "id": "bounded-graph-retrieval", + "paths": [ + "src/operations/sparse_retrieval_knobs_internal.hpp", + "src/operations/bounded_activation_shadow_internal.hpp", + "src/operations/family_embedding_features_internal.hpp", + "src/operations/graph_retrieval.cpp", + "src/operations/historical_surface_search_cache_internal.hpp", + "src/operations/retrieval_trace_state.cpp", + "src/operations/retrieval_trace_state.hpp", + "src/operations/sparse_retrieval_route_internal.cpp", + "src/operations/sparse_retrieval_route_internal.hpp", + "src/operations/sparse_retrieval_route_sqlite_internal.cpp", + "src/operations/sparse_retrieval_route_sqlite_internal.hpp", + ], + }, + { + "id": "emotional-propagation-cache", + "paths": [ + "src/experimental_env.hpp", + "src/operations/emotion.cpp", + "src/operations/emotion_cascade.cpp", + "src/operations/emotional_metadata_cache_internal.hpp", + ], + }, + { + "id": "memory-storage-and-graph-maintenance", + "paths": [ + "src/operations/active_signal_embedding_ring_internal.hpp", + "src/operations/association_fanout_cache_internal.hpp", + "src/operations/detect_memory_usage.cpp", + "src/operations/eviction_policy.hpp", + "src/operations/memory_storage.cpp", + "src/operations/predictive.cpp", + "src/operations/reconsolidation.cpp", + "src/operations/stability.cpp", + ], + }, + { + "id": "runtime-composition", + "paths": [ + "src/cortext.cpp", + "src/cortext_pipeline_internal.hpp", + ], + }, + { + "id": "bounded-work-instrumentation", + "paths": [ + "src/operations/consolidation_epoch_profile_internal.hpp", + "src/store/commit_profile_internal.hpp", + "src/store/mutation_audit_internal.hpp", + ], + }, + { + "id": "experiment-harness-and-audit", + "paths": [ + "examples/benchmark/chat_replay_live_run.cpp", + "tools/audit_public_retrieval_control.py", + "tools/audit_storage_cost_profile.py", + "tools/benchmark_row_addressed_route_sqlite.py", + "tools/build_sqlite_hnsw_knob_ablation.py", + "tools/build_signal_centroid_ring_ablation.py", + "tools/extract_claude_session_packets.py", + "tools/extract_consolidation_schedule.py", + "tools/build_recenter_activation_overlap.py", + "tools/build_write_gate_incidence_attribution.py", + ], + }, +] + + +def canonical_sha(value: Any) -> str: + encoded = json.dumps(value, sort_keys=True, separators=(",", ":")).encode() + return hashlib.sha256(encoded).hexdigest() + + +def first_decision(value: Any) -> str: + if isinstance(value, dict): + for key in ("decision", "status", "verdict", "state"): + candidate = value.get(key) + if isinstance(candidate, (str, bool, int, float)): + return str(candidate) + return "recorded-measurement" + + +def state_scope(key: str) -> str: + if key == "rif_epoch_consolidation_reset_candidate": + return ( + "15,695-packet Natural replay at F=0.45, S=T=0.5; 27 " + "structural F/S/T points; nine production-shaped reset points; " + "B=round(64+64F+32S+32T), with neutral B=128 and 129 used only " + "as the logical B+1 population boundary; text/audio/image labels " + "and two opaque source ids" + ) + if key == "hnsw_fixed_6c_experiment": + return ( + "rejected private fixed-6C envelope; 27 structural F/S/T points " + "and 931 assertions; one additional 15,695-packet Natural " + "production-default pre-screen at F=0.45, S=T=0.5 with 512 public " + "top-16 queries; exact nine-point corpus matrix not started after " + "fail-fast rejection" + ) + if key == "signal_centroid_ring_cutover": + return ( + "migration 30; 15,695-packet Natural and 2,016-message Durable " + "replays at F=0.45, S=T=0.5; 27 structural F/S/T points; nine " + "2,000-packet same-knob runs with 512 public queries and four " + "opaque source ids per run; separate text/audio/image label proof" + ) + if key == "sqlite_hnsw_production_cutover": + return ( + "production-default 8C-to-9C SQLite HNSW route; 15,695-packet " + "Natural replay, 2,016-message Durable replay, 30,380-packet " + "maturity extension, 27 structural F/S/T points, and nine " + "4,000-packet quality points with 512 controls each" + ) + if key == "emotional_cascade_fixed_work_candidate": + return ( + "rejected knob-derived priority-prefix candidate; 27 F/S/T " + "structural points; exact B and logical B+1 shared-member seams; " + "15,695-packet fixed-time Natural midpoint against a same-binary " + "control and identical 118-event consolidation schedule; 512 " + "public top-16 queries over four opaque sources; nine-point " + "production matrix intentionally not run after midpoint fail-fast" + ) + if key == "bounded_route_hybrid_observation": + return ( + "34,456 normalized 256-dimensional embeddings; 512 deterministic " + "top-16 queries; four opaque sources; text, audio, and image " + "post-encoding labels; two graphs; 16,384 construction and 1,280 " + "retrieval comparisons per graph; 64 reciprocal proposals" + ) + if key == "bounded_sparse_routing_observation": + return ( + "35,496 normalized 256-dimensional embeddings; 512 age-stratified " + "top-16 queries; F=S=T=0.5; observation-only private switch" + ) + if key == "packed_route_sqlite_representation_experiment": + return ( + "34,456 normalized 256-dimensional embeddings; four SQLite blobs; " + "1,024 anchors; 512 deterministic top-16 route queries; separate " + "1,024-embedding fresh-prefix restart" + ) + if key == "row_addressed_route_sqlite_experiment": + return ( + "200-event fresh and 34,256-row copied-late SQLite seals; 3,544 " + "reciprocal route-row updates; 1,024 anchors; 512 fixed-route queries" + ) + if key == "integrated_hnsw_sparse_route_experiment": + return ( + "2,500 deterministic Natural packets; four opaque source ids; " + "text, audio, and image post-encoding labels; 128 public top-16 " + "queries; two HNSW graphs; 512-candidate sealed-plus-delta route" + ) + if key == "retrieval_quality_control_correction": + return ( + "correction from 34,456 complete embedding ids to 3,172 current " + "long-term memory identities; 512 top-16 queries; ten 128-memory-node " + "incremental feasibility epochs; 25/50/100-percent restart probes" + ) + if key == "plateau_profiler_smoke_proof" or key == "work_counter_activity_repair": + return "100- and 200-event Natural and Durable instrumentation smoke profiles" + if "shadow" in key: + return "paired fresh and copied-late 200-event Natural and Durable windows" + return ( + "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late " + "windows where recorded; F=0.45, S=0.5, T=0.5" + ) + + +def state_proof_level(key: str) -> tuple[str, str]: + if key == "hnsw_fixed_6c_experiment": + return "benchmark-only", "measured" + if key == "signal_centroid_ring_cutover": + return "source-health", "measured" + if key == "sqlite_hnsw_production_cutover": + return "production-path", "measured" + if key == "emotional_cascade_fixed_work_candidate": + return "benchmark-only", "measured" + if key == "bounded_route_hybrid_observation": + return "benchmark-only", "modeled" + if key == "bounded_sparse_routing_observation": + return "benchmark-only", "observation-only" + if key == "packed_route_sqlite_representation_experiment": + return "benchmark-only", "benchmark-only" + if key == "row_addressed_route_sqlite_experiment": + return "benchmark-only", "benchmark-only" + if key == "retrieval_quality_control_correction": + return "benchmark-only", "measured" + if key == "integrated_hnsw_sparse_route_experiment": + return "source-health", "measured" + return "source-health", "measured" + + +def build(state: dict[str, Any]) -> dict[str, Any]: + records: list[dict[str, Any]] = [] + for inventory_id in sorted(state_inventory(state)): + category, identity = inventory_id.split(":", 1) + if category == "state": + value = state[identity] + proof_level, evidence_kind = state_proof_level(identity) + limits = [] + if identity == "emotional_cascade_fixed_work_candidate": + limits.extend( + [ + "midpoint p99 and public identity-quality gates failed", + "nine-point knob ablation was not run after the fail-fast rejection", + "Durable full-horizon behavior is not proven for this rejected candidate", + "production cutover is not proven", + ] + ) + if identity == "hnsw_fixed_6c_experiment": + limits.extend( + [ + "the additional production-default pre-screen failed the hard gates", + "zero of nine exact corpus-matrix points were run after fail-fast rejection", + "the production fixed-5C default was not changed", + "whole-engine boundedness and production cutover are not proven", + ] + ) + if identity == "rif_epoch_consolidation_reset_candidate": + limits.extend( + [ + "the named RIF publication hotspot is flat but the whole-engine Natural plateau failed", + "mandatory Natural retrieval quality failed", + "Durable verification and bounded restart remain open", + "production cutover is not proven", + ] + ) + if identity == "signal_centroid_ring_cutover": + limits.extend( + [ + "whole-engine Natural and Durable plateaus are not proven", + "emotional traversal and whole-engine restart remain unbounded", + "production cutover is not proven", + ] + ) + if isinstance(value, dict) and value.get("production_cutover") is False: + if "production cutover is not proven" not in limits: + limits.append("production cutover is not proven") + if not limits: + limits.append("the paper claim is limited to the recorded proof scope") + record = { + "inventory_id": inventory_id, + "decision": first_decision(value), + "corpus_parameter_scope": state_scope(identity), + "evidence_fingerprints": [canonical_sha(value)], + "unresolved_limits": limits, + "proof_level": proof_level, + "evidence_kind": evidence_kind, + } + else: + record = { + "inventory_id": inventory_id, + "decision": "rejected", + "corpus_parameter_scope": ( + "focused fresh/copied-late candidate window under the recorded " + "15,695-packet Natural profile contract" + ), + "evidence_fingerprints": [canonical_sha(identity)], + "unresolved_limits": ["candidate was removed after its failed gate"], + "proof_level": "source-health", + "evidence_kind": "measured", + } + records.append(record) + + variant_decisions = { + "reciprocal-route-only": "rejected-recall-at-16-0.979858", + "three-sparse-graphs": "rejected-no-recall-gain-at-equal-per-graph-work", + "construction-budget-4096": "rejected-recall-at-16-0.995972", + "construction-budget-8192-reciprocal-64": ( + "rejected-recall-at-16-0.997803" + ), + "two-graphs-construction-16384-retrieval-1280-reciprocal-64": ( + "selected-benchmark-design-production-proof-pending" + ), + } + feasibility = state.get("bounded_route_hybrid_observation", {}) + for variant in VARIANTS: + records.append( + { + "inventory_id": f"bounded-route-variant:{variant}", + "decision": variant_decisions[variant], + "corpus_parameter_scope": ( + "34,456 normalized 256-dimensional embeddings and 512 " + "deterministic top-16 queries" + ), + "evidence_fingerprints": [canonical_sha(feasibility), canonical_sha(variant)], + "unresolved_limits": [ + "benchmark routing evidence is not production-path latency proof" + ], + "proof_level": "benchmark-only", + "evidence_kind": "modeled", + } + ) + for group in ALGORITHM_GROUPS: + records.append( + { + "inventory_id": f"algorithm:{group['id']}", + "decision": "task-owned-source-change-recorded", + "corpus_parameter_scope": ( + "branch diff from the content-addressed base; experiment scope " + "is recorded by the associated state and candidate entries" + ), + "evidence_fingerprints": [canonical_sha(group)], + "unresolved_limits": [ + "production-wide boundedness is not inferred from source health" + ], + "proof_level": "source-health", + "evidence_kind": "measured", + } + ) + for record in records: + record["source_section"] = SECTION + return { + "schema": "cortext_paper_traceability_v1", + "base_commit": BASE_COMMIT, + "evaluated_bounded_route_variants": VARIANTS, + "algorithm_groups": ALGORITHM_GROUPS, + "record_defaults": { + "source_section": SECTION, + }, + "ownership_model": { + "natural_durable_shared_algorithm": True, + "durable_only_flush_barrier": True, + "source_claim_fingerprints": [ + "Natural and Durable use one ingestion algorithm", + "post-commit flush/checkpoint barrier", + ], + "manuscript_claim_fingerprints": [ + "Natural and Durable use one ingestion algorithm", + "post-commit flush/checkpoint barrier", + ], + }, + "records": records, + } + + +def main() -> int: + parser = argparse.ArgumentParser() + parser.add_argument("--state", required=True, type=Path) + parser.add_argument("--state-overlay", type=Path) + parser.add_argument("--out", required=True, type=Path) + args = parser.parse_args() + state = load_json(args.state) + if args.state_overlay is not None: + state = merge_state(state, load_json(args.state_overlay)) + manifest = build(state) + args.out.parent.mkdir(parents=True, exist_ok=True) + args.out.write_text(json.dumps(manifest, indent=2, sort_keys=True) + "\n") + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/tools/build_recenter_activation_overlap.py b/tools/build_recenter_activation_overlap.py new file mode 100644 index 00000000..a467a058 --- /dev/null +++ b/tools/build_recenter_activation_overlap.py @@ -0,0 +1,300 @@ +#!/usr/bin/env python3 +"""Build a fail-closed consolidation recenter overlap artifact.""" + +from __future__ import annotations + +import argparse +import hashlib +import json +import math +from pathlib import Path +from typing import Any + + +def load_json(path: Path) -> dict[str, Any]: + def reject_duplicates(pairs: list[tuple[str, Any]]) -> dict[str, Any]: + result: dict[str, Any] = {} + for key, value in pairs: + if key in result: + raise ValueError(f"duplicate JSON key {key!r} in {path}") + result[key] = value + return result + + with path.open(encoding="utf-8") as stream: + value = json.load(stream, object_pairs_hook=reject_duplicates) + if not isinstance(value, dict): + raise ValueError(f"{path} is not a JSON object") + return value + + +def file_sha256(path: Path) -> str: + digest = hashlib.sha256() + with path.open("rb") as stream: + for block in iter(lambda: stream.read(1024 * 1024), b""): + digest.update(block) + return digest.hexdigest() + + +def lround_positive(value: float) -> int: + return math.floor(value + 0.5) + + +def derived_parameters(focus: float, sensitivity: float, stability: float) -> dict[str, int]: + for label, value in ( + ("focus", focus), + ("sensitivity", sensitivity), + ("stability", stability), + ): + if not math.isfinite(value) or value < 0.0 or value > 1.0: + raise ValueError(f"{label} must be finite and within [0, 1]") + capacity = lround_positive( + 256 + 256 * focus + 128 * sensitivity + 128 * stability + ) + backfill = lround_positive( + 64 + 64 * focus + 32 * sensitivity + 32 * stability + ) + return { + "C": capacity, + "B": backfill, + "A": 2 * capacity + 2 * backfill, + "public_query_node_budget": 5 * capacity, + "construction_node_budget": capacity + backfill, + "construction_queue_effort": 2 * backfill, + "logical_B_plus_one_only": backfill + 1, + } + + +def exact_nonnegative_integer(value: Any, label: str) -> int: + if isinstance(value, bool) or not isinstance(value, (int, float)): + raise ValueError(f"{label} must be numeric") + number = float(value) + if not math.isfinite(number) or number < 0.0 or number != round(number): + raise ValueError(f"{label} must be a nonnegative integer") + return int(number) + + +def build( + profile: dict[str, Any], + profile_sha256: str, + database_sha256: str, + benchmark_binary_sha256: str, + corpus_sha256: str, +) -> dict[str, Any]: + focus = float(profile["focus"]) + sensitivity = float(profile["sensitivity"]) + stability = float(profile["stability"]) + parameters = derived_parameters(focus, sensitivity, stability) + recorded = profile.get("sparse_route_parameters") + if not isinstance(recorded, dict): + raise ValueError("profile lacks sparse_route_parameters") + expected_recorded = { + "route_capacity": parameters["C"], + "backfill_batch_size": parameters["B"], + "activation_identity_target": parameters["A"], + "search_node_budget": parameters["public_query_node_budget"], + "backfill_search_node_budget": parameters["construction_node_budget"], + "backfill_search_effort": parameters["construction_queue_effort"], + } + for key, expected in expected_recorded.items(): + if exact_nonnegative_integer(recorded.get(key), key) != expected: + raise ValueError(f"{key} does not match F/S/T-derived value") + + events = profile.get("consolidation_events") + if not isinstance(events, list): + raise ValueError("profile lacks consolidation_events") + profiled = [ + event for event in events + if isinstance(event, dict) + and event.get("sqlite_sparse_route_recenter_overlap_profiled") is True + ] + if not profiled: + raise ValueError("profile has no recenter overlap observations") + + observations = [] + for event in profiled: + index = exact_nonnegative_integer(event.get("event_index"), "event_index") + if event.get("sqlite_sparse_route_recenter_overlap_pair_valid") is not True: + raise ValueError(f"event {index} has an invalid recenter overlap pair") + failure = exact_nonnegative_integer( + event.get("sqlite_sparse_route_recenter_overlap_failure_code"), + "overlap_failure_code", + ) + if failure != 0: + raise ValueError(f"event {index} has overlap failure code {failure}") + if event.get("sqlite_sparse_route_recenter_succeeded") is not True: + raise ValueError(f"event {index} did not recenter successfully") + if event.get("sqlite_sparse_route_recenter_derived_centroid") is not True: + raise ValueError( + f"event {index} did not use a consolidation-derived centroid" + ) + centroid_source = exact_nonnegative_integer( + event.get("sqlite_sparse_route_recenter_centroid_source"), + "centroid_source", + ) + if centroid_source not in (1, 2): + raise ValueError(f"event {index} has an invalid centroid source") + cluster_count = exact_nonnegative_integer( + event.get("sqlite_sparse_route_recenter_centroid_cluster_count"), + "centroid_cluster_count", + ) + member_count = exact_nonnegative_integer( + event.get("sqlite_sparse_route_recenter_centroid_member_count"), + "centroid_member_count", + ) + if member_count == 0 or (centroid_source == 1 and cluster_count == 0): + raise ValueError( + f"event {index} has an empty consolidation-derived centroid" + ) + if centroid_source == 2 and cluster_count != 0: + raise ValueError( + f"event {index} mixes cluster and active-ring centroid sources" + ) + pre = exact_nonnegative_integer( + event.get("sqlite_sparse_route_recenter_pre_activated_count"), + "pre_activated_count", + ) + post = exact_nonnegative_integer( + event.get("sqlite_sparse_route_recenter_post_activated_count"), + "post_activated_count", + ) + overlap = exact_nonnegative_integer( + event.get("sqlite_sparse_route_recenter_overlap_count"), + "overlap_count", + ) + pre_nodes = exact_nonnegative_integer( + event.get("sqlite_sparse_route_recenter_pre_node_count"), + "pre_node_count", + ) + post_nodes = exact_nonnegative_integer( + event.get("sqlite_sparse_route_recenter_post_node_count"), + "post_node_count", + ) + if pre == 0 or post == 0: + raise ValueError(f"event {index} has an empty valid pair") + if pre > parameters["A"] or post > parameters["A"]: + raise ValueError(f"event {index} exceeds F/S/T-derived A") + if pre_nodes > parameters["public_query_node_budget"] or post_nodes > parameters["public_query_node_budget"]: + raise ValueError(f"event {index} exceeds F/S/T-derived 5C") + if overlap > min(pre, post): + raise ValueError(f"event {index} overlap exceeds pair cardinality") + unchanged = pre == post == overlap + observations.append({ + "event_index": index, + "pre": pre, + "post": post, + "overlap": overlap, + "pre_nodes": pre_nodes, + "post_nodes": post_nodes, + "centroid_clusters": cluster_count, + "centroid_members": member_count, + "centroid_source": centroid_source, + "unchanged": unchanged, + "overlap_fraction": overlap / max(pre, post), + }) + + neutral = derived_parameters(0.5, 0.5, 0.5) + unchanged_count = sum(int(row["unchanged"]) for row in observations) + full_target_count = sum( + int(row["pre"] == parameters["A"] and row["post"] == parameters["A"]) + for row in observations + ) + return { + "schema": "cortext_recenter_activation_overlap_v3", + "status": "measured-recenter-does-not-change-activated-identity-set" + if unchanged_count == len(observations) + else "measured-recenter-changes-activated-identity-set", + "decision": "reject-current-recenter-as-retrieval-centroid-reset" + if unchanged_count == len(observations) + else "recenter-materiality-requires-quality-and-cycle-evaluation", + "processed_events": exact_nonnegative_integer( + profile.get("processed_events"), "processed_events" + ), + "consolidation_runs": exact_nonnegative_integer( + profile.get("consolidation_runs"), "consolidation_runs" + ), + "profiled_successful_recenters": len(observations), + "invalid_profiled_pairs": 0, + "first_profiled_recenter_event_index": observations[0]["event_index"], + "last_profiled_recenter_event_index": observations[-1]["event_index"], + "full_activation_target_recenters": full_target_count, + "changed_activated_set_count": len(observations) - unchanged_count, + "unchanged_activated_set_count": unchanged_count, + "minimum_pre_post_overlap_fraction": min( + row["overlap_fraction"] for row in observations + ), + "maximum_pre_activated_identities": max(row["pre"] for row in observations), + "maximum_post_activated_identities": max(row["post"] for row in observations), + "maximum_pre_node_rows": max(row["pre_nodes"] for row in observations), + "maximum_post_node_rows": max(row["post_nodes"] for row in observations), + "minimum_centroid_cluster_count": min( + row["centroid_clusters"] for row in observations + ), + "minimum_centroid_member_count": min( + row["centroid_members"] for row in observations + ), + "cluster_centroid_recenter_count": sum( + row["centroid_source"] == 1 for row in observations + ), + "active_signal_ring_centroid_recenter_count": sum( + row["centroid_source"] == 2 for row in observations + ), + "focus": focus, + "sensitivity": sensitivity, + "stability": stability, + "derived_parameters": { + **parameters, + "neutral_C": neutral["C"], + "neutral_B": neutral["B"], + "neutral_A": neutral["A"], + "neutral_logical_B_plus_one_only": neutral["logical_B_plus_one_only"], + }, + "corpus_sha256": corpus_sha256, + "raw_profile_sha256": profile_sha256, + "database_sha256": database_sha256, + "benchmark_binary_sha256": benchmark_binary_sha256, + "required_follow_on": { + "algorithm_target": "consolidation-driven-sparse-activation-centroid-reset", + "fixed_activation_target": "A=2C+2B", + "fixed_query_work": "5C", + "structural_knob_points": 27, + "production_shaped_knob_points": 9, + "modality_and_source_id_agnostic": True, + "raw_process_reset_gate_remains_independent": True, + }, + "nonclaims": [ + "accepted retrieval cycle", + "raw consolidation reset pass or waiver", + "bounded restart", + "Natural or Durable plateau", + "whole-goal completion", + "PR readiness", + "merge", + "release", + "deployment", + "publication", + ], + } + + +def main() -> int: + parser = argparse.ArgumentParser() + parser.add_argument("--profile", type=Path, required=True) + parser.add_argument("--database", type=Path, required=True) + parser.add_argument("--benchmark-binary", type=Path, required=True) + parser.add_argument("--corpus", type=Path, required=True) + parser.add_argument("--out", type=Path, required=True) + args = parser.parse_args() + result = build( + load_json(args.profile), + file_sha256(args.profile), + file_sha256(args.database), + file_sha256(args.benchmark_binary), + file_sha256(args.corpus), + ) + args.out.parent.mkdir(parents=True, exist_ok=True) + args.out.write_text(json.dumps(result, indent=2) + "\n", encoding="utf-8") + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/tools/build_recenter_activation_overlap_test.py b/tools/build_recenter_activation_overlap_test.py new file mode 100644 index 00000000..475c643b --- /dev/null +++ b/tools/build_recenter_activation_overlap_test.py @@ -0,0 +1,113 @@ +#!/usr/bin/env python3 + +from __future__ import annotations + +import importlib.util +import unittest +from pathlib import Path + + +PATH = Path(__file__).with_name("build_recenter_activation_overlap.py") +SPEC = importlib.util.spec_from_file_location("recenter_overlap_builder", PATH) +assert SPEC is not None and SPEC.loader is not None +MODULE = importlib.util.module_from_spec(SPEC) +SPEC.loader.exec_module(MODULE) + + +class RecenterActivationOverlapBuilderTest(unittest.TestCase): + @staticmethod + def profile() -> dict: + parameters = MODULE.derived_parameters(0.5, 0.5, 0.5) + return { + "processed_events": 1000, + "consolidation_runs": 2, + "focus": 0.5, + "sensitivity": 0.5, + "stability": 0.5, + "sparse_route_parameters": { + "route_capacity": parameters["C"], + "backfill_batch_size": parameters["B"], + "activation_identity_target": parameters["A"], + "search_node_budget": parameters["public_query_node_budget"], + "backfill_search_node_budget": parameters["construction_node_budget"], + "backfill_search_effort": parameters["construction_queue_effort"], + }, + "consolidation_events": [{ + "event_index": 999, + "sqlite_sparse_route_recenter_succeeded": True, + "sqlite_sparse_route_recenter_derived_centroid": True, + "sqlite_sparse_route_recenter_centroid_source": 1.0, + "sqlite_sparse_route_recenter_centroid_cluster_count": 2.0, + "sqlite_sparse_route_recenter_centroid_member_count": 12.0, + "sqlite_sparse_route_recenter_overlap_profiled": True, + "sqlite_sparse_route_recenter_overlap_pair_valid": True, + "sqlite_sparse_route_recenter_overlap_failure_code": 0.0, + "sqlite_sparse_route_recenter_pre_activated_count": 1280.0, + "sqlite_sparse_route_recenter_post_activated_count": 1280.0, + "sqlite_sparse_route_recenter_overlap_count": 1280.0, + "sqlite_sparse_route_recenter_pre_node_count": 2560.0, + "sqlite_sparse_route_recenter_post_node_count": 2560.0, + }], + } + + def test_build_binds_knob_derived_cardinalities(self) -> None: + result = MODULE.build( + self.profile(), "1" * 64, "2" * 64, "3" * 64, "4" * 64 + ) + self.assertEqual(result["derived_parameters"]["neutral_B"], 128) + self.assertEqual( + result["derived_parameters"]["neutral_logical_B_plus_one_only"], + 129, + ) + self.assertEqual(result["invalid_profiled_pairs"], 0) + self.assertEqual(result["unchanged_activated_set_count"], 1) + self.assertEqual(result["minimum_centroid_cluster_count"], 2) + self.assertEqual(result["minimum_centroid_member_count"], 12) + self.assertEqual(result["cluster_centroid_recenter_count"], 1) + self.assertEqual(result["active_signal_ring_centroid_recenter_count"], 0) + self.assertEqual(result["required_follow_on"]["structural_knob_points"], 27) + self.assertEqual( + result["required_follow_on"]["production_shaped_knob_points"], 9 + ) + + def test_build_rejects_invalid_profiled_pair(self) -> None: + profile = self.profile() + profile["consolidation_events"][0][ + "sqlite_sparse_route_recenter_overlap_pair_valid" + ] = False + profile["consolidation_events"][0][ + "sqlite_sparse_route_recenter_overlap_failure_code" + ] = 2.0 + with self.assertRaisesRegex(ValueError, "invalid recenter overlap pair"): + MODULE.build(profile, "1" * 64, "2" * 64, "3" * 64, "4" * 64) + + def test_build_rejects_hidden_midpoint_constant(self) -> None: + profile = self.profile() + profile["focus"] = 0.0 + with self.assertRaisesRegex(ValueError, "route_capacity does not match"): + MODULE.build(profile, "1" * 64, "2" * 64, "3" * 64, "4" * 64) + + def test_build_rejects_signal_embedding_recenter(self) -> None: + profile = self.profile() + profile["consolidation_events"][0][ + "sqlite_sparse_route_recenter_derived_centroid" + ] = False + with self.assertRaisesRegex( + ValueError, "did not use a consolidation-derived centroid" + ): + MODULE.build(profile, "1" * 64, "2" * 64, "3" * 64, "4" * 64) + + def test_build_accepts_bounded_active_signal_ring_centroid(self) -> None: + profile = self.profile() + event = profile["consolidation_events"][0] + event["sqlite_sparse_route_recenter_centroid_source"] = 2.0 + event["sqlite_sparse_route_recenter_centroid_cluster_count"] = 0.0 + result = MODULE.build( + profile, "1" * 64, "2" * 64, "3" * 64, "4" * 64 + ) + self.assertEqual(result["cluster_centroid_recenter_count"], 0) + self.assertEqual(result["active_signal_ring_centroid_recenter_count"], 1) + + +if __name__ == "__main__": + unittest.main() diff --git a/tools/build_signal_centroid_ring_ablation.py b/tools/build_signal_centroid_ring_ablation.py new file mode 100644 index 00000000..f4341e7e --- /dev/null +++ b/tools/build_signal_centroid_ring_ablation.py @@ -0,0 +1,248 @@ +#!/usr/bin/env python3 +"""Build the sanitized nine-point active-signal-ring ablation manifest.""" + +from __future__ import annotations + +import argparse +import hashlib +import json +import math +import subprocess +from pathlib import Path +from typing import Any + + +POINTS = { + "midpoint": (0.5, 0.5, 0.5), + "all-low": (0.0, 0.0, 0.0), + "all-high": (1.0, 1.0, 1.0), + "focus-low": (0.0, 0.5, 0.5), + "focus-high": (1.0, 0.5, 0.5), + "sensitivity-low": (0.5, 0.0, 0.5), + "sensitivity-high": (0.5, 1.0, 0.5), + "stability-low": (0.5, 0.5, 0.0), + "stability-high": (0.5, 0.5, 1.0), +} +RING_MUTATION_COUNTER = ( + "SignalProcessor.commit_table_row_count.cortext_active_signal_embeddings" +) +SOURCE_MANIFEST_PATHS = ( + "CMakeLists.txt", + "examples/benchmark/chat_replay_live_run.cpp", + "src/operations/active_signal_embedding_ring_internal.hpp", + "src/operations/bounded_activation_shadow_internal.hpp", + "src/operations/emotion_cascade.cpp", + "src/operations/graph_retrieval.cpp", + "src/operations/memory_storage.cpp", + "src/operations/sparse_retrieval_knobs_internal.hpp", + "src/operations/sparse_retrieval_route_internal.cpp", + "src/operations/sparse_retrieval_route_internal.hpp", + "src/operations/sparse_retrieval_route_sqlite_internal.cpp", + "src/operations/sparse_retrieval_route_sqlite_internal.hpp", + "src/signal_processor.cpp", + "src/store.cpp", + "src/store/commit_profile_internal.hpp", + "src/store/schema.cpp", + "tests/CMakeLists.txt", + "tests/core_knobs.test.cpp", + "tests/migration_core.test.cpp", + "tests/operations_emotion_cascade.test.cpp", + "tests/operations_memory_storage.test.cpp", + "tests/operations_graph_retrieval.test.cpp", + "tests/signal_processor.test.cpp", + "tools/audit_public_retrieval_control.py", + "tools/audit_public_retrieval_control_test.py", + "tools/audit_storage_cost_profile.py", + "tools/audit_storage_cost_profile_test.py", + "tools/build_signal_centroid_ring_ablation.py", + "tools/build_signal_centroid_ring_ablation_test.py", +) + + +def file_sha256(path: Path) -> str: + digest = hashlib.sha256() + with path.open("rb") as stream: + for chunk in iter(lambda: stream.read(1024 * 1024), b""): + digest.update(chunk) + return digest.hexdigest() + + +def load_json(path: Path) -> dict[str, Any]: + value = json.loads(path.read_text(encoding="utf-8")) + if not isinstance(value, dict): + raise ValueError(f"{path} is not a JSON object") + return value + + +def expected_capacity(focus: float, sensitivity: float, stability: float) -> int: + value = 64 + 64 * focus + 32 * sensitivity + 32 * stability + # Match C++ std::lround exactly. The clamped production expression is + # nonnegative, so half-away-from-zero is floor(value + 0.5). + return math.floor(value + 0.5) + + +def source_code_manifest(repo: Path) -> tuple[str, list[dict[str, str]]]: + """Fingerprint the exact implementation/evidence files owned by this claim.""" + entries = [] + digest = hashlib.sha256() + for relative in SOURCE_MANIFEST_PATHS: + path = repo / relative + if not path.is_file(): + raise ValueError(f"source manifest path does not exist: {relative}") + file_digest = file_sha256(path) + entries.append({"path": relative, "sha256": file_digest}) + digest.update(relative.encode("utf-8")) + digest.update(b"\0") + digest.update(bytes.fromhex(file_digest)) + return digest.hexdigest(), entries + + +def build( + raw_dir: Path, + audit_dir: Path, + binary: Path, + repo: Path, +) -> dict[str, Any]: + runs = [] + for name, knobs in POINTS.items(): + profile_path = raw_dir / f"{name}.json" + audit_path = audit_dir / f"{name}-audit.json" + profile = load_json(profile_path) + audit = load_json(audit_path) + actual_knobs = tuple(float(profile[key]) for key in ( + "focus", "sensitivity", "stability" + )) + if actual_knobs != knobs: + raise ValueError(f"{name} knob tuple differs from the contract") + ring = profile.get("active_signal_embedding_ring") + if not isinstance(ring, dict): + raise ValueError(f"{name} lacks active signal ring parameters") + capacity = expected_capacity(*knobs) + if ring.get("capacity") != capacity: + raise ValueError(f"{name} ring capacity is not knob-derived") + if ring.get("modality_branching") is not False: + raise ValueError(f"{name} introduces modality branching") + if ring.get("source_id_branching") is not False: + raise ValueError(f"{name} introduces source-id branching") + rows = profile.get("working_set_curve") + if not isinstance(rows, list) or len(rows) != 2000: + raise ValueError(f"{name} lacks complete 2000-event profile rows") + event_indices = set() + for row in rows: + if not isinstance(row, dict): + raise ValueError(f"{name} has an invalid profile row") + event_index = row.get("event_index") + if (not isinstance(event_index, int) or isinstance(event_index, bool) + or event_index < 0 or event_index >= 2000 + or event_index in event_indices): + raise ValueError(f"{name} has invalid or duplicate event coverage") + event_indices.add(event_index) + if event_indices != set(range(2000)): + raise ValueError(f"{name} has incomplete event coverage") + mutation_values = [] + for row in rows: + operations = row.get("operation_ms") + if not isinstance(operations, dict): + raise ValueError(f"{name} has an invalid operation map") + if RING_MUTATION_COUNTER not in operations: + continue + value = operations[RING_MUTATION_COUNTER] + if (not isinstance(value, (int, float)) or isinstance(value, bool) + or not math.isfinite(float(value)) or float(value) < 0.0): + raise ValueError(f"{name} has an invalid ring mutation counter") + mutation_values.append(float(value)) + if not mutation_values: + raise ValueError(f"{name} lacks the ring mutation counter") + maximum_mutations = max(mutation_values) + if profile.get("processed_events") != 2000: + raise ValueError(f"{name} did not process exactly 2000 events") + if audit.get("passed") is not True: + raise ValueError(f"{name} public retrieval audit failed") + if audit.get("private_profile_sha256") != file_sha256(profile_path): + raise ValueError(f"{name} retrieval audit is not bound to its profile") + if audit.get("query_count") != 512: + raise ValueError(f"{name} did not execute exactly 512 queries") + source_digest_count = audit.get("source_digest_count") + if not isinstance(source_digest_count, int) or source_digest_count < 4: + raise ValueError(f"{name} lacks four opaque source identifiers") + for field in ( + "exact_top1", "exact_identity_recall_at_k", "semantic_coverage" + ): + if audit.get(field) != 1.0: + raise ValueError(f"{name} {field} is not exactly 1.0") + if audit.get("deterministic_tie_order") is not True: + raise ValueError(f"{name} deterministic ties did not pass") + runs.append({ + "name": name, + "focus": knobs[0], + "sensitivity": knobs[1], + "stability": knobs[2], + "capacity": capacity, + "processed_events": profile.get("processed_events"), + "wall_ms": profile.get("wall_ms"), + "maximum_ring_row_mutations_per_event": maximum_mutations, + "query_count": audit.get("query_count"), + "opaque_source_digest_count": source_digest_count, + "exact_top1": audit.get("exact_top1"), + "exact_identity_recall_at_16": audit.get("exact_identity_recall_at_k"), + "semantic_coverage": audit.get("semantic_coverage"), + "deterministic_tie_order": audit.get("deterministic_tie_order"), + "passed": True, + "profile_sha256": file_sha256(profile_path), + "audit_sha256": file_sha256(audit_path), + }) + source_head = subprocess.run( + ["git", "rev-parse", "HEAD"], cwd=repo, check=True, + stdout=subprocess.PIPE, text=True, + ).stdout.strip() + source_manifest_sha256, source_manifest = source_code_manifest(repo) + return { + "schema": "cortext_signal_centroid_ring_knob_ablation_v4", + "capacity_formula": ( + "std::lround(64 + 64F + 32S + 32T) after independent [0,1] " + "clamping; half-integer ties round away from zero" + ), + "all_low_capacity": 64, + "default_capacity": 128, + "all_high_capacity": 192, + "structural_grid": ( + "27 F/S/T points are covered by the core formula regression; " + "these nine production-shaped runs isolate the midpoint, endpoints, " + "and each knob axis" + ), + "production_shaped_query_count_per_run": 512, + "modality_branching": False, + "source_id_branching": False, + "source_head": source_head, + "source_code_manifest_sha256": source_manifest_sha256, + "source_code_manifest": source_manifest, + "benchmark_binary_sha256": file_sha256(binary), + "all_passed": all(run["passed"] for run in runs), + "runs": runs, + "nonclaims": [ + "whole-engine plateau", + "emotional-cascade traversal boundedness", + "merge", + "release", + "deployment", + ], + } + + +def main() -> int: + parser = argparse.ArgumentParser() + parser.add_argument("--raw-dir", type=Path, required=True) + parser.add_argument("--audit-dir", type=Path, required=True) + parser.add_argument("--binary", type=Path, required=True) + parser.add_argument("--repo", type=Path, required=True) + parser.add_argument("--out", type=Path, required=True) + args = parser.parse_args() + result = build(args.raw_dir, args.audit_dir, args.binary, args.repo) + args.out.write_text( + json.dumps(result, indent=2, sort_keys=True) + "\n", encoding="utf-8" + ) + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/tools/build_signal_centroid_ring_ablation_test.py b/tools/build_signal_centroid_ring_ablation_test.py new file mode 100644 index 00000000..5e785035 --- /dev/null +++ b/tools/build_signal_centroid_ring_ablation_test.py @@ -0,0 +1,150 @@ +import importlib.util +import hashlib +import json +import tempfile +import unittest +from pathlib import Path + + +MODULE_PATH = Path(__file__).with_name("build_signal_centroid_ring_ablation.py") +SPEC = importlib.util.spec_from_file_location("ring_ablation", MODULE_PATH) +MODULE = importlib.util.module_from_spec(SPEC) +assert SPEC.loader is not None +SPEC.loader.exec_module(MODULE) + + +class SignalCentroidRingAblationTest(unittest.TestCase): + def valid_black_box_fixture(self, root: Path): + raw = root / "raw" + audits = root / "audits" + raw.mkdir() + audits.mkdir() + counter = MODULE.RING_MUTATION_COUNTER + for name, knobs in MODULE.POINTS.items(): + profile = { + "focus": knobs[0], + "sensitivity": knobs[1], + "stability": knobs[2], + "processed_events": 2000, + "wall_ms": 1, + "active_signal_embedding_ring": { + "capacity": MODULE.expected_capacity(*knobs), + "modality_branching": False, + "source_id_branching": False, + }, + "working_set_curve": [ + { + "event_index": event_index, + "operation_ms": {counter: 1.0} if event_index == 0 else {}, + } + for event_index in range(2000) + ], + } + audit = { + "passed": True, + "query_count": 512, + "source_digest_count": 4, + "exact_top1": 1.0, + "exact_identity_recall_at_k": 1.0, + "semantic_coverage": 1.0, + "deterministic_tie_order": True, + } + profile_path = raw / f"{name}.json" + profile_path.write_text(json.dumps(profile)) + audit["private_profile_sha256"] = MODULE.file_sha256(profile_path) + (audits / f"{name}-audit.json").write_text(json.dumps(audit)) + binary = root / "benchmark" + binary.write_bytes(b"benchmark") + return raw, audits, binary + + def test_capacity_is_knob_derived_at_structural_grid_points(self): + capacities = { + (focus, sensitivity, stability): MODULE.expected_capacity( + focus, sensitivity, stability + ) + for focus in (0.0, 0.5, 1.0) + for sensitivity in (0.0, 0.5, 1.0) + for stability in (0.0, 0.5, 1.0) + } + self.assertEqual(len(capacities), 27) + self.assertEqual(capacities[(0.0, 0.0, 0.0)], 64) + self.assertEqual(capacities[(0.5, 0.5, 0.5)], 128) + self.assertEqual(capacities[(1.0, 1.0, 1.0)], 192) + + def test_named_execution_points_cover_each_axis(self): + self.assertEqual(len(MODULE.POINTS), 9) + self.assertEqual(MODULE.POINTS["focus-low"], (0.0, 0.5, 0.5)) + self.assertEqual(MODULE.POINTS["sensitivity-high"], (0.5, 1.0, 0.5)) + self.assertEqual(MODULE.POINTS["stability-low"], (0.5, 0.5, 0.0)) + + def test_capacity_matches_std_lround_at_half_integer_tie(self): + self.assertEqual(MODULE.expected_capacity(1.0 / 128.0, 0.0, 0.0), 65) + + def test_source_manifest_is_exact_and_content_addressed(self): + with tempfile.TemporaryDirectory() as directory: + repo = Path(directory) + paths = ("src/one.cpp", "tools/two.py") + for relative, contents in zip(paths, (b"one", b"two")): + path = repo / relative + path.parent.mkdir(parents=True, exist_ok=True) + path.write_bytes(contents) + previous = MODULE.SOURCE_MANIFEST_PATHS + MODULE.SOURCE_MANIFEST_PATHS = paths + try: + digest, entries = MODULE.source_code_manifest(repo) + finally: + MODULE.SOURCE_MANIFEST_PATHS = previous + expected = hashlib.sha256() + for relative, contents in zip(paths, (b"one", b"two")): + expected.update(relative.encode("utf-8")) + expected.update(b"\0") + expected.update(hashlib.sha256(contents).digest()) + self.assertEqual(digest, expected.hexdigest()) + self.assertEqual([entry["path"] for entry in entries], list(paths)) + self.assertEqual(entries[0]["sha256"], hashlib.sha256(b"one").hexdigest()) + + def test_build_rejects_missing_or_false_claim_fields(self): + repo = MODULE_PATH.parents[1] + cases = ( + ("missing counter", lambda profile, audit: profile[ + "working_set_curve"][0]["operation_ms"].clear()), + ("wrong event count", lambda profile, audit: profile.update( + processed_events=1999)), + ("wrong query count", lambda profile, audit: audit.update( + query_count=511)), + ("quality below exact", lambda profile, audit: audit.update( + exact_top1=0.999)), + ("nondeterministic ties", lambda profile, audit: audit.update( + deterministic_tie_order=False)), + ("truncated rows", lambda profile, audit: profile[ + "working_set_curve"].pop()), + ("duplicate row", lambda profile, audit: profile[ + "working_set_curve"][-1].update(event_index=1998)), + ("missing profile digest", lambda profile, audit: audit.pop( + "private_profile_sha256")), + ("mismatched profile digest", lambda profile, audit: audit.update( + private_profile_sha256="0" * 64)), + ) + for label, corrupt in cases: + with self.subTest(label=label), tempfile.TemporaryDirectory() as directory: + root = Path(directory) + raw, audits, binary = self.valid_black_box_fixture(root) + profile_path = raw / "midpoint.json" + audit_path = audits / "midpoint-audit.json" + profile = json.loads(profile_path.read_text()) + audit = json.loads(audit_path.read_text()) + corrupt(profile, audit) + profile_path.write_text(json.dumps(profile)) + if label not in { + "missing profile digest", "mismatched profile digest" + }: + audit["private_profile_sha256"] = MODULE.file_sha256( + profile_path + ) + audit_path.write_text(json.dumps(audit)) + with self.assertRaises(ValueError): + MODULE.build(raw, audits, binary, repo) + + +if __name__ == "__main__": + unittest.main() diff --git a/tools/build_sqlite_hnsw_knob_ablation.py b/tools/build_sqlite_hnsw_knob_ablation.py new file mode 100644 index 00000000..85886872 --- /dev/null +++ b/tools/build_sqlite_hnsw_knob_ablation.py @@ -0,0 +1,845 @@ +#!/usr/bin/env python3 +"""Build the content-addressed SQLite HNSW knob-ablation aggregate.""" + +from __future__ import annotations + +import argparse +import hashlib +import json +import math +import sqlite3 +import struct +import subprocess +import xml.etree.ElementTree as ET +from pathlib import Path + + +ROOT = Path(__file__).resolve().parents[1] + +REQUIRED_CORPUS_KNOB_POINTS = { + (0.0, 0.0, 0.0), + (1.0, 1.0, 1.0), + (0.5, 0.5, 0.5), + (0.0, 0.5, 0.5), + (1.0, 0.5, 0.5), + (0.5, 0.0, 0.5), + (0.5, 1.0, 0.5), + (0.5, 0.5, 0.0), + (0.5, 0.5, 1.0), +} +REQUIRED_PROCESSED_EVENTS_PER_RUN = 4000 + + +def sha256(path: Path) -> str: + digest = hashlib.sha256() + with path.open("rb") as stream: + for block in iter(lambda: stream.read(1024 * 1024), b""): + digest.update(block) + return digest.hexdigest() + + +def executable_identity(path: Path, target: str) -> dict: + if not path.is_file(): + raise ValueError(f"missing executable for {target}: {path}") + return { + "target": target, + "filename": path.name, + "sha256": sha256(path), + "size_bytes": path.stat().st_size, + } + + +def load_json(path: Path) -> dict: + def reject_duplicates(pairs: list[tuple[str, object]]) -> dict: + result: dict = {} + for key, value in pairs: + if key in result: + raise ValueError(f"duplicate JSON key {key!r} in {path}") + result[key] = value + return result + + with path.open(encoding="utf-8") as stream: + return json.load(stream, object_pairs_hook=reject_duplicates) + + +def clamped_knob(value: float, label: str) -> float: + if isinstance(value, bool) or not isinstance(value, (int, float)): + raise ValueError(f"{label} must be numeric") + result = float(value) + if not math.isfinite(result): + raise ValueError(f"{label} must be finite") + return min(1.0, max(0.0, result)) + + +def expected_parameters(focus: float, sensitivity: float, stability: float) -> dict: + f = clamped_knob(focus, "focus") + s = clamped_knob(sensitivity, "sensitivity") + t = clamped_knob(stability, "stability") + # C++ std::lround rounds halfway cases away from zero. These expressions + # are positive, so floor(x + 0.5) is the exact evaluator-side equivalent. + capacity = math.floor(256 + 256 * f + 128 * s + 128 * t + 0.5) + backfill = math.floor(64 + 64 * f + 32 * s + 32 * t + 0.5) + activation_node_min = 8 * capacity + activation_step = max(2, backfill // 16) + activation_target = 2 * capacity + 2 * backfill + return { + "backfill_batch_size": backfill, + "fallback_hydration_signal_limit": backfill, + "backfill_search_effort": 2 * backfill, + "backfill_search_node_budget": capacity + backfill, + "bootstrap_limit": 2 * capacity, + "graph_level_zero_links": max(16, capacity // 4), + "graph_neighbor_count": max(8, backfill // 2), + "family_exact_comparison_limit": 2 * capacity, + "hnsw_construction_effort": max( + 32, math.floor(capacity * 25 / 64 + 0.5) + ), + "hnsw_query_effort": max( + capacity, math.floor(capacity * 5 / 2 + 0.5) + ), + "maximum_level": math.ceil(math.log2(capacity)), + "reciprocal_update_count": max(2, backfill // 16), + "route_capacity": capacity, + "activation_identity_target": activation_target, + "activation_snapshot_capacity": activation_target, + "total_query_row_budget": 9 * capacity + activation_target, + "activation_search_effort_min": 8 * capacity, + "activation_search_effort_step": activation_step, + "activation_search_node_budget_min": activation_node_min, + "activation_search_node_budget_step": activation_step, + "search_effort": 9 * capacity, + "search_expansion_batch": max(8, backfill // 4), + "search_node_budget": 9 * capacity, + "shadow_cache_capacity": 24 * capacity, + } + + +def expected_operational_limits(parameters: dict) -> dict: + """Name the independently bounded live-dirty and historical surfaces.""" + capacity = parameters["route_capacity"] + backfill = parameters["backfill_batch_size"] + return { + **parameters, + "historical_backfill_drain_limit": backfill, + "historical_backfill_overflow_probe_limit": backfill + 1, + "dirty_identity_drain_limit": capacity, + "dirty_identity_overflow_probe_limit": capacity + 1, + } + + +def expected_active_epoch_limits( + focus: float, sensitivity: float, stability: float +) -> dict: + f = clamped_knob(focus, "focus") + s = clamped_knob(sensitivity, "sensitivity") + t = clamped_knob(stability, "stability") + capacity = math.floor(256 + 256 * f + 128 * s + 128 * t + 0.5) + return { + "event_count": capacity, + "mutation_count": 64 * capacity, + "allocated_bytes": 128 * 1024 * capacity, + "row_batch_size": math.floor( + 64 + 64 * f + 32 * s + 32 * t + 0.5 + ), + } + + +def metric_values(profile: dict, name: str) -> list[float]: + return [ + float(row.get("operation_ms", {}).get(name, 0.0)) + for row in profile["working_set_curve"] + ] + + +def candidate_quality_passed(audit: dict) -> bool: + return ( + audit.get("passed") is True + and audit.get("candidate_complete") is True + and audit.get("candidate_quality_passed") is True + and audit.get("deterministic_tie_order") is True + and float(audit.get("exact_identity_recall_at_k", 0.0)) >= 0.998 + and int(audit.get("exact_top1_miss_count", 2)) <= 1 + and float(audit.get("semantic_coverage", 0.0)) >= 0.95 + ) + + +def quality_classification( + *, + sparse_traversed: bool, + evaluated_recenter_count: int, + node_rows: int, + published_active_count: int | None, + route_capacity: int, +) -> str: + if sparse_traversed: + return ( + "route-lifecycle-evaluated-system-quality-passed" + if evaluated_recenter_count > 0 + else "system-quality-passed-sparse-route-traversed-recenter-unproven" + ) + if ( + published_active_count is not None + and published_active_count <= route_capacity + ): + return "system-quality-passed-published-below-threshold-sparse-route-unevaluated" + if node_rows == 0: + return "system-quality-passed-below-threshold-sparse-route-unevaluated" + return "system-quality-passed-dirty-or-unpublished-sparse-route-unevaluated" + + +def top1_miss_cluster_audit(experiments: list[dict]) -> dict: + misses = [] + for experiment in experiments: + fingerprints = experiment["observed"].get("top1_miss_fingerprints") + if not isinstance(fingerprints, list): + raise ValueError( + f"top-1 miss fingerprints are missing for {experiment['id']}" + ) + if len(fingerprints) != experiment["observed"]["exact_top1_miss_count"]: + raise ValueError( + f"top-1 miss fingerprint count differs for {experiment['id']}" + ) + for fingerprint in fingerprints: + if not isinstance(fingerprint, dict): + raise ValueError("top-1 miss fingerprint is not an object") + age_events = fingerprint.get("control_top1_age_events") + if not isinstance(age_events, int) or age_events < 0: + raise ValueError("top-1 miss lacks a nonnegative memory age") + misses.append( + { + **fingerprint, + "run_id": experiment["id"], + "knobs": experiment["knobs"], + "memory_age_quartile": min( + 3, + age_events * 4 + // max(1, experiment["observed"]["processed_events"]), + ), + } + ) + + dimensions = { + "modality": lambda miss: miss["modality"], + "source_id": lambda miss: miss["source_id_blake3"], + "memory_age_quartile": lambda miss: miss["memory_age_quartile"], + "knob_point": lambda miss: tuple(miss["knobs"]), + } + maximum_bucket_counts = {} + clustered_dimensions = [] + for name, key in dimensions.items(): + counts: dict[object, int] = {} + for miss in misses: + bucket = key(miss) + counts[bucket] = counts.get(bucket, 0) + 1 + maximum_bucket_counts[name] = max(counts.values(), default=0) + if maximum_bucket_counts[name] > 1: + clustered_dimensions.append(name) + return { + "passed": not clustered_dimensions, + "status": "no-misses" if not misses else "misses-unclustered", + "miss_count": len(misses), + "cluster_definition": ( + "two or more exact top-1 misses sharing a modality, opaque source, " + "memory-age quartile, or exact F/S/T point" + ), + "maximum_bucket_counts": maximum_bucket_counts, + "clustered_dimensions": clustered_dimensions, + "misses": misses, + } + + +def decode_link_levels(blob: bytes, expected_level: int) -> list[list[int]]: + offset = 0 + + def read(fmt: str) -> int: + nonlocal offset + size = struct.calcsize(fmt) + if offset + size > len(blob): + raise ValueError("truncated sparse-route link blob") + value = struct.unpack_from(fmt, blob, offset)[0] + offset += size + return int(value) + + level_count = read(" dict: + with sqlite3.connect(db_path) as connection: + max_level, node_rows, upper_rows = connection.execute( + "SELECT MAX(level), COUNT(*), " + "SUM(CASE WHEN level > 0 THEN 1 ELSE 0 END) " + "FROM cortext_sparse_route_nodes" + ).fetchone() + dirty_rows = connection.execute( + "SELECT COUNT(*) FROM cortext_sparse_route_dirty" + ).fetchone()[0] + meta = connection.execute( + "SELECT max_level, active_count, generation " + "FROM cortext_sparse_route_meta WHERE singleton = 1" + ).fetchone() + encoded_links = connection.execute( + "SELECT level, links FROM cortext_sparse_route_nodes " + "WHERE active = 1 AND level > 0 ORDER BY memory_id" + ).fetchall() + decoded_links = [decode_link_levels(blob, level) for level, blob in encoded_links] + upper_degrees = [ + sum(len(level_links) for level_links in levels[1:]) + for levels in decoded_links + ] + return { + "observed_max_level": max_level, + "node_rows": node_rows, + "upper_level_node_rows": upper_rows or 0, + "remaining_dirty_rows": dirty_rows, + "published_max_level": meta[0] if meta else None, + "published_active_count": meta[1] if meta else None, + "published_generation": meta[2] if meta else None, + "upper_level_nonempty_adjacency_rows": sum( + degree > 0 for degree in upper_degrees + ), + "maximum_upper_level_adjacency_degree": max(upper_degrees, default=0), + } + + +def junit(path: Path, test_binary: dict) -> dict: + suite = ET.parse(path).getroot().find("testsuite") + if suite is None: + raise ValueError(f"no testsuite in {path}") + return { + "result_artifact": f"sanitized/{path.name}", + "result_sha256": sha256(path), + "assertions": int(suite.attrib["tests"]), + "failures": int(suite.attrib["failures"]), + "errors": int(suite.attrib["errors"]), + "test_binary": test_binary, + } + + +def parse_run(spec: str) -> tuple[str, Path, Path, Path]: + pieces = spec.split(",", 3) + if len(pieces) != 4: + raise ValueError("--run must be label,profile,audit,db") + return pieces[0], Path(pieces[1]), Path(pieces[2]), Path(pieces[3]) + + +def main() -> None: + parser = argparse.ArgumentParser() + parser.add_argument("--corpus", type=Path, required=True) + parser.add_argument("--out", type=Path, required=True) + parser.add_argument("--run", action="append", required=True) + parser.add_argument("--structural-junit", type=Path, required=True) + parser.add_argument("--backfill-junit", type=Path, required=True) + parser.add_argument("--restart-junit", type=Path, required=True) + parser.add_argument("--core-knob-junit", type=Path, required=True) + parser.add_argument("--invariance-junit", type=Path, required=True) + parser.add_argument("--benchmark-binary", type=Path, required=True) + parser.add_argument("--test-binary", type=Path, required=True) + args = parser.parse_args() + + benchmark_binary = executable_identity( + args.benchmark_binary, "cortext_chat_replay_live_run" + ) + test_binary = executable_identity(args.test_binary, "cortext_tests") + + source_paths = [ + "src/operations/sparse_retrieval_knobs_internal.hpp", + "src/operations/sparse_retrieval_route_internal.hpp", + "src/operations/sparse_retrieval_route_internal.cpp", + "src/operations/sparse_retrieval_route_sqlite_internal.hpp", + "src/operations/sparse_retrieval_route_sqlite_internal.cpp", + "src/operations/rif_active_epoch_cache_internal.hpp", + "src/operations/historical_surface_search_cache_internal.hpp", + "src/operations/graph_retrieval.cpp", + "src/operations/memory_storage.cpp", + "src/cortext.cpp", + "src/signal_processor.cpp", + "tests/operations_graph_retrieval.test.cpp", + "tests/operations_memory_storage.test.cpp", + "tests/cortext.test.cpp", + "tests/signal_processor.test.cpp", + "examples/benchmark/chat_replay_live_run.cpp", + "tools/audit_public_retrieval_control.py", + "tools/audit_storage_cost_profile.py", + "tools/build_sqlite_hnsw_knob_ablation.py", + ] + experiments = [] + for spec in args.run: + label, profile_path, audit_path, db_path = parse_run(spec) + profile = load_json(profile_path) + audit = load_json(audit_path) + if "experimental_sparse_node_envelope_formula" in profile: + raise ValueError( + f"production-default run unexpectedly used an experiment selector for {label}" + ) + if profile.get("processed_events") != REQUIRED_PROCESSED_EVENTS_PER_RUN: + raise ValueError( + f"{label} must contain exactly " + f"{REQUIRED_PROCESSED_EVENTS_PER_RUN} processed events" + ) + expected = expected_parameters( + profile["focus"], profile["sensitivity"], profile["stability"] + ) + if profile["sparse_route_parameters"] != expected: + raise ValueError(f"resolved parameters do not match formulas for {label}") + expected_epoch_limits = expected_active_epoch_limits( + profile["focus"], profile["sensitivity"], profile["stability"] + ) + if profile.get("active_epoch_limits") != expected_epoch_limits: + raise ValueError( + f"resolved active-epoch limits do not match formulas for {label}" + ) + if not candidate_quality_passed(audit): + raise ValueError(f"candidate quality audit did not pass for {label}") + visits = metric_values(profile, "GraphRetrieve.sqlite_sparse_route_node_rows") + snapshot_visits = metric_values( + profile, + "GraphRetrieve.sqlite_sparse_route_activation_snapshot_rows", + ) + activated = metric_values( + profile, "GraphRetrieve.sqlite_sparse_route_activated_identities" + ) + node_budgets = metric_values( + profile, "GraphRetrieve.sqlite_sparse_route_search_node_budget" + ) + if any( + visited > node_budget + for visited, node_budget in zip(visits, node_budgets) + if visited > 0.0 + ): + raise ValueError(f"dynamic node ceiling exceeded for {label}") + if any( + visited > expected["activation_snapshot_capacity"] + for visited in snapshot_visits + ): + raise ValueError(f"activation snapshot ceiling exceeded for {label}") + if any( + canonical + snapshot > expected["total_query_row_budget"] + for canonical, snapshot in zip(visits, snapshot_visits) + ): + raise ValueError(f"total query-row ceiling exceeded for {label}") + if any( + identity_count > expected["activation_identity_target"] + for identity_count in activated + ): + raise ValueError(f"activation identity target exceeded for {label}") + search_failures = metric_values( + profile, "GraphRetrieve.sqlite_sparse_route_search_failure_code" + ) + route_metadata_open_rows = metric_values( + profile, "GraphRetrieve.sqlite_sparse_route_restart_rows" + ) + backfill_rows = [ + int(row.get("sqlite_sparse_route_backfill_rows", 0)) + for row in profile["consolidation_events"] + ] + backfill_failures = [ + int(row.get("sqlite_sparse_route_backfill_failure_count", 0)) + for row in profile["consolidation_events"] + ] + successful_resets = [ + event + for event in profile["consolidation_events"] + if event.get("sqlite_sparse_route_recenter_succeeded") is True + and float(event.get("sqlite_sparse_route_activation_search_effort", 0.0)) + == expected["activation_search_effort_min"] + and float(event.get("sqlite_sparse_route_activation_node_budget", 0.0)) + == expected["activation_search_node_budget_min"] + ] + valid_overlap_events = [] + changed_overlap_events = [] + overlap_ratios = [] + for event in successful_resets: + centroid_source = event.get( + "sqlite_sparse_route_recenter_centroid_source" + ) + centroid_cluster_count = event.get( + "sqlite_sparse_route_recenter_centroid_cluster_count" + ) + centroid_member_count = event.get( + "sqlite_sparse_route_recenter_centroid_member_count" + ) + if ( + event.get("sqlite_sparse_route_recenter_derived_centroid") + is not True + or centroid_source not in (1.0, 2.0) + or not isinstance(centroid_cluster_count, (int, float)) + or not isinstance(centroid_member_count, (int, float)) + or not math.isfinite(float(centroid_cluster_count)) + or not math.isfinite(float(centroid_member_count)) + or float(centroid_cluster_count) < 0.0 + or float(centroid_member_count) <= 0.0 + or ( + centroid_source == 1.0 + and float(centroid_cluster_count) <= 0.0 + ) + or ( + centroid_source == 2.0 + and float(centroid_cluster_count) != 0.0 + ) + ): + raise ValueError( + f"successful recenter lacks a valid derived centroid for {label}" + ) + overlap_profiled = ( + event.get("sqlite_sparse_route_recenter_overlap_profiled") is True + ) + overlap_pair_valid = ( + event.get("sqlite_sparse_route_recenter_overlap_pair_valid") is True + ) + if overlap_profiled != overlap_pair_valid: + raise ValueError( + f"recenter overlap profile is internally inconsistent for {label}" + ) + if not overlap_profiled: + continue + if float(event.get( + "sqlite_sparse_route_recenter_overlap_failure_code", -1.0 + )) != 0.0: + raise ValueError(f"recenter overlap failed for {label}") + pre_count = float(event.get( + "sqlite_sparse_route_recenter_pre_activated_count", -1.0 + )) + post_count = float(event.get( + "sqlite_sparse_route_recenter_post_activated_count", -1.0 + )) + overlap_count = float(event.get( + "sqlite_sparse_route_recenter_overlap_count", -1.0 + )) + if ( + not all(math.isfinite(value) for value in ( + pre_count, post_count, overlap_count + )) + or pre_count <= 0.0 + or post_count <= 0.0 + or pre_count > expected["activation_identity_target"] + or post_count > expected["activation_identity_target"] + or overlap_count < 0.0 + or overlap_count > min(pre_count, post_count) + ): + raise ValueError(f"invalid recenter overlap counts for {label}") + valid_overlap_events.append(event) + overlap_ratios.append(overlap_count / post_count) + if overlap_count < post_count: + changed_overlap_events.append(event) + hydration_limits = metric_values( + profile, "Cortext.fallback_hydration_signal_limit" + ) + hydration_rows = metric_values( + profile, "Cortext.fallback_hydration_signal_rows" + ) + if any( + value != expected["fallback_hydration_signal_limit"] + for value in hydration_limits + ): + raise ValueError(f"fallback hydration limit mismatch for {label}") + topo = topology(db_path) + sparse_traversed = sum(value > 0 for value in visits) > 0 + route_lifecycle_evaluated = sparse_traversed and bool(successful_resets) + if sparse_traversed and ( + topo["observed_max_level"] is None + or topo["observed_max_level"] <= 0 + or topo["upper_level_node_rows"] <= 0 + or topo["upper_level_nonempty_adjacency_rows"] <= 0 + ): + raise ValueError(f"flat or missing runtime hierarchy for {label}") + quality_class = quality_classification( + sparse_traversed=sparse_traversed, + evaluated_recenter_count=len(valid_overlap_events), + node_rows=topo["node_rows"], + published_active_count=topo["published_active_count"], + route_capacity=expected["route_capacity"], + ) + experiments.append( + { + "id": label, + "knobs": [ + profile["focus"], + profile["sensitivity"], + profile["stability"], + ], + "resolved": expected_operational_limits(expected), + "active_epoch_limits": expected_epoch_limits, + "observed": { + "sqlite_sparse_route_event_count": sum(value > 0 for value in visits), + "maximum_activated_identities": max(activated), + "activation_identity_target": expected[ + "activation_identity_target" + ], + "maximum_search_node_rows": max(visits), + "maximum_activation_snapshot_rows": max(snapshot_visits), + "maximum_total_query_rows": max( + canonical + snapshot + for canonical, snapshot in zip(visits, snapshot_visits) + ), + "maximum_dynamic_search_node_budget": max(node_budgets), + "successful_activation_reset_count": len(successful_resets), + "cluster_centroid_reset_count": sum( + event.get("sqlite_sparse_route_recenter_centroid_source") + == 1.0 + for event in successful_resets + ), + "active_signal_ring_centroid_reset_count": sum( + event.get("sqlite_sparse_route_recenter_centroid_source") + == 2.0 + for event in successful_resets + ), + "valid_activation_overlap_count": len(valid_overlap_events), + "changed_activation_set_count": len(changed_overlap_events), + "minimum_activation_overlap_ratio": min( + overlap_ratios, default=None + ), + "maximum_activation_overlap_ratio": max( + overlap_ratios, default=None + ), + "maximum_route_metadata_open_rows": max( + route_metadata_open_rows + ), + "maximum_backfill_rows": max(backfill_rows, default=0), + "total_backfill_rows": sum(backfill_rows), + "maximum_fallback_hydration_signal_rows": max(hydration_rows), + "fallback_hydration_signal_limit": max(hydration_limits), + "backfill_failures": max(backfill_failures, default=0), + "search_failure_events": sum(value > 0 for value in search_failures), + "consolidation_runs": profile["consolidation_runs"], + "processed_events": profile["processed_events"], + "wall_ms": profile["wall_ms"], + "mean_process_ms": profile["mean_process_ms"], + "mean_total_ms": profile["mean_total_ms"], + "peak_rss_mb": profile["peak_rss_mb"], + "exact_identity_recall_at_16": audit["exact_identity_recall_at_k"], + "exact_top1": audit["exact_top1"], + "exact_top1_hits": audit["exact_top1_hits"], + "exact_top1_miss_count": audit["exact_top1_miss_count"], + "top1_miss_fingerprints": audit["top1_miss_fingerprints"], + "semantic_coverage": audit["semantic_coverage"], + **topo, + }, + "quality_class": quality_class, + "profile": f"private/raw/{profile_path.name}", + "profile_sha256": sha256(profile_path), + "audit": f"sanitized/{audit_path.name}", + "audit_sha256": sha256(audit_path), + "database": f"private/raw/{db_path.name}", + "db_sha256": sha256(db_path), + "benchmark_binary": benchmark_binary, + } + ) + + if len(experiments) != 9: + raise ValueError("the contract requires exactly nine corpus runs") + if len({row["id"] for row in experiments}) != len(experiments): + raise ValueError("corpus run labels must be unique") + observed_knob_points = {tuple(row["knobs"]) for row in experiments} + if observed_knob_points != REQUIRED_CORPUS_KNOB_POINTS: + raise ValueError("corpus runs do not match the required nine knob points") + aggregate_top1_hits = sum( + row["observed"]["exact_top1_hits"] for row in experiments + ) + aggregate_top1_queries = sum( + load_json(parse_run(spec)[2])["query_count"] for spec in args.run + ) + aggregate_top1 = aggregate_top1_hits / aggregate_top1_queries + if aggregate_top1 < 0.999: + raise ValueError("aggregate exact top-1 is below 0.999") + miss_cluster_audit = top1_miss_cluster_audit(experiments) + if not miss_cluster_audit["passed"]: + raise ValueError("exact top-1 misses cluster across a protected dimension") + route_lifecycle_evaluated = [ + row + for row in experiments + if row["quality_class"] + == "route-lifecycle-evaluated-system-quality-passed" + ] + traversed_recenter_unproven = [ + row + for row in experiments + if row["quality_class"] + == "system-quality-passed-sparse-route-traversed-recenter-unproven" + ] + structural = junit(args.structural_junit, test_binary) + aggregate = { + "schema": "cortext_sqlite_hnsw_knob_ablation_v7", + "status": "passed-production-default-nine-quality-points-with-explicit-route-maturity-classification", + "source_head": subprocess.check_output( + ["git", "rev-parse", "HEAD"], cwd=ROOT, text=True + ).strip(), + "source_sha256": {name: sha256(ROOT / name) for name in source_paths}, + "execution_identity": { + "benchmark_binary": benchmark_binary, + "test_binary": test_binary, + "identity_contract": "Every profile and retained SQLite topology database was generated by the benchmark binary named here; every JUnit artifact was generated by the test binary named here. The aggregate content-addresses all binaries, profiles, audits, databases, and XML results.", + }, + "corpus": { + "kind": "owner-authorized-private-claude-jsonl-derived-sentence-packets", + "processed_events_per_run": REQUIRED_PROCESSED_EVENTS_PER_RUN, + "sha256": sha256(args.corpus), + }, + "formulas": { + "route_capacity": "C = lround(256 + 256*clamp(F) + 128*clamp(S) + 128*clamp(T))", + "backfill_batch_size": "B = lround(64 + 64*clamp(F) + 32*clamp(S) + 32*clamp(T))", + "fallback_hydration_signal_limit": "B recent indexed signal rows per hydrated memory", + "graph_neighbor_count": "max(8, B / 2)", + "graph_level_zero_links": "max(16, C / 4)", + "maximum_level": "ceil(log2(C))", + "reciprocal_update_count_per_level": "max(2, B / 16)", + "centroid_identity_quota": "max(2, B / 16), shared with the reciprocal-update budget", + "hnsw_construction_effort": "max(32, lround(C * 25 / 64))", + "hnsw_query_effort": "max(C, lround(C * 5 / 2))", + "bootstrap_limit": "2 * C", + "activation_identity_target": "2 * C + 2 * B retained activated identities per public search", + "activation_snapshot_capacity": "A identities persisted by consolidation and exactly compared without displacing canonical HNSW candidates", + "total_query_row_budget": "9 * C + A, with canonical HNSW and consolidation-snapshot rows recorded separately", + "search_node_budget": "9 * C hard ceiling per public activation", + "activation_search_node_budget_min": "8 * C at route open and after successful consolidation recenter", + "activation_search_node_budget_step": "max(2, B / 16) per public activation until the 9 * C ceiling", + "search_expansion_batch": "max(8, B / 4)", + "search_effort": "9 * C hard ceiling per public activation", + "activation_search_effort_min": "8 * C at route open and after successful consolidation recenter", + "activation_search_effort_step": "max(2, B / 16) per public activation until the 9 * C ceiling", + "retrieval_cycle_edge_samples": "max(2, B / 32) retrieval-active queries per phase edge", + "shadow_cache_capacity": "24 * C", + "backfill_search_node_budget": "C + B", + "backfill_search_effort": "2 * B", + "historical_backfill_drain_limit": "B ordered rows per successful construction edge", + "historical_backfill_overflow_probe_limit": "logical B + 1 boundary: process B ordered entries, then test whether the in-memory iterator has another entry; no B + 1 row is read or processed", + "dirty_identity_drain_limit": "C per successful construction edge", + "dirty_identity_overflow_probe_limit": "C + 1 identities read only to detect overflow", + "route_metadata_open_row_limit": 1, + }, + "structural_invariants": { + "persisted_hnsw_hierarchy_count": 1, + "route_metadata_open_row_count": 1, + "runtime_hierarchy_required_for_sparse_route_traversed": True, + "valid_pre-post_activation_overlap_required_for_route_lifecycle_evaluated": True, + "whole_engine_restart_bounded": False, + "classification": "fixed SQLite representation with a consolidation-reset activation envelope and all operational work limits knob-derived", + }, + "structural_grid": { + "focus_values": [0.0, 0.5, 1.0], + "sensitivity_values": [0.0, 0.5, 1.0], + "stability_values": [0.0, 0.5, 1.0], + "configuration_count": 27, + "passed": structural["failures"] == 0 and structural["errors"] == 0, + **structural, + }, + "direct_regressions": { + "bounded_dirty_backfill_and_live_journal": junit( + args.backfill_junit, test_binary + ), + "route_metadata_open": junit(args.restart_junit, test_binary), + "core_knob_endpoints": junit(args.core_knob_junit, test_binary), + "active_route_source_modality_label_invariance": junit( + args.invariance_junit, test_binary + ), + }, + "system_quality_contract": { + "queries_per_run": 512, + "result_k": 16, + "exact_identity_recall_at_k_min": 0.998, + "exact_top1_per_run_min": 511 / 512, + "exact_top1_per_run_max_misses": 1, + "exact_top1_nine_run_aggregate_min": 0.999, + "semantic_coverage_min": 0.95, + "deterministic_tie_order_required": True, + "minimum_opaque_source_ids": 4, + "modalities": ["text"], + "modality_agnostic_proof": "active_route_source_modality_label_invariance", + }, + "experiments": experiments, + "aggregate": { + "run_count": len(experiments), + "system_quality_query_count": 512 * len(experiments), + "system_quality_pass_count": len(experiments), + "route_lifecycle_evaluated_run_count": len( + route_lifecycle_evaluated + ), + "route_lifecycle_unevaluated_run_count": len(experiments) + - len(route_lifecycle_evaluated), + "valid_activation_overlap_count": sum( + row["observed"]["valid_activation_overlap_count"] + for row in experiments + ), + "changed_activation_set_count": sum( + row["observed"]["changed_activation_set_count"] + for row in experiments + ), + "changed_activation_set_run_count": sum( + row["observed"]["changed_activation_set_count"] > 0 + for row in experiments + ), + "sparse_route_quality_separately_materialized": False, + "sparse_route_quality_pass_count": None, + "sparse_route_traversed_recenter_unproven_run_count": sum( + row["quality_class"] + == "system-quality-passed-sparse-route-traversed-recenter-unproven" + for row in experiments + ), + "published_below_threshold_route_unevaluated_run_count": sum( + row["quality_class"] + == "system-quality-passed-published-below-threshold-sparse-route-unevaluated" + for row in experiments + ), + "exact_top1_min": min(row["observed"]["exact_top1"] for row in experiments), + "exact_top1_aggregate": aggregate_top1, + "exact_top1_aggregate_hits": aggregate_top1_hits, + "exact_top1_aggregate_queries": aggregate_top1_queries, + "exact_top1_aggregate_misses": ( + aggregate_top1_queries - aggregate_top1_hits + ), + "exact_top1_miss_cluster_audit": miss_cluster_audit, + "exact_identity_recall_at_16_min": min( + row["observed"]["exact_identity_recall_at_16"] for row in experiments + ), + "semantic_coverage_min": min( + row["observed"]["semantic_coverage"] for row in experiments + ), + "maximum_route_metadata_open_rows": max( + row["observed"]["maximum_route_metadata_open_rows"] + for row in experiments + ), + "maximum_backfill_failure_count": max( + row["observed"]["backfill_failures"] for row in experiments + ), + "maximum_search_failure_event_count": max( + row["observed"]["search_failure_events"] for row in experiments + ), + "all_activation_identity_targets_respected": all( + row["observed"]["maximum_activated_identities"] + <= row["observed"]["activation_identity_target"] + for row in experiments + ), + "all_route_lifecycle_evaluated_runs_have_runtime_upper_levels": all( + row["observed"]["observed_max_level"] > 0 + and row["observed"]["upper_level_node_rows"] > 0 + and row["observed"]["upper_level_nonempty_adjacency_rows"] > 0 + for row in route_lifecycle_evaluated + ), + "all_resolved_parameters_embedded_in_raw_profiles": True, + "all_system_quality_contracts_passed": True, + }, + "limits": [ + "Whole-engine latency is not an HNSW-only measure because F, S, and T also change admission, consolidation frequency, and surface evolution.", + "A route lifecycle is evaluated only after both nonzero SQLite node visits and a successful consolidation recenter. The retained quality audit is whole-system quality and does not separately materialize a route-active query subset.", + "The route metadata open reads one row, but SignalProcessor startup still hydrates the complete current memory surface and therefore remains O(history). The route restart regression is not whole-engine bounded-restart proof.", + "The corpus matrix uses text ingress with four opaque source identifiers. Modality agnosticism is proved separately by the active SQLite-route label-invariance regression over text, audio, and image labels, so no fabricated media ingress is used in the corpus audit.", + "This 4,000-event matrix proves production-default knob derivation, local work ceilings, bounded durable dirty drainage, explicit route-maturity classification at every point, accepted whole-system quality, and—through the separate active-route regression—source/modality label invariance. It does not claim a mature 8C-to-9C recenter cycle when a run lacks a valid pre/post activation pair; that requires the separate long-horizon sawtooth experiment. It also does not prove route-only quality, bounded whole-engine restart, the full 15,695-event plateau, or production-wide boundedness.", + ], + "production_cutover": True, + } + args.out.parent.mkdir(parents=True, exist_ok=True) + with args.out.open("w", encoding="utf-8") as stream: + json.dump(aggregate, stream, indent=2) + stream.write("\n") + + +if __name__ == "__main__": + main() diff --git a/tools/build_sqlite_hnsw_knob_ablation_test.py b/tools/build_sqlite_hnsw_knob_ablation_test.py new file mode 100644 index 00000000..7ed05062 --- /dev/null +++ b/tools/build_sqlite_hnsw_knob_ablation_test.py @@ -0,0 +1,254 @@ +import importlib.util +import math +import tempfile +import unittest +from pathlib import Path + + +MODULE_PATH = Path(__file__).with_name("build_sqlite_hnsw_knob_ablation.py") +SPEC = importlib.util.spec_from_file_location("knob_ablation_builder", MODULE_PATH) +MODULE = importlib.util.module_from_spec(SPEC) +assert SPEC.loader is not None +SPEC.loader.exec_module(MODULE) + + +class KnobAblationBuilderTest(unittest.TestCase): + def test_corpus_ablation_uses_the_quality_matrix_length(self): + self.assertEqual(MODULE.REQUIRED_PROCESSED_EVENTS_PER_RUN, 4000) + + def test_control_only_audit_cannot_pass_as_candidate_quality(self): + control_only = { + "passed": True, + "candidate_complete": False, + "candidate_quality_passed": False, + } + self.assertFalse(MODULE.candidate_quality_passed(control_only)) + + candidate = { + "passed": True, + "candidate_complete": True, + "candidate_quality_passed": True, + "deterministic_tie_order": True, + "exact_identity_recall_at_k": 0.998, + "exact_top1": 1.0, + "exact_top1_miss_count": 0, + "semantic_coverage": 0.95, + } + self.assertTrue(MODULE.candidate_quality_passed(candidate)) + + def test_route_quality_classification_preserves_below_threshold_state(self): + self.assertEqual( + MODULE.quality_classification( + sparse_traversed=False, + evaluated_recenter_count=0, + node_rows=395, + published_active_count=395, + route_capacity=448, + ), + "system-quality-passed-published-below-threshold-sparse-route-unevaluated", + ) + self.assertEqual( + MODULE.quality_classification( + sparse_traversed=True, + evaluated_recenter_count=0, + node_rows=500, + published_active_count=500, + route_capacity=448, + ), + "system-quality-passed-sparse-route-traversed-recenter-unproven", + ) + self.assertEqual( + MODULE.quality_classification( + sparse_traversed=True, + evaluated_recenter_count=1, + node_rows=500, + published_active_count=500, + route_capacity=448, + ), + "route-lifecycle-evaluated-system-quality-passed", + ) + + def test_top1_miss_cluster_audit_accepts_zero_and_rejects_a_repeat(self): + base = { + "id": "midpoint", + "knobs": [0.5, 0.5, 0.5], + "observed": { + "processed_events": 4000, + "exact_top1_miss_count": 0, + "top1_miss_fingerprints": [], + }, + } + self.assertEqual( + MODULE.top1_miss_cluster_audit([base])["status"], "no-misses" + ) + + repeated = [] + for index, knobs in enumerate(([0.0, 0.0, 0.0], [1.0, 1.0, 1.0])): + repeated.append( + { + "id": f"run-{index}", + "knobs": knobs, + "observed": { + "processed_events": 4000, + "exact_top1_miss_count": 1, + "top1_miss_fingerprints": [ + { + "query_ordinal": index, + "query_progress_quartile": index, + "source_id_blake3": f"{index + 1:064x}", + "modality": "text", + "control_top1_age_events": 1000 + index * 100, + "control_top1_age_ms": 10000 + index, + } + ], + }, + } + ) + result = MODULE.top1_miss_cluster_audit(repeated) + self.assertFalse(result["passed"]) + self.assertIn("modality", result["clustered_dimensions"]) + + def test_required_corpus_points_are_midpoint_endpoints_and_one_axis_edges(self): + self.assertEqual( + MODULE.REQUIRED_CORPUS_KNOB_POINTS, + { + (0.0, 0.0, 0.0), + (1.0, 1.0, 1.0), + (0.5, 0.5, 0.5), + (0.0, 0.5, 0.5), + (1.0, 0.5, 0.5), + (0.5, 0.0, 0.5), + (0.5, 1.0, 0.5), + (0.5, 0.5, 0.0), + (0.5, 0.5, 1.0), + }, + ) + + def test_endpoint_and_midpoint_parameters(self): + low = MODULE.expected_parameters(0.0, 0.0, 0.0) + midpoint = MODULE.expected_parameters(0.5, 0.5, 0.5) + high = MODULE.expected_parameters(1.0, 1.0, 1.0) + + self.assertEqual((low["route_capacity"], low["backfill_batch_size"]), (256, 64)) + self.assertEqual( + (midpoint["route_capacity"], midpoint["backfill_batch_size"]), + (512, 128), + ) + self.assertEqual( + (high["route_capacity"], high["backfill_batch_size"]), (768, 192) + ) + self.assertEqual( + ( + low["activation_identity_target"], + midpoint["activation_identity_target"], + high["activation_identity_target"], + ), + (640, 1280, 1920), + ) + self.assertEqual( + ( + low["total_query_row_budget"], + midpoint["total_query_row_budget"], + high["total_query_row_budget"], + ), + (2944, 5888, 8832), + ) + self.assertEqual( + (low["maximum_level"], midpoint["maximum_level"], high["maximum_level"]), + (8, 9, 10), + ) + + def test_active_epoch_limits_have_literal_endpoint_and_axis_expectations(self): + expected = { + (0.0, 0.0, 0.0): (256, 16384, 33554432), + (0.5, 0.5, 0.5): (512, 32768, 67108864), + (1.0, 1.0, 1.0): (768, 49152, 100663296), + (0.0, 0.5, 0.5): (384, 24576, 50331648), + (1.0, 0.5, 0.5): (640, 40960, 83886080), + (0.5, 0.0, 0.5): (448, 28672, 58720256), + (0.5, 1.0, 0.5): (576, 36864, 75497472), + (0.5, 0.5, 0.0): (448, 28672, 58720256), + (0.5, 0.5, 1.0): (576, 36864, 75497472), + } + for point, values in expected.items(): + limits = MODULE.expected_active_epoch_limits(*point) + self.assertEqual( + ( + limits["event_count"], + limits["mutation_count"], + limits["allocated_bytes"], + limits["row_batch_size"], + ), + (*values, MODULE.expected_parameters(*point)["backfill_batch_size"]), + ) + + def test_parameter_builders_reject_nonfinite_and_clamp_finite_values(self): + for function in ( + MODULE.expected_parameters, + MODULE.expected_active_epoch_limits, + ): + for point in ( + (math.nan, 0.5, 0.5), + (0.5, math.inf, 0.5), + (0.5, 0.5, -math.inf), + ): + with self.subTest(function=function.__name__, point=point): + with self.assertRaisesRegex(ValueError, "must be finite"): + function(*point) + self.assertEqual(function(-1.0, -2.0, -3.0), function(0.0, 0.0, 0.0)) + self.assertEqual(function(2.0, 3.0, 4.0), function(1.0, 1.0, 1.0)) + + def test_all_operational_limits_are_knob_derived(self): + low = MODULE.expected_operational_limits( + MODULE.expected_parameters(0.0, 0.0, 0.0) + ) + high = MODULE.expected_operational_limits( + MODULE.expected_parameters(1.0, 1.0, 1.0) + ) + for name in low: + if name in { + "activation_search_effort_step", + "activation_search_node_budget_step", + }: + self.assertEqual((low[name], high[name]), (4, 12)) + continue + self.assertLess(low[name], high[name], name) + + def test_midpoint_backfill_and_dirty_sentinels_are_derived(self): + midpoint = MODULE.expected_operational_limits( + MODULE.expected_parameters(0.5, 0.5, 0.5) + ) + self.assertEqual(midpoint["historical_backfill_drain_limit"], 128) + self.assertEqual(midpoint["historical_backfill_overflow_probe_limit"], 129) + self.assertEqual(midpoint["dirty_identity_drain_limit"], 512) + self.assertEqual(midpoint["dirty_identity_overflow_probe_limit"], 513) + + def test_executable_identity_content_addresses_binary_without_local_path(self): + with tempfile.TemporaryDirectory() as directory: + binary = Path(directory) / "example_binary" + binary.write_bytes(b"exact executable bytes") + identity = MODULE.executable_identity(binary, "example_target") + + self.assertEqual(identity["target"], "example_target") + self.assertEqual(identity["filename"], "example_binary") + self.assertEqual(identity["size_bytes"], 22) + self.assertEqual( + identity["sha256"], + "135a9af43260004bfc617b97f806fcc6600e211fe0219d6c4311ef8cc6d59b48", + ) + self.assertNotIn(str(binary.parent), identity.values()) + + def test_link_decoder_proves_nonempty_upper_adjacency(self): + blob = ( + (2).to_bytes(4, "little") + + (1).to_bytes(4, "little") + + (11).to_bytes(8, "little", signed=True) + + (2).to_bytes(4, "little") + + (17).to_bytes(8, "little", signed=True) + + (19).to_bytes(8, "little", signed=True) + ) + self.assertEqual(MODULE.decode_link_levels(blob, 1), [[11], [17, 19]]) + + +if __name__ == "__main__": + unittest.main() diff --git a/tools/build_write_gate_incidence_attribution.py b/tools/build_write_gate_incidence_attribution.py new file mode 100644 index 00000000..ba085dbb --- /dev/null +++ b/tools/build_write_gate_incidence_attribution.py @@ -0,0 +1,372 @@ +#!/usr/bin/env python3 +"""Build a range-bound write-gate incidence attribution artifact.""" + +from __future__ import annotations + +import argparse +import hashlib +import json +import math +import statistics +from pathlib import Path +from typing import Any, Sequence + + +WRITE_GATE_KEYS = ( + "WriteGate.flush_trigger", + "WriteGate.spike_bypass", + "WriteGate.accumulator_available", + "WriteGate.n_signals", + "WriteGate.coverage", + "WriteGate.window_score", + "WriteGate.threshold_dynamic", + "WriteGate.refractory_multiplier", + "WriteGate.write_scale", + "WriteGate.effective_threshold", + "WriteGate.score_margin", + "WriteGate.force_write", + "WriteGate.write_accumulator", + "WriteGate.reason_code", +) +PROCESS_RATIO_RANGE = (0.90, 1.10) +THROUGHPUT_RATIO_RANGE = (0.90, 1.10) +RELATIVE_SLOPE_MAX = 0.02 +RELATIVE_UPPER_MAX = 0.05 + + +def load_json(path: Path) -> dict[str, Any]: + def reject_duplicates(pairs: list[tuple[str, Any]]) -> dict[str, Any]: + result: dict[str, Any] = {} + for key, value in pairs: + if key in result: + raise ValueError(f"duplicate JSON key {key!r} in {path}") + result[key] = value + return result + + with path.open(encoding="utf-8") as stream: + value = json.load(stream, object_pairs_hook=reject_duplicates) + if not isinstance(value, dict): + raise ValueError(f"{path} is not a JSON object") + return value + + +def file_sha256(path: Path) -> str: + digest = hashlib.sha256() + with path.open("rb") as stream: + for block in iter(lambda: stream.read(1024 * 1024), b""): + digest.update(block) + return digest.hexdigest() + + +def lround_positive(value: float) -> int: + return math.floor(value + 0.5) + + +def derived_parameters(focus: float, sensitivity: float, stability: float) -> dict[str, int]: + for label, value in ( + ("focus", focus), + ("sensitivity", sensitivity), + ("stability", stability), + ): + if not math.isfinite(value) or value < 0.0 or value > 1.0: + raise ValueError(f"{label} must be finite and within [0, 1]") + capacity = lround_positive( + 256 + 256 * focus + 128 * sensitivity + 128 * stability + ) + backfill = lround_positive( + 64 + 64 * focus + 32 * sensitivity + 32 * stability + ) + return { + "C": capacity, + "B": backfill, + "A": 2 * capacity + 2 * backfill, + "public_query_node_budget": 5 * capacity, + "construction_node_budget": capacity + backfill, + "construction_queue_effort": 2 * backfill, + "logical_B_plus_one_only": backfill + 1, + } + + +def finite_number(value: Any, label: str) -> float: + if isinstance(value, bool) or not isinstance(value, (int, float)): + raise ValueError(f"{label} must be numeric") + result = float(value) + if not math.isfinite(result): + raise ValueError(f"{label} must be finite") + return result + + +def operation_value(row: dict[str, Any], key: str) -> float: + operations = row.get("operation_ms") + if not isinstance(operations, dict) or key not in operations: + raise ValueError(f"event {row.get('event_index')} lacks {key}") + return finite_number(operations[key], key) + + +def integer_sum(rows: Sequence[dict[str, Any]], key: str) -> int: + value = sum(operation_value(row, key) for row in rows) + rounded = round(value) + if value < 0.0 or not math.isclose(value, rounded, abs_tol=1e-9): + raise ValueError(f"{key} aggregate must be a nonnegative integer") + return int(rounded) + + +def aggregate(rows: Sequence[dict[str, Any]]) -> dict[str, Any]: + if not rows: + raise ValueError("attribution range is empty") + reason_counts = {reason: 0 for reason in range(1, 7)} + scored_rows = [] + for row in rows: + reason_value = operation_value(row, "WriteGate.reason_code") + reason = int(reason_value) + if reason_value != reason or reason not in reason_counts: + raise ValueError("WriteGate.reason_code must be an integer in [1, 6]") + reason_counts[reason] += 1 + if reason in (5, 6): + scored_rows.append(row) + if sum(reason_counts.values()) != len(rows): + raise ValueError("write-gate reason coverage is incomplete") + + boundaries = integer_sum(rows, "WriteGate.flush_trigger") + writes = integer_sum(rows, "WriteGate.write_accumulator") + forced = integer_sum(rows, "WriteGate.force_write") + if forced != reason_counts[4]: + raise ValueError("forced-write count differs from reason code") + if writes != reason_counts[4] + reason_counts[5]: + raise ValueError("write count differs from forced plus scored accepts") + if boundaries != reason_counts[3] + reason_counts[4] + reason_counts[5] + reason_counts[6]: + raise ValueError("boundary count differs from write-gate exit classes") + if writes <= 0 or not scored_rows: + raise ValueError("attribution range needs writes and scored decisions") + + def summed(key: str) -> float: + return sum(operation_value(row, key) for row in rows) + + def scored_mean(key: str) -> float: + return statistics.mean(operation_value(row, key) for row in scored_rows) + + return { + "start_event_index": int(rows[0]["event_index"]), + "end_event_index_inclusive": int(rows[-1]["event_index"]), + "events": len(rows), + "boundaries": boundaries, + "writes": writes, + "forced_writes": forced, + "score_accepted": reason_counts[5], + "score_rejected": reason_counts[6], + "mean_scored_window_score": scored_mean("WriteGate.window_score"), + "mean_scored_effective_threshold": scored_mean( + "WriteGate.effective_threshold" + ), + "mean_scored_margin": scored_mean("WriteGate.score_margin"), + "memory_storage_ms_per_write": summed( + "cortext::operations::MemoryStorage" + ) / writes, + "supersession_ms_per_write": summed( + "MemoryStorage.supersession_edges" + ) / writes, + "current_candidates_per_write": summed( + "MemoryStorage.supersession_current_candidate_count" + ) / writes, + "current_rows_visited_per_write": summed( + "MemoryStorage.supersession_current_rows_visited" + ) / writes, + "sparse_route_node_rows_per_write": summed( + "MemoryStorage.supersession_sparse_route_node_rows" + ) / writes, + } + + +def mature_suffix_shape(audit: dict[str, Any]) -> dict[str, Any]: + plateau = audit.get("plateau") + candidates = plateau.get("candidate_failures") if isinstance(plateau, dict) else None + if not isinstance(candidates, list): + raise ValueError("plateau audit lacks candidate failures") + eligible = [] + for candidate in candidates: + if not isinstance(candidate, dict): + continue + if ( + candidate.get("operation_failure_count") == 0 + and candidate.get("counter_failure_count") == 0 + and candidate.get("height_passed") is True + and candidate.get("store_growth_passed") is True + and PROCESS_RATIO_RANGE[0] + <= finite_number(candidate.get("process_ratio"), "process_ratio") + <= PROCESS_RATIO_RANGE[1] + and THROUGHPUT_RATIO_RANGE[0] + <= finite_number(candidate.get("throughput_ratio"), "throughput_ratio") + <= THROUGHPUT_RATIO_RANGE[1] + and finite_number(candidate.get("relative_slope"), "relative_slope") + <= RELATIVE_SLOPE_MAX + and finite_number(candidate.get("relative_upper"), "relative_upper") + <= RELATIVE_UPPER_MAX + ): + eligible.append(candidate) + if not eligible: + raise ValueError("plateau audit has no mature suffix passing shape gates") + selected = min(eligible, key=lambda item: int(item["plateau_start_event"])) + return { + "plateau_start_event": int(selected["plateau_start_event"]), + "plateau_window_count": int(selected["plateau_window_count"]), + "process_ratio": float(selected["process_ratio"]), + "throughput_ratio": float(selected["throughput_ratio"]), + "relative_slope": float(selected["relative_slope"]), + "relative_upper": float(selected["relative_upper"]), + "operation_failure_count": 0, + "counter_failure_count": 0, + "height_passed": True, + "store_growth_passed": True, + "raw_consolidation_mode": selected.get("consolidation_mode"), + "raw_consolidation_epoch_passed": selected.get( + "consolidation_epoch_passed" + ), + } + + +def build( + profile: dict[str, Any], profile_sha256: str, + plateau_audit: dict[str, Any], plateau_audit_sha256: str, + window_size: int = 500, window_count: int = 5, +) -> dict[str, Any]: + rows = profile.get("working_set_curve") + if not isinstance(rows, list) or not rows: + raise ValueError("profile has no working_set_curve") + if profile.get("processed_events") != len(rows): + raise ValueError("processed_events differs from row count") + for index, row in enumerate(rows): + if not isinstance(row, dict) or row.get("event_index") != index: + raise ValueError("event indices must be contiguous and zero-based") + for key in WRITE_GATE_KEYS: + operation_value(row, key) + if window_size <= 0 or window_count <= 0: + raise ValueError("window size and count must be positive") + span = window_size * window_count + if len(rows) < 2 * span: + raise ValueError("profile is too short for disjoint first/final ranges") + + focus = finite_number(profile.get("focus"), "focus") + sensitivity = finite_number(profile.get("sensitivity"), "sensitivity") + stability = finite_number(profile.get("stability"), "stability") + parameters = derived_parameters(focus, sensitivity, stability) + route = profile.get("sparse_route_parameters") + expected_route = { + "route_capacity": parameters["C"], + "backfill_batch_size": parameters["B"], + "activation_identity_target": parameters["A"], + "search_node_budget": parameters["public_query_node_budget"], + "backfill_search_node_budget": parameters["construction_node_budget"], + "backfill_search_effort": parameters["construction_queue_effort"], + } + if not isinstance(route, dict) or any( + route.get(key) != value for key, value in expected_route.items() + ): + raise ValueError("profile sparse-route parameters differ from F/S/T formulas") + + first = aggregate(rows[:span]) + final = aggregate(rows[-span:]) + full = aggregate(rows) + boundary_ratio = final["boundaries"] / first["boundaries"] + write_ratio = final["writes"] / first["writes"] + incidence_is_flat = ( + 0.90 <= boundary_ratio <= 1.10 + and 0.90 <= write_ratio <= 1.10 + ) + neutral = derived_parameters(0.5, 0.5, 0.5) + suffix = mature_suffix_shape(plateau_audit) + plateau = plateau_audit.get("plateau") + whole_plateau_passed = bool( + isinstance(plateau, dict) and plateau.get("passed") is True + ) + raw_reset_passed = suffix["raw_consolidation_epoch_passed"] is True + status = ( + "attribution-only-write-gate-rejected-as-growth-source" + if incidence_is_flat + else "attribution-only-write-gate-growth-source-unresolved" + ) + return { + "schema": "cortext_write_gate_incidence_attribution_v2", + "status": status, + "profile_sha256": profile_sha256, + "plateau_audit_sha256": plateau_audit_sha256, + "processed_events": len(rows), + "consolidation_runs": int(profile.get("consolidation_runs", 0)), + "focus": focus, + "sensitivity": sensitivity, + "stability": stability, + "window_contract": { + "window_size": window_size, + "window_count": window_count, + "first_range": [0, span - 1], + "final_range": [len(rows) - span, len(rows) - 1], + "final_range_is_end_anchored": True, + "ranges_are_disjoint": True, + }, + "derived_parameters": { + **parameters, + "neutral_C": neutral["C"], + "neutral_B": neutral["B"], + "neutral_A": neutral["A"], + "neutral_logical_B_plus_one_only": neutral["logical_B_plus_one_only"], + }, + "first_range_aggregate": first, + "final_range_aggregate": final, + "full_run": full, + "incidence_ratios": { + "final_over_first_boundaries": boundary_ratio, + "final_over_first_writes": write_ratio, + "flat_within_ten_percent": incidence_is_flat, + }, + "mature_suffix_shape": suffix, + "decision": { + "write_incidence_rejected_as_growth_source": incidence_is_flat, + "write_incidence_growth_source": ( + False if incidence_is_flat else None + ), + "observed_growth_surface": ( + "MemoryStorage sparse-route visited-node warm-up to the fixed 5C envelope" + if incidence_is_flat else "unresolved" + ), + "mature_suffix_process_plateau_shape_passed": True, + "raw_reset_gate_passed": raw_reset_passed, + "raw_reset_gate_waived": False, + "whole_plateau_passed": whole_plateau_passed, + "runtime_repair_authorized_from_this_artifact": False, + }, + "required_follow_on": { + "structural_knob_points": 27, + "production_shaped_knob_points": 9, + "modality_and_source_id_agnostic": True, + "activated_identity_overlap": "pending", + }, + "nonclaims": [ + "whole-engine plateau", + "raw reset waiver", + "retrieval full-cycle activated-identity overlap", + "bounded restart", + "PR readiness", + "merge", + "release", + "deployment", + "publication", + ], + } + + +def main() -> int: + parser = argparse.ArgumentParser() + parser.add_argument("--profile", required=True, type=Path) + parser.add_argument("--plateau-audit", required=True, type=Path) + parser.add_argument("--out", required=True, type=Path) + args = parser.parse_args() + result = build( + load_json(args.profile), file_sha256(args.profile), + load_json(args.plateau_audit), file_sha256(args.plateau_audit), + ) + args.out.parent.mkdir(parents=True, exist_ok=True) + args.out.write_text(json.dumps(result, indent=2, sort_keys=True) + "\n") + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/tools/build_write_gate_incidence_attribution_test.py b/tools/build_write_gate_incidence_attribution_test.py new file mode 100644 index 00000000..f0647e02 --- /dev/null +++ b/tools/build_write_gate_incidence_attribution_test.py @@ -0,0 +1,180 @@ +#!/usr/bin/env python3 + +from __future__ import annotations + +import importlib.util +import contextlib +import io +import sys +import unittest +from pathlib import Path +from unittest import mock + + +PATH = Path(__file__).with_name("build_write_gate_incidence_attribution.py") +SPEC = importlib.util.spec_from_file_location("write_gate_builder", PATH) +assert SPEC is not None and SPEC.loader is not None +MODULE = importlib.util.module_from_spec(SPEC) +SPEC.loader.exec_module(MODULE) + + +class WriteGateAttributionBuilderTest(unittest.TestCase): + @staticmethod + def row(index: int, reason: int) -> dict: + forced = reason == 4 + accepted = reason in (4, 5) + boundary = reason in (3, 4, 5, 6) + return { + "event_index": index, + "operation_ms": { + "WriteGate.flush_trigger": float(boundary), + "WriteGate.spike_bypass": float(forced), + "WriteGate.accumulator_available": float(boundary), + "WriteGate.n_signals": 3.0 if boundary else 0.0, + "WriteGate.coverage": 1.0 if boundary else 0.0, + "WriteGate.window_score": 0.6 if reason in (5, 6) else 0.0, + "WriteGate.threshold_dynamic": 0.3, + "WriteGate.refractory_multiplier": 1.0, + "WriteGate.write_scale": 1.0, + "WriteGate.effective_threshold": 0.5 if reason in (5, 6) else 0.0, + "WriteGate.score_margin": 0.1 if reason in (5, 6) else 0.0, + "WriteGate.force_write": float(forced), + "WriteGate.write_accumulator": float(accepted), + "WriteGate.reason_code": float(reason), + "cortext::operations::MemoryStorage": 2.0 if accepted else 0.0, + "MemoryStorage.supersession_edges": 1.0 if accepted else 0.0, + "MemoryStorage.supersession_current_candidate_count": 4.0 if accepted else 0.0, + "MemoryStorage.supersession_current_rows_visited": 8.0 if accepted else 0.0, + "MemoryStorage.supersession_sparse_route_node_rows": 10.0 if accepted else 0.0, + }, + } + + @classmethod + def profile(cls) -> dict: + reasons = [4, 5, 6, 2, 6, 2, 4, 5] + params = MODULE.derived_parameters(0.5, 0.5, 0.5) + return { + "processed_events": len(reasons), + "consolidation_runs": 2, + "focus": 0.5, + "sensitivity": 0.5, + "stability": 0.5, + "sparse_route_parameters": { + "route_capacity": params["C"], + "backfill_batch_size": params["B"], + "activation_identity_target": params["A"], + "search_node_budget": params["public_query_node_budget"], + "backfill_search_node_budget": params["construction_node_budget"], + "backfill_search_effort": params["construction_queue_effort"], + }, + "working_set_curve": [ + cls.row(index, reason) for index, reason in enumerate(reasons) + ], + } + + @staticmethod + def audit() -> dict: + return { + "plateau": { + "candidate_failures": [{ + "plateau_start_event": 2, + "plateau_window_count": 6, + "process_ratio": 1.0, + "throughput_ratio": 1.0, + "relative_slope": 0.0, + "relative_upper": 0.0, + "operation_failure_count": 0, + "counter_failure_count": 0, + "height_passed": True, + "store_growth_passed": True, + "consolidation_mode": "invalid", + "consolidation_epoch_passed": False, + }] + } + } + + def test_build_binds_exact_first_and_final_ranges(self) -> None: + result = MODULE.build( + self.profile(), "1" * 64, self.audit(), "2" * 64, + window_size=2, window_count=1, + ) + self.assertEqual(result["window_contract"]["first_range"], [0, 1]) + self.assertEqual(result["window_contract"]["final_range"], [6, 7]) + self.assertEqual( + result["final_range_aggregate"]["writes"], 2 + ) + self.assertEqual(result["derived_parameters"]["neutral_B"], 128) + self.assertEqual( + result["derived_parameters"]["neutral_logical_B_plus_one_only"], + 129, + ) + self.assertFalse(result["decision"]["raw_reset_gate_waived"]) + self.assertTrue( + result["decision"]["write_incidence_rejected_as_growth_source"] + ) + + def test_build_does_not_reject_nonflat_incidence(self) -> None: + profile = self.profile() + profile["working_set_curve"][-2] = self.row(6, 5) + profile["working_set_curve"][-1] = self.row(7, 2) + result = MODULE.build( + profile, "1" * 64, self.audit(), "2" * 64, + window_size=2, window_count=1, + ) + self.assertFalse(result["incidence_ratios"]["flat_within_ten_percent"]) + self.assertFalse( + result["decision"]["write_incidence_rejected_as_growth_source"] + ) + self.assertIsNone(result["decision"]["write_incidence_growth_source"]) + self.assertEqual( + result["status"], + "attribution-only-write-gate-growth-source-unresolved", + ) + + def test_build_derives_audit_gate_state(self) -> None: + audit = self.audit() + audit["plateau"]["passed"] = True + candidate = audit["plateau"]["candidate_failures"][0] + candidate["consolidation_mode"] = "sawtooth" + candidate["consolidation_epoch_passed"] = True + result = MODULE.build( + self.profile(), "1" * 64, audit, "2" * 64, + window_size=2, window_count=1, + ) + self.assertTrue(result["decision"]["raw_reset_gate_passed"]) + self.assertTrue(result["decision"]["whole_plateau_passed"]) + + def test_cli_rejects_noncanonical_window_override(self) -> None: + argv = [ + str(PATH), + "--profile", "/does/not/exist-profile.json", + "--plateau-audit", "/does/not/exist-audit.json", + "--out", "/does/not/exist-output.json", + "--window-size", "1", + ] + with mock.patch.object(sys, "argv", argv): + with contextlib.redirect_stderr(io.StringIO()): + with self.assertRaises(SystemExit): + MODULE.main() + + def test_build_rejects_noncontiguous_event_identity(self) -> None: + profile = self.profile() + profile["working_set_curve"][-1]["event_index"] = 99 + with self.assertRaisesRegex(ValueError, "contiguous"): + MODULE.build( + profile, "1" * 64, self.audit(), "2" * 64, + window_size=2, window_count=1, + ) + + def test_build_rejects_formula_drift(self) -> None: + profile = self.profile() + profile["sparse_route_parameters"]["backfill_batch_size"] = 129 + with self.assertRaisesRegex(ValueError, "F/S/T"): + MODULE.build( + profile, "1" * 64, self.audit(), "2" * 64, + window_size=2, window_count=1, + ) + + +if __name__ == "__main__": + unittest.main() diff --git a/tools/extract_consolidation_schedule.py b/tools/extract_consolidation_schedule.py new file mode 100644 index 00000000..d4665f87 --- /dev/null +++ b/tools/extract_consolidation_schedule.py @@ -0,0 +1,43 @@ +#!/usr/bin/env python3 +"""Extract a one-based successful consolidation schedule from a replay profile.""" + +from __future__ import annotations + +import argparse +import json +from pathlib import Path + + +def main() -> int: + parser = argparse.ArgumentParser() + parser.add_argument("--profile", type=Path, required=True) + parser.add_argument("--out", type=Path, required=True) + args = parser.parse_args() + + profile = json.loads(args.profile.read_text(encoding="utf-8")) + events = profile.get("consolidation_events") + if not isinstance(events, list): + raise ValueError("profile consolidation_events must be an array") + schedule: list[int] = [] + for event in events: + if not isinstance(event, dict): + raise ValueError("consolidation event must be an object") + value = event.get("one_based_event_index") + if not isinstance(value, int) or isinstance(value, bool) or value <= 0: + raise ValueError("consolidation event lacks a positive one-based index") + schedule.append(value) + if schedule != sorted(set(schedule)): + raise ValueError("consolidation schedule must be strictly increasing") + if len(schedule) != profile.get("consolidation_runs"): + raise ValueError("consolidation run count does not match schedule") + + args.out.parent.mkdir(parents=True, exist_ok=True) + args.out.write_text( + json.dumps(schedule, separators=(",", ":")) + "\n", + encoding="utf-8", + ) + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) From 5f2e3b38edbc5d582b2a0cbb37d7ec10f8ceb1cb Mon Sep 17 00:00:00 2001 From: gabewillen Date: Tue, 21 Jul 2026 00:18:01 -0500 Subject: [PATCH 09/18] Transition retrieval cutover to PR monitoring --- .../paper-traceability-audit-v2.json | 4 ++-- .../paper-traceability-current-state-v2.json | 8 ++++--- .../paper-traceability-manifest-v1.json | 2 +- ...trator-goal-mdscript-converted.mdscript.md | 22 ++++++++++++------- 4 files changed, 22 insertions(+), 14 deletions(-) diff --git a/artifacts/flat_storage_cost/paper-traceability-audit-v2.json b/artifacts/flat_storage_cost/paper-traceability-audit-v2.json index e6041775..fb226e4b 100644 --- a/artifacts/flat_storage_cost/paper-traceability-audit-v2.json +++ b/artifacts/flat_storage_cost/paper-traceability-audit-v2.json @@ -1,7 +1,7 @@ { "generated_claim_mismatches": [], "inventory_count": 69, - "manifest_sha256": "222e2525511e61c12cc870dcb6d3e41dc4475ea7414163f8442be689fdf9df7d", + "manifest_sha256": "06e028939212980df3bd9e9fa655b20901cde1b3652e3a843ecc8dbfb47e0cf2", "manuscript_sha256": "f7ed5d59cadeb0cc3194da92ea4f574e20f0a030e5aa28e6ff54cefdd44a43de", "missing_source_claims": [], "ownership_violations": [], @@ -9,6 +9,6 @@ "proof_level_violations": [], "record_count": 69, "schema": "cortext_paper_traceability_audit_v1", - "state_sha256": "bb2c335ab974d05ae26aaf75f18ab4f1d3beab519a31b1d3ca3c0e0b6c6234fb", + "state_sha256": "2eb2b31546cce94912c8d378edbfb6dfcdf0449f42f059bb70b930756d2bf7f5", "uncovered_inventory": [] } diff --git a/artifacts/flat_storage_cost/paper-traceability-current-state-v2.json b/artifacts/flat_storage_cost/paper-traceability-current-state-v2.json index faf771fa..7561782a 100644 --- a/artifacts/flat_storage_cost/paper-traceability-current-state-v2.json +++ b/artifacts/flat_storage_cost/paper-traceability-current-state-v2.json @@ -1,9 +1,9 @@ { "schema": "cortext_paper_traceability_state_overlay_v2", "supersedes_state_sha256": "f0605f910ed3c10fa7838c2e175c5d0babbe352f7e4fe4e2f92fdf3c70cd1f2d", - "phase": "production-cutover-review", - "completion": false, - "resume_phase": "repair-review-findings", + "phase": "monitor-pr", + "completion": true, + "resume_phase": "refresh-pr-state", "sqlite_hnsw_schema_authority": { "status": "approved-current-user-through-migration-31", "approver_identity": "current-user", @@ -47,6 +47,8 @@ "sqlite_hnsw_production_cutover": { "decision": "retained-production-default", "production_cutover": true, + "implementation_head": "6ac1e3121e4be9aa456c7ac93fdb4b09ea34023d", + "implementation_review": "Proven at P1 by a fresh round-three cumulative review with no findings or residuals", "schema_authority": { "migrations": { "29": "internal SQLite HNSW route, metadata, build, node, and dirty-journal tables", diff --git a/artifacts/flat_storage_cost/paper-traceability-manifest-v1.json b/artifacts/flat_storage_cost/paper-traceability-manifest-v1.json index 02c22e3a..61625a9d 100644 --- a/artifacts/flat_storage_cost/paper-traceability-manifest-v1.json +++ b/artifacts/flat_storage_cost/paper-traceability-manifest-v1.json @@ -1010,7 +1010,7 @@ "corpus_parameter_scope": "production-default 8C-to-9C SQLite HNSW route; 15,695-packet Natural replay, 2,016-message Durable replay, 30,380-packet maturity extension, 27 structural F/S/T points, and nine 4,000-packet quality points with 512 controls each", "decision": "retained-production-default", "evidence_fingerprints": [ - "0f9f67d4aa7eea6a7ae9a1b64e0ce89aee29a15ea8f5c2c229e00e371ec7b53f" + "44abead03df4cc0c1a2b601ada6c9171f2eeaaa780328036faf70f54b5080922" ], "evidence_kind": "measured", "inventory_id": "state:sqlite_hnsw_production_cutover", diff --git a/comments/consolidation-drift-retrigger/20260716T205900Z-orchestrator-goal-mdscript-converted.mdscript.md b/comments/consolidation-drift-retrigger/20260716T205900Z-orchestrator-goal-mdscript-converted.mdscript.md index fd27e812..befa3ad7 100644 --- a/comments/consolidation-drift-retrigger/20260716T205900Z-orchestrator-goal-mdscript-converted.mdscript.md +++ b/comments/consolidation-drift-retrigger/20260716T205900Z-orchestrator-goal-mdscript-converted.mdscript.md @@ -3,13 +3,15 @@ id: consolidation-drift-rearm-pr-monitor-worktree-entry task_id: consolidation-drift-retrigger owner_role: implementer lane_id: consolidation-drift-retrigger -status: active +status: monitoring +implementation_status: complete +monitor_status: activating source_of_truth: current repository, current user corrections, this goal, task comments, exact private profiles and audits, and GitHub PR 6 only after implementation completion model: gpt-5.6-terra reasoning: high model_selection_basis: cross-cutting C++ and SQLite implementation, deterministic bounded-work proof, research traceability, and PR ownership canonical_monitor_entry: true -updated_at: 20260721T001500Z +updated_at: 20260721T051726Z --- @@ -36,16 +38,20 @@ updated_at: 20260721T001500Z * focused production-default derivation, route work, active-epoch reset, shared Natural/Durable path, Durable-barrier non-replay, source/modality, Python audit, and evidence-builder tests pass on the current release build * all algorithm and experiment changes, accepted adverse timing, maturity boundary, failed-recenter rollback repair, and nonclaims are recorded in `docs/paper/sections/10_implementation.qmd` and `docs/paper/sections/11_optimization.qmd`; the regenerated manuscript SHA-256 is `f7ed5d59cadeb0cc3194da92ea4f574e20f0a030e5aa28e6ff54cefdd44a43de` * the full media-enabled CTest suite passes 39,151 assertions in 688 cases, including failure injection proving a failed recenter preserves the existing effort and node budget; the complete Python tool suite passes 159 tests; `git diff --check` passes -* the current-state overlay, rebuilt 69-record manifest, and fail-closed audit have SHA-256 values `ad5eb97044e3db7b41b25bfae4715f375dc748ecb0326c26f40926f38f2ff73b`, `c32dd391ff4aa3db22ae1c49948939d4604b732c777e45c5c8be338170f175b6`, and `2463560aa3b2c9860c026c39f036e726f32fd0d8bc521c701a9bbc34fdfde640`; the audit passes with 69/69 inventory records and no uncovered inventory, claim mismatch, proof-level violation, or ownership violation +* the current-state overlay, rebuilt 69-record manifest, and fail-closed audit have SHA-256 values `89b32a782b0164e82c1b76e230baabdd47827aab00355ec817aaab40e18eb354`, `18f544b6b4cd0d0e7337d99e2381fa7c346d304bf083f265a5b5151beb275ae0`, and `53a648cd6e3c6079c6ade1cd175a1617caf180714e72152c7f37d6ca14a7443f`; the audit passes with 69/69 inventory records and no uncovered inventory, claim mismatch, proof-level violation, or ownership violation +* the recursive blind-review loop is complete: round-one and round-two findings were repaired, and the fresh round-three cumulative reviewer proved the scoped implementation/source-health claim at P1 with no findings or residuals +* the verified tree was committed and pushed without force as `6ac1e3121e4be9aa456c7ac93fdb4b09ea34023d`; PR 6 was updated with the current contract, proof, review trail, and nonclaims; exact-head CI is in progress -## Remaining Execution +## PR Monitor Hot Path -* continue the required diminishing-severity fresh recursive `gabe-review` loop over the repaired complete current diff and intended scoped claim; resolve every required finding and preserve residuals -* after implementation, proof, paper, and review all pass, update the existing branch and PR 6 without force; do not merge or close -* only after the goal is achieved, resume the ten-minute PR monitor in this task; do not let monitoring interrupt implementation again +* implementation, proof, paper, recursive review, branch push, and PR update are complete; do not reopen implementation without changed CI, review, discussion, conflict, or base-drift evidence +* every ten minutes in this current task, refresh PR 6 exact head, checks, mergeability, reviews, review requests, comments, and unresolved threads; compare with the prior state and report only changes +* repair only in-scope failures or review findings with proportionate proof and the required fresh review; push without force and update this goal to the new exact head +* stop and deactivate the heartbeat when the PR merges or closes externally, repair exceeds scope, target drift is unrecoverable, or authority is explicitly denied +* do not merge or close; do not release, deploy, publish, or widen the scoped bounded-retrieval claim * re-enter with `/mdscript-exec {{repository}}/comments/consolidation-drift-retrigger/20260716T205900Z-orchestrator-goal-mdscript-converted.mdscript.md#resume-goal` ## Completion Boundary -* mark implementation complete only when current binaries, artifacts, paper, full tests, and recursive review agree on the scoped claim: knob-derived bounded retrieval sawtooth, accepted retrieval quality, one Natural/Durable operation path with Durable checkpoint only, and modality/source-id agnosticism +* implementation is complete because current binaries, artifacts, paper, full tests, and recursive review agree on the scoped claim: knob-derived bounded retrieval sawtooth, accepted retrieval quality, one Natural/Durable operation path with Durable checkpoint only, and modality/source-id agnosticism * keep whole-engine raw process reset, bounded whole-engine restart, Durable plateau, production-wide boundedness, merge, release, deployment, and publication explicitly unclaimed From f7f0fc532dc90f59bdea1cfee2bf50bc94316a4c Mon Sep 17 00:00:00 2001 From: gabewillen Date: Tue, 21 Jul 2026 02:27:12 -0500 Subject: [PATCH 10/18] Repair exact-head startup and portability failures --- CMakeLists.txt | 9 ++ .../paper-traceability-audit-v2.json | 10 +- .../paper-traceability-current-state-v2.json | 42 +++++++ .../paper-traceability-manifest-v1.json | 17 +++ cmake/PatchHnswlibPrefetch.cmake | 31 +++++ cmake/hnswlib-prefetch-bounds.patch | 82 ++++++++++++++ ...trator-goal-mdscript-converted.mdscript.md | 16 +-- docs/paper/_manuscript/index.md | 30 +++++ docs/paper/sections/10_implementation.qmd | 15 +++ docs/paper/sections/11_optimization.qmd | 1 + .../rif_active_epoch_cache_internal.hpp | 2 +- src/signal_processor.cpp | 53 ++++++++- tests/operations_graph_retrieval.test.cpp | 45 ++++++++ tests/signal_processor.test.cpp | 107 ++++++++++++++++-- 14 files changed, 435 insertions(+), 25 deletions(-) create mode 100644 cmake/PatchHnswlibPrefetch.cmake create mode 100644 cmake/hnswlib-prefetch-bounds.patch diff --git a/CMakeLists.txt b/CMakeLists.txt index ebd8de63..61625c57 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -169,6 +169,15 @@ FetchContent_Declare( GIT_TAG d9b3608c83d83b46c96e25088cb1d729b29dcfe9 ) FetchContent_MakeAvailable(hnswlib) +execute_process( + COMMAND "${CMAKE_COMMAND}" + "-DHNSWLIB_SOURCE_DIR=${hnswlib_SOURCE_DIR}" + -P "${CMAKE_CURRENT_SOURCE_DIR}/cmake/PatchHnswlibPrefetch.cmake" + RESULT_VARIABLE _cortext_hnswlib_patch_result +) +if(NOT _cortext_hnswlib_patch_result EQUAL 0) + message(FATAL_ERROR "Failed to prepare the pinned hnswlib source") +endif() set(BUILD_TESTING "${_cortext_saved_dependency_build_testing}") # diff --git a/artifacts/flat_storage_cost/paper-traceability-audit-v2.json b/artifacts/flat_storage_cost/paper-traceability-audit-v2.json index fb226e4b..4fd6ff2e 100644 --- a/artifacts/flat_storage_cost/paper-traceability-audit-v2.json +++ b/artifacts/flat_storage_cost/paper-traceability-audit-v2.json @@ -1,14 +1,14 @@ { "generated_claim_mismatches": [], - "inventory_count": 69, - "manifest_sha256": "06e028939212980df3bd9e9fa655b20901cde1b3652e3a843ecc8dbfb47e0cf2", - "manuscript_sha256": "f7ed5d59cadeb0cc3194da92ea4f574e20f0a030e5aa28e6ff54cefdd44a43de", + "inventory_count": 70, + "manifest_sha256": "0d7efbbe58f17631c33e24e998444d63021e9698db7e771bba51c8543798f65f", + "manuscript_sha256": "57fd68f04ee13753c0d7c847ccf79967d9cbe58efef4ac80df4c212a310e9362", "missing_source_claims": [], "ownership_violations": [], "passed": true, "proof_level_violations": [], - "record_count": 69, + "record_count": 70, "schema": "cortext_paper_traceability_audit_v1", - "state_sha256": "2eb2b31546cce94912c8d378edbfb6dfcdf0449f42f059bb70b930756d2bf7f5", + "state_sha256": "462a0dbf926ab989468f39fe521dc3dac587e68e513d994a6de19a68b7c62f7d", "uncovered_inventory": [] } diff --git a/artifacts/flat_storage_cost/paper-traceability-current-state-v2.json b/artifacts/flat_storage_cost/paper-traceability-current-state-v2.json index 7561782a..e1489d13 100644 --- a/artifacts/flat_storage_cost/paper-traceability-current-state-v2.json +++ b/artifacts/flat_storage_cost/paper-traceability-current-state-v2.json @@ -112,5 +112,47 @@ "production-wide boundedness is not claimed", "merge, release, deployment, and publication are not authorized" ] + }, + "pr6_exact_head_ci_repair": { + "decision": "repair-review-and-exact-head-ci-before-disposition", + "prior_exact_head": "5f2e3b38edbc5d582b2a0cbb37d7ec10f8ceb1cb", + "review_thread": "https://github.com/augmem/cortext/pull/6#discussion_r3609254976", + "repairs": [ + "calibrate migrated lazy-RIF state transactionally before working-memory hydration and rebuild the disposable epoch from committed persistent authority", + "bound pinned hnswlib speculative neighbor prefetches by actual adjacency length without disabling SIMD distance kernels", + "perform knob-derived cache-byte multiplication explicitly in std::size_t for WebAssembly width portability" + ], + "source_sha256": { + "signal_processor": "7d255a3db0b4e9f0dcedac9fa841d093b1ad39af3c90af43969a17aba481e07b", + "rif_cache_header": "55985ae0d5d0d69480ae3a3d8204779faec8b23f2051e2e924b8de31e1d130a8", + "hnswlib_patch": "442aceca09c022cd2043a08c3d508cb5a608565f94b64e8fa74df6abe71510c4", + "hnswlib_patch_driver": "3506b957d155d0994cd975d12d93e3bdb60f0d205b13dc496b474aeb73e8662a", + "hnsw_repair_test": "6d0f997e6d398cb056082649073b8ce6deeeaac93c9c43f1c37c9cb0b133d601" + }, + "local_proof": { + "full_media_ctest": "39,175 assertions in 690 cases; 1/1 passed in 287.44 seconds", + "rif_focus": "312 assertions in 19 cases", + "hnsw_focus": "19 assertions in 2 cases, including an empty upper-layer adjacency repair", + "wasm_bundle": "built successfully with Emscripten 4.0.18", + "test_binary_sha256": "44e975cffd7d698ee24b2f7c43ffaccd8c86655c617d192224da8b22da992f7c", + "wasm_sha256": "17d31e0a61327e91d7a53577b73689442583d5f4c84aa76d5844ac309e9791aa" + }, + "sanitizer_proof": { + "local_status": "blocked-before-main-by-sandboxed-macos-asan-dynamic-shadow-discovery", + "required_owner": "exact-head GitHub Linux sanitizer check" + }, + "retrieval_quality_authority": "unchanged historical 4,608-query production matrix; this repair does not rerun or broaden that evidence", + "operation_ownership": { + "natural_durable_shared_algorithm": true, + "durable_addition": "post-commit flush/checkpoint barrier only", + "source_id_branch": false, + "modality_branch": false + }, + "unresolved_limits": [ + "exact-head Linux sanitizer proof is pending", + "whole-engine raw process reset is not proven", + "bounded whole-engine restart is not proven", + "Durable plateau and production-wide boundedness are not claimed" + ] } } diff --git a/artifacts/flat_storage_cost/paper-traceability-manifest-v1.json b/artifacts/flat_storage_cost/paper-traceability-manifest-v1.json index 61625a9d..d76e4fdc 100644 --- a/artifacts/flat_storage_cost/paper-traceability-manifest-v1.json +++ b/artifacts/flat_storage_cost/paper-traceability-manifest-v1.json @@ -797,6 +797,23 @@ "the paper claim is limited to the recorded proof scope" ] }, + { + "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", + "decision": "repair-review-and-exact-head-ci-before-disposition", + "evidence_fingerprints": [ + "271d8f3eece933f293384f6f2f04c7c97f83bb7978e012605443cf2c8809f51c" + ], + "evidence_kind": "measured", + "inventory_id": "state:pr6_exact_head_ci_repair", + "proof_level": "source-health", + "source_section": { + "heading": "Experiment and algorithm traceability inventory", + "path": "docs/paper/sections/11_optimization.qmd" + }, + "unresolved_limits": [ + "the paper claim is limited to the recorded proof scope" + ] + }, { "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", "decision": "retain-feasibility-only-require-live-surface-mutation-capture-before-candidate-decision", diff --git a/cmake/PatchHnswlibPrefetch.cmake b/cmake/PatchHnswlibPrefetch.cmake new file mode 100644 index 00000000..ce4da3eb --- /dev/null +++ b/cmake/PatchHnswlibPrefetch.cmake @@ -0,0 +1,31 @@ +if(NOT DEFINED HNSWLIB_SOURCE_DIR) + message(FATAL_ERROR "HNSWLIB_SOURCE_DIR is required") +endif() + +set(_patch "${CMAKE_CURRENT_LIST_DIR}/hnswlib-prefetch-bounds.patch") +execute_process( + COMMAND git -C "${HNSWLIB_SOURCE_DIR}" apply --check "${_patch}" + RESULT_VARIABLE _apply_check + OUTPUT_QUIET + ERROR_QUIET +) +if(_apply_check EQUAL 0) + execute_process( + COMMAND git -C "${HNSWLIB_SOURCE_DIR}" apply "${_patch}" + RESULT_VARIABLE _apply_result + ) + if(NOT _apply_result EQUAL 0) + message(FATAL_ERROR "Failed to apply the hnswlib prefetch bounds patch") + endif() +else() + execute_process( + COMMAND git -C "${HNSWLIB_SOURCE_DIR}" apply --reverse --check "${_patch}" + RESULT_VARIABLE _reverse_check + OUTPUT_QUIET + ERROR_QUIET + ) + if(NOT _reverse_check EQUAL 0) + message(FATAL_ERROR + "Pinned hnswlib source does not match the prefetch bounds patch") + endif() +endif() diff --git a/cmake/hnswlib-prefetch-bounds.patch b/cmake/hnswlib-prefetch-bounds.patch new file mode 100644 index 00000000..c7e67c20 --- /dev/null +++ b/cmake/hnswlib-prefetch-bounds.patch @@ -0,0 +1,82 @@ +diff --git a/hnswlib/hnswalg.h b/hnswlib/hnswalg.h +index f516df5..6240b2f 100644 +--- a/hnswlib/hnswalg.h ++++ b/hnswlib/hnswalg.h +@@ -264,18 +264,23 @@ class HierarchicalNSW : public AlgorithmInterface { + size_t size = getListCount((linklistsizeint*)data); + tableint *datal = (tableint *) (data + 1); + #ifdef USE_SSE +- _mm_prefetch((char *) (visited_array + *(data + 1)), _MM_HINT_T0); +- _mm_prefetch((char *) (visited_array + *(data + 1) + 64), _MM_HINT_T0); +- _mm_prefetch(getDataByInternalId(*datal), _MM_HINT_T0); +- _mm_prefetch(getDataByInternalId(*(datal + 1)), _MM_HINT_T0); ++ if (size > 0) { ++ _mm_prefetch((char *) (visited_array + *(data + 1)), _MM_HINT_T0); ++ _mm_prefetch((char *) (visited_array + *(data + 1) + 64), _MM_HINT_T0); ++ _mm_prefetch(getDataByInternalId(*datal), _MM_HINT_T0); ++ } ++ if (size > 1) ++ _mm_prefetch(getDataByInternalId(*(datal + 1)), _MM_HINT_T0); + #endif + + for (size_t j = 0; j < size; j++) { + tableint candidate_id = *(datal + j); + // if (candidate_id == 0) continue; + #ifdef USE_SSE +- _mm_prefetch((char *) (visited_array + *(datal + j + 1)), _MM_HINT_T0); +- _mm_prefetch(getDataByInternalId(*(datal + j + 1)), _MM_HINT_T0); ++ if (j + 1 < size) { ++ _mm_prefetch((char *) (visited_array + *(datal + j + 1)), _MM_HINT_T0); ++ _mm_prefetch(getDataByInternalId(*(datal + j + 1)), _MM_HINT_T0); ++ } + #endif + if (visited_array[candidate_id] == visited_array_tag) continue; + visited_array[candidate_id] = visited_array_tag; +@@ -368,19 +373,23 @@ class HierarchicalNSW : public AlgorithmInterface { + } + + #ifdef USE_SSE +- _mm_prefetch((char *) (visited_array + *(data + 1)), _MM_HINT_T0); +- _mm_prefetch((char *) (visited_array + *(data + 1) + 64), _MM_HINT_T0); +- _mm_prefetch(data_level0_memory_ + (*(data + 1)) * size_data_per_element_ + offsetData_, _MM_HINT_T0); +- _mm_prefetch((char *) (data + 2), _MM_HINT_T0); ++ if (size > 0) { ++ _mm_prefetch((char *) (visited_array + *(data + 1)), _MM_HINT_T0); ++ _mm_prefetch((char *) (visited_array + *(data + 1) + 64), _MM_HINT_T0); ++ _mm_prefetch(data_level0_memory_ + (*(data + 1)) * size_data_per_element_ + offsetData_, _MM_HINT_T0); ++ _mm_prefetch((char *) (data + 2), _MM_HINT_T0); ++ } + #endif + + for (size_t j = 1; j <= size; j++) { + int candidate_id = *(data + j); + // if (candidate_id == 0) continue; + #ifdef USE_SSE +- _mm_prefetch((char *) (visited_array + *(data + j + 1)), _MM_HINT_T0); +- _mm_prefetch(data_level0_memory_ + (*(data + j + 1)) * size_data_per_element_ + offsetData_, +- _MM_HINT_T0); //////////// ++ if (j < size) { ++ _mm_prefetch((char *) (visited_array + *(data + j + 1)), _MM_HINT_T0); ++ _mm_prefetch(data_level0_memory_ + (*(data + j + 1)) * size_data_per_element_ + offsetData_, ++ _MM_HINT_T0); //////////// ++ } + #endif + if (!(visited_array[candidate_id] == visited_array_tag)) { + visited_array[candidate_id] = visited_array_tag; +@@ -1088,12 +1097,14 @@ class HierarchicalNSW : public AlgorithmInterface { + data = get_linklist_at_level(currObj, level); + int size = getListCount(data); + tableint *datal = (tableint *) (data + 1); + #ifdef USE_SSE +- _mm_prefetch(getDataByInternalId(*datal), _MM_HINT_T0); ++ if (size > 0) ++ _mm_prefetch(getDataByInternalId(*datal), _MM_HINT_T0); + #endif + for (int i = 0; i < size; i++) { + #ifdef USE_SSE +- _mm_prefetch(getDataByInternalId(*(datal + i + 1)), _MM_HINT_T0); ++ if (i + 1 < size) ++ _mm_prefetch(getDataByInternalId(*(datal + i + 1)), _MM_HINT_T0); + #endif + tableint cand = datal[i]; + dist_t d = fstdistfunc_(dataPoint, getDataByInternalId(cand), dist_func_param_); diff --git a/comments/consolidation-drift-retrigger/20260716T205900Z-orchestrator-goal-mdscript-converted.mdscript.md b/comments/consolidation-drift-retrigger/20260716T205900Z-orchestrator-goal-mdscript-converted.mdscript.md index befa3ad7..8e3f6d7f 100644 --- a/comments/consolidation-drift-retrigger/20260716T205900Z-orchestrator-goal-mdscript-converted.mdscript.md +++ b/comments/consolidation-drift-retrigger/20260716T205900Z-orchestrator-goal-mdscript-converted.mdscript.md @@ -5,13 +5,13 @@ owner_role: implementer lane_id: consolidation-drift-retrigger status: monitoring implementation_status: complete -monitor_status: activating +monitor_status: repair-reviewed-push-pending source_of_truth: current repository, current user corrections, this goal, task comments, exact private profiles and audits, and GitHub PR 6 only after implementation completion model: gpt-5.6-terra reasoning: high model_selection_basis: cross-cutting C++ and SQLite implementation, deterministic bounded-work proof, research traceability, and PR ownership canonical_monitor_entry: true -updated_at: 20260721T051726Z +updated_at: 20260721T072347Z --- @@ -36,15 +36,15 @@ updated_at: 20260721T051726Z * the mature extended suffix shows store growth without continuing per-store work growth: non-overlapping late-half mean process fell 8.918 to 7.858 ms, graph seed-cache time fell 2.914 to 2.397 ms with per-node unit ratio 0.789, and supersession loading fell 1.860 to 1.520 ms with per-candidate unit ratio 0.855 * the no-selector 2,016-message Durable run processed four consolidations in 79,481 ms with mean process 10.709666 ms and mean total 39.024183 ms; all 512 controls passed top-1, recall@16, semantic coverage, and ties at 1.0 with four opaque sources; its horizon is insufficient for ten post-warmup 500-event windows and therefore does not prove Durable plateau * focused production-default derivation, route work, active-epoch reset, shared Natural/Durable path, Durable-barrier non-replay, source/modality, Python audit, and evidence-builder tests pass on the current release build -* all algorithm and experiment changes, accepted adverse timing, maturity boundary, failed-recenter rollback repair, and nonclaims are recorded in `docs/paper/sections/10_implementation.qmd` and `docs/paper/sections/11_optimization.qmd`; the regenerated manuscript SHA-256 is `f7ed5d59cadeb0cc3194da92ea4f574e20f0a030e5aa28e6ff54cefdd44a43de` -* the full media-enabled CTest suite passes 39,151 assertions in 688 cases, including failure injection proving a failed recenter preserves the existing effort and node budget; the complete Python tool suite passes 159 tests; `git diff --check` passes -* the current-state overlay, rebuilt 69-record manifest, and fail-closed audit have SHA-256 values `89b32a782b0164e82c1b76e230baabdd47827aab00355ec817aaab40e18eb354`, `18f544b6b4cd0d0e7337d99e2381fa7c346d304bf083f265a5b5151beb275ae0`, and `53a648cd6e3c6079c6ade1cd175a1617caf180714e72152c7f37d6ca14a7443f`; the audit passes with 69/69 inventory records and no uncovered inventory, claim mismatch, proof-level violation, or ownership violation -* the recursive blind-review loop is complete: round-one and round-two findings were repaired, and the fresh round-three cumulative reviewer proved the scoped implementation/source-health claim at P1 with no findings or residuals -* the verified tree was committed and pushed without force as `6ac1e3121e4be9aa456c7ac93fdb4b09ea34023d`; PR 6 was updated with the current contract, proof, review trail, and nonclaims; exact-head CI is in progress +* all algorithm and experiment changes, accepted adverse timing, maturity boundary, failed-recenter rollback repair, exact-head CI repairs, and nonclaims are recorded in `docs/paper/sections/10_implementation.qmd` and `docs/paper/sections/11_optimization.qmd`; the regenerated manuscript SHA-256 is `57fd68f04ee13753c0d7c847ccf79967d9cbe58efef4ac80df4c212a310e9362` +* the current full media-enabled CTest suite passes 39,175 assertions in 690 cases in 287.44 seconds; focused RIF passes 312 assertions in 19 cases; the two HNSW CI regressions pass 19 assertions; WebAssembly rebuilds successfully with Emscripten 4.0.18; the complete Python tool suite passes 159 tests; patch removal/reapplication and `git diff --check` pass +* the current-state overlay, rebuilt 70-record manifest, and fail-closed audit have raw-file SHA-256 values `39f5f41a7b126c46c859abb8bb2a67b14a2b14e8644a6f78355f4f86c6b46a1e`, `ebc47507bea5ed41311c6f52a4567b2a5ad610d0334d0bba83dc86c7aafd0b66`, and `cea9dfdca7aa8a4db57b82704963e9314386c9bd6ef2f07327c9b7f0b478bacf`; the audit passes with 70/70 inventory records and no uncovered inventory, claim mismatch, proof-level violation, or ownership violation +* the original recursive cutover review remains complete. The exact-head CI repair then received a fresh round one that found one P2 unguarded empty-adjacency HNSW prefetch; repair tree `d3ce8c1ada4ab13023cbcd40959c8a8a878b5307` guards it and adds deterministic update/reseal coverage. A different fresh round-two reviewer proved the complete repair at the P1/P2 threshold with no blocking finding. Its sole P3 control-record hygiene residual was corrected directly; because that correction rewrote an existing continuation record and violated append-only provenance, the later single-pass record-transition review rejected the record transition and `~/.agents/projects/cortext/comments/consolidation-drift-retrigger/20260721T072347Z-implementer-pr6-record-transition-correction.mdscript.md` now discloses the mutation, supersedes the compromised continuation, synchronizes the task, and restores the missing lane-ledger history without changing code or proof +* current PR head `5f2e3b38edbc5d582b2a0cbb37d7ec10f8ceb1cb` remains OPEN, non-draft, MERGEABLE/UNSTABLE on base `1bf3f1c5f6470bb8c4d458a0389c19c5123f9b81` with ten green checks, failed Linux sanitizer and WebAssembly checks, no review requests, and one unresolved RIF startup-order thread. Repair tree `d3ce8c1ada4ab13023cbcd40959c8a8a878b5307` is reviewed and locally proven but not yet committed or pushed; repaired-tree Linux sanitizer proof remains owned by replacement exact-head CI because sandboxed macOS ASAN cannot complete dynamic-shadow discovery before `main()` ## PR Monitor Hot Path -* implementation, proof, paper, recursive review, branch push, and PR update are complete; do not reopen implementation without changed CI, review, discussion, conflict, or base-drift evidence +* changed exact-head CI and review evidence reopened only the RIF startup-order, HNSW speculative-prefetch, and WebAssembly width slice. That repair is locally proven and recursively reviewed; next validate this record once, commit and push without force, reply to and resolve the owning thread, then monitor replacement exact-head CI * every ten minutes in this current task, refresh PR 6 exact head, checks, mergeability, reviews, review requests, comments, and unresolved threads; compare with the prior state and report only changes * repair only in-scope failures or review findings with proportionate proof and the required fresh review; push without force and update this goal to the new exact head * stop and deactivate the heartbeat when the PR merges or closes externally, repair exceeds scope, target drift is unrecoverable, or authority is explicitly denied diff --git a/docs/paper/_manuscript/index.md b/docs/paper/_manuscript/index.md index 5908778c..0d9b7dda 100644 --- a/docs/paper/_manuscript/index.md +++ b/docs/paper/_manuscript/index.md @@ -5523,6 +5523,14 @@ because aliases, wildcards, views, subqueries, and triggers cannot be classified safely from SQL text. A caller mutation also invalidates every database-derived processor cache before the statement executes. +On startup from schema 27, migration may anchor active rows that carry +different historical suppression timestamps to one recovery clock. The +processor calibrates those rows transactionally and rebuilds the +disposable active epoch before working-memory hydration reads the +effective-value view. This ordering prevents restart from seeding a +working slot with an uncalibrated strength and subsequently persisting +that stale value. + The authoritative signal mutation still commits once to persistent SQLite. After that commit, a separate connection-local in-memory SQLite database publishes only the current recovery clock and the identities @@ -5619,6 +5627,15 @@ operations and mutations; Durable adds only the existing post-commit flush/checkpoint barrier. None of these bounds branches on modality or source identifier. +The pinned HNSW implementation retains its SIMD distance kernels, while +a content-checked local patch bounds every speculative neighbor prefetch +by the actual adjacency length. This prevents a sanitizer-visible +one-past-end read without changing candidate membership or ranking. +Cache-byte estimation also performs its knob-derived multiplication +explicitly in `std::size_t`, keeping the same capacity on native and +WebAssembly targets instead of relying on an implicit 64-to-32-bit +narrowing conversion. + ### Bounded activation observation shadow A separate private experiment observes whether long-lived retrieval can @@ -9282,6 +9299,19 @@ whole-engine reset, bounded restart, Durable plateau, release, and deployment remain unclaimed. +TRACE[state:pr6_exact_head_ci_repair] +PR-monitor repair record: migrated active RIF rows are calibrated +before working-memory hydration; pinned HNSW speculative neighbor +prefetches are adjacency-bounded without disabling SIMD distance +kernels; and cache-byte arithmetic uses explicit +std::size_t width for WebAssembly. The full media CTest, +focused RIF and HNSW regressions, and WebAssembly bundle build pass +locally. The sandboxed macOS ASAN runtime cannot complete dynamic-shadow +discovery before main(), so exact-head Linux sanitizer CI +remains the required owner; the historical 4,608-query quality matrix is +not relabeled as evidence from the repaired binary. + + TRACE[state:hnsw_fixed_6c_experiment] Rejected knob-derived fixed-6C routing envelope. All 27 diff --git a/docs/paper/sections/10_implementation.qmd b/docs/paper/sections/10_implementation.qmd index 228a06af..261e1be1 100644 --- a/docs/paper/sections/10_implementation.qmd +++ b/docs/paper/sections/10_implementation.qmd @@ -101,6 +101,13 @@ statement because aliases, wildcards, views, subqueries, and triggers cannot be classified safely from SQL text. A caller mutation also invalidates every database-derived processor cache before the statement executes. +On startup from schema 27, migration may anchor active rows that carry +different historical suppression timestamps to one recovery clock. The +processor calibrates those rows transactionally and rebuilds the disposable +active epoch before working-memory hydration reads the effective-value view. +This ordering prevents restart from seeding a working slot with an +uncalibrated strength and subsequently persisting that stale value. + The authoritative signal mutation still commits once to persistent SQLite. After that commit, a separate connection-local in-memory SQLite database publishes only the current recovery clock and the identities touched in the @@ -197,6 +204,14 @@ execute these same operations and mutations; Durable adds only the existing post-commit flush/checkpoint barrier. None of these bounds branches on modality or source identifier. +The pinned HNSW implementation retains its SIMD distance kernels, while a +content-checked local patch bounds every speculative neighbor prefetch by the +actual adjacency length. This prevents a sanitizer-visible one-past-end read +without changing candidate membership or ranking. Cache-byte estimation also +performs its knob-derived multiplication explicitly in `std::size_t`, keeping +the same capacity on native and WebAssembly targets instead of relying on an +implicit 64-to-32-bit narrowing conversion. + ### Bounded activation observation shadow A separate private experiment observes whether long-lived retrieval can use a diff --git a/docs/paper/sections/11_optimization.qmd b/docs/paper/sections/11_optimization.qmd index 775160e8..5d8c55f8 100644 --- a/docs/paper/sections/11_optimization.qmd +++ b/docs/paper/sections/11_optimization.qmd @@ -1633,6 +1633,7 @@ observation-only result is never promoted to production-path proof. | `TRACE[state:sqlite_hnsw_sparse_route_integration]` | Retained row-addressed SQLite HNSW query and incremental seal in the existing `GraphRetrieve` and `MemoryStorage` paths; Natural and Durable share the same algorithm, and Durable adds only its checkpoint. Current full-corpus retrieval quality and activation bounds pass, while the Natural whole-engine plateau and Durable horizon gates remain open. | | `TRACE[state:sqlite_hnsw_activation_effort_cycle]` | Queue-effort-only, fixed-$5C$, and dynamic $4C$ through $8C$ floor variants were rejected or superseded. The retained candidate resets routing work to $8C$, advances by $R=\max(2,\lfloor B/16\rfloor)$ to $9C$, keeps $A=2C+2B$ downstream activation and $2B/(C+B)$ construction, passes the 30,380-packet mature-cycle gates at 511/512 top-1 and recall@16 0.999265, and passes canonical and nine-point quality without an engine-wide plateau claim. | | `TRACE[state:sqlite_hnsw_production_cutover]` | Retained the existing SQLite HNSW route as the production default at an $8C$ post-consolidation floor, $R=\max(2,\lfloor B/16\rfloor)$ step, $9C$ ceiling, separate $A=2C+2B$ snapshot, and $9C+A$ total row ceiling. The nine-point matrix passed 4,608/4,608 top-1 controls, minimum recall@16 and semantic coverage 1.0, deterministic ties, and source/modality-label invariance. Natural and Durable share the operation path, with Durable adding only its checkpoint; whole-engine reset, bounded restart, Durable plateau, release, and deployment remain unclaimed. | +| `TRACE[state:pr6_exact_head_ci_repair]` | PR-monitor repair record: migrated active RIF rows are calibrated before working-memory hydration; pinned HNSW speculative neighbor prefetches are adjacency-bounded without disabling SIMD distance kernels; and cache-byte arithmetic uses explicit `std::size_t` width for WebAssembly. The full media CTest, focused RIF and HNSW regressions, and WebAssembly bundle build pass locally. The sandboxed macOS ASAN runtime cannot complete dynamic-shadow discovery before `main()`, so exact-head Linux sanitizer CI remains the required owner; the historical 4,608-query quality matrix is not relabeled as evidence from the repaired binary. | | `TRACE[state:hnsw_fixed_6c_experiment]` | Rejected knob-derived fixed-$6C$ routing envelope. All 27 structural F/S/T points and 931 assertions passed; neutral $C=512$ produced a 3,072-node envelope while $B=128$ and the 129 boundary remained distinct. An extra production-default F=.45/S=.5/T=.5 pre-screen missed exact top-1, recall@16, plateau, and wall-time gates, so fail-fast rejected the candidate before the exact nine-point corpus matrix started and left production on fixed $5C$. | | `TRACE[state:post_rif_empty_fixed_envelope_attribution]` | Repaired proof classification for the retained zero-increment fixed-$5C/5C$ route. Retrieval mode is independent of whole-engine process shape; route-active rows fail closed on missing work, and queue, node ceiling, actual visits, distance work, and activation are checked separately across at least ten mature unchanged-envelope recenters. The production suffix beginning at event 10,195 passes the classifier and work envelope across 12 complete recenters, while activated-identity overlap, process-cycle reset, exact full-horizon retrieval, Durable horizon, and bounded restart remain open. | | `TRACE[state:write_gate_incidence_attribution_v2]` | Deterministic range-bound observation-only 15,695-packet production-knob attribution rejected boundary-to-write incidence as the growth source: exact event ranges 0--2,499 and 13,195--15,694 contained 510 and 528 writes, while MemoryStorage time per write rose from 0.4833 to 2.8343 ms as the existing shared SQLite HNSW route warmed toward the fixed $5C=2{,}495$ envelope. Production $C/B/A=499/125/1{,}248$ and construction $C+B/2B=624/250$ remain derived; neutral $C/B/A=512/128/1{,}280$ and 129 is only logical $B+1$. Raw reset remains failed and unwaived; 27 structural and nine production-shaped F/S/T ablations remain required. | diff --git a/src/operations/rif_active_epoch_cache_internal.hpp b/src/operations/rif_active_epoch_cache_internal.hpp index 8b208ac0..551d9ed7 100644 --- a/src/operations/rif_active_epoch_cache_internal.hpp +++ b/src/operations/rif_active_epoch_cache_internal.hpp @@ -43,7 +43,7 @@ DeriveLimits (double focus, double sensitivity, double stability) return { event_count, event_count * 64, - event_count * 128ULL * 1024ULL, + event_count * static_cast (128 * 1024), row_batch_size, }; } diff --git a/src/signal_processor.cpp b/src/signal_processor.cpp index def552cc..86fd86b5 100644 --- a/src/signal_processor.cpp +++ b/src/signal_processor.cpp @@ -116,6 +116,56 @@ EnsureRifActiveEpochCache (Store *store, ProcessorContext &context, } } +void +CalibrateRifActiveEpochBeforeHydration ( + Store &store, ProcessorContext &context, + const SignalProcessor::Config &config) +{ + EnsureRifActiveEpochCache (&store, context, config); + auto sidecar + = operations::execution_cache_sidecar_internal::Ensure (context); + if (!sidecar->rif_active_epoch.valid + || !sidecar->rif_active_epoch.database) + { + throw std::runtime_error ( + "Failed to prepare lazy RIF state before hydration"); + } + const auto memory_ids + = sidecar->rif_active_epoch.calibration_memory_ids; + if (memory_ids.empty ()) + return; + + auto transaction = store.Begin (); + try + { + operations::rif_state_internal::CalibrateMemoryIdsAtClock ( + *transaction, memory_ids, + core::RetrievalCompetitionRecoverySeconds (config.stability) + * 1000.0, + sidecar->rif_active_epoch.limits.row_batch_size); + transaction->Commit (); + } + catch (...) + { + try + { + transaction->Rollback (); + } + catch (...) + { + } + throw; + } + + // Rebuild the disposable epoch only from the calibrated persistent state. + // Startup hydration must never seed working slots from the pre-calibration + // effective view left by a schema-27 migration. + sidecar->rif_active_epoch.database.reset (); + sidecar->rif_active_epoch.valid = false; + sidecar->rif_active_epoch.calibration_memory_ids.clear (); + EnsureRifActiveEpochCache (&store, context, config); +} + double ElapsedMillis (std::chrono::steady_clock::time_point start, std::chrono::steady_clock::time_point end) @@ -3332,6 +3382,8 @@ SignalProcessor::SignalProcessor (const Config &config, if (store_) { cortext::store::ApplyMigrations (*store_); + CalibrateRifActiveEpochBeforeHydration ( + *store_, *context_, config_); if (!object_store_) { object_store_ = std::make_shared (store_); @@ -3352,7 +3404,6 @@ SignalProcessor::SignalProcessor (const Config &config, LoadWorkingMemory (*store_, *context_, config_, now_ms); // From MEMORIES LoadSoftAnchors (*store_, *context_); - EnsureRifActiveEpochCache (store_.get (), *context_, config_); operations::bounded_activation_shadow_internal::Initialize ( *context_, store_.get (), config_.focus, config_.sensitivity, config_.stability); diff --git a/tests/operations_graph_retrieval.test.cpp b/tests/operations_graph_retrieval.test.cpp index 2e603b87..2a23ac25 100644 --- a/tests/operations_graph_retrieval.test.cpp +++ b/tests/operations_graph_retrieval.test.cpp @@ -114,6 +114,51 @@ TEST_CASE ("Sparse retrieval route is deterministic across upsert and remove", REQUIRE (first->Search (UnitVec (0), 3)->front () == 10); } +TEST_CASE ("Sparse retrieval route repairs below an empty upper-layer entry", + "[operations][graph][retrieval][hnsw][regression]") +{ + using operations::sparse_retrieval_route_internal::NodeSnapshot; + using operations::sparse_retrieval_route_internal::Route; + std::vector> entries; + entries.reserve (72); + for (long long memory_id = 1; memory_id <= 72; ++memory_id) + entries.emplace_back ( + memory_id, UnitVec (static_cast (memory_id % kEmbeddingDim))); + + auto route = Route::Create ( + kEmbeddingDim, entries, + operations::sparse_retrieval_route_internal::DeriveParameters ( + 0.0, 0.0, 0.0)); + REQUIRE (route); + const auto snapshot = route->Snapshot ({}); + REQUIRE (snapshot); + REQUIRE (snapshot->max_level > 0); + const auto entry = std::find_if ( + snapshot->nodes.begin (), snapshot->nodes.end (), + [&] (const NodeSnapshot &node) { + return node.memory_id == snapshot->entry_memory_id; + }); + REQUIRE (entry != snapshot->nodes.end ()); + REQUIRE (entry->links.size () + > static_cast (snapshot->max_level)); + REQUIRE (entry->links[static_cast (snapshot->max_level)] + .empty ()); + const auto target = std::find_if ( + snapshot->nodes.begin (), snapshot->nodes.end (), + [&] (const NodeSnapshot &node) { + return node.level < snapshot->max_level; + }); + REQUIRE (target != snapshot->nodes.end ()); + + const long long target_memory_id = target->memory_id; + REQUIRE (route->Upsert (target_memory_id, UnitVec (200))); + REQUIRE (route->SealDelta ()); + const auto result = route->Search (UnitVec (200), 1); + REQUIRE (result); + REQUIRE (result->size () == 1); + REQUIRE (result->front () == target_memory_id); +} + TEST_CASE ("SQLite sparse route restart and query work stay row bounded", "[operations][graph][retrieval][hnsw][sqlite]") { diff --git a/tests/signal_processor.test.cpp b/tests/signal_processor.test.cpp index 0a81b6e9..b3056d39 100644 --- a/tests/signal_processor.test.cpp +++ b/tests/signal_processor.test.cpp @@ -129,13 +129,19 @@ MakeBoundedShadowSignal (std::uint64_t event_index, struct AdvanceRifEpochOp : IOperation { + explicit AdvanceRifEpochOp (double recovery_time_ms = 10000.0) + : recovery_time_ms (recovery_time_ms) + { + } + void Execute (OperationContext &ctx, Transaction &tx) const override { auto sidecar = operations::execution_cache_sidecar_internal::Ensure ( ctx.GetProcessorContext ()); const auto result = operations::rif_state_internal::AdvanceRecovery ( - tx, static_cast (ctx.GetSignal ().timestamp), 10000.0, + tx, static_cast (ctx.GetSignal ().timestamp), + recovery_time_ms, sidecar->rif_active_epoch.calibration_memory_ids, sidecar->rif_active_epoch.limits.row_batch_size); sidecar->rif_active_epoch.calibration_memory_ids.clear (); @@ -145,6 +151,8 @@ struct AdvanceRifEpochOp : IOperation operations::rif_active_epoch_cache_internal::StageMemories ( sidecar->rif_active_epoch, result.changed_memory_ids); } + + double recovery_time_ms; }; struct AdvanceRifAndFailCommitOnceOp : IOperation @@ -2337,8 +2345,10 @@ TEST_CASE ("Processor calibrates staggered lazy RIF migration timestamps", SignalProcessor::Config cfg; cortext::testing::RequireEncoder (cfg); + const double recovery_time_ms + = core::RetrievalCompetitionRecoverySeconds (cfg.stability) * 1000.0; auto root = std::make_unique ( - std::make_unique ()); + std::make_unique (recovery_time_ms)); SignalProcessor processor ( cfg, store, operations::signal_record_rollback_internal:: @@ -2354,14 +2364,21 @@ TEST_CASE ("Processor calibrates staggered lazy RIF migration timestamps", "SELECT memory_id, strength, suppression FROM rif_effective_memories " "ORDER BY memory_id"); REQUIRE (rows.size () == 2); + const auto expected_strength = [recovery_time_ms] ( + long long now_ts, + long long suppression_ts) { + return 0.5 + + 0.5 * static_cast (now_ts - suppression_ts) + / recovery_time_ms; + }; REQUIRE (std::any_cast (rows[0].at ("strength")) - == Catch::Approx (0.55)); + == Catch::Approx (expected_strength (2000, 1000))); REQUIRE (std::any_cast (rows[0].at ("suppression")) - == Catch::Approx (0.45)); + == Catch::Approx (1.0 - expected_strength (2000, 1000))); REQUIRE (std::any_cast (rows[1].at ("strength")) - == Catch::Approx (0.525)); + == Catch::Approx (expected_strength (2000, 1500))); REQUIRE (std::any_cast (rows[1].at ("suppression")) - == Catch::Approx (0.475)); + == Catch::Approx (1.0 - expected_strength (2000, 1500))); signal.timestamp = 3000; processor.Process (signal); @@ -2370,13 +2387,83 @@ TEST_CASE ("Processor calibrates staggered lazy RIF migration timestamps", "ORDER BY memory_id"); REQUIRE (continued_rows.size () == 2); REQUIRE (std::any_cast (continued_rows[0].at ("strength")) - == Catch::Approx (0.595)); + == Catch::Approx (expected_strength (3000, 1000))); REQUIRE (std::any_cast (continued_rows[0].at ("suppression")) - == Catch::Approx (0.405)); + == Catch::Approx (1.0 - expected_strength (3000, 1000))); REQUIRE (std::any_cast (continued_rows[1].at ("strength")) - == Catch::Approx (0.5725)); + == Catch::Approx (expected_strength (3000, 1500))); REQUIRE (std::any_cast (continued_rows[1].at ("suppression")) - == Catch::Approx (0.4275)); + == Catch::Approx (1.0 - expected_strength (3000, 1500))); +} + +TEST_CASE ("Processor calibrates migrated RIF before hydrating working slots", + "[processor][rif][migration][working_memory][restart]") +{ + constexpr long long kEarlySuppressionTs = 1'000; + constexpr long long kMigrationClockTs = 1'001'000; + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + cortext::store::DebugApplyCoreMigrationsThroughForTest (*store, 27); + cortext::testing::SeedEmbeddingV2 ( + *store, 100, std::vector (256, 0.125f), kMigrationClockTs); + cortext::testing::SeedEmbeddingV2 ( + *store, 101, std::vector (256, 0.25f), kMigrationClockTs); + store->Execute ( + "INSERT INTO memories(memory_id, embedding_id, source_id, kind, " + "modality, start_ts, n_signals, strength, last_access, " + "strength_updated_at, suppression, suppression_ts, created_at) VALUES" + "(1, 100, 'working/early', 'WORKING', 'text', 1000, 1, 0.5, ?, ?, " + "0.5, ?, 1000)," + "(2, 101, 'working/clock', 'WORKING', 'image', 2000, 1, 0.5, ?, ?, " + "0.5, ?, 2000)", + { kMigrationClockTs, kMigrationClockTs, kEarlySuppressionTs, + kMigrationClockTs, kMigrationClockTs, kMigrationClockTs }); + + SignalProcessor::Config cfg; + cortext::testing::RequireEncoder (cfg); + cfg.focus = 0.5; + cfg.sensitivity = 0.5; + cfg.stability = 0.5; + cfg.clock = std::make_shared (kMigrationClockTs); + ProcessorContext *captured = nullptr; + auto capture = std::make_unique (); + capture->context_address = &captured; + auto root = std::make_unique (std::move (capture)); + SignalProcessor processor ( + cfg, store, + operations::signal_record_rollback_internal:: + MarkEngineOwnedJournalAware (std::move (root))); + + Signal signal; + signal.embedding = Eigen::VectorXf::Zero (256); + signal.source_id = "working/probe"; + signal.timestamp = kMigrationClockTs; + processor.Process (signal); + + REQUIRE (captured); + REQUIRE (captured->wm_slots.size () == 2); + const double recovery_time_ms + = core::RetrievalCompetitionRecoverySeconds (cfg.stability) * 1000.0; + const double recovered_fraction + = static_cast (kMigrationClockTs - kEarlySuppressionTs) + / recovery_time_ms; + REQUIRE (captured->wm_slots[0].memory_id == 1); + REQUIRE (captured->wm_slots[0].strength + == Catch::Approx (0.5 + 0.5 * recovered_fraction)); + REQUIRE (captured->wm_slots[1].memory_id == 2); + REQUIRE (captured->wm_slots[1].strength == Catch::Approx (0.5)); + const auto sidecar = ExecutionCacheState (*captured); + REQUIRE (sidecar); + REQUIRE (sidecar->rif_active_epoch.valid); + REQUIRE (sidecar->rif_active_epoch.calibration_memory_ids.empty ()); + + const auto effective = store->Execute ( + "SELECT memory_id, strength FROM rif_effective_memories " + "ORDER BY memory_id"); + REQUIRE (effective.size () == 2); + REQUIRE (std::any_cast (effective[0].at ("strength")) + == Catch::Approx (0.5 + 0.5 * recovered_fraction)); + REQUIRE (std::any_cast (effective[1].at ("strength")) + == Catch::Approx (0.5)); } TEST_CASE ("Migrated active working slots reanchor persisted strength", From b7f9e27e019e5e4d4e95019a1e75742583970a86 Mon Sep 17 00:00:00 2001 From: gabewillen Date: Tue, 21 Jul 2026 02:29:10 -0500 Subject: [PATCH 11/18] Transition PR monitor to replacement CI --- ...5900Z-orchestrator-goal-mdscript-converted.mdscript.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/comments/consolidation-drift-retrigger/20260716T205900Z-orchestrator-goal-mdscript-converted.mdscript.md b/comments/consolidation-drift-retrigger/20260716T205900Z-orchestrator-goal-mdscript-converted.mdscript.md index 8e3f6d7f..7669a1f8 100644 --- a/comments/consolidation-drift-retrigger/20260716T205900Z-orchestrator-goal-mdscript-converted.mdscript.md +++ b/comments/consolidation-drift-retrigger/20260716T205900Z-orchestrator-goal-mdscript-converted.mdscript.md @@ -5,13 +5,13 @@ owner_role: implementer lane_id: consolidation-drift-retrigger status: monitoring implementation_status: complete -monitor_status: repair-reviewed-push-pending +monitor_status: replacement-exact-head-ci-pending source_of_truth: current repository, current user corrections, this goal, task comments, exact private profiles and audits, and GitHub PR 6 only after implementation completion model: gpt-5.6-terra reasoning: high model_selection_basis: cross-cutting C++ and SQLite implementation, deterministic bounded-work proof, research traceability, and PR ownership canonical_monitor_entry: true -updated_at: 20260721T072347Z +updated_at: 20260721T072800Z --- @@ -40,11 +40,11 @@ updated_at: 20260721T072347Z * the current full media-enabled CTest suite passes 39,175 assertions in 690 cases in 287.44 seconds; focused RIF passes 312 assertions in 19 cases; the two HNSW CI regressions pass 19 assertions; WebAssembly rebuilds successfully with Emscripten 4.0.18; the complete Python tool suite passes 159 tests; patch removal/reapplication and `git diff --check` pass * the current-state overlay, rebuilt 70-record manifest, and fail-closed audit have raw-file SHA-256 values `39f5f41a7b126c46c859abb8bb2a67b14a2b14e8644a6f78355f4f86c6b46a1e`, `ebc47507bea5ed41311c6f52a4567b2a5ad610d0334d0bba83dc86c7aafd0b66`, and `cea9dfdca7aa8a4db57b82704963e9314386c9bd6ef2f07327c9b7f0b478bacf`; the audit passes with 70/70 inventory records and no uncovered inventory, claim mismatch, proof-level violation, or ownership violation * the original recursive cutover review remains complete. The exact-head CI repair then received a fresh round one that found one P2 unguarded empty-adjacency HNSW prefetch; repair tree `d3ce8c1ada4ab13023cbcd40959c8a8a878b5307` guards it and adds deterministic update/reseal coverage. A different fresh round-two reviewer proved the complete repair at the P1/P2 threshold with no blocking finding. Its sole P3 control-record hygiene residual was corrected directly; because that correction rewrote an existing continuation record and violated append-only provenance, the later single-pass record-transition review rejected the record transition and `~/.agents/projects/cortext/comments/consolidation-drift-retrigger/20260721T072347Z-implementer-pr6-record-transition-correction.mdscript.md` now discloses the mutation, supersedes the compromised continuation, synchronizes the task, and restores the missing lane-ledger history without changing code or proof -* current PR head `5f2e3b38edbc5d582b2a0cbb37d7ec10f8ceb1cb` remains OPEN, non-draft, MERGEABLE/UNSTABLE on base `1bf3f1c5f6470bb8c4d458a0389c19c5123f9b81` with ten green checks, failed Linux sanitizer and WebAssembly checks, no review requests, and one unresolved RIF startup-order thread. Repair tree `d3ce8c1ada4ab13023cbcd40959c8a8a878b5307` is reviewed and locally proven but not yet committed or pushed; repaired-tree Linux sanitizer proof remains owned by replacement exact-head CI because sandboxed macOS ASAN cannot complete dynamic-shadow discovery before `main()` +* repair commit `f7f0fc532dc90f59bdea1cfee2bf50bc94316a4c` is pushed on the PR branch over reviewed parent `5f2e3b38edbc5d582b2a0cbb37d7ec10f8ceb1cb`; the owning RIF startup-order thread has a proof-bearing reply and is resolved, and a sanitized repair/proof summary is on the PR. This record-only transition is the sole descendant needed to synchronize the durable monitor after that push; refresh the live exact head and its replacement checks rather than treating either historical OID as current. Repaired-tree Linux sanitizer proof remains owned by replacement exact-head CI because sandboxed macOS ASAN cannot complete dynamic-shadow discovery before `main()` ## PR Monitor Hot Path -* changed exact-head CI and review evidence reopened only the RIF startup-order, HNSW speculative-prefetch, and WebAssembly width slice. That repair is locally proven and recursively reviewed; next validate this record once, commit and push without force, reply to and resolve the owning thread, then monitor replacement exact-head CI +* changed exact-head CI and review evidence reopened only the RIF startup-order, HNSW speculative-prefetch, and WebAssembly width slice. That repair is locally proven, recursively reviewed, pushed, and its owning thread is resolved; next monitor replacement exact-head CI, repair only new in-scope failures or comments, and keep the branch synchronized with current main without merging or closing * every ten minutes in this current task, refresh PR 6 exact head, checks, mergeability, reviews, review requests, comments, and unresolved threads; compare with the prior state and report only changes * repair only in-scope failures or review findings with proportionate proof and the required fresh review; push without force and update this goal to the new exact head * stop and deactivate the heartbeat when the PR merges or closes externally, repair exceeds scope, target drift is unrecoverable, or authority is explicitly denied From 764e4af202a91120dae85e1d6b0d69e2ce97aa5d Mon Sep 17 00:00:00 2001 From: gabewillen Date: Tue, 21 Jul 2026 03:14:48 -0500 Subject: [PATCH 12/18] Make HNSW empty adjacency repair portable --- .../paper-traceability-audit-v2.json | 6 +-- .../paper-traceability-current-state-v2.json | 16 +++++--- .../paper-traceability-manifest-v1.json | 4 +- cmake/hnswlib-prefetch-bounds.patch | 9 ++++ ...trator-goal-mdscript-converted.mdscript.md | 18 ++++---- docs/paper/_manuscript/index.md | 23 ++++++----- docs/paper/sections/10_implementation.qmd | 4 +- docs/paper/sections/11_optimization.qmd | 2 +- .../sparse_retrieval_route_internal.cpp | 41 +++++++++++++++++-- .../sparse_retrieval_route_internal.hpp | 7 ++++ tests/operations_graph_retrieval.test.cpp | 25 ++++------- 11 files changed, 104 insertions(+), 51 deletions(-) diff --git a/artifacts/flat_storage_cost/paper-traceability-audit-v2.json b/artifacts/flat_storage_cost/paper-traceability-audit-v2.json index 4fd6ff2e..d85feb4a 100644 --- a/artifacts/flat_storage_cost/paper-traceability-audit-v2.json +++ b/artifacts/flat_storage_cost/paper-traceability-audit-v2.json @@ -1,14 +1,14 @@ { "generated_claim_mismatches": [], "inventory_count": 70, - "manifest_sha256": "0d7efbbe58f17631c33e24e998444d63021e9698db7e771bba51c8543798f65f", - "manuscript_sha256": "57fd68f04ee13753c0d7c847ccf79967d9cbe58efef4ac80df4c212a310e9362", + "manifest_sha256": "9429dab2729daef909481f6f68db9299686c90b3e8a4a773f9a404564eacac09", + "manuscript_sha256": "f4334f825fecf80c821162eb002d9a81d1ba1277529c575f8819d40bfb0ce21c", "missing_source_claims": [], "ownership_violations": [], "passed": true, "proof_level_violations": [], "record_count": 70, "schema": "cortext_paper_traceability_audit_v1", - "state_sha256": "462a0dbf926ab989468f39fe521dc3dac587e68e513d994a6de19a68b7c62f7d", + "state_sha256": "118b11ca3d0b871a94de1a89178e1e3338efcee8343a17f7872e727f51a5557f", "uncovered_inventory": [] } diff --git a/artifacts/flat_storage_cost/paper-traceability-current-state-v2.json b/artifacts/flat_storage_cost/paper-traceability-current-state-v2.json index e1489d13..1afca6f3 100644 --- a/artifacts/flat_storage_cost/paper-traceability-current-state-v2.json +++ b/artifacts/flat_storage_cost/paper-traceability-current-state-v2.json @@ -114,31 +114,35 @@ ] }, "pr6_exact_head_ci_repair": { - "decision": "repair-review-and-exact-head-ci-before-disposition", + "decision": "native-test-and-sanitizer-repair-reviewed-push-pending", "prior_exact_head": "5f2e3b38edbc5d582b2a0cbb37d7ec10f8ceb1cb", + "current_failing_exact_head": "b7f9e27e019e5e4d4e95019a1e75742583970a86", "review_thread": "https://github.com/augmem/cortext/pull/6#discussion_r3609254976", "repairs": [ "calibrate migrated lazy-RIF state transactionally before working-memory hydration and rebuild the disposable epoch from committed persistent authority", - "bound pinned hnswlib speculative neighbor prefetches by actual adjacency length without disabling SIMD distance kernels", + "bound pinned hnswlib speculative neighbor prefetches by actual adjacency length without disabling SIMD distance kernels and skip its zero-byte empty-adjacency copy whose vector destination may be null", + "construct the empty-upper-layer HNSW regression with explicit test-only levels instead of platform-dependent random levels", "perform knob-derived cache-byte multiplication explicitly in std::size_t for WebAssembly width portability" ], "source_sha256": { "signal_processor": "7d255a3db0b4e9f0dcedac9fa841d093b1ad39af3c90af43969a17aba481e07b", "rif_cache_header": "55985ae0d5d0d69480ae3a3d8204779faec8b23f2051e2e924b8de31e1d130a8", - "hnswlib_patch": "442aceca09c022cd2043a08c3d508cb5a608565f94b64e8fa74df6abe71510c4", + "hnswlib_patch": "4180985795ccdac233cf7c50e82ec0bb2108fd191aece8951f8cedc12932d54a", "hnswlib_patch_driver": "3506b957d155d0994cd975d12d93e3bdb60f0d205b13dc496b474aeb73e8662a", - "hnsw_repair_test": "6d0f997e6d398cb056082649073b8ce6deeeaac93c9c43f1c37c9cb0b133d601" + "hnsw_route_header": "4996c6575e70c4e74da29d6e289695df250f3316feeaae3724be29c3fda74ad8", + "hnsw_route_source": "9582307376d8a8dcb40e85351382142e3a985df6448e7d8ef5a4f52e69268424", + "hnsw_repair_test": "ea620a606886e2f9630e7b20882aaa5fe1603ab46de67afdf52bacb1aca7cbe4" }, "local_proof": { "full_media_ctest": "39,175 assertions in 690 cases; 1/1 passed in 287.44 seconds", "rif_focus": "312 assertions in 19 cases", - "hnsw_focus": "19 assertions in 2 cases, including an empty upper-layer adjacency repair", + "hnsw_focus": "1,184 assertions in 5 regression cases; the exact explicit-level empty upper-layer repair passes 14 assertions", "wasm_bundle": "built successfully with Emscripten 4.0.18", "test_binary_sha256": "44e975cffd7d698ee24b2f7c43ffaccd8c86655c617d192224da8b22da992f7c", "wasm_sha256": "17d31e0a61327e91d7a53577b73689442583d5f4c84aa76d5844ac309e9791aa" }, "sanitizer_proof": { - "local_status": "blocked-before-main-by-sandboxed-macos-asan-dynamic-shadow-discovery", + "local_status": "ASAN blocked before main by sandboxed macOS dynamic-shadow discovery; UBSan-only build completes but its runtime library is denied by macOS code-signing policy before main", "required_owner": "exact-head GitHub Linux sanitizer check" }, "retrieval_quality_authority": "unchanged historical 4,608-query production matrix; this repair does not rerun or broaden that evidence", diff --git a/artifacts/flat_storage_cost/paper-traceability-manifest-v1.json b/artifacts/flat_storage_cost/paper-traceability-manifest-v1.json index d76e4fdc..94335cb5 100644 --- a/artifacts/flat_storage_cost/paper-traceability-manifest-v1.json +++ b/artifacts/flat_storage_cost/paper-traceability-manifest-v1.json @@ -799,9 +799,9 @@ }, { "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", - "decision": "repair-review-and-exact-head-ci-before-disposition", + "decision": "native-test-and-sanitizer-repair-reviewed-push-pending", "evidence_fingerprints": [ - "271d8f3eece933f293384f6f2f04c7c97f83bb7978e012605443cf2c8809f51c" + "05378353dc522ca3bf044fd35b767278af215f967ddb18f825325b3cbbd25c20" ], "evidence_kind": "measured", "inventory_id": "state:pr6_exact_head_ci_repair", diff --git a/cmake/hnswlib-prefetch-bounds.patch b/cmake/hnswlib-prefetch-bounds.patch index c7e67c20..d7c1b568 100644 --- a/cmake/hnswlib-prefetch-bounds.patch +++ b/cmake/hnswlib-prefetch-bounds.patch @@ -80,3 +80,12 @@ index f516df5..6240b2f 100644 #endif tableint cand = datal[i]; dist_t d = fstdistfunc_(dataPoint, getDataByInternalId(cand), dist_func_param_); +@@ -1144,6 +1155,7 @@ class HierarchicalNSW : public AlgorithmInterface { + int size = getListCount(data); + std::vector result(size); + tableint *ll = (tableint *) (data + 1); +- memcpy(result.data(), ll, size * sizeof(tableint)); ++ if (size > 0) ++ memcpy(result.data(), ll, size * sizeof(tableint)); + return result; + } diff --git a/comments/consolidation-drift-retrigger/20260716T205900Z-orchestrator-goal-mdscript-converted.mdscript.md b/comments/consolidation-drift-retrigger/20260716T205900Z-orchestrator-goal-mdscript-converted.mdscript.md index 7669a1f8..36e52d22 100644 --- a/comments/consolidation-drift-retrigger/20260716T205900Z-orchestrator-goal-mdscript-converted.mdscript.md +++ b/comments/consolidation-drift-retrigger/20260716T205900Z-orchestrator-goal-mdscript-converted.mdscript.md @@ -5,20 +5,20 @@ owner_role: implementer lane_id: consolidation-drift-retrigger status: monitoring implementation_status: complete -monitor_status: replacement-exact-head-ci-pending +monitor_status: native-and-sanitizer-repair-reviewed-push-pending source_of_truth: current repository, current user corrections, this goal, task comments, exact private profiles and audits, and GitHub PR 6 only after implementation completion model: gpt-5.6-terra reasoning: high model_selection_basis: cross-cutting C++ and SQLite implementation, deterministic bounded-work proof, research traceability, and PR ownership canonical_monitor_entry: true -updated_at: 20260721T072800Z +updated_at: 20260721T081254Z --- ## Resume Goal * set `{{repository}}` to the canonical Git root containing this file; execute on branch `fix/consolidation-drift-rearm`; do not infer completion, merge authority, release authority, deployment authority, or production-wide boundedness -* treat `artifacts/flat_storage_cost/paper-traceability-current-state-v2.json` as the current control overlay over the content-addressed historical `~/.agents` state; the paused heartbeat must execute this goal rather than the superseded external 5C goal +* treat `artifacts/flat_storage_cost/paper-traceability-current-state-v2.json` as the current control overlay over the content-addressed historical project state; the heartbeat must execute this goal rather than the superseded external 5C goal * preserve one modality- and source-id-agnostic Natural/Durable operation path; Durable may add only its post-commit flush/checkpoint barrier, while Ephemeral retains its read-only semantics * preserve current retrieval quality authority: each deterministic 512-query production-shaped run permits at most one exact top-1 miss, nine-run aggregate top-1 must be at least 0.999, mean exact identity recall@16 must be at least 0.998, semantic coverage must be at least 0.95, deterministic ties remain exact, and misses may not cluster by modality, opaque source id, memory age, or knob point * preserve exact structural, rollback, transaction, source-provenance, modality-label, one-write-ownership, and work-ceiling invariants at 100 percent; do not substitute approximate retrieval tolerance for a structural tolerance @@ -36,15 +36,15 @@ updated_at: 20260721T072800Z * the mature extended suffix shows store growth without continuing per-store work growth: non-overlapping late-half mean process fell 8.918 to 7.858 ms, graph seed-cache time fell 2.914 to 2.397 ms with per-node unit ratio 0.789, and supersession loading fell 1.860 to 1.520 ms with per-candidate unit ratio 0.855 * the no-selector 2,016-message Durable run processed four consolidations in 79,481 ms with mean process 10.709666 ms and mean total 39.024183 ms; all 512 controls passed top-1, recall@16, semantic coverage, and ties at 1.0 with four opaque sources; its horizon is insufficient for ten post-warmup 500-event windows and therefore does not prove Durable plateau * focused production-default derivation, route work, active-epoch reset, shared Natural/Durable path, Durable-barrier non-replay, source/modality, Python audit, and evidence-builder tests pass on the current release build -* all algorithm and experiment changes, accepted adverse timing, maturity boundary, failed-recenter rollback repair, exact-head CI repairs, and nonclaims are recorded in `docs/paper/sections/10_implementation.qmd` and `docs/paper/sections/11_optimization.qmd`; the regenerated manuscript SHA-256 is `57fd68f04ee13753c0d7c847ccf79967d9cbe58efef4ac80df4c212a310e9362` -* the current full media-enabled CTest suite passes 39,175 assertions in 690 cases in 287.44 seconds; focused RIF passes 312 assertions in 19 cases; the two HNSW CI regressions pass 19 assertions; WebAssembly rebuilds successfully with Emscripten 4.0.18; the complete Python tool suite passes 159 tests; patch removal/reapplication and `git diff --check` pass -* the current-state overlay, rebuilt 70-record manifest, and fail-closed audit have raw-file SHA-256 values `39f5f41a7b126c46c859abb8bb2a67b14a2b14e8644a6f78355f4f86c6b46a1e`, `ebc47507bea5ed41311c6f52a4567b2a5ad610d0334d0bba83dc86c7aafd0b66`, and `cea9dfdca7aa8a4db57b82704963e9314386c9bd6ef2f07327c9b7f0b478bacf`; the audit passes with 70/70 inventory records and no uncovered inventory, claim mismatch, proof-level violation, or ownership violation -* the original recursive cutover review remains complete. The exact-head CI repair then received a fresh round one that found one P2 unguarded empty-adjacency HNSW prefetch; repair tree `d3ce8c1ada4ab13023cbcd40959c8a8a878b5307` guards it and adds deterministic update/reseal coverage. A different fresh round-two reviewer proved the complete repair at the P1/P2 threshold with no blocking finding. Its sole P3 control-record hygiene residual was corrected directly; because that correction rewrote an existing continuation record and violated append-only provenance, the later single-pass record-transition review rejected the record transition and `~/.agents/projects/cortext/comments/consolidation-drift-retrigger/20260721T072347Z-implementer-pr6-record-transition-correction.mdscript.md` now discloses the mutation, supersedes the compromised continuation, synchronizes the task, and restores the missing lane-ledger history without changing code or proof -* repair commit `f7f0fc532dc90f59bdea1cfee2bf50bc94316a4c` is pushed on the PR branch over reviewed parent `5f2e3b38edbc5d582b2a0cbb37d7ec10f8ceb1cb`; the owning RIF startup-order thread has a proof-bearing reply and is resolved, and a sanitized repair/proof summary is on the PR. This record-only transition is the sole descendant needed to synchronize the durable monitor after that push; refresh the live exact head and its replacement checks rather than treating either historical OID as current. Repaired-tree Linux sanitizer proof remains owned by replacement exact-head CI because sandboxed macOS ASAN cannot complete dynamic-shadow discovery before `main()` +* all algorithm and experiment changes, accepted adverse timing, maturity boundary, failed-recenter rollback repair, exact-head CI repairs, and nonclaims are recorded in `docs/paper/sections/10_implementation.qmd` and `docs/paper/sections/11_optimization.qmd`; the regenerated manuscript SHA-256 is `f4334f825fecf80c821162eb002d9a81d1ba1277529c575f8819d40bfb0ce21c` +* the current full media-enabled CTest suite before the latest isolated test-seam repair passes 39,175 assertions in 690 cases in 287.44 seconds; focused RIF passes 312 assertions in 19 cases; the deterministic explicit-level HNSW repair passes 14 assertions and all five HNSW regression cases pass 1,184 assertions; WebAssembly rebuilt successfully with Emscripten 4.0.18 on the preceding exact head; the complete Python tool suite passes 159 tests; complete hnswlib patch reverse-check and `git diff --check` pass. A local UBSan-only build completes, but macOS denies its runtime library before `main()` on code-signing policy, so replacement Linux CI owns sanitizer execution +* the current-state overlay, rebuilt 70-record manifest, and fail-closed audit have raw-file SHA-256 values `836d2c2f235df1fc553e2d36955f1e8a0b543461ff708db320d8a3234bad2099`, `43ddb8e7cdec3822d544ad4a9a19fda8d2e0e67a093b8a63cd3cfbd9d7ca086f`, and `40881c9b7b9f87c168324879ec7e1e7cfe5ee22e4acbb5b233c25e9d01dc2a57`; the audit passes with 70/70 inventory records and no uncovered inventory, claim mismatch, proof-level violation, or ownership violation; the regenerated manuscript SHA-256 is `f4334f825fecf80c821162eb002d9a81d1ba1277529c575f8819d40bfb0ce21c` +* the original recursive cutover review remains complete. The exact-head CI repair then received a fresh round one that found one P2 unguarded empty-adjacency HNSW prefetch; repair tree `d3ce8c1ada4ab13023cbcd40959c8a8a878b5307` guards it and adds deterministic update/reseal coverage. A different fresh round-two reviewer proved the complete repair at the P1/P2 threshold with no blocking finding. Its sole P3 control-record hygiene residual was corrected directly; a later append-only project correction record dated 2026-07-21 discloses the earlier in-place continuation mutation, supersedes that compromised provenance, synchronizes the task, and restores the missing lane-ledger history without exposing a machine-local path +* exact head `b7f9e27e019e5e4d4e95019a1e75742583970a86` remains synchronized with current main, OPEN/non-draft, and MERGEABLE/UNSTABLE with nine green checks and three failures. `ubuntu-native` and `arch-native` rejected a platform-dependent random-level premise in the new regression; `ubuntu-sanitizers` rejected the same premise and additionally found a zero-length `memcpy` with a potentially null empty-vector destination in pinned hnswlib. The current repair uses explicit test-only levels, guards the zero-byte copy, passes focused proof, and is Proven by a fresh round-two reviewer at the P1/P2 threshold with no residual. There are no review requests or unresolved threads; the repair is not yet pushed ## PR Monitor Hot Path -* changed exact-head CI and review evidence reopened only the RIF startup-order, HNSW speculative-prefetch, and WebAssembly width slice. That repair is locally proven, recursively reviewed, pushed, and its owning thread is resolved; next monitor replacement exact-head CI, repair only new in-scope failures or comments, and keep the branch synchronized with current main without merging or closing +* exact-head CI reopened only the HNSW test-determinism and zero-byte empty-adjacency copy slice. The repair is locally proven and recursively reviewed; next validate the updated paper/evidence/goal record once, commit and push without force, then monitor replacement exact-head CI and keep the branch synchronized with current main without merging or closing * every ten minutes in this current task, refresh PR 6 exact head, checks, mergeability, reviews, review requests, comments, and unresolved threads; compare with the prior state and report only changes * repair only in-scope failures or review findings with proportionate proof and the required fresh review; push without force and update this goal to the new exact head * stop and deactivate the heartbeat when the PR merges or closes externally, repair exceeds scope, target drift is unrecoverable, or authority is explicitly denied diff --git a/docs/paper/_manuscript/index.md b/docs/paper/_manuscript/index.md index 0d9b7dda..68aaf7cd 100644 --- a/docs/paper/_manuscript/index.md +++ b/docs/paper/_manuscript/index.md @@ -5630,11 +5630,12 @@ source identifier. The pinned HNSW implementation retains its SIMD distance kernels, while a content-checked local patch bounds every speculative neighbor prefetch by the actual adjacency length. This prevents a sanitizer-visible -one-past-end read without changing candidate membership or ranking. -Cache-byte estimation also performs its knob-derived multiplication -explicitly in `std::size_t`, keeping the same capacity on native and -WebAssembly targets instead of relying on an implicit 64-to-32-bit -narrowing conversion. +one-past-end read and skips the zero-byte adjacency copy whose +empty-vector destination may be null, without changing candidate +membership, adjacency contents, or ranking. Cache-byte estimation also +performs its knob-derived multiplication explicitly in `std::size_t`, +keeping the same capacity on native and WebAssembly targets instead of +relying on an implicit 64-to-32-bit narrowing conversion. ### Bounded activation observation shadow @@ -9303,13 +9304,15 @@ deployment remain unclaimed. PR-monitor repair record: migrated active RIF rows are calibrated before working-memory hydration; pinned HNSW speculative neighbor prefetches are adjacency-bounded without disabling SIMD distance -kernels; and cache-byte arithmetic uses explicit +kernels; empty adjacency snapshots skip a zero-byte copy whose vector +destination may be null; and cache-byte arithmetic uses explicit std::size_t width for WebAssembly. The full media CTest, focused RIF and HNSW regressions, and WebAssembly bundle build pass -locally. The sandboxed macOS ASAN runtime cannot complete dynamic-shadow -discovery before main(), so exact-head Linux sanitizer CI -remains the required owner; the historical 4,608-query quality matrix is -not relabeled as evidence from the repaired binary. +locally. The sandboxed macOS ASAN runtime cannot execute because +dynamic-shadow discovery or sanitizer-runtime code signing fails before +main(), so exact-head Linux sanitizer CI remains the +required owner; the historical 4,608-query quality matrix is not +relabeled as evidence from the repaired binary. TRACE[state:hnsw_fixed_6c_experiment] diff --git a/docs/paper/sections/10_implementation.qmd b/docs/paper/sections/10_implementation.qmd index 261e1be1..5a62555b 100644 --- a/docs/paper/sections/10_implementation.qmd +++ b/docs/paper/sections/10_implementation.qmd @@ -207,7 +207,9 @@ modality or source identifier. The pinned HNSW implementation retains its SIMD distance kernels, while a content-checked local patch bounds every speculative neighbor prefetch by the actual adjacency length. This prevents a sanitizer-visible one-past-end read -without changing candidate membership or ranking. Cache-byte estimation also +and skips the zero-byte adjacency copy whose empty-vector destination may be +null, without changing candidate membership, adjacency contents, or ranking. +Cache-byte estimation also performs its knob-derived multiplication explicitly in `std::size_t`, keeping the same capacity on native and WebAssembly targets instead of relying on an implicit 64-to-32-bit narrowing conversion. diff --git a/docs/paper/sections/11_optimization.qmd b/docs/paper/sections/11_optimization.qmd index 5d8c55f8..7b7d9934 100644 --- a/docs/paper/sections/11_optimization.qmd +++ b/docs/paper/sections/11_optimization.qmd @@ -1633,7 +1633,7 @@ observation-only result is never promoted to production-path proof. | `TRACE[state:sqlite_hnsw_sparse_route_integration]` | Retained row-addressed SQLite HNSW query and incremental seal in the existing `GraphRetrieve` and `MemoryStorage` paths; Natural and Durable share the same algorithm, and Durable adds only its checkpoint. Current full-corpus retrieval quality and activation bounds pass, while the Natural whole-engine plateau and Durable horizon gates remain open. | | `TRACE[state:sqlite_hnsw_activation_effort_cycle]` | Queue-effort-only, fixed-$5C$, and dynamic $4C$ through $8C$ floor variants were rejected or superseded. The retained candidate resets routing work to $8C$, advances by $R=\max(2,\lfloor B/16\rfloor)$ to $9C$, keeps $A=2C+2B$ downstream activation and $2B/(C+B)$ construction, passes the 30,380-packet mature-cycle gates at 511/512 top-1 and recall@16 0.999265, and passes canonical and nine-point quality without an engine-wide plateau claim. | | `TRACE[state:sqlite_hnsw_production_cutover]` | Retained the existing SQLite HNSW route as the production default at an $8C$ post-consolidation floor, $R=\max(2,\lfloor B/16\rfloor)$ step, $9C$ ceiling, separate $A=2C+2B$ snapshot, and $9C+A$ total row ceiling. The nine-point matrix passed 4,608/4,608 top-1 controls, minimum recall@16 and semantic coverage 1.0, deterministic ties, and source/modality-label invariance. Natural and Durable share the operation path, with Durable adding only its checkpoint; whole-engine reset, bounded restart, Durable plateau, release, and deployment remain unclaimed. | -| `TRACE[state:pr6_exact_head_ci_repair]` | PR-monitor repair record: migrated active RIF rows are calibrated before working-memory hydration; pinned HNSW speculative neighbor prefetches are adjacency-bounded without disabling SIMD distance kernels; and cache-byte arithmetic uses explicit `std::size_t` width for WebAssembly. The full media CTest, focused RIF and HNSW regressions, and WebAssembly bundle build pass locally. The sandboxed macOS ASAN runtime cannot complete dynamic-shadow discovery before `main()`, so exact-head Linux sanitizer CI remains the required owner; the historical 4,608-query quality matrix is not relabeled as evidence from the repaired binary. | +| `TRACE[state:pr6_exact_head_ci_repair]` | PR-monitor repair record: migrated active RIF rows are calibrated before working-memory hydration; pinned HNSW speculative neighbor prefetches are adjacency-bounded without disabling SIMD distance kernels; empty adjacency snapshots skip a zero-byte copy whose vector destination may be null; and cache-byte arithmetic uses explicit `std::size_t` width for WebAssembly. The full media CTest, focused RIF and HNSW regressions, and WebAssembly bundle build pass locally. The sandboxed macOS ASAN runtime cannot execute because dynamic-shadow discovery or sanitizer-runtime code signing fails before `main()`, so exact-head Linux sanitizer CI remains the required owner; the historical 4,608-query quality matrix is not relabeled as evidence from the repaired binary. | | `TRACE[state:hnsw_fixed_6c_experiment]` | Rejected knob-derived fixed-$6C$ routing envelope. All 27 structural F/S/T points and 931 assertions passed; neutral $C=512$ produced a 3,072-node envelope while $B=128$ and the 129 boundary remained distinct. An extra production-default F=.45/S=.5/T=.5 pre-screen missed exact top-1, recall@16, plateau, and wall-time gates, so fail-fast rejected the candidate before the exact nine-point corpus matrix started and left production on fixed $5C$. | | `TRACE[state:post_rif_empty_fixed_envelope_attribution]` | Repaired proof classification for the retained zero-increment fixed-$5C/5C$ route. Retrieval mode is independent of whole-engine process shape; route-active rows fail closed on missing work, and queue, node ceiling, actual visits, distance work, and activation are checked separately across at least ten mature unchanged-envelope recenters. The production suffix beginning at event 10,195 passes the classifier and work envelope across 12 complete recenters, while activated-identity overlap, process-cycle reset, exact full-horizon retrieval, Durable horizon, and bounded restart remain open. | | `TRACE[state:write_gate_incidence_attribution_v2]` | Deterministic range-bound observation-only 15,695-packet production-knob attribution rejected boundary-to-write incidence as the growth source: exact event ranges 0--2,499 and 13,195--15,694 contained 510 and 528 writes, while MemoryStorage time per write rose from 0.4833 to 2.8343 ms as the existing shared SQLite HNSW route warmed toward the fixed $5C=2{,}495$ envelope. Production $C/B/A=499/125/1{,}248$ and construction $C+B/2B=624/250$ remain derived; neutral $C/B/A=512/128/1{,}280$ and 129 is only logical $B+1$. Raw reset remains failed and unwaived; 27 structural and nine production-shaped F/S/T ablations remain required. | diff --git a/src/operations/sparse_retrieval_route_internal.cpp b/src/operations/sparse_retrieval_route_internal.cpp index ca509ce5..a82adea5 100644 --- a/src/operations/sparse_retrieval_route_internal.cpp +++ b/src/operations/sparse_retrieval_route_internal.cpp @@ -75,15 +75,16 @@ struct Route::Impl second.setEf (parameters.query_effort); } - bool AddSealed (long long memory_id, const Eigen::VectorXf &embedding) + bool AddSealed (long long memory_id, const Eigen::VectorXf &embedding, + int level = -1) { auto normalized = Normalize (embedding, embedding_dim); if (!normalized || memory_id <= 0 || sealed_embeddings.count (memory_id) != 0) return false; const auto label = static_cast (memory_id); - first.addPoint (normalized->data (), label); - second.addPoint (normalized->data (), label); + first.addPoint (normalized->data (), label, level); + second.addPoint (normalized->data (), label, level); sealed_embeddings.emplace (memory_id, std::move (*normalized)); return true; } @@ -147,6 +148,40 @@ Route::Create ( } } +#if defined(CORTEXT_TESTING) +std::shared_ptr +Route::CreateWithLevelsForTest ( + int embedding_dim, + const std::vector> &entries, + const std::vector &levels, Parameters parameters) +{ + if (embedding_dim <= 0 || entries.size () != levels.size () + || parameters.minimum_capacity == 0 + || parameters.graph_neighbor_count == 0 + || parameters.construction_effort == 0 + || parameters.query_effort == 0) + return nullptr; + try + { + auto route = std::shared_ptr (new Route (std::make_unique ( + embedding_dim, entries.size () * 2, std::move (parameters)))); + for (std::size_t index = 0; index < entries.size (); ++index) + { + const auto &[memory_id, embedding] = entries[index]; + if (levels[index] <= 0 + || !route->impl_->AddSealed (memory_id, embedding, + levels[index])) + return nullptr; + } + return route; + } + catch (...) + { + return nullptr; + } +} +#endif + bool Route::Upsert (long long memory_id, const Eigen::VectorXf &embedding) { diff --git a/src/operations/sparse_retrieval_route_internal.hpp b/src/operations/sparse_retrieval_route_internal.hpp index 80745781..67530dc4 100644 --- a/src/operations/sparse_retrieval_route_internal.hpp +++ b/src/operations/sparse_retrieval_route_internal.hpp @@ -73,6 +73,13 @@ class Route const std::vector> &entries, Parameters parameters); +#if defined(CORTEXT_TESTING) + static std::shared_ptr CreateWithLevelsForTest ( + int embedding_dim, + const std::vector> &entries, + const std::vector &levels, Parameters parameters); +#endif + ~Route (); Route (const Route &) = delete; diff --git a/tests/operations_graph_retrieval.test.cpp b/tests/operations_graph_retrieval.test.cpp index 2a23ac25..1ef9928a 100644 --- a/tests/operations_graph_retrieval.test.cpp +++ b/tests/operations_graph_retrieval.test.cpp @@ -119,36 +119,29 @@ TEST_CASE ("Sparse retrieval route repairs below an empty upper-layer entry", { using operations::sparse_retrieval_route_internal::NodeSnapshot; using operations::sparse_retrieval_route_internal::Route; - std::vector> entries; - entries.reserve (72); - for (long long memory_id = 1; memory_id <= 72; ++memory_id) - entries.emplace_back ( - memory_id, UnitVec (static_cast (memory_id % kEmbeddingDim))); - - auto route = Route::Create ( - kEmbeddingDim, entries, + auto route = Route::CreateWithLevelsForTest ( + kEmbeddingDim, { { 1, UnitVec (1) }, { 2, UnitVec (2) } }, + { 2, 1 }, operations::sparse_retrieval_route_internal::DeriveParameters ( 0.0, 0.0, 0.0)); REQUIRE (route); const auto snapshot = route->Snapshot ({}); REQUIRE (snapshot); - REQUIRE (snapshot->max_level > 0); + REQUIRE (snapshot->entry_memory_id == 1); + REQUIRE (snapshot->max_level == 2); const auto entry = std::find_if ( snapshot->nodes.begin (), snapshot->nodes.end (), [&] (const NodeSnapshot &node) { return node.memory_id == snapshot->entry_memory_id; }); REQUIRE (entry != snapshot->nodes.end ()); - REQUIRE (entry->links.size () - > static_cast (snapshot->max_level)); - REQUIRE (entry->links[static_cast (snapshot->max_level)] - .empty ()); + REQUIRE (entry->links.size () == 3); + REQUIRE (entry->links[2].empty ()); const auto target = std::find_if ( snapshot->nodes.begin (), snapshot->nodes.end (), - [&] (const NodeSnapshot &node) { - return node.level < snapshot->max_level; - }); + [] (const NodeSnapshot &node) { return node.memory_id == 2; }); REQUIRE (target != snapshot->nodes.end ()); + REQUIRE (target->level == 1); const long long target_memory_id = target->memory_id; REQUIRE (route->Upsert (target_memory_id, UnitVec (200))); From 89a06084dd05710f90572c1b7bac7e17fab79122 Mon Sep 17 00:00:00 2001 From: gabewillen Date: Tue, 21 Jul 2026 05:41:11 -0500 Subject: [PATCH 13/18] Resolve PR review findings --- .../paper-traceability-audit-v2.json | 6 +- .../paper-traceability-current-state-v2.json | 62 +++- .../paper-traceability-manifest-v1.json | 6 +- build.zig | 16 +- cmake/PrepareHnswlibForZig.cmake | 39 +++ ...trator-goal-mdscript-converted.mdscript.md | 16 +- docs/paper/_manuscript/index.md | 182 +++++++--- docs/paper/sections/10_implementation.qmd | 75 +++- docs/paper/sections/11_optimization.qmd | 42 ++- src/operations/consolidation.cpp | 69 +++- src/operations/emotion_cascade.cpp | 8 +- .../emotional_metadata_cache_internal.hpp | 69 +++- .../execution_cache_sidecar_internal.hpp | 1 + ...storical_surface_search_cache_internal.hpp | 5 + ...sparse_retrieval_route_sqlite_internal.cpp | 226 ++++++++++-- src/store/schema.cpp | 19 ++ tests/migration_core.test.cpp | 1 + tests/operations_consolidation.test.cpp | 136 ++++++++ tests/operations_emotion_cascade.test.cpp | 119 ++++++- tests/operations_graph_retrieval.test.cpp | 322 ++++++++++++++---- tests/signal_processor.test.cpp | 25 +- 21 files changed, 1225 insertions(+), 219 deletions(-) create mode 100644 cmake/PrepareHnswlibForZig.cmake diff --git a/artifacts/flat_storage_cost/paper-traceability-audit-v2.json b/artifacts/flat_storage_cost/paper-traceability-audit-v2.json index d85feb4a..8df866f7 100644 --- a/artifacts/flat_storage_cost/paper-traceability-audit-v2.json +++ b/artifacts/flat_storage_cost/paper-traceability-audit-v2.json @@ -1,14 +1,14 @@ { "generated_claim_mismatches": [], "inventory_count": 70, - "manifest_sha256": "9429dab2729daef909481f6f68db9299686c90b3e8a4a773f9a404564eacac09", - "manuscript_sha256": "f4334f825fecf80c821162eb002d9a81d1ba1277529c575f8819d40bfb0ce21c", + "manifest_sha256": "8edbbd87fc4bd23cd6f9248c9851226eec82a496edafcd9b923c3ed455d2d1ab", + "manuscript_sha256": "070a04989506a062227bd69b3c57254e3602be37e734ad14a6a5eef6806e0472", "missing_source_claims": [], "ownership_violations": [], "passed": true, "proof_level_violations": [], "record_count": 70, "schema": "cortext_paper_traceability_audit_v1", - "state_sha256": "118b11ca3d0b871a94de1a89178e1e3338efcee8343a17f7872e727f51a5557f", + "state_sha256": "cd08a420024a4a89050f47bfa63cce161f6d46c6430f82820b853959aa0dc410", "uncovered_inventory": [] } diff --git a/artifacts/flat_storage_cost/paper-traceability-current-state-v2.json b/artifacts/flat_storage_cost/paper-traceability-current-state-v2.json index 1afca6f3..48444bda 100644 --- a/artifacts/flat_storage_cost/paper-traceability-current-state-v2.json +++ b/artifacts/flat_storage_cost/paper-traceability-current-state-v2.json @@ -1,15 +1,15 @@ { "schema": "cortext_paper_traceability_state_overlay_v2", "supersedes_state_sha256": "f0605f910ed3c10fa7838c2e175c5d0babbe352f7e4fe4e2f92fdf3c70cd1f2d", - "phase": "monitor-pr", + "phase": "repair-pr-review-threads", "completion": true, "resume_phase": "refresh-pr-state", "sqlite_hnsw_schema_authority": { - "status": "approved-current-user-through-migration-31", + "status": "approved-current-user-through-migration-33", "approver_identity": "current-user", "provenance": "direct user authorization in this task", - "schema_migration_numbers": [29, 30, 31], - "authority_scope": "private internal SQLite sparse route, exact signal-vector ring, and knob-bounded activation-centroid persistence", + "schema_migration_numbers": [29, 30, 31, 32, 33], + "authority_scope": "private internal SQLite sparse route, deterministic active-entry replacement index, exact signal-vector ring, knob-bounded activation-centroid persistence, and bounded emotional-source reranking index", "public_api_change": false, "no_release_or_deployment_grant": true }, @@ -52,7 +52,9 @@ "schema_authority": { "migrations": { "29": "internal SQLite HNSW route, metadata, build, node, and dirty-journal tables", - "31": "knob-bounded activation entry, generation, centroid, and identity snapshot columns" + "31": "knob-bounded activation entry, generation, centroid, and identity snapshot columns", + "32": "deterministic active sparse-route entry replacement index", + "33": "bounded emotional-source intensity reranking index" }, "public_api_change": false, "authority": "current user explicitly approved the SQLite shadow-memory schema design and authorized the implementation changes" @@ -114,14 +116,38 @@ ] }, "pr6_exact_head_ci_repair": { - "decision": "native-test-and-sanitizer-repair-reviewed-push-pending", + "decision": "seven-review-thread-repair-proven-at-round-five-p1", "prior_exact_head": "5f2e3b38edbc5d582b2a0cbb37d7ec10f8ceb1cb", - "current_failing_exact_head": "b7f9e27e019e5e4d4e95019a1e75742583970a86", - "review_thread": "https://github.com/augmem/cortext/pull/6#discussion_r3609254976", + "current_exact_head": "764e4af202a91120dae85e1d6b0d69e2ce97aa5d", + "current_exact_head_ci": "12-of-12-green-before-the-seven-thread-candidate-push", + "review": { + "baseline_tree": "156dd7bc27b7cda2c661a9467bfddfe72c771e8a", + "candidate_tree": "0b4069c73955147da28add9b9eaea480bad48249", + "verdict": "Proven at the fresh round-five P1 threshold with no P1 findings; the cache eligibility-before-LIMIT P2 remains expressly unclaimed", + "residuals": [ + "P2: the bounded cache ranks its global flashbulb prefix before applying cascade recency/arousal eligibility, whereas the SQL fallback filters eligibility before LIMIT; this does not regress the public thread's required intensity-before-truncation order, but full cache/fallback selection equivalence remains unclaimed" + ] + }, + "review_threads": [ + "https://github.com/augmem/cortext/pull/6#discussion_r3620394273", + "https://github.com/augmem/cortext/pull/6#discussion_r3620394282", + "https://github.com/augmem/cortext/pull/6#discussion_r3620394286", + "https://github.com/augmem/cortext/pull/6#discussion_r3620632960", + "https://github.com/augmem/cortext/pull/6#discussion_r3620632969", + "https://github.com/augmem/cortext/pull/6#discussion_r3620632977", + "https://github.com/augmem/cortext/pull/6#discussion_r3620632985" + ], "repairs": [ "calibrate migrated lazy-RIF state transactionally before working-memory hydration and rebuild the disposable epoch from committed persistent authority", "bound pinned hnswlib speculative neighbor prefetches by actual adjacency length without disabling SIMD distance kernels and skip its zero-byte empty-adjacency copy whose vector destination may be null", "construct the empty-upper-layer HNSW regression with explicit test-only levels instead of platform-dependent random levels", + "apply the same hnswlib patch to a declared build-local Zig copy without mutating the shared package cache", + "exclude inactive rows from deterministic route fill through the existing generation-active-memory index", + "merge exact active-RIF and indexed inactive consolidation frontiers under the existing knob-derived 64C active-state and A candidate ceilings", + "replace a removed canonical hierarchy entry through the indexed highest-level active row, clear any overlapping activation snapshot atomically, and fail closed on legacy dead-entry metadata at restart", + "invalidate a route generation when an active normalized embedding moves beyond the fixed cosine tolerance, then use exact retrieval while the existing knob-bounded builder reconstructs coherent adjacency", + "retain the bounded emotional-source prefix in the SQL fallback's intensity-descending and memory-id-ascending order, marking rank-changing mutations dirty and refilling exactly the knob-derived prefix through the partial SQLite intensity index", + "treat an edge-visit-limited emotional traversal as an incomplete prefix that cannot publish a fixed point", "perform knob-derived cache-byte multiplication explicitly in std::size_t for WebAssembly width portability" ], "source_sha256": { @@ -129,16 +155,26 @@ "rif_cache_header": "55985ae0d5d0d69480ae3a3d8204779faec8b23f2051e2e924b8de31e1d130a8", "hnswlib_patch": "4180985795ccdac233cf7c50e82ec0bb2108fd191aece8951f8cedc12932d54a", "hnswlib_patch_driver": "3506b957d155d0994cd975d12d93e3bdb60f0d205b13dc496b474aeb73e8662a", + "zig_build": "7336dcc354cc970fc8fc71e1f40a9f96ac549622a859a19e6dc55a0ed069357c", + "zig_hnswlib_prepare": "c4635b5ed46654e19285cee1e2861c1385d214b67d058767c51bfc505d30f33f", "hnsw_route_header": "4996c6575e70c4e74da29d6e289695df250f3316feeaae3724be29c3fda74ad8", "hnsw_route_source": "9582307376d8a8dcb40e85351382142e3a985df6448e7d8ef5a4f52e69268424", - "hnsw_repair_test": "ea620a606886e2f9630e7b20882aaa5fe1603ab46de67afdf52bacb1aca7cbe4" + "hnsw_repair_test": "c904515074515cd6c4325318d34a89ae10da4c0b9a3d7b9c34b2ebccbfbe7407", + "consolidation_source": "c5b0863f43e1f1080e006d213bc62ed145b3c740a906697327d2c91ba98e7e18", + "consolidation_test": "0bca3997b4c0a68ab475355b5c8be962ec06cbcbb19f628a3eb266d6fa4e071d", + "emotion_cascade_source": "8135e0f9a07d55a62d6bfdf7f63c83c5b2110237cc208c4fff2ef1ae6e135634", + "emotional_metadata_cache": "a8deda12553ffb9c07389f4665645187b85e4dd55f3c055ba230385cfcfbf88a", + "emotion_cascade_test": "47b0d780994832bbd36f06fcba4abee9d2935ad0267b4c9bd9e7cb6659df5afe", + "schema_source": "c42ac2cac86b6464d3bccdef87c1ddd02731cafccba179e229b16284e0f87cf4" }, "local_proof": { - "full_media_ctest": "39,175 assertions in 690 cases; 1/1 passed in 287.44 seconds", + "full_media_ctest": "clean Debug LLVM 21 media-enabled suite with experiment hooks enabled: 38,730 assertions in 697 cases", "rif_focus": "312 assertions in 19 cases", - "hnsw_focus": "1,184 assertions in 5 regression cases; the exact explicit-level empty upper-layer repair passes 14 assertions", + "hnsw_focus": "complete SQLite-HNSW suite passes 2,614 assertions in 20 cases; focused replacement-entry and activation-snapshot clearing, moved-embedding invalidation with unchanged-vector tolerance, legacy dead-snapshot rejection, legacy dead-entry restart rebuild, active-only fill, and bounded-backfill regressions pass", + "consolidation_focus": "4,309 assertions in 32 cases, including exact effective-RIF selection and the 16,384-row all-low active-state ceiling", + "zig_build_local_patch": "text-only shared build passed; global hnswlib cache remained unpatched while the declared build-local copy passed reverse patch verification", "wasm_bundle": "built successfully with Emscripten 4.0.18", - "test_binary_sha256": "44e975cffd7d698ee24b2f7c43ffaccd8c86655c617d192224da8b22da992f7c", + "test_binary_sha256": "0fd25b6e322913cb0e76e3aa5a1fbcc6836d8696b6bbd5886224a3144fea1ec8", "wasm_sha256": "17d31e0a61327e91d7a53577b73689442583d5f4c84aa76d5844ac309e9791aa" }, "sanitizer_proof": { @@ -153,7 +189,7 @@ "modality_branch": false }, "unresolved_limits": [ - "exact-head Linux sanitizer proof is pending", + "record-transition review, push, and replacement exact-head CI for the seven-thread repair remain pending", "whole-engine raw process reset is not proven", "bounded whole-engine restart is not proven", "Durable plateau and production-wide boundedness are not claimed" diff --git a/artifacts/flat_storage_cost/paper-traceability-manifest-v1.json b/artifacts/flat_storage_cost/paper-traceability-manifest-v1.json index 94335cb5..6bb23e63 100644 --- a/artifacts/flat_storage_cost/paper-traceability-manifest-v1.json +++ b/artifacts/flat_storage_cost/paper-traceability-manifest-v1.json @@ -799,9 +799,9 @@ }, { "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", - "decision": "native-test-and-sanitizer-repair-reviewed-push-pending", + "decision": "seven-review-thread-repair-proven-at-round-five-p1", "evidence_fingerprints": [ - "05378353dc522ca3bf044fd35b767278af215f967ddb18f825325b3cbbd25c20" + "1e4fc54c2a756b4c2237ad32d9cea5cad9c704141736fe3d250a6c1868043377" ], "evidence_kind": "measured", "inventory_id": "state:pr6_exact_head_ci_repair", @@ -1027,7 +1027,7 @@ "corpus_parameter_scope": "production-default 8C-to-9C SQLite HNSW route; 15,695-packet Natural replay, 2,016-message Durable replay, 30,380-packet maturity extension, 27 structural F/S/T points, and nine 4,000-packet quality points with 512 controls each", "decision": "retained-production-default", "evidence_fingerprints": [ - "44abead03df4cc0c1a2b601ada6c9171f2eeaaa780328036faf70f54b5080922" + "a75c72875146e28ce9292f50c68289d2bbc5f37911b8cc3947407f9009a5bd64" ], "evidence_kind": "measured", "inventory_id": "state:sqlite_hnsw_production_cutover", diff --git a/build.zig b/build.zig index 7cf92edd..e80daf11 100644 --- a/build.zig +++ b/build.zig @@ -319,6 +319,20 @@ pub fn build(b: *std.Build) void { .version = .{ .major = 1, .minor = 2, .patch = 2 }, }); + // Keep Zig consumers on the same pinned hnswlib safety contract as the + // CMake build without mutating Zig's shared package cache. + const prepare_hnswlib = b.addSystemCommand(&.{"cmake"}); + prepare_hnswlib.addPrefixedDirectoryArg( + "-DHNSWLIB_SOURCE_DIR=", + hnswlib.path(""), + ); + const patched_hnswlib = prepare_hnswlib.addPrefixedOutputDirectoryArg( + "-DHNSWLIB_OUTPUT_DIR=", + "hnswlib-patched", + ); + prepare_hnswlib.addArg("-P"); + prepare_hnswlib.addFileArg(b.path("cmake/PrepareHnswlibForZig.cmake")); + if (fetch_aist_model) { if (!std.mem.eql(u8, aist_model_quant, "q8_0") and !std.mem.eql(u8, aist_model_quant, "q5_1") and @@ -343,7 +357,7 @@ pub fn build(b: *std.Build) void { mod.addIncludePath(b.path("third_party/sqlite-objstore/include")); mod.addIncludePath(b.path("third_party/sqlite-objstore/third_party/blake3")); mod.addIncludePath(eigen.path("")); - mod.addIncludePath(hnswlib.path("")); + mod.addIncludePath(patched_hnswlib); mod.addIncludePath(nlohmann_json.path("include")); const generated = b.addWriteFiles(); diff --git a/cmake/PrepareHnswlibForZig.cmake b/cmake/PrepareHnswlibForZig.cmake new file mode 100644 index 00000000..0b9742b5 --- /dev/null +++ b/cmake/PrepareHnswlibForZig.cmake @@ -0,0 +1,39 @@ +if(NOT DEFINED HNSWLIB_SOURCE_DIR) + message(FATAL_ERROR "HNSWLIB_SOURCE_DIR is required") +endif() +if(NOT DEFINED HNSWLIB_OUTPUT_DIR) + message(FATAL_ERROR "HNSWLIB_OUTPUT_DIR is required") +endif() + +# Zig's package directory is a content-addressed shared cache. Copy only the +# header library into this build step's declared output, then apply the same +# checked patch used by CMake without mutating or racing the package cache. +file(REMOVE_RECURSE "${HNSWLIB_OUTPUT_DIR}/hnswlib") +file(MAKE_DIRECTORY "${HNSWLIB_OUTPUT_DIR}") +file(COPY "${HNSWLIB_SOURCE_DIR}/hnswlib" + DESTINATION "${HNSWLIB_OUTPUT_DIR}") + +get_filename_component(_repo_root "${CMAKE_CURRENT_LIST_DIR}/.." ABSOLUTE) +file(RELATIVE_PATH _output_relative "${_repo_root}" "${HNSWLIB_OUTPUT_DIR}") +set(_patch "${CMAKE_CURRENT_LIST_DIR}/hnswlib-prefetch-bounds.patch") +execute_process( + COMMAND git apply --check --unsafe-paths + "--directory=${_output_relative}" "${_patch}" + WORKING_DIRECTORY "${_repo_root}" + RESULT_VARIABLE _apply_check + OUTPUT_QUIET + ERROR_QUIET +) +if(NOT _apply_check EQUAL 0) + message(FATAL_ERROR + "Pinned Zig hnswlib source does not match the prefetch bounds patch") +endif() +execute_process( + COMMAND git apply --unsafe-paths + "--directory=${_output_relative}" "${_patch}" + WORKING_DIRECTORY "${_repo_root}" + RESULT_VARIABLE _apply_result +) +if(NOT _apply_result EQUAL 0) + message(FATAL_ERROR "Failed to patch the build-local Zig hnswlib copy") +endif() diff --git a/comments/consolidation-drift-retrigger/20260716T205900Z-orchestrator-goal-mdscript-converted.mdscript.md b/comments/consolidation-drift-retrigger/20260716T205900Z-orchestrator-goal-mdscript-converted.mdscript.md index 36e52d22..60f17923 100644 --- a/comments/consolidation-drift-retrigger/20260716T205900Z-orchestrator-goal-mdscript-converted.mdscript.md +++ b/comments/consolidation-drift-retrigger/20260716T205900Z-orchestrator-goal-mdscript-converted.mdscript.md @@ -5,13 +5,13 @@ owner_role: implementer lane_id: consolidation-drift-retrigger status: monitoring implementation_status: complete -monitor_status: native-and-sanitizer-repair-reviewed-push-pending +monitor_status: seven-review-thread-repair-ready-to-push source_of_truth: current repository, current user corrections, this goal, task comments, exact private profiles and audits, and GitHub PR 6 only after implementation completion model: gpt-5.6-terra reasoning: high model_selection_basis: cross-cutting C++ and SQLite implementation, deterministic bounded-work proof, research traceability, and PR ownership canonical_monitor_entry: true -updated_at: 20260721T081254Z +updated_at: 20260721T103935Z --- @@ -36,15 +36,17 @@ updated_at: 20260721T081254Z * the mature extended suffix shows store growth without continuing per-store work growth: non-overlapping late-half mean process fell 8.918 to 7.858 ms, graph seed-cache time fell 2.914 to 2.397 ms with per-node unit ratio 0.789, and supersession loading fell 1.860 to 1.520 ms with per-candidate unit ratio 0.855 * the no-selector 2,016-message Durable run processed four consolidations in 79,481 ms with mean process 10.709666 ms and mean total 39.024183 ms; all 512 controls passed top-1, recall@16, semantic coverage, and ties at 1.0 with four opaque sources; its horizon is insufficient for ten post-warmup 500-event windows and therefore does not prove Durable plateau * focused production-default derivation, route work, active-epoch reset, shared Natural/Durable path, Durable-barrier non-replay, source/modality, Python audit, and evidence-builder tests pass on the current release build -* all algorithm and experiment changes, accepted adverse timing, maturity boundary, failed-recenter rollback repair, exact-head CI repairs, and nonclaims are recorded in `docs/paper/sections/10_implementation.qmd` and `docs/paper/sections/11_optimization.qmd`; the regenerated manuscript SHA-256 is `f4334f825fecf80c821162eb002d9a81d1ba1277529c575f8819d40bfb0ce21c` -* the current full media-enabled CTest suite before the latest isolated test-seam repair passes 39,175 assertions in 690 cases in 287.44 seconds; focused RIF passes 312 assertions in 19 cases; the deterministic explicit-level HNSW repair passes 14 assertions and all five HNSW regression cases pass 1,184 assertions; WebAssembly rebuilt successfully with Emscripten 4.0.18 on the preceding exact head; the complete Python tool suite passes 159 tests; complete hnswlib patch reverse-check and `git diff --check` pass. A local UBSan-only build completes, but macOS denies its runtime library before `main()` on code-signing policy, so replacement Linux CI owns sanitizer execution -* the current-state overlay, rebuilt 70-record manifest, and fail-closed audit have raw-file SHA-256 values `836d2c2f235df1fc553e2d36955f1e8a0b543461ff708db320d8a3234bad2099`, `43ddb8e7cdec3822d544ad4a9a19fda8d2e0e67a093b8a63cd3cfbd9d7ca086f`, and `40881c9b7b9f87c168324879ec7e1e7cfe5ee22e4acbb5b233c25e9d01dc2a57`; the audit passes with 70/70 inventory records and no uncovered inventory, claim mismatch, proof-level violation, or ownership violation; the regenerated manuscript SHA-256 is `f4334f825fecf80c821162eb002d9a81d1ba1277529c575f8819d40bfb0ce21c` +* all algorithm and experiment changes, accepted adverse timing, maturity boundary, failed-recenter rollback repair, exact-head CI repairs, and nonclaims are recorded in `docs/paper/sections/10_implementation.qmd` and `docs/paper/sections/11_optimization.qmd`; the regenerated manuscript SHA-256 is `070a04989506a062227bd69b3c57254e3602be37e734ad14a6a5eef6806e0472` +* the clean Debug LLVM 21 media-enabled suite with experiment hooks enabled passes 38,730 assertions in 697 cases; its exact test binary SHA-256 is `0fd25b6e322913cb0e76e3aa5a1fbcc6836d8696b6bbd5886224a3144fea1ec8`. The complete SQLite-HNSW suite passes 2,614 assertions in 20 cases; focused RIF passes 312 assertions in 19 cases; the complete Python tool suite passes 159 tests; complete hnswlib patch reverse-check and `git diff --check` pass. WebAssembly rebuilt successfully with Emscripten 4.0.18 on the preceding exact head. A local UBSan-only build completes, but macOS denies its runtime library before `main()` on code-signing policy, so replacement Linux CI owns sanitizer execution +* the current-state overlay, rebuilt 70-record manifest, and fail-closed audit have raw-file SHA-256 values `4fc32ca4a05c1a6549f77adc3ec991b4cc646d8dd1e91c49c128461e09587388`, `8fdd635490cda4be8beea247cedc0b0e11756ecd227acf8d0d0191cf53e19395`, and `090fc413dde8300eb6946cceaaa54a3dfe4446a9fb47dc403a2c09987e1c27e5`; the audit passes with 70/70 inventory records and no uncovered inventory, claim mismatch, proof-level violation, or ownership violation; its normalized state SHA-256 is `cd08a420024a4a89050f47bfa63cce161f6d46c6430f82820b853959aa0dc410`, and the regenerated manuscript SHA-256 is `070a04989506a062227bd69b3c57254e3602be37e734ad14a6a5eef6806e0472` * the original recursive cutover review remains complete. The exact-head CI repair then received a fresh round one that found one P2 unguarded empty-adjacency HNSW prefetch; repair tree `d3ce8c1ada4ab13023cbcd40959c8a8a878b5307` guards it and adds deterministic update/reseal coverage. A different fresh round-two reviewer proved the complete repair at the P1/P2 threshold with no blocking finding. Its sole P3 control-record hygiene residual was corrected directly; a later append-only project correction record dated 2026-07-21 discloses the earlier in-place continuation mutation, supersedes that compromised provenance, synchronizes the task, and restores the missing lane-ledger history without exposing a machine-local path -* exact head `b7f9e27e019e5e4d4e95019a1e75742583970a86` remains synchronized with current main, OPEN/non-draft, and MERGEABLE/UNSTABLE with nine green checks and three failures. `ubuntu-native` and `arch-native` rejected a platform-dependent random-level premise in the new regression; `ubuntu-sanitizers` rejected the same premise and additionally found a zero-length `memcpy` with a potentially null empty-vector destination in pinned hnswlib. The current repair uses explicit test-only levels, guards the zero-byte copy, passes focused proof, and is Proven by a fresh round-two reviewer at the P1/P2 threshold with no residual. There are no review requests or unresolved threads; the repair is not yet pushed +* fresh round-three cumulative review of baseline tree `156dd7bc27b7cda2c661a9467bfddfe72c771e8a` to candidate tree `71b079ec217128513e593f54bdb308f18a03d8eb` was Proven at P1 with no P1 findings. Round four reviewed candidate `5ea10c156fe6072961b7c43af97b2ac34ed30037` and found no implementation P1, but correctly rejected its stale audit and prior-candidate proof identities at P1. After that repair, a different fresh round-five reviewer proved exact candidate tree `0b4069c73955147da28add9b9eaea480bad48249` for source health at the P1 threshold with no P1 findings. One below-threshold P2 residual remains visible: the bounded cache ranks the global flashbulb prefix before recency/arousal filtering, while the SQL fallback filters eligibility before `LIMIT`. This does not regress the public thread's required intensity-before-truncation order, but full cache/fallback selection equivalence remains unclaimed +* the required single non-code review reproduced the merged-state 70/70 trace audit and found two record defects: the external task still capped schema authority at migrations 29/30 and named obsolete head `b7f9e27`, while four current implementer comments lacked the complete metadata and Evidence/Questions/Stop Report shape. Both findings are directly corrected and validated without rereview as required; no code changed after the Proven round-five source candidate +* exact pushed head `764e4af202a91120dae85e1d6b0d69e2ce97aa5d` is synchronized with current main, OPEN/non-draft, MERGEABLE/CLEAN, and 12/12 green. Seven review threads remain unresolved until one cumulative reviewed repair is pushed. The accepted first slice uses a patched build-local Zig copy, indexed active-only route fill, and an exact inactive/active RIF frontier merge guarded by `64C+1` and `A`. The second slice adds indexed canonical-entry replacement, activation-snapshot clearing in both row-addressed and HNSW-assisted seals, legacy dead-entry/snapshot restart rejection, moved-embedding generation invalidation with exact fallback and bounded rebuild, bounded emotional-source intensity ordering before truncation, and fixed-point invalidation after edge-limited traversal. Round one found and repaired three P2 lifecycle/record gaps. Round two found and repaired one P2 stale bounded source rank after intensity mutation through migration 33's partial SQLite index, a dirty rank marker, and exact knob-sized refill. The first cumulative rerun used a non-media build, exposed expected audio/image configuration failures, timed out at 1,500 seconds, and also exposed one obsolete integration expectation: the scenario deliberately moves an active vector but still expected a stale-adjacency seal. Candidate tree `5ea10c156fe6072961b7c43af97b2ac34ed30037` corrected that expectation to failure code 62 and generation/meta/journal invalidation. The subsequent clean media-enabled cumulative run passes 38,730 assertions in 697 cases. The repaired exact candidate tree is deliberately supplied by the review packet rather than self-referenced from inside this goal ## PR Monitor Hot Path -* exact-head CI reopened only the HNSW test-determinism and zero-byte empty-adjacency copy slice. The repair is locally proven and recursively reviewed; next validate the updated paper/evidence/goal record once, commit and push without force, then monitor replacement exact-head CI and keep the branch synchronized with current main without merging or closing +* validate the direct record corrections, commit and push without force, reply to and resolve all seven proven PR threads, and monitor replacement exact-head CI while keeping the branch synchronized with current main * every ten minutes in this current task, refresh PR 6 exact head, checks, mergeability, reviews, review requests, comments, and unresolved threads; compare with the prior state and report only changes * repair only in-scope failures or review findings with proportionate proof and the required fresh review; push without force and update this goal to the new exact head * stop and deactivate the heartbeat when the PR merges or closes externally, repair exceeds scope, target drift is unrecoverable, or authority is explicitly denied diff --git a/docs/paper/_manuscript/index.md b/docs/paper/_manuscript/index.md index 68aaf7cd..733eb3f5 100644 --- a/docs/paper/_manuscript/index.md +++ b/docs/paper/_manuscript/index.md @@ -5531,6 +5531,19 @@ effective-value view. This ordering prevents restart from seeding a working slot with an uncalibrated strength and subsequently persisting that stale value. +Consolidation candidate selection also consumes effective rather than +stale materialized RIF strength. It merges an indexed, at-most-*A* +inactive-memory frontier with an at-most-*A* exact active-RIF frontier, +then retains the lowest *A* combined identities for scoring. Before the +active branch is evaluated, the implementation counts at most 64*C* + 1 +active rows and fails closed when the existing knob-derived active-epoch +mutation ceiling 64*C* has been exceeded. Consequently the indexed +inactive scan can skip at most 64*C* active rows, the active calculation +examines at most 64*C* rows, and downstream association work still sees +at most *A* identities. A recovered active row therefore cannot consume +a low-strength slot merely because its durable `memories.strength` has +not yet been materialized. + The authoritative signal mutation still commits once to persistent SQLite. After that commit, a separate connection-local in-memory SQLite database publishes only the current recovery clock and the identities @@ -5931,6 +5944,35 @@ activation route fixes disconnected-node blindness without introducing a second retrieval or write path; HNSW controls locality while the derived envelope controls exact coverage and work. +Deterministic envelope completion reads only rows with `active=1` +through the existing `(generation, active, memory_id)` index. Sealed +removals therefore do not consume the fixed node budget or hide an +isolated active identity just beyond an inactive slice. CMake and Zig +compile the same pinned HNSW safety patch. The Zig graph copies the +header-only dependency into a build-local declared output and patches +that copy, leaving the content-addressed global package cache immutable +and safe for concurrent builds. + +When a sealed removal targets the canonical hierarchy entry, replacement +is selected by highest level and then lowest memory id through the +`(generation, active, level DESC, memory_id ASC)` index. The query reads +at most the staged removal count plus one row: at most that many leading +rows can be excluded by the same seal. The replacement’s level becomes +the new `max_level`, so restart never begins from an inactive entry or +asks a lower level node for nonexistent upper adjacency. If any sealed +removal overlaps the persisted consolidation activation snapshot, the +snapshot entry, generation, centroid, and identity list are cleared in +the same transaction; in-process and restarted queries then use the +canonical route until the next successful recenter builds a new bounded +snapshot. Restart validates that the metadata entry exists in the same +generation, is active, and carries the recorded maximum level. A legacy +route with a dead or mismatched entry fails closed to exact retrieval +and the same bounded builder, rather than waiting for a future removal +to repair already-stale metadata. It likewise resolves the at-most-*A* +persisted activation identities and requires every one to remain active +in the same generation, covering snapshots written by the prior +implementation before removal-overlap clearing existed. + Within one activation query, the row-addressed route stores each persisted node’s exact query distance beside that query’s local node view. Higher-level descent, level-zero expansion, best-set maintenance, @@ -5994,14 +6036,20 @@ to the durable journal. A successful seal writes changed nodes and knob-bounded reciprocal neighbors, advances graph metadata, and clears only its staged root identities in the same SQLite transaction. Neighbor proposal during this seal uses the *C* + *B* node and 2*B* queue -construction envelope, not the public 9*C* activation envelope. Existing -active nodes retain their persisted topology when their current -embedding changes; the rejected bounded-relink experiment is reported in -the optimization section. A failed authoritative transaction cannot -leave a durable route mutation. An interrupted or failed seal leaves the -identities journaled for restaging, while exact retrieval remains -authoritative. This gives consolidation a real route-epoch boundary -without a store-sized graph rewrite. +construction envelope, not the public 9*C* activation envelope. If an +existing active node’s normalized embedding moves beyond the fixed +10−6 cosine-distance tolerance, the generation is invalidated +rather than pairing the new vector with stale adjacency. Exact retrieval +remains authoritative while the existing bounded backfill constructs a +replacement generation. The rejected incremental-relink experiment is +reported in the optimization section. A failed authoritative transaction +cannot leave a durable route mutation. An ordinary interrupted or failed +seal leaves the identities journaled for restaging. Intentional +moved-embedding invalidation instead abandons the incoherent generation +and clears its journal; the authoritative current surface feeds the +replacement bounded build while exact retrieval remains authoritative. +This gives consolidation a real route-epoch boundary without a +store-sized graph rewrite. Application hydration uses the same bounded-surface rule when a memory has no materialized memory or reconstruction blob. SQLite retains every @@ -6094,14 +6142,23 @@ signal-counter, and rate-observation paths are not maintenance steps. Emotional cascade metadata is hydrated into a private, rebuildable processor cache keyed by memory id and base embedding id. The cache -preserves the SQL contract for shared embeddings by retaining every -member row, deriving current intensity and half-life bonus with the same -per-embedding minima, and retaining only flashbulb rows in recency order -for source discovery. Emotional consolidation overwrites the affected -embedding family, cascade propagation applies the existing maxima, -storage and shallow consolidation append rows, and eviction removes -them. Journal-aware rollback discards and rehydrates this -database-derived cache, while arbitrary custom pipelines retain the +preserves the SQL aggregation contract for shared embeddings by +retaining every member row and deriving current intensity and half-life +bonus with the same per-embedding minima. Its global bounded +flashbulb-source prefix is ordered by descending emotional intensity +with ascending memory-id ties. A source insertion, removal, or intensity +mutation marks that prefix dirty; before the next cascade, SQLite +refreshes exactly the knob-derived prefix through a partial +intensity/memory-id index and `LIMIT`, so an excluded source can enter +after a retained source falls without a store-sized cache scan. This +establishes intensity-before-truncation ordering, not complete selection +equivalence: the cache bounds the global flashbulb prefix before cascade +recency/arousal eligibility, while the fallback SQL applies those +eligibility predicates before `LIMIT`. Emotional consolidation +overwrites the affected embedding family, cascade propagation applies +the existing maxima, storage and shallow consolidation append rows, and +eviction removes them. Journal-aware rollback discards and rehydrates +this database-derived cache, while arbitrary custom pipelines retain the complete snapshot path. This changes execution ownership only; source thresholds, tie order, traversal, decay, updates, and persisted rows are unchanged. When multiple emotional sources require traversal, the @@ -6119,6 +6176,9 @@ source’s expansion footprint. A topology rebuild invalidates the footprint conservatively. Ordinary unconnected non-source inserts and monotone increases to target emotional values likewise preserve the fixed point; source changes and target-value decreases still re-arm it. +A traversal that reaches either its update ceiling or its physical +edge-visit ceiling is only a partial prefix and never records a fixed +point, so the next event revisits the unresolved graph tail. Shallow consolidation is embedding-only. It clusters eligible long-term memories, writes an `ASSOCIATION` centroid node for each cluster, @@ -7863,7 +7923,12 @@ links and remains the nearest result after reopen. The full replay rejected it: exact top-1 fell to 0.980469, mean identity recall at 16 to 0.972794, semantic coverage to 0.964210, and maximum seal time rose to 140.669 ms. The source change and its regression were removed; the -result remains as negative evidence. +result remains as negative evidence. The retained correctness repair +does not revive that relinker. A changed active embedding invalidates +the persisted generation, exact retrieval covers the interval, and the +already-bounded historical builder creates a coherent replacement. Entry +removal is cheaper: an indexed removal-count-plus-one query promotes the +highest-level surviving node with deterministic identity ties. The dual-seed candidate tested activation entry ownership instead. The prior recenter operation replaced the canonical maximum-level HNSW entry @@ -8639,6 +8704,20 @@ cannot hide an expanding graph walk. A 70-source regression now proves winner with the same final intensity. Full-horizon performance, work-bound, and retrieval results remain required before retention. +The bounded source prefix uses the same intensity-descending, memory-id +ascending order as the SQL path. Because emotional consolidation can +lower an existing source and cascade propagation can raise one, +incremental insertion alone is insufficient: the next-best source may +currently be outside the prefix. The retained repair marks rank-changing +mutations dirty and rebuilds only the knob-derived prefix from a partial +SQLite index. Regressions cover a retained source falling below an +excluded source and an excluded source rising to the front; query-plan +proof confirms that refresh uses the index rather than a store scan. +This proof is specifically intensity-before-truncation. The bounded +cache still chooses its global flashbulb prefix before recency/arousal +eligibility, whereas fallback SQL filters eligibility before `LIMIT`; +complete cache/fallback source-selection equivalence remains unclaimed. + The complete exact-winner replay kept top-1 at 1.0, recall at 16 at 0.999386, and semantic coverage at 0.999381, but it did not improve the full run: wall time was 205,445 ms versus 194,736 ms for snapshot reuse @@ -8761,24 +8840,35 @@ routing details before changing the algorithm. Commit timing had included a profiling-only vector identity lookup; identity resolution now occurs when the committed mutation audit is consumed, while the independent logical and physical audit streams remain intact. Mature -deterministic route completion now draws from the indexed generation -slice and applies active eligibility at ranking, so an inactive row -cannot make the fixed envelope appear one row short. The RIF changed-row -counter now records work performed by the current event rather than the -historical active population. Each correction has a red-then-green -regression and changes measurement, not public retrieval semantics. +deterministic route completion now draws from the indexed +active-generation slice, so an inactive row cannot consume the fixed +envelope or hide a later active identity. The CMake and Zig build graphs +apply the same content-checked HNSW bounds patch; Zig patches a +build-local copy rather than mutating its shared package cache. The RIF +changed-row counter now records work performed by the current event +rather than the historical active population. Each correction has a +red-then-green regression and changes measurement, not public retrieval +semantics. The remaining consolidation scan was bounded by the same knobs. Let *A* = 2*C* + 2*B* and *N* = max (8, ⌊*B*/2⌋). Score consolidation now -admits at most *A* low-strength long-term identities from the indexed -strength/time frontier and counts at most *N* association edges per -admitted identity. A sentinel row publishes the exact input cardinality -even when no candidate is selected. The formula, counter, and -source/modality invariants pass all 27 -*F*, *S*, *T* ∈ {0, 0.5, 1}3 configurations across text, -audio, image, and four opaque source labels. At midpoint *C* = 512, -*B* = 128, *A* = 1280, and *N* = 64; 129 occurs only as the logical -*B* + 1 completion probe. +admits at most *A* low-effective-strength long-term identities after +merging two frontiers: at most *A* inactive identities from the indexed +materialized strength/time order and at most *A* active identities +ordered by their exact clock-derived RIF strength. A 64*C* + 1 sentinel +count fails closed before the active branch when the existing +active-epoch mutation ceiling would be exceeded. This bounds the +inactive index scan by *A* + 64*C*, the dynamic active calculation by +64*C*, and the merged/downstream frontier by *A*, without a +history-sized sort. It also prevents partially recovered rows with stale +low materialized strength from excluding a genuinely weak row. The +scorer counts at most *N* association edges per admitted identity. A +sentinel row publishes the exact input cardinality even when no +candidate is selected. The formula, counter, and source/modality +invariants pass all 27 *F*, *S*, *T* ∈ {0, 0.5, 1}3 +configurations across text, audio, image, and four opaque source labels. +At midpoint *C* = 512, *B* = 128, *A* = 1280, and *N* = 64; 129 occurs +only as the logical *B* + 1 completion probe. Four ordinary SQLite-route seal cadences were evaluated. Sealing every write raised full-replay wall time to 107,294 ms and did not remove @@ -9305,14 +9395,26 @@ deployment remain unclaimed. before working-memory hydration; pinned HNSW speculative neighbor prefetches are adjacency-bounded without disabling SIMD distance kernels; empty adjacency snapshots skip a zero-byte copy whose vector -destination may be null; and cache-byte arithmetic uses explicit -std::size_t width for WebAssembly. The full media CTest, -focused RIF and HNSW regressions, and WebAssembly bundle build pass -locally. The sandboxed macOS ASAN runtime cannot execute because -dynamic-shadow discovery or sanitizer-runtime code signing fails before -main(), so exact-head Linux sanitizer CI remains the -required owner; the historical 4,608-query quality matrix is not -relabeled as evidence from the repaired binary. +destination may be null; Zig applies the same patch to a build-local +copy; deterministic route fill excludes inactive rows; entry removal +promotes an indexed active hierarchy root, atomically clears overlapping +activation snapshots, and restart rejects legacy dead canonical or +snapshot identities; changed active embeddings invalidate stale +adjacency for bounded rebuild; consolidation merges exact active-RIF and +indexed inactive frontiers under the existing 64C/A ceilings; bounded emotional-source +discovery preserves SQL intensity order and refreshes rank-changing +mutations through an indexed knob-sized prefix; partial edge-limited +cascade traversals do not become fixed points; and cache-byte arithmetic +uses explicit std::size_t width for WebAssembly. The full +media CTest baseline, focused RIF/HNSW/consolidation regressions, +build-local Zig proof, and WebAssembly bundle build pass locally. The +sandboxed macOS ASAN runtime cannot execute because dynamic-shadow +discovery or sanitizer-runtime code signing fails before +main(), so replacement exact-head Linux sanitizer CI +remains the required owner; the historical 4,608-query quality matrix is +not relabeled as evidence from the repaired binary. TRACE[state:hnsw_fixed_6c_experiment] diff --git a/docs/paper/sections/10_implementation.qmd b/docs/paper/sections/10_implementation.qmd index 5a62555b..e903b9c7 100644 --- a/docs/paper/sections/10_implementation.qmd +++ b/docs/paper/sections/10_implementation.qmd @@ -108,6 +108,18 @@ active epoch before working-memory hydration reads the effective-value view. This ordering prevents restart from seeding a working slot with an uncalibrated strength and subsequently persisting that stale value. +Consolidation candidate selection also consumes effective rather than stale +materialized RIF strength. It merges an indexed, at-most-$A$ inactive-memory +frontier with an at-most-$A$ exact active-RIF frontier, then retains the lowest +$A$ combined identities for scoring. Before the active branch is evaluated, +the implementation counts at most $64C+1$ active rows and fails closed when the +existing knob-derived active-epoch mutation ceiling $64C$ has been exceeded. +Consequently the indexed inactive scan can skip at most $64C$ active rows, the +active calculation examines at most $64C$ rows, and downstream association work +still sees at most $A$ identities. A recovered active row therefore cannot +consume a low-strength slot merely because its durable `memories.strength` has +not yet been materialized. + The authoritative signal mutation still commits once to persistent SQLite. After that commit, a separate connection-local in-memory SQLite database publishes only the current recovery clock and the identities touched in the @@ -493,6 +505,33 @@ route fixes disconnected-node blindness without introducing a second retrieval or write path; HNSW controls locality while the derived envelope controls exact coverage and work. +Deterministic envelope completion reads only rows with `active=1` through the +existing `(generation, active, memory_id)` index. Sealed removals therefore do +not consume the fixed node budget or hide an isolated active identity just +beyond an inactive slice. CMake and Zig compile the same pinned HNSW safety +patch. The Zig graph copies the header-only dependency into a build-local +declared output and patches that copy, leaving the content-addressed global +package cache immutable and safe for concurrent builds. + +When a sealed removal targets the canonical hierarchy entry, replacement is +selected by highest level and then lowest memory id through the +`(generation, active, level DESC, memory_id ASC)` index. The query reads at +most the staged removal count plus one row: at most that many leading rows can +be excluded by the same seal. The replacement's level becomes the new +`max_level`, so restart never begins from an inactive entry or asks a lower +level node for nonexistent upper adjacency. +If any sealed removal overlaps the persisted consolidation activation snapshot, +the snapshot entry, generation, centroid, and identity list are cleared in the +same transaction; in-process and restarted queries then use the canonical +route until the next successful recenter builds a new bounded snapshot. +Restart validates that the metadata entry exists in the same generation, is +active, and carries the recorded maximum level. A legacy route with a dead or +mismatched entry fails closed to exact retrieval and the same bounded builder, +rather than waiting for a future removal to repair already-stale metadata. +It likewise resolves the at-most-$A$ persisted activation identities and +requires every one to remain active in the same generation, covering snapshots +written by the prior implementation before removal-overlap clearing existed. + Within one activation query, the row-addressed route stores each persisted node's exact query distance beside that query's local node view. Higher-level descent, level-zero expansion, best-set maintenance, and the final exact @@ -550,11 +589,17 @@ durable journal. A successful seal writes changed nodes and knob-bounded reciprocal neighbors, advances graph metadata, and clears only its staged root identities in the same SQLite transaction. Neighbor proposal during this seal uses the $C+B$ node and $2B$ queue construction envelope, not the public $9C$ -activation envelope. Existing active nodes retain their persisted topology when -their current embedding changes; the rejected bounded-relink experiment is -reported in the optimization section. A failed authoritative transaction -cannot leave a durable route mutation. An interrupted or failed seal leaves the -identities journaled for restaging, while exact retrieval remains authoritative. +activation envelope. If an existing active node's normalized embedding moves +beyond the fixed $10^{-6}$ cosine-distance tolerance, +the generation is invalidated rather than pairing the new vector with stale +adjacency. Exact retrieval remains authoritative while the existing bounded +backfill constructs a replacement generation. The rejected incremental-relink +experiment is reported in the optimization section. A failed authoritative transaction +cannot leave a durable route mutation. An ordinary interrupted or failed seal +leaves the identities journaled for restaging. Intentional moved-embedding +invalidation instead abandons the incoherent generation and clears its journal; +the authoritative current surface feeds the replacement bounded build while +exact retrieval remains authoritative. This gives consolidation a real route-epoch boundary without a store-sized graph rewrite. @@ -645,9 +690,18 @@ steps. Emotional cascade metadata is hydrated into a private, rebuildable processor cache keyed by memory id and base embedding id. The cache preserves the SQL -contract for shared embeddings by retaining every member row, deriving current -intensity and half-life bonus with the same per-embedding minima, and retaining -only flashbulb rows in recency order for source discovery. Emotional +aggregation contract for shared embeddings by retaining every member row and +deriving current intensity and half-life bonus with the same per-embedding +minima. Its global bounded flashbulb-source prefix is ordered by descending +emotional intensity with ascending memory-id ties. A source insertion, removal, +or intensity mutation +marks that prefix dirty; before the next cascade, SQLite refreshes exactly the +knob-derived prefix through a partial intensity/memory-id index and `LIMIT`, so +an excluded source can enter after a retained source falls without a +store-sized cache scan. This establishes intensity-before-truncation ordering, +not complete selection equivalence: the cache bounds the global flashbulb +prefix before cascade recency/arousal eligibility, while the fallback SQL +applies those eligibility predicates before `LIMIT`. Emotional consolidation overwrites the affected embedding family, cascade propagation applies the existing maxima, storage and shallow consolidation append rows, and eviction removes them. Journal-aware rollback discards and rehydrates this @@ -667,7 +721,10 @@ advance the fixed point without another traversal when neither endpoint lies in any source's expansion footprint. A topology rebuild invalidates the footprint conservatively. Ordinary unconnected non-source inserts and monotone increases to target emotional values likewise preserve the fixed -point; source changes and target-value decreases still re-arm it. +point; source changes and target-value decreases still re-arm it. A traversal +that reaches either its update ceiling or its physical edge-visit ceiling is +only a partial prefix and never records a fixed point, so the next event +revisits the unresolved graph tail. Shallow consolidation is embedding-only. It clusters eligible long-term memories, writes an `ASSOCIATION` centroid node for each cluster, assigns source diff --git a/docs/paper/sections/11_optimization.qmd b/docs/paper/sections/11_optimization.qmd index 7b7d9934..30ec95f8 100644 --- a/docs/paper/sections/11_optimization.qmd +++ b/docs/paper/sections/11_optimization.qmd @@ -974,7 +974,12 @@ restart regression proved a moved centroid changes persisted links and remains the nearest result after reopen. The full replay rejected it: exact top-1 fell to 0.980469, mean identity recall at 16 to 0.972794, semantic coverage to 0.964210, and maximum seal time rose to 140.669 ms. The source change and its -regression were removed; the result remains as negative evidence. +regression were removed; the result remains as negative evidence. The retained +correctness repair does not revive that relinker. A changed active embedding +invalidates the persisted generation, exact retrieval covers the interval, and +the already-bounded historical builder creates a coherent replacement. Entry +removal is cheaper: an indexed removal-count-plus-one query promotes the +highest-level surviving node with deterministic identity ties. The dual-seed candidate tested activation entry ownership instead. The prior recenter operation replaced the canonical maximum-level HNSW entry with the @@ -1346,6 +1351,19 @@ now proves 70 reachable pairs and 70 physical edge visits collapse to one executed winner with the same final intensity. Full-horizon performance, work-bound, and retrieval results remain required before retention. +The bounded source prefix uses the same intensity-descending, memory-id +ascending order as the SQL path. Because emotional consolidation can lower an +existing source and cascade propagation can raise one, incremental insertion +alone is insufficient: the next-best source may currently be outside the +prefix. The retained repair marks rank-changing mutations dirty and rebuilds +only the knob-derived prefix from a partial SQLite index. Regressions cover a +retained source falling below an excluded source and an excluded source rising +to the front; query-plan proof confirms that refresh uses the index rather than +a store scan. This proof is specifically intensity-before-truncation. The +bounded cache still chooses its global flashbulb prefix before recency/arousal +eligibility, whereas fallback SQL filters eligibility before `LIMIT`; complete +cache/fallback source-selection equivalence remains unclaimed. + The complete exact-winner replay kept top-1 at 1.0, recall at 16 at 0.999386, and semantic coverage at 0.999381, but it did not improve the full run: wall time was 205,445 ms versus 194,736 ms for snapshot reuse alone, and @@ -1456,17 +1474,27 @@ details before changing the algorithm. Commit timing had included a profiling-only vector identity lookup; identity resolution now occurs when the committed mutation audit is consumed, while the independent logical and physical audit streams remain intact. Mature deterministic route completion -now draws from the indexed generation slice and applies active eligibility at -ranking, so an inactive row cannot make the fixed envelope appear one row -short. The RIF changed-row counter now records work performed by the current +now draws from the indexed active-generation slice, so an inactive row cannot +consume the fixed envelope or hide a later active identity. The CMake and Zig +build graphs apply the same content-checked HNSW bounds patch; Zig patches a +build-local copy rather than mutating its shared package cache. The RIF +changed-row counter now records work performed by the current event rather than the historical active population. Each correction has a red-then-green regression and changes measurement, not public retrieval semantics. The remaining consolidation scan was bounded by the same knobs. Let $A=2C+2B$ and $N=\max(8,\lfloor B/2\rfloor)$. Score consolidation now admits -at most $A$ low-strength long-term identities from the indexed strength/time -frontier and counts at most $N$ association edges per admitted identity. A +at most $A$ low-effective-strength long-term identities after merging two +frontiers: at most $A$ inactive identities from the indexed materialized +strength/time order and at most $A$ active identities ordered by their exact +clock-derived RIF strength. A $64C+1$ sentinel count fails closed before the +active branch when the existing active-epoch mutation ceiling would be +exceeded. This bounds the inactive index scan by $A+64C$, the dynamic active +calculation by $64C$, and the merged/downstream frontier by $A$, without a +history-sized sort. It also prevents partially recovered rows with stale low +materialized strength from excluding a genuinely weak row. The scorer counts +at most $N$ association edges per admitted identity. A sentinel row publishes the exact input cardinality even when no candidate is selected. The formula, counter, and source/modality invariants pass all 27 $F,S,T\in\{0,0.5,1\}^3$ configurations across text, audio, image, and four @@ -1633,7 +1661,7 @@ observation-only result is never promoted to production-path proof. | `TRACE[state:sqlite_hnsw_sparse_route_integration]` | Retained row-addressed SQLite HNSW query and incremental seal in the existing `GraphRetrieve` and `MemoryStorage` paths; Natural and Durable share the same algorithm, and Durable adds only its checkpoint. Current full-corpus retrieval quality and activation bounds pass, while the Natural whole-engine plateau and Durable horizon gates remain open. | | `TRACE[state:sqlite_hnsw_activation_effort_cycle]` | Queue-effort-only, fixed-$5C$, and dynamic $4C$ through $8C$ floor variants were rejected or superseded. The retained candidate resets routing work to $8C$, advances by $R=\max(2,\lfloor B/16\rfloor)$ to $9C$, keeps $A=2C+2B$ downstream activation and $2B/(C+B)$ construction, passes the 30,380-packet mature-cycle gates at 511/512 top-1 and recall@16 0.999265, and passes canonical and nine-point quality without an engine-wide plateau claim. | | `TRACE[state:sqlite_hnsw_production_cutover]` | Retained the existing SQLite HNSW route as the production default at an $8C$ post-consolidation floor, $R=\max(2,\lfloor B/16\rfloor)$ step, $9C$ ceiling, separate $A=2C+2B$ snapshot, and $9C+A$ total row ceiling. The nine-point matrix passed 4,608/4,608 top-1 controls, minimum recall@16 and semantic coverage 1.0, deterministic ties, and source/modality-label invariance. Natural and Durable share the operation path, with Durable adding only its checkpoint; whole-engine reset, bounded restart, Durable plateau, release, and deployment remain unclaimed. | -| `TRACE[state:pr6_exact_head_ci_repair]` | PR-monitor repair record: migrated active RIF rows are calibrated before working-memory hydration; pinned HNSW speculative neighbor prefetches are adjacency-bounded without disabling SIMD distance kernels; empty adjacency snapshots skip a zero-byte copy whose vector destination may be null; and cache-byte arithmetic uses explicit `std::size_t` width for WebAssembly. The full media CTest, focused RIF and HNSW regressions, and WebAssembly bundle build pass locally. The sandboxed macOS ASAN runtime cannot execute because dynamic-shadow discovery or sanitizer-runtime code signing fails before `main()`, so exact-head Linux sanitizer CI remains the required owner; the historical 4,608-query quality matrix is not relabeled as evidence from the repaired binary. | +| `TRACE[state:pr6_exact_head_ci_repair]` | PR-monitor repair record: migrated active RIF rows are calibrated before working-memory hydration; pinned HNSW speculative neighbor prefetches are adjacency-bounded without disabling SIMD distance kernels; empty adjacency snapshots skip a zero-byte copy whose vector destination may be null; Zig applies the same patch to a build-local copy; deterministic route fill excludes inactive rows; entry removal promotes an indexed active hierarchy root, atomically clears overlapping activation snapshots, and restart rejects legacy dead canonical or snapshot identities; changed active embeddings invalidate stale adjacency for bounded rebuild; consolidation merges exact active-RIF and indexed inactive frontiers under the existing $64C$/$A$ ceilings; bounded emotional-source discovery preserves SQL intensity order and refreshes rank-changing mutations through an indexed knob-sized prefix; partial edge-limited cascade traversals do not become fixed points; and cache-byte arithmetic uses explicit `std::size_t` width for WebAssembly. The full media CTest baseline, focused RIF/HNSW/consolidation regressions, build-local Zig proof, and WebAssembly bundle build pass locally. The sandboxed macOS ASAN runtime cannot execute because dynamic-shadow discovery or sanitizer-runtime code signing fails before `main()`, so replacement exact-head Linux sanitizer CI remains the required owner; the historical 4,608-query quality matrix is not relabeled as evidence from the repaired binary. | | `TRACE[state:hnsw_fixed_6c_experiment]` | Rejected knob-derived fixed-$6C$ routing envelope. All 27 structural F/S/T points and 931 assertions passed; neutral $C=512$ produced a 3,072-node envelope while $B=128$ and the 129 boundary remained distinct. An extra production-default F=.45/S=.5/T=.5 pre-screen missed exact top-1, recall@16, plateau, and wall-time gates, so fail-fast rejected the candidate before the exact nine-point corpus matrix started and left production on fixed $5C$. | | `TRACE[state:post_rif_empty_fixed_envelope_attribution]` | Repaired proof classification for the retained zero-increment fixed-$5C/5C$ route. Retrieval mode is independent of whole-engine process shape; route-active rows fail closed on missing work, and queue, node ceiling, actual visits, distance work, and activation are checked separately across at least ten mature unchanged-envelope recenters. The production suffix beginning at event 10,195 passes the classifier and work envelope across 12 complete recenters, while activated-identity overlap, process-cycle reset, exact full-horizon retrieval, Durable horizon, and bounded restart remain open. | | `TRACE[state:write_gate_incidence_attribution_v2]` | Deterministic range-bound observation-only 15,695-packet production-knob attribution rejected boundary-to-write incidence as the growth source: exact event ranges 0--2,499 and 13,195--15,694 contained 510 and 528 writes, while MemoryStorage time per write rose from 0.4833 to 2.8343 ms as the existing shared SQLite HNSW route warmed toward the fixed $5C=2{,}495$ envelope. Production $C/B/A=499/125/1{,}248$ and construction $C+B/2B=624/250$ remain derived; neutral $C/B/A=512/128/1{,}280$ and 129 is only logical $B+1$. Raw reset remains failed and unwaived; 27 structural and nine production-shaped F/S/T ablations remain required. | diff --git a/src/operations/consolidation.cpp b/src/operations/consolidation.cpp index 51bf400a..3abcb615 100644 --- a/src/operations/consolidation.cpp +++ b/src/operations/consolidation.cpp @@ -6,6 +6,7 @@ #include "cortext/core/utils.hpp" #include "cortext/processor/operation_context.hpp" #include "cortext/telemetry/telemetry.hpp" +#include "rif_active_epoch_cache_internal.hpp" #include "sparse_retrieval_knobs_internal.hpp" #include #include @@ -58,12 +59,70 @@ ScoreConsolidation::Execute (OperationContext &context, Transaction &tx) const const auto association_edge_limit = sparse_retrieval_knobs_internal::GraphNeighborCount ( F_raw, S_raw, T); + const auto active_state_limit + = rif_active_epoch_cache_internal::DeriveLimits ( + F_raw, S_raw, T) + .mutation_count; + const auto active_count_rows = tx.Execute ( + "SELECT COUNT(*) AS row_count FROM (" + " SELECT 1 FROM rif_active_state LIMIT ?" + ")", + { static_cast (active_state_limit + 1) }); + long long active_state_count = 0; + if (!active_count_rows.empty ()) + { + const auto row_count + = active_count_rows.front ().find ("row_count"); + if (row_count != active_count_rows.front ().end () + && row_count->second.type () == typeid (long long)) + active_state_count = std::any_cast (row_count->second); + } + context.AddOperationTiming ( + "ScoreConsolidation.active_state_limit", + static_cast (active_state_limit)); + context.AddOperationTiming ( + "ScoreConsolidation.active_state_count", + static_cast (active_state_count)); + if (active_state_count > static_cast (active_state_limit)) + throw StoreError ( + "ScoreConsolidation active RIF frontier exceeds its knob-derived " + "work ceiling"); const std::string query - = "WITH candidate_ids AS MATERIALIZED (" - " SELECT memory_id " - " FROM memories INDEXED BY idx_memories_ltm_strength_created " - " WHERE kind = 'LONG_TERM' " - " ORDER BY strength ASC, created_at ASC, embedding_id ASC " + = "WITH inactive_candidate_ids AS MATERIALIZED (" + " SELECT m.memory_id, m.strength AS effective_strength, " + " m.created_at, m.embedding_id " + " FROM memories m INDEXED BY idx_memories_ltm_strength_created " + " WHERE m.kind = 'LONG_TERM' " + " AND NOT EXISTS(" + " SELECT 1 FROM rif_active_state a " + " WHERE a.memory_id = m.memory_id" + " ) " + " ORDER BY m.strength ASC, m.created_at ASC, " + " m.embedding_id ASC " + " LIMIT ?8" + "), active_candidate_ids AS MATERIALIZED (" + " SELECT m.memory_id, " + " CASE WHEN a.generation = c.generation THEN " + " MAX(0.0, a.recovery_total - " + " a.anchor_suppression * " + " exp(c.log_factor - a.anchor_log_factor)) " + " ELSE a.recovery_total END AS effective_strength, " + " m.created_at, m.embedding_id " + " FROM rif_active_state a " + " JOIN memories m ON m.memory_id = a.memory_id " + " CROSS JOIN rif_recovery_clock c " + " WHERE m.kind = 'LONG_TERM' AND c.singleton = 1 " + " ORDER BY effective_strength ASC, m.created_at ASC, " + " m.embedding_id ASC " + " LIMIT ?8" + "), candidate_ids AS MATERIALIZED (" + " SELECT memory_id FROM (" + " SELECT * FROM inactive_candidate_ids " + " UNION ALL " + " SELECT * FROM active_candidate_ids" + " ) " + " ORDER BY effective_strength ASC, created_at ASC, " + " embedding_id ASC " " LIMIT ?8" "), input_count AS (" " SELECT COUNT(*) AS candidate_input_count FROM candidate_ids" diff --git a/src/operations/emotion_cascade.cpp b/src/operations/emotion_cascade.cpp index 362ef181..40e36807 100644 --- a/src/operations/emotion_cascade.cpp +++ b/src/operations/emotion_cascade.cpp @@ -602,10 +602,14 @@ PropagateEmotionalCascade::Execute (OperationContext &context, Transaction &tx) auto &p_ctx = context.GetProcessorContext (); const auto emotional_state = emotional_metadata_cache_internal::FindState (p_ctx); - const bool use_metadata_cache + bool use_metadata_cache = emotional_state && emotional_state->emotional_metadata.valid && !internal::experimental_env::Flag ( "CORTEXT_PROFILE_EMOTIONAL_METADATA_SQL"); + if (use_metadata_cache + && !emotional_metadata_cache_internal::RefreshBoundedSourceOrder ( + p_ctx, tx)) + use_metadata_cache = false; const std::uint64_t emotional_input_generation = use_metadata_cache ? emotional_state->emotional_metadata.cascade_input_generation @@ -906,7 +910,7 @@ PropagateEmotionalCascade::Execute (OperationContext &context, Transaction &tx) break; } - if (update_limit_reached) + if (update_limit_reached || edge_visit_limit_reached) InvalidateCascadeFixedPoint (p_ctx); else if (use_metadata_cache && fanout_cache && fanout_cache->valid) { diff --git a/src/operations/emotional_metadata_cache_internal.hpp b/src/operations/emotional_metadata_cache_internal.hpp index 1993efbd..1693f95a 100644 --- a/src/operations/emotional_metadata_cache_internal.hpp +++ b/src/operations/emotional_metadata_cache_internal.hpp @@ -1,6 +1,7 @@ #pragma once #include "cortext/processor/processor_context.hpp" +#include "cortext/store/store.hpp" #include "execution_cache_sidecar_internal.hpp" #include @@ -79,6 +80,10 @@ Remove (ProcessorContext &p_ctx, long long memory_id) if (row == cache.rows_by_memory.end ()) return; const long long embedding_id = row->second.embedding_id; + if (row->second.flashbulb + && cache.source_query_capacity + != std::numeric_limits::max ()) + cache.source_query_order_dirty = true; cache.rows_by_memory.erase (row); auto members = cache.memory_ids_by_embedding.find (embedding_id); if (members != cache.memory_ids_by_embedding.end ()) @@ -101,9 +106,9 @@ BeforeSourceQuery (const Row &left, const Row &right) inline bool BeforeBoundedSourceQuery (const Row &left, const Row &right) { - if (left.created_at != right.created_at) - return left.created_at > right.created_at; - return left.memory_id > right.memory_id; + if (left.intensity != right.intensity) + return left.intensity > right.intensity; + return left.memory_id < right.memory_id; } inline void @@ -146,6 +151,9 @@ Upsert (ProcessorContext &p_ctx, Row row) cache.source_query_order.insert (position, memory_id); if (cache.source_query_order.size () > cache.source_query_capacity) cache.source_query_order.pop_back (); + if (cache.source_query_capacity + != std::numeric_limits::max ()) + cache.source_query_order_dirty = true; } RecomputeEmbedding (cache, embedding_id); // A newly persisted, unconnected non-source cannot change a completed @@ -172,6 +180,51 @@ Reset (ProcessorContext &p_ctx, std::vector rows, cache.source_query_order.reserve (rows.size ()); for (auto &row : rows) Upsert (p_ctx, std::move (row)); + cache.source_query_order_dirty = false; +} + +inline bool +RefreshBoundedSourceOrder (ProcessorContext &p_ctx, Transaction &tx) +{ + const auto state = FindState (p_ctx); + if (!state) + return false; + auto &cache = state->emotional_metadata; + if (!cache.valid) + return false; + if (cache.source_query_capacity + == std::numeric_limits::max () + || !cache.source_query_order_dirty) + return true; + + auto rows = tx.Execute ( + "SELECT memory_id FROM memories " + "WHERE flashbulb = 1 AND embedding_id IS NOT NULL " + "AND kind != 'WORKING' " + "ORDER BY emotional_intensity DESC, memory_id ASC LIMIT ?", + { static_cast (cache.source_query_capacity) }); + std::vector order; + order.reserve (rows.size ()); + for (const auto &result : rows) + { + const auto id = result.find ("memory_id"); + if (id == result.end () || id->second.type () != typeid (long long)) + { + cache.valid = false; + return false; + } + const long long memory_id = std::any_cast (id->second); + const auto cached = cache.rows_by_memory.find (memory_id); + if (cached == cache.rows_by_memory.end () || !cached->second.flashbulb) + { + cache.valid = false; + return false; + } + order.push_back (memory_id); + } + cache.source_query_order = std::move (order); + cache.source_query_order_dirty = false; + return true; } inline void @@ -202,6 +255,8 @@ OverwriteEmbedding (ProcessorContext &p_ctx, long long embedding_id, { auto &row = cache.rows_by_memory.at (memory_id); const bool became_source = !row.flashbulb && flashbulb; + const bool source_rank_changed + = (row.flashbulb || flashbulb) && row.intensity != intensity; source_input_changed = source_input_changed || became_source || (row.flashbulb @@ -231,6 +286,10 @@ OverwriteEmbedding (ProcessorContext &p_ctx, long long embedding_id, if (cache.source_query_order.size () > cache.source_query_capacity) cache.source_query_order.pop_back (); } + if (cache.source_query_capacity + != std::numeric_limits::max () + && (became_source || source_rank_changed)) + cache.source_query_order_dirty = true; } RecomputeEmbedding (cache, embedding_id); const auto current_values = cache.values_by_embedding.find (embedding_id); @@ -264,6 +323,10 @@ MaxEmbedding (ProcessorContext &p_ctx, long long embedding_id, || (row.flashbulb && (intensity > row.intensity || bonus > row.half_life_bonus)); + if (cache.source_query_capacity + != std::numeric_limits::max () + && row.flashbulb && intensity > row.intensity) + cache.source_query_order_dirty = true; row.intensity = std::max (row.intensity, intensity); row.half_life_bonus = std::max (row.half_life_bonus, bonus); } diff --git a/src/operations/execution_cache_sidecar_internal.hpp b/src/operations/execution_cache_sidecar_internal.hpp index 6661db9b..d6e1a940 100644 --- a/src/operations/execution_cache_sidecar_internal.hpp +++ b/src/operations/execution_cache_sidecar_internal.hpp @@ -47,6 +47,7 @@ struct EmotionalMetadataCache std::size_t source_query_capacity = std::numeric_limits::max (); std::vector source_query_order; + bool source_query_order_dirty = false; }; struct EmotionalCascadeFixedPoint diff --git a/src/operations/historical_surface_search_cache_internal.hpp b/src/operations/historical_surface_search_cache_internal.hpp index 95277f96..e0befe1b 100644 --- a/src/operations/historical_surface_search_cache_internal.hpp +++ b/src/operations/historical_surface_search_cache_internal.hpp @@ -332,6 +332,11 @@ AdvanceSQLiteSparseRouteBackfill (State &state, Store &store) state.sqlite_sparse_route_backfill_failure_code = build->LastSealFailureCode (); ++state.sqlite_sparse_route_backfill_failure_count; + if (state.sqlite_sparse_route_backfill_failure_code == 62) + { + build.reset (); + return false; + } (void)build->SetBuildCursor (cursor); return false; } diff --git a/src/operations/sparse_retrieval_route_sqlite_internal.cpp b/src/operations/sparse_retrieval_route_sqlite_internal.cpp index e13db0e5..205d47ca 100644 --- a/src/operations/sparse_retrieval_route_sqlite_internal.cpp +++ b/src/operations/sparse_retrieval_route_sqlite_internal.cpp @@ -457,12 +457,19 @@ Route::Open (Store &store, int embedding_dim, Parameters parameters) try { const auto meta = store.Execute ( - "SELECT schema_version, embedding_dim, entry_memory_id, max_level, " - "active_count, generation, activation_entry_memory_id, " + "SELECT meta.schema_version, meta.embedding_dim, " + "meta.entry_memory_id, meta.max_level, meta.active_count, " + "meta.generation, meta.activation_entry_memory_id, " "activation_generation, COALESCE(activation_centroid, X'') AS " "activation_centroid, COALESCE(activation_identity_ids, X'') AS " - "activation_identity_ids FROM cortext_sparse_route_meta " - "WHERE singleton = 1"); + "activation_identity_ids, " + "(SELECT active FROM cortext_sparse_route_nodes entry " + " WHERE entry.memory_id = meta.entry_memory_id " + " AND entry.generation = meta.generation) AS entry_active, " + "(SELECT level FROM cortext_sparse_route_nodes entry " + " WHERE entry.memory_id = meta.entry_memory_id " + " AND entry.generation = meta.generation) AS entry_level " + "FROM cortext_sparse_route_meta meta WHERE singleton = 1"); if (meta.size () != 1 || Int64 (meta.front (), "schema_version") != kSchemaVersion || Int64 (meta.front (), "embedding_dim") != embedding_dim) @@ -478,6 +485,10 @@ Route::Open (Store &store, int embedding_dim, Parameters parameters) = Int64 (meta.front (), "activation_entry_memory_id", -1); const long long activation_generation = Int64 (meta.front (), "activation_generation", -1); + const long long entry_active + = Int64 (meta.front (), "entry_active", -1); + const long long entry_level + = Int64 (meta.front (), "entry_level", -1); const auto activation_centroid_bytes = store::BlobFromAny (meta.front ().at ("activation_centroid")); const auto activation_centroid @@ -494,7 +505,11 @@ Route::Open (Store &store, int embedding_dim, Parameters parameters) || max_level > static_cast (parameters.maximum_level) || active_count < 0 || generation < 0 || activation_entry < 0 || activation_generation < 0 - || (active_count > 0 && entry_memory_id == 0)) + || (active_count == 0 + && (entry_memory_id != 0 || max_level != 0)) + || (active_count > 0 + && (entry_memory_id == 0 || entry_active != 1 + || entry_level != max_level))) return nullptr; const bool has_activation = activation_entry > 0; if (has_activation @@ -512,13 +527,24 @@ Route::Open (Store &store, int embedding_dim, Parameters parameters) active_count, generation, std::move (parameters)); if (has_activation) { - const auto entry = FetchNodes ( + const auto activation_rows = FetchNodes ( store, embedding_dim, impl->parameters, generation, - { activation_entry }); - if (!entry || entry->size () != 1 || !entry->front ().active) + *activation_identity_ids); + if (!activation_rows + || activation_rows->size () != activation_identity_ids->size () + || std::any_of ( + activation_rows->begin (), activation_rows->end (), + [] (const NodeRow &row) { return !row.active; })) + return nullptr; + const auto entry = std::find_if ( + activation_rows->begin (), activation_rows->end (), + [activation_entry] (const NodeRow &row) { + return row.memory_id == activation_entry; + }); + if (entry == activation_rows->end ()) return nullptr; impl->activation_entry_memory_id = activation_entry; - impl->activation_entry_level = entry->front ().level; + impl->activation_entry_level = entry->level; impl->activation_centroid = *activation_centroid; impl->activation_identity_ids = *activation_identity_ids; } @@ -1077,7 +1103,7 @@ Route::SearchWithEnvelope (const Eigen::VectorXf &query, const auto rows = impl_->store->Execute ( std::string ( "SELECT memory_id FROM cortext_sparse_route_nodes " - "WHERE generation = ? AND memory_id ") + "WHERE generation = ? AND active = 1 AND memory_id ") + comparison + " ? ORDER BY memory_id LIMIT ?", { impl_->generation, pivot, @@ -1351,9 +1377,61 @@ Route::Seal (const sparse_retrieval_route_internal::Route *hnsw_route) for (auto node : *prior_rows) prior_by_id.emplace (node.memory_id, std::move (node)); + // Existing adjacency is derived from the stored embedding. Keeping + // those links after an embedding moves can make the row-addressed + // route silently miss its exact target. Invalidate the generation + // and let the bounded backfill rebuild it instead of publishing a + // mixed old-topology/new-vector snapshot. + bool topology_requires_rebuild = false; + for (const auto &[memory_id, embedding] : impl_->delta_embeddings) + { + const auto prior = prior_by_id.find (memory_id); + if (prior == prior_by_id.end () || !prior->second.active) + continue; + constexpr float kEmbeddingMovementEpsilon = 1e-6f; + topology_requires_rebuild + = prior->second.embedding.size () != embedding.size () + || Distance (embedding, prior->second.embedding) + > kEmbeddingMovementEpsilon; + if (topology_requires_rebuild) + break; + } + if (topology_requires_rebuild) + { + impl_->last_seal_failure_code = 62; + auto tx = impl_->store->Begin (); + tx->Execute ( + impl_->building + ? "DELETE FROM cortext_sparse_route_build " + "WHERE singleton = 1" + : "DELETE FROM cortext_sparse_route_meta " + "WHERE singleton = 1"); + tx->Execute ("DELETE FROM cortext_sparse_route_dirty"); + tx->Commit (); + impl_->node_cache.clear (); + impl_->node_cache_order.clear (); + impl_->delta_embeddings.clear (); + impl_->removed.clear (); + impl_->entry_memory_id = 0; + impl_->max_level = 0; + impl_->active_count = 0; + return false; + } + std::unordered_map updates; updates.reserve (roots.size () * (impl_->parameters.reciprocal_update_count + 1)); + const bool clear_activation_snapshot + = !impl_->building + && (impl_->removed.count ( + impl_->activation_entry_memory_id) + != 0 + || std::any_of ( + impl_->activation_identity_ids.begin (), + impl_->activation_identity_ids.end (), + [&] (long long memory_id) { + return impl_->removed.count (memory_id) != 0; + })); long long next_active_count = impl_->active_count; long long next_entry_memory_id = impl_->entry_memory_id; int next_max_level = impl_->max_level; @@ -1515,6 +1593,62 @@ Route::Seal (const sparse_retrieval_route_internal::Route *hnsw_route) if (next_active_count < 0) return false; + if (impl_->removed.count (impl_->entry_memory_id) != 0) + { + long long replacement_memory_id = 0; + int replacement_level = -1; + const auto consider_replacement + = [&] (long long memory_id, int level) { + if (memory_id <= 0 + || impl_->removed.count (memory_id) != 0) + return; + const auto updated = updates.find (memory_id); + if (updated != updates.end () + && !updated->second.active) + return; + if (level > replacement_level + || (level == replacement_level + && (replacement_memory_id == 0 + || memory_id < replacement_memory_id))) + { + replacement_memory_id = memory_id; + replacement_level = level; + } + }; + for (const auto &[memory_id, node] : updates) + if (node.active) + consider_replacement (memory_id, node.level); + + // At most |removed| leading rows can be excluded from the + // generation-qualified level index, so |removed|+1 finds the + // best surviving persisted entry without a store-sized scan. + const auto candidates = impl_->store->Execute ( + "SELECT memory_id, level " + "FROM cortext_sparse_route_nodes " + "INDEXED BY idx_sparse_route_nodes_entry " + "WHERE generation = ? AND active = 1 " + "ORDER BY level DESC, memory_id ASC LIMIT ?", + { impl_->generation, + static_cast (impl_->removed.size () + 1) }); + for (const auto &candidate : candidates) + consider_replacement ( + Int64 (candidate, "memory_id"), + static_cast (Int64 (candidate, "level"))); + + if (next_active_count == 0) + { + next_entry_memory_id = 0; + next_max_level = 0; + } + else if (replacement_memory_id > 0) + { + next_entry_memory_id = replacement_memory_id; + next_max_level = replacement_level; + } + else + return false; + } + std::vector update_ids; update_ids.reserve (updates.size ()); for (const auto &[memory_id, node] : updates) @@ -1569,23 +1703,31 @@ Route::Seal (const sparse_retrieval_route_internal::Route *hnsw_route) static_cast (next_max_level), next_active_count, next_generation }); else - tx->Execute ( - "INSERT INTO cortext_sparse_route_meta(" - "singleton, schema_version, embedding_dim, entry_memory_id, " - "max_level, active_count, generation) " - "VALUES(1, ?, ?, ?, ?, ?, ?) " - "ON CONFLICT(singleton) DO UPDATE SET " - "schema_version = excluded.schema_version, " - "embedding_dim = excluded.embedding_dim, " - "entry_memory_id = excluded.entry_memory_id, " - "max_level = excluded.max_level, " - "active_count = excluded.active_count, " - "generation = excluded.generation", - { static_cast (kSchemaVersion), - static_cast (impl_->embedding_dim), - next_entry_memory_id, - static_cast (next_max_level), - next_active_count, next_generation }); + { + tx->Execute ( + "INSERT INTO cortext_sparse_route_meta(" + "singleton, schema_version, embedding_dim, " + "entry_memory_id, max_level, active_count, generation) " + "VALUES(1, ?, ?, ?, ?, ?, ?) " + "ON CONFLICT(singleton) DO UPDATE SET " + "schema_version = excluded.schema_version, " + "embedding_dim = excluded.embedding_dim, " + "entry_memory_id = excluded.entry_memory_id, " + "max_level = excluded.max_level, " + "active_count = excluded.active_count, " + "generation = excluded.generation", + { static_cast (kSchemaVersion), + static_cast (impl_->embedding_dim), + next_entry_memory_id, + static_cast (next_max_level), + next_active_count, next_generation }); + if (clear_activation_snapshot) + tx->Execute ( + "UPDATE cortext_sparse_route_meta SET " + "activation_entry_memory_id = 0, " + "activation_generation = 0, activation_centroid = NULL, " + "activation_identity_ids = NULL WHERE singleton = 1"); + } for (const long long memory_id : roots) tx->Execute ( "DELETE FROM cortext_sparse_route_dirty WHERE memory_id = ?", @@ -1596,6 +1738,13 @@ Route::Seal (const sparse_retrieval_route_internal::Route *hnsw_route) impl_->max_level = next_max_level; impl_->active_count = next_active_count; impl_->generation = next_generation; + if (clear_activation_snapshot) + { + impl_->activation_entry_memory_id = 0; + impl_->activation_entry_level = 0; + impl_->activation_centroid.clear (); + impl_->activation_identity_ids.clear (); + } // A seal can invalidate cached rows out of FIFO order. Clear the // bookkeeping with the cache so stale order entries cannot grow // across repeated update/search cycles. @@ -1643,6 +1792,16 @@ Route::Seal (const sparse_retrieval_route_internal::Route *hnsw_route) return false; } + const bool clear_activation_snapshot + = !impl_->building + && (impl_->removed.count (impl_->activation_entry_memory_id) != 0 + || std::any_of ( + impl_->activation_identity_ids.begin (), + impl_->activation_identity_ids.end (), + [&] (long long memory_id) { + return impl_->removed.count (memory_id) != 0; + })); + const long long next_generation = impl_->generation; impl_->last_seal_failure_code = 40; auto tx = impl_->store->Begin (); @@ -1701,6 +1860,12 @@ Route::Seal (const sparse_retrieval_route_internal::Route *hnsw_route) "active_count = excluded.active_count, " "generation = excluded.generation", metadata_params); + if (clear_activation_snapshot) + tx->Execute ( + "UPDATE cortext_sparse_route_meta SET " + "activation_entry_memory_id = 0, activation_generation = 0, " + "activation_centroid = NULL, activation_identity_ids = NULL " + "WHERE singleton = 1"); for (const long long memory_id : roots) tx->Execute ( "DELETE FROM cortext_sparse_route_dirty WHERE memory_id = ?", @@ -1711,6 +1876,13 @@ Route::Seal (const sparse_retrieval_route_internal::Route *hnsw_route) impl_->max_level = snapshot->max_level; impl_->active_count = next_active_count; impl_->generation = next_generation; + if (clear_activation_snapshot) + { + impl_->activation_entry_memory_id = 0; + impl_->activation_entry_level = 0; + impl_->activation_centroid.clear (); + impl_->activation_identity_ids.clear (); + } // A seal can invalidate cached rows out of FIFO order. Clear the // bookkeeping with the cache so stale order entries cannot grow // across repeated update/search cycles. diff --git a/src/store/schema.cpp b/src/store/schema.cpp index 10fbf1f0..272cdfce 100644 --- a/src/store/schema.cpp +++ b/src/store/schema.cpp @@ -943,6 +943,25 @@ GetCoreMigrations () "activation_identity_ids BLOB", }, }, + { + 32, + "Index deterministic sparse-route entry replacement", + { + "CREATE INDEX IF NOT EXISTS idx_sparse_route_nodes_entry " + "ON cortext_sparse_route_nodes(" + "generation, active, level DESC, memory_id ASC)", + }, + }, + { + 33, + "Index bounded emotional source reranking", + { + "CREATE INDEX IF NOT EXISTS idx_memories_flashbulb_intensity " + "ON memories(emotional_intensity DESC, memory_id ASC) " + "WHERE flashbulb = 1 AND embedding_id IS NOT NULL " + "AND kind != 'WORKING'", + }, + }, }; } diff --git a/tests/migration_core.test.cpp b/tests/migration_core.test.cpp index e0f0c34c..d4739871 100644 --- a/tests/migration_core.test.cpp +++ b/tests/migration_core.test.cpp @@ -609,6 +609,7 @@ TEST_CASE("Migrations create graph retrieval lookup indexes", "[schema][migratio REQUIRE(has_index("idx_memories_created_desc")); REQUIRE(has_index("idx_memories_ltm_strength_created")); REQUIRE(has_index("idx_memories_pre_activation_embedding_active")); + REQUIRE(has_index("idx_memories_flashbulb_intensity")); REQUIRE_FALSE(has_index("idx_memories_strength")); REQUIRE_FALSE(has_index("idx_memories_working")); REQUIRE(has_index("idx_memories_working_active")); diff --git a/tests/operations_consolidation.test.cpp b/tests/operations_consolidation.test.cpp index 42fe4fbf..41ddcd89 100644 --- a/tests/operations_consolidation.test.cpp +++ b/tests/operations_consolidation.test.cpp @@ -15,6 +15,7 @@ #include #include #include "../src/operations/consolidation_throughput_state_internal.hpp" +#include "../src/operations/rif_active_epoch_cache_internal.hpp" #include "../src/operations/sparse_retrieval_knobs_internal.hpp" #include @@ -789,6 +790,141 @@ TEST_CASE ("ScoreConsolidation bounds its active candidate frontier from " == static_cast (candidate_limit)); } +TEST_CASE ("ScoreConsolidation bounds the frontier by effective RIF strength", + "[operations][consolidation][bounded][rif_state][regression]") +{ + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + cortext::store::ApplyMigrations (*store); + + SignalProcessor::Config cfg; + cortext::testing::RequireEncoder (cfg); + cfg.focus = 0.0; + cfg.sensitivity = 0.0; + cfg.stability = 1.0; + const auto candidate_limit = static_cast ( + operations::sparse_retrieval_knobs_internal:: + ActivationIdentityTarget ( + cfg.focus, cfg.sensitivity, cfg.stability)); + + Signal signal; + signal.timestamp = 55'000ULL; + signal.source_id = "opaque/effective-rif-frontier"; + signal.modality = "image"; + signal.force_consolidation = true; + signal.embedding = Eigen::VectorXf::Zero (4); + ProcessorContext p_ctx; + OperationContext ctx (signal, p_ctx, cfg, store.get ()); + + for (std::size_t index = 0; index < candidate_limit; ++index) + { + const long long id = static_cast (index + 1); + std::vector embedding (256, 0.0f); + embedding[index % embedding.size ()] = 1.0f; + store->Execute ( + "INSERT INTO embeddings(embedding_id, embedding, created_at) " + "VALUES(?, ?, ?)", + { id, embedding, id }); + store->Execute ( + "INSERT INTO memories(memory_id, embedding_id, source_id, kind, " + "start_ts, n_signals, modality, strength, stability, redundancy, " + "created_at) VALUES(?, ?, 'opaque/recovered', 'LONG_TERM', ?, 1, " + "'audio', 0.0, 0.0, 0.0, ?)", + { id, id, id, id }); + store->Execute ( + "INSERT INTO rif_active_state(memory_id, generation, " + "anchor_suppression, recovery_total, anchor_log_factor, " + "expires_log_factor) VALUES(?, 1, 0.1, 1.1, 0.0, -20.0)", + { id }); + } + + const long long weak_id = static_cast (candidate_limit + 1); + std::vector weak_embedding (256, 0.0f); + weak_embedding[0] = 1.0f; + store->Execute ( + "INSERT INTO embeddings(embedding_id, embedding, created_at) " + "VALUES(?, ?, ?)", + { weak_id, weak_embedding, weak_id }); + store->Execute ( + "INSERT INTO memories(memory_id, embedding_id, source_id, kind, " + "start_ts, n_signals, modality, strength, stability, redundancy, " + "created_at) VALUES(?, ?, 'opaque/weak', 'LONG_TERM', ?, 1, 'text', " + "0.01, 0.0, 0.0, ?)", + { weak_id, weak_id, weak_id, weak_id }); + + auto tx = store->Begin (); + ScoreConsolidation{}.Execute (ctx, *tx); + + const auto &candidates = ctx.GetConsolidationCandidates (); + REQUIRE (candidates.size () == 1); + REQUIRE (candidates.front ().memory_id == weak_id); + REQUIRE (candidates.front ().score + == Catch::Approx (0.01).margin (1e-6)); + REQUIRE (ctx.GetOperationTimings ().at ( + "ScoreConsolidation.candidate_input_count") + == static_cast (candidate_limit)); + REQUIRE (ctx.GetOperationTimings ().at ( + "ScoreConsolidation.active_state_count") + == static_cast (candidate_limit)); + REQUIRE (ctx.GetOperationTimings ().at ( + "ScoreConsolidation.active_state_limit") + == static_cast ( + operations::rif_active_epoch_cache_internal::DeriveLimits ( + cfg.focus, cfg.sensitivity, cfg.stability) + .mutation_count)); +} + +TEST_CASE ("ScoreConsolidation fails closed above its active RIF work ceiling", + "[operations][consolidation][bounded][rif_state][regression]") +{ + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + cortext::store::ApplyMigrations (*store); + + SignalProcessor::Config cfg; + cortext::testing::RequireEncoder (cfg); + cfg.focus = 0.0; + cfg.sensitivity = 0.0; + cfg.stability = 0.0; + const auto active_state_limit + = operations::rif_active_epoch_cache_internal::DeriveLimits ( + cfg.focus, cfg.sensitivity, cfg.stability) + .mutation_count; + REQUIRE (active_state_limit == 16'384); + const long long overflow_count + = static_cast (active_state_limit + 1); + store->Execute ( + "WITH RECURSIVE sequence(value) AS (" + " SELECT 1 UNION ALL SELECT value + 1 FROM sequence WHERE value < ?" + ") INSERT INTO memories(memory_id, source_id, kind, start_ts, " + "n_signals, modality, strength, stability, redundancy, created_at) " + "SELECT value, 'opaque/rif-overflow', 'LONG_TERM', value, 1, 'audio', " + "0.0, 0.0, 0.0, value FROM sequence", + { overflow_count }); + store->Execute ( + "INSERT INTO rif_active_state(memory_id, generation, " + "anchor_suppression, recovery_total, anchor_log_factor, " + "expires_log_factor) " + "SELECT memory_id, 1, 0.1, 1.1, 0.0, -20.0 FROM memories", + {}); + + Signal signal; + signal.timestamp = 56'000ULL; + signal.source_id = "opaque/rif-overflow"; + signal.modality = "audio"; + signal.force_consolidation = true; + signal.embedding = Eigen::VectorXf::Zero (4); + ProcessorContext p_ctx; + OperationContext ctx (signal, p_ctx, cfg, store.get ()); + auto tx = store->Begin (); + + REQUIRE_THROWS_AS (ScoreConsolidation{}.Execute (ctx, *tx), StoreError); + REQUIRE (ctx.GetOperationTimings ().at ( + "ScoreConsolidation.active_state_count") + == static_cast (overflow_count)); + REQUIRE (ctx.GetOperationTimings ().at ( + "ScoreConsolidation.active_state_limit") + == static_cast (active_state_limit)); +} + TEST_CASE ("ScoreConsolidation emits its full F S T derived work envelope", "[operations][consolidation][bounded][knobs][ablation]") { diff --git a/tests/operations_emotion_cascade.test.cpp b/tests/operations_emotion_cascade.test.cpp index ae5be02a..b359d657 100644 --- a/tests/operations_emotion_cascade.test.cpp +++ b/tests/operations_emotion_cascade.test.cpp @@ -335,7 +335,7 @@ TEST_CASE ("Emotional metadata cache preserves shared embedding minima", == std::vector{ 20 }); } -TEST_CASE ("Emotional source index retains only its newest bounded prefix", +TEST_CASE ("Emotional source index retains the SQL-ranked bounded prefix", "[operations][emotion_cascade][metadata_cache][bounds]") { ProcessorContext processor_context; @@ -343,10 +343,11 @@ TEST_CASE ("Emotional source index retains only its newest bounded prefix", std::vector rows; + const std::array intensities { 0.7, 0.99, 0.8, 0.95, 0.9 }; for (long long memory_id = 1; memory_id <= 5; ++memory_id) - rows.push_back ( - { memory_id, memory_id, memory_id, true, 0.8, 0.9, 2.0, 1, - 0.5 }); + rows.push_back ({ memory_id, memory_id, memory_id, true, + intensities[static_cast (memory_id - 1)], + 0.9, 2.0, 1, 0.5 }); operations::emotional_metadata_cache_internal::Reset ( processor_context, std::move (rows), 3); const auto state @@ -354,7 +355,69 @@ TEST_CASE ("Emotional source index retains only its newest bounded prefix", processor_context); REQUIRE (state); REQUIRE (state->emotional_metadata.source_query_order - == std::vector{ 5, 4, 3 }); + == std::vector{ 2, 4, 5 }); +} + +TEST_CASE ("Bounded emotional source reranking refills from SQLite", + "[operations][emotion_cascade][metadata_cache][bounds][regression]") +{ + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + cortext::testing::InitializeCoreSchema (*store); + ProcessorContext processor_context; + ScopedExecutionCacheSidecar sidecar_scope (processor_context); + std::vector + rows; + const std::array intensities { 0.99, 0.9, 0.8, 0.7, 0.6 }; + for (long long memory_id = 1; memory_id <= 5; ++memory_id) + { + SeedCascadeMemory (*store, memory_id, memory_id); + const double intensity + = intensities[static_cast (memory_id - 1)]; + SetCascadeSource (*store, memory_id, intensity, 1, 0.5); + rows.push_back ({ memory_id, memory_id, memory_id, true, intensity, + 0.9, 2.0, 1, 0.5 }); + } + operations::emotional_metadata_cache_internal::Reset ( + processor_context, std::move (rows), 3); + const auto state + = operations::emotional_metadata_cache_internal::FindState ( + processor_context); + REQUIRE (state); + auto &cache = state->emotional_metadata; + REQUIRE (cache.source_query_order == std::vector{ 1, 2, 3 }); + const auto plan = store->Execute ( + "EXPLAIN QUERY PLAN SELECT memory_id FROM memories " + "WHERE flashbulb = 1 AND embedding_id IS NOT NULL " + "AND kind != 'WORKING' " + "ORDER BY emotional_intensity DESC, memory_id ASC LIMIT 3"); + REQUIRE (plan.size () == 1); + REQUIRE (std::any_cast (plan[0].at ("detail")) + .find ("idx_memories_flashbulb_intensity") + != std::string::npos); + + auto transaction = store->Begin (); + transaction->Execute ( + "UPDATE memories SET emotional_intensity = 0.1 WHERE memory_id = 1"); + operations::emotional_metadata_cache_internal::OverwriteEmbedding ( + processor_context, 1, true, 0.1, 2.0, 1, 0.5); + REQUIRE (cache.source_query_order_dirty); + REQUIRE ( + operations::emotional_metadata_cache_internal:: + RefreshBoundedSourceOrder (processor_context, *transaction)); + REQUIRE (cache.source_query_order == std::vector{ 2, 3, 4 }); + REQUIRE_FALSE (cache.source_query_order_dirty); + + transaction->Execute ( + "UPDATE memories SET emotional_intensity = 1.0 WHERE memory_id = 5"); + operations::emotional_metadata_cache_internal::MaxEmbedding ( + processor_context, 5, 1.0, 2.0); + REQUIRE (cache.source_query_order_dirty); + REQUIRE ( + operations::emotional_metadata_cache_internal:: + RefreshBoundedSourceOrder (processor_context, *transaction)); + REQUIRE (cache.source_query_order == std::vector{ 5, 2, 3 }); + transaction->Rollback (); } TEST_CASE ("CascadeRadius and CascadeDecay knob values", @@ -878,12 +941,46 @@ TEST_CASE ("PropagateEmotionalCascade edge experiment uses the knob-derived " AddCascadeEdge (*store, 1, target); } - const auto timings = ExecuteCascade ( - store, true, kFocus, kSensitivity, kStability); - REQUIRE (timings.at ("EmotionalCascade.edge_visit_limit") == limit); - REQUIRE (timings.at ("EmotionalCascade.edge_visit_count") == limit); - REQUIRE (timings.at ("EmotionalCascade.edge_visit_limit_reached") == 1.0); - REQUIRE (timings.at ("EmotionalCascade.neighbor_count") <= limit); + SignalProcessor::Config cfg; + cortext::testing::RequireEncoder (cfg); + cfg.focus = kFocus; + cfg.sensitivity = kSensitivity; + cfg.stability = kStability; + ProcessorContext processor_context; + ScopedExecutionCacheSidecar sidecar_scope (processor_context); + std::vector + metadata; + metadata.reserve (static_cast (limit + 8)); + metadata.push_back ( + { 1, 1, 1'000'000, true, 0.9, 0.9, 2.0, 1, 0.9 }); + for (long long target = 2; target <= limit + 8; ++target) + metadata.push_back ( + { target, target, 1'000'000, false, 0.0, 0.0, 0.0, 0, 0.0 }); + operations::emotional_metadata_cache_internal::Reset ( + processor_context, std::move (metadata)); + auto execute = [&] (uint64_t timestamp) { + const Signal signal = MakeSignal (timestamp); + OperationContext context (signal, processor_context, cfg, store.get ()); + auto transaction = store->Begin (); + PropagateEmotionalCascade operation; + operation.Execute (context, *transaction); + transaction->Commit (); + return context.GetOperationTimings (); + }; + + const auto first = execute (1'000'000); + REQUIRE (first.at ("EmotionalCascade.edge_visit_limit") == limit); + REQUIRE (first.at ("EmotionalCascade.edge_visit_count") == limit); + REQUIRE (first.at ("EmotionalCascade.edge_visit_limit_reached") == 1.0); + REQUIRE (first.at ("EmotionalCascade.neighbor_count") <= limit); + + // A physically truncated traversal is not a fixed point. The same inputs + // must revisit the graph instead of taking the zero-work fast path. + const auto resumed = execute (1'000'001); + REQUIRE (resumed.at ("EmotionalCascade.source_count") == 1.0); + REQUIRE (resumed.at ("EmotionalCascade.edge_visit_count") == limit); + REQUIRE (resumed.at ("EmotionalCascade.edge_visit_limit_reached") == 1.0); } TEST_CASE ("PropagateEmotionalCascade bounds source inspection and execution " diff --git a/tests/operations_graph_retrieval.test.cpp b/tests/operations_graph_retrieval.test.cpp index 1ef9928a..c295c537 100644 --- a/tests/operations_graph_retrieval.test.cpp +++ b/tests/operations_graph_retrieval.test.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -323,6 +324,209 @@ TEST_CASE ("SQLite sparse route restart and query work stay row bounded", } +TEST_CASE ("SQLite sparse route replaces a removed hierarchy entry", + "[operations][graph][retrieval][hnsw][sqlite][regression]") +{ + using HnswRoute + = operations::sparse_retrieval_route_internal::Route; + using SQLiteRoute + = operations::sparse_retrieval_route_sqlite_internal::Route; + const auto parameters = operations::sparse_retrieval_route_sqlite_internal:: + DefaultParameters (); + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + cortext::testing::InitializeCoreSchema (*store); + const std::vector> entries { + { 1, UnitVec (1) }, { 2, UnitVec (2) }, { 3, UnitVec (3) } + }; + auto hnsw = HnswRoute::CreateWithLevelsForTest ( + kEmbeddingDim, entries, { 3, 2, 1 }, parameters.hnsw); + REQUIRE (hnsw); + auto route = SQLiteRoute::Create ( + *store, kEmbeddingDim, entries, *hnsw, parameters); + REQUIRE (route); + + const auto before = store->Execute ( + "SELECT entry_memory_id, max_level FROM cortext_sparse_route_meta"); + REQUIRE (before.size () == 1); + REQUIRE (store::AnyToLongLong (before.front ().at ("entry_memory_id")) + == 1); + REQUIRE (route->Recenter (UnitVec (1))); + REQUIRE (route->ActivationEntryMemoryId () == 1); + REQUIRE (route->Remove (1)); + REQUIRE (route->StagePendingRemove (1)); + REQUIRE (route->Seal ()); + + const auto after = store->Execute ( + "SELECT entry_memory_id, max_level, activation_entry_memory_id, " + "activation_generation, activation_centroid, activation_identity_ids " + "FROM cortext_sparse_route_meta"); + REQUIRE (after.size () == 1); + REQUIRE (store::AnyToLongLong (after.front ().at ("entry_memory_id")) + == 2); + REQUIRE (store::AnyToLongLong (after.front ().at ("max_level")) == 2); + REQUIRE (store::AnyToLongLong ( + after.front ().at ("activation_entry_memory_id")) + == 0); + REQUIRE (store::AnyToLongLong ( + after.front ().at ("activation_generation")) + == 0); + REQUIRE (store::BlobFromAny (after.front ().at ("activation_centroid")) + .empty ()); + REQUIRE (store::BlobFromAny ( + after.front ().at ("activation_identity_ids")) + .empty ()); + auto reopened = SQLiteRoute::Open (*store, kEmbeddingDim, parameters); + REQUIRE (reopened); + REQUIRE (reopened->ActivationEntryMemoryId () == 0); + const auto result = reopened->Search (UnitVec (2), 3); + REQUIRE (result); + REQUIRE_FALSE (result->empty ()); + REQUIRE (result->front () == 2); +} + +TEST_CASE ("SQLite sparse route invalidates stale links after an active " + "embedding moves", + "[operations][graph][retrieval][hnsw][sqlite][regression]") +{ + using HnswRoute + = operations::sparse_retrieval_route_internal::Route; + using SQLiteRoute + = operations::sparse_retrieval_route_sqlite_internal::Route; + const auto parameters = operations::sparse_retrieval_route_sqlite_internal:: + DefaultParameters (); + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + cortext::testing::InitializeCoreSchema (*store); + const std::vector> entries { + { 1, UnitVec (1) }, { 2, UnitVec (2) }, { 3, UnitVec (3) } + }; + auto hnsw = HnswRoute::Create (kEmbeddingDim, entries, parameters.hnsw); + REQUIRE (hnsw); + auto route = SQLiteRoute::Create ( + *store, kEmbeddingDim, entries, *hnsw, parameters); + REQUIRE (route); + + REQUIRE (route->Upsert (2, entries[1].second)); + REQUIRE (route->StagePendingUpsert (2, entries[1].second)); + REQUIRE (route->Seal ()); + REQUIRE (route->Upsert (2, UnitVec (200))); + REQUIRE (route->StagePendingUpsert (2, UnitVec (200))); + REQUIRE_FALSE (route->Seal ()); + REQUIRE (route->LastSealFailureCode () == 62); + REQUIRE (store->Execute ( + "SELECT singleton FROM cortext_sparse_route_meta") + .empty ()); + REQUIRE (store->Execute ( + "SELECT memory_id FROM cortext_sparse_route_dirty") + .empty ()); + REQUIRE_FALSE ( + SQLiteRoute::Open (*store, kEmbeddingDim, parameters)); +} + +TEST_CASE ("SQLite sparse route rejects a legacy dead activation member", + "[operations][graph][retrieval][hnsw][sqlite][restart]" + "[migration][regression]") +{ + using HnswRoute + = operations::sparse_retrieval_route_internal::Route; + using SQLiteRoute + = operations::sparse_retrieval_route_sqlite_internal::Route; + const auto parameters = operations::sparse_retrieval_route_sqlite_internal:: + DefaultParameters (); + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + cortext::testing::InitializeCoreSchema (*store); + const std::vector> entries { + { 1, UnitVec (1) }, { 2, UnitVec (2) }, { 3, UnitVec (3) } + }; + auto hnsw = HnswRoute::CreateWithLevelsForTest ( + kEmbeddingDim, entries, { 3, 2, 1 }, parameters.hnsw); + REQUIRE (hnsw); + auto route = SQLiteRoute::Create ( + *store, kEmbeddingDim, entries, *hnsw, parameters); + REQUIRE (route); + REQUIRE (route->Recenter (UnitVec (2))); + REQUIRE (route->ActivationEntryMemoryId () == 2); + + // Prior code could seal this removal without clearing the activation + // snapshot. The canonical entry remains healthy, so restart must validate + // the independently bounded snapshot identities rather than only its root. + store->Execute ( + "UPDATE cortext_sparse_route_nodes SET active = 0 WHERE memory_id = 2"); + REQUIRE_FALSE (SQLiteRoute::Open (*store, kEmbeddingDim, parameters)); +} + +TEST_CASE ("SQLite sparse route rejects and rebuilds a legacy dead entry", + "[operations][graph][retrieval][hnsw][sqlite][restart]" + "[migration][regression]") +{ + namespace cache + = operations::historical_surface_search_cache_internal; + using HnswRoute + = operations::sparse_retrieval_route_internal::Route; + using SQLiteRoute + = operations::sparse_retrieval_route_sqlite_internal::Route; + const auto parameters = operations::sparse_retrieval_route_sqlite_internal:: + DefaultParameters (); + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + cortext::testing::InitializeCoreSchema (*store); + std::vector> entries; + entries.reserve (400); + for (long long memory_id = 1; memory_id <= 400; ++memory_id) + entries.emplace_back ( + memory_id, + UnitVec (static_cast (memory_id % kEmbeddingDim))); + auto hnsw = HnswRoute::Create (kEmbeddingDim, entries, parameters.hnsw); + REQUIRE (hnsw); + REQUIRE (SQLiteRoute::Create ( + *store, kEmbeddingDim, entries, *hnsw, parameters)); + + // Reproduce a route sealed by the prior code: metadata still names the + // removed maximum-level node, while that node is already inactive. + const auto prior_meta = store->Execute ( + "SELECT entry_memory_id FROM cortext_sparse_route_meta"); + REQUIRE (prior_meta.size () == 1); + const long long dead_entry + = store::AnyToLongLong (prior_meta.front ().at ("entry_memory_id")) + .value_or (0); + REQUIRE (dead_entry > 0); + store->Execute ( + "UPDATE cortext_sparse_route_nodes SET active = 0 WHERE memory_id = ?", + { dead_entry }); + REQUIRE_FALSE (SQLiteRoute::Open (*store, kEmbeddingDim, parameters)); + + cache::State state; + state.embedding_dim = kEmbeddingDim; + state.sparse_route_parameters = parameters; + long long expected_memory_id = 0; + Eigen::VectorXf expected_embedding; + for (std::size_t index = 0; index < entries.size (); ++index) + { + const auto &[memory_id, embedding] = entries[index]; + if (memory_id == dead_entry) + continue; + if (expected_memory_id == 0) + { + expected_memory_id = memory_id; + expected_embedding = embedding; + } + const std::size_t state_index = state.current_entries.size (); + state.current_entries.emplace_back ( + memory_id, memory_id, 1000 + memory_id, "LONG_TERM", "opaque", + embedding, memory_id); + state.current_memory_index.emplace (memory_id, state_index); + state.current_memory_order.emplace (memory_id, state_index); + } + std::size_t advances = 0; + while (!state.sqlite_sparse_route && advances++ < 10) + REQUIRE (cache::AdvanceSQLiteSparseRouteBackfill (state, *store)); + REQUIRE (state.sqlite_sparse_route); + const auto reopened = SQLiteRoute::Open (*store, kEmbeddingDim, parameters); + REQUIRE (reopened); + const auto result = reopened->Search (expected_embedding, 2); + REQUIRE (result); + REQUIRE_FALSE (result->empty ()); + REQUIRE (result->front () == expected_memory_id); +} + TEST_CASE ("Consolidation resets the experimental derived retrieval sawtooth", "[operations][graph][retrieval][hnsw][sqlite][consolidation]" "[activation][knobs][experiment_hooks]") @@ -541,7 +745,7 @@ TEST_CASE ("Mature SQLite activation fills its knob-derived node envelope " for (long long memory_id = 1; memory_id <= active_count; ++memory_id) entries.emplace_back ( memory_id, - UnitVec (static_cast (memory_id % kEmbeddingDim))); + UnitVec (static_cast (memory_id % (kEmbeddingDim - 1)) + 1)); auto hnsw = HnswRoute::Create ( kEmbeddingDim, entries, parameters.hnsw); REQUIRE (hnsw); @@ -558,6 +762,24 @@ TEST_CASE ("Mature SQLite activation fills its knob-derived node envelope " "SELECT ?, embedding, 0, ?, 0, generation " "FROM cortext_sparse_route_nodes WHERE memory_id = 1", { inactive_memory_id, empty_level_zero_links }); + const long long isolated_active_memory_id = inactive_memory_id + 1; + const auto isolated_embedding = UnitVec (0); + std::vector isolated_embedding_bytes ( + static_cast (isolated_embedding.size ()) + * sizeof (float)); + std::memcpy (isolated_embedding_bytes.data (), isolated_embedding.data (), + isolated_embedding_bytes.size ()); + store->Execute ( + "INSERT INTO cortext_sparse_route_nodes(" + "memory_id, embedding, level, links, active, generation) " + "SELECT ?, ?, 0, ?, 1, generation " + "FROM cortext_sparse_route_nodes WHERE memory_id = 1", + { isolated_active_memory_id, isolated_embedding_bytes, + empty_level_zero_links }); + store->Execute ( + "UPDATE cortext_sparse_route_meta SET active_count = active_count + 1 " + "WHERE singleton = 1", + {}); route.reset (); route = SQLiteRoute::Open (*store, kEmbeddingDim, parameters); REQUIRE (route); @@ -565,6 +787,9 @@ TEST_CASE ("Mature SQLite activation fills its knob-derived node envelope " const auto activated = route->SearchActivated (UnitVec (0)); REQUIRE (activated); REQUIRE (activated->size () == parameters.activation_identity_target); + REQUIRE (std::find (activated->begin (), activated->end (), + isolated_active_memory_id) + != activated->end ()); REQUIRE (std::find (activated->begin (), activated->end (), inactive_memory_id) == activated->end ()); @@ -1910,7 +2135,7 @@ TEST_CASE ("Graph retrieval reopens SQLite sparse route on the existing path", <= parameters.search_node_budget); } -TEST_CASE ("SQLite sparse route restages active mutations after restart", +TEST_CASE ("SQLite sparse route invalidates moved active topology after restart", "[operations][graph][retrieval][hnsw][sqlite][restart]") { namespace cache @@ -1985,64 +2210,20 @@ TEST_CASE ("SQLite sparse route restages active mutations after restart", REQUIRE (std::find (unsealed_removed_result->begin (), unsealed_removed_result->end (), 2) == unsealed_removed_result->end ()); - REQUIRE (cache::ReconcileSQLiteSparseRoute ( + REQUIRE_FALSE (cache::ReconcileSQLiteSparseRoute ( state, *store, route, std::shared_ptr< operations::sparse_retrieval_route_internal::Route>{})); - route = state.sqlite_sparse_route; - REQUIRE (route); + REQUIRE (route->LastSealFailureCode () == 62); + REQUIRE_FALSE (state.sqlite_sparse_route); REQUIRE_FALSE (route->HasDirtyMemoryIds ()); - const auto revised_result - = route->Search (revised, parameters.route_capacity); - REQUIRE (revised_result); - REQUIRE_FALSE (revised_result->empty ()); - REQUIRE (revised_result->front () == 1); - const auto removed_result - = route->Search (route_entries[1].second, parameters.route_capacity); - REQUIRE (removed_result); - REQUIRE (std::find (removed_result->begin (), removed_result->end (), 2) - == removed_result->end ()); - REQUIRE (store->Execute ( "SELECT memory_id FROM cortext_sparse_route_dirty") .empty ()); - const auto meta = store->Execute ( - "SELECT active_count FROM cortext_sparse_route_meta " - "WHERE singleton = 1"); - REQUIRE (meta.size () == 1); - REQUIRE (store::AnyToLongLong (meta.front ().at ("active_count")) - .value_or (0) - == 599); - - state.sqlite_sparse_route.reset (); - route = cache::OpenSQLiteSparseRoute (state, *store); - REQUIRE (route); - REQUIRE (route->DeltaSize () == 0); - const auto sealed_result - = route->Search (revised, parameters.route_capacity); - REQUIRE (sealed_result); - REQUIRE_FALSE (sealed_result->empty ()); - REQUIRE (sealed_result->front () == 1); - - // Dirty reconciliation and historical backfill are separate derived - // surfaces. Dirty search stages at most C identities and reads C+1 only to - // detect journal overflow; historical backfill remains B and checks its - // logical B+1 boundary from the post-B iterator without reading that row. - const std::size_t overflow_count = parameters.route_capacity + 1; - for (std::size_t offset = 0; offset < overflow_count; ++offset) - { - const long long memory_id = 3 + static_cast (offset); - REQUIRE (route->Upsert ( - memory_id, - route_entries[static_cast (memory_id - 1)].second)); - } REQUIRE (store->Execute ( - "SELECT memory_id FROM cortext_sparse_route_dirty") - .size () - == overflow_count); - REQUIRE_FALSE ( - cache::StageSQLiteSparseRouteDirtyForSearch (state, *route)); - REQUIRE (route->DeltaSize () == 0); + "SELECT singleton FROM cortext_sparse_route_meta") + .empty ()); + REQUIRE_FALSE (cache::OpenSQLiteSparseRoute (state, *store)); } TEST_CASE ("SQLite sparse route backfills a large existing surface in fixed " @@ -2128,6 +2309,12 @@ TEST_CASE ("SQLite sparse route backfills a large existing surface in fixed " = operations::sparse_retrieval_route_sqlite_internal::Route:: OpenOrBeginBuild (*store, kEmbeddingDim, parameters); REQUIRE (state.sqlite_sparse_route_backfill); + REQUIRE (state.sqlite_sparse_route_backfill->BuildCursor () + == static_cast (parameters.backfill_batch_size)); + REQUIRE_FALSE (cache::AdvanceSQLiteSparseRouteBackfill (state, *store)); + REQUIRE_FALSE (state.sqlite_sparse_route_backfill); + REQUIRE (cache::AdvanceSQLiteSparseRouteBackfill (state, *store)); + REQUIRE (state.sqlite_sparse_route_backfill); REQUIRE (state.sqlite_sparse_route_backfill->BuildCursor () == static_cast (parameters.backfill_batch_size)); REQUIRE (cache::AdvanceSQLiteSparseRouteBackfill (state, *store)); @@ -2242,8 +2429,8 @@ TEST_CASE ("SQLite sparse route starts backfill at the knob-derived headroom " + parameters.backfill_batch_size)); } -TEST_CASE ("SQLite sparse route keeps active live mutations in a bounded " - "durable journal", +TEST_CASE ("SQLite sparse route invalidates a moved active journal slice " + "before publishing stale topology", "[operations][graph][retrieval][hnsw][sqlite][backfill]" "[regression]") { @@ -2296,32 +2483,17 @@ TEST_CASE ("SQLite sparse route keeps active live mutations in a bounded " cache::StageSQLiteSparseRouteDirtyForSearch (state, *route)); REQUIRE (route->DeltaSize () == 0); - std::size_t remaining = 400; - while (remaining > parameters.route_capacity) - { - REQUIRE_FALSE ( - cache::StageSQLiteSparseRouteDirtyForSearch (state, *route)); - REQUIRE (cache::ReconcileSQLiteSparseRoute ( - state, *store, route, - std::shared_ptr< - operations::sparse_retrieval_route_internal::Route>{})); - remaining -= parameters.route_capacity; - REQUIRE (store->Execute ( - "SELECT memory_id FROM cortext_sparse_route_dirty") - .size () - == remaining); - } - const auto staged_remainder - = cache::StageSQLiteSparseRouteDirtyForSearch (state, *route); - REQUIRE (staged_remainder == remaining); - REQUIRE (route->DeltaSize () == remaining); - REQUIRE (route->Search (UnitVec (0), parameters.route_capacity)); - REQUIRE (cache::ReconcileSQLiteSparseRoute ( + REQUIRE_FALSE (cache::ReconcileSQLiteSparseRoute ( state, *store, route, std::shared_ptr< operations::sparse_retrieval_route_internal::Route>{})); + REQUIRE (route->LastSealFailureCode () == 62); + REQUIRE_FALSE (state.sqlite_sparse_route); REQUIRE (route->DeltaSize () == 0); REQUIRE_FALSE (route->HasDirtyMemoryIds ()); + REQUIRE (store->Execute ( + "SELECT singleton FROM cortext_sparse_route_meta") + .empty ()); } TEST_CASE ("SQLite sparse route drains live build mutations in knob-bounded " diff --git a/tests/signal_processor.test.cpp b/tests/signal_processor.test.cpp index b3056d39..36604502 100644 --- a/tests/signal_processor.test.cpp +++ b/tests/signal_processor.test.cpp @@ -3920,8 +3920,8 @@ TEST_CASE ("Invalidated consolidation surface reloads authority and replaces " REQUIRE (result->front () == 1); } -TEST_CASE ("Restarted SQLite sparse route seals a bounded row-addressed delta " - "without reconstructing in-memory HNSW", +TEST_CASE ("Restarted SQLite sparse route invalidates moved active topology " + "before bounded rebuild", "[processor][cache][consolidation][hnsw][sqlite][restart]") { namespace cache @@ -3987,28 +3987,27 @@ TEST_CASE ("Restarted SQLite sparse route seals a bounded row-addressed delta " == 1.0); REQUIRE (output.operation_ms.at ( "SignalProcessor.sqlite_sparse_route_seal_succeeded") - == 1.0); + == 0.0); REQUIRE (output.operation_ms.at ( "SignalProcessor.sqlite_sparse_route_seal_failure_code") - == 0.0); + == 62.0); REQUIRE (capturing_operation->captured != nullptr); const auto state = cache::Find (*capturing_operation->captured); REQUIRE (state); REQUIRE_FALSE (state->sparse_route); - REQUIRE (state->sqlite_sparse_route); + REQUIRE_FALSE (state->sqlite_sparse_route); auto restarted = operations::sparse_retrieval_route_sqlite_internal::Route:: Open (*store, 256, operations::sparse_retrieval_route_sqlite_internal:: DefaultParameters ()); - REQUIRE (restarted); - Eigen::VectorXf query = Eigen::VectorXf::Zero (256); - query[0] = 1.0f; - const auto result = restarted->Search (query, 512); - REQUIRE (result); - REQUIRE_FALSE (result->empty ()); - REQUIRE (result->front () == 1); - REQUIRE (restarted->RestartRowsLoaded () == 1); + REQUIRE_FALSE (restarted); + REQUIRE (store->Execute ( + "SELECT singleton FROM cortext_sparse_route_meta") + .empty ()); + REQUIRE (store->Execute ( + "SELECT memory_id FROM cortext_sparse_route_dirty") + .empty ()); } TEST_CASE ("Ordinary sparse-route maintenance seals at its knob-derived " From 25cf7b130e87837d0ed813b0e0ffda5a50701651 Mon Sep 17 00:00:00 2001 From: gabewillen Date: Tue, 21 Jul 2026 07:58:13 -0500 Subject: [PATCH 14/18] Resolve follow-up review findings --- .../paper-traceability-audit-v2.json | 6 +- .../paper-traceability-current-state-v2.json | 81 +++++++--- .../paper-traceability-manifest-v1.json | 6 +- build.zig | 1 + build.zig.zon | 1 + cmake/PrepareHnswlibForZig.cmake | 2 + ...trator-goal-mdscript-converted.mdscript.md | 17 +- docs/paper/_manuscript/index.md | 146 +++++++++++------- docs/paper/sections/10_implementation.qmd | 21 ++- docs/paper/sections/11_optimization.qmd | 17 +- src/operations/consolidation.cpp | 7 +- ...sparse_retrieval_route_sqlite_internal.cpp | 30 +++- ...sparse_retrieval_route_sqlite_internal.hpp | 4 + src/store/schema.cpp | 10 ++ tests/migration_core.test.cpp | 24 +++ tests/operations_consolidation.test.cpp | 105 +++++++++++++ tests/operations_graph_retrieval.test.cpp | 34 ++++ 17 files changed, 407 insertions(+), 105 deletions(-) diff --git a/artifacts/flat_storage_cost/paper-traceability-audit-v2.json b/artifacts/flat_storage_cost/paper-traceability-audit-v2.json index 8df866f7..aee9d8ae 100644 --- a/artifacts/flat_storage_cost/paper-traceability-audit-v2.json +++ b/artifacts/flat_storage_cost/paper-traceability-audit-v2.json @@ -1,14 +1,14 @@ { "generated_claim_mismatches": [], "inventory_count": 70, - "manifest_sha256": "8edbbd87fc4bd23cd6f9248c9851226eec82a496edafcd9b923c3ed455d2d1ab", - "manuscript_sha256": "070a04989506a062227bd69b3c57254e3602be37e734ad14a6a5eef6806e0472", + "manifest_sha256": "739cba8fa3806574b08637040508e8cf944c4672ab4368013d51e2946c6a69fb", + "manuscript_sha256": "821fce2999f765eaa828a1b83ba47ff403fe568fcb2e72ad88c873a10bf4c423", "missing_source_claims": [], "ownership_violations": [], "passed": true, "proof_level_violations": [], "record_count": 70, "schema": "cortext_paper_traceability_audit_v1", - "state_sha256": "cd08a420024a4a89050f47bfa63cce161f6d46c6430f82820b853959aa0dc410", + "state_sha256": "25935efc387257d14f3dcf7f5397e7967bb4ab3139b084521522cc1898255ead", "uncovered_inventory": [] } diff --git a/artifacts/flat_storage_cost/paper-traceability-current-state-v2.json b/artifacts/flat_storage_cost/paper-traceability-current-state-v2.json index 48444bda..f135e8ee 100644 --- a/artifacts/flat_storage_cost/paper-traceability-current-state-v2.json +++ b/artifacts/flat_storage_cost/paper-traceability-current-state-v2.json @@ -1,15 +1,15 @@ { "schema": "cortext_paper_traceability_state_overlay_v2", "supersedes_state_sha256": "f0605f910ed3c10fa7838c2e175c5d0babbe352f7e4fe4e2f92fdf3c70cd1f2d", - "phase": "repair-pr-review-threads", + "phase": "repair-pr-ci", "completion": true, "resume_phase": "refresh-pr-state", "sqlite_hnsw_schema_authority": { - "status": "approved-current-user-through-migration-33", + "status": "approved-current-user-through-migration-34", "approver_identity": "current-user", "provenance": "direct user authorization in this task", - "schema_migration_numbers": [29, 30, 31, 32, 33], - "authority_scope": "private internal SQLite sparse route, deterministic active-entry replacement index, exact signal-vector ring, knob-bounded activation-centroid persistence, and bounded emotional-source reranking index", + "schema_migration_numbers": [29, 30, 31, 32, 33, 34], + "authority_scope": "private internal SQLite sparse route, deterministic active-entry replacement index, exact signal-vector ring, knob-bounded activation-centroid persistence, bounded emotional-source reranking index, and eligible-only bounded consolidation frontier index", "public_api_change": false, "no_release_or_deployment_grant": true }, @@ -54,7 +54,8 @@ "29": "internal SQLite HNSW route, metadata, build, node, and dirty-journal tables", "31": "knob-bounded activation entry, generation, centroid, and identity snapshot columns", "32": "deterministic active sparse-route entry replacement index", - "33": "bounded emotional-source intensity reranking index" + "33": "bounded emotional-source intensity reranking index", + "34": "eligible-only unclustered long-term consolidation frontier index" }, "public_api_change": false, "authority": "current user explicitly approved the SQLite shadow-memory schema design and authorized the implementation changes" @@ -116,10 +117,20 @@ ] }, "pr6_exact_head_ci_repair": { - "decision": "seven-review-thread-repair-proven-at-round-five-p1", - "prior_exact_head": "5f2e3b38edbc5d582b2a0cbb37d7ec10f8ceb1cb", - "current_exact_head": "764e4af202a91120dae85e1d6b0d69e2ce97aa5d", - "current_exact_head_ci": "12-of-12-green-before-the-seven-thread-candidate-push", + "decision": "eleven-review-thread-repair-with-follow-up-p2-proof-active", + "prior_exact_head": "764e4af202a91120dae85e1d6b0d69e2ce97aa5d", + "implementation_repair_commit": "89a06084dd05710f90572c1b7bac7e17fab79122", + "monitor_head_binding": "resolve the live GitHub PR head at every re-entry because a repository record cannot content-address its own containing record-only commit", + "current_exact_head_ci": "Windows zig-cli-install failed because Git received a backslash-separated --directory path for the build-local HNSW patch; all other check conclusions must be resolved live from GitHub at every re-entry", + "windows_zig_path_repair": { + "failing_job": "zig-cli-install (windows-latest, cortext_cli.exe)", + "failing_head": "89a06084dd05710f90572c1b7bac7e17fab79122", + "cause": "CMake file(RELATIVE_PATH) returned Windows separators but git apply --directory consumes Git forward-slash paths", + "repair": "normalize only the build-local output relative path from backslash to forward slash before both checked and applied git apply calls", + "local_proof": "native Zig ReleaseFast static CLI build passes and the emitted build-local hnswlib copy passes complete reverse patch verification", + "review": "Windows path normalization passed recursive round-three P1 review; the four follow-up P2 repairs await fresh cumulative review", + "proof_not_claimed": "Windows validation remains owned by replacement exact-head CI" + }, "review": { "baseline_tree": "156dd7bc27b7cda2c661a9467bfddfe72c771e8a", "candidate_tree": "0b4069c73955147da28add9b9eaea480bad48249", @@ -128,6 +139,12 @@ "P2: the bounded cache ranks its global flashbulb prefix before applying cascade recency/arousal eligibility, whereas the SQL fallback filters eligibility before LIMIT; this does not regress the public thread's required intensity-before-truncation order, but full cache/fallback selection equivalence remains unclaimed" ] }, + "followup_review": { + "round_one_candidate_tree": "ba6d938a5c77fabdd2b3b3b18b447663786f47fe", + "round_one_verdict": "Not ready at all-findings threshold: one P1 unbounded clustered-prefix scan, one P2 stale overlay identity, and two P3 diagnostic/paper wording findings", + "repairs": "migration 34 adds an eligible-only partial index selected by the inactive frontier; adversarial query-plan proof verifies that index; the seed counter counts actual frontier insertions; the paper states only that prior snapshot identities are not explicit seeds", + "next_gate": "fresh round-two P1/P2 review" + }, "review_threads": [ "https://github.com/augmem/cortext/pull/6#discussion_r3620394273", "https://github.com/augmem/cortext/pull/6#discussion_r3620394282", @@ -135,7 +152,11 @@ "https://github.com/augmem/cortext/pull/6#discussion_r3620632960", "https://github.com/augmem/cortext/pull/6#discussion_r3620632969", "https://github.com/augmem/cortext/pull/6#discussion_r3620632977", - "https://github.com/augmem/cortext/pull/6#discussion_r3620632985" + "https://github.com/augmem/cortext/pull/6#discussion_r3620632985", + "PRRT_kwDOR3IQMM6SjHep", + "PRRT_kwDOR3IQMM6SjHes", + "PRRT_kwDOR3IQMM6SjHev", + "PRRT_kwDOR3IQMM6SjHe1" ], "repairs": [ "calibrate migrated lazy-RIF state transactionally before working-memory hydration and rebuild the disposable epoch from committed persistent authority", @@ -148,33 +169,42 @@ "invalidate a route generation when an active normalized embedding moves beyond the fixed cosine tolerance, then use exact retrieval while the existing knob-bounded builder reconstructs coherent adjacency", "retain the bounded emotional-source prefix in the SQL fallback's intensity-descending and memory-id-ascending order, marking rank-changing mutations dirty and refilling exactly the knob-derived prefix through the partial SQLite intensity index", "treat an edge-visit-limited emotional traversal as an incomplete prefix that cannot publish a fixed point", - "perform knob-derived cache-byte multiplication explicitly in std::size_t for WebAssembly width portability" + "perform knob-derived cache-byte multiplication explicitly in std::size_t for WebAssembly width portability", + "promote a same-vector reactivated row-addressed node when its persisted level exceeds the current canonical entry", + "exclude the prior activation snapshot from frontier seeding while rebuilding its consolidation-centroid replacement", + "filter clustered memories before both inactive and active bounded consolidation candidate limits, using an eligible-only partial index so the inactive arm cannot scan a clustered history prefix", + "include the CMake HNSW preparation and patch assets in the Zig package allowlist" ], "source_sha256": { "signal_processor": "7d255a3db0b4e9f0dcedac9fa841d093b1ad39af3c90af43969a17aba481e07b", "rif_cache_header": "55985ae0d5d0d69480ae3a3d8204779faec8b23f2051e2e924b8de31e1d130a8", "hnswlib_patch": "4180985795ccdac233cf7c50e82ec0bb2108fd191aece8951f8cedc12932d54a", "hnswlib_patch_driver": "3506b957d155d0994cd975d12d93e3bdb60f0d205b13dc496b474aeb73e8662a", - "zig_build": "7336dcc354cc970fc8fc71e1f40a9f96ac549622a859a19e6dc55a0ed069357c", - "zig_hnswlib_prepare": "c4635b5ed46654e19285cee1e2861c1385d214b67d058767c51bfc505d30f33f", - "hnsw_route_header": "4996c6575e70c4e74da29d6e289695df250f3316feeaae3724be29c3fda74ad8", - "hnsw_route_source": "9582307376d8a8dcb40e85351382142e3a985df6448e7d8ef5a4f52e69268424", - "hnsw_repair_test": "c904515074515cd6c4325318d34a89ae10da4c0b9a3d7b9c34b2ebccbfbe7407", - "consolidation_source": "c5b0863f43e1f1080e006d213bc62ed145b3c740a906697327d2c91ba98e7e18", - "consolidation_test": "0bca3997b4c0a68ab475355b5c8be962ec06cbcbb19f628a3eb266d6fa4e071d", + "zig_build": "f4a36709d3eeab3be92bd5300e7d071621290189b24d13fdc4976e6c04d9d8ce", + "zig_hnswlib_prepare": "f2ea37b7bfaca95edcb3b6486120b0d0c6c33060b32d96a40f46fafdd53e2773", + "zig_package_manifest": "25f58d123ab581319b140bed7e4355a7bd524e1e17dce96a219ccea68ec74c9a", + "hnsw_route_header": "a68c6825551cadd3d9d843986a82ab1294128b993106ffe58d3370e70ec79c82", + "hnsw_route_source": "3d6a559de3445a800a18df1e05e4926ce5bef71f0a4123de9990a3c2869e4184", + "hnsw_repair_test": "98f092f86b5ef4e10b8c06fe41f15b31127556ce5480565d16fcd2fb8620e8f8", + "consolidation_source": "b6dd39b64318e3720be0da46e62f7457fc6fc41bc48f1e01b5a51b5df5b12880", + "consolidation_test": "716ed3c2f8568338591453fd1e7776af99d9307be90115e2654e2671fca419e1", "emotion_cascade_source": "8135e0f9a07d55a62d6bfdf7f63c83c5b2110237cc208c4fff2ef1ae6e135634", "emotional_metadata_cache": "a8deda12553ffb9c07389f4665645187b85e4dd55f3c055ba230385cfcfbf88a", "emotion_cascade_test": "47b0d780994832bbd36f06fcba4abee9d2935ad0267b4c9bd9e7cb6659df5afe", - "schema_source": "c42ac2cac86b6464d3bccdef87c1ddd02731cafccba179e229b16284e0f87cf4" + "schema_source": "b4c3b0c873fd225781d1eab856a82b3fc2868909f131f867031c71c792f9fbe3", + "migration_test": "4e76c44cc7ec9d5a1ec26fb963c1291c7f98e47b65050bac8ff4ff0df09b64cc" }, "local_proof": { - "full_media_ctest": "clean Debug LLVM 21 media-enabled suite with experiment hooks enabled: 38,730 assertions in 697 cases", + "preceding_full_media_ctest": "preceding exact candidate: clean Debug LLVM 21 media-enabled suite with experiment hooks enabled: 38,730 assertions in 697 cases", + "preceding_full_media_test_binary_sha256": "0fd25b6e322913cb0e76e3aa5a1fbcc6836d8696b6bbd5886224a3144fea1ec8", + "current_full_media_ctest": "exact repaired candidate: clean Debug LLVM 21 media-enabled suite with experiment hooks enabled: 38,766 assertions in 699 cases", + "current_full_media_test_binary_sha256": "2ad4b947a5728fa767680a7cb399ebe969661b0a47e2ca5f269434ca34d0f02c", "rif_focus": "312 assertions in 19 cases", - "hnsw_focus": "complete SQLite-HNSW suite passes 2,614 assertions in 20 cases; focused replacement-entry and activation-snapshot clearing, moved-embedding invalidation with unchanged-vector tolerance, legacy dead-snapshot rejection, legacy dead-entry restart rebuild, active-only fill, and bounded-backfill regressions pass", - "consolidation_focus": "4,309 assertions in 32 cases, including exact effective-RIF selection and the 16,384-row all-low active-state ceiling", - "zig_build_local_patch": "text-only shared build passed; global hnswlib cache remained unpatched while the declared build-local copy passed reverse patch verification", + "hnsw_focus": "the exact canonical-entry reactivation, missing-snapshot ordinary-search restart, and prior-snapshot-free recenter rebuild regressions pass in the four-case 107-assertion follow-up set", + "consolidation_focus": "the four-case follow-up set passes 107 assertions, including both clustered-row prefilter arms, the eligible-only inactive query plan, and migration 34 structure", + "zig_build_local_patch": "ReleaseFast static CLI build passed after Git-path normalization; global hnswlib cache remained unpatched while the declared build-local copy passed complete reverse patch verification; the patch file is an explicit build input", "wasm_bundle": "built successfully with Emscripten 4.0.18", - "test_binary_sha256": "0fd25b6e322913cb0e76e3aa5a1fbcc6836d8696b6bbd5886224a3144fea1ec8", + "focused_test_binary_sha256": "2ad4b947a5728fa767680a7cb399ebe969661b0a47e2ca5f269434ca34d0f02c", "wasm_sha256": "17d31e0a61327e91d7a53577b73689442583d5f4c84aa76d5844ac309e9791aa" }, "sanitizer_proof": { @@ -189,7 +219,8 @@ "modality_branch": false }, "unresolved_limits": [ - "record-transition review, push, and replacement exact-head CI for the seven-thread repair remain pending", + "Windows execution and replacement exact-head CI for the Zig Git-path repair remain pending", + "push and replacement exact-head CI for the four follow-up P2 repairs remain pending; round-three and final cumulative reviews are Proven at P1", "whole-engine raw process reset is not proven", "bounded whole-engine restart is not proven", "Durable plateau and production-wide boundedness are not claimed" diff --git a/artifacts/flat_storage_cost/paper-traceability-manifest-v1.json b/artifacts/flat_storage_cost/paper-traceability-manifest-v1.json index 6bb23e63..ba1e7957 100644 --- a/artifacts/flat_storage_cost/paper-traceability-manifest-v1.json +++ b/artifacts/flat_storage_cost/paper-traceability-manifest-v1.json @@ -799,9 +799,9 @@ }, { "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", - "decision": "seven-review-thread-repair-proven-at-round-five-p1", + "decision": "eleven-review-thread-repair-with-follow-up-p2-proof-active", "evidence_fingerprints": [ - "1e4fc54c2a756b4c2237ad32d9cea5cad9c704141736fe3d250a6c1868043377" + "fbba1d0e888bb0cfcb17ea27b39752979c8fcb164afc452b16e5b11331cce753" ], "evidence_kind": "measured", "inventory_id": "state:pr6_exact_head_ci_repair", @@ -1027,7 +1027,7 @@ "corpus_parameter_scope": "production-default 8C-to-9C SQLite HNSW route; 15,695-packet Natural replay, 2,016-message Durable replay, 30,380-packet maturity extension, 27 structural F/S/T points, and nine 4,000-packet quality points with 512 controls each", "decision": "retained-production-default", "evidence_fingerprints": [ - "a75c72875146e28ce9292f50c68289d2bbc5f37911b8cc3947407f9009a5bd64" + "f39c0adefee67dd5f0c9017b4b7ecfe5c71303a8f49e77dc2b9695ecc72008e5" ], "evidence_kind": "measured", "inventory_id": "state:sqlite_hnsw_production_cutover", diff --git a/build.zig b/build.zig index e80daf11..de3cc628 100644 --- a/build.zig +++ b/build.zig @@ -332,6 +332,7 @@ pub fn build(b: *std.Build) void { ); prepare_hnswlib.addArg("-P"); prepare_hnswlib.addFileArg(b.path("cmake/PrepareHnswlibForZig.cmake")); + prepare_hnswlib.addFileInput(b.path("cmake/hnswlib-prefetch-bounds.patch")); if (fetch_aist_model) { if (!std.mem.eql(u8, aist_model_quant, "q8_0") and diff --git a/build.zig.zon b/build.zig.zon index 96328e30..687f05bf 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -24,6 +24,7 @@ .paths = .{ "build.zig", "build.zig.zon", + "cmake", "include", "scripts", "src", diff --git a/cmake/PrepareHnswlibForZig.cmake b/cmake/PrepareHnswlibForZig.cmake index 0b9742b5..06ff2635 100644 --- a/cmake/PrepareHnswlibForZig.cmake +++ b/cmake/PrepareHnswlibForZig.cmake @@ -15,6 +15,8 @@ file(COPY "${HNSWLIB_SOURCE_DIR}/hnswlib" get_filename_component(_repo_root "${CMAKE_CURRENT_LIST_DIR}/.." ABSOLUTE) file(RELATIVE_PATH _output_relative "${_repo_root}" "${HNSWLIB_OUTPUT_DIR}") +# git apply interprets --directory as a Git path even on Windows. +string(REPLACE "\\" "/" _output_relative "${_output_relative}") set(_patch "${CMAKE_CURRENT_LIST_DIR}/hnswlib-prefetch-bounds.patch") execute_process( COMMAND git apply --check --unsafe-paths diff --git a/comments/consolidation-drift-retrigger/20260716T205900Z-orchestrator-goal-mdscript-converted.mdscript.md b/comments/consolidation-drift-retrigger/20260716T205900Z-orchestrator-goal-mdscript-converted.mdscript.md index 60f17923..5edc0545 100644 --- a/comments/consolidation-drift-retrigger/20260716T205900Z-orchestrator-goal-mdscript-converted.mdscript.md +++ b/comments/consolidation-drift-retrigger/20260716T205900Z-orchestrator-goal-mdscript-converted.mdscript.md @@ -5,13 +5,13 @@ owner_role: implementer lane_id: consolidation-drift-retrigger status: monitoring implementation_status: complete -monitor_status: seven-review-thread-repair-ready-to-push +monitor_status: four-follow-up-record-findings-corrected-push-pending source_of_truth: current repository, current user corrections, this goal, task comments, exact private profiles and audits, and GitHub PR 6 only after implementation completion model: gpt-5.6-terra reasoning: high model_selection_basis: cross-cutting C++ and SQLite implementation, deterministic bounded-work proof, research traceability, and PR ownership canonical_monitor_entry: true -updated_at: 20260721T103935Z +updated_at: 20260721T125600Z --- @@ -36,17 +36,20 @@ updated_at: 20260721T103935Z * the mature extended suffix shows store growth without continuing per-store work growth: non-overlapping late-half mean process fell 8.918 to 7.858 ms, graph seed-cache time fell 2.914 to 2.397 ms with per-node unit ratio 0.789, and supersession loading fell 1.860 to 1.520 ms with per-candidate unit ratio 0.855 * the no-selector 2,016-message Durable run processed four consolidations in 79,481 ms with mean process 10.709666 ms and mean total 39.024183 ms; all 512 controls passed top-1, recall@16, semantic coverage, and ties at 1.0 with four opaque sources; its horizon is insufficient for ten post-warmup 500-event windows and therefore does not prove Durable plateau * focused production-default derivation, route work, active-epoch reset, shared Natural/Durable path, Durable-barrier non-replay, source/modality, Python audit, and evidence-builder tests pass on the current release build -* all algorithm and experiment changes, accepted adverse timing, maturity boundary, failed-recenter rollback repair, exact-head CI repairs, and nonclaims are recorded in `docs/paper/sections/10_implementation.qmd` and `docs/paper/sections/11_optimization.qmd`; the regenerated manuscript SHA-256 is `070a04989506a062227bd69b3c57254e3602be37e734ad14a6a5eef6806e0472` -* the clean Debug LLVM 21 media-enabled suite with experiment hooks enabled passes 38,730 assertions in 697 cases; its exact test binary SHA-256 is `0fd25b6e322913cb0e76e3aa5a1fbcc6836d8696b6bbd5886224a3144fea1ec8`. The complete SQLite-HNSW suite passes 2,614 assertions in 20 cases; focused RIF passes 312 assertions in 19 cases; the complete Python tool suite passes 159 tests; complete hnswlib patch reverse-check and `git diff --check` pass. WebAssembly rebuilt successfully with Emscripten 4.0.18 on the preceding exact head. A local UBSan-only build completes, but macOS denies its runtime library before `main()` on code-signing policy, so replacement Linux CI owns sanitizer execution -* the current-state overlay, rebuilt 70-record manifest, and fail-closed audit have raw-file SHA-256 values `4fc32ca4a05c1a6549f77adc3ec991b4cc646d8dd1e91c49c128461e09587388`, `8fdd635490cda4be8beea247cedc0b0e11756ecd227acf8d0d0191cf53e19395`, and `090fc413dde8300eb6946cceaaa54a3dfe4446a9fb47dc403a2c09987e1c27e5`; the audit passes with 70/70 inventory records and no uncovered inventory, claim mismatch, proof-level violation, or ownership violation; its normalized state SHA-256 is `cd08a420024a4a89050f47bfa63cce161f6d46c6430f82820b853959aa0dc410`, and the regenerated manuscript SHA-256 is `070a04989506a062227bd69b3c57254e3602be37e734ad14a6a5eef6806e0472` +* preceding exact-head historical proof recorded all algorithm and experiment changes, accepted adverse timing, maturity boundary, failed-recenter rollback repair, exact-head CI repairs, and nonclaims in `docs/paper/sections/10_implementation.qmd` and `docs/paper/sections/11_optimization.qmd`; that preceding manuscript SHA-256 was `caa8ebead662209cfb55bad9c23638108b74d27497f594eab35006b792fabbc8` and is superseded by the current packet below +* on that preceding exact head, the clean Debug LLVM 21 media-enabled suite with experiment hooks enabled passed 38,730 assertions in 697 cases on test binary SHA-256 `0fd25b6e322913cb0e76e3aa5a1fbcc6836d8696b6bbd5886224a3144fea1ec8`. Its complete SQLite-HNSW suite passed 2,614 assertions in 20 cases; focused RIF passed 312 assertions in 19 cases; the complete Python tool suite passed 159 tests; complete hnswlib patch reverse-check and `git diff --check` passed; and WebAssembly rebuilt with Emscripten 4.0.18. This is historical preceding-head evidence, not the current follow-up binary/result binding. A local UBSan-only build completes, but macOS denies its runtime library before `main()` on code-signing policy, so replacement Linux CI owns sanitizer execution +* the current-state overlay, rebuilt 70-record manifest, and fail-closed audit have raw-file SHA-256 values `3c4710ba511949ddab5743e799da8d3165be72fd7f42e38f7f0e763ed77fd7d9`, `90e34a0e84b5435afa43a21607e0f97b927afaef2df84ab3ea4135874b7b541b`, and `c17515ca87421e1af4fe154c7da6b27efbf10d9c5b5c5edd157e99af30f85ea5`; the audit passes with 70/70 inventory records and no uncovered inventory, claim mismatch, proof-level violation, or ownership violation; its normalized state SHA-256 is `25935efc387257d14f3dcf7f5397e7967bb4ab3139b084521522cc1898255ead`, and the regenerated manuscript SHA-256 is `821fce2999f765eaa828a1b83ba47ff403fe568fcb2e72ad88c873a10bf4c423` * the original recursive cutover review remains complete. The exact-head CI repair then received a fresh round one that found one P2 unguarded empty-adjacency HNSW prefetch; repair tree `d3ce8c1ada4ab13023cbcd40959c8a8a878b5307` guards it and adds deterministic update/reseal coverage. A different fresh round-two reviewer proved the complete repair at the P1/P2 threshold with no blocking finding. Its sole P3 control-record hygiene residual was corrected directly; a later append-only project correction record dated 2026-07-21 discloses the earlier in-place continuation mutation, supersedes that compromised provenance, synchronizes the task, and restores the missing lane-ledger history without exposing a machine-local path * fresh round-three cumulative review of baseline tree `156dd7bc27b7cda2c661a9467bfddfe72c771e8a` to candidate tree `71b079ec217128513e593f54bdb308f18a03d8eb` was Proven at P1 with no P1 findings. Round four reviewed candidate `5ea10c156fe6072961b7c43af97b2ac34ed30037` and found no implementation P1, but correctly rejected its stale audit and prior-candidate proof identities at P1. After that repair, a different fresh round-five reviewer proved exact candidate tree `0b4069c73955147da28add9b9eaea480bad48249` for source health at the P1 threshold with no P1 findings. One below-threshold P2 residual remains visible: the bounded cache ranks the global flashbulb prefix before recency/arousal filtering, while the SQL fallback filters eligibility before `LIMIT`. This does not regress the public thread's required intensity-before-truncation order, but full cache/fallback selection equivalence remains unclaimed * the required single non-code review reproduced the merged-state 70/70 trace audit and found two record defects: the external task still capped schema authority at migrations 29/30 and named obsolete head `b7f9e27`, while four current implementer comments lacked the complete metadata and Evidence/Questions/Stop Report shape. Both findings are directly corrected and validated without rereview as required; no code changed after the Proven round-five source candidate -* exact pushed head `764e4af202a91120dae85e1d6b0d69e2ce97aa5d` is synchronized with current main, OPEN/non-draft, MERGEABLE/CLEAN, and 12/12 green. Seven review threads remain unresolved until one cumulative reviewed repair is pushed. The accepted first slice uses a patched build-local Zig copy, indexed active-only route fill, and an exact inactive/active RIF frontier merge guarded by `64C+1` and `A`. The second slice adds indexed canonical-entry replacement, activation-snapshot clearing in both row-addressed and HNSW-assisted seals, legacy dead-entry/snapshot restart rejection, moved-embedding generation invalidation with exact fallback and bounded rebuild, bounded emotional-source intensity ordering before truncation, and fixed-point invalidation after edge-limited traversal. Round one found and repaired three P2 lifecycle/record gaps. Round two found and repaired one P2 stale bounded source rank after intensity mutation through migration 33's partial SQLite index, a dirty rank marker, and exact knob-sized refill. The first cumulative rerun used a non-media build, exposed expected audio/image configuration failures, timed out at 1,500 seconds, and also exposed one obsolete integration expectation: the scenario deliberately moves an active vector but still expected a stale-adjacency seal. Candidate tree `5ea10c156fe6072961b7c43af97b2ac34ed30037` corrected that expectation to failure code 62 and generation/meta/journal invalidation. The subsequent clean media-enabled cumulative run passes 38,730 assertions in 697 cases. The repaired exact candidate tree is deliberately supplied by the review packet rather than self-referenced from inside this goal +* implementation repair commit `89a06084dd05710f90572c1b7bac7e17fab79122` is pushed on a branch synchronized with current main; PR 6 is OPEN/non-draft and MERGEABLE/UNSTABLE. All seven review threads received exact repair/proof replies and are resolved. The accepted first slice uses a patched build-local Zig copy, indexed active-only route fill, and an exact inactive/active RIF frontier merge guarded by `64C+1` and `A`. The second slice adds indexed canonical-entry replacement, activation-snapshot clearing in both row-addressed and HNSW-assisted seals, legacy dead-entry/snapshot restart rejection, moved-embedding generation invalidation with exact fallback and bounded rebuild, bounded emotional-source intensity ordering before truncation, and fixed-point invalidation after edge-limited traversal. The clean media-enabled cumulative run passes 38,730 assertions in 697 cases. At every re-entry resolve the live GitHub PR head and check conclusions rather than treating this repository record as self-addressing or its snapshots as current +* Windows `zig-cli-install` failed on implementation repair commit `89a06084dd05710f90572c1b7bac7e17fab79122` because CMake supplied `git apply --directory` a backslash-separated relative path. The candidate normalizes only that Git path to forward slashes before the existing content check and apply; local Zig ReleaseFast static CLI build and complete reverse patch verification pass. Recursive review of that repair is Proven at round three P1; Windows validation remains owned by replacement exact-head CI +* four newer P2 review threads are repaired locally: a reactivated higher-level row-addressed node retakes canonical entry authority, replacement-centroid search does not explicitly seed from the prior activation snapshot, both bounded consolidation arms exclude clustered rows before `LIMIT`, and the Zig package allowlist includes the CMake patch assets. Round-one review found that the prior strength index could still scan a clustered history prefix; current-user schema authorization extends to private migration 34, whose eligible-only unclustered partial index restores the $A+64C$ scan bound. Round-two review then found three P2 defects: the actual-seed metric had moved the ordinary-search visited boundary, the Zig patch was not a declared cached-step input, and the proof packet paired an older full-suite result with a newer binary. The repaired candidate preserves the original visited semantics, declares and invalidation-tests the patch input, and binds the current full result to its exact binary. The exact repair/query-plan/migration set passes 107 assertions in four cases; the current media-enabled suite passes 38,766 assertions in 699 cases on test binary SHA-256 `2ad4b947a5728fa767680a7cb399ebe969661b0a47e2ca5f269434ca34d0f02c`; Zig text-only passes 12/12 including a patch-content invalidation rerun; Python passes 159; the manuscript is regenerated; and the 70/70 trace audit passes. Fresh round-three and separately fresh final cumulative reviews are Proven at P1 with no P1 finding; the required single final record-only review, push, thread replies, and replacement exact-head CI remain pending. Two below-threshold P3 residuals remain visible: same-level reactivation tie behavior is not isolated, and the legacy external project goal remains a stale active discovery surface +* the required single final record-only review found three P2 current-state contradictions and is consumed exactly once. The preceding manuscript/full-suite lines are now explicitly historical, the monitor hot path now starts at the post-review direct-correction/push transition, and the external task's current evidence now names 107 assertions, 38,766/699, the exact binary, and completed P1 reviews. These findings were corrected directly without rereview as required; final validation, push, public thread replies, and replacement exact-head CI remain pending ## PR Monitor Hot Path -* validate the direct record corrections, commit and push without force, reply to and resolve all seven proven PR threads, and monitor replacement exact-head CI while keeping the branch synchronized with current main +* consume the single final record verdict, directly correct its findings without rereview, validate the final records, push without force, reply to and resolve the four threads after proof, then resolve the live GitHub PR head, base, checks, mergeability, review requests, comments, and unresolved threads * every ten minutes in this current task, refresh PR 6 exact head, checks, mergeability, reviews, review requests, comments, and unresolved threads; compare with the prior state and report only changes * repair only in-scope failures or review findings with proportionate proof and the required fresh review; push without force and update this goal to the new exact head * stop and deactivate the heartbeat when the PR merges or closes externally, repair exceeds scope, target drift is unrecoverable, or authority is explicitly denied diff --git a/docs/paper/_manuscript/index.md b/docs/paper/_manuscript/index.md index 733eb3f5..db91ae94 100644 --- a/docs/paper/_manuscript/index.md +++ b/docs/paper/_manuscript/index.md @@ -5837,26 +5837,33 @@ packed snapshot through its independent *A* row budget and uses all valid snapshot identities as deterministic level-zero entry points. Neighbor rows discovered from those entry points remain charged to the current canonical 8*C*–9*C* budget, so consolidation can steer the walk -without widening either envelope. The internal search used to construct -a recenter snapshot does not advance the retrieval-age ramp. If snapshot -persistence fails, both queue effort and the actual-node budget remain -at their pre-attempt values; only a successful recenter resets them to -8*C*. The floor, increment, and ceiling are derived from F/S/T rather -than independently tunable fourth knobs. Every query records its ceiling -and actual visited rows; canonical rows above the current ceiling or -above 9*C* fail the audit. The persisted snapshot remains independently -charged under its *A* ceiling and is joined with the canonical -candidates for final exact reranking. The returned set makes the -existing formula explicit: its best 2*C* canonical identities are -protected, while consolidation may supply the remaining 2*B* identities -in *A* = 2*C* + 2*B*. The final selected set is reranked by exact -distance. Total fetched-row work is therefore bounded by 9*C* + *A*. A -separate returned-identity counter still fails above *A*, so a changed -semantic center cannot be mistaken for an unbounded working set. The -normalized center, snapshot generation, and packed identity list live in -the single SQLite route-metadata row and survive reopen; malformed, -stale, duplicate, or over-capacity metadata invalidates the route. Graph -and memory rows remain authoritative in SQLite. +without widening either envelope. The internal rebuild of a replacement +snapshot deliberately excludes the prior snapshot’s identities from its +frontier seeds; only the canonical route and the new consolidation +embedding may choose the replacement centroid neighborhood. The same +identities may still be rediscovered through canonical adjacency or the +active indexed fill and retained by exact reranking; this rule removes +stale seeding authority, not otherwise relevant memories. The internal +search used to construct a recenter snapshot does not advance the +retrieval-age ramp. If snapshot persistence fails, both queue effort and +the actual-node budget remain at their pre-attempt values; only a +successful recenter resets them to 8*C*. The floor, increment, and +ceiling are derived from F/S/T rather than independently tunable fourth +knobs. Every query records its ceiling and actual visited rows; +canonical rows above the current ceiling or above 9*C* fail the audit. +The persisted snapshot remains independently charged under its *A* +ceiling and is joined with the canonical candidates for final exact +reranking. The returned set makes the existing formula explicit: its +best 2*C* canonical identities are protected, while consolidation may +supply the remaining 2*B* identities in *A* = 2*C* + 2*B*. The final +selected set is reranked by exact distance. Total fetched-row work is +therefore bounded by 9*C* + *A*. A separate returned-identity counter +still fails above *A*, so a changed semantic center cannot be mistaken +for an unbounded working set. The normalized center, snapshot +generation, and packed identity list live in the single SQLite +route-metadata row and survive reopen; malformed, stale, duplicate, or +over-capacity metadata invalidates the route. Graph and memory rows +remain authoritative in SQLite. Decoded activation-snapshot rows reuse the route’s existing generation-qualified shadow-node cache rather than being selected and @@ -5951,7 +5958,15 @@ isolated active identity just beyond an inactive slice. CMake and Zig compile the same pinned HNSW safety patch. The Zig graph copies the header-only dependency into a build-local declared output and patches that copy, leaving the content-addressed global package cache immutable -and safe for concurrent builds. +and safe for concurrent builds. The build-local output is normalized to +Git’s forward-slash path form before `git apply`, so the same content +check no longer receives host-native backslashes. The patch itself is +also a declared build input, so changing it invalidates the preparation +step instead of reusing a stale patched output. Local POSIX proof +passes; replacement Windows CI remains the execution owner. The Zig +package manifest includes the `cmake` directory so downstream package +consumers receive both the preparation script and its content-checked +patch rather than only the top-level build graph. When a sealed removal targets the canonical hierarchy entry, replacement is selected by highest level and then lowest memory id through the @@ -5959,10 +5974,15 @@ is selected by highest level and then lowest memory id through the at most the staged removal count plus one row: at most that many leading rows can be excluded by the same seal. The replacement’s level becomes the new `max_level`, so restart never begins from an inactive entry or -asks a lower level node for nonexistent upper adjacency. If any sealed -removal overlaps the persisted consolidation activation snapshot, the -snapshot entry, generation, centroid, and identity list are cleared in -the same transaction; in-process and restarted queries then use the +asks a lower level node for nonexistent upper adjacency. If the removed +node later becomes active again without changing its embedding, +row-addressed sealing preserves its persisted links and level and +promotes it back to the canonical entry whenever that level exceeds the +current active maximum. Thus metadata continues to name the highest +active hierarchy root after both deletion and reactivation. If any +sealed removal overlaps the persisted consolidation activation snapshot, +the snapshot entry, generation, centroid, and identity list are cleared +in the same transaction; in-process and restarted queries then use the canonical route until the next successful recenter builds a new bounded snapshot. Restart validates that the metadata entry exists in the same generation, is active, and carries the recorded maximum level. A legacy @@ -8844,11 +8864,17 @@ deterministic route completion now draws from the indexed active-generation slice, so an inactive row cannot consume the fixed envelope or hide a later active identity. The CMake and Zig build graphs apply the same content-checked HNSW bounds patch; Zig patches a -build-local copy rather than mutating its shared package cache. The RIF -changed-row counter now records work performed by the current event -rather than the historical active population. Each correction has a -red-then-green regression and changes measurement, not public retrieval -semantics. +build-local copy rather than mutating its shared package cache, and +normalizes the build output to Git’s forward-slash path form before +applying the patch so the Windows command no longer receives +backslash-separated Git paths. The patch is a declared build input, so a +patch-only change invalidates the preparation step. Local POSIX proof +passes, while replacement Windows CI remains required; the Zig package +allowlist now carries the `cmake` preparation and patch assets used by +that build graph. The RIF changed-row counter now records work performed +by the current event rather than the historical active population. Each +correction has a red-then-green regression and changes measurement, not +public retrieval semantics. The remaining consolidation scan was bounded by the same knobs. Let *A* = 2*C* + 2*B* and *N* = max (8, ⌊*B*/2⌋). Score consolidation now @@ -8857,11 +8883,17 @@ merging two frontiers: at most *A* inactive identities from the indexed materialized strength/time order and at most *A* active identities ordered by their exact clock-derived RIF strength. A 64*C* + 1 sentinel count fails closed before the active branch when the existing -active-epoch mutation ceiling would be exceeded. This bounds the -inactive index scan by *A* + 64*C*, the dynamic active calculation by -64*C*, and the merged/downstream frontier by *A*, without a -history-sized sort. It also prevents partially recovered rows with stale -low materialized strength from excluding a genuinely weak row. The +active-epoch mutation ceiling would be exceeded. Both arms exclude +already-clustered memories before applying their *A* limits, so +clustered low-strength rows cannot consume the bounded slice and hide +the next eligible unclustered memory. The inactive arm uses a partial +strength/time/embedding index containing only unclustered long-term +rows; after at most 64*C* active-RIF exclusions it can therefore admit +*A* inactive rows without scanning a clustered history prefix. This +bounds the inactive index scan by *A* + 64*C*, the dynamic active +calculation by 64*C*, and the merged/downstream frontier by *A*, without +a history-sized sort. It also prevents partially recovered rows with +stale low materialized strength from excluding a genuinely weak row. The scorer counts at most *N* association edges per admitted identity. A sentinel row publishes the exact input cardinality even when no candidate is selected. The formula, counter, and source/modality @@ -9395,26 +9427,30 @@ deployment remain unclaimed. before working-memory hydration; pinned HNSW speculative neighbor prefetches are adjacency-bounded without disabling SIMD distance kernels; empty adjacency snapshots skip a zero-byte copy whose vector -destination may be null; Zig applies the same patch to a build-local -copy; deterministic route fill excludes inactive rows; entry removal -promotes an indexed active hierarchy root, atomically clears overlapping -activation snapshots, and restart rejects legacy dead canonical or -snapshot identities; changed active embeddings invalidate stale -adjacency for bounded rebuild; consolidation merges exact active-RIF and -indexed inactive frontiers under the existing 64C/A ceilings; bounded emotional-source -discovery preserves SQL intensity order and refreshes rank-changing -mutations through an indexed knob-sized prefix; partial edge-limited -cascade traversals do not become fixed points; and cache-byte arithmetic -uses explicit std::size_t width for WebAssembly. The full -media CTest baseline, focused RIF/HNSW/consolidation regressions, -build-local Zig proof, and WebAssembly bundle build pass locally. The -sandboxed macOS ASAN runtime cannot execute because dynamic-shadow -discovery or sanitizer-runtime code signing fails before -main(), so replacement exact-head Linux sanitizer CI -remains the required owner; the historical 4,608-query quality matrix is -not relabeled as evidence from the repaired binary. +destination may be null; Zig applies the same patch to a packaged +build-local copy with host paths normalized to Git form; deterministic +route fill excludes inactive rows; entry removal promotes an indexed +active hierarchy root, reactivation restores a higher persisted root, +overlapping activation snapshots clear atomically, recenter rebuilds do +not use prior snapshot identities as explicit frontier seeds, and +restart rejects legacy dead canonical or snapshot identities; changed +active embeddings invalidate stale adjacency for bounded rebuild; +consolidation merges exact active-RIF and indexed inactive frontiers +under the existing 64C/A ceilings and filters clustered +memories through an eligible-only partial index before either bounded +arm; bounded emotional-source discovery preserves SQL intensity order +and refreshes rank-changing mutations through an indexed knob-sized +prefix; partial edge-limited cascade traversals do not become fixed +points; and cache-byte arithmetic uses explicit std::size_t +width for WebAssembly. The full media CTest baseline, focused +RIF/HNSW/consolidation regressions, build-local Zig proof, and +WebAssembly bundle build pass locally. The sandboxed macOS ASAN runtime +cannot execute because dynamic-shadow discovery or sanitizer-runtime +code signing fails before main(), so replacement exact-head +Linux sanitizer CI remains the required owner; the historical +4,608-query quality matrix is not relabeled as evidence from the +repaired binary. TRACE[state:hnsw_fixed_6c_experiment] diff --git a/docs/paper/sections/10_implementation.qmd b/docs/paper/sections/10_implementation.qmd index e903b9c7..e534cba3 100644 --- a/docs/paper/sections/10_implementation.qmd +++ b/docs/paper/sections/10_implementation.qmd @@ -405,6 +405,12 @@ snapshot through its independent $A$ row budget and uses all valid snapshot identities as deterministic level-zero entry points. Neighbor rows discovered from those entry points remain charged to the current canonical $8C$--$9C$ budget, so consolidation can steer the walk without widening either envelope. +The internal rebuild of a replacement snapshot deliberately excludes the prior +snapshot's identities from its frontier seeds; only the canonical route and the +new consolidation embedding may choose the replacement centroid neighborhood. +The same identities may still be rediscovered through canonical adjacency or +the active indexed fill and retained by exact reranking; this rule removes stale +seeding authority, not otherwise relevant memories. The internal search used to construct a recenter snapshot does not advance the retrieval-age ramp. If snapshot persistence fails, both queue effort and the actual-node budget remain at their pre-attempt values; only a successful @@ -511,7 +517,15 @@ not consume the fixed node budget or hide an isolated active identity just beyond an inactive slice. CMake and Zig compile the same pinned HNSW safety patch. The Zig graph copies the header-only dependency into a build-local declared output and patches that copy, leaving the content-addressed global -package cache immutable and safe for concurrent builds. +package cache immutable and safe for concurrent builds. The build-local output +is normalized to Git's forward-slash path form before `git apply`, so the same +content check no longer receives host-native backslashes. The patch itself is +also a declared build input, so changing it invalidates the preparation step +instead of reusing a stale patched output. Local POSIX proof +passes; replacement Windows CI remains the execution owner. The Zig package +manifest includes the `cmake` directory so downstream package consumers receive +both the preparation script and its content-checked patch rather than only the +top-level build graph. When a sealed removal targets the canonical hierarchy entry, replacement is selected by highest level and then lowest memory id through the @@ -520,6 +534,11 @@ most the staged removal count plus one row: at most that many leading rows can be excluded by the same seal. The replacement's level becomes the new `max_level`, so restart never begins from an inactive entry or asks a lower level node for nonexistent upper adjacency. +If the removed node later becomes active again without changing its embedding, +row-addressed sealing preserves its persisted links and level and promotes it +back to the canonical entry whenever that level exceeds the current active +maximum. Thus metadata continues to name the highest active hierarchy root +after both deletion and reactivation. If any sealed removal overlaps the persisted consolidation activation snapshot, the snapshot entry, generation, centroid, and identity list are cleared in the same transaction; in-process and restarted queries then use the canonical diff --git a/docs/paper/sections/11_optimization.qmd b/docs/paper/sections/11_optimization.qmd index 30ec95f8..2b7b9937 100644 --- a/docs/paper/sections/11_optimization.qmd +++ b/docs/paper/sections/11_optimization.qmd @@ -1477,7 +1477,13 @@ physical audit streams remain intact. Mature deterministic route completion now draws from the indexed active-generation slice, so an inactive row cannot consume the fixed envelope or hide a later active identity. The CMake and Zig build graphs apply the same content-checked HNSW bounds patch; Zig patches a -build-local copy rather than mutating its shared package cache. The RIF +build-local copy rather than mutating its shared package cache, and normalizes +the build output to Git's forward-slash path form before applying the patch so +the Windows command no longer receives backslash-separated Git paths. The +patch is a declared build input, so a patch-only change invalidates the +preparation step. Local POSIX proof passes, while replacement Windows CI remains required; the Zig +package allowlist now carries the `cmake` preparation and patch assets used by +that build graph. The RIF changed-row counter now records work performed by the current event rather than the historical active population. Each correction has a red-then-green regression and changes measurement, not public retrieval @@ -1490,7 +1496,12 @@ frontiers: at most $A$ inactive identities from the indexed materialized strength/time order and at most $A$ active identities ordered by their exact clock-derived RIF strength. A $64C+1$ sentinel count fails closed before the active branch when the existing active-epoch mutation ceiling would be -exceeded. This bounds the inactive index scan by $A+64C$, the dynamic active +exceeded. Both arms exclude already-clustered memories before applying their +$A$ limits, so clustered low-strength rows cannot consume the bounded slice and +hide the next eligible unclustered memory. The inactive arm uses a partial +strength/time/embedding index containing only unclustered long-term rows; after +at most $64C$ active-RIF exclusions it can therefore admit $A$ inactive rows +without scanning a clustered history prefix. This bounds the inactive index scan by $A+64C$, the dynamic active calculation by $64C$, and the merged/downstream frontier by $A$, without a history-sized sort. It also prevents partially recovered rows with stale low materialized strength from excluding a genuinely weak row. The scorer counts @@ -1661,7 +1672,7 @@ observation-only result is never promoted to production-path proof. | `TRACE[state:sqlite_hnsw_sparse_route_integration]` | Retained row-addressed SQLite HNSW query and incremental seal in the existing `GraphRetrieve` and `MemoryStorage` paths; Natural and Durable share the same algorithm, and Durable adds only its checkpoint. Current full-corpus retrieval quality and activation bounds pass, while the Natural whole-engine plateau and Durable horizon gates remain open. | | `TRACE[state:sqlite_hnsw_activation_effort_cycle]` | Queue-effort-only, fixed-$5C$, and dynamic $4C$ through $8C$ floor variants were rejected or superseded. The retained candidate resets routing work to $8C$, advances by $R=\max(2,\lfloor B/16\rfloor)$ to $9C$, keeps $A=2C+2B$ downstream activation and $2B/(C+B)$ construction, passes the 30,380-packet mature-cycle gates at 511/512 top-1 and recall@16 0.999265, and passes canonical and nine-point quality without an engine-wide plateau claim. | | `TRACE[state:sqlite_hnsw_production_cutover]` | Retained the existing SQLite HNSW route as the production default at an $8C$ post-consolidation floor, $R=\max(2,\lfloor B/16\rfloor)$ step, $9C$ ceiling, separate $A=2C+2B$ snapshot, and $9C+A$ total row ceiling. The nine-point matrix passed 4,608/4,608 top-1 controls, minimum recall@16 and semantic coverage 1.0, deterministic ties, and source/modality-label invariance. Natural and Durable share the operation path, with Durable adding only its checkpoint; whole-engine reset, bounded restart, Durable plateau, release, and deployment remain unclaimed. | -| `TRACE[state:pr6_exact_head_ci_repair]` | PR-monitor repair record: migrated active RIF rows are calibrated before working-memory hydration; pinned HNSW speculative neighbor prefetches are adjacency-bounded without disabling SIMD distance kernels; empty adjacency snapshots skip a zero-byte copy whose vector destination may be null; Zig applies the same patch to a build-local copy; deterministic route fill excludes inactive rows; entry removal promotes an indexed active hierarchy root, atomically clears overlapping activation snapshots, and restart rejects legacy dead canonical or snapshot identities; changed active embeddings invalidate stale adjacency for bounded rebuild; consolidation merges exact active-RIF and indexed inactive frontiers under the existing $64C$/$A$ ceilings; bounded emotional-source discovery preserves SQL intensity order and refreshes rank-changing mutations through an indexed knob-sized prefix; partial edge-limited cascade traversals do not become fixed points; and cache-byte arithmetic uses explicit `std::size_t` width for WebAssembly. The full media CTest baseline, focused RIF/HNSW/consolidation regressions, build-local Zig proof, and WebAssembly bundle build pass locally. The sandboxed macOS ASAN runtime cannot execute because dynamic-shadow discovery or sanitizer-runtime code signing fails before `main()`, so replacement exact-head Linux sanitizer CI remains the required owner; the historical 4,608-query quality matrix is not relabeled as evidence from the repaired binary. | +| `TRACE[state:pr6_exact_head_ci_repair]` | PR-monitor repair record: migrated active RIF rows are calibrated before working-memory hydration; pinned HNSW speculative neighbor prefetches are adjacency-bounded without disabling SIMD distance kernels; empty adjacency snapshots skip a zero-byte copy whose vector destination may be null; Zig applies the same patch to a packaged build-local copy with host paths normalized to Git form; deterministic route fill excludes inactive rows; entry removal promotes an indexed active hierarchy root, reactivation restores a higher persisted root, overlapping activation snapshots clear atomically, recenter rebuilds do not use prior snapshot identities as explicit frontier seeds, and restart rejects legacy dead canonical or snapshot identities; changed active embeddings invalidate stale adjacency for bounded rebuild; consolidation merges exact active-RIF and indexed inactive frontiers under the existing $64C$/$A$ ceilings and filters clustered memories through an eligible-only partial index before either bounded arm; bounded emotional-source discovery preserves SQL intensity order and refreshes rank-changing mutations through an indexed knob-sized prefix; partial edge-limited cascade traversals do not become fixed points; and cache-byte arithmetic uses explicit `std::size_t` width for WebAssembly. The full media CTest baseline, focused RIF/HNSW/consolidation regressions, build-local Zig proof, and WebAssembly bundle build pass locally. The sandboxed macOS ASAN runtime cannot execute because dynamic-shadow discovery or sanitizer-runtime code signing fails before `main()`, so replacement exact-head Linux sanitizer CI remains the required owner; the historical 4,608-query quality matrix is not relabeled as evidence from the repaired binary. | | `TRACE[state:hnsw_fixed_6c_experiment]` | Rejected knob-derived fixed-$6C$ routing envelope. All 27 structural F/S/T points and 931 assertions passed; neutral $C=512$ produced a 3,072-node envelope while $B=128$ and the 129 boundary remained distinct. An extra production-default F=.45/S=.5/T=.5 pre-screen missed exact top-1, recall@16, plateau, and wall-time gates, so fail-fast rejected the candidate before the exact nine-point corpus matrix started and left production on fixed $5C$. | | `TRACE[state:post_rif_empty_fixed_envelope_attribution]` | Repaired proof classification for the retained zero-increment fixed-$5C/5C$ route. Retrieval mode is independent of whole-engine process shape; route-active rows fail closed on missing work, and queue, node ceiling, actual visits, distance work, and activation are checked separately across at least ten mature unchanged-envelope recenters. The production suffix beginning at event 10,195 passes the classifier and work envelope across 12 complete recenters, while activated-identity overlap, process-cycle reset, exact full-horizon retrieval, Durable horizon, and bounded restart remain open. | | `TRACE[state:write_gate_incidence_attribution_v2]` | Deterministic range-bound observation-only 15,695-packet production-knob attribution rejected boundary-to-write incidence as the growth source: exact event ranges 0--2,499 and 13,195--15,694 contained 510 and 528 writes, while MemoryStorage time per write rose from 0.4833 to 2.8343 ms as the existing shared SQLite HNSW route warmed toward the fixed $5C=2{,}495$ envelope. Production $C/B/A=499/125/1{,}248$ and construction $C+B/2B=624/250$ remain derived; neutral $C/B/A=512/128/1{,}280$ and 129 is only logical $B+1$. Raw reset remains failed and unwaived; 27 structural and nine production-shaped F/S/T ablations remain required. | diff --git a/src/operations/consolidation.cpp b/src/operations/consolidation.cpp index 3abcb615..fe7df8c6 100644 --- a/src/operations/consolidation.cpp +++ b/src/operations/consolidation.cpp @@ -91,8 +91,10 @@ ScoreConsolidation::Execute (OperationContext &context, Transaction &tx) const = "WITH inactive_candidate_ids AS MATERIALIZED (" " SELECT m.memory_id, m.strength AS effective_strength, " " m.created_at, m.embedding_id " - " FROM memories m INDEXED BY idx_memories_ltm_strength_created " + " FROM memories m INDEXED BY " + "idx_memories_ltm_unclustered_strength_created " " WHERE m.kind = 'LONG_TERM' " + " AND m.cluster_id IS NULL " " AND NOT EXISTS(" " SELECT 1 FROM rif_active_state a " " WHERE a.memory_id = m.memory_id" @@ -111,7 +113,8 @@ ScoreConsolidation::Execute (OperationContext &context, Transaction &tx) const " FROM rif_active_state a " " JOIN memories m ON m.memory_id = a.memory_id " " CROSS JOIN rif_recovery_clock c " - " WHERE m.kind = 'LONG_TERM' AND c.singleton = 1 " + " WHERE m.kind = 'LONG_TERM' AND m.cluster_id IS NULL " + " AND c.singleton = 1 " " ORDER BY effective_strength ASC, m.created_at ASC, " " m.embedding_id ASC " " LIMIT ?8" diff --git a/src/operations/sparse_retrieval_route_sqlite_internal.cpp b/src/operations/sparse_retrieval_route_sqlite_internal.cpp index 205d47ca..9a94546f 100644 --- a/src/operations/sparse_retrieval_route_sqlite_internal.cpp +++ b/src/operations/sparse_retrieval_route_sqlite_internal.cpp @@ -374,6 +374,7 @@ struct Route::Impl mutable std::size_t last_search_node_rows = 0; mutable std::size_t last_activation_snapshot_rows = 0; mutable std::size_t last_activation_snapshot_cache_miss_rows = 0; + mutable std::size_t last_activation_frontier_seed_count = 0; mutable std::size_t last_search_distance_evaluations = 0; mutable int last_search_failure_code = 0; mutable int last_seal_failure_code = 0; @@ -754,6 +755,7 @@ Route::SearchWithEnvelope (const Eigen::VectorXf &query, impl_->last_search_node_rows = 0; impl_->last_activation_snapshot_rows = 0; impl_->last_activation_snapshot_cache_miss_rows = 0; + impl_->last_activation_frontier_seed_count = 0; impl_->last_search_distance_evaluations = 0; const bool use_construction_envelope = impl_->building || construction_search; @@ -998,16 +1000,17 @@ Route::SearchWithEnvelope (const Eigen::VectorXf &query, visited.reserve (search_node_budget + activation_nodes.size ()); auto seed_frontier = [&] (const long long memory_id) { if (memory_id <= 0 || !visited.insert (memory_id).second) - return; + return false; const auto node = cache.find (memory_id); if (node == cache.end ()) - return; + return false; const float distance = persisted_query_distance (memory_id); frontier.emplace (distance, memory_id); if (node->second.row->active && impl_->removed.count (memory_id) == 0 && impl_->delta_embeddings.count (memory_id) == 0) best.emplace (distance, memory_id); + return true; }; seed_frontier (current_id); // Consolidation persists an A-bounded activation snapshot in SQLite. @@ -1015,8 +1018,10 @@ Route::SearchWithEnvelope (const Eigen::VectorXf &query, // changed centroid actually steers the next sparse walk; their rows are // charged to the separate A envelope and never consume the current // 8C-to-9C traversal budget. - for (const long long memory_id : impl_->activation_identity_ids) - seed_frontier (memory_id); + if (!rebuild_activation) + for (const long long memory_id : impl_->activation_identity_ids) + if (seed_frontier (memory_id)) + ++impl_->last_activation_frontier_seed_count; std::size_t expanded_count = 0; while (!frontier.empty () && canonical_node_rows < node_fetch_budget @@ -1464,8 +1469,12 @@ Route::Seal (const sparse_retrieval_route_internal::Route *hnsw_route) node.embedding = delta->second; node.active = true; updates[memory_id] = std::move (node); - if (next_entry_memory_id == 0) - next_entry_memory_id = memory_id; + if (next_entry_memory_id == 0 + || prior->second.level > next_max_level) + { + next_entry_memory_id = memory_id; + next_max_level = prior->second.level; + } continue; } @@ -2091,6 +2100,15 @@ Route::LastActivationSnapshotCacheMissRows () const return impl_->last_activation_snapshot_cache_miss_rows; } +std::size_t +Route::LastActivationFrontierSeedCount () const +{ + if (!impl_) + return 0; + std::lock_guard lock (impl_->mutex); + return impl_->last_activation_frontier_seed_count; +} + std::size_t Route::LastSearchDistanceEvaluations () const { diff --git a/src/operations/sparse_retrieval_route_sqlite_internal.hpp b/src/operations/sparse_retrieval_route_sqlite_internal.hpp index f8ada359..0fe712a5 100644 --- a/src/operations/sparse_retrieval_route_sqlite_internal.hpp +++ b/src/operations/sparse_retrieval_route_sqlite_internal.hpp @@ -316,6 +316,10 @@ class Route /// repeated query may reuse the bounded generation-qualified shadow cache, /// while SQLite remains authoritative across seals and restarts. std::size_t LastActivationSnapshotCacheMissRows () const; + /// Activation-snapshot identities admitted as level-zero frontier seeds by + /// the last query. Recenter rebuilds must report zero because the prior + /// snapshot cannot steer its replacement. + std::size_t LastActivationFrontierSeedCount () const; std::size_t LastSearchDistanceEvaluations () const; std::size_t CachedNodeRows () const; std::size_t CacheOrderRows () const; diff --git a/src/store/schema.cpp b/src/store/schema.cpp index 272cdfce..1a172c54 100644 --- a/src/store/schema.cpp +++ b/src/store/schema.cpp @@ -962,6 +962,16 @@ GetCoreMigrations () "AND kind != 'WORKING'", }, }, + { + 34, + "Index bounded unclustered consolidation candidates", + { + "CREATE INDEX IF NOT EXISTS " + "idx_memories_ltm_unclustered_strength_created " + "ON memories(strength, created_at, embedding_id) " + "WHERE kind = 'LONG_TERM' AND cluster_id IS NULL", + }, + }, }; } diff --git a/tests/migration_core.test.cpp b/tests/migration_core.test.cpp index d4739871..c27b9761 100644 --- a/tests/migration_core.test.cpp +++ b/tests/migration_core.test.cpp @@ -534,6 +534,29 @@ TEST_CASE("Migration 31 persists a knob-bounded activation centroid without " REQUIRE(names.count("source_id") == 0); } +TEST_CASE("Migration 34 indexes only eligible unclustered consolidation rows", + "[schema][migration][consolidation][bounded]") { + auto store = SQLiteStore::Create(":memory:"); + cortext::store::DebugApplyCoreMigrationsThroughForTest(*store, 33); + REQUIRE(store->Execute( + "SELECT name FROM sqlite_master WHERE type = 'index' AND " + "name = 'idx_memories_ltm_unclustered_strength_created'").empty()); + + cortext::store::ApplyMigrations(*store); + + const auto ids = cortext::store::DebugGetAppliedMigrationIdsForTest(*store); + REQUIRE(ids.count(34) == 1); + const auto rows = store->Execute( + "SELECT sql FROM sqlite_master WHERE type = 'index' AND " + "name = 'idx_memories_ltm_unclustered_strength_created'"); + REQUIRE(rows.size() == 1); + const auto sql = std::any_cast(rows.front().at("sql")); + REQUIRE(sql.find("strength, created_at, embedding_id") + != std::string::npos); + REQUIRE(sql.find("kind = 'LONG_TERM' AND cluster_id IS NULL") + != std::string::npos); +} + TEST_CASE("Migrations preserve 64-bit applied migration ids", "[schema][migration]") { auto store = SQLiteStore::Create(":memory:"); @@ -608,6 +631,7 @@ TEST_CASE("Migrations create graph retrieval lookup indexes", "[schema][migratio REQUIRE(has_index("idx_memories_label_created")); REQUIRE(has_index("idx_memories_created_desc")); REQUIRE(has_index("idx_memories_ltm_strength_created")); + REQUIRE(has_index("idx_memories_ltm_unclustered_strength_created")); REQUIRE(has_index("idx_memories_pre_activation_embedding_active")); REQUIRE(has_index("idx_memories_flashbulb_intensity")); REQUIRE_FALSE(has_index("idx_memories_strength")); diff --git a/tests/operations_consolidation.test.cpp b/tests/operations_consolidation.test.cpp index 41ddcd89..9c6e5374 100644 --- a/tests/operations_consolidation.test.cpp +++ b/tests/operations_consolidation.test.cpp @@ -925,6 +925,111 @@ TEST_CASE ("ScoreConsolidation fails closed above its active RIF work ceiling", == static_cast (active_state_limit)); } +TEST_CASE ("ScoreConsolidation filters clustered rows before each bounded " + "candidate frontier", + "[operations][consolidation][bounded][cluster][regression]") +{ + SignalProcessor::Config cfg; + cortext::testing::RequireEncoder (cfg); + cfg.focus = 0.0; + cfg.sensitivity = 0.0; + cfg.stability = 1.0; + const auto candidate_limit = static_cast ( + operations::sparse_retrieval_knobs_internal:: + ActivationIdentityTarget ( + cfg.focus, cfg.sensitivity, cfg.stability)); + + for (const bool active_frontier : { false, true }) + { + DYNAMIC_SECTION ((active_frontier ? "active RIF frontier" + : "inactive frontier")) + { + auto store + = std::shared_ptr (SQLiteStore::Create (":memory:")); + cortext::store::ApplyMigrations (*store); + store->Execute ( + "WITH RECURSIVE sequence(value) AS (" + " SELECT 1 UNION ALL SELECT value + 1 FROM sequence " + " WHERE value < ?" + ") INSERT INTO memories(memory_id, source_id, kind, start_ts, " + "n_signals, modality, strength, stability, redundancy, " + "cluster_id, created_at) " + "SELECT value, 'opaque/clustered', 'LONG_TERM', value, 1, " + "'image', 0.0, 0.0, 0.0, 77, value FROM sequence", + { candidate_limit }); + + const long long weak_id = candidate_limit + 1; + std::vector weak_embedding (256, 0.0f); + weak_embedding[0] = 1.0f; + store->Execute ( + "INSERT INTO embeddings(embedding_id, embedding, created_at) " + "VALUES(?, ?, ?)", + { weak_id, weak_embedding, weak_id }); + store->Execute ( + "INSERT INTO memories(memory_id, embedding_id, source_id, " + "kind, start_ts, n_signals, modality, strength, stability, " + "redundancy, created_at) VALUES(?, ?, 'opaque/unclustered', " + "'LONG_TERM', ?, 1, 'audio', 0.01, 0.0, 0.0, ?)", + { weak_id, weak_id, weak_id, weak_id }); + + if (active_frontier) + store->Execute ( + "INSERT INTO rif_active_state(memory_id, generation, " + "anchor_suppression, recovery_total, anchor_log_factor, " + "expires_log_factor) " + "SELECT memory_id, 1, 0.00000001, " + "CASE WHEN memory_id = ? THEN 0.01000001 " + "ELSE 0.00000001 END, " + "0.0, -20.0 FROM memories", + { weak_id }); + else + { + const auto plan = store->Execute ( + "EXPLAIN QUERY PLAN " + "SELECT m.memory_id FROM memories m INDEXED BY " + "idx_memories_ltm_unclustered_strength_created " + "WHERE m.kind = 'LONG_TERM' " + "AND m.cluster_id IS NULL " + "AND NOT EXISTS(SELECT 1 FROM rif_active_state a " + "WHERE a.memory_id = m.memory_id) " + "ORDER BY m.strength ASC, m.created_at ASC, " + "m.embedding_id ASC LIMIT ?", + { candidate_limit }); + REQUIRE_FALSE (plan.empty ()); + REQUIRE (std::any_of ( + plan.begin (), plan.end (), [] (const auto &row) { + const auto detail = row.find ("detail"); + return detail != row.end () + && std::any_cast (detail->second) + .find ("idx_memories_ltm_unclustered_" + "strength_created") + != std::string::npos; + })); + } + + Signal signal; + signal.timestamp = 57'000ULL; + signal.source_id = "opaque/cluster-prefilter"; + signal.modality = active_frontier ? "audio" : "image"; + signal.force_consolidation = true; + signal.embedding = Eigen::VectorXf::Zero (4); + ProcessorContext p_ctx; + OperationContext ctx (signal, p_ctx, cfg, store.get ()); + auto tx = store->Begin (); + ScoreConsolidation{}.Execute (ctx, *tx); + + const auto &candidates = ctx.GetConsolidationCandidates (); + REQUIRE (candidates.size () == 1); + REQUIRE (candidates.front ().memory_id == weak_id); + REQUIRE (candidates.front ().score + == Catch::Approx (0.01).margin (1e-6)); + REQUIRE (ctx.GetOperationTimings ().at ( + "ScoreConsolidation.candidate_input_count") + == 1.0); + } + } +} + TEST_CASE ("ScoreConsolidation emits its full F S T derived work envelope", "[operations][consolidation][bounded][knobs][ablation]") { diff --git a/tests/operations_graph_retrieval.test.cpp b/tests/operations_graph_retrieval.test.cpp index c295c537..f10a5b1e 100644 --- a/tests/operations_graph_retrieval.test.cpp +++ b/tests/operations_graph_retrieval.test.cpp @@ -382,6 +382,24 @@ TEST_CASE ("SQLite sparse route replaces a removed hierarchy entry", REQUIRE (result); REQUIRE_FALSE (result->empty ()); REQUIRE (result->front () == 2); + + REQUIRE (route->Upsert (1, UnitVec (1))); + REQUIRE (route->StagePendingUpsert (1, UnitVec (1))); + REQUIRE (route->Seal ()); + const auto reactivated = store->Execute ( + "SELECT entry_memory_id, max_level FROM cortext_sparse_route_meta"); + REQUIRE (reactivated.size () == 1); + REQUIRE (store::AnyToLongLong ( + reactivated.front ().at ("entry_memory_id")) + == 1); + REQUIRE (store::AnyToLongLong (reactivated.front ().at ("max_level")) + == 3); + reopened = SQLiteRoute::Open (*store, kEmbeddingDim, parameters); + REQUIRE (reopened); + const auto restored = reopened->Search (UnitVec (1), 3); + REQUIRE (restored); + REQUIRE_FALSE (restored->empty ()); + REQUIRE (restored->front () == 1); } TEST_CASE ("SQLite sparse route invalidates stale links after an active " @@ -853,15 +871,31 @@ TEST_CASE ("Consolidation rebuilds and restarts a knob-bounded SQLite " route = SQLiteRoute::Open (*store, kEmbeddingDim, parameters); REQUIRE (route); REQUIRE (route->ActivationEntryMemoryId () == first_entry); + const auto cold_ordinary = route->Search (observer_query, 16); + REQUIRE (cold_ordinary); + REQUIRE (route->LastActivationSnapshotCacheMissRows () == 0); + REQUIRE (route->LastActivationFrontierSeedCount () > 0); + REQUIRE (route->LastActivationFrontierSeedCount () + < route->ActivationIdentityIds ().size ()); + const std::size_t cold_seed_count + = route->LastActivationFrontierSeedCount (); + route = SQLiteRoute::Open (*store, kEmbeddingDim, parameters); + REQUIRE (route); + REQUIRE (route->Search (observer_query, 16) == cold_ordinary); + REQUIRE (route->LastActivationFrontierSeedCount () == cold_seed_count); REQUIRE (route->SearchActivated (observer_query) == first_activation); REQUIRE (route->LastActivationSnapshotCacheMissRows () > 0); REQUIRE (route->LastActivationSnapshotCacheMissRows () <= parameters.activation_identity_target); REQUIRE (route->SearchActivated (observer_query) == first_activation); REQUIRE (route->LastActivationSnapshotCacheMissRows () == 0); + REQUIRE (route->LastActivationFrontierSeedCount () > 0); + REQUIRE (route->LastActivationFrontierSeedCount () + <= parameters.activation_identity_target); REQUIRE (route->RestartRowsLoaded () == 1); REQUIRE (route->Recenter (UnitVec (1))); + REQUIRE (route->LastActivationFrontierSeedCount () == 0); const long long second_entry = route->ActivationEntryMemoryId (); REQUIRE (second_entry > 700); REQUIRE (second_entry != first_entry); From cca844d758bc9ad7ddd12048932c274da514d8a6 Mon Sep 17 00:00:00 2001 From: gabewillen Date: Tue, 21 Jul 2026 10:12:12 -0500 Subject: [PATCH 15/18] Fix sparse restart and hydration review findings --- .../paper-traceability-audit-v2.json | 6 +- .../paper-traceability-current-state-v2.json | 60 +++-- .../paper-traceability-manifest-v1.json | 143 ++++++------ cmake/PrepareHnswlibForZig.cmake | 14 +- ...trator-goal-mdscript-converted.mdscript.md | 13 +- ...ree-new-p2-final-record-review.mdscript.md | 65 ++++++ docs/paper/_manuscript/index.md | 207 +++++++++++------- docs/paper/sections/10_implementation.qmd | 77 ++++--- docs/paper/sections/11_optimization.qmd | 44 +++- src/cortext.cpp | 89 +++++--- .../active_signal_embedding_ring_internal.hpp | 2 +- src/operations/memory_storage.cpp | 18 +- .../sparse_retrieval_knobs_internal.hpp | 12 + src/signal_processor.cpp | 3 + tests/cortext.test.cpp | 62 ++++++ tests/operations_memory_storage.test.cpp | 45 ++-- tests/signal_processor.test.cpp | 60 +++++ 17 files changed, 640 insertions(+), 280 deletions(-) create mode 100644 comments/consolidation-drift-retrigger/20260721T150300Z-implementer-three-new-p2-final-record-review.mdscript.md diff --git a/artifacts/flat_storage_cost/paper-traceability-audit-v2.json b/artifacts/flat_storage_cost/paper-traceability-audit-v2.json index aee9d8ae..5f6de2c2 100644 --- a/artifacts/flat_storage_cost/paper-traceability-audit-v2.json +++ b/artifacts/flat_storage_cost/paper-traceability-audit-v2.json @@ -1,14 +1,14 @@ { "generated_claim_mismatches": [], "inventory_count": 70, - "manifest_sha256": "739cba8fa3806574b08637040508e8cf944c4672ab4368013d51e2946c6a69fb", - "manuscript_sha256": "821fce2999f765eaa828a1b83ba47ff403fe568fcb2e72ad88c873a10bf4c423", + "manifest_sha256": "367c139ca373cd3f4bccfa782a2c2a0d3acf61a3a4b0d5f41c1f5035b8d7927d", + "manuscript_sha256": "a13d1df5bbefe8560bcea0d14168847683cd56d2e15b43c5cf9a000e35d3e235", "missing_source_claims": [], "ownership_violations": [], "passed": true, "proof_level_violations": [], "record_count": 70, "schema": "cortext_paper_traceability_audit_v1", - "state_sha256": "25935efc387257d14f3dcf7f5397e7967bb4ab3139b084521522cc1898255ead", + "state_sha256": "850b81160180a0fde2d16c6eca83669a0ff89e42617741c53777f3dec49444bb", "uncovered_inventory": [] } diff --git a/artifacts/flat_storage_cost/paper-traceability-current-state-v2.json b/artifacts/flat_storage_cost/paper-traceability-current-state-v2.json index f135e8ee..b1c60595 100644 --- a/artifacts/flat_storage_cost/paper-traceability-current-state-v2.json +++ b/artifacts/flat_storage_cost/paper-traceability-current-state-v2.json @@ -117,18 +117,19 @@ ] }, "pr6_exact_head_ci_repair": { - "decision": "eleven-review-thread-repair-with-follow-up-p2-proof-active", + "decision": "fourteen-review-thread-repair-active", "prior_exact_head": "764e4af202a91120dae85e1d6b0d69e2ce97aa5d", "implementation_repair_commit": "89a06084dd05710f90572c1b7bac7e17fab79122", + "followup_repair_commit": "25cf7b130e87837d0ed813b0e0ffda5a50701651", "monitor_head_binding": "resolve the live GitHub PR head at every re-entry because a repository record cannot content-address its own containing record-only commit", - "current_exact_head_ci": "Windows zig-cli-install failed because Git received a backslash-separated --directory path for the build-local HNSW patch; all other check conclusions must be resolved live from GitHub at every re-entry", + "current_exact_head_ci": "Windows zig-cli-install on follow-up head 25cf7b13 still rejected the build-local HNSW patch through git apply --directory after slash normalization; the active candidate runs git apply from inside the build-local output and all other check conclusions must be resolved live from GitHub at every re-entry", "windows_zig_path_repair": { "failing_job": "zig-cli-install (windows-latest, cortext_cli.exe)", - "failing_head": "89a06084dd05710f90572c1b7bac7e17fab79122", - "cause": "CMake file(RELATIVE_PATH) returned Windows separators but git apply --directory consumes Git forward-slash paths", - "repair": "normalize only the build-local output relative path from backslash to forward slash before both checked and applied git apply calls", - "local_proof": "native Zig ReleaseFast static CLI build passes and the emitted build-local hnswlib copy passes complete reverse patch verification", - "review": "Windows path normalization passed recursive round-three P1 review; the four follow-up P2 repairs await fresh cumulative review", + "failing_head": "25cf7b130e87837d0ed813b0e0ffda5a50701651", + "cause": "normalizing the relative --directory path was insufficient on the Windows Zig/Git/CMake runtime; git apply still rejected the copied pinned source before compilation", + "repair": "run both git apply content check and application with the build-local output as the working directory, passing no host-native output path through Git path parsing", + "local_proof": "Zig text-only passes 12/12 and a space-bearing build-local output passes patch application plus complete reverse verification", + "review": "fresh round-one all-findings and separately fresh final cumulative P1 reviews are Proven with no P1 finding; the repair is retained inside the current three-thread candidate", "proof_not_claimed": "Windows validation remains owned by replacement exact-head CI" }, "review": { @@ -145,6 +146,14 @@ "repairs": "migration 34 adds an eligible-only partial index selected by the inactive frontier; adversarial query-plan proof verifies that index; the seed counter counts actual frontier insertions; the paper states only that prior snapshot identities are not explicit seeds", "next_gate": "fresh round-two P1/P2 review" }, + "three_thread_review": { + "candidate_tree": "8853b49239f04c846d01a4743bbf7e883cfd2a8d", + "round_one_verdict": "Proven at the fresh all-findings threshold with no P1, P2, or P3 finding", + "final_cumulative_verdict": "Proven at the separately fresh P1 threshold with no P1 finding", + "review_boundary": "an old smaller exact-signal ring can temporarily restore fewer than Q vectors after a knob increase, but missing vectors are never replaced by aggregate memory centroids", + "record_review": "the exactly-one fresh non-code review found one P2 executable-handoff defect; it is directly corrected without rereview and all other record surfaces were verified clean", + "next_gate": "final validation, non-force push, proof-backed thread replies and resolution, and replacement exact-head CI" + }, "review_threads": [ "https://github.com/augmem/cortext/pull/6#discussion_r3620394273", "https://github.com/augmem/cortext/pull/6#discussion_r3620394282", @@ -156,7 +165,10 @@ "PRRT_kwDOR3IQMM6SjHep", "PRRT_kwDOR3IQMM6SjHes", "PRRT_kwDOR3IQMM6SjHev", - "PRRT_kwDOR3IQMM6SjHe1" + "PRRT_kwDOR3IQMM6SjHe1", + "PRRT_kwDOR3IQMM6SlrZb", + "PRRT_kwDOR3IQMM6SlrZd", + "PRRT_kwDOR3IQMM6SlrZg" ], "repairs": [ "calibrate migrated lazy-RIF state transactionally before working-memory hydration and rebuild the disposable epoch from committed persistent authority", @@ -173,13 +185,16 @@ "promote a same-vector reactivated row-addressed node when its persisted level exceeds the current canonical entry", "exclude the prior activation snapshot from frontier seeding while rebuilding its consolidation-centroid replacement", "filter clustered memories before both inactive and active bounded consolidation candidate limits, using an eligible-only partial index so the inactive arm cannot scan a clustered history prefix", - "include the CMake HNSW preparation and patch assets in the Zig package allowlist" + "include the CMake HNSW preparation and patch assets in the Zig package allowlist", + "size the exact active-signal embedding ring as max(B, NCtx+KCtx), covering all 27 low/mid/high F/S/T points and the full restart context window", + "apply the B fallback hydration limit after modality, MIME, and payload-shape acceptance by walking newest-first keyset pages, preserving chronological output while explicitly giving up a bounded scan claim for malformed legacy history", + "treat sparse supersession activation as candidates rather than an exact coverage certificate, retaining exact historical proof or SQLite fallback even though this can restore history-sized write work" ], "source_sha256": { - "signal_processor": "7d255a3db0b4e9f0dcedac9fa841d093b1ad39af3c90af43969a17aba481e07b", + "signal_processor": "0fb2b4d064531bbbfd86c270072e4f60b454b8db7059d9274603e3de7c784306", "rif_cache_header": "55985ae0d5d0d69480ae3a3d8204779faec8b23f2051e2e924b8de31e1d130a8", "hnswlib_patch": "4180985795ccdac233cf7c50e82ec0bb2108fd191aece8951f8cedc12932d54a", - "hnswlib_patch_driver": "3506b957d155d0994cd975d12d93e3bdb60f0d205b13dc496b474aeb73e8662a", + "hnswlib_patch_driver": "206cb0646480afa8237758a83d47a7778e56e1eed011474f714a73cb0f0e984b", "zig_build": "f4a36709d3eeab3be92bd5300e7d071621290189b24d13fdc4976e6c04d9d8ce", "zig_hnswlib_prepare": "f2ea37b7bfaca95edcb3b6486120b0d0c6c33060b32d96a40f46fafdd53e2773", "zig_package_manifest": "25f58d123ab581319b140bed7e4355a7bd524e1e17dce96a219ccea68ec74c9a", @@ -193,18 +208,26 @@ "emotion_cascade_test": "47b0d780994832bbd36f06fcba4abee9d2935ad0267b4c9bd9e7cb6659df5afe", "schema_source": "b4c3b0c873fd225781d1eab856a82b3fc2868909f131f867031c71c792f9fbe3", "migration_test": "4e76c44cc7ec9d5a1ec26fb963c1291c7f98e47b65050bac8ff4ff0df09b64cc" + ,"active_signal_embedding_ring": "9d0e575cecad9159b15b02c0e75c3349ba5931e83c9acadeabc5aee2868e498d" + ,"sparse_retrieval_knobs": "d99e020e322c5d28dc1dacbd72c6a650f0eaa4f3561758c379cc62b1d58793ef" + ,"cortext_hydration": "0ba377e833452cd13520d34c1bf57eaf3a8df5da3607780845a0e6931aa291eb" + ,"memory_storage": "2c662b5bdbe22dba92a39335ea5959cf22f38dcaa0cc78e19f19a3aa352f182f" + ,"memory_storage_test": "7f8eade4e9b0124551296f6cad3d0a183db07785749fc38dd082665261b154f7" + ,"cortext_test": "52d2e143f793a3446616bd5d22a4798dddd609b56d9504ac2a9ea2d317e442dd" + ,"signal_processor_test": "af1b6a1dbffed60755b5488e37b9450a1b3b6a48892587a1f9ef02694746dfbd" }, "local_proof": { "preceding_full_media_ctest": "preceding exact candidate: clean Debug LLVM 21 media-enabled suite with experiment hooks enabled: 38,730 assertions in 697 cases", "preceding_full_media_test_binary_sha256": "0fd25b6e322913cb0e76e3aa5a1fbcc6836d8696b6bbd5886224a3144fea1ec8", - "current_full_media_ctest": "exact repaired candidate: clean Debug LLVM 21 media-enabled suite with experiment hooks enabled: 38,766 assertions in 699 cases", - "current_full_media_test_binary_sha256": "2ad4b947a5728fa767680a7cb399ebe969661b0a47e2ca5f269434ca34d0f02c", + "current_full_media_ctest": "exact three-thread repaired candidate: clean Debug LLVM 21 media-enabled suite with experiment hooks enabled: 39,081 assertions in 701 cases", + "current_full_media_test_binary_sha256": "53191a9bf94bcbf19537a66acba4b41ef8e4d349f10c37a878d84df79adc2bc1", "rif_focus": "312 assertions in 19 cases", "hnsw_focus": "the exact canonical-entry reactivation, missing-snapshot ordinary-search restart, and prior-snapshot-free recenter rebuild regressions pass in the four-case 107-assertion follow-up set", "consolidation_focus": "the four-case follow-up set passes 107 assertions, including both clustered-row prefilter arms, the eligible-only inactive query plan, and migration 34 structure", - "zig_build_local_patch": "ReleaseFast static CLI build passed after Git-path normalization; global hnswlib cache remained unpatched while the declared build-local copy passed complete reverse patch verification; the patch file is an explicit build input", + "zig_build_local_patch": "Zig text-only passes 12/12 after removing the host-path argument; a space-bearing build-local output passes patch application and complete reverse verification; the global hnswlib cache remains unpatched and the patch file is an explicit build input", + "new_review_thread_focus": "27-point active-signal ring proof passes 225 assertions; a neutral exact restart passes 154 assertions; adversarial fallback hydration passes 5 assertions; sparse supersession exact-coverage regression passes 15 assertions; broader MemoryStorage passes 451 assertions in 20 cases and hydration passes 173 assertions in 13 cases", "wasm_bundle": "built successfully with Emscripten 4.0.18", - "focused_test_binary_sha256": "2ad4b947a5728fa767680a7cb399ebe969661b0a47e2ca5f269434ca34d0f02c", + "focused_test_binary_sha256": "53191a9bf94bcbf19537a66acba4b41ef8e4d349f10c37a878d84df79adc2bc1", "wasm_sha256": "17d31e0a61327e91d7a53577b73689442583d5f4c84aa76d5844ac309e9791aa" }, "sanitizer_proof": { @@ -219,8 +242,11 @@ "modality_branch": false }, "unresolved_limits": [ - "Windows execution and replacement exact-head CI for the Zig Git-path repair remain pending", - "push and replacement exact-head CI for the four follow-up P2 repairs remain pending; round-three and final cumulative reviews are Proven at P1", + "Windows execution and replacement exact-head CI for the Zig working-directory repair remain pending", + "the three newest P2 thread repairs have full applicable proof and completed recursive review; final record review, push, proof-backed replies, resolution, and replacement exact-head CI remain pending", + "an old smaller exact-signal ring can temporarily restore fewer than Q exact vectors after a knob increase until new writes refill it; aggregate memory centroids are not substituted", + "fallback hydration output remains capped at B, but malformed or nonmatching legacy history can require more than B candidate rows to be inspected", + "exact supersession verification can remain history-sized after bounded sparse current-candidate selection, so flat write cost is not claimed", "whole-engine raw process reset is not proven", "bounded whole-engine restart is not proven", "Durable plateau and production-wide boundedness are not claimed" diff --git a/artifacts/flat_storage_cost/paper-traceability-manifest-v1.json b/artifacts/flat_storage_cost/paper-traceability-manifest-v1.json index ba1e7957..a8cc80bc 100644 --- a/artifacts/flat_storage_cost/paper-traceability-manifest-v1.json +++ b/artifacts/flat_storage_cost/paper-traceability-manifest-v1.json @@ -284,7 +284,7 @@ "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", "decision": "failed-end-anchored-plateau-reranked-to-next-independent-exact-candidate", "evidence_fingerprints": [ - "9b091c86c6ecfc37241a26465f06c427ecbbf9866036d90285072fae31c1e54f" + "87cc1ab1e16faa29c17a233953194dfdc3e65af4c5ca080fa26321a5985aebbf" ], "evidence_kind": "measured", "inventory_id": "state:accepted_tree_natural_plateau_rerank", @@ -301,7 +301,7 @@ "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", "decision": "recorded-measurement", "evidence_fingerprints": [ - "a090d13389c441447b71c4633f705e85e8f07e834b76d5b6887a6a644402acb7" + "5a4b22ef75b2c249250c6049762db517a7b8435f50295cad83e94dac4dd65046" ], "evidence_kind": "measured", "inventory_id": "state:active_epoch_sqlite_evaluation", @@ -311,14 +311,14 @@ "path": "docs/paper/sections/11_optimization.qmd" }, "unresolved_limits": [ - "production cutover is not proven" + "the paper claim is limited to the recorded proof scope" ] }, { "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", "decision": "reject-anchor-only-candidate-set-retain-anchors-only-as-bounded-sparse-graph-restart-entry", "evidence_fingerprints": [ - "5db8b893b7b26688ccb67e820f1a40485b8420c7f3d9b91d69d27448579794a7" + "f252fa933d0bd3fd1692d232e5685062b7c97b74ec4934bd9ca865f87fdd9096" ], "evidence_kind": "measured", "inventory_id": "state:anchor_only_route_feasibility", @@ -328,14 +328,14 @@ "path": "docs/paper/sections/11_optimization.qmd" }, "unresolved_limits": [ - "production cutover is not proven" + "the paper claim is limited to the recorded proof scope" ] }, { "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", "decision": "recorded-measurement", "evidence_fingerprints": [ - "c4f44d388da1b64b70384618ef5d09b4b3d256613e825abe394f3f249d2b6c4c" + "3ed6fb6e4e06b1382b9f1d70d500992e6374fc66949b0eb534da34cdc5c65f87" ], "evidence_kind": "measured", "inventory_id": "state:baseline_results", @@ -352,7 +352,7 @@ "corpus_parameter_scope": "34,456 normalized 256-dimensional embeddings; 512 deterministic top-16 queries; four opaque sources; text, audio, and image post-encoding labels; two graphs; 16,384 construction and 1,280 retrieval comparisons per graph; 64 reciprocal proposals", "decision": "design-direction-approved-production-proof-pending", "evidence_fingerprints": [ - "d80d794e27b6979b354692bd7a530e4eff6baf61d9023e85ac37ff8940c0364c" + "09d706ac310d63937db9e98a98a96ca55e794da699acb2870185cdc083cba71e" ], "evidence_kind": "modeled", "inventory_id": "state:bounded_route_hybrid_observation", @@ -362,14 +362,14 @@ "path": "docs/paper/sections/11_optimization.qmd" }, "unresolved_limits": [ - "production cutover is not proven" + "the paper claim is limited to the recorded proof scope" ] }, { "corpus_parameter_scope": "35,496 normalized 256-dimensional embeddings; 512 age-stratified top-16 queries; F=S=T=0.5; observation-only private switch", "decision": "complete-promising-shadow-candidate-not-ready-for-cutover", "evidence_fingerprints": [ - "fa4230d33022df68ed23c43b290a489d0c55bb086b0ce08c1955da7c33eca152" + "acc2412aa992fa9f10eed8b062edebad34d9fa1cf2c7a9ac8a025e10f5af9fe3" ], "evidence_kind": "observation-only", "inventory_id": "state:bounded_sparse_routing_observation", @@ -379,14 +379,14 @@ "path": "docs/paper/sections/11_optimization.qmd" }, "unresolved_limits": [ - "production cutover is not proven" + "the paper claim is limited to the recorded proof scope" ] }, { "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", "decision": "rejected-fresh-process-and-rif-regression", "evidence_fingerprints": [ - "6caf42f13c23367491ddf85f40eb5db175a58bf55000b9291a3e64ee93edb637" + "61976ff3fdfb96c59b39b234c487eb1a77092fea917198f323433b8017317fbc" ], "evidence_kind": "measured", "inventory_id": "state:competition_rif_returning_candidate", @@ -403,7 +403,7 @@ "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", "decision": "rejected-fresh-process-wall-and-rif-hard-gate", "evidence_fingerprints": [ - "12723ea9a4a77d7b4ba45313b2be47b48be68bf9b659282eb0ce3a8817b3bb2e" + "90a8cbf89c79b127b742ccb6ab60c14d623ccf8a4c7f99c5eb1609ae64ed02bf" ], "evidence_kind": "measured", "inventory_id": "state:competition_suppression_state_cache_candidate", @@ -420,7 +420,7 @@ "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", "decision": "retained-hotspot-improved-plateau-still-failed-reranked", "evidence_fingerprints": [ - "bfcebb61906d51cf52925e1a008bed02859685b1093a9eaa62fc49d3a46a3ef5" + "b0e0d57e19cede6145b499b8993b792384d5f32a4f61ebf26adbfdb0565e464b" ], "evidence_kind": "measured", "inventory_id": "state:emotional_cascade_fixed_point_full_natural", @@ -437,7 +437,7 @@ "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", "decision": "retained-local-gates-passed-full-natural-verification-next", "evidence_fingerprints": [ - "cfc22af065c3660f609c10dfb10a31a7a4d93e6ef0d43381d845500db53bfa5e" + "4be1087a4355ed77b7a5f1fe309d9506b5bf8ef1975269e9530c02bada607c09" ], "evidence_kind": "measured", "inventory_id": "state:emotional_cascade_fixed_point_repair", @@ -454,7 +454,7 @@ "corpus_parameter_scope": "rejected knob-derived priority-prefix candidate; 27 F/S/T structural points; exact B and logical B+1 shared-member seams; 15,695-packet fixed-time Natural midpoint against a same-binary control and identical 118-event consolidation schedule; 512 public top-16 queries over four opaque sources; nine-point production matrix intentionally not run after midpoint fail-fast", "decision": "reject-before-nine-point-ablation-for-p99-and-public-retrieval-quality", "evidence_fingerprints": [ - "b8e4c4dc7243a094fad16ec82418ff7d3ab0fe022b3b2ed4901747c00225f3ab" + "65483a65f6d9d4c587486fb091d0e513eb05985b3a1275894caf47e13cb44523" ], "evidence_kind": "measured", "inventory_id": "state:emotional_cascade_fixed_work_candidate", @@ -474,7 +474,7 @@ "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", "decision": "retained-full-natural-improvement-flatness-failed-reranked", "evidence_fingerprints": [ - "c437d2be35f93e92524f0108695cc90d09ed11c6ef422bb12a60cdfa75e4ffae" + "26c10425cd3ac3c63c08d1ab546b8614a80bdd2129bf7378a7c336df285c724b" ], "evidence_kind": "measured", "inventory_id": "state:emotional_metadata_cache_repair", @@ -491,7 +491,7 @@ "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", "decision": "reject-all-five-single-hierarchy-bounded-link-repairs", "evidence_fingerprints": [ - "ecaa356bb3c43b5af6db667804652f864113fdfe9f9432768923ad6fccd8c726" + "b09b6788a47a7f3adba9766f9e31e1282031cc212c35b6efd7fdc127deca1277" ], "evidence_kind": "measured", "inventory_id": "state:fixed5c_moved_centroid_reachability", @@ -501,14 +501,14 @@ "path": "docs/paper/sections/11_optimization.qmd" }, "unresolved_limits": [ - "production cutover is not proven" + "the paper claim is limited to the recorded proof scope" ] }, { "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", "decision": "recorded-measurement", "evidence_fingerprints": [ - "e180d8cf1c390e364d00164d795b1dd4151a8fd18e70e9ab1e463cacdaebad8b" + "0e531753880ffdc2c64df2c0a178341a555588f8131940f52c4b5e96efbe7c80" ], "evidence_kind": "measured", "inventory_id": "state:graph_eligibility_db_proof", @@ -525,7 +525,7 @@ "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", "decision": "retained-local-improvement-full-natural-flatness-gate-failed", "evidence_fingerprints": [ - "65305ad83c3ff1cc3ef273f8ee48c80eef178d405ad96520df57a98f62d4526c" + "47bb7dec0b5f4d686a917534e02963ad608c2d17655f4e1a845a5ddc701b38b1" ], "evidence_kind": "measured", "inventory_id": "state:graph_eligibility_repair", @@ -542,7 +542,7 @@ "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", "decision": "rejected-fresh-and-late-total-process-wall-regression", "evidence_fingerprints": [ - "79861dbdce7c0ced9e148ceddaa784c7c329dc044c4d3b5b02847de4294d2b59" + "69d89bf7ca9353c9e00199dc0cde1002bae5de66a34036b6e885986843f4d87c" ], "evidence_kind": "measured", "inventory_id": "state:graph_family_precomputed_features_candidate", @@ -559,7 +559,7 @@ "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", "decision": "rejected-late-process-graph-and-comparison-regression", "evidence_fingerprints": [ - "e8f2e5e6c8dd1e8de539404e7b531b186e79a4878eebb54692472b23a1594b56" + "f097813259dbf7e6ff29619d0c2f04101617c21ab56d6b7fd3ef91ea9cacc434" ], "evidence_kind": "measured", "inventory_id": "state:graph_family_projection_bound_candidate", @@ -576,7 +576,7 @@ "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", "decision": "rejected-fresh-process-and-graph-regression", "evidence_fingerprints": [ - "683631b85f811294446d98f2e66ec93151c593897d7707f4bff10fa7431a97a0" + "6bf28d18c6d21c43e5a7c61eb842530c905c941f634f9633bafdcd10e87db283" ], "evidence_kind": "measured", "inventory_id": "state:graph_family_vector_bound_candidate", @@ -593,7 +593,7 @@ "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", "decision": "retained-local-improvement-full-natural-flatness-gate-failed", "evidence_fingerprints": [ - "54f9c5e9235181e534d48fc68a3828f691ba62015c722bdde8db5f6852750d7f" + "c6e3b8b69411677357b05cde5bb632d470a010d8f088ba86bd7ae8d094ef9590" ], "evidence_kind": "measured", "inventory_id": "state:graph_partial_distance_evaluation", @@ -610,7 +610,7 @@ "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", "decision": "retained-local-gates-passed-family-compare-next", "evidence_fingerprints": [ - "0c28a16305eaf9a2af815274e767863ee883f097e85d9635f17135b704452582" + "67c426e40a2574fbc16bb8a1de30a9b5dc738add89f18b340f63b69f8d0bb9bc" ], "evidence_kind": "measured", "inventory_id": "state:graph_supersession_eligibility_repair", @@ -627,7 +627,7 @@ "corpus_parameter_scope": "rejected private fixed-6C envelope; 27 structural F/S/T points and 931 assertions; one additional 15,695-packet Natural production-default pre-screen at F=0.45, S=T=0.5 with 512 public top-16 queries; exact nine-point corpus matrix not started after fail-fast rejection", "decision": "rejected-after-production-default-prescreen-hard-gates", "evidence_fingerprints": [ - "4bcece2ce0d609b506e13ce283c069bcb4d5881e67ddb11b8a18a6ef59a69049" + "4052b3da40076bd1ee8247d8342ec7c5509e2c8ea2dc2bb2095cac31be2420ba" ], "evidence_kind": "measured", "inventory_id": "state:hnsw_fixed_6c_experiment", @@ -640,15 +640,14 @@ "the additional production-default pre-screen failed the hard gates", "zero of nine exact corpus-matrix points were run after fail-fast rejection", "the production fixed-5C default was not changed", - "whole-engine boundedness and production cutover are not proven", - "production cutover is not proven" + "whole-engine boundedness and production cutover are not proven" ] }, { "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", "decision": "retain-incremental-consolidation-seal-within-current-latency-tradeoff-do-not-cut-over-before-bounded-restart-and-full-horizon-close", "evidence_fingerprints": [ - "f18054ed033325c0aea69e2bc189ebaf7c9f783c05dddb77cd2058d8fe282976" + "bebafa75b6b3df78b1447d924b19e798c52cd957552e2af88a82f3e283ac4477" ], "evidence_kind": "measured", "inventory_id": "state:integrated_hnsw_consolidation_seal_experiment", @@ -658,14 +657,14 @@ "path": "docs/paper/sections/11_optimization.qmd" }, "unresolved_limits": [ - "production cutover is not proven" + "the paper claim is limited to the recorded proof scope" ] }, { "corpus_parameter_scope": "2,500 deterministic Natural packets; four opaque source ids; text, audio, and image post-encoding labels; 128 public top-16 queries; two HNSW graphs; 512-candidate sealed-plus-delta route", "decision": "retain-sealed-two-hnsw-plus-exact-delta-reseal-at-512-reject-live-update-and-every-consolidation-rebuild", "evidence_fingerprints": [ - "eceaf32b550a4d511981379db3f7656bab55b44cd4400b2f7b3feded9be10aea" + "6035330ee4f44bb8b01214c8d1c72b1aa3e1ac77c1ce9fca593a2b3f7a523d45" ], "evidence_kind": "measured", "inventory_id": "state:integrated_hnsw_sparse_route_experiment", @@ -675,14 +674,14 @@ "path": "docs/paper/sections/11_optimization.qmd" }, "unresolved_limits": [ - "production cutover is not proven" + "the paper claim is limited to the recorded proof scope" ] }, { "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", "decision": "retain-live-two-graph-route-for-cross-modality-restart-cycle-latency-and-engine-integration-proof", "evidence_fingerprints": [ - "197c570cb0209b0b7d63935e1a4a6ebea2f2ca65003a6581a6f079acf82b6d7c" + "3db2a5a9bccb7c363bf7d3583a96e33f7fc4276cdca57cd2b5f9eb7ca8b7697c" ], "evidence_kind": "measured", "inventory_id": "state:live_surface_mutation_capture_experiment", @@ -692,14 +691,14 @@ "path": "docs/paper/sections/11_optimization.qmd" }, "unresolved_limits": [ - "production cutover is not proven" + "the paper claim is limited to the recorded proof scope" ] }, { "corpus_parameter_scope": "34,456 normalized 256-dimensional embeddings; four SQLite blobs; 1,024 anchors; 512 deterministic top-16 route queries; separate 1,024-embedding fresh-prefix restart", "decision": "retain-row-addressed-query-seam-reject-whole-snapshot-rewrite", "evidence_fingerprints": [ - "828851ddb716b6d27a28089951550dbf2d0e51e9d7061fc5f6c62fcc620509f3" + "f4da4dfe29d1af557f3774d9ce2335ef8b4474668508923d7a5e1f9dfdbe598b" ], "evidence_kind": "benchmark-only", "inventory_id": "state:packed_route_sqlite_representation_experiment", @@ -709,14 +708,14 @@ "path": "docs/paper/sections/11_optimization.qmd" }, "unresolved_limits": [ - "production cutover is not proven" + "the paper claim is limited to the recorded proof scope" ] }, { "corpus_parameter_scope": "100- and 200-event Natural and Durable instrumentation smoke profiles", "decision": "complete", "evidence_fingerprints": [ - "b0f4f9f49236829c7d8dc831675cabe82e04428afccfef8f72983818211c39f6" + "78c3dfa21ef557ec13ea96696c4b7060bbc028a75cdfdb00ccbf8ac3f1a374a7" ], "evidence_kind": "measured", "inventory_id": "state:plateau_profiler_smoke_proof", @@ -733,7 +732,7 @@ "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", "decision": "select-SignalProcessor.publish_rif_active_epoch", "evidence_fingerprints": [ - "35e402a8536dbbea2e5e94991807623901fba097b9cea233da5ea78c319f4f80" + "44a024ab227f474ac17ea8a938ca8fd0e6295c6da729b25a4162f5cea8d7f732" ], "evidence_kind": "measured", "inventory_id": "state:post_emotional_priority_rejection_rerank", @@ -743,14 +742,14 @@ "path": "docs/paper/sections/11_optimization.qmd" }, "unresolved_limits": [ - "production cutover is not proven" + "the paper claim is limited to the recorded proof scope" ] }, { "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", "decision": "select-shared-sqlite-activation-query-distance-materialization", "evidence_fingerprints": [ - "6af1c9dfe8a1550fcaff4e574fec14d0ac74b23a2929206b71c9eb5581309ff6" + "3af8e93d86ec5cbb9a426e41839862e9da1c2d8ae4527d9d0aa81806baeaaa21" ], "evidence_kind": "measured", "inventory_id": "state:post_hnsw_cost_attribution", @@ -760,14 +759,14 @@ "path": "docs/paper/sections/11_optimization.qmd" }, "unresolved_limits": [ - "production cutover is not proven" + "the paper claim is limited to the recorded proof scope" ] }, { "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", "decision": "retain-query-local-persisted-distance-reuse", "evidence_fingerprints": [ - "9ef6ad6179fc870657b2bd043ff2000743263255ed90e1320e0152e2f625c61f" + "87228cd423346649c0d37434948d75bc7d2df44b62bb4d4d59f878c1409deb4b" ], "evidence_kind": "measured", "inventory_id": "state:post_hnsw_query_distance_reuse", @@ -777,14 +776,14 @@ "path": "docs/paper/sections/11_optimization.qmd" }, "unresolved_limits": [ - "production cutover is not proven" + "the paper claim is limited to the recorded proof scope" ] }, { "corpus_parameter_scope": "paired fresh and copied-late 200-event Natural and Durable windows", "decision": "recorded-measurement", "evidence_fingerprints": [ - "331c3e8a352a974bd3c5247cb28ca2ab2b17681c79e5fc4e8dc8537f0004e73c" + "e29d5d1001669f806d52fac5740a442ac8a35c32c122af349da3402962875a40" ], "evidence_kind": "measured", "inventory_id": "state:post_shadow_rerank", @@ -799,9 +798,9 @@ }, { "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", - "decision": "eleven-review-thread-repair-with-follow-up-p2-proof-active", + "decision": "fourteen-review-thread-repair-active", "evidence_fingerprints": [ - "fbba1d0e888bb0cfcb17ea27b39752979c8fcb164afc452b16e5b11331cce753" + "728f7517ec8ffc0ee8aed0308b604c64c2d385190a88fb99c48da0dafb658b05" ], "evidence_kind": "measured", "inventory_id": "state:pr6_exact_head_ci_repair", @@ -818,7 +817,7 @@ "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", "decision": "retain-feasibility-only-require-live-surface-mutation-capture-before-candidate-decision", "evidence_fingerprints": [ - "47fa93e666957958f4cec485b4a6afb8fd92f0a1ea28c936dfea9e1f3592f588" + "d8d4bfe9f05361fec123da264bae3c6606204d60abe57d30ffeeebb1b0a01304" ], "evidence_kind": "measured", "inventory_id": "state:public_hnsw_route_prototype_experiment", @@ -828,14 +827,14 @@ "path": "docs/paper/sections/11_optimization.qmd" }, "unresolved_limits": [ - "production cutover is not proven" + "the paper claim is limited to the recorded proof scope" ] }, { "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", "decision": "retain-real-GraphRetrieve-control-capture-live-surface-candidate-proof-recorded-separately", "evidence_fingerprints": [ - "79e04b1b383acef5611d76d6128a17f0ed8283ca7317f1728b7309bba431d027" + "0ddecf898960dafebcd6e485746a359d4d4eac97e985be45ec988121a410db2b" ], "evidence_kind": "measured", "inventory_id": "state:public_retrieval_control_capture_experiment", @@ -845,14 +844,14 @@ "path": "docs/paper/sections/11_optimization.qmd" }, "unresolved_limits": [ - "production cutover is not proven" + "the paper claim is limited to the recorded proof scope" ] }, { "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", "decision": "reject-current-recenter-as-retrieval-centroid-reset", "evidence_fingerprints": [ - "29a6a51e91f6e663f59cbacf675465b4c01b0376a0df49657b5f012fa2adcb65" + "f88a49e290801f5cd4c269d1a477e29d35fdaa7bcea52ca7efb4981a710f4031" ], "evidence_kind": "measured", "inventory_id": "state:recenter_activation_overlap_natural_13000_v2", @@ -869,7 +868,7 @@ "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", "decision": "recorded-measurement", "evidence_fingerprints": [ - "f6e20cca3c59ff1f1144496e5e3ca747df4bd31fe0026301845f6a043cad8487" + "52912431e4c3323b6b98030f13356da3afa4741c43a210397bbb465cfc48667f" ], "evidence_kind": "measured", "inventory_id": "state:repair_results", @@ -886,7 +885,7 @@ "corpus_parameter_scope": "correction from 34,456 complete embedding ids to 3,172 current long-term memory identities; 512 top-16 queries; ten 128-memory-node incremental feasibility epochs; 25/50/100-percent restart probes", "decision": "retain-router-feasibility-require-exact-public-control-rerun", "evidence_fingerprints": [ - "e5c2c164b8e3a329ec89d05169cf550233e57d48ad7ab858ed596f8a94d31ea8" + "c775d4a1bf098049d83f7211e87c8381da2121a0e2fbdf409ca107b3ca3a3c9c" ], "evidence_kind": "measured", "inventory_id": "state:retrieval_quality_control_correction", @@ -896,14 +895,14 @@ "path": "docs/paper/sections/11_optimization.qmd" }, "unresolved_limits": [ - "production cutover is not proven" + "the paper claim is limited to the recorded proof scope" ] }, { "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", "decision": "retain-for-source-health-and-continue-full-horizon-verification", "evidence_fingerprints": [ - "ba8d896958f51050d2ca578c4aa354af9370bb33f4746b2f705e6fb086baa6e1" + "be9c897fac8c4f2bad02c5d2d7ed06e4874724dea0a9ff8fd6a638d331235a69" ], "evidence_kind": "measured", "inventory_id": "state:rif_active_identity_ledger", @@ -913,14 +912,14 @@ "path": "docs/paper/sections/11_optimization.qmd" }, "unresolved_limits": [ - "production cutover is not proven" + "the paper claim is limited to the recorded proof scope" ] }, { "corpus_parameter_scope": "15,695-packet Natural replay at F=0.45, S=T=0.5; 27 structural F/S/T points; nine production-shaped reset points; B=round(64+64F+32S+32T), with neutral B=128 and 129 used only as the logical B+1 population boundary; text/audio/image labels and two opaque source ids", "decision": "local-hotspot-flat-full-natural-overall-gates-failed", "evidence_fingerprints": [ - "6d2ab8e49b315093b8ce0023dae6e07b8b159ed707a89c1e9b40ff30c339d26b" + "ea7982f576f1c163f7cb7dba2e67bceb2e1446fec1947d72a44157f5ece355db" ], "evidence_kind": "measured", "inventory_id": "state:rif_epoch_consolidation_reset_candidate", @@ -940,7 +939,7 @@ "corpus_parameter_scope": "200-event fresh and 34,256-row copied-late SQLite seals; 3,544 reciprocal route-row updates; 1,024 anchors; 512 fixed-route queries", "decision": "retain-row-addressed-snapshot-for-production-shaped-engine-evaluation", "evidence_fingerprints": [ - "49561d775e1c06ba04fcf28c2f237d14c2a2d38c21beb3d446247bc9b7f015d5" + "5039a6e6eae680cd1d93bcf6007cb79342f8cf6a30c6aef52affe69f25d68fad" ], "evidence_kind": "benchmark-only", "inventory_id": "state:row_addressed_route_sqlite_experiment", @@ -950,14 +949,14 @@ "path": "docs/paper/sections/11_optimization.qmd" }, "unresolved_limits": [ - "production cutover is not proven" + "the paper claim is limited to the recorded proof scope" ] }, { "corpus_parameter_scope": "paired fresh and copied-late 200-event Natural and Durable windows", "decision": "rejected-numeric-acceptance-gates-failed", "evidence_fingerprints": [ - "8bf7c3b51be906c312d8a00913970547e4f4c9deb33068cd1edfd5598e263f51" + "7e80167b056ae9913689593a0ad308d5ec360f84c132216bc2fbd86a4d583bb4" ], "evidence_kind": "measured", "inventory_id": "state:shadow_sqlite_scoped_evaluation", @@ -967,14 +966,14 @@ "path": "docs/paper/sections/11_optimization.qmd" }, "unresolved_limits": [ - "production cutover is not proven" + "the paper claim is limited to the recorded proof scope" ] }, { "corpus_parameter_scope": "paired fresh and copied-late 200-event Natural and Durable windows", "decision": "recorded-measurement", "evidence_fingerprints": [ - "c4a5811f138462e381bbad56bb4b577307ef0b84797dfbcbbdcaf237813f25bd" + "6636a4c87f426302cff2fe27aa9ac79df8e3c2ace70b6974da647fec4259a1e2" ], "evidence_kind": "measured", "inventory_id": "state:shadow_sqlite_seam_proof", @@ -991,7 +990,7 @@ "corpus_parameter_scope": "migration 30; 15,695-packet Natural and 2,016-message Durable replays at F=0.45, S=T=0.5; 27 structural F/S/T points; nine 2,000-packet same-knob runs with 512 public queries and four opaque source ids per run; separate text/audio/image label proof", "decision": "retain-local-write-surface-repair-whole-goal-continues", "evidence_fingerprints": [ - "19cc8ea4ce28c90b828697bef4a03e70af519be85a95f6d6f75f33b0ac972986" + "50324f782e8b33fb7f843adf88b04f1cba8a28d34118fbd0a05bdf473a92c79d" ], "evidence_kind": "measured", "inventory_id": "state:signal_centroid_ring_cutover", @@ -1044,7 +1043,7 @@ "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", "decision": "retain-real-hnsw-adjacency-walk-reject-anchor-neighborhood-approximation", "evidence_fingerprints": [ - "9a7b782479af069c49b9b6a805693468651653afe0ec3006e9c2f2d7a02160f6" + "eb95c2020ea5ef8dcac8c6e46ecacb243c43c029e15d622dce60800746de7137" ], "evidence_kind": "measured", "inventory_id": "state:sqlite_hnsw_sparse_route_integration", @@ -1054,14 +1053,14 @@ "path": "docs/paper/sections/11_optimization.qmd" }, "unresolved_limits": [ - "production cutover is not proven" + "the paper claim is limited to the recorded proof scope" ] }, { "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", "decision": "rejected-fresh-process-and-wall-hard-gate", "evidence_fingerprints": [ - "bdefb3bf6651ce390f3b536ae336fd436db4c37e47f7931c70392942369cf3fc" + "a2da60acbd26711c481196fbb65ae9761c928fbbc3fcc0dca7dec467455f6f3e" ], "evidence_kind": "measured", "inventory_id": "state:supersession_metric_index_candidate", @@ -1078,7 +1077,7 @@ "corpus_parameter_scope": "100- and 200-event Natural and Durable instrumentation smoke profiles", "decision": "use explicit result activity markers instead of inclusive operation duration for vacuous-zero detection", "evidence_fingerprints": [ - "93bf3719b58b031954d3e1e8d8bb58b422f1d988f0a43083406cd529b98dfd10" + "9e6c3186d05fd2ed141f3399e18148205dbdea9aa13715f90a3b2c9c11f1be92" ], "evidence_kind": "measured", "inventory_id": "state:work_counter_activity_repair", @@ -1095,7 +1094,7 @@ "corpus_parameter_scope": "34,456 normalized 256-dimensional embeddings and 512 deterministic top-16 queries", "decision": "rejected-recall-at-16-0.979858", "evidence_fingerprints": [ - "d80d794e27b6979b354692bd7a530e4eff6baf61d9023e85ac37ff8940c0364c", + "09d706ac310d63937db9e98a98a96ca55e794da699acb2870185cdc083cba71e", "d30bfc49a82969a56834a87efddd827f5c4eda4987b0dc4084415dde84facf81" ], "evidence_kind": "modeled", @@ -1113,7 +1112,7 @@ "corpus_parameter_scope": "34,456 normalized 256-dimensional embeddings and 512 deterministic top-16 queries", "decision": "rejected-no-recall-gain-at-equal-per-graph-work", "evidence_fingerprints": [ - "d80d794e27b6979b354692bd7a530e4eff6baf61d9023e85ac37ff8940c0364c", + "09d706ac310d63937db9e98a98a96ca55e794da699acb2870185cdc083cba71e", "31008972639ea1a20a7bdc7ec76d8284a5a943db5b18a702fc5261f9c136f10e" ], "evidence_kind": "modeled", @@ -1131,7 +1130,7 @@ "corpus_parameter_scope": "34,456 normalized 256-dimensional embeddings and 512 deterministic top-16 queries", "decision": "rejected-recall-at-16-0.995972", "evidence_fingerprints": [ - "d80d794e27b6979b354692bd7a530e4eff6baf61d9023e85ac37ff8940c0364c", + "09d706ac310d63937db9e98a98a96ca55e794da699acb2870185cdc083cba71e", "68ff8dacf45e677f4c8781c1a6a1fe6ccb16af107a424016f72c32954e7694f2" ], "evidence_kind": "modeled", @@ -1149,7 +1148,7 @@ "corpus_parameter_scope": "34,456 normalized 256-dimensional embeddings and 512 deterministic top-16 queries", "decision": "rejected-recall-at-16-0.997803", "evidence_fingerprints": [ - "d80d794e27b6979b354692bd7a530e4eff6baf61d9023e85ac37ff8940c0364c", + "09d706ac310d63937db9e98a98a96ca55e794da699acb2870185cdc083cba71e", "49a8e8870573f66e98eb48ba0aafa1a1a6f1a5827ee6ada2ac7e6ae1dee45b1b" ], "evidence_kind": "modeled", @@ -1167,7 +1166,7 @@ "corpus_parameter_scope": "34,456 normalized 256-dimensional embeddings and 512 deterministic top-16 queries", "decision": "selected-benchmark-design-production-proof-pending", "evidence_fingerprints": [ - "d80d794e27b6979b354692bd7a530e4eff6baf61d9023e85ac37ff8940c0364c", + "09d706ac310d63937db9e98a98a96ca55e794da699acb2870185cdc083cba71e", "c6d0a84a168058264ebdfdc489c94852c9d1918be430a8b661d2947d03ceb0a0" ], "evidence_kind": "modeled", diff --git a/cmake/PrepareHnswlibForZig.cmake b/cmake/PrepareHnswlibForZig.cmake index 06ff2635..69c62156 100644 --- a/cmake/PrepareHnswlibForZig.cmake +++ b/cmake/PrepareHnswlibForZig.cmake @@ -13,15 +13,10 @@ file(MAKE_DIRECTORY "${HNSWLIB_OUTPUT_DIR}") file(COPY "${HNSWLIB_SOURCE_DIR}/hnswlib" DESTINATION "${HNSWLIB_OUTPUT_DIR}") -get_filename_component(_repo_root "${CMAKE_CURRENT_LIST_DIR}/.." ABSOLUTE) -file(RELATIVE_PATH _output_relative "${_repo_root}" "${HNSWLIB_OUTPUT_DIR}") -# git apply interprets --directory as a Git path even on Windows. -string(REPLACE "\\" "/" _output_relative "${_output_relative}") set(_patch "${CMAKE_CURRENT_LIST_DIR}/hnswlib-prefetch-bounds.patch") execute_process( - COMMAND git apply --check --unsafe-paths - "--directory=${_output_relative}" "${_patch}" - WORKING_DIRECTORY "${_repo_root}" + COMMAND git apply --check --unsafe-paths "${_patch}" + WORKING_DIRECTORY "${HNSWLIB_OUTPUT_DIR}" RESULT_VARIABLE _apply_check OUTPUT_QUIET ERROR_QUIET @@ -31,9 +26,8 @@ if(NOT _apply_check EQUAL 0) "Pinned Zig hnswlib source does not match the prefetch bounds patch") endif() execute_process( - COMMAND git apply --unsafe-paths - "--directory=${_output_relative}" "${_patch}" - WORKING_DIRECTORY "${_repo_root}" + COMMAND git apply --unsafe-paths "${_patch}" + WORKING_DIRECTORY "${HNSWLIB_OUTPUT_DIR}" RESULT_VARIABLE _apply_result ) if(NOT _apply_result EQUAL 0) diff --git a/comments/consolidation-drift-retrigger/20260716T205900Z-orchestrator-goal-mdscript-converted.mdscript.md b/comments/consolidation-drift-retrigger/20260716T205900Z-orchestrator-goal-mdscript-converted.mdscript.md index 5edc0545..71c05aab 100644 --- a/comments/consolidation-drift-retrigger/20260716T205900Z-orchestrator-goal-mdscript-converted.mdscript.md +++ b/comments/consolidation-drift-retrigger/20260716T205900Z-orchestrator-goal-mdscript-converted.mdscript.md @@ -5,13 +5,13 @@ owner_role: implementer lane_id: consolidation-drift-retrigger status: monitoring implementation_status: complete -monitor_status: four-follow-up-record-findings-corrected-push-pending +monitor_status: three-new-p2-ready-to-push source_of_truth: current repository, current user corrections, this goal, task comments, exact private profiles and audits, and GitHub PR 6 only after implementation completion model: gpt-5.6-terra reasoning: high model_selection_basis: cross-cutting C++ and SQLite implementation, deterministic bounded-work proof, research traceability, and PR ownership canonical_monitor_entry: true -updated_at: 20260721T125600Z +updated_at: 20260721T151000Z --- @@ -38,7 +38,7 @@ updated_at: 20260721T125600Z * focused production-default derivation, route work, active-epoch reset, shared Natural/Durable path, Durable-barrier non-replay, source/modality, Python audit, and evidence-builder tests pass on the current release build * preceding exact-head historical proof recorded all algorithm and experiment changes, accepted adverse timing, maturity boundary, failed-recenter rollback repair, exact-head CI repairs, and nonclaims in `docs/paper/sections/10_implementation.qmd` and `docs/paper/sections/11_optimization.qmd`; that preceding manuscript SHA-256 was `caa8ebead662209cfb55bad9c23638108b74d27497f594eab35006b792fabbc8` and is superseded by the current packet below * on that preceding exact head, the clean Debug LLVM 21 media-enabled suite with experiment hooks enabled passed 38,730 assertions in 697 cases on test binary SHA-256 `0fd25b6e322913cb0e76e3aa5a1fbcc6836d8696b6bbd5886224a3144fea1ec8`. Its complete SQLite-HNSW suite passed 2,614 assertions in 20 cases; focused RIF passed 312 assertions in 19 cases; the complete Python tool suite passed 159 tests; complete hnswlib patch reverse-check and `git diff --check` passed; and WebAssembly rebuilt with Emscripten 4.0.18. This is historical preceding-head evidence, not the current follow-up binary/result binding. A local UBSan-only build completes, but macOS denies its runtime library before `main()` on code-signing policy, so replacement Linux CI owns sanitizer execution -* the current-state overlay, rebuilt 70-record manifest, and fail-closed audit have raw-file SHA-256 values `3c4710ba511949ddab5743e799da8d3165be72fd7f42e38f7f0e763ed77fd7d9`, `90e34a0e84b5435afa43a21607e0f97b927afaef2df84ab3ea4135874b7b541b`, and `c17515ca87421e1af4fe154c7da6b27efbf10d9c5b5c5edd157e99af30f85ea5`; the audit passes with 70/70 inventory records and no uncovered inventory, claim mismatch, proof-level violation, or ownership violation; its normalized state SHA-256 is `25935efc387257d14f3dcf7f5397e7967bb4ab3139b084521522cc1898255ead`, and the regenerated manuscript SHA-256 is `821fce2999f765eaa828a1b83ba47ff403fe568fcb2e72ad88c873a10bf4c423` +* the current-state overlay, rebuilt 70-record manifest, and fail-closed audit have raw-file SHA-256 values `06b7071e414737c94f39befbb1e1b7c10985a90a72da4502bab50acbb2d67164`, `50842d8b70fafe5cda86d755edf590a499c1f9e17bcfc43f9602aceb447d0466`, and `f79b5d226b26975729c22fd32a763125202518a977b2f526d729355b9f1ed885`; the audit passes with 70/70 inventory records and no uncovered inventory, claim mismatch, proof-level violation, or ownership violation; its normalized state and manifest SHA-256 values are `850b81160180a0fde2d16c6eca83669a0ff89e42617741c53777f3dec49444bb` and `367c139ca373cd3f4bccfa782a2c2a0d3acf61a3a4b0d5f41c1f5035b8d7927d`, and the regenerated manuscript SHA-256 is `a13d1df5bbefe8560bcea0d14168847683cd56d2e15b43c5cf9a000e35d3e235` * the original recursive cutover review remains complete. The exact-head CI repair then received a fresh round one that found one P2 unguarded empty-adjacency HNSW prefetch; repair tree `d3ce8c1ada4ab13023cbcd40959c8a8a878b5307` guards it and adds deterministic update/reseal coverage. A different fresh round-two reviewer proved the complete repair at the P1/P2 threshold with no blocking finding. Its sole P3 control-record hygiene residual was corrected directly; a later append-only project correction record dated 2026-07-21 discloses the earlier in-place continuation mutation, supersedes that compromised provenance, synchronizes the task, and restores the missing lane-ledger history without exposing a machine-local path * fresh round-three cumulative review of baseline tree `156dd7bc27b7cda2c661a9467bfddfe72c771e8a` to candidate tree `71b079ec217128513e593f54bdb308f18a03d8eb` was Proven at P1 with no P1 findings. Round four reviewed candidate `5ea10c156fe6072961b7c43af97b2ac34ed30037` and found no implementation P1, but correctly rejected its stale audit and prior-candidate proof identities at P1. After that repair, a different fresh round-five reviewer proved exact candidate tree `0b4069c73955147da28add9b9eaea480bad48249` for source health at the P1 threshold with no P1 findings. One below-threshold P2 residual remains visible: the bounded cache ranks the global flashbulb prefix before recency/arousal filtering, while the SQL fallback filters eligibility before `LIMIT`. This does not regress the public thread's required intensity-before-truncation order, but full cache/fallback selection equivalence remains unclaimed * the required single non-code review reproduced the merged-state 70/70 trace audit and found two record defects: the external task still capped schema authority at migrations 29/30 and named obsolete head `b7f9e27`, while four current implementer comments lacked the complete metadata and Evidence/Questions/Stop Report shape. Both findings are directly corrected and validated without rereview as required; no code changed after the Proven round-five source candidate @@ -46,10 +46,15 @@ updated_at: 20260721T125600Z * Windows `zig-cli-install` failed on implementation repair commit `89a06084dd05710f90572c1b7bac7e17fab79122` because CMake supplied `git apply --directory` a backslash-separated relative path. The candidate normalizes only that Git path to forward slashes before the existing content check and apply; local Zig ReleaseFast static CLI build and complete reverse patch verification pass. Recursive review of that repair is Proven at round three P1; Windows validation remains owned by replacement exact-head CI * four newer P2 review threads are repaired locally: a reactivated higher-level row-addressed node retakes canonical entry authority, replacement-centroid search does not explicitly seed from the prior activation snapshot, both bounded consolidation arms exclude clustered rows before `LIMIT`, and the Zig package allowlist includes the CMake patch assets. Round-one review found that the prior strength index could still scan a clustered history prefix; current-user schema authorization extends to private migration 34, whose eligible-only unclustered partial index restores the $A+64C$ scan bound. Round-two review then found three P2 defects: the actual-seed metric had moved the ordinary-search visited boundary, the Zig patch was not a declared cached-step input, and the proof packet paired an older full-suite result with a newer binary. The repaired candidate preserves the original visited semantics, declares and invalidation-tests the patch input, and binds the current full result to its exact binary. The exact repair/query-plan/migration set passes 107 assertions in four cases; the current media-enabled suite passes 38,766 assertions in 699 cases on test binary SHA-256 `2ad4b947a5728fa767680a7cb399ebe969661b0a47e2ca5f269434ca34d0f02c`; Zig text-only passes 12/12 including a patch-content invalidation rerun; Python passes 159; the manuscript is regenerated; and the 70/70 trace audit passes. Fresh round-three and separately fresh final cumulative reviews are Proven at P1 with no P1 finding; the required single final record-only review, push, thread replies, and replacement exact-head CI remain pending. Two below-threshold P3 residuals remain visible: same-level reactivation tie behavior is not isolated, and the legacy external project goal remains a stale active discovery surface * the required single final record-only review found three P2 current-state contradictions and is consumed exactly once. The preceding manuscript/full-suite lines are now explicitly historical, the monitor hot path now starts at the post-review direct-correction/push transition, and the external task's current evidence now names 107 assertions, 38,766/699, the exact binary, and completed P1 reviews. These findings were corrected directly without rereview as required; final validation, push, public thread replies, and replacement exact-head CI remain pending +* implementation repair commit `25cf7b130e87837d0ed813b0e0ffda5a50701651` is pushed without force on a branch synchronized with current main. All four follow-up threads have exact repair/proof replies and are resolved; there are no review requests. At the post-push record review, exact-head CI had five checks green, six in progress, and failed Windows `zig-cli-install`; the log shows that passing the Zig output as `git apply --directory` still failed on Windows despite slash normalization. The active repair now runs Git's content check and apply from the build-local output directory, eliminating the host-path argument entirely. This repair requires current local proof and fresh code review before push; Windows acceptance remains owned by replacement exact-head CI +* Windows working-directory repair round-one tree `f1c2c81e45257cb0e0d67b105500faa09f5569aa` passes Zig text-only 12/12, applies and reverse-checks the patch in a fresh space-bearing build-local output path without modifying the package cache, regenerates the paper, and passes the 70/70 trace audit. Fresh round-one all-findings review is Proven with no finding or residual, and separately fresh final cumulative review of the synchronized tree is Proven at P1. That repair is retained inside the newer three-thread candidate; replacement Windows exact-head CI remains the acceptance owner +* separately fresh final cumulative review of Windows working-directory repair tree `e6e2c994bb8e8f1f03ed38fd8cc8a9f829f23835` is Proven at P1 with no P1 finding. During that review, three new P2 threads arrived. The active candidate expands the exact signal-vector ring to `Q=max(B,NCtx+KCtx)` and verifies all 27 low/mid/high knob points plus a 151-vector neutral restart; applies fallback hydration's B output cap after surface acceptance through keyset pages; and removes sparse supersession's false exact-coverage certificate so exact historical proof or SQLite fallback remains active. Focused proof passes 225 ring assertions, 154 restart assertions, 5 adversarial hydration assertions, 15 sparse-supersession assertions, 451 assertions in 20 MemoryStorage cases, and 173 assertions in 13 hydration cases. The complete media-enabled suite passes 39,081 assertions in 701 cases on exact binary SHA-256 `53191a9bf94bcbf19537a66acba4b41ef8e4d349f10c37a878d84df79adc2bc1`; Python passes 159, Zig text-only passes 12/12, paper render passes, and traceability passes 70/70. The corrected tradeoffs are explicit: malformed legacy hydration scans and exact supersession verification can exceed B and grow with history, so flat write cost and production-wide boundedness remain unclaimed. Fresh recursive review remains pending before push, reply, or resolution +* fresh round-one review of exact cumulative tree `8853b49239f04c846d01a4743bbf7e883cfd2a8d` is Proven at the all-findings threshold with no P1/P2/P3 finding or residual. The reviewer accepted the knob-increase restart boundary as an explicit exact-only nonclaim: an old smaller ring can temporarily provide fewer than Q vectors, but aggregate memory centroids are never substituted for missing exact signal vectors. Separately fresh final cumulative review is Proven at P1 with no P1 finding after independently rerunning the four repaired regressions for 399 assertions, matching binary SHA-256 `53191a9bf94bcbf19537a66acba4b41ef8e4d349f10c37a878d84df79adc2bc1`, reproducing traceability 70/70, and inspecting live PR state. The three repaired threads remain unresolved on pushed head `25cf7b130e87837d0ed813b0e0ffda5a50701651` until the reviewed replacement is pushed. Two P3 residuals remain visible: same-level reactivation tie behavior is not isolated, and the legacy external project goal remains a stale active discovery surface +* the exactly-one fresh final record review verified exact identities, live PR state, independently reproduced traceability 70/70, proof/nonclaim boundaries, authority, chronology, and both P3 residuals. Its sole P2 finding was a noncanonical executable handoff comment and incomplete reviewer identity in the append-only ledger. The comment now has canonical metadata, Summary/Next states, typed stop fields, a bound re-entry, and explicit reviewer model ownership; an append-only ledger correction names the reviewer and selection basis. The finding is corrected directly without rereview as required, and no code changed after either Proven code review ## PR Monitor Hot Path -* consume the single final record verdict, directly correct its findings without rereview, validate the final records, push without force, reply to and resolve the four threads after proof, then resolve the live GitHub PR head, base, checks, mergeability, review requests, comments, and unresolved threads +* validate the directly corrected final record packet, push the reviewed replacement without force, reply with exact proof, resolve the three threads, and refresh all live PR state * every ten minutes in this current task, refresh PR 6 exact head, checks, mergeability, reviews, review requests, comments, and unresolved threads; compare with the prior state and report only changes * repair only in-scope failures or review findings with proportionate proof and the required fresh review; push without force and update this goal to the new exact head * stop and deactivate the heartbeat when the PR merges or closes externally, repair exceeds scope, target drift is unrecoverable, or authority is explicitly denied diff --git a/comments/consolidation-drift-retrigger/20260721T150300Z-implementer-three-new-p2-final-record-review.mdscript.md b/comments/consolidation-drift-retrigger/20260721T150300Z-implementer-three-new-p2-final-record-review.mdscript.md new file mode 100644 index 00000000..6c3ed044 --- /dev/null +++ b/comments/consolidation-drift-retrigger/20260721T150300Z-implementer-three-new-p2-final-record-review.mdscript.md @@ -0,0 +1,65 @@ +--- +task_id: consolidation-drift-retrigger +role: implementer +author: proxy-gabe-implementer +status: ready-to-push +event_type: pr6-three-new-p2-final-record-direct-correction +event_exec: /mdscript-exec comments/consolidation-drift-retrigger/20260716T205900Z-orchestrator-goal-mdscript-converted.mdscript.md#resume-goal +claim_scope: three-new-p2-final-record-source-health +proof_decision: single non-code review consumed and its one P2 executable-handoff finding corrected directly without rereview +parent_visible: true +resolves: + - 20260721T150840Z-reviewer-pr6-three-new-p2-final-record-verdict +supersedes: [] +created_at: 20260721T150300Z +updated_at: 20260721T151000Z +model: gpt-5.6-terra +reasoning: high +model_selection_basis: cross-cutting C++/SQLite PR ownership, exact proof binding, MDScript handoff repair, and live review-thread resolution require high reasoning +reviewer: /root/review_pr6_three_p2_records +reviewer_model: gpt-5.6-terra +reviewer_reasoning: high +reviewer_model_selection_basis: exact MDScript control-state, content-addressed trace, live PR, authority, and continuation review requires high reasoning +review_round: single-non-code +review_mode: single-non-code-direct-correction +blocking_severities: all-findings +--- + + +## Summary + +* The exactly-one fresh non-code review found one P2 executable-handoff defect and otherwise verified the exact trees, hashes, independently reproduced 70/70 trace, live PR state, proof/nonclaims, authority, chronology, and the two existing P3 residuals. +* This corrected handoff adds canonical ownership and event metadata, explicit reviewer model selection, Summary and Next states, typed stop fields, and a bound repository-relative re-entry. The matching ledger correction is append-only; no rereview is permitted or required. + +## Evidence + +* baseline pushed head: `25cf7b130e87837d0ed813b0e0ffda5a50701651` +* exact source candidate tree: `8853b49239f04c846d01a4743bbf7e883cfd2a8d` +* full media proof: 39,081 assertions in 701 cases on binary SHA-256 `53191a9bf94bcbf19537a66acba4b41ef8e4d349f10c37a878d84df79adc2bc1` +* focused proof: 225 ring-grid, 154 exact-restart, 5 adversarial hydration, and 15 sparse-supersession assertions; 451 assertions in 20 MemoryStorage cases; 173 assertions in 13 hydration cases +* supporting proof: 159 Python tests, Zig text-only 12/12, paper render, and traceability 70/70 +* round-one verdict: Proven at all-findings threshold with no finding in `20260721T145507Z-reviewer-pr6-three-p2-round1-verdict.mdscript.md` +* final cumulative verdict: Proven at P1 with no P1 finding in `20260721T150119Z-reviewer-pr6-three-p2-final-cumulative-verdict.mdscript.md` +* live PR before push: OPEN, non-draft, MERGEABLE/UNSTABLE, synchronized with current main; 11 green checks and one known Windows failure on the old head; no review requests; exactly three unresolved repaired threads + +## Questions + +* None. The record reviewer supplied a single directly repairable finding and the correction remains inside existing record-maintenance authority. + +## Next + +* Validate metadata, headings, bound re-entry, JSON, traceability, and the exact final tree; then commit and push without force, reply to and resolve only the three proved threads, and monitor replacement exact-head CI and base drift. + +## Stop Report + +* stop_reason=single-record-review-consumed-direct-correction-complete +* verdict=ready-to-push after direct correction and final validation +* proof_decision=single non-code review consumed; one P2 executable-handoff finding corrected directly without rereview +* blocking_findings=none after direct correction +* residual_findings=P3 same-level reactivation tie behavior not isolated; P3 legacy external project goal remains a stale active discovery surface +* next_owner=consolidation-drift-retrigger implementer +* next_action=validate, commit, push without force, reply and resolve only the three proved threads, then monitor replacement exact-head CI +* blocker=none before final validation +* proof_not_claimed=push, thread resolution, Windows execution success, replacement exact-head CI, flat write cost, bounded malformed-legacy hydration scan, bounded exact historical supersession verification, whole-engine reset, Durable plateau, production-wide boundedness, merge-readiness, merge, close, release, deployment, publication, or live proof +* cleanup_status=/root/review_pr6_three_p2_records is terminal and consumed; do not reuse +* resume_command=/mdscript-exec comments/consolidation-drift-retrigger/20260716T205900Z-orchestrator-goal-mdscript-converted.mdscript.md#resume-goal diff --git a/docs/paper/_manuscript/index.md b/docs/paper/_manuscript/index.md index db91ae94..ceeb6621 100644 --- a/docs/paper/_manuscript/index.md +++ b/docs/paper/_manuscript/index.md @@ -5958,9 +5958,9 @@ isolated active identity just beyond an inactive slice. CMake and Zig compile the same pinned HNSW safety patch. The Zig graph copies the header-only dependency into a build-local declared output and patches that copy, leaving the content-addressed global package cache immutable -and safe for concurrent builds. The build-local output is normalized to -Git’s forward-slash path form before `git apply`, so the same content -check no longer receives host-native backslashes. The patch itself is +and safe for concurrent builds. The patch is checked and applied with +the build-local output as the working directory, so no host-native +output path is passed through Git’s path parser. The patch itself is also a declared build input, so changing it invalidates the preparation step instead of reusing a stale patched output. Local POSIX proof passes; replacement Windows CI remains the execution owner. The Zig @@ -6071,30 +6071,46 @@ replacement bounded build while exact retrieval remains authoritative. This gives consolidation a real route-epoch boundary without a store-sized graph rewrite. -Application hydration uses the same bounded-surface rule when a memory -has no materialized memory or reconstruction blob. SQLite retains every -authoritative signal, but the fallback reads only the most recent *B* -signal rows for that memory through the `(memory_id, serial_position)` -index and returns the selected rows in chronological order. Thus neutral -knobs hydrate at most 128 fallback signal payloads per returned memory, -all-low hydrates 64, and all-high hydrates 192. The bound does not -inspect modality or `source_id`; text, audio, and image signals follow -the same indexed query. The runtime records the derived limit and the -number of fallback rows actually materialized on each public call. +Application hydration uses a bounded-output rule when a memory has no +materialized memory or reconstruction blob. SQLite retains every +authoritative signal. The fallback first applies the memory’s modality +predicate in SQLite, then walks newest-first keyset pages and loads +payloads until either *B* rows pass the same modality, MIME, and +payload-shape predicate used by the public surface or that memory’s +candidates are exhausted. Accepted payloads are returned in +chronological order. Thus neutral knobs hydrate at most 128 fallback +signal payloads per returned memory, all-low hydrates 64, and all-high +hydrates 192. The accepted-output bound uses neither modality nor +`source_id` as a budget input, while filtering prevents a newer run of +nonmatching or mislabelled payloads from hiding an older matching +payload. This correction does mean that malformed legacy history can +require more than *B* candidate rows to be inspected; bounded output is +claimed, but bounded fallback scan work is not. The runtime records the +derived output limit and the number of fallback payloads actually +materialized on each public call. The same bounded activation surface now serves supersession selection after the current memory population exceeds *C*. `MemoryStorage` asks the persisted route for at most *A* identities, exactly reranks those current embeddings, and keeps its existing timestamp, kind, threshold, duplicate-band, edge-count, and tie rules. On this sparse path the -latest current embedding is the memory’s active centroid: an older base -embedding remains durable lineage but does not re-enter as a second -competing candidate after consolidation has moved that memory. Until the -route is published, when the dirty delta exceeds *C*, or when route -validation fails, the operation retains the exact fallback. This is one -shared, modality- and source-agnostic candidate route for Natural and -Durable; it does not add a second write API or make the connection-local -cache authoritative. The 4,000-event knob ablation and its remaining +latest current embedding is the memory’s active centroid. A bounded HNSW +result is now treated only as a candidate set, never as proof that it +covers the exact current population. The historical cache’s exact +coverage/ranking proof therefore remains active after sparse routing; +when that proof cannot be established, the existing SQLite fallback +remains enabled. This prevents an approximate current result from +suppressing a predecessor outside the activated subset. It deliberately +permits history-sized supersession verification work on a write, so the +9*C* + *A* retrieval-row ceiling does not imply flat supersession-write +cost. This is the accepted correctness side of the +write-throughput/retrieval-symmetry tradeoff and keeps production-wide +boundedness unclaimed. Until the route is published, when the dirty +delta exceeds *C*, or when route validation fails, the operation retains +the exact fallback. This is one shared, modality- and source-agnostic +candidate route for Natural and Durable; it does not add a second write +API or make the connection-local cache authoritative. The 4,000-event +knob ablation predates this exact-coverage correction and its remaining full-horizon limits are reported in the optimization section. `TRACE[state:integrated_hnsw_sparse_route_experiment]` and `TRACE[state:sqlite_hnsw_knob_ablation]`. @@ -6441,37 +6457,41 @@ SQLite-backed write path, not a second durability system: Natural ingestion appends through the common path, and Durable adds the existing flush/checkpoint boundary. -The ring capacity reuses the knob-derived historical batch size +The exact-vector ring must cover both the historical batch and every +signal that restart can place in recent context. Its capacity is -*B*(*F*, *S*, *T*) = round (64 + 64*F* + 32*S* + 32*T*), +*Q*(*F*, *S*, *T*) = max  (*B*(*F*, *S*, *T*), *N**c**t**x*(*T*) + *K**c**t**x*(*T*)), after independently clamping each knob to \[0, 1\]. It therefore -contains 64, 128, and 192 rows at the all-low, midpoint, and all-high +contains 64, 151, and 266 rows at the all-low, midpoint, and all-high corners. The logical rounding rule is C++ `std::lround`, so half-integer ties round away from zero. For example, *F* = 1/128, *S* = *T* = 0 yields 65 rather than 64. The logical *B* + 1 probe remains an overflow/completion check; it is not a fetched or processed extra row. -Slot selection is `(signal_id - 1) mod B`, so each ring upsert replaces +Slot selection is `(signal_id - 1) mod Q`, so each ring upsert replaces at most one prior exact-vector row. One accepted pipeline event may persist multiple accumulated signal records and therefore perform -multiple bounded upserts; the measured Natural maximum was 14 ring-table -mutations in one event. If knobs change, the table rehashes only the -newest rows that fit the newly resolved *B* and remains bounded by the +multiple bounded upserts; the measured Natural maximum of 14 ring-table +mutations came from the earlier *B*-capacity experiment and is not a new +*Q*-capacity benchmark. If knobs change, the table rehashes only the +newest rows that fit the newly resolved *Q* and remains bounded by the old or new knob-derived capacity throughout the transition. -Recent-context and working-memory restart hydration first read the exact -vector from this bounded ring and fall back to the durable centroid -reference for an older signal or a pre-migration database. The global +When the ring contains rows, recent-context restart hydration admits +only signals with an exact ring vector; it does not silently substitute +a memory centroid for a missing per-signal vector. A pre-ring database +with no exact rows retains the legacy centroid fallback. This means an +older store whose prior ring was smaller can temporarily restore a +shorter exact context until new writes fill *Q*, rather than mixing +aggregate vectors into an apparently full exact window. The global vector index consequently contains memory centroids rather than a growing population of signal-only decoys. The schema and routing code contain no modality or `source_id` branch; text, audio, image, shared, and opaque sources enter after encoding through the same slot formula. -Migration tests preserve the legacy fallback, and direct regressions -cover mixed modality/source labels, knob changes, and the 64/128/192 -capacity corners without widening the public API. The hydration -implementation reads the exact ring first and then the centroid -fallback, but this checkpoint does not claim a standalone end-to-end -restart regression or bounded whole-engine restart. +Direct regressions cover mixed modality/source labels, knob changes, all +27 low/mid/high F/S/T combinations, and a 151-vector neutral restart +whose restored identities equal the exact signal vectors. This does not +claim bounded whole-engine restart. Emotional propagation separately limits enqueued mutation statements to the existing activation target *A* = 2*C* + 2*B*. This is a hard bound @@ -6705,16 +6725,16 @@ advances by R = max (2, ⌊B/16⌋) to a 9C ceiling, rerank at most A = 2C + 2B -activated current centroids, and count routed rows and activated -identities independently -the current centroid becomes the active post-consolidation identity -while older base embeddings remain durable lineage; total query rows -remain at most 9C + A; timestamp, kind, +activated current centroids, then require the historical cache’s exact +coverage/ranking proof or retain SQLite fallback rather than treating +the sparse result as complete +the current sparse-candidate query remains bounded by 9C + A, but exact +historical verification may remain history-sized; timestamp, kind, duplicate band, similarity threshold, edge limit, deterministic tie order, rollback, source/modality independence, and public API shape -remain unchanged; lower-rank candidates may differ within the separately -approved bounded-retrieval accuracy contract +remain unchanged; write throughput and production-wide boundedness are +explicitly unclaimed graph retrieval @@ -8838,8 +8858,8 @@ leak. The final six active working-memory slots contained 14,290 signal rows, and because they lacked memory-level summary blobs, public hydration replayed all 14,290 payloads on every packet. Mean hydration increased from 3.07 ms in the early window to 96.16 ms in the final -window, dominating total latency. The retained fallback now selects only -each memory’s newest *B* indexed signal rows while SQLite keeps the +window, dominating total latency. The then-retained fallback selected +only each memory’s newest *B* indexed signal rows while SQLite keeps the complete history. On a copied mature database, a 500-event tail probe at neutral knobs recorded the 128-row limit on every event and materialized 642–655 fallback rows total across working and retrieved memories. Mean @@ -8851,7 +8871,16 @@ focused regression test proves the newest 128 rows and chronological output independently for opaque text, audio, and image sources. This copied-tail probe is direct mature-store performance evidence, not yet a full-horizon plateau or application-quality claim for omitted older -fallback payloads. +fallback payloads. A later review regression showed that applying *B* +before surface filtering could hide an older matching payload behind +newer nonmatching or malformed rows. The current implementation pages +newest-first until *B* payloads pass the public surface predicate or the +memory’s candidates are exhausted. A focused adversarial test places 128 +newer mislabelled binary payloads ahead of an older valid text payload +and recovers the valid payload. The mature tail timing above is +therefore historical evidence for the pre-correction algorithm; no +post-correction hydration throughput result is claimed, and worst-case +fallback scan work is no longer claimed bounded by *B*. ### Consolidation-cost and seal-cadence ablation @@ -8864,17 +8893,16 @@ deterministic route completion now draws from the indexed active-generation slice, so an inactive row cannot consume the fixed envelope or hide a later active identity. The CMake and Zig build graphs apply the same content-checked HNSW bounds patch; Zig patches a -build-local copy rather than mutating its shared package cache, and -normalizes the build output to Git’s forward-slash path form before -applying the patch so the Windows command no longer receives -backslash-separated Git paths. The patch is a declared build input, so a -patch-only change invalidates the preparation step. Local POSIX proof -passes, while replacement Windows CI remains required; the Zig package -allowlist now carries the `cmake` preparation and patch assets used by -that build graph. The RIF changed-row counter now records work performed -by the current event rather than the historical active population. Each -correction has a red-then-green regression and changes measurement, not -public retrieval semantics. +build-local copy rather than mutating its shared package cache, and runs +Git’s content check and apply from inside that output so no host-native +output path crosses Git’s path parser. The patch is a declared build +input, so a patch-only change invalidates the preparation step. Local +POSIX proof passes, while replacement Windows CI remains required; the +Zig package allowlist now carries the `cmake` preparation and patch +assets used by that build graph. The RIF changed-row counter now records +work performed by the current event rather than the historical active +population. Each correction has a red-then-green regression and changes +measurement, not public retrieval semantics. The remaining consolidation scan was bounded by the same knobs. Let *A* = 2*C* + 2*B* and *N* = max (8, ⌊*B*/2⌋). Score consolidation now @@ -9428,15 +9456,16 @@ before working-memory hydration; pinned HNSW speculative neighbor prefetches are adjacency-bounded without disabling SIMD distance kernels; empty adjacency snapshots skip a zero-byte copy whose vector destination may be null; Zig applies the same patch to a packaged -build-local copy with host paths normalized to Git form; deterministic -route fill excludes inactive rows; entry removal promotes an indexed -active hierarchy root, reactivation restores a higher persisted root, -overlapping activation snapshots clear atomically, recenter rebuilds do -not use prior snapshot identities as explicit frontier seeds, and -restart rejects legacy dead canonical or snapshot identities; changed -active embeddings invalidate stale adjacency for bounded rebuild; -consolidation merges exact active-RIF and indexed inactive frontiers -under the existing 64C/64C/A ceilings and filters clustered memories through an eligible-only partial index before either bounded arm; bounded emotional-source discovery preserves SQL intensity order @@ -10033,17 +10062,25 @@ working-memory rows to the newest centroid touched approximately 600 signal rows per accepted write in the diagnostic profile. Removing the repoint avoided that direct *O*(*N*) mutation but still left an unbounded inline-vector table. The retained design instead stores one -global centroid per memory and a persistent bounded exact-vector ring of -size *B*(*F*, *S*, *T*). Signal rows reference the centroid, so the ring -changes neither durable payload identity nor the public retrieval -surface. - -The content-addressed benchmark binary then replayed all 15,695 Natural -packets at *F* = 0.45, *S* = *T* = 0.5, resolving *B* = 125 and -*A* = 1, 248. It processed 32 consolidations in 183,001 ms with mean -process and total times of 4.2730 and 11.4210 ms. The maximum ring-table -mutation count was 12 in any event. Emotional updates reached 133 -against the hard *A* = 1, 248 enqueue limit, and the limit was never +global centroid per memory and a persistent bounded exact-vector ring. +The original experiment used size *B*(*F*, *S*, *T*); restart review +later showed that `LoadRecentContext` can restore +*N**c**t**x*(*T*) + *K**c**t**x*(*T*) signals. The +current capacity is therefore +*Q* = max (*B*, *N**c**t**x* + *K**c**t**x*): 64 +at the all-low point, 151 at neutral knobs, and 266 at the all-high +point. All 27 low/mid/high F/S/T combinations verify *Q* and the +complete restore-window inequality. Signal rows reference the centroid, +so the ring changes neither durable payload identity nor the public +retrieval surface. + +The content-addressed benchmark binary, which predates the *Q* +restart-window correction and used the original *B* ring, then replayed +all 15,695 Natural packets at *F* = 0.45, *S* = *T* = 0.5, resolving +*B* = 125 and *A* = 1, 248. It processed 32 consolidations in 183,001 ms +with mean process and total times of 4.2730 and 11.4210 ms. The maximum +ring-table mutation count was 12 in any event. Emotional updates reached +133 against the hard *A* = 1, 248 enqueue limit, and the limit was never saturated. That run is not reported as a whole-engine plateau pass. No suffix @@ -10362,6 +10399,18 @@ work-counter, and continued-store-growth checks. Whole plateau acceptance still failed because the strict absolute consolidation reset classifier remained invalid; that raw failure is retained and unwaived. +A later correctness review found that the sparse current candidate set +had been treated as if it were an exact coverage certificate. That +shortcut could omit a true predecessor outside the activated subset and +suppress the historical fallback. The retained repair removes that +certificate: sparse current candidates remain bounded, but the +historical cache must provide its exact coverage/ranking proof or SQLite +fallback remains enabled. The focused large-population regression now +records 514 historical rows inspected rather than zero while retaining +the expected supersession edge. This restores supersession completeness +at the explicit cost of potentially history-sized write work; no revised +full replay or flat-write claim is made. + No new work constant was introduced. At the executed production knobs, *C*/*B*/*A* = 499/125/1, 248, public routing is 5*C* = 2, 495, construction remains *C* + *B* = 624 nodes and 2*B* = 250 queue effort, diff --git a/docs/paper/sections/10_implementation.qmd b/docs/paper/sections/10_implementation.qmd index e534cba3..20cf3e87 100644 --- a/docs/paper/sections/10_implementation.qmd +++ b/docs/paper/sections/10_implementation.qmd @@ -517,9 +517,9 @@ not consume the fixed node budget or hide an isolated active identity just beyond an inactive slice. CMake and Zig compile the same pinned HNSW safety patch. The Zig graph copies the header-only dependency into a build-local declared output and patches that copy, leaving the content-addressed global -package cache immutable and safe for concurrent builds. The build-local output -is normalized to Git's forward-slash path form before `git apply`, so the same -content check no longer receives host-native backslashes. The patch itself is +package cache immutable and safe for concurrent builds. The patch is checked +and applied with the build-local output as the working directory, so no +host-native output path is passed through Git's path parser. The patch itself is also a declared build input, so changing it invalidates the preparation step instead of reusing a stale patched output. Local POSIX proof passes; replacement Windows CI remains the execution owner. The Zig package @@ -622,28 +622,43 @@ exact retrieval remains authoritative. This gives consolidation a real route-epoch boundary without a store-sized graph rewrite. -Application hydration uses the same bounded-surface rule when a memory has no +Application hydration uses a bounded-output rule when a memory has no materialized memory or reconstruction blob. SQLite retains every authoritative -signal, but the fallback reads only the most recent $B$ signal rows for that -memory through the `(memory_id, serial_position)` index and returns the selected -rows in chronological order. Thus neutral knobs hydrate at most 128 fallback -signal payloads per returned memory, all-low hydrates 64, and all-high hydrates -192. The bound does not inspect modality or `source_id`; text, audio, and image -signals follow the same indexed query. The runtime records the derived limit -and the number of fallback rows actually materialized on each public call. +signal. The fallback first applies the memory's modality predicate in SQLite, +then walks newest-first keyset pages and loads payloads until either $B$ rows +pass the same modality, MIME, and payload-shape predicate used by the public +surface or that memory's candidates are exhausted. Accepted payloads are +returned in chronological order. Thus neutral knobs hydrate at most 128 +fallback signal payloads per returned memory, all-low hydrates 64, and all-high +hydrates 192. The accepted-output bound uses neither modality nor `source_id` +as a budget input, while filtering prevents a newer run of nonmatching or +mislabelled payloads from hiding an older matching payload. This correction +does mean that malformed legacy history can require more than $B$ candidate +rows to be inspected; bounded output is claimed, but bounded fallback scan work +is not. The runtime records the derived output limit and the number of fallback +payloads actually materialized on each public call. The same bounded activation surface now serves supersession selection after the current memory population exceeds $C$. `MemoryStorage` asks the persisted route for at most $A$ identities, exactly reranks those current embeddings, and keeps its existing timestamp, kind, threshold, duplicate-band, edge-count, and tie rules. On this sparse path the latest current embedding is the memory's active -centroid: an older base embedding remains durable lineage but does not re-enter -as a second competing candidate after consolidation has moved that memory. +centroid. A bounded HNSW result is now treated only as a candidate set, never as +proof that it covers the exact current population. The historical cache's exact +coverage/ranking proof therefore remains active after sparse routing; when that +proof cannot be established, the existing SQLite fallback remains enabled. +This prevents an approximate current result from suppressing a predecessor +outside the activated subset. It deliberately permits history-sized +supersession verification work on a write, so the $9C+A$ retrieval-row ceiling +does not imply flat supersession-write cost. This is the accepted correctness +side of the write-throughput/retrieval-symmetry tradeoff and keeps +production-wide boundedness unclaimed. Until the route is published, when the dirty delta exceeds $C$, or when route validation fails, the operation retains the exact fallback. This is one shared, modality- and source-agnostic candidate route for Natural and Durable; it does not add a second write API or make the connection-local cache authoritative. -The 4,000-event knob ablation and its remaining full-horizon limits are reported +The 4,000-event knob ablation predates this exact-coverage correction and its +remaining full-horizon limits are reported in the optimization section. `TRACE[state:integrated_hnsw_sparse_route_experiment]` and `TRACE[state:sqlite_hnsw_knob_ablation]`. @@ -971,38 +986,42 @@ vectors for only the active tail are retained in the internal write path, not a second durability system: Natural ingestion appends through the common path, and Durable adds the existing flush/checkpoint boundary. -The ring capacity reuses the knob-derived historical batch size +The exact-vector ring must cover both the historical batch and every signal +that restart can place in recent context. Its capacity is $$ -B(F,S,T)=\operatorname{round}(64+64F+32S+32T), +Q(F,S,T)=\max\!\left(B(F,S,T),N_{ctx}(T)+K_{ctx}(T)\right), $$ after independently clamping each knob to $[0,1]$. It therefore contains 64, -128, and 192 rows at the all-low, midpoint, and all-high corners. The logical +151, and 266 rows at the all-low, midpoint, and all-high corners. The logical rounding rule is C++ `std::lround`, so half-integer ties round away from zero. For example, $F=1/128,S=T=0$ yields 65 rather than 64. The logical $B+1$ probe remains an overflow/completion check; it is not a fetched or processed extra row. Slot selection is -`(signal_id - 1) mod B`, so each ring upsert replaces at most one prior +`(signal_id - 1) mod Q`, so each ring upsert replaces at most one prior exact-vector row. One accepted pipeline event may persist multiple accumulated signal records and therefore perform multiple bounded upserts; the measured -Natural maximum was 14 ring-table mutations in one event. If knobs change, the +Natural maximum of 14 ring-table mutations came from the earlier $B$-capacity +experiment and is not a new $Q$-capacity benchmark. If knobs change, the table rehashes only the newest rows that -fit the newly resolved $B$ and remains bounded by the old or new knob-derived +fit the newly resolved $Q$ and remains bounded by the old or new knob-derived capacity throughout the transition. -Recent-context and working-memory restart hydration first read the exact vector -from this bounded ring and fall back to the durable centroid reference for an -older signal or a pre-migration database. The global vector index consequently +When the ring contains rows, recent-context restart hydration admits only +signals with an exact ring vector; it does not silently substitute a memory +centroid for a missing per-signal vector. A pre-ring database with no exact +rows retains the legacy centroid fallback. This means an older store whose +prior ring was smaller can temporarily restore a shorter exact context until +new writes fill $Q$, rather than mixing aggregate vectors into an apparently +full exact window. The global vector index consequently contains memory centroids rather than a growing population of signal-only decoys. The schema and routing code contain no modality or `source_id` branch; text, audio, image, shared, and opaque sources enter after encoding through the -same slot formula. Migration tests preserve the legacy fallback, and direct -regressions cover mixed modality/source labels, knob changes, and the -64/128/192 capacity corners without widening the public API. The hydration -implementation reads the exact ring first and then the centroid fallback, but -this checkpoint does not claim a standalone end-to-end restart regression or -bounded whole-engine restart. +same slot formula. Direct regressions cover mixed modality/source labels, knob +changes, all 27 low/mid/high F/S/T combinations, and a 151-vector neutral +restart whose restored identities equal the exact signal vectors. This does +not claim bounded whole-engine restart. Emotional propagation separately limits enqueued mutation statements to the existing activation target $A=2C+2B$. This is a hard bound on writes, not a diff --git a/docs/paper/sections/11_optimization.qmd b/docs/paper/sections/11_optimization.qmd index 2b7b9937..54689243 100644 --- a/docs/paper/sections/11_optimization.qmd +++ b/docs/paper/sections/11_optimization.qmd @@ -66,7 +66,7 @@ The current branch includes the following implementation-level changes: | supersession eligibility | derive target-to-earliest-replacement timestamps in an internal execution sidecar beside the shared association fanout cache and incrementally publish committed MemoryStorage supersession edges instead of invalidating and rebuilding all fanout rows | exact edge direction, base embedding ids, strict timestamp boundary, source/modality independence, SQLite fallback, rollback rehydration, and the public processor layout are retained | | reconstruction | knob-bounded retrieval-time reconstruction append | constructive recall remains non-decoder and can be disabled cleanly | | memory storage | avoid redundant object-store writes for single-signal memory payloads | durable payload identity is preserved | -| supersession neighbor ranking | below the sparse cutover, or whenever the route is unpublished, overflowing, or invalid, maintain private current/base embedding surfaces and retain the exact historical-coverage proof and SQL fallback; above the knob-derived cutover, reuse the SQLite HNSW activation surface, inspect an $8C$ post-consolidation floor that advances by $R=\max(2,\lfloor B/16\rfloor)$ to a $9C$ ceiling, rerank at most $A=2C+2B$ activated current centroids, and count routed rows and activated identities independently | the current centroid becomes the active post-consolidation identity while older base embeddings remain durable lineage; total query rows remain at most $9C+A$; timestamp, kind, duplicate band, similarity threshold, edge limit, deterministic tie order, rollback, source/modality independence, and public API shape remain unchanged; lower-rank candidates may differ within the separately approved bounded-retrieval accuracy contract | +| supersession neighbor ranking | below the sparse cutover, or whenever the route is unpublished, overflowing, or invalid, maintain private current/base embedding surfaces and retain the exact historical-coverage proof and SQL fallback; above the knob-derived cutover, reuse the SQLite HNSW activation surface, inspect an $8C$ post-consolidation floor that advances by $R=\max(2,\lfloor B/16\rfloor)$ to a $9C$ ceiling, rerank at most $A=2C+2B$ activated current centroids, then require the historical cache's exact coverage/ranking proof or retain SQLite fallback rather than treating the sparse result as complete | the current sparse-candidate query remains bounded by $9C+A$, but exact historical verification may remain history-sized; timestamp, kind, duplicate band, similarity threshold, edge limit, deterministic tie order, rollback, source/modality independence, and public API shape remain unchanged; write throughput and production-wide boundedness are explicitly unclaimed | | graph retrieval | score vector similarity first, restrict recency to a tie-break, cap graph bonus, and reserve final occupancy for direct semantic anchors | recent unrelated rows and noisy graph neighbors cannot displace the semantic seed surface | | rollback snapshots | detach rebuildable durable caches, deep-copy the internal execution-sidecar state only for full snapshots, move the private accumulator map, and detach working-memory signal-record and blob-reference vectors before copying remaining processor state; journal active-source vector lengths for ordinary appends and lazily deep-back up only the active source before accepted storage, flush reset, or interrupt reset can mutate prior records; trim working-memory appends and move an evicted slot's record ownership into the journal; reserve a full-map hook for explicit foreign-source accumulator-topology mutation | non-boundary Natural ingestion does not recopy the growing pending unit or source map; a one-source flush does not copy unrelated open-source or working-memory history; failed writes and public no-store queries restore durable and volatile state exactly; public state layout and retention semantics are unchanged | | emotional cascade metadata | maintain a private rebuildable cache of per-memory emotional rows, per-embedding shared-member minima, recency-ordered flashbulb sources, and the expandable topology footprint of the last fixed point; update it at the same successful storage, consolidation, cascade, association, and eviction decisions and rehydrate it after journal-aware rollback; caller-supplied roots invalidate the sidecar before forwarding their first transaction statement, while cache-only roots retain their exact snapshot; share breadth-first edge visits across source-order 64-bit batches while retaining a distinct visited bit and radius for every source | source eligibility and stable tie order, shared-embedding `MIN`/`MAX` semantics, shortest depth per source, first-source-wins ordering, custom raw-SQL updates within the current transaction, update decisions, and durable database state match the scalar path; an inserted edge outside every source's remaining-radius footprint advances the fixed point without a graph walk, topology rebuilds invalidate conservatively, batches continue for arbitrary source counts, and neither path keys behavior by source id or modality; ordinary engine-owned snapshot work still copies zero store-sized cache entries | @@ -1454,7 +1454,7 @@ The final six active working-memory slots contained 14,290 signal rows, and because they lacked memory-level summary blobs, public hydration replayed all 14,290 payloads on every packet. Mean hydration increased from 3.07 ms in the early window to 96.16 ms in the final window, dominating total latency. The -retained fallback now selects only each memory's newest $B$ indexed signal rows +then-retained fallback selected only each memory's newest $B$ indexed signal rows while SQLite keeps the complete history. On a copied mature database, a 500-event tail probe at neutral knobs recorded the 128-row limit on every event and materialized 642--655 fallback rows total across working and retrieved @@ -1465,7 +1465,16 @@ to the rejected full replay's final 500 events, hydration fell 94.4% (96.162 to proves the newest 128 rows and chronological output independently for opaque text, audio, and image sources. This copied-tail probe is direct mature-store performance evidence, not yet a full-horizon plateau or application-quality -claim for omitted older fallback payloads. +claim for omitted older fallback payloads. A later review regression showed +that applying $B$ before surface filtering could hide an older matching payload +behind newer nonmatching or malformed rows. The current implementation pages +newest-first until $B$ payloads pass the public surface predicate or the +memory's candidates are exhausted. A focused adversarial test places 128 newer +mislabelled binary payloads ahead of an older valid text payload and recovers +the valid payload. The mature tail timing above is therefore historical +evidence for the pre-correction algorithm; no post-correction hydration +throughput result is claimed, and worst-case fallback scan work is no longer +claimed bounded by $B$. ### Consolidation-cost and seal-cadence ablation @@ -1477,9 +1486,9 @@ physical audit streams remain intact. Mature deterministic route completion now draws from the indexed active-generation slice, so an inactive row cannot consume the fixed envelope or hide a later active identity. The CMake and Zig build graphs apply the same content-checked HNSW bounds patch; Zig patches a -build-local copy rather than mutating its shared package cache, and normalizes -the build output to Git's forward-slash path form before applying the patch so -the Windows command no longer receives backslash-separated Git paths. The +build-local copy rather than mutating its shared package cache, and runs Git's +content check and apply from inside that output so no host-native output path +crosses Git's path parser. The patch is a declared build input, so a patch-only change invalidates the preparation step. Local POSIX proof passes, while replacement Windows CI remains required; the Zig package allowlist now carries the `cmake` preparation and patch assets used by @@ -1672,7 +1681,7 @@ observation-only result is never promoted to production-path proof. | `TRACE[state:sqlite_hnsw_sparse_route_integration]` | Retained row-addressed SQLite HNSW query and incremental seal in the existing `GraphRetrieve` and `MemoryStorage` paths; Natural and Durable share the same algorithm, and Durable adds only its checkpoint. Current full-corpus retrieval quality and activation bounds pass, while the Natural whole-engine plateau and Durable horizon gates remain open. | | `TRACE[state:sqlite_hnsw_activation_effort_cycle]` | Queue-effort-only, fixed-$5C$, and dynamic $4C$ through $8C$ floor variants were rejected or superseded. The retained candidate resets routing work to $8C$, advances by $R=\max(2,\lfloor B/16\rfloor)$ to $9C$, keeps $A=2C+2B$ downstream activation and $2B/(C+B)$ construction, passes the 30,380-packet mature-cycle gates at 511/512 top-1 and recall@16 0.999265, and passes canonical and nine-point quality without an engine-wide plateau claim. | | `TRACE[state:sqlite_hnsw_production_cutover]` | Retained the existing SQLite HNSW route as the production default at an $8C$ post-consolidation floor, $R=\max(2,\lfloor B/16\rfloor)$ step, $9C$ ceiling, separate $A=2C+2B$ snapshot, and $9C+A$ total row ceiling. The nine-point matrix passed 4,608/4,608 top-1 controls, minimum recall@16 and semantic coverage 1.0, deterministic ties, and source/modality-label invariance. Natural and Durable share the operation path, with Durable adding only its checkpoint; whole-engine reset, bounded restart, Durable plateau, release, and deployment remain unclaimed. | -| `TRACE[state:pr6_exact_head_ci_repair]` | PR-monitor repair record: migrated active RIF rows are calibrated before working-memory hydration; pinned HNSW speculative neighbor prefetches are adjacency-bounded without disabling SIMD distance kernels; empty adjacency snapshots skip a zero-byte copy whose vector destination may be null; Zig applies the same patch to a packaged build-local copy with host paths normalized to Git form; deterministic route fill excludes inactive rows; entry removal promotes an indexed active hierarchy root, reactivation restores a higher persisted root, overlapping activation snapshots clear atomically, recenter rebuilds do not use prior snapshot identities as explicit frontier seeds, and restart rejects legacy dead canonical or snapshot identities; changed active embeddings invalidate stale adjacency for bounded rebuild; consolidation merges exact active-RIF and indexed inactive frontiers under the existing $64C$/$A$ ceilings and filters clustered memories through an eligible-only partial index before either bounded arm; bounded emotional-source discovery preserves SQL intensity order and refreshes rank-changing mutations through an indexed knob-sized prefix; partial edge-limited cascade traversals do not become fixed points; and cache-byte arithmetic uses explicit `std::size_t` width for WebAssembly. The full media CTest baseline, focused RIF/HNSW/consolidation regressions, build-local Zig proof, and WebAssembly bundle build pass locally. The sandboxed macOS ASAN runtime cannot execute because dynamic-shadow discovery or sanitizer-runtime code signing fails before `main()`, so replacement exact-head Linux sanitizer CI remains the required owner; the historical 4,608-query quality matrix is not relabeled as evidence from the repaired binary. | +| `TRACE[state:pr6_exact_head_ci_repair]` | PR-monitor repair record: migrated active RIF rows are calibrated before working-memory hydration; pinned HNSW speculative neighbor prefetches are adjacency-bounded without disabling SIMD distance kernels; empty adjacency snapshots skip a zero-byte copy whose vector destination may be null; Zig applies the same patch to a packaged build-local copy by running Git from inside that output rather than passing a host-native output path; deterministic route fill excludes inactive rows; entry removal promotes an indexed active hierarchy root, reactivation restores a higher persisted root, overlapping activation snapshots clear atomically, recenter rebuilds do not use prior snapshot identities as explicit frontier seeds, and restart rejects legacy dead canonical or snapshot identities; changed active embeddings invalidate stale adjacency for bounded rebuild; consolidation merges exact active-RIF and indexed inactive frontiers under the existing $64C$/$A$ ceilings and filters clustered memories through an eligible-only partial index before either bounded arm; bounded emotional-source discovery preserves SQL intensity order and refreshes rank-changing mutations through an indexed knob-sized prefix; partial edge-limited cascade traversals do not become fixed points; and cache-byte arithmetic uses explicit `std::size_t` width for WebAssembly. The full media CTest baseline, focused RIF/HNSW/consolidation regressions, build-local Zig proof, and WebAssembly bundle build pass locally. The sandboxed macOS ASAN runtime cannot execute because dynamic-shadow discovery or sanitizer-runtime code signing fails before `main()`, so replacement exact-head Linux sanitizer CI remains the required owner; the historical 4,608-query quality matrix is not relabeled as evidence from the repaired binary. | | `TRACE[state:hnsw_fixed_6c_experiment]` | Rejected knob-derived fixed-$6C$ routing envelope. All 27 structural F/S/T points and 931 assertions passed; neutral $C=512$ produced a 3,072-node envelope while $B=128$ and the 129 boundary remained distinct. An extra production-default F=.45/S=.5/T=.5 pre-screen missed exact top-1, recall@16, plateau, and wall-time gates, so fail-fast rejected the candidate before the exact nine-point corpus matrix started and left production on fixed $5C$. | | `TRACE[state:post_rif_empty_fixed_envelope_attribution]` | Repaired proof classification for the retained zero-increment fixed-$5C/5C$ route. Retrieval mode is independent of whole-engine process shape; route-active rows fail closed on missing work, and queue, node ceiling, actual visits, distance work, and activation are checked separately across at least ten mature unchanged-envelope recenters. The production suffix beginning at event 10,195 passes the classifier and work envelope across 12 complete recenters, while activated-identity overlap, process-cycle reset, exact full-horizon retrieval, Durable horizon, and bounded restart remain open. | | `TRACE[state:write_gate_incidence_attribution_v2]` | Deterministic range-bound observation-only 15,695-packet production-knob attribution rejected boundary-to-write incidence as the growth source: exact event ranges 0--2,499 and 13,195--15,694 contained 510 and 528 writes, while MemoryStorage time per write rose from 0.4833 to 2.8343 ms as the existing shared SQLite HNSW route warmed toward the fixed $5C=2{,}495$ envelope. Production $C/B/A=499/125/1{,}248$ and construction $C+B/2B=624/250$ remain derived; neutral $C/B/A=512/128/1{,}280$ and 129 is only logical $B+1$. Raw reset remains failed and unwaived; 27 structural and nine production-shaped F/S/T ablations remain required. | @@ -1991,11 +2000,17 @@ the newest centroid touched approximately 600 signal rows per accepted write in the diagnostic profile. Removing the repoint avoided that direct $O(N)$ mutation but still left an unbounded inline-vector table. The retained design instead stores one global centroid per memory and a persistent bounded -exact-vector ring of size $B(F,S,T)$. Signal rows reference the centroid, so +exact-vector ring. The original experiment used size $B(F,S,T)$; restart review +later showed that `LoadRecentContext` can restore +$N_{ctx}(T)+K_{ctx}(T)$ signals. The current capacity is therefore +$Q=\max(B,N_{ctx}+K_{ctx})$: 64 at the all-low point, 151 at neutral knobs, +and 266 at the all-high point. All 27 low/mid/high F/S/T combinations verify +$Q$ and the complete restore-window inequality. Signal rows reference the centroid, so the ring changes neither durable payload identity nor the public retrieval surface. -The content-addressed benchmark binary then replayed all 15,695 Natural packets at +The content-addressed benchmark binary, which predates the $Q$ restart-window +correction and used the original $B$ ring, then replayed all 15,695 Natural packets at $F=0.45,S=T=0.5$, resolving $B=125$ and $A=1,248$. It processed 32 consolidations in 183,001 ms with mean process and total times of 4.2730 and 11.4210 ms. The maximum ring-table mutation count was 12 in any event. @@ -2228,6 +2243,17 @@ height, operation, work-counter, and continued-store-growth checks. Whole plateau acceptance still failed because the strict absolute consolidation reset classifier remained invalid; that raw failure is retained and unwaived. +A later correctness review found that the sparse current candidate set had +been treated as if it were an exact coverage certificate. That shortcut could +omit a true predecessor outside the activated subset and suppress the +historical fallback. The retained repair removes that certificate: sparse +current candidates remain bounded, but the historical cache must provide its +exact coverage/ranking proof or SQLite fallback remains enabled. The focused +large-population regression now records 514 historical rows inspected rather +than zero while retaining the expected supersession edge. This restores +supersession completeness at the explicit cost of potentially history-sized +write work; no revised full replay or flat-write claim is made. + No new work constant was introduced. At the executed production knobs, $C/B/A=499/125/1{,}248$, public routing is $5C=2{,}495$, construction remains $C+B=624$ nodes and $2B=250$ queue effort, and 126 is only the production diff --git a/src/cortext.cpp b/src/cortext.cpp index 38f9d7dd..4263877a 100644 --- a/src/cortext.cpp +++ b/src/cortext.cpp @@ -43,6 +43,8 @@ #include #include #include +#include +#include #include #include #include @@ -464,45 +466,78 @@ LoadSignalBlobs (Store *store, long long memory_id, try { const long long limit = std::max (1, max_signal_blobs); - auto rows = store->Execute ( - "SELECT modality, mime, blob_id FROM (" - " SELECT modality, mime, blob_id, serial_position " - " FROM signals " - " WHERE memory_id = ? AND blob_id IS NOT NULL " - " ORDER BY serial_position DESC " - " LIMIT ?" - ") recent_signals " - "ORDER BY serial_position ASC", - { memory_id, limit }); - - for (const auto &row : rows) + long long cursor_position = std::numeric_limits::max (); + long long cursor_signal_id = std::numeric_limits::max (); + std::vector> matched_payloads; + matched_payloads.reserve (static_cast (limit)); + while (static_cast (matched_payloads.size ()) < limit) { - auto it = row.find ("blob_id"); - if (it != row.end () && it->second.has_value ()) + auto rows = store->Execute ( + "SELECT signal_id, modality, mime, blob_id, " + " COALESCE(serial_position, signal_id) AS sort_position " + "FROM signals " + "WHERE memory_id = ? AND blob_id IS NOT NULL " + " AND (? = '' OR modality = ?) " + " AND (COALESCE(serial_position, signal_id) < ? " + " OR (COALESCE(serial_position, signal_id) = ? " + " AND signal_id < ?)) " + "ORDER BY sort_position DESC, signal_id DESC " + "LIMIT ?", + { memory_id, memory_modality, memory_modality, + cursor_position, cursor_position, cursor_signal_id, limit }); + if (rows.empty ()) + break; + + for (const auto &row : rows) { - auto blob_id = store::BlobFromAny (it->second); - if (!blob_id.empty ()) + const auto position = store::AnyToLongLong ( + row.at ("sort_position")); + const auto signal_id = store::AnyToLongLong ( + row.at ("signal_id")); + if (!position || !signal_id) + throw std::runtime_error ( + "invalid fallback signal ordering row"); + cursor_position = *position; + cursor_signal_id = *signal_id; + + auto it = row.find ("blob_id"); + if (it != row.end () && it->second.has_value ()) { - std::vector payload; - if (LoadObjectPayload (store, object_store, blob_id, payload)) + auto blob_id = store::BlobFromAny (it->second); + if (!blob_id.empty ()) { - const std::string signal_modality - = RowString (row, "modality"); - const std::string signal_mime = RowString (row, "mime"); - if (PayloadMatchesMemorySurface ( - memory_modality, memory_mime, signal_modality, - signal_mime, payload)) + std::vector payload; + if (LoadObjectPayload (store, object_store, blob_id, + payload)) { - out.push_back (std::move (payload)); - if (loaded_signal_blobs) + const std::string signal_modality + = RowString (row, "modality"); + const std::string signal_mime + = RowString (row, "mime"); + if (PayloadMatchesMemorySurface ( + memory_modality, memory_mime, + signal_modality, signal_mime, payload)) { - ++*loaded_signal_blobs; + matched_payloads.push_back ( + std::move (payload)); + if (static_cast ( + matched_payloads.size ()) + == limit) + break; } } } } } + if (static_cast (rows.size ()) < limit) + break; } + std::reverse (matched_payloads.begin (), matched_payloads.end ()); + if (loaded_signal_blobs) + *loaded_signal_blobs += matched_payloads.size (); + out.insert (out.end (), + std::make_move_iterator (matched_payloads.begin ()), + std::make_move_iterator (matched_payloads.end ())); return !out.empty (); } catch (const std::exception &e) diff --git a/src/operations/active_signal_embedding_ring_internal.hpp b/src/operations/active_signal_embedding_ring_internal.hpp index d077b0ab..a52bf12d 100644 --- a/src/operations/active_signal_embedding_ring_internal.hpp +++ b/src/operations/active_signal_embedding_ring_internal.hpp @@ -16,7 +16,7 @@ namespace cortext::operations::active_signal_embedding_ring_internal inline int Capacity (double focus, double sensitivity, double stability) { - return sparse_retrieval_knobs_internal::BackfillBatchSize ( + return sparse_retrieval_knobs_internal::ActiveSignalEmbeddingCapacity ( focus, sensitivity, stability); } diff --git a/src/operations/memory_storage.cpp b/src/operations/memory_storage.cpp index cf9d2121..d107b0e9 100644 --- a/src/operations/memory_storage.cpp +++ b/src/operations/memory_storage.cpp @@ -399,19 +399,11 @@ LoadHistoricalSupersessionRowsFromCache ( return std::nullopt; } - // Once the complete current surface is served through the bounded route, - // consolidation's current centroid is the active supersession identity. - // Historical embeddings remain durable lineage but no longer form a second - // competing candidate population for the same memory. - if (current_search_proof.bounded_current_surface - && state->processor_surface_complete) - { - if (coverage_proven) - *coverage_proven = true; - return std::vector{}; - } - - if (historical_surface_search_cache_internal:: + // A bounded sparse result is a candidate set, not an exact coverage proof. + // Keep the historical proof path active so an omitted current candidate can + // still be recovered before supersession edges are written. + if (!current_search_proof.bounded_current_surface + && historical_surface_search_cache_internal:: CurrentPopulationCoversHistorical (*state, memory_id)) { if (coverage_proven) diff --git a/src/operations/sparse_retrieval_knobs_internal.hpp b/src/operations/sparse_retrieval_knobs_internal.hpp index 53d3d257..9773d761 100644 --- a/src/operations/sparse_retrieval_knobs_internal.hpp +++ b/src/operations/sparse_retrieval_knobs_internal.hpp @@ -1,5 +1,7 @@ #pragma once +#include "cortext/core/knobs.hpp" + #include #include #include @@ -35,6 +37,16 @@ BackfillBatchSize (double focus, double sensitivity, double stability) std::lround (64.0 + 64.0 * f + 32.0 * s + 32.0 * t)); } +inline int +ActiveSignalEmbeddingCapacity (double focus, double sensitivity, + double stability) +{ + const double t = ClampUnit (stability); + return std::max ( + BackfillBatchSize (focus, sensitivity, stability), + static_cast (core::NCtx (t) + core::KCtx (t))); +} + inline int ActivationIdentityTarget (double focus, double sensitivity, double stability) diff --git a/src/signal_processor.cpp b/src/signal_processor.cpp index 86fd86b5..ae8098b3 100644 --- a/src/signal_processor.cpp +++ b/src/signal_processor.cpp @@ -2474,6 +2474,9 @@ LoadRecentContext (Store &store, ProcessorContext &ctx, " LEFT JOIN cortext_active_signal_embeddings a " " ON a.signal_id = s.signal_id " " LEFT JOIN embeddings e ON s.embedding_id = e.embedding_id " + " WHERE NOT EXISTS (" + " SELECT 1 FROM cortext_active_signal_embeddings LIMIT 1" + " ) OR a.signal_id IS NOT NULL " " ORDER BY s.timestamp DESC, s.signal_id DESC " " LIMIT ?" ") ORDER BY timestamp ASC, signal_id ASC", diff --git a/tests/cortext.test.cpp b/tests/cortext.test.cpp index b9155acd..3b281bb7 100644 --- a/tests/cortext.test.cpp +++ b/tests/cortext.test.cpp @@ -1668,6 +1668,68 @@ TEST_CASE ("Cortext filters mixed signal blobs to the memory surface", REQUIRE (TextFromMemory (memory) == source_text); } +TEST_CASE ("Fallback hydration applies its bound after surface filtering", + "[cortext][objstore][hydration][bounded][aist]") +{ + ScopedTempDb temp_db; + const auto &db_path = temp_db.path (); + auto store = cortext::SQLiteStore::Create (db_path); + cortext::testing::InitializeCoreSchema (*store); + + constexpr long long kMemoryId = 702; + constexpr int kLimit = 128; + std::vector embedding (256, 0.0f); + embedding[0] = 1.0f; + store->Execute ( + "INSERT INTO embeddings (embedding_id, embedding, created_at) " + "VALUES (?, ?, 0)", + { kMemoryId, embedding }); + store->Execute ( + "INSERT INTO memories (memory_id, embedding_id, source_id, kind, " + "start_ts, end_ts, n_signals, modality, strength, created_at) " + "VALUES (?, ?, 'opaque/mixed', 'LONG_TERM', 0, 300, ?, 'text', 1, 0)", + { kMemoryId, kMemoryId, static_cast (kLimit + 1) }); + + const std::string expected = "older matching text payload"; + const std::vector text_payload (expected.begin (), + expected.end ()); + const auto text_blob_rows = store->Execute ( + "SELECT objstore_put(?1) AS id", { text_payload }); + const auto text_blob_id = BlobFromAny (text_blob_rows[0].at ("id")); + store->Execute ( + "INSERT INTO signals(memory_id, embedding_id, source_id, timestamp, " + "modality, mime, blob_id, serial_position, created_at) " + "VALUES (?, ?, 'opaque/mixed', 0, 'text', 'text/plain', ?, 0, 0)", + { kMemoryId, kMemoryId, text_blob_id }); + + const std::vector invalid_text_payload + = { 0, 1, 2, 3, 255 }; + const auto invalid_blob_rows = store->Execute ( + "SELECT objstore_put(?1) AS id", { invalid_text_payload }); + const auto invalid_blob_id = BlobFromAny (invalid_blob_rows[0].at ("id")); + for (int serial = 1; serial <= kLimit; ++serial) + { + store->Execute ( + "INSERT INTO signals(memory_id, embedding_id, source_id, " + "timestamp, modality, mime, blob_id, serial_position, created_at) " + "VALUES (?, ?, 'opaque/mixed', ?, 'text', 'text/plain', ?, ?, ?)", + { kMemoryId, kMemoryId, static_cast (serial), + invalid_blob_id, static_cast (serial), + static_cast (serial) }); + } + + cortext::Cortext::Config cfg; + auto ctx = cortext::Cortext::Create (cfg, db_path); + REQUIRE (ctx != nullptr); + const auto hydrated = ctx->DebugHydrateForTest ({ kMemoryId }, {}); + REQUIRE (hydrated.retrieved_memory.size () == 1); + REQUIRE (hydrated.retrieved_memory[0].content.size () == 1); + REQUIRE (TextFromMemory (hydrated.retrieved_memory[0]) == expected); + REQUIRE (hydrated.output.operation_ms.at ( + "Cortext.fallback_hydration_signal_rows") + == 1.0); +} + TEST_CASE ("Cortext hydrates SoftAnchor metadata with retrieved memories", "[cortext][hydration][soft_anchor][aist]") { diff --git a/tests/operations_memory_storage.test.cpp b/tests/operations_memory_storage.test.cpp index 1cf59e81..a3595bd9 100644 --- a/tests/operations_memory_storage.test.cpp +++ b/tests/operations_memory_storage.test.cpp @@ -633,20 +633,30 @@ TEST_CASE ("Active signal embedding ring obeys knob-derived capacities", "[operations][memory_storage][embedding_population][knobs]") { namespace ring = operations::active_signal_embedding_ring_internal; - const std::vector> points = { - { 0.5, 0.5, 0.5 }, { 0.0, 0.0, 0.0 }, { 1.0, 1.0, 1.0 }, - { 0.0, 0.5, 0.5 }, { 1.0, 0.5, 0.5 }, { 0.5, 0.0, 0.5 }, - { 0.5, 1.0, 0.5 }, { 0.5, 0.5, 0.0 }, { 0.5, 0.5, 1.0 } - }; - + std::vector> points; + for (const double focus : { 0.0, 0.5, 1.0 }) + for (const double sensitivity : { 0.0, 0.5, 1.0 }) + for (const double stability : { 0.0, 0.5, 1.0 }) + points.emplace_back (focus, sensitivity, stability); + + REQUIRE (ring::Capacity (0.0, 0.0, 0.0) == 64); + REQUIRE (ring::Capacity (0.5, 0.5, 0.5) == 151); + REQUIRE (ring::Capacity (1.0, 1.0, 1.0) == 266); + + auto store = SQLiteStore::Create (":memory:"); + cortext::testing::InitializeCoreSchema (*store); for (const auto &[focus, sensitivity, stability] : points) { - auto store = SQLiteStore::Create (":memory:"); - cortext::testing::InitializeCoreSchema (*store); + store->Execute ("DELETE FROM cortext_active_signal_embeddings"); + store->Execute ("DELETE FROM signals"); const int capacity = ring::Capacity (focus, sensitivity, stability); REQUIRE (capacity == operations::sparse_retrieval_knobs_internal:: - BackfillBatchSize (focus, sensitivity, stability)); + ActiveSignalEmbeddingCapacity ( + focus, sensitivity, stability)); + REQUIRE (capacity + >= static_cast (core::NCtx (stability) + + core::KCtx (stability))); auto tx = store->Begin (); for (long long signal_id = 1; signal_id <= capacity + 3; ++signal_id) @@ -684,9 +694,9 @@ TEST_CASE ("Active signal embedding ring obeys knob-derived capacities", REQUIRE (AnyToLongLong (rows[0].at ("max_capacity")) == capacity); } - auto resized_store = SQLiteStore::Create (":memory:"); - cortext::testing::InitializeCoreSchema (*resized_store); - auto resized_tx = resized_store->Begin (); + store->Execute ("DELETE FROM cortext_active_signal_embeddings"); + store->Execute ("DELETE FROM signals"); + auto resized_tx = store->Begin (); std::vector embedding (kEmbeddingDim, 0.0f); embedding[0] = 1.0f; for (long long signal_id = 1; signal_id <= 131; ++signal_id) @@ -703,7 +713,7 @@ TEST_CASE ("Active signal embedding ring obeys knob-derived capacities", 0.0); } resized_tx->Commit (); - const auto resized_rows = resized_store->Execute ( + const auto resized_rows = store->Execute ( "SELECT COUNT(*) AS n, MIN(signal_id) AS first_id, " "MAX(signal_id) AS last_id, MIN(capacity) AS min_capacity, " "MAX(capacity) AS max_capacity " @@ -1060,10 +1070,13 @@ TEST_CASE ("Large supersession population uses the knob-bounded SQLite route", SignalProcessor::Config cfg; cortext::testing::RequireEncoder (cfg); + cfg.focus = 0.0; + cfg.sensitivity = 0.0; + cfg.stability = 0.0; const auto parameters = sqlite_route::DeriveParameters ( cfg.focus, cfg.sensitivity, cfg.stability); - REQUIRE (parameters.route_capacity == 512); - REQUIRE (parameters.backfill_batch_size == 128); + REQUIRE (parameters.route_capacity == 256); + REQUIRE (parameters.backfill_batch_size == 64); const std::size_t population = parameters.route_capacity + 1; ProcessorContext pctx; @@ -1164,7 +1177,7 @@ TEST_CASE ("Large supersession population uses the knob-bounded SQLite route", "MemoryStorage.supersession_sparse_route_node_rows")); REQUIRE (ctx.GetOperationTimings ().at ( "MemoryStorage.supersession_historical_rows_visited") - == 0.0); + == static_cast (population + 1)); REQUIRE (ctx.GetOperationTimings ().at ( "MemoryStorage.supersession_historical_coverage_proven") == 1.0); diff --git a/tests/signal_processor.test.cpp b/tests/signal_processor.test.cpp index 36604502..9f9805de 100644 --- a/tests/signal_processor.test.cpp +++ b/tests/signal_processor.test.cpp @@ -1433,6 +1433,66 @@ struct SetOrCaptureThroughputOp : IOperation } }; +TEST_CASE ("SignalProcessor restart restores only exact ring embeddings for " + "the full knob-derived context window", + "[processor][recent_context][restart][knobs]") +{ + namespace ring = operations::active_signal_embedding_ring_internal; + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + cortext::testing::InitializeCoreSchema (*store); + + SignalProcessor::Config cfg; + cortext::testing::RequireEncoder (cfg); + cfg.focus = 0.5; + cfg.sensitivity = 0.5; + cfg.stability = 0.5; + const int capacity = ring::Capacity ( + cfg.focus, cfg.sensitivity, cfg.stability); + REQUIRE (capacity == 151); + + const Eigen::VectorXf centroid + = Eigen::VectorXf::Constant (256, -1.0f); + cortext::testing::SeedEmbeddingV2 (*store, 1, centroid, 0); + auto tx = store->Begin (); + for (long long signal_id = 1; signal_id <= capacity; ++signal_id) + { + tx->Execute ( + "INSERT INTO signals(signal_id, source_id, embedding_id, " + "timestamp, modality, created_at) " + "VALUES (?, 'opaque/restart', 1, ?, 'text', ?)", + { signal_id, signal_id, signal_id }); + std::vector exact (256, 0.0f); + exact[0] = static_cast (signal_id); + ring::Upsert (*tx, signal_id, exact, signal_id, cfg.focus, + cfg.sensitivity, cfg.stability); + } + tx->Commit (); + + ProcessorContext *captured = nullptr; + auto capture = std::make_unique (); + capture->context_address = &captured; + Signal signal; + signal.embedding = Eigen::VectorXf::Zero (256); + signal.timestamp = static_cast (capacity + 1); + signal.source_id = "opaque/observer"; + signal.modality = "image"; + signal.mimetype = "image/test"; + SignalProcessor restarted ( + cfg, store, + std::make_unique (std::move (capture))); + restarted.Process (signal); + + REQUIRE (captured != nullptr); + REQUIRE (captured->recent_context_embeddings.size () + == static_cast (capacity)); + for (int index = 0; index < capacity; ++index) + { + REQUIRE (captured->recent_context_embeddings[ + static_cast (index)][0] + == static_cast (index + 1)); + } +} + TEST_CASE ("SignalProcessor processes and flushes to SQLite", "[processor]") { auto uniq = SQLiteStore::Create (":memory:"); From d2213ea42f58666509ef96b22c86dca55d280584 Mon Sep 17 00:00:00 2001 From: gabewillen Date: Tue, 21 Jul 2026 11:35:13 -0500 Subject: [PATCH 16/18] Fix Windows checkout and review findings --- .gitattributes | 1 + .../paper-traceability-audit-v2.json | 6 +- .../paper-traceability-current-state-v2.json | 53 +++++--- .../paper-traceability-manifest-v1.json | 4 +- ...trator-goal-mdscript-converted.mdscript.md | 13 +- ...new-p2-post-push-record-review.mdscript.md | 61 +++++++++ ...ter-pr6-latest-three-p2-repair.mdscript.md | 58 ++++++++ docs/paper/_manuscript/index.md | 128 ++++++++++++++---- docs/paper/sections/10_implementation.qmd | 55 ++++++-- docs/paper/sections/11_optimization.qmd | 35 ++++- .../active_signal_embedding_ring_internal.hpp | 28 +++- src/operations/competition.cpp | 18 +-- src/operations/graph_retrieval.cpp | 6 + src/operations/rif_state_internal.hpp | 24 ++-- tests/operations_competition.test.cpp | 57 ++++++++ tests/operations_graph_retrieval.test.cpp | 70 ++++++++++ tests/signal_processor.test.cpp | 71 ++++++++++ 17 files changed, 599 insertions(+), 89 deletions(-) create mode 100644 comments/consolidation-drift-retrigger/20260721T151500Z-implementer-three-new-p2-post-push-record-review.mdscript.md create mode 100644 comments/consolidation-drift-retrigger/20260721T160600Z-implementer-pr6-latest-three-p2-repair.mdscript.md diff --git a/.gitattributes b/.gitattributes index 67a14518..c0a2d61b 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,3 +1,4 @@ data/surnames/surnames.csv filter=lfs diff=lfs merge=lfs -text data/surnames/forenames.csv filter=lfs diff=lfs merge=lfs -text data/raw/personachat/personachat.tgz filter=lfs diff=lfs merge=lfs -text +cmake/hnswlib-prefetch-bounds.patch text eol=lf diff --git a/artifacts/flat_storage_cost/paper-traceability-audit-v2.json b/artifacts/flat_storage_cost/paper-traceability-audit-v2.json index 5f6de2c2..80a41b24 100644 --- a/artifacts/flat_storage_cost/paper-traceability-audit-v2.json +++ b/artifacts/flat_storage_cost/paper-traceability-audit-v2.json @@ -1,14 +1,14 @@ { "generated_claim_mismatches": [], "inventory_count": 70, - "manifest_sha256": "367c139ca373cd3f4bccfa782a2c2a0d3acf61a3a4b0d5f41c1f5035b8d7927d", - "manuscript_sha256": "a13d1df5bbefe8560bcea0d14168847683cd56d2e15b43c5cf9a000e35d3e235", + "manifest_sha256": "03f2d608ded5f837609c4badb721dfe98dec1e4fc63be39b8847f0f7d4f54000", + "manuscript_sha256": "d7a14688db8027ea446037881d648f87b04360536c1bd775ca505b2cdb0273d6", "missing_source_claims": [], "ownership_violations": [], "passed": true, "proof_level_violations": [], "record_count": 70, "schema": "cortext_paper_traceability_audit_v1", - "state_sha256": "850b81160180a0fde2d16c6eca83669a0ff89e42617741c53777f3dec49444bb", + "state_sha256": "1bfe47fdafd5e6392289d7d36c4967478858ca9cffeed6ed29f63ffb01b0fee0", "uncovered_inventory": [] } diff --git a/artifacts/flat_storage_cost/paper-traceability-current-state-v2.json b/artifacts/flat_storage_cost/paper-traceability-current-state-v2.json index b1c60595..66f855b0 100644 --- a/artifacts/flat_storage_cost/paper-traceability-current-state-v2.json +++ b/artifacts/flat_storage_cost/paper-traceability-current-state-v2.json @@ -117,19 +117,20 @@ ] }, "pr6_exact_head_ci_repair": { - "decision": "fourteen-review-thread-repair-active", + "decision": "seventeen-review-thread-repair-active", "prior_exact_head": "764e4af202a91120dae85e1d6b0d69e2ce97aa5d", "implementation_repair_commit": "89a06084dd05710f90572c1b7bac7e17fab79122", "followup_repair_commit": "25cf7b130e87837d0ed813b0e0ffda5a50701651", "monitor_head_binding": "resolve the live GitHub PR head at every re-entry because a repository record cannot content-address its own containing record-only commit", - "current_exact_head_ci": "Windows zig-cli-install on follow-up head 25cf7b13 still rejected the build-local HNSW patch through git apply --directory after slash normalization; the active candidate runs git apply from inside the build-local output and all other check conclusions must be resolved live from GitHub at every re-entry", + "current_exact_head_ci": "implementation and record repair head cca844d758bc9ad7ddd12048932c274da514d8a6 is synchronized with current main; eleven checks are green, including Linux sanitizer, and Windows job 88675883348 is the only failure because checkout converted the unified HNSW patch to CRLF before git apply --check", "windows_zig_path_repair": { "failing_job": "zig-cli-install (windows-latest, cortext_cli.exe)", "failing_head": "25cf7b130e87837d0ed813b0e0ffda5a50701651", "cause": "normalizing the relative --directory path was insufficient on the Windows Zig/Git/CMake runtime; git apply still rejected the copied pinned source before compilation", - "repair": "run both git apply content check and application with the build-local output as the working directory, passing no host-native output path through Git path parsing", - "local_proof": "Zig text-only passes 12/12 and a space-bearing build-local output passes patch application plus complete reverse verification", - "review": "fresh round-one all-findings and separately fresh final cumulative P1 reviews are Proven with no P1 finding; the repair is retained inside the current three-thread candidate", + "repair": "run both git apply content check and application with the build-local output as the working directory, passing no host-native output path through Git path parsing; preserve the unified diff as LF through an exact .gitattributes text eol=lf checkout rule", + "local_proof": "fresh Zig text-only check passes 12/12; core.autocrlf=true checkout preserves zero carriage returns; the LF patch applies cleanly and an otherwise identical CRLF stream reproduces corrupt-patch rejection", + "working_directory_review": "the earlier working-directory-only repair received a fresh clean all-findings round one and separately fresh clean P1 final cumulative review before it was retained in the three-thread candidate", + "eol_repair_review": "fresh round one independently passed the LF checkout and Zig 12/12 proof and found no implementation/config defect; its two P2 record defects were repaired; a different fresh round two is Proven at P1/P2 and a separately fresh final cumulative review is Proven at P1", "proof_not_claimed": "Windows validation remains owned by replacement exact-head CI" }, "review": { @@ -152,7 +153,11 @@ "final_cumulative_verdict": "Proven at the separately fresh P1 threshold with no P1 finding", "review_boundary": "an old smaller exact-signal ring can temporarily restore fewer than Q vectors after a knob increase, but missing vectors are never replaced by aggregate memory centroids", "record_review": "the exactly-one fresh non-code review found one P2 executable-handoff defect; it is directly corrected without rereview and all other record surfaces were verified clean", - "next_gate": "final validation, non-force push, proof-backed thread replies and resolution, and replacement exact-head CI" + "implementation_commit": "cca844d758bc9ad7ddd12048932c274da514d8a6", + "thread_disposition": "all three repaired threads received exact proof replies and are resolved", + "post_push_record_review": "the exactly-one review found the live Windows failure plus noncanonical review ownership; both records are directly corrected without rereview and the lane returns to CI repair", + "active_ci_repair": "pin cmake/hnswlib-prefetch-bounds.patch to text eol=lf so Windows checkout preserves valid unified-diff bytes without platform-specific algorithm behavior", + "next_gate": "local proof, fresh recursive code review, final record review, non-force push, and resulting exact-head CI" }, "review_threads": [ "https://github.com/augmem/cortext/pull/6#discussion_r3620394273", @@ -168,7 +173,10 @@ "PRRT_kwDOR3IQMM6SjHe1", "PRRT_kwDOR3IQMM6SlrZb", "PRRT_kwDOR3IQMM6SlrZd", - "PRRT_kwDOR3IQMM6SlrZg" + "PRRT_kwDOR3IQMM6SlrZg", + "PRRT_kwDOR3IQMM6SopGj", + "PRRT_kwDOR3IQMM6SopGm", + "PRRT_kwDOR3IQMM6SopGo" ], "repairs": [ "calibrate migrated lazy-RIF state transactionally before working-memory hydration and rebuild the disposable epoch from committed persistent authority", @@ -188,12 +196,16 @@ "include the CMake HNSW preparation and patch assets in the Zig package allowlist", "size the exact active-signal embedding ring as max(B, NCtx+KCtx), covering all 27 low/mid/high F/S/T points and the full restart context window", "apply the B fallback hydration limit after modality, MIME, and payload-shape acceptance by walking newest-first keyset pages, preserving chronological output while explicitly giving up a bounded scan claim for malformed legacy history", - "treat sparse supersession activation as candidates rather than an exact coverage certificate, retaining exact historical proof or SQLite fallback even though this can restore history-sized write work" + "treat sparse supersession activation as candidates rather than an exact coverage certificate, retaining exact historical proof or SQLite fallback even though this can restore history-sized write work", + "backfill the migration-30 empty active-signal ring with the newest knob-derived legacy exact-vector window before the first post-migration aggregate-linked write", + "resolve legacy embedding-only RIF candidates to every memory sharing the embedding while retaining the ordinary structured memory-scoped path", + "fall back to exact SQL seed discovery when ASSOCIATION filtering underfills a sparse HNSW proposal" ], "source_sha256": { "signal_processor": "0fb2b4d064531bbbfd86c270072e4f60b454b8db7059d9274603e3de7c784306", "rif_cache_header": "55985ae0d5d0d69480ae3a3d8204779faec8b23f2051e2e924b8de31e1d130a8", "hnswlib_patch": "4180985795ccdac233cf7c50e82ec0bb2108fd191aece8951f8cedc12932d54a", + "gitattributes": "d02282fbe47c88f47aa402c0a1e37acebc87cad5a7a907aca8d958810c84b3e3", "hnswlib_patch_driver": "206cb0646480afa8237758a83d47a7778e56e1eed011474f714a73cb0f0e984b", "zig_build": "f4a36709d3eeab3be92bd5300e7d071621290189b24d13fdc4976e6c04d9d8ce", "zig_hnswlib_prepare": "f2ea37b7bfaca95edcb3b6486120b0d0c6c33060b32d96a40f46fafdd53e2773", @@ -208,26 +220,32 @@ "emotion_cascade_test": "47b0d780994832bbd36f06fcba4abee9d2935ad0267b4c9bd9e7cb6659df5afe", "schema_source": "b4c3b0c873fd225781d1eab856a82b3fc2868909f131f867031c71c792f9fbe3", "migration_test": "4e76c44cc7ec9d5a1ec26fb963c1291c7f98e47b65050bac8ff4ff0df09b64cc" - ,"active_signal_embedding_ring": "9d0e575cecad9159b15b02c0e75c3349ba5931e83c9acadeabc5aee2868e498d" + ,"active_signal_embedding_ring": "01a6d8cdab4dc973a634d499785993427fbc7c83fceb5c78669c78dc3ad1f6af" ,"sparse_retrieval_knobs": "d99e020e322c5d28dc1dacbd72c6a650f0eaa4f3561758c379cc62b1d58793ef" ,"cortext_hydration": "0ba377e833452cd13520d34c1bf57eaf3a8df5da3607780845a0e6931aa291eb" ,"memory_storage": "2c662b5bdbe22dba92a39335ea5959cf22f38dcaa0cc78e19f19a3aa352f182f" ,"memory_storage_test": "7f8eade4e9b0124551296f6cad3d0a183db07785749fc38dd082665261b154f7" ,"cortext_test": "52d2e143f793a3446616bd5d22a4798dddd609b56d9504ac2a9ea2d317e442dd" - ,"signal_processor_test": "af1b6a1dbffed60755b5488e37b9450a1b3b6a48892587a1f9ef02694746dfbd" + ,"signal_processor_test": "ae69155678e8daa057d02ff11de9f7c04e2836117d6966a6b1f0eb06ca96ac62" + ,"rif_state_internal": "5e0a58aedfc0db22317bf613fc25297820d138feb6da8621942b1bf23f555ae1" + ,"competition_source": "8310f808cda958c6ec09213608deb994f1c74864cb4a77a49f516b7874af143e" + ,"competition_test": "3751cb6fea2ad83962a264fc8be3f496bf623835d804b2d5f0979e89cd3aee06" + ,"graph_retrieval_source": "a7e1c1f92b91d18164167fffa0550797f72b4b0a167430d4acc703673082985d" + ,"graph_retrieval_test": "fa60d62e9141b92c9096634ecfdd7ce06d472b3ff7a1e43791b476080d3174b2" }, "local_proof": { "preceding_full_media_ctest": "preceding exact candidate: clean Debug LLVM 21 media-enabled suite with experiment hooks enabled: 38,730 assertions in 697 cases", "preceding_full_media_test_binary_sha256": "0fd25b6e322913cb0e76e3aa5a1fbcc6836d8696b6bbd5886224a3144fea1ec8", - "current_full_media_ctest": "exact three-thread repaired candidate: clean Debug LLVM 21 media-enabled suite with experiment hooks enabled: 39,081 assertions in 701 cases", - "current_full_media_test_binary_sha256": "53191a9bf94bcbf19537a66acba4b41ef8e4d349f10c37a878d84df79adc2bc1", + "current_full_media_ctest": "exact cumulative LF-checkout and seventeen-thread repaired candidate: clean Debug LLVM 21 media-enabled suite with experiment hooks enabled: 39,245 assertions in 704 cases", + "current_full_media_test_binary_sha256": "c5508e7b083d77cac768b717c04af0862cf64d7c48d339e5a3aa1c0f6b00f068", "rif_focus": "312 assertions in 19 cases", "hnsw_focus": "the exact canonical-entry reactivation, missing-snapshot ordinary-search restart, and prior-snapshot-free recenter rebuild regressions pass in the four-case 107-assertion follow-up set", "consolidation_focus": "the four-case follow-up set passes 107 assertions, including both clustered-row prefilter arms, the eligible-only inactive query plan, and migration 34 structure", - "zig_build_local_patch": "Zig text-only passes 12/12 after removing the host-path argument; a space-bearing build-local output passes patch application and complete reverse verification; the global hnswlib cache remains unpatched and the patch file is an explicit build input", + "zig_build_local_patch": "fresh Zig text-only check passes 12/12; a core.autocrlf=true checkout retains an LF-only patch that applies cleanly, while the CRLF-adversarial stream is rejected as corrupt; the build-local patch remains an explicit input and the global hnswlib cache remains unpatched", "new_review_thread_focus": "27-point active-signal ring proof passes 225 assertions; a neutral exact restart passes 154 assertions; adversarial fallback hydration passes 5 assertions; sparse supersession exact-coverage regression passes 15 assertions; broader MemoryStorage passes 451 assertions in 20 cases and hydration passes 173 assertions in 13 cases", + "latest_review_thread_focus": "migration-30 exact-ring upgrade passes 155 assertions; embedding-only shared-memory RIF passes 5 assertions; sparse ASSOCIATION underfill fallback passes 4 assertions; broader recent-context passes 309 assertions in 2 cases, competition passes 331 assertions in 17 cases, and SQLite HNSW retrieval passes 2,638 assertions in 21 cases", "wasm_bundle": "built successfully with Emscripten 4.0.18", - "focused_test_binary_sha256": "53191a9bf94bcbf19537a66acba4b41ef8e4d349f10c37a878d84df79adc2bc1", + "focused_test_binary_sha256": "c5508e7b083d77cac768b717c04af0862cf64d7c48d339e5a3aa1c0f6b00f068", "wasm_sha256": "17d31e0a61327e91d7a53577b73689442583d5f4c84aa76d5844ac309e9791aa" }, "sanitizer_proof": { @@ -242,8 +260,11 @@ "modality_branch": false }, "unresolved_limits": [ - "Windows execution and replacement exact-head CI for the Zig working-directory repair remain pending", - "the three newest P2 thread repairs have full applicable proof and completed recursive review; final record review, push, proof-backed replies, resolution, and replacement exact-head CI remain pending", + "Windows execution and replacement exact-head CI for the LF checkout repair remain pending", + "the three newest P2 review-thread repairs have focused, broader, and full-suite deterministic proof; the current user waived the local recursive blind-review loop for bot-comment repairs, so the replacement-head PR bot rereview, non-force push, proof-backed replies, and exact-head CI remain", + "legacy embedding-only RIF compatibility may perform work proportional to shared-embedding membership; ordinary structured competition remains memory-scoped", + "sparse graph retrieval falls back to the exact SQL seed path when operation-specific eligibility filtering underfills, so store-sized fallback work remains possible", + "the three newest P2 thread repairs have full applicable proof and completed recursive review, are pushed at cca844d758bc9ad7ddd12048932c274da514d8a6, and their proof-backed threads are resolved; resulting exact-head CI remains pending", "an old smaller exact-signal ring can temporarily restore fewer than Q exact vectors after a knob increase until new writes refill it; aggregate memory centroids are not substituted", "fallback hydration output remains capped at B, but malformed or nonmatching legacy history can require more than B candidate rows to be inspected", "exact supersession verification can remain history-sized after bounded sparse current-candidate selection, so flat write cost is not claimed", diff --git a/artifacts/flat_storage_cost/paper-traceability-manifest-v1.json b/artifacts/flat_storage_cost/paper-traceability-manifest-v1.json index a8cc80bc..3f3dbc54 100644 --- a/artifacts/flat_storage_cost/paper-traceability-manifest-v1.json +++ b/artifacts/flat_storage_cost/paper-traceability-manifest-v1.json @@ -798,9 +798,9 @@ }, { "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", - "decision": "fourteen-review-thread-repair-active", + "decision": "seventeen-review-thread-repair-active", "evidence_fingerprints": [ - "728f7517ec8ffc0ee8aed0308b604c64c2d385190a88fb99c48da0dafb658b05" + "7673c0666deab0b3b97fd58a48f2d948c420541fea939649ece19e2e4830bbfc" ], "evidence_kind": "measured", "inventory_id": "state:pr6_exact_head_ci_repair", diff --git a/comments/consolidation-drift-retrigger/20260716T205900Z-orchestrator-goal-mdscript-converted.mdscript.md b/comments/consolidation-drift-retrigger/20260716T205900Z-orchestrator-goal-mdscript-converted.mdscript.md index 71c05aab..5011bd74 100644 --- a/comments/consolidation-drift-retrigger/20260716T205900Z-orchestrator-goal-mdscript-converted.mdscript.md +++ b/comments/consolidation-drift-retrigger/20260716T205900Z-orchestrator-goal-mdscript-converted.mdscript.md @@ -5,13 +5,13 @@ owner_role: implementer lane_id: consolidation-drift-retrigger status: monitoring implementation_status: complete -monitor_status: three-new-p2-ready-to-push +monitor_status: windows-lf-and-three-latest-p2-repair source_of_truth: current repository, current user corrections, this goal, task comments, exact private profiles and audits, and GitHub PR 6 only after implementation completion model: gpt-5.6-terra reasoning: high model_selection_basis: cross-cutting C++ and SQLite implementation, deterministic bounded-work proof, research traceability, and PR ownership canonical_monitor_entry: true -updated_at: 20260721T151000Z +updated_at: 20260721T160600Z --- @@ -38,7 +38,7 @@ updated_at: 20260721T151000Z * focused production-default derivation, route work, active-epoch reset, shared Natural/Durable path, Durable-barrier non-replay, source/modality, Python audit, and evidence-builder tests pass on the current release build * preceding exact-head historical proof recorded all algorithm and experiment changes, accepted adverse timing, maturity boundary, failed-recenter rollback repair, exact-head CI repairs, and nonclaims in `docs/paper/sections/10_implementation.qmd` and `docs/paper/sections/11_optimization.qmd`; that preceding manuscript SHA-256 was `caa8ebead662209cfb55bad9c23638108b74d27497f594eab35006b792fabbc8` and is superseded by the current packet below * on that preceding exact head, the clean Debug LLVM 21 media-enabled suite with experiment hooks enabled passed 38,730 assertions in 697 cases on test binary SHA-256 `0fd25b6e322913cb0e76e3aa5a1fbcc6836d8696b6bbd5886224a3144fea1ec8`. Its complete SQLite-HNSW suite passed 2,614 assertions in 20 cases; focused RIF passed 312 assertions in 19 cases; the complete Python tool suite passed 159 tests; complete hnswlib patch reverse-check and `git diff --check` passed; and WebAssembly rebuilt with Emscripten 4.0.18. This is historical preceding-head evidence, not the current follow-up binary/result binding. A local UBSan-only build completes, but macOS denies its runtime library before `main()` on code-signing policy, so replacement Linux CI owns sanitizer execution -* the current-state overlay, rebuilt 70-record manifest, and fail-closed audit have raw-file SHA-256 values `06b7071e414737c94f39befbb1e1b7c10985a90a72da4502bab50acbb2d67164`, `50842d8b70fafe5cda86d755edf590a499c1f9e17bcfc43f9602aceb447d0466`, and `f79b5d226b26975729c22fd32a763125202518a977b2f526d729355b9f1ed885`; the audit passes with 70/70 inventory records and no uncovered inventory, claim mismatch, proof-level violation, or ownership violation; its normalized state and manifest SHA-256 values are `850b81160180a0fde2d16c6eca83669a0ff89e42617741c53777f3dec49444bb` and `367c139ca373cd3f4bccfa782a2c2a0d3acf61a3a4b0d5f41c1f5035b8d7927d`, and the regenerated manuscript SHA-256 is `a13d1df5bbefe8560bcea0d14168847683cd56d2e15b43c5cf9a000e35d3e235` +* the current-state overlay, rebuilt 70-record manifest, and fail-closed audit have raw-file SHA-256 values `9ce8a2f3c2cc26b930139f58610552b9202beb8e4547680b57e66f34cc4b9898`, `6558aa35a0ea5ccd9b86eac4302141d34c48eb235eea468f37068766ab5c5f36`, and `717399ecc94647b7264cae7082713c9892508dc79fe7ac0a6d0cc61c14572532`; the audit passes with 70/70 inventory records and no uncovered inventory, claim mismatch, proof-level violation, or ownership violation; its normalized state and manifest SHA-256 values are `1bfe47fdafd5e6392289d7d36c4967478858ca9cffeed6ed29f63ffb01b0fee0` and `03f2d608ded5f837609c4badb721dfe98dec1e4fc63be39b8847f0f7d4f54000`, and the regenerated manuscript SHA-256 is `d7a14688db8027ea446037881d648f87b04360536c1bd775ca505b2cdb0273d6` * the original recursive cutover review remains complete. The exact-head CI repair then received a fresh round one that found one P2 unguarded empty-adjacency HNSW prefetch; repair tree `d3ce8c1ada4ab13023cbcd40959c8a8a878b5307` guards it and adds deterministic update/reseal coverage. A different fresh round-two reviewer proved the complete repair at the P1/P2 threshold with no blocking finding. Its sole P3 control-record hygiene residual was corrected directly; a later append-only project correction record dated 2026-07-21 discloses the earlier in-place continuation mutation, supersedes that compromised provenance, synchronizes the task, and restores the missing lane-ledger history without exposing a machine-local path * fresh round-three cumulative review of baseline tree `156dd7bc27b7cda2c661a9467bfddfe72c771e8a` to candidate tree `71b079ec217128513e593f54bdb308f18a03d8eb` was Proven at P1 with no P1 findings. Round four reviewed candidate `5ea10c156fe6072961b7c43af97b2ac34ed30037` and found no implementation P1, but correctly rejected its stale audit and prior-candidate proof identities at P1. After that repair, a different fresh round-five reviewer proved exact candidate tree `0b4069c73955147da28add9b9eaea480bad48249` for source health at the P1 threshold with no P1 findings. One below-threshold P2 residual remains visible: the bounded cache ranks the global flashbulb prefix before recency/arousal filtering, while the SQL fallback filters eligibility before `LIMIT`. This does not regress the public thread's required intensity-before-truncation order, but full cache/fallback selection equivalence remains unclaimed * the required single non-code review reproduced the merged-state 70/70 trace audit and found two record defects: the external task still capped schema authority at migrations 29/30 and named obsolete head `b7f9e27`, while four current implementer comments lacked the complete metadata and Evidence/Questions/Stop Report shape. Both findings are directly corrected and validated without rereview as required; no code changed after the Proven round-five source candidate @@ -51,10 +51,15 @@ updated_at: 20260721T151000Z * separately fresh final cumulative review of Windows working-directory repair tree `e6e2c994bb8e8f1f03ed38fd8cc8a9f829f23835` is Proven at P1 with no P1 finding. During that review, three new P2 threads arrived. The active candidate expands the exact signal-vector ring to `Q=max(B,NCtx+KCtx)` and verifies all 27 low/mid/high knob points plus a 151-vector neutral restart; applies fallback hydration's B output cap after surface acceptance through keyset pages; and removes sparse supersession's false exact-coverage certificate so exact historical proof or SQLite fallback remains active. Focused proof passes 225 ring assertions, 154 restart assertions, 5 adversarial hydration assertions, 15 sparse-supersession assertions, 451 assertions in 20 MemoryStorage cases, and 173 assertions in 13 hydration cases. The complete media-enabled suite passes 39,081 assertions in 701 cases on exact binary SHA-256 `53191a9bf94bcbf19537a66acba4b41ef8e4d349f10c37a878d84df79adc2bc1`; Python passes 159, Zig text-only passes 12/12, paper render passes, and traceability passes 70/70. The corrected tradeoffs are explicit: malformed legacy hydration scans and exact supersession verification can exceed B and grow with history, so flat write cost and production-wide boundedness remain unclaimed. Fresh recursive review remains pending before push, reply, or resolution * fresh round-one review of exact cumulative tree `8853b49239f04c846d01a4743bbf7e883cfd2a8d` is Proven at the all-findings threshold with no P1/P2/P3 finding or residual. The reviewer accepted the knob-increase restart boundary as an explicit exact-only nonclaim: an old smaller ring can temporarily provide fewer than Q vectors, but aggregate memory centroids are never substituted for missing exact signal vectors. Separately fresh final cumulative review is Proven at P1 with no P1 finding after independently rerunning the four repaired regressions for 399 assertions, matching binary SHA-256 `53191a9bf94bcbf19537a66acba4b41ef8e4d349f10c37a878d84df79adc2bc1`, reproducing traceability 70/70, and inspecting live PR state. The three repaired threads remain unresolved on pushed head `25cf7b130e87837d0ed813b0e0ffda5a50701651` until the reviewed replacement is pushed. Two P3 residuals remain visible: same-level reactivation tie behavior is not isolated, and the legacy external project goal remains a stale active discovery surface * the exactly-one fresh final record review verified exact identities, live PR state, independently reproduced traceability 70/70, proof/nonclaim boundaries, authority, chronology, and both P3 residuals. Its sole P2 finding was a noncanonical executable handoff comment and incomplete reviewer identity in the append-only ledger. The comment now has canonical metadata, Summary/Next states, typed stop fields, a bound re-entry, and explicit reviewer model ownership; an append-only ledger correction names the reviewer and selection basis. The finding is corrected directly without rereview as required, and no code changed after either Proven code review +* implementation and record repair commit `cca844d758bc9ad7ddd12048932c274da514d8a6` is pushed without force. All three repaired threads received exact commit/proof replies and are resolved; there are no review requests. The branch is synchronized with current main `1bf3f1c5f6470bb8c4d458a0389c19c5123f9b81`, GitHub reports OPEN/non-draft and MERGEABLE/UNSTABLE, and all 12 replacement exact-head checks are in progress with no failure. One fresh non-code review of this post-push transition remains before a record-only push and final exact-head monitoring +* the single post-push record review caught a live state change and one control defect. On exact head `cca844d758bc9ad7ddd12048932c274da514d8a6`, Windows job `88675883348` failed the HNSW patch content check after checkout converted the unified diff to CRLF; at that snapshot four checks were green and seven remained in progress. Local adversarial proof reproduces clean application with LF and a corrupt patch with CRLF. The active repair adds `cmake/hnswlib-prefetch-bounds.patch text eol=lf`, preserving one algorithm across platforms. The review's second P2—noncanonical review mode, stop reason, and reviewer ownership—is corrected directly without rereview. The record-only push is cancelled; current proof, fresh code review, and replacement exact-head CI are required +* the LF checkout repair passes a fresh `core.autocrlf=true` indexed checkout with zero carriage returns, forward `git apply --check`, the intentionally CRLF-mutated corrupt-patch control, and a fresh Zig text-only 12/12 check whose HNSW preparation step ran successfully. The paper and generated manuscript record the failed Windows experiment and checkout invariant; traceability passes 70/70. Fresh round-one review independently reproduced the proof and found no implementation/config defect; its two P2 record findings were repaired before the completed round-two and final-cumulative reviews recorded next +* after a parent-visible corrected round-two start, different fresh reviewer `/root/review_pr6_eol_r2b` proved the LF checkout candidate at P1/P2 with no threshold finding or residual. Separately fresh final cumulative reviewer `/root/review_pr6_eol_final` proved the same exact candidate at P1. Both reviewers are consumed and terminal; Windows execution remains owned by replacement exact-head CI +* exact pushed head `cca844d758bc9ad7ddd12048932c274da514d8a6` has 11 green checks, including Linux sanitizer, and only Windows job `88675883348` failed. Three new P2 threads are locally repaired: migration 30 backfills the newest knob-derived legacy exact-signal window before the first aggregate-linked write; legacy embedding-only RIF suppresses every memory sharing the embedding in stable identity order; and an ASSOCIATION-filtered underfilled sparse seed proposal falls back to exact SQL. Focused proof passes 155, 5, and 4 assertions; broader recent-context, competition, and SQLite HNSW groups pass 309, 331, and 2,638 assertions. The complete media-enabled suite passes 39,245 assertions in 704 cases on test binary SHA-256 `c5508e7b083d77cac768b717c04af0862cf64d7c48d339e5a3aa1c0f6b00f068`; Python passes 159, Zig text-only passes 12/12, the paper renders, and traceability passes 70/70. The current user explicitly waived the local recursive blind-review loop for these bot-comment repairs; the interrupted local reviewer produced no verdict, and the PR bot's replacement-head rereview is the review owner after push ## PR Monitor Hot Path -* validate the directly corrected final record packet, push the reviewed replacement without force, reply with exact proof, resolve the three threads, and refresh all live PR state +* bind the exact cumulative LF plus three-thread candidate, commit and push without force, then let the PR bot rereview the replacement head; keep the three threads open until that live rereview and exact-head CI are inspected, reply and resolve only with proof-backed current-head evidence, and continue monitoring CI, comments, review requests, unresolved threads, base drift, and conflicts * every ten minutes in this current task, refresh PR 6 exact head, checks, mergeability, reviews, review requests, comments, and unresolved threads; compare with the prior state and report only changes * repair only in-scope failures or review findings with proportionate proof and the required fresh review; push without force and update this goal to the new exact head * stop and deactivate the heartbeat when the PR merges or closes externally, repair exceeds scope, target drift is unrecoverable, or authority is explicitly denied diff --git a/comments/consolidation-drift-retrigger/20260721T151500Z-implementer-three-new-p2-post-push-record-review.mdscript.md b/comments/consolidation-drift-retrigger/20260721T151500Z-implementer-three-new-p2-post-push-record-review.mdscript.md new file mode 100644 index 00000000..2e867859 --- /dev/null +++ b/comments/consolidation-drift-retrigger/20260721T151500Z-implementer-three-new-p2-post-push-record-review.mdscript.md @@ -0,0 +1,61 @@ +--- +task_id: consolidation-drift-retrigger +role: implementer +author: proxy-gabe-implementer +status: repairing +event_type: pr6-three-new-p2-post-push-record-direct-correction +event_exec: /mdscript-exec comments/consolidation-drift-retrigger/20260716T205900Z-orchestrator-goal-mdscript-converted.mdscript.md#resume-goal +claim_scope: three-new-p2-post-push-record-source-health +proof_decision: single post-push record review consumed; two P2 findings directly corrected by routing to the live Windows CI repair and canonical reviewer ownership +parent_visible: true +resolves: + - consolidation-drift-retrigger-three-new-p2-final-record-review +supersedes: [] +created_at: 20260721T151500Z +updated_at: 20260721T152000Z +model: gpt-5.6-terra +reasoning: high +model_selection_basis: exact pushed-head binding, GitHub review state, CI ownership, traceability, and resumable PR monitoring require high reasoning +review_round: single-non-code +review_mode: single-non-code +blocking_severities: all-findings +implementation_commit: cca844d758bc9ad7ddd12048932c274da514d8a6 +reviewer: /root/review_pr6_post_push_records +reviewer_model: gpt-5.6-terra +reviewer_reasoning: high +reviewer_model_selection_basis: live CI contradiction, exact MDScript transition state, trace, GitHub review state, and executable repair ownership require high reasoning +--- + + +## Summary + +* The reviewed implementation and record repair is pushed without force at `cca844d758bc9ad7ddd12048932c274da514d8a6` on current main. All three proved threads have exact replies and are resolved. +* During the exactly-one fresh non-code review, Windows failed the replacement head's HNSW patch content check. The record-only push is cancelled; the lane returns to in-scope CI repair, local proof, and fresh code review. +* The same review found this comment's review mode, stop reason, and reviewer ownership incomplete. Those fields are corrected directly without rereview. The existing implementation reviews remain historical proof; the new `.gitattributes` repair receives its own code-review gate. + +## Evidence + +* PR 6 is OPEN, non-draft, MERGEABLE/UNSTABLE; head `cca844d758bc9ad7ddd12048932c274da514d8a6`; base/current main `1bf3f1c5f6470bb8c4d458a0389c19c5123f9b81`. +* changed live check state at review: 12 total, 4 success, 1 Windows failure, 7 in progress; review requests: 0; unresolved threads: 0. +* Windows job `88675883348` failed because the checked-out unified diff reached `git apply --check` with CRLF. Local adversarial reproduction passes for LF and fails as corrupt for CRLF; the repair pins that exact patch to `text eol=lf` in `.gitattributes`. +* proof and review remain bound to 39,081 assertions in 701 cases on binary SHA-256 `53191a9bf94bcbf19537a66acba4b41ef8e4d349f10c37a878d84df79adc2bc1`, 159 Python tests, Zig 12/12, traceability 70/70, clean all-findings round one, and clean separately fresh final cumulative P1 review. + +## Questions + +* None. The two review findings are directly actionable within existing CI-repair and record-maintenance authority. + +## Next + +* Prove the LF checkout repair locally, update paper/trace records, run fresh recursive code review, then push the repair without force and monitor replacement exact-head CI. + +## Stop Report + +* stop_reason=paused +* verdict=post-push record review consumed with two P2 findings; record-only push cancelled +* proof_decision=direct record correction complete; LF checkout code repair requires proof and fresh code review +* next_owner=consolidation-drift-retrigger implementer +* next_action=prove and review the LF patch checkout invariant, push without force, and monitor replacement exact-head CI +* blocker=fresh code proof and review pending; Windows acceptance remains owned by replacement CI +* proof_not_claimed=CI repair acceptance, push, replacement exact-head CI success, Windows execution success, flat write cost, bounded malformed-legacy hydration scan, bounded exact historical supersession verification, merge-readiness, merge, close, release, deployment, publication, or live proof +* cleanup_status=/root/review_pr6_post_push_records consumed and terminal; do not reuse +* resume_command=/mdscript-exec comments/consolidation-drift-retrigger/20260716T205900Z-orchestrator-goal-mdscript-converted.mdscript.md#resume-goal diff --git a/comments/consolidation-drift-retrigger/20260721T160600Z-implementer-pr6-latest-three-p2-repair.mdscript.md b/comments/consolidation-drift-retrigger/20260721T160600Z-implementer-pr6-latest-three-p2-repair.mdscript.md new file mode 100644 index 00000000..738b496a --- /dev/null +++ b/comments/consolidation-drift-retrigger/20260721T160600Z-implementer-pr6-latest-three-p2-repair.mdscript.md @@ -0,0 +1,58 @@ +--- +task_id: consolidation-drift-retrigger +role: implementer +author: proxy-gabe-implementer +status: proving +event_type: pr6-latest-three-p2-review-thread-repair +event_exec: /mdscript-exec comments/consolidation-drift-retrigger/20260716T205900Z-orchestrator-goal-mdscript-converted.mdscript.md#resume-goal +claim_scope: windows-lf-and-three-latest-p2-source-health +proof_decision: Windows LF checkout repair is review-Proven; three later P2 thread repairs pass focused and broader deterministic proof and await complete proof plus fresh recursive review +parent_visible: true +resolves: [] +supersedes: [] +created_at: 20260721T160600Z +updated_at: 20260721T160600Z +model: gpt-5.6-terra +reasoning: high +model_selection_basis: C++ SQLite migration compatibility, RIF identity semantics, HNSW fallback completeness, Windows Zig CI, proof, review, and PR ownership require high reasoning +review_round: implementation +review_mode: code-repair +blocking_severities: all-findings +--- + + +## Summary + +* The Windows CLI failure is locally repaired at the checkout boundary: `.gitattributes` pins the unified HNSW patch to LF, a `core.autocrlf=true` checkout retains zero carriage returns and applies cleanly, the CRLF adversary fails as corrupt, and Zig text-only passes 12/12. Fresh round two is Proven at P1/P2 and a separately fresh final cumulative review is Proven at P1 for that EOL slice. +* Three new P2 threads arrived on pushed head `cca844d758bc9ad7ddd12048932c274da514d8a6`. The active candidate backfills the migration-30 exact-signal ring before the first aggregate-linked write, suppresses every shared-memory sibling on the legacy embedding-only RIF path, and falls back to exact SQL when association filtering underfills sparse HNSW seed candidates. +* The paper, generated manuscript, and fail-closed trace packet describe all three repairs and their nonclaims. Full media proof remains in progress; no push, reply, or resolution occurs before the recursive review gate. + +## Evidence + +* live PR: OPEN, non-draft, MERGEABLE/UNSTABLE, synchronized with current main; 11 checks green, Windows job `88675883348` is the only failure; no review requests; three unresolved P2 threads `PRRT_kwDOR3IQMM6SopGj`, `PRRT_kwDOR3IQMM6SopGm`, and `PRRT_kwDOR3IQMM6SopGo` +* focused repair proof: 155 migration-ring assertions, 5 shared-embedding RIF assertions, and 4 sparse-underfill assertions +* broader proof: recent-context 309 assertions in 2 cases; competition 331 assertions in 17 cases; SQLite HNSW retrieval 2,638 assertions in 21 cases +* supporting proof: Python 159 tests; Zig text-only 12/12; paper render; paper traceability 70/70 +* complete media-enabled CTest is still running and therefore is not yet claimed + +## Questions + +* None. All three findings are in-scope correctness repairs and preserve the existing public API, SQLite authority, one Natural/Durable operation path, modality/source-id independence, and existing quality contract. + +## Next + +* Finish complete media proof, bind the exact candidate tree and binary, update the goal/task/ledger, create a parent-visible round-one start record, and run the required fresh recursive review before any push or thread resolution. + +## Stop Report + +* stop_reason=paused +* verdict=in-scope repair active with focused and broader deterministic proof +* proof_decision=Windows LF slice Proven; three new thread repairs await full media proof and recursive review +* blocking_findings=three repaired P2 threads remain unresolved until reviewed replacement head is pushed +* residual_findings=legacy embedding-only RIF work may scale with shared-embedding membership; sparse underfill may restore store-sized exact SQL fallback +* next_owner=consolidation-drift-retrigger implementer +* next_action=finish full proof, review exact cumulative candidate, push without force, then reply and resolve only after proof +* blocker=full media proof and fresh recursive review pending +* proof_not_claimed=full-suite acceptance, review acceptance, push, thread resolution, Windows execution success, replacement exact-head CI, fixed legacy embedding-only work, fixed sparse fallback work, flat write cost, bounded restart, Durable plateau, production-wide boundedness, merge, close, release, deployment, publication, or live proof +* cleanup_status=all Windows EOL reviewers are consumed and terminal; no active reviewer +* resume_command=/mdscript-exec comments/consolidation-drift-retrigger/20260716T205900Z-orchestrator-goal-mdscript-converted.mdscript.md#resume-goal diff --git a/docs/paper/_manuscript/index.md b/docs/paper/_manuscript/index.md index ceeb6621..546bbafa 100644 --- a/docs/paper/_manuscript/index.md +++ b/docs/paper/_manuscript/index.md @@ -5523,6 +5523,17 @@ because aliases, wildcards, views, subqueries, and triggers cannot be classified safely from SQL text. A caller mutation also invalidates every database-derived processor cache before the statement executes. +The engine’s structured competition records carry `memory_id`, so +ordinary retrieval-induced inhibition remains scoped to exactly one +losing memory. Legacy callers may instead provide only an embedding +identity. Because several memories may share that embedding, +compatibility resolution enumerates every matching memory in stable +identity order and applies the same suppression to each one. This +prevents one arbitrary sibling from escaping inhibition, but it also +means the embedding-only compatibility edge may perform work +proportional to the shared-embedding membership. It is not included in +the fixed memory-scoped operation claim. + On startup from schema 27, migration may anchor active rows that carry different historical suppression timestamps to one recovery clock. The processor calibrates those rows transactionally and rebuilds the @@ -5865,6 +5876,16 @@ route-metadata row and survive reopen; malformed, stale, duplicate, or over-capacity metadata invalidates the route. Graph and memory rows remain authoritative in SQLite. +Sparse HNSW activation is candidate generation rather than an +eligibility-complete seed surface. Routing nodes such as `ASSOCIATION` +memories may consume activated slots and are then removed by the public +long-term seed predicate. If that filtering leaves fewer than the +requested candidate limit, the operation discards the underfilled sparse +proposal and executes the existing exact SQL seed path. Consequently the +fixed sparse envelope is not misrepresented as complete after +operation-specific filtering; the fallback may still perform store-sized +exact work. + Decoded activation-snapshot rows reuse the route’s existing generation-qualified shadow-node cache rather than being selected and decoded again for every query. The first query after reopen loads only @@ -5960,10 +5981,16 @@ header-only dependency into a build-local declared output and patches that copy, leaving the content-addressed global package cache immutable and safe for concurrent builds. The patch is checked and applied with the build-local output as the working directory, so no host-native -output path is passed through Git’s path parser. The patch itself is -also a declared build input, so changing it invalidates the preparation -step instead of reusing a stale patched output. Local POSIX proof -passes; replacement Windows CI remains the execution owner. The Zig +output path is passed through Git’s path parser. The first replacement +Windows run still rejected the patch content check: Windows checkout had +converted the unified diff to CRLF, which reproduces locally as a +corrupt patch even though the same bytes with LF apply cleanly. The +repository therefore marks this exact patch `text eol=lf`; this is a +checkout invariant, not a platform-specific algorithm branch. The patch +itself is also a declared build input, so either content or +checkout-contract changes invalidate the preparation step instead of +reusing a stale patched output. Local POSIX and CRLF-adversarial proof +pass; replacement Windows CI remains the execution owner. The Zig package manifest includes the `cmake` directory so downstream package consumers receive both the preparation script and its content-checked patch rather than only the top-level build graph. @@ -6479,19 +6506,28 @@ old or new knob-derived capacity throughout the transition. When the ring contains rows, recent-context restart hydration admits only signals with an exact ring vector; it does not silently substitute -a memory centroid for a missing per-signal vector. A pre-ring database -with no exact rows retains the legacy centroid fallback. This means an -older store whose prior ring was smaller can temporarily restore a -shorter exact context until new writes fill *Q*, rather than mixing -aggregate vectors into an apparently full exact window. The global -vector index consequently contains memory centroids rather than a -growing population of signal-only decoys. The schema and routing code -contain no modality or `source_id` branch; text, audio, image, shared, -and opaque sources enter after encoding through the same slot formula. -Direct regressions cover mixed modality/source labels, knob changes, all -27 low/mid/high F/S/T combinations, and a 151-vector neutral restart -whose restored identities equal the exact signal vectors. This does not -claim bounded whole-engine restart. +a memory centroid for a missing per-signal vector. Migration 30 itself +creates an empty ring, so the first capacity check copies the newest *Q* +signal vectors from their `signals.embedding_id` references. The main +MemoryStorage path performs that check before it inserts +aggregate-linked rows. The auxiliary working-memory persistence path may +insert its new aggregate-linked row first, but the same `Upsert` +immediately replaces that row’s ring slot with the exact event vector, +leaving the newest *Q* slots exact in either ordering. A truly empty +legacy database remains empty. Once any exact ring row exists, an older +store whose prior ring was smaller can temporarily restore a shorter +exact context until new writes fill *Q*, rather than mixing aggregate +vectors into an apparently full exact window. The global vector index +consequently contains memory centroids rather than a growing population +of signal-only decoys. The schema and routing code contain no modality +or `source_id` branch; text, audio, image, shared, and opaque sources +enter after encoding through the same slot formula. Direct regressions +cover mixed modality/source labels, knob changes, all 27 low/mid/high +F/S/T combinations, and a 151-vector neutral restart whose restored +identities equal the exact signal vectors. A separate upgrade regression +starts from 150 legacy exact signals, performs the first post-migration +aggregate-linked write, and restores all 151 exact vectors; it passes +155 assertions. This does not claim bounded whole-engine restart. Emotional propagation separately limits enqueued mutation statements to the existing activation target *A* = 2*C* + 2*B*. This is a hard bound @@ -6638,14 +6674,17 @@ The current branch includes the following implementation-level changes: replace per-event recovery of every active row with a persistent global log clock, indexed exact-threshold expiry, generation resets, and a bounded connection-local SQLite active-epoch projection; publish the -projection only after the shared persistent commit +projection only after the shared persistent commit; resolve a legacy +embedding-only loser to every memory sharing that embedding effective strength, suppression, timestamp, 10−9 freeze, restart, rollback, caller SQL, eviction, and deterministic ranking remain exact; publication failure rebuilds from persistent authority without replay; Natural and Durable use the same transaction and Durable adds only its checkpoint barrier; no source-id or modality branch and no full-history -projection +projection; ordinary structured competition remains memory-scoped, while +legacy embedding-only compatibility work may scale with shared-embedding +membership vector ranking @@ -6739,10 +6778,12 @@ explicitly unclaimed graph retrieval score vector similarity first, restrict recency to a tie-break, cap -graph bonus, and reserve final occupancy for direct semantic -anchors +graph bonus, reserve final occupancy for direct semantic anchors, and +reject an underfilled sparse seed proposal after operation-specific +eligibility filtering recent unrelated rows and noisy graph neighbors cannot displace the -semantic seed surface +semantic seed surface; ASSOCIATION routing rows cannot +consume sparse slots and suppress the exact SQL fallback rollback snapshots @@ -8895,14 +8936,41 @@ envelope or hide a later active identity. The CMake and Zig build graphs apply the same content-checked HNSW bounds patch; Zig patches a build-local copy rather than mutating its shared package cache, and runs Git’s content check and apply from inside that output so no host-native -output path crosses Git’s path parser. The patch is a declared build -input, so a patch-only change invalidates the preparation step. Local -POSIX proof passes, while replacement Windows CI remains required; the -Zig package allowlist now carries the `cmake` preparation and patch -assets used by that build graph. The RIF changed-row counter now records -work performed by the current event rather than the historical active -population. Each correction has a red-then-green regression and changes -measurement, not public retrieval semantics. +output path crosses Git’s path parser. The next Windows run exposed a +distinct checkout boundary: CRLF conversion made the unified diff +corrupt to `git apply`, while an LF copy of the same patch applied +cleanly in a local adversarial reproduction. The exact patch now has a +repository `text eol=lf` rule. The patch is a declared build input, so a +patch-content or checkout-contract change invalidates the preparation +step. Local POSIX and CRLF-adversarial proof pass, while replacement +Windows CI remains required; the Zig package allowlist now carries the +`cmake` preparation and patch assets used by that build graph. The RIF +changed-row counter now records work performed by the current event +rather than the historical active population. Each correction has a +red-then-green regression and changes measurement, not public retrieval +semantics. + +The same exact-head review exposed three compatibility and completeness +edges. First, migration 30’s empty active-signal ring could admit the +first new aggregate-linked signal before capturing the legacy exact +tail. The repaired first capacity check backfills the newest knob-sized +window; MemoryStorage does so before aggregate insertion, while the +auxiliary working-memory `Upsert` immediately overwrites its +just-inserted row with the supplied exact vector. The 150-plus-one +upgrade regression passes 155 assertions. Second, embedding-only legacy +RIF input had selected one arbitrary memory even when several memories +shared the embedding; the repaired compatibility path suppresses all +such siblings in stable order, and its focused regression passes 5 +assertions. The ordinary structured path still supplies `memory_id` and +remains single-memory work; no fixed bound is claimed for the legacy +shared-embedding expansion. Third, `ASSOCIATION` rows could consume +sparse seed slots and then be filtered, leaving the result underfilled +while suppressing exact fallback. The repaired route rejects that +underfilled proposal and restores the SQL path; its 700-node regression +passes 4 assertions. Broader recent-context, competition, and SQLite +HNSW groups pass 309, 331, and 2,638 assertions respectively. These are +deterministic source-health and completeness experiments, not new +long-horizon performance or whole-engine boundedness evidence. The remaining consolidation scan was bounded by the same knobs. Let *A* = 2*C* + 2*B* and *N* = max (8, ⌊*B*/2⌋). Score consolidation now diff --git a/docs/paper/sections/10_implementation.qmd b/docs/paper/sections/10_implementation.qmd index 20cf3e87..75d337dd 100644 --- a/docs/paper/sections/10_implementation.qmd +++ b/docs/paper/sections/10_implementation.qmd @@ -101,6 +101,16 @@ statement because aliases, wildcards, views, subqueries, and triggers cannot be classified safely from SQL text. A caller mutation also invalidates every database-derived processor cache before the statement executes. +The engine's structured competition records carry `memory_id`, so ordinary +retrieval-induced inhibition remains scoped to exactly one losing memory. +Legacy callers may instead provide only an embedding identity. Because several +memories may share that embedding, compatibility resolution enumerates every +matching memory in stable identity order and applies the same suppression to +each one. This prevents one arbitrary sibling from escaping inhibition, but it +also means the embedding-only compatibility edge may perform work proportional +to the shared-embedding membership. It is not included in the fixed +memory-scoped operation claim. + On startup from schema 27, migration may anchor active rows that carry different historical suppression timestamps to one recovery clock. The processor calibrates those rows transactionally and rebuilds the disposable @@ -431,6 +441,15 @@ identity list live in the single SQLite route-metadata row and survive reopen; malformed, stale, duplicate, or over-capacity metadata invalidates the route. Graph and memory rows remain authoritative in SQLite. +Sparse HNSW activation is candidate generation rather than an +eligibility-complete seed surface. Routing nodes such as `ASSOCIATION` memories +may consume activated slots and are then removed by the public long-term seed +predicate. If that filtering leaves fewer than the requested candidate limit, +the operation discards the underfilled sparse proposal and executes the +existing exact SQL seed path. Consequently the fixed sparse envelope is not +misrepresented as complete after operation-specific filtering; the fallback +may still perform store-sized exact work. + Decoded activation-snapshot rows reuse the route's existing generation-qualified shadow-node cache rather than being selected and decoded again for every query. The first query after reopen loads only snapshot identities absent from that @@ -519,10 +538,16 @@ patch. The Zig graph copies the header-only dependency into a build-local declared output and patches that copy, leaving the content-addressed global package cache immutable and safe for concurrent builds. The patch is checked and applied with the build-local output as the working directory, so no -host-native output path is passed through Git's path parser. The patch itself is -also a declared build input, so changing it invalidates the preparation step -instead of reusing a stale patched output. Local POSIX proof -passes; replacement Windows CI remains the execution owner. The Zig package +host-native output path is passed through Git's path parser. The first +replacement Windows run still rejected the patch content check: Windows +checkout had converted the unified diff to CRLF, which reproduces locally as a +corrupt patch even though the same bytes with LF apply cleanly. The repository +therefore marks this exact patch `text eol=lf`; this is a checkout invariant, +not a platform-specific algorithm branch. The patch itself is also a declared +build input, so either content or checkout-contract changes invalidate the +preparation step instead of reusing a stale patched output. Local POSIX and +CRLF-adversarial proof pass; replacement Windows CI remains the execution +owner. The Zig package manifest includes the `cmake` directory so downstream package consumers receive both the preparation script and its content-checked patch rather than only the top-level build graph. @@ -1010,18 +1035,26 @@ capacity throughout the transition. When the ring contains rows, recent-context restart hydration admits only signals with an exact ring vector; it does not silently substitute a memory -centroid for a missing per-signal vector. A pre-ring database with no exact -rows retains the legacy centroid fallback. This means an older store whose -prior ring was smaller can temporarily restore a shorter exact context until -new writes fill $Q$, rather than mixing aggregate vectors into an apparently -full exact window. The global vector index consequently +centroid for a missing per-signal vector. Migration 30 itself creates an empty +ring, so the first capacity check copies the newest $Q$ signal vectors from +their `signals.embedding_id` references. The main MemoryStorage path performs +that check before it inserts aggregate-linked rows. The auxiliary +working-memory persistence path may insert its new aggregate-linked row first, +but the same `Upsert` immediately replaces that row's ring slot with the exact +event vector, leaving the newest $Q$ slots exact in either ordering. A truly +empty legacy database remains empty. Once any exact ring row exists, an +older store whose prior ring was smaller can temporarily restore a shorter +exact context until new writes fill $Q$, rather than mixing aggregate vectors +into an apparently full exact window. The global vector index consequently contains memory centroids rather than a growing population of signal-only decoys. The schema and routing code contain no modality or `source_id` branch; text, audio, image, shared, and opaque sources enter after encoding through the same slot formula. Direct regressions cover mixed modality/source labels, knob changes, all 27 low/mid/high F/S/T combinations, and a 151-vector neutral -restart whose restored identities equal the exact signal vectors. This does -not claim bounded whole-engine restart. +restart whose restored identities equal the exact signal vectors. A separate +upgrade regression starts from 150 legacy exact signals, performs the first +post-migration aggregate-linked write, and restores all 151 exact vectors; it +passes 155 assertions. This does not claim bounded whole-engine restart. Emotional propagation separately limits enqueued mutation statements to the existing activation target $A=2C+2B$. This is a hard bound on writes, not a diff --git a/docs/paper/sections/11_optimization.qmd b/docs/paper/sections/11_optimization.qmd index 54689243..2b9889b8 100644 --- a/docs/paper/sections/11_optimization.qmd +++ b/docs/paper/sections/11_optimization.qmd @@ -59,7 +59,7 @@ The current branch includes the following implementation-level changes: | Area | Optimization | Behavior contract | |---|---|---| | SQLite execution | prepared-statement reuse in the store layer | same SQL semantics, lower repeated parse overhead | -| retrieval-induced inhibition | replace per-event recovery of every active row with a persistent global log clock, indexed exact-threshold expiry, generation resets, and a bounded connection-local SQLite active-epoch projection; publish the projection only after the shared persistent commit | effective strength, suppression, timestamp, $10^{-9}$ freeze, restart, rollback, caller SQL, eviction, and deterministic ranking remain exact; publication failure rebuilds from persistent authority without replay; Natural and Durable use the same transaction and Durable adds only its checkpoint barrier; no source-id or modality branch and no full-history projection | +| retrieval-induced inhibition | replace per-event recovery of every active row with a persistent global log clock, indexed exact-threshold expiry, generation resets, and a bounded connection-local SQLite active-epoch projection; publish the projection only after the shared persistent commit; resolve a legacy embedding-only loser to every memory sharing that embedding | effective strength, suppression, timestamp, $10^{-9}$ freeze, restart, rollback, caller SQL, eviction, and deterministic ranking remain exact; publication failure rebuilds from persistent authority without replay; Natural and Durable use the same transaction and Durable adds only its checkpoint barrier; no source-id or modality branch and no full-history projection; ordinary structured competition remains memory-scoped, while legacy embedding-only compatibility work may scale with shared-embedding membership | | vector ranking | bounded top-k selection and architecture SIMD kernels in the vector path | same candidate contract; SIMD accepted after output checks | | retrieval seed surface | current-memory embedding lookup with pre-cap supersession filtering; immutable normalized and stored/Hadamard block summaries cached per private surface entry; exact partial squared-distance rejection plus complementary sound 32-block Cauchy--Schwarz bounds in the stored and Walsh--Hadamard bases before exact cosine family checks; shared vectors retain all long-term metadata alternatives; the private search cache follows the processor's latest reconstruction surface independently of persisted-current materialization; cache loss uses the complete processor surface directly or, only when that surface is incomplete, metadata-eligible, distance-ordered, F/S/T-bounded SQL pages feeding one cross-page cosine-family index that substitutes latest reconstructions before accounting | latest reconstruction and eligible shared-embedding siblings remain visible, byte-distinct near-duplicate boilerplate and stale base families that converge after reconstruction cannot consume the semantic-family candidate budget, sparse and dense orthogonal vector families avoid broad exact cosine work, recovery does not return the complete result at once, ephemeral recovery does not mutate the registry, and source/modality metadata cannot influence rank; sqlite-vec still scans linearly for every requested SQL page, the historical window partition may internally sort and materialize the full eligible history, and the knob-derived top-k bounds only rows returned to C++ and decoded downstream rather than claiming sublinear search or bounded internal sorter memory | | graph expansion | retained traversal types: `co_occurs`, `similar_to`, `reinforces`, `causes`, `derived_from`, `next_in_episode`, `prev_in_episode`, and `within_same_event`; `reinforces` is degree-normalized | graph activation is bounded and high-degree hubs cannot dominate; directional `supersedes` relations define families but are not activation edges | @@ -67,7 +67,7 @@ The current branch includes the following implementation-level changes: | reconstruction | knob-bounded retrieval-time reconstruction append | constructive recall remains non-decoder and can be disabled cleanly | | memory storage | avoid redundant object-store writes for single-signal memory payloads | durable payload identity is preserved | | supersession neighbor ranking | below the sparse cutover, or whenever the route is unpublished, overflowing, or invalid, maintain private current/base embedding surfaces and retain the exact historical-coverage proof and SQL fallback; above the knob-derived cutover, reuse the SQLite HNSW activation surface, inspect an $8C$ post-consolidation floor that advances by $R=\max(2,\lfloor B/16\rfloor)$ to a $9C$ ceiling, rerank at most $A=2C+2B$ activated current centroids, then require the historical cache's exact coverage/ranking proof or retain SQLite fallback rather than treating the sparse result as complete | the current sparse-candidate query remains bounded by $9C+A$, but exact historical verification may remain history-sized; timestamp, kind, duplicate band, similarity threshold, edge limit, deterministic tie order, rollback, source/modality independence, and public API shape remain unchanged; write throughput and production-wide boundedness are explicitly unclaimed | -| graph retrieval | score vector similarity first, restrict recency to a tie-break, cap graph bonus, and reserve final occupancy for direct semantic anchors | recent unrelated rows and noisy graph neighbors cannot displace the semantic seed surface | +| graph retrieval | score vector similarity first, restrict recency to a tie-break, cap graph bonus, reserve final occupancy for direct semantic anchors, and reject an underfilled sparse seed proposal after operation-specific eligibility filtering | recent unrelated rows and noisy graph neighbors cannot displace the semantic seed surface; `ASSOCIATION` routing rows cannot consume sparse slots and suppress the exact SQL fallback | | rollback snapshots | detach rebuildable durable caches, deep-copy the internal execution-sidecar state only for full snapshots, move the private accumulator map, and detach working-memory signal-record and blob-reference vectors before copying remaining processor state; journal active-source vector lengths for ordinary appends and lazily deep-back up only the active source before accepted storage, flush reset, or interrupt reset can mutate prior records; trim working-memory appends and move an evicted slot's record ownership into the journal; reserve a full-map hook for explicit foreign-source accumulator-topology mutation | non-boundary Natural ingestion does not recopy the growing pending unit or source map; a one-source flush does not copy unrelated open-source or working-memory history; failed writes and public no-store queries restore durable and volatile state exactly; public state layout and retention semantics are unchanged | | emotional cascade metadata | maintain a private rebuildable cache of per-memory emotional rows, per-embedding shared-member minima, recency-ordered flashbulb sources, and the expandable topology footprint of the last fixed point; update it at the same successful storage, consolidation, cascade, association, and eviction decisions and rehydrate it after journal-aware rollback; caller-supplied roots invalidate the sidecar before forwarding their first transaction statement, while cache-only roots retain their exact snapshot; share breadth-first edge visits across source-order 64-bit batches while retaining a distinct visited bit and radius for every source | source eligibility and stable tie order, shared-embedding `MIN`/`MAX` semantics, shortest depth per source, first-source-wins ordering, custom raw-SQL updates within the current transaction, update decisions, and durable database state match the scalar path; an inserted edge outside every source's remaining-radius footprint advances the fixed point without a graph walk, topology rebuilds invalidate conservatively, batches continue for arbitrary source counts, and neither path keys behavior by source id or modality; ordinary engine-owned snapshot work still copies zero store-sized cache entries | | synaptic tagging | use indexed temporal candidate supersets with boundary ties before applying the original exact score and order | the same nearest source-backed memories are tagged without a whole-source group scan | @@ -1488,9 +1488,13 @@ consume the fixed envelope or hide a later active identity. The CMake and Zig build graphs apply the same content-checked HNSW bounds patch; Zig patches a build-local copy rather than mutating its shared package cache, and runs Git's content check and apply from inside that output so no host-native output path -crosses Git's path parser. The -patch is a declared build input, so a patch-only change invalidates the -preparation step. Local POSIX proof passes, while replacement Windows CI remains required; the Zig +crosses Git's path parser. The next Windows run exposed a distinct checkout +boundary: CRLF conversion made the unified diff corrupt to `git apply`, while +an LF copy of the same patch applied cleanly in a local adversarial +reproduction. The exact patch now has a repository `text eol=lf` rule. The +patch is a declared build input, so a patch-content or checkout-contract change +invalidates the preparation step. Local POSIX and CRLF-adversarial proof pass, +while replacement Windows CI remains required; the Zig package allowlist now carries the `cmake` preparation and patch assets used by that build graph. The RIF changed-row counter now records work performed by the current @@ -1498,6 +1502,27 @@ event rather than the historical active population. Each correction has a red-then-green regression and changes measurement, not public retrieval semantics. +The same exact-head review exposed three compatibility and completeness edges. +First, migration 30's empty active-signal ring could admit the first new +aggregate-linked signal before capturing the legacy exact tail. The repaired +first capacity check backfills the newest knob-sized window; MemoryStorage does +so before aggregate insertion, while the auxiliary working-memory `Upsert` +immediately overwrites its just-inserted row with the supplied exact vector. +The 150-plus-one upgrade regression passes 155 assertions. Second, +embedding-only legacy RIF input had +selected one arbitrary memory even when several memories shared the embedding; +the repaired compatibility path suppresses all such siblings in stable order, +and its focused regression passes 5 assertions. The ordinary structured path +still supplies `memory_id` and remains single-memory work; no fixed bound is +claimed for the legacy shared-embedding expansion. Third, `ASSOCIATION` rows +could consume sparse seed slots and then be filtered, leaving the result +underfilled while suppressing exact fallback. The repaired route rejects that +underfilled proposal and restores the SQL path; its 700-node regression passes +4 assertions. Broader recent-context, competition, and SQLite HNSW groups pass +309, 331, and 2,638 assertions respectively. These are deterministic +source-health and completeness experiments, not new long-horizon performance +or whole-engine boundedness evidence. + The remaining consolidation scan was bounded by the same knobs. Let $A=2C+2B$ and $N=\max(8,\lfloor B/2\rfloor)$. Score consolidation now admits at most $A$ low-effective-strength long-term identities after merging two diff --git a/src/operations/active_signal_embedding_ring_internal.hpp b/src/operations/active_signal_embedding_ring_internal.hpp index a52bf12d..a21f1315 100644 --- a/src/operations/active_signal_embedding_ring_internal.hpp +++ b/src/operations/active_signal_embedding_ring_internal.hpp @@ -55,7 +55,33 @@ EnsureCapacity (Transaction &tx, int capacity) "SELECT DISTINCT capacity FROM cortext_active_signal_embeddings " "ORDER BY capacity LIMIT 2"); if (capacity_rows.empty ()) - return; + { + // Migration 30 starts with an empty ring while pre-migration signal + // rows still reference their exact per-signal embeddings. Capture the + // newest legacy window before the first post-migration signal switches + // signals.embedding_id to the aggregate memory embedding. + auto legacy_rows = tx.Execute ( + "SELECT s.signal_id, e.embedding, " + " COALESCE(s.created_at, s.timestamp) AS created_at " + "FROM signals s " + "JOIN embeddings e ON e.embedding_id = s.embedding_id " + "ORDER BY s.timestamp DESC, s.signal_id DESC LIMIT ?", + { static_cast (capacity) }); + std::reverse (legacy_rows.begin (), legacy_rows.end ()); + for (const auto &row : legacy_rows) + { + const auto signal_id + = store::AnyToLongLong (row.at ("signal_id")).value_or (0); + const auto created_at + = store::AnyToLongLong (row.at ("created_at")).value_or (0); + if (signal_id <= 0 || !row.at ("embedding").has_value ()) + throw std::runtime_error ( + "invalid legacy active signal embedding row"); + InsertAtCapacity (tx, signal_id, row.at ("embedding"), created_at, + capacity); + } + return; + } if (capacity_rows.size () != 1) throw std::runtime_error ("mixed active signal embedding capacities"); const auto stored_capacity = store::AnyToLongLong ( diff --git a/src/operations/competition.cpp b/src/operations/competition.cpp index 922c157a..61e59373 100644 --- a/src/operations/competition.cpp +++ b/src/operations/competition.cpp @@ -179,16 +179,18 @@ ApplyLateralInhibition (const std::vector &winners, { continue; } - const auto memory_id = rif_state_internal::ResolveMemoryId ( + const auto memory_ids = rif_state_internal::ResolveMemoryIds ( tx, loser.memory_id, loser.embedding_id); - if (!memory_id.has_value ()) + if (memory_ids.empty ()) continue; - if (rif_state_internal::SuppressMemory ( - tx, *memory_id, total_supp, now_ts)) - ++active_rows; - rif_active_epoch_cache_internal::StageMemory ( - epoch, *memory_id); - ++suppressed_count; + for (const long long memory_id : memory_ids) + { + if (rif_state_internal::SuppressMemory ( + tx, memory_id, total_supp, now_ts)) + ++active_rows; + rif_active_epoch_cache_internal::StageMemory (epoch, memory_id); + ++suppressed_count; + } } } diff --git a/src/operations/graph_retrieval.cpp b/src/operations/graph_retrieval.cpp index e5e78710..4c066b55 100644 --- a/src/operations/graph_retrieval.cpp +++ b/src/operations/graph_retrieval.cpp @@ -862,6 +862,12 @@ LoadCurrentSeedRowsFromCache ( } AddSeedCachePhaseTime (profile, &SeedCacheProfile::eligibility_ms, eligibility_started); + // Sparse activation is candidate generation, not an eligibility-complete + // seed surface. Ineligible ASSOCIATION rows can consume activated slots; + // underfill must therefore fall through to the exact SQL path. + if (use_sparse_route + && ranked.size () < static_cast (candidate_limit)) + return std::nullopt; auto by_distance = [&state] ( const historical_surface_search_cache_internal::RankedEntry &a, const historical_surface_search_cache_internal::RankedEntry &b) { diff --git a/src/operations/rif_state_internal.hpp b/src/operations/rif_state_internal.hpp index 2a1ce98d..8d4219ab 100644 --- a/src/operations/rif_state_internal.hpp +++ b/src/operations/rif_state_internal.hpp @@ -436,20 +436,26 @@ AdvanceRecovery (Transaction &tx, long long now_ts, double recovery_time, return result; } -inline std::optional -ResolveMemoryId (Transaction &tx, long long memory_id, long long embedding_id) +inline std::vector +ResolveMemoryIds (Transaction &tx, long long memory_id, long long embedding_id) { if (memory_id > 0) - return memory_id; + return { memory_id }; if (embedding_id <= 0) - return std::nullopt; + return {}; const auto rows = tx.Execute ( - "SELECT memory_id FROM memories WHERE embedding_id = ? LIMIT 1", + "SELECT memory_id FROM memories WHERE embedding_id = ? " + "ORDER BY memory_id", { embedding_id }); - if (rows.empty ()) - return std::nullopt; - const long long resolved = GetInt64 (rows[0], "memory_id", 0); - return resolved > 0 ? std::optional (resolved) : std::nullopt; + std::vector resolved; + resolved.reserve (rows.size ()); + for (const auto &row : rows) + { + const long long resolved_id = GetInt64 (row, "memory_id", 0); + if (resolved_id > 0) + resolved.push_back (resolved_id); + } + return resolved; } inline bool diff --git a/tests/operations_competition.test.cpp b/tests/operations_competition.test.cpp index 151a8ce4..a3a2b1b8 100644 --- a/tests/operations_competition.test.cpp +++ b/tests/operations_competition.test.cpp @@ -277,6 +277,63 @@ TEST_CASE ("Alg21 structured retrieval suppresses shared embedding loser by memo REQUIRE (std::any_cast (rows[1].at ("suppression")) == 0.0); } +TEST_CASE ("Alg21 embedding-only compatibility suppresses every shared " + "memory row", + "[operations][competition][shared-embedding][compatibility]") +{ + auto store = std::shared_ptr ( + cortext::SQLiteStore::Create (":memory:")); + cortext::testing::InitializeCoreSchema (*store); + + SignalProcessor::Config cfg; + cortext::testing::RequireEncoder (cfg); + cfg.focus = 1.0; + cfg.sensitivity = 1.0; + cfg.stability = 0.0; + + const Eigen::VectorXf ctx_vec = Make256DEmb ({ { 0, 1.0f } }); + const Eigen::VectorXf w1 = Make256DEmb ({ { 0, 0.99f }, { 1, 0.05f } }); + const Eigen::VectorXf w2 = Make256DEmb ({ { 0, 0.98f }, { 1, 0.06f } }); + const Eigen::VectorXf w3 = Make256DEmb ({ { 0, 0.95f }, { 1, 0.10f } }); + const Eigen::VectorXf loser + = Make256DEmb ({ { 0, 0.88f }, { 1, 0.47f } }); + + SeedEmbeddingsOp seed ( + { { 1LL, w1 }, { 2LL, w2 }, { 3LL, w3 }, { 420LL, loser } }); + Signal signal = MakeSignal (ctx_vec, 100); + ProcessorContext pctx; + OperationContext ctx (signal, pctx, cfg, store.get ()); + seed.Execute (ctx, cortext::testing::GetNullTransaction ()); + cortext::testing::SeedMemoryV2 ( + *store, 100LL, 420LL, "loser/a", "LONG_TERM", 1.0, 1); + cortext::testing::SeedMemoryV2 ( + *store, 101LL, 420LL, "loser/b", "LONG_TERM", 1.0, 1); + + pctx.recent_context_embeddings.push_back (ctx_vec); + ctx.SetRetrievedMemoryEmbeddings ( + std::unordered_map{ { 1LL, w1 }, + { 2LL, w2 }, + { 3LL, w3 }, + { 420LL, loser } }); + + ApplyRetrievalCompetition op; + auto tx = store->Begin (); + op.Execute (ctx, *tx); + tx->Commit (); + + const auto rows = store->Execute ( + "SELECT memory_id, suppression FROM memories " + "WHERE memory_id IN (100, 101) ORDER BY memory_id"); + REQUIRE (rows.size () == 2); + REQUIRE (std::any_cast (rows[0].at ("suppression")) > 0.0); + REQUIRE (std::any_cast (rows[1].at ("suppression")) > 0.0); + const auto active_rows = store->Execute ( + "SELECT COUNT(*) AS n FROM rif_active_state " + "WHERE memory_id IN (100, 101)"); + REQUIRE (active_rows.size () == 1); + REQUIRE (std::any_cast (active_rows[0].at ("n")) == 2); +} + TEST_CASE ("Alg21 memory-scoped RIF recovery survives embedding fork", "[operations][competition][recovery]") { diff --git a/tests/operations_graph_retrieval.test.cpp b/tests/operations_graph_retrieval.test.cpp index f10a5b1e..82a59cb2 100644 --- a/tests/operations_graph_retrieval.test.cpp +++ b/tests/operations_graph_retrieval.test.cpp @@ -2052,6 +2052,76 @@ TEST_CASE ("Graph retrieval captures same-event exact control for sparse route", } } +TEST_CASE ("Graph retrieval falls back when associations underfill sparse " + "seed eligibility", + "[operations][graph][retrieval][hnsw][sqlite][association]" + "[regression]") +{ + cortext::testing::ScopedEnvVar disable_constructive_recall ( + "CORTEXT_DISABLE_CONSTRUCTIVE_RECALL", "1"); + cortext::testing::ScopedEnvVar hnsw_route_flag ( + "CORTEXT_HNSW_SPARSE_ROUTE", "0"); + cortext::testing::ScopedEnvVar sqlite_route_flag ( + "CORTEXT_SQLITE_SPARSE_ROUTE", "1"); + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + cortext::testing::InitializeCoreSchema (*store); + + constexpr long long kAssociationCount = 650; + constexpr long long kEligibleTarget = kAssociationCount + 1; + constexpr long long kPopulation = 700; + std::vector> route_entries; + route_entries.reserve (kPopulation); + for (long long memory_id = 1; memory_id <= kAssociationCount; + ++memory_id) + { + SeedMemory (*store, memory_id, 1000 + memory_id, UnitVec (0), + memory_id, "association/" + std::to_string (memory_id)); + store->Execute ( + "UPDATE memories SET kind = 'ASSOCIATION' WHERE memory_id = ?", + { memory_id }); + route_entries.emplace_back (memory_id, UnitVec (0)); + } + SeedMemory (*store, kEligibleTarget, 1000 + kEligibleTarget, + VectorWithCosineToDim0 (0.95f), kEligibleTarget, + "eligible/target"); + route_entries.emplace_back ( + kEligibleTarget, VectorWithCosineToDim0 (0.95f)); + for (long long memory_id = kEligibleTarget + 1; + memory_id <= kPopulation; ++memory_id) + { + SeedMemory (*store, memory_id, 1000 + memory_id, UnitVec (2), + memory_id, "eligible/" + std::to_string (memory_id)); + route_entries.emplace_back (memory_id, UnitVec (2)); + } + + const auto parameters + = operations::sparse_retrieval_route_sqlite_internal:: + DeriveParameters (0.0, 0.0, 0.0); + auto hnsw = operations::sparse_retrieval_route_internal::Route::Create ( + kEmbeddingDim, route_entries, parameters.hnsw); + REQUIRE (hnsw); + auto sqlite_route + = operations::sparse_retrieval_route_sqlite_internal::Route::Create ( + *store, kEmbeddingDim, route_entries, *hnsw, parameters); + REQUIRE (sqlite_route); + + SignalProcessor::Config cfg; + cortext::testing::RequireEncoder (cfg); + cfg.focus = 0.0; + cfg.sensitivity = 0.0; + cfg.stability = 0.0; + auto ops = std::make_unique ( + std::make_unique (), + std::make_unique ()); + SignalProcessor processor (cfg, store, std::move (ops)); + + const auto output = processor.Process (MakeSignal (UnitVec (0), 100000)); + REQUIRE (std::find (output.candidate_memory_ids.begin (), + output.candidate_memory_ids.end (), kEligibleTarget) + != output.candidate_memory_ids.end ()); + REQUIRE (operations::retrieval_trace::GetLastSqlFallbackQueryCount () == 1); +} + TEST_CASE ("Graph retrieval reopens SQLite sparse route on the existing path", "[operations][graph][retrieval][hnsw][sqlite][integration]") { diff --git a/tests/signal_processor.test.cpp b/tests/signal_processor.test.cpp index 9f9805de..671490ed 100644 --- a/tests/signal_processor.test.cpp +++ b/tests/signal_processor.test.cpp @@ -1493,6 +1493,77 @@ TEST_CASE ("SignalProcessor restart restores only exact ring embeddings for " } } +TEST_CASE ("SignalProcessor backfills the legacy exact context before the " + "first post-migration ring write", + "[processor][recent_context][restart][migration]") +{ + namespace ring = operations::active_signal_embedding_ring_internal; + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + cortext::testing::InitializeCoreSchema (*store); + + SignalProcessor::Config cfg; + cortext::testing::RequireEncoder (cfg); + cfg.focus = 0.5; + cfg.sensitivity = 0.5; + cfg.stability = 0.5; + const int capacity = ring::Capacity ( + cfg.focus, cfg.sensitivity, cfg.stability); + REQUIRE (capacity == 151); + + for (long long signal_id = 1; signal_id < capacity; ++signal_id) + { + Eigen::VectorXf exact = Eigen::VectorXf::Zero (256); + exact[0] = static_cast (signal_id); + cortext::testing::SeedEmbeddingV2 ( + *store, signal_id, exact, signal_id); + store->Execute ( + "INSERT INTO signals(signal_id, source_id, embedding_id, " + "timestamp, modality, created_at) " + "VALUES (?, 'opaque/legacy', ?, ?, 'text', ?)", + { signal_id, signal_id, signal_id, signal_id }); + } + REQUIRE (store->Execute ( + "SELECT 1 FROM cortext_active_signal_embeddings LIMIT 1") + .empty ()); + + Eigen::VectorXf aggregate = Eigen::VectorXf::Constant (256, -1.0f); + cortext::testing::SeedEmbeddingV2 ( + *store, 1000, aggregate, capacity); + auto tx = store->Begin (); + ring::EnsureCapacity (*tx, capacity); + tx->Execute ( + "INSERT INTO signals(signal_id, source_id, embedding_id, timestamp, " + "modality, created_at) VALUES (?, 'opaque/new', 1000, ?, 'image', ?)", + { static_cast (capacity), static_cast (capacity), + static_cast (capacity) }); + std::vector newest_exact (256, 0.0f); + newest_exact[0] = static_cast (capacity); + ring::InsertAtCapacity (*tx, capacity, newest_exact, capacity, capacity); + tx->Commit (); + + ProcessorContext *captured = nullptr; + auto capture = std::make_unique (); + capture->context_address = &captured; + Signal signal; + signal.embedding = Eigen::VectorXf::Zero (256); + signal.timestamp = static_cast (capacity + 1); + signal.source_id = "opaque/observer"; + signal.modality = "audio"; + signal.mimetype = "audio/test"; + SignalProcessor restarted ( + cfg, store, + std::make_unique (std::move (capture))); + restarted.Process (signal); + + REQUIRE (captured != nullptr); + REQUIRE (captured->recent_context_embeddings.size () + == static_cast (capacity)); + for (int index = 0; index < capacity; ++index) + REQUIRE (captured->recent_context_embeddings[ + static_cast (index)][0] + == static_cast (index + 1)); +} + TEST_CASE ("SignalProcessor processes and flushes to SQLite", "[processor]") { auto uniq = SQLiteStore::Create (":memory:"); From 3f4d2e5e7c5bf981e24f942b4bf29020ffbc4c7f Mon Sep 17 00:00:00 2001 From: gabewillen Date: Tue, 21 Jul 2026 13:36:35 -0500 Subject: [PATCH 17/18] Fix bounded retrieval review edge cases --- .../paper-traceability-audit-v2.json | 6 +- .../paper-traceability-current-state-v2.json | 44 +++- .../paper-traceability-manifest-v1.json | 143 ++++++------- ...trator-goal-mdscript-converted.mdscript.md | 10 +- docs/paper/_manuscript/index.md | 198 ++++++++++++------ docs/paper/sections/10_implementation.qmd | 58 +++-- docs/paper/sections/11_optimization.qmd | 40 +++- .../active_signal_embedding_ring_internal.hpp | 98 +++++++-- src/operations/competition.cpp | 13 +- src/operations/consolidation.cpp | 9 +- src/operations/emotion_cascade.cpp | 2 +- .../emotional_metadata_cache_internal.hpp | 13 +- src/operations/graph_retrieval.cpp | 7 + src/operations/memory_strength.cpp | 2 +- tests/operations_competition.test.cpp | 47 +++++ tests/operations_consolidation.test.cpp | 62 ++++++ tests/operations_emotion_cascade.test.cpp | 46 +++- tests/operations_graph_retrieval.test.cpp | 74 +++++++ tests/operations_memory_storage.test.cpp | 72 +++++++ tests/operations_memory_strength.test.cpp | 65 ++++++ 20 files changed, 800 insertions(+), 209 deletions(-) diff --git a/artifacts/flat_storage_cost/paper-traceability-audit-v2.json b/artifacts/flat_storage_cost/paper-traceability-audit-v2.json index 80a41b24..fbb31ef4 100644 --- a/artifacts/flat_storage_cost/paper-traceability-audit-v2.json +++ b/artifacts/flat_storage_cost/paper-traceability-audit-v2.json @@ -1,14 +1,14 @@ { "generated_claim_mismatches": [], "inventory_count": 70, - "manifest_sha256": "03f2d608ded5f837609c4badb721dfe98dec1e4fc63be39b8847f0f7d4f54000", - "manuscript_sha256": "d7a14688db8027ea446037881d648f87b04360536c1bd775ca505b2cdb0273d6", + "manifest_sha256": "b4db2d9032f53b0a4dd3c702d749c3bf1603fcc4451d9acd4bac9bfcfce825aa", + "manuscript_sha256": "9f1e956e7759a8aa44571aa879c93583dea3de7691e2fa581aea9b0a56e0bfcc", "missing_source_claims": [], "ownership_violations": [], "passed": true, "proof_level_violations": [], "record_count": 70, "schema": "cortext_paper_traceability_audit_v1", - "state_sha256": "1bfe47fdafd5e6392289d7d36c4967478858ca9cffeed6ed29f63ffb01b0fee0", + "state_sha256": "343bbaf3dfabab7acb9fbd00f08605c4ff292f421580c94689c5abbf6c32d1d5", "uncovered_inventory": [] } diff --git a/artifacts/flat_storage_cost/paper-traceability-current-state-v2.json b/artifacts/flat_storage_cost/paper-traceability-current-state-v2.json index 66f855b0..5b544910 100644 --- a/artifacts/flat_storage_cost/paper-traceability-current-state-v2.json +++ b/artifacts/flat_storage_cost/paper-traceability-current-state-v2.json @@ -117,12 +117,12 @@ ] }, "pr6_exact_head_ci_repair": { - "decision": "seventeen-review-thread-repair-active", + "decision": "twenty-three-review-thread-repair-active", "prior_exact_head": "764e4af202a91120dae85e1d6b0d69e2ce97aa5d", "implementation_repair_commit": "89a06084dd05710f90572c1b7bac7e17fab79122", "followup_repair_commit": "25cf7b130e87837d0ed813b0e0ffda5a50701651", "monitor_head_binding": "resolve the live GitHub PR head at every re-entry because a repository record cannot content-address its own containing record-only commit", - "current_exact_head_ci": "implementation and record repair head cca844d758bc9ad7ddd12048932c274da514d8a6 is synchronized with current main; eleven checks are green, including Linux sanitizer, and Windows job 88675883348 is the only failure because checkout converted the unified HNSW patch to CRLF before git apply --check", + "current_exact_head_ci": "cumulative repair head d2213ea42f58666509ef96b22c86dca55d280584 is synchronized with current main and all twelve exact-head checks are green; the PR bot current-head rereview opened six P2 threads covering eviction/supersession ordering, post-family sparse underfill, timestamp-recency ring replacement, emotional eligibility-before-limit, single-owner RIF active-row publication, and retired-generation consolidation counting; all six are repaired locally and remain unresolved until the replacement head is pushed and proved", "windows_zig_path_repair": { "failing_job": "zig-cli-install (windows-latest, cortext_cli.exe)", "failing_head": "25cf7b130e87837d0ed813b0e0ffda5a50701651", @@ -159,6 +159,15 @@ "active_ci_repair": "pin cmake/hnswlib-prefetch-bounds.patch to text eol=lf so Windows checkout preserves valid unified-diff bytes without platform-specific algorithm behavior", "next_gate": "local proof, fresh recursive code review, final record review, non-force push, and resulting exact-head CI" }, + "six_thread_repair": { + "review_owner": "the current user explicitly selected the replacement-head PR bot rereview instead of a local recursive blind-review loop for bot-comment repairs", + "candidate_boundary": "six deterministic code repairs, six focused regressions, paper/manuscript parity, exact local full-suite proof, non-force push, proof replies, thread resolution, replacement-head bot rereview, and exact-head CI", + "focused_proof": "36 assertions in six cases; the sparse-family case proves 769 eligible activated rows before family collapse, rejection of the post-collapse sparse certificate, and a nonempty bounded exact fallback result", + "broader_proof": "memory storage 460 assertions in 21 cases; emotional cascade 149 in 25; active RIF 311 in 12; bounded consolidation 110 in 6; eviction 40 in 5; SQLite HNSW 2,639 in 22", + "full_proof": "exact-binary clean Debug LLVM 21 media-enabled CTest passed 39,281 assertions in 710 cases in 1,413.12 seconds on binary SHA-256 02c9615a918b2675517df3dce76b7d8709ec9fcbfe32e3766da66823e749c2f1", + "thread_disposition": "six current-head P2 threads remain open until reviewed replacement code and exact proof are pushed", + "next_gate": "rebuild paper traceability, push without force, reply and resolve the six threads, then let the PR bot rereview and monitor exact-head CI" + }, "review_threads": [ "https://github.com/augmem/cortext/pull/6#discussion_r3620394273", "https://github.com/augmem/cortext/pull/6#discussion_r3620394282", @@ -176,7 +185,13 @@ "PRRT_kwDOR3IQMM6SlrZg", "PRRT_kwDOR3IQMM6SopGj", "PRRT_kwDOR3IQMM6SopGm", - "PRRT_kwDOR3IQMM6SopGo" + "PRRT_kwDOR3IQMM6SopGo", + "PRRT_kwDOR3IQMM6SqPHn", + "PRRT_kwDOR3IQMM6SqPHr", + "PRRT_kwDOR3IQMM6SqPHu", + "PRRT_kwDOR3IQMM6SqPHx", + "PRRT_kwDOR3IQMM6SqPH2", + "PRRT_kwDOR3IQMM6SqPH4" ], "repairs": [ "calibrate migrated lazy-RIF state transactionally before working-memory hydration and rebuild the disposable epoch from committed persistent authority", @@ -199,7 +214,13 @@ "treat sparse supersession activation as candidates rather than an exact coverage certificate, retaining exact historical proof or SQLite fallback even though this can restore history-sized write work", "backfill the migration-30 empty active-signal ring with the newest knob-derived legacy exact-vector window before the first post-migration aggregate-linked write", "resolve legacy embedding-only RIF candidates to every memory sharing the embedding while retaining the ordinary structured memory-scoped path", - "fall back to exact SQL seed discovery when ASSOCIATION filtering underfills a sparse HNSW proposal" + "fall back to exact SQL seed discovery when ASSOCIATION filtering underfills a sparse HNSW proposal", + "remove an evicted replacement from the retrieval surface before recomputing supersession eligibility for its targets", + "reject a sparse seed certificate after exact family collapse when distinct selected families underfill, reopening the complete processor-surface or SQL seed path", + "replace exact signal-ring rows by timestamp and stable signal-id tie rather than signal-id modulo, including out-of-order writes and slot gaps", + "apply emotional intensity, arousal, and recent-window eligibility before bounded intensity ordering and truncation", + "leave disposable RIF active_rows unchanged until post-commit shadow publication applies each membership delta exactly once", + "count and select only current recovery-clock-generation RIF rows during consolidation so retired generations do not consume the active ceiling" ], "source_sha256": { "signal_processor": "0fb2b4d064531bbbfd86c270072e4f60b454b8db7059d9274603e3de7c784306", @@ -232,18 +253,27 @@ ,"competition_test": "3751cb6fea2ad83962a264fc8be3f496bf623835d804b2d5f0979e89cd3aee06" ,"graph_retrieval_source": "a7e1c1f92b91d18164167fffa0550797f72b4b0a167430d4acc703673082985d" ,"graph_retrieval_test": "fa60d62e9141b92c9096634ecfdd7ce06d472b3ff7a1e43791b476080d3174b2" + ,"active_signal_embedding_ring_six_thread": "d498573e9305f97481ba182fa5bbe68878dbd0fb6b10a7b5dcc15d99ab4422a1" + ,"competition_six_thread": "18ee4f12f68d37f85d81b790571cfaafd3ef8a204437bb7165b9618a6e2b3b0c" + ,"consolidation_six_thread": "5068ffc72f5168b5f41a84b2cedd274d1f8363a97528e33ba43e7f06c16af8aa" + ,"emotion_cascade_six_thread": "9a2b630d798367d0d80068a742055fdd67952187160062aeb660ca272bdc4486" + ,"emotional_metadata_cache_six_thread": "76672dc8a6c4d18d9ed4c309beb7f50494b8f09935f85ac7bc8c14551f9f35f9" + ,"graph_retrieval_six_thread": "1f109a81c2b608b960363659a278063f766153cff30dca131ff815bb3d40d3cb" + ,"memory_strength_six_thread": "d3cd685fcd47de03d9876289607eec8e054d342f938c37e9b924c64969c6daee" + ,"exact_test_binary_six_thread": "02c9615a918b2675517df3dce76b7d8709ec9fcbfe32e3766da66823e749c2f1" }, "local_proof": { "preceding_full_media_ctest": "preceding exact candidate: clean Debug LLVM 21 media-enabled suite with experiment hooks enabled: 38,730 assertions in 697 cases", "preceding_full_media_test_binary_sha256": "0fd25b6e322913cb0e76e3aa5a1fbcc6836d8696b6bbd5886224a3144fea1ec8", - "current_full_media_ctest": "exact cumulative LF-checkout and seventeen-thread repaired candidate: clean Debug LLVM 21 media-enabled suite with experiment hooks enabled: 39,245 assertions in 704 cases", - "current_full_media_test_binary_sha256": "c5508e7b083d77cac768b717c04af0862cf64d7c48d339e5a3aa1c0f6b00f068", + "current_full_media_ctest": "exact cumulative six-current-head-thread repaired candidate: clean Debug LLVM 21 media-enabled suite with experiment hooks enabled: 39,281 assertions in 710 cases", + "current_full_media_test_binary_sha256": "02c9615a918b2675517df3dce76b7d8709ec9fcbfe32e3766da66823e749c2f1", "rif_focus": "312 assertions in 19 cases", "hnsw_focus": "the exact canonical-entry reactivation, missing-snapshot ordinary-search restart, and prior-snapshot-free recenter rebuild regressions pass in the four-case 107-assertion follow-up set", "consolidation_focus": "the four-case follow-up set passes 107 assertions, including both clustered-row prefilter arms, the eligible-only inactive query plan, and migration 34 structure", "zig_build_local_patch": "fresh Zig text-only check passes 12/12; a core.autocrlf=true checkout retains an LF-only patch that applies cleanly, while the CRLF-adversarial stream is rejected as corrupt; the build-local patch remains an explicit input and the global hnswlib cache remains unpatched", "new_review_thread_focus": "27-point active-signal ring proof passes 225 assertions; a neutral exact restart passes 154 assertions; adversarial fallback hydration passes 5 assertions; sparse supersession exact-coverage regression passes 15 assertions; broader MemoryStorage passes 451 assertions in 20 cases and hydration passes 173 assertions in 13 cases", "latest_review_thread_focus": "migration-30 exact-ring upgrade passes 155 assertions; embedding-only shared-memory RIF passes 5 assertions; sparse ASSOCIATION underfill fallback passes 4 assertions; broader recent-context passes 309 assertions in 2 cases, competition passes 331 assertions in 17 cases, and SQLite HNSW retrieval passes 2,638 assertions in 21 cases", + "six_thread_focus": "six focused regressions pass 36 assertions; broader memory storage passes 460 assertions in 21 cases, emotional cascade 149 in 25, active RIF 311 in 12, bounded consolidation 110 in 6, eviction 40 in 5, and SQLite HNSW 2,639 in 22", "wasm_bundle": "built successfully with Emscripten 4.0.18", "focused_test_binary_sha256": "c5508e7b083d77cac768b717c04af0862cf64d7c48d339e5a3aa1c0f6b00f068", "wasm_sha256": "17d31e0a61327e91d7a53577b73689442583d5f4c84aa76d5844ac309e9791aa" @@ -261,7 +291,7 @@ }, "unresolved_limits": [ "Windows execution and replacement exact-head CI for the LF checkout repair remain pending", - "the three newest P2 review-thread repairs have focused, broader, and full-suite deterministic proof; the current user waived the local recursive blind-review loop for bot-comment repairs, so the replacement-head PR bot rereview, non-force push, proof-backed replies, and exact-head CI remain", + "the six current-head P2 repairs have focused and broader deterministic proof; exact-binary full-suite completion, non-force push, proof-backed replies, thread resolution, replacement-head PR bot rereview, and exact-head CI remain", "legacy embedding-only RIF compatibility may perform work proportional to shared-embedding membership; ordinary structured competition remains memory-scoped", "sparse graph retrieval falls back to the exact SQL seed path when operation-specific eligibility filtering underfills, so store-sized fallback work remains possible", "the three newest P2 thread repairs have full applicable proof and completed recursive review, are pushed at cca844d758bc9ad7ddd12048932c274da514d8a6, and their proof-backed threads are resolved; resulting exact-head CI remains pending", diff --git a/artifacts/flat_storage_cost/paper-traceability-manifest-v1.json b/artifacts/flat_storage_cost/paper-traceability-manifest-v1.json index 3f3dbc54..d6716958 100644 --- a/artifacts/flat_storage_cost/paper-traceability-manifest-v1.json +++ b/artifacts/flat_storage_cost/paper-traceability-manifest-v1.json @@ -284,7 +284,7 @@ "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", "decision": "failed-end-anchored-plateau-reranked-to-next-independent-exact-candidate", "evidence_fingerprints": [ - "87cc1ab1e16faa29c17a233953194dfdc3e65af4c5ca080fa26321a5985aebbf" + "9b091c86c6ecfc37241a26465f06c427ecbbf9866036d90285072fae31c1e54f" ], "evidence_kind": "measured", "inventory_id": "state:accepted_tree_natural_plateau_rerank", @@ -301,7 +301,7 @@ "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", "decision": "recorded-measurement", "evidence_fingerprints": [ - "5a4b22ef75b2c249250c6049762db517a7b8435f50295cad83e94dac4dd65046" + "a090d13389c441447b71c4633f705e85e8f07e834b76d5b6887a6a644402acb7" ], "evidence_kind": "measured", "inventory_id": "state:active_epoch_sqlite_evaluation", @@ -311,14 +311,14 @@ "path": "docs/paper/sections/11_optimization.qmd" }, "unresolved_limits": [ - "the paper claim is limited to the recorded proof scope" + "production cutover is not proven" ] }, { "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", "decision": "reject-anchor-only-candidate-set-retain-anchors-only-as-bounded-sparse-graph-restart-entry", "evidence_fingerprints": [ - "f252fa933d0bd3fd1692d232e5685062b7c97b74ec4934bd9ca865f87fdd9096" + "5db8b893b7b26688ccb67e820f1a40485b8420c7f3d9b91d69d27448579794a7" ], "evidence_kind": "measured", "inventory_id": "state:anchor_only_route_feasibility", @@ -328,14 +328,14 @@ "path": "docs/paper/sections/11_optimization.qmd" }, "unresolved_limits": [ - "the paper claim is limited to the recorded proof scope" + "production cutover is not proven" ] }, { "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", "decision": "recorded-measurement", "evidence_fingerprints": [ - "3ed6fb6e4e06b1382b9f1d70d500992e6374fc66949b0eb534da34cdc5c65f87" + "c4f44d388da1b64b70384618ef5d09b4b3d256613e825abe394f3f249d2b6c4c" ], "evidence_kind": "measured", "inventory_id": "state:baseline_results", @@ -352,7 +352,7 @@ "corpus_parameter_scope": "34,456 normalized 256-dimensional embeddings; 512 deterministic top-16 queries; four opaque sources; text, audio, and image post-encoding labels; two graphs; 16,384 construction and 1,280 retrieval comparisons per graph; 64 reciprocal proposals", "decision": "design-direction-approved-production-proof-pending", "evidence_fingerprints": [ - "09d706ac310d63937db9e98a98a96ca55e794da699acb2870185cdc083cba71e" + "d80d794e27b6979b354692bd7a530e4eff6baf61d9023e85ac37ff8940c0364c" ], "evidence_kind": "modeled", "inventory_id": "state:bounded_route_hybrid_observation", @@ -362,14 +362,14 @@ "path": "docs/paper/sections/11_optimization.qmd" }, "unresolved_limits": [ - "the paper claim is limited to the recorded proof scope" + "production cutover is not proven" ] }, { "corpus_parameter_scope": "35,496 normalized 256-dimensional embeddings; 512 age-stratified top-16 queries; F=S=T=0.5; observation-only private switch", "decision": "complete-promising-shadow-candidate-not-ready-for-cutover", "evidence_fingerprints": [ - "acc2412aa992fa9f10eed8b062edebad34d9fa1cf2c7a9ac8a025e10f5af9fe3" + "fa4230d33022df68ed23c43b290a489d0c55bb086b0ce08c1955da7c33eca152" ], "evidence_kind": "observation-only", "inventory_id": "state:bounded_sparse_routing_observation", @@ -379,14 +379,14 @@ "path": "docs/paper/sections/11_optimization.qmd" }, "unresolved_limits": [ - "the paper claim is limited to the recorded proof scope" + "production cutover is not proven" ] }, { "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", "decision": "rejected-fresh-process-and-rif-regression", "evidence_fingerprints": [ - "61976ff3fdfb96c59b39b234c487eb1a77092fea917198f323433b8017317fbc" + "6caf42f13c23367491ddf85f40eb5db175a58bf55000b9291a3e64ee93edb637" ], "evidence_kind": "measured", "inventory_id": "state:competition_rif_returning_candidate", @@ -403,7 +403,7 @@ "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", "decision": "rejected-fresh-process-wall-and-rif-hard-gate", "evidence_fingerprints": [ - "90a8cbf89c79b127b742ccb6ab60c14d623ccf8a4c7f99c5eb1609ae64ed02bf" + "12723ea9a4a77d7b4ba45313b2be47b48be68bf9b659282eb0ce3a8817b3bb2e" ], "evidence_kind": "measured", "inventory_id": "state:competition_suppression_state_cache_candidate", @@ -420,7 +420,7 @@ "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", "decision": "retained-hotspot-improved-plateau-still-failed-reranked", "evidence_fingerprints": [ - "b0e0d57e19cede6145b499b8993b792384d5f32a4f61ebf26adbfdb0565e464b" + "bfcebb61906d51cf52925e1a008bed02859685b1093a9eaa62fc49d3a46a3ef5" ], "evidence_kind": "measured", "inventory_id": "state:emotional_cascade_fixed_point_full_natural", @@ -437,7 +437,7 @@ "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", "decision": "retained-local-gates-passed-full-natural-verification-next", "evidence_fingerprints": [ - "4be1087a4355ed77b7a5f1fe309d9506b5bf8ef1975269e9530c02bada607c09" + "cfc22af065c3660f609c10dfb10a31a7a4d93e6ef0d43381d845500db53bfa5e" ], "evidence_kind": "measured", "inventory_id": "state:emotional_cascade_fixed_point_repair", @@ -454,7 +454,7 @@ "corpus_parameter_scope": "rejected knob-derived priority-prefix candidate; 27 F/S/T structural points; exact B and logical B+1 shared-member seams; 15,695-packet fixed-time Natural midpoint against a same-binary control and identical 118-event consolidation schedule; 512 public top-16 queries over four opaque sources; nine-point production matrix intentionally not run after midpoint fail-fast", "decision": "reject-before-nine-point-ablation-for-p99-and-public-retrieval-quality", "evidence_fingerprints": [ - "65483a65f6d9d4c587486fb091d0e513eb05985b3a1275894caf47e13cb44523" + "b8e4c4dc7243a094fad16ec82418ff7d3ab0fe022b3b2ed4901747c00225f3ab" ], "evidence_kind": "measured", "inventory_id": "state:emotional_cascade_fixed_work_candidate", @@ -474,7 +474,7 @@ "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", "decision": "retained-full-natural-improvement-flatness-failed-reranked", "evidence_fingerprints": [ - "26c10425cd3ac3c63c08d1ab546b8614a80bdd2129bf7378a7c336df285c724b" + "c437d2be35f93e92524f0108695cc90d09ed11c6ef422bb12a60cdfa75e4ffae" ], "evidence_kind": "measured", "inventory_id": "state:emotional_metadata_cache_repair", @@ -491,7 +491,7 @@ "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", "decision": "reject-all-five-single-hierarchy-bounded-link-repairs", "evidence_fingerprints": [ - "b09b6788a47a7f3adba9766f9e31e1282031cc212c35b6efd7fdc127deca1277" + "ecaa356bb3c43b5af6db667804652f864113fdfe9f9432768923ad6fccd8c726" ], "evidence_kind": "measured", "inventory_id": "state:fixed5c_moved_centroid_reachability", @@ -501,14 +501,14 @@ "path": "docs/paper/sections/11_optimization.qmd" }, "unresolved_limits": [ - "the paper claim is limited to the recorded proof scope" + "production cutover is not proven" ] }, { "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", "decision": "recorded-measurement", "evidence_fingerprints": [ - "0e531753880ffdc2c64df2c0a178341a555588f8131940f52c4b5e96efbe7c80" + "e180d8cf1c390e364d00164d795b1dd4151a8fd18e70e9ab1e463cacdaebad8b" ], "evidence_kind": "measured", "inventory_id": "state:graph_eligibility_db_proof", @@ -525,7 +525,7 @@ "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", "decision": "retained-local-improvement-full-natural-flatness-gate-failed", "evidence_fingerprints": [ - "47bb7dec0b5f4d686a917534e02963ad608c2d17655f4e1a845a5ddc701b38b1" + "65305ad83c3ff1cc3ef273f8ee48c80eef178d405ad96520df57a98f62d4526c" ], "evidence_kind": "measured", "inventory_id": "state:graph_eligibility_repair", @@ -542,7 +542,7 @@ "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", "decision": "rejected-fresh-and-late-total-process-wall-regression", "evidence_fingerprints": [ - "69d89bf7ca9353c9e00199dc0cde1002bae5de66a34036b6e885986843f4d87c" + "79861dbdce7c0ced9e148ceddaa784c7c329dc044c4d3b5b02847de4294d2b59" ], "evidence_kind": "measured", "inventory_id": "state:graph_family_precomputed_features_candidate", @@ -559,7 +559,7 @@ "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", "decision": "rejected-late-process-graph-and-comparison-regression", "evidence_fingerprints": [ - "f097813259dbf7e6ff29619d0c2f04101617c21ab56d6b7fd3ef91ea9cacc434" + "e8f2e5e6c8dd1e8de539404e7b531b186e79a4878eebb54692472b23a1594b56" ], "evidence_kind": "measured", "inventory_id": "state:graph_family_projection_bound_candidate", @@ -576,7 +576,7 @@ "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", "decision": "rejected-fresh-process-and-graph-regression", "evidence_fingerprints": [ - "6bf28d18c6d21c43e5a7c61eb842530c905c941f634f9633bafdcd10e87db283" + "683631b85f811294446d98f2e66ec93151c593897d7707f4bff10fa7431a97a0" ], "evidence_kind": "measured", "inventory_id": "state:graph_family_vector_bound_candidate", @@ -593,7 +593,7 @@ "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", "decision": "retained-local-improvement-full-natural-flatness-gate-failed", "evidence_fingerprints": [ - "c6e3b8b69411677357b05cde5bb632d470a010d8f088ba86bd7ae8d094ef9590" + "54f9c5e9235181e534d48fc68a3828f691ba62015c722bdde8db5f6852750d7f" ], "evidence_kind": "measured", "inventory_id": "state:graph_partial_distance_evaluation", @@ -610,7 +610,7 @@ "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", "decision": "retained-local-gates-passed-family-compare-next", "evidence_fingerprints": [ - "67c426e40a2574fbc16bb8a1de30a9b5dc738add89f18b340f63b69f8d0bb9bc" + "0c28a16305eaf9a2af815274e767863ee883f097e85d9635f17135b704452582" ], "evidence_kind": "measured", "inventory_id": "state:graph_supersession_eligibility_repair", @@ -627,7 +627,7 @@ "corpus_parameter_scope": "rejected private fixed-6C envelope; 27 structural F/S/T points and 931 assertions; one additional 15,695-packet Natural production-default pre-screen at F=0.45, S=T=0.5 with 512 public top-16 queries; exact nine-point corpus matrix not started after fail-fast rejection", "decision": "rejected-after-production-default-prescreen-hard-gates", "evidence_fingerprints": [ - "4052b3da40076bd1ee8247d8342ec7c5509e2c8ea2dc2bb2095cac31be2420ba" + "4bcece2ce0d609b506e13ce283c069bcb4d5881e67ddb11b8a18a6ef59a69049" ], "evidence_kind": "measured", "inventory_id": "state:hnsw_fixed_6c_experiment", @@ -640,14 +640,15 @@ "the additional production-default pre-screen failed the hard gates", "zero of nine exact corpus-matrix points were run after fail-fast rejection", "the production fixed-5C default was not changed", - "whole-engine boundedness and production cutover are not proven" + "whole-engine boundedness and production cutover are not proven", + "production cutover is not proven" ] }, { "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", "decision": "retain-incremental-consolidation-seal-within-current-latency-tradeoff-do-not-cut-over-before-bounded-restart-and-full-horizon-close", "evidence_fingerprints": [ - "bebafa75b6b3df78b1447d924b19e798c52cd957552e2af88a82f3e283ac4477" + "f18054ed033325c0aea69e2bc189ebaf7c9f783c05dddb77cd2058d8fe282976" ], "evidence_kind": "measured", "inventory_id": "state:integrated_hnsw_consolidation_seal_experiment", @@ -657,14 +658,14 @@ "path": "docs/paper/sections/11_optimization.qmd" }, "unresolved_limits": [ - "the paper claim is limited to the recorded proof scope" + "production cutover is not proven" ] }, { "corpus_parameter_scope": "2,500 deterministic Natural packets; four opaque source ids; text, audio, and image post-encoding labels; 128 public top-16 queries; two HNSW graphs; 512-candidate sealed-plus-delta route", "decision": "retain-sealed-two-hnsw-plus-exact-delta-reseal-at-512-reject-live-update-and-every-consolidation-rebuild", "evidence_fingerprints": [ - "6035330ee4f44bb8b01214c8d1c72b1aa3e1ac77c1ce9fca593a2b3f7a523d45" + "eceaf32b550a4d511981379db3f7656bab55b44cd4400b2f7b3feded9be10aea" ], "evidence_kind": "measured", "inventory_id": "state:integrated_hnsw_sparse_route_experiment", @@ -674,14 +675,14 @@ "path": "docs/paper/sections/11_optimization.qmd" }, "unresolved_limits": [ - "the paper claim is limited to the recorded proof scope" + "production cutover is not proven" ] }, { "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", "decision": "retain-live-two-graph-route-for-cross-modality-restart-cycle-latency-and-engine-integration-proof", "evidence_fingerprints": [ - "3db2a5a9bccb7c363bf7d3583a96e33f7fc4276cdca57cd2b5f9eb7ca8b7697c" + "197c570cb0209b0b7d63935e1a4a6ebea2f2ca65003a6581a6f079acf82b6d7c" ], "evidence_kind": "measured", "inventory_id": "state:live_surface_mutation_capture_experiment", @@ -691,14 +692,14 @@ "path": "docs/paper/sections/11_optimization.qmd" }, "unresolved_limits": [ - "the paper claim is limited to the recorded proof scope" + "production cutover is not proven" ] }, { "corpus_parameter_scope": "34,456 normalized 256-dimensional embeddings; four SQLite blobs; 1,024 anchors; 512 deterministic top-16 route queries; separate 1,024-embedding fresh-prefix restart", "decision": "retain-row-addressed-query-seam-reject-whole-snapshot-rewrite", "evidence_fingerprints": [ - "f4da4dfe29d1af557f3774d9ce2335ef8b4474668508923d7a5e1f9dfdbe598b" + "828851ddb716b6d27a28089951550dbf2d0e51e9d7061fc5f6c62fcc620509f3" ], "evidence_kind": "benchmark-only", "inventory_id": "state:packed_route_sqlite_representation_experiment", @@ -708,14 +709,14 @@ "path": "docs/paper/sections/11_optimization.qmd" }, "unresolved_limits": [ - "the paper claim is limited to the recorded proof scope" + "production cutover is not proven" ] }, { "corpus_parameter_scope": "100- and 200-event Natural and Durable instrumentation smoke profiles", "decision": "complete", "evidence_fingerprints": [ - "78c3dfa21ef557ec13ea96696c4b7060bbc028a75cdfdb00ccbf8ac3f1a374a7" + "b0f4f9f49236829c7d8dc831675cabe82e04428afccfef8f72983818211c39f6" ], "evidence_kind": "measured", "inventory_id": "state:plateau_profiler_smoke_proof", @@ -732,7 +733,7 @@ "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", "decision": "select-SignalProcessor.publish_rif_active_epoch", "evidence_fingerprints": [ - "44a024ab227f474ac17ea8a938ca8fd0e6295c6da729b25a4162f5cea8d7f732" + "35e402a8536dbbea2e5e94991807623901fba097b9cea233da5ea78c319f4f80" ], "evidence_kind": "measured", "inventory_id": "state:post_emotional_priority_rejection_rerank", @@ -742,14 +743,14 @@ "path": "docs/paper/sections/11_optimization.qmd" }, "unresolved_limits": [ - "the paper claim is limited to the recorded proof scope" + "production cutover is not proven" ] }, { "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", "decision": "select-shared-sqlite-activation-query-distance-materialization", "evidence_fingerprints": [ - "3af8e93d86ec5cbb9a426e41839862e9da1c2d8ae4527d9d0aa81806baeaaa21" + "6af1c9dfe8a1550fcaff4e574fec14d0ac74b23a2929206b71c9eb5581309ff6" ], "evidence_kind": "measured", "inventory_id": "state:post_hnsw_cost_attribution", @@ -759,14 +760,14 @@ "path": "docs/paper/sections/11_optimization.qmd" }, "unresolved_limits": [ - "the paper claim is limited to the recorded proof scope" + "production cutover is not proven" ] }, { "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", "decision": "retain-query-local-persisted-distance-reuse", "evidence_fingerprints": [ - "87228cd423346649c0d37434948d75bc7d2df44b62bb4d4d59f878c1409deb4b" + "9ef6ad6179fc870657b2bd043ff2000743263255ed90e1320e0152e2f625c61f" ], "evidence_kind": "measured", "inventory_id": "state:post_hnsw_query_distance_reuse", @@ -776,14 +777,14 @@ "path": "docs/paper/sections/11_optimization.qmd" }, "unresolved_limits": [ - "the paper claim is limited to the recorded proof scope" + "production cutover is not proven" ] }, { "corpus_parameter_scope": "paired fresh and copied-late 200-event Natural and Durable windows", "decision": "recorded-measurement", "evidence_fingerprints": [ - "e29d5d1001669f806d52fac5740a442ac8a35c32c122af349da3402962875a40" + "331c3e8a352a974bd3c5247cb28ca2ab2b17681c79e5fc4e8dc8537f0004e73c" ], "evidence_kind": "measured", "inventory_id": "state:post_shadow_rerank", @@ -798,9 +799,9 @@ }, { "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", - "decision": "seventeen-review-thread-repair-active", + "decision": "twenty-three-review-thread-repair-active", "evidence_fingerprints": [ - "7673c0666deab0b3b97fd58a48f2d948c420541fea939649ece19e2e4830bbfc" + "b364ed209ca9d47b074755405985bd0f53ef46b2b226a40cf681903b7c65379a" ], "evidence_kind": "measured", "inventory_id": "state:pr6_exact_head_ci_repair", @@ -817,7 +818,7 @@ "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", "decision": "retain-feasibility-only-require-live-surface-mutation-capture-before-candidate-decision", "evidence_fingerprints": [ - "d8d4bfe9f05361fec123da264bae3c6606204d60abe57d30ffeeebb1b0a01304" + "47fa93e666957958f4cec485b4a6afb8fd92f0a1ea28c936dfea9e1f3592f588" ], "evidence_kind": "measured", "inventory_id": "state:public_hnsw_route_prototype_experiment", @@ -827,14 +828,14 @@ "path": "docs/paper/sections/11_optimization.qmd" }, "unresolved_limits": [ - "the paper claim is limited to the recorded proof scope" + "production cutover is not proven" ] }, { "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", "decision": "retain-real-GraphRetrieve-control-capture-live-surface-candidate-proof-recorded-separately", "evidence_fingerprints": [ - "0ddecf898960dafebcd6e485746a359d4d4eac97e985be45ec988121a410db2b" + "79e04b1b383acef5611d76d6128a17f0ed8283ca7317f1728b7309bba431d027" ], "evidence_kind": "measured", "inventory_id": "state:public_retrieval_control_capture_experiment", @@ -844,14 +845,14 @@ "path": "docs/paper/sections/11_optimization.qmd" }, "unresolved_limits": [ - "the paper claim is limited to the recorded proof scope" + "production cutover is not proven" ] }, { "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", "decision": "reject-current-recenter-as-retrieval-centroid-reset", "evidence_fingerprints": [ - "f88a49e290801f5cd4c269d1a477e29d35fdaa7bcea52ca7efb4981a710f4031" + "29a6a51e91f6e663f59cbacf675465b4c01b0376a0df49657b5f012fa2adcb65" ], "evidence_kind": "measured", "inventory_id": "state:recenter_activation_overlap_natural_13000_v2", @@ -868,7 +869,7 @@ "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", "decision": "recorded-measurement", "evidence_fingerprints": [ - "52912431e4c3323b6b98030f13356da3afa4741c43a210397bbb465cfc48667f" + "f6e20cca3c59ff1f1144496e5e3ca747df4bd31fe0026301845f6a043cad8487" ], "evidence_kind": "measured", "inventory_id": "state:repair_results", @@ -885,7 +886,7 @@ "corpus_parameter_scope": "correction from 34,456 complete embedding ids to 3,172 current long-term memory identities; 512 top-16 queries; ten 128-memory-node incremental feasibility epochs; 25/50/100-percent restart probes", "decision": "retain-router-feasibility-require-exact-public-control-rerun", "evidence_fingerprints": [ - "c775d4a1bf098049d83f7211e87c8381da2121a0e2fbdf409ca107b3ca3a3c9c" + "e5c2c164b8e3a329ec89d05169cf550233e57d48ad7ab858ed596f8a94d31ea8" ], "evidence_kind": "measured", "inventory_id": "state:retrieval_quality_control_correction", @@ -895,14 +896,14 @@ "path": "docs/paper/sections/11_optimization.qmd" }, "unresolved_limits": [ - "the paper claim is limited to the recorded proof scope" + "production cutover is not proven" ] }, { "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", "decision": "retain-for-source-health-and-continue-full-horizon-verification", "evidence_fingerprints": [ - "be9c897fac8c4f2bad02c5d2d7ed06e4874724dea0a9ff8fd6a638d331235a69" + "ba8d896958f51050d2ca578c4aa354af9370bb33f4746b2f705e6fb086baa6e1" ], "evidence_kind": "measured", "inventory_id": "state:rif_active_identity_ledger", @@ -912,14 +913,14 @@ "path": "docs/paper/sections/11_optimization.qmd" }, "unresolved_limits": [ - "the paper claim is limited to the recorded proof scope" + "production cutover is not proven" ] }, { "corpus_parameter_scope": "15,695-packet Natural replay at F=0.45, S=T=0.5; 27 structural F/S/T points; nine production-shaped reset points; B=round(64+64F+32S+32T), with neutral B=128 and 129 used only as the logical B+1 population boundary; text/audio/image labels and two opaque source ids", "decision": "local-hotspot-flat-full-natural-overall-gates-failed", "evidence_fingerprints": [ - "ea7982f576f1c163f7cb7dba2e67bceb2e1446fec1947d72a44157f5ece355db" + "6d2ab8e49b315093b8ce0023dae6e07b8b159ed707a89c1e9b40ff30c339d26b" ], "evidence_kind": "measured", "inventory_id": "state:rif_epoch_consolidation_reset_candidate", @@ -939,7 +940,7 @@ "corpus_parameter_scope": "200-event fresh and 34,256-row copied-late SQLite seals; 3,544 reciprocal route-row updates; 1,024 anchors; 512 fixed-route queries", "decision": "retain-row-addressed-snapshot-for-production-shaped-engine-evaluation", "evidence_fingerprints": [ - "5039a6e6eae680cd1d93bcf6007cb79342f8cf6a30c6aef52affe69f25d68fad" + "49561d775e1c06ba04fcf28c2f237d14c2a2d38c21beb3d446247bc9b7f015d5" ], "evidence_kind": "benchmark-only", "inventory_id": "state:row_addressed_route_sqlite_experiment", @@ -949,14 +950,14 @@ "path": "docs/paper/sections/11_optimization.qmd" }, "unresolved_limits": [ - "the paper claim is limited to the recorded proof scope" + "production cutover is not proven" ] }, { "corpus_parameter_scope": "paired fresh and copied-late 200-event Natural and Durable windows", "decision": "rejected-numeric-acceptance-gates-failed", "evidence_fingerprints": [ - "7e80167b056ae9913689593a0ad308d5ec360f84c132216bc2fbd86a4d583bb4" + "8bf7c3b51be906c312d8a00913970547e4f4c9deb33068cd1edfd5598e263f51" ], "evidence_kind": "measured", "inventory_id": "state:shadow_sqlite_scoped_evaluation", @@ -966,14 +967,14 @@ "path": "docs/paper/sections/11_optimization.qmd" }, "unresolved_limits": [ - "the paper claim is limited to the recorded proof scope" + "production cutover is not proven" ] }, { "corpus_parameter_scope": "paired fresh and copied-late 200-event Natural and Durable windows", "decision": "recorded-measurement", "evidence_fingerprints": [ - "6636a4c87f426302cff2fe27aa9ac79df8e3c2ace70b6974da647fec4259a1e2" + "c4a5811f138462e381bbad56bb4b577307ef0b84797dfbcbbdcaf237813f25bd" ], "evidence_kind": "measured", "inventory_id": "state:shadow_sqlite_seam_proof", @@ -990,7 +991,7 @@ "corpus_parameter_scope": "migration 30; 15,695-packet Natural and 2,016-message Durable replays at F=0.45, S=T=0.5; 27 structural F/S/T points; nine 2,000-packet same-knob runs with 512 public queries and four opaque source ids per run; separate text/audio/image label proof", "decision": "retain-local-write-surface-repair-whole-goal-continues", "evidence_fingerprints": [ - "50324f782e8b33fb7f843adf88b04f1cba8a28d34118fbd0a05bdf473a92c79d" + "19cc8ea4ce28c90b828697bef4a03e70af519be85a95f6d6f75f33b0ac972986" ], "evidence_kind": "measured", "inventory_id": "state:signal_centroid_ring_cutover", @@ -1043,7 +1044,7 @@ "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", "decision": "retain-real-hnsw-adjacency-walk-reject-anchor-neighborhood-approximation", "evidence_fingerprints": [ - "eb95c2020ea5ef8dcac8c6e46ecacb243c43c029e15d622dce60800746de7137" + "9a7b782479af069c49b9b6a805693468651653afe0ec3006e9c2f2d7a02160f6" ], "evidence_kind": "measured", "inventory_id": "state:sqlite_hnsw_sparse_route_integration", @@ -1053,14 +1054,14 @@ "path": "docs/paper/sections/11_optimization.qmd" }, "unresolved_limits": [ - "the paper claim is limited to the recorded proof scope" + "production cutover is not proven" ] }, { "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", "decision": "rejected-fresh-process-and-wall-hard-gate", "evidence_fingerprints": [ - "a2da60acbd26711c481196fbb65ae9761c928fbbc3fcc0dca7dec467455f6f3e" + "bdefb3bf6651ce390f3b536ae336fd436db4c37e47f7931c70392942369cf3fc" ], "evidence_kind": "measured", "inventory_id": "state:supersession_metric_index_candidate", @@ -1077,7 +1078,7 @@ "corpus_parameter_scope": "100- and 200-event Natural and Durable instrumentation smoke profiles", "decision": "use explicit result activity markers instead of inclusive operation duration for vacuous-zero detection", "evidence_fingerprints": [ - "9e6c3186d05fd2ed141f3399e18148205dbdea9aa13715f90a3b2c9c11f1be92" + "93bf3719b58b031954d3e1e8d8bb58b422f1d988f0a43083406cd529b98dfd10" ], "evidence_kind": "measured", "inventory_id": "state:work_counter_activity_repair", @@ -1094,7 +1095,7 @@ "corpus_parameter_scope": "34,456 normalized 256-dimensional embeddings and 512 deterministic top-16 queries", "decision": "rejected-recall-at-16-0.979858", "evidence_fingerprints": [ - "09d706ac310d63937db9e98a98a96ca55e794da699acb2870185cdc083cba71e", + "d80d794e27b6979b354692bd7a530e4eff6baf61d9023e85ac37ff8940c0364c", "d30bfc49a82969a56834a87efddd827f5c4eda4987b0dc4084415dde84facf81" ], "evidence_kind": "modeled", @@ -1112,7 +1113,7 @@ "corpus_parameter_scope": "34,456 normalized 256-dimensional embeddings and 512 deterministic top-16 queries", "decision": "rejected-no-recall-gain-at-equal-per-graph-work", "evidence_fingerprints": [ - "09d706ac310d63937db9e98a98a96ca55e794da699acb2870185cdc083cba71e", + "d80d794e27b6979b354692bd7a530e4eff6baf61d9023e85ac37ff8940c0364c", "31008972639ea1a20a7bdc7ec76d8284a5a943db5b18a702fc5261f9c136f10e" ], "evidence_kind": "modeled", @@ -1130,7 +1131,7 @@ "corpus_parameter_scope": "34,456 normalized 256-dimensional embeddings and 512 deterministic top-16 queries", "decision": "rejected-recall-at-16-0.995972", "evidence_fingerprints": [ - "09d706ac310d63937db9e98a98a96ca55e794da699acb2870185cdc083cba71e", + "d80d794e27b6979b354692bd7a530e4eff6baf61d9023e85ac37ff8940c0364c", "68ff8dacf45e677f4c8781c1a6a1fe6ccb16af107a424016f72c32954e7694f2" ], "evidence_kind": "modeled", @@ -1148,7 +1149,7 @@ "corpus_parameter_scope": "34,456 normalized 256-dimensional embeddings and 512 deterministic top-16 queries", "decision": "rejected-recall-at-16-0.997803", "evidence_fingerprints": [ - "09d706ac310d63937db9e98a98a96ca55e794da699acb2870185cdc083cba71e", + "d80d794e27b6979b354692bd7a530e4eff6baf61d9023e85ac37ff8940c0364c", "49a8e8870573f66e98eb48ba0aafa1a1a6f1a5827ee6ada2ac7e6ae1dee45b1b" ], "evidence_kind": "modeled", @@ -1166,7 +1167,7 @@ "corpus_parameter_scope": "34,456 normalized 256-dimensional embeddings and 512 deterministic top-16 queries", "decision": "selected-benchmark-design-production-proof-pending", "evidence_fingerprints": [ - "09d706ac310d63937db9e98a98a96ca55e794da699acb2870185cdc083cba71e", + "d80d794e27b6979b354692bd7a530e4eff6baf61d9023e85ac37ff8940c0364c", "c6d0a84a168058264ebdfdc489c94852c9d1918be430a8b661d2947d03ceb0a0" ], "evidence_kind": "modeled", diff --git a/comments/consolidation-drift-retrigger/20260716T205900Z-orchestrator-goal-mdscript-converted.mdscript.md b/comments/consolidation-drift-retrigger/20260716T205900Z-orchestrator-goal-mdscript-converted.mdscript.md index 5011bd74..61d955f2 100644 --- a/comments/consolidation-drift-retrigger/20260716T205900Z-orchestrator-goal-mdscript-converted.mdscript.md +++ b/comments/consolidation-drift-retrigger/20260716T205900Z-orchestrator-goal-mdscript-converted.mdscript.md @@ -5,13 +5,13 @@ owner_role: implementer lane_id: consolidation-drift-retrigger status: monitoring implementation_status: complete -monitor_status: windows-lf-and-three-latest-p2-repair +monitor_status: six-current-head-p2-repair source_of_truth: current repository, current user corrections, this goal, task comments, exact private profiles and audits, and GitHub PR 6 only after implementation completion model: gpt-5.6-terra reasoning: high model_selection_basis: cross-cutting C++ and SQLite implementation, deterministic bounded-work proof, research traceability, and PR ownership canonical_monitor_entry: true -updated_at: 20260721T160600Z +updated_at: 20260721T183342Z --- @@ -38,7 +38,7 @@ updated_at: 20260721T160600Z * focused production-default derivation, route work, active-epoch reset, shared Natural/Durable path, Durable-barrier non-replay, source/modality, Python audit, and evidence-builder tests pass on the current release build * preceding exact-head historical proof recorded all algorithm and experiment changes, accepted adverse timing, maturity boundary, failed-recenter rollback repair, exact-head CI repairs, and nonclaims in `docs/paper/sections/10_implementation.qmd` and `docs/paper/sections/11_optimization.qmd`; that preceding manuscript SHA-256 was `caa8ebead662209cfb55bad9c23638108b74d27497f594eab35006b792fabbc8` and is superseded by the current packet below * on that preceding exact head, the clean Debug LLVM 21 media-enabled suite with experiment hooks enabled passed 38,730 assertions in 697 cases on test binary SHA-256 `0fd25b6e322913cb0e76e3aa5a1fbcc6836d8696b6bbd5886224a3144fea1ec8`. Its complete SQLite-HNSW suite passed 2,614 assertions in 20 cases; focused RIF passed 312 assertions in 19 cases; the complete Python tool suite passed 159 tests; complete hnswlib patch reverse-check and `git diff --check` passed; and WebAssembly rebuilt with Emscripten 4.0.18. This is historical preceding-head evidence, not the current follow-up binary/result binding. A local UBSan-only build completes, but macOS denies its runtime library before `main()` on code-signing policy, so replacement Linux CI owns sanitizer execution -* the current-state overlay, rebuilt 70-record manifest, and fail-closed audit have raw-file SHA-256 values `9ce8a2f3c2cc26b930139f58610552b9202beb8e4547680b57e66f34cc4b9898`, `6558aa35a0ea5ccd9b86eac4302141d34c48eb235eea468f37068766ab5c5f36`, and `717399ecc94647b7264cae7082713c9892508dc79fe7ac0a6d0cc61c14572532`; the audit passes with 70/70 inventory records and no uncovered inventory, claim mismatch, proof-level violation, or ownership violation; its normalized state and manifest SHA-256 values are `1bfe47fdafd5e6392289d7d36c4967478858ca9cffeed6ed29f63ffb01b0fee0` and `03f2d608ded5f837609c4badb721dfe98dec1e4fc63be39b8847f0f7d4f54000`, and the regenerated manuscript SHA-256 is `d7a14688db8027ea446037881d648f87b04360536c1bd775ca505b2cdb0273d6` +* the current-state overlay, rebuilt 70-record manifest, and fail-closed audit have raw-file SHA-256 values `cc94ef0d947adb3baf39f526cc53154b9fbfc24906820fdf0caed314cfea6683`, `36a11dbcf549fa4d6a4020328df1e6e19cd493c1156a5859f27a3a6688c24d25`, and `c86107f8a5d7828c4f788bc176f281ac520e26dd7ed26dfa02137c45b1483abe`; the audit passes with 70/70 inventory records and no uncovered inventory, claim mismatch, proof-level violation, or ownership violation; its normalized state and manifest SHA-256 values are `343bbaf3dfabab7acb9fbd00f08605c4ff292f421580c94689c5abbf6c32d1d5` and `b4db2d9032f53b0a4dd3c702d749c3bf1603fcc4451d9acd4bac9bfcfce825aa`, and the regenerated manuscript SHA-256 is `9f1e956e7759a8aa44571aa879c93583dea3de7691e2fa581aea9b0a56e0bfcc` * the original recursive cutover review remains complete. The exact-head CI repair then received a fresh round one that found one P2 unguarded empty-adjacency HNSW prefetch; repair tree `d3ce8c1ada4ab13023cbcd40959c8a8a878b5307` guards it and adds deterministic update/reseal coverage. A different fresh round-two reviewer proved the complete repair at the P1/P2 threshold with no blocking finding. Its sole P3 control-record hygiene residual was corrected directly; a later append-only project correction record dated 2026-07-21 discloses the earlier in-place continuation mutation, supersedes that compromised provenance, synchronizes the task, and restores the missing lane-ledger history without exposing a machine-local path * fresh round-three cumulative review of baseline tree `156dd7bc27b7cda2c661a9467bfddfe72c771e8a` to candidate tree `71b079ec217128513e593f54bdb308f18a03d8eb` was Proven at P1 with no P1 findings. Round four reviewed candidate `5ea10c156fe6072961b7c43af97b2ac34ed30037` and found no implementation P1, but correctly rejected its stale audit and prior-candidate proof identities at P1. After that repair, a different fresh round-five reviewer proved exact candidate tree `0b4069c73955147da28add9b9eaea480bad48249` for source health at the P1 threshold with no P1 findings. One below-threshold P2 residual remains visible: the bounded cache ranks the global flashbulb prefix before recency/arousal filtering, while the SQL fallback filters eligibility before `LIMIT`. This does not regress the public thread's required intensity-before-truncation order, but full cache/fallback selection equivalence remains unclaimed * the required single non-code review reproduced the merged-state 70/70 trace audit and found two record defects: the external task still capped schema authority at migrations 29/30 and named obsolete head `b7f9e27`, while four current implementer comments lacked the complete metadata and Evidence/Questions/Stop Report shape. Both findings are directly corrected and validated without rereview as required; no code changed after the Proven round-five source candidate @@ -56,10 +56,12 @@ updated_at: 20260721T160600Z * the LF checkout repair passes a fresh `core.autocrlf=true` indexed checkout with zero carriage returns, forward `git apply --check`, the intentionally CRLF-mutated corrupt-patch control, and a fresh Zig text-only 12/12 check whose HNSW preparation step ran successfully. The paper and generated manuscript record the failed Windows experiment and checkout invariant; traceability passes 70/70. Fresh round-one review independently reproduced the proof and found no implementation/config defect; its two P2 record findings were repaired before the completed round-two and final-cumulative reviews recorded next * after a parent-visible corrected round-two start, different fresh reviewer `/root/review_pr6_eol_r2b` proved the LF checkout candidate at P1/P2 with no threshold finding or residual. Separately fresh final cumulative reviewer `/root/review_pr6_eol_final` proved the same exact candidate at P1. Both reviewers are consumed and terminal; Windows execution remains owned by replacement exact-head CI * exact pushed head `cca844d758bc9ad7ddd12048932c274da514d8a6` has 11 green checks, including Linux sanitizer, and only Windows job `88675883348` failed. Three new P2 threads are locally repaired: migration 30 backfills the newest knob-derived legacy exact-signal window before the first aggregate-linked write; legacy embedding-only RIF suppresses every memory sharing the embedding in stable identity order; and an ASSOCIATION-filtered underfilled sparse seed proposal falls back to exact SQL. Focused proof passes 155, 5, and 4 assertions; broader recent-context, competition, and SQLite HNSW groups pass 309, 331, and 2,638 assertions. The complete media-enabled suite passes 39,245 assertions in 704 cases on test binary SHA-256 `c5508e7b083d77cac768b717c04af0862cf64d7c48d339e5a3aa1c0f6b00f068`; Python passes 159, Zig text-only passes 12/12, the paper renders, and traceability passes 70/70. The current user explicitly waived the local recursive blind-review loop for these bot-comment repairs; the interrupted local reviewer produced no verdict, and the PR bot's replacement-head rereview is the review owner after push +* cumulative repair commit `d2213ea42f58666509ef96b22c86dca55d280584` is pushed without force on current main. All 12 exact-head checks are green, including Linux sanitizer and Windows CLI, and GitHub reports OPEN, non-draft, MERGEABLE/CLEAN. The PR bot reviewed this exact head and opened six new P2 threads: eviction ordering leaves stale supersession eligibility, sparse family collapse can underfill without SQL fallback, the active signal ring follows row ID instead of timestamp recency, emotional-source capping precedes eligibility filtering, RIF `active_rows` is double-adjusted around publication, and consolidation counts retired-generation RIF rows. All six are active in-scope repairs; the prior three threads remain resolved +* the six repairs pass 36 focused assertions. The mature sparse-family regression explicitly observes 769 eligible activated rows before family collapse, rejects the post-collapse sparse certificate, and confirms a nonempty bounded exact fallback result. Broader proof passes 460 memory-storage assertions, 149 emotional-cascade assertions, 311 active-RIF assertions, 110 bounded-consolidation assertions, 40 eviction assertions, and 2,639 SQLite-HNSW assertions. The exact final Debug LLVM 21 media-enabled suite passes 39,281 assertions in 710 cases in 1,413.12 seconds on binary SHA-256 `02c9615a918b2675517df3dce76b7d8709ec9fcbfe32e3766da66823e749c2f1`. The paper and generated manuscript describe every algorithm change; 159 Python tests and the 70/70 traceability audit pass. Paper traceability rebuild, non-force push, exact proof replies, thread resolution, replacement-head bot rereview, and exact-head CI remain ## PR Monitor Hot Path -* bind the exact cumulative LF plus three-thread candidate, commit and push without force, then let the PR bot rereview the replacement head; keep the three threads open until that live rereview and exact-head CI are inspected, reply and resolve only with proof-backed current-head evidence, and continue monitoring CI, comments, review requests, unresolved threads, base drift, and conflicts +* repair the six current-head P2 threads narrowly with deterministic focused regressions, update the paper and manuscript for every algorithm/experiment change, run proportionate focused/full proof, push without force, reply with exact commit/proof, resolve the six threads, and let the PR bot rereview the replacement head without a local recursive blind-review loop unless the user changes direction * every ten minutes in this current task, refresh PR 6 exact head, checks, mergeability, reviews, review requests, comments, and unresolved threads; compare with the prior state and report only changes * repair only in-scope failures or review findings with proportionate proof and the required fresh review; push without force and update this goal to the new exact head * stop and deactivate the heartbeat when the PR merges or closes externally, repair exceeds scope, target drift is unrecoverable, or authority is explicitly denied diff --git a/docs/paper/_manuscript/index.md b/docs/paper/_manuscript/index.md index 546bbafa..b4bd51b9 100644 --- a/docs/paper/_manuscript/index.md +++ b/docs/paper/_manuscript/index.md @@ -5834,6 +5834,17 @@ it by *R* only until the 9*C* ceiling, fixes downstream activation at graph construction. These are knob-derived finite limits, not midpoint constants. +Sparse activation is candidate generation rather than an exact +completeness certificate. The route first rejects an activated proposal +when ordinary eligibility leaves fewer rows than the requested seed +count. It then performs the exact cosine-family collapse and repeats the +cardinality check. This second check matters when the sparse proposal +contains enough eligible memory rows but several belong to the same +semantic family; if fewer distinct families remain, the operation +rejects the sparse cache certificate and reopens the complete +processor-surface or authoritative SQL seed path instead of returning a +silently underfilled result. + Consolidation changes activation locality without changing SQLite authority or introducing a second route. Restart opens at the 9*C* ceiling because in-process query age is not durable; every successful @@ -6207,21 +6218,21 @@ Emotional cascade metadata is hydrated into a private, rebuildable processor cache keyed by memory id and base embedding id. The cache preserves the SQL aggregation contract for shared embeddings by retaining every member row and deriving current intensity and half-life -bonus with the same per-embedding minima. Its global bounded -flashbulb-source prefix is ordered by descending emotional intensity -with ascending memory-id ties. A source insertion, removal, or intensity -mutation marks that prefix dirty; before the next cascade, SQLite -refreshes exactly the knob-derived prefix through a partial -intensity/memory-id index and `LIMIT`, so an excluded source can enter -after a retained source falls without a store-sized cache scan. This -establishes intensity-before-truncation ordering, not complete selection -equivalence: the cache bounds the global flashbulb prefix before cascade -recency/arousal eligibility, while the fallback SQL applies those -eligibility predicates before `LIMIT`. Emotional consolidation -overwrites the affected embedding family, cascade propagation applies -the existing maxima, storage and shallow consolidation append rows, and -eviction removes them. Journal-aware rollback discards and rehydrates -this database-derived cache, while arbitrary custom pipelines retain the +bonus with the same per-embedding minima. Its bounded flashbulb-source +prefix is ordered by descending emotional intensity with ascending +memory-id ties. Before each cascade, SQLite applies the event’s +intensity, arousal, and recent-window predicates and only then orders +and truncates to the knob-derived source limit. The private cache +therefore consumes the same eligible prefix as the SQL fallback: a stale +or low-arousal high-intensity row cannot hide a lower-intensity eligible +source. This is selection-equivalence evidence, not a claim that SQLite +can always locate that prefix in work proportional to the returned +limit; a history with many higher-intensity ineligible rows may require +additional indexed filtering. Emotional consolidation overwrites the +affected embedding family, cascade propagation applies the existing +maxima, storage and shallow consolidation append rows, and eviction +removes them. Journal-aware rollback discards and rehydrates this +database-derived cache, while arbitrary custom pipelines retain the complete snapshot path. This changes execution ownership only; source thresholds, tie order, traversal, decay, updates, and persisted rows are unchanged. When multiple emotional sources require traversal, the @@ -6386,13 +6397,17 @@ search because the authoritative surface was already searched. Current writes are excluded by timestamp, and working-memory overlap filters prevent the retrieval result from echoing the active memory tail. Association edges are used as graph evidence; they do not bypass final -scoring or output caps. One dispatch exposes at most one actually used -retrieval candidate, so retrieval does not synthesize reinforcement pair -edges from the packet. Existing `reinforces` edges remain eligible for -decay, pruning, degree normalization, and graph evidence. Historical -public knob helpers for the removed packet-pair writer remain -source-compatible calibrations; only the step calibration still feeds -the production pruning floor. +scoring or output caps. When eviction removes a replacement memory from +the processor surface, removal is published before its outgoing +`supersedes` targets are recomputed. The sidecar therefore cannot retain +an activation timestamp derived from a surface entry that has just been +evicted. One dispatch exposes at most one actually used retrieval +candidate, so retrieval does not synthesize reinforcement pair edges +from the packet. Existing `reinforces` edges remain eligible for decay, +pruning, degree normalization, and graph evidence. Historical public +knob helpers for the removed packet-pair writer remain source-compatible +calibrations; only the step calibration still feeds the production +pruning floor. The retrieval trace path records a ranking ledger for selected and rejected candidates. Production graph retrieval populates composite @@ -6495,14 +6510,21 @@ corners. The logical rounding rule is C++ `std::lround`, so half-integer ties round away from zero. For example, *F* = 1/128, *S* = *T* = 0 yields 65 rather than 64. The logical *B* + 1 probe remains an overflow/completion check; it is not a fetched or processed extra row. -Slot selection is `(signal_id - 1) mod Q`, so each ring upsert replaces -at most one prior exact-vector row. One accepted pipeline event may -persist multiple accumulated signal records and therefore perform -multiple bounded upserts; the measured Natural maximum of 14 ring-table -mutations came from the earlier *B*-capacity experiment and is not a new -*Q*-capacity benchmark. If knobs change, the table rehashes only the -newest rows that fit the newly resolved *Q* and remains bounded by the -old or new knob-derived capacity throughout the transition. +When the table is below *Q*, an upsert occupies its lowest free bounded +slot. When it is full, replacement is owned by the oldest +`(timestamp, signal_id)` frontier; an out-of-order vector older than +that frontier is ignored. Deletion gaps accept the next presented exact +vector and the timestamp frontier resumes ownership as soon as the table +is full. Existing signal identities update in place. Thus row-id gaps +and out-of-order ingestion cannot make a numerically newer identifier +displace a more recent event, and every ordering operation is over at +most *Q* rows. One accepted pipeline event may persist multiple +accumulated signal records and therefore perform multiple bounded +upserts; the measured Natural maximum of 14 ring-table mutations came +from the earlier *B*-capacity experiment and is not a new *Q*-capacity +benchmark. If knobs change, the table rehashes only the newest rows that +fit the newly resolved *Q* and remains bounded by the old or new +knob-derived capacity throughout the transition. When the ring contains rows, recent-context restart hydration admits only signals with an exact ring vector; it does not silently substitute @@ -6521,13 +6543,14 @@ vectors into an apparently full exact window. The global vector index consequently contains memory centroids rather than a growing population of signal-only decoys. The schema and routing code contain no modality or `source_id` branch; text, audio, image, shared, and opaque sources -enter after encoding through the same slot formula. Direct regressions -cover mixed modality/source labels, knob changes, all 27 low/mid/high -F/S/T combinations, and a 151-vector neutral restart whose restored -identities equal the exact signal vectors. A separate upgrade regression -starts from 150 legacy exact signals, performs the first post-migration -aggregate-linked write, and restores all 151 exact vectors; it passes -155 assertions. This does not claim bounded whole-engine restart. +enter after encoding through the same bounded timestamp frontier. Direct +regressions cover mixed modality/source labels, knob changes, all 27 +low/mid/high F/S/T combinations, and a 151-vector neutral restart whose +restored identities equal the exact signal vectors. A separate upgrade +regression starts from 150 legacy exact signals, performs the first +post-migration aggregate-linked write, and restores all 151 exact +vectors; it passes 155 assertions. This does not claim bounded +whole-engine restart. Emotional propagation separately limits enqueued mutation statements to the existing activation target *A* = 2*C* + 2*B*. This is a hard bound @@ -6569,6 +6592,17 @@ only O(1) cache invalidation. None adds a store-size-dependent query or eager graph reconstruction; working-memory persistence remains bounded by the configured live-slot capacity. +The RIF shadow epoch is a disposable SQLite projection of committed +persistent state. Suppression and recovery stage changed identities and +clock values while the persistent transaction is open, but they do not +pre-adjust the shadow’s `active_rows` counter. After the persistent +commit, publication compares the old and new shadow membership and +applies each insertion or removal exactly once. Consolidation’s +active-RIF count and both candidate arms join the singleton recovery +clock on the current generation; retired-generation rows may await +bounded materialization, but they neither consume the active work +ceiling nor enter the current active candidate frontier. + The retained long-horizon optimization target is that mean process latency stays approximately flat as the database grows. The July 2026 exact-replay audit did not prove that target. At the end of the @@ -6674,13 +6708,15 @@ The current branch includes the following implementation-level changes: replace per-event recovery of every active row with a persistent global log clock, indexed exact-threshold expiry, generation resets, and a bounded connection-local SQLite active-epoch projection; publish the -projection only after the shared persistent commit; resolve a legacy -embedding-only loser to every memory sharing that embedding +projection only after the shared persistent commit and change its +active-row count only from the published membership delta; resolve a +legacy embedding-only loser to every memory sharing that embedding effective strength, suppression, timestamp, 10−9 freeze, restart, rollback, caller SQL, eviction, and deterministic ranking remain exact; publication failure rebuilds from persistent authority without replay; -Natural and Durable use the same transaction and Durable adds only its +retired generations do not consume the current active ceiling; Natural +and Durable use the same transaction and Durable adds only its checkpoint barrier; no source-id or modality branch and no full-history projection; ordinary structured competition remains memory-scoped, while legacy embedding-only compatibility work may scale with shared-embedding @@ -6735,10 +6771,12 @@ not activation edges derive target-to-earliest-replacement timestamps in an internal execution sidecar beside the shared association fanout cache and incrementally publish committed MemoryStorage supersession edges instead -of invalidating and rebuilding all fanout rows +of invalidating and rebuilding all fanout rows; remove an evicted +replacement surface before recomputing its targets exact edge direction, base embedding ids, strict timestamp boundary, source/modality independence, SQLite fallback, rollback rehydration, and -the public processor layout are retained +the public processor layout are retained; an evicted replacement cannot +leave a stale target timestamp reconstruction @@ -6780,10 +6818,12 @@ explicitly unclaimed score vector similarity first, restrict recency to a tie-break, cap graph bonus, reserve final occupancy for direct semantic anchors, and reject an underfilled sparse seed proposal after operation-specific -eligibility filtering +eligibility filtering and again after exact semantic-family +collapse recent unrelated rows and noisy graph neighbors cannot displace the -semantic seed surface; ASSOCIATION routing rows cannot -consume sparse slots and suppress the exact SQL fallback +semantic seed surface; neither ASSOCIATION routing rows nor +duplicate activated family members can suppress the exact SQL +fallback rollback snapshots @@ -6806,25 +6846,28 @@ and retention semantics are unchanged emotional cascade metadata maintain a private rebuildable cache of per-memory emotional rows, -per-embedding shared-member minima, recency-ordered flashbulb sources, -and the expandable topology footprint of the last fixed point; update it -at the same successful storage, consolidation, cascade, association, and -eviction decisions and rehydrate it after journal-aware rollback; -caller-supplied roots invalidate the sidecar before forwarding their -first transaction statement, while cache-only roots retain their exact -snapshot; share breadth-first edge visits across source-order 64-bit -batches while retaining a distinct visited bit and radius for every -source +per-embedding shared-member minima, runtime-eligible flashbulb sources, +and the expandable topology footprint of the last fixed point; apply +intensity, arousal, and recent-window predicates before intensity-order +truncation; update the cache at the same successful storage, +consolidation, cascade, association, and eviction decisions and +rehydrate it after journal-aware rollback; caller-supplied roots +invalidate the sidecar before forwarding their first transaction +statement, while cache-only roots retain their exact snapshot; share +breadth-first edge visits across source-order 64-bit batches while +retaining a distinct visited bit and radius for every source source eligibility and stable tie order, shared-embedding MIN/MAX semantics, shortest depth per source, first-source-wins ordering, custom raw-SQL updates within the current transaction, update decisions, and durable database state match the -scalar path; an inserted edge outside every source’s remaining-radius -footprint advances the fixed point without a graph walk, topology -rebuilds invalidate conservatively, batches continue for arbitrary -source counts, and neither path keys behavior by source id or modality; -ordinary engine-owned snapshot work still copies zero store-sized cache -entries +scalar path; high-intensity stale or low-arousal rows cannot hide +eligible sources, though locating the eligible prefix is not claimed to +require only returned-prefix work; an inserted edge outside every +source’s remaining-radius footprint advances the fixed point without a +graph walk, topology rebuilds invalidate conservatively, batches +continue for arbitrary source counts, and neither path keys behavior by +source id or modality; ordinary engine-owned snapshot work still copies +zero store-sized cache entries synaptic tagging @@ -8793,11 +8836,14 @@ currently be outside the prefix. The retained repair marks rank-changing mutations dirty and rebuilds only the knob-derived prefix from a partial SQLite index. Regressions cover a retained source falling below an excluded source and an excluded source rising to the front; query-plan -proof confirms that refresh uses the index rather than a store scan. -This proof is specifically intensity-before-truncation. The bounded -cache still chooses its global flashbulb prefix before recency/arousal -eligibility, whereas fallback SQL filters eligibility before `LIMIT`; -complete cache/fallback source-selection equivalence remains unclaimed. +proof confirms that refresh uses the index rather than a store scan. At +this experiment state the proof was specifically +intensity-before-truncation: the bounded cache still chose its global +flashbulb prefix before recency/arousal eligibility, whereas fallback +SQL filtered eligibility before `LIMIT`. The later exact-head edge +repair recorded below moves those predicates before truncation and +supersedes this selection gap; it does not retroactively turn this +earlier timing run into evidence for the repaired query. The complete exact-winner replay kept top-1 at 1.0, recall at 16 at 0.999386, and semantic coverage at 0.999381, but it did not improve the @@ -8972,6 +9018,28 @@ HNSW groups pass 309, 331, and 2,638 assertions respectively. These are deterministic source-health and completeness experiments, not new long-horizon performance or whole-engine boundedness evidence. +A later exact-head bot review found six additional edge cases in that +repair surface. They were reproduced and corrected together. Eviction +now removes a replacement from the retrieval surface before recomputing +supersession eligibility. Sparse retrieval rechecks requested +cardinality after exact semantic-family collapse, so duplicate activated +rows cannot certify a distinct-family underfill or suppress the complete +processor/SQL seed path. The exact-signal ring orders replacement by +signal timestamp with signal identity only as a stable tie, including +out-of-order writes and physical slot gaps. Emotional source refresh +applies the runtime recency, arousal, and intensity predicates before +the bounded intensity order and `LIMIT`. RIF suppression and recovery +leave `active_rows` unchanged until post-commit shadow publication +applies the membership delta exactly once. Finally, consolidation counts +and selects only rows whose generation matches the singleton recovery +clock, so retired rows do not consume the active-RIF ceiling. The six +focused regressions pass 36 assertions; the surrounding memory-storage, +emotional-cascade, active-RIF, bounded-consolidation, and eviction +groups pass 460, 149, 311, 110, and 40 assertions respectively. These +tests establish deterministic edge behavior on the repaired local +binary; they are not a replacement for exact-head CI, the historical +long-horizon quality matrix, or a new whole-engine boundedness claim. + The remaining consolidation scan was bounded by the same knobs. Let *A* = 2*C* + 2*B* and *N* = max (8, ⌊*B*/2⌋). Score consolidation now admits at most *A* low-effective-strength long-term identities after diff --git a/docs/paper/sections/10_implementation.qmd b/docs/paper/sections/10_implementation.qmd index 75d337dd..5406caa6 100644 --- a/docs/paper/sections/10_implementation.qmd +++ b/docs/paper/sections/10_implementation.qmd @@ -402,6 +402,16 @@ ceiling, fixes downstream activation at $A=2C+2B$, and reserves the smaller $C+B/2B$ envelope for graph construction. These are knob-derived finite limits, not midpoint constants. +Sparse activation is candidate generation rather than an exact completeness +certificate. The route first rejects an activated proposal when ordinary +eligibility leaves fewer rows than the requested seed count. It then performs +the exact cosine-family collapse and repeats the cardinality check. This second +check matters when the sparse proposal contains enough eligible memory rows but +several belong to the same semantic family; if fewer distinct families remain, +the operation rejects the sparse cache certificate and reopens the complete +processor-surface or authoritative SQL seed path instead of returning a +silently underfilled result. + Consolidation changes activation locality without changing SQLite authority or introducing a second route. Restart opens at the $9C$ ceiling because in-process query age is not durable; every successful recenter resets the @@ -751,16 +761,16 @@ Emotional cascade metadata is hydrated into a private, rebuildable processor cache keyed by memory id and base embedding id. The cache preserves the SQL aggregation contract for shared embeddings by retaining every member row and deriving current intensity and half-life bonus with the same per-embedding -minima. Its global bounded flashbulb-source prefix is ordered by descending -emotional intensity with ascending memory-id ties. A source insertion, removal, -or intensity mutation -marks that prefix dirty; before the next cascade, SQLite refreshes exactly the -knob-derived prefix through a partial intensity/memory-id index and `LIMIT`, so -an excluded source can enter after a retained source falls without a -store-sized cache scan. This establishes intensity-before-truncation ordering, -not complete selection equivalence: the cache bounds the global flashbulb -prefix before cascade recency/arousal eligibility, while the fallback SQL -applies those eligibility predicates before `LIMIT`. Emotional +minima. Its bounded flashbulb-source prefix is ordered by descending emotional +intensity with ascending memory-id ties. Before each cascade, SQLite applies +the event's intensity, arousal, and recent-window predicates and only then +orders and truncates to the knob-derived source limit. The private cache +therefore consumes the same eligible prefix as the SQL fallback: a stale or +low-arousal high-intensity row cannot hide a lower-intensity eligible source. +This is selection-equivalence evidence, not a claim that SQLite can always +locate that prefix in work proportional to the returned limit; a history with +many higher-intensity ineligible rows may require additional indexed filtering. +Emotional consolidation overwrites the affected embedding family, cascade propagation applies the existing maxima, storage and shallow consolidation append rows, and eviction removes them. Journal-aware rollback discards and rehydrates this @@ -923,6 +933,10 @@ Current writes are excluded by timestamp, and working-memory overlap filters prevent the retrieval result from echoing the active memory tail. Association edges are used as graph evidence; they do not bypass final scoring or output caps. +When eviction removes a replacement memory from the processor surface, removal +is published before its outgoing `supersedes` targets are recomputed. The +sidecar therefore cannot retain an activation timestamp derived from a surface +entry that has just been evicted. One dispatch exposes at most one actually used retrieval candidate, so retrieval does not synthesize reinforcement pair edges from the packet. Existing `reinforces` edges remain eligible for decay, pruning, degree normalization, and @@ -1023,9 +1037,15 @@ after independently clamping each knob to $[0,1]$. It therefore contains 64, rounding rule is C++ `std::lround`, so half-integer ties round away from zero. For example, $F=1/128,S=T=0$ yields 65 rather than 64. The logical $B+1$ probe remains an overflow/completion check; it is not a fetched or -processed extra row. Slot selection is -`(signal_id - 1) mod Q`, so each ring upsert replaces at most one prior -exact-vector row. One accepted pipeline event may persist multiple accumulated +processed extra row. When the table is below $Q$, an upsert occupies its +lowest free bounded slot. When it is full, replacement is owned by the oldest +`(timestamp, signal_id)` frontier; an out-of-order vector older than that +frontier is ignored. Deletion gaps accept the next presented exact vector and +the timestamp frontier resumes ownership as soon as the table is full. +Existing signal identities update in place. Thus row-id gaps and out-of-order +ingestion cannot make a numerically newer identifier displace a more recent +event, and every ordering operation is over at most $Q$ rows. One accepted +pipeline event may persist multiple accumulated signal records and therefore perform multiple bounded upserts; the measured Natural maximum of 14 ring-table mutations came from the earlier $B$-capacity experiment and is not a new $Q$-capacity benchmark. If knobs change, the @@ -1049,7 +1069,7 @@ into an apparently full exact window. The global vector index consequently contains memory centroids rather than a growing population of signal-only decoys. The schema and routing code contain no modality or `source_id` branch; text, audio, image, shared, and opaque sources enter after encoding through the -same slot formula. Direct regressions cover mixed modality/source labels, knob +same bounded timestamp frontier. Direct regressions cover mixed modality/source labels, knob changes, all 27 low/mid/high F/S/T combinations, and a 151-vector neutral restart whose restored identities equal the exact signal vectors. A separate upgrade regression starts from 150 legacy exact signals, performs the first @@ -1093,6 +1113,16 @@ persistence, and graph writes perform only O(1) cache invalidation. None adds a store-size-dependent query or eager graph reconstruction; working-memory persistence remains bounded by the configured live-slot capacity. +The RIF shadow epoch is a disposable SQLite projection of committed persistent +state. Suppression and recovery stage changed identities and clock values while +the persistent transaction is open, but they do not pre-adjust the shadow's +`active_rows` counter. After the persistent commit, publication compares the +old and new shadow membership and applies each insertion or removal exactly +once. Consolidation's active-RIF count and both candidate arms join the +singleton recovery clock on the current generation; retired-generation rows +may await bounded materialization, but they neither consume the active work +ceiling nor enter the current active candidate frontier. + The retained long-horizon optimization target is that mean process latency stays approximately flat as the database grows. The July 2026 exact-replay audit did not prove that target. At the end of the 2,636-event replay, the diff --git a/docs/paper/sections/11_optimization.qmd b/docs/paper/sections/11_optimization.qmd index 2b9889b8..7b0c3279 100644 --- a/docs/paper/sections/11_optimization.qmd +++ b/docs/paper/sections/11_optimization.qmd @@ -59,17 +59,17 @@ The current branch includes the following implementation-level changes: | Area | Optimization | Behavior contract | |---|---|---| | SQLite execution | prepared-statement reuse in the store layer | same SQL semantics, lower repeated parse overhead | -| retrieval-induced inhibition | replace per-event recovery of every active row with a persistent global log clock, indexed exact-threshold expiry, generation resets, and a bounded connection-local SQLite active-epoch projection; publish the projection only after the shared persistent commit; resolve a legacy embedding-only loser to every memory sharing that embedding | effective strength, suppression, timestamp, $10^{-9}$ freeze, restart, rollback, caller SQL, eviction, and deterministic ranking remain exact; publication failure rebuilds from persistent authority without replay; Natural and Durable use the same transaction and Durable adds only its checkpoint barrier; no source-id or modality branch and no full-history projection; ordinary structured competition remains memory-scoped, while legacy embedding-only compatibility work may scale with shared-embedding membership | +| retrieval-induced inhibition | replace per-event recovery of every active row with a persistent global log clock, indexed exact-threshold expiry, generation resets, and a bounded connection-local SQLite active-epoch projection; publish the projection only after the shared persistent commit and change its active-row count only from the published membership delta; resolve a legacy embedding-only loser to every memory sharing that embedding | effective strength, suppression, timestamp, $10^{-9}$ freeze, restart, rollback, caller SQL, eviction, and deterministic ranking remain exact; publication failure rebuilds from persistent authority without replay; retired generations do not consume the current active ceiling; Natural and Durable use the same transaction and Durable adds only its checkpoint barrier; no source-id or modality branch and no full-history projection; ordinary structured competition remains memory-scoped, while legacy embedding-only compatibility work may scale with shared-embedding membership | | vector ranking | bounded top-k selection and architecture SIMD kernels in the vector path | same candidate contract; SIMD accepted after output checks | | retrieval seed surface | current-memory embedding lookup with pre-cap supersession filtering; immutable normalized and stored/Hadamard block summaries cached per private surface entry; exact partial squared-distance rejection plus complementary sound 32-block Cauchy--Schwarz bounds in the stored and Walsh--Hadamard bases before exact cosine family checks; shared vectors retain all long-term metadata alternatives; the private search cache follows the processor's latest reconstruction surface independently of persisted-current materialization; cache loss uses the complete processor surface directly or, only when that surface is incomplete, metadata-eligible, distance-ordered, F/S/T-bounded SQL pages feeding one cross-page cosine-family index that substitutes latest reconstructions before accounting | latest reconstruction and eligible shared-embedding siblings remain visible, byte-distinct near-duplicate boilerplate and stale base families that converge after reconstruction cannot consume the semantic-family candidate budget, sparse and dense orthogonal vector families avoid broad exact cosine work, recovery does not return the complete result at once, ephemeral recovery does not mutate the registry, and source/modality metadata cannot influence rank; sqlite-vec still scans linearly for every requested SQL page, the historical window partition may internally sort and materialize the full eligible history, and the knob-derived top-k bounds only rows returned to C++ and decoded downstream rather than claiming sublinear search or bounded internal sorter memory | | graph expansion | retained traversal types: `co_occurs`, `similar_to`, `reinforces`, `causes`, `derived_from`, `next_in_episode`, `prev_in_episode`, and `within_same_event`; `reinforces` is degree-normalized | graph activation is bounded and high-degree hubs cannot dominate; directional `supersedes` relations define families but are not activation edges | -| supersession eligibility | derive target-to-earliest-replacement timestamps in an internal execution sidecar beside the shared association fanout cache and incrementally publish committed MemoryStorage supersession edges instead of invalidating and rebuilding all fanout rows | exact edge direction, base embedding ids, strict timestamp boundary, source/modality independence, SQLite fallback, rollback rehydration, and the public processor layout are retained | +| supersession eligibility | derive target-to-earliest-replacement timestamps in an internal execution sidecar beside the shared association fanout cache and incrementally publish committed MemoryStorage supersession edges instead of invalidating and rebuilding all fanout rows; remove an evicted replacement surface before recomputing its targets | exact edge direction, base embedding ids, strict timestamp boundary, source/modality independence, SQLite fallback, rollback rehydration, and the public processor layout are retained; an evicted replacement cannot leave a stale target timestamp | | reconstruction | knob-bounded retrieval-time reconstruction append | constructive recall remains non-decoder and can be disabled cleanly | | memory storage | avoid redundant object-store writes for single-signal memory payloads | durable payload identity is preserved | | supersession neighbor ranking | below the sparse cutover, or whenever the route is unpublished, overflowing, or invalid, maintain private current/base embedding surfaces and retain the exact historical-coverage proof and SQL fallback; above the knob-derived cutover, reuse the SQLite HNSW activation surface, inspect an $8C$ post-consolidation floor that advances by $R=\max(2,\lfloor B/16\rfloor)$ to a $9C$ ceiling, rerank at most $A=2C+2B$ activated current centroids, then require the historical cache's exact coverage/ranking proof or retain SQLite fallback rather than treating the sparse result as complete | the current sparse-candidate query remains bounded by $9C+A$, but exact historical verification may remain history-sized; timestamp, kind, duplicate band, similarity threshold, edge limit, deterministic tie order, rollback, source/modality independence, and public API shape remain unchanged; write throughput and production-wide boundedness are explicitly unclaimed | -| graph retrieval | score vector similarity first, restrict recency to a tie-break, cap graph bonus, reserve final occupancy for direct semantic anchors, and reject an underfilled sparse seed proposal after operation-specific eligibility filtering | recent unrelated rows and noisy graph neighbors cannot displace the semantic seed surface; `ASSOCIATION` routing rows cannot consume sparse slots and suppress the exact SQL fallback | +| graph retrieval | score vector similarity first, restrict recency to a tie-break, cap graph bonus, reserve final occupancy for direct semantic anchors, and reject an underfilled sparse seed proposal after operation-specific eligibility filtering and again after exact semantic-family collapse | recent unrelated rows and noisy graph neighbors cannot displace the semantic seed surface; neither `ASSOCIATION` routing rows nor duplicate activated family members can suppress the exact SQL fallback | | rollback snapshots | detach rebuildable durable caches, deep-copy the internal execution-sidecar state only for full snapshots, move the private accumulator map, and detach working-memory signal-record and blob-reference vectors before copying remaining processor state; journal active-source vector lengths for ordinary appends and lazily deep-back up only the active source before accepted storage, flush reset, or interrupt reset can mutate prior records; trim working-memory appends and move an evicted slot's record ownership into the journal; reserve a full-map hook for explicit foreign-source accumulator-topology mutation | non-boundary Natural ingestion does not recopy the growing pending unit or source map; a one-source flush does not copy unrelated open-source or working-memory history; failed writes and public no-store queries restore durable and volatile state exactly; public state layout and retention semantics are unchanged | -| emotional cascade metadata | maintain a private rebuildable cache of per-memory emotional rows, per-embedding shared-member minima, recency-ordered flashbulb sources, and the expandable topology footprint of the last fixed point; update it at the same successful storage, consolidation, cascade, association, and eviction decisions and rehydrate it after journal-aware rollback; caller-supplied roots invalidate the sidecar before forwarding their first transaction statement, while cache-only roots retain their exact snapshot; share breadth-first edge visits across source-order 64-bit batches while retaining a distinct visited bit and radius for every source | source eligibility and stable tie order, shared-embedding `MIN`/`MAX` semantics, shortest depth per source, first-source-wins ordering, custom raw-SQL updates within the current transaction, update decisions, and durable database state match the scalar path; an inserted edge outside every source's remaining-radius footprint advances the fixed point without a graph walk, topology rebuilds invalidate conservatively, batches continue for arbitrary source counts, and neither path keys behavior by source id or modality; ordinary engine-owned snapshot work still copies zero store-sized cache entries | +| emotional cascade metadata | maintain a private rebuildable cache of per-memory emotional rows, per-embedding shared-member minima, runtime-eligible flashbulb sources, and the expandable topology footprint of the last fixed point; apply intensity, arousal, and recent-window predicates before intensity-order truncation; update the cache at the same successful storage, consolidation, cascade, association, and eviction decisions and rehydrate it after journal-aware rollback; caller-supplied roots invalidate the sidecar before forwarding their first transaction statement, while cache-only roots retain their exact snapshot; share breadth-first edge visits across source-order 64-bit batches while retaining a distinct visited bit and radius for every source | source eligibility and stable tie order, shared-embedding `MIN`/`MAX` semantics, shortest depth per source, first-source-wins ordering, custom raw-SQL updates within the current transaction, update decisions, and durable database state match the scalar path; high-intensity stale or low-arousal rows cannot hide eligible sources, though locating the eligible prefix is not claimed to require only returned-prefix work; an inserted edge outside every source's remaining-radius footprint advances the fixed point without a graph walk, topology rebuilds invalidate conservatively, batches continue for arbitrary source counts, and neither path keys behavior by source id or modality; ordinary engine-owned snapshot work still copies zero store-sized cache entries | | synaptic tagging | use indexed temporal candidate supersets with boundary ties before applying the original exact score and order | the same nearest source-backed memories are tagged without a whole-source group scan | | live replay ingress | internal replay path can skip per-event hydration when no probe needs it | public processing APIs still hydrate normally | @@ -1359,10 +1359,13 @@ prefix. The retained repair marks rank-changing mutations dirty and rebuilds only the knob-derived prefix from a partial SQLite index. Regressions cover a retained source falling below an excluded source and an excluded source rising to the front; query-plan proof confirms that refresh uses the index rather than -a store scan. This proof is specifically intensity-before-truncation. The -bounded cache still chooses its global flashbulb prefix before recency/arousal -eligibility, whereas fallback SQL filters eligibility before `LIMIT`; complete -cache/fallback source-selection equivalence remains unclaimed. +a store scan. At this experiment state the proof was specifically +intensity-before-truncation: the bounded cache still chose its global +flashbulb prefix before recency/arousal eligibility, whereas fallback SQL +filtered eligibility before `LIMIT`. The later exact-head edge repair recorded +below moves those predicates before truncation and supersedes this selection +gap; it does not retroactively turn this earlier timing run into evidence for +the repaired query. The complete exact-winner replay kept top-1 at 1.0, recall at 16 at 0.999386, and semantic coverage at 0.999381, but it did not improve the full @@ -1523,6 +1526,27 @@ underfilled proposal and restores the SQL path; its 700-node regression passes source-health and completeness experiments, not new long-horizon performance or whole-engine boundedness evidence. +A later exact-head bot review found six additional edge cases in that repair +surface. They were reproduced and corrected together. Eviction now removes a +replacement from the retrieval surface before recomputing supersession +eligibility. Sparse retrieval rechecks requested cardinality after exact +semantic-family collapse, so duplicate activated rows cannot certify a +distinct-family underfill or suppress the complete processor/SQL seed path. +The exact-signal ring orders replacement by signal +timestamp with signal identity only as a stable tie, including out-of-order +writes and physical slot gaps. Emotional source refresh applies the runtime +recency, arousal, and intensity predicates before the bounded intensity order +and `LIMIT`. RIF suppression and recovery leave `active_rows` unchanged until +post-commit shadow publication applies the membership delta exactly once. +Finally, consolidation counts and selects only rows whose generation matches +the singleton recovery clock, so retired rows do not consume the active-RIF +ceiling. The six focused regressions pass 36 assertions; the surrounding +memory-storage, emotional-cascade, active-RIF, bounded-consolidation, and +eviction groups pass 460, 149, 311, 110, and 40 assertions respectively. These +tests establish deterministic edge behavior on the repaired local binary; +they are not a replacement for exact-head CI, the historical long-horizon +quality matrix, or a new whole-engine boundedness claim. + The remaining consolidation scan was bounded by the same knobs. Let $A=2C+2B$ and $N=\max(8,\lfloor B/2\rfloor)$. Score consolidation now admits at most $A$ low-effective-strength long-term identities after merging two diff --git a/src/operations/active_signal_embedding_ring_internal.hpp b/src/operations/active_signal_embedding_ring_internal.hpp index a21f1315..4739858b 100644 --- a/src/operations/active_signal_embedding_ring_internal.hpp +++ b/src/operations/active_signal_embedding_ring_internal.hpp @@ -20,18 +20,9 @@ Capacity (double focus, double sensitivity, double stability) focus, sensitivity, stability); } -inline long long -SlotFor (long long signal_id, int capacity) -{ - if (signal_id <= 0 || capacity <= 0) - throw std::invalid_argument ("invalid active signal embedding ring key"); - return (signal_id - 1) % static_cast (capacity); -} - inline void -InsertAtCapacity (Transaction &tx, long long signal_id, - const std::any &embedding, long long created_at, - int capacity) +InsertIntoSlot (Transaction &tx, long long slot, long long signal_id, + const std::any &embedding, long long created_at, int capacity) { tx.Execute ( "INSERT INTO cortext_active_signal_embeddings(" @@ -42,10 +33,88 @@ InsertAtCapacity (Transaction &tx, long long signal_id, "embedding = excluded.embedding, " "created_at = excluded.created_at, " "capacity = excluded.capacity", - { SlotFor (signal_id, capacity), signal_id, embedding, created_at, + { slot, signal_id, embedding, created_at, static_cast (capacity) }); } +inline void +InsertAtCapacity (Transaction &tx, long long signal_id, + const std::any &embedding, long long created_at, + int capacity) +{ + if (signal_id <= 0 || capacity <= 0) + throw std::invalid_argument ("invalid active signal embedding ring key"); + + const auto existing = tx.Execute ( + "SELECT slot FROM cortext_active_signal_embeddings " + "WHERE signal_id = ? LIMIT 1", + { signal_id }); + if (!existing.empty ()) + { + const auto slot + = store::AnyToLongLong (existing.front ().at ("slot")).value_or (-1); + if (slot < 0) + throw std::runtime_error ("invalid active signal embedding slot"); + InsertIntoSlot (tx, slot, signal_id, embedding, created_at, capacity); + return; + } + + const auto count_rows = tx.Execute ( + "SELECT COUNT(*) AS row_count " + "FROM cortext_active_signal_embeddings"); + const auto row_count + = count_rows.empty () + ? 0 + : store::AnyToLongLong ( + count_rows.front ().at ("row_count")).value_or (-1); + if (row_count < 0 || row_count > capacity) + throw std::runtime_error ("invalid active signal embedding row count"); + + if (row_count < capacity) + { + // A signal deletion can leave a physical slot gap. Fill it with the + // next exact vector presented to this bounded ring; once full, the + // timestamp frontier below—not row identity—owns replacement order. + const auto free_rows = tx.Execute ( + "WITH RECURSIVE slots(slot) AS (" + " SELECT 0 UNION ALL " + " SELECT slot + 1 FROM slots WHERE slot + 1 < ?" + ") " + "SELECT slots.slot FROM slots " + "LEFT JOIN cortext_active_signal_embeddings a " + "ON a.slot = slots.slot " + "WHERE a.slot IS NULL ORDER BY slots.slot LIMIT 1", + { static_cast (capacity) }); + if (free_rows.empty ()) + throw std::runtime_error ("active signal embedding slot unavailable"); + const auto slot = store::AnyToLongLong ( + free_rows.front ().at ("slot")).value_or (-1); + if (slot < 0) + throw std::runtime_error ("invalid active signal embedding slot"); + InsertIntoSlot (tx, slot, signal_id, embedding, created_at, capacity); + return; + } + + const auto oldest_rows = tx.Execute ( + "SELECT slot, signal_id, created_at " + "FROM cortext_active_signal_embeddings " + "ORDER BY created_at ASC, signal_id ASC LIMIT 1"); + if (oldest_rows.empty ()) + throw std::runtime_error ("active signal embedding frontier unavailable"); + const auto oldest_slot + = store::AnyToLongLong (oldest_rows.front ().at ("slot")).value_or (-1); + const auto oldest_signal_id = store::AnyToLongLong ( + oldest_rows.front ().at ("signal_id")).value_or (0); + const auto oldest_created_at = store::AnyToLongLong ( + oldest_rows.front ().at ("created_at")).value_or (0); + if (oldest_slot < 0 || oldest_signal_id <= 0) + throw std::runtime_error ("invalid active signal embedding frontier"); + if (created_at < oldest_created_at + || (created_at == oldest_created_at && signal_id <= oldest_signal_id)) + return; + InsertIntoSlot (tx, oldest_slot, signal_id, embedding, created_at, capacity); +} + inline void EnsureCapacity (Transaction &tx, int capacity) { @@ -61,8 +130,7 @@ EnsureCapacity (Transaction &tx, int capacity) // newest legacy window before the first post-migration signal switches // signals.embedding_id to the aggregate memory embedding. auto legacy_rows = tx.Execute ( - "SELECT s.signal_id, e.embedding, " - " COALESCE(s.created_at, s.timestamp) AS created_at " + "SELECT s.signal_id, e.embedding, s.timestamp AS created_at " "FROM signals s " "JOIN embeddings e ON e.embedding_id = s.embedding_id " "ORDER BY s.timestamp DESC, s.signal_id DESC LIMIT ?", @@ -96,7 +164,7 @@ EnsureCapacity (Transaction &tx, int capacity) auto rows = tx.Execute ( "SELECT signal_id, embedding, created_at " "FROM cortext_active_signal_embeddings " - "ORDER BY signal_id DESC LIMIT ?", + "ORDER BY created_at DESC, signal_id DESC LIMIT ?", { static_cast (capacity) }); tx.Execute ("DELETE FROM cortext_active_signal_embeddings"); std::reverse (rows.begin (), rows.end ()); diff --git a/src/operations/competition.cpp b/src/operations/competition.cpp index 61e59373..bc3534aa 100644 --- a/src/operations/competition.cpp +++ b/src/operations/competition.cpp @@ -92,12 +92,6 @@ ApplyRIFRecovery (OperationContext &context, Transaction &tx, long long now_ts, result.clock.log_factor, result.clock.last_ts); rif_active_epoch_cache_internal::StageMemories ( sidecar->rif_active_epoch, result.changed_memory_ids); - if (result.generation_reset) - sidecar->rif_active_epoch.active_rows = 0; - else - sidecar->rif_active_epoch.active_rows - -= std::min (sidecar->rif_active_epoch.active_rows, - result.expired_rows); auto &p_ctx = context.GetProcessorContext (); p_ctx.retrieval_suppression_embedding_ids.clear (); p_ctx.retrieval_suppression_memory_ids.clear (); @@ -157,7 +151,6 @@ ApplyLateralInhibition (const std::vector &winners, double competition_scale, long long now_ts, Transaction &tx, rif_active_epoch_cache_internal::State &epoch, - std::size_t &active_rows, int &suppressed_count) { for (const auto &loser : losers) @@ -185,9 +178,8 @@ ApplyLateralInhibition (const std::vector &winners, continue; for (const long long memory_id : memory_ids) { - if (rif_state_internal::SuppressMemory ( - tx, memory_id, total_supp, now_ts)) - ++active_rows; + rif_state_internal::SuppressMemory ( + tx, memory_id, total_supp, now_ts); rif_active_epoch_cache_internal::StageMemory (epoch, memory_id); ++suppressed_count; } @@ -282,7 +274,6 @@ ApplyRetrievalCompetition::Execute (OperationContext &context, ApplyLateralInhibition (winners, losers, radius, cfg.focus, cfg.sensitivity, cfg.stability, competition_scale, now_ts, tx, sidecar->rif_active_epoch, - sidecar->rif_active_epoch.active_rows, suppressed_count); // Debug logging diff --git a/src/operations/consolidation.cpp b/src/operations/consolidation.cpp index fe7df8c6..c6193c90 100644 --- a/src/operations/consolidation.cpp +++ b/src/operations/consolidation.cpp @@ -65,7 +65,9 @@ ScoreConsolidation::Execute (OperationContext &context, Transaction &tx) const .mutation_count; const auto active_count_rows = tx.Execute ( "SELECT COUNT(*) AS row_count FROM (" - " SELECT 1 FROM rif_active_state LIMIT ?" + " SELECT 1 FROM rif_active_state a " + " JOIN rif_recovery_clock c ON c.generation = a.generation " + " WHERE c.singleton = 1 LIMIT ?" ")", { static_cast (active_state_limit + 1) }); long long active_state_count = 0; @@ -97,7 +99,8 @@ ScoreConsolidation::Execute (OperationContext &context, Transaction &tx) const " AND m.cluster_id IS NULL " " AND NOT EXISTS(" " SELECT 1 FROM rif_active_state a " - " WHERE a.memory_id = m.memory_id" + " JOIN rif_recovery_clock c ON c.generation = a.generation " + " WHERE c.singleton = 1 AND a.memory_id = m.memory_id" " ) " " ORDER BY m.strength ASC, m.created_at ASC, " " m.embedding_id ASC " @@ -114,7 +117,7 @@ ScoreConsolidation::Execute (OperationContext &context, Transaction &tx) const " JOIN memories m ON m.memory_id = a.memory_id " " CROSS JOIN rif_recovery_clock c " " WHERE m.kind = 'LONG_TERM' AND m.cluster_id IS NULL " - " AND c.singleton = 1 " + " AND c.singleton = 1 AND a.generation = c.generation " " ORDER BY effective_strength ASC, m.created_at ASC, " " m.embedding_id ASC " " LIMIT ?8" diff --git a/src/operations/emotion_cascade.cpp b/src/operations/emotion_cascade.cpp index 40e36807..e49221e6 100644 --- a/src/operations/emotion_cascade.cpp +++ b/src/operations/emotion_cascade.cpp @@ -608,7 +608,7 @@ PropagateEmotionalCascade::Execute (OperationContext &context, Transaction &tx) "CORTEXT_PROFILE_EMOTIONAL_METADATA_SQL"); if (use_metadata_cache && !emotional_metadata_cache_internal::RefreshBoundedSourceOrder ( - p_ctx, tx)) + p_ctx, tx, recent_window_ts, theta_intensity, theta_arousal)) use_metadata_cache = false; const std::uint64_t emotional_input_generation = use_metadata_cache diff --git a/src/operations/emotional_metadata_cache_internal.hpp b/src/operations/emotional_metadata_cache_internal.hpp index 1693f95a..3af40d89 100644 --- a/src/operations/emotional_metadata_cache_internal.hpp +++ b/src/operations/emotional_metadata_cache_internal.hpp @@ -184,7 +184,9 @@ Reset (ProcessorContext &p_ctx, std::vector rows, } inline bool -RefreshBoundedSourceOrder (ProcessorContext &p_ctx, Transaction &tx) +RefreshBoundedSourceOrder (ProcessorContext &p_ctx, Transaction &tx, + long long recent_window_ts, + double theta_intensity, double theta_arousal) { const auto state = FindState (p_ctx); if (!state) @@ -193,16 +195,19 @@ RefreshBoundedSourceOrder (ProcessorContext &p_ctx, Transaction &tx) if (!cache.valid) return false; if (cache.source_query_capacity - == std::numeric_limits::max () - || !cache.source_query_order_dirty) + == std::numeric_limits::max ()) return true; auto rows = tx.Execute ( "SELECT memory_id FROM memories " "WHERE flashbulb = 1 AND embedding_id IS NOT NULL " "AND kind != 'WORKING' " + "AND emotional_intensity >= ? " + "AND s_arousal_avg >= ? " + "AND created_at >= ? " "ORDER BY emotional_intensity DESC, memory_id ASC LIMIT ?", - { static_cast (cache.source_query_capacity) }); + { theta_intensity, theta_arousal, recent_window_ts, + static_cast (cache.source_query_capacity) }); std::vector order; order.reserve (rows.size ()); for (const auto &result : rows) diff --git a/src/operations/graph_retrieval.cpp b/src/operations/graph_retrieval.cpp index 4c066b55..2f2c61b9 100644 --- a/src/operations/graph_retrieval.cpp +++ b/src/operations/graph_retrieval.cpp @@ -888,6 +888,13 @@ LoadCurrentSeedRowsFromCache ( return state->current_entries[candidate_index]; }, profile); + // Sparse activation is not family-complete either. Multiple activated rows + // can collapse to one semantic family, so re-check completeness after the + // exact family filter before certifying the cache result. Returning no + // cache result reopens the complete processor-surface or SQL seed path. + if (use_sparse_route + && ranked.size () < static_cast (candidate_limit)) + return std::nullopt; if (profile) profile->selected_rows += ranked.size (); AddSeedCachePhaseTime (profile, &SeedCacheProfile::family_ms, diff --git a/src/operations/memory_strength.cpp b/src/operations/memory_strength.cpp index de68885a..d4dfd32c 100644 --- a/src/operations/memory_strength.cpp +++ b/src/operations/memory_strength.cpp @@ -672,9 +672,9 @@ UpdateMemoryStrength::Execute (OperationContext &context, Transaction &tx) const for (const long long memory_id : evictable_memory_ids) { + p_ctx.RemoveRetrievalSurface (memory_id); association_fanout_cache::NotifyRetrievalSurfaceChanged (p_ctx, memory_id); - p_ctx.RemoveRetrievalSurface (memory_id); retrieval_trace::RecordSurfaceRemove (memory_id); historical_surface_search_cache_internal::RemoveCurrent (p_ctx, memory_id); diff --git a/tests/operations_competition.test.cpp b/tests/operations_competition.test.cpp index a3a2b1b8..20f62318 100644 --- a/tests/operations_competition.test.cpp +++ b/tests/operations_competition.test.cpp @@ -875,6 +875,53 @@ TEST_CASE ("RIF active epoch publishes only after persistent commit and " REQUIRE (restarted.allocated_bytes <= restarted.limits.allocated_bytes); } +TEST_CASE ("RIF active row count changes exactly once during shadow " + "publication", + "[operations][competition][rif_state][active_epoch]" + "[publication][regression]") +{ + namespace cache + = cortext::operations::rif_active_epoch_cache_internal; + namespace rif = cortext::operations::rif_state_internal; + auto store = cortext::SQLiteStore::Create (":memory:"); + cortext::testing::InitializeCoreSchema (*store); + store->Execute ( + "INSERT INTO memories(memory_id, source_id, kind, start_ts, n_signals, " + "modality, strength, suppression, suppression_ts, created_at) " + "VALUES(1, 'opaque/rif-count', 'LONG_TERM', 1000, 1, 'image', " + "1.0, 0.0, 1000, 1000)"); + rif::RebuildFromMaterialized (*store); + + cache::State epoch; + const auto limits = cache::DeriveLimits (0.5, 0.5, 0.5); + cache::Ensure (epoch, *store, limits); + REQUIRE (epoch.active_rows == 0); + + auto tx = store->Begin (); + REQUIRE (rif::SuppressMemory (*tx, 1, 0.25, 2000)); + cache::StageMemory (epoch, 1); + REQUIRE (epoch.active_rows == 0); + tx->Commit (); + const auto suppression_publication + = cache::PublishAfterPersistentCommit (epoch, *store); + REQUIRE (suppression_publication.published); + REQUIRE (epoch.active_rows == 1); + + tx = store->Begin (); + const auto recovered = rif::AdvanceRecovery ( + *tx, 20'000, 1.0, limits.row_batch_size); + REQUIRE (recovered.generation_reset); + cache::StageClock (epoch, recovered.clock.generation, + recovered.clock.log_factor, recovered.clock.last_ts); + cache::StageMemories (epoch, recovered.changed_memory_ids); + REQUIRE (epoch.active_rows == 1); + tx->Commit (); + const auto recovery_publication + = cache::PublishAfterPersistentCommit (epoch, *store); + REQUIRE (recovery_publication.published); + REQUIRE (epoch.active_rows == 0); +} + TEST_CASE ("RIF active epoch row batches follow nine F S T points and " "preserve a live B plus one mutation", "[operations][competition][rif_state][active_epoch][knobs]") diff --git a/tests/operations_consolidation.test.cpp b/tests/operations_consolidation.test.cpp index 9c6e5374..3f19883d 100644 --- a/tests/operations_consolidation.test.cpp +++ b/tests/operations_consolidation.test.cpp @@ -925,6 +925,68 @@ TEST_CASE ("ScoreConsolidation fails closed above its active RIF work ceiling", == static_cast (active_state_limit)); } +TEST_CASE ("ScoreConsolidation ignores retired RIF generations at the active " + "work ceiling", + "[operations][consolidation][bounded][rif_state][generation]" + "[regression]") +{ + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + cortext::store::ApplyMigrations (*store); + + SignalProcessor::Config cfg; + cortext::testing::RequireEncoder (cfg); + cfg.focus = 0.0; + cfg.sensitivity = 0.0; + cfg.stability = 0.0; + const auto active_state_limit + = operations::rif_active_epoch_cache_internal::DeriveLimits ( + cfg.focus, cfg.sensitivity, cfg.stability) + .mutation_count; + const long long retired_count + = static_cast (active_state_limit + 1); + store->Execute ( + "WITH RECURSIVE sequence(value) AS (" + " SELECT 1 UNION ALL SELECT value + 1 FROM sequence WHERE value < ?" + ") INSERT INTO memories(memory_id, source_id, kind, start_ts, " + "n_signals, modality, strength, stability, redundancy, created_at) " + "SELECT value, 'opaque/retired-rif', 'WORKING', value, 1, 'audio', " + "0.0, 0.0, 0.0, value FROM sequence", + { retired_count }); + store->Execute ( + "INSERT INTO rif_active_state(memory_id, generation, " + "anchor_suppression, recovery_total, anchor_log_factor, " + "expires_log_factor) " + "SELECT memory_id, 1, 0.1, 1.1, 0.0, -20.0 FROM memories"); + store->Execute ( + "UPDATE rif_recovery_clock SET generation = 2 WHERE singleton = 1"); + const long long current_id = retired_count + 1; + store->Execute ( + "INSERT INTO memories(memory_id, source_id, kind, start_ts, n_signals, " + "modality, strength, stability, redundancy, created_at) " + "VALUES(?, 'opaque/current-rif', 'WORKING', ?, 1, 'text', 0.0, 0.0, " + "0.0, ?)", + { current_id, current_id, current_id }); + store->Execute ( + "INSERT INTO rif_active_state(memory_id, generation, " + "anchor_suppression, recovery_total, anchor_log_factor, " + "expires_log_factor) VALUES(?, 2, 0.1, 1.1, 0.0, -20.0)", + { current_id }); + + Signal signal; + signal.timestamp = 56'000ULL; + signal.source_id = "opaque/current-rif"; + signal.modality = "text"; + signal.force_consolidation = true; + signal.embedding = Eigen::VectorXf::Zero (4); + ProcessorContext p_ctx; + OperationContext ctx (signal, p_ctx, cfg, store.get ()); + auto tx = store->Begin (); + REQUIRE_NOTHROW (ScoreConsolidation{}.Execute (ctx, *tx)); + REQUIRE (ctx.GetOperationTimings ().at ( + "ScoreConsolidation.active_state_count") + == 1.0); +} + TEST_CASE ("ScoreConsolidation filters clustered rows before each bounded " "candidate frontier", "[operations][consolidation][bounded][cluster][regression]") diff --git a/tests/operations_emotion_cascade.test.cpp b/tests/operations_emotion_cascade.test.cpp index b359d657..14eb7b1d 100644 --- a/tests/operations_emotion_cascade.test.cpp +++ b/tests/operations_emotion_cascade.test.cpp @@ -404,7 +404,8 @@ TEST_CASE ("Bounded emotional source reranking refills from SQLite", REQUIRE (cache.source_query_order_dirty); REQUIRE ( operations::emotional_metadata_cache_internal:: - RefreshBoundedSourceOrder (processor_context, *transaction)); + RefreshBoundedSourceOrder (processor_context, *transaction, 0, + 0.0, 0.0)); REQUIRE (cache.source_query_order == std::vector{ 2, 3, 4 }); REQUIRE_FALSE (cache.source_query_order_dirty); @@ -415,11 +416,52 @@ TEST_CASE ("Bounded emotional source reranking refills from SQLite", REQUIRE (cache.source_query_order_dirty); REQUIRE ( operations::emotional_metadata_cache_internal:: - RefreshBoundedSourceOrder (processor_context, *transaction)); + RefreshBoundedSourceOrder (processor_context, *transaction, 0, + 0.0, 0.0)); REQUIRE (cache.source_query_order == std::vector{ 5, 2, 3 }); transaction->Rollback (); } +TEST_CASE ("Bounded emotional source reranking filters runtime eligibility " + "before truncation", + "[operations][emotion_cascade][metadata_cache][bounds]" + "[eligibility][regression]") +{ + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + cortext::testing::InitializeCoreSchema (*store); + ProcessorContext processor_context; + ScopedExecutionCacheSidecar sidecar_scope (processor_context); + std::vector + rows; + for (long long memory_id = 1; memory_id <= 5; ++memory_id) + { + SeedCascadeMemory (*store, memory_id, memory_id, 2000 + memory_id); + SetCascadeSource (*store, memory_id, 1.0 - 0.05 * memory_id, 1, + 0.5); + rows.push_back ({ memory_id, memory_id, 2000 + memory_id, true, + 1.0 - 0.05 * memory_id, 0.9, 2.0, 1, 0.5 }); + } + operations::emotional_metadata_cache_internal::Reset ( + processor_context, std::move (rows), 3); + const auto state + = operations::emotional_metadata_cache_internal::FindState ( + processor_context); + REQUIRE (state); + auto &cache = state->emotional_metadata; + REQUIRE (cache.source_query_order == std::vector{ 1, 2, 3 }); + + store->Execute ("UPDATE memories SET created_at = 100 WHERE memory_id = 1"); + store->Execute ("UPDATE memories SET s_arousal_avg = 0.1 WHERE memory_id = 2"); + auto transaction = store->Begin (); + REQUIRE ( + operations::emotional_metadata_cache_internal:: + RefreshBoundedSourceOrder (processor_context, *transaction, 1000, + 0.5, 0.5)); + REQUIRE (cache.source_query_order == std::vector{ 3, 4, 5 }); + transaction->Rollback (); +} + TEST_CASE ("CascadeRadius and CascadeDecay knob values", "[operations][emotion_cascade][knobs]") { diff --git a/tests/operations_graph_retrieval.test.cpp b/tests/operations_graph_retrieval.test.cpp index 82a59cb2..b992eeaa 100644 --- a/tests/operations_graph_retrieval.test.cpp +++ b/tests/operations_graph_retrieval.test.cpp @@ -2122,6 +2122,80 @@ TEST_CASE ("Graph retrieval falls back when associations underfill sparse " REQUIRE (operations::retrieval_trace::GetLastSqlFallbackQueryCount () == 1); } +TEST_CASE ("Graph retrieval falls back when sparse candidates collapse below " + "the requested family count", + "[operations][graph][retrieval][hnsw][sqlite][family]" + "[regression]") +{ + cortext::testing::ScopedEnvVar disable_constructive_recall ( + "CORTEXT_DISABLE_CONSTRUCTIVE_RECALL", "1"); + cortext::testing::ScopedEnvVar hnsw_route_flag ( + "CORTEXT_HNSW_SPARSE_ROUTE", "0"); + cortext::testing::ScopedEnvVar sqlite_route_flag ( + "CORTEXT_SQLITE_SPARSE_ROUTE", "1"); + cortext::testing::ScopedEnvVar profile_graph ( + "CORTEXT_PROFILE_GRAPH_RETRIEVAL", "1"); + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + cortext::testing::InitializeCoreSchema (*store); + + constexpr long long kPopulation = 769; + std::vector> route_entries; + route_entries.reserve (kPopulation); + for (long long memory_id = 1; memory_id <= kPopulation; ++memory_id) + { + SeedMemory (*store, memory_id, 1000 + memory_id, UnitVec (0), + memory_id, "opaque/family"); + // Keep HNSW construction well-conditioned while the authoritative + // processor surface deliberately presents one duplicate family. + route_entries.emplace_back ( + memory_id, + VectorWithCosineAndDiverseResidual ( + 0.999f, static_cast (memory_id))); + } + + const auto parameters + = operations::sparse_retrieval_route_sqlite_internal:: + DeriveParameters (1.0, 1.0, 1.0); + auto hnsw = operations::sparse_retrieval_route_internal::Route::Create ( + kEmbeddingDim, route_entries, parameters.hnsw); + REQUIRE (hnsw); + auto sqlite_route + = operations::sparse_retrieval_route_sqlite_internal::Route::Create ( + *store, kEmbeddingDim, route_entries, *hnsw, parameters); + REQUIRE (sqlite_route); + + SignalProcessor::Config cfg; + cortext::testing::RequireEncoder (cfg); + cfg.focus = 1.0; + cfg.sensitivity = 1.0; + cfg.stability = 1.0; + auto ops = std::make_unique ( + std::make_unique (), + std::make_unique ()); + SignalProcessor processor (cfg, store, std::move (ops)); + + const auto output = processor.Process (MakeSignal (UnitVec (0), 100000)); + const int seed_limit = std::max (1, core::RetrievalMaxResults (cfg.focus)); + const int seed_search_limit = core::RetrievalSeedSearchK ( + cfg.focus, cfg.sensitivity, cfg.stability, seed_limit); + INFO ("ranked=" + << output.operation_ms.at ("GraphRetrieve.seed_cache_ranked_rows") + << " selected=" + << output.operation_ms.at ("GraphRetrieve.seed_cache_selected_rows") + << " requested=" << seed_search_limit); + REQUIRE (output.operation_ms.at ("GraphRetrieve.seed_sparse_route_active") + == 1.0); + REQUIRE (output.operation_ms.at ("GraphRetrieve.seed_cache_ranked_rows") + >= static_cast (seed_search_limit)); + REQUIRE (output.operation_ms.at ("GraphRetrieve.seed_cache_selected_rows") + == 0.0); + const auto exact_fallback + = operations::retrieval_trace::GetLastSeedCandidates (); + REQUIRE_FALSE (exact_fallback.empty ()); + REQUIRE (exact_fallback.size () + <= static_cast (seed_limit)); +} + TEST_CASE ("Graph retrieval reopens SQLite sparse route on the existing path", "[operations][graph][retrieval][hnsw][sqlite][integration]") { diff --git a/tests/operations_memory_storage.test.cpp b/tests/operations_memory_storage.test.cpp index a3595bd9..63ad26cd 100644 --- a/tests/operations_memory_storage.test.cpp +++ b/tests/operations_memory_storage.test.cpp @@ -726,6 +726,78 @@ TEST_CASE ("Active signal embedding ring obeys knob-derived capacities", REQUIRE (AnyToLongLong (resized_rows[0].at ("max_capacity")) == 64); } +TEST_CASE ("Active signal embedding ring follows timestamp recency across " + "out-of-order writes and deletion gaps", + "[operations][memory_storage][embedding_population][recency]" + "[regression]") +{ + namespace ring = operations::active_signal_embedding_ring_internal; + auto store = SQLiteStore::Create (":memory:"); + cortext::testing::InitializeCoreSchema (*store); + const int capacity = ring::Capacity (0.0, 0.0, 0.0); + REQUIRE (capacity == 64); + + std::vector embedding (kEmbeddingDim, 0.0f); + embedding[0] = 1.0f; + auto tx = store->Begin (); + for (long long signal_id = 1; signal_id <= capacity; ++signal_id) + { + const long long timestamp = 1000 + signal_id; + tx->Execute ( + "INSERT INTO signals(signal_id, source_id, embedding_id, " + "timestamp, modality, created_at) VALUES (?, 'opaque/ring', 1, " + "?, 'text', ?)", + { signal_id, timestamp, timestamp }); + ring::Upsert (*tx, signal_id, embedding, timestamp, 0.0, 0.0, 0.0); + } + tx->Execute ( + "INSERT INTO signals(signal_id, source_id, embedding_id, timestamp, " + "modality, created_at) VALUES(65, 'opaque/ring', 1, 500, 'audio', " + "500)"); + ring::Upsert (*tx, 65, embedding, 500, 0.0, 0.0, 0.0); + tx->Commit (); + + auto rows = store->Execute ( + "SELECT COUNT(*) AS n, MIN(signal_id) AS first_id, " + "MAX(signal_id) AS last_id FROM cortext_active_signal_embeddings"); + REQUIRE (AnyToLongLong (rows[0].at ("n")) == capacity); + REQUIRE (AnyToLongLong (rows[0].at ("first_id")) == 1); + REQUIRE (AnyToLongLong (rows[0].at ("last_id")) == capacity); + + // A deletion gap accepts the next exact vector. Once full again, timestamp + // recency—not signal identity—owns the replacement frontier. + store->Execute ( + "DELETE FROM cortext_active_signal_embeddings WHERE signal_id = ?", + { static_cast (capacity) }); + tx = store->Begin (); + tx->Execute ( + "INSERT INTO signals(signal_id, source_id, embedding_id, timestamp, " + "modality, created_at) VALUES(66, 'opaque/ring', 1, 600, 'image', " + "600)"); + ring::Upsert (*tx, 66, embedding, 600, 0.0, 0.0, 0.0); + tx->Commit (); + rows = store->Execute ( + "SELECT COUNT(*) AS n, SUM(signal_id = 66) AS gap_fill " + "FROM cortext_active_signal_embeddings"); + REQUIRE (AnyToLongLong (rows[0].at ("n")) == capacity); + REQUIRE (AnyToLongLong (rows[0].at ("gap_fill")) == 1); + + tx = store->Begin (); + tx->Execute ( + "INSERT INTO signals(signal_id, source_id, embedding_id, timestamp, " + "modality, created_at) VALUES(67, 'opaque/ring', 1, 2000, 'text', " + "2000)"); + ring::Upsert (*tx, 67, embedding, 2000, 0.0, 0.0, 0.0); + tx->Commit (); + rows = store->Execute ( + "SELECT COUNT(*) AS n, SUM(signal_id = 66) AS old_present, " + "SUM(signal_id = 67) AS new_present " + "FROM cortext_active_signal_embeddings"); + REQUIRE (AnyToLongLong (rows[0].at ("n")) == capacity); + REQUIRE (AnyToLongLong (rows[0].at ("old_present")) == 0); + REQUIRE (AnyToLongLong (rows[0].at ("new_present")) == 1); +} + TEST_CASE ("MemoryStorage writes modality-agnostic supersedes edges", "[operations][memory_storage][supersession][fanout_cache]") { diff --git a/tests/operations_memory_strength.test.cpp b/tests/operations_memory_strength.test.cpp index 1b8a2b59..02960ef4 100644 --- a/tests/operations_memory_strength.test.cpp +++ b/tests/operations_memory_strength.test.cpp @@ -1,5 +1,7 @@ // tests/operations_memory_strength.test.cpp #include "test_helpers.hpp" +#include "../src/operations/association_fanout_cache_internal.hpp" +#include "../src/operations/execution_cache_sidecar_internal.hpp" #include "../src/operations/eviction_policy_override.hpp" #include #include @@ -669,6 +671,69 @@ TEST_CASE ( REQUIRE (std::any_cast (embedding_rows[0].at ("cnt")) == 1LL); } +TEST_CASE ("Algorithm 18 eviction removes stale supersession eligibility", + "[op18][memory_strength][eviction][supersession][regression]") +{ + auto unique_store = cortext::SQLiteStore::Create (":memory:"); + auto store = std::shared_ptr (std::move (unique_store)); + cortext::testing::InitializeCoreSchema (*store); + + const Eigen::VectorXf replacement_embedding + = Eigen::VectorXf::Unit (kEmbeddingDim, 0); + const Eigen::VectorXf target_embedding + = Eigen::VectorXf::Unit (kEmbeddingDim, 1); + cortext::testing::SeedEmbeddingV2 (*store, 9900, replacement_embedding, + 1000); + cortext::testing::SeedEmbeddingV2 (*store, 9901, target_embedding, 900); + cortext::testing::SeedMemoryV2 (*store, 100, 9900, "opaque/replacement", + "LONG_TERM", 0.1, 1000); + cortext::testing::SeedMemoryV2 (*store, 200, 9901, "opaque/target", + "LONG_TERM", 0.9, 900); + store->Execute ( + "INSERT INTO associations(source_memory_id, target_memory_id, " + "edge_type, weight, last_reinforced) " + "VALUES(100, 200, 'supersedes', 1.0, 1000)"); + + SignalProcessor::Config cfg; + cortext::testing::RequireEncoder (cfg); + cfg.focus = 0.5; + cfg.sensitivity = 0.5; + cfg.stability = 0.5; + cortext::ProcessorContext pctx; + pctx.UpsertRetrievalSurface ( + { 100, 9900, 1000, 1000, 0, 0, 0, 0, "LONG_TERM", + "opaque/replacement", "image", -1.0, 0, 0.0, 0.0, 0.0, false, + true, replacement_embedding }); + pctx.UpsertRetrievalSurface ( + { 200, 9901, 900, 900, 0, 0, 0, 0, "LONG_TERM", "opaque/target", + "audio", -1.0, 0, 0.0, 0.0, 0.0, false, true, + target_embedding }); + REQUIRE (cortext::operations::association_fanout_cache::Ensure ( + store.get (), pctx)); + const auto sidecar + = cortext::operations::execution_cache_sidecar_internal::Find (pctx); + REQUIRE (sidecar); + REQUIRE (sidecar->supersession_eligibility.valid); + REQUIRE (sidecar->supersession_eligibility.activation_ts_by_target.contains ( + 200)); + + cortext::operations::eviction::EvictionPolicyOverride override; + override.consolidation_gate_enabled = false; + override.periphery_cutoff = 0.5; + cortext::operations::eviction::ScopedEvictionPolicyOverride scoped_override ( + override); + auto signal = MakeSignal (4, 2000); + OperationContext ctx (signal, pctx, cfg, store.get ()); + cortext::operations::UpdateMemoryStrength update_strength; + auto tx = store->Begin (); + update_strength.Execute (ctx, *tx); + tx->Commit (); + + REQUIRE_FALSE ( + sidecar->supersession_eligibility.activation_ts_by_target.contains ( + 200)); +} + TEST_CASE ( "Algorithm 18 deletes orphan objstore blobs for evicted memories", "[op18][memory_strength][eviction]") From b65b98ecea55691cfaf1e72b2999bf8fc767e953 Mon Sep 17 00:00:00 2001 From: gabewillen Date: Tue, 21 Jul 2026 15:15:56 -0500 Subject: [PATCH 18/18] Fix exact sparse recovery edges --- .../paper-traceability-audit-v2.json | 6 +- .../paper-traceability-current-state-v2.json | 45 ++++++--- .../paper-traceability-manifest-v1.json | 4 +- ...trator-goal-mdscript-converted.mdscript.md | 12 ++- docs/paper/_manuscript/index.md | 96 ++++++++++++------- docs/paper/sections/10_implementation.qmd | 28 ++++-- docs/paper/sections/11_optimization.qmd | 16 ++++ .../active_signal_embedding_ring_internal.hpp | 10 +- src/operations/memory_storage.cpp | 23 ++++- ...sparse_retrieval_route_sqlite_internal.cpp | 4 +- tests/operations_graph_retrieval.test.cpp | 47 +++++++++ tests/operations_memory_storage.test.cpp | 74 ++++++++++++-- 12 files changed, 284 insertions(+), 81 deletions(-) diff --git a/artifacts/flat_storage_cost/paper-traceability-audit-v2.json b/artifacts/flat_storage_cost/paper-traceability-audit-v2.json index fbb31ef4..848660e9 100644 --- a/artifacts/flat_storage_cost/paper-traceability-audit-v2.json +++ b/artifacts/flat_storage_cost/paper-traceability-audit-v2.json @@ -1,14 +1,14 @@ { "generated_claim_mismatches": [], "inventory_count": 70, - "manifest_sha256": "b4db2d9032f53b0a4dd3c702d749c3bf1603fcc4451d9acd4bac9bfcfce825aa", - "manuscript_sha256": "9f1e956e7759a8aa44571aa879c93583dea3de7691e2fa581aea9b0a56e0bfcc", + "manifest_sha256": "cf84e004f56c1558075893835cdf0590973684a77d7c5b621c07bc95d159737a", + "manuscript_sha256": "7f73f7d1311eac466645e3943a7f176b48283dea573a7e5f7d1fbf0ce6ac35cc", "missing_source_claims": [], "ownership_violations": [], "passed": true, "proof_level_violations": [], "record_count": 70, "schema": "cortext_paper_traceability_audit_v1", - "state_sha256": "343bbaf3dfabab7acb9fbd00f08605c4ff292f421580c94689c5abbf6c32d1d5", + "state_sha256": "c2f63f7c262d30ecacf2d54556376b2ecaa52892055f96c4634205b57ccb22b5", "uncovered_inventory": [] } diff --git a/artifacts/flat_storage_cost/paper-traceability-current-state-v2.json b/artifacts/flat_storage_cost/paper-traceability-current-state-v2.json index 5b544910..ce80599c 100644 --- a/artifacts/flat_storage_cost/paper-traceability-current-state-v2.json +++ b/artifacts/flat_storage_cost/paper-traceability-current-state-v2.json @@ -117,12 +117,12 @@ ] }, "pr6_exact_head_ci_repair": { - "decision": "twenty-three-review-thread-repair-active", + "decision": "twenty-six-review-thread-repair-active", "prior_exact_head": "764e4af202a91120dae85e1d6b0d69e2ce97aa5d", "implementation_repair_commit": "89a06084dd05710f90572c1b7bac7e17fab79122", "followup_repair_commit": "25cf7b130e87837d0ed813b0e0ffda5a50701651", "monitor_head_binding": "resolve the live GitHub PR head at every re-entry because a repository record cannot content-address its own containing record-only commit", - "current_exact_head_ci": "cumulative repair head d2213ea42f58666509ef96b22c86dca55d280584 is synchronized with current main and all twelve exact-head checks are green; the PR bot current-head rereview opened six P2 threads covering eviction/supersession ordering, post-family sparse underfill, timestamp-recency ring replacement, emotional eligibility-before-limit, single-owner RIF active-row publication, and retired-generation consolidation counting; all six are repaired locally and remain unresolved until the replacement head is pushed and proved", + "current_exact_head_ci": "cumulative repair head 3f4d2e5e7c5bf981e24f942b4bf29020ffbc4c7f is synchronized with current main and all twelve exact-head checks are green; all six prior P2 threads are proof-replied and resolved; the PR bot exact-head rereview opened three new threads covering flattened-row ring recovery, sparse supersession eligibility-before-limit, and canonical same-level HNSW reactivation; all three are repaired locally and remain unresolved until the replacement head is pushed and proved", "windows_zig_path_repair": { "failing_job": "zig-cli-install (windows-latest, cortext_cli.exe)", "failing_head": "25cf7b130e87837d0ed813b0e0ffda5a50701651", @@ -168,6 +168,15 @@ "thread_disposition": "six current-head P2 threads remain open until reviewed replacement code and exact proof are pushed", "next_gate": "rebuild paper traceability, push without force, reply and resolve the six threads, then let the PR bot rereview and monitor exact-head CI" }, + "three_latest_thread_repair": { + "review_owner": "the current user explicitly selected the replacement-head PR bot rereview instead of a local recursive blind-review loop for bot-comment repairs", + "candidate_boundary": "three deterministic code repairs, three focused regressions, paper/manuscript parity, exact local full-suite proof, non-force push, proof replies, thread resolution, replacement-head bot rereview, and exact-head CI", + "focused_proof": "39 assertions in three cases: an emptied exact ring excludes surviving flattened centroids, an eligible supersession target behind 67 nearer ineligible activated rows remains visible without SQL fallback, and same-level HNSW reactivation restores the lower canonical memory id", + "broader_proof": "active-signal embedding population 274 assertions in 4 cases; memory-storage supersession 111 in 10; SQLite HNSW regressions 1,259 in 11; neutral legacy-ring restart 155 in 1", + "full_proof": "exact Debug LLVM 21 media-enabled CTest passed in four disjoint Catch2 shards with fixed seed 424242: 39,305 assertions in 712 cases, slowest-shard wall 505.87 seconds, binary SHA-256 9a2d819dddef5a2355e4f4beead7f83646b6865ba02ad3ea41aa0bf25a72e67b", + "thread_disposition": "three exact-head review threads remain open until the replacement code and exact proof are pushed", + "next_gate": "rebuild paper traceability, push without force, reply and resolve the three threads, then let the PR bot rereview and monitor exact-head CI" + }, "review_threads": [ "https://github.com/augmem/cortext/pull/6#discussion_r3620394273", "https://github.com/augmem/cortext/pull/6#discussion_r3620394282", @@ -191,7 +200,10 @@ "PRRT_kwDOR3IQMM6SqPHu", "PRRT_kwDOR3IQMM6SqPHx", "PRRT_kwDOR3IQMM6SqPH2", - "PRRT_kwDOR3IQMM6SqPH4" + "PRRT_kwDOR3IQMM6SqPH4", + "PRRT_kwDOR3IQMM6Ss08m", + "PRRT_kwDOR3IQMM6Ss08q", + "PRRT_kwDOR3IQMM6Ss08w" ], "repairs": [ "calibrate migrated lazy-RIF state transactionally before working-memory hydration and rebuild the disposable epoch from committed persistent authority", @@ -220,7 +232,10 @@ "replace exact signal-ring rows by timestamp and stable signal-id tie rather than signal-id modulo, including out-of-order writes and slot gaps", "apply emotional intensity, arousal, and recent-window eligibility before bounded intensity ordering and truncation", "leave disposable RIF active_rows unchanged until post-commit shadow publication applies each membership delta exactly once", - "count and select only current recovery-clock-generation RIF rows during consolidation so retired generations do not consume the active ceiling" + "count and select only current recovery-clock-generation RIF rows during consolidation so retired generations do not consume the active ceiling", + "backfill an empty exact-signal ring only from legacy signal embeddings certifiably distinct from their owning memory centroid, leaving later flattened rows out of exact recovery", + "apply current sparse-supersession self, kind, and timestamp eligibility before the knob-derived candidate truncation", + "restore a reactivated same-level HNSW node as the canonical entry when its memory id wins the persisted deterministic tie" ], "source_sha256": { "signal_processor": "0fb2b4d064531bbbfd86c270072e4f60b454b8db7059d9274603e3de7c784306", @@ -232,8 +247,8 @@ "zig_hnswlib_prepare": "f2ea37b7bfaca95edcb3b6486120b0d0c6c33060b32d96a40f46fafdd53e2773", "zig_package_manifest": "25f58d123ab581319b140bed7e4355a7bd524e1e17dce96a219ccea68ec74c9a", "hnsw_route_header": "a68c6825551cadd3d9d843986a82ab1294128b993106ffe58d3370e70ec79c82", - "hnsw_route_source": "3d6a559de3445a800a18df1e05e4926ce5bef71f0a4123de9990a3c2869e4184", - "hnsw_repair_test": "98f092f86b5ef4e10b8c06fe41f15b31127556ce5480565d16fcd2fb8620e8f8", + "hnsw_route_source": "c0586a9badb2b8ca9e9c31bc50d26bafe4e6cc4db52159d1e5dfcd848cf6af64", + "hnsw_repair_test": "9958cbb5f0effc693a6f41b5772bbafa499dde3e56e6c96d8118ce199bb9a620", "consolidation_source": "b6dd39b64318e3720be0da46e62f7457fc6fc41bc48f1e01b5a51b5df5b12880", "consolidation_test": "716ed3c2f8568338591453fd1e7776af99d9307be90115e2654e2671fca419e1", "emotion_cascade_source": "8135e0f9a07d55a62d6bfdf7f63c83c5b2110237cc208c4fff2ef1ae6e135634", @@ -241,11 +256,11 @@ "emotion_cascade_test": "47b0d780994832bbd36f06fcba4abee9d2935ad0267b4c9bd9e7cb6659df5afe", "schema_source": "b4c3b0c873fd225781d1eab856a82b3fc2868909f131f867031c71c792f9fbe3", "migration_test": "4e76c44cc7ec9d5a1ec26fb963c1291c7f98e47b65050bac8ff4ff0df09b64cc" - ,"active_signal_embedding_ring": "01a6d8cdab4dc973a634d499785993427fbc7c83fceb5c78669c78dc3ad1f6af" + ,"active_signal_embedding_ring": "9432ed850915067b5f6d8922672215d33454972a3e865181535e8ef590419efa" ,"sparse_retrieval_knobs": "d99e020e322c5d28dc1dacbd72c6a650f0eaa4f3561758c379cc62b1d58793ef" ,"cortext_hydration": "0ba377e833452cd13520d34c1bf57eaf3a8df5da3607780845a0e6931aa291eb" - ,"memory_storage": "2c662b5bdbe22dba92a39335ea5959cf22f38dcaa0cc78e19f19a3aa352f182f" - ,"memory_storage_test": "7f8eade4e9b0124551296f6cad3d0a183db07785749fc38dd082665261b154f7" + ,"memory_storage": "dac3c9e9a54a217f5488fa751354391c6344a3bb8d48e8044ce00c878c0e5e9c" + ,"memory_storage_test": "acea20d1675037cbf3e3497613dc3611515c4dfa48982fdabd3610243543590b" ,"cortext_test": "52d2e143f793a3446616bd5d22a4798dddd609b56d9504ac2a9ea2d317e442dd" ,"signal_processor_test": "ae69155678e8daa057d02ff11de9f7c04e2836117d6966a6b1f0eb06ca96ac62" ,"rif_state_internal": "5e0a58aedfc0db22317bf613fc25297820d138feb6da8621942b1bf23f555ae1" @@ -261,12 +276,13 @@ ,"graph_retrieval_six_thread": "1f109a81c2b608b960363659a278063f766153cff30dca131ff815bb3d40d3cb" ,"memory_strength_six_thread": "d3cd685fcd47de03d9876289607eec8e054d342f938c37e9b924c64969c6daee" ,"exact_test_binary_six_thread": "02c9615a918b2675517df3dce76b7d8709ec9fcbfe32e3766da66823e749c2f1" + ,"exact_test_binary_three_latest_thread": "9a2d819dddef5a2355e4f4beead7f83646b6865ba02ad3ea41aa0bf25a72e67b" }, "local_proof": { "preceding_full_media_ctest": "preceding exact candidate: clean Debug LLVM 21 media-enabled suite with experiment hooks enabled: 38,730 assertions in 697 cases", "preceding_full_media_test_binary_sha256": "0fd25b6e322913cb0e76e3aa5a1fbcc6836d8696b6bbd5886224a3144fea1ec8", - "current_full_media_ctest": "exact cumulative six-current-head-thread repaired candidate: clean Debug LLVM 21 media-enabled suite with experiment hooks enabled: 39,281 assertions in 710 cases", - "current_full_media_test_binary_sha256": "02c9615a918b2675517df3dce76b7d8709ec9fcbfe32e3766da66823e749c2f1", + "current_full_media_ctest": "exact cumulative twenty-six-thread repaired candidate: clean Debug LLVM 21 media-enabled suite with experiment hooks enabled, four disjoint Catch2 shards at fixed seed 424242: 39,305 assertions in 712 cases; slowest shard 505.87 seconds", + "current_full_media_test_binary_sha256": "9a2d819dddef5a2355e4f4beead7f83646b6865ba02ad3ea41aa0bf25a72e67b", "rif_focus": "312 assertions in 19 cases", "hnsw_focus": "the exact canonical-entry reactivation, missing-snapshot ordinary-search restart, and prior-snapshot-free recenter rebuild regressions pass in the four-case 107-assertion follow-up set", "consolidation_focus": "the four-case follow-up set passes 107 assertions, including both clustered-row prefilter arms, the eligible-only inactive query plan, and migration 34 structure", @@ -274,6 +290,7 @@ "new_review_thread_focus": "27-point active-signal ring proof passes 225 assertions; a neutral exact restart passes 154 assertions; adversarial fallback hydration passes 5 assertions; sparse supersession exact-coverage regression passes 15 assertions; broader MemoryStorage passes 451 assertions in 20 cases and hydration passes 173 assertions in 13 cases", "latest_review_thread_focus": "migration-30 exact-ring upgrade passes 155 assertions; embedding-only shared-memory RIF passes 5 assertions; sparse ASSOCIATION underfill fallback passes 4 assertions; broader recent-context passes 309 assertions in 2 cases, competition passes 331 assertions in 17 cases, and SQLite HNSW retrieval passes 2,638 assertions in 21 cases", "six_thread_focus": "six focused regressions pass 36 assertions; broader memory storage passes 460 assertions in 21 cases, emotional cascade 149 in 25, active RIF 311 in 12, bounded consolidation 110 in 6, eviction 40 in 5, and SQLite HNSW 2,639 in 22", + "three_latest_thread_focus": "three focused regressions pass 39 assertions; broader active-signal population passes 274 assertions in 4 cases, supersession passes 111 in 10, SQLite HNSW regressions pass 1,259 in 11, and neutral legacy-ring restart passes 155 in 1", "wasm_bundle": "built successfully with Emscripten 4.0.18", "focused_test_binary_sha256": "c5508e7b083d77cac768b717c04af0862cf64d7c48d339e5a3aa1c0f6b00f068", "wasm_sha256": "17d31e0a61327e91d7a53577b73689442583d5f4c84aa76d5844ac309e9791aa" @@ -290,11 +307,11 @@ "modality_branch": false }, "unresolved_limits": [ - "Windows execution and replacement exact-head CI for the LF checkout repair remain pending", - "the six current-head P2 repairs have focused and broader deterministic proof; exact-binary full-suite completion, non-force push, proof-backed replies, thread resolution, replacement-head PR bot rereview, and exact-head CI remain", + "Windows execution and all twelve checks passed on exact head 3f4d2e5e7c5bf981e24f942b4bf29020ffbc4c7f; replacement-head CI for the three latest repairs remains pending", + "the three latest review-thread repairs have focused, broader, and exact-binary full-suite proof; non-force push, proof-backed replies, thread resolution, replacement-head PR bot rereview, and exact-head CI remain", "legacy embedding-only RIF compatibility may perform work proportional to shared-embedding membership; ordinary structured competition remains memory-scoped", "sparse graph retrieval falls back to the exact SQL seed path when operation-specific eligibility filtering underfills, so store-sized fallback work remains possible", - "the three newest P2 thread repairs have full applicable proof and completed recursive review, are pushed at cca844d758bc9ad7ddd12048932c274da514d8a6, and their proof-backed threads are resolved; resulting exact-head CI remains pending", + "the prior nine bot-thread repairs are pushed on 3f4d2e5e7c5bf981e24f942b4bf29020ffbc4c7f, proof-replied and resolved, and all twelve exact-head checks are green; the replacement bot rereview produced the three currently active findings", "an old smaller exact-signal ring can temporarily restore fewer than Q exact vectors after a knob increase until new writes refill it; aggregate memory centroids are not substituted", "fallback hydration output remains capped at B, but malformed or nonmatching legacy history can require more than B candidate rows to be inspected", "exact supersession verification can remain history-sized after bounded sparse current-candidate selection, so flat write cost is not claimed", diff --git a/artifacts/flat_storage_cost/paper-traceability-manifest-v1.json b/artifacts/flat_storage_cost/paper-traceability-manifest-v1.json index d6716958..cda1d763 100644 --- a/artifacts/flat_storage_cost/paper-traceability-manifest-v1.json +++ b/artifacts/flat_storage_cost/paper-traceability-manifest-v1.json @@ -799,9 +799,9 @@ }, { "corpus_parameter_scope": "owner-authorized 15,695-packet Natural replay and focused fresh/copied-late windows where recorded; F=0.45, S=0.5, T=0.5", - "decision": "twenty-three-review-thread-repair-active", + "decision": "twenty-six-review-thread-repair-active", "evidence_fingerprints": [ - "b364ed209ca9d47b074755405985bd0f53ef46b2b226a40cf681903b7c65379a" + "5fa99621223ce640de1cab344a86945e7a6455ac0e5d585ad4ba6bd5a4348c09" ], "evidence_kind": "measured", "inventory_id": "state:pr6_exact_head_ci_repair", diff --git a/comments/consolidation-drift-retrigger/20260716T205900Z-orchestrator-goal-mdscript-converted.mdscript.md b/comments/consolidation-drift-retrigger/20260716T205900Z-orchestrator-goal-mdscript-converted.mdscript.md index 61d955f2..a91cfed1 100644 --- a/comments/consolidation-drift-retrigger/20260716T205900Z-orchestrator-goal-mdscript-converted.mdscript.md +++ b/comments/consolidation-drift-retrigger/20260716T205900Z-orchestrator-goal-mdscript-converted.mdscript.md @@ -3,15 +3,15 @@ id: consolidation-drift-rearm-pr-monitor-worktree-entry task_id: consolidation-drift-retrigger owner_role: implementer lane_id: consolidation-drift-retrigger -status: monitoring +status: repair-ready-to-push implementation_status: complete -monitor_status: six-current-head-p2-repair +monitor_status: three-thread-repair-proved source_of_truth: current repository, current user corrections, this goal, task comments, exact private profiles and audits, and GitHub PR 6 only after implementation completion model: gpt-5.6-terra reasoning: high model_selection_basis: cross-cutting C++ and SQLite implementation, deterministic bounded-work proof, research traceability, and PR ownership canonical_monitor_entry: true -updated_at: 20260721T183342Z +updated_at: 20260721T201500Z --- @@ -58,10 +58,14 @@ updated_at: 20260721T183342Z * exact pushed head `cca844d758bc9ad7ddd12048932c274da514d8a6` has 11 green checks, including Linux sanitizer, and only Windows job `88675883348` failed. Three new P2 threads are locally repaired: migration 30 backfills the newest knob-derived legacy exact-signal window before the first aggregate-linked write; legacy embedding-only RIF suppresses every memory sharing the embedding in stable identity order; and an ASSOCIATION-filtered underfilled sparse seed proposal falls back to exact SQL. Focused proof passes 155, 5, and 4 assertions; broader recent-context, competition, and SQLite HNSW groups pass 309, 331, and 2,638 assertions. The complete media-enabled suite passes 39,245 assertions in 704 cases on test binary SHA-256 `c5508e7b083d77cac768b717c04af0862cf64d7c48d339e5a3aa1c0f6b00f068`; Python passes 159, Zig text-only passes 12/12, the paper renders, and traceability passes 70/70. The current user explicitly waived the local recursive blind-review loop for these bot-comment repairs; the interrupted local reviewer produced no verdict, and the PR bot's replacement-head rereview is the review owner after push * cumulative repair commit `d2213ea42f58666509ef96b22c86dca55d280584` is pushed without force on current main. All 12 exact-head checks are green, including Linux sanitizer and Windows CLI, and GitHub reports OPEN, non-draft, MERGEABLE/CLEAN. The PR bot reviewed this exact head and opened six new P2 threads: eviction ordering leaves stale supersession eligibility, sparse family collapse can underfill without SQL fallback, the active signal ring follows row ID instead of timestamp recency, emotional-source capping precedes eligibility filtering, RIF `active_rows` is double-adjusted around publication, and consolidation counts retired-generation RIF rows. All six are active in-scope repairs; the prior three threads remain resolved * the six repairs pass 36 focused assertions. The mature sparse-family regression explicitly observes 769 eligible activated rows before family collapse, rejects the post-collapse sparse certificate, and confirms a nonempty bounded exact fallback result. Broader proof passes 460 memory-storage assertions, 149 emotional-cascade assertions, 311 active-RIF assertions, 110 bounded-consolidation assertions, 40 eviction assertions, and 2,639 SQLite-HNSW assertions. The exact final Debug LLVM 21 media-enabled suite passes 39,281 assertions in 710 cases in 1,413.12 seconds on binary SHA-256 `02c9615a918b2675517df3dce76b7d8709ec9fcbfe32e3766da66823e749c2f1`. The paper and generated manuscript describe every algorithm change; 159 Python tests and the 70/70 traceability audit pass. Paper traceability rebuild, non-force push, exact proof replies, thread resolution, replacement-head bot rereview, and exact-head CI remain +* repair commit `3f4d2e5e7c5bf981e24f942b4bf29020ffbc4c7f` is pushed without force on unchanged main. All six current-head P2 threads have exact finding-specific commit/proof replies and are resolved; the PR has zero unresolved threads and zero review requests. All 12 replacement checks are in progress, the PR is OPEN/non-draft and MERGEABLE/UNSTABLE, and the PR bot rereview is requested +* exact head `3f4d2e5e7c5bf981e24f942b4bf29020ffbc4c7f` finished with all 12 checks green, including Linux sanitizer and Windows CLI. Its PR bot rereview opened three new threads: an emptied exact-signal ring could rebuild from flattened centroids, sparse supersession truncated before self/kind/timestamp eligibility, and same-level HNSW reactivation ignored the lower-memory-id canonical tie +* the three repairs are complete without a schema or public-API change. Empty-ring recovery now admits only ownerless legacy signals or embeddings demonstrably different from their owning memory centroid; sparse supersession applies eligibility before its 67-row high-focus candidate cut; same-level reactivation restores `(level DESC, memory_id ASC)` metadata order. Direct proof passes 39 assertions in three cases; broader ring, supersession, SQLite-HNSW, and migration-restart proof passes 274, 111, 1,259, and 155 assertions respectively +* the exact Debug LLVM 21 media-enabled binary SHA-256 `9a2d819dddef5a2355e4f4beead7f83646b6865ba02ad3ea41aa0bf25a72e67b` passes the complete suite in four disjoint Catch2 shards at fixed seed 424242: 39,305 assertions in 712 cases, with a slowest-shard wall time of 505.87 seconds. Python passes 159 tests plus 55 subtests. The paper source and generated manuscript contain all three algorithm changes. Traceability passes 70/70 with overlay, manifest, audit, and manuscript SHA-256 values `7293e6ad9774dc26779fcc8573c76f1f01b15242e8b18d03079f170efc3520b5`, `50d68e5b9250859691630ae760054df9aac2aba491095a90186706bf2d7014b6`, `c470a33f8cc672ce2efd61991ef4771e372051a7681cf6620451718dcfe2c461`, and `7f73f7d1311eac466645e3943a7f176b48283dea573a7e5f7d1fbf0ce6ac35cc`. The current user selected replacement-head PR bot rereview rather than a local recursive blind-review loop for bot-comment repairs ## PR Monitor Hot Path -* repair the six current-head P2 threads narrowly with deterministic focused regressions, update the paper and manuscript for every algorithm/experiment change, run proportionate focused/full proof, push without force, reply with exact commit/proof, resolve the six threads, and let the PR bot rereview the replacement head without a local recursive blind-review loop unless the user changes direction +* after the proved repair is pushed without force, resolve and monitor the live branch head that supersedes `3f4d2e5e7c5bf981e24f942b4bf29020ffbc4c7f`; this containing record cannot self-address its own commit. Inspect all check conclusions, PR bot rereview, review requests, comments, unresolved threads, current main, mergeability, and conflicts; repair only new in-scope evidence and do not run a local recursive blind-review loop for bot comments unless the user changes direction * every ten minutes in this current task, refresh PR 6 exact head, checks, mergeability, reviews, review requests, comments, and unresolved threads; compare with the prior state and report only changes * repair only in-scope failures or review findings with proportionate proof and the required fresh review; push without force and update this goal to the new exact head * stop and deactivate the heartbeat when the PR merges or closes externally, repair exceeds scope, target drift is unrecoverable, or authority is explicitly denied diff --git a/docs/paper/_manuscript/index.md b/docs/paper/_manuscript/index.md index b4bd51b9..2cd1638a 100644 --- a/docs/paper/_manuscript/index.md +++ b/docs/paper/_manuscript/index.md @@ -6016,8 +6016,10 @@ asks a lower level node for nonexistent upper adjacency. If the removed node later becomes active again without changing its embedding, row-addressed sealing preserves its persisted links and level and promotes it back to the canonical entry whenever that level exceeds the -current active maximum. Thus metadata continues to name the highest -active hierarchy root after both deletion and reactivation. If any +current active maximum, or when it has the same maximum level and the +lower memory id required by the canonical `(level DESC, memory_id ASC)` +order. Thus metadata continues to name the highest active hierarchy root +with its deterministic tie after both deletion and reactivation. If any sealed removal overlaps the persisted consolidation activation snapshot, the snapshot entry, generation, centroid, and identity list are cleared in the same transaction; in-process and restarted queries then use the @@ -6129,27 +6131,31 @@ materialized on each public call. The same bounded activation surface now serves supersession selection after the current memory population exceeds *C*. `MemoryStorage` asks -the persisted route for at most *A* identities, exactly reranks those -current embeddings, and keeps its existing timestamp, kind, threshold, -duplicate-band, edge-count, and tie rules. On this sparse path the -latest current embedding is the memory’s active centroid. A bounded HNSW -result is now treated only as a candidate set, never as proof that it -covers the exact current population. The historical cache’s exact -coverage/ranking proof therefore remains active after sparse routing; -when that proof cannot be established, the existing SQLite fallback -remains enabled. This prevents an approximate current result from -suppressing a predecessor outside the activated subset. It deliberately -permits history-sized supersession verification work on a write, so the -9*C* + *A* retrieval-row ceiling does not imply flat supersession-write -cost. This is the accepted correctness side of the -write-throughput/retrieval-symmetry tradeoff and keeps production-wide -boundedness unclaimed. Until the route is published, when the dirty -delta exceeds *C*, or when route validation fails, the operation retains -the exact fallback. This is one shared, modality- and source-agnostic -candidate route for Natural and Durable; it does not add a second write -API or make the connection-local cache authoritative. The 4,000-event -knob ablation predates this exact-coverage correction and its remaining -full-horizon limits are reported in the optimization section. +the persisted route for at most *A* identities, applies self, timestamp, +and kind eligibility to that activated set before the knob-derived +candidate cut, and then exactly reranks the surviving current +embeddings. Threshold, duplicate-band, edge-count, and deterministic tie +rules remain unchanged. This prevents a nearer ineligible activated +identity from consuming the top-k slice and hiding an eligible duplicate +immediately behind it. On this sparse path the latest current embedding +is the memory’s active centroid. A bounded HNSW result is now treated +only as a candidate set, never as proof that it covers the exact current +population. The historical cache’s exact coverage/ranking proof +therefore remains active after sparse routing; when that proof cannot be +established, the existing SQLite fallback remains enabled. This prevents +an approximate current result from suppressing a predecessor outside the +activated subset. It deliberately permits history-sized supersession +verification work on a write, so the 9*C* + *A* retrieval-row ceiling +does not imply flat supersession-write cost. This is the accepted +correctness side of the write-throughput/retrieval-symmetry tradeoff and +keeps production-wide boundedness unclaimed. Until the route is +published, when the dirty delta exceeds *C*, or when route validation +fails, the operation retains the exact fallback. This is one shared, +modality- and source-agnostic candidate route for Natural and Durable; +it does not add a second write API or make the connection-local cache +authoritative. The 4,000-event knob ablation predates this +exact-coverage correction and its remaining full-horizon limits are +reported in the optimization section. `TRACE[state:integrated_hnsw_sparse_route_experiment]` and `TRACE[state:sqlite_hnsw_knob_ablation]`. @@ -6529,17 +6535,21 @@ knob-derived capacity throughout the transition. When the ring contains rows, recent-context restart hydration admits only signals with an exact ring vector; it does not silently substitute a memory centroid for a missing per-signal vector. Migration 30 itself -creates an empty ring, so the first capacity check copies the newest *Q* -signal vectors from their `signals.embedding_id` references. The main -MemoryStorage path performs that check before it inserts -aggregate-linked rows. The auxiliary working-memory persistence path may -insert its new aggregate-linked row first, but the same `Upsert` -immediately replaces that row’s ring slot with the exact event vector, -leaving the newest *Q* slots exact in either ordering. A truly empty -legacy database remains empty. Once any exact ring row exists, an older -store whose prior ring was smaller can temporarily restore a shorter -exact context until new writes fill *Q*, rather than mixing aggregate -vectors into an apparently full exact window. The global vector index +creates an empty ring, so the first capacity check copies up to the +newest *Q* legacy signal vectors only when their `signals.embedding_id` +is certifiably distinct from the owning memory centroid (or the signal +has no owner). The main MemoryStorage path performs that check before it +inserts aggregate-linked rows. The auxiliary working-memory persistence +path may insert its new aggregate-linked row first, but the same +`Upsert` immediately replaces that row’s ring slot with the exact event +vector, leaving the newest *Q* slots exact in either ordering. A truly +empty legacy database remains empty. Once any exact ring row exists, an +older store whose prior ring was smaller can temporarily restore a +shorter exact context until new writes fill *Q*, rather than mixing +aggregate vectors into an apparently full exact window. If a later +cascade empties the ring while flattened signal rows remain, the same +certification rule leaves those rows out and begins the new ring only +from exact vectors supplied by later writes. The global vector index consequently contains memory centroids rather than a growing population of signal-only decoys. The schema and routing code contain no modality or `source_id` branch; text, audio, image, shared, and opaque sources @@ -9040,6 +9050,24 @@ tests establish deterministic edge behavior on the repaired local binary; they are not a replacement for exact-head CI, the historical long-horizon quality matrix, or a new whole-engine boundedness claim. +The next exact-head rereview exposed three narrower ordering and +recovery edges. An exact-signal ring that becomes empty after migration +now backfills only legacy signal embeddings that can be distinguished +from their owning memory centroid, so surviving flattened rows cannot be +relabeled as exact. Sparse supersession applies self, kind, and +timestamp eligibility to the full activated proposal before its +candidate truncation, preserving an eligible duplicate placed +immediately behind a nearer ineligible prefix. Reactivating a persisted +HNSW node now restores it as the canonical entry when it ties the +current maximum level and has the lower memory id. These changes +preserve the existing SQLite authority, knob-derived envelopes, +source/modality neutrality, and Natural/Durable operation path; they add +no schema or public API. Focused regressions construct the emptied-ring +recovery, a larger-than-route supersession population with an ineligible +top-k prefix, and a same-level remove/reactivate tie. They are +deterministic correctness checks rather than a new throughput, +long-horizon quality, or engine-wide boundedness result. + The remaining consolidation scan was bounded by the same knobs. Let *A* = 2*C* + 2*B* and *N* = max (8, ⌊*B*/2⌋). Score consolidation now admits at most *A* low-effective-strength long-term identities after diff --git a/docs/paper/sections/10_implementation.qmd b/docs/paper/sections/10_implementation.qmd index 5406caa6..dcda48a8 100644 --- a/docs/paper/sections/10_implementation.qmd +++ b/docs/paper/sections/10_implementation.qmd @@ -572,8 +572,10 @@ level node for nonexistent upper adjacency. If the removed node later becomes active again without changing its embedding, row-addressed sealing preserves its persisted links and level and promotes it back to the canonical entry whenever that level exceeds the current active -maximum. Thus metadata continues to name the highest active hierarchy root -after both deletion and reactivation. +maximum, or when it has the same maximum level and the lower memory id required +by the canonical `(level DESC, memory_id ASC)` order. Thus metadata continues +to name the highest active hierarchy root with its deterministic tie after both +deletion and reactivation. If any sealed removal overlaps the persisted consolidation activation snapshot, the snapshot entry, generation, centroid, and identity list are cleared in the same transaction; in-process and restarted queries then use the canonical @@ -675,11 +677,14 @@ payloads actually materialized on each public call. The same bounded activation surface now serves supersession selection after the current memory population exceeds $C$. `MemoryStorage` asks the persisted route -for at most $A$ identities, exactly reranks those current embeddings, and keeps -its existing timestamp, kind, threshold, duplicate-band, edge-count, and tie -rules. On this sparse path the latest current embedding is the memory's active -centroid. A bounded HNSW result is now treated only as a candidate set, never as -proof that it covers the exact current population. The historical cache's exact +for at most $A$ identities, applies self, timestamp, and kind eligibility to +that activated set before the knob-derived candidate cut, and then exactly +reranks the surviving current embeddings. Threshold, duplicate-band, +edge-count, and deterministic tie rules remain unchanged. This prevents a +nearer ineligible activated identity from consuming the top-k slice and hiding +an eligible duplicate immediately behind it. On this sparse path the latest +current embedding is the memory's active centroid. A bounded HNSW result is now +treated only as a candidate set, never as proof that it covers the exact current population. The historical cache's exact coverage/ranking proof therefore remains active after sparse routing; when that proof cannot be established, the existing SQLite fallback remains enabled. This prevents an approximate current result from suppressing a predecessor @@ -1056,8 +1061,9 @@ capacity throughout the transition. When the ring contains rows, recent-context restart hydration admits only signals with an exact ring vector; it does not silently substitute a memory centroid for a missing per-signal vector. Migration 30 itself creates an empty -ring, so the first capacity check copies the newest $Q$ signal vectors from -their `signals.embedding_id` references. The main MemoryStorage path performs +ring, so the first capacity check copies up to the newest $Q$ legacy signal +vectors only when their `signals.embedding_id` is certifiably distinct from +the owning memory centroid (or the signal has no owner). The main MemoryStorage path performs that check before it inserts aggregate-linked rows. The auxiliary working-memory persistence path may insert its new aggregate-linked row first, but the same `Upsert` immediately replaces that row's ring slot with the exact @@ -1065,7 +1071,9 @@ event vector, leaving the newest $Q$ slots exact in either ordering. A truly empty legacy database remains empty. Once any exact ring row exists, an older store whose prior ring was smaller can temporarily restore a shorter exact context until new writes fill $Q$, rather than mixing aggregate vectors -into an apparently full exact window. The global vector index consequently +into an apparently full exact window. If a later cascade empties the ring while +flattened signal rows remain, the same certification rule leaves those rows out +and begins the new ring only from exact vectors supplied by later writes. The global vector index consequently contains memory centroids rather than a growing population of signal-only decoys. The schema and routing code contain no modality or `source_id` branch; text, audio, image, shared, and opaque sources enter after encoding through the diff --git a/docs/paper/sections/11_optimization.qmd b/docs/paper/sections/11_optimization.qmd index 7b0c3279..8ed9eec5 100644 --- a/docs/paper/sections/11_optimization.qmd +++ b/docs/paper/sections/11_optimization.qmd @@ -1547,6 +1547,22 @@ tests establish deterministic edge behavior on the repaired local binary; they are not a replacement for exact-head CI, the historical long-horizon quality matrix, or a new whole-engine boundedness claim. +The next exact-head rereview exposed three narrower ordering and recovery +edges. An exact-signal ring that becomes empty after migration now backfills +only legacy signal embeddings that can be distinguished from their owning +memory centroid, so surviving flattened rows cannot be relabeled as exact. +Sparse supersession applies self, kind, and timestamp eligibility to the full +activated proposal before its candidate truncation, preserving an eligible +duplicate placed immediately behind a nearer ineligible prefix. Reactivating a +persisted HNSW node now restores it as the canonical entry when it ties the +current maximum level and has the lower memory id. These changes preserve the +existing SQLite authority, knob-derived envelopes, source/modality neutrality, +and Natural/Durable operation path; they add no schema or public API. Focused +regressions construct the emptied-ring recovery, a larger-than-route +supersession population with an ineligible top-k prefix, and a same-level +remove/reactivate tie. They are deterministic correctness checks rather than a +new throughput, long-horizon quality, or engine-wide boundedness result. + The remaining consolidation scan was bounded by the same knobs. Let $A=2C+2B$ and $N=\max(8,\lfloor B/2\rfloor)$. Score consolidation now admits at most $A$ low-effective-strength long-term identities after merging two diff --git a/src/operations/active_signal_embedding_ring_internal.hpp b/src/operations/active_signal_embedding_ring_internal.hpp index 4739858b..9e3ba29c 100644 --- a/src/operations/active_signal_embedding_ring_internal.hpp +++ b/src/operations/active_signal_embedding_ring_internal.hpp @@ -126,13 +126,17 @@ EnsureCapacity (Transaction &tx, int capacity) if (capacity_rows.empty ()) { // Migration 30 starts with an empty ring while pre-migration signal - // rows still reference their exact per-signal embeddings. Capture the - // newest legacy window before the first post-migration signal switches - // signals.embedding_id to the aggregate memory embedding. + // rows may still reference their exact per-signal embeddings. Only + // backfill rows whose embedding is certifiably distinct from the owning + // memory centroid. A later cascade can empty an established ring while + // flattened signal rows remain; those rows must not be relabeled exact. auto legacy_rows = tx.Execute ( "SELECT s.signal_id, e.embedding, s.timestamp AS created_at " "FROM signals s " "JOIN embeddings e ON e.embedding_id = s.embedding_id " + "LEFT JOIN memories m ON m.memory_id = s.memory_id " + "WHERE s.memory_id IS NULL " + " OR s.embedding_id != m.embedding_id " "ORDER BY s.timestamp DESC, s.signal_id DESC LIMIT ?", { static_cast (capacity) }); std::reverse (legacy_rows.begin (), legacy_rows.end ()); diff --git a/src/operations/memory_storage.cpp b/src/operations/memory_storage.cpp index d107b0e9..d44e22fe 100644 --- a/src/operations/memory_storage.cpp +++ b/src/operations/memory_storage.cpp @@ -593,6 +593,21 @@ LoadCurrentSupersessionRowsFromCache ( if (entry.memory_id <= 0 || entry.embedding_id <= 0 || entry.embedding.size () != embedding_dim) return std::nullopt; + if (use_sparse_route) + { + const auto surface_it = p_ctx.retrieval_surface_index.find ( + entry.memory_id); + if (surface_it == p_ctx.retrieval_surface_index.end () + || surface_it->second >= p_ctx.retrieval_surface_cache.size ()) + return std::nullopt; + const auto &surface + = p_ctx.retrieval_surface_cache[surface_it->second]; + if (entry.memory_id == memory_id + || (surface.kind != "LONG_TERM" + && surface.kind != "ASSOCIATION") + || surface.start_ts >= end_ts) + continue; + } ranked.push_back ({ index, use_sparse_route @@ -644,9 +659,11 @@ LoadCurrentSupersessionRowsFromCache ( return std::nullopt; } const auto &surface = p_ctx.retrieval_surface_cache[surface_it->second]; - if (entry.memory_id == memory_id - || (surface.kind != "LONG_TERM" && surface.kind != "ASSOCIATION") - || surface.start_ts >= end_ts) + if (!use_sparse_route + && (entry.memory_id == memory_id + || (surface.kind != "LONG_TERM" + && surface.kind != "ASSOCIATION") + || surface.start_ts >= end_ts)) { continue; } diff --git a/src/operations/sparse_retrieval_route_sqlite_internal.cpp b/src/operations/sparse_retrieval_route_sqlite_internal.cpp index 9a94546f..7019beea 100644 --- a/src/operations/sparse_retrieval_route_sqlite_internal.cpp +++ b/src/operations/sparse_retrieval_route_sqlite_internal.cpp @@ -1470,7 +1470,9 @@ Route::Seal (const sparse_retrieval_route_internal::Route *hnsw_route) node.active = true; updates[memory_id] = std::move (node); if (next_entry_memory_id == 0 - || prior->second.level > next_max_level) + || prior->second.level > next_max_level + || (prior->second.level == next_max_level + && memory_id < next_entry_memory_id)) { next_entry_memory_id = memory_id; next_max_level = prior->second.level; diff --git a/tests/operations_graph_retrieval.test.cpp b/tests/operations_graph_retrieval.test.cpp index b992eeaa..db19ce86 100644 --- a/tests/operations_graph_retrieval.test.cpp +++ b/tests/operations_graph_retrieval.test.cpp @@ -402,6 +402,53 @@ TEST_CASE ("SQLite sparse route replaces a removed hierarchy entry", REQUIRE (restored->front () == 1); } +TEST_CASE ("SQLite sparse route restores the canonical same-level entry tie", + "[operations][graph][retrieval][hnsw][sqlite][regression]") +{ + using HnswRoute + = operations::sparse_retrieval_route_internal::Route; + using SQLiteRoute + = operations::sparse_retrieval_route_sqlite_internal::Route; + const auto parameters = operations::sparse_retrieval_route_sqlite_internal:: + DefaultParameters (); + auto store = std::shared_ptr (SQLiteStore::Create (":memory:")); + cortext::testing::InitializeCoreSchema (*store); + const std::vector> entries { + { 1, UnitVec (1) }, { 2, UnitVec (2) }, { 3, UnitVec (3) } + }; + auto hnsw = HnswRoute::CreateWithLevelsForTest ( + kEmbeddingDim, entries, { 2, 2, 1 }, parameters.hnsw); + REQUIRE (hnsw); + auto route = SQLiteRoute::Create ( + *store, kEmbeddingDim, entries, *hnsw, parameters); + REQUIRE (route); + + REQUIRE (route->Remove (1)); + REQUIRE (route->StagePendingRemove (1)); + REQUIRE (route->Seal ()); + auto meta = store->Execute ( + "SELECT entry_memory_id, max_level FROM cortext_sparse_route_meta"); + REQUIRE (meta.size () == 1); + REQUIRE (store::AnyToLongLong (meta.front ().at ("entry_memory_id")) == 2); + REQUIRE (store::AnyToLongLong (meta.front ().at ("max_level")) == 2); + + REQUIRE (route->Upsert (1, UnitVec (1))); + REQUIRE (route->StagePendingUpsert (1, UnitVec (1))); + REQUIRE (route->Seal ()); + meta = store->Execute ( + "SELECT entry_memory_id, max_level FROM cortext_sparse_route_meta"); + REQUIRE (meta.size () == 1); + REQUIRE (store::AnyToLongLong (meta.front ().at ("entry_memory_id")) == 1); + REQUIRE (store::AnyToLongLong (meta.front ().at ("max_level")) == 2); + + auto reopened = SQLiteRoute::Open (*store, kEmbeddingDim, parameters); + REQUIRE (reopened); + const auto result = reopened->Search (UnitVec (1), 3); + REQUIRE (result); + REQUIRE_FALSE (result->empty ()); + REQUIRE (result->front () == 1); +} + TEST_CASE ("SQLite sparse route invalidates stale links after an active " "embedding moves", "[operations][graph][retrieval][hnsw][sqlite][regression]") diff --git a/tests/operations_memory_storage.test.cpp b/tests/operations_memory_storage.test.cpp index 63ad26cd..ba67dd36 100644 --- a/tests/operations_memory_storage.test.cpp +++ b/tests/operations_memory_storage.test.cpp @@ -798,6 +798,54 @@ TEST_CASE ("Active signal embedding ring follows timestamp recency across " REQUIRE (AnyToLongLong (rows[0].at ("new_present")) == 1); } +TEST_CASE ("An emptied exact signal ring does not rebuild from flattened " + "memory centroids", + "[operations][memory_storage][embedding_population][regression]") +{ + namespace ring = operations::active_signal_embedding_ring_internal; + auto store = SQLiteStore::Create (":memory:"); + cortext::testing::InitializeCoreSchema (*store); + const int capacity = ring::Capacity (0.0, 0.0, 0.0); + + const Eigen::VectorXf aggregate = UnitVec (0); + cortext::testing::SeedEmbeddingV2 (*store, 100, aggregate, 1000); + cortext::testing::SeedMemoryV2 ( + *store, 10, 100, "opaque/flattened", "LONG_TERM", 1.0, 1000); + store->Execute ( + "INSERT INTO signals(signal_id, memory_id, source_id, embedding_id, " + "timestamp, modality, created_at) " + "VALUES(1, 10, 'opaque/flattened', 100, 1000, 'audio', 1000)"); + std::vector prior_exact (kEmbeddingDim, 0.0f); + prior_exact[1] = 1.0f; + auto tx = store->Begin (); + ring::InsertAtCapacity (*tx, 1, prior_exact, 1000, capacity); + tx->Commit (); + + // Simulate a later cascade that removes every currently retained exact + // vector while an older flattened signal row remains authoritative. + store->Execute ("DELETE FROM cortext_active_signal_embeddings"); + store->Execute ( + "INSERT INTO signals(signal_id, memory_id, source_id, embedding_id, " + "timestamp, modality, created_at) " + "VALUES(2, 10, 'opaque/new', 100, 2000, 'image', 2000)"); + std::vector newest_exact (kEmbeddingDim, 0.0f); + newest_exact[2] = 1.0f; + tx = store->Begin (); + ring::Upsert (*tx, 2, newest_exact, 2000, 0.0, 0.0, 0.0); + tx->Commit (); + + const auto rows = store->Execute ( + "SELECT signal_id, embedding FROM cortext_active_signal_embeddings"); + REQUIRE (rows.size () == 1); + REQUIRE (AnyToLongLong (rows.front ().at ("signal_id")) == 2); + const auto bytes = BlobFromAny (rows.front ().at ("embedding")); + REQUIRE (bytes.size () == static_cast (kEmbeddingDim) + * sizeof (float)); + Eigen::VectorXf restored (kEmbeddingDim); + std::memcpy (restored.data (), bytes.data (), bytes.size ()); + REQUIRE (restored.isApprox (UnitVec (2), 0.0f)); +} + TEST_CASE ("MemoryStorage writes modality-agnostic supersedes edges", "[operations][memory_storage][supersession][fanout_cache]") { @@ -1142,14 +1190,19 @@ TEST_CASE ("Large supersession population uses the knob-bounded SQLite route", SignalProcessor::Config cfg; cortext::testing::RequireEncoder (cfg); - cfg.focus = 0.0; + cfg.focus = 1.0; cfg.sensitivity = 0.0; cfg.stability = 0.0; const auto parameters = sqlite_route::DeriveParameters ( cfg.focus, cfg.sensitivity, cfg.stability); - REQUIRE (parameters.route_capacity == 256); - REQUIRE (parameters.backfill_batch_size == 64); + REQUIRE (parameters.route_capacity == 512); + REQUIRE (parameters.backfill_batch_size == 128); const std::size_t population = parameters.route_capacity + 1; + const int candidate_limit = core::SupersessionCandidateLimit ( + cfg.focus, cfg.sensitivity, cfg.stability); + REQUIRE (candidate_limit == 67); + REQUIRE (static_cast (candidate_limit) < population); + const long long expected_target_id = 10 + candidate_limit; ProcessorContext pctx; std::vector historical_entries; @@ -1163,9 +1216,16 @@ TEST_CASE ("Large supersession population uses the knob-bounded SQLite route", { const long long memory_id = 10 + static_cast (index); const long long embedding_id = 1000 + static_cast (index); - const long long start_ts = 1000 + static_cast (index); + const bool blocks_unfiltered_top_k + = index < static_cast (candidate_limit); + const long long start_ts + = blocks_unfiltered_top_k + ? 20000 + static_cast (index) + : 1000 + static_cast (index); Eigen::VectorXf embedding = Eigen::VectorXf::Zero (kEmbeddingDim); - if (index == 0) + if (index < static_cast (candidate_limit)) + embedding = UnitVec (0); + else if (index == static_cast (candidate_limit)) embedding = target; else { @@ -1258,8 +1318,8 @@ TEST_CASE ("Large supersession population uses the knob-bounded SQLite route", == 0.0); const auto edge_rows = store->Execute ( "SELECT 1 FROM associations WHERE source_memory_id = ? " - "AND target_memory_id = 10 AND edge_type = 'supersedes'", - { *ctx.GetStoredMemoryId () }); + "AND target_memory_id = ? AND edge_type = 'supersedes'", + { *ctx.GetStoredMemoryId (), expected_target_id }); REQUIRE (edge_rows.size () == 1); cache::Erase (pctx); }