Meld Prompt Constructor
A wildcard prompt loader that sorts the negatives for you
- positive_prompt
- negative_prompt
If you've ever run a batch of images and wanted "a random hairstyle from this list" or "one of these three outfits, weighted," you've wanted a wildcard loader. Meld Prompt Constructor is that - it scans a folder of text files, pulls a random (or sequential) line from each, expands dynamic syntax like {A|B|C}, and - the nice bit - automatically moves anything starting with - into a separate negative prompt output.
It's one of ComfyUI-Meld's text utilities, no Image Manager required. Wire its outputs into a CLIP Text Encode and you're off.
How it works
Point directory at a folder (it searches recursively), set file_pattern (default *.txt, so character_*.txt works), and the node reads the files, ignoring any starting with _. From each file it picks one valid line - comments excluded - according to selection_method (random, or sequential based on seed). Then the real work starts:
- Dynamic syntax:
{A|B|C}picks one option;{0.1::rare|0.9::common}picks with weights (unweighted items count as 1.0). - Comments:
//,#, and/* */are stripped, so you can keep notes in your prompt files. - Auto negative split: any element starting with
-is moved to the negative prompt --low qualitybecomes a negative, and-(worst quality, bad anatomy)moves the whole group over. - BREAK: with
use_breakon (default), prompts from different files are joined withBREAKso CLIP treats them as separate blocks instead of one soup.
The inputs that matter
- directory - where your
.txtprompt files live. - seed - controls both the random line picks and the
{A|B}choices, so you can reproduce or vary. - selection_method -
randomfor variety,sequentialfor a deterministic tour through your prompts. - use_break - on by default.
Outputs are just two: positive_prompt and negative_prompt, both plain strings.
Where people get burned
The BREAK keyword is the one real trap. BREAK is meaningful against the old 77-token chunking of SD 1.5 and SDXL - it forces a hard break between prompt blocks. On modern guidance-distilled, LLM-encoded models like Flux, there's no 77-token boundary left, and BREAK is silently meaningless. So if you run this into a Flux workflow, flip use_break to false and let files join with commas, or the keyword just rides along doing nothing.
Also remember the auto-negative split depends on the - prefix, so design your prompt files with that convention in mind - that's the feature that makes this loader nicer than a plain wildcard picker.
Installing it
Same pack, same install as the rest of Meld:
- ComfyUI Manager → search "Meld" → install, or
comfy node install HappyOnigiri/ComfyUI-Meld, orcd ComfyUI/custom_nodes && git clone https://github.com/HappyOnigiri/ComfyUI-Meld.git && cd ComfyUI-Meld && pip install -r requirements.txtthen restart.
No models to download. Set up a my_prompts folder, drop a few files in, and you've got a poor man's dynamic prompt engine with clean positive/negative separation built in.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| directory | STRING | ./my_prompts | — |
| file_pattern | STRING | *.txt | — |
| seed | INT | 00–18446744073709550000 | — |
| selection_method | COMBO | random | 2 options: random, sequential |
| use_break | BOOLEAN | true | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| positive_prompt | STRING | — |
| negative_prompt | STRING | — |