Random Prompts
One template, an endless supply of prompts
- Resolved Prompt
You've seen the trick before, probably without knowing it had a name: wrap alternatives in {red|blue|green}, batch 32, and every image comes out different without you writing a single extra prompt. It's ancient A1111-era wildcard syntax, and it's still the cheapest way to build variety - the same template that gives you "a young woman with {brown|blonde|black} hair" in batch 32 is how people assemble character reference libraries without any training. Random Prompts is a clean, zero-dependency version of that for ComfyUI, from the small Promptcraft pack.
What it does
You give it a template. It gives you one fully resolved string, randomly on every run. The template can mix three kinds of syntax:
- Variants -
{red|green|blue}picks one option. Add weights ({3::common|rare}) to skew the odds, or{2$$A|B|C}to draw several at once. - Wildcards -
__color__pulls a random line fromwildcards/color.txt(also.jsonand.yaml). The__!name__form guarantees uniqueness across the whole prompt, so you never end up withred hairandred eyesfrom the same file. - Variables -
${h=!{red|blue|pink}}locks a choice once and reuses it everywhere, so(${h}_hair:1.05)and${h}_eyesalways match. This is the bit that makes a randomized prompt still look coherent.
Everything resolves through one parser, and the seed drives the RNG - so the same template plus the same seed gives you the same result, which is how you reproduce that one lucky draw.
The inputs and output that matter
Only two inputs, and that's the point:
- Prompt Template - multiline STRING where you type the whole thing. Line numbers appear in the textarea, which you'll appreciate once a template runs past twenty lines.
- seed - defaults to randomize-on-generate; flip it to fixed for reproducible output.
The single output, Resolved Prompt, is a STRING that wires straight into a CLIPTextEncode positive prompt. Random Prompts → CLIPTextEncode is the whole workflow. Throw a Show Text node in between if you want to see what actually got picked.
Installing it
It's a normal custom node, no model downloads, no heavy Python deps. Either search "Promptcraft" in ComfyUI Manager, or:
cd ComfyUI/custom_nodes
git clone https://github.com/rTachibana/comfyui-promptcraft
Restart ComfyUI and the Promptcraft category appears in Add Node. PyYAML is optional and only needed if your wildcard files are .yaml; plain .txt needs nothing. A wildcards/ folder ships inside the pack (with an example.txt) - that's where it looks for files.
Where people get burned
- You need ComfyUI ≥ 0.18.0. The pack is built on the new V3 API (
comfy_api.latest), and on an older ComfyUI the node simply won't exist in the menu. This is the one real compatibility trap. - Syntax errors halt the run. An unmatched
{or an unclosed__makes Random Prompts refuse to execute and report every error before the workflow runs. That's a feature guarding a batch - but if you're mid-edit, use the Debug variant, which shows the errors without stopping. - Wildcard files go in the pack's
wildcards/folder, not your models dir, and paths map to subdirectories (__characters/female__). - Keep
#comments out of${...}declarations - the comment token ends the line, so write it after the closing}.
Worth knowing before you depend on it: Promptcraft is new and essentially one-person (last touched March 2026). It's a nice lightweight alternative to the heavyweight comfyui-dynamicprompts - and it's the one place I've seen variables injected into wildcard files (${season:summer} in a .txt, overridden from the prompt). For a fresh pack that's a genuinely useful trick.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| text | STRING | Prompt template. {A|B|C} — pick one at random __name__ — wildcard from file | |
| seed | INT | 00–18446744073709550000 | Random seed. Set 'control after generate' to 'fixed' for reproducible results. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| Resolved Prompt | STRING | The prompt template with all variants and wildcards resolved. |