Gws Gmail Auto
Comprehensive command designed for gmail, watch, emails, stream. Includes structured workflows, validation checks, and reusable patterns for google workspace.
GWS Gmail Auto
Automate Gmail operations for email management, filtering, labeling, and batch processing.
When to Use This Command
Run this command when you need to:
- Process emails in bulk: archive, label, delete, or move messages matching specific criteria
- Set up or manage Gmail filters and labels programmatically across your domain
- Export email data for compliance, backup, or migration to another platform
Consider alternatives when:
- You need to compose and send a single email which is simpler through the Gmail interface
- You are managing Gmail delegated access which requires Admin Console configuration
Quick Start
Configuration
name: gws-gmail-auto type: command category: google-workspace
Example Invocation
claude command:run gws-gmail-auto --action cleanup --filter "older:90d label:promotions" --apply archive
Example Output
Executing Gmail automation...
Action: cleanup
Filter: older:90d label:promotions
Operation: archive
Scanning inbox...
Messages matching filter: 1,247
Total size: 845 MB
Processing messages...
[========================================] 1247/1247 complete
Cleanup summary:
Archived: 1,247 messages
Storage freed: 845 MB
Remaining in Promotions: 89 messages (last 90 days)
Labels updated: Promotions (1,247 messages removed from inbox view)
Core Concepts
Gmail Automation Overview
| Aspect | Details |
|---|---|
| Bulk Actions | Archive, delete, label, star, mark-read on messages matching criteria |
| Filters | Create, update, delete Gmail filters for automatic message processing |
| Labels | Manage labels: create, rename, delete, nest with color customization |
| Export | Download messages in EML or MBOX format for backup or migration |
| Search | Full Gmail search syntax support for precise message targeting |
Automation Workflow
Define Filter Criteria
|
v
Preview Matching Messages
(count + sample)
|
v
Select Bulk Action
| | | |
v v v v
Archive Delete Label Export
| | | |
v v v v
Process in Batches
[progress tracking]
|
v
Report Results
Configuration
| Parameter | Type | Default | Description |
|---|---|---|---|
| action | string | (required) | Operation: cleanup, filter, label, export, search |
| filter | string | (none) | Gmail search query to select target messages |
| apply | string | (none) | Bulk action: archive, delete, label, star, mark-read |
| label | string | (none) | Label name for label operations or label-based filtering |
| export-path | string | ./ | Local directory for message export output |
Best Practices
-
Preview before processing - Always run with
--dry-runfirst to see how many messages match your filter. A broad filter likeolder:30dmight match thousands of important messages. -
Use Gmail search syntax precisely - Combine operators for precise targeting:
from:[email protected] subject:newsletter older:60dis much safer thansubject:newsletteralone. -
Archive instead of delete - Archiving removes messages from the inbox without deleting them. This is safer for cleanup operations since archived messages are still searchable.
-
Create filters for ongoing automation - Instead of repeatedly running cleanup commands, create a Gmail filter that automatically archives, labels, or deletes matching messages going forward.
Common Issues
-
Batch processing interrupted - Network timeouts can interrupt large batch operations. The command tracks progress and can resume from where it left off using the batch checkpoint file.
-
Filter matches unexpected messages - Gmail search syntax can be surprising. The operator
from:usermatches any header containing "user", not just the from address. Usefrom:[email protected]for precision. -
Export exceeds disk space - Large mailboxes can produce multi-gigabyte exports. Check available disk space before starting and use date filters to export in smaller chunks. Consider exporting in MBOX format which is more compact than individual EML files for large mailbox archives.
Reviews
No reviews yet. Be the first to review this template!
Similar Templates
Git Commit Message Generator
Generates well-structured conventional commit messages by analyzing staged changes. Follows Conventional Commits spec with scope detection.
React Component Scaffolder
Scaffolds a complete React component with TypeScript types, Tailwind styles, Storybook stories, and unit tests. Follows project conventions automatically.
CI/CD Pipeline Generator
Generates GitHub Actions workflows for CI/CD including linting, testing, building, and deploying. Detects project stack automatically.