Nodes/DJZ-Nodes/Zenkai-Wildcard
ComfyUI Node

Zenkai-Wildcard

The $$ trick for prompt variety without an LLM

By MushroomFleet·Created 2 years ago·Updated 5 months ago· 78
Zenkai-Wildcard
    • STRING
    prompt
    seed0
    wildcard_symbol$$

    Wildcards are the oldest trick for prompt variety that isn't "call an LLM": drop a placeholder in your prompt, and every run rolls a fresh option from a list. Zenkai-Wildcard is DJZ-Nodes' version of that, and its one twist is the symbol - instead of __color__ or {a|b|c}, you write $$color. It ships with 85 theme files already loaded (colors, animals, emotions, biomes, the works), so you get useful variety on day one without writing a single list.

    It's part of the Zenkai prompt system inside DJZ-Nodes, Drift Johnson's prompt-engineering suite. If you're new to wildcards entirely: they're the non-LLM way to make "same prompt, different results" actually feel different - roll a color, an animal, a location, and you've got a batch that isn't forty identical cats. The KB's prompt-engineering essay flags {a|b|c} bracket syntax as the A1111-era trick most post-2024 users never learned; this node is the same idea with $$.

    How it works

    The mechanism is refreshingly plain. The node scans your prompt for the pattern $$name, then looks for wildcards/name.txt inside the pack directory, picks a random non-empty line, and substitutes it. Seeded, reproducible: same seed, same pick. If the file doesn't exist or is empty, the original $$name text is left in place - no error, so a typo'd wildcard silently stays in your prompt.

    That last bit is the trap. $$anmal in your prompt won't error; it'll just be sent to the CLIP encoder as literal text. Same if you get the filename wrong. The node logs what it's doing to the console, which is the debugging path when a prompt looks unfilled.

    Inputs and outputs

    • prompt - your text with $$name tokens
    • seed - reproducible randomness
    • wildcard_symbol - the token prefix, default $$. Change it if $$ collides with something else in your prompt (shell-escape quirks in some workflows make a rare custom symbol worth it).

    Output is a single STRING with all substitutions resolved - into a CLIP Text Encode or a Zenkai Prompt node. V1 does not handle nesting: if a wildcard file's lines contain other $$tokens, they won't be resolved. That's what V2 is for.

    Install

    ComfyUI Manager → search DJZ-Nodes, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/MushroomFleet/DJZ-Nodes
    cd DJZ-Nodes
    pip install -r requirements.txt
    

    Restart ComfyUI. Zero exotic dependencies - standard library only. If the node's missing, the pack's __init__.py silently skipped the import; check the console for "Unable to import ZenkaiWildcard".

    Troubleshooting

    Your own wildcard files go in custom_nodes/DJZ-Nodes/wildcards/<name>.txt, one option per line, and they just work - the node reads them from disk at run time, so no restart needed for new files. If a wildcard doesn't expand, check three things: the file exists, the token matches the filename exactly (case matters), and the file has at least one non-empty line. And remember the silent-in-place behavior - an unresolved $$something in your final image means a missing file, not a broken node.

    CategoryDJZ-Nodes

    Inputs (3)

    NameTypeDefaultDescription
    promptSTRING
    seedINT00–4294967295
    wildcard_symbolSTRING$$

    Outputs (1)

    NameTypeDescription
    STRINGSTRING