Side project · Sep 2026
An email agent for regulatory filings
Email it “Can you give me Other Documents files from M12205?” It finds the matter in the Nova Scotia UARB public database, downloads up to ten files from that category, zips them, and replies in the same thread with the ZIP plus live metadata and document counts.
- 5
- document types: exhibits to recordings
- 15 s
- inbox polling interval
- 1
- fresh-browser retry before a failure reply
- 24/7
- runs unattended in Docker
Pipeline
From an unread email to a threaded reply.
Each message moves through a SQLite state machine — RECEIVED → PARSED → MATTER_LOADED → DOWNLOADED → ZIPPED → SENT, or FAILED — keyed by its Message-ID.
- 01
Parse
Deterministically extract one matter number and one document type. Anything ambiguous gets a short usage reply instead of a guess.
- 02
Browse
Drive the FileMaker WebDirect site with Playwright: open the matter, read metadata and all five counts, then download the requested rows.
- 03
Package
Sanitise filenames, de-duplicate with -2/-3 suffixes, and build a deflated ZIP within the attachment budget.
- 04
Reply
Send over SMTP with In-Reply-To and References so the answer lands in the original thread.
Guarantees
Built to run without anyone watching it.
- Idempotency
Each email is answered once
The Message-ID is the key and claiming is atomic, so concurrent workers never process the same request. Mail is marked read only after handling completes.
- Integrity
No corrupt ZIPs
Each download is retried once. If a file still fails, the request fails with no attachment rather than shipping a broken archive.
- Safety
No reply loops
No-reply senders, its own mail, and auto-submitted or bulk messages are ignored. Only the newest top-posted section is parsed, so quoted history cannot confuse it.
- Limits
Bounded everything
Size guards on downloads, the encoded MIME message, and inbound mail; per-sender and global hourly rate limits; temp files deleted after every request.
Field notes
Automating a FileMaker web UI.
The matter field is a div that only becomes contenteditable about a second after focus — type earlier and keystrokes vanish — so the client waits, types, and verifies the visible value before searching.
Layout object ids differ between the matter page and each tab, so metadata is read by the geometry of its label column instead. The document grid is virtualised to about twelve rows, so the client scrolls until a requested row exists.
Verified live
Real requests against matter M12205.
| Request | Result |
|---|---|
| Other Documents (43) | 10 files, 10.4 MB ZIP |
| Key Documents (6) | 6 files |
| Transcripts (0) | Accurate “nothing to attach” reply, no ZIP |
| Exhibits (13) | 6-file ZIP; oversized PDFs skipped and reported |
| M99999 | “Matter not found” reply |
Scope
What it deliberately does not do.
No dashboard, no multi-user accounts, no LLM parsing, and no cloud links for oversized archives. A deterministic parser and a well-guarded worker were the right tools for a request format this narrow.