Email-to-Brain
Gmail messages collected into digest files at
raw/email/. Deterministic noise filtering, Gmail link generation, and entity detection.
Design: Code for Data, LLMs for Judgment
The collector handles the mechanical work: pull emails, generate Gmail links, filter noise, detect signature requests. This never fails - links are always correct, timestamps always accurate. The agent handles judgment: who is important, what entities are mentioned, what action items exist. Source: scripts/sync-email.ts; recipes/email-to-brain.md
Usage
npx tsx scripts/sync-email.ts --auth # first-time OAuth (adds Gmail scope)
npx tsx scripts/sync-email.ts # collect since last run
npx tsx scripts/sync-email.ts --days 7 # collect last 7 days
Output
Digest files at raw/email/{YYYY-MM-DD}.md with three sections:
- Signatures Pending - DocuSign, HelloSign, etc. needing action
- Messages to Triage - real emails from real people with Gmail links
- Noise - filtered automated messages (available if needed)
Raw JSON preserved at raw/email/.raw/{YYYY-MM-DD}.json for provenance.
Noise Filtering (Deterministic)
Automatically filtered: noreply, no-reply, notifications, calendar-notification, mailer-daemon, donotreply, automated, alerts, updates, newsletter, marketing, promo.
Gmail Links
Generated by code, never by LLM. Format:
https://mail.google.com/mail/u/?authuser=ACCOUNT#inbox/MESSAGE_ID
Every email in the digest has a working "Open in Gmail" link.
Dedup
Message IDs tracked in PGlite. Re-running the collector skips already-seen messages.
Cost
$0/mo - Gmail API is within free quota for personal use.
Timeline
- 2026-06-30 | Updated cadence language for the every-four-hours Gmail sync loop. Source: User request, 2026-06-30; automations/email-sync.md
- 2026-06-17 | Added inline provenance and linked the page to its recipe and automation. Source: scripts/sync-email.ts; recipes/email-to-brain.md; automations/email-sync.md
- 2026-04-12 | Created. Recipe at
recipes/email-to-brain.md, automation atautomations/email-sync.md. Source: scripts/sync-email.ts