This is an early release preview. You may encounter bugs.
LEANN logo
Unclaimed

Tool memory

LEANN

Stop storing embeddings, and still keep your recall. LEANN is a low‑storage vector index that recomputes embeddings on t

A 88/100 GitHub score ? This grade is derived from GitHub signals, not user votes. Open for the full breakdown.
Discussion

01 / Summary

About LEANN.

LEANN is a vector index for personal RAG on a laptop. Instead of storing an embedding for every chunk, it keeps a pruned nearest-neighbor graph and recomputes embeddings only for the nodes visited during a search. The technique (graph-based selective recomputation with high-degree preserving pruning) is described in the research paper "LEANN: A Low-Storage Vector Index", and the project reports roughly 97% less storage than a conventional vector index at the same search quality.

Search combines selective recomputation with dynamic batching of embedding computations and a two-level graph traversal. Two backends are available: HNSW, the default, which recomputes fully for the largest savings, and DiskANN, which uses product-quantized graph traversal with real-time reranking for faster search. Metadata filters (comparison, membership, and string operators) and an exact grep mode sit alongside semantic search.

Ready-made pipelines index local documents (PDF, text, Markdown), Apple Mail, Chrome browser history, WeChat, iMessage, and exported ChatGPT and Claude conversations, and live data such as Slack messages or Twitter bookmarks can be pulled in through MCP servers. A ColQwen pipeline adds multimodal PDF retrieval with vision-language models. Generation and embeddings can run locally through Hugging Face models or Ollama, or through Anthropic and any OpenAI-compatible API.

LEANN also runs as an MCP server for Claude Code, giving the agent semantic code search alongside its built-in keyword search. In the project's comparison against BM25 on 30 SWE-Bench Pro tasks, with model, tools, and retrieval budget fixed, the agent reached 24.2% initial relevant-code recall versus 11.4% and used 8.4% fewer tokens.

Storage comparison published by the project:

Dataset Conventional index (e.g. FAISS) LEANN Savings
DPR (2.1M chunks) 3.8 GB 324 MB 91%
Wikipedia (60M chunks) 201 GB 6 GB 97%
Chat (400K) 1.8 GB 64 MB 97%
Email (780K) 2.4 GB 79 MB 97%
Browser history (38K) 130 MB 6.4 MB 95%
  • Selective recomputation: stores a pruned graph and computes embeddings only for nodes on the search path
  • Two backends: HNSW for maximum storage savings and DiskANN for faster PQ-based search with reranking
  • Declarative Python API: builder, searcher, and chat classes for indexing, search, and question answering
  • Personal data pipelines: documents, Apple Mail, Chrome history, WeChat, iMessage, and ChatGPT and Claude chat exports
  • MCP data sources: live RAG over Slack, Twitter, and other platforms through MCP servers
  • Multimodal PDF retrieval: ColQwen2 and ColPali models for PDFs with figures and complex layouts
  • Claude Code integration: an MCP server that adds semantic code search to Claude Code
  • Metadata filtering: filter results by date, type, file extension, or custom fields
  • Grep search: exact text matching for code patterns, error messages, and function names
  • Model choice: Hugging Face, Ollama, Anthropic, or any OpenAI-compatible endpoint for generation and embeddings, with separate embedding providers supported

02 / Discussion CREDIBILITY-GATED

Discussion

Reading is open to everyone. Posting and voting need a verified identity or a GitHub grade of B or higher.

  • No discussions yet.

04 / Build

Build with LEANN.

Browse the catalog for frameworks, tools, and harnesses, each scored on real GitHub credibility.

Get LEANN →

Browse the catalog