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

mail-from

Skill7 starsChanged 9 months agoMITView on GitHub

Show all emails from a specific person, email address, or domain. Summarize the relationship and communication history. Use when user asks about emails from someone, or wants to see what a specific sender has sent them. Arguments: person name, email address, or domain (e.g. "john@company.com", "amazon.com", "my boss Sarah").

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    If multiple matches, show options and ask which one (or proceed with all if they're clearly the same person/org).

    line 37

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “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

Mail From — All Emails From a Sender

Sender query: $ARGUMENTS

Steps

1. Find matching senders

DB="$HOME/Library/Mail/V10/MailData/Envelope Index"
QUERY="$ARGUMENTS"  # treat as search term against address + comment fields

sqlite3 "$DB" "
SELECT DISTINCT a.address, a.comment, COUNT(*) as cnt
FROM messages m
JOIN addresses a ON m.sender = a.ROWID
JOIN mailboxes mb ON m.mailbox = mb.ROWID
WHERE (a.address LIKE '%${QUERY}%' OR a.comment LIKE '%${QUERY}%')
  AND m.deleted = 0
GROUP BY a.address
ORDER BY cnt DESC
LIMIT 10;" 2>/dev/null

If multiple matches, show options and ask which one (or proceed with all if they're clearly the same person/org).

2. Get all emails from the matched address(es)

sqlite3 "$DB" "
SELECT datetime(m.date_received,'unixepoch','localtime') as dt,
       s.subject, mb.url as mailbox, m.ROWID, m.read, m.flagged
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 a.address LIKE '%SENDER%'
  AND m.deleted = 0
  AND mb.url NOT LIKE '%Spam%'
  AND mb.url NOT LIKE '%Trash%'
ORDER BY m.date_received DESC
LIMIT 100;" 2>/dev/null

3. Compute relationship stats

sqlite3 "$DB" "
SELECT
  COUNT(*) as total,
  SUM(CASE WHEN m.read = 0 THEN 1 ELSE 0 END) as unread,
  SUM(CASE WHEN m.flagged = 1 THEN 1 ELSE 0 END) as flagged,
  MIN(datetime(m.date_received,'unixepoch','localtime')) as first_email,
  MAX(datetime(m.date_received,'unixepoch','localtime')) as latest_email,
  strftime('%Y-%m', datetime(m.date_received,'unixepoch','localtime')) as busiest_month
FROM messages m
JOIN addresses a ON m.sender = a.ROWID
JOIN mailboxes mb ON m.mailbox = mb.ROWID
WHERE a.address LIKE '%SENDER%' AND m.deleted = 0
GROUP BY busiest_month
ORDER BY COUNT(*) DESC LIMIT 1;" 2>/dev/null

4. Read recent emails if user wants details

python3 ~/.claude/skills/_mail-shared/parser.py <ROWID1> <ROWID2> ...

Output Format

Lead with relationship summary:

  • X emails from [name/address], spanning [date range]
  • First contact: [date] — Latest: [date]
  • Unread: X | Flagged: X

Then list recent emails (last 10-20) as a table. Group older emails by month if there are many. Highlight unread and flagged ones. Offer to read any specific email or summarize the thread.

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.