Nodes/NN-custom-nodes/Wildcard Processor
ComfyUI Node

Wildcard Processor

Roll a fresh prompt on every queue

By bandifiu·Created about a month ago·Updated about a month ago· 0
Wildcard Processor
    • text
    text
    Seed0

    You know the trick - throw {brown|blonde|black} into a prompt and let each run pick a different option? That's the old A1111 wildcard syntax, and it's still the single cheapest way to get prompt variety without writing fifty prompts by hand. NNWildcardProcessor is that idea as a ComfyUI node: drop it before your CLIP Text Encode, and a plain string in becomes a randomized, fully-expanded prompt on every execution.

    It ships in ComfyUI-NN-custom-nodes, a small utility pack by bandifiu. It's not the only wildcard node in town - dynamic-prompts and Easy-Use both do similar work - but this one is light, has no external dependencies, and is genuinely seed-reproducible, which is the feature people actually fight for.

    How it works

    Text in, text out. Feed it a prompt containing choice blocks, and it expands them all in one pass: {one|two|three} picks one, {2$$one|two|three} picks two, {1-2$$, $$one|two|three} picks one to two joined by , . You can even weight the odds - {0.8::red|0.2::blue} picks red four times out of five.

    Beyond inline blocks it does three things that make it feel complete:

    • Wildcard files. __characters/age__ loads a random line from a text file, and __styles/*__ matches whole folders via glob. The lookup is just "file path minus .txt, lowercased" - so characters/age.txt in your wildcards folder maps to __characters/age__. Lines starting with # are treated as comments and skipped. Files can reference other wildcards, so you can build libraries that nest.
    • Variables. {!style=cinematic portrait!} defines a reusable value, {$style} drops it back in anywhere. The defined value itself gets expanded, so variables can hold wildcards.
    • Prompt hygiene. Full-line # comments and /* inline */ blocks are stripped, and - by default - <lora:name:strength> tags are removed from the result.

    The inputs are just text (multiline) and Seed. Output is a single text string, wired straight into your CLIP Text Encode (or wherever the prompt goes).

    The seed thing is the whole game

    Internally it seeds a Python random.Random(seed), so the exact same seed reproduces the exact same expansion, forever. That's the feature people rave about - you can log the seed that gave you a great roll and replay it. But it cuts both ways, and this is where beginners get stuck:

    • ComfyUI caches aggressively, and a deterministic node with the same inputs is supposed to give the same answer. Same seed, re-queue → same prompt. To re-roll, change the seed.
    • A batch gets one expansion, not one per image. If you queue 8 images at batch size 8, all 8 share the prompt. Vary the seed to get variation.
    • And yes - because it strips LoRA tags by default, <lora:...> in your wildcard text silently disappears. If you use LoRA tags as prompt text, that's a trap; flip cleanup = false in the pack's settings.toml.

    Files and settings

    Wildcard files live in a wildcards folder relative to where ComfyUI runs (usually your ComfyUI root). The pack reads a settings.toml next to its own code for the path, delimiter, caching, and the expansion-pass cap. One quirk: the README says max_iterations = 5, but the code floors that at 100 passes, so deeply nested wildcards resolve fine - the setting just stops runaway recursion.

    Installing it

    cd ComfyUI/custom_nodes
    git clone https://github.com/bandifiu/ComfyUI-NN-custom-nodes
    

    then restart. Or search "ComfyUI-NN-custom-nodes" in ComfyUI Manager. No models, no extra installs beyond what ComfyUI already ships. It's a brand-new pack from a one-person author, so treat it as a neat utility rather than a pillar of your setup - but for turning one prompt into a thousand rolls, it does the job.

    CategoryNN

    Inputs (2)

    NameTypeDefaultDescription
    textSTRING
    SeedINT0

    Outputs (1)

    NameTypeDescription
    textSTRING