LEANN is a local vector database and retrieval system that lets a personal device search documents and other data by meaning rather than exact keywords. It is intended for private, laptop-based retrieval-augmented AI applications, including use with coding agents.
Borrowing it
Nothing to install: this file belongs to StarTrail-org/LEANN. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/StarTrail-org/LEANN/main/CLAUDE.mdgit clone --depth 1 https://github.com/StarTrail-org/LEANNWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/instructions/startrail-org/leann/claude-md)<a href="https://agentmods.dev/instructions/startrail-org/leann/claude-md"><img src="https://agentmods.dev/badge/instructions/startrail-org/leann/claude-md/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/instructions/startrail-org/leann/claude-md"><img src="https://agentmods.dev/badge/instructions/startrail-org/leann/claude-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.02437 | $0.02437 |
| Opus 5.5 | $0.00975 | $0.00975 |
| Sonnet 5.5 | $0.00487 | $0.00487 |
| Haiku 4.5 | $0.00244 | $0.00244 |
Grade D, and why
LEANN CLAUDE.md scanned grade D with 3 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 16d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Asks for rootmediumPrivilege escalation
A mod that escalates privileges can change anything on the machine, not only the project.
sudo apt-get install libomp-dev libboost-all-dev protobuf-compiler \ Downloads and executes remote codehighSupply chain
curl | sh runs whatever the server returns today, which is not necessarily what it returned when this was reviewed.
curl -LsSf https://astral.sh/uv/install.sh | sh Makes network callslowCapability
Not a fault in itself. Listed so you know the mod talks to something, and to what.
curl -LsSf https://astral.sh/uv/install.sh | sh How it starts
The opening of the file, as written. The whole thing — 215 lines — stays where its author put it; the contents beside it link to each section on GitHub.
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Project Overview
LEANN is a lightweight vector database and RAG (Retrieval-Augmented Generation) system that achieves 97% storage reduction compared to traditional vector databases through graph-based selective recomputation. It enables semantic search across various data sources (emails, browser history, chat history, code, documents) on a single laptop without cloud dependencies.
Build & Development Commands
Quick install (pip)
pip install leann
Development setup (from source)
# Install uv first (required package manager)
curl -LsSf https://astral.sh/uv/install.sh | sh
git submodule update --init --recursive
# macOS
brew install libomp boost protobuf zeromq pkgconf
uv sync
# Ubuntu/Debian
sudo apt-get install libomp-dev libboost-all-dev protobuf-compiler \
libabsl-dev libmkl-full-dev libaio-dev libzmq3-dev
uv sync
# Windows (requires VS 2022 Build Tools with C++ workload, vcpkg, chocolatey)
choco install cmake swig pkgconfiglite nuget.commandline -y
vcpkg install zeromq:x64-windows openblas:x64-windows lapack:x64-windows boost-program-options:x64-windows protobuf:x64-windows
# Set CMAKE_PREFIX_PATH, PKG_CONFIG_PATH, OPENBLAS_LIB to vcpkg paths (see README)
uv sync --extra diskann
# Install lint tools
uv sync --group lint
# Install test tools
uv sync --group test
Code Quality
# Format code
ruff format
# Lint with auto-fix
ruff check --fix
# Pre-commit hooks (install once)
pre-commit install
# Run pre-commit manually
uv run pre-commit run --all-files
Architecture
Core API Layer (packages/leann-core/src/leann/)
api.py: Main APIs -LeannBuilder,LeannSearcher,LeannChatreact_agent.py:ReActAgentfor multi-turn reasoningcli.py: CLI implementation (leann build,leann search,leann ask)chat.py: LLM provider integrations (OpenAI, Ollama, HuggingFace, Anthropic)embedding_compute.py: Embedding computation (sentence-transformers, MLX, OpenAI)metadata_filter.py: Search result filtering by metadata
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 16d ago Changed a0da5f98265b
- 2mo ago First seen · 215 lines · 2,437 tokens per session scan D f1c3c44bf789
LEANN CLAUDE.md is an instructions file published in the GitHub repository StarTrail-org/LEANN (13,775 stars, last pushed 3d ago), licensed MIT. It adds 2,437 tokens to every session, about $0.0097 per session on Opus 5.5. A static security scan graded it D with 3 findings (asks for root, downloads and executes remote code, makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
LEANN CLAUDE.md compared with instructions from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| LEANN CLAUDE.mdStarTrail-org/LEANN | Instructions file | 14k | 3d ago | MIT | D | 2,437 | Claude Code |
| vscode buildNext.instructions.mdmicrosoft/vscode | Instructions file | 195k | today | MIT | A | 9,719 | GitHub Copilot |
| next.js AGENTS.mdvercel/next.js | Instructions file | 143k | today | MIT | A | 7,461 | Codex, OpenCode |
| vscode oss-third-party-notices.instructions.mdmicrosoft/vscode | Instructions file | 195k | today | MIT | A | 5,516 | GitHub Copilot |
| langchain AGENTS.mdlangchain-ai/langchain | Instructions file | 149k | today | MIT | A | 4,680 | Codex, OpenCode |
| vscode copilot-instructions.mdmicrosoft/vscode | Instructions file | 195k | today | MIT | A | 3,093 | GitHub Copilot |
| deepseek-harness AGENTS.mddeepseek-ai/deepseek-harness | Instructions file | 274k | 2d ago | MIT | A | 4,313 | Codex, OpenCode |