ComfyUI Extension: ComfyUI-Prompt_Library
A ComfyUI node pack for management of larger prompt amounts and prompt variations.
Custom Nodes (0)
README
ComfyUI Prompt Library
A collection of ComfyUI nodes for efficient prompt management and organization. Handle multi-line prompts with positive/negative separation, create prompt libraries, and extend prompts dynamically.
Features
- Double Prompt Format: All nodes use a unified format where positive and negative prompts are separated by
---
(3-5 dashes) - Prompt Libraries: Organize prompts in text files or directly in nodes
- Smart Concatenation: Intelligently combines prompts with proper punctuation
- Comment Support: Use
###
at line start for notes that won't be processed - Flexible Prepend/Append: Add global settings before or after your prompts
Nodes
š¤ Simple Prompt Library
Store multiple prompt projects directly in a text field within ComfyUI.
- Projects: Each project is separated by empty lines
- Index: Select which project to use (1, 2, 3, etc.)
- Randomize: Enable to randomly select a different project on each generation
- Output: Combined double prompt string and the used index
Organizing Multiple Projects:
You can store many different prompt variations or completely different scenes in one text field. Use ###
comments to number and label them for easy reference:
### 1 - Quality Base
masterpiece, best quality
---
worst quality, ugly
### 2 - Fantasy Portrait
portrait of an elf warrior, detailed armor, forest background
---
modern clothing, urban setting
### 3 - Sci-Fi Scene
futuristic cityscape, neon lights, flying vehicles
---
medieval, rustic, old fashioned
### 4 - Nature Photography
misty mountain sunrise, dramatic clouds
---
### 5 - Abstract Art
flowing colors, geometric patterns, surreal composition
---
realistic, photographic, literal
Index Selection: Set the index to 3 to use the "Sci-Fi Scene" project. The index directly corresponds to the project number (separated by empty lines).
Random Mode: Enable randomize_index
to randomly pick between all available projects on each generation - perfect for exploring variations or creating diverse outputs.
š Prompt Library
File-based prompt management that reads .txt
files containing complete scene descriptions.
Setup:
- Navigate to
ComfyUI/models/prompts/
- Create folders for different themes/projects (e.g.,
fantasy_rpg
,cyberpunk_scenes
,nature_photography
) - Add
.txt
files with complete scene descriptions - Files appear in the dropdown as
folder/filename
File Structure Example:
ComfyUI/models/prompts/
āāā fantasy_rpg/
ā āāā dungeon_exploration.txt # Multiple dungeon variations
ā āāā tavern_scene.txt # Different tavern scenarios
ā āāā boss_battle.txt # Various boss encounters
āāā cyberpunk_scenes/
ā āāā neon_street.txt # Street scene variations
ā āāā hacker_hideout.txt # Different hideout styles
āāā nature_photography/
āāā mountain_sunrise.txt # Various mountain scenes
āāā forest_creek.txt # Different forest moods
Inside dungeon_exploration.txt:
### 1 - Dark Corridor
ancient stone corridor, torchlight, moss covered walls, dripping water, medieval dungeon
---
modern elements, bright lighting, clean surfaces
### 2 - Treasure Room
golden treasures, ancient artifacts, mystical glow, dust particles in light rays
---
empty room, poor, modern items
### 3 - Monster Encounter
massive stone chamber, lurking shadows, glowing eyes in darkness, battle ready stance
---
peaceful, well lit, safe environment
### 4 - Puzzle Chamber
intricate mechanisms, mysterious symbols, blue magical energy
---
### 5 - Boss Arena
vast ceremonial hall, pillars of obsidian, lava flows, epic scale
---
small room, cramped space
Key Features:
- Multiple Variations: Each file can contain dozens of different scenes or variations
- Mixed Content: Combine related variations (different dungeon rooms) or completely different concepts in one file
- Index Selection: Use the index parameter to select specific scenes (e.g., index 4 = Puzzle Chamber)
- Random Mode: Enable
randomize_index
to randomly select from all projects in the file - Numbered Comments: Use
### 1 - Name
format to easily identify which index corresponds to which project - Empty Negatives: Leave negative prompts empty by having nothing after
---
(as shown in project 4)
ā Prompt Extender
Add extensions to existing prompts from other nodes with flexible positioning.
- Input: Connect a double prompt from another node
- Additions: Define what to add in the text field
- Prepend Mode: Toggle to add extensions before (ON) or after (OFF) the input prompt
- Output: Combined result maintaining the double prompt format
Usage Example:
- Connect Simple Prompt Library output ā Prompt Extender input
- Add extensions like:
8k, professional photography --- lowres, amateur
- With Prepend Mode OFF (default): Original + additions
- With Prepend Mode ON: Additions + original (useful for global quality settings)
šØ Double Prompt Encode
Convert double prompt text directly to CLIP conditioning.
- Input: Any text using the
---
separator format (requires connection from another node) - Output: Separate positive and negative conditioning outputs
- Perfect for connecting prompt libraries directly to samplers
Double Prompt Syntax
All nodes use this unified format:
positive prompt content here
---
negative prompt content here
- Everything above
---
ā Positive prompt - Everything below
---
ā Negative prompt - No separator ā Everything becomes positive prompt
- Empty negative allowed: Leave blank after
---
for no negative prompt - Separator must be on its own line (3-5 dashes:
---
,----
, or-----
)
Valid Examples:
# Full double prompt:
beautiful landscape, sunset
---
ugly, blurry
# Only positive prompt:
beautiful landscape, sunset
# Empty negative prompt:
beautiful landscape, sunset
---
# Even this works (only negative):
---
ugly, blurry
Workflow Examples
Scene-Based Workflow
- Create a
ComfyUI/models/prompts/game_art/character_portraits.txt
file - Add multiple character descriptions separated by empty lines
- In ComfyUI: Prompt Library ā choose file and index ā Double Prompt Encode ā Sampler
Modular Prompt Building with Global Settings
- Simple Prompt Library (character/scene descriptions)
- ā Prompt Extender with Prepend Mode ON (add quality settings at the beginning)
- ā Prompt Extender with Prepend Mode OFF (add style details at the end)
- ā Double Prompt Encode ā Sampler
Global Settings Example
- Simple Prompt Library:
warrior in armor --- modern clothing
- Prompt Extender (Prepend ON):
8k, professional photography --- lowres, amateur
- Result:
8k, professional photography, warrior in armor --- lowres, amateur, modern clothing
Tips
- Comments: Lines starting with
###
are ignored - perfect for notes and numbering projects - Project Numbering: Use
### 1 - Project Name
format to keep track of which index selects which prompt - Organization:
- One file can contain many variations of similar scenes
- Or mix completely different concepts in one file
- Random Exploration: Use
randomize_index
to:- Use all variations automatically
- Create diverse output sets
- Find unexpected combinations
- Empty Negatives: Sometimes you don't need negative prompts - just leave the space after
---
empty - Prepend for Quality: Use Prompt Extender with Prepend Mode ON to add consistent quality settings to all prompts
- Chaining: Connect multiple Prompt Extenders to layer details onto base scenes
Installation
- Clone to
ComfyUI/custom_nodes/
- Restart ComfyUI
- Find nodes under "hexxacubic" category