Nodes/comfy-ovum/Escapable Wildcard Processor đŸ„š
ComfyUI Node

Escapable Wildcard Processor đŸ„š

Dynamic prompts in ComfyUI — wildcard files, random choices, and date stamps

By sfinktah·Created about a year ago·Updated 10 months ago· 7
Escapable Wildcard Processor đŸ„š
    • STRING
    ◄prompt—â–ș
    ◄seed0â–ș

    Prompt fatigue is real: batch 40 images with the same prompt and they all look the same. The Ovum Wildcard Processor is the fix - a prompt preprocessor that expands __wildcard__ syntax from text files, {choice|choice} alternatives, weighted options, multi-select ranges, and %date: stamps into a concrete prompt, driven by a seed so results are reproducible. It's the classic A1111-style wildcard workflow that most people arriving after 2024 never learned, and the KB's own prompt-engineering notes call the bracket trick one of the highest-leverage ways to get variety without writing more prompts. This node brings that whole bag into one node.

    How it works

    You feed it a prompt (multiline) and a seed, and it runs a pipeline: strip comments, apply the date/placeholder substitution, expand random-choice syntax, then resolve __wildcard__ references against text files in ComfyUI's user/wildcards folder. Because wildcard files can themselves contain wildcards, it loops up to ten passes to resolve nesting. The whole thing is engineered not to crash your run - an empty wildcard file or an unbalanced brace produces an [ERROR: ...] string in the output instead of a failed queue.

    The syntax that matters:

    • __filename__ - pulls a random line from user/wildcards/filename.txt. Subfolders work: __scenes/night__ reads user/wildcards/scenes/night.txt. Blank lines and # comments are skipped.
    • {a|b|c} - random pick, the bracket trick.
    • {3::option} - weighted choice: option appears 3 times in the pool.
    • {2-4$$ , $$ a|b|c} - multi-select: pick 2–4 options, joined by , .
    • %date:yyyy-MM-dd% - a live date stamp, great for filenames or logging.
    • Prefix modifiers on wildcards like __!name__ (lock to seed), __+name__ / __-name__ (increment/decrement), __*name__ (fresh random each hit).
    • A |word filter on a wildcard selects a line containing that word.

    Output is a single STRING - the fully expanded prompt - which you wire into your text encoder or sampler prompt.

    Why you'd reach for it

    Character-reference libraries, style variety, A/B looks - build a person/ folder of wildcard files describing different faces or outfits and batch a grid where each image gets a different combination, same seed discipline, fully reproducible. It also composes with the pack's text nodes: build a template in Python String Format, expand it here, feed the result downstream. It's the node that turns a static prompt into a generative prompt.

    Installing it

    Ships in comfy-ovum. ComfyUI Manager → search "comfy-ovum", or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/sfinktah/comfy-ovum
    

    Restart, find it under ovum/text. The wildcard files live in ComfyUI/user/wildcards/ - create it if it doesn't exist (older setups fall back to the built-in wildcards folder next to ComfyUI itself). The processor needs braceexpand, which is in the pack's requirements.txt; Manager installs it, and manual installs should pip install -r requirements.txt.

    The gotcha

    Wildcards are read from files, not remembered from a dropdown - if __thing__ shows up as an [ERROR], the file thing.txt doesn't exist or is empty. The seed matters more than it feels like: identical seed + identical wildcard files = identical expansion, which is either reproducibility (good) or "why is it the same every time" (check your seed isn't constant). And brace expansion runs after wildcard resolution, so unbalanced braces in a wildcard file surface as a clear error string rather than a silent mess. This is the most powerful node in the pack - worth the 20 minutes to set up a proper wildcard folder.

    Categoryovum/text

    Inputs (2)

    NameTypeDefaultDescription
    promptSTRING—
    seedINT00–18446744073709550000—

    Outputs (1)

    NameTypeDescription
    STRINGSTRING—