lib2027
English

Free to use · runs on your own machine

A knowledge library on your own files, for you and your AI agents

Drop in a folder of documents and search it three ways at once: by meaning, by word forms in 15 languages, and by exact API names. There is a web UI for you and an MCP server for Claude Code, pi, Cursor and other agents.

  • One Rust binary via npx
  • No Python, no database
  • NVIDIA GPU, DirectML or CPU
# put a folder on the shelf
$ npx lib2027 add ./docs
# open the web UI → http://127.0.0.1:2027
$ npx lib2027

Benchmarks

Does it actually help a model answer?

Models don’t know recent or niche knowledge from memory, and adding more text alone doesn’t fix that. We measured what the right fragments do.

How we measured

Same model, same questions

Each comparison runs one model on one set of questions. The only thing that changes is what the model gets to read.

A placebo arm

Irrelevant text of the same length: a control for the idea that “more context helps”.

Preregistered

Questions, rules and success thresholds were fixed before any data were collected.

Repeated and tested

Each arm ran 3 times. Significance comes from a paired sign test on questions.

Share of correct answers

  • No library
  • Placebo
  • With lib2027
  • No library — the model answers from memory
  • Placebo — irrelevant text of the same length
  • With lib2027 — the fragments lib2027’s search returned

Fresh web docs (devdocs, Sept 2026)

150 questions · qwen3.8-27b
No library17.8%
Placebo12.7%
With lib202785.1%

The same questions, small model

150 questions · 4B
No library9.1%
Placebo0.4%
With lib202783.1%

Russian law (15 codes, pravo.gov.ru)

150 questions · qwen3.8-27b
No library34.7%
Placebo33.8%
With lib202784.4%¹

three.js r186 API quiz

90 answers · Claude Haiku 4.5
No library27.8%
Placebonot measured
With lib202788.9%

¹ The whole law article is returned instead of the first 800 characters (the earlier result was 69.1%). On articles amended since 2024, the model goes from 25% to 81%.

Show the numbers as a table
TaskModelNo libraryPlaceboWith lib2027
Fresh web docs (devdocs, Sept 2026)
150 questions · qwen3.8-27b
qwen3.8-27b17.8%12.7%85.1%
The same questions, small model
150 questions · 4B
4B9.1%0.4%83.1%
Russian law (15 codes, pravo.gov.ru)
150 questions · qwen3.8-27b
qwen3.8-27b34.7%33.8%84.4%¹
three.js r186 API quiz
90 answers · Claude Haiku 4.5
Claude Haiku 4.527.8%—88.9%

Beyond the quiz: three.js with Claude Haiku 4.5

Answers that use an outdated API

24.4%5.6%

fewer is better

“Write a game” task, score out of 100

5275

higher is better

Turns to finish the game

5636

at a slightly lower cost

A library the model has never seen

2–5%84–96%

A 4B model goes from 2–5% to 84–96% of tasks passing when lib2027 delivers migration notes to the task.

The takeaway

Models don’t know recent or niche knowledge from memory, and more context alone doesn’t help: the placebo never beat answering from memory. What helps is the right fragments, and that is what lib2027 delivers.

Speed: Rust vs the earlier Python version

Measured on Windows with an RTX 5090, on the same shelf with the same queries. Both versions return the same results: on the law quiz, both delivered the article for 122 of 150 questions.

  • Python + PyTorch
  • lib2027 (Rust)
Lower is better
Hybrid search, median (GPU)
Python + PyTorch207 ms
lib2027 (Rust)103 ms
Lexical search
Python + PyTorch39 ms
lib2027 (Rust)5 ms
Search on CPU only
Python + PyTorch4.4 s
lib2027 (Rust)1.7 s
743K fragments (devdocs), per query
Python + PyTorch~0.4 s
lib2027 (Rust)0.15 s
MCP server ready for initialize
Python + PyTorch2.6–3.8 s
lib2027 (Rust)< 0.2 s
add ./docs (6 docs, 237 fragments)
Python + PyTorch36.6 s
lib2027 (Rust)8.6 s
Building 15 law codes (16K fragments)
Python + PyTorch169 s
lib2027 (Rust)127 s
Parsing 7,170 files
Python + PyTorch136 s
lib2027 (Rust)4.1 s
Install

Python + PyTorch: Python + PyTorch, about 2.5 GB

lib2027 (Rust): Node.js + a 7 MB binary; the runtime and models are fetched on first run

How it works

Three kinds of search, one ranked answer

Every query runs through three channels at once. The results are merged and re-ranked, and you or your agent get whole passages to read and cite, not scraps.

Meaning

Semantic search with the Qwen3-Embedding-0.6B embedder finds passages that say the same thing in other words.

Word forms

Morphology for Russian, English and 13 more languages: search for one form of a word and find the others.

Exact API names

Function, class and option names are matched exactly, so a name finds that very thing, not something that looks similar.

Reranker

The bge-reranker-v2-m3 cross-encoder reads each candidate together with the query and puts the best ones first.

Whole articles

Structure is kept. Laws are split by articles, and the whole article is delivered: that took the law benchmark from 69.1% to 84.4%.

Formats: md, txt, html, pdf, docx and source code (js, ts, json, …). npx lib2027 package <name> adds a whole npm package: API types, docs, tests and examples.

For agents

Connect it to Claude Code, pi, Cursor and other MCP clients

lib2027 works as an MCP server. One command connects it, and from then on the agent searches your libraries by itself.

Claude Code

npx lib2027 claude

Runs claude mcp add for you. Claude Code gets these tools:

  • search_knowledge
  • read_source
  • list_libraries
  • check_code
  • explore_graph

pi

npx lib2027 pi

Installs the MCP adapter in pi and connects lib2027. npx lib2027 pi --remove disconnects it.

Cursor, Claude Desktop and other clients

Add this to the MCP config:

{ "mcpServers": { "lib2027": { "command": "npx", "args": ["-y", "lib2027", "mcp"] } } }

On Windows, run npx through cmd:

{ "mcpServers": { "lib2027": { "command": "cmd", "args": ["/c", "npx", "-y", "lib2027", "mcp"] } } }

Prefer a browser? npx lib2027 opens the web UI at http://127.0.0.1:2027, with an HTTP API next to it.

Commands

One binary, a handful of commands.

CommandWhat it does
add <folder|files…> [--name …] [--lang auto|ru|en|…] [--to slug]A folder becomes a library; files are added to the given library. Re-running updates changed files.
listLibraries on the shelf
search "query" [-l slug] [--top-k 5]Search
remove <slug> / restore <slug>Hide from search / bring back (files stay on disk)
package <npm-package>[@version]A whole npm package: API types, docs, tests and examples
ui [--port 2027] [--no-open]Web UI and HTTP API (same as running with no command)
mcpMCP server over stdio (started by the agent)
claude [--scope user|project]Runs claude mcp add for you; without Claude Code, prints a config for other clients
pi [--project] [--remove]Installs the MCP adapter in pi and connects lib2027 (or disconnects it)
ask "question"An answer with verified citations (needs a model key: LIB2027_ANSWER_*)
setup [--device cuda|directml|cpu]Installs the runtime and models ahead of time
doctorShows what is installed and what it computes on

Runs where you work

Platforms

PlatformsCUDADirectMLCPU
Windows x64✓✓✓
Windows arm64——✓
Linux x64glibc 2.35+✓—✓
Linux arm64glibc 2.35+——✓
macOS Apple Silicon——✓

Acceleration

NVIDIA CUDA on x64 Windows and Linux, DirectML on x64 Windows. Everything else runs on the CPU.

What you need

Only Node.js 18+. The first run downloads the rest into ~/.lib2027, once, in about 2 minutes: an ONNX runtime for your hardware and two models, Qwen3-Embedding-0.6B and bge-reranker-v2-m3.

Your documents stay on your device

Local by design

Your documents and the shelf stay on your device. Search runs in the binary on your own GPU or CPU.

Nothing sent unless you ask

Text goes to a third party only if you configure an external model for the answer service (LIB2027_ANSWER_*).

Localhost by default

Without LIB2027_API_KEY, the web UI and HTTP API need no key and are reachable from localhost only.

A plain folder

Each library is library.sqlite, vectors.f16 and knowledge.json. Copy the shelf and carry it around.

License

Free to use, including commercially, on any number of devices. Closed source. You may redistribute unmodified packages. The models and ONNX Runtime are downloaded from their publishers under their own licenses.

Read the license on npm

Try it on your own documents

Two commands. Node.js 18+ is all you need.

# put a folder on the shelf
$ npx lib2027 add ./docs
# open the web UI → http://127.0.0.1:2027
$ npx lib2027