MegaMemory is an MCP server that lets a coding agent write down what it understands about a project (features, modules, patterns, decisions and why they were made) as a small graph, then search it at the start of later sessions. The model is the indexer: there is no AST parsing or static analysis, so the graph is exactly as good, and as current, as the agent's own notes. The useful ideas are the why field on every concept, soft deletion with a reason, and an AI-assisted merge that resolves conflicts against the current code. The weak points are that file references are bare paths with no commit or hash, so nothing detects a stale concept, and that the database is a binary SQLite file in the repository.
Source: AI Engineering's LinkedIn post (2026-11-30) and the 0xK3vin/MegaMemory repository: README, commands/bootstrap-memory.md, commands/save-memory.md, package.json, src/install.ts, src/db.ts and src/merge.ts.
What it is
| Item | Detail |
|---|---|
| Package | megamemory on npm, version 1.6.2 in package.json; Node 18 or later; MIT |
| Repository | 787 stars; created 2026-02-06; last push 2026-05-03, about seven months before the post |
| Interface | Stdio MCP server with 9 tools, plus a CLI (install, serve, merge, conflicts, resolve) |
| Storage | One SQLite file per project at .megamemory/knowledge.db (libsql, WAL mode, schema v3) |
| Retrieval | In-process embeddings (Xenova all-MiniLM-L6-v2, 384 dimensions, quantized ONNX, about 23 MB downloaded on first use), brute-force cosine over nodes; the README says it is fast enough under 10,000 nodes |
| Integrations | Installer targets Claude Code, Codex, OpenCode and Antigravity; any other MCP client by config |
| Explorer | megamemory serve draws the graph in a browser (d3-force on canvas, port 4321 by default) |
How it works
The workflow is understand, work, update. At session start the agent calls list_roots; before a task it calls understand (semantic search returning matched concepts with children, edges and parent) or get_concept by exact id; after a task it calls create_concept, update_concept, link or remove_concept.
Nodes are concepts, not code symbols. Kinds: feature, module, pattern, config, decision, component. Each has a name, a summary, a
why, optionalfile_refs, a parent, and the task that created it. The bootstrap command asks for at most two levels and the top 10 to 15 concepts first.Edges are typed:
connects_to,depends_on,implements,calls,configured_by, each with a free-text description.Deletion is soft.
remove_conceptsetsremoved_atand a reason, and reads filter onremoved_at IS NULL, so history survives. A timeline table exists in the schema.Two slash commands carry the workflow.
bootstrap-memorylists files by line count and has the agent record the biggest subsystems;save-memoryhas it reflect on the session, search for overlap first, and prefer updating a concept to adding one. Both stress that thewhyis the most valuable field.Branches merge by concept id.
megamemory merge main.db feature.db --into merged.dbkeeps identical nodes once and writes differing ones as::leftand::rightvariants under one merge group. An agent then callslist_conflicts, checks both versions against the current source files, and callsresolve_conflictwith the verified content and a reason, rather than picking a side.
Tradeoffs
The model as indexer gets you rationale and intent, which no parser can recover, at the price of coverage and accuracy that depend on the agent's diligence. The post says this itself: the memory is only what the agent records and keeps current. Compare a parser-built code graph (Graphify, CodeGraph), which is complete and mechanical but cannot say why.
Concepts over symbols keeps the graph small enough for brute-force search and readable in the explorer, but it means nothing links a concept to the lines that justify it beyond a list of file paths.
A local SQLite file needs no service or API key and can live in the repository, but git cannot diff or merge it. That is why the merge command exists, and it also means a pull request shows no reviewable change to the project's memory.
Small local embeddings make retrieval free and offline. The model is a general English sentence encoder, so queries phrased in code identifiers may match weakly; the README gives no retrieval evaluation.
Failure modes
Silent staleness.
file_refsis stored as a JSON list of path strings, with no commit, hash or line range. When the code changes and the agent skipsupdate_concept, the concept goes on describing the old behaviour and nothing flags it. This is the experience-rot pattern: a remembered answer is reused without re-checking the thing it was learned from.Instructions applied everywhere. For Claude Code and Codex the installer appends a section to the GLOBAL
~/.claude/CLAUDE.mdor~/.codex/AGENTS.md, saying the agent must query the graph before reading source files and must record after each task. That applies to every project on the machine, including ones with no graph.Every two-branch edit is a conflict. The merge is two-way, with no common ancestor: any concept present on both sides and not identical becomes a conflict, even if only one branch changed it. Resolution then costs an agent call per concept, and on a busy repository the conflict queue will grow with ordinary work.
Duplicates and drift in wording. Search-before-create is an instruction, not an enforced check; two sessions can add near-identical concepts under different ids.
Unmaintained-looking project. No push since 2026-05-03. Before adopting, check open issues and whether the MCP SDK and embedding dependencies still install cleanly.
Review checklist
Does every concept that carries a claim about code record which commit it was checked against, and is there a pass that flags concepts whose files changed since?
Is the workflow instruction scoped to the projects that use it, rather than written into the user-global instruction file?
Is the memory reviewable in a pull request (an exported text view, or a diff of concepts), or only through the explorer?
Who resolves merge conflicts, and is the agent's resolution reviewed or applied directly?
Is there a cap or pruning rule, so the graph stays near the 10 to 15 root concepts the bootstrap aims for?
Has anyone measured whether querying the graph before a task changes outcomes, against simply reading the code?
Related
Beacon, from the same LinkedIn page: session traces distilled into reviewed Agent Skills.
Graphify and CodeGraph: parser-built code graphs the agent queries instead of grep.
Relate and SelfGraph: embedded graph stores for agent memory, SelfGraph with bitemporal history.
Experience Rot: why remembered context needs the version it was learned against.
A knowledge graph in Markdown files: the reviewable, diffable alternative to a binary store.
Memory Tax: when a memory layer loses to searching the raw history.