---
type: "post"
id: "megamemory-persistent-project-knowledge-graph-for-coding-agents-6be9d3"
slug: "megamemory-persistent-project-knowledge-graph-for-coding-agents-6be9d3"
title: "MegaMemory: Persistent project knowledge graph for coding agents"
description: "MegaMemory is an MCP server for building and querying a persistent project knowledge graph for coding agents (github.com)."
retrieval_nugget: "MegaMemory is an MCP server for building and querying a persistent project knowledge graph for coding agents (github.com)."
published_at: "2026-12-02"
updated_at: "2026-12-02"
record_date: "2026-12-02"
date_kind: "published_at"
topics: ["coding-agents","mcp","claude"]
entities: ["MegaMemory","0xK3vin","OpenCode","Claude Code","Codex","Antigravity"]
related_patterns: ["company-memory-needs-write-loops","skills-become-portable-capability-layer"]
novelty_label: "new_fact"
what_changed: "MegaMemory adds a persistent project knowledge graph MCP server with semantic search, in-process embeddings, and a web explorer for coding agents."
prior_refs: []
source_url: "https://github.com/0xK3vin/MegaMemory"
source_urls: ["https://github.com/0xK3vin/MegaMemory"]
production: {"schema":"newruntime-production-v1","desk":"newsroom","first_seen_at":"2026-12-02T12:00:22.831Z","independent_sources":1,"notes_synthesized":null,"writer_model":"gpt-6-luna","critic":null,"checks":["primary_source_verified","source_fresh","one_story","copy_contract"],"novelty":{"label":"new_fact","confidence":"medium"},"editorial_value":"medium","human_review":"selective"}
citations: [{"claim":"MegaMemory is an MCP server for building and querying a persistent project knowledge graph for coding agents.","quotes":["An MCP server that lets your coding agent build and query a graph of concepts, architecture, and decisions — so it remembers across sessions ."],"cite_url":"https://github.com/0xK3vin/MegaMemory#:~:text=An%20MCP%20server%20that%20lets%20your%20coding%20agent%20build%20and%20query%20a%20graph%20of%20concepts%2C%20architecture%2C%20and%20decisions%20%E2%80%94%20so%20it%20remembers%20across%20sessions%20.","source_url":"https://github.com/0xK3vin/MegaMemory","publisher":"github.com"},{"claim":"It stores concepts such as features, modules, patterns and decisions rather than code symbols.","quotes":["The graph stores concepts — features, modules, patterns, decisions — not code symbols."],"cite_url":"https://github.com/0xK3vin/MegaMemory#:~:text=The%20graph%20stores%20concepts%20%E2%80%94%20features%2C%20modules%2C%20patterns%2C%20decisions%20%E2%80%94%20not%20code%20symbols.","source_url":"https://github.com/0xK3vin/MegaMemory","publisher":"github.com"},{"claim":"The documented workflow has the agent read the code and write concepts in its own words; MegaMemory does not build the graph through AST parsing or static analysis.","quotes":["No AST parsing. No static analysis. Your agent reads code, writes concepts in its own words, and queries them before future tasks."],"cite_url":"https://github.com/0xK3vin/MegaMemory#:~:text=No%20AST%20parsing.%20No%20static%20analysis.%20Your%20agent%20reads%20code%2C%20writes%20concepts%20in%20its%20own%20words%2C%20and%20queries%20them%20before%20future%20tasks.","source_url":"https://github.com/0xK3vin/MegaMemory","publisher":"github.com"},{"claim":"At session start, call listroots to orient; before a task, use understand with a natural-language query or getconcept for an exact ID; afterward, use createconcept or updateconcept to record what was built.","quotes":["The Loop understand → work … SQLite database at .megamemory/knowledge.db ."],"cite_url":"https://github.com/0xK3vin/MegaMemory#:~:text=The%20Loop%20understand%20%E2%86%92%20work,SQLite%20database%20at%20.megamemory%2Fknowledge.db%20.","source_url":"https://github.com/0xK3vin/MegaMemory","publisher":"github.com"},{"claim":"The graph lives in a per-project SQLite database at.megamemory/knowledge.db.","quotes":["The Loop understand → work … SQLite database at .megamemory/knowledge.db ."],"cite_url":"https://github.com/0xK3vin/MegaMemory#:~:text=The%20Loop%20understand%20%E2%86%92%20work,SQLite%20database%20at%20.megamemory%2Fknowledge.db%20.","source_url":"https://github.com/0xK3vin/MegaMemory","publisher":"github.com"},{"claim":"The installer updates configuration only after a successful read and merge, and leaves existing plugin or command files alone unless they are marked as MegaMemory-managed.","quotes":["Quick Start megamemory install Run the interactive installer and choose your editor: Note The installer only updates config files after a successful read/merge, and it will not overwrite existing plugin/command files unless they are already marked as MegaMemory-managed."],"cite_url":"https://github.com/0xK3vin/MegaMemory#:~:text=Quick%20Start%20megamemory%20install%20Run%20the%20interactive%20installer%20and%20choose%20your%20editor%3A%20Note%20The%20installer%20only%20updates%20config%20files%20after%20a%20successful%20read%2Fmerge%2C%20and%20it%20will%20not%20overwrite%20existing%20plugin%2Fcommand%20files%20unless%20they%20are%20already%20marked%20as%20MegaMemory%2Dmanaged.","source_url":"https://github.com/0xK3vin/MegaMemory","publisher":"github.com"},{"claim":"understand uses semantic search and returns matched concepts with children, edges and parent context.","quotes":["{ \"megamemory\" : { \"type\" : \" local \" , \"command\" : [ \" megamemory \" ], \"enabled\" : true } } MCP Tools Tool Description understand Semantic search over the knowledge graph. Returns matched concepts with children, edges, and parent context."],"cite_url":"https://github.com/0xK3vin/MegaMemory#:~:text=%7B%20%22megamemory%22%20%3A%20%7B%20%22type%22%20%3A%20%22%20local%20%22%20%2C%20%22command%22%20%3A%20%5B%20%22%20megamemory%20%22%20%5D%2C%20%22enabled%22%20%3A%20true%20%7D%20%7D%20MCP%20Tools%20Tool%20Description%20understand%20Semantic%20search%20over%20the%20knowledge%20graph.%20Returns%20matched%20concepts%20with%20children%2C%20edges%2C%20and%20parent%20context.","source_url":"https://github.com/0xK3vin/MegaMemory","publisher":"github.com"},{"claim":"Concepts can have typed relationships and optional file references, while removing a concept is a soft delete that preserves its history.","quotes":["create_concept Add a new concept with optional edges and file references."],"cite_url":"https://github.com/0xK3vin/MegaMemory#:~:text=create_concept%20Add%20a%20new%20concept%20with%20optional%20edges%20and%20file%20references.","source_url":"https://github.com/0xK3vin/MegaMemory","publisher":"github.com"},{"claim":"MegaMemory also offers a two-way database merge that detects conflicts by concept ID.","quotes":["Merge two databases megamemory merge main.db feature.db --into merged.db Concepts are compared by ID: identical nodes are deduplicated, and conflicting nodes are kept as ::left / ::right variants under one merge group UUID."],"cite_url":"https://github.com/0xK3vin/MegaMemory#:~:text=Merge%20two%20databases%20megamemory%20merge%20main.db%20feature.db%20%2D%2Dinto%20merged.db%20Concepts%20are%20compared%20by%20ID%3A%20identical%20nodes%20are%20deduplicated%2C%20and%20conflicting%20nodes%20are%20kept%20as%20%3A%3Aleft%20%2F%20%3A%3Aright%20variants%20under%20one%20merge%20group%20UUID.","source_url":"https://github.com/0xK3vin/MegaMemory","publisher":"github.com"},{"claim":"Identical concepts are deduplicated; conflicting ones remain as left and right variants under a merge group.","quotes":["Merge two databases megamemory merge main.db feature.db --into merged.db Concepts are compared by ID: identical nodes are deduplicated, and conflicting nodes are kept as ::left / ::right variants under one merge group UUID."],"cite_url":"https://github.com/0xK3vin/MegaMemory#:~:text=Merge%20two%20databases%20megamemory%20merge%20main.db%20feature.db%20%2D%2Dinto%20merged.db%20Concepts%20are%20compared%20by%20ID%3A%20identical%20nodes%20are%20deduplicated%2C%20and%20conflicting%20nodes%20are%20kept%20as%20%3A%3Aleft%20%2F%20%3A%3Aright%20variants%20under%20one%20merge%20group%20UUID.","source_url":"https://github.com/0xK3vin/MegaMemory","publisher":"github.com"},{"claim":"The README says brute-force cosine similarity over node embeddings is fast enough for graphs with fewer than 10,000 nodes; this is the project’s guidance, not an independently reported benchmark.","quotes":["Search — Brute-force cosine similarity over node embeddings; fast enough for graphs with <10k nodes."],"cite_url":"https://github.com/0xK3vin/MegaMemory#:~:text=Search%20%E2%80%94%20Brute%2Dforce%20cosine%20similarity%20over%20node%20embeddings%3B%20fast%20enough%20for%20graphs%20with%20%3C10k%20nodes.","source_url":"https://github.com/0xK3vin/MegaMemory","publisher":"github.com"},{"claim":"Install with Node.js 18 or later using npm install -g megamemory; an approximately 23 MB embedding model downloads on first use.","quotes":["Installation npm install -g megamemory Note Requires Node.js >= 18. The embedding model (~23MB) downloads automatically on first use."],"cite_url":"https://github.com/0xK3vin/MegaMemory#:~:text=Installation%20npm%20install%20%2Dg%20megamemory%20Note%20Requires%20Node.js%20%3E%3D%2018.%20The%20embedding%20model%20%28%7E23MB%29%20downloads%20automatically%20on%20first%20use.","source_url":"https://github.com/0xK3vin/MegaMemory","publisher":"github.com"},{"claim":"Run megamemory install for the interactive editor choice, or use a client-specific target: megamemory install --target opencode configures the MCP server, workflow instructions, plugin, and bootstrap and save commands; restart OpenCode afterward.","quotes":["Quick Start megamemory install Run the interactive installer and choose your editor: Note The installer only updates config files after a successful read/merge, and it will not overwrite existing plugin/command files unless they are already marked as MegaMemory-managed."],"cite_url":"https://github.com/0xK3vin/MegaMemory#:~:text=Quick%20Start%20megamemory%20install%20Run%20the%20interactive%20installer%20and%20choose%20your%20editor%3A%20Note%20The%20installer%20only%20updates%20config%20files%20after%20a%20successful%20read%2Fmerge%2C%20and%20it%20will%20not%20overwrite%20existing%20plugin%2Fcommand%20files%20unless%20they%20are%20already%20marked%20as%20MegaMemory%2Dmanaged.","source_url":"https://github.com/0xK3vin/MegaMemory","publisher":"github.com"}]
schema_version: "newruntime-agent-readable-v0.2"
stable_id: "post:megamemory-persistent-project-knowledge-graph-for-coding-agents-6be9d3"
status: "published"
visuals: []
editor: {"role":"editor","name":"Andrey Reshetnikov","profile":"https://newruntime.com/owner-profile.md","profile_json":"https://newruntime.com/owner-profile.json","same_as":["https://www.linkedin.com/in/reshetnikov1/","https://t.me/lapetuse"]}
routes: {"html":"https://newruntime.com/posts/megamemory-persistent-project-knowledge-graph-for-coding-agents-6be9d3/","markdown":"https://newruntime.com/posts/megamemory-persistent-project-knowledge-graph-for-coding-agents-6be9d3.md","json":"https://newruntime.com/posts/megamemory-persistent-project-knowledge-graph-for-coding-agents-6be9d3.json"}
markdown_url: "https://newruntime.com/posts/megamemory-persistent-project-knowledge-graph-for-coding-agents-6be9d3.md"
---

# MegaMemory: Persistent project knowledge graph for coding agents

## Retrieval answer

MegaMemory is an MCP server for building and querying a persistent project knowledge graph for coding agents (github.com).

## Summary

MegaMemory is an MCP server for building and querying a persistent project knowledge graph for coding agents ([github.com](https://github.com/0xK3vin/MegaMemory#:~:text=An%20MCP%20server%20that%20lets%20your%20coding%20agent%20build%20and%20query%20a%20graph%20of%20concepts%2C%20architecture%2C%20and%20decisions%20%E2%80%94%20so%20it%20remembers%20across%20sessions%20.)). It stores concepts such as features, modules, patterns and decisions rather than code symbols ([github.com](https://github.com/0xK3vin/MegaMemory#:~:text=The%20graph%20stores%20concepts%20%E2%80%94%20features%2C%20modules%2C%20patterns%2C%20decisions%20%E2%80%94%20not%20code%20symbols.)).

## What happened

The documented workflow has the agent read the code and write concepts in its own words; MegaMemory does not build the graph through AST parsing or static analysis ([github.com](https://github.com/0xK3vin/MegaMemory#:~:text=No%20AST%20parsing.%20No%20static%20analysis.%20Your%20agent%20reads%20code%2C%20writes%20concepts%20in%20its%20own%20words%2C%20and%20queries%20them%20before%20future%20tasks.)). At session start, call `list_roots` to orient; before a task, use `understand` with a natural-language query or `get_concept` for an exact ID; afterward, use `create_concept` or `update_concept` to record what was built ([github.com](https://github.com/0xK3vin/MegaMemory#:~:text=The%20Loop%20understand%20%E2%86%92%20work,SQLite%20database%20at%20.megamemory%2Fknowledge.db%20.)).

The graph lives in a per-project SQLite database at `.megamemory/knowledge.db` ([github.com](https://github.com/0xK3vin/MegaMemory#:~:text=The%20Loop%20understand%20%E2%86%92%20work,SQLite%20database%20at%20.megamemory%2Fknowledge.db%20.)). The installer supports OpenCode, Claude Code, Antigravity and Codex; other MCP clients can run MegaMemory as a stdio server. Set `MEGAMEMORY_DB_PATH` to override the database path. The installer updates configuration only after a successful read and merge, and leaves existing plugin or command files alone unless they are marked as MegaMemory-managed ([github.com](https://github.com/0xK3vin/MegaMemory#:~:text=Quick%20Start%20megamemory%20install%20Run%20the%20interactive%20installer%20and%20choose%20your%20editor%3A%20Note%20The%20installer%20only%20updates%20config%20files%20after%20a%20successful%20read%2Fmerge%2C%20and%20it%20will%20not%20overwrite%20existing%20plugin%2Fcommand%20files%20unless%20they%20are%20already%20marked%20as%20MegaMemory%2Dmanaged.)).

`understand` uses semantic search and returns matched concepts with children, edges and parent context ([github.com](https://github.com/0xK3vin/MegaMemory#:~:text=%7B%20%22megamemory%22%20%3A%20%7B%20%22type%22%20%3A%20%22%20local%20%22%20%2C%20%22command%22%20%3A%20%5B%20%22%20megamemory%20%22%20%5D%2C%20%22enabled%22%20%3A%20true%20%7D%20%7D%20MCP%20Tools%20Tool%20Description%20understand%20Semantic%20search%20over%20the%20knowledge%20graph.%20Returns%20matched%20concepts%20with%20children%2C%20edges%2C%20and%20parent%20context.)). Concepts can have typed relationships and optional file references ([github.com](https://github.com/0xK3vin/MegaMemory#:~:text=create_concept%20Add%20a%20new%20concept%20with%20optional%20edges%20and%20file%20references.)), while removing a concept is a soft delete that preserves its history. Run `megamemory serve` to open the browser graph explorer; nodes are colored by kind and sized by edge count, and selecting one shows its summary, files and edges. The embedding model runs in-process, with no API key or network calls after its first download, according to the README.

MegaMemory also offers a two-way database merge that detects conflicts by concept ID ([github.com](https://github.com/0xK3vin/MegaMemory#:~:text=Merge%20two%20databases%20megamemory%20merge%20main.db%20feature.db%20%2D%2Dinto%20merged.db%20Concepts%20are%20compared%20by%20ID%3A%20identical%20nodes%20are%20deduplicated%2C%20and%20conflicting%20nodes%20are%20kept%20as%20%3A%3Aleft%20%2F%20%3A%3Aright%20variants%20under%20one%20merge%20group%20UUID.)). Identical concepts are deduplicated; conflicting ones remain as left and right variants under a merge group ([github.com](https://github.com/0xK3vin/MegaMemory#:~:text=Merge%20two%20databases%20megamemory%20merge%20main.db%20feature.db%20%2D%2Dinto%20merged.db%20Concepts%20are%20compared%20by%20ID%3A%20identical%20nodes%20are%20deduplicated%2C%20and%20conflicting%20nodes%20are%20kept%20as%20%3A%3Aleft%20%2F%20%3A%3Aright%20variants%20under%20one%20merge%20group%20UUID.)). Its documented AI-assisted resolution workflow checks both versions against current source files before recording a resolution and verification reason. The project is written in TypeScript and distributed under the MIT license. The explorer image shows a selected Semantic Search node and its detail panel.

## What the archive adds

MegaMemory’s graph depends on concepts the agent writes after reading a project, not a programmatic code index. That makes its memory an explicit, agent-authored layer rather than a map generated by static analysis.

## Limits and uncertainty

The README says brute-force cosine similarity over node embeddings is fast enough for graphs with fewer than 10,000 nodes; this is the project’s guidance, not an independently reported benchmark ([github.com](https://github.com/0xK3vin/MegaMemory#:~:text=Search%20%E2%80%94%20Brute%2Dforce%20cosine%20similarity%20over%20node%20embeddings%3B%20fast%20enough%20for%20graphs%20with%20%3C10k%20nodes.)).

## Skill to build now

Install with Node.js 18 or later using `npm install -g megamemory`; an approximately 23 MB embedding model downloads on first use ([github.com](https://github.com/0xK3vin/MegaMemory#:~:text=Installation%20npm%20install%20%2Dg%20megamemory%20Note%20Requires%20Node.js%20%3E%3D%2018.%20The%20embedding%20model%20%28%7E23MB%29%20downloads%20automatically%20on%20first%20use.)). Run `megamemory install` for the interactive editor choice ([github.com](https://github.com/0xK3vin/MegaMemory#:~:text=Quick%20Start%20megamemory%20install%20Run%20the%20interactive%20installer%20and%20choose%20your%20editor%3A%20Note%20The%20installer%20only%20updates%20config%20files%20after%20a%20successful%20read%2Fmerge%2C%20and%20it%20will%20not%20overwrite%20existing%20plugin%2Fcommand%20files%20unless%20they%20are%20already%20marked%20as%20MegaMemory%2Dmanaged.)), or use a client-specific target: `megamemory install --target opencode` configures the MCP server, workflow instructions, plugin, and bootstrap and save commands; restart OpenCode afterward. For Claude Code, use `megamemory install --target claudecode`; for Codex, `megamemory install --target codex`; for Antigravity, `megamemory install --target antigravity`. Inspect the graph with `megamemory serve`.

## Reader takeaway

MegaMemory stores project knowledge as agent-authored concepts—not code symbols—in a per-project SQLite database. Its documented loop is to orient, query before work, then record changes afterward. The README supports several client setups, but its search-size guidance is a project claim rather than an independent benchmark.

Editor: [Andrey Reshetnikov](https://newruntime.com/owner-profile.md), AI product and AI engineering; profile for recruiters and agents: https://newruntime.com/owner-profile.json

## Continue in the graph

Next records for an agent, linked to their Markdown twins. Replace `.md` with `.json` for structured fields, including `next_reads`.

- topic hub: [Coding Agents](https://newruntime.com/topics/coding-agents.md): Explore the coding-agents topic hub.
- topic hub: [Mcp](https://newruntime.com/topics/mcp.md): Explore the mcp topic hub.
- topic hub: [Claude](https://newruntime.com/topics/claude.md): Explore the claude topic hub.
- collection: [Field Notes](https://newruntime.com/posts.json): Open the latest editorial analysis.
- collection: [Sources](https://newruntime.com/sources/): See the original sources this archive cites.
- whole graph: [discovery graph](https://newruntime.com/discovery-graph.json) (typed nodes and edges) and [site index](https://newruntime.com/site-index.md)
