All notes

When my email filters couldn't keep up

How I use locally hosted models, encrypted requests, and richer Thunderbird rules to file changing email.

  • Changing senders and subjects made ordinary mail filters a recurring maintenance job.
  • Nimble classifies messages and decides whether they need attention; GPT-OSS Safeguard screens attempts to manipulate that decision.
  • Clef gets one fallback attempt when the complete request exceeds Nimble’s context limit.
  • Nested rules combine model answers with sender, subject, age, read, and starred conditions before deciding what to file.
  • Email is processed on my own computer or server; requests and replies to the server are encrypted.
On this page

My email filters couldn't keep up. They worked, but the mail they were trying to sort kept changing. Senders used different addresses, and subjects changed from one campaign to the next. Every new variation gave me another rule to maintain.

A retail sale email is a good example. It is legitimate mail, not spam, but I do not need it alongside messages from people or notices that require action. Its address can look almost arbitrary, and the next promotion may use a different subject. Matching those details is a poor way to recognize what the message is.

I built Mail Classifier as a Thunderbird extension so I could write rules about the kind of message I received, while keeping control over what happens to it. All of the models run on hardware I control: either the computer where I read mail or a server I own. My email is not sent to a hosted model provider.

Give the models narrow jobs

The extension first prepares the readable email text. It does not fetch remote content or send attachments to a model. When safety screening is enabled, GPT-OSS Safeguard checks that text for attempts to tell the automated classifier how to behave. A flagged message goes to a Safety Review folder instead of continuing through normal filing.

Nimble is my primary classification model. I give it definitions for categories such as Promotions, Newsletters, Financial records, and Direct correspondence. It returns two constrained answers: the message's primary category and whether it needs my attention. A sale campaign can be a Promotion even when its sender and subject are new. An order receipt from a retailer can be a Financial record instead.

I write the category definitions in ordinary language. Each one can describe what belongs, what does not, and the cases that are easy to confuse. For example, a shopping offer is a Promotion, while a completed purchase is a Financial record. Nimble applies those descriptions to the message instead of relying on a fixed list of senders or trigger words. I can refine a definition as my mail changes without rewriting every filing rule.

Example AI category

Promotions

Optional offers and sales campaigns whose purpose is to persuade me to buy, enroll, or upgrade.

Belongs here

Sale announcements, deals, and optional offers.

Financial records instead

Order confirmations and completed payment receipts.

A shortened example of the editable Promotions definition. The boundary matters more than any particular sender or subject line.

Those answers describe the email. They do not tell Thunderbird which folder to use. The extension validates the answers, then evaluates the rules I wrote.

Why Clef is the fallback

The complete classification request includes the message, my category definitions, and the attention instructions. One real message pushed that request beyond Nimble's input-token limit, even though it fit the extension's message and transport limits.

I did not want to cut off part of the email or quietly drop categories to make it fit. Either choice could change the answer. I use Clef as a fallback for this specific case. When Nimble reports a recognized context-limit error, the extension gives Clef one attempt with the same complete, safety-screened input. Other errors do not trigger the fallback. If classification still cannot be completed, the message stays put for manual handling.

Make the rules as expressive as I need

Owning the filing logic lets me combine the model's answers with familiar mail conditions. A rule can check a category or an attention result alongside a sender address or domain, subject text, message age, read status, or a star. It can require every condition in a group, or any one of them, and groups can sit inside other groups.

For example, I could write a rule like this:

TEXT
Match all:
  Category is Promotions
  Needs attention is No
  Match any:
    Message is read
    Message is older than 3 days
Action: Move to Promotions

That is an illustrative rule, not a list of keywords for each retailer. A new unread promotion can stay in the Inbox for a while, while an older or already read one moves out. Rules run in the order I choose; the first matching rule decides whether to keep the message where it is or move it to a configured folder. If none matches, the extension leaves the message alone.

I can preview proposed moves and run a dry scan before allowing real filing. Those checks matter because a model can be wrong, and a rule can be broader than I intended.

Keep the processing in-house

When the models run on my computer, the extension reaches them locally. When they run on my server, the extension encrypts the complete model request before it leaves Thunderbird and sends it over HTTPS. A small service on my server decrypts the request, passes approved operations to the locally hosted models, and encrypts the response back to the extension.

That extra encryption keeps the email, category instructions, and model answer unreadable to a network observer or intermediary along the route. My server decrypts the request so the locally hosted models can process it. In both setups, classification of the readable email happens only on machines I own.

The result is a filter system I can adjust as my mail changes. Models help me recognize what a message means. Rules express what I want done with it. I still review the behavior, but I no longer have to chase every changing sender and subject to keep my inbox organized and promotional clutter under control.