ANAMNESIS // MEMORY ATTENTION PIPELINE
How an agent remembers, and recalls.
The full sequence — write-side gating, then read-side retrieval across three nested layers.
·
·
G1–G6 = the six attention mechanisms
DIAGRAM 1 — WRITE PATH · remember()
384-dim vector via sentence-transformer
surprise = 1 − exp(−nearest-neighbor distance)
(embedding novelty)
salience = 0.5·(importance/10) + 0.2·emotion + 0.3·surprise
decision:
importance ≥ 8 → CONSOLIDATE
(hard floor)
· salience ≥ 0.35 → CONSOLIDATE
· else → EPHEMERAL
(valid_until +14d)
INSERT into memories + vector index + FTS index
The write side decides what's worth keeping — surprise + emotion + importance — never hard-dropping load-bearing facts.
DIAGRAM 2 — READ PATH · recall()
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
384-dim vector representation of the query
PARALLEL SEARCH
sqlite-vec · top 2k results · cosine similarity
BM25 ranking · top 2k results · token matching
score = Σ 1/(60 + rank) across both result lists
Drop expired records — valid_until passed
ROUTE A — short-circuits B
Opt-In
Score query × content relevance, sort descending. Wins — short-circuits Route B.
ROUTE B — default when A absent
Scale by importance factor 0.6–1.5
cosine(query_emotion, memory_emotion) · 0.3
Final sort descending on composite score · slice to requested limit
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.