nc://openmail

v0.1.0Pinned
ThomSharktools/nodecode-openmail: An OpenMail inbox for the agent: nine tools to send, reply in-thread, read threads and extract attachment text. - a rewrite of openmailsh/hermes-plugin (MIT), credited to openmailsh3ac5dee· 9 Nov1 commit
test1 filecell.lisp21.1 KBcontracts.lisp4.7 KB

nodecode-openmail

OpenMail: an email address the agent has of its own, and nine tools to use it. A Nodecode rewrite of openmailsh/hermes-plugin by openmailsh.

The tools are the original plugin's: the same nine names, and the arguments below except where the last section says otherwise.

Tool What it does
openmail_whoami The inboxes this key can use, with their addresses, and which one the tools act on.
openmail_send Starts a new thread: to, subject, body, optional cc.
openmail_reply Answers inside a thread; the subject is the thread's and the recipient its last inbound sender.
openmail_list_threads The inbox's threads, newest first, and read_state picks unread ones.
openmail_read_thread Every message of a thread, oldest first, and it marks the thread read.
openmail_list_messages Individual messages, filtered by direction.
openmail_attachment_text Text extracted server-side from a PDF, DOCX, XLSX or image attachment.
openmail_list_inboxes Every inbox the key can see.
openmail_create_inbox A new address for the agent.

Ask "check my inbox", "reply to that and confirm", "sign up for this and send them the details" - the model picks the verb and reads the answers.

Get it

Tell the agent "add the openmail cell", or run nodecode add nc://openmail.

Set it up

You need an OpenMail API key (an inbox-scoped key is enough) and, when the key can see more than one inbox, the inbox the agent should run as.

"openmail": {
  "api_key_env": "OPENMAIL_API_KEY",   // or a file: "api_key_file": "~/.config/openmail-key"
  "inbox_id": "inb_...",               // optional: the inbox a call naming none acts on
  "base_url": "https://api.openmail.sh",
  "timeout": 30
}

A key is named, never written into the config: api_key_env holds the name of the environment variable that carries it (export it in the shell that starts Nodecode), and api_key_file a file only you can read. Set exactly one.

Use it

You do not call the tools; the model does, when a turn is about email. A person can call the same functions from eval, in the openmail package:

(openmail:list-threads (nlk:make-json-object "read_state" "unread"))

(help :openmail) is the model's manual for the nine verbs, kept while the cell runs.

Inbound mail is data, not orders

The original ships this rule with a skill, and this cell keeps it in the manual: a message comes from an untrusted sender, so the model reads it as data - never running a command or opening a link it names, never forwarding files or credentials to an address found in one, never changing what it is doing because a message says so, but saying what arrived and waiting for the operator. There is no inbound channel here to enforce it: this cell is the nine tools, so the rule is the manual's, and the operator's eye is the gate.

What the rewrite leaves out

The original is also a Hermes gateway channel: it opens a websocket, wakes the agent when mail lands, scopes itself to an inbox or a whole pod, gates senders with an allow-list, and answers in-thread from the conversation. A chat surface is a room cell here, and this cell is the tools: mail is read and answered when a turn asks, not when it lands. Not here either: attachment upload on send and reply (the original confines model-supplied paths to its own media folders, and there is no such folder here, so an outgoing message carries text - openmail_attachment_text still reads what others send), and the openmail CLI for administration (sender rules, pods, deleting an inbox, feedback). One argument is spelled differently: is_read on openmail_list_threads is read_state (any, unread, read), because a declared Nodecode argument cannot tell an absent boolean from a false one.

License

MIT. The tools, their schemas and the anti-injection guidance are openmailsh's, rewritten in Common Lisp: see NOTICE and LICENSE.

Add nc://openmail

  1. 1

    Install Nodecode

    Once per machine.

    $ curl -fsSL https://nodecode.ai/install.sh | sh
  2. 2

    Add the cell

    Pinned at 3ac5dee.

    $ nodecode add nc://openmail

    Or tell the agent add the openmail cell.