← Changelog

The Mail Archive Leaves the Laptop

The local mail archive now mirrors to Cloudflare R2, so other machines can read it, and a read-only IMAP client lays the groundwork for keeping it current from the cloud.

Why Care?

An archive that only lives on one laptop is only reachable from that laptop, and only while it's awake. Most email gets handled on a phone, and the agents that should work over it need an always-on home. The first step is getting the archive off the machine, without spreading keys around.

What's New?

  • mail/r2.sh copies the archive to a Cloudflare R2 bucket (push), or pulls the search index, and optionally the raw mail, onto another machine (pull). check confirms the keys work.

  • No keys on disk. The R2 keys stay in 1Password and are read only while the script runs, through op run. The README lists what each machine needs.

  • sync-worker/ has a read-only IMAP client written for Cloudflare Workers. It's the piece an always-on sync will run, one mailbox account at a time.

  • Two explorations cover where the archive and its agents should live, and a gateway that sits between outside agents and the accounts they'd like to touch.

How it Works

TEXT
laptop archive --(r2.sh push)--> R2 bucket <--(r2.sh pull)-- other machines
                                     ^
                    sync-worker (next) ┘   IMAP, read-only, same file paths

The IMAP client can't change your mail either. Every command passes a check before it's sent: only login, listing, EXAMINE, search, and BODY.PEEK fetches get through. Anything that would select, flag, move, delete, or mark a message read is refused.

It produces the same files as the laptop sync. Raw messages are stored by the hash of their bytes, and two messages fetched by both clients hashed the same. So the cloud sync and the laptop can write into one bucket without duplicating mail.

It holds one message at a time. Messages stream through in turn, and anything over 48 MB is skipped, so a large attachment can't exhaust a Worker's memory.

Tests run the client against an in-memory Gmail-shaped server, including replies cut into 1-byte pieces and a check that no command could modify a mailbox.