Getting Started
Build your first RAG library in under 60 seconds
Libragen (pronounced “LIB-ruh-jen”) lets you create portable, searchable RAG libraries from any documentation. Libraries are single SQLite files you can share, version control, and query locally—no cloud services required.
Try it now: This documentation is available as a libragen library. Download libragen-docs-0.3.0.libragen and query it locally!
Quick Start
1. Build a Library
Create a library from a directory of markdown, text, or HTML files:
libragen build ./my-docs --name my-libraryThis will:
- Process all supported files in
./my-docs - Generate embeddings using a local model
- Build a full-text search index
- Save everything to
my-library-1.0.0.libragen
2. Query Your Library
Search with natural language:
libragen query --library my-library "How do I authenticate?"Results include relevance scores and source file information.
3. Use with MCP (Optional)
Install the MCP server for your AI tool with one command:
npx -y install-mcp @libragen/mcpThis automatically configures Claude Desktop, Cursor, Windsurf, or other MCP-compatible tools. Your AI assistant can now query your libraries directly.
Installation Options
Use Without Installing
The easiest way to use libragen is with npx:
# Buildlibragen build ./docs --name my-docs
# Querylibragen query --library my-docs "your question"Global Installation
For frequent use, install globally:
npm install -g @libragen/cli
# Now use without npxlibragen build ./docs --name my-docslibragen query --library my-docs "your question"Enable shell completions for tab-completion of commands and options:
libragen completions installAs a Project Dependency
For programmatic use in your project:
npm install --save-exact @libragen/coreLibrary Storage
Libraries are stored and discovered from multiple locations:
Default Installation Location
By default, all installed .libragen files go to the global directory:
| Platform | Global Path |
|---|---|
| macOS | ~/Library/Application Support/libragen/libraries/ |
| Linux | ~/.local/share/libragen/libraries/ |
| Windows | %APPDATA%\libragen\libraries\ |
You can override the global directory with the LIBRAGEN_HOME environment variable:
export LIBRAGEN_HOME=/custom/pathLibrary Discovery
When searching for libraries (e.g., libragen list, libragen query), libragen looks in:
- Project directory — If
.libragen/libraries/exists in the current directory, it’s searched first - Global directory —
$LIBRAGEN_HOME/libraries(always included)
Project-Local Libraries
To install a library to a local directory instead of the global directory, use the -p flag (it automatically appends .libragen/libraries):
# Install to ./my-project/.libragen/librarieslibragen install ./my-lib.libragen -p ./my-projectThis is useful for:
- Project-specific documentation
- Version-controlled library sets
- CI/CD environments
Environment Variables
Override the global directory with LIBRAGEN_HOME:
export LIBRAGEN_HOME=/custom/pathRun libragen config to see current paths and active environment variables.
Next Steps
- CLI Reference - Full command documentation
- Building Libraries - Advanced build options
- CI Integration - Automate builds in your pipeline
- MCP Integration - Connect to AI tools
- Collections - Install curated library bundles
- Troubleshooting - Solutions to common issues