Nodes/Wildcard Power Loader/Wildcard Cluster
ComfyUI Node

Wildcard Cluster

One prompt template, a hundred variations

By CaptainGrock·Created about a month ago·Updated about a month ago· 1
Wildcard Cluster
    • prompt
    prompt_templateA _gender person with _hair wearing _clo sits on the beach
    wildcards_config
    base_dir
    prompt_prefix
    seed0

    You want variety - batch 30 images and get 30 different people, outfits, and lighting setups from a single prompt. Wildcards are how you do that in ComfyUI, and Wildcard Cluster is one of the more approachable takes on it. Drop a _keyword into a prompt template, back it with a plain text file of options, and each queue pulls a different line. No API, no key, no model downloads - it's all local text files and a small bit of Python.

    The name tells you the shape: instead of one wildcard, you get a cluster of them resolved in a single pass. You write something like A _gender person with _hair wearing _clo sits on the beach, and _gender, _hair, and _clo each pull from their own file. The neat part is the dedicated UI: a slim table on the node where each row is one wildcard slot, with a dropdown to pick the file, a box for the keyword, and a mode selector. The table is a real DOM widget, so clicks and typing just work - no fighting a hidden JSON string.

    How it works

    Each slot is one entry in a JSON config: {"keyword": "_hair", "file": "hair.txt", "mode": "random"}. At execution the node reads the file, skips blank lines and anything starting with #, and picks one line per slot. Random mode uses a seeded RNG - the seed you set, plus the slot's position - so the same seed and slot order reproduce the same prompt. That's a genuinely nice touch; a lot of wildcard nodes are unseeded chaos. The other mode, sequential, cycles through the file round-robin and remembers where it is in a .wildcard_state.json, so over a batch you cover every option before repeating. That's the one I'd reach for when you want exactly one of each outfit rather than 30 random rolls.

    There are also a couple of quiet correctness details that tell you someone actually used this thing: slots are applied in order of keyword length, so a short _hair can't corrupt a longer _hair_color, and there's a path-traversal guard so a crafted filename can't escape your wildcard folder.

    The inputs that matter

    • prompt_template - your prompt with _keyword placeholders. Multiline, so whole paragraphs work.
    • base_dir - folder holding the .txt files. Leave empty and it uses the node's built-in wildcards/ folder (which ships with hair.txt, gender.txt, clothing.txt so it works out of the box). Type an absolute path for your own collections; relative paths resolve against the node's folder.
    • seed - set it to freeze a batch, change it to roll new combinations.
    • prompt_prefix - text prepended to the output, handy for chaining from upstream string nodes.

    The rest is the hidden wildcards_config widget, which the table UI manages for you. The single output, prompt, wires straight into a CLIP Text Encode node.

    Installing it

    Install the "wildcardcluster" pack via ComfyUI Manager, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/CaptainGrock/wildcardcluster
    

    Restart ComfyUI. That's it - there's no requirements.txt and no models to fetch. The only imports beyond the standard library are aiohttp and ComfyUI's PromptServer, both already present.

    Where people get burned

    • A keyword that stays in your prompt means the slot didn't resolve - either the file is missing/empty, or the keyword in your template doesn't match any row's keyword. Check the table.
    • Sequential mode isn't random. If your batch keeps repeating the same list in order, a slot is set to sequential. Flip it to random or leave the seed rolling.
    • Reordering slots changes results even with the same seed, since each slot's seed is seed + slot index. Reorder, re-roll.
    • Context: this is a young, low-profile pack - zero community footprint as of writing, and the README is basically one line. The mechanics are solid and dependency-free, but don't expect tutorials. If you'd rather stick with the ecosystem standard, Impact Pack's {a|b|c} dynamic-prompt syntax covers similar ground (see the "bracket trick" in our prompt-engineering notes). For one-prompt batch variety, though, this node's table UI is a friendly way in.
    Categorywildcards

    Inputs (5)

    NameTypeDefaultDescription
    prompt_templateSTRINGA _gender person with _hair wearing _clo sits on the beach
    wildcards_configSTRING
    base_dirSTRINGFolder containing the .txt wildcard files. Leave empty to use the node's wildcards/ folder.
    prompt_prefixoptSTRING
    seedoptINT00–4294967295

    Outputs (1)

    NameTypeDescription
    promptSTRING