MemBridge — Verifiable Agent Memory Migration

Inspiration

"We migrated your memories" is a sentence every AI product will eventually say to its users, and right now it's completely unfalsifiable — nobody measures what actually arrives on the other side of a memory migration.

An agent's memory is also the one part of it you can't regenerate: prompts get rewritten, models get swapped, but a user's accumulated history — their allergies, their preferences, what they told you last March — exists in exactly one place.

As agent memory systems proliferate and users move between them, that one-way door is going to matter a lot more than it does today, and nobody was building a way to check it.

What it does

MemBridge reads a memory store (Mem0) into a vendor-neutral Common Memory Model, writes it to a target (CockroachDB), and scores the round trip field-by-field — 15 fields per record, not one percentage that hides which fields survived.

It then runs a memory agent with zero persistence of its own: every fact in every answer is retrieved from the target store live, so the migration's result is something you can interrogate rather than take on trust.

The live demo lets you:

  • Search across migrated and native memories side by side, indistinguishable except for a badge.
  • Watch expired memories get correctly withheld from retrieval.
  • Stage a specific, named corruption — an inverted vector or a dropped expiry — and watch the fidelity checker catch it on demand, live against the real database, not a canned "100%."

How we built it

Ground truth first: two reproducible fixtures dump a real Mem0 instance's exact output shape, because the whole project's claim rests on knowing precisely what Mem0 does and doesn't hold.

That became a strict CMM schema (Pydantic v2, extra="forbid" everywhere) mapped onto CockroachDB with the invariants enforced as actual CHECK/UNIQUE/composite FOREIGN KEY constraints, so the target physically cannot hold a record CMM would reject.

A content-fingerprint (NFC-normalized, SHA-256) aligns source and target records without depending on anything a legitimate migration is allowed to change.

Vectors are compared bit-exact through a float32 round-trip.

The whole thing runs on AWS Lambda + API Gateway + S3 in front of CockroachDB Cloud, with an ONNX MiniLM encoder (no torch) doing query embedding.

Every vendor behavior we relied on was confirmed by reading the installed source code, not documentation.

Challenges we ran into

Almost everything that broke was a vendor doing something undocumented.

  • CockroachDB's VECTOR representation: it prints float32 as a 9-digit string that parses back as a different float64. A comparison written naively would've reported total embedding loss on a flawless migration.

  • Mem0's get_all(): it silently truncates at top_k=20 and drops expired records by default, both backwards for a migration.

  • TLS: it failed three different ways across three environments — laptop, Lambda, and CockroachDB Cloud — for three unrelated reasons.

  • Lambda dependencies: Python 3.11 pulled a NumPy/ONNX Runtime wheel mismatch that read like a NumPy bug and was actually a manylinux tag problem.

  • Groq authentication: Groq returned 200 on GET /models and 401 on the actual inference call from the same Lambda IP. We had to prove that with a throwaway probe before believing it.

  • GitHub contributor history: after cleaning up commit history to remove an unwanted co-author trailer, GitHub's contributors cache stayed stale through a force-push. We ended up deleting and recreating the repo entirely to get a clean state.

Accomplishments that we're proud of

  • 107 tests passing.
  • A Mem0 → CockroachDB migration that survives 15/15 fields, with vectors bit-exact, across every record we've thrown at it.
  • A fidelity checker that can actually fail on command, live, in front of an audience, instead of only ever reporting success. That's what makes the green state mean something.
  • A fully public, working deployment with search, ask, and a live fidelity endpoint, backed by 1,061 real records in CockroachDB Cloud — not five records in a demo silo.
  • A memory layer honest enough to withhold an expired dinner reservation even when it's the single highest-similarity match for the query — the boring-but-correct behavior most demos would fake.

What we learned

Vendor documentation lies by omission far more than it lies outright.

Every real finding here came from reading source, not docs, and several findings directly contradicted what the documentation implied.

"97% migrated" is a worse answer than "94%, and here's exactly which 6% and why," because the aggregate number actively hides the one thing anyone evaluating a migration actually needs.

We also learned that a near-miss can look identical to real loss unless you understand the underlying storage format. The float32 printing quirk would have failed our own fidelity check on a migration that lost nothing.

And translating internal vocabulary into plain language — what does "read-scoped" or "PRECISION_QUANTIZED" mean to someone who's never read the codebase? — turned out to matter as much as the correctness underneath it for making the claim land with a stranger.

What's next for MemBridge — Verifiable Agent Memory Migration

1. Mem0 write adapter

Close the loop into a true round trip.

This is currently blocked on a real architectural decision, not effort:

  • Mem0's infer=True path re-runs its extraction LLM over already-extracted content, breaking fingerprint alignment.
  • infer=False cannot reproduce the attribution the LLM path writes.

2. Streaming support

Support source stores too large to hold entirely in memory during migration.

3. More target pairs

Add additional source and target integrations beyond Mem0 → CockroachDB.

The Common Memory Model was built to be vendor-neutral from the start. This migration is our first proof of that architecture, not the whole scope.

Built With

Share this project:

Updates

Submission history