Calibre Ebooks
/install calibre-ebooks
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.dbfile:
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
- Understand if the user wants discovery, metadata, exported file, or analysis/RAG.
- Start with read-only operations:
list,search,show_metadata, orscripts/calibre_query.py. - Confirm the correct
idbefore exporting, changing metadata, adding, or removing anything. - Prefer exporting to
/tmp/openclaw-calibre-exportwhen the user requests file access. - For RAG, index the file or Calibre
idwithdocument_semantic_rag.py, then search with--search. - 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 usedocument_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
--checkpoints to missing dependencies, inform exactly which ones are missing before attempting to index.
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install calibre-ebooks - 安装完成后,直接呼叫该 Skill 的名称或使用
/calibre-ebooks触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
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... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 62 次。
如何安装 Calibre Ebooks?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install calibre-ebooks」即可一键安装,无需额外配置。
Calibre Ebooks 是免费的吗?
是的,Calibre Ebooks 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
Calibre Ebooks 支持哪些平台?
Calibre Ebooks 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 Calibre Ebooks?
由 Carlos Delfino(@carlosdelfino)开发并维护,当前版本 v0.0.3。