← Back to Skills Marketplace
carlosdelfino

Calibre Ebooks

by Carlos Delfino · GitHub ↗ · v0.0.3 · MIT-0
cross-platform ⚠ pending
62
Downloads
0
Stars
0
Active Installs
2
Versions
Install in OpenClaw
/install calibre-ebooks
Description
Query and operate the local Calibre library using calibredb and metadata.db. Use when the user asks to list, search, locate, summarize metadata, find availab...
README (SKILL.md)

Calibre E-books

Use this skill to work with the local Calibre library and a semantic RAG base derived from the books.

Configuration

  • Default Calibre library: /mnt/Backup_2/Biblioteca
  • Metadata database: /mnt/Backup_2/Biblioteca/metadata.db
  • Official command: calibredb
  • Read-only metadata script: scripts/calibre_query.py
  • Conversion, indexing, and RAG script: scripts/document_semantic_rag.py
  • Default RAG base: /tmp/openclaw-calibre-rag/data
  • Default converted Markdown: /tmp/openclaw-calibre-rag/converteds
  • Always pass the library directory to calibredb, not the .db file:
calibredb list --library-path "/mnt/Backup_2/Biblioteca"

If calibredb fails due to sandbox, mutex, or Calibre configuration, request elevated permission to repeat the query. For read-only queries, use scripts/calibre_query.py as a SQLite fallback.

Recommended workflow

  1. Understand if the user wants discovery, metadata, exported file, or analysis/RAG.
  2. Start with read-only operations: list, search, show_metadata, or scripts/calibre_query.py.
  3. Confirm the correct id before exporting, changing metadata, adding, or removing anything.
  4. Prefer exporting to /tmp/openclaw-calibre-export when the user requests file access.
  5. For RAG, index the file or Calibre id with document_semantic_rag.py, then search with --search.
  6. Never use destructive commands (remove, remove_format, set_metadata, set_custom, restore_database) without explicit request.

Useful calibredb commands

List books:

calibredb list --library-path "/mnt/Backup_2/Biblioteca" --fields id,title,authors,formats --limit 20

Search by term:

calibredb search --library-path "/mnt/Backup_2/Biblioteca" "python"

View complete metadata of a book:

calibredb show_metadata --library-path "/mnt/Backup_2/Biblioteca" 123

Export a book to a temporary directory:

mkdir -p /tmp/openclaw-calibre-export
calibredb export --library-path "/mnt/Backup_2/Biblioteca" --to-dir /tmp/openclaw-calibre-export 123

Use full-text search if the index exists:

calibredb fts_search --library-path "/mnt/Backup_2/Biblioteca" "searched term"

SQLite read-only fallback

Use the script when you only need to query metadata.db without depending on the Calibre process:

python3 skills/calibre-ebooks/scripts/calibre_query.py list --limit 20
python3 skills/calibre-ebooks/scripts/calibre_query.py search "python" --limit 10
python3 skills/calibre-ebooks/scripts/calibre_query.py metadata 123
python3 skills/calibre-ebooks/scripts/calibre_query.py path 123 --format PDF

The script returns JSON by default and does not write to the library.

Conversion and RAG services

Before converting or searching semantically, check dependencies:

python3 skills/calibre-ebooks/scripts/document_semantic_rag.py --check --json

If Python dependencies are missing, install the RAG set:

pip install -r skills/calibre-ebooks/scripts/requirements-rag.txt

Index a book directly by Calibre ID:

python3 skills/calibre-ebooks/scripts/document_semantic_rag.py --calibre-id 123 --format PDF --json

Index an exported or resolved file:

python3 skills/calibre-ebooks/scripts/document_semantic_rag.py --convert "/path/book.pdf" --json

Index all supported documents in a folder:

python3 skills/calibre-ebooks/scripts/document_semantic_rag.py --convert-all "/path/folder"

Search in the RAG base:

python3 skills/calibre-ebooks/scripts/document_semantic_rag.py --search "convolutional neural networks" --json

List or check base status:

python3 skills/calibre-ebooks/scripts/document_semantic_rag.py --list --json
python3 skills/calibre-ebooks/scripts/document_semantic_rag.py --status --json

Removing a book from the RAG base requires the internal ID returned during indexing/listing, not the Calibre ID:

python3 skills/calibre-ebooks/scripts/document_semantic_rag.py --delete RAG_BOOK_ID --json

RAG strategy

  • Convert PDF to Markdown with PyMuPDF.
  • Convert EPUB to Markdown with ebooklib, BeautifulSoup, and markdownify.
  • Convert DjVu via OCR when external dependencies are available.
  • Split text into chunks with configurable overlap.
  • Generate embeddings via Ollama (OLLAMA_MODEL, skill default: nomic-embed-text-v2-moe).
  • Store metadata and chunks in SQLite.
  • Store embeddings in ChromaDB.
  • Hybrid search: exact/partial text in SQLite first, semantic search in ChromaDB after.

RAG configuration

The script reads skills/calibre-ebooks/.env and accepts CLI override:

python3 skills/calibre-ebooks/scripts/document_semantic_rag.py --status --data-dir /tmp/my-base --converted-dir /tmp/my-markdowns
python3 skills/calibre-ebooks/scripts/document_semantic_rag.py --search "term" --embedding-model nomic-embed-text-v2-moe

If a base was already created with another embedding model, use the same previous model. Only use --allow-model-mismatch when accepting potentially incorrect results.

User responses

  • Show id, title, authors, and formats when there are multiple results.
  • Inform when a book lacks PDF/EPUB before promising analysis or delivery.
  • When preparing RAG, first locate the book via calibre_query.py, confirm available format, then use document_semantic_rag.py --calibre-id.
  • For RAG-based responses, cite document, page, similarity, and relevant excerpt.
  • If the library is inaccessible, cite the tested path and relevant error.
  • If --check points to missing dependencies, inform exactly which ones are missing before attempting to index.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install calibre-ebooks
  3. After installation, invoke the skill by name or use /calibre-ebooks
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v0.0.3
- Added instructions for using the new --convert-all option in document_semantic_rag.py to index all supported documents in a folder. - Updated example CLI commands to include --convert-all usage. - No changes to functionality—documentation clarification and enhancement only.
v0.0.2
- Expanded and clarified the skill documentation, covering Calibre library operations, recommended workflows, and RAG integration. - Outlined usage of calibredb and Python scripts for read-only metadata queries, exporting, conversion, and semantic search. - Added explicit command examples for listing, searching, exporting, and metadata inspection. - Documented fallback behaviors, requirements, and user response guidelines to ensure reliability and transparency. - Provided detailed instructions for semantic RAG indexing, searching, and managing dependencies.
Metadata
Slug calibre-ebooks
Version 0.0.3
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 2
Frequently Asked Questions

What is Calibre Ebooks?

Query and operate the local Calibre library using calibredb and metadata.db. Use when the user asks to list, search, locate, summarize metadata, find availab... It is an AI Agent Skill for Claude Code / OpenClaw, with 62 downloads so far.

How do I install Calibre Ebooks?

Run "/install calibre-ebooks" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Calibre Ebooks free?

Yes, Calibre Ebooks is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does Calibre Ebooks support?

Calibre Ebooks is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Calibre Ebooks?

It is built and maintained by Carlos Delfino (@carlosdelfino); the current version is v0.0.3.

💬 Comments