Skip to main
omar.nagy
Mnemonic — terminal-style thumbnail showing a layered memory recall command and 4 memory layers.
Open source·case study·published 2026-04-29

Mnemonic

Mnemonic is the open-source memory layer I built because the hosted alternatives all wanted my agents’ entire conversation history on someone else’s server. Four layers — scratchpad, episodic, semantic, relationships — with explicit contradiction resolution. Python, FastAPI, Qdrant. Self-hostable.

4
Memory layers
OSS
MIT licensed
Qdrant
Vector backend
FastAPI
Surface

The problem

Most agent memory libraries do one of two things: (1) dump everything into a vector store and pray, or (2) use a single conversation history that gets truncated when it hits context limits. Neither matches how human memory actually works, and neither handles the failure mode that bites real agents in production — contradictory memories.

The user said they’re vegetarian last week. This week they ordered chicken. Which memory wins? Most libraries silently let the wrong one stick around forever.

Four layers, on purpose

  • Scratchpad. Working memory for the current task. Cleared between tasks. Anything you’d hold in your head for the next 5 minutes lives here.
  • Episodic. Specific events with timestamps. “User said X on Tuesday at 14:00.” Time-indexed; recency matters; old episodes get summarised into…
  • Semantic. Generalised facts. “User is vegetarian.” These are the facts the agent assumes are true unless contradicted.
  • Relationships. Graph layer. Who is connected to whom. The user’s partner, their employer, the project they’re working on. Used for context grounding.

Contradiction resolution

The contribution that made Mnemonic worth shipping is the contradiction-resolution step. When a new memory arrives:

  1. Vector-search the semantic layer for related facts.
  2. If a contradicting fact is found, score the conflict (recency vs frequency vs user-asserted-strength).
  3. If the new memory wins, mark the old one as superseded with a timestamp and pointer. Don’t delete — superseded memories are recoverable.
  4. If neither wins clearly, flag for a clarification turn (“earlier you said X — has that changed?”) instead of silently picking one.

Why it’s useful as a portfolio piece

Mnemonic is small. It’s ~1.4K lines of Python. It does one thing well. It signals something more important than “I shipped a 100K-line monorepo”: I can isolate a domain problem, design a clean abstraction, and ship a focused tool that other people might actually use. That’s the muscle that translates into client work.

What it’s not

Mnemonic is not a hosted service. It’s not a managed RAG product. It’s not a magic wand that will fix your agent’s reasoning. It’s the memory layer I’d want under any serious agent, and it’s licensed MIT so you can take it.

// stack

  • Python
  • FastAPI
  • Qdrant
  • mem0

// next case study

Want this kind of build for your business? Book the Audit Sprint — $1,500 or email omar@neurascale.org.