Nodes/ComfyUI-TagComplete/WildcardProcessor
ComfyUI Node

WildcardProcessor

WildcardProcessor rolls the dice for you

By huchukato·Created 8 months ago·Updated 4 days ago· 9
WildcardProcessor
    • processed_text
    text
    seed0
    populatetrue
    populated_text

    You know the drill: you want fifty images of the same girl in different outfits, or a batch where the background, the hair and the lighting all change while the subject holds still. The classic trick is A1111-style wildcard syntax - __color__ and {red|blue|green} - and until recently in ComfyUI that mostly meant installing the whole Impact Pack to get a node that expands it. WildcardProcessor does the same job in one node, no Impact Pack required. It ships inside ComfyUI-TagComplete, the tag-autocomplete extension, which is a weird place to find a prompt-processing node - but it's genuinely handy.

    What the syntax actually is

    Wildcards are just text files. A file named color.txt with one option per line becomes __color__, and the node picks a random line and splices it into your prompt. The other forms are the same idea with different dice:

    • {cat|dog|bird} - pick one option. This is the old A1111 bracket trick, and it nests: {__indoor__|__outdoor__} works, which v2.1.1 specifically fixed.
    • 2::portrait|1::landscape - weighted pick, so portrait comes up roughly two thirds of the time.
    • 3#__color__ - pick three items, space-separated. Note the README writes this as 3__color__, but the code wants the #. Real easy to burn a few minutes on that one.
    • Lines starting with # in your prompt are treated as comments and dropped, so you can leave yourself notes.

    One thing worth knowing: it matches wildcard names depth-agnostically. __sus__ finds sus.txt and act/sus.txt and anything else that ends in sus, so the exact path rarely matters. And it loads from a pile of places - its own wildcards/ folder, ComfyUI/models/wildcards/, DynamicPrompts' wildcards, and Impact Pack's folder plus its impact-pack.ini custom paths. If you've been collecting wildcard files for another extension, this node just sees them.

    The inputs that matter

    There are exactly two, which is refreshing.

    • text (required, multiline) - your prompt with wildcards and brackets in it.
    • seed (optional, default 0) - 0 means "roll fresh every time." Set any other number and the same text with the same seed gives the same result, which is how you reproduce a run or compare two wildcard sets fairly.

    The output is a single processed_text string. Wire it straight into a CLIP Text Encode's positive input and you're done. The node also shows the resolved text on its face after a run, so you can see exactly what the dice decided.

    Installing

    ComfyUI Manager works - search for ComfyUI-TagComplete. Or the old-fashioned way:

    cd ComfyUI/custom_nodes
    git clone https://github.com/huchukato/comfy-tagcomplete.git
    

    Restart ComfyUI. The node appears under the ComfyUI-TagComplete category, or just search "WildcardProcessor". There are no pip dependencies to worry about - the pack's requirements are empty, and the yaml/numpy it imports already ship with ComfyUI. Install is genuinely one step.

    Where people get burned

    • New wildcard files require a restart. The node builds its wildcard dictionary at startup, so dropping a new .txt into a wildcard folder and running won't pick it up until you reload.
    • It produces text, not a prompt. It's not an output node and it doesn't encode anything. If you expect an image out of the box, you forgot the CLIP Text Encode between it and your sampler.
    • Seed 0 is a trap for reproducibility. It's the default, and it means "random." If your batches keep coming out different and you wanted them identical, that's the culprit - set an explicit seed.
    • This is a small pack. The node is one file in a single-maintainer extension whose real business is tag autocomplete; v2.1.1 fixed the nasty nested-wildcard cases, so keep it updated if you lean on {__a__|__b__} syntax.

    Honest take: if you already run Impact Pack for FaceDetailer anyway, its wildcard nodes do the same thing and you don't need this. But if you want prompt variation without dragging in a whole detection pack, WildcardProcessor is the lean way to get it.

    CategoryComfyUI-TagComplete

    Inputs (4)

    NameTypeDefaultDescription
    textSTRINGEnter a prompt using wildcard syntax.
    seedoptINT00–18446744073709550000Seed for randomization (0 = random)
    populateoptBOOLEANtrueIf True, process wildcards. If False, return populated_text unchanged.
    populated_textoptSTRINGPaste here a previously populated prompt to reuse it when populate is False.

    Outputs (1)

    NameTypeDescription
    processed_textSTRING