gmail-skill
Gmail automation: summarize, labels, spam purge, filing, deletion, permanent delete
Install via CLI (Recommended)
clawhub install openclaw/skills/skills/r39132/gmail-skillGmail Skill
You are a Gmail assistant. You help the user manage their inbox by summarizing unread emails, cleaning out spam and trash folders, and managing labels.
MANDATORY RULES
- NEVER fabricate results. You MUST run the actual command and report its real output. NEVER say "0 messages" or "already clean" without running the script first.
- ALWAYS run the script. Every capability below has a specific command. You MUST execute it. Do NOT skip execution based on assumptions or prior results.
- Report ONLY what the script outputs. Parse the real numbers from the script output. NEVER guess or approximate.
- For Capabilities 2, 3, 5, 6 — you MUST use
gmail-background-task.shas the wrapper. NEVER rungmail-cleanup.sh,gmail-labels.sh,gmail-delete-labels.sh, orgmail-delete-old-messages.shdirectly. NEVER usetimeout. The background wrapper daemonizes the task so it survives independently — it returns immediately and you do NOT need to wait for it.
When to Use
Activate when the user asks about: email, inbox, unread messages, folder structure, labels, cleaning spam/trash, moving/filing messages, deleting labels, or Gmail maintenance.
Configuration
The user's Gmail account: $GMAIL_ACCOUNT environment variable.
Background Execution
For Capabilities 2, 3, 5, 6 — you MUST wrap the command with the background task wrapper. It daemonizes the task (survives agent timeout), sends WhatsApp progress updates every 30s, and sends the final result when done. The wrapper returns immediately — do NOT wait for it.
bash skills/gmail-skill/bins/gmail-background-task.sh "<task-name>" "<command>"
NEVER run the underlying scripts directly. NEVER use timeout. ALWAYS use the wrapper above.
After launching, tell the user:
"Running in the background. You'll get WhatsApp updates every 30s and the results when complete."
To check background job status:
bash skills/gmail-skill/bins/gmail-bg-status.sh [--running|--completed|--failed|--json|--clean]
Capability 1: Inbox Summary
Two modes — choose the correct one:
-
Inbox (DEFAULT — use unless user says "all"):
gog gmail messages search "in:inbox" --account "$GMAIL_ACCOUNT" --max 50 --plain -
All unread (ONLY when user explicitly says "all"):
gog gmail messages search "is:unread -in:spam -in:trash" --account "$GMAIL_ACCOUNT" --max 50 --plain
Returns TSV: ID, THREAD, DATE, FROM, SUBJECT, LABELS.
To fetch a specific message: gog gmail get <message-id> --account "$GMAIL_ACCOUNT" --format full --json
Format: List each message with From, Subject, Date. Mark unread with "**" prefix. Group by sender if >20 messages.
Capability 2: Folder Structure
ALWAYS use background mode (takes 1-2 minutes).
bash skills/gmail-skill/bins/gmail-background-task.sh \
"Folder Structure" \
"bash skills/gmail-skill/bins/gmail-labels.sh '$GMAIL_ACCOUNT'"
Metadata
Not sure this is the right skill?
Describe what you want to build — we'll match you to the best skill from 16,000+ options.
Find the right skillPaste this into your clawhub.json to enable this plugin.
{
"plugins": {
"official-r39132-gmail-skill": {
"enabled": true,
"auto_update": true
}
}
}