gmail-automation

Automates Gmail inbox cleanup via IMAP with scan, flag, approve, and delete workflow.

Updated Jul 3, 2026
One-click install
npx skills add https://github.com/decniner/HermesP1 --skill gmail-automation-decniner
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: gmail-automation
Source: https://github.com/decniner/HermesP1/tree/main/.hermes-backup/skills/productivity/gmail-automation
Command: npx skills add https://github.com/decniner/HermesP1 --skill gmail-automation-decniner

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Cleaning up a cluttered Gmail inbox with thousands of old unread emails is tedious and risky when done manually. This Skill automates the process using IMAP and Gmail App Passwords, flagging deletion candidates while protecting important senders, so nothing valuable is lost. ## Core Features & Use Cases - Automated Inbox Scanning: Connects to Gmail via IMAP, searches for unread emails older than 30 days, and batch-fetches headers in groups of 50 for fast processing. - Sender Protection Rules: Filters emails through an is_protected() function that safeguards payroll, government, banking, and personal contacts from deletion. - Approval-Based Deletion: Flags candidates with a star, waits for user approval, then moves flagged emails to Gmail Trash using X-GM-LABELS. - Scheduled Cleanup: Runs daily via Hermes cron jobs as a no-agent Python script. - Use Case: A user with 3,600+ old unread emails schedules a daily 8am scan; the script flags 34 safe candidates, and after the user replies "approve delete", they are moved to trash automatically. ## Quick Start Set up a Gmail App Password, then ask the agent to scan my inbox for unread emails older than 30 days and flag the safe ones for deletion.

Frequently Asked Questions about gmail-automation

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I automatically delete old unread Gmail emails?▼

Connect to Gmail via IMAP using an App Password, search with UNSEEN BEFORE criteria, flag matching emails with the \Flagged star, then move them to trash using the +X-GM-LABELS \Trash command after user approval.

How to use Gmail IMAP without OAuth?▼

Enable 2-Step Verification on the Google account, generate a 16-character App Password at myaccount.google.com/apppasswords, and log in with imaplib.IMAP4_SSL using that password instead of OAuth tokens.

Does Gmail IMAP search support Gmail web operators like newer_than?▼

No, IMAP search does not support Gmail web operators such as -has:attachment, from:, or newer_than:. You must use IMAP-native syntax like UNSEEN, BEFORE, FROM, SUBJECT, and FLAGGED.

Why is fetching Gmail headers one by one slow?▼

Individual fetches create one IMAP request per email, which is slow and risks rate limits. Batch-fetch headers in groups of 50-100 using comma-separated message IDs with BODY.PEEK[HEADER.FIELDS] for much faster processing.

What are the limitations of Gmail IMAP automation?▼

IMAP cannot detect attachments without expensive per-email BODYSTRUCTURE fetches, and Gmail rate-limits to roughly 1500 commands per 10 minutes. Trash contents also auto-purge after 30 days, so manual expunging is unnecessary.