ReadPrintedHistoryCompareGraphs

v7.1 → v7.2

What changed from v7.1 to v7.2

From v7.1 (2 Jun) to v7.2 (2 Jun): 6,494 words to 6,515 words, 334 words in new or rewritten paragraphs and 313 taken out, 27 paragraphs changed.

Three diagrams added

Three diagrams arrive: the three-layer memory system, the path of a question at answer time, and how the new ranking signals adjust the result. The improvement notes had marked the lack of diagrams as critical. The retry on weak matches is now labelled as proposed, not built.

v7.1 · 2 June 2026v7.2 · 2 June 2026
v7.1 · Instant Recall: A Pre-Computed Concept Index for O(1) Memory Retrieval in Persistent AI Agents# Instant Recall: A Pre-Computed Concept Index for O(1) Memory Retrieval in Persistent AI Agents
removed in v7.2
v7.1 · Instant Recall: A Pre-Computed Concept Index for O(1) Memory Retrieval in Persistent AI Agents**Oscar Serra¹** ¹Independent Research _Version 7.1 — June 2026_
removed in v7.2
v7.1 · Instant Recall: A Pre-Computed Concept Index for O(1) Memory Retrieval in Persistent AI Agents---
removed in v7.2

··· 3 unchanged paragraphs folded ···

v7.1 · Abstract---
removed in v7.2

··· 12 unchanged paragraphs folded ···

not in v7.1
v7.2 · 1.1 The Three-Layer Memory System![The three-layer memory system. Storage (Total Recall) persists and compacts events into the chunk store; Instant Recall builds and serves the concept index over that store; Sleep Consolidation reflects nightly and tunes the index parameters. Each arrow shows what flows between layers.](images/three-layer-system.png)

··· 2 unchanged paragraphs folded ···

v7.1 · 1.1 The Three-Layer Memory System---
removed in v7.2

··· 11 unchanged paragraphs folded ···

v7.1 · 2.3 Neuroscience Basis---
removed in v7.2

··· 18 unchanged paragraphs folded ···

v7.1 · 3.4 Frequency Analysis---
removed in v7.2

··· 6 unchanged paragraphs folded ···

not in v7.1
v7.2 · 4.1 Overview![Inference-time data flow. The user query enters anchor detection and semantic expansion (orange, input), feeds the O(1) index lookup against the pre-built concept index (blue, storage), then post-retrieval re-ranking blends anchor relevance, query cosine, and the beyond-cosine signals (green, processing). A low-confidence branch triggers the reformulation gate. Ranked chunks assemble into the context window handed to the LLM (purple, output).](images/inference-pipeline.png)

··· 37 unchanged paragraphs folded ···

v7.1 · 4.9 Beyond Cosine: Validity, Trust, and Links**Validity over time (bi-temporal facts).** A chunk you can retrieve but that is silently *wrong because it was overwritten* is a recall failure subtler than CORF: the index finds it, but it no longer reflects reality, and the prior truth is gone. Each chunk therefore carries a validity interval (`validity_start … validity_end`) describing when it was true in the world, and an ingestion time describing when the system learned it — the two clocks of a bi-temporal store. A new fact that contradicts an old one *closes the interval* of the old fact (`validity_end = now`) and stamps it `superseded_by` the new chunk, rather than overwriting the row. History is preserved, and the index can answer "what did we believe was true *as of* date X," not only "what is the latest snapshot." Retrieval defaults to a `current`-mode filter (`validity_end IS NULL OR validity_end > now`), backed by a covering index so the hot path does not scan; `valid-at` and `all` modes are available for time-travel queries. v1 exposes an `invalidate()` API and leaves contradiction *detection* to the nightly reflection layer.
v7.2 · 4.9 Beyond Cosine: Validity, Trust, and Links**Validity over time (bi-temporal facts).** A chunk you can retrieve but that is silently *wrong because it was overwritten* is a recall failure subtler than CORF: the index finds it, but it no longer reflects reality, and the prior truth is gone. Each chunk therefore carries a validity interval (`validity_start … validity_end`) describing when it was true in the world, and an ingestion time describing when the system learned it — the two clocks of a bi-temporal store. A new fact that contradicts an old one *closes the interval* of the old fact (`validity_end = now`) and stamps it `superseded_by` the new chunk, rather than overwriting the row. History is preserved, and the index can answer "what did we believe was true *as of* date X," not only "what is the latest snapshot." Retrieval defaults to a `current`-mode filter (`validity_end IS NULL OR validity_end > now`), backed by a covering index so the hot path does not scan; `valid-at` and `all` modes are available for time-travel queries. The invalidation routine only closes currently-open intervals — it never deletes a row or resurrects a closed one — and the contradiction *detection* that decides when to call it is left to the nightly reflection layer.
v7.1 · 4.9 Beyond Cosine: Validity, Trust, and Links**Trust (verified-code retrieval).** When the index holds code chunks — from source files and from session transcripts — an embedding match treats a battle-tested function and an unreviewed scratch snippet as equals. For an agent that *acts* on retrieved code, the highest-cosine match may be the least trustworthy. Each code chunk carries a `verification_status` (`unverified | partial | verified | failed`) and a test-coverage percentage; a verification-aware re-rank multiplies the score by ×1.5 (verified), ×1.2 (partial), ×1.0 (unverified), or ×0.5 (failed). Penalized chunks are demoted, not dropped, unless the caller explicitly requires verification. Coverage is populated by a nightly batch that maps test-runner coverage back to chunk line ranges — keeping metadata churn off the inference path. Transcript code, which has no coverage map, stays `unverified` by default.
v7.2 · 4.9 Beyond Cosine: Validity, Trust, and Links**Trust (verified-code retrieval).** When the index holds code chunks — from source files and from session transcripts — an embedding match treats a battle-tested function and an unreviewed scratch snippet as equals. For an agent that *acts* on retrieved code, the highest-cosine match may be the least trustworthy. Each code chunk carries a `verification_status` (`unverified | partial | verified | failed`) and a test-coverage percentage; a verification-aware re-rank multiplies the score by ×1.5 (verified), ×1.2 (partial), ×1.0 (unverified), or ×0.5 (failed). Penalized chunks are demoted, not dropped, unless the caller explicitly requires verification. Coverage is populated by a nightly batch that maps test-runner coverage back to chunk line ranges (≥80% coverage marks a chunk `verified`, partial coverage `partial`, no coverage `unverified`) — keeping metadata churn off the inference path. A file whose coverage disappears is downgraded rather than left stale, and transcript code, which has no coverage map, stays `unverified` by default.
v7.1 · 4.9 Beyond Cosine: Validity, Trust, and Links**Links (durable inter-chunk edges).** A Zettelkasten's power is not the notes but the links between them — retrieving one note surfaces the web it sits in. The deduplication pass (§4.6a) already computes relatedness but historically discarded it. Those edges are now persisted in a `backlinks` table (authoritative) with a denormalized JSON cache on the chunk row: `link_type='duplicate'` for similarity > 0.9, `'related'` for 0.7–0.9, with a link strength blending similarity, recency, and access count. A search can opt in to hydrate each result with its top backlinks, and a depth-capped, cycle-safe breadth-first walk can pull in a chunk's k-hop neighbourhood. Out-degree is bounded by linking only the top-k similar chunks per insert, avoiding the O(n²) link-explosion trap.
v7.2 · 4.9 Beyond Cosine: Validity, Trust, and Links**Links (durable inter-chunk edges).** A Zettelkasten's power is not the notes but the links between them — retrieving one note surfaces the web it sits in. The deduplication pass (§4.6a) already computes relatedness but historically discarded it. Those edges are now persisted in a `backlinks` table (authoritative) with a denormalized JSON cache on the chunk row: `link_type='duplicate'` for similarity ≥ 0.9, `'related'` for 0.7–0.9, with a link strength blending similarity, recency, and access count. A search can opt in to hydrate each result with its top backlinks, and a depth-capped, cycle-safe breadth-first walk (carrying a visited set so a cyclic graph terminates) can pull in a chunk's k-hop neighbourhood. Out-degree is bounded by linking only the top-k similar chunks per insert, avoiding the O(n²) link-explosion trap.
not in v7.1
v7.2 · 4.9 Beyond Cosine: Validity, Trust, and Links![The three beyond-cosine signals layered on the base cosine ranking. The base lane (blue) produces a cosine-ranked candidate set; validity (closes superseded intervals via a temporal filter), trust (×1.5/×1.2/×1.0/×0.5 verification multipliers), and links (durable backlinks + k-hop walk) each re-weight the candidates (green). All three are populated by the nightly cycle, never at query time, so the inference path stays O(1). The output is a re-weighted ranking where the closest chunk is not automatically first.](images/beyond-cosine-signals.png)

··· 6 unchanged paragraphs folded ···

v7.1 · 4.12 Low-Confidence Reformulation (Proposed)### 4.12 Low-Confidence Reformulation
v7.2 · 4.12 Low-Confidence Reformulation (Proposed)### 4.12 Low-Confidence Reformulation (Proposed)
v7.1 · 4.12 Low-Confidence Reformulation (Proposed)The pipeline above assumes one query attempt. Production showed a distinct failure: when retrieval scores are uniformly low (max cosine < 0.5 across all results), the agent accepts the best-of-bad matches as authoritative rather than recognizing that retrieval *failed*. Instant Recall adds a reformulation gate. When max(scores) falls below a confidence threshold **and** the query carries ownership signals ("our", "we", "my", "the [noun] we [verb]"), it (1) extracts domain-anchor nouns and re-searches on those alone, (2) searches explicitly for known project and paper titles, and (3) if still low, broadens to a file-path search — the knowledge may live in a file whose *name* matches even when its *text* does not. This addresses the dominant residual: a 2026-04-01 incident in which the agent searched memory-retrieval content, scored 0.47–0.49 across all results, and accepted the wrong files with no retry. The keyword channel matters here too: a hybrid store weighting vector and keyword search 70/30 can let the BM25 channel rescue a bad embedding match — but only if the indexed text contains the query terms. Papers about "compaction" do not match queries about "retrieval." A concept→keyword routing table, built during Sleep Consolidation, stores 10–20 human-search keywords per project (e.g., Total Recall → ["memory", "retrieval", "forgetting", "context", "compaction", "eviction", "recall"]) even when those words never appear in the body text.
v7.2 · 4.12 Low-Confidence Reformulation (Proposed)The pipeline above assumes one query attempt. Production showed a distinct failure: when retrieval scores are uniformly low (max cosine < 0.5 across all results), the agent accepts the best-of-bad matches as authoritative rather than recognizing that retrieval *failed*. We propose a reformulation gate to close this gap. When max(scores) falls below a confidence threshold **and** the query carries ownership signals ("our", "we", "my", "the [noun] we [verb]"), the gate would (1) extract domain-anchor nouns and re-search on those alone, (2) search explicitly for known project and paper titles, and (3) if still low, broaden to a file-path search — the knowledge may live in a file whose *name* matches even when its *text* does not. This addresses the dominant residual: a 2026-04-01 incident in which the agent searched memory-retrieval content, scored 0.47–0.49 across all results, and accepted the wrong files with no retry. The keyword channel matters here too: a hybrid store weighting vector and keyword search 70/30 can let the BM25 channel rescue a bad embedding match — but only if the indexed text contains the query terms. Papers about "compaction" do not match queries about "retrieval." A complementary proposal is a concept→keyword routing table, built during Sleep Consolidation, storing 10–20 human-search keywords per project (e.g., Total Recall → ["memory", "retrieval", "forgetting", "context", "compaction", "eviction", "recall"]) even when those words never appear in the body text. Unlike the signals of §4.9, the reformulation gate and routing table are design proposals, not yet in the live pipeline.

··· 2 unchanged paragraphs folded ···

v7.1 · Layer 1: Instant Recall lookup + re-rank (O(|A|) + O(K×|A|), ~50ms) index = load_cached("memory/instant-recall-index.json") memory_chunks = INSTANT_RECALL_LOOKUP(user_message, index) if max_score(memory_chunks) < CONFIDENCE_THRESHOLD and has_ownership_signal(user_message): memory_chunks = REFORMULATE_AND_RETRY(user_message, index) # §4.12 (proposed)# Layer 1: Instant Recall lookup + re-rank (O(|A|) + O(K×|A|), ~50ms) index = load_cached("memory/instant-recall-index.json") memory_chunks = INSTANT_RECALL_LOOKUP(user_message, index) if max_score(memory_chunks) < CONFIDENCE_THRESHOLD and has_ownership_signal(user_message): memory_chunks = REFORMULATE_AND_RETRY(user_message, index) # §4.12
v7.2 · Layer 1: Instant Recall lookup + re-rank (O(|A|) + O(K×|A|), ~50ms) index = load_cached("memory/instant-recall-index.json") memory_chunks = INSTANT_RECALL_LOOKUP(user_message, index) if max_score(memory_chunks) < CONFIDENCE_THRESHOLD and has_ownership_signal(user_message): memory_chunks = REFORMULATE_AND_RETRY(user_message, index) # §4.12 (proposed)# Layer 1: Instant Recall lookup + re-rank (O(|A|) + O(K×|A|), ~50ms) index = load_cached("memory/instant-recall-index.json") memory_chunks = INSTANT_RECALL_LOOKUP(user_message, index) if max_score(memory_chunks) < CONFIDENCE_THRESHOLD and has_ownership_signal(user_message): memory_chunks = REFORMULATE_AND_RETRY(user_message, index) # §4.12 (proposed)

··· 3 unchanged paragraphs folded ···

v7.1 · Layer 3: Compaction if budget exceeded if token_count(context) > CONTEXT_BUDGET: context = COMPACT(context)---
removed in v7.2

··· 6 unchanged paragraphs folded ···

v7.1 · 5.2 Recognition vs. Recall---
removed in v7.2

··· 12 unchanged paragraphs folded ···

v7.1 · 6.5 Alternative 5: Hosted Vector Databases (Pinecone, Weaviate)---
removed in v7.2

··· 13 unchanged paragraphs folded ···

v7.1 · 7.4 Implementation StatusThe reference implementation is TypeScript (ESM, Node 22+), organized around an enhancement module (importance scoring, episodic buffer, deduplication, ~480 lines), a rebuild module (nightly orchestration, anchor extraction, incremental mtime-diff state, ~470 lines), and a co-located unit test suite. The beyond-cosine signals of §4.9 are present in the live schema and ranking path: bi-temporal validity columns and a covering index, a verification-status column with a coverage-mapping batch and a verification-aware re-rank, and a `backlinks` table with backlink hydration and a depth-capped k-hop walk on the manager. Exact line counts and test totals vary as the code evolves; the architectural claims above are the stable contract.
v7.2 · 7.4 Implementation StatusThe reference implementation is TypeScript (ESM, Node 22+), organized around an enhancement module (importance scoring, episodic buffer, deduplication, ~480 lines), a rebuild module (nightly orchestration, anchor extraction, incremental mtime-diff state, ~470 lines), and a co-located unit test suite. The beyond-cosine signals of §4.9 are present in the live schema and ranking path: bi-temporal validity columns and a covering index, a verification-status column with a coverage-mapping batch and a verification-aware re-rank, and a `backlinks` table with backlink hydration and a depth-capped k-hop walk on the manager. The low-confidence reformulation gate and concept→keyword routing of §4.12 are designed but not yet wired into the live pipeline. Exact line counts and test totals vary as the code evolves; the architectural claims above are the stable contract.

··· 3 unchanged paragraphs folded ···

v7.1 · 7.5 Threats to Validity**Beyond-cosine signals not yet in the benchmark.** The validity, trust, and link signals of §4.9 are implemented but were added after the §7.2 benchmark was frozen; their retrieval-quality contribution is not yet isolated in an ablation. Quantifying each is the next evaluation priority.
v7.2 · 7.5 Threats to Validity**Beyond-cosine signals not yet in the benchmark.** The validity, trust, and link signals of §4.9 are implemented but were added after the §7.2 benchmark was frozen; their retrieval-quality contribution is not yet isolated in an ablation. Quantifying each is the next evaluation priority. The §4.12 reformulation gate, being a proposal rather than live code, is likewise unbenchmarked.
v7.1 · 7.5 Threats to Validity---
removed in v7.2

··· 5 unchanged paragraphs folded ···

v7.1 · 8.1 Limitations and Mitigation Strategies**Contradiction detection boundary.** The validity machinery (§4.9) can close a fact's interval, but *deciding* that a new fact contradicts an old one is left to the reflection layer. Until that detector is in place, validity intervals are only as good as the heuristics that call `invalidate()`.
v7.2 · 8.1 Limitations and Mitigation Strategies**Contradiction detection boundary.** The validity machinery (§4.9) can close a fact's interval, but *deciding* that a new fact contradicts an old one is left to the reflection layer. Until that detector is in place, validity intervals are only as good as the heuristics that call the invalidation routine.

··· 8 unchanged paragraphs folded ···

v7.1 · 8.4 Reproducibility---
removed in v7.2

··· 4 unchanged paragraphs folded ···

v7.1 · 9. Conclusion---
removed in v7.2

··· 2 unchanged paragraphs folded ···

v7.1 · References---
removed in v7.2
v7.1 · References_Version 7.1 — June 2026_ _Changes from v7.0: Grounded the opening in the human hippocampus and patient H.M. (Scoville & Milner, 1957, added to refs) with the "indexing organ — difference between having and using memories" framing. Added reader-facing similes (book index, owning-a-book-you-can't-find for CORF, desk-vs-filing-cabinet for the episodic hot cache, editor's front page for importance scoring). Added §1.1 "The three-layer memory system" with self-sufficient inline summaries of the storage and reflection layers, replacing the bare cross-reference list. Added §4.2 clarifying that Instant Recall is store-agnostic — it requires only a (content, timestamp, source) contract and does not depend on any one storage layer. Added §4.9 "Beyond cosine: validity, trust, and links," documenting three retrieval signals now present in the live schema/ranking path — bi-temporal validity intervals, verified-code trust ranking, and durable Zettelkasten backlinks — verified against the implementation. Added §4.10 reflection-tuned parameters (anchor/weight/boundary auto-tuning). Added §4.12 low-confidence reformulation gate and concept→keyword routing tables, motivated by the 2026-04-01 CORF incident. Folded the same-day self-contradiction fix into §4.7 (episodic hot cache) without a separate failure mode. Replaced §7.4 unit-benchmark table with an implementation-status paragraph that no longer pins exact LOC/test counts to a frozen snapshot, and added a §7.5 threat noting the §4.9 signals are not yet ablated. Added §8.4 reproducibility (synthetic CORF generator) and a retention note to §8.3. Removed remaining file-path/commit-hash references and the "GravityClaw"-style internal pointers from prose; renamed the reflection module from "Round Table" to "Sleep Consolidation" for consistency with the cited layer. Killed AI-isms ("landscape" → "field", "represents a favorable" → "is a favorable")._
removed in v7.2

Changed paragraphs in the same form, for scripts: JSON · Markdown