← 开源
0xK3vin

MegaMemory

Persistent project knowledge graph for coding agents. MCP server with semantic search, in-process embeddings, and web explorer.

AI EngineeringGive agent toolsGive agent knowledgeTypeScript
在 GitHub 打开
增长势头
+024 小时新增 Star0.0%
725
Star
76
Fork
+6
本周
2
贡献者
创建于 2026-02-06 · 更新于 2026-10-15 · 今日第 14500 名
主要开发者
0xK3vinmikaelj

0xK3vin/MegaMemory 排名第 14,500,有 725 个星标。

同类别比较

0xK3vin/MegaMemory 排名第 14,500,此处有 8 个同类条目;mikechambers/adb-mcp 排名第 14,494。

同类别比较
名称排名指标
laravel/agent-skills14,483
语言:
Shell
星标数:
727
分叉数:
27
简介:
Laravel official collection of agent skills
probelabs/probe14,486
语言:
Rust
星标数:
727
分叉数:
62
简介:
AI-friendly semantic code search engine for large codebases. Combines ripgrep speed with tree-sitter AST parsing. Powers AI coding assistants with precise, context-aware code understanding.
marckohlbrugge/37signals-skills14,493
星标数:
726
分叉数:
56
mikechambers/adb-mcp14,494
语言:
JavaScript
星标数:
726
分叉数:
103
jason-effi-lab/karpathy-llm-wiki-vault14,509
星标数:
725
分叉数:
225
简介:
基于 Karpathy LLM Wiki 理念构建的 SKILL 和 Obsidian 知识库,将碎片信息整理为结构化、互联的知识网络。
laravel/pao14,510
语言:
PHP
星标数:
725
分叉数:
38
简介:
PAO is agent-optimized output for PHP testing tools.
Snowflake-Labs/cocoplus14,514
语言:
JavaScript
星标数:
724
分叉数:
86
answeryt/Fat-Cat14,518
语言:
Python
星标数:
724
分叉数:
36
简介:
Fat-Cat: A document-centric context management Agent. Making context as simple as reading chat history.
关键参数与规格
关键参数与规格
参数值
语言TypeScript
类别AI Engineering
子类别Give agent tools,Give agent knowledge
关键词Embeddings, Knowledge base, MCP, Memory management
星标数725
分叉数76
贡献者2
创建日期2026-02-06
更新日期2026-10-15
1 天星标数0
7 天星标数6
排名14,500
上次排名6,548
排名变化-7,952
7 天星标排名5,259
上次 7 天星标排名4,282
7 天星标排名变化-977
总星标排名14,459
上次总星标排名14,427
总星标排名变化-32
README 摘录

MegaMemory Persistent project knowledge graph for coding agents. Your agent reads code, writes concepts in its own words, and queries them before future tasks. The embedding model (~23MB) downloads automatically on first use. Quick Start 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 One command configures: MCP server in

Workflow instructions in Skill tool plugin at Bootstrap command for initial graph population Save command to persist session knowledge Restart opencode after running install. With Claude Code Configures: MCP server in Workflow instructions in Commands in With Antigravity Configures: MCP server in (workspace-level) With Codex Configures: MCP server in Workflow instructions in With other MCP clients Add megamemory as a stdio MCP server. It reads/writes relative to the working directory, or set to override. Returns matched concepts with

children, edges, and parent context. | | | Look up a concept by its exact ID. Returns full context including children, edges, incoming edges, and parent. | | | Add a new concept with optional edges and file references. | | | Update fields on an existing concept. | | | Create a typed relationship between two concepts. | | | Soft-delete a concept with a reason. | | | List all top-level concepts with direct children. | | | List unresolved merge conflicts grouped by merge group. | | | Resolve a merge conflict by providing verified, correct content based on

the current codebase. No API keys, and no network calls after the first model download. Since SQLite files cannot be auto-merged by git, megamemory provides dedicated merge commands. Merge two databases Concepts are compared by ID: identical nodes are deduplicated, and conflicting nodes are kept as / variants under one merge group UUID. Use and to replace default side labels with branch names. View conflicts Resolve conflicts manually AI-assisted resolution When an AI agent runs , it calls , verifies both

versions against current source files, then calls with plus a verification . It does not pick a side blindly; it resolves to what the codebase currently reflects.

常见问题

记录了多少星标和分叉?

0xK3vin/MegaMemory 有 725 个星标和 76 个分叉。

仓库排名是多少?

0xK3vin/MegaMemory 排名第 14,500。

记录的语言和类别是什么?

0xK3vin/MegaMemory 有 725 个星标,语言为 TypeScript,类别为 AI Engineering。

哪个仓库排名最接近?

0xK3vin/MegaMemory 与 mikechambers/adb-mcp 比较,后者排名第 14,494,有 726 个星标。

README

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

  1. Session start — agent calls list_roots to orient itself
  2. Before a task — agent calls understand with a natural language query (or get_concept for exact ID lookup)
  3. After a task — agent calls create_concept or update_concept to 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-memory for initial graph population
  • Save command /user:save-memory to 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 context including children, edges, incoming edges, and parent.
create_concept Add a new concept with optional edges and file references.
update_concept Update fields on an existing concept. Regenerates embeddings automatically.
link Create a typed relationship between two concepts.
remove_concept Soft-delete a concept with a reason. History preserved.
list_roots List all top-level concepts with direct children.
list_conflicts List unresolved merge conflicts grouped by merge group.
resolve_conflict Resolve a merge conflict by providing verified, correct content based on the current codebase.

Concept kinds: feature · module · pattern · config · decision · component

Relationship types: connects_to · depends_on · implements · calls · configured_by

Knowledge Graph


Web Explorer

Visualize the knowledge graph in your browser:

megamemory serve
  • Nodes are colored by kind and sized by edge count
  • Dashed edges show parent-child links; solid edges show relationships
  • Click any node to inspect summary, files, and edges
  • Search supports highlight/dim filtering
  • If port 4321 is taken, you'll be prompted to pick another
megamemory serve --port 8080   # custom port

How It Works

src/
  index.ts       CLI entry + MCP server (9 tools)
  tools.ts       Tool handlers (understand, get_concept, create, update, link, remove, list_conflicts, resolve_conflict)
  db.ts          SQLite persistence (libsql, WAL mode, schema v3)
  embeddings.ts  In-process embeddings (all-MiniLM-L6-v2, 384 dims)
  merge.ts       Two-way merge engine for knowledge.db files
  merge-cli.ts   CLI handlers for merge, conflicts, resolve commands
  types.ts       TypeScript types
  cli-utils.ts   Colored output + interactive prompts
  install.ts     multi-target installer (opencode, Claude Code, Antigravity, Codex)
  web.ts         HTTP server for graph explorer
plugin/
  megamemory.ts  Opencode skill tool plugin
commands/
  bootstrap-memory.md  /user command for initial population
  save-memory.md       /user command to save session knowledge
web/
  index.html     Single-file graph visualization (d3-force + Canvas)
  • Embeddings — In-process via Xenova/all-MiniLM-L6-v2 (ONNX, quantized). No API keys, and no network calls after the first model download.
  • Storage — SQLite with WAL mode, soft-delete history, and schema migrations (currently v3).
  • Search — Brute-force cosine similarity over node embeddings; fast enough for graphs with <10k nodes.
  • Merge — Two-way merge with conflict detection by concept ID, with AI-assisted conflict resolution via MCP tools.

CLI Commands

Command Description
megamemory Start the MCP stdio server
megamemory install Configure editor/agent integration
megamemory serve Launch the web graph explorer
megamemory merge Merge two knowledge.db files
megamemory conflicts List unresolved merge conflicts
megamemory resolve Resolve a merge conflict
megamemory --help Show help
megamemory --version Show version

Merging Knowledge Graphs

When branches diverge, each may update .megamemory/knowledge.db independently. Since SQLite files cannot be auto-merged by git, megamemory provides dedicated merge commands.

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. Use --left-label and --right-label to replace default side labels with branch names.

megamemory merge main.db feature.db --into merged.db --left-label main --right-label feature-xyz

View conflicts

megamemory conflicts            # human-readable summary
megamemory conflicts --json     # machine-readable output
megamemory conflicts --db path  # specify database path

Resolve conflicts manually

megamemory resolve  --keep left    # keep the left version
megamemory resolve  --keep right   # keep the right version
megamemory resolve  --keep both    # keep both as separate concepts

AI-assisted resolution

When an AI agent runs /merge, it calls list_conflicts, verifies both versions against current source files, then calls resolve_conflict with resolved: {summary, why?, file_refs?} plus a verification reason. It does not pick a side blindly; it resolves to what the codebase currently reflects.


License

MIT

排名相邻
同类项目