Nodes/Caching to not Waste/Caching Wildcard List
ComfyUI Node

Caching Wildcard List

One random wildcard per line, not one random pick for the whole prompt

By alastor-666-1933·Created about a year ago·Updated about a year ago· 13
Caching Wildcard List
    • modified_text
    each_line
    wildcard_filexray.yaml

    First, the honesty: despite the "Caching" name, caching_wildcard_list is not a caching node. It has no cache folder, no identification, no force_recreate. What it actually is - and does well - is a wildcard expansion node with one specific superpower: it drafts a different random option for each line of your prompt, instead of the usual "one random pick applied to the whole prompt" behavior.

    The author's complaint that birthed it is real. Most wildcard nodes ship with almost no documentation about where the wildcard file is supposed to live, and they resolve the whole prompt with a single seed, so if you want each __wildcard__ in your prompt to pick a different option, they just... can't. This node reads its YAML, expands every placeholder per line, and deliberately does not depend on the current seed.

    How it works

    Put a .yaml file in ComfyUI/wildcards/ (that's the ComfyUI root, not your custom_nodes folder - this is the thing the author says other nodes never tell you). The node loads it, then for every line of your prompt it finds __placeholder__ patterns, looks up the matching key in the YAML, and picks a random option from that key's list. The trick: it remembers what it picked for that key and avoids repeating it, so consecutive lines don't come out identical. Nested wildcard paths (__characters/wizard__) and inline {this|that} alternatives are supported too. Unknown keys get left in place rather than silently dropped, which is friendlier than the alternatives.

    The inputs that matter

    Only two, and they're both required:

    • each_line - your prompt text, multiline. This is where the per-line behavior comes from: each line of this box is expanded independently, so you get variety across lines instead of one global roll.
    • wildcard_file - the filename of your YAML, e.g. xray.yaml. Just the name; it's always looked up in ComfyUI/wildcards/.

    Output: modified_text - the expanded string, which you feed into a CLIP Text Encode prompt input (or anywhere a prompt string goes). It also wires the input as a dynamic prompt, so ComfyUI knows the output changes run to run.

    Installing it

    Same pack, same steps:

    cd ComfyUI/custom_nodes
    git clone https://github.com/alastor-666-1933/caching_to_not_waste
    

    Restart ComfyUI. Or find Caching to not Waste in ComfyUI Manager. The one dependency - PyYAML - already ships with ComfyUI, so there's nothing extra to install.

    Where people get burned

    The file-not-found error is the number one trap: FileNotFoundError: File YAML 'xray.yaml' not found means you put the file somewhere other than ComfyUI/wildcards/. That's the entire fix, and it's the exact thing the author says the other wildcard nodes never explain. Past that, remember the node is a prompt variety tool - the "not depending on the seed" behavior is intentional, so don't expect seed-locked reproducibility if you're hunting a specific roll.

    Categorycaching_to_not_wast

    Inputs (2)

    NameTypeDefaultDescription
    each_lineSTRING
    wildcard_fileSTRINGxray.yaml

    Outputs (1)

    NameTypeDescription
    modified_textSTRING