Combinatorial Prompt
Every prompt combination, one queue at a time
- STRING
Combinatorial Prompt is Random Prompt's patient sibling, from the same Qaz Tools pack and using the same {a|b} + __wildcard__ syntax. But instead of picking one random option per variant, it expands every combination and hands them to you one at a time, cycling through the whole list. It's a prompt grid search wearing a queue button.
This is the node for when random sampling isn't thorough enough. Random gives you a nice sample of the space; combinatorial gives you coverage - "does this base prompt work with all five artists" and then you're done, rather than hoping the RNG visits them. Set your KSampler seed once and each queued run is a different combination against the same noise.
How it works
The parser builds the full cross product of your variants and wildcard values, then the node walks it via itertools.cycle:
- Parse the text into the same tree Random Prompt uses.
- Expand all combinations - every variant option × every wildcard line, in file order.
- If
seed > 0, shuffle that list with a seeded RNG (reproducible order across sessions). With seed0, no shuffle - combinations come out in deterministic order. - Each execution returns the next prompt, wrapping forever.
So enumeration is: count your combinations, then queue the workflow that many times. There's no "emit all of them at once" mode and no counter output - you keep the number in your head or on a sticky note.
The input you should actually think about
Same three inputs as Random Prompt (text, seed, autorefresh), and again autorefresh is effectively decorative - IS_CHANGED always returns NaN, so the node always advances. The important one is:
seed-0= natural file/option order; anything above0= a deterministic shuffle, which is how you get the same grid order if you re-run tomorrow.
Output is a single STRING, same wiring as Random Prompt: into a CLIP Text Encode, or into QazOutput to watch which combination you're on.
The explosion warning
Cross products multiply, and they multiply fast. {a|b|c} × {d|e} × a 20-line wildcard file is 120 prompts. Great for thoroughness, very rough if you forgot and queued a few hundred generations. This is the one genuinely "think before you queue" node in the pack - triple-check your wildcard file isn't 500 lines before you hit run.
Installing Qaz Tools
Same as every node in the pack: Qaz Tools is a personal toolkit from qazwsxedc121, six small text utilities, no models, no requirements.txt. Install and restart:
cd ComfyUI/custom_nodes
git clone https://github.com/qazwsxedc121/comfyui-qaz-tools
Or in ComfyUI Manager, search "Qaz Tools" / paste the repo URL under Install via Git URL.
Where people get burned
- A missing wildcard doesn't fail - the literal
__name__just appears in the output. The file must be inComfyUI/wildcards/as a.txt, one value per line (#comments and blank lines skipped). - An unclosed
{or__throws a parse error. The error names the position, which is all you need.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| text | STRING | — | |
| seed | INT | 0 | — |
| autorefresh | COMBO | No | 2 options: Yes, No |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |