# Mail Thread

> >-

- **Type:** Skill
- **Install:** `agentstack add skill-aashari-ai-agent-skills-mail-thread`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [aashari](https://agentstack.voostack.com/s/aashari)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [aashari](https://github.com/aashari)
- **Source:** https://github.com/aashari/ai-agent-skills/tree/main/skills/apple-mail/mail-thread

## Install

```sh
agentstack add skill-aashari-ai-agent-skills-mail-thread
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Mail Thread — Read a Full Email Conversation

Thread: **$ARGUMENTS**

## Step 1: Find the thread
### Option A: Search by subject keyword
```bash
DB="$HOME/Library/Mail/V10/MailData/Envelope Index"
QUERY=""

sqlite3 "$DB" "
SELECT m.ROWID, m.conversation_id, s.subject,
       datetime(m.date_received,'unixepoch','localtime') as dt,
       a.address as sender
FROM messages m
JOIN subjects  s ON m.subject = s.ROWID
JOIN addresses a ON m.sender  = a.ROWID
WHERE s.subject LIKE '%${QUERY}%' AND m.deleted=0
ORDER BY m.date_received DESC LIMIT 10;" 2>/dev/null
```

### Option B: If ROWID provided directly
```bash
sqlite3 "$DB" "
SELECT conversation_id FROM messages WHERE ROWID = ;" 2>/dev/null
```

## Step 2: Get all messages in the thread by conversation_id
```bash
CONV_ID=

sqlite3 "$DB" "
SELECT m.ROWID,
       datetime(m.date_received,'unixepoch','localtime') as dt,
       a.address as sender, a.comment as name,
       s.subject, mb.url as mailbox, m.read
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 m.conversation_id = ${CONV_ID}
  AND m.deleted = 0
ORDER BY m.date_received ASC;" 2>/dev/null
```

## Step 3: Read all message bodies
```bash
python3 ~/.claude/skills/_mail-shared/parser.py    ...
```

## Step 4: Reconstruct the conversation
Present chronologically:
- Who sent each message and when
- Key content of each message (summarize long ones, quote short ones)
- Reply chain structure

## Step 5: Summarize the thread
After showing the conversation:
- What was the original question/issue?
- What was discussed/debated?
- What was decided or concluded?
- Are there any open questions or pending actions?
- Who is waiting on whom?

## Output Format
**Thread: [Subject]**
[N messages | started: date | participants: list]

---
**[Date] [Sender Name]** [→ Reply to: ...]
> [message content, summarized if long]

---
[repeat for each message]

---
**Summary:**
[2-3 sentence summary of the thread outcome]

**Status:** [Resolved / Ongoing / Waiting for response]
**Next action:** [if any]

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [aashari](https://github.com/aashari)
- **Source:** [aashari/ai-agent-skills](https://github.com/aashari/ai-agent-skills)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-aashari-ai-agent-skills-mail-thread
- Seller: https://agentstack.voostack.com/s/aashari
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
