The offline-first AI stack
Building a private email processing system with local LLMs, Proton Bridge, and a semi-disconnected architecture that keeps your data on your machine.
Email is the highest-signal personal data source most people have. It contains financial records, medical correspondence, employment history, relationship patterns, and a decade of decisions. Every “AI email assistant” on the market wants to read it on their servers.
I wanted the analysis without the exposure. So I built a local pipeline.
The architecture
The setup has three components: Proton Bridge, Ollama running Qwen3-14B, and a Python script that orchestrates the whole thing.
Proton Mail has no public API. This is a deliberate choice on Proton’s part, and it’s worth understanding the implication. The only programmatic way to access Proton email is through Proton Bridge, which runs on your machine and exposes an IMAP/SMTP interface on localhost. Any automation you write runs locally by definition. There’s no server-side API to call, no OAuth flow to a remote endpoint. The architecture forces locality.
Proton Bridge handles the decryption. Your email arrives encrypted on Proton’s servers, and Bridge decrypts it locally before presenting it over IMAP. So by the time my script reads the email, it’s already on my machine, already decrypted, and Bridge is the only thing that touched the ciphertext.
Ollama serves Qwen3-14B on localhost. The model runs on an RTX 5070 Ti Mobile with 16GB VRAM. At Q4 quantization, Qwen3-14B sits at around 10GB, which fits with room for the KV cache. The Ollama API is OpenAI-compatible, so the Python script talks to it the same way it would talk to any LLM API, just pointed at localhost:11434 instead of api.openai.com.
The semi-disconnected pattern
The part I find most interesting about this architecture is what I call the semi-disconnected pattern. The script runs in three phases.
First, it connects to Proton Bridge over IMAP and downloads the emails I want to process. This is the only phase where the machine is talking to the network, and it’s only talking to localhost (Bridge), which is talking to Proton’s servers over an encrypted connection.
Second, I disconnect from the network entirely. The machine goes offline. Then the script passes the email content to Ollama for analysis. The LLM never touches the network. It can’t. The network is down.
Third, after processing is complete, I reconnect and sync any results I want to keep.
This is more paranoid than strictly necessary. Ollama running locally isn’t going to exfiltrate your data over the network. But the pattern makes the privacy guarantee explicit and verifiable. You don’t have to trust that the local model isn’t phoning home. You can confirm it can’t.
What the script actually does
The practical output is a categorised summary of my inbox. The script pulls emails from the last 48 hours, passes them to Qwen3-14B with a prompt that asks for priority categorisation, action item extraction, and flagging of anything needing a response. The model returns structured JSON. The script writes that to a local file.
No email content leaves the machine. The analysis runs on my hardware, on my schedule. If I want to run it at 2am, it runs at 2am. If I want to run it on a plane with no internet, I can, as long as I downloaded the emails first.
The quality is good enough for triage. Qwen3-14B at Q4 is a capable model. It correctly identifies action items, spots emails that look like they need a reply, and categorises by rough priority. It occasionally miscategorises something, but so does every email client’s built-in filtering. The difference is that when it gets something wrong, I’m not also handing my inbox to a third party.
The tradeoff is real
I’m not going to pretend this is as convenient as Gmail’s AI features or whatever Outlook is doing now. It isn’t. There’s no “always on” processing. I have to run the script manually, or set up a cron job and remember to have Bridge running. There’s no mobile integration. The results live in a text file, not a polished UI.
The tradeoff is: your email analysis runs on your hardware, with no data leaving, and you control every part of the pipeline. For most people, that tradeoff isn’t worth it. For me, with the hardware to run a 14B model locally and the inclination to build things, it is.
Offline-first as a posture
The broader principle here is what I’d call offline-first AI. Not a product category, not a marketing term. A design posture. It means building AI workflows where data stays on the machine unless you explicitly decide to move it. The default is local. The exception is cloud.
Most AI tooling is built the other way around. The default is cloud. Local is the exception, the “enterprise” option, the thing you pay extra for. Offline-first inverts that. You start with local capability and add cloud only when local isn’t sufficient.
For email analysis, local is sufficient. Qwen3-14B handles it. For complex multi-step reasoning over large codebases, local isn’t sufficient yet, and I use cloud models for that. The point is making the choice deliberately rather than defaulting to cloud because it’s easier to set up.
Proton Bridge’s architecture accidentally enforces this. Because there’s no remote API, you can’t build a cloud-side email processor even if you wanted to. The tool’s design makes the privacy-preserving architecture the only architecture. I find that kind of constraint clarifying.