Intelligent Gmail email classification and organization plugin with learning. Automatically categorize emails (receipts, newsletters, promotions) and organize your inbox with AI assistance.
- Smart Classification: Automatically categorizes emails into receipts, newsletters, and promotions
- Confidence Scoring: Know how certain the classifier is about each categorization
- Learned Preferences: The plugin learns which senders you trust and which you want to block
- Safety-First: All actions require user confirmation before archiving (initially)
- Quality Tiers: Assess newsletters as high, medium, or low quality
- User Feedback Loop: Improves over time based on your decisions
- Expandable: Easy to add new categories as your needs grow
-
Clone/Download this plugin into your Claude Code plugins directory:
~/.claude/plugins/gmail-classifier/ -
Set up Gmail authentication:
- Enable 2-step verification in your Google Account: https://myaccount.google.com/security
- Create an App Password: https://myaccount.google.com/apppasswords
- Add to your shell secrets (
.zshrc,.bashrc, etc.):export GMAIL_APP_PASSWORD="your-16-char-app-password"
- Reload:
source ~/.zshrc
-
Verify MCP Setup:
cd ~/.claude/plugins/gmail-classifier cat .mcp.json # Verify gmail-mcp configuration
-
Load the plugin in Claude Code:
/help plugins # or reload Claude Code session
/classify 15This analyzes 15 recent unread emails and categorizes them:
- π¦ Receipts: High confidence, suggested action: archive
- π° Newsletters: Medium confidence, quality assessed
- π Promotions: Medium confidence, suggested action: archive
/review-suggestionsFor each classified email, decide:
- β Approve - Apply the suggested action
- β Reject - Keep in inbox, ignore suggestion
- π Learn - Remember this decision for future emails from this sender
/organize-config viewView your current configuration, or:
/organize-config editEdit to add:
- Trusted newsletter senders (keep in inbox)
- Senders to always archive
- Blocked domains (spam sources)
- Custom category patterns
Analyze and classify recent unread emails.
/classify # Process 10 emails (default)
/classify 20 # Process 20 emails
/classify 50 # Process 50 emailsOutput: Summary of found categories with confidence levels and suggested actions.
Review classified emails and make decisions.
Options:
- β Approve - Apply suggested action
- β Reject - Don't apply action
- π Learn - Remember decision for this sender
- Skip - Review later
Manage classification rules and preferences.
/organize-config view # Show current settings
/organize-config edit # Edit configuration
/organize-config reset # Reset preferencesSettings are stored in .local.md with these sections:
Define how to classify each email type:
categories:
receipts:
confidence: high
action: archive
patterns: [order, receipt, invoice, confirmation]
common_domains: [amazon.com, ebay.com, stripe.com, paypal.com]
newsletters:
confidence: medium
action: review
quality_tiers: [high, medium, low]
patterns: [newsletter, digest, subscription]
promotions:
confidence: medium
action: archive
patterns: [sale, discount, offer, promo]Track your decisions over time:
learned_preferences:
keep_newsletters:
- newsletter@techcrunch.com
- digest@morning.news
archive_newsletters:
- spam@promotional.com
keep_senders:
- boss@company.com
- friend@personal.com
blocked_domains:
- unwanted-spam.com- Pattern Matching: Check sender domain and keywords
- Confidence Scoring: Calculate likelihood (0-100%)
- Learned Preferences: Apply your learned rules
- Suggest Action: Recommend archive, review, or keep
- User Review: Show suggestions for your approval
Classify Email
β
Show Confidence + Suggestion
β
User Feedback (Approve/Reject/Learn)
β
Update Preferences
β
Apply to Similar Emails (Next Time)
- π High: Keep in inbox (professional, well-researched, personalized)
- β Medium: Review periodically (decent content, standard templates)
- Low: Archive (generic, frequent, low engagement)
$ /classify 10
Found 6 receipts (95% confidence)
Action: Archive
$ /review-suggestions
β
Approve: Archive 6 receipts
Result: 6 emails moved to archive, clutter reduced.
$ /classify 20
Found 5 newsletters (78% confidence)
$ /review-suggestions
Newsletter from newsletter@techcrunch.com
β High Quality
β [π Learn] "Always keep this"
β Added to keep_newsletters
Newsletter from spam@promotional.com
β Low Quality
β [π Learn] "Always archive this"
β Added to archive_newsletters
Result: Similar emails from these senders are now handled automatically.
$ /organize-config edit
# Add to blocked_domains:
blocked_domains:
- flash-sale-spam.com
- daily-deals.net
Result: Emails from these domains skip the inbox classification.
- Automatic scheduling (process inbox daily at night)
- More categories (bills, account notifications, work, social)
- Advanced quality scoring for newsletters
- Label/folder organization (Gmail integration)
- Undo/revert suggestions
- Per-sender engagement tracking
- Collaborative filtering (recommended newsletters)
- Time-based patterns (seasonal emails)
- Multi-language support
Check Gmail app password:
echo $GMAIL_APP_PASSWORD
# Should print your 16-character app passwordIf not set, add to your shell config (~/.zshrc or ~/.bashrc):
export GMAIL_APP_PASSWORD="your-16-char-password"- Check your inbox has unread emails
- Try with higher count:
/classify 50 - Verify Gmail authentication
- Provide feedback with
/review-suggestions - Use π Learn to train on your preferences
- Check configuration:
/organize-config view - Adjust patterns in
.local.mdif needed
Edit .local.md to adjust preferences:
- Remove senders from
keep_newslettersorarchive_newsletters - Remove domains from
blocked_domains - Reset with
/organize-config reset
gmail-classifier/
βββ .claude-plugin/
β βββ plugin.json # Plugin manifest
βββ .mcp.json # Gmail MCP configuration
βββ .local.md # User settings & preferences
βββ commands/
β βββ classify.md # /classify command
β βββ review-suggestions.md # /review-suggestions command
β βββ organize-config.md # /organize-config command
βββ agents/
β βββ email-organizer.md # Autonomous email organizer agent
βββ skills/
β βββ email-organization/
β βββ SKILL.md # Email organization strategy skill
βββ scripts/
β βββ classify-logic.py # Core classification engine
β βββ preference-learner.py # Preference learning system
βββ README.md # This file
- Commands: User-facing actions (
/classify,/review-suggestions,/organize-config) - Agent:
email-organizer- Autonomous classification and suggestion generation - Skill: Email organization strategy and patterns
- Scripts: Python helpers for classification and preference learning
- Settings:
.local.md- User configuration and learned preferences
- First run: ~2-3 seconds per 10 emails (no learned preferences)
- Subsequent runs: ~1 second per 10 emails (with learned preferences)
- Learning benefit: 80% faster processing after 2-4 weeks of use
- All classification happens locally (no external APIs)
- Gmail passwords are stored in shell environment only
- Learned preferences stored in
.local.md(gitignored) - No data sent to third parties
To extend the plugin:
- Add new category: Update
categoriesin.local.md, add patterns toclassify-logic.py - Improve patterns: Edit
scripts/classify-logic.pyto refine detection - Add features: Modify commands or create new skills
- Report issues: Create issue with classification example
- Stuck? Read the Email Organization Strategy skill:
/email-organization - Need help? Run
/help classifyor/help organize-config - Questions? Check the command examples above
Version: 0.1.0 Author: Claude License: MIT Last Updated: February 2026