MegaMemory
Persistent project knowledge graph for coding agents.
An MCP server that lets your coding agent build and query a graph of concepts, architecture, and decisions — so it remembers across sessions.
The LLM is the indexer. No AST parsing. No static analysis. Your agent reads code, writes concepts in its own words, and queries them before future tasks. The graph stores concepts — features, modules, patterns, decisions — not code symbols.
The Loop
understand → work → update
- Session start — agent calls
list_rootsto orient itself - Before a task — agent calls
understandwith a natural language query (orget_conceptfor exact ID lookup) - After a task — agent calls
create_conceptorupdate_conceptto record what it built
Everything persists in a per-project SQLite database at .megamemory/knowledge.db.
Installation
npm install -g megamemory
[!NOTE] Requires Node.js >= 18. The embedding model (~23MB) downloads automatically on first use.
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.
With opencode
megamemory install --target opencode
One command configures:
- MCP server in
~/.config/opencode/opencode.json - Workflow instructions in
~/.config/opencode/AGENTS.md - Skill tool plugin at
~/.config/opencode/tool/megamemory.ts - Bootstrap command
/user:bootstrap-memoryfor initial graph population - Save command
/user:save-memoryto persist session knowledge
Restart opencode after running install.
With Claude Code
megamemory install --target claudecode
Configures:
- MCP server in
~/.claude.json - Workflow instructions in
~/.claude/CLAUDE.md - Commands in
~/.claude/commands/
With Antigravity
megamemory install --target antigravity
Configures:
- MCP server in
./mcp_config.json(workspace-level)
With Codex
megamemory install --target codex
Configures:
- MCP server in
~/.codex/config.toml - Workflow instructions in
~/.codex/AGENTS.md
With other MCP clients
Add megamemory as a stdio MCP server. The command is just megamemory (no arguments). It reads/writes .megamemory/knowledge.db relative to the working directory, or set MEGAMEMORY_DB_PATH to override.
{
"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. |
get_concept |
Look up a concept by its exact ID. Returns full |