Inspiration

Email is overwhelming — most of what lands in your inbox doesn't need immediate attention, but figuring out what does takes time. We wanted a tool that could fetch new emails and automatically sort them so you know what to act on, what to ignore, and what to circle back to.

What it does

Its a CLI that pulls recent Gmail messages as structured JSON and, with the --triage flag, sends them to Omnara for classification. Omnara sorts each email into three buckets — priority (respond now), junk (archive), or follow-up (handle later) — with a one-line reason for each. It tracks state between runs so you only process new mail.

How we built it

TypeScript on Node.js, using the Gmail API with OAuth2 for email access. The CLI fetches messages with paginated, concurrent requests, extracts bodies from multipart MIME payloads, and outputs clean JSON to stdout. The Omnara integration reads local credentials, resolves the workspace via the Omnara REST API, and creates a session with a triage prompt. The prompt template lives in its own file for easy tweaking.

Challenges we ran into

Gmail's MIME structure is deeply nested and inconsistent — extracting readable body text from multipart messages required recursive traversal and base64 decoding. Getting OAuth token refresh to work seamlessly (auto-updating .env on each run) took iteration. Designing a triage prompt that produces consistent, useful classifications across wildly different email types was its own challenge.

Accomplishments that we're proud of

The tool composes cleanly with Unix pipelines — you can pipe output to jq, head, or any other tool, and --triage works as an additive side effect without breaking that flow. State tracking means you never re-process old emails, and the prompt template is separated from the logic so it can be refined independently.

Built With

Share this project:

Updates