ANAMNESIS // MEMORY ATTENTION PIPELINE

How an agent remembers, and recalls.

The full sequence — write-side gating, then read-side retrieval across three nested layers.

ALWAYS-ON
·
OPT-IN
·
G1–G6 = the six attention mechanisms
Embed content Always-On
384-dim vector via sentence-transformer
Salience Gate G6 Opt-In
surprise = 1 − exp(−nearest-neighbor distance)  (embedding novelty)
salience = 0.5·(importance/10) + 0.2·emotion + 0.3·surprise
decision:  importance ≥ 8CONSOLIDATE  (hard floor)  ·  salience ≥ 0.35CONSOLIDATE  ·  else → EPHEMERAL (valid_until +14d)
Store Always-On
INSERT into memories + vector index + FTS index

The write side decides what's worth keeping — surprise + emotion + importance — never hard-dropping load-bearing facts.

G5 FEDERATION — for own DB, then each peer DB (read-only) Opt-In
G1 MULTI-HOP — repeat up to N hops Opt-In
CORE recall() — per-query ranking
Embed query Always-On
384-dim vector representation of the query
PARALLEL SEARCH
Vector search Always-On
sqlite-vec · top 2k results · cosine similarity
FTS5 keyword search Always-On
BM25 ranking · top 2k results · token matching
RRF Fusion Always-On
score = Σ 1/(60 + rank) across both result lists
Validity gate Always-On
Drop expired records — valid_until passed
RANK — two routes, one wins
ROUTE A — short-circuits B
Cross-encoder rerank G4
Opt-In
Score query × content relevance, sort descending. Wins — short-circuits Route B.
ROUTE B — default when A absent
× importance weight Always-On
Scale by importance factor 0.6–1.5
× recency decay G3 Opt-In
0.5^(age / half-life)
+ emotion rerank Opt-In
cosine(query_emotion, memory_emotion) · 0.3
Sort + trim to limit Always-On
Final sort descending on composite score · slice to requested limit
Associative expansion G2 Opt-In
Pull neighbors sharing association labels · score by overlap × importance · append with provenance — spreading activation
CORE RECALL — per-query fusion · vector + lexical · filtered · ranked
assess coverage (Haiku or heuristic) → refine query → loop  ·  stop on: assessor-stop · budget · convergence
merge peer results · dedup · tag source_scope: own → peer:<agent>
MENTAL MODEL
Federation sets the breadth · multi-hop sets the depth · the core fuses semantic + lexical evidence · the rerankers set priority · expansion follows the association graph outward. Write-side, the salience gate decides what was worth admitting at all.