<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: AgentBrain.ch</title>
    <description>The latest articles on DEV Community by AgentBrain.ch (@agentbrain_ch).</description>
    <link>https://dev.to/agentbrain_ch</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3867704%2F6a4771ee-f353-484d-a6b4-0137aa368f51.jpg</url>
      <title>DEV Community: AgentBrain.ch</title>
      <link>https://dev.to/agentbrain_ch</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/agentbrain_ch"/>
    <language>en</language>
    <item>
      <title>Why we built a 7-layer cognitive memory for AI agents</title>
      <dc:creator>AgentBrain.ch</dc:creator>
      <pubDate>Wed, 08 Apr 2026 11:55:27 +0000</pubDate>
      <link>https://dev.to/agentbrain_ch/why-we-built-a-7-layer-cognitive-memory-for-ai-agents-5bkg</link>
      <guid>https://dev.to/agentbrain_ch/why-we-built-a-7-layer-cognitive-memory-for-ai-agents-5bkg</guid>
      <description>&lt;p&gt;Every AI agent framework has the same blind spot: memory.&lt;/p&gt;

&lt;p&gt;You can give your agent tools, planning capabilities, and access to APIs. But between sessions, it forgets everything. The next conversation starts from zero. Context is gone. Preferences are gone. Learned behaviors are gone.&lt;/p&gt;

&lt;p&gt;The common fix is RAG — store text as vector embeddings, retrieve by similarity. It works for document search. But it's not memory.&lt;/p&gt;

&lt;p&gt;Real memory has priority. It has emotion. It has decay. Things that don't matter fade away. Things that matter get reinforced. Similar experiences merge into generalized knowledge. And sometimes, connections appear between things you never explicitly linked.&lt;/p&gt;

&lt;p&gt;We built Agent Brain to bring these properties to AI agents.&lt;/p&gt;

&lt;h2&gt;
  
  
  The problem with current approaches
&lt;/h2&gt;

&lt;p&gt;Most AI memory systems do one thing: store embeddings and retrieve them by cosine similarity. Some add metadata filtering. Some add a reranking step. But fundamentally, they treat every piece of information as equally important, store it permanently, and retrieve it through a single mechanism.&lt;/p&gt;

&lt;p&gt;This creates three problems:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Noise accumulation.&lt;/strong&gt; Everything gets stored. After thousands of interactions, the memory fills with low-value data that degrades retrieval quality.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Flat recall.&lt;/strong&gt; Retrieval is one-dimensional — similarity. There's no concept of urgency, emotional significance, or how recently something was accessed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;No learning.&lt;/strong&gt; The memory is static. It doesn't consolidate, generalize, or find patterns. It's a database, not a cognitive system.&lt;/p&gt;

&lt;h2&gt;
  
  
  7 layers inspired by cognitive science
&lt;/h2&gt;

&lt;p&gt;Agent Brain implements 7 layers modeled on how human memory actually works.&lt;/p&gt;

&lt;h3&gt;
  
  
  Layer 1: Perception Gate
&lt;/h3&gt;

&lt;p&gt;Before anything enters memory, it passes through the Perception Gate. Every input gets scored on four axes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Emotion&lt;/strong&gt; (-1 to +1): How emotionally significant is this?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Novelty&lt;/strong&gt; (0 to 1): How new or surprising is it?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Urgency&lt;/strong&gt; (0 to 1): How time-sensitive?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Source Trust&lt;/strong&gt; (0 to 1): How reliable is the source?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is modeled on thalamic gating — most sensory data never reaches conscious processing.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;https://api.agentbrain.ch/memory/store&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;X-API-Key&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;YOUR_KEY&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;workspace_id&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;YOUR_WS&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;content&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;User prefers dark mode&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;agent_id&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;assistant-1&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;source_trust&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.9&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Layer 2: Working Memory
&lt;/h3&gt;

&lt;p&gt;Based on Miller's Law (1956), working memory holds exactly 7 items. When the buffer is full, the lowest-scoring item gets evicted.&lt;/p&gt;

&lt;h3&gt;
  
  
  Layer 3: Episodic Memory
&lt;/h3&gt;

&lt;p&gt;Long-term memories with pgvector similarity search. Unlike a plain vector DB, recall is ranked by semantic similarity + recency + emotional weight + access frequency.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;https://api.agentbrain.ch/memory/recall&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;X-API-Key&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;YOUR_KEY&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;workspace_id&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;YOUR_WS&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;query&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;user interface preferences&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;limit&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Layer 4: Knowledge Graph
&lt;/h3&gt;

&lt;p&gt;Entities extracted via spaCy get linked into a relationship graph. Recalling one concept activates related concepts — spreading activation theory.&lt;/p&gt;

&lt;h3&gt;
  
  
  Layer 5: Procedural Memory
&lt;/h3&gt;

&lt;p&gt;Detects repeated patterns after 3+ occurrences. Stores successful action sequences as procedures. Your agent builds institutional intuition.&lt;/p&gt;

&lt;h3&gt;
  
  
  Layer 6: Predictive Engine
&lt;/h3&gt;

&lt;p&gt;Runs every 60 minutes. Tracks temporal patterns and generates probability-scored alerts: "87% chance of heating issue for Property X within 30 days."&lt;/p&gt;

&lt;h3&gt;
  
  
  Layer 7: Dream Cycle
&lt;/h3&gt;

&lt;p&gt;A nightly batch process (default: 2 AM) that performs three operations:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Ebbinghaus Decay.&lt;/strong&gt; Every memory has a strength score that decays over time. Frequently accessed or emotionally significant memories decay slower. Below threshold = pruned.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Consolidation.&lt;/strong&gt; Near-duplicate memories merge into unified, stronger representations.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Creative Synthesis.&lt;/strong&gt; Non-obvious connections between memories that share entities but weren't explicitly linked. Mirrors REM sleep.&lt;/p&gt;

&lt;h2&gt;
  
  
  No LLM required
&lt;/h2&gt;

&lt;p&gt;Agent Brain makes zero LLM API calls.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Embeddings:&lt;/strong&gt; sentence-transformers (local, 384 dimensions)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Entity extraction:&lt;/strong&gt; spaCy (local)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Similarity search:&lt;/strong&gt; pgvector in PostgreSQL&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Decay and consolidation:&lt;/strong&gt; Pure math&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Memory operations need to be fast, cheap, and deterministic.&lt;/p&gt;

&lt;h2&gt;
  
  
  Self-host or managed
&lt;/h2&gt;

&lt;p&gt;Open source under AGPLv3:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/kaderosio/agent-brain
&lt;span class="nb"&gt;cd &lt;/span&gt;agent-brain
docker build &lt;span class="nt"&gt;-t&lt;/span&gt; agent-brain &lt;span class="nb"&gt;.&lt;/span&gt;
docker run &lt;span class="nt"&gt;-p&lt;/span&gt; 8000:8000 &lt;span class="nt"&gt;--env-file&lt;/span&gt; .env agent-brain
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Managed hosting: CHF 29/mo. Swiss hosted.&lt;/p&gt;

&lt;p&gt;For comparison: Mem0 Pro $249/mo, Zep Pro ~$50/mo, Letta Cloud $200/mo.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try it now
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Demo (no signup):&lt;/strong&gt; &lt;a href="https://agentbrain.ch/demo" rel="noopener noreferrer"&gt;agentbrain.ch/demo&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Docs:&lt;/strong&gt; &lt;a href="https://agentbrain.ch/docs" rel="noopener noreferrer"&gt;agentbrain.ch/docs&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GitHub:&lt;/strong&gt; &lt;a href="https://github.com/kaderosio/agent-brain" rel="noopener noreferrer"&gt;github.com/kaderosio/agent-brain&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Website:&lt;/strong&gt; &lt;a href="https://agentbrain.ch" rel="noopener noreferrer"&gt;agentbrain.ch&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you're building AI agents and want memory that actually behaves like memory, give Agent Brain a look.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Built by &lt;a href="https://valtis.ch" rel="noopener noreferrer"&gt;Valtis AG&lt;/a&gt;, Zürich&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>agents</category>
      <category>memory</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
