🧬 Biological Systems — Overview¶
Spector Memory draws on computational neuroscience research to implement simplified, performance-optimized approximations of biological memory mechanisms. Each package in spector-memory maps to a neuroscience concept, implementing mathematical models inspired by peer-reviewed cognitive science — particularly Anderson's ACT-R architecture (1993) — and optimized for microsecond-scale agent memory operations.
The Brain–Code Mapping¶
graph TB
subgraph "Encoding & Storage"
STE["🧩 Synapse<br/>Synaptic Tags & Scoring<br/><i>Bloom filter + binary layout</i>"]
CT["🧠 Cortex<br/>4-Tier Memory Stores<br/><i>Working → Episodic → Semantic → Procedural</i>"]
end
subgraph "Emotional & Importance Modulation"
DA["⚡ Dopamine<br/>Surprise Detection<br/><i>Welford Z-score → importance</i>"]
AM["❤️ Amygdala<br/>Emotional Valence<br/><i>-128 to +127 coloring</i>"]
end
subgraph "Retrieval Dynamics"
HB["🛑 Habituation<br/>Anti-Filter Bubble<br/><i>Repetition penalty</i>"]
IN["🚫 Inhibition<br/>Suppression Set<br/><i>Inhibition of return</i>"]
IF["🔀 Interference<br/>Deduplication<br/><i>Proactive/retroactive</i>"]
end
subgraph "Association & Learning"
HE["🔗 3-Layer Cognitive Graph<br/>Hebbian + Entity + Temporal<br/><i>Off-heap graph structures</i>"]
end
subgraph "Consolidation & Planning"
HP["💤 Hippocampus<br/>Sleep Consolidation<br/><i>ReflectDaemon cycle</i>"]
PR["📋 Prospective<br/>Future Intents<br/><i>Scheduled reminders</i>"]
MM["🔍 Metamemory<br/>Self-Reflection<br/><i>Confidence calibration</i>"]
end
DA --> STE
AM --> STE
STE --> CT
CT --> HE
HE --> HP
style HE fill:#e74c3c,color:white
style DA fill:#f39c12,color:white
style HP fill:#9b59b6,color:white Systems at a Glance¶
| System | Brain Region | Key Concept | Spector Implementation | Reference |
|---|---|---|---|---|
| Cortex | Prefrontal, Hippocampus, Neocortex, Basal Ganglia | Multi-store memory model | 4-tier off-heap stores (Working, Episodic, Semantic, Procedural) | Atkinson & Shiffrin, 19681 |
| Synapse | Synaptic junction | Synaptic tagging & capture | 64-bit Bloom filter tag encoding, 32B binary header | Frey & Morris, 19972 |
| Dopamine | Ventral tegmental area | Prediction error signaling | Welford Z-score surprise detection, flashbulb encoding | Schultz, 19973 |
| Amygdala | Amygdala | Emotional memory modulation | Signed valence byte (-128 to +127), emotional filtering | McGaugh, 20044 |
| 3-Layer Graph | Cortical networks, Hippocampus | Hebbian learning, STDP, episodic sequences | Off-heap HebbianGraph, EntityGraph, TemporalChain | Hebb, 19495; Bi & Poo, 20016 |
| Habituation | Sensory cortex | Response decrement to repetition | Exponential penalty on repeated recall | Thompson & Spencer, 19667 |
| Inhibition | Prefrontal cortex | Inhibition of return | SuppressionSet with TTL-based suppression windows | Klein, 20008 |
| Interference | Hippocampus | Proactive/retroactive interference | Similarity-based deduplication during ingestion | Underwood, 19579 |
| Hippocampus | Hippocampus | Sleep consolidation & replay | ReflectDaemon: decay, compaction, episodic→semantic promotion | Rasch & Born, 201310 |
| Prospective | Prefrontal cortex | Prospective memory | Scheduled future intent reminders | Einstein & McDaniel, 199011 |
| Metamemory | Prefrontal cortex | Metacognitive monitoring | Confidence calibration, recall quality estimation | Nelson & Narens, 199012 |
| Sync | — (engineering) | Persistence & replication | WAL + mmap-backed partitions | — |
Key Mathematical Models¶
Temporal Decay (Power Law of Forgetting)¶
Spector approximates the power law of forgetting using precomputed decay buckets — avoiding expensive Math.pow() calls in the hot loop:
Where \(R(t)\) is retrieval strength, \(t\) is time since encoding, and \(d\) is the configurable decay exponent (default: 0.15). Research since Wixted (2004) has established that forgetting follows a power law, not the exponential curve originally proposed by Ebbinghaus (1885). Spector discretizes this into 12 buckets spanning 5+ years, with a configurable permastore floor (default: 0.10) — see Scoring Pipeline).
References: Wixted, J.T. (2004). The psychology and neuroscience of forgetting15; Ebbinghaus, H. (1885). Über das Gedächtnis13
Reconsolidation (Spacing Effect)¶
Each recall shifts the decay bucket backward, simulating how retrieved memories become more durable:
Reference: Bjork & Bjork (1992). A New Theory of Disuse14
Surprise Detection (Dopamine Prediction Error)¶
The importance signal uses a Z-score from Welford's online statistics:
Where \(\sigma()\) is the sigmoid function, \(\alpha = 0.6\), \(\beta = 0.4\).
Reference: Schultz, W. (1997). A neural substrate of prediction and reward3
Hebbian Edge Strengthening¶
Co-ingested memories strengthen their bidirectional edge:
With decay during consolidation: \(w_{ij}(t+1) = 0.9 \cdot w_{ij}(t)\)
Reference: Hebb, D.O. (1949). The Organization of Behavior5
STDP — Spike-Timing Dependent Plasticity¶
Directed causal edges are strengthened when tag A is recalled before tag B:
Reference: Bi & Poo (2001). Synaptic modification by correlated activity6
Scoring Formula (ACT-R Lineage)¶
Spector's core scoring formula is a simplified, hardware-optimized approximation of the ACT-R activation equation (Anderson, 1993):
Spector's approximation:
Where:
- Similarity ≈ ACT-R's spreading activation from current context
- Importance × decay ≈ ACT-R's base-level activation \(B_i\)
- \(S^{0.3}\) (storage strength) ≈ Bjork's two-factor model (1992)14
- α, β = relative weighting of context vs. base-level (default: 0.6, 0.4)
References: Anderson, J.R. (1993). Rules of the Mind16; Anderson, J.R. & Lebiere, C. (1998). The Atomic Components of Thought17
Habituation Penalty¶
Repeated recall of the same memory incurs an exponentially increasing penalty:
Where \(n\) is the number of times the memory appeared in recent results and \(\gamma\) controls penalty steepness.
Reference: Thompson & Spencer (1966). Habituation: A model phenomenon7
Design Principles¶
-
Grounded in research: Each system implements a mathematical model inspired by peer-reviewed cognitive science, optimized for microsecond-scale agent memory operations. The scoring formula is a simplified, hardware-optimized approximation of the ACT-R activation equation (Anderson, 1993)16, with extensions for emotional valence (McGaugh, 2004)4 and storage strength (Bjork & Bjork, 1992)14.
-
Independent testability: Each biological system is a standalone package with its own unit tests. Systems compose via dependency injection, not inheritance.
-
Graceful degradation: Every system is optional. Disabling surprise detection, habituation, or graph augmentation produces a functional (if less intelligent) memory system.
-
Performance-first biology: Biological accuracy is constrained by microsecond latency requirements. Where exact models are too expensive (e.g., continuous exponential decay), we use precomputed approximations (decay buckets, Bloom filter tags).
Explore Each System¶
-
Cortex — Tier Stores
Working, Episodic, Semantic, and Procedural memory tiers
-
Synapse — Tags & Scoring
Bloom filter encoding, binary layout, 6-phase scorer
-
:material-head-lightning-bolt:{ .lg .middle } Dopamine — Surprise
Welford Z-score, flashbulb encoding, importance scoring
-
Amygdala — Valence
Emotional coloring, valence-based filtering
-
3-Layer Cognitive Graph
Hebbian, Entity-Relationship, and Temporal Causal graphs
-
Hippocampus — Consolidation
Sleep cycles, decay, episodic-to-semantic promotion
References¶
-
Atkinson, R.C. & Shiffrin, R.M. (1968). Human memory: A proposed system and its control processes. In Psychology of Learning and Motivation, 2, 89–195. doi:10.1016/S0079-7421(08)60422-3 ↩
-
Frey, U. & Morris, R.G.M. (1997). Synaptic tagging and long-term potentiation. Nature, 385, 533–536. doi:10.1038/385533a0 ↩
-
Schultz, W. (1997). A neural substrate of prediction and reward. Science, 275(5306), 1593–1599. doi:10.1126/science.275.5306.1593 ↩↩
-
McGaugh, J.L. (2004). The amygdala modulates the consolidation of memories of emotionally arousing experiences. Annual Review of Neuroscience, 27, 1–28. doi:10.1146/annurev.neuro.27.070203.144157 ↩↩
-
Hebb, D.O. (1949). The Organization of Behavior: A Neuropsychological Theory. New York: Wiley. ↩↩
-
Bi, G. & Poo, M. (2001). Synaptic modification by correlated activity: Hebb's postulate revisited. Annual Review of Neuroscience, 24, 139–166. doi:10.1146/annurev.neuro.24.1.139 ↩↩
-
Thompson, R.F. & Spencer, W.A. (1966). Habituation: A model phenomenon for the study of neuronal substrates of behavior. Psychological Review, 73(1), 16–43. doi:10.1037/h0022681 ↩↩
-
Klein, R.M. (2000). Inhibition of return. Trends in Cognitive Sciences, 4(4), 138–147. doi:10.1016/S1364-6613(00)01452-2 ↩
-
Underwood, B.J. (1957). Interference and forgetting. Psychological Review, 64(1), 49–60. doi:10.1037/h0044616 ↩
-
Rasch, B. & Born, J. (2013). About sleep's role in memory. Physiological Reviews, 93(2), 681–766. doi:10.1152/physrev.00032.2012 ↩
-
Einstein, G.O. & McDaniel, M.A. (1990). Normal aging and prospective memory. Journal of Experimental Psychology: Learning, Memory, and Cognition, 16(4), 717–726. doi:10.1037/0278-7393.16.4.717 ↩
-
Nelson, T.O. & Narens, L. (1990). Metamemory: A theoretical framework and new findings. In Psychology of Learning and Motivation, 26, 125–173. doi:10.1016/S0079-7421(08)60053-5 ↩
-
Ebbinghaus, H. (1885). Über das Gedächtnis: Untersuchungen zur experimentellen Psychologie. Leipzig: Duncker & Humblot. English translation: Memory: A Contribution to Experimental Psychology (1913). ↩
-
Bjork, R.A. & Bjork, E.L. (1992). A new theory of disuse and an old theory of stimulus fluctuation. In From Learning Processes to Cognitive Processes: Essays in Honor of William K. Estes, 2, 35–67. ↩↩↩
-
Wixted, J.T. (2004). The psychology and neuroscience of forgetting. Annual Review of Psychology, 55, 235–269. doi:10.1146/annurev.psych.55.090902.141555 ↩
-
Anderson, J.R. (1993). Rules of the Mind. Hillsdale, NJ: Erlbaum. ↩↩
-
Anderson, J.R. & Lebiere, C. (1998). The Atomic Components of Thought. Mahwah, NJ: Erlbaum. ↩
-
Park, J.S. et al. (2023). Generative Agents: Interactive Simulacra of Human Behavior. UIST '23. doi:10.1145/3586183.3606763 ↩
-
Hu, Y. et al. (2025). MemoryOS: Cognitive-Inspired Memory Architecture for AI Agents. arXiv:2506.06326. ↩
-
McClelland, J.L., McNaughton, B.L. & O'Reilly, R.C. (1995). Why there are complementary learning systems in the hippocampus and neocortex. Psychological Review, 102(3), 419–457. doi:10.1037/0033-295X.102.3.419 ↩
-
Baddeley, A.D. (2000). The episodic buffer: a new component of working memory? Trends in Cognitive Sciences, 4(11), 417–423. doi:10.1016/S1364-6613(00)01538-2 ↩
-
Bahrick, H.P. (1984). Semantic memory content in permastore: Fifty years of memory for Spanish learned in school. JEP: General, 113(1), 1–29. doi:10.1037/0096-3445.113.1.1 ↩