LEANN: Instructions file for Claude Code

CLAUDE.md

LEANN CLAUDE.md is an instructions file for Claude Code from StarTrail-org/LEANN. It costs 2,437 tokens per session, scanned D, original, MIT.

Repository instructions for Claude Code, an AI coding assistant, explaining how to work on LEANN, a lightweight local search system for finding information in documents and other data.

In plain words
What is it for?
Setting up LEANN, installing its dependencies, building it from source, and developing or testing changes across macOS, Linux, and Windows.
Why use it?
It gives the assistant the project context and setup commands needed to make changes without guessing how the repository works.

Instructions file for Claude Code

Written for Claude Code: the file is CLAUDE.md. Also seen: mentions CLAUDE.md; mentions Claude Code.

This is StarTrail-org/LEANN's own configuration. It tells Claude Code how to work on LEANN itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything LEANN configures →

About the project

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.

StarTrail-org/LEANN · 13,775 stars · on GitHub · arxiv.org

Reuse

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.

Copy the file
curl -O https://raw.githubusercontent.com/StarTrail-org/LEANN/main/CLAUDE.md
Clone the repo
git clone --depth 1 https://github.com/StarTrail-org/LEANN

Made for: Claude Code.

Wrote 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.

agentmods badge for LEANN CLAUDE.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/startrail-org/leann/claude-md/github.svg)](https://agentmods.dev/instructions/startrail-org/leann/claude-md)
Your own site
<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.

agentmods 80×15 button for LEANN CLAUDE.md

Your own site · 80×15
<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>
Per session 2,437 This file is loaded in full into every session.
When invoked 2,437 The same file — it is already loaded in full.
Security scan D 3 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce 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

Measured 16d ago against content hash a0da5f98265b, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

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
CLAUDE.md · 215 lines

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, LeannChat
  • react_agent.py: ReActAgent for multi-turn reasoning
  • cli.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

Read the full file on GitHub · 215 lines

Changes

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.

  1. 16d ago Changed a0da5f98265b
  2. 2mo ago First seen · 215 lines · 2,437 tokens per session scan D f1c3c44bf789

Subscribe to this mod's changes

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.

Related

LEANN CLAUDE.md compared with instructions from other repositories

LEANN CLAUDE.md next to 6 instructions from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
LEANN CLAUDE.mdStarTrail-org/LEANNInstructions file14k3d agoMITD2,437Claude Code
vscode buildNext.instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA9,719GitHub Copilot
next.js AGENTS.mdvercel/next.jsInstructions file143ktodayMITA7,461Codex, OpenCode
vscode oss-third-party-notices.instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA5,516GitHub Copilot
langchain AGENTS.mdlangchain-ai/langchainInstructions file149ktodayMITA4,680Codex, OpenCode
vscode copilot-instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA3,093GitHub Copilot
deepseek-harness AGENTS.mddeepseek-ai/deepseek-harnessInstructions file274k2d agoMITA4,313Codex, OpenCode