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.
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.
Related MCP server: SharedMemory MCP Server
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) |
|
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 melchizedekAdd the MCP server to Claude Code:
claude mcp add --scope user melchizedek -- melchizedek-servernpx (no install)
claude mcp add --scope user melchizedek -- npx melchizedek-serverFrom source
git clone https://github.com/louis49/melchizedek.git
cd melchizedek && npm install && npm run build
claude --mcp-config .mcp.jsonClaude Code plugin marketplace (coming soon)
Plugin review pending. In the meantime, use npm or npx install above.
claude plugin install melchizedek # not yet availableSetting 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 |
| Search indexed conversations. Returns compact snippets. Current project boosted. Supports |
| Get a chunk with surrounding context (adjacent chunks in the same session). |
| 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 |
| Find past conversations that touched a specific file. |
| Find past solutions for an error message. |
| Find past approaches to similar tasks. Prioritizes rich metadata. |
Memory management
Tool | Description |
| Manually save a memory note for future recall. |
| List all indexed sessions, optionally filtered by project. |
| Show memory index info: corpus size, search pipeline, embedding worker, usage metrics. |
| View or update plugin configuration. |
| Permanently remove a chunk from the index. |
| Delete a session from the index. |
| Exclude a project from indexing. Future sessions won't be indexed, existing ones optionally purged. |
| Re-enable indexing for a previously ignored project. Purged data is not restored. |
| Restart the MCP server to load fresh code after |
Usage guide
Tool | Description |
| 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 |
|
|
Daemon mode | enabled |
|
Log level |
|
|
Embeddings enabled |
|
|
Reranker enabled |
|
|
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 | |||||
|
|
|
| ||
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 |
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, | 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 | |
RRF hybrid fusion, SHA-256 dedup, auto-fuzzy fallback | ||
Specialized MCP tools (file_history, error_solutions) |
| |
PreCompact hook (archive before |
Known issues
Session boost inactive - Claude Code currently sends an empty
session_idin 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 (emptytranscript_path), #9188 (stalesession_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
Available Tools
16 toolsm9k_configA
View or update plugin configuration. Changes are saved to ~/.melchizedek/config.json and take effect on next server restart. Without arguments, returns current config.
Inputs: key, value.
m9k_contextARead-onlyIdempotent
Get a chunk with surrounding context (adjacent chunks in the same session). Use after m9k_search to understand the conversation flow.
Inputs: chunkId (required), window.
m9k_delete_sessionADestructiveIdempotent
Delete a session from the index. Removes all chunks and search data. Does NOT delete the source JSONL file.
Inputs: sessionId (required).
m9k_errorsARead-onlyIdempotent
Find past solutions for an error message. Returns error context + how it was resolved.
Inputs: errorMessage (required), limit, source.
m9k_file_historyBRead-onlyIdempotent
Find past conversations that touched a specific file. Searches metadata (tool_use file_path) and text content.
Inputs: filePath (required), limit, source.
m9k_forgetADestructiveIdempotent
Permanently remove a specific chunk from the memory index. Does NOT delete the source JSONL. Use m9k_search() first to find the chunk ID to forget.
Inputs: chunkId (required).
m9k_fullARead-onlyIdempotent
Retrieve full content of chunks by IDs. Use after m9k_search to get complete context.
Inputs: chunkIds (required).
m9k_ignore_projectADestructive
Exclude a project from indexing. Future sessions won't be indexed. Optionally purge existing indexed sessions for this project.
Inputs: project (required), purge.
m9k_infoARead-onlyIdempotent
Show memory index information: corpus size, search pipeline status, usage metrics, embedding worker state.
Inputs: no named parameters.
m9k_restartAIdempotent
Restart the MCP server. Use after npm run build to load fresh code. The server disconnects; next MCP call auto-reconnects with the new build.
Inputs: force.
m9k_saveAIdempotent
Manually save a memory note for future recall. Use for important decisions, patterns, or context.
Inputs: content (required), tags.
m9k_searchARead-onlyIdempotent
Search indexed past conversations. Returns compact results with snippets. Results from the current project and session are boosted by default. Use m9k_context or m9k_full to drill down.
Inputs: query (required), project, limit, since, +3 more.
m9k_sessionsBRead-onlyIdempotent
List all indexed sessions, optionally filtered by project.
Inputs: project, limit, source.
m9k_similar_workARead-onlyIdempotent
Find past work similar to what you're about to do. Use at the start of a complex task to see previous approaches. Unlike m9k_search, this prioritizes chunks with rich metadata (multiple tools used, multiple files touched).
Inputs: description (required), limit, source.
m9k_unignore_projectAIdempotent
Remove a project from the ignore list. Future sessions will be indexed again. Previously purged sessions are NOT restored (requires backfill re-indexation).
Inputs: project (required).
__USAGE_GUIDECRead-onlyIdempotent
melchizedek v1.0.2 — Persistent memory for Claude Code with hybrid search (BM25 + dual embeddings) + reranking.
Corpus: empty (no sessions indexed yet).
Available tools (16):
m9k_search: Find past conversations (BM25 + text vectors + code vectors, fused via RRF)
m9k_context: Get a chunk with surrounding conversation context
m9k_full: Get complete chunk content by IDs
m9k_sessions: Browse indexed sessions
m9k_file_history: Find conversations that touched a specific file
m9k_errors: Find past solutions for error messages
m9k_save: Store important notes for future recall
m9k_similar_work: Find past approaches to similar tasks (bonus for complex work)
m9k_forget: Permanently remove a chunk from memory
m9k_info: Memory index information, corpus size, search pipeline status, usage metrics, embedding worker state
m9k_config: View or update plugin configuration
m9k_delete_session: Remove a session from the index
m9k_ignore_project: Exclude a project from indexing (optionally purge existing data)
m9k_unignore_project: Re-enable indexing for a previously ignored project
m9k_restart: Restart the MCP server to load fresh code after rebuild
RETRIEVAL PATTERN (use this order):
m9k_search(query) → compact results, current project and session boosted (use order="date_asc" to find first occurrence)
m9k_context(chunkId) → surrounding conversation
m9k_full([chunkIds]) → complete content if needed
SPECIALIZED SEARCH:
m9k_file_history(filePath) → before modifying any file
m9k_errors(errorMessage) → when you hit an error
m9k_similar_work(description) → at the start of a complex task
MANAGE:
m9k_info() → check corpus size, search pipeline, usage metrics
m9k_config() → view or change plugin configuration
m9k_delete_session(sessionId) → remove a session from the index
m9k_ignore_project(project) → exclude a project from indexing
m9k_unignore_project(project) → re-enable indexing for a project
m9k_restart() → restart server after npm run build
Inputs: no named parameters.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 16 tools
Each tool has a clearly distinct purpose: search, context retrieval, session management, configuration, etc. Even overlapping functions like m9k_search and m9k_similar_work are differentiated by description and use case. No two tools are easily confused.
Most tools follow the consistent m9k_verb_noun pattern (e.g., m9k_search, m9k_save). However, the tool __USAGE_GUIDE breaks this pattern with double underscores and all caps, which is a minor deviation from an otherwise uniform naming convention.
With 16 tools, the server is well-scoped for its purpose as a persistent memory system. Each tool covers a distinct function (search, context, save, delete, config, etc.) without being overwhelming or too sparse.
The tool surface covers the main CRUD-like operations (save, retrieve, forget, session delete) and specialized search (file history, errors, similar work). Minor gaps include no way to update existing chunks or list all chunk IDs for a session, but these are not critical for the domain.
Maintenance
Related MCP Connectors
Private persistent memory for Claude, ChatGPT & Gemini via MCP - semantic search, zero-code setup.
Persistent memory for Claude Code and Cursor. Stop re-explaining your project every session.
Persistent memory for AI assistants. Save once; recall from Claude, ChatGPT, or any MCP client.
Persistent AI memory shared across Claude, ChatGPT, coding agents, and compatible MCP clients.
Related MCP Servers
- AlicenseAqualityBmaintenancePersistent local memory for Claude Code that indexes every session's JSONL file verbatim into SQLite + ChromaDB. Exposes 17 MCP tools for semantic recall, deterministic file replay, and fuzzy "do you remember when..." queries across your entire session history — no API calls, nothing leaves the machine.17202 PyPI17MIT
- AlicenseAqualityDmaintenanceGives Claude Code, Claude Desktop, Cursor, VS Code Copilot, and other MCP-compatible tools persistent memory.1873 npm1MIT
- FlicenseNot gradedqualityDmaintenanceProvides persistent semantic memory for Claude Code via local embeddings and six MCP tools, enabling context storage and retrieval across sessions without cloud dependencies.-
- AlicenseNot gradedqualityAmaintenanceGives Claude Code persistent cross-session memory with semantic search, automatic detection and classification of user corrections into behavioral patterns, and self-evolving frameworks that refine judgment over time. Everything runs locally through hooks and MCP tools, with no cloud, API keys, or telemetry.6 npmMIT