Nodes/ComfyUI-GadgetNodes/Expand Wildcards
ComfyUI Node

Expand Wildcards

One prompt, a hundred variations, on purpose

By 2daadv·Created 6 months ago·Updated 21 days ago· 1
Expand Wildcards
    • prompts
    • total_variations
    raw_prompt
    max_variations100
    auto_refreshNo

    The wildcard trick is old - it predates ComfyUI, it's an A1111-era convention most people who arrived after 2024 never learned - and it's still the cheapest way to get real variety out of one prompt. Instead of writing "a woman with brown hair," you write "a woman with {__hair_colors__}" and let a list of options fill the blank at generation time. Expand Wildcards is this pack's implementation of that, built on the dynamicprompts library (the real thing, same engine that powers dynamic-prompts in A1111 - still actively used, ~106 reddit mentions by mid-2026).

    Here's the mechanism. You put text files with one option per line somewhere ComfyUI can see them. The node checks two places, in order: ComfyUI/wildcards/ first, then a wildcards/ folder inside the pack's own directory (it creates it for you). A file called colors.txt containing red/green/blue is referenced in your prompt as {__colors__}. The node then runs the CombinatorialPromptGenerator from dynamicprompts, which expands every placeholder in every combination and hands you back a list of concrete prompts.

    The inputs:

    • raw_prompt (required, multiline) - your template with {__name__} placeholders.
    • max_variations (optional, default 100, range 1–10000) - the cap on how many expansions you get. This is the one to actually think about: combinatorial expansion explodes fast, and 3 lists of 5 options is already 125 prompts. The cap is your safety valve.
    • auto_refresh (optional, No/Yes) - when Yes, the node reloads your wildcard files every run (it does this by returning NaN from IS_CHANGED, the always-rerun trick). Leave it No while editing files, then flip it Yes when you want live updates without restarting.

    Outputs: prompts - the expanded list of STRINGs - and total_variations, an INT telling you how many you actually got. Feed prompts into whatever node takes a prompt list and batches.

    Now the honest part. The wildcard feature is a genuine crowd-pleaser when it works, but the setup is where people stumble:

    • Path confusion. The README and the code agree on order - ComfyUI/wildcards/ wins, the pack's own folder is the fallback - but the pack's wildcards/ folder is created lazily on first run. If your files aren't being found, check where you put them, then check the log line [GadgetNodes] Loading wildcards from: <path> which prints the actual directory it's reading. That line saves you.
    • Syntax matters. It's the dynamicprompts dialect: {__colors__} for a wildcard file, {red|blue} for inline alternation. Mixing dialects confuses the generator.
    • Dependency. This is the one node in this pack that has a real third-party requirement - dynamicprompts==0.31.0 is pinned in requirements.txt. The clone + pip install -r requirements.txt step is not optional for it.

    The pack (2daadv/ComfyUI-GadgetNodes, MIT, one developer, brand new with no reputation yet) installs via ComfyUI Manager - search "GadgetNodes" - or clone + pip + restart. This node is pure Python, so it works on both the legacy canvas and Nodes 2.0.

    If you want to burn through variations on purpose - character sheets, lighting studies, the bracket-trick batch style from prompt-engineering - this is the node that turns one template into a whole batch without you typing anything else.

    CategoryGadget/prompt

    Inputs (3)

    NameTypeDefaultDescription
    raw_promptSTRING
    max_variationsoptINT1001–10000
    auto_refreshoptCOMBONo2 options: No, Yes

    Outputs (2)

    NameTypeDescription
    promptsSTRING
    total_variationsINT