Skip to content
zensation

Research

πŸ”¬

Research overview

Three tracks, architecture and agenda

πŸ“

Methodology

Operational standards and validation

πŸ“„

Publications

Preprints, software, identifiers

βš–οΈ

Research ethics

Fundamental rights and compliance

🧰

Resources

Code, data, citation, open science

Collaboration & applications

πŸ›οΈ

Public sector & funding

Collaborations in the public sector

🧭

Adopt AI

Neutral roadmap & interactive simulation

πŸ›‘οΈ

Protecting public spaces

Track B β€” rights-preserving early warning

βš™οΈ

Technology

ZenBrain β€” our open core

PublicationsAboutOpen SourceBlog
Contact
zensation

Research

πŸ”¬Research overviewπŸ“MethodologyπŸ“„Publicationsβš–οΈResearch ethics🧰Resources

Collaboration & applications

πŸ›οΈPublic sector & funding🧭Adopt AIπŸ›‘οΈProtecting public spacesβš™οΈTechnology
PublicationsAboutOpen SourceBlogContact
Blog
Engineering

7-Layer Memory Architecture: How ZenBrain Remembers Like a Human Brain

Alexander Bering
Alexander Bering
March 17, 2026 Β· 5 min read

Why Conventional AI Memory Falls Short

Most AI systems treat memory as a flat vector store. Embed text, store vectors, retrieve by cosine similarity. It works β€” but it has fundamental limitations:

  • No temporal decay β€” A fact from 3 years ago has the same weight as yesterday's insight
  • No consolidation β€” Memories are never strengthened or reorganized
  • No active forgetting β€” Everything is stored forever, creating noise
  • No relational context β€” Facts exist in isolation, no connections between them

The human brain solves all of these. It actively forgets irrelevant information, strengthens important memories during sleep, and builds dense networks of associations. We wanted our AI to do the same.

The 7 Layers

ZenBrain's HiMeS (Hierarchical Memory System) architecture implements seven layers, each serving a distinct cognitive function:

Layer 1: Working Memory

Purpose: Active task focus β€” your mental scratchpad.

Working memory holds the current context. It's small (like human working memory, approximately 7 items), fast, and constantly refreshed. When you switch tasks, working memory clears and reloads.

Layer 2: Short-Term Memory

Purpose: Session context β€” what you remember from this conversation.

Short-term memory persists across a single session. It tracks the flow of conversation, maintains context, and provides continuity. It decays naturally when the session ends.

Layer 3: Episodic Memory

Purpose: Concrete experiences β€” "Last Tuesday, when we discussed the API redesign..."

Episodic memories are timestamped, contextual records of specific interactions. They capture not just what was said, but when, where (which context), and what emotional valence the interaction had. Most systems don't distinguish between facts and experiences β€” we do.

Layer 4: Semantic Memory

Purpose: Facts and concepts β€” "PostgreSQL supports pgvector for embeddings."

Semantic memory stores factual knowledge stripped of temporal context. These memories are built up from repeated episodic experiences β€” just like in the human brain, where individual episodes gradually crystallize into general knowledge.

Layer 5: Procedural Memory

Purpose: How-to knowledge β€” processes and workflows.

Procedural memory captures how to do things. "When the user asks for a code review, first check the diff, then analyze patterns, then provide feedback." These are learned from successful interactions and refined through feedback.

Layer 6: Prospective Memory

Purpose: Future planning β€” "Remember to follow up on Monday."

Prospective memory handles intentions and planned actions. It enables the AI to proactively remind you about things, track deadlines, and maintain awareness of future commitments.

Layer 7: Long-Term Memory

Purpose: Persistent knowledge β€” your life experience.

Long-term memory is the permanent store. Facts that have been consolidated, reinforced through repetition, and proven important over time live here. This layer uses Ebbinghaus-style decay curves β€” memories that aren't accessed gradually fade, but each retrieval strengthens them.

Sleep Consolidation: The Secret Weapon

In neuroscience, sleep consolidation is the process where the brain replays recent experiences during rest periods, strengthening important memories and pruning weak connections. Stickgold & Walker (2013) showed that memory consolidation during sleep is critical for learning.

We implemented the same mechanism. During idle periods, ZenBrain:

  1. Selects memories with high importance scores that haven't been consolidated yet
  2. Replays them β€” re-evaluates their importance in the context of everything else the system knows
  3. Strengthens connections between related memories using Hebbian learning ("neurons that fire together wire together")
  4. Prunes weak connections β€” memories that haven't been accessed and have low importance scores decay and eventually get forgotten

This is genuinely unique. We surveyed every major AI memory system β€” Mem0, Letta/MemGPT, Zep, LangChain's memory modules β€” and none implement sleep consolidation.

Spaced Repetition with FSRS

For knowledge that needs long-term retention, we use the FSRS (Free Spaced Repetition Scheduler) algorithm. Originally designed for flashcard apps like Anki, FSRS calculates optimal review intervals based on stability, difficulty, and elapsed time.

Each memory gets a retrievability score (0-1) predicting the probability of successful recall. When retrievability drops below a threshold, the memory gets flagged for review.

Hebbian Knowledge Graphs

Memories don't exist in isolation. The brain builds dense networks of associations. We do the same:

  • Co-activation: When two memories are accessed together, the connection strengthens
  • Decay: Connections that aren't reinforced gradually weaken
  • Normalization: Connection weights are normalized to prevent runaway activation

The system naturally builds topic clusters, recognizes related concepts, and traverses knowledge paths that the user never explicitly defined.

The Numbers

  • 276 tests for the memory algorithms alone (all passing)
  • 9 foundational algorithms in @zensation/algorithms
  • 7 memory layers in @zensation/core
  • Zero dependencies β€” pure TypeScript
  • 95% confidence intervals for all probabilistic outputs

Try It

The entire system is open source:

npm install @zensation/algorithms @zensation/core

GitHub: github.com/zensation-ai/zenbrain

This is part of the "Building an AI Brain" series. Next: how we use Contextual Retrieval (Anthropic method) for +67% retrieval accuracy.

Share on XShare on LinkedIn

Related Articles

From AI Overview to a Real Demo: Turning a Blueprint into a ZenAi Instance β€” Autonomously

Most AI pilots don't fail on the technology β€” they fail at the jump from idea to a tangible, context-true application. Here's how a quick assessment turns autonomously into a lightweight, sector-accurate ZenAi instance β€” and why honesty (clearly labelled demo data) is the most important building block.

The Stress Test: Why We Ran Ten Security Sprints Before the First Customer

Between 'it runs on my machine' and 'a company entrusts it with its data' lies a gap many AI projects underestimate. How we bridged it with ten back-to-back hardening sprints.

91 % of the accuracy at 1 % of the tokens β€” the Pareto position for AI memory

On LongMemEval-500, ZenBrain reaches 91.3 % of a long-context oracle's accuracy at 1/106α΅—Κ° the per-query token budget. The oracle wins by 4.5 percentage points, burns 106Γ— more tokens, and has no memory architecture at all.

Β© 2026 Alexander Bering / ZenSation Enterprise Solutions

HomeResearchMethodologyResearch ethicsPublic sectorPublicationsResourcesAdopt AIOpen SourceTechnologySystem explorerAboutBlogRSSChangelogPrivacy PolicyLegal NoticeAccessibility
GitHubLinkedInarXivZenodoORCIDScholarSemantic ScholarHuggingFacenpmDiscord