Problem
/archive-mail SOP 的 Step 5「生成 Markdown」主路徑仍是 per-email get_email(format='text') 逐封 fetch + client-side transcription(commands/archive-mail.md Step 0 task 描述與 Step 5 本文皆然),而 binary 端的 server-side 批次匯出工具已成熟且自 binary v2.18.0 起以 batch_export_emails_markdown 為 canonical 名(che-apple-mail-mcp#233;舊名 export_emails_markdown 為 deprecated alias)。
這正是 che-apple-mail-mcp#232 事故的 SOP 側缺口:#232 的 Proposed Solution 第 1 項「Step 5 大批量走批次路徑(強制/預設)」在該 issue 關閉時只落地了 binary 側(rename + 命名 discoverability,經 #233 出貨);SOP 側的 Step 5 遷移至今未動。SOP 文字甚至完全沒有出現任何 export 工具名(grep 零命中)— AI 執行者照 Step 5 逐封抓是文件指示的預期行為,不是偏差。
Proposed Solution(依 #232 原案)
- Step 5 在待歸檔清單 ≥ N 封(建議 ≥ 5,對齊既有 confirmation gate)時 SHALL 改用
batch_export_emails_markdown(一次呼叫、per-email manifest、skip_message_ids_path dedup、manifest message_id 可直接 reconcile INDEX_FILE);per-email get_email 迴圈降為 fallback。
- SOP 需說明「按 direction 拆批」慣例(工具用單一
mailbox 參數標 direction,mixed corpus 拆收/寄兩批;見 #232 Considerations)。
- Step 5.5 附件流程與 batch 匯出的
opts.include_attachments 的分工要明文(batch 匯出可含附件;classify 到 data/documents 的既有分流邏輯如何銜接需設計)。
- frontmatter 契約對齊:工具輸出 6-field frozen frontmatter +
body_type/in_reply_to;SOP 現行 frontmatter 欄位(thread_key/direction)是 client-side 加值,遷移後由 manifest 後處理補寫或保留 client-side 步驟,需設計決定。
Context
- che-apple-mail-mcp#232(事故 + 原案;已關,binary 側完成)
- che-apple-mail-mcp#233(rename 出貨,binary v2.18.0 / plugin v2.27.0)
- 實測成本:63 封歸檔逐封 get_email vs 兩次 batch 呼叫
✅ Verified(PR #114 @ frozen ada402d,tag idd-107-verified)
Step 5 主路徑遷移至 batch_export_emails_markdown(Step 5.0),per-email 降為 Step 5.1 fallback(<5 / enriched / batch 失敗)。shell v2.32.0(binary 不動 v2.19.0)。
6-AI verify 兩輪。R1(dc849ff)四 verifier 全 FAIL,DA REQUEST-CHANGES + 3 REQUIRED——攔下三個真實缺陷:
- direction 按 recipe provenance 分區的資料正確性 bug(3 verifier 收斂):3b/3c 是跨匣 subject 搜尋、帶使用者自己的寄出信,全歸「received 批」→ 寄出信誤標
direction: received(subject_keywords/zero-arg 模式每封寄出信都誤標)。→ 改按每封信自己的 mailbox 真分區(批 B = matchesSpecial(id.mailbox, Sent);批 A = 其餘 − uncertain),批 B 傳字面 "Sent"(locale-robust)。
- filename-authority bug(Codex BLOCKER):
opts.filenames 只是請求名(工具對 override branch 也 uniquify、seed 自 on-disk)→ downstream 一律以 manifest.written_path 為準。
- thread_key superset 碎裂(binary-cap FAIL):工具去
回覆:/回复: + case-insensitive 的 superset,SOP 舊規則窄 → batch/fallback 同 thread 拿不同 thread_key。→ SOP thread_key rule + Step 3 regex 對齊 binary superset;sender 記 lowercased、date 記 offset-preserving。
R2 re-verify(ada402d):綜合 lens PASS(3 REQUIRED 全落地、regex 與 binary 完全一致、對 #112 Step 8b 安全)+ DA APPROVE。post-verify polish fa47894(2 cheap doc-precision)。Master report。
已知 follow-up(非本次):SOP 的 Layer-2 corpus-refinement subject matcher 仍用 pre-Fix-3 窄前綴集(不同 code path,屬 archive-mail-corpus-refinement spec)。
狀態:停在 verified。merge 順序 #108 → #111 → #113 → #114(archive-mail 塔);plugins#110 stack 在本 PR 上;close 由維護者決定。
Problem
/archive-mailSOP 的 Step 5「生成 Markdown」主路徑仍是 per-emailget_email(format='text')逐封 fetch + client-side transcription(commands/archive-mail.mdStep 0 task 描述與 Step 5 本文皆然),而 binary 端的 server-side 批次匯出工具已成熟且自 binary v2.18.0 起以batch_export_emails_markdown為 canonical 名(che-apple-mail-mcp#233;舊名export_emails_markdown為 deprecated alias)。這正是 che-apple-mail-mcp#232 事故的 SOP 側缺口:#232 的 Proposed Solution 第 1 項「Step 5 大批量走批次路徑(強制/預設)」在該 issue 關閉時只落地了 binary 側(rename + 命名 discoverability,經 #233 出貨);SOP 側的 Step 5 遷移至今未動。SOP 文字甚至完全沒有出現任何 export 工具名(grep 零命中)— AI 執行者照 Step 5 逐封抓是文件指示的預期行為,不是偏差。
Proposed Solution(依 #232 原案)
batch_export_emails_markdown(一次呼叫、per-email manifest、skip_message_ids_pathdedup、manifestmessage_id可直接 reconcile INDEX_FILE);per-emailget_email迴圈降為 fallback。mailbox參數標 direction,mixed corpus 拆收/寄兩批;見 #232 Considerations)。opts.include_attachments的分工要明文(batch 匯出可含附件;classify 到 data/documents 的既有分流邏輯如何銜接需設計)。body_type/in_reply_to;SOP 現行 frontmatter 欄位(thread_key/direction)是 client-side 加值,遷移後由 manifest 後處理補寫或保留 client-side 步驟,需設計決定。Context
✅ Verified(PR #114 @ frozen
ada402d,tagidd-107-verified)Step 5 主路徑遷移至
batch_export_emails_markdown(Step 5.0),per-email 降為 Step 5.1 fallback(<5 / enriched / batch 失敗)。shell v2.32.0(binary 不動 v2.19.0)。6-AI verify 兩輪。R1(
dc849ff)四 verifier 全 FAIL,DA REQUEST-CHANGES + 3 REQUIRED——攔下三個真實缺陷:direction: received(subject_keywords/zero-arg 模式每封寄出信都誤標)。→ 改按每封信自己的 mailbox 真分區(批 B =matchesSpecial(id.mailbox, Sent);批 A = 其餘 − uncertain),批 B 傳字面"Sent"(locale-robust)。opts.filenames只是請求名(工具對 override branch 也 uniquify、seed 自 on-disk)→ downstream 一律以manifest.written_path為準。回覆:/回复:+ case-insensitive 的 superset,SOP 舊規則窄 → batch/fallback 同 thread 拿不同 thread_key。→ SOP thread_key rule + Step 3 regex 對齊 binary superset;sender 記 lowercased、date 記 offset-preserving。R2 re-verify(
ada402d):綜合 lens PASS(3 REQUIRED 全落地、regex 與 binary 完全一致、對 #112 Step 8b 安全)+ DA APPROVE。post-verify polishfa47894(2 cheap doc-precision)。Master report。已知 follow-up(非本次):SOP 的 Layer-2 corpus-refinement subject matcher 仍用 pre-Fix-3 窄前綴集(不同 code path,屬
archive-mail-corpus-refinementspec)。狀態:停在 verified。merge 順序 #108 → #111 → #113 → #114(archive-mail 塔);plugins#110 stack 在本 PR 上;close 由維護者決定。