Local LLM Email Triage
Inbox triage by a locally hosted model, so no message body ever leaves the machine

Overview
An inbox without priority is a queue in arrival order, where the message that needed an answer today sits under thirty that did not. The usual fix hands every message body to a cloud AI provider, which is a poor trade for private correspondence. This system keeps the judgement local. Seven workflows pull unread mail on a schedule, pass one message at a time to a model running on the same machine, and turn the verdict into labels, a daily digest, and an inbox that can be questioned in plain language.
Approach & Architecture
A scheduled workflow queries a bounded lookback window for unread mail that has not been processed yet, then sends one message at a time to a local model pinned to JSON mode. The model returns a summary, an importance score, an urgency level, whether a reply is required, and whether the message is a genuine opportunity. A deterministic guard re-scores the opportunity flag before anything is applied. Label IDs resolve live from the account, archive and mark-read actions sit behind config flags, and every analysed message is appended to a log the digest workflow reads.
Workflow Topology
A condensed view of the real node graph.
Outcome & Impact
Mail arrives sorted: priority, urgency, follow-up, and opportunity labels are already applied, and a single digest covers the last 24 hours. No message body reaches a third-party provider, and no destructive action runs unless its flag is set. Sixty nodes across seven workflows, validated end to end against a live mailbox.
Challenges & Solutions
- Getting reliable structured output from a small local model by pinning JSON mode at the runtime and hand-writing the parsing and repair path rather than depending on a framework parser
- Suppressing false positives, where hype-heavy cold sales read as genuine opportunities, with a deterministic guard that scores sender patterns, unsubscribe text, and discount language before the verdict is trusted
- Guaranteeing exactly-once processing across reruns and two separate pipelines by making a processed label double as the dedup marker, with every search query self-excluding it
- Limiting blast radius on a live mailbox, where continue-on-fail isolates one bad message from the batch, destructive actions sit behind config gates, and archiving never deletes
Key Features
- Scheduled triage over a bounded lookback window, plus a resumable one-time sweep of the historical archive
- Self-hosted model returns strict JSON: summary, importance, urgency, reply-required, and opportunity flags
- Verdicts become labels for priority, urgency, follow-up, and three opportunity categories
- Deterministic guard downgrades the cold sales a small model over-flags as genuine opportunities
- Archive and mark-read gated behind config flags, and archiving only removes the inbox label
- Daily digest composed from an on-disk log of everything analysed in the previous 24 hours
- Webhook workflow answers free-text questions over a mailbox search and cites the message behind each fact
Tech Stack
Automation
- Platform
- n8n
- Workflows
- 7
- Nodes
- 60
- Triggers
- Schedule, Webhook, Sub-workflow