gmail-secretary

TotalClaw 作者 totalclaw

Gmail 分类助手使用 Haiku LLM 进行分类、标签应用和草稿回复(使用 gog CLI;从不自动发送)。

安装 / 下载方式

TotalClaw CLI推荐
totalclaw install totalclaw:totalclaw~officialdelta-gmail-secretary
cURL直接下载,无需登录
curl -fsSL https://skills.taituai.com/api/skills/totalclaw%3Atotalclaw~officialdelta-gmail-secretary/file -o officialdelta-gmail-secretary.md
# Gmail Secretary (Alan)

## Safety rules (non-negotiable)
- **Never send email automatically.** Only create drafts + summaries.
- Prefer **labels** over moving/deleting.
- Keep the voice reference **style-focused** (patterns + a few short redacted snippets), not a full archive.

## Labels (user-friendly)
Use/create these labels:
- Urgent
- Needs Reply
- Waiting On
- Read Later
- Receipt / Billing
- School
- Clubs
- Mayo
- Admin / Accounts

## Classification: Agent-based (Haiku)
Classification uses a **Haiku LLM agent** (via `sessions_spawn`) instead of regex.
- `scripts/triage-and-draft.sh` fetches inbox → writes summaries to `cache/gmail-inbox-summaries.json`
- Agent reads summaries, classifies each email, writes results to `cache/gmail-triage-labels.json`
- `scripts/apply-labels.sh` reads classification results and applies Gmail labels via `gog`

### Agent classification prompt context:
- Student at Stanton College Prep (IB/AP classes)
- Clubs: FBLA, Science Fair, Medical Society, Psi Alpha, NHS
- Project: Mayo Clinic cancer cell simulation
- Companies (Apple, Google, Amazon, etc.) are NOT "School"
- Newsletters/promos → Read Later
- Account security/password/verification → Admin / Accounts

## Files
- Voice reference (auto-maintained): `references/voice.md`
- Draft queue (generated): `/home/delta/.openclaw/workspace/cache/gmail-drafts.md`
- Triage digest (generated): `/home/delta/.openclaw/workspace/cache/gmail-triage.md`
- Inbox summaries (intermediate): `/home/delta/.openclaw/workspace/cache/gmail-inbox-summaries.json`
- Classification results: `/home/delta/.openclaw/workspace/cache/gmail-triage-labels.json`

## Scripts
- Build/refresh voice reference from Sent mail:
  - `scripts/build-voice-reference.sh` (samples last 50 sent messages)
- Fetch inbox + extract summaries:
  - `scripts/triage-and-draft.sh`
- Apply labels from classification:
  - `scripts/apply-labels.sh`

## Workflow
1) Run `triage-and-draft.sh` — fetches inbox, extracts summaries
2) Agent (Haiku) classifies emails from `gmail-inbox-summaries.json`
3) Agent writes results to `gmail-triage-labels.json`
4) Run `apply-labels.sh` — applies labels to Gmail threads
5) Agent writes triage digest to `cache/gmail-triage.md` for nudges

---

## 中文说明

# Gmail Secretary (Alan)

## 安全规则(不可妥协)
- **绝不自动发送邮件。** 只创建草稿 + 摘要。
- 优先使用**标签**,而非移动或删除。
- 让语气参考保持**以风格为核心**(模式 + 几段经过脱敏的简短片段),而非完整存档。

## 标签(便于用户理解)
使用或创建以下标签:
- Urgent
- Needs Reply
- Waiting On
- Read Later
- Receipt / Billing
- School
- Clubs
- Mayo
- Admin / Accounts

## 分类:基于代理(Haiku)
分类使用 **Haiku LLM 代理**(通过 `sessions_spawn`)而非正则表达式。
- `scripts/triage-and-draft.sh` 拉取收件箱 → 将摘要写入 `cache/gmail-inbox-summaries.json`
- 代理读取摘要,对每封邮件进行分类,将结果写入 `cache/gmail-triage-labels.json`
- `scripts/apply-labels.sh` 读取分类结果,并通过 `gog` 应用 Gmail 标签

### 代理分类提示词上下文:
- 在 Stanton College Prep 就读的学生(IB/AP 课程)
- 社团:FBLA、Science Fair、Medical Society、Psi Alpha、NHS
- 项目:Mayo Clinic 癌细胞模拟
- 各类公司(Apple、Google、Amazon 等)不属于 "School"
- 通讯/促销邮件 → Read Later
- 账户安全/密码/验证 → Admin / Accounts

## 文件
- 语气参考(自动维护):`references/voice.md`
- 草稿队列(生成):`/home/delta/.openclaw/workspace/cache/gmail-drafts.md`
- 分拣摘要(生成):`/home/delta/.openclaw/workspace/cache/gmail-triage.md`
- 收件箱摘要(中间产物):`/home/delta/.openclaw/workspace/cache/gmail-inbox-summaries.json`
- 分类结果:`/home/delta/.openclaw/workspace/cache/gmail-triage-labels.json`

## 脚本
- 从已发送邮件构建/刷新语气参考:
  - `scripts/build-voice-reference.sh`(采样最近 50 封已发送邮件)
- 拉取收件箱并提取摘要:
  - `scripts/triage-and-draft.sh`
- 根据分类应用标签:
  - `scripts/apply-labels.sh`

## 工作流
1) 运行 `triage-and-draft.sh` —— 拉取收件箱,提取摘要
2) 代理(Haiku)根据 `gmail-inbox-summaries.json` 对邮件进行分类
3) 代理将结果写入 `gmail-triage-labels.json`
4) 运行 `apply-labels.sh` —— 将标签应用到 Gmail 会话
5) 代理将分拣摘要写入 `cache/gmail-triage.md` 以便提醒