Gmail Unsubscribe Cleaner
Quick start
- •Confirm explicit consent to read and modify Gmail.
- •Collect policy inputs: allowlist, denylist, cleanup action, dry-run limit, and schedule.
- •Pull Gmail message metadata and convert it to JSONL with
scripts/gmail_export_metadata.py(seereferences/data-schema.md). - •Run
scripts/classify_marketing.pyto label marketing messages. - •Present a dry-run summary and ask for approval before unsubscribing or trashing.
- •Apply unsubscribe actions and cleanup steps, then log outcomes.
Safety rules
- •Require a dry-run before any destructive action.
- •Skip protected categories unless the user opts in.
- •Use least-privilege Gmail scopes and avoid storing raw message bodies.
- •Keep an audit log and add a durable label to processed messages.
Resources
- •
scripts/gmail_export_metadata.py: Gmail API metadata exporter (OAuth). - •
scripts/classify_marketing.py: Offline classifier for marketing signals. - •
scripts/gmail_unsubscribe_oneclick.py: List-Unsubscribe one-click executor. - •
scripts/gmail_unsubscribe_mailto.py: Mailto unsubscribe sender (approval gated). - •
scripts/gmail_apply_cleanup.py: Archive/trash/label cleanup actions. - •
references/workflow.md: End-to-end agentic workflow. - •
references/policy.md: Classification policy and allowlist guidance. - •
references/data-schema.md: Input/output schema for classifier. - •
references/cleanup-actions.md: Cleanup options and space recovery notes. - •
references/gmail-api-setup.md: OAuth setup and scope guidance. - •
assets/allowlist.txt: Allowlist template for trusted senders. - •
assets/denylist.txt: Denylist template for always-unsubscribe senders.
Output expectations
- •Provide a summary: total scanned, marketing candidates, unsubscribe candidates, cleanup actions.
- •Provide a confirmation step before changes.
- •Produce an action log for transparency and rollback.
- •If trashing, send a summary email after approval.