/apple-mail:email-archive-cleanupfrom apple-mail
This skill should be used when the user asks to "archive old mail safely", "move everything from X sender" (screens out human correspondents unless confidently spam), "clear newsletters", "bulk mark read after export", "preview what would move with dry_run=True", or run staged cleanup campaigns. Uses search_emails, move_email(dry_run=True) preview → execute, update_email_status, export_emails, manage_trash (max_deletes cap), synchronize_account, and get_statistics when measuring progress. Do NOT use for taxonomy design sessions without execution (mailbox-taxonomy), proposing Mail filter rules copy (mail-rules-advisor only), drafting mail (email-drafting), or the 5-minute triage skim (inbox-triage).
Ships in apple-mail. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
High-leverage transformations with explicit human checkpoints. Optimize for reversible moves (Archive, Trash soft-delete) unless the operator understands permanent deletes.
Archiving is for promotional and marketing mail, spam, automated notifications and system alerts, newsletters, receipts, order and shipping confirmations, calendar and system notices, and other bulk or automated mail. It is not for messages from real people.
Never propose archiving a message from a real person the operator corresponds with (a human sender, especially anyone the operator has emailed or replied to, or who addresses the operator by name) unless confident the message is spam. Apply this screen while building the candidate list during evidence-gathering, before any id reaches move_email(dry_run=True, ...); it is a filter on what gets proposed, not a warning attached afterward.
Every signal below uses a field a tool actually returns. Do not rely on headers or filters the tools do not expose (there is no List-Unsubscribe field and no direct sent-to filter). search_emails and list_inbox_emails rows also do not carry in_reply_to or references; those threading headers are emitted empty on discovery rows and only come back from get_email_by_id / get_email_by_ids / get_email_thread.
Keep visible, do not archive, when the sender shows:
content_preview rather than a bulk templatewas_replied_to=true (Mail's native "was replied to" property, always present on every discovery row) or has_draft=true (a correlated reply draft exists)noreply@, no-reply@, notifications@, marketing@, or a bulk ESP domaincontent_previewsearch_emails cannot ask "did the operator ever email this address." When the stakes are high, search mailbox="Sent" for a bounded window and fetch full messages with get_email_by_id/get_email_by_ids to check the to field for the correspondent's address (search_emails results always leave to empty). Treat missing history as inconclusive, not as evidence the sender is automated.Safe to archive when the sender shows:
noreply@, no-reply@, notifications@, marketing@, or a known bulk ESP domaincontent_preview), a promotional template, or newsletter formattingcontent_preview with no engagement (was_replied_to=false and has_draft=false) points toward automated or bulk mail. Treat has_draft=null as unknown, not as "no draft"; the bounded Drafts scan was skipped or truncatedWhen it is uncertain whether a sender is a real person or an automated/bulk source, default to NOT archiving and leave the message in the inbox. Bias toward keeping human mail visible; archive only when confident the message is automated, promotional, or spam. If a candidate batch mixes human and automated senders, split it: drop the ambiguous or human-looking ids before quoting a dry-run total, and archive only the confidently automated or promotional subset.
Explicit override: when the operator names a specific human sender by address or name and confirms, in that request, that they want that person's mail archived, proceed on that named id or sender at the operator's instruction, outside the automatic screen above. The screen governs automatic and bulk archive proposals, not an explicit, informed instruction about a named sender.
See large-inbox-rules.md for the canonical pre-flight checklist.
full_inbox_export is disabledfull_inbox_export returns UNBOUNDED_EXPORT_DISABLED. For a cleanup backup, collect reviewed IDs with bounded search_emails, then call export_emails(message_ids=[...]) with up to five IDs from one mailbox to start. Run each batch serially and reconcile the files against the IDs before continuing. For a positional mailbox slice, start with export_emails(scope="entire_mailbox", mailbox=..., max_emails=5, offset=0) and resolve any incomplete batch before advancing.
move_email, update_email_status, and manage_trash require message_ids by default. Passing subject_keyword= or sender= to action tools returns code: TARGET_SELECTOR_DEPRECATED; collect message_ids first. Date-only or explicit bulk paths still require allow_filter_scan=True.
For any archive move (to_mailbox targeting Archive or similar), the id list in step 2 must already have passed the Human-Sender Screen (above) before it reaches step 3; do not build a dry-run from unscreened search results.
When the id list came from get_email_thread, check all four completeness fields before archiving the conversation as a unit; thread_incomplete alone is not a completeness test, and a bounded scan can return a confident subset that leaves part of the conversation behind in the inbox. Raise scan_messages for a scan_ceiling_hit (thread_incomplete: true); widen recent_days for window_truncated / date_floor_hit, and raise max_messages for return_limit_reached — both of those are caller-chosen bounds, so thread_incomplete stays false for them. Re-collect before the dry run. export_emails has no scan_messages parameter: widen the scan by calling get_email_thread directly, then export the resulting ids with export_emails(message_ids=[...]).
export_emails(scope="thread", ...) passes max_emails straight through as the thread's max_messages, and it defaults to 25. A 40-message thread therefore exports 25 members, and every count reconciles — 25 requested, 25 written, no shortfall and no PARTIAL: line — because the thread tool was asked for 25. Raise max_emails (hard-capped at 50) or, for a longer thread, call get_email_thread with a larger max_messages and export by message_ids in batches.
On a 24k inbox, filter-based mutations re-pay the scan cost for every batch and often time out. Always:
search_emails(sender_exact="...", subject_keyword="...", recent_days=30, limit=50), search_emails(sender_domain="...", recent_days=30, limit=50), or list_inbox_emails(...); inspect sample subjects.message_ids: extract ids from the JSON/text result. For archive moves, drop any id whose sender fails the Human-Sender Screen before it leaves this step.move_email(dry_run=True, message_ids=[ids], to_mailbox="...", max_moves=50) (or manage_trash(dry_run=True, message_ids=[ids], ...)).move_email(dry_run=False, message_ids=[ids], ...) after the operator confirms counts.Repeat in batches until stop conditions. Re-run search_emails(offset=0) after each archive wave because offsets shift on active inboxes (exchange-account-patterns.md).
allow_filter_scan=True (rare escape hatch only)Use only when the user has explicitly approved a bulk campaign and ID collection is impractical (e.g. migrating an entire sender across years). The tool prefixes responses with a slow-scan warning. Do not use sender= or subject_keyword= on action tools. Use search_emails(...) to collect ids, then act by message_ids.
recent_days wide) or targeted with discovery filters (sender_exact=, sender_domain=, subject_keyword=).Sequence:
search_emails(..., limit≤50) preview; escalate only after inspecting sample subjects.get_statistics(scope="sender_stats", sender="...") or scope="mailbox_breakdown" for volume proof.export_emails(...) snapshots before manage_trash. For preservation or migration evidence, use reviewed ids (or one bounded page) with format="eml" to preserve raw RFC 822 source headers and MIME. Use include_attachments=True only when required: each attachment is capped at 25 MiB and each batch at 100 MiB, skipped files are reported, and cold Exchange/Gmail caches may need a small page plus a higher timeout than the 120-second default.Verify the backup against the exact IDs approved for deletion. Check each ID against the export result and its file on disk. Treat missing IDs, timeouts, and PARTIAL: results as unresolved until verified. Retry only unresolved IDs, using the mailbox that holds them. Proceed to manage_trash(action="delete_permanent") only after the files cover the reviewed ID list. A verified positional page covers its own selection, which can shift across calls as messages arrive or move.
For archive campaigns, apply the Human-Sender Screen (above) to the preview results now: drop any human-looking or ambiguous sender from the candidate list before it becomes an id to move. Always quote expected totals after dry runs.
dry_run=True on move_email / manage_trash, message_ids required)Mandatory first pass after collecting ids from step 2. For archive moves, ids must already be screened: build it only from senders that passed the Human-Sender Screen, not the raw preview.
ids = [e["message_id"] for e in preview["items"]] # search_emails JSON uses "items"; list_inbox_emails uses "emails"
# For archive moves, drop any id whose sender failed the Human-Sender Screen before this call.
move_email(dry_run=True, message_ids=ids, to_mailbox="Archive", max_moves=50)
Trash paths: manage_trash(action="move_to_trash", dry_run=True, message_ids=ids, ...) before committing (dry_run defaults to True on manage_trash, and to False on move_email — pass it explicitly on moves).
update_email_status has no dry_run. It is the one action tool with no simulate mode, so there is nothing to preview against: the safe path is the id list itself. Show the user the collected ids (with subjects and senders from the search preview that produced them) and get confirmation before the call, keep max_updates at or below the batch you just showed, and never pass allow_filter_scan=True on a status update the user has not seen enumerated. Read/flag changes are reversible (mark_unread, unflag), which is why the tool ships without a preview; a wrong batch is still a wrong batch, so confirm first.
Quote expected totals from the dry-run response. Discuss raising max_moves / max_deletes; defaults protect against catastrophe. If you hit TARGET_SELECTOR_DEPRECATED, you used a search selector on an action tool. Go back to search/list and collect ids.
message_ids only)| Action | Typical tool |
|---|---|
| File / archive batch | move_email(dry_run=False, message_ids=ids, to_mailbox="...", max_moves=50) |
| Mark processed | update_email_status(action="mark_read"|"unflag", message_ids=ids, max_updates≤50 after confirmation) |
| Remove noise | manage_trash(action="move_to_trash", dry_run=False, message_ids=ids, max_deletes≤50) after the dry run; escalate delete_permanent only post-export + verbal/written affirmation |
| Hydrate caches | synchronize_account(account="...", confirm_sync=True) only after explicit user approval; it can fetch large remote backlogs |
Slice ids into batches of ≤50. Re-run narrower search_emails between batches until stop conditions.
Finish with get_statistics(scope="account_overview") or get_inbox_overview() verifying queues match operator expectations.
| Hazard | Mitigation |
|---|---|
| Archiving a real person's mail | Apply the Human-Sender Screen before every archive dry-run; when uncertain, leave the message in the inbox |
| Over-broad keywords | Narrow by mailbox=, combine sender + unread flags |
| Mailbox typos | list_mailboxes validation before destructive move |
| Accidental unread wipe | Separate pass for unread-only subsets |
| Cross-account fallout | Iterate per account instead of omnibus all_accounts=True mutations |
Permanent deletes invoke irreversible manage_trash(action="delete_permanent"); escalate only with evidence export + checklist.
| If the user pivots... | Skill |
|---|---|
| Needs smarter folder ontology | mailbox-taxonomy |
| Wants sieve text for automation | mail-rules-advisor |
| Suddenly needs reply drafts | email-drafting |
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub agentic-assets/apple-mail-mcp --plugin apple-mail12 skills in this plugin
/apple-mail-archive-exportUse when the user asks to "back up an Apple Mail account", "recover my partial.emlx attachments", "search an offline mail archive", or "convert my mail for Thunderbird". Runs local scripts to snapshot the Mail cache, rebuild detached MIME payloads, verify the output, and create a SQLite search index. Also indexes verified EML and ICS plugin exports with a manifest. Route staged moves or trash to email-archive-cleanup./apple-mail-operatorThis skill should be used when the user asks "how does this Mail MCP work", "why is Mail slow", "set up Mail for the assistant", "list my accounts/mailboxes", "find an email quickly", or "export my mail in batches". Uses list_accounts, list_mailboxes, get_inbox_overview, search_emails, and export_emails. Do NOT use for sustained inbox-zero programs (see email-management), a 5–10 minute triage ritual (see inbox-triage), or drafting mail (see email-drafting)./calendar-operatorThis skill should be used when the user asks "what's on my calendar", "am I free Thursday", "add an event", "block time for this", "clean up my test calendar", or "which calendar tool should I use". Covers bounded reads, timezone handling, safe event creation, ID-first updates and deletes, and calendar management with list_calendars, list_events, create_event, delete_events, and manage_calendars. Do NOT use for coordinating meetings with other people or invitation workflows (see meeting-scheduler), and do NOT use for email work (see apple-mail-operator)./email-attachmentsThis skill should be used when the user asks to "list attachments on messages about X", "save this PDF from email", "which invoices have ZIP files", or needs disk-safe attachment extraction. Uses bounded search_emails (has_attachments filters) to collect message_ids first, then list_email_attachments, save_email_attachment, get_email_by_id for confirmation, and optionally export_emails for bundles. Discovery-only; pass subject_keyword to search_emails when ids are unknown; never pass subject_keyword to list_email_attachments or save_email_attachment. Do NOT use when the real goal is writing responses (email-drafting), diagnosing slow accounts (apple-mail-operator), bulk deleting mail (email-archive-cleanup), or designing folder hierarchies (mailbox-taxonomy)./email-draftingThis skill should be used when the user asks to "draft an email", "reply to this message", "forward this thread", "verify my draft", or needs compose workflows in Apple Mail with draft-safe defaults. Covers compose_email, reply_to_email, forward_email, create_rich_email_draft, manage_drafts, verify_draft, and verify_drafts with exact message ids for replies, standalone-draft guardrails, native reply defaults, signatures, and post-draft verification. Do NOT use for inbox triage (inbox-triage), Mail MCP setup (apple-mail-operator), folder taxonomy (mailbox-taxonomy), Mail rules (mail-rules-advisor), staged bulk moves (email-archive-cleanup), or attachment extraction (email-attachments)./email-managementThis skill should be used when the user asks to "help me get to inbox zero", "build a repeatable triage program", "coordinate a multi-week cleanup across mailboxes", "set up sustained email habits", or "I'm drowning in email" and needs a multi-week umbrella program coordinating triage, taxonomy, cleanup, drafting, and analytics, not a single pass. Uses get_inbox_overview, search_emails, move_email, update_email_status, manage_trash, and get_statistics; routes single-purpose work to the narrow sibling skill instead. Do NOT use for tooling-only onboarding (see apple-mail-operator), a single 5–10 minute read-first scan (inbox-triage), a one-shot bulk move/archive/delete campaign (email-archive-cleanup), folder-architecture redesign without execution (mailbox-taxonomy), Mail filter prose only (mail-rules-advisor), or drafting voice capture (email-style-profile before email-drafting).