archive-mail

archive-mail is a command for Claude Code from PsychQuant/che-apple-mail-mcp. It costs 19 tokens per session (31,798 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: 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 31,798 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. 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.31798
Opus 5 $0.00010 $0.15899
Sonnet 5 $0.00004 $0.06360
Haiku 4.5 $0.00002 $0.03180

Measured 9d ago against content hash ae03c0519b65, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

archive-mail scanned grade A with 0 findings 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 9d ago.

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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugin/commands/archive-mail.md · 1,508 lines

How it starts

The opening of the file, as written. The whole thing — 1,508 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
  • 第一個參數(v2.12.0+ 可選):Email 過濾條件(寄件人或收件人包含此字串)
  • 第二個參數(可選):輸出目錄,預設 communication/emails
零參數模式

當 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

命令列參數仍可覆寫 config(傳一個 filter 就只用該 filter,不讀 config 的 filters 清單)。詳細 schema 見 plugin CLAUDE.md。

執行步驟

Step 0: Bootstrap Stage Task List(v2.9.0+ 鐵律,強制)

Read the full file on GitHub · 1,508 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. 9d 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 (8 stars, last pushed today), licensed MIT. It adds 19 tokens to every session and 31,798 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.