Skip to content

LEANN

Local semantic search over your own files and chats, using far less storage than typical vector databases.

Stars
13.8k
Forks
1.3k
Licence
MIT
Language
Python
Last update
5 days ago
Type
Library

What it is

LEANN is a Python tool that builds a searchable index of your personal documents, such as files, emails, and chat logs, so an AI assistant can find relevant passages before answering. It is a vector database that recomputes embeddings on demand instead of storing them all, which the project says cuts storage by about 97% without accuracy loss. People use it to run private retrieval-augmented generation (RAG) on their own laptop without sending data to a cloud service.

  • Index a folder of PDFs, text, and markdown files and search them by meaning
  • Give a coding agent semantic search over a codebase via the MCP integration
  • Search exported chat histories such as ChatGPT or Claude conversations
  • Connect an LLM framework like LangChain or LlamaIndex to a local index

Great for

  • Developers building a private RAG prototype on a personal machine
  • People who want to semantically search their own files or notes locally
  • Users of coding agents who want semantic code search through an MCP service
  • Anyone with a large document collection who is short on disk space

Not ideal for

  • Teams needing a hosted, multi-user database, since the README centres on a personal, single-device setup
  • Users who need GPU acceleration now, as the README says it is only being considered based on survey votes
  • People who want a polished end-user app with no command line, since setup uses uv and Python tooling
Step-by-step guide: how to use LEANNInstall, first run, examples, tips and FAQs

How to get it

  1. 1

    Install with a package manager

    You'll need: Python 3.10 or newer (3.10 through 3.14 listed in README badges) · uv package manager

    Install uv

    curl -LsSf https://astral.sh/uv/install.sh | sh

    Clone the repository

    git clone https://github.com/StarTrail-org/LEANN.git leann

    Create and activate a virtual environment

    uv venv && source .venv/bin/activate

    Install LEANN from PyPI

    uv pip install leann
  2. 2

    Run it

    • Install uv and clone the repository as shown in the README
    • Create a virtual environment and activate it
    • Install the leann package from PyPI
    • Run the examples included in the cloned repository to see a first search
  3. 3

    Get the most out of it

    • Use the packages/leann-mcp service to connect LEANN to Claude Code for semantic code search
    • Follow the Linux note and set UV_LINK_MODE=copy if leann build fails with a security violation error
    • Build from source with the diskann extra if you need the DiskANN backend on macOS or Linux
    • Review the benchmark and configuration docs linked in the README to tune for your data

Downloads

Strengths

  • Keeps data on the local machine, with no cloud dependency described in the README
  • Claims large storage savings, with a benchmark example of 60M chunks in 6GB versus 201GB
  • Works with common tooling including Ollama, LangChain, and LlamaIndex, per the repository topics

Trade-offs

  • Setup involves Python version requirements, uv, and optional build steps for DiskANN that can be fiddly on Linux and macOS
  • Some README sections are truncated here, so the full feature set and configuration are not verified
  • Accuracy and storage claims come from the project and its paper; independent verification was not part of this review

How it compares

ProjectStarsTypeLevelUpdatedBest for
LEANN (this)13.8kLibraryintermediate5 days agoDevelopers building a private RAG prototype on a personal machine
llama_index52.8kLibraryintermediate11 days agoPython developers building retrieval-augmented generation (RAG) apps over private documents
faiss41.2kLibraryintermediate5 days agoDevelopers building semantic search or recommendation features over embedding vectors
LightRAG40.5kLibraryintermediate8 days agoDevelopers building question-answering over their own document collections
PageIndex40kLibraryintermediate8 days agoDevelopers building question-answering over long PDFs such as annual reports or manuals
turbovec17.5kLibraryintermediate30 days agoPython or Rust developers building semantic search over a few million or fewer embeddings on a single machine

Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.