All plugins

offline-mail

Lets 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.

nftpoetristToolsv0.1.0Updated 1 day ago

About

Lets 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.

hermes-offline-mail

A Hermes Agent plugin that lets the agent search and
read mail archives on your own machine, without signing in to any mail account and without
internet access. It reads the two formats mail programs keep mail in:

  • mbox: one file per folder, each message starting with a From line. Thunderbird keeps every
    local and IMAP folder this way (by default), Google Takeout exports Gmail as one .mbox file, and
    mailing-list archives (GNU's, Mailman's) are published as mbox.
  • Maildir: one file per message in a folder's cur/ and new/ directories. mutt and NeoMutt,
    mbsync (isync), OfflineIMAP, getmail and Dovecot use it.

Useful for questions about old mail ("what did the landlord say about the deposit in 2019?"), for a
Gmail export you no longer keep online, or for a mailing-list archive you downloaded, without giving
the agent access to a live mailbox.

The plugin uses Python's standard library only (email, html.parser). It is read-only: it never
sends, moves, deletes or marks mail.

Tools

ToolWhat it does
mail_foldersLists the configured folders: id, format (mbox or maildir) and number of messages.
mail_searchSearches the messages. Every word of query (or "quoted phrase") must appear in the subject, the sender or recipient names and addresses, or the message text; case and accents are ignored (goncalves finds Gonçalves). Filters: folder (a folder or every folder below it), sender, recipient (To or Cc), since and until (YYYY-MM-DD), message_id. Returns the newest matches first, each with folder, id, date, from, to, subject, a snippet around the match, and Gmail labels when the archive has them.
mail_readReads one message: from, to, cc, date, subject, Message-ID, In-Reply-To, Gmail labels or Maildir flags (seen, replied, ...), the text (the plain-text part, or the HTML part as text), and the name, type and size of each attachment. Long messages come back in parts (next_offset). To follow a thread, pass a message's in_reply_to to mail_search as message_id.

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

Install

hermes plugins install offline-mail --enable

No dependencies.

Configure

plugins:
  entries:
    offline-mail:
      settings:
        paths:               # mbox files, Maildir folders, or folders holding them
          - ~/Library/Thunderbird/Profiles/abcd1234.default-release/Mail
          - ~/Library/Thunderbird/Profiles/abcd1234.default-release/ImapMail
          - ~/Downloads/Takeout/Mail
          - ~/Mail                       # mbsync / mutt Maildirs
        max_chars: 12000     # optional; characters of message text per mail_read call (1000-100000)

A configured mbox file or Maildir is one folder. Any other folder is scanned, up to 8 levels deep and
without following symlinks, for mbox files and Maildirs. Their ids are the configured folder's name
followed by the path inside it, written the way the mail program shows it: Thunderbird's
Local Folders/Inbox.sbd/Lists file is the folder Mail/Local Folders/Inbox/Lists. Thunderbird's
.msf summary files are skipped, and an empty folder (an empty file next to its .msf) is listed with
no messages. Missing paths, and folders with no mail in them, are reported under problems.

Where the files are:

  • Thunderbird: the Mail (local folders) and ImapMail (offline copies of IMAP folders)
    folders of your profile. Help → Troubleshooting Information → Profile Folder opens it. IMAP
    folders are only there if Thunderbird keeps messages for offline use (the default for most
    accounts).
  • Google Takeout: choose Mail at https://takeout.google.com; the download holds
    Takeout/Mail/All mail Including Spam and Trash.mbox.
  • mutt, NeoMutt, mbsync, OfflineIMAP: the Maildir root from your configuration, often ~/Mail
    or ~/.mail.

What it does on your machine (disclosure)

  • Reads only the paths you configure, and only the mail files in them. Your mail is personal
    data: what the agent reads goes to the model provider you use, like anything else in a
    conversation. Configure only the folders you want the agent to see.
  • Writes nothing. Files are opened read-only; nothing is renamed, moved or locked. Reading a
    message in a Maildir does not mark it as seen (that would rename the file). The tests check that
    no file's bytes, size or modification time and no file name changes while all three tools run.
  • No network, no credentials, no shell commands, no background work. The test suite refuses to
    open any socket while all three tools run. Nothing is kept between calls, so another Hermes
    profile never sees this profile's folders.
  • Message text is written by its senders. It is returned as it is (HTML reduced to text, scripts
    and styles removed) and may contain instructions aimed at an assistant. The tool description
    tells the model to treat it as content, not as requests from you.

Limits

  • Each search reads the folders it covers in full; nothing is indexed. On a recent Mac about 2,000
    messages a second are searched, so a 50,000-message Takeout export takes about 25 seconds. A
    search stops after 60 seconds and says how far it got; folder, since/until and sender
    make searches faster.
  • Messages over 25 MB (usually large attachments) are matched on their headers only.
  • Attachments are listed (name, type, size) but their content is not read.
  • An mbox message id is its position in the file. If a mail program rewrites the file (compacting a
    folder after deleting mail), an id from an earlier search is refused rather than reading another
    message; search again.
  • Encrypted mail (PGP/MIME, S/MIME) is not decrypted, so only its headers are searchable.
  • Not read: Apple Mail's .emlx files, Outlook .pst/.ost files and MMDF mailboxes.

Development

python -m pip install pytest
python -m pytest -c tests/pytest.ini tests
OFFLINE_MAIL_REAL=~/Downloads/Takeout/Mail python -m pytest -c tests/pytest.ini tests -k real_world -s
hermes plugins validate .

The tests build archives the way mail programs lay them out: a Thunderbird profile (extensionless
mbox folders, .msf summaries, .sbd subfolders, an empty folder), a Google Takeout mbox with
X-Gmail-Labels, and Maildirs in both the nested (mbsync) and the Maildir++ (Dovecot) layout,
with CRLF line ends and flags in the file names. The messages carry what real mail has:
quoted-printable and base64 bodies, RFC 2047 encoded headers, unlabelled 8-bit UTF-8 headers, an
HTML-only newsletter with a script, attachments, an unknown charset, a message without a date, a
body line starting with "From" that was never quoted and an mboxrd-quoted >From line.

OFFLINE_MAIL_REAL (one or more paths, separated like PATH) adds a test against real archives:
every message of every folder must read, searching for a message's own subject must find it, and no
file may change. It was run against GNU mailing-list archives (bug-bash, bug-coreutils,
help-gnu-emacs; 4,059 messages, 35 MB) and notmuch's test corpora (LKML, attachments, HTML,
broken, encrypted and protected-header messages; 295 messages).

License

MIT

README from the reviewed commit 18ae0b9; it updates when the author re-pins.

More by nftpoetrist

6 plugins by nftpoetrist in the catalog.

nftpoetristcalibre-libraryLets 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.Communitytools1nftpoetristoffline-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-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