Melchizedek

Melchizedek

Persistent memory for Claude Code. Automatically indexes every conversation and provides production-grade hybrid search (BM25 + vectors + reranker) via MCP tools. 100% local, zero config, zero API keys, zero invoice.

Category
访问服务器

README

Melchizedek

npm version npm downloads CI License: MIT Donate Donate

Persistent memory for Claude Code. Automatically indexes every conversation and provides production-grade hybrid search (BM25 + vectors + reranker) via MCP tools. 100% local, zero config, zero API keys, zero invoice.


Why Melchizedek?

Claude Code forgets everything between sessions - and knows nothing about your other projects. Melchizedek fixes both.

It runs silently in the background - indexing your conversations as you work - then gives Claude the ability to search across your entire history, across all projects: past debugging sessions, architectural decisions, error solutions, code patterns.

No cloud. No API keys. No config. Plug and ask.

How it works

~/.claude/projects/**/*.jsonl       (your conversation transcripts - read-only)
        |
        v
  SessionEnd hook                   (auto-triggers after each session)
        |
        v
  +-----------------+
  |  Indexer         |    Parse JSONL -> chunk pairs -> SHA-256 dedup
  |  (better-sqlite3)|    FTS5 tokenize -> vector embed (optional)
  +-----------------+
        |
        v
  ~/.melchizedek/memory.db           (single SQLite file, WAL mode)
        |
        v
  +-----------------+
  |  MCP Server      |    16 search & management tools
  |  (stdio)         |    Hybrid: BM25 + vectors + RRF + reranker
  +-----------------+
        |
        v
  Claude Code                       (searches your history via MCP)

Search pipeline - 4 levels of graceful degradation

Every layer is optional. The plugin works with BM25 alone and gets better as more components are available.

Level Component What it adds Dependency
1 BM25 (FTS5) Keyword search with stemming None (always active)
2 Dual vectors (sqlite-vec) Semantic search - text (MiniLM 384d) + code (Jina 768d) @huggingface/transformers (optional)
3 RRF fusion Merges BM25 + text vectors + code vectors via Reciprocal Rank Fusion Vectors enabled
4 Reranker Cross-encoder re-scoring of top results Transformers.js or node-llama-cpp (optional)

Performance

Measured with npm run bench - 100 sessions, 1 000 chunks, on a single SQLite file.

Metric Result Target
Indexation (100 sessions) ~80 ms < 10 s
BM25 search (mean) ~0.2 ms < 50 ms
DB size (100 sessions) ~1.4 MB < 30 MB
Tokens per search ~125 < 2 000

Quick Start

npm (recommended)

npm install -g melchizedek

Add the MCP server to Claude Code:

claude mcp add --scope user melchizedek -- melchizedek-server

npx (no install)

claude mcp add --scope user melchizedek -- npx melchizedek-server

From source

git clone https://github.com/louis49/melchizedek.git
cd melchizedek && npm install && npm run build
claude --mcp-config .mcp.json

Claude Code plugin marketplace (coming soon)

Plugin review pending. In the meantime, use npm or npx install above.

claude plugin install melchizedek   # not yet available

Setting up hooks (automatic indexing)

The MCP server provides search tools, but hooks trigger automatic indexing. Without hooks, you'd need to manually index sessions.

For marketplace installs, hooks are configured automatically. For npm/npx/source installs, add hooks to ~/.claude/settings.json.

See docs/installation.md for the full JSON configuration, hook reference, and troubleshooting.

After setup, restart Claude Code. Indexing starts automatically.

MCP Tools

Search (start here)

Tool Description
m9k_search Search indexed conversations. Returns compact snippets. Current project boosted. Supports since/until date filters and order (score, date_asc, date_desc).
m9k_context Get a chunk with surrounding context (adjacent chunks in the same session).
m9k_full Retrieve full content of chunks by IDs.

Progressive retrieval pattern - search returns ~50 tokens/result, context ~200-300, full ~500-1000. Start with m9k_search, drill down only when needed. 4x token savings vs loading everything.

Context-aware ranking - results from your current project (×1.5) and current session (×1.2) are automatically promoted. Cross-project results remain visible.

Specialized search

Tool Description
m9k_file_history Find past conversations that touched a specific file.
m9k_errors Find past solutions for an error message.
m9k_similar_work Find past approaches to similar tasks. Prioritizes rich metadata.

Memory management

Tool Description
m9k_save Manually save a memory note for future recall.
m9k_sessions List all indexed sessions, optionally filtered by project.
m9k_info Show memory index info: corpus size, search pipeline, embedding worker, usage metrics.
m9k_config View or update plugin configuration.
m9k_forget Permanently remove a chunk from the index.
m9k_delete_session Delete a session from the index.
m9k_ignore_project Exclude a project from indexing. Future sessions won't be indexed, existing ones optionally purged.
m9k_unignore_project Re-enable indexing for a previously ignored project. Purged data is not restored.
m9k_restart Restart the MCP server to load fresh code after npm run build. Supports force: true for stuck processes.

Usage guide

Tool Description
__USAGE_GUIDE Phantom tool. Its description teaches Claude the retrieval pattern and available tools.

Configuration

Zero config by default. Everything is tunable via m9k_config or environment variables.

Setting Default Env var
Database path ~/.melchizedek/memory.db M9K_DB_PATH
Daemon mode enabled M9K_NO_DAEMON=1 to disable
Log level warn M9K_LOG_LEVEL
Embeddings enabled true M9K_EMBEDDINGS=false to disable
Reranker enabled true M9K_RERANKER=false to disable

See docs/configuration.md for the full settings reference (20+ options, env vars, config file examples).

Enhanced Search

Melchizedek works out of the box with BM25 keyword search. Text embeddings (MiniLM) download automatically on first use for semantic search.

For GPU-accelerated code embeddings (Ollama), cross-encoder reranking (GGUF models), platform-specific setup guides, and the full model reference, see Enhanced Search Setup.

How is this different?

Melchizedek claude-historian-mcp claude-mem episodic-memory mcp-memory-service
GitHub stars npm GitHub stars npm GitHub stars npm GitHub stars GitHub stars PyPI
Philosophy Search engine - indexes everything, you search Search engine - scans JSONL on demand Notebook - AI compresses & saves Search engine Notebook - AI decides what to store
Indexes raw conversations Yes (JSONL transcripts) Yes (direct JSONL read, no persistent index) Compressed summaries Yes (JSONL) No (manual store_memory)
Retroactive on install Yes (backfills all history) Yes (reads existing files) No Yes No (empty at start)
Search BM25 + vectors + RRF + reranker TF-IDF + fuzzy matching FTS5 + ChromaDB Vectors only BM25 + vectors
Progressive retrieval 3 layers (search/context/full) No No No No
100% offline Yes Yes No (needs API for compression) Yes Yes
Single-file storage SQLite None (reads raw JSONL) SQLite + ChromaDB SQLite SQLite-vec
Zero config Yes Yes Yes Yes Yes
MCP tools 16 10 4 2 12
License MIT MIT AGPL-3.0 MIT Apache-2.0
Dual embedding (text + code) Yes (MiniLM + Jina Code) No No No No
Configurable models Yes (Transformers.js or Ollama) No No (Chroma internal) No (hardcoded) Yes (ONNX, Ollama, OpenAI, Cloudflare)
Reranker Cross-encoder (ONNX, GGUF, or HTTP) No No No Quality scorer (not search reranker)
Privacy All local, <private> tag redaction All local Sends data to Anthropic API All local All local
Multi-instance Singleton daemon - N Claude windows share 1 process (Unix socket / Windows named pipe, local fallback) N separate processes Shared HTTP worker (:37777) N separate processes Shared HTTP server

Inspirations

This project stands on the shoulders of others. Key ideas borrowed from:

Project What we took
CASS RRF hybrid fusion, SHA-256 dedup, auto-fuzzy fallback GitHub stars
claude-historian-mcp Specialized MCP tools (file_history, error_solutions) GitHub stars npm
claude-diary PreCompact hook (archive before /compact) GitHub stars

Known issues

  • Session boost inactive - Claude Code currently sends an empty session_id in the SessionStart hook stdin payload, preventing the ×1.2 session boost from working. The ×1.5 project boost is unaffected and provides the primary context-aware ranking. Related upstream issues: #13668 (empty transcript_path), #9188 (stale session_id). Melchizedek's session boost code is tested and ready, and will activate automatically when the upstream fix lands.

Privacy

  • Zero telemetry. No tracking, no analytics, no network calls (except optional lazy model download).
  • Read-only on transcripts. Never writes to ~/.claude/projects/. All data in ~/.melchizedek/.
  • <private> tag support. Content between <private>...</private> is replaced with [REDACTED] before indexing.
  • Local-only. Your conversations never leave your machine.

Requirements

  • Node.js >= 20
  • Claude Code >= 2.0
  • macOS, Linux, or Windows

License

MIT


"Without father, without mother, without genealogy, having neither beginning of days nor end of life."

  • Hebrews 7:3

Built by @louis49

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选