LLM‑Powered Email Triage Pipeline with Aider and Nylas CLI
Run the triage script to classify unread emails into ACTION, SKIM, DROP using an LLM, then mark/star accordingly.
Place the script in `/opt/triage/triage.py`, run it periodically, and ensure Aider and Nylas CLI are installed
Summary
The article describes a triage pipeline that classifies unread emails into three buckets—ACTION, SKIM, DROP—using an LLM via the Aider CLI. The script fetches up to 50 unread emails with `nylas email list --unread --limit 50 --json`, then calls Aider with a prompt that asks the LLM to output a single word. Based on the classification, the script marks the email as starred, read, or deletes it. The triage rules are defined in a table: ACTION emails are starred, SKIM emails are marked read, and DROP emails are marked read and deleted. The script demonstrates how to integrate the LLM classification with Nylas CLI commands for email management. It emphasizes that the pipeline runs on the user's laptop in the background and surfaces only the messages that need personal attention.
Key changes
- Fetch up to 50 unread emails with `nylas email list`
- LLM classification via Aider prompt returning a single word
- Mark ACTION emails as starred with `nylas email mark-starred`
- Mark SKIM emails as read with `nylas email mark-read`
- Delete DROP emails with `nylas email delete`
- Script uses subprocess to call CLI and Aider
- Classification prompt includes sender, subject, snippet
- Runs on laptop in background, surfaces only relevant messages