🎁 Get the FREE AI Skills Starter Guide β€” Subscribe β†’
BytesAgainBytesAgain
πŸ¦€ ClawHub

The Librarian

by @rochyroch

Build and search lightweight quantized document indexes with TurboVec. Use when you need to create searchable indexes from documents for RAG applications wit...

Versionv1.0.1
Comments1
⚑ When to Use
TriggerAction
|----------|---------------------|
| Resource-constrained hardware | βœ… Runs on Raspberry Pi, 512MB RAM |
| Personal knowledge base | βœ… Zero infrastructure |
| Embedded/offline deployment | βœ… No cloud, no database |
| 100K+ documents on limited hardware | βœ… Fits where FAISS doesn't |
| Medical/legal records | ❌ Use FAISS instead |
| Maximum accuracy required | ❌ Use FAISS + Flashrank |
**Accuracy:** ~97-98% of FAISS for 4-bit quantization. Top results may occasionally swap ranking.
πŸ’‘ Examples

Prerequisites

# Install BLAS library (required for TurboVec)
sudo apt install libblas3

Create venv and install dependencies

cd /path/to/the-librarian python3 -m venv venv source venv/bin/activate pip install turbovec numpy requests rank-bm25 flashrank

Build an Index

# Using the wrapper (recommended)
./scripts/librarian build /path/to/documents/ index/my_library

With options

./scripts/librarian build /path/to/docs/ index/my_library --bits 3 --chunk-size 800

Direct Python

LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libblas.so.3 \ python scripts/build_index.py --input /path/to/docs/ --output index/my_library

Search

# Pure vector search
./scripts/librarian search "habit formation" index/my_library

Hybrid (vector + BM25)

./scripts/librarian search "habit formation" index/my_library --hybrid

Hybrid + rerank (best accuracy)

./scripts/librarian search "habit formation" index/my_library --hybrid --rerank

With context expansion

./scripts/librarian search "habit formation" index/my_library --hybrid --rerank --expand 1

JSON output

./scripts/librarian search "habit formation" index/my_library --json

βš™οΈ Configuration

# Install BLAS library (required for TurboVec)
sudo apt install libblas3

Create venv and install dependencies

cd /path/to/the-librarian python3 -m venv venv source venv/bin/activate pip install turbovec numpy requests rank-bm25 flashrank

Build an Index

# Using the wrapper (recommended)
./scripts/librarian build /path/to/documents/ index/my_library

With options

./scripts/librarian build /path/to/docs/ index/my_library --bits 3 --chunk-size 800

Direct Python

LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libblas.so.3 \ python scripts/build_index.py --input /path/to/docs/ --output index/my_library

Search

# Pure vector search
./scripts/librarian search "habit formation" index/my_library

Hybrid (vector + BM25)

./scripts/librarian search "habit formation" index/my_library --hybrid

Hybrid + rerank (best accuracy)

./scripts/librarian search "habit formation" index/my_library --hybrid --rerank

With context expansion

./scripts/librarian search "habit formation" index/my_library --hybrid --rerank --expand 1

JSON output

./scripts/librarian search "habit formation" index/my_library --json

View on ClawHub
TERMINAL
clawhub install thelibrarian

πŸ§ͺ Use this skill with your agent

Most visitors already have an agent. Pick your environment, install or copy the workflow, then run the smoke-test prompt above.

πŸ” Can't find the right skill?

Search 60,000+ AI agent skills β€” free, no login needed.

Search Skills β†’