Nodes/ComfyUI-Prompto/Prompto Wildcards
ComfyUI Node

Prompto Wildcards

`{a|b}` that finally uses your own snippet library

By EY4O·Created 7 days ago·Updated 3 days ago· 0
Prompto Wildcards
    • text
    ◄text1girl, {silver|black|red} hair, __hair_color__►
    ◄seed0►

    Wildcards are the cheapest variety machine in image generation, and almost nobody uses them well. You write one prompt with a {brown|blonde|black} in it, batch it, and get a contact sheet of variations - same composition, different hair - which is how people build character reference libraries without training anything.

    Prompto Wildcards is a text box that resolves {a|b} choices and __snippet__ references, using your Prompto snippet library as the source of truth.

    What it is

    A STRING in, a STRING out, plus a seed. That's the entire schema, and it's the most flexible node in the pack because of it: it doesn't care what the text is for. A positive prompt, a negative, a filename fragment, a LoRA trigger phrase.

    The distinction from the wildcard support you may already have is where the vocabulary lives. Impact Pack's dynamic prompts - which quietly provide __wildcard__ and {a|b} to a large share of the ecosystem - read from text files on disk. This one reads the snippet library your Prompto Chrome extension syncs to ComfyUI, so __hair_color__ is a snippet you can edit in a side panel with a category and a prose variant, not a .txt file you have to go find.

    How it works

    Two syntaxes, both old A1111 habits that most people arriving after 2024 never learned:

    {this|that|the other} picks one option. That's it - no weights, no nesting requirement, and the node resolves them one at a time over repeated passes, up to forty, so a choice inside a choice still lands.

    __name__ is the interesting one. It resolves in two different ways depending on what it finds in your library:

    • Matching a snippet by name, it returns one of that snippet's tags. __hair_color__ where the snippet has silver, black, red will give you one of those three.
    • Matching a snippet category instead, it returns one whole snippet from that category - tags joined. So __lighting__, where lighting is a category with six snippets, gives you a complete lighting phrase per roll.

    Both comparisons are slugged (lowercased, non-alphanumerics to underscores), so Hair Color and hair_color are the same wildcard.

    The default text in the box - 1girl, {silver|black|red} hair, __hair_color__ - is a working demo of both.

    Cleanup is real, too: after expansion the node collapses ,, and trims stray leading or trailing commas, so a wildcard that resolves to nothing doesn't leave a syntax mess in your prompt.

    Seeding, which is the whole trick

    seed is the variation control. Same seed and same library, same text, every time - so you can find a roll you like, switch the widget to fixed, and keep it. Put it on randomize and every queue is a different combination, which is how you get a 32-image variation batch out of one prompt.

    This also interacts with caching in a way worth knowing. The node declares its change state as a function of the library's sync timestamp plus its own inputs, so a sync in Chrome makes it re-run - it doesn't sit on a stale string because nothing upstream moved.

    Install

    cd ComfyUI/custom_nodes
    git clone https://github.com/EY4O/ComfyUI-Prompto.git
    

    Restart ComfyUI. No Python dependencies beyond ComfyUI, no models, no download step; the pack declares an empty dependency list. ComfyUI Manager → search Prompto is the other route.

    Your own snippet library needs the Prompto Chrome extension, currently unpublished - load it unpacked from its folder through chrome://extensions → Developer mode → Load unpacked. After it syncs, press R in the ComfyUI tab: the node's snippet vocabulary is read when node definitions load. Seven sample snippets ship in samples.json, so __name__ works before you've installed anything.

    Where people get burned

    An unresolved __name__ stays in your prompt as literal text. If no snippet or category matches, the token passes through untouched - so __hair_colour__ with the British spelling on a library that has the American one ends up in front of the model as six tokens of nonsense. It doesn't error and it doesn't warn. Count your underscores if output looks oddly insensitive.

    Same seed, same roll - including the boring ones. A two-option {a|b} gives you two outcomes across a batch of 32. If you want real spread, put more variety in the snippet than in the braces.

    Keep snippets short. Wildcards invite you to write a paragraph with six slots in it; each roll then makes a long prompt with six variables, which is where attribute bleed starts. A few strong concepts is what the models actually want.

    Editing a snippet changes every workflow using it. That's the point, and it's also a footgun when you go back to a setup that worked last month - the saved seed no longer produces the saved image, because the vocabulary moved. Duplicate a snippet if you want to experiment.

    CategoryPrompto

    Inputs (2)

    NameTypeDefaultDescription
    textSTRING1girl, {silver|black|red} hair, __hair_color__—
    seedINT00–4294967295—

    Outputs (1)

    NameTypeDescription
    textSTRING—