Estimated reading time: 12 minutes
The Global Rules page controls system-wide email classification behavior across 10 configuration sections with 49 total settings. These rules apply to all emails and work in conjunction with per-category settings to provide comprehensive email automation and intelligent inbox organization.
Global Rules vs. Category Settings:
Type: Number (characters)
Default: 4000
Purpose: Maximum email body characters sent to Gemini AI for classification (cost optimization)
Backend Use: Email truncated in main.py lines 583, 642 before AI processing
Recommendations:
Note: Gemini 1.5 Flash handles long context efficiently; 4000 chars captures 95% of email content while maintaining performance
Type: Checkbox (boolean)
Default: true
Purpose: Enable fallback classification when AI confidence is below all category thresholds
Backend Use: Checked in main.py line 1297; triggers fallback category assignment
When to Enable: Ensures ALL emails get at least one label (recommended for comprehensive organization)
When to Disable: Only highly-confident classifications desired; low-confidence emails remain unlabeled
Type: Dropdown (category list)
Default: "Uncategorized" or "Other"
Purpose: Category applied when fallback is triggered (requires Fallback Enabled = true)
Backend Use: Applied in main.py line 1300 with fallback confidence score
Best Practice: Create an "Uncategorized" or "Review Needed" category specifically for fallback cases
Type: Number (0-100)
Default: 50
Purpose: Confidence score assigned to fallback classifications
Backend Use: Used in main.py line 1301 when recording fallback classification
Typical Range: 40-60 (indicates lower-confidence classification)
Analytics Impact: Affects your average confidence metric in Overview Dashboard
Type: Checkbox (boolean)
Default: true
Purpose: Skip classification for emails you send to yourself
Backend Use: Checked in main.py line 1167; emails from your own address are not processed
Recommendation: Enable (checked) for most users to avoid classifying test emails, reminders, and self-forwarded messages
Use Case to Disable: If you frequently email yourself important reminders that need classification
Type: Checkbox (boolean)
Default: true
Purpose: Allow AI to apply multiple categories to a single email
Backend Use: Loaded in main.py line 576 via multi_config; controls classification logic
Recommendation: Enable for most use cases (emails often span multiple topics)
Example: Email about "Q4 client project budget review deadline Friday" could receive: Client Communications + Financial + Action Required
Type: Number (1-10)
Default: 3
Purpose: Maximum number of categories applied to one email (requires Multi-Classification Enabled = true)
Backend Use: Enforced during classification; AI returns top N categories by confidence
Recommendations:
Type: Number (0-100)
Default: 70
Purpose: Global minimum confidence for any classification (overrides per-category thresholds if higher)
Backend Use: Categories below this threshold are excluded even if they exceed their per-category threshold
Use Case: Set global baseline (e.g., 75%) to ensure all classifications meet minimum quality bar
Interaction: If global = 75% and category = 70%, the higher value (75%) is used
Type: Checkbox (boolean)
Default: true
Purpose: Remove quoted reply text ("> Original message...") before classification
Backend Use: Text preprocessing during email parsing
Recommendation: Enable to focus classification on new content, not email history
Type: Checkbox (boolean)
Default: true
Purpose: Strip HTML tags and convert to plain text before classification
Backend Use: HTML parsing extracts text content, removes markup
Recommendation: Enable (HTML tags don't help classification and add token count)
Type: Checkbox (boolean)
Default: true
Purpose: Attempt to remove email signatures before classification
Backend Use: Signature detection heuristics (common patterns: "--", "Sent from", "Best regards")
Recommendation: Enable to focus on email body content
Note: Not 100% accurate; some signatures may remain if non-standard format
Type: Checkbox (boolean)
Default: true
Purpose: Collapse multiple spaces/newlines to single space
Backend Use: Text normalization reduces token count
Recommendation: Enable (whitespace doesn't affect classification accuracy)
Type: Checkbox (boolean)
Default: false
Purpose: Create Gmail labels for detected action dates (e.g., "Due: Jan 15")
Backend Use: Date extraction from email content; label created with date
Recommendation: Enable if you want visual date indicators in Gmail
Note: Separate from Time-Sensitive Labels (Section 9) which focus on urgency thresholds
Type: Comma-separated email list
Default: (empty)
Purpose: Email addresses to treat as high priority
Backend Use: Checked in main.py line 630; VIP emails included in AI prompt context
Example: boss@company.com, ceo@company.com, topclient@client.com
Effect: AI considers VIP status during classification; may influence confidence/priority
Type: Comma-separated domain list
Default: (empty)
Purpose: Domains to treat as legitimate (opposite of spam)
Backend Use: Checked in main.py line 631; influences spam detection
Example: company.com, client-domain.com, partner.com
Use Case: Ensure emails from internal/partner domains aren't misclassified as spam
Type: Comma-separated keyword list
Default: (empty - system has built-in spam detection)
Purpose: Additional keywords/phrases indicating spam emails
Backend Use: Checked in main.py line 632; supplements AI spam detection
Example: viagra, casino, click here to claim, you've won
Effect: Emails containing these terms more likely classified as spam/low priority
Type: Comma-separated email list
Default: (empty)
Purpose: Specific email addresses to exclude from classification entirely
Backend Use: Checked in main.py line 1126; emails from these senders are not processed
Example: noreply@service.com, notifications@system.com
Use Case: Skip automated system emails that don't need organization
Type: Comma-separated domain list
Default: (empty)
Purpose: Entire domains to exclude from classification
Backend Use: Checked in main.py line 1127; emails from these domains are not processed
Example: noreply-service.com, automated-systems.com
Use Case: Bulk exclude notification domains (e.g., social media, monitoring alerts)
Type: Checkbox (boolean)
Default: false
Purpose: When multi-classification is enabled, execute actions for ALL applied categories vs. only primary (highest confidence) category
Backend Use: Controls action execution scope throughout main.py
Recommendation: Keep disabled (false) to avoid duplicate actions (e.g., multiple auto-drafts for one email)
When to Enable: Advanced use cases where you want all category actions executed (e.g., multiple webhooks)
Type: Number (0-100)
Default: 85
Purpose: Minimum confidence required to trigger automatic draft reply creation
Backend Use: Checked in main.py line 1381 before creating draft
Recommendation: 80-90% (higher threshold prevents inappropriate draft creation)
Note: Category must also have "Auto-Draft Reply" enabled
Type: Comma-separated keyword list
Default: urgent, asap, critical, emergency, immediate
Purpose: Keywords indicating high-priority emails
Backend Use: Checked in main.py line 645; influences priority detection
Example: urgent, asap, critical, important, deadline today, time-sensitive
Effect: Emails with these keywords may be classified as higher priority
Type: Comma-separated keyword list
Default: newsletter, unsubscribe, fyi, optional, when you have time
Purpose: Keywords indicating low-priority emails
Backend Use: Checked in main.py line 646; influences priority detection
Example: newsletter, fyi, optional, no rush, informational
Effect: Emails with these keywords may be classified as lower priority
These checkboxes control whether specific actions only execute for the primary (highest confidence) category in multi-classification scenarios. All default to false (actions execute for all categories).
| Field | Default | Purpose |
|---|---|---|
| Primary Only: Auto-Draft | false | Only create auto-draft for primary category (prevents multiple drafts) |
| Primary Only: Mark Important | false | Only mark important for primary category (Gmail Important flag) |
| Primary Only: Archive | false | Only auto-archive for primary category (prevents accidental archiving) |
| Primary Only: Webhook | false | Only send webhook for primary category (reduces webhook volume) |
| Primary Only: Forward | false | Only forward for primary category (⚠️ future feature) |
Type: Multi-select dropdown
Default: (empty)
Purpose: Always mark emails from these categories as Important in Gmail (overrides category settings)
Backend Use: Checked during label application; Gmail Important star applied
Use Case: Quickly configure important categories without editing each category individually
Type: Multi-select dropdown
Default: (empty)
Purpose: Always auto-archive emails from these categories after labeling
Backend Use: Removes INBOX label via Gmail API
Use Case: Bulk configure archive behavior (e.g., Newsletters, Notifications, Receipts)
Type: Multi-select dropdown
Default: (empty)
Purpose: Automatically mark emails from these categories as read
Backend Use: Gmail API call to mark as read after classification
Use Case: Low-priority categories you want labeled but don't need to read (e.g., automated reports, monitoring alerts)
Type: Checkbox (boolean)
Default: true
Purpose: Create separate Gmail labels for priority levels (High/Medium/Low)
Backend Use: Priority labels created based on category priority settings
Effect: Emails get both category label AND priority label (e.g., "Client Communications" + "Priority: High")
Type: Color picker
Default: Red (#EA4335)
Purpose: Gmail label color for "Priority: High" label
Recommendation: Red or orange for visibility
Type: Color picker
Default: Yellow (#FBBC04)
Purpose: Gmail label color for "Priority: Medium" label
Recommendation: Yellow or blue for moderate attention
Type: Color picker
Default: Gray (#9E9E9E)
Purpose: Gmail label color for "Priority: Low" label
Recommendation: Gray or light blue for low visibility
Type: Checkbox (boolean)
Default: true
Purpose: Receive daily email summary via Telegram at midnight (your timezone)
Backend Use: daily_summary Cloud Function checks this setting
Content: Emails processed, classifications by category, top senders, confidence stats
Requirement: Telegram bot token and chat ID configured in Settings
Type: Checkbox (boolean)
Default: true
Purpose: Instant Telegram notification when high-priority email is classified
Backend Use: Checked in notification_manager.py after classification
Message Includes: Sender, subject, category, confidence, priority level
Type: Checkbox (boolean)
Default: false
Purpose: Telegram alert when email classification fails (AI error, timeout, etc.)
Backend Use: Error handler sends notification on exception
Use Case: Monitoring/debugging; disable after system is stable
Type: Checkbox (boolean)
Default: true
Purpose: Instant notification when email triggers Tier 1 urgency label (most urgent)
Backend Use: Checked in main.py after urgency label application
Requirement: Section 9 (Time-Sensitive Labels) must be enabled
Type: Checkbox (boolean)
Default: true
Purpose: Instant notification when email triggers Tier 2 urgency label
Backend Use: Checked in main.py after urgency label application
Requirement: Section 9 (Time-Sensitive Labels) must be enabled
Type: Checkbox (boolean)
Default: false
Purpose: Notification when email receives multiple categories (multi-classification event)
Backend Use: Checked when classification count > 1
Use Case: Monitoring multi-classification patterns; usually disabled after tuning
Type: Checkbox (boolean)
Default: false
Purpose: Notification when conflicting categories are detected (relationship violation)
Backend Use: Checked when category conflicts are resolved
Use Case: Debugging category relationships; disable after configuration is stable
Type: Checkbox (boolean)
Default: false
Purpose: Enable entire two-tier urgency label system
Backend Use: Master toggle checked in main.py line 1443
Effect: When enabled, AI extracts urgency_date from emails and applies tier labels based on thresholds
Type: Number (days)
Default: 2
Purpose: Apply Tier 1 label if action date is within this many days
Backend Use: Date comparison in main.py line 1458
Example: If set to 2, emails with action dates within 2 days receive Tier 1 label
Recommendation: 1-3 days for most urgent items
Type: Text
Default: "⚡ URGENT - Action Required"
Purpose: Gmail label name for Tier 1 urgency
Recommendation: Use emoji or clear prefix for high visibility
Type: Color picker
Default: Red (#EA4335)
Purpose: Gmail label color for Tier 1 urgency
Recommendation: Red or bright orange for maximum visibility
Type: Number (days)
Default: 7
Purpose: Apply Tier 2 label if action date is within this many days (but beyond Tier 1 threshold)
Backend Use: Date comparison in main.py line 1459
Example: If Tier 1 = 2 and Tier 2 = 7, emails with action dates in 3-7 days receive Tier 2 label
Recommendation: 5-10 days for moderate urgency
⚠️ Validation: Must be ≥ Tier 1 threshold (enforced in dashboard)
Type: Text
Default: "⏰ Time-Sensitive"
Purpose: Gmail label name for Tier 2 urgency
Recommendation: Less intense than Tier 1 (e.g., clock emoji vs. lightning)
Type: Color picker
Default: Orange (#FBBC04)
Purpose: Gmail label color for Tier 2 urgency
Recommendation: Orange or yellow (less intense than Tier 1 red)
| Action Date | Days Until | Label Applied | Example |
|---|---|---|---|
| Within Tier 1 threshold | 0-2 days | Tier 1 only | "Respond by tomorrow" → ⚡ URGENT |
| Within Tier 2 threshold | 3-7 days | Tier 2 only | "Deadline Friday" (today is Monday) → ⏰ Time-Sensitive |
| Beyond Tier 2 threshold | 8+ days | None | "Submit by next month" → No urgency label |
| No date detected | N/A | None | Email without deadline → No urgency label |
Type: Textarea
Default: (system default prompt)
Character Limit: 1000 characters (configurable up to 5000 for admin users)
Purpose: Provide business context or classification guidance to the AI
Backend Use: Prepended to classification prompt in main.py lines 656-661
Storage: Saved to tenant_users/{tenant_id}_{email}/config/prompts
Fallback: If empty, system uses default prompt
Truncation: If exceeds limit, automatically truncated (main.py lines 683-686)
You are classifying emails for a software development consulting firm. Key context:
- "Client Projects" refers to active billable client work
- "Internal" includes team communication, HR, and company updates
- "Sales" includes prospective client inquiries and proposals
- Prioritize emails from current clients over prospective leads
- Consider deadline mentions as high priority
You are classifying legal emails. Important considerations:
- Court-related emails are always high priority
- Client communications must be confidential and properly categorized
- Distinguish between billable client work and administrative tasks
- Urgent matters include court filings, depositions, and hearings
Personal email classification guidelines:
- Family/friends emails are high priority
- Financial matters (banking, investments) should be clearly categorized
- Travel confirmations need special attention around trip dates
- Newsletters are low priority unless from specific subscriptions I've flagged
When to Use: You have specialized industry terminology, specific prioritization rules, or business context that would help the AI make better classification decisions.
When to Skip: Default system prompt works well for most users. Only customize if you notice consistent misclassifications that context could fix.
| Goal | Configuration | Trade-off |
|---|---|---|
| Reduce Costs | Lower Body Truncate (2000-3000), skip more domains, disable debug notifications | May miss context in long emails |
| Maximize Accuracy | Higher Body Truncate (5000+), lower confidence thresholds, enable system prompt | Higher API costs, slower processing |
| Reduce Notification Noise | Disable debug notifications, only enable high priority + urgency tier 1 | May miss classification issues |
| Inbox Zero | Aggressive auto-archive (multiple categories), auto-mark read for low priority | Risk of missing important emails |
A: Global Rules apply to ALL emails and ALL categories (system-wide behavior). Category settings apply only to specific categories (per-category behavior). For example, "Enable multi-classification" is global; "Auto-archive Newsletters" is category-specific.
A: Changes apply only to NEW emails processed after saving. Existing emails are not retroactively reprocessed. Wait for new emails to arrive (or send test emails) to verify your configuration changes.
A: Scroll to the bottom of the Global Rules page and click the "Reset to Defaults" button. This restores all 49 fields to system default values. This action cannot be undone, so download a backup of your configuration first if needed.
A: The AI only sees the first N characters of the email body. For very long emails, important context at the end may be missed, leading to misclassification. The AI will indicate if context was truncated. Recommended minimum: 2000 characters.
A: Global Rules apply universally. For per-category behavior, use the Categories page configuration (Actions tab, Rules tab). For example, you can't set different body truncate lengths per category, but you can enable auto-draft for some categories and not others.
A: "Apply actions to all" is the master toggle. If disabled, actions only execute for the primary category, period. If enabled, the "Primary Only" flags control individual action types. Most users should keep "Apply to all" disabled to avoid duplicate actions.
A: Check: (1) Urgency Enabled is checked, (2) Email contains a detectable action date (e.g., "by Friday", "deadline March 15"), (3) Date is within your threshold ranges (Tier 1 or Tier 2), (4) Gmail watch is connected. Test with an obvious example: "Please respond by tomorrow."
A: 4000 characters (default) is optimal for most users. This captures the full content of 95% of emails while controlling API costs. Increase to 6000-8000 for legal/technical emails with extensive details. Decrease to 2000-3000 for short emails (newsletters, notifications) to save costs.
A: No, exact matching only. For domains, "example.com" matches all emails from "*@example.com". For emails, you must list each specific address. To skip multiple related addresses, list them all or use the domain field if they share a domain.
A: Enable "Auto-Draft Reply" in the Actions tab of specific categories only (Categories page). Then in Global Rules → Processing Rules, set "Min Confidence for Auto-Draft" to your desired threshold (e.g., 85%). Auto-drafts will only be created for categories with the action enabled AND emails meeting the confidence threshold.
A: Default limit is 1000 characters (configurable to 5000 for admin users). This ensures the prompt doesn't consume excessive API tokens. Focus on concise business context (3-5 bullet points) rather than lengthy instructions. The AI already knows how to classify; your prompt just provides domain-specific context.
A: Enable if you want every email to receive at least one label (comprehensive organization). Disable if you only want high-confidence classifications (some emails may remain unlabeled). Most users should enable with a "Review Needed" or "Uncategorized" fallback category.
A: VIP status is included in the AI classification prompt as context. The AI considers this when determining priority and category. VIP doesn't guarantee specific classification, but influences the AI to treat those emails with higher importance. Combine with category-level "Mark Important" for guaranteed Gmail starring.