archive-mail-migrate

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

A one-time command that moves old email archive indexes and settings into the newer `.claude/.mail/` folder structure. It leaves the archived Markdown emails where they are.

In plain words
What is it for?
Use it to migrate every existing email archive at once, especially when you have several archive locations and do not want to wait for automatic migration.
Why use it?
It cleans up files left in different locations by older versions. A dry run lets you preview the moves before changing anything.

Command for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: names the AskUserQuestion tool; positional $N argument.

Needs its repository: it runs a file that does not travel with it, so clone the repository first. The line is 1. ./communications/emails/.email_index.json (18 entries) + .threads.json (6 threads).

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

Good fit Use it to migrate every existing email archive at once, especially when you have several archive locations and do not want to wait for automatic migration.

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-migrate

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-migrate

README.md
[![agentmods](https://agentmods.dev/badge/commands/psychquant/che-apple-mail-mcp/archive-mail-migrate/github.svg)](https://agentmods.dev/commands/psychquant/che-apple-mail-mcp/archive-mail-migrate)
Your own site
<a href="https://agentmods.dev/commands/psychquant/che-apple-mail-mcp/archive-mail-migrate"><img src="https://agentmods.dev/badge/commands/psychquant/che-apple-mail-mcp/archive-mail-migrate/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-migrate

Your own site · 80×15
<a href="https://agentmods.dev/commands/psychquant/che-apple-mail-mcp/archive-mail-migrate"><img src="https://agentmods.dev/badge/commands/psychquant/che-apple-mail-mcp/archive-mail-migrate.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 21 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,999 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.00021 $0.01999
Opus 5 $0.00010 $0.01000
Sonnet 5 $0.00004 $0.00400
Haiku 4.5 $0.00002 $0.00200

Measured 10d ago against content hash fe2271a5c562, 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-migrate 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 10d 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-migrate.md · 209 lines

How it starts

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

Archive Mail — Migrate to .claude/.mail/ Namespace(v2.8.0+)

把散在各個 archive directory 的 .email_index.json.threads.json,以及 .claude/emails.md,集中搬到 .claude/.mail/ namespace。學 IDD .claude/.idd/ 的 namespace 收斂 pattern。

為什麼要 migrate

v2.8.0 之前的 file layout:

{cwd}/
├── .claude/
│   └── emails.md                  ← config 散在 root
└── communications/emails/
    ├── .email_index.json          ← state 散在 archive output 裡
    ├── .threads.json
    ├── 2026-01-13_xxx.md          ← archive markdown(不動)
    └── ...

v2.8.0+ 集中後:

{cwd}/
├── .claude/.mail/
│   ├── config.yaml                ← 從 .claude/emails.md 搬來(v2.7.0 ↓);v2.16.0+ 副檔名 .yaml
│   └── state/
│       └── archives/
│           └── communications-emails/
│               ├── email_index.json   ← 從 communications/emails/.email_index.json 搬來
│               └── threads.json       ← 從 communications/emails/.threads.json 搬來
└── communications/emails/
    ├── 2026-01-13_xxx.md          ← archive markdown 不動
    └── ...

archive-mail v2.8.0+ 會 auto-migrate(每次跑時 silent 移動),但若你有多個 archive target 不想等到下次 archive 才觸發,可以一次跑這個 command 全部搬完。

使用方式

# Dry run(預覽會搬什麼,不實際執行)
/archive-mail-migrate --dry-run

# 實際執行
/archive-mail-migrate

執行步驟

Step 1: 解析參數

DRY_RUN=false
if [ "$1" = "--dry-run" ]; then
  DRY_RUN=true
fi
NAMESPACE_DIR=".claude/.mail"

Step 2: 掃描所有 archive targets

從當前 working directory 開始,找出所有 legacy index files:

find . -maxdepth 6 -type f \( -name ".email_index.json" -o -name ".threads.json" \) \
  -not -path "*/.claude/.mail/*" \
  -not -path "*/.git/*" \
  -not -path "*/node_modules/*" \
  2>/dev/null

對每一個 hit,推斷它所屬的 archive_dir(file 所在的 directory),然後計算 slug。

範例 output:

Detected legacy archive targets:

1. ./communications/emails/.email_index.json (18 entries) + .threads.json (6 threads)
   → slug: communications-emails

2. ./projects/X/comms/.email_index.json (12 entries) + .threads.json (4 threads)
   → slug: projects-X-comms

3. (etc.)

Plus:
  ./.claude/emails.md → .claude/.mail/config.yaml

Read the full file on GitHub · 209 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. 10d ago First seen · 209 lines · 21 tokens per session scan A fe2271a5c562

Subscribe to this mod's changes

archive-mail-migrate is a command published in the GitHub repository PsychQuant/che-apple-mail-mcp (8 stars, last pushed yesterday), licensed MIT. It adds 21 tokens to every session and 1,999 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.