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

Install

Install in one line

One binary: no Node.js, no Python. The installer checks the download against the npm registry and adds lib2027 to your PATH.

Windows (PowerShell)

irm https://lib2027.dev/install.ps1 | iex

macOS and Linux

curl -fsSL https://lib2027.dev/install.sh | sh

Or with Node.js

npx lib2027

Nothing to install: npx lib2027 runs the same binary.

Then run the setup

lib2027 setup

lib2027 setup picks your GPU or CPU and downloads the models, offers ready-made libraries and connects Claude Code, pi, Cursor or Claude Desktop.

Ready-made libraries

lib2027 install

Built, verified and licensed for reuse — UK, Italian and Russian law to start with. lib2027 install opens a picker; search and agents see a library right away.

Update with lib2027 update, remove with lib2027 uninstall.

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%¹

UK legislation (15 Acts, legislation.gov.uk)

150 questions · qwen3.8-27b
No library36.7%
Placebo29.3%
With lib202790.9%

UK legislation, small model

150 questions · 4B
No library28.4%
Placebo5.1%
With lib202788.2%

Italian law (11 codes and laws, Normattiva)

150 questions · qwen3.8-27b
No library11.8%
Placebo4.2%
With lib202782.4%

Italian law, small model

150 questions · 4B
No library5.6%
Placebo3.3%
With lib202770.2%

German federal law (20 statutes, gesetze-im-internet.de)

150 questions · qwen3.8-27b
No library21.3%
Placebo16.4%
With lib202788%

German law, small model

150 questions · 4B
No library16.7%
Placebo2.2%
With lib202786.4%

French law (Constitution and 9 codes, Légifrance)

150 questions · qwen3.8-27b
No library18.7%
Placebo9.8%
With lib202790.4%

French law, small model

150 questions · 4B
No library12.9%
Placebo3.8%
With lib202785.8%

Spanish law (Constitution and 11 laws, BOE)

150 questions · qwen3.8-27b
No library22%
Placebo20.7%
With lib202788.4%

Spanish law, small model

150 questions · 4B
No library9.3%
Placebo3.3%
With lib202783.3%

EU legislation (EUR-Lex)

150 questions · 4B
No library18.7%
Placebo1.1%
With lib202781.3%

US federal law (U.S. Code, CFR)

150 questions · 4B
No library16.2%
Placebo4.4%
With lib202782.7%

Canadian federal law

150 questions · 4B
No library17.8%
Placebo4.4%
With lib202784.4%

Australian federal law

150 questions · 4B
No library10.7%
Placebo4.7%
With lib202784.7%

Ukrainian law

150 questions · 4B
No library7.6%
Placebo0.9%
With lib202784.7%

Belarusian law

150 questions · 4B
No library13.3%
Placebo3.1%
With lib202791.1%

Polish law

150 questions · 4B
No library14.6%
Placebo9.2%
With lib202788.5%

Dutch law

150 questions · 4B
No library9.8%
Placebo0.2%
With lib202791.3%

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%¹
UK legislation (15 Acts, legislation.gov.uk)
150 questions · qwen3.8-27b
qwen3.8-27b36.7%29.3%90.9%
UK legislation, small model
150 questions · 4B
4B28.4%5.1%88.2%
Italian law (11 codes and laws, Normattiva)
150 questions · qwen3.8-27b
qwen3.8-27b11.8%4.2%82.4%
Italian law, small model
150 questions · 4B
4B5.6%3.3%70.2%
German federal law (20 statutes, gesetze-im-internet.de)
150 questions · qwen3.8-27b
qwen3.8-27b21.3%16.4%88%
German law, small model
150 questions · 4B
4B16.7%2.2%86.4%
French law (Constitution and 9 codes, Légifrance)
150 questions · qwen3.8-27b
qwen3.8-27b18.7%9.8%90.4%
French law, small model
150 questions · 4B
4B12.9%3.8%85.8%
Spanish law (Constitution and 11 laws, BOE)
150 questions · qwen3.8-27b
qwen3.8-27b22%20.7%88.4%
Spanish law, small model
150 questions · 4B
4B9.3%3.3%83.3%
EU legislation (EUR-Lex)
150 questions · 4B
4B18.7%1.1%81.3%
US federal law (U.S. Code, CFR)
150 questions · 4B
4B16.2%4.4%82.7%
Canadian federal law
150 questions · 4B
4B17.8%4.4%84.4%
Australian federal law
150 questions · 4B
4B10.7%4.7%84.7%
Ukrainian law
150 questions · 4B
4B7.6%0.9%84.7%
Belarusian law
150 questions · 4B
4B13.3%3.1%91.1%
Polish law
150 questions · 4B
4B14.6%9.2%88.5%
Dutch law
150 questions · 4B
4B9.8%0.2%91.3%
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.

Online, nothing to install

claude mcp add --transport http lib2027 https://mcp.lib2027.dev/mcp

A free hosted MCP server with ready-made libraries: laws, dev and DevOps books, package docs. Pick the libraries on mcp.lib2027.dev — it gives you the URL and configs for Claude Code, Cursor, Claude Desktop and pi. Searches go to lib2027.dev; your own files stay local.

Only the libraries a project needs

npx lib2027 use

Run it inside a project: a settings screen lists the shelf's libraries with live numbers — documents, fragments, knowledge graphs. Check what this project needs and save. The choice goes to .lib2027.json, which you can commit; the agent picks it up on its next call, no restart.

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
install [slug|pattern…] [--list] [--force]Ready-made libraries from the catalogue: a picker, or by name or pattern
use [slug|pattern…] [--add …] [--drop …] [--all]Which libraries the agent sees in this project: a settings screen, or flags for scripts
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
update [--check] / uninstallUpdates lib2027 itself (when installed with the install script)
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