prj-gmail-cleanup
Skill2 starsChanged 3 months agoMITView on GitHub
Gmail inbox optimization and label management with category awareness
In this repository10 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- gmail-analyzeSkill
- gmail-classifySkill
- gmail-filterSkill
- gmail-labelSkill
- gogSkill
- prj-drive-cleanupSkill
- prj-driveSkill
- prj-inboxSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 37
Ask user which category to focus on (or "all").
- Distinctive: line 149
Keep all emails in inbox (don't archive unless asked)
- Very specific: line 150
Always dry-run first with scripts: DRY_RUN=true ./scripts/script.sh
- Very specific: line 151
Use category filter: CATEGORY=promotions DRY_RUN=true ./scripts/ai_categorize.sh
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Gmail Cleanup Workflow
Gmail inbox optimization and label management. Analyzes uncategorized emails, suggests new labels and filters, organizes inbox.
Prerequisites
gog CLI installed and authenticated with Gmail.
Workflow
1. Show Category Breakdown
Count emails per Gmail tab (Promotions, Social, Updates, Primary):
# Promotions
gog gmail search "in:promotions has:nouserlabels -in:spam -in:trash" --max=500 --plain
# Social
gog gmail search "in:social has:nouserlabels -in:spam -in:trash" --max=500 --plain
# Updates
gog gmail search "in:updates has:nouserlabels -in:spam -in:trash" --max=500 --plain
# Primary (truly uncategorized)
gog gmail search "has:nouserlabels -in:promotions -in:social -in:updates -in:forums -in:spam -in:trash" --max=500 --plainAsk user which category to focus on (or "all").
2. Analyze Selected Category
# List labels and filters
gog gmail labels list
gog gmail settings filters list
# Get uncategorized emails (max 100)
gog gmail search "has:nouserlabels -in:spam -in:trash" --max=100 --plain3. Identify Patterns
Analyze uncategorized emails for:
- Sender domains (group by @domain.com)
- Subject keywords
- Frequency
Category-specific suggestions:
- Promotions -> Services/Shopping, Finance/Subscriptions
- Social -> Admin/Notifications
- Updates -> Finance/Payments, Projects/Purchases
- Primary -> analyze sender/subject patterns
Present as table:
| Sender Pattern | Count | Suggested Label |
|----------------|-------|-----------------|
| @domain.com | 15 | Category/Label |4. Propose Actions (Ask Approval First)
Present proposals:
New Labels:
- Finance/Subscriptions
- Services/ShoppingNew Filters:
| From | Label | Keep in Inbox |
|------|-------|---------------|
| rakuten.com | Services/Shopping | Yes |Emails to Categorize:
Found X emails to labelWait for user confirmation before executing.
5. Execute Approved Actions
# Create label
gog gmail labels create "Category/Subcategory"
# Create filter (keeps in inbox)
gog gmail settings filters create --from="domain.com" --add-label="Category/Label"
# Apply label to existing emails
THREADS=$(gog gmail search "from:domain.com -label:Target" --max=500 --plain | awk '{print $1}')
for tid in $THREADS; do
gog gmail labels modify "$tid" --add="Target/Label"
done6. Report Results
Summarize:
- Labels created
- Filters added
- Emails categorized
- Remaining uncategorized per category
Label Hierarchy
Finance/ Investments, Taxes, Insurance, Payments, Subscriptions
Services/ Tech, Gaming, Automotive, Shopping
Projects/ Travel, Purchases, Legal
Admin/ Security, Jobs, Notifications
Status/ Pending, Important, ArchiveCommon Sender Patterns
| Pattern | Label |
| bank, credit | Finance/Payments |
| invest, crypto | Finance/Investments |
| tax, impots | Finance/Taxes |
| github, gitlab | Services/Tech |
| game, steam | Services/Gaming |
| travel, flight | Projects/Travel |
| shop, order | Services/Shopping |
Best Practices
- Keep all emails in inbox (don't archive unless asked)
- Always dry-run first with scripts:
DRY_RUN=true ./scripts/script.sh - Use category filter:
CATEGORY=promotions DRY_RUN=true ./scripts/ai_categorize.sh
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

