A Local LLM Sorts Your Inbox. One Email Told It What to Answer
BigIron AI
0:00 / 0:00
A Local LLM Sorts Your Inbox. One Email Told It What to Answer
10 просмотров · 3 дн. назад
BigIron AI
15 подписчиков
10 просмотров · 3 дн. назад
A local model can tell a bill from a newsletter, even from a sender it has never seen. But every email is written by someone else, including people trying to manipulate automated systems. The bigiron.cc guide built a small Python script that reads new mail over IMAP and asks a local model for one category from a fixed list, and nothing else: it can only move messages, never send, delete, reply or open links. In the guide's test on 13 synthetic messages with qwen2.5:7b-instruct, it filed 12 correctly at about 3 seconds each. The 13th contained an instruction aimed at the classifier, and the model obeyed it, down to the confidence it was told to report. A one-line header check caught it. This video walks through the design that made that harmless.
What's covered:
• Why a local model, and why email is hostile input
• The design: the model can only pick one of six category words
• Ollama's JSON schema format field: parseable is not the same as correct
• Fetching with BODY.PEEK so triage never marks mail as read
• A custom $Triaged keyword so each message is classified once
• MOVE, or COPY without deleting when the server lacks MOVE
• What the model sees: sender, subject, a header hint, 1,500 characters
• The test: 13 synthetic messages, two per category plus one attack
• The injection that worked, despite a prompt saying to ignore it
• Self-reported confidence: 0.95 on every right answer, 1.00 on the wrong one
• The fix: bulk mail with a List-Unsubscribe header is never personal
• More checks: SPF/DKIM/DMARC results, your contacts, spam score
• Measuring accuracy on 200 of your own labelled messages
• Cost: about five minutes of GPU time for 100 messages a day
• A systemd timer, a week of dry runs, and Sieve for known senders
• Privacy: local model, app password, no logged bodies, narrow actions
⏱️ Chapters
0:00 AI Email Triage
1:09 One Harmless Action
2:45 The Script
4:12 13 Messages, One Attack
5:50 A Check It Can't Argue With
7:12 Running It for Real
📖 The full guide (the complete mailtriage.py script, the systemd service and timer units, Sieve examples and a troubleshooting table):
→ Local LLM Email Triage: Sorting an IMAP Inbox With Ollama, Safely: https://www.bigiron.cc/guides/local-l...
🛠️ Gear (affiliate — same price to you, supports the channel):
• 12 GB-class GPU for a 7B model → https://www.amazon.com/s?k=rtx+3060+1...
• Mini PC for an always-on mail and Ollama box → https://www.amazon.com/s?k=mini+pc+32...
• External drive for mailbox backups → https://www.amazon.com/s?k=external+s...
As an Amazon Associate we earn from qualifying purchases. Affiliate links — same price to you, supports the channel.
👉 Subscribe for self-hosted AI + homelab, with new videos every day.
#LocalAI #Ollama #LLM #Email #IMAP #PromptInjection #SelfHosted #Homelab #Automation #AI