All plugins

calibre-library

Lets the agent search your calibre e-book libraries and read their EPUB and TXT books, from the metadata.db and book folders calibre leaves on disk; calibre need not be installed or running. calibre_search matches titles, authors, series, tags, publishers and identifiers (ISBN, ASIN, ...) ignoring case and accents, with author, series, tag, format and language filters; calibre_book shows everything calibre records about a book and its files; calibre_read returns an EPUB in reading order with chapter offsets, or a TXT decoded as UTF-8 or Windows-1252, in parts. Standard library only. Not affiliated with calibre. Disclosure — reads only the library folders you configure: metadata.db, opened read-only per call (mode=ro, or immutable=1 for a WAL-mode database, which is refused while its -wal holds changes), and the one book file asked for, which must lie inside the library folder. EPUBs are read in place, never extracted; a package declaring a DTD or entities, a document over 32 MB unpacked or a book over 128 MB is refused. Writes nothing, makes no network calls, needs no credentials and runs no commands. Book text and descriptions are returned to the model as they are, with scripts and styles stripped.

nftpoetrist1Toolsv0.1.0Updated 5 days ago

About

Lets the agent search your calibre e-book libraries and read their EPUB and TXT books, from the metadata.db and book folders calibre leaves on disk; calibre need not be installed or running. calibre_search matches titles, authors, series, tags, publishers and identifiers (ISBN, ASIN, ...) ignoring case and accents, with author, series, tag, format and language filters; calibre_book shows everything calibre records about a book and its files; calibre_read returns an EPUB in reading order with chapter offsets, or a TXT decoded as UTF-8 or Windows-1252, in parts. Standard library only. Not affiliated with calibre. Disclosure — reads only the library folders you configure: metadata.db, opened read-only per call (mode=ro, or immutable=1 for a WAL-mode database, which is refused while its -wal holds changes), and the one book file asked for, which must lie inside the library folder. EPUBs are read in place, never extracted; a package declaring a DTD or entities, a document over 32 MB unpacked or a book over 128 MB is refused. Writes nothing, makes no network calls, needs no credentials and runs no commands. Book text and descriptions are returned to the model as they are, with scripts and styles stripped.

hermes-calibre-library

A Hermes Agent plugin that lets the agent search
your calibre e-book libraries and read their EPUB and TXT books, on
your own machine and without internet access. It reads a library the way calibre leaves it on disk:
the metadata.db database and the Author/Title (id)/ folders beside it. calibre itself does not
need to be installed or running.

Useful for questions like "which of my books are by this author", "what is the third book in this
series", "find the passage about X in my copy of Y", or "summarise chapter 4", answered from the
books you own.

This plugin is not affiliated with calibre or Kovid Goyal. It uses only Python's standard library.

Tools

ToolWhat it does
calibre_searchFinds books. Every word of the query must appear in a book's title, authors, series, tags, publisher or identifiers (ISBN, ASIN, ...). Matching ignores case and accents, so goncalves finds Gonçalves. Filters narrow by author, series, exact tag, file format or language. It can sort by relevance, title, date added or publication date. Each result has the library, book id, title, authors, series and number, tags, formats, languages, publication date and rating in stars.
calibre_bookEverything calibre records about one book: publisher, dates, identifiers, its description as plain text, and each file with format, size, path inside the library, whether it is on disk and whether calibre_read can read it.
calibre_readA book's text from its EPUB (preferred) or TXT file. EPUB documents are joined in reading order with headings marked #. Long books come back in parts (next_offset), and the first part lists where each chapter starts. TXT files are decoded as UTF-8, or as Windows-1252 when they are not valid UTF-8; the result says which.

The tools are offered to the model only while at least one library is configured.

Install

hermes plugins install calibre-library --enable

No dependencies: the plugin uses only the Python standard library (sqlite3, zipfile,
xml.etree, html.parser).

Configure

plugins:
  entries:
    calibre-library:
      settings:
        paths:                       # calibre library folders, each holding a metadata.db
          - "~/Calibre Library"
          - /data/books/Work Library
        max_chars: 12000             # optional; characters per calibre_read call (1000-100000)

Point paths at the folder you chose for the library in calibre, the one that holds
metadata.db. Each library's id is its folder name with spaces
and punctuation turned into _, for example Calibre_Library. With one library configured the
tools need no library argument. Folders without a metadata.db and duplicate ids are reported
under unavailable and do not hide the other libraries.

What it does on your machine (disclosure)

  • Reads only the libraries you configure. In each one it opens metadata.db and, for
    calibre_read, the one book file asked for. A book whose recorded folder leads outside the
    library (for example through ..) is refused, and calibre_book reports it instead of a path.
  • Writes nothing. metadata.db is opened read-only for each call and closed again:
    • calibre keeps the database in rollback-journal mode; both real libraries tested here
      (schema versions 23 and 25) do. In that mode mode=ro writes and creates nothing, and
      holds SQLite's shared read lock only while the call reads. A change calibre is making at
      that moment is therefore seen either whole or not at all: SQLite answers a commit attempted
      during those milliseconds with its usual "database is busy" until the read ends.
    • If a library's database is in WAL mode, plain mode=ro would write the -shm file. It is
      then opened with immutable=1, and refused while its -wal file still holds changes.
    • Nothing is cached between calls. The tests check every connection's open mode, that each one
      is closed, and that no file in any test library changes.
  • No network. The test suite refuses to open any socket while all three tools run.
  • EPUB files are read in place. Nothing is extracted to disk. Only the documents the EPUB's
    package lists are read. A package that declares a DTD or entities is refused (EPUB needs
    neither, and it is how XML entity bombs work). A single document that unpacks to more than
    32 MB, or a book over 128 MB in total, is refused too.
  • No credentials, no shell commands, no background work.
  • Content is your books. Book text and descriptions are returned to the model as they are.
    Scripts and styles are stripped and HTML is reduced to plain text.

Limits

  • Only EPUB and TXT can be read as text. PDF, MOBI, AZW3, CBR and other formats are listed by
    calibre_book but calibre_read declines them.
  • Custom columns are not shown yet.
  • Search covers titles, authors, series, tags, publishers and identifiers, not descriptions or
    the books' full text. Use calibre_read to read a book.
  • EPUB spine documents that are not HTML (for example SVG or image pages) are skipped and counted
    in skipped_documents.
  • Covers are not returned.

Development

python -m pip install pytest
python -m pytest -c tests/pytest.ini tests
CALIBRE_LIBRARY_REAL="$HOME/Calibre Library" python -m pytest -c tests/pytest.ini tests -k real_calibre -s
CALIBRE_REAL_EPUBS=~/epubs python -m pytest -c tests/pytest.ini tests -k real_epub -s
hermes plugins validate .

The tests build calibre libraries with calibre's own table and column names and with values shaped
like a real library's. These include calibre's "no date" value (0101-01-01), an empty series
number, half-star ratings, accented names, a Windows-1252 TXT with CRLF line ends and
multi-chapter EPUB 3 books. They also cover what must be refused: a book folder leading out of
the library, an EPUB declaring entities, a zip bomb, a broken zip and a WAL-mode library with
unsaved changes.

CALIBRE_LIBRARY_REAL (library folders separated like PATH) runs a test against real
libraries. It opens every book, checks that every file the database lists is on disk, reads
every EPUB and TXT to the end, and checks that no file in the library changed.
CALIBRE_REAL_EPUBS runs the EPUB reader over a folder of real .epub files.

License

MIT

README from the reviewed commit 60f11e0; it updates when the author re-pins.

More by nftpoetrist

6 plugins by nftpoetrist in the catalog.

nftpoetristoffline-docsetsLets the agent look up API documentation in docsets on this machine without internet access: the offline format Dash and Zeal use, with an index of every function, class and guide plus the HTML pages (Kapeli's public feeds list about 180, among them Python, Node.js, Bash, SQLite and Vim). docset_list lists the docsets configured under plugins.entries.offline-docsets.settings.paths, docset_search looks entries up by name in Dash's searchIndex or Apple's Core Data index, and docset_read returns a page as plain text starting at the entry's own section, in parts, with in-docset links listed. Standard library only. Not affiliated with Kapeli or Zeal. Disclosure — reads only the docsets you configure, and only pages inside each docset's Documents folder (paths through .., encoded .., absolute paths or symlinks that leave it are refused); opens the SQLite index with mode=ro&immutable=1 so nothing is written, a WAL-mode index's -wal and -shm files included; makes no network calls, needs no credentials and runs no commands. Page text is returned to the model as the documentation's authors wrote it, with scripts and styles stripped.Communitytoolsnftpoetristoffline-mailLets the agent search and read mail archives on this machine without signing in to any mail account: mbox files (Thunderbird's folders, a Google Takeout export of Gmail, mailing-list archives) and Maildir folders (mutt, mbsync, OfflineIMAP, Dovecot). mail_folders lists the folders found under plugins.entries.offline-mail.settings.paths, mail_search finds messages by the words of their subject, names, addresses or text (case and accents ignored) with folder, sender, recipient, date and Message-ID filters, newest first, and mail_read returns a message's headers, text (the plain-text part, or the HTML part as text) and attachment list, in parts. Standard library only. Disclosure — reads only the mail files under the paths you configure, and what the agent reads goes to your model provider like the rest of the conversation; opens files read-only and never sends, moves, deletes or marks mail (a Maildir message is not renamed to seen); makes no network calls, needs no credentials and runs no commands. Message text is returned as its senders wrote it, with HTML scripts and styles removed.Communitytoolsnftpoetristoffline-zimLets the agent search and read ZIM files on this machine without internet access: the open archive format behind Kiwix's offline Wikipedia, Wiktionary, Stack Exchange, Project Gutenberg and other libraries. zim_list_books lists the ZIM files configured under plugins.entries.offline-zim.settings.paths, zim_search uses each archive's full-text index (or its titles when it has none), and zim_read returns an article as plain text in parts, with redirects followed and in-book links listed. Not affiliated with Kiwix or openZIM; reads archives with python-libzim. Disclosure — reads only the ZIM files and folders you configure (folders are listed to find *.zim), makes no network calls, writes nothing, needs no credentials and runs no commands. Article text is returned to the model as the archive's maker wrote it, with scripts and styles stripped. The libzim dependency is GPL-3.0-or-later.Communitytoolsnftpoetristorg-filesLets the agent search and read your Org mode (.org) files and answer from their agenda, without Emacs running. org_files lists the files under plugins.entries.org-files.settings.paths, org_search finds headings by words, TODO keyword (each file's #+TODO, or your own org-todo-keywords), tags (inherited and #+FILETAGS included) and priority, org_agenda returns the entries for a span of days by org-agenda-list's default rules (SCHEDULED, overdue items on today, DEADLINE warnings, appointments, +1w/++1m/.+1d repeaters with Org's month arithmetic, date ranges; blocks, COMMENT and ARCHIVE subtrees skipped), checked against Org's own agenda tests, and org_read returns an entry or a file as Org text with its properties and subheadings. Standard library only. Not affiliated with the Org mode project or GNU Emacs. Disclosure — reads only the .org files under the paths you configure (hidden folders, symlinks and Emacs lock and auto-save files skipped), and what the agent reads goes to your model provider like the rest of the conversation; opens files read-only and writes nothing; makes no network calls, needs no credentials and runs no commands, Emacs included.Communitytools

Developer Mode

Explore built-in Hermes toolsets and actions.

HermesAgent

Developer?

Create a Hermes extension for Desktop or agent workflows.

Developer Section