All posts

Building MemBrane: What Six Months of Teaching AI to Remember Actually Looks Like

Updated November 26, 2026

Building MemBrane: What Six Months of Teaching AI to Remember Actually Looks Like

A tower of six translucent layers, each with a different geometric pattern

Every Monday morning used to start the same way. I'd open a new Claude session, and within the first three messages I'd be re-explaining my server topology, my naming conventions, which services ran where, and why particular instances lived on particular machines. The AI would respond helpfully, as if hearing all of this for the first time. Because it was.

AI conversational amnesia isn't a bug in the traditional sense. It's a design constraint baked into every major language model: each session starts from zero. Context windows are generous now (200K tokens for Claude, a million if you're in the beta), but they're still ephemeral. Close the tab, and everything evaporates.

I spent six months building a system to fix that. Not a weekend prototype. Not a proof of concept. A multi-layer memory architecture called MemBrane, with 297 commits, 1,382 tests, and more production incidents than I'd care to admit. This is what that journey actually looked like.

Asking the Wrong Question with the Right Tools

The earliest experiments happened in March 2025. I was running qwq-32b locally through Obsidian, trying to create a feedback loop between my note-taking system and a local LLM. The question I kept asking was simple: "What do you remember about me?"

The answer was always nothing.

I found Mem0, an open-source memory framework designed to give LLMs persistent recall. The architecture made sense on paper: embed conversation fragments into vectors, store them in Pinecone or Chroma, retrieve relevant chunks on the next query. Standard RAG with a memory wrapper.

But when I tried to map Mem0's concepts onto my actual workflow, the abstraction didn't fit. I wasn't trying to help an AI remember chat history. I was trying to build a system that understood relationships between entities in my infrastructure, tracked how those relationships changed over time, and could distinguish between a fact that was true last Tuesday and one that's true today. Vector similarity search alone doesn't give you that. You can find semantically similar text, but you can't traverse a relationship graph or answer temporal queries.

I shelved Mem0 and started looking at graph-based approaches.

Adopting Someone Else's Answer

Graphiti, built by the team at Zep, was the next candidate. A temporal knowledge graph purpose-built for AI memory, with entity extraction, relationship tracking, and episodic nodes that captured conversational context with timestamps. It had an MCP server, which meant I could wire it directly into Claude Code.

I adopted it in September 2025. Four days later, I had 9,626 nodes in the graph. Entities from my infrastructure, relationships between services, facts about configurations. It felt like progress.

Then the MCP server stopped connecting. Silently. Not "intermittently failing" — just not working, with no error surfaced to the user. The problem turned out to be a compatibility issue: Graphiti's server hardcoded OpenAI model defaults for its LLM client initialization, and those models didn't exist in my local inference environment. The server wasn't broken in the traditional sense — it was built for a deployment model that assumed OpenAI API access, and mine didn't match. The troubleshooting session that uncovered this was its own education in reading the code you depend on, not just the README.

I built a direct HTTP API bypass to keep working while the MCP server was down. That workaround taught me something important: I was spending more effort maintaining compatibility with someone else's abstractions than I would spend building my own.

Everything Gone

September 24, 2025. Four days into serious use. Near-total data loss.

A shattered crystal structure with luminous streams pulling its fragments back together

The details are in a postmortem I wrote during an 18-hour recovery session, but the short version is this: the system had produced warnings that data would be lost during a particular operation. Those warnings were dismissed. Not ignored, exactly. More like rationalized away in the momentum of getting things working.

We recovered 9,626 nodes. The recovery process itself became a masterclass in graph database forensics: crawling Neo4j's transaction logs, reconstructing relationships from partial data, validating entity integrity node by node.

Three lessons from that night that shaped everything that came after:

First, trust dynamics between humans and AI during a crisis are genuinely strange. The AI assistant that helped me recover data was also the one whose warnings I'd dismissed. There's a particular kind of humility that comes from asking for help from the system you chose not to listen to.

Second, temporal validity matters. Facts change. Configurations change. A memory system that treats every stored fact as eternally true will eventually poison its own context with outdated information. The recovery forced me to think about memory not just as storage but as something with a lifecycle.

Third, backups aren't optional, even for experimental systems. Especially for experimental systems. The speed at which you start depending on a tool that works is faster than you expect.

Building the Real Thing

MemBrane's first commit landed on September 28, 2025. Four days after the data loss. The name was intentional: a membrane is selectively permeable. It lets the right things through and keeps the wrong things out. That's what I wanted from a memory system. Not total recall, but intelligent filtering.

The initial architecture was two layers: a Neo4j graph for entity relationships and a markdown file system for human-readable learnings. The graph handled structured facts ("MemBrane runs on inference01," "Neo4j is the graph database"). The file layer captured narrative knowledge: debugging sessions, architectural decisions, insights that don't reduce cleanly to entity-relationship triples.

This dual-layer approach came from a practical observation: different kinds of knowledge serve different retrieval patterns. When I ask "what database backs the graph layer?" I want a graph traversal. When I ask "why did we switch from systemd to Docker for deployment?" I want a narrative with context and reasoning. Forcing both into the same storage layer means one of them always loses.

The Framework That Changed the Architecture

In October 2025, I watched a video by Nate Jones on AI memory architecture that reframed how I thought about the entire system. Jones identified six distinct memory types that any comprehensive AI memory system needs:

  1. Preferences: permanent configuration (how you like things done)
  2. Facts: entity relationships that require updates over time
  3. Knowledge: domain expertise and deep understanding
  4. Episodic: temporal sequences of what happened when
  5. Procedural: problem-solving patterns and proven approaches
  6. Session State: ephemeral current-conversation context

I mapped MemBrane against this framework and realized I already had four of the six types implemented, just not consciously organized that way. The Flywheel system (the broader personal AI infrastructure MemBrane lives inside) already handled Preferences through its atomic context loading. Session State was covered by Claude Code's built-in JSON persistence. Facts and Knowledge mapped directly to my graph and file layers.

What I was missing: Episodic memory (an event log tracking what happened across sessions) and Procedural memory (learned problem-solving patterns).

The event log became Feature 009. SQLite-backed, with automatic capture of every MCP tool call, session tracking with 4-hour resumption windows, and a retention policy inspired by Jones' concept of "forgetting as technology." The insight was that cross-layer relevance scoring could identify events with zero relationships in other MemBrane layers as deletion candidates. Remembering everything is the same as remembering nothing if you can't find what matters.

The memory layer reorganization became Feature 010: 148 files migrated into lifecycle-separated directories (/memory/facts/, /memory/learnings/, /memory/sessions/, /memory/graphs/), each with its own storage engine optimized for its query pattern. After the migration, I validated MemBrane against Jones' framework and scored 5 of 6 memory types at 83% coverage.

The Costs Nobody Talks About

Two parallel pipes, one bloated with dense dots and one slim and efficient

The unglamorous work that makes a system usable doesn't make for exciting architecture diagrams, but it's where most of the engineering time goes.

In early October 2025, I discovered that MCP response payloads were bloated with serialized data that no caller actually needed -- vector embeddings, internal metadata, redundant schema fields. Stripping that overhead out produced a dramatic reduction in per-call token cost and materially improved session capacity. The full story of that optimization and its impact on session economics is in The Token Economy.

There was also a stability issue with MemBrane's cache warming system. An async initialization antipattern caused the cache warming to silently fail on startup -- no errors, no exceptions, just quietly not doing its job. The fix involved restructuring startup to ensure all initialization ran on the same event loop as the actual server.

Neither of these problems was intellectually interesting. Both were critical to making the system actually work in production.

When Memory Gets Interesting

With the foundation stable, the features that make MemBrane genuinely useful started to emerge.

Two streams of light approaching a gateway arch where a scanning beam compares them

Conflict detection (Feature 025) operates bidirectionally. Inbound validation catches mistakes in what I tell the system ("MemBrane runs on inference02" when it actually runs on inference01). Outbound validation catches mistakes in what the AI tells me, auto-correcting LLM responses before they're displayed. The severity scoring algorithm weighs entity mismatches, confidence levels, recency, and temporal validity. Below a certain threshold, conflicts are auto-corrected. Above it, the system warns and asks for human judgment.

Temporal validity (Feature 004) means every fact in the graph carries created_at, valid_from, and expired_at timestamps. Updates don't delete old facts; they mark them as superseded. This makes the knowledge base queryable across time. "What did we believe about the deployment architecture on January 15th?" is a question MemBrane can answer. Non-destructive updates also mean that incorrect invalidations are recoverable, which matters when you're building a system you actually depend on.

Knowledge deduplication (Feature 023) uses a three-stage pipeline: exact text matching, vector similarity search, and fuzzy string matching. Before any new fact is captured, it's validated against all three stages. The alternative is a knowledge base that accumulates slightly different phrasings of the same information until retrieval becomes noise.

Cross-session pattern recognition (Feature 026) tracks debugging approaches across sessions, recording which strategies succeeded and which failed. After enough data accumulates, the system can surface patterns like "you've tried this approach three times and it failed each time; here's what worked." This is the closest thing to institutional memory I've built for a solo developer workflow.

The Cognitive Turn

A web of memory nodes with varying brightness, fading trails and strengthened links

In early 2026, I came across a video by Scrypster (MJ Bonanno) about MuninnDB, a cognitive database built on ACT-R principles. ACT-R (Adaptive Control of Thought, Rational) is a cognitive architecture developed by John Anderson at Carnegie Mellon in 1993. It models how human memory actually works: not as a filing cabinet you search through, but as a system where memories have activation levels that rise and fall based on recency, frequency, and associative context.

Three mechanisms from ACT-R resonated with problems I'd been solving ad hoc:

Temporal decay: memories that aren't accessed fade in activation strength. This is the mathematical formalization of "forgetting as technology" that I'd been implementing through retention policies and relevance scoring.

Hebbian association: memories that co-occur strengthen their connections automatically. When I debug a Docker networking issue and reference the Neo4j configuration three times in the same session, those entities should become more strongly linked. Not because someone tagged them, but because the usage pattern implies a relationship.

Bayesian confidence: belief in a fact should update continuously based on evidence. A fact confirmed across five sessions deserves higher confidence than one mentioned once. A fact that's been contradicted should decay.

Scrypster's thesis was provocative: "What if the problem with AI agents isn't that they don't store enough? It's that the storage itself doesn't think." MuninnDB implements these mechanisms at the database layer. I took a different approach with Feature 034: implementing ACT-R activation scoring as a service layer on top of Neo4j, adding activation indexes and cognitive retrieval to MemBrane's existing infrastructure. The database stores the data; the activation service decides what's relevant right now.

The Meta Moment

There's something recursive about this project that I didn't plan but can't ignore.

The research for this very article was conducted partly through MemBrane itself. The facts about Nate Jones' Six Memory Types framework are stored in MemBrane's graph layer. The learning about validating MemBrane against that framework is stored in MemBrane's file layer. The session events from the debugging sessions that shaped the architecture are in MemBrane's event log.

When I asked my AI assistant to research MemBrane for a blog post rewrite, it pulled Obsidian learnings that MemBrane had originally captured, read git history from a repository that MemBrane had influenced the development of, and synthesized insights from video transcript notes that were processed by a transcription skill running inside the same Flywheel ecosystem. The tool was researching itself through its own artifacts.

This isn't navel-gazing. It's a concrete demonstration of what a functional memory system enables. Six months of captured decisions, debugging sessions, architectural pivots, and framework validations are all queryable, traversable, and temporally valid. The system remembers not just what I built, but why I built it that way, what I tried first, and what failed.

297 commits. 34 features. 1,382 tests across 99 test files. A six-layer architecture (graph, file, vector, cache, event log, procedural) running across Neo4j, Qdrant, Redis, SQLite, and the local filesystem. Privacy-first with Ollama-powered local embeddings. Model-agnostic across Claude, GPT-4, and local LLMs.

What I'd Do Differently

Start with the event log, not the graph. Episodic memory is the cheapest to implement and the most immediately useful. Having a timestamped record of what happened, in what order, during which session, would have made the data loss recovery dramatically easier and the early debugging sessions far less painful.

Write tests from the beginning, not 250 commits in. Feature 035 (the comprehensive test suite) was one of the last things I built. It should have been one of the first. The 1,382 tests I have now would have caught the event loop bug, the token bloat, and at least two of the three migration issues I hit during the memory layer reorganization.

Don't over-abstract early. The deduplication service is 28.6 KB of Python. Some of that complexity is genuinely necessary (the three-stage cascade handles real edge cases), but some of it grew from premature generalization. Build for the problem you have, not the problem you imagine.

Where This Goes

MemBrane currently has 9,600+ nodes in its production graph, with temporal validity tracking, bidirectional conflict detection, cognitive activation scoring, and cross-session pattern learning. It runs as a Docker Compose stack on my development server, accessible via MCP from any Claude Code session.

The procedural memory layer (Feature 031) is in specification. Pattern recognition across debugging sessions will graduate from tracking what worked into recommending approaches before I've even started troubleshooting. Evolving strategies (Feature 032) will let the system update its own recommendations based on new evidence.

The question I keep coming back to isn't technical. It's this: what happens when your AI assistant remembers your infrastructure better than you do? When it knows which debugging approaches have failed across your last twenty sessions, which configuration values changed last month, and which architectural decisions you've reversed twice?

I don't have a clean answer. But six months into building a memory system, I can tell you this: the Monday morning re-explanation problem is solved. My AI assistant knows my infrastructure, my conventions, and my preferences. And when I tell it something that contradicts what it already knows, it pushes back.

That's worth 297 commits.

About the author

Carlos Mendez

Carlos Mendez

IT support and systems, Maui, Hawaii

I come from IT support and systems work. I build and run my own infrastructure and the production websites for West Maui Tech, my business, and I build AI tooling on top of that stack. I write here about what I run, what broke, and how I fixed it.

Enjoyed this article?

Subscribe to get notified about new posts on software engineering, AI development, and infrastructure.

No spam, unsubscribe anytime.