agentleFS
aashariaashari/ai-agent-skills/skills/apple-mail/mail-work/SKILL.md

mail-work

Skill7 starsChanged 9 months agoMITView on GitHub

Show work emails only, filtered to Exchange/EWS accounts and corporate email domains. Digest with priorities. Use when user asks about work email, work inbox, or wants to separate work from personal mail. Arguments: optional date range or "today", "yesterday", "this week".

The file

Files
SKILL.md

Mail Work — Work Email Digest

Period: $ARGUMENTS (default: today)

Step 1: Identify work accounts

Work accounts are EWS/Exchange (detected by ews:// prefix in mailbox URL), plus any IMAP account with a corporate domain (not gmail.com, icloud.com, yahoo.com, hotmail.com, outlook.com).

DB="$HOME/Library/Mail/V10/MailData/Envelope Index"

# EWS/Exchange accounts (most reliable work indicator)
EWS_UUIDS=$(sqlite3 "$DB" "
  SELECT DISTINCT substr(url, instr(url,'://')+3, instr(substr(url,instr(url,'://')+3),'/')-1)
  FROM mailboxes WHERE url LIKE 'ews://%';" 2>/dev/null)

# All mailbox URLs for work accounts
sqlite3 "$DB" "SELECT DISTINCT url FROM mailboxes WHERE url LIKE 'ews://%';" 2>/dev/null

Step 2: Date filter

# Parse $ARGUMENTS
# today: date('now')
# yesterday: date('now','-1 day') to date('now')
# this week: date('now', 'weekday 1', '-7 days') or similar
# default: today

DATE_FILTER="datetime(m.date_received,'unixepoch','localtime') >= '$(date +%Y-%m-%d) 00:00:00'"

Step 3: Query work mail

sqlite3 "$DB" "
SELECT datetime(m.date_received,'unixepoch','localtime') as dt,
       s.subject, a.address as sender, a.comment as name,
       mb.url as mailbox, m.ROWID, m.read, m.flagged, m.is_urgent
FROM messages m
JOIN subjects  s  ON m.subject = s.ROWID
JOIN addresses a  ON m.sender  = a.ROWID
JOIN mailboxes mb ON m.mailbox = mb.ROWID
WHERE ${DATE_FILTER}
  AND m.deleted = 0
  AND mb.url LIKE 'ews://%'
  AND mb.url NOT LIKE '%Spam%'
  AND mb.url NOT LIKE '%Trash%'
  AND mb.url NOT LIKE '%Junk%'
  AND mb.url NOT LIKE '%Draft%'
ORDER BY m.is_urgent DESC, m.read ASC, m.date_received DESC;" 2>/dev/null

Step 4: Read bodies of important emails

For emails that look substantive, prioritize by automated_conversation:

  • automated_conversation = 0 = likely real person → read first
  • automated_conversation = 1 = transactional (Jira, Slack) → skim
  • automated_conversation = 2 = bulk automated → count only unless urgent
python3 ~/.claude/skills/_mail-shared/parser.py <ROWID1> <ROWID2>

Categorization for Work Mail

  • Escalations/Alerts: incidents, P1/P2/P3 alerts, on-call, outages (automated_conversation=2 OK)
  • Action Required: review, approve, sign off, merge request, deploy
  • Meetings: invites, updates, cancellations, meeting notes/summaries
  • Reports: daily/weekly reports, incident reports, uptime summaries
  • External: emails from outside the company domain
  • Internal Chatter: announcements, FYIs, newsletters (automated_conversation=2)

Output Format

Group by category. Highlight unread. Surface anything urgent or needing a response. Include a "still needs reply" flag for emails older than 24h that are unread.

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.