Back to Blog
open sourceai agentsmemoryselfhostedvector databaseknowledge graphopenclawprivacydev tools

Why I Built a Sovereign Memory Control Plane for AI Agents

Apifeny AI TeamJune 2, 20268 min read

Key Takeaways

  • โ€ข AI agents need persistent memory across sessions โ€” standard solutions are either static files (no recall) or cloud APIs (no privacy)

  • โ€ข OmniMind uses three embedded databases (LanceDB, Kuzu, SQLite) for vector search, knowledge graphs, and provenance tracking

  • โ€ข A nightly Memify worker compresses raw episodic logs into higher-level knowledge โ€” your agent gets smarter while you sleep

  • โ€ข 100% local, zero cost, open source (MIT), installs as an OpenClaw plugin in one command
  • The Day I Realized My AI Agent Had a 20-Minute Memory

    Every OpenClaw agent starts a new session with a blank slate.

    It remembers what's in `MEMORY.md` โ€” but that's static. A configuration file. It doesn't remember what we talked about yesterday. It doesn't know that we already solved the database latency problem three weeks ago. It doesn't connect the dots across conversations.

    I ran OpenClaw for months before I admitted this was a problem. The framework is excellent โ€” but the memory situation was stuck between two bad options.

    #

    Option 1: Static Files (Free, Doesn't Scale)

    `MEMORY.md` + `AGENTS.md` + a folder of daily notes. This is the default OpenClaw setup. It's fine for configuration. It's useless for recall.

    There's no vector search. No temporal awareness. No relationship tracking. Every time you need to know "did we already figure this out?" you're grepping markdown files manually.

    #

    Option 2: Cloud Memory APIs (Works, Costs Money, Gives Away Privacy)

    Supermemory. Mem0. They're good products. But they send your agent's conversations to someone else's server, vectorize them, and charge $30-50/month for the privilege. Your private work, your architectural decisions, your half-baked ideas โ€” all on someone else's infrastructure.

    If you're building a business on your agent's work, that competitive advantage shouldn't live in a cloud database you don't control.

    What I Wanted

    A memory layer that was:

    • โ€ข 100% local โ€” no data ever leaves my machine

    • โ€ข Zero cost โ€” no monthly bill, no API credits

    • โ€ข Persistent โ€” survives sessions, survives restarts, survives time

    • โ€ข Evolving โ€” raw logs are useless at scale. I wanted my agent to actually learn over time

    • โ€ข OpenClaw-native โ€” install as a plugin, not bolt on an external service
    • So I built [OmniMind](https://github.com/apifenylabs/omnimind).

      The Architecture: Three Databases, One Pipeline

      Most memory solutions pick one storage layer and call it done. Vectors for search. Or a graph for relationships. Or SQL for audit.

      I wanted all three.

      #

      1. LanceDB โ€” Vector Search

      Every memory gets embedded (using local Ollama โ€” no cloud API calls) and stored in LanceDB. Columnar, embedded, fast.

      What it's good for: "What did we say about database latency back in April?" โ€” semantic search across everything the agent has ever discussed.

      #

      2. Kuzu โ€” Knowledge Graph

      Memories aren't isolated facts. They're connected. A decision about pricing relates to a competitor analysis relates to a feature prioritization thread.

      Kuzu (embedded, columnar, no server) stores entities and their weighted relationships. When the agent recalls a decision about pricing, the graph surfaces the related context automatically.

      What it's good for: "Why did we choose this approach?" โ€” the graph shows the reasoning tree, not just the final decision.

      #

      3. SQLite โ€” Provenance

      Who stored this memory? When? Who accessed it last? Is it still relevant?

      SQLite keeps the audit trail. No guesses about where a memory came from or whether it's stale.

      What it's good for: Accountability. Knowing whether a memory is from yesterday's session or three months ago changes how much you trust it.

      #

      The ECL Pipeline (Extract โ†’ Cognify โ†’ Load)

      Raw markdown โ†’ chunked โ†’ embedded โ†’ stored across all three layers. Every time a memory is added, the pipeline:

      1. Extracts structured entities from the text
      2. Cognifies โ€” embeds the text for vector search, creates graph nodes and edges
      3. Loads โ€” writes to all three stores atomically

      #

      The Memify Worker (Nightly Evolution)

      Raw conversation logs are noisy. A single session might generate hundreds of memory entries. Many are trivial: "tried approach X, it failed." But over time, patterns emerge.

      Every night, the Memify worker scans raw episodic logs, identifies patterns, and compresses them into higher-level semantic knowledge. It prunes stale edges. It strengthens relationships that appear repeatedly. It derives preferences and habits from repeated behavior.

      Your agent gets smarter while you sleep.

      Comparison: OmniMind vs Alternatives

      | Feature | OmniMind | Supermemory | Mem0 | Static files |
      |---------|----------|-------------|------|-------------|
      | Local-first | โœ… 100% local | โŒ Cloud API | โŒ Cloud API | โœ… |
      | Free | โœ… | โŒ $30/mo | โŒ $50/mo | โœ… |
      | Vector search | โœ… LanceDB | โœ… | โœ… | โŒ |
      | Knowledge graph | โœ… Kuzu | โŒ | โŒ | โŒ |
      | Provenance tracking | โœ… SQLite | โŒ | โŒ | โŒ |
      | Self-evolution | โœ… Memify | โŒ | โŒ | โŒ |
      | OpenClaw native | โœ… Plugin | โŒ (manual) | โŒ (manual) | โœ… (static) |
      | Privacy | โœ… No data leaves | โŒ | โŒ | โœ… |

      The One-Liner Install

      ```bash
      openclaw plugins install @openclaw/omni-mind
      ```

      That's it. No signup. No API key. No cloud.

      What I Haven't Solved Yet (Being Honest)

      1. Multi-agent shared memory โ€” Each OmniMind instance is single-agent. Shared context across agents is coming in v0.4.
      2. Proactive file watcher โ€” Currently you trigger the ECL pipeline manually or via cron. Auto-watch on file changes is planned.
      3. Scale testing โ€” It works great on my setup (about 2 weeks of dogfood). More data needed before calling it production-ready.
      4. npm publish โ€” The package installs from local source today. ClawHub listing is in review.

      Why "Sovereign"?

      Because your agent's memory *is* your intellectual property. Every decision, every experiment, every failed approach โ€” that's knowledge. It shouldn't be locked in a SaaS database. It shouldn't vanish when a session ends. It shouldn't be a configuration file you manually edit.

      Sovereign means you own it. All of it. Locally. Permanently.

      What's Next

      • โ€ข v0.3.0 โ€” Current release. ECL pipeline, all three stores, Memify worker. Running in production on my own agents.

      • โ€ข v0.4 โ€” Multi-agent shared memory, file watcher, inspection dashboard.

      • โ€ข v1.0 โ€” Memory-as-Asset: export, share, and selectively publish memory snapshots.
      • Get Involved

        [GitHub: apifenylabs/omnimind](https://github.com/apifenylabs/omnimind) โ€” MIT licensed, contributions welcome.

        If you build AI agents, I'd love to hear what breaks for you. Feedback, criticism, and PRs all appreciated.

Devin โ€” AI Software Engineer

The first AI software engineer. Delegate coding tasks and ship faster.

Learn About Devin โ†’

Recommended Guides

Related AI Tools Mentioned

These AI tools are discussed in this article. Click to see full reviews, pricing, and alternatives.

open sourceai agentsmemoryselfhostedvector databaseknowledge graphopenclawprivacydev tools

Get the Best AI Tools โ€” Curated Weekly

No fluff. No spam. Just the tools and playbooks that actually work for solopreneurs in Asia.

Unsubscribe anytime. 1-2 emails per week.