Skip to main content

lorme

Tests

LORME — Local Offline Retrieval & MCP Engine

An MCP server for semantic search over your local documents. Preprocesses, indexes, and serves any format — PDF, HTML, DOCX, markdown, and more. No cloud, no external database — just a single .db file on your workstation.

What it does

  • Preprocesses source documents in any format (PDF, HTML, DOCX, PPTX, XLSX, EPUB, images, audio, video, CSV, JSON, XML, markdown) into clean markdown
  • Indexes with vector embeddings and full-text search (hybrid FTS5 + vector with RRF fusion)
  • Serves three MCP tools (search_docs, list_indexed_sources, list_collections) for any MCP client
  • Evaluates retrieval quality with built-in RAG evaluation and parameter optimization
  • Runs locally with automatic GPU/API/CPU fallback for embedding generation

Quickstart

1. Install

git clone https://github.com/romainsc/lorme.git
cd lorme
python -m venv .venv
source .venv/bin/activate
pip install -e ".[parse]"

Install extras by need:

  • pip install -e . — core (markdown only)
  • pip install -e ".[html]" — add HTML support (trafilatura)
  • pip install -e ".[pdf]" — add PDF/DOCX/PPTX support (Docling)
  • pip install -e ".[video]" — add video/audio download from YouTube/platforms (yt-dlp)
  • pip install -e ".[parse]" — all format support
  • pip install -e ".[eval]" — RAG evaluation (RAGAS)

2. Create a config file

# config.yaml
database:
  path: ./lore.db

embedding:
  model: nomic-ai/nomic-embed-text-v2-moe
  mode: builtin    # builtin, builtin:gpu, builtin:cpu, api

chunking:
  chunk_size: 1024
  chunk_overlap: 128

See docs/configuration.md for all options.

3. Create a manifest

# manifest.yaml
collection: my-docs
level: libre

sources:
  - title: Architecture Guide
    license: Apache-2.0
    orig: architecture.pdf

  - title: API Reference
    orig: api-ref.html

  - url: https://example.com/guide.md

The manifest declares sources abstractly. orig is the source file in its native format. path (output filename) is generated automatically.

4. Preprocess and build

# Preprocess: convert + clean sources
lorme preprocess manifest.yaml \
  --config config.yaml \
  --docs-base-dir /path/to/corpus/ \
  --orig-dir orig \
  --prep-dir prep

# Build: index preprocessed sources
lorme build manifest-prep.yaml \
  --config config.yaml \
  --docs-dir /path/to/corpus/prep/ \
  --output-dir /path/to/output/ \
  --skip-optimize

Or combine both in one step:

lorme build manifest.yaml \
  --config config.yaml \
  --docs-dir /path/to/corpus/orig/ \
  --output-dir /path/to/output/ \
  --preprocess --skip-optimize

5. Start the MCP server

lorme --config config.yaml --transport sse
{
  "mcpServers": {
    "lore": {
      "url": "http://localhost:8000/sse"
    }
  }
}

Option B: subprocess (stdio)

{
  "mcpServers": {
    "lore": {
      "command": "/path/to/.venv/bin/lorme",
      "args": ["--config", "/path/to/config.yaml"]
    }
  }
}

6. Use from your MCP client

search_docs("how to configure authentication")
search_docs("deployment", top_k=10, collection="docs-libre")
list_indexed_sources()
list_collections()

Search uses hybrid retrieval (vector + FTS5 full-text) with Reciprocal Rank Fusion for better keyword matching alongside semantic similarity.

CLI commands

Command Purpose
lorme Start MCP server
lorme preprocess Convert and clean sources
lorme build Index sources into .db
lorme lint Analyze source quality
lorme eval Evaluate retrieval quality
lorme optimize Auto-optimize parameters
lorme enrich LLM enrichment (context, Q&A)
lorme state Manage pipeline state (--list, --purge)

All commands accept --config config.yaml.

Architecture

Uses nomic-ai/nomic-embed-text-v2-moe for embeddings (768 dimensions, multilingual, Apache 2.0) and sqlite-vec for vector storage. Hybrid search combines vector KNN with FTS5 full-text via RRF fusion.

Preprocessing uses trafilatura (HTML, Apache 2.0), Docling (PDF/DOCX, MIT), and markitdown (CSV/JSON/XML, MIT).

See docs/architecture.md for the full design.

Roadmap

Done

  • SQLite + sqlite-vec storage with model validation
  • Embedding with GPU/API/CPU fallback
  • MCP server (search_docs, list_indexed_sources, list_collections)
  • Multi-collection support with license classification
  • Preprocessing tool (multi-format parsing, clean, dedup, PII detection, quality gate)
  • LLM enrichment (contextual retrieval, Q&A mode)
  • Hybrid search (FTS5 + vector + RRF fusion)
  • RAG evaluation and parameter optimization
  • Build workflow (manifest + config → optimized .db + metadata)
  • Unified config.yaml (no env vars)
  • MarkdownTextSplitter (structure-aware chunking)
  • Reranking (cross-encoder, granite reranker)
  • Adjacent-chunk / parent-child retrieval
  • End-to-end parameter optimization
  • CI/CD with GitHub Actions
  • Docker image (Containerfile)
  • Audio ingestion (STT via API)
  • Video ingestion (STT + frame extraction, 4 strategies: scene/interval/hybrid/OCR)
  • Video download from YouTube/platforms (yt-dlp, caption download → skip STT)
  • Resumable pipeline with per-phase hash (config change → auto re-run)
  • Configurable enrichment prompts (prompts.yaml, custom overrides)
  • Smart frame captioning filter (OCR before VLM)
  • Graceful shutdown (Ctrl+C → cleanup)
  • 554+ tests (TDD)

Next

  • pip install lorme (PyPI)
  • STT post-correction (LLM fix of transcription errors)
  • Detailed eval report (markdown)

AI-assisted development

This project is developed with AI assistance (Claude, Anthropic). All AI-assisted content is marked with Assisted-by and Co-Authored-By trailers in commits. Every contribution is reviewed, tested, and validated by a human.

See docs/ai-guidelines.md.

License

AGPL-3.0-or-later — see docs/adr/001-license-gpl-v3.md for the rationale.

Copyright (C) 2026 Romain Chantereau

Metadata

Release files for lorme 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lorme 0.1.1
File Size Uploaded Provenance Actions
lorme-0.1.1.tar.gz 1.1 MB Without provenance Details for lorme-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for lorme 0.1.1
File Interpreter ABI Platform Actions
lorme-0.1.1-py3-none-any.whl Python 3 none any Details for lorme-0.1.1-py3-none-any.whl

Total release size: 1.2 MB

Release files / lorme-0.1.1.tar.gz

Download URL lorme-0.1.1.tar.gz
Size 1.1 MB
Tags Source
SHA-256 checksum
How to use checksums
afbefba8643e7afde8b53dbe9388d407375a8c1ea1b753ed1663b53f11b0e523
BLAKE2b-256 checksum
How to use checksums
eeecfc3f8b27f7fdd66b6dd47f61305190cafc3284f62c38d7210639c1fcb311
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.8

Release files / lorme-0.1.1-py3-none-any.whl

Download URL lorme-0.1.1-py3-none-any.whl
Size 130.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
24e0ccaff1157b2ae770dcb4a1eeffdcbe037d29f445117f15115dacc365aeac
BLAKE2b-256 checksum
How to use checksums
5cfeabb61a11662bfa71c4618977f06c958e46baf4063c88d41d5f2c530bfaf9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.8

Security for lorme 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page