🎨 ComfyUI Prompting System
A comprehensive prompt management system for ComfyUI with database storage, thumbnail management, and advanced features.
✨ Features
- 💾 Prompt Saver - Save prompts with metadata (category, tags, rating, notes)
- 🔒 Lock/Unlock Mechanism - Control when prompts overwrite from database
- ✏️ Smart Text Input - Automatic change detection (new vs edit)
- 📚 Library Browser - Browse, search, filter prompts with rich UI
- 🖼️ Thumbnail Management - Store up to 3 thumbnails per prompt with lock/unlock
- 📤 Export/Import - Export database as JSON, merge with other databases
- 🧹 Auto-Cleanup - Automatically remove old unrated prompts
- 🔍 Advanced Search - Search by text, category, tags, rating
- 📊 Statistics - Track usage, ratings, generations
- 🌐 Cross-Platform - Works on Windows, Linux, macOS
📦 Installation
Method 1: Git Clone (Recommended)
cd ComfyUI/custom_nodes
git clone https://github.com/danieljanata/ComfyUI-Prompting-System.git
Method 2: Manual Download
- Download ZIP from GitHub
- Extract to
ComfyUI/custom_nodes/ComfyUI-Prompting-System - Restart ComfyUI
Requirements
- ComfyUI (latest version)
- Python 3.8+
- PIL/Pillow (usually included with ComfyUI)
🚀 Quick Start
Basic Workflow
-
Add Smart Text Input node
- Type your prompt
- Detects if it's a new prompt or edit
-
Connect to Prompt Saver node
- Select category (or create new)
- Add tags (comma-separated)
- Rate the prompt (0-5 stars)
- Add notes (optional)
-
Lock/Unlock behavior
- 🔓 Unlocked: Loads latest prompt from category
- 🔒 Locked: Saves current prompt
-
Browse saved prompts
- Add Prompt Library Browser node
- Search, filter, load prompts
- View thumbnails and generation history
📋 Node Documentation
💾 Prompt Saver
Saves prompts with full metadata and lock/unlock mechanism.
Inputs:
text(STRING) - Prompt textlocked(BOOLEAN) - Lock/unlock togglecategory(DROPDOWN) - Prompt categorynew_category(STRING) - Create new categorytags(STRING) - Comma-separated tagsrating(INT 0-5) - Prompt quality ratingnotes(STRING) - Additional notesauto_save(BOOLEAN) - Enable/disable auto-save
Outputs:
text- Processed textcategory- Selected categoryprompt_id- Database ID of saved prompt
Behavior:
Unlocked Mode (🔓):
- Loads latest prompt from selected category
- Overwrites text input with database content
- Useful for reusing previous prompts
Locked Mode (🔒):
- Saves current text to database
- Detects if new prompt or update (based on similarity)
- Creates new entry if text is significantly different
- Updates existing if minor changes
Pulsing Button:
- The unlock button pulses to remind you it's in overwrite mode
- Lock it when you want to save new content
✏️ Smart Text Input
Enhanced text input with automatic change detection.
Inputs:
text(STRING) - Your prompt textsimilarity_threshold(FLOAT 0-1) - Threshold for new vs edit detection
Outputs:
text- The input textis_new_prompt(BOOLEAN) - True if completely newsimilarity(FLOAT) - Similarity score with previous text
Usage:
- Type your prompt normally
- Node automatically detects if you're writing something new or editing
- Visual feedback (color change) indicates detection result
📚 Prompt Library Browser
Interactive browser for managing your prompt library.
Inputs:
-
action(DROPDOWN) - Action to perform:Browse- View all promptsSearch- Search with filtersLoad Prompt- Load specific prompt by IDUpload Database- Import and merge databaseLock Thumbnail- Lock a thumbnail slotUnlock Thumbnail- Unlock a thumbnail slot
-
search_text(STRING) - Text to search -
category_filter(DROPDOWN) - Filter by category -
min_rating(INT 0-5) - Minimum rating filter -
prompt_id_to_load(INT) - ID of prompt to load -
thumbnail_index(INT 0-2) - Thumbnail slot index -
database_json(STRING) - Paste JSON for upload -
max_results(INT) - Maximum results to show
Outputs:
loaded_text- Text of loaded promptloaded_category- Category of loaded promptresults_json- Search results as JSONloaded_prompt_id- ID of loaded prompt
Features:
Browsing:
- View all prompts with metadata
- See thumbnails, ratings, usage count
- Filter by category, tags, rating
Searching:
- Full-text search in prompt content and notes
- Multiple filter combinations
- Sorted by rating and usage
Loading:
- Enter prompt ID to load specific prompt
- Outputs text and category for use in workflow
Database Upload:
- Paste JSON from exported database
- Automatically merges with current database
- Removes duplicates (by hash)
- Keeps higher ratings
- Sums usage counts
📤 Export Manager
Export and manage your database.
Inputs:
-
export_action(DROPDOWN):None- Show basic statisticsExport Database- Save database to fileShow Statistics- Detailed statisticsCleanup Old Prompts- Remove old unrated prompts
-
export_filename(STRING) - Filename for export
Outputs:
info- Status information and statistics
Features:
Export Database:
- Saves complete database to output folder
- Includes all prompts, thumbnails (base64), metadata
- Single JSON file - easy to share or backup
Statistics:
- Total prompts, categories, tags
- Rated vs unrated breakdown
- Category distribution
- Tag usage
- Database size and location
Cleanup:
- Removes prompts with rating = 0
- Only if older than threshold (default 30 days)
- Configurable in database settings
- Rated prompts are NEVER deleted
🖼️ Thumbnail Management
How Thumbnails Work
Each prompt can store up to 3 thumbnails with a lock/unlock system.
Automatic Thumbnail Saving
When you generate images using a prompt:
- The last generated image is automatically saved as a thumbnail
- If all slots are unlocked, the oldest unlocked slot is replaced
- If some slots are locked, only unlocked slots are replaced
Lock/Unlock Mechanism
Unlocked Slot (default):
- Always gets replaced with the newest generation
- Useful for seeing "current best" output
Locked Slot:
- Preserved permanently until you unlock it
- Useful for keeping reference images
Example Workflow:
Generation 1: [Unlocked Slot 1] ← New image
Generation 2: [Unlocked Slot 1] ← Replaced
→ User clicks lock on Slot 1
Generation 3: [Locked Slot 1] [Unlocked Slot 2] ← New image
Generation 4: [Locked Slot 1] [Unlocked Slot 2] ← Replaced
→ User clicks lock on Slot 2
Generation 5: [Locked Slot 1] [Locked Slot 2] [Unlocked Slot 3] ← New
Locking/Unlocking in UI
Use Prompt Library Browser node:
- Set action to "Lock Thumbnail" or "Unlock Thumbnail"
- Enter prompt ID
- Enter thumbnail index (0, 1, or 2)
- Execute
🗄️ Database Structure
Location
ComfyUI/
└── user/
└── default/
└── workflows/
└── prompt_database.json
Format
{
"version": "1.0",
"created": "2026-01-14T10:00:00Z",
"last_updated": "2026-01-14T12:00:00Z",
"settings": {
"auto_cleanup_enabled": true,
"auto_cleanup_days": 30,
"max_thumbnails": 3
},
"categories": ["Girl 👩🏻", "Clothing 👗", "Lighting 💡"],
"tags": ["blonde", "dress", "outdoor"],
"prompts": [
{
"id": 1,
"text": "Beautiful woman with platinum blonde hair...",
"category": "Girl 👩🏻",
"tags": ["blonde", "blue-eyes"],
"rating": 5,
"notes": "Best prompt for nordic look",
"created_at": "2026-01-14T10:30:00Z",
"updated_at": "2026-01-14T11:00:00Z",
"used_count": 15,
"hash": "a3f5e8d...",
"thumbnails": [
{
"data": "data:image/jpeg;base64,...",
"locked": true,
"timestamp": "2026-01-14T10:35:00Z",
"source_image": "ComfyUI_00123.png"
}
],
"generation_history": []
}
]
}
Thumbnails
- Stored as base64-encoded JPEG data URIs
- 150x150px at 70% quality
- Approximately 10-12 KB each
- Maximum 3 per prompt = ~35 KB per prompt
🔄 Database Merge Logic
When merging databases (e.g., from backup or another user):
-
Deduplication by Hash
- Prompts with identical text (hash) are considered duplicates
- Only one copy is kept
-
Conflict Resolution
- Rating: Higher rating wins
- Used Count: Summed (e.g., 20 + 5 = 25)
- Created Date: Older date kept (original creation time)
- Updated Date: Newer date kept
- Thumbnails: Locked thumbnails preserved, newest unlocked added
- Tags: Merged (union of both sets)
-
Categories and Tags
- All unique categories are preserved
- All unique tags are preserved
Example Merge
Database A:
{
"id": 1,
"text": "Beautiful woman...",
"hash": "abc123",
"rating": 5,
"used_count": 20
}
Database B:
{
"id": 47,
"text": "Beautiful woman...",
"hash": "abc123",
"rating": 3,
"used_count": 5
}
Result:
{
"id": 1,
"text": "Beautiful woman...",
"hash": "abc123",
"rating": 5, ← Higher rating
"used_count": 25 ← Summed
}
🧹 Auto-Cleanup
How It Works
- Removes prompts with rating = 0 (unrated)
- Only if older than 30 days (configurable)
- Runs when you use "Cleanup Old Prompts" action
- Can be disabled in settings
Why?
- Prevents database bloat from experimental prompts
- Keeps only prompts you found valuable (rated)
- Encourages rating good prompts to preserve them
Protection
Prompts are SAFE if:
- Rating > 0 (any rating keeps it forever)
- Created within cleanup threshold (e.g., last 30 days)
Prompts are REMOVED if:
- Rating = 0 AND
- Created more than threshold days ago
🎯 Use Cases
1. Iterative Prompt Development
[Smart Text Input] → [Prompt Saver (Unlocked)]
↓
[Generate Image]
↓
[View Result]
↓
[Lock if good, or edit and try again]
2. Building Prompt Library
- Start with Prompt Saver locked
- Write different prompts for each category
- Rate them as you test (1-5 stars)
- Best prompts (5 stars) are easy to find later
3. Team Collaboration
- Each person exports their database
- Share JSON files
- Import into Prompt Library Browser
- Automatic merge with deduplication
- Everyone has access to best prompts
4. Backup and Restore
- Regularly export database (Export Manager)
- Save to cloud storage
- If database corrupted, import from backup
- No data loss
🔧 Advanced Configuration
Changing Auto-Cleanup Settings
Edit prompt_database.json directly:
"settings": {
"auto_cleanup_enabled": true,
"auto_cleanup_days": 30,
"max_thumbnails": 3
}
Options:
auto_cleanup_enabled:trueorfalseauto_cleanup_days: Number of days (e.g.,30,60,90)max_thumbnails: 1 to 5 (default 3)
Custom Categories
Categories are created automatically when you type them, or you can add to database:
"categories": [
"Girl 👩🏻",
"Clothing 👗",
"Your Custom Category"
]
Custom Tags
Tags are created automatically when you use them. No configuration needed.
🐛 Troubleshooting
Database Not Saving
Problem: Changes not persisting
Solutions:
- Check file permissions on
ComfyUI/user/default/workflows/ - Ensure no other process is locking the file
- Check console for error messages
- Try manual export and re-import
Thumbnails Not Appearing
Problem: Images not being captured
Solutions:
- Ensure images are saved (PreviewImage or SaveImage node)
- Check that workflow completed successfully
- Verify output directory exists
- May need to implement automatic image detection (coming soon)
Lock Button Not Pulsing
Problem: Visual animation not working
Solutions:
- Refresh ComfyUI page (Ctrl+F5)
- Check browser console for JavaScript errors
- Ensure
web/js/prompt_library_ui.jsis loaded
Merge Failed
Problem: Upload database gives error
Solutions:
- Validate JSON syntax (use JSONLint.com)
- Ensure it's a valid prompt database (has correct structure)
- Check for file encoding (must be UTF-8)
- Try smaller database first to test
🤝 Contributing
Contributions welcome! Please:
- Fork the repository
- Create feature branch
- Test thoroughly
- Submit pull request with clear description
📄 License
MIT License - feel free to use in your projects!
🙏 Credits
Created by Daniel Janata with assistance from Claude (Anthropic)
Special thanks to the ComfyUI community!
📞 Support
- Issues: GitHub Issues
- Discussions: GitHub Discussions
🗺️ Roadmap
Planned Features
- Automatic image detection from workflow execution
- Web UI panel for library browser (instead of node)
- Import/export to CSV format
- Prompt templates and variables
- Batch operations (rate multiple, delete multiple)
- Prompt versioning and history
- Shared online library (opt-in)
- AI-powered prompt suggestions
- Integration with popular checkpoint metadata
📊 Statistics
Development Info
- Lines of Code: ~2500+
- Development Time: 2 hours
- Languages: Python 95%, JavaScript 3%, CSS 2%
- Dependencies: Minimal (PIL, built-in modules)
Happy Prompting! 🎨