Nodes/ComfyUI Local Wildcards/Local Wildcard Text
ComfyUI Node

Local Wildcard Text

Local Wildcard Text

By DutchyDutch·Created 2 months ago·Updated about a month ago· 4
Local Wildcard Text
    • text
    • used_seed
    textA photo of __color__
    insert_wildcard
    seed_modefixed
    seed0

    Local Wildcard Text is the whole point of the ComfyUI Local Wildcards pack - one node that expands __wildcard__ tokens and {this|that} dynamic prompts into a real string before it ever reaches your text encoder. The name is a hint: it's fully local. No API, no key, no model download, no heavy dependencies. It's written as a lightweight replacement for older wildcard nodes that stopped being maintained, and honestly it's the one I'd reach for if I want prompt randomization without bolting on a whole prompt-engineering framework.

    If you've ever batch-generated 32 images and gotten "woman with brown hair in a rainy street" 32 times, this is the fix. The old A1111 crowd cracked this problem ages ago with the bracket trick - {brown|blonde|black} hair while it is {raining|windy|snowing} - and it's still the cheapest way to get variety without an LLM rewriting your prompt. This node brings that syntax into ComfyUI properly, with file-based wildcards, nesting, and seeds on top.

    How it works

    The node parses your prompt, expanding innermost {...} blocks and __token__ references repeatedly (up to 50 passes) until nothing changes. That recursion is what makes nesting work: a wildcard result can itself contain more wildcards or dynamic prompts, and they all get resolved. It supports .txt, .yaml/.yml, and .json wildcard files, plus globbing (__folder/*__ picks a random file inside a folder).

    Beyond the basics, the syntax does real work:

    • {red::0.2|blue::0.8} - weighted choices, so blue shows up four times as often
    • {2$$red|blue|green} - pick exactly two
    • {1-3$$ and $$red|blue|green} - pick a random count, joined with " and "
    • \{, \|, \$, \_ - escape characters when you need them literally

    There's also an insert_wildcard dropdown that lists every detected wildcard, grouped by folder, so you don't have to remember filenames. You can build a prompt without typing a single __.

    The inputs that matter

    • text (multiline) - your prompt template with __wildcards__ and {choices} baked in. The default is A photo of __color__, and the pack ships a sample color.txt (red/green/blue) so it works out of the box.
    • seed_mode - fixed or random. Fixed reuses the seed you give it; random rolls a new one every run.
    • seed - the seed that drives the random picks. Same seed + same wildcard files = same combination, every time.

    Outputs: text (the fully expanded, clean prompt - wire it into a CLIP Text Encode positive input) and used_seed (the seed that was actually used, which matters because in random mode the node picks a fresh one). The node also shows a live preview with resolved parts wrapped in 【 】 so you can see what got substituted without it polluting the real output.

    Install

    Via ComfyUI Manager, search ComfyUI Local Wildcards and hit Install. Or, by hand:

    cd ComfyUI/custom_nodes
    git clone https://github.com/DutchyDutch/ComfyUI_Local_Wildcards.git
    

    Then restart ComfyUI. No requirements to pip-install, no models to fetch - the pack is pure standard-library Python.

    Where people get burned

    • Which folder are your files in? The code scans custom_nodes/ComfyUI_Local_Wildcards/wildcards/, while the current README talks about a newer ComfyUI/user/ComfyUI_Local_Wildcards/ home with auto-migration. If your dropdown shows "No wildcards found," check which one you're actually editing.
    • Stale dropdown. New files are picked up automatically when the node runs, but an insert_wildcard dropdown on an already-placed node can go stale - add a fresh node or reload if it doesn't show what you just added.
    • Escaping. If your model prompt legitimately contains braces, you'll get random choices injected until you escape them with \{.

    The reproducible-seed behavior is the sleeper feature: set seed_mode to fixed, and you can lock in a lucky combination, or pipe used_seed into your workflow to rebuild it later.

    CategoryLocal Wildcards

    Inputs (4)

    NameTypeDefaultDescription
    textSTRINGA photo of __color__
    insert_wildcardCOMBO3 options: Select wildcard to insert, • 𝐑𝐨𝐨𝐭, __color__
    seed_modeCOMBOfixed2 options: fixed, random
    seedINT00–9007199254740991

    Outputs (2)

    NameTypeDescription
    textSTRING
    used_seedINT