← 返回 Skills 市场
cedarscy

Gmail Cleaner

作者 cedarscy · GitHub ↗ · v1.0.0
cross-platform ⚠ suspicious
543
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install gmail-cleaner
功能描述
Clean and organize Gmail accounts in bulk. Use when asked to clean Gmail, remove spam, trash newsletters/promotional emails, bulk-delete emails by sender, cr...
使用说明 (SKILL.md)

Gmail Cleaner

Bulk Gmail cleanup using the Gmail API. Processes 1000 messages per API call.

Prerequisites

  • google-api-python-client, google-auth-oauthlib Python packages (scripts auto-install if missing)
  • OAuth credentials JSON from Google Cloud Console (Desktop app type)
  • Token files stored as .pkl files per account

Workflow

1. Auth (first time or new account)

python scripts/auth.py --credentials /path/to/credentials.json --token /path/to/token.pkl --scopes settings
  • basic scopes: read/modify/delete messages + labels
  • settings scopes: adds gmail.settings.basic (required for creating filters)
  • Default token path: ~/.openclaw/workspace/gmail_token.pkl
  • Default creds path: ~/.openclaw/workspace/gmail_credentials.json

For a second account, specify a different --token path (e.g., gmail_token_work.pkl).

2. Scan (identify what to clean)

python scripts/scan.py --token /path/to/token.pkl --sample 500

Shows inbox counts by category + top 40 senders. Run this first.

3. Clean (bulk trash/delete)

# Trash specific senders:
python scripts/clean.py --from "[email protected],[email protected]"

# Trash by Gmail search query:
python scripts/clean.py --query "category:promotions older_than:30d"

# From a JSON config file (list of {query, label}):
python scripts/clean.py --config senders.json

# Permanently delete instead of trash:
python scripts/clean.py --from "[email protected]" --delete

# Dry run first:
python scripts/clean.py --from "[email protected]" --dry-run

4. Deep Clean (comprehensive)

# Full deep clean (4 steps: trash promos → archive old → mark read → purge trash):
python scripts/deep_clean.py

# Custom age thresholds:
python scripts/deep_clean.py --promo-days 7 --archive-days 30 --unread-days 14

# Skip trash purge (keep trash for 30-day auto-delete):
python scripts/deep_clean.py --skip-trash-purge

5. Organize (labels + filters)

# Apply built-in label set (Business, Banking, Tech, Personal, Trading, Social):
python scripts/organize.py

# Custom labels/rules/filters from JSON:
python scripts/organize.py --config labels.json

# Labels only (no filters):
python scripts/organize.py --skip-filters

6. Restore (rescue emails from trash)

# Restore all emails from a sender + apply a label:
python scripts/restore.py --from [email protected] --label "Harvard Health"

# Restore by query:
python scripts/restore.py --query "from:apple.com in:trash" --label "Tech/Apple"

Multiple Accounts

Run each script with a different --token path per account:

python scripts/scan.py    --token ~/.openclaw/workspace/gmail_token_personal.pkl
python scripts/scan.py    --token ~/.openclaw/workspace/gmail_token_work.pkl
python scripts/deep_clean.py --token ~/.openclaw/workspace/gmail_token_work.pkl

Common Patterns

Full cleanup for one account:

python scripts/auth.py --scopes settings
python scripts/scan.py                         # identify top senders
python scripts/clean.py --from "..."          # trash specific senders
python scripts/deep_clean.py                   # clean categories
python scripts/organize.py                     # create labels + filters

Rescue important emails caught in bulk delete:

python scripts/restore.py --from [email protected] --label "Important"

Senders config file format for clean.py --config:

[
  {"query": "from:[email protected]", "label": "Temu"},
  {"query": "category:promotions older_than:7d", "label": "Old Promos"}
]

Notes

  • batchModify moves to TRASH — Gmail auto-purges after 30 days
  • batchDelete is permanent and irreversible — always dry-run first
  • Gmail filter creation requires gmail.settings.basic scope — re-auth with --scopes settings if filters fail with 403
  • scan.py samples N messages; large inboxes may need --sample 2000 for accuracy
  • Credentials JSON comes from Google Cloud Console → APIs & Services → Credentials → OAuth 2.0 → Desktop → Download JSON
安全使用建议
This skill appears to be what it claims: a Gmail bulk-cleaner built around the Gmail API. Before installing/using it: 1) Review and obtain your own Google OAuth credentials JSON from Google Cloud Console (do not use credentials/token files from untrusted sources). 2) Use the --dry-run option to verify which messages will be affected before allowing deletions. 3) Be aware the scripts store tokens as pickle (.pkl) files — do not load token files from untrusted parties, and protect the token files' filesystem permissions. 4) The scripts auto-install Python packages via pip at runtime; consider pre-installing and pinning versions in a controlled environment (or run inside a virtualenv/container) to reduce supply-chain risk. 5) Limit scopes requested when possible (use 'basic' instead of 'all' unless you need filter creation), and back up important mail before running mass delete/purge operations.
功能分析
Type: OpenClaw Skill Name: gmail-cleaner Version: 1.0.0 The skill is classified as suspicious due to the use of `os.system` for package installation and `pickle.load` for deserializing authentication tokens. While `os.system` in `scripts/auth.py`, `scripts/clean.py`, `scripts/deep_clean.py`, `scripts/organize.py`, `scripts/restore.py`, and `scripts/scan.py` is used with hardcoded arguments for installing known dependencies, it represents a direct shell execution vulnerability if the execution environment or `sys.executable` path were compromised. Additionally, `pickle.load` (used across all scripts to load `gmail_token.pkl`) is a known deserialization vulnerability that could lead to arbitrary code execution if an attacker were able to replace the token file with a malicious payload. These are significant vulnerabilities, not malicious intent, aligning with a 'suspicious' classification.
能力评估
Purpose & Capability
Name/description match the included scripts (auth, scan, clean, deep_clean, organize, restore). The code requires OAuth credentials JSON and token .pkl files (as documented) and calls the Gmail API for listing/labeling/trashing/deleting — all expected for a Gmail cleanup tool. There are no unrelated environment variables, binaries, or external services requested.
Instruction Scope
SKILL.md instructs running the included scripts with token/credentials paths and describes expected scopes. The scripts only read the provided credentials/token files, interact with the Gmail API, create labels/filters, and modify messages. They do not reference unrelated system paths or hidden external endpoints other than Google APIs. The instructions advise dry-run mode and warn about irreversible deletes.
Install Mechanism
There is no formal install spec, but each script will attempt to install required Python packages at runtime via os.system pip install if imports fail. Installing packages from PyPI at runtime is common but carries moderate risk (silent installs, no pinned versions). There are no downloads from untrusted URLs or archives in the skill itself.
Credentials
No environment variables or unrelated credentials are requested. The only persistent data are OAuth credentials JSON (user-supplied) and token pickle files stored by default under ~/.openclaw/workspace — this is proportional and documented. The tool asks for Gmail scopes appropriate for its operations (modify, readonly, settings).
Persistence & Privilege
always:false and model-invocation is normal. The skill writes token files to its own workspace location and creates Gmail filters/labels in the user's Gmail account (expected). It does not modify other skills or system-wide agent settings.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install gmail-cleaner
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /gmail-cleaner 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release — bulk trash, deep clean, organize labels, restore from trash, multi-account support via token files
元数据
Slug gmail-cleaner
版本 1.0.0
许可证
累计安装 0
当前安装数 0
历史版本数 1
常见问题

Gmail Cleaner 是什么?

Clean and organize Gmail accounts in bulk. Use when asked to clean Gmail, remove spam, trash newsletters/promotional emails, bulk-delete emails by sender, cr... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 543 次。

如何安装 Gmail Cleaner?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install gmail-cleaner」即可一键安装,无需额外配置。

Gmail Cleaner 是免费的吗?

是的,Gmail Cleaner 完全免费(开源免费),可自由下载、安装和使用。

Gmail Cleaner 支持哪些平台?

Gmail Cleaner 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Gmail Cleaner?

由 cedarscy(@cedarscy)开发并维护,当前版本 v1.0.0。

💬 留言讨论