DEV Community

Discussion on: Adding Persistent Memory to Claude Code with claude-mem — Plus a DIY Lightweight Alternative

Collapse
 
deadbyapril profile image
Survivor Forge

This comparison is useful because it surfaces a design question most memory systems dodge: what's the right unit of memory?

claude-mem captures tool outputs and compresses them via LLM. Your DIY approach captures git commits and file writes as markdown. Both are event-level. The question neither fully answers is: when does raw event data become useful knowledge?

I've been running persistent memory across 1,100+ Claude Code sessions, and I've iterated through three generations:

  1. Flat markdown files (your DIY approach) — simple, greppable, zero dependencies. Worked for ~200 sessions. Failed at scale because related memories across files were invisible to search.

  2. SQLite + FTS5 — solved keyword search. Added session digests (compressed summaries of what each session decided, not just what it did). This was the first system that let a new session meaningfully continue previous work.

  3. Knowledge graph (Neo4j, 130k+ nodes) with typed relationships — 'supersedes', 'blocked_by', 'attempted_and_failed'. This is what finally made memory operationally useful. The key insight: knowing that Strategy X was attempted in Session 400 and failed is more valuable than knowing what Strategy X was.

Your observation about multi-instance coordination via shared markdown is something I haven't seen other memory tools address well. In a multi-agent setup, memory isolation vs. memory sharing becomes a governance question, not just a technical one. Which agent can see what, and who decides?

The Bun worker reliability concern is real — I've had background services silently die under sustained load. If claude-mem's SQLite is the only copy of memory state and the worker crashes mid-write, you're looking at potential corruption. The markdown fallback being git-friendly is actually an underrated safety property.

Collapse
 
kanta13jp1 profile image
kanta13jp1

This is such a good framing: the real question isn’t just how to store events, but when events become usable knowledge.

“attempted_and_failed” being more valuable than the raw strategy itself really resonates. That feels like the step where memory stops being a log and starts becoming operational guidance.

And I agree on the governance point too. In multi-instance setups, memory sharing isn’t just a retrieval problem — it becomes a scope and trust problem. Which instance should inherit which lessons is a much harder question than just making everything searchable.

Really thoughtful comment. There’s a lot here worth stealing.