nkgrep-0.1.0 is not a library.
nkgrep
nkgrep is a ranked code search tool. Given a pattern, it returns the k highest-scoring matches. It combines a trigram index with best-first verification: on plain literal queries it returns exactly the match set of ripgrep, ordered by relevance score.
Install
Or build it yourself (crate stays nkgrep, the binary is nkg):
Quickstart
# index the repo once
# serve it in the background
&
# ask for the 20 best hits
No server? No problem — plain one-shot search works too:
Each hit comes back as one JSON object per line:
Performance
Same-machine medians after one warmup, every match set identical to ripgrep's — read it off the chart:

The bar to clear lives in bench/bench_index.py: gate A (indexed
matches ripgrep exactly), gate B (the index pays for itself on
selective queries), gate C (top-20 answers no slower than a ripgrep
full run).
Learn More
- Bench (
bench/README.md) — full numbers, corpora, and how to re-run everything. - Man (
man/nkg.1) — every flag, exit code, and example (man ./man/nkg.1). - Completions (
completions/) — shell setup for bash, zsh, and fish. - Src (
src/README.md) — architecture and extension points. - Tests (
tests/README.md) — match-set equality contract and fixtures.
License
Apache-2.0 — see LICENSE.