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.
Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add instructions/startrail-org/leann/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.svg" alt="Measured on agentmods" 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 | $0.02437 | $0.02437 |
| Opus 5 | $0.01218 | $0.01218 |
| Sonnet 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 5d 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.
- 5d 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 (12,889 stars, last pushed today), licensed MIT. It adds 2,437 tokens to every session, about $0.0122 per session on Opus 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.
Other instructions, from other repositories
langchain AGENTS.md
AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.
opik python_sdk.instructions.md
Instructions for comet-ml/opik, covering opik python sdk code review guidelines, 🔧 core architecture principles, three-layer architecture, execution paths and 📋 api design standards.
opik copilot-instructions.md
Copilot instructions for comet-ml/opik, covering copilot code review instructions, project overview, 1. git workflow & branch management, branch naming convention and commit message standards.
opik AGENTS.md
AGENTS.md instructions for comet-ml/opik, covering repository guidelines, scope & inheritance, project structure & module organization, build, test, and development commands and coding style & naming conventions.
LangAlpha AGENTS.md
AGENTS.md instructions for ginlix-ai/LangAlpha, covering langalpha, common commands, architecture, backend (src/) and frontend (web/src/).
MaxKB CLAUDE.md
Claude Code instructions for 1Panel-dev/MaxKB, covering claude.md, project overview, development commands, database / static and architecture.