Mithril — Index — The Palantír




Purpose
🔮
BM25 full-text search over the project codebase for context injection into agent
Files
2
LOC
315

Key Concept

Scans the project, builds an inverted index, agents query it to find relevant code without reading every file.

What It Does

Builds a BM25 full-text index of the project's source code. Agents can query it to find relevant files without reading the entire codebase.

How It Works

  1. mithril scan walks the project tree (respects .gitignore)
  2. Each file is tokenized into terms
  3. A BM25 inverted index is built and stored in .mithril/palantir.idx
  4. Agents query with natural language → get ranked file paths

Use Case

When a user asks "fix the authentication bug", the agent searches the index for "auth" → finds src/auth.rs, src/middleware/jwt.rs → reads only the relevant files instead of scanning everything.

FilePurpose
mod.rs
palantir.rs