agentleFS
huifeideyu-1121huifeideyu-1121/email-triage/SKILL.md

email-triage

Skill0 starsChanged 5 months agoMITView on GitHub

Unified multi-mailbox triage and reply for Claude Code / Codex. Fetches unread (or last-N-hours) mail across all your IMAP accounts, classifies it, writes a single Markdown "email digest", and optionally marks the messages read. Use when the user says "triage my email", "check my inbox", "any important mail", "email digest", or asks to draft/send a reply. Pure local: credentials from the macOS Keychain, mail over IMAP/SMTP.

4 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions4 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 4

    1. mariagorskikh/open-instinct★ 219same name
    2. strikersam/autonomous-ai-agency★ 9same name
    3. Magnus-Gille/claude-skills★ 5same name
    4. selamy-labs/agent-skills★ 0same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

The file

We split this skill into the rules it gives an agent

10 rules. 0 are common, 6 are distinctive, and 4 are very specific to this project.

  • 0

    Common

    Most of the 4 edited versions we read keep these.

  • 6

    Distinctive

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Add/remove a mailbox by editing config only — never touch the script.

    line 13
  2. Very specific:

    If config.json doesn't exist (only config.example.json), or its accounts are still placeholders,

    line 17
  3. Distinctive:

    walk the user through setup conversationally: instead of erroring:

    line 18
  4. Distinctive:

    Ask which mailboxes they want to connect (just the email addresses).

    line 20
  5. Very specific:

    Write config.json (copy from config.example.json, fill accounts + digest_dir).

    line 28
  6. Very specific:

    Run python3 scripts/mailbox.py healthcheck to confirm every account logs in.

    line 29
  7. Distinctive:

    Read the JSON, write a one-line summary per message, and bucket each into:

    line 56
  8. Distinctive:

    Rule: never put marketing in 🔴.

    line 63
  9. Very specific:

    Write the digest to (expand ~.

    line 65
  10. Distinctive:

    After confirmation, write a JSON spec file:

    line 85

“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

email-triage

Fetch mail from multiple mailboxes, classify it, write a Markdown digest, optionally mark read. Division of labor: scripts/mailbox.py does only IMAP/SMTP I/O (connect / fetch / mark / send); you (the AI) do the classification and write the digest — that part rides your subscription, no API cost.

Config in config.json (accounts, servers, optional proxy, digest dir, auto_mark_read). Add/remove a mailbox by editing config only — never touch the script.

First run / onboarding (when config.json is missing or has no real accounts)

If config.json doesn't exist (only config.example.json), or its accounts are still placeholders, walk the user through setup conversationally instead of erroring:

  1. Ask which mailboxes they want to connect (just the email addresses).
  2. For each, fill in the IMAP/SMTP servers — auto-detect from the domain using the table below; ask only if the domain is unknown.
  3. Tell the user how to get an app password / authorization code for each provider (see table), and give them the exact Keychain command to run (in their own Terminal, not via the agent):
    security add-generic-password -s "email-imap" -a "their@email.com" -U -w
  4. Write config.json (copy from config.example.json, fill accounts + digest_dir).
  5. Run python3 scripts/mailbox.py healthcheck to confirm every account logs in.
  6. Offer to set up the daily schedule (see README → launchd).

Common provider servers (IMAP / SMTP, both SSL — 993 / 465):

ProviderIMAPSMTPApp password
Gmail / Google Workspaceimap.gmail.comsmtp.gmail.comEnable 2-Step Verification → App Passwords
Outlook / Hotmail / Office365outlook.office365.comsmtp.office365.comMicrosoft account → App passwords
Yahooimap.mail.yahoo.comsmtp.mail.yahoo.comAccount security → Generate app password
iCloudimap.mail.me.comsmtp.mail.me.comappleid.apple.com → App-Specific Passwords
Zohoimap.zoho.comsmtp.zoho.comSecurity → App Passwords
QQimap.qq.comsmtp.qq.comSettings → enable IMAP → SMS authorization code
NetEase 163 / 126imap.163.com / imap.126.comsmtp.163.com / smtp.126.comSettings → enable IMAP → authorization code
Custom domainask the host (often Zoho / Google Workspace / cPanel)—per host

Standard flow: produce a digest

1 · Fetch (read-only; does not change read state)

python3 scripts/mailbox.py fetch                 # unread only
python3 scripts/mailbox.py fetch --since-hours 24 # everything received in the last 24h

Prints JSON (one object per message: account/uid/from/date/subject/snippet) and saves the UID list to state/last_fetch.json for the mark step. Limit to some accounts: --account a@b.com c@d.com.

2 · You classify + write the digest Read the JSON, write a one-line summary per message, and bucket each into:

  • 🔴 Action needed — genuinely needs the user (customer mail, billing problems, decisions)
  • 🟡 Worth a look — relevant notices (shipping/policy/login alerts, weekly reports)
  • 🟢 Self-triggered alerts — security alerts caused by the user's own setup/logins (ignorable; check time/device, don't confuse with real threats)
  • ⚪ Marketing / notifications — newsletters, promos; ignorable

Rule: never put marketing in 🔴; when unsure, lean 🟡 rather than burying something important.

Write the digest to (expand ~; create the month subfolder; confirm the dir exists first):

<digest_dir>/<YYYY-MM>/email-digest-<YYYY-MM-DD>.md

Lead with a summary (per-category counts) and put 🔴 at the very top.

3 · Mark read (only if config.auto_mark_read is true) ⚠️ Safety order: confirm the digest file is written and non-empty first, then mark.

python3 scripts/mailbox.py mark-read    # marks exactly the UIDs from the last fetch

Health check (troubleshooting)

python3 scripts/mailbox.py healthcheck   # logs in to each account, reports unread counts
python3 scripts/mailbox.py smtp-test     # SMTP login only, sends nothing

Reply (draft → confirm → send)

  1. Draft the reply and show it to the user for confirmation — sending is outbound; never auto-send.
  2. After confirmation, write a JSON spec file:
    {"account":"sender@you.com","to":"recipient@x.com","subject":"Re: ...","body":"...",
     "in_reply_to":"<original-Message-ID>","references":"<original-Message-ID>"}
  3. Send: python3 scripts/mailbox.py send --spec /tmp/reply.json

Key constraints

  • Credentials live in the macOS Keychain: service = config.keychain_service, account = email address. The script never sees plaintext; the AI never sees the password.
  • Optional proxy: set config.proxy {host,port} if your network needs a SOCKS proxy to reach mail servers (e.g. behind a firewall). Connections use remote DNS so they work even when local DNS can't resolve.
  • Look but don't touch: fetch uses IMAP read-only (EXAMINE) — reading never marks mail read; only mark-read changes state.
  • NetEase 163 requires an IMAP ID command after login — handled automatically.
  • Scheduled runs use scripts/run_daily.sh (see README) with fetch --since-hours 24.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.