<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[LOZE]]></title><description><![CDATA[LOZE]]></description><link>https://loze.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Sat, 28 Nov 2026 02:24:18 GMT</lastBuildDate><atom:link href="https://loze.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Fixing mem0, local ollama, and openclaw: Mem0 with Qdrant + Ollama Locally]]></title><description><![CDATA[Building a Private AI Memory System: Local Mem0 with Qdrant + Ollama]]></description><link>https://loze.hashnode.dev/fixing-mem0-local-ollama-and-openclaw-mem0-with-qdrant-ollama-locally</link><guid isPermaLink="true">https://loze.hashnode.dev/fixing-mem0-local-ollama-and-openclaw-mem0-with-qdrant-ollama-locally</guid><category><![CDATA[memory-management]]></category><category><![CDATA[ollama]]></category><category><![CDATA[qdrant]]></category><dc:creator><![CDATA[Dan Loze]]></dc:creator><pubDate>Sat, 21 Feb 2026 03:57:24 GMT</pubDate><enclosure url="https://cloudmate-test.s3.us-east-1.amazonaws.com/uploads/covers/699926fd3dc17c48620ddaa3/d6133ac7-7463-492e-ab04-819a9973c47c.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h1>Building a Private AI Memory System: Local Mem0 with Qdrant + Ollama</h1>
<p>Ever wanted your AI assistant to remember things... but without sending all that data to the cloud? I've been using <a href="https://mem0.ai/">Mem0</a> for my agents's memory, but recently decided to go fully local. Here's how I built a private, self-hosted memory system using Qdrant and Ollama.</p>
<h2>Why Go Local?</h2>
<p>Mem0 Cloud is great, but there were a few reasons I wanted self-hosted:</p>
<ol>
<li><p><strong>Privacy</strong> — No more sending conversation data to third-party servers</p>
</li>
<li><p><strong>Cost</strong> — Free after initial setup (just compute costs)</p>
</li>
<li><p><strong>Control</strong> — Full control over data retention and embedding models</p>
</li>
<li><p><strong>Independence</strong> — Not dependent on external services</p>
</li>
<li><p><strong>No Quota</strong> - I hit quota in about 7 days of regular chatting on there lowest paid tier</p>
</li>
</ol>
<h2>The Stack</h2>
<ul>
<li><p><strong>Memory Layer</strong>: <a href="https://mem0.ai/">Mem0</a> (open-source mode)</p>
</li>
<li><p><strong>Vector Store</strong>: <a href="https://qdrant.tech/">Qdrant</a> v1.13.0 (Docker)</p>
</li>
<li><p><strong>Embeddings</strong>: <a href="https://ollama.ai/">Ollama</a> + nomic-embed-text (768 dimensions)</p>
</li>
<li><p><strong>LLM</strong>: Ollama + llama3.2:latest (for memory summarization)</p>
</li>
</ul>
<h2>Step 1: Running Qdrant</h2>
<p>Qdrant is a production-ready vector database. I used Docker to get it running:</p>
<pre><code class="language-bash">docker run -d --name qdrant \
  -p 6333:6333 \
  -p 6334:6334 \
  qdrant/qdrant:v1.13.0
</code></pre>
<blockquote>
<p><strong>Important</strong>: Use v1.13.0 specifically — newer versions had compatibility issues.</p>
</blockquote>
<h2>Step 2: Configuring the Mem0 Plugin</h2>
<p>I'm using <a href="https://github.com/openclaw/openclaw">OpenClaw</a> as my AI assistant framework. The mem0 plugin needed some tweaks to support local configuration.</p>
<h3>Add Dimension Support</h3>
<p>The plugin schema doesn't expose <code>dimension</code> by default. Edit <code>~/.openclaw/extensions/openclaw-mem0/openclaw.plugin.json</code>:</p>
<pre><code class="language-json">{
  "historyDbPath": { "type": "string" },
  "dimension": { "type": "number" }
}
</code></pre>
<h3>Pass Dimension to Mem0</h3>
<p>In the plugin code (<code>index.ts</code>), add the dimension pass-through:</p>
<pre><code class="language-typescript">if (this.ossConfig?.dimension) {
  config.dimension = this.ossConfig.dimension;
}
</code></pre>
<h2>Step 3: The Critical Config Mistake</h2>
<p>This one stumped me for hours. The <code>dimension</code> setting <strong>must</strong> be inside <code>vectorStore.config</code>, not at the top level:</p>
<pre><code class="language-json">{
  "mode": "open-source",
  "oss": {
    "embedder": { ... },
    "vectorStore": {
      "provider": "qdrant",
      "config": {
        "host": "localhost",
        "port": 6333,
        "dimension": 768  // ← HERE, not at oss level
      }
    }
  }
}
</code></pre>
<h2>Step 4: Fix Collection Conflict Error</h2>
<p>The mem0ai library fails if the <code>memory_migrations</code> collection already exists. Patch the library:</p>
<pre><code class="language-javascript">// In node_modules/mem0ai/dist/oss/index.mjs
try {
  await this.client.createCollection("memory_migrations", {
    vectors: { size: 1, distance: "Cosine", on_disk: false }
  });
} catch (e) {
  if (e.status !== 409) throw e; // Ignore "already exists"
}
</code></pre>
<h2>Step 5: Pull the Models</h2>
<pre><code class="language-bash">ollama pull nomic-embed-text:latest
ollama pull llama3.2:latest
</code></pre>
<p>These are lightweight and work great for embeddings.</p>
<h2>The Result</h2>
<p>After restarting the gateway, my AI assistant now has:</p>
<ul>
<li><p>✅ Fully local memory (no cloud dependencies)</p>
</li>
<li><p>✅ Semantic search across all memories</p>
</li>
<li><p>✅ 768-dimensional embeddings via nomic-embed-text</p>
</li>
<li><p>✅ Automatic memory capture after each conversation</p>
</li>
</ul>
<pre><code class="language-bash">openclaw mem0 stats
# Mode: open-source
# Vector store: Qdrant (localhost:6333)
# Embedding model: nomic-embed-text:latest
</code></pre>
<h2>Bonus: Building a Memory Dashboard</h2>
<p>Since I wanted visibility into what the AI was remembering, I built a simple dashboard to view and manage memories, similar to mem0's dashboard.</p>
<h3>Features</h3>
<ul>
<li><p>View all memories in a searchable table</p>
</li>
<li><p>See memory count, user count, embedding dimensions</p>
</li>
<li><p>Delete unwanted memories</p>
</li>
<li><p>Real-time sync with Qdrant</p>
</li>
</ul>
<h3>The Stack</h3>
<ul>
<li><p><strong>Frontend</strong>: Next.js + Tailwind CSS</p>
</li>
<li><p><strong>Backend</strong>: FastAPI (Python) + Qdrant client</p>
</li>
<li><p><strong>Deployment</strong>: Local only (runs on same machine as Qdrant)</p>
</li>
</ul>
<pre><code class="language-python"># Simple API endpoint to fetch memories
@app.get("/api/memories")
async def get_memories():
    client = QdrantClient(host="localhost", port=6333)
    results = client.scroll(collection_name="memories", limit=1000)
    return {"memories": [...]}
</code></pre>
<h2>Lessons Learned</h2>
<ol>
<li><p><strong>Dimension matters</strong> — 768 vs 1536 caused hours of debugging</p>
</li>
<li><p><strong>Version pinning</strong> — Qdrant v1.13.0 specifically works</p>
</li>
<li><p><strong>Local isn't always easier</strong> — But it's more private and cost-effective</p>
</li>
<li><p><strong>The dashboard is essential</strong> — Visual feedback helps debug what's being remembered</p>
</li>
</ol>
<h2>What's Next?</h2>
<ul>
<li><p>[ ] Add automatic memory cleanup (remove duplicates)</p>
</li>
<li><p>[ ] Set up backup/restore for the vector DB</p>
</li>
<li><p>[ ] Experiment with different embedding models</p>
</li>
<li><p>[ ] Add memory categories/tags</p>
</li>
</ul>
<hr />
<p>If you're building AI assistants and care about privacy, I highly recommend going local. It's more setup, but the control is worth it.</p>
<p><em>Have questions? Drop them in the comments!</em></p>
]]></content:encoded></item></channel></rss>