Nodes/Sagado Nodes for ComfyUI/Wildcard Processor
ComfyUI Node

Wildcard Processor

The Prompt Box That Actually Expands Your Wildcards

By 5agado·Created about a year ago·Updated 3 days ago· 1
Wildcard Processor
    • text
    text
    seed0
    wildcard_chooserSelect wildcard to insert

    You write {blonde|brown|black} hair, {raining|windy|snowing} into a CLIP Text Encode, hit queue, and get… literal curly braces. Nothing expanded. That's not a bug: {a|b|c} and __wildcard__ were never built into ComfyUI's text box. They're processed by nodes - mostly the wildcard machinery that came in with Impact Pack - and a plain text widget just passes your braces through verbatim. It's a very normal afternoon to spend assuming otherwise.

    The Wildcard Processor is a standalone version of that processing, in one node, with no Impact Pack attached.

    What it does

    It takes a multiline string, expands the wildcards inside it using a seed, and emits the resolved text. That's the whole node. In the wider workflow it sits between whatever wrote the prompt and the CLIP Text Encode that consumes it - which sounds trivial, and is, until you want prompt variety across a batch, a character-reference sweep, or a scene list you keep in a text file.

    How the expansion works

    Random choices are made by the node's own function, seeded by the seed input - same seed plus same text gives the same output, change the seed and the picks change. So it's reproducible in a way that a bare {a|b} in a text box never is, and it's the reason this beats hand-editing prompts between runs.

    The option sources are:

    Your wildcard folder - <ComfyUI>/wildcards/, scanned recursively when the pack loads. .txt files are one option per line (blank lines skipped, and lines starting with # ignored). .yaml/.yml files are read as lists or nested dicts. Keys are normalized: lowercased, spaces to dashes, so Characters/Hero Faces.txt becomes __characters/hero-faces__.

    Inline alternatives - {a|b|c}, with weights as 3::option, forced multi-picks as {2$$a|b|c}, and a custom separator as {2-3$$, $$a|b|c}. There's also a repeat quantifier, 4#__my-wildcard__, and glob matching on keys, __char*__. Nested wildcards get unwrapped in a loop, so a wildcard whose options reference other wildcards resolves all the way down.

    If you've used A1111 or Impact Pack's processors, the syntax will feel familiar because it's the same lineage. If you haven't: this is old Automatic1111 prompt syntax that most people arriving after 2024 never learned.

    Inputs and output

    • text (multiline STRING) - your prompt, wildcards and all. You can wire an upstream STRING into it (an LLM node's output, for instance) and the expansion runs on whatever arrives, which is the point of having this as a node rather than typing into the encoder.
    • seed (INT, 0 to 2^64−1, default 0) - every choice in the string hangs off this.
    • wildcard_chooser - a helper dropdown, not a setting. Pick a wildcard and it drops __that-name__ into your text at the cursor, then flips back to "Select wildcard to insert". It never holds a selection, so don't sit there waiting for it to stick.
    • Output: text (STRING) - the expanded prompt. Wire it to CLIP Text Encode.

    Installing

    ComfyUI Manager → search "Sagado Nodes for ComfyUI", or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/5agado/ComfyUI-Sagado-Nodes
    cd ComfyUI-Sagado-Nodes && pip install -r requirements.txt
    

    Restart afterwards. The pack's requirements.txt is torch, pillow, numpy, ollama - the Ollama client is for its LLM nodes and this one doesn't need it. What this node does need (PyYAML for .yaml wildcards, aiohttp for its small reload/list API) already ships with ComfyUI itself, so the wildcard path works even if you skip the requirements step.

    Gotchas

    New wildcard files don't appear. The folder is scanned at import, and the chooser fetches its list once per page load. Restart ComfyUI, or hit the pack's reload route and refresh the tab:

    curl http://127.0.0.1:8188/sagado/wildcards/reload
    

    A malformed .yaml in your wildcards folder is not caught. The scanner only guards against encoding errors, and since it runs at import, a genuinely broken YAML can stop the pack registering at all - then all the Sagado nodes vanish from the menu. If the pack disappeared after you added a wildcard file, that's the first thing to check.

    An unknown __name__ is left in the output untouched. No error, no warning; it just lands in your prompt as literal underscores. Typos are silent here.

    # comment lines are stripped, but the line after one gets glued onto the line before it. Fine for comma-separated prompt text, mildly confusing if you're using line breaks for structure.

    Reruns are cached. The node has no reason to re-roll unless an input changes, so a fixed seed gives you the same prompt forever. Put control_after_generate on the seed for variety - and remember the seed trap: with the default "After" widget control mode, the seed in the box is the one for the next run, not the one you just got. Switching that to "Before" in the settings is the fix.

    CategorySagado-Nodes/text

    Inputs (3)

    NameTypeDefaultDescription
    textSTRING
    seedINT00–18446744073709550000
    wildcard_chooserCOMBOSelect wildcard to insert1 options: Select wildcard to insert

    Outputs (1)

    NameTypeDescription
    textSTRING