LEANN CLAUDE.md

LEANN CLAUDE.md is an instructions file for coding agents 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

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 · 12,889 stars · on GitHub

Install

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.

agentmods
npx agentmods add instructions/startrail-org/leann/claude-md
Clone the repo
git clone --depth 1 https://github.com/StarTrail-org/LEANN

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.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.svg" alt="Measured on agentmods" 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. Scan, not verified.
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 $0.02437 $0.02437
Opus 5 $0.01218 $0.01218
Sonnet 5 $0.00487 $0.00487
Haiku 4.5 $0.00244 $0.00244

Measured 5d ago against content hash f1c3c44bf789, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, 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 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
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. 5d 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 (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.