Wildcard Loader π²
The seeded wildcard resolver that needs no extra packs
- text
- resolution_log
- seed_used
Wildcards are how you make one prompt produce a thousand different images. Write a __color__ dress, {simple|ornate|__quality__} once, and every run picks a random color from your color.txt file, a random inline option, and a random quality line. Wildcard Loader is the resolver that makes that happen - and unlike the heavyweight Dynamic Prompts or Impact Pack setups, it's pure standard library, no dependency, and seeded, so the same prompt plus the same seed gives you the same result every time.
How it works
It handles two syntaxes in one pass, nesting included:
__name__- pulls a random line from<wildcards folder>/name.txt. If the chosen line itself contains another__token__, that gets resolved recursively.{a|b|c}- inline choice, no file needed. Also nests.
Wildcard files are just text: one option per line, blank lines and # comment lines ignored. And here's the nice touch - weighted lines. A line prefixed 2::crimson is twice as likely to be picked as a 1::teal line. That's the difference between "uniform random" and "mostly this, sometimes that," and it's rare to see it in a dependency-free loader.
The seed makes it reproducible. Internally it uses random.Random(seed), so seed 42 always expands the same prompt the same way - which is the property you want when you find a great frame and need to regenerate it.
Where does it read files from? The shared <ComfyUI root>/wildcards/ convention first (so existing Impact Pack / Dynamic Prompts collections just work), falling back to a bundled wildcards/ folder it auto-creates with starter color.txt and quality.txt files. The optional wildcards_subfolder input lets you scope reads to a subfolder.
The inputs that matter
- text - your prompt with
__tokens__and{choices}. Convert this widget to an input if you want to build the template upstream. - seed - lock it for reproducible expansions, or wire a randomizer into it for variety.
- max_recursion (default 6) - how deep nested tokens resolve. This is your guard against circular references: if
a.txtcontains__b__andb.txtcontains__a__, the cap stops the loop and leaves the remaining token as literal text instead of recursing forever.
Outputs - and the one you shouldn't ignore
text is your resolved prompt; wire it into a CLIP Text Encode (convert that node's text widget to an input). seed_used is the seed that was actually applied. But the output to actually read is resolution_log - it lists every pick the resolver made, in order, and flags any missing wildcard files.
That log is your debugging tool. Missing files don't error; the __token__ is left as literal text in your prompt, which means "a color dress" goes to the model as actual characters if color.txt is missing. Check the log when the output looks wrong.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/TensorVizion/OmniNodes
Restart; find Wildcard Loader π² under TensorVizion/Prompt. No pip installs needed - it's the standard library plus folder_paths. (The pack's only extra dependency, requests, is for Web API nodes and doesn't touch this.)
Where people get burned
- Missing file β literal token, not an error. The classic silent failure. Watch
resolution_log. - Seed 0 is a valid fixed seed. If you never touch the seed and leave it at 0, you get the same expansion every run. For variety you have to randomize the seed - a randomizer node or
control_after_generateon a seed source. - Weights are in the file, not the widget.
2::crimsonlives in the.txt. If you're not seeing the distribution you expect, that's where to look.
It's the bracket-trick from the KB's prompt-engineering playbook - old A1111 wildcard syntax most people who arrived after 2024 never learned - packaged as a self-contained, seedable node. Wire the output into your encoder and batch away.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| text | STRING | a __color__ dress, {simple|ornate|__quality__} | β |
| seed | INT | 00β18446744073709550000 | β |
| max_recursion | INT | 61β20 | β |
| wildcards_subfolderopt | STRING | β |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| text | STRING | β |
| resolution_log | STRING | β |
| seed_used | INT | β |