← 返回 Skills 市场
carlosdelfino

Calibre Ebooks

作者 Carlos Delfino · GitHub ↗ · v0.0.3 · MIT-0
cross-platform ⚠ pending
62
总下载
0
收藏
0
当前安装
2
版本数
在 OpenClaw 中安装
/install 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...
使用说明 (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.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install calibre-ebooks
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /calibre-ebooks 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
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.
元数据
Slug calibre-ebooks
版本 0.0.3
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 2
常见问题

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。

💬 留言讨论