<?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>Forem: Leandro Pérez González</title>
    <description>The latest articles on Forem by Leandro Pérez González (@lenadro1910).</description>
    <link>https://forem.com/lenadro1910</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%2F3813276%2Fd3a62018-8193-445a-a832-de6adaee96a7.jpeg</url>
      <title>Forem: Leandro Pérez González</title>
      <link>https://forem.com/lenadro1910</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/lenadro1910"/>
    <language>en</language>
    <item>
      <title>I built a persistent memory MCP with Hebbian learning and GraphRAG</title>
      <dc:creator>Leandro Pérez González</dc:creator>
      <pubDate>Sun, 08 Mar 2026 18:14:36 +0000</pubDate>
      <link>https://forem.com/lenadro1910/i-built-a-persistent-memory-mcp-with-hebbian-learning-and-graphrag-1b5p</link>
      <guid>https://forem.com/lenadro1910/i-built-a-persistent-memory-mcp-with-hebbian-learning-and-graphrag-1b5p</guid>
      <description>&lt;h2&gt;
  
  
  The Problem
&lt;/h2&gt;

&lt;p&gt;AI coding assistants forget everything between sessions. Every conversation starts from zero. You explain your architecture, your patterns, your preferences — and next time, it's gone.&lt;br&gt;
I built &lt;strong&gt;Cuba-Memorys&lt;/strong&gt; to fix this.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is it?
&lt;/h2&gt;

&lt;p&gt;An MCP server that gives AI agents persistent long-term memory using a knowledge graph backed by PostgreSQL. 12 tools with Cuban-themed names.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key Features
&lt;/h2&gt;

&lt;h3&gt;
  
  
  🧠 Knowledge Graph
&lt;/h3&gt;

&lt;p&gt;Entities, observations, and typed relations that persist across sessions. Your AI remembers projects, decisions, patterns, and connections between them.&lt;/p&gt;

&lt;h3&gt;
  
  
  ⚡ Hebbian Learning
&lt;/h3&gt;

&lt;p&gt;"Neurons that fire together wire together" — memories strengthen with use (Oja's rule) and fade adaptively using FSRS spaced repetition (the algorithm behind Anki).&lt;/p&gt;

&lt;h3&gt;
  
  
  🔍 4-Signal RRF Fusion Search
&lt;/h3&gt;

&lt;p&gt;Not just keyword matching. Cuba-Memorys fuses 4 search signals:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;TF-IDF similarity&lt;/li&gt;
&lt;li&gt;PostgreSQL full-text search&lt;/li&gt;
&lt;li&gt;Trigram matching&lt;/li&gt;
&lt;li&gt;Optional pgvector HNSW embeddings
Results are ranked using Reciprocal Rank Fusion for maximum recall.
### 🕸️ GraphRAG Enrichment
Top search results are automatically enriched with degree-1 graph neighbors, giving your AI topological context — not just text matches.
### 🛡️ Anti-Hallucination Grounding
Verify claims against stored knowledge with graduated confidence scoring: &lt;code&gt;verified&lt;/code&gt; → &lt;code&gt;partial&lt;/code&gt; → &lt;code&gt;weak&lt;/code&gt; → &lt;code&gt;unknown&lt;/code&gt;. Your AI can fact-check itself before answering.
### 😴 REM Sleep Consolidation
After 15 minutes of inactivity, the system automatically runs maintenance: adaptive decay, deduplication, and memory consolidation. Like biological sleep for your AI's memory.
### 📊 Graph Analytics&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;PageRank&lt;/strong&gt; — Find the most important entities&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Louvain communities&lt;/strong&gt; — Discover knowledge clusters&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Betweenness centrality&lt;/strong&gt; — Identify bridge concepts
## The 12 Tools
| Tool | Purpose |
|------|---------|
| &lt;code&gt;cuba_alma&lt;/code&gt; | CRUD knowledge graph entities |
| &lt;code&gt;cuba_cronica&lt;/code&gt; | Attach observations to entities |
| &lt;code&gt;cuba_puente&lt;/code&gt; | Create/traverse relations |
| &lt;code&gt;cuba_faro&lt;/code&gt; | Search with anti-hallucination |
| &lt;code&gt;cuba_alarma&lt;/code&gt; | Report and track errors |
| &lt;code&gt;cuba_expediente&lt;/code&gt; | Search past errors (anti-repetition) |
| &lt;code&gt;cuba_remedio&lt;/code&gt; | Mark errors as resolved |
| &lt;code&gt;cuba_eco&lt;/code&gt; | RLHF feedback loop |
| &lt;code&gt;cuba_decreto&lt;/code&gt; | Record architecture decisions |
| &lt;code&gt;cuba_jornada&lt;/code&gt; | Session management |
| &lt;code&gt;cuba_vigia&lt;/code&gt; | Graph analytics |
| &lt;code&gt;cuba_zafra&lt;/code&gt; | Memory maintenance |
## Quick Start&lt;/li&gt;
&lt;/ul&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
json
{
  "mcpServers": {
    "cuba-memorys": {
      "command": "python",
      "args": ["-m", "cuba_memorys"],
      "env": {
        "DATABASE_URL": "postgresql://user:pass@localhost:5432/brain"
      }
    }
  }
}
¨¨


The database auto-provisions via Docker if needed. Zero manual setup.

Why "Cuba"?
The tools are named after Cuban Spanish words — alma (soul), crónica (chronicle), faro (lighthouse), remedio (remedy). It started as a personal project and the naming stuck.

Links
GitHub: github.com/lENADRO1910/cuba-memorys
PyPI: pip install cuba-memorys
License: CC BY-NC 4.0
If you find it useful, a ⭐ on GitHub would mean a lot. Open to feedback and contributions!


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>mcp</category>
      <category>ai</category>
      <category>python</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
