Setup

Problem

Roughly 140 messages a day across all the addresses, of which perhaps seven matter: a bill with a due date, something from family, a contractor’s quote, a reply in a thread I started. The rest is receipts, newsletters, alerts and sales. The provider’s filters sort by kind of mail, not by what matters to me, and the hosted AI tools that would do better want to read every message on their servers.

Design

Read-only, enforced, tested at the wire. The IMAP client has a whitelist: LOGIN, SELECT/EXAMINE, UID SEARCH, UID FETCH with BODY.PEEK[] (which doesn’t set the Seen flag), LOGOUT. No STORE, COPY, MOVE, EXPUNGE, and no SMTP library imported at all. A test runs the client against a fake server and fails if any other command crosses the socket. The worst bug this program can have is a wrong verdict.

Rules first, model second. Every message gets a floor from header facts before the model sees it:

FactFloor
matches an “always” rule, or is in a thread I wrote in, or is from someone I’ve written to (and not bulk mail)important
addressed to me directly, or a calendar inviteat least maybe
matches a “never” rulefiltered — no model call
fails SPF/DMARCcapped at maybe, with a warning

The model then gets one short call per message — headers, a capped slice of the body, my plain-words policy, and my recent corrections — and answers in a closed schema. It may raise the floor, never lower it. The design accepts telling me too much over hiding something.

How does it know who I’ve written to? It reads the Sent folder headers only — never bodies — to learn my own addresses, my correspondents and my threads.

Three buckets, nothing thrown away. Important (with a summary, to-dos, dates, a draft reply I can copy), Maybe (folded), Filtered (seven days, grouped by sender, a Rescue button). Search covers all three.

Teaching. My policy is a paragraph of plain English I can edit, with history. Every verdict I change is stored as a correction; the last twenty go into the prompt (sender domain, subject and signals — never body text). After two consistent corrections for the same sender, the page proposes an always/never rule, and it applies only when I click yes. Names work too: “anyone named Smith” is one rule.

Pushes. One push per important message once its summary is done: sender and subject in the title, and — once push bodies are kept out of backups — the summary and which of my addresses it was sent to in the body. At most five per cycle, then one “n more”. Between 22:00 and 07:00 they fold into a single morning push. Digests twice a day carry counts only.

The first day

The first run backfilled two weeks: 1,948 messages, all judged. 102 important (96 raised by the model, 6 by the header floor), 200 maybe, 1,646 filtered. Every message from a family member and from the two businesses I’d named landed in Important.

The miss was in the other direction: the “addressed to you directly” floor lifted about 190 automated messages into Maybe, because plenty of robots address you by name. That’s the right failure — a Maybe is cheap to skim — and the levers are the strictness setting (I moved from conservative to balanced), the policy text, and demoting a few senders, which the rule proposals then make permanent.

Making it stick

Gotchas

If you build one, the second prompt at the bottom of the email guide is the brief I’d start from.