Terefang Wildcards
Prompt wildcards with no folder scanning and no dependencies
- text
Wildcards are the file-based way to add variety to a prompt without writing a new one. You put a placeholder like __hair_color__ in your prompt, point a node at a folder full of .txt files, and each run pulls a random line from hair_color.txt. If you've been getting by on the {brown|blonde|black} bracket trick inside a single prompt, this is the same idea with the options living in text files - which means you can have hundreds of options per slot and share the lists without pasting them into every prompt.
Terefang Wildcards is the no-frills version of that node. It's a single node in the Terefang pack: type a prompt, set a directory, get a string back. No extra UI, no auto-scanning of your whole hard drive, no bundled word lists. It does exactly one job, by hand.
How it works
Under the hood it's a short loop, and reading the source tells you most of what matters. It finds every __something__ in your text with a regex, then for each one looks for <directory>/something.txt. If the file exists, it reads the lines, drops any that start with # (your comment/disabled entries), and swaps the placeholder for a random line. Then it re-scans and repeats, which is what makes nesting work - a file can itself contain __other__ and the node will resolve that on the next pass, up to a depth limit.
Three practical consequences fall straight out of that. One: the directory input is not optional in spirit, even though it's not marked required. Default it to empty and the node looks for color.txt relative to wherever ComfyUI is running, which is almost never where your lists live. Set it to your wildcards folder. Two: a placeholder whose file is missing never gets replaced - it passes through to your final prompt literally as __something__, which is a great way to silently ruin a generation. Three: # lines are the way to keep a file without making it selectable, which is the one genuinely thoughtful touch here.
The inputs that matter
- text (multiline string): your prompt with
__placeholders__in it. - directory (string): the folder containing your
.txtwildcard files. This is the one people forget. - seed (int): declared, and mostly decoration. The source never uses it to seed the RNG - the pick is a bare
random.choice(). So don't expect to reproduce a particular pick by reusing a seed; every run re-rolls, whatever you set here. - wildcard_depth (int, 2–256, default 10): how many replace passes are allowed. Leave it alone unless you're doing deep nesting; it's a safety valve, not a tuning knob.
Output
One output: text (string), which wires straight into the text input of CLIPTextEncode for your positive and negative prompts. Standard loop: this node → CLIPTextEncode → conditioning → sampler.
Installing it
Same pack, same story as its sibling node. It lives in ComfyUI-Terefang-Nodes by Alfred Reibenschuh (Terefang):
# ComfyUI Manager: search "ComfyUI-Terefang-Nodes", install, restart.
# Or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/terefang/ComfyUI-Terefang-Nodes
# restart ComfyUI
No requirements.txt, no models, no hidden deps - just re and random from the standard library. That's the whole pitch for this node versus the bigger wildcard packs: no 40MB dependency chain, no folder auto-discovery to configure, no UI to learn. It's a function in a box.
Should you bother?
If you already run a heavier wildcard pack - the ones that scan a central wildcards folder and give you a picker UI - this is a downgrade. But if you want file-based prompt variety and the heavyweight options feel like overkill, this is a solid, dependency-free pick that does the core thing correctly. Where people get burned: the directory input (set it!), the silent pass-through of missing wildcards, and the false sense of reproducibility from that unused seed. Nail those three and it's genuinely useful for batch variety workflows.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| text | STRING | — | |
| directory | STRING | — | |
| seed | INT | 00–18446744073709550000 | — |
| wildcard_depth | INT | 102–256 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| text | STRING | — |