Skip to content
.dev
cs

IMAP triage

Sorting company mail and drafting replies

In the morning it is clear what is on fire. The agent sorts the NOC, CSIRT, billing and sales mailboxes and drafts replies to selected messages. It cannot send them.

local, drafts also cloud

The problem

Operational mailboxes receive dozens of messages a day: alerts, incident reports, invoices, enquiries. An important message gets lost among automated notifications, and a reply to a routine question waits until someone gets to it.

How it works

  1. 1

    Find new messages

    Searches IMAP for messages it has not processed yet. Its own IMAP client over TLS, no PHP extension needed.

  2. 2

    Deterministic pre-filter

    The spam score, the List-Unsubscribe header and known senders file a large part of the mail without a model.

  3. 3

    First pass with a local model

    A cheap local model sets the category and writes a summary. The output is JSON against a schema, not free text.

  4. 4

    Second pass for selected categories

    Messages that matter get a more careful second pass, and a draft reply is created if the mailbox’s rule says so.

  5. 5

    Label and draft in the mailbox

    The message gets an IMAP label and the draft goes to Drafts. A person always sends it.

  6. 6

    Run summary

    An overview of what arrived and what is urgent goes to the mailbox or a Mattermost channel.

Guardrails

  • The service has no access to sending mail. It physically cannot send an e-mail, only save a draft.
  • The message content enters the prompt fenced off as untrusted data.
  • Double duplicate check: local state and an IMAP label. Saving a draft is never retried automatically.
  • The summary is stripped of formatting, mentions and line breaks, so it cannot tag anyone or become its own input.
  • For incident reports, drafts are deliberately not prepared.
  • Dry-run mode and a message limit for first runs.

The model’s confidence is useless; it almost always reports 1.00. So the second pass is triggered by category, not by how sure the model is.

No-obligation consultation

Let’s find the first job for AI in your company.

An hour’s conversation about where your data lives, which processes slow you down and what of it may leave your network. You leave with a proposal for a first pilot, not a tool demo.

Radek Růžička, Managing Director and CTO, Nux s.r.o.

Built and is accountable for the AI layer at Nux

Radek Růžička

Managing Director and CTO, Nux s.r.o.

Happy to sign an NDA