An intelligent Thunderbird extension that uses artificial intelligence to automatically manage, optimize, and clean up your email tags.
- Find Similar Tags: AI analyzes your tags and finds similar or duplicate tags (e.g., "Project", "Projects", "project")
- Improve Tag Names: Get suggestions for more consistent and clearer tag names
- Automatic Categorization: Organize your tags into meaningful categories (Projects, Priorities, Status, etc.)
- β Interactive Suggestions: All AI suggestions are displayed in a clear preview page - you decide which ones to apply!
- π₯ Deep Analysis Mode: Analyze ALL tags in a single request for comprehensive similarity detection
- Tag Analysis: Overview of all tags with usage statistics
- Merge Tags: Automatically merge similar tags
- Cleanup: Remove unused tags automatically
- Consistency: Ensure uniform naming conventions
- Smart Warnings: Token limit detection with actionable recommendations
- OpenAI (GPT-4o, GPT-4o-mini, GPT-3.5)
- β GPT-4o recommended for 1000+ tags (16K output limit)
- Anthropic (Claude 3.5 Sonnet, Claude 3.5 Haiku)
- β Claude 3.5 Sonnet recommended for 1000+ tags (8K output limit)
- Google AI (Gemini 1.5 Flash, Gemini 1.5 Pro)
- β Gemini 1.5 Pro recommended for 1000+ tags (8K output limit)
- Ollama (local, free - llama3.2, mistral, gemma2, etc.)
-
Clone or download the repository
git clone https://github.com/hendkai/ai_tag_manager cd ai_tag_manager -
Install in Thunderbird
- Open Thunderbird
- Go to
MenuβAdd-ons and Themes(or pressCtrl+Shift+A) - Click the gear icon βοΈ
- Select
Install Add-on From File... - Navigate to the folder and select
manifest.json
For development and testing:
- Open
about:debuggingin Thunderbird - Click
This Thunderbird - Click
Load Temporary Add-on... - Select the
manifest.jsonfile
Open the extension settings:
- Click the AI Tag Manager icon in the toolbar
- Select
βοΈ Open Settings
Choose your preferred AI provider and enter your API key:
- Register at platform.openai.com
- Create an API key at API Keys
- Recommended model:
gpt-4ofor 1000+ tags,gpt-4o-minifor <1000 tags
- Register at console.anthropic.com
- Create an API key
- Recommended model:
claude-3-5-sonnet-20241022for best quality
- Create an API key at Google AI Studio
- Recommended model:
gemini-1.5-profor 1000+ tags
- Install Ollama
- Run:
ollama pull llama3.2 - No API costs! Runs completely locally.
- Click the AI Tag Manager icon
- Click
π Analyze Tags - You'll see an overview of your tags
- Click
π Find Similar Tags - Enable π₯ Deep Analysis Mode for comprehensive analysis (recommended for 500+ tags)
- AI analyzes your tags and suggests merges
- Preview page opens: Review each suggestion individually
- Select which suggestions to apply
- Click "Apply Selected" to execute chosen changes
- Click
β¨ Improve Tag Names - Get suggestions for more consistent names
- Interactive selection: Choose only the improvements you like
- E.g., "ToDo" β "todo", "IMPORTANT" β "important"
- Click
π Categorize Tags - AI sorts your tags into meaningful categories
- Overview view: Informative display of your organized tags
- Helps organize large tag collections
Tokens are pieces of text that AI models process. When analyzing tags, the AI needs tokens for both reading your tags (input) and writing suggestions (output).
Each AI model has a maximum output limit. With many tags (500+), the AI might find hundreds of similar groups, but if it hits the token limit, it can only return a fraction of them.
| Tag Count | Best Model | Output Limit | Quality |
|---|---|---|---|
| < 500 tags | Any model | - | Good |
| 500-1000 tags | GPT-4o-mini, Gemini 1.5 Flash | 16K / 8K | Good |
| 1000-2000 tags | β GPT-4o, Claude 3.5 Sonnet, Gemini 1.5 Pro | 16K / 8K | Excellent |
| 2000+ tags | β GPT-4o only | 16K | Excellent |
If you have 1000 tags and use a smaller model, the AI might only return 30-50 groups instead of 100+. The extension will:
- β Automatically recover partial results
β οΈ Display a warning with coverage percentage- π‘ Recommend appropriate models for your tag count
- Automatic Merging: Tags are merged after confirmation
- Similarity Threshold: How similar tags must be (0.0 - 1.0)
- Remove Unused Tags: Automatic deletion during cleanup
- Case Sensitive: Distinction during analysis
- Max. Tags per Analysis: Limit for very large tag lists
- Detailed Logging: For debugging and development
- π₯ Deep Analysis Mode: Send ALL tags in ONE request for maximum coverage
- API keys are stored locally only (in Thunderbird's Storage API)
- No data collection: This extension collects no user data
- Only tag names are sent to AI APIs (never email content!)
- Ollama option: Use AI completely locally without cloud connection
ai_tag_manager/
βββ manifest.json # Extension manifest
βββ scripts/
β βββ background.js # Background logic
β βββ aiIntegration.js # AI API integration
βββ popup/
β βββ popup.html # Popup UI
β βββ popup.js # Popup logic
βββ results/ # β NEW
β βββ results.html # Preview page for AI suggestions
β βββ results.js # Interactive selection logic
βββ options/
β βββ options.html # Settings page
β βββ options.js # Settings logic
βββ icons/ # App icons
βββ README.md
- Open
about:debuggingin Thunderbird - Click on the extension
- Open the
Consolefor logs - Enable "Detailed Logging" in settings
// In Browser Console (Ctrl+Shift+J)
browser.runtime.sendMessage({action: 'analyzeTags'})
.then(console.log)- API Costs: OpenAI, Anthropic, and Google AI incur costs (use Ollama for free alternative)
- Rate Limits: AI APIs have request limits
- Token Limits: Large tag lists (1000+) may require larger models for complete results
- Thunderbird >= 91: Requires Thunderbird version 91 or higher
Contributions are welcome! Please create a pull request or open an issue.
# Clone the repository
git clone <repository-url>
cd ai_tag_manager
# Load in Thunderbird (about:debugging)MIT License - see LICENSE file
For questions or issues:
- Check the FAQ
- Open an issue on GitHub
- Enable "Detailed Logging" for debug information
- Your tags might already be very well organized
- Try reducing the similarity threshold
- Ensure the API key is correct
- For 1000+ tags, use a larger model (GPT-4o recommended)
No! Only the tag names are analyzed, never email content.
Yes, with Ollama! Install Ollama locally and all AI functions run offline.
- Ollama: Free (local)
- OpenAI: ~$0.001 per request (gpt-4o-mini), ~$0.005 per request (gpt-4o)
- Anthropic: ~$0.003 per request (Claude 3.5 Haiku), ~$0.015 per request (Claude 3.5 Sonnet)
- Google: Free (with limits), then ~$0.001 per request
- For cost: Ollama (free) or OpenAI gpt-4o-mini
- For quality with large tag lists (1000+): GPT-4o or Claude 3.5 Sonnet
- For privacy: Ollama (completely local)
- For speed: Gemini 1.5 Flash or GPT-4o-mini
Deep Analysis Mode sends ALL your tags in ONE single AI request for comprehensive comparison. Benefits:
- β Finds every possible similarity in a single pass
- β Compares all tags with each other
- β Best results for large tag collections
β οΈ Requires larger models (GPT-4o, Claude Sonnet) for 1000+ tagsβ οΈ Higher API costs but fewer total requests
When you see "Token limit reached" warnings:
- Best solution: Switch to a larger model (GPT-4o for 1000+ tags)
- Alternative: Disable Deep Analysis Mode (uses batches instead)
- Optional: Remove unused tags first to reduce total count
The extension automatically recovers partial results and shows you exactly how many groups were found vs. expected.
- Deep Analysis Mode for comprehensive tag comparison
- Token limit detection and warnings
- Automatic partial result recovery
- Model recommendations based on tag count
- Undo/Redo for tag changes
- Tag rules and automation
- More AI providers (Mistral, etc.)
- Tag suggestions based on email content
- Import/Export tag configurations
- Multi-language user interface
Developed with β€οΈ for better email management