--- license: cc-by-4.0 language: - en tags: - memory - agent-memory - ai-memory - neuroscience - cognitive-architecture - ai-memory-architecture - autonomous-ai - knowledge-management - long-term-memory - episodic-memory - hebbian-learning - spaced-repetition - bayesian - rag - agents --- # ZenBrain: A Neuroscience-Inspired 7-Layer Memory Architecture for Autonomous AI Systems [![arXiv](https://img.shields.io/badge/arXiv-2604.23878-b31b1b.svg)](https://arxiv.org/abs/2604.23878) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.19353663.svg)](https://doi.org/10.5281/zenodo.19353663) [![Code: Apache-2.0](https://img.shields.io/badge/Code-Apache--2.0-blue.svg)](https://github.com/zensation-ai/zenbrain/blob/main/LICENSE) [![Paper: CC BY 4.0](https://img.shields.io/badge/Paper-CC%20BY%204.0-lightgrey.svg)](https://creativecommons.org/licenses/by/4.0/) [![npm @zensation/algorithms](https://img.shields.io/npm/v/@zensation/algorithms.svg?label=%40zensation%2Falgorithms)](https://www.npmjs.com/package/@zensation/algorithms) [![npm @zensation/core](https://img.shields.io/npm/v/@zensation/core.svg?label=%40zensation%2Fcore)](https://www.npmjs.com/package/@zensation/core) [![GitHub](https://img.shields.io/badge/GitHub-zensation--ai%2Fzenbrain-black?logo=github)](https://github.com/zensation-ai/zenbrain) [![Website](https://img.shields.io/badge/Website-zensation.ai-orange)](https://zensation.ai/?utm_source=huggingface&utm_medium=card&utm_campaign=evergreen) [![Live Demo](https://img.shields.io/badge/%F0%9F%A4%97%20Space-Live%20Demo-yellow)](https://huggingface.co/spaces/zensation-ai/zenbrain-playground) **Head-to-head:** On LongMemEval-500, three of nine answer-quality comparisons hold against Letta, Mem0 and A-Mem — all three against A-Mem, the remaining six are ties, none lost (3 competitors x 3 LLM judges, Bonferroni-corrected, version-matched). ZenBrain reaches 91.3% of a full-context oracle's binary-judge accuracy at 1/109.6 of the per-query token cost. **Built by:** Alexander Bering — Division Manager in a mid-sized company and Principal Investigator. What is researched here has to survive a Monday morning, not just a review. ⭐ If this is useful, a star on [GitHub](https://github.com/zensation-ai/zenbrain) helps other agent developers find it. ## Overview ZenBrain is a 7-layer neuroscience-inspired memory architecture for autonomous AI systems. It bridges the gap between biological memory principles and practical AI system design, evaluated on long-context recall, memory stability, and knowledge retrieval tasks across ten experiments and a 15-algorithm ablation study (results below). **Paper:** [ZenBrain v8 (Zenodo)](https://zenodo.org/records/21858218) | DOI: `10.5281/zenodo.19353663` (concept DOI — always resolves to the latest version) **Status:** arXiv preprint (April 2026). Independent replications, counter-results, and reviewer feedback welcome — contact: research@zensation.ai ## Key Results (9 Experiments) | Experiment | Metric | Result | |------------|--------|--------| | Exp 1 — LoCoMo Retrieval | F1 score | **+20.7%** vs. Flat Store | | Exp 2 — Layer Ablation | Storage efficiency | **+47.4%** vs. single-layer | | Exp 3 — Retention Curves | Retention@30d | **89.9%** (vs. 0% pure Ebbinghaus) | | Exp 4 — Sleep Consolidation | Memory stability | **+37.0%** vs. no-sleep baseline | | Exp 5 — Hebbian Retrieval | Precision@5 | **0.955** | | Exp 6 — Bayesian Confidence | Confidence AUC | **0.797** (+49.5% vs. 0.533) | | Exp 8 — Moderate Ablation | 15-algorithm suite | Cooperative redundancy (no single removal matters) | | Exp 9 — Challenging Ablation | 15-algorithm suite | **7 of 15** algorithms individually significant | | Exp 10 — Stress Ablation | 15-algorithm suite | **9 of 15** algorithms individually critical | > The full 15-algorithm ablation reveals a cooperative survival network with a measurable gradient across three difficulty levels. Sleep consolidation acts as a **1.92x multiplier**. 95 reproducible tests across 4 experiment suites, all with Mulberry32 seeded PRNG (10 seeds). ## Architecture: 7 Memory Layers ``` Layer 1: Working Memory — Active task focus (capacity-limited, 7±2 items) Layer 2: Episodic Memory — Concrete experiences with temporal context Layer 3: Semantic Memory — Abstracted facts and relationships Layer 4: Procedural Memory — Skills and how-to knowledge Layer 5: Short-Term Memory — Session context buffer Layer 6: Long-Term Memory — Persistent cross-session knowledge Layer 7: Core Memory — Pinned identity and values (Letta-pattern) ``` **Key algorithms:** - Hebbian Learning (co-activation strengthening, decay, normalization) - FSRS Spaced Repetition (optimal review scheduling) - Bayesian Confidence Propagation (uncertainty quantification) - Sleep Consolidation (Stickgold & Walker 2013 — memory replay simulation) - Ebbinghaus Decay (forgetting curve modeling) - Contextual Retrieval (Anthropic method: reduced retrieval failure rate by 67% with reranking, 49% without) ## Installation ```bash # Core algorithms (zero dependencies) npm install @zensation/algorithms # Memory layer orchestration npm install @zensation/core # PostgreSQL + pgvector adapter npm install @zensation/adapter-postgres # SQLite adapter (zero-config) npm install @zensation/adapter-sqlite ``` ## Quick Start ```typescript import { MemoryCoordinator } from '@zensation/core'; import { PostgresAdapter } from '@zensation/adapter-postgres'; const memory = new MemoryCoordinator({ adapter: new PostgresAdapter({ connectionString: process.env.DATABASE_URL }), }); // Store a memory across all relevant layers await memory.store({ content: 'ZenBrain uses Hebbian learning for knowledge graph strengthening', type: 'semantic', importance: 0.9, }); // Recall with confidence scores const results = await memory.recall('Hebbian learning', { topK: 5 }); // Returns facts with 95% confidence intervals ``` ## Links - **Paper (v8, 9 Aug 2026):** https://zenodo.org/records/21858218 - **PDF:** https://zenodo.org/records/21858218/files/zenbrain-v8.pdf - **GitHub:** https://github.com/zensation-ai/zenbrain - **Website:** https://zensation.ai/technologie?utm_source=huggingface&utm_medium=card&utm_campaign=evergreen - **Live demo (HF Space):** https://huggingface.co/spaces/zensation-ai/zenbrain-playground — runs the real open library in your browser - **npm packages (7):** [`@zensation/algorithms`](https://www.npmjs.com/package/@zensation/algorithms) · [`@zensation/core`](https://www.npmjs.com/package/@zensation/core) · [`@zensation/adapter-postgres`](https://www.npmjs.com/package/@zensation/adapter-postgres) · [`@zensation/adapter-sqlite`](https://www.npmjs.com/package/@zensation/adapter-sqlite) · [`@zensation/mcp`](https://www.npmjs.com/package/@zensation/mcp) · [`@zensation/ai-sdk`](https://www.npmjs.com/package/@zensation/ai-sdk) · [`@zensation/cli`](https://www.npmjs.com/package/@zensation/cli) - **Reproduction packages:** [Mechanism ablation, Tables 7-9](https://doi.org/10.5281/zenodo.22162064) (Apache-2.0) · [Measurement package: judged outputs, flag manifests, analysis scripts](https://doi.org/10.5281/zenodo.22161978) (CC BY 4.0) - **ORCID:** https://orcid.org/0009-0001-1793-012X ## Citation ```bibtex @misc{bering2026zenbrain, title = {ZenBrain: A Neuroscience-Inspired 7-Layer Memory Architecture for Autonomous AI Systems}, author = {Bering, Alexander}, year = {2026}, doi = {10.5281/zenodo.19353663}, url = {https://doi.org/10.5281/zenodo.19353663}, note = {Zenodo Preprint} } @article{bering2026zenbrainarxiv, title = {ZenBrain: A Neuroscience-Inspired 7-Layer Memory Architecture for Autonomous AI Systems}, author = {Bering, Alexander}, year = {2026}, eprint = {2604.23878}, archivePrefix = {arXiv}, primaryClass = {cs.AI}, url = {https://arxiv.org/abs/2604.23878} } ``` ## License **Code** (the `@zensation/*` npm packages and the GitHub repository) — **Apache-2.0**, see [LICENSE](https://github.com/zensation-ai/zenbrain/blob/main/LICENSE). **Paper and preprint records** (`zenbrain-v8.pdf`, the arXiv preprint, the Zenodo preprint records) — **CC BY 4.0**. **Reproduction packages** carry their own licence, stated on each record (CC BY 4.0 or Apache-2.0).