hips — a small search engine for agents
hips is a small Rust search engine that coding agents can use:
point it at a repository (or any pile of documents and PDFs) and it gives
Claude Code, Codex, OpenCode and friends a search tool that answers "where
is this implemented?" with ranked path:line locations, keeps its index
fresh in the background while they edit, and costs them a few lines of
context per query. It ships as a CLI, an MCP server, and a Claude Code
plugin, and needs no service, database, or Python at query time.
Underneath is a full-text search engine written in Rust from scratch —
no Tantivy, Lucene, or any other search-engine crate. It builds an inverted
index and answers top-k queries with BM25 scoring executed by exact
Block-Max WAND, over compressed (delta + bit-packed), memory-mapped
posting lists, with optional document reordering (recursive graph
bisection) for better compression; it scales from a repository to all of
English Wikipedia on a laptop. The code-search layer walks a repository into
declaration-sized chunks that keep their line numbers and adds
CodeRankEmbed vectors for hybrid lexical + semantic retrieval. The
encoder is hips' own NomicBert graph on the ggml tensor library, running on
Vulkan (Linux), Metal (macOS) or the CPU, with CoreML on the Apple Neural
Engine as the fastest option on Apple silicon. Linux and macOS are both
built and tested in CI; an Arch Linux package recipe is included.
JSONL docs ──index──▶ inverted index + block metadata ──search──▶ exact BM25 top-k
(compressed, mmap'd, immutable) (Block-Max WAND)
source tree ──index-repo──▶ segments: postings + FP16 vectors ──search──▶ path:line hits
(gitignore-aware, chunked by declaration) (BM25 + CodeRankEmbed)

The theory and original papers behind every algorithm used here are
documented in docs/THEORY.md.
Status
Small by design: one executable, separately loadable grammar libraries, one
model file, and index caches. Maintainers can package no grammars, a chosen
subset, or all of them; omitted languages download when first indexed, and
the 274 MB encoder GGUF downloads once on the first hybrid index. The
watcher runs only when requested directly or by an agent session. It is in
daily use as the code-search tool this repository itself is developed with.
Benchmarks in this README name their machine: the author's Apple M3 laptop
for the lexical engine and the CoreML numbers, and a Linux workstation
(Ryzen 5800X3D, Radeon RX 9070 XT) for the ggml encoder. Architecture and
usage were reviewed against the working tree on 2026-09-14, when the Candle
encoder was replaced by the ggml engine; historical benchmark numbers are
retained with their original corpus and configuration.
It is not a hosted search service — no clustering, no replication — and the engine
half doubles as a readable, tested walk through how modern lexical search
works end to end: indexing, compression, memory-mapped storage, exact
dynamic pruning, batch updates, benchmarking, and a small HTTP API.
Requirements