360 Secure SkillHub
360 安全技能中心

GClaw

面向 OpenClaw 的 Gmail 收件箱智能库:经 gog CLI 获取邮件,EmailFetcher 去重缓存,EmailParser 解析发件人与正文,EmailClassifier 以 15 类启发式规则离线分类,EmailStore 按 bot_id 持久化为 JSONL;BotContext 提供多 bot 标签/发件人隔离,仅在需要摘要时调用 LLM。

yhyatt
yhyatt
热度 43.89
最近更新 2026-05-20 03:29:56
分类:协作依赖:代码执行 / 读写文件 / 第三方 API / 内部调用大模型应用场景:摘要总结 / 工作流 / 自动化脚本 / 数据处理

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add gclaw
Metadata
name
gclaw
description
Gmail inbox intelligence for OpenClaw. Reads, classifies, and digests your Gmail so the important stuff surfaces without the noise. Use when fetching new emails, running an inbox digest, classifying messages into categories (newsletter, finance, travel, work, action-required, etc.), or building downstream bots that consume email data. Provides BotContext (per-bot label isolation), EmailFetcher, EmailParser, EmailClassifier (15 categories), and EmailStore (deduplicated JSONL).
metadata
{"openclaw":{"requires":{"bins":["gog"]},"env":["GCLAW_GMAIL_ACCOUNT","GOG_KEYRING_PASSWORD"]}}

GClaw — Gmail Intelligence for OpenClaw

Reads, classifies, and digests your Gmail so the important stuff surfaces without the noise.

Zero LLM tokens for classification — heuristic classifier covers 15 categories. LLM only fires when you need a summary or digest narrative.

Setup

# Requires the gog skill (Google OAuth CLI)
export GCLAW_GMAIL_ACCOUNT="your@gmail.com"
export GOG_KEYRING_PASSWORD="your-keyring-password"

pip install -e .

Quick Usage

from kaimail.bot_context import BotContext
from kaimail.fetcher import EmailFetcher
from kaimail.classifier import EmailClassifier
from kaimail.store import EmailStore

# Each bot declares its own label scope
ctx = BotContext(
    bot_id="digest",
    allowed_labels=["INBOX", "CATEGORY_UPDATES"],
    max_results=50
)

fetcher = EmailFetcher(context=ctx)
emails = fetcher.fetch_new()  # deduped — never processes the same email twice

classifier = EmailClassifier()
store = EmailStore(bot_id="digest")

for email in emails:
    email.category = classifier.classify(email)
    store.save(email)
    print(f"[{email.category}] {email.subject}")

Classification Categories (15)

newsletter · finance · travel · work · action_required · social · shopping · security · calendar · health · legal · ads · receipt · personal · other

All heuristic — no LLM cost.

Architecture

Gmail (via gog CLI)
    └─► EmailFetcher      — fetch, cache, deduplicate
        └─► EmailParser   — extract sender, clean body, detect forwards
            └─► EmailClassifier  — 15-category heuristic classification
                └─► EmailStore  — JSONL persistence (per bot_id)

BotContext — Per-Bot Isolation

Multiple bots can share one Gmail account without interfering:

# Digest bot — only newsletters + inbox
digest_ctx = BotContext(bot_id="digest", allowed_labels=["Thoughts", "INBOX"])

# Travel bot — only travel senders
travel_ctx = BotContext(
    bot_id="travel",
    allowed_labels=["Travel"],
    allowed_senders=["booking.com", "airbnb.com", "kayak.com"]
)

Running Tests

pip install pytest
pytest tests/

Requirements

  • Python 3.10+
  • gog skill installed and authenticated
  • GOG_KEYRING_PASSWORD env var set

License

MIT