archive-mail

archive-mail is a command for Claude Code from PsychQuant/che-apple-mail-mcp. It costs 19 tokens per session (51,124 once invoked), scanned A, original, MIT.

A command that archives Apple Mail messages involving a chosen contact into Markdown files, which are plain-text documents with simple formatting. It can use a contact filter, an output directory, or saved settings.

In plain words
What is it for?
Use it to search Apple Mail by sender or recipient, apply saved filters and date limits, exclude mailboxes, and save matching conversations under a communication folder.
Why use it?
It turns email threads into searchable project files and avoids repeatedly collecting the same messages manually.

Command for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: reads .claude/ paths; mentions CLAUDE.md; positional $N argument.

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is - [raw\_indicators\.csv](../../data/raw/raw_indicators.csv) (12 KB).

Part of the che-apple-mail-mcp plugin — 3 skills, 5 commands, 1 hook shipped together

Good fit Use it to search Apple Mail by sender or recipient, apply saved filters and date limits, exclude mailboxes, and save matching conversations under a communication folder.

Compare 6 commands from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/PsychQuant/che-apple-mail-mcp
agentmods
npx agentmods add commands/psychquant/che-apple-mail-mcp/archive-mail

Made for: Claude Code.

Or install che-apple-mail-mcp, the plugin that ships this one along with the rest of its 3 skills, 5 commands, 1 hook.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for archive-mail

README.md
[![agentmods](https://agentmods.dev/badge/commands/psychquant/che-apple-mail-mcp/archive-mail/github.svg)](https://agentmods.dev/commands/psychquant/che-apple-mail-mcp/archive-mail)
Your own site
<a href="https://agentmods.dev/commands/psychquant/che-apple-mail-mcp/archive-mail"><img src="https://agentmods.dev/badge/commands/psychquant/che-apple-mail-mcp/archive-mail/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for archive-mail

Your own site · 80×15
<a href="https://agentmods.dev/commands/psychquant/che-apple-mail-mcp/archive-mail"><img src="https://agentmods.dev/badge/commands/psychquant/che-apple-mail-mcp/archive-mail.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 19 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 51,124 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00019 $0.51124
Opus 5.5 $0.00008 $0.20450
Sonnet 5.5 $0.00004 $0.10225
Haiku 4.5 $0.00002 $0.05112

Measured yesterday against content hash 524b44a71b1b, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

archive-mail scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

from urllib.parse import quote
plugin/commands/archive-mail.md · 2,210 lines

How it starts

The opening of the file, as written. The whole thing — 2,210 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Archive Mail

歸檔指定聯絡人的郵件到 Markdown 檔案。

使用方式

/archive-mail                                    # 零參數(v2.12.0+;v2.16.0+ 讀 .claude/.mail/config.yaml,.md fallback)
/archive-mail [email protected]
/archive-mail [email protected] communication/emails
/archive-mail [email protected] --no-confirm      # 略過確認(旗標可放在任何位置;見 Step 1)
/archive-mail --no-confirm                       # 只給旗標:仍走零參數模式,filters 來自 config
/archive-mail [email protected] -- --odd-dir      # `--` 之後一律是位置參數(目錄名以 - 開頭時用)
  • 第一個參數(v2.12.0+ 可選):Email 過濾條件(寄件人或收件人包含此字串)
  • 第二個參數(可選):輸出目錄,預設 communication/emails
  • --no-confirm(可選,#540):等同使用者說「直接做」,略過 Phase 1–3 的確認(Step 1.5 的 mail#334 例外與 Step 4.5 的略過範圍不變,Step 7 報告會揭露)。只認這一次叫用實際打的旗標
  • 其他以 -- 開頭的旗標(含智慧破折號打成的 —no-confirm)會回 不認得的旗標 並停止,不會被當成輸出目錄;引號不成對也會停止
零參數模式

當 cwd 已有 .claude/.mail/config.yaml(v2.16.0+;舊 .md 仍 fallback,首次 invoke auto-migrate 為 .yaml)並設定 filters 時,可不帶任何參數呼叫;從 config 讀取:

Field 用途
filters 多個 filter,作 OR-search 合併 corpus
output_dir 覆寫 default communication/emails
last_archived 給 search_emails 設 date_from(只抓此時點之後的信)
exclude_mailboxes search 跳過(垃圾郵件 / 草稿等)
sender_includes Layer 2 post-fetch: keep thread 若任一 message sender 含 substring(v2.20.0+, #84)
sender_excludes Layer 2 post-fetch: drop thread 若任一 message sender 含 substring(v2.20.0+, #84)
recipient_includes Layer 2 post-fetch: keep thread 若任一 message recipient 含 substring(v2.20.0+, #84)
recipient_excludes Layer 2 post-fetch: drop thread 若任一 message recipient 含 substring(v2.20.0+, #84)
subject_includes Layer 2 post-fetch: keep thread 若任一 message bare subject 含 substring(v2.20.0+, #76)
subject_excludes Layer 2 post-fetch: drop thread 若任一 message bare subject 含 substring(v2.20.0+, #76)
distributed_archives YAML 清單:分派去向的 archive 目錄(不限 symlink、不限在 output_dir 底下)。Step 2.1 把這些目錄的 message_id 併入 capture 層 dedup set,支援 capture-then-distribute 工作流(v2.38.0+, #285)

兩層 corpus model:filters / subject_keywords / exclude_mailboxes 是 Layer 1 search-time(定義 corpus);6 個 *_includes / *_excludes 是 Layer 2 post-fetch refinement(thread-coherent narrowing,excludes-precedence on same axis,case-insensitive substring)。完整契約見 spec openspec/specs/archive-mail-corpus-refinement/spec.md。

Read the full file on GitHub · 2,210 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday Changed · +202 lines 524b44a71b1b
  2. 4d ago Changed · +46 lines fcb0f87ec30d
  3. 7d ago Changed · +224 lines 2cc9c94ea101
  4. 8d ago Changed · +230 lines b2d45e1b15a1
  5. 1mo ago First seen · 1,508 lines · 19 tokens per session scan A ae03c0519b65

Subscribe to this mod's changes

archive-mail is a command published in the GitHub repository PsychQuant/che-apple-mail-mcp (10 stars, last pushed yesterday), licensed MIT. It adds 19 tokens to every session and 51,124 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.