Brian Oktavec
← ProjectsMailForge
Case studyAI / LLMPERSONAL

MailForge

A self-hosted AI email classification and automation system integrated with Fastmail via JMAP.

Problem

Triaging incoming email — deciding what mattered, what could wait, and where it should go — was manual and inconsistent, and getting worse with volume.

Architecture

n8n orchestrates the pipeline against a Fastmail mailbox via the JMAP API: ingest incoming messages, classify them, then take mailbox actions. Classification runs through a locally hosted LLM (Qwen) that determines category, subcategory, importance, whether the message needs action, and the destination folder — combined with a deterministic rule layer rather than relying on the model alone. Processed messages are tracked to prevent duplicate handling on subsequent runs.

What I Built

A JMAP integration with Fastmail for reading and acting on mailbox state.
An n8n workflow orchestrating ingestion, classification, and mailbox actions.
A local LLM (Qwen) classification step producing category, priority, and destination folder.
A deterministic rule layer alongside the LLM step for decisions that should be reliable and inspectable.
Processed-message tracking to prevent duplicate handling.

Engineering Decisions

Local LLM over a hosted API
Email content is sensitive by nature. Cost: relying on a smaller local model's classification accuracy instead of a larger hosted model's.
Deterministic rules plus LLM, not LLM-only
Some classification decisions should be reliable and inspectable rather than purely inferred. Cost: rules need maintaining as mailbox patterns change.
n8n over a custom orchestration service
Faster to iterate on the workflow shape without standing up bespoke infrastructure. Cost: less flexibility than fully custom code for unusual edge cases.

Challenges

Preventing duplicate processing of the same message across pipeline runs.
Tuning classification prompts and rules so triage effort actually goes down instead of just adding another layer of noise to review.

Outcome

Self-hosted and in active daily use.

What I Learned

The deterministic rule layer ends up doing more of the reliability work than the model — the LLM is best spent on the fuzzy middle of the decision, not the whole thing.

Personal · Active