Nodes/Prompt Preset Selector/Prompt Preset Selector (Wildcard)
ComfyUI Node

Prompt Preset Selector (Wildcard)

Wildcard presets from plain text files, with a keyword filter bolted on

By shin131002·Created 8 months ago·Updated 7 days ago· 2
Prompt Preset Selector (Wildcard)
    • text
    • preset_list
    • selected_info
    preset_file
    absolute_path
    keyword
    keyword_modeOFF
    selection_modeManual
    preset_index0
    seed0
    enable_wildcardtrue

    If you batch generations, you've hit the wall this node exists to smash: hand-editing a prompt between every queue is soul-crushing, and a single hardcoded prompt means 20 nearly identical images. This is a text node that picks a prompt line out of an external .txt, .yaml, or .yml file - think camera angles, clothing, lighting setups, an anime character database - and pushes it into your CLIP Text Encode. It's the wildcard variant of the pack's basic Preset Selector, and the extra enable_wildcard flag is the whole reason to pick it over the plain version.

    The wildcard angle is what you actually want. {A|B|C} choice syntax is the old A1111 bracket trick - {red|blue|green} dress picks one per run - and Impact Pack's __filename__ file reference made the same idea standard in ComfyUI. This node speaks both, plus Impact Pack's {__key__|__key__} YAML-key selection. So a preset like __colors__ {dress|suit|jacket} expands to "red dress", "blue suit", and so on, randomly or sequentially depending on your selection mode. That's batch variety without touching the prompt again.

    How it works

    Preset files load from three places, in priority order: whatever you type in absolute_path (this wins), the node's own presets/ folder, then Impact Pack's wildcards/ folder if it's installed - so it can reuse wildcard libraries you already own. YAML is flattened into one list: nested dicts get their key path prepended, so camera_angles.close_up becomes camera_angles:close_up: front view, low-angle shot..., and you can search by those keys.

    The interesting inputs, the ones you'll actually touch:

    • selection_mode - Manual (uses preset_index), Sequential, Sequential (continue), or Random (seeded, so same seed = same pick).
    • keyword + keyword_mode - the filter. front close-up -wide in AND mode means "must have front AND close-up, never wide". Quotes make phrases, a minus excludes, and a : suffix searches YAML keys. It's powerful and genuinely fiddly - keep the README open the first week.
    • enable_wildcard - wildcard expansion on/off. Leave it on; it does nothing if there's no wildcard syntax.

    Outputs: text (the selected, expanded prompt - that's the one that feeds your text encoder), preset_list (a numbered list of everything that matched your filter, handy for finding the right index), and selected_info (debug text telling you which preset won and how many got filtered out). The last two are a nice touch most preset nodes skip.

    Install

    ComfyUI Manager, search "Prompt Preset Selector", or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/shin131002/ComfyUI-Prompt-Preset-Selector
    

    Then restart ComfyUI. For YAML support it wants pip install pyyaml, but that ships with practically every ComfyUI install - the node just warns if it's missing. No model downloads, no heavy dependencies, and editing preset files doesn't even need a restart (they reload on execution, which the node makes a point of).

    Where people trip

    • absolute_path silently overrides the dropdown, and only .txt/.yaml/.yml extensions are accepted. On Windows use forward slashes even in an absolute path.
    • Filter doing nothing? keyword_mode is OFF by default. Flip it to AND or OR.
    • Exclusions quietly break if you type - wide; there can't be a space after the minus.
    • Searching a keyword like heroes will also match the wildcard choice line {__heroes__|__villains__}. The fix is searching heroes: instead, which only hits real key hierarchies.
    • {__key__|__key__} references keys within the currently selected YAML file - it doesn't reach into other files. That catches everyone once.

    One honest caveat: this is a solo, explicitly unsupported project - the README says bug reports may go unanswered and it's MIT, so forking is the fallback. It's not the pack for prompt curation at enterprise scale, but for a personal character or style library that you edit in a text editor, it's exactly right.

    Categorytext

    Inputs (8)

    NameTypeDefaultDescription
    preset_fileCOMBO1 options: (No preset files found)
    absolute_pathSTRING
    keywordSTRING
    keyword_modeCOMBOOFF3 options: OFF, AND, OR
    selection_modeCOMBOManual4 options: Manual, Sequential, Sequential (continue), Random
    preset_indexINT00–9999
    seedINT00–18446744073709550000
    enable_wildcardBOOLEANtrue

    Outputs (3)

    NameTypeDescription
    textSTRING
    preset_listSTRING
    selected_infoSTRING