Gmail AI Classifier
Intelligent email classification using AI reasoning for smart inbox organization.
Overview
Unlike pattern-based filtering, AI classification analyzes email content, sender context, and user behavior to make intelligent categorization decisions.
Usage
Syntax: /gmail-classify [days]
Examples:
/gmail-classify # Classify last 7 days
/gmail-classify 30 # Classify last 30 days
/gmail-classify --dry-run # Preview without applying
Classification Categories
| Category |
Indicators |
Label |
| Newsletter |
Substack, Mailchimp, "unsubscribe" link |
Newsletters |
| Shopping |
Order confirmation, shipping, tracking |
Shopping |
| Work |
Company domain, professional tone |
Work |
| Personal |
Personal contacts, casual tone |
Personal |
| Notifications |
GitHub, Slack, calendar alerts |
Notifications |
| Receipts |
Invoice, payment, receipt keywords |
Finance/Receipts |
| Promotions |
Discount, sale, marketing language |
Promotions |
Classification Workflow
Step 1: Fetch Emails
gog gmail search 'newer_than:${DAYS}d -label:classified' --json
Exclude already-classified emails to avoid re-processing.
Step 2: Analyze Each Email
For each email, analyze:
Sender Analysis
- Domain reputation (newsletter service? company?)
- Sender name format (person vs system)
- Reply-to address
Subject Analysis
- Keywords (order, invoice, newsletter, etc.)
- Format (numbered list? FW:? RE:?)
- Tone (formal, casual, marketing)
Content Indicators
- Unsubscribe link presence
- Tracking numbers
- Financial amounts
- Personal greetings
Step 3: Classify with Confidence
Assign category with confidence level:
| Confidence |
Threshold |
Action |
| High (90%+) |
Strong signals |
Auto-apply label |
| Medium (70-89%) |
Mixed signals |
Apply with note |
| Low (<70%) |
Unclear |
Skip, flag for review |
Step 4: Apply Labels
For high-confidence classifications:
# Ensure label exists
gog gmail labels list --json
gog gmail labels create "CategoryName"
# Apply label
gog gmail modify <message-id> --add-label <label-id>
Step 5: Report Results
## Classification Report
**Period**: Last 7 days
**Emails Analyzed**: 142
**Classifications Made**: 128
**Skipped (low confidence)**: 14
### Summary by Category
| Category | Count | % of Total |
|----------|-------|------------|
| Newsletters | 45 | 35% |
| Notifications | 32 | 25% |
| Shopping | 18 | 14% |
| Work | 15 | 12% |
| Personal | 12 | 9% |
| Receipts | 6 | 5% |
### High-Confidence Classifications (Auto-labeled)
- 98 emails across all categories
### Low-Confidence (Manual Review Needed)
1. "Meeting notes from John" - Work or Personal?
2. "Your weekly summary" - Newsletter or Notification?
...
### Suggested Filters
Based on this analysis, create permanent filters:
1. `/gmail-filter create @substack.com Newsletters --archive`
2. `/gmail-filter create @github.com Notifications`
Classification Signals
Newsletter Signals
- Sender:
newsletter@, digest@, weekly@
- Domains: substack.com, mailchimp.com, beehiiv.com
- Content: "unsubscribe", "view in browser"
- Subject: "Weekly", "Digest", "Newsletter"
Shopping Signals
- Subject: "order", "shipped", "delivered", "tracking"
- Sender: orders@, shipping@, noreply@
- Content: Order numbers, tracking links
Work Signals
- Sender: Company domain match
- Content: Project names, professional terminology
- CC: Multiple company addresses
Personal Signals
- Sender: In contacts, personal domain
- Content: Casual language, personal topics
- No marketing footers
Notification Signals
- Sender: notifications@, alerts@, noreply@
- Subject: [GitHub], [Slack], calendar patterns
- Content: Action buttons, status updates
Receipt Signals
- Subject: "receipt", "invoice", "payment"
- Content: Dollar amounts, transaction IDs
- Sender: billing@, receipts@
Dry Run Mode
Preview classifications without applying:
/gmail-classify --dry-run
Shows what would be classified without making changes.
Error Handling
- No emails found: Suggest widening date range
- Label creation fails: Check permissions
- API rate limit: Pause and resume
- Classification uncertain: Flag for user review
See Also
references/categories.md - Detailed category definitions
/gmail-analyze - Pattern analysis (faster, simpler)
/gmail-filter - Create permanent rules from classifications
1---2name: gmail-classify3description: AI-powered email classification using intelligent content analysis. Categorizes emails into Newsletter, Shopping, Work, Personal, Notifications, Receipts, and Promotions. Use for smart inbox organization beyond simple pattern matching.4license: Apache-2.05---67# Gmail AI Classifier89Intelligent email classification using AI reasoning for smart inbox organization.1011## Overview1213Unlike pattern-based filtering, AI classification analyzes email content, sender context, and user behavior to make intelligent categorization decisions.1415## Usage1617**Syntax**: `/gmail-classify [days]`1819**Examples**:20```21/gmail-classify # Classify last 7 days22/gmail-classify 30 # Classify last 30 days23/gmail-classify --dry-run # Preview without applying24```2526## Classification Categories2728| Category | Indicators | Label |29|----------|------------|-------|30| Newsletter | Substack, Mailchimp, "unsubscribe" link | Newsletters |31| Shopping | Order confirmation, shipping, tracking | Shopping |32| Work | Company domain, professional tone | Work |33| Personal | Personal contacts, casual tone | Personal |34| Notifications | GitHub, Slack, calendar alerts | Notifications |35| Receipts | Invoice, payment, receipt keywords | Finance/Receipts |36| Promotions | Discount, sale, marketing language | Promotions |3738## Classification Workflow3940### Step 1: Fetch Emails4142```bash43gog gmail search 'newer_than:${DAYS}d -label:classified' --json44```4546Exclude already-classified emails to avoid re-processing.4748### Step 2: Analyze Each Email4950For each email, analyze:51521. **Sender Analysis**53 - Domain reputation (newsletter service? company?)54 - Sender name format (person vs system)55 - Reply-to address56572. **Subject Analysis**58 - Keywords (order, invoice, newsletter, etc.)59 - Format (numbered list? FW:? RE:?)60 - Tone (formal, casual, marketing)61623. **Content Indicators**63 - Unsubscribe link presence64 - Tracking numbers65 - Financial amounts66 - Personal greetings6768### Step 3: Classify with Confidence6970Assign category with confidence level:7172| Confidence | Threshold | Action |73|------------|-----------|--------|74| High (90%+) | Strong signals | Auto-apply label |75| Medium (70-89%) | Mixed signals | Apply with note |76| Low (<70%) | Unclear | Skip, flag for review |7778### Step 4: Apply Labels7980For high-confidence classifications:8182```bash83# Ensure label exists84gog gmail labels list --json85gog gmail labels create "CategoryName"8687# Apply label88gog gmail modify <message-id> --add-label <label-id>89```9091### Step 5: Report Results9293```94## Classification Report9596**Period**: Last 7 days97**Emails Analyzed**: 14298**Classifications Made**: 12899**Skipped (low confidence)**: 14100101### Summary by Category102103| Category | Count | % of Total |104|----------|-------|------------|105| Newsletters | 45 | 35% |106| Notifications | 32 | 25% |107| Shopping | 18 | 14% |108| Work | 15 | 12% |109| Personal | 12 | 9% |110| Receipts | 6 | 5% |111112### High-Confidence Classifications (Auto-labeled)113- 98 emails across all categories114115### Low-Confidence (Manual Review Needed)1161. "Meeting notes from John" - Work or Personal?1172. "Your weekly summary" - Newsletter or Notification?118...119120### Suggested Filters121122Based on this analysis, create permanent filters:1231. `/gmail-filter create @substack.com Newsletters --archive`1242. `/gmail-filter create @github.com Notifications`125```126127## Classification Signals128129### Newsletter Signals130- Sender: `newsletter@`, `digest@`, `weekly@`131- Domains: substack.com, mailchimp.com, beehiiv.com132- Content: "unsubscribe", "view in browser"133- Subject: "Weekly", "Digest", "Newsletter"134135### Shopping Signals136- Subject: "order", "shipped", "delivered", "tracking"137- Sender: orders@, shipping@, noreply@138- Content: Order numbers, tracking links139140### Work Signals141- Sender: Company domain match142- Content: Project names, professional terminology143- CC: Multiple company addresses144145### Personal Signals146- Sender: In contacts, personal domain147- Content: Casual language, personal topics148- No marketing footers149150### Notification Signals151- Sender: notifications@, alerts@, noreply@152- Subject: [GitHub], [Slack], calendar patterns153- Content: Action buttons, status updates154155### Receipt Signals156- Subject: "receipt", "invoice", "payment"157- Content: Dollar amounts, transaction IDs158- Sender: billing@, receipts@159160## Dry Run Mode161162Preview classifications without applying:163164```165/gmail-classify --dry-run166```167168Shows what would be classified without making changes.169170## Error Handling171172- **No emails found**: Suggest widening date range173- **Label creation fails**: Check permissions174- **API rate limit**: Pause and resume175- **Classification uncertain**: Flag for user review176177## See Also178179- `references/categories.md` - Detailed category definitions180- `/gmail-analyze` - Pattern analysis (faster, simpler)181- `/gmail-filter` - Create permanent rules from classifications